playbook_ui 14.17.0.pre.alpha.play1966highchartsgaugedefaultpoc7347 → 14.17.0.pre.alpha.play2065passphrasewithselect7273
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_copy_button/_copy_button.tsx +45 -19
- data/app/pb_kits/playbook/pb_copy_button/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_copy_button/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_table/_table.tsx +2 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +1 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows_rails.md +1 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +1 -3
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md +1 -3
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +1 -1
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +5 -13
- data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_text_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +1 -8
- data/dist/chunks/_typeahead-BY6AFq1l.js +22 -0
- data/dist/chunks/_weekday_stacked-BwWArBYi.js +45 -0
- data/dist/chunks/lib-BGzBzFZX.js +29 -0
- data/dist/chunks/{pb_form_validation-DUYz51EH.js → pb_form_validation-BvNy9Bd6.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -19
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -14
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx +0 -54
- data/app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md +0 -3
- data/app/pb_kits/playbook/pb_copy_button/usePBCopy.ts +0 -45
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +0 -31
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +0 -83
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.jsx +0 -94
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.md +0 -1
- data/dist/chunks/_typeahead-Bj5y64Ch.js +0 -22
- data/dist/chunks/_weekday_stacked-DmUdsm2C.js +0 -45
- data/dist/chunks/lib-CmHH0j0i.js +0 -29
@@ -1 +1 @@
|
|
1
|
-
import WebpackerReact from"webpacker-react";import{B as BarGraph,C as CircleChart,D as Dialog,a as DialogBody,b as DialogFooter,c as DialogHeader,d as DistributionBar,M as MultiLevelSelect,L as Legend,e as LineGraph,P as Passphrase,R as RichTextEditor,T as TreemapChart,f as Typeahead,G as Gauge,g as PhoneNumberInput}from"./chunks/_typeahead-
|
1
|
+
import WebpackerReact from"webpacker-react";import{B as BarGraph,C as CircleChart,D as Dialog,a as DialogBody,b as DialogFooter,c as DialogHeader,d as DistributionBar,M as MultiLevelSelect,L as Legend,e as LineGraph,P as Passphrase,R as RichTextEditor,T as TreemapChart,f as Typeahead,G as Gauge,g as PhoneNumberInput}from"./chunks/_typeahead-BY6AFq1l.js";import"react/jsx-runtime";import"react";import"./chunks/lib-BGzBzFZX.js";import"react-dom";import"react-trix";import"trix";import"react-is";var ujs$1={};Object.defineProperty(ujs$1,"__esModule",{value:true});var ujs={handleEvent:function handleEvent(eventName,callback){var _ref=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{once:false},once=_ref.once;var $=typeof window.jQuery!=="undefined"&&window.jQuery;if($){if(once){$(document).one(eventName,callback)}else{$(document).on(eventName,callback)}}else{document.addEventListener(eventName,callback,{once:once})}},setup:function setup(onMount,onUnmount){var $=typeof window.jQuery!=="undefined"&&window.jQuery;var Turbolinks=window.Turbolinks;if(typeof Turbolinks!=="undefined"&&Turbolinks.supported){if(typeof Turbolinks.EVENTS!=="undefined"){this.turbolinksClassic(onMount,onUnmount)}else if(typeof Turbolinks.controller!=="undefined"){this.turbolinks5(onMount,onUnmount)}else{this.turbolinksClassicDeprecated(onMount,onUnmount)}}else if($&&typeof $.pjax==="function"){this.pjax(onMount,onUnmount)}else{this.native(onMount)}},turbolinks5:function turbolinks5(onMount,onUnmount){this.handleEvent("turbolinks:load",onMount,{once:true});this.handleEvent("turbolinks:render",onMount);this.handleEvent("turbolinks:before-render",onUnmount)},turbolinksClassic:function turbolinksClassic(onMount,onUnmount){var Turbolinks=window.Turbolinks;this.handleEvent(Turbolinks.EVENTS.CHANGE,onMount);this.handleEvent(Turbolinks.EVENTS.BEFORE_UNLOAD,onUnmount)},turbolinksClassicDeprecated:function turbolinksClassicDeprecated(onMount,onUnmount){var Turbolinks=window.Turbolinks;Turbolinks.pagesCached(0);this.handleEvent("page:change",onMount);this.handleEvent("page:receive",onUnmount)},pjax:function pjax(onMount,onUnmount){this.handleEvent("ready",onMount);this.handleEvent("pjax:end",onMount);this.handleEvent("pjax:beforeReplace",onUnmount)},native:function native(onMount){var $=typeof window.jQuery!=="undefined"&&window.jQuery;if($){$((function(){return onMount()}))}else if("addEventListener"in window){document.addEventListener("DOMContentLoaded",onMount)}else{window.attachEvent("onload",onMount)}}};var _default=ujs$1.default=ujs;WebpackerReact.registerComponents({BarGraph:BarGraph,CircleChart:CircleChart,Dialog:Dialog,DialogBody:DialogBody,DialogFooter:DialogFooter,DialogHeader:DialogHeader,DistributionBar:DistributionBar,MultiLevelSelect:MultiLevelSelect,Legend:Legend,LineGraph:LineGraph,Passphrase:Passphrase,RichTextEditor:RichTextEditor,TreemapChart:TreemapChart,Typeahead:Typeahead,Gauge:Gauge,PhoneNumberInput:PhoneNumberInput});_default.setup((()=>WebpackerReact.mountComponents()),(()=>WebpackerReact.unmountComponents()));
|
data/dist/playbook-rails.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:true,configurable:true,writable:true,value:value}):obj[key]=value;var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!=="symbol"?key+"":key,value);import{P as PbEnhancedElement,f as formHelper,a as datePickerHelper,b as dialogHelper,c as PbPopover,e as PbTooltip,g as PbTypeahead,h as PbTable,i as PbTextarea}from"./chunks/lib-CmHH0j0i.js";import{I as INPUTMASKS}from"./chunks/_typeahead-Bj5y64Ch.js";import"./chunks/pb_form_validation-DUYz51EH.js";import"./chunks/lazysizes-B7xYodB-.js";import"./playbook-rails-react-bindings.js";import"react";import"react/jsx-runtime";import"react-dom";import"react-trix";import"trix";import"react-is";import"webpacker-react";class PbTextInput extends PbEnhancedElement{static get selector(){return'[data-pb-input-mask="true"]'}connect(){this.handleInput=this.handleInput.bind(this);this.element.addEventListener("input",this.handleInput);this.handleInput()}disconnect(){this.element.removeEventListener("input",this.handleInput)}handleInput(){var _a;const maskType=this.element.getAttribute("mask");const cursorPosition=this.element.selectionStart;const rawValue=this.element.value;let formattedValue=rawValue;const maskKey={currency:"currency",ssn:"ssn",postal_code:"postalCode",zip_code:"zipCode",credit_card:"creditCard",cvv:"cvv"}[maskType];if(maskKey&&INPUTMASKS[maskKey]){formattedValue=INPUTMASKS[maskKey].format(rawValue)}const sanitizedInput=(_a=this.element.closest(".text_input_wrapper"))==null?void 0:_a.querySelector('[data="sanitized-pb-input"]');if(sanitizedInput){switch(maskType){case"ssn":sanitizedInput.value=sanitizeSSN(formattedValue);break;case"currency":sanitizedInput.value=sanitizeCurrency(formattedValue);break;case"credit_card":sanitizedInput.value=sanitizeCreditCard(formattedValue);break;default:sanitizedInput.value=formattedValue}}this.element.value=formattedValue;setCursorPosition(this.element,cursorPosition,rawValue,formattedValue)}}function sanitizeSSN(input){return input.replace(/\D/g,"")}function sanitizeCurrency(input){return input.replace(/[$,]/g,"")}function sanitizeCreditCard(input){return input.replace(/\D/g,"")}function setCursorPosition(inputElement,cursorPosition,rawValue,formattedValue){const difference=formattedValue.length-rawValue.length;const newPosition=Math.max(0,cursorPosition+difference);requestAnimationFrame((()=>{inputElement.setSelectionRange(newPosition,newPosition)}))}class PbCopyButton extends PbEnhancedElement{static get selector(){return".pb_copy_button_kit"}connect(){this.handleClick=this.handleClick.bind(this);this.button=this.element.querySelector("button");if(this.button){this.button.addEventListener("click",this.handleClick)}}disconnect(){if(this.button){this.button.removeEventListener("click",this.handleClick)}}handleClick(){const fromId=this.element.getAttribute("data-from");if(fromId){const fromElement=document.querySelector(`#${fromId}`);if(fromElement){let contentToCopy="";if(fromElement.tagName.toLowerCase()==="input"){contentToCopy=fromElement.value}else{contentToCopy=fromElement.innerText}navigator.clipboard.writeText(contentToCopy).catch((err=>console.error("Failed to copy text",err)));return}}const textToCopy=this.element.getAttribute("data-copy-value");if(textToCopy){navigator.clipboard.writeText(textToCopy).catch((err=>console.error("Failed to copy text",err)))}else{console.warn("No data-copy-value attribute found or data-from element")}}}class PbDrawer extends PbEnhancedElement{static get selector(){return".pb_drawer_wrapper"}connect(){this.handleToggleClick=this.handleToggleClick.bind(this);this.handleOutsideClick=this.handleOutsideClick.bind(this);this.handleResize=this.handleResize.bind(this);this._toggleTriggers=Array.from(document.querySelectorAll("[data-open-drawer]"));this._toggleTriggers.forEach((el=>{el.addEventListener("click",this.handleToggleClick)}));this._wrappers=Array.from(document.querySelectorAll(".pb_drawer_wrapper"));this._wrappers.forEach((el=>{el.addEventListener("mousedown",this.handleOutsideClick)}));this._withinElementDrawers=Array.from(document.querySelectorAll(".pb_drawer_within_element_rails[data-breakpoint]"));window.addEventListener("resize",this.handleResize);this.handleResize()}disconnect(){this._toggleTriggers.forEach((el=>{el.removeEventListener("click",this.handleToggleClick)}));this._wrappers.forEach((el=>{el.removeEventListener("mousedown",this.handleOutsideClick)}));window.removeEventListener("resize",this.handleResize)}getOverlay(wrapper){if(wrapper.id&&wrapper.id.startsWith("drawer-wrapper-")){const overlayId=wrapper.id.replace("drawer-wrapper-","drawer-overlay-");return document.getElementById(overlayId)}return wrapper.querySelector(".pb_drawer_overlay")||wrapper.querySelector(".pb_drawer_no_overlay")}handleToggleClick(event){const trigger=event.currentTarget;const drawerId=trigger.dataset.openDrawer;const dialog=document.getElementById(drawerId);if(!dialog)return;if(dialog.classList.contains("pb_drawer_within_element_rails")){if(dialog.classList.contains("open")){this.closeWithinElementDrawer(dialog);dialog.dataset.manualOpen="false"}else{this.openWithinElementDrawer(dialog);dialog.dataset.manualOpen="true"}return}const wrapperId=`drawer-wrapper-${drawerId}`;const wrapper=document.getElementById(wrapperId);if(!wrapper)return;if(wrapper!==this.element)return;if(wrapper.classList.contains("open")){this.closeDrawer(wrapper,dialog);wrapper.dataset.manualOpen="false"}else{this.openDrawer(wrapper,dialog);wrapper.dataset.manualOpen="true"}}openWithinElementDrawer(dialog){if(dialog.classList.contains("open"))return;dialog.style.maxHeight="0px";dialog.offsetHeight;dialog.classList.add("open");const trigger=document.querySelector(`[data-open-drawer="${dialog.id}"]`);const triggerHeight=trigger?trigger.offsetHeight:0;const finalHeight=dialog.scrollHeight+triggerHeight+"px";dialog.style.maxHeight=finalHeight;dialog.addEventListener("transitionend",(function handleOpenEnd(e){if(e.propertyName==="max-height"){dialog.style.maxHeight="none";dialog.removeEventListener("transitionend",handleOpenEnd)}}))}closeWithinElementDrawer(dialog){if(!dialog.classList.contains("open"))return;const currentHeight=dialog.scrollHeight;dialog.style.maxHeight=currentHeight+"px";dialog.offsetHeight;dialog.classList.remove("open");dialog.style.maxHeight="0px";dialog.addEventListener("transitionend",(function handleCloseEnd(e){if(e.propertyName==="max-height"){dialog.removeEventListener("transitionend",handleCloseEnd);dialog.style.maxHeight="0px"}}))}openDrawer(wrapper,dialog){const behavior=wrapper.dataset.behavior;const size=wrapper.dataset.size;const placement=wrapper.dataset.placement;this.handlePushOpen(behavior,size,placement);wrapper.style.display="";const overlay=this.getOverlay(wrapper);if(overlay)overlay.style.display="";wrapper.classList.add("open");dialog.classList.add("open")}closeDrawer(wrapper,dialog){const behavior=wrapper.dataset.behavior;this.handlePushClose(behavior);if(wrapper.className.includes("open"))wrapper.style.display="none";const overlay=this.getOverlay(wrapper);if(overlay&&wrapper.className.includes("open"))overlay.style.display="none";wrapper.classList.remove("open");dialog.classList.remove("open")}handleOutsideClick(event){const wrapper=event.currentTarget;const dialog=wrapper.querySelector(".pb_drawer");const overlay=this.getOverlay(wrapper);if(dialog&&dialog.classList.contains("pb_drawer_within_element_rails")){return}if(wrapper.dataset.overlayClick==="overlay_close"&&event.target===overlay){this.closeDrawer(wrapper,dialog);event.stopPropagation();return}const dialogRect=dialog.getBoundingClientRect();const clickedOutside=event.clientX<dialogRect.left||event.clientX>dialogRect.right||event.clientY<dialogRect.top||event.clientY>dialogRect.bottom;if(clickedOutside){this.closeDrawer(wrapper,dialog);event.stopPropagation()}}handleResize(){const breakpointValues={none:0,xs:575,sm:768,md:992,lg:1200,xl:1400};this._wrappers.forEach((wrapper=>{const bp=wrapper.dataset.breakpoint||"none";if(bp==="none")return;const threshold=breakpointValues[bp]||0;const dialog=wrapper.querySelector(".pb_drawer");const trigger=dialog?document.querySelector(`[data-open-drawer="${dialog.id}"]`):null;if(window.innerWidth>=threshold){if(!wrapper.classList.contains("open")){this.openDrawer(wrapper,dialog)}if(trigger)trigger.style.display="none"}else{if(trigger)trigger.style.display="";if(wrapper.classList.contains("open")&&wrapper.dataset.manualOpen!=="true"){this.closeDrawer(wrapper,dialog)}}}));this._withinElementDrawers.forEach((drawer=>{const bp=drawer.dataset.breakpoint||"none";if(bp==="none")return;const threshold=breakpointValues[bp]||0;const trigger=document.querySelector(`[data-open-drawer="${drawer.id}"]`);if(window.innerWidth>=threshold){if(!drawer.classList.contains("open")){this.openWithinElementDrawer(drawer)}if(trigger)trigger.style.display="none"}else{if(trigger)trigger.style.display="";if(drawer.classList.contains("open")&&drawer.dataset.manualOpen!=="true"){this.closeWithinElementDrawer(drawer)}}}))}handlePushOpen(behavior,size,placement){if(behavior!=="push")return;const sizeMap={xl:"365px",lg:"300px",md:"250px",sm:"200px",xs:"64px",full:"100%"};const body=document.querySelector("body");if(!body)return;if(placement==="left"){body.style.cssText=`margin-left: ${sizeMap[size]} !important; margin-right: '' !important;`}else if(placement==="right"){body.style.cssText=`margin-right: ${sizeMap[size]} !important; margin-left: '' !important;`}body.classList.add("PBDrawer__Body--open")}handlePushClose(behavior){if(behavior!=="push")return;const body=document.querySelector("body");if(!body)return;if(body.classList.contains("PBDrawer__Body--open")){body.classList.add("PBDrawer__Body--close")}body.style.cssText="";body.classList.remove("PBDrawer__Body--open")}}const MAIN_SELECTOR="[data-collapsible-main]";const CONTENT_SELECTOR="[data-collapsible-content]";const DOWN_ARROW_SELECTOR$2="#collapsible_open_icon";const UP_ARROW_SELECTOR$2="#collapsible_close_icon";class PbCollapsible extends PbEnhancedElement{static get selector(){return MAIN_SELECTOR}connect(){this.element.addEventListener("click",(()=>{this.toggleElement(this.target)}));if(this.target.classList.contains("is-visible")){this.displayUpArrow()}else{this.displayDownArrow()}document.addEventListener(`${this.target.id}`,(()=>{this.toggleElement(this.target)}))}get target(){return this.element.parentNode.querySelector(CONTENT_SELECTOR)}showElement(elem){const getHeight=()=>{elem.style.display="block";const height2=elem.scrollHeight+"px";elem.style.display="";return height2};const height=getHeight();elem.classList.add("is-visible");elem.style.height=height;elem.style.overflow="hidden";window.setTimeout((()=>{elem.style.height="";elem.style.overflow="visible"}),300)}hideElement(elem){elem.style.height=elem.scrollHeight+"px";window.setTimeout((()=>{elem.style.height="0";elem.style.paddingTop="0";elem.style.paddingBottom="0";elem.style.overflow="hidden"}),1);window.setTimeout((()=>{elem.classList.remove("is-visible");elem.style.overflow=""}),300)}toggleElement(elem){if(elem.classList.contains("is-visible")){this.hideElement(elem);this.displayDownArrow();return}this.showElement(elem);this.displayUpArrow()}toggleArrows(showDownArrow){const downArrow=this.element.querySelector(DOWN_ARROW_SELECTOR$2);const upArrow=this.element.querySelector(UP_ARROW_SELECTOR$2);if(downArrow){downArrow.style.display=showDownArrow?"inline-block":"none"}if(upArrow){upArrow.style.display=showDownArrow?"none":"inline-block"}}displayDownArrow(){this.toggleArrows(true)}displayUpArrow(){this.toggleArrows(false)}}class PbFixedConfirmationToast extends PbEnhancedElement{static get selector(){return'[class*="pb_fixed_confirmation_toast_kit"]'}connect(){this.self=this.element;this.autoCloseToast(this.self);if(this.self.classList.contains("remove_toast")){this.self.addEventListener("click",(()=>{this.removeToast(this.self)}))}}removeToast(elem){elem.parentNode.removeChild(elem)}autoCloseToast(element){const classListValues=element.classList.value;const hasAutoCloseClass=classListValues.includes("auto_close");if(hasAutoCloseClass){const classList=classListValues.split(" ");const autoCloseValue=classList[classList.length-1].split("_")[2];const autoCloseIntValue=parseInt(autoCloseValue);setTimeout((()=>{this.removeToast(element)}),autoCloseIntValue)}}}const OPTION_SELECTOR$1="[data-dropdown-option-label]";class PbDropdownKeyboard{constructor(dropdown){this.dropdown=dropdown;this.dropdownElement=dropdown.element;this.options=Array.from(this.dropdownElement.querySelectorAll(OPTION_SELECTOR$1));this.focusedOptionIndex=-1;this.init()}init(){this.dropdownElement.addEventListener("keydown",this.handleKeyDown.bind(this))}handleKeyDown(event){switch(event.key){case"ArrowDown":event.preventDefault();if(!this.dropdown.target.classList.contains("open")){this.dropdown.showElement(this.dropdown.target);this.dropdown.updateArrowDisplay(true)}this.moveFocus(1);break;case"ArrowUp":event.preventDefault();this.moveFocus(-1);break;case"Enter":event.preventDefault();if(this.focusedOptionIndex!==-1){this.selectOption()}else{if(!this.dropdown.target.classList.contains("open")){this.dropdown.showElement(this.dropdown.target);this.dropdown.updateArrowDisplay(true)}}break;case"Escape":this.dropdown.hideElement(this.dropdown.target);break;case"Tab":this.dropdown.hideElement(this.dropdown.target);this.dropdown.updateArrowDisplay(false);this.resetFocus();break}}moveFocus(direction){if(this.focusedOptionIndex!==-1){this.options[this.focusedOptionIndex].classList.remove("pb_dropdown_option_focused")}this.focusedOptionIndex=(this.focusedOptionIndex+direction+this.options.length)%this.options.length;this.options[this.focusedOptionIndex].classList.add("pb_dropdown_option_focused")}selectOption(){const option=this.options[this.focusedOptionIndex];this.dropdown.onOptionSelected(option.dataset.dropdownOptionLabel,option);this.dropdown.hideElement(this.dropdown.target)}}const DROPDOWN_SELECTOR="[data-pb-dropdown]";const TRIGGER_SELECTOR="[data-dropdown-trigger]";const CONTAINER_SELECTOR="[data-dropdown-container]";const DOWN_ARROW_SELECTOR$1="#dropdown_open_icon";const UP_ARROW_SELECTOR$1="#dropdown_close_icon";const OPTION_SELECTOR="[data-dropdown-option-label]";const CUSTOM_DISPLAY_SELECTOR="[data-dropdown-custom-trigger]";const DROPDOWN_TRIGGER_DISPLAY="#dropdown_trigger_display";const DROPDOWN_PLACEHOLDER="[data-dropdown-placeholder]";const DROPDOWN_INPUT="#dropdown-selected-option";class PbDropdown extends PbEnhancedElement{static get selector(){return DROPDOWN_SELECTOR}get target(){return this.element.parentNode.querySelector(CONTAINER_SELECTOR)}connect(){this.keyboardHandler=new PbDropdownKeyboard(this);this.setDefaultValue();this.bindEventListeners();this.updateArrowDisplay(false);this.handleFormValidation();this.handleFormReset()}bindEventListeners(){const customTrigger=this.element.querySelector(CUSTOM_DISPLAY_SELECTOR)||this.element;customTrigger.addEventListener("click",(()=>this.toggleElement(this.target)));this.target.addEventListener("click",this.handleOptionClick.bind(this));document.addEventListener("click",this.handleDocumentClick.bind(this),true)}handleOptionClick(event){const option=event.target.closest(OPTION_SELECTOR);const hiddenInput=this.element.querySelector(DROPDOWN_INPUT);if(option){const value=option.dataset.dropdownOptionLabel;hiddenInput.value=JSON.parse(value).id;this.clearFormValidation(hiddenInput);this.onOptionSelected(value,option)}}handleDocumentClick(event){if(this.isClickOutside(event)&&this.target.classList.contains("open")){this.hideElement(this.target);this.updateArrowDisplay(false)}}isClickOutside(event){const customTrigger=this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);if(customTrigger){return!customTrigger.contains(event.target)}else{const triggerElement=this.element.querySelector(TRIGGER_SELECTOR);const containerElement=this.element.parentNode.querySelector(CONTAINER_SELECTOR);const isOutsideTrigger=triggerElement?!triggerElement.contains(event.target):true;const isOutsideContainer=containerElement?!containerElement.contains(event.target):true;return isOutsideTrigger&&isOutsideContainer}}onOptionSelected(value,selectedOption){const triggerElement=this.element.querySelector(DROPDOWN_TRIGGER_DISPLAY);const customDisplayElement=this.element.querySelector("#dropdown_trigger_custom_display");if(triggerElement){const selectedLabel=JSON.parse(value).label;triggerElement.textContent=selectedLabel;if(customDisplayElement){customDisplayElement.style.display="block";customDisplayElement.style.paddingRight="8px"}}const customTrigger=this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);if(customTrigger){if(this.target.classList.contains("open")){this.hideElement(this.target);this.updateArrowDisplay(false)}}const options=this.element.querySelectorAll(OPTION_SELECTOR);options.forEach((option=>{option.classList.remove("pb_dropdown_option_selected")}));selectedOption.classList.add("pb_dropdown_option_selected")}showElement(elem){elem.classList.remove("close");elem.classList.add("open");elem.style.height=elem.scrollHeight+"px"}hideElement(elem){elem.style.height=elem.scrollHeight+"px";window.setTimeout((()=>{elem.classList.add("close");elem.classList.remove("open");this.resetFocus()}),0)}resetFocus(){if(this.keyboardHandler){this.keyboardHandler.focusedOptionIndex=-1;const options=this.element.querySelectorAll(OPTION_SELECTOR);options.forEach((option=>option.classList.remove("pb_dropdown_option_focused")))}}toggleElement(elem){if(elem.classList.contains("open")){this.hideElement(elem);this.updateArrowDisplay(false);return}this.showElement(elem);this.updateArrowDisplay(true)}updateArrowDisplay(isOpen){const downArrow=this.element.querySelector(DOWN_ARROW_SELECTOR$1);const upArrow=this.element.querySelector(UP_ARROW_SELECTOR$1);if(downArrow&&upArrow){downArrow.style.display=isOpen?"none":"inline-block";upArrow.style.display=isOpen?"inline-block":"none"}}handleFormValidation(){const hiddenInput=this.element.querySelector(DROPDOWN_INPUT);hiddenInput.addEventListener("invalid",(function(event){if(hiddenInput.hasAttribute("required")&&hiddenInput.value===""){event.preventDefault();hiddenInput.closest(".dropdown_wrapper").classList.add("error")}}),true)}clearFormValidation(input){if(input.checkValidity()){const dropdownWrapperElement=input.closest(".dropdown_wrapper");dropdownWrapperElement.classList.remove("error");const errorLabelElement=dropdownWrapperElement.querySelector(".pb_body_kit_negative");if(errorLabelElement){errorLabelElement.remove()}}}setDefaultValue(){const hiddenInput=this.element.querySelector(DROPDOWN_INPUT);const options=this.element.querySelectorAll(OPTION_SELECTOR);const defaultValue=hiddenInput.dataset.defaultValue||"";hiddenInput.value=defaultValue;if(defaultValue){const selectedOption=Array.from(options).find((option=>JSON.parse(option.dataset.dropdownOptionLabel).id===defaultValue));selectedOption.classList.add("pb_dropdown_option_selected");this.setTriggerElementText(JSON.parse(selectedOption.dataset.dropdownOptionLabel).label)}}handleFormReset(){const form=this.element.closest("form");if(form){form.addEventListener("reset",(()=>{this.resetDropdownValue()}))}}resetDropdownValue(){const hiddenInput=this.element.querySelector(DROPDOWN_INPUT);const options=this.element.querySelectorAll(OPTION_SELECTOR);options.forEach((option=>{option.classList.remove("pb_dropdown_option_selected")}));hiddenInput.value="";const defaultPlaceholder=this.element.querySelector(DROPDOWN_PLACEHOLDER);this.setTriggerElementText(defaultPlaceholder.dataset.dropdownPlaceholder)}setTriggerElementText(text){const triggerElement=this.element.querySelector(DROPDOWN_TRIGGER_DISPLAY);if(triggerElement){triggerElement.textContent=text}}}const ADVANCED_TABLE_SELECTOR="[data-advanced-table]";const DOWN_ARROW_SELECTOR="#advanced-table_open_icon";const UP_ARROW_SELECTOR="#advanced-table_close_icon";const _PbAdvancedTable=class _PbAdvancedTable extends PbEnhancedElement{static get selector(){return ADVANCED_TABLE_SELECTOR}get target(){const table=this.element.closest("table");return table.querySelectorAll(`[data-row-parent="${this.element.id}"]`)}connect(){this.element.addEventListener("click",(()=>{if(!_PbAdvancedTable.isCollapsing){const isExpanded=this.element.querySelector(UP_ARROW_SELECTOR).style.display==="inline-block";if(!isExpanded){_PbAdvancedTable.expandedRows.add(this.element.id)}else{_PbAdvancedTable.expandedRows.delete(this.element.id)}this.toggleElement(this.target)}}));const nestedButtons=this.element.closest("table").querySelectorAll("[data-advanced-table]");nestedButtons.forEach((button=>{button.addEventListener("click",(()=>{const isExpanded=button.querySelector(UP_ARROW_SELECTOR).style.display==="inline-block";if(isExpanded){_PbAdvancedTable.expandedRows.add(button.id)}else{_PbAdvancedTable.expandedRows.delete(button.id)}}))}))}showElement(elements){elements.forEach((elem=>{elem.style.display="table-row";elem.classList.add("is-visible");const childRowsAll=this.element.closest("table").querySelectorAll(`[data-advanced-table-content^="${elem.dataset.advancedTableContent}-"]`);childRowsAll.forEach((childRow=>{const dataContent=childRow.dataset.advancedTableContent;if(!dataContent){return}const ancestorIds=dataContent.split("-").slice(0,-1);const prefixedAncestorIds=ancestorIds.map((id=>`${childRow.id}_${id}`));const allAncestorsExpanded=prefixedAncestorIds.every((id=>_PbAdvancedTable.expandedRows.has(id)));const checkIfParentIsExpanded=()=>{if(dataContent.endsWith("sr")){const parentRowId=childRow.dataset.rowParent;const isParentVisible=childRow.previousElementSibling.classList.contains("is-visible");if(parentRowId){const isInSet=_PbAdvancedTable.expandedRows.has(parentRowId);if(isInSet&&isParentVisible){return true}}}return false};if(allAncestorsExpanded||checkIfParentIsExpanded()){childRow.style.display="table-row";childRow.classList.add("is-visible")}else{childRow.style.display="none";childRow.classList.remove("is-visible")}}))}))}hideElement(elements){elements.forEach((elem=>{elem.style.display="none";elem.classList.remove("is-visible");if(_PbAdvancedTable.expandedRows.has(elem.id)){_PbAdvancedTable.expandedRows.delete(elem.id)}const childrenArray=elem.dataset.advancedTableContent.split("-");const currentDepth=parseInt(elem.dataset.rowDepth);if(childrenArray.length>currentDepth){const childRows=this.element.closest("table").querySelectorAll(`[data-advanced-table-content^="${elem.dataset.advancedTableContent}-"]`);childRows.forEach((childRow=>{childRow.style.display="none";childRow.classList.remove("is-visible")}))}}))}toggleElement(elements){if(!elements.length)return;const isVisible=elements[0].classList.contains("is-visible");isVisible?this.hideElement(elements):this.showElement(elements);isVisible?this.displayDownArrow():this.displayUpArrow();const row=this.element.closest("tr");if(row){row.classList.toggle("bg-silver",!isVisible);row.classList.toggle("bg-white",isVisible)}}displayDownArrow(){this.element.querySelector(DOWN_ARROW_SELECTOR).style.display="inline-block";this.element.querySelector(UP_ARROW_SELECTOR).style.display="none"}displayUpArrow(){this.element.querySelector(UP_ARROW_SELECTOR).style.display="inline-block";this.element.querySelector(DOWN_ARROW_SELECTOR).style.display="none"}static handleToggleAllHeaders(element){const table=element.closest(".pb_table");const firstLevelButtons=table.querySelectorAll(".pb_advanced_table_body > .pb_table_tr[data-row-depth='0'] [data-advanced-table]");const allExpanded=Array.from(firstLevelButtons).every((button=>button.querySelector(UP_ARROW_SELECTOR).style.display==="inline-block"));if(allExpanded){firstLevelButtons.forEach((button=>{button.click();_PbAdvancedTable.expandedRows.delete(button.id)}))}else{firstLevelButtons.forEach((button=>{if(!_PbAdvancedTable.expandedRows.has(button.id)){button.click();_PbAdvancedTable.expandedRows.add(button.id)}}));_PbAdvancedTable.expandedRows.forEach((rowId=>{const nestedButton=table.querySelector(`[data-advanced-table][id="${rowId}"]`);if(nestedButton&&!firstLevelButtons.contains(nestedButton)){nestedButton.click()}}))}}static handleToggleAllSubRows(element,rowDepth){const table=element.closest(".pb_table");const parentRow=element.closest("tr");if(!parentRow){return}const rowParentId=parentRow.dataset.rowParent;const subRowButtons=table.querySelectorAll(`.pb_advanced_table_body > .pb_table_tr[data-row-depth='${rowDepth}'].pb_table_tr[data-row-parent='${rowParentId}'] [data-advanced-table]`);const allExpanded=Array.from(subRowButtons).every((button=>button.querySelector(UP_ARROW_SELECTOR).style.display==="inline-block"));if(allExpanded){subRowButtons.forEach((button=>{button.click();_PbAdvancedTable.expandedRows.delete(button.id)}))}else{subRowButtons.forEach((button=>{if(!_PbAdvancedTable.expandedRows.has(button.id)){button.click();_PbAdvancedTable.expandedRows.add(button.id)}}))}}};__publicField(_PbAdvancedTable,"expandedRows",new Set);__publicField(_PbAdvancedTable,"isCollapsing",false);let PbAdvancedTable=_PbAdvancedTable;window.expandAllRows=element=>{PbAdvancedTable.handleToggleAllHeaders(element)};window.expandAllSubRows=(element,rowDepth)=>{PbAdvancedTable.handleToggleAllSubRows(element,rowDepth)};const NAV_SELECTOR="[data-pb-nav-tab]";const NAV_ITEM_SELECTOR="[data-pb-tab-target]";class PbNav extends PbEnhancedElement{static get selector(){return NAV_SELECTOR}connect(){this.hideAndAddEventListeners()}hideAndAddEventListeners(){const navItems=this.element.querySelectorAll(NAV_ITEM_SELECTOR);navItems.forEach((navItem=>{if(!navItem.className.includes("active")){this.changeContentDisplay(navItem.dataset.pbTabTarget,"none")}navItem.addEventListener("click",(event=>this.handleNavItemClick(event)))}))}handleNavItemClick(event){event.preventDefault();const navItem=event.target.closest(NAV_ITEM_SELECTOR);this.changeContentDisplay(navItem.dataset.pbTabTarget,"block");const navItems=this.element.querySelectorAll(NAV_ITEM_SELECTOR);navItems.forEach((navItemSelected=>{if(navItem!==navItemSelected){this.changeContentDisplay(navItemSelected.dataset.pbTabTarget,"none")}}))}changeContentDisplay(contentId,display){const content=document.getElementById(contentId);content.style.display=display}}const STAR_RATING_WRAPPER_SELECTOR="[data-pb-star-rating-wrapper]";const STAR_RATING_SELECTOR="[data-pb-star-rating]";const STAR_RATING_INPUT_DATA_SELECTOR="[data-pb-star-rating-input]";class PbStarRating extends PbEnhancedElement{static get selector(){return STAR_RATING_WRAPPER_SELECTOR}connect(){this.addEventListeners();this.handleFormReset();this.setDefaultValue()}addEventListeners(){this.element.querySelectorAll(STAR_RATING_SELECTOR).forEach((star=>{star.addEventListener("click",(event=>{const clickedStarId=event.currentTarget.id;this.updateStarColors(clickedStarId);this.updateHiddenInputValue(clickedStarId);this.clearFormValidation()}));star.addEventListener("mouseenter",(event=>{const hoveredStarId=event.currentTarget.id;this.updateStarHoverColors(hoveredStarId)}));star.addEventListener("mouseleave",(()=>{this.removeStarHoverColors()}));star.addEventListener("keydown",(event=>{if(event.key==="Enter"||event.key===" "){event.preventDefault();this.handleStarClick(star.id)}}))}))}handleStarClick(starId){this.updateStarColors(starId);this.updateHiddenInputValue(starId)}updateStarColors(clickedStarId){const allStars=this.element.querySelectorAll(STAR_RATING_SELECTOR);allStars.forEach((star=>{const starId=star.id;const icon=star.querySelector(".interactive-star-icon");if(icon){if(starId<=clickedStarId){if(star.classList.contains("yellow_star")){icon.classList.add("yellow-star-selected")}else if(star.classList.contains("primary_star_light")){icon.classList.add("primary-star-selected")}else if(star.classList.contains("primary_star_dark")){icon.classList.add("primary-star-selected")}else if(star.classList.contains("subtle_star_light")){icon.classList.add("subtle-star-selected")}else if(star.classList.contains("subtle_star_dark")){icon.classList.add("subtle-star-selected")}else{icon.classList.add("yellow-star-selected")}}else{icon.classList.remove("yellow-star-selected","primary-star-selected","subtle-star-selected")}icon.classList.remove("star-hovered")}}))}updateHiddenInputValue(value){const hiddenInput=this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR);if(hiddenInput){hiddenInput.value=value}}updateStarHoverColors(hoveredStarId){const allStars=this.element.querySelectorAll(STAR_RATING_SELECTOR);allStars.forEach((star=>{const starId=star.id;const icon=star.querySelector(".interactive-star-icon");if(icon){if(starId<=hoveredStarId){if(!icon.classList.contains("yellow-star-selected")&&!icon.classList.contains("primary-star-selected")&&!icon.classList.contains("subtle-star-selected")){icon.classList.add("star-hovered")}}else{icon.classList.remove("star-hovered")}}}))}removeStarHoverColors(){const allStars=this.element.querySelectorAll(STAR_RATING_SELECTOR);allStars.forEach((star=>{const icon=star.querySelector(".interactive-star-icon");if(icon){if(!icon.classList.contains("yellow-star-selected")&&!icon.classList.contains("primary-star-selected")&&!icon.classList.contains("subtle-star-selected")){icon.classList.remove("star-hovered")}}}))}isStarSelected(){return this.element.querySelectorAll(".yellow-star-selected, .primary-star-selected, .subtle-star-selected").length>0}handleFormReset(){const form=this.element.closest("form");if(form){form.addEventListener("reset",(()=>{var _a;(_a=this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR))==null?void 0:_a.setAttribute("value","");this.resetStarRatingValues()}))}}resetStarRatingValues(){const allStars=this.element.querySelectorAll(STAR_RATING_SELECTOR);allStars.forEach((star=>{const icon=star.querySelector(".interactive-star-icon");if(icon){icon.classList.remove("yellow-star-selected","primary-star-selected","subtle-star-selected")}}))}clearFormValidation(){const hiddenInput=this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR);if(hiddenInput.checkValidity()){const errorLabelElement=this.element.querySelector(".pb_body_kit_negative");if(errorLabelElement){errorLabelElement.remove()}}}setDefaultValue(){const hiddenInput=this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR);const defaultValue=hiddenInput.value;if(defaultValue){this.updateStarColors(defaultValue)}}}const RADIO_SELECTOR="[data-pb-radio-children]";const RADIO_WRAPPER_SELECTOR="[data-pb-radio-children-wrapper]";class PbRadio extends PbEnhancedElement{static get selector(){return RADIO_SELECTOR}connect(){const radioWrapperElement=this.element.parentElement.querySelector(RADIO_WRAPPER_SELECTOR);radioWrapperElement.addEventListener("click",(()=>{this.element.querySelector("input[type='radio']").click()}))}}const DRAGGABLE_SELECTOR="[data-pb-draggable]";const DRAGGABLE_CONTAINER=".pb_draggable_container";class PbDraggable extends PbEnhancedElement{static get selector(){return DRAGGABLE_SELECTOR}connect(){this.state={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};this.draggedItem=null;this.draggedItemId=null;this.hasMultipleContainers=false;document.addEventListener("DOMContentLoaded",(()=>this.bindEventListeners()))}setState(newState){this.state={...this.state,...newState};if(newState.items){const customEvent=new CustomEvent("pb-draggable-reorder",{detail:{reorderedItems:this.state.items,containerId:this.element.querySelector(DRAGGABLE_CONTAINER).id}});this.element.dispatchEvent(customEvent)}}bindEventListeners(){const containers=this.element.querySelectorAll(DRAGGABLE_CONTAINER);this.hasMultipleContainers=containers.length>1;this.element.querySelectorAll(".pb_draggable_item img").forEach((img=>{img.setAttribute("draggable","false")}));this.element.querySelectorAll(".pb_draggable_item").forEach((item=>{item.addEventListener("dragstart",this.handleDragStart.bind(this));item.addEventListener("dragend",this.handleDragEnd.bind(this));item.addEventListener("dragenter",this.handleDragEnter.bind(this))}));containers.forEach((container=>{container.addEventListener("dragover",this.handleDragOver.bind(this));container.addEventListener("drop",this.handleDrop.bind(this))}))}handleDragStart(event){if(event.target.tagName.toLowerCase()==="img"){event.preventDefault();return}const container=event.target.closest(DRAGGABLE_CONTAINER);this.draggedItem=event.target;this.draggedItemId=event.target.id;this.setState({dragData:{id:this.draggedItemId,initialGroup:container.id},isDragging:this.draggedItemId});event.target.classList.add("is_dragging");if(event.dataTransfer){event.dataTransfer.effectAllowed="move";event.dataTransfer.setData("text/plain",this.draggedItemId)}setTimeout((()=>{event.target.style.opacity="0.5"}),0)}handleDragEnter(event){if(!this.draggedItem||event.target===this.draggedItem)return;if(this.hasMultipleContainers){this.handleMultiContainerDragEnter(event)}else{this.handleSingleContainerDragEnter(event)}}handleSingleContainerDragEnter(event){const targetItem=event.target.closest(".pb_draggable_item");if(!targetItem)return;const container=targetItem.parentNode;const items=Array.from(container.children);const draggedIndex=items.indexOf(this.draggedItem);const targetIndex=items.indexOf(targetItem);if(draggedIndex>targetIndex){container.insertBefore(this.draggedItem,targetItem)}else{container.insertBefore(this.draggedItem,targetItem.nextSibling)}}handleMultiContainerDragEnter(event){const targetContainer=event.target.closest(DRAGGABLE_CONTAINER);const targetItem=event.target.closest(".pb_draggable_item");if(!targetContainer)return;if(!targetItem){const lastItem=targetContainer.querySelector(".pb_draggable_item:last-child");if(lastItem){targetContainer.insertBefore(this.draggedItem,lastItem.nextSibling)}else{targetContainer.appendChild(this.draggedItem)}return}const container=targetItem.parentNode;const items=Array.from(container.children);const newItems=[...items].map((item=>({id:item.id,container:container.id})));this.setState({items:newItems});const rect=targetItem.getBoundingClientRect();const middleY=rect.top+rect.height/2;if(event.clientY<middleY){container.insertBefore(this.draggedItem,targetItem)}else{container.insertBefore(this.draggedItem,targetItem.nextSibling)}}handleDragOver(event){event.preventDefault();event.stopPropagation();if(this.hasMultipleContainers){this.handleMultiContainerDragOver(event)}else{this.handleSingleContainerDragOver(event)}}handleSingleContainerDragOver(event){const container=event.target.closest(DRAGGABLE_CONTAINER);if(container){container.classList.add("active_container")}}handleMultiContainerDragOver(event){let container;if(event.target.matches(DRAGGABLE_CONTAINER)){container=event.target}else{container=event.target.closest(DRAGGABLE_CONTAINER)}if(container){this.setState({activeContainer:container.id});container.classList.add("active_container");const lastItem=container.querySelector(".pb_draggable_item:last-child");if(!lastItem||lastItem&&event.clientY>lastItem.getBoundingClientRect().bottom){if(this.draggedItem&&this.draggedItem.parentNode!==container){container.appendChild(this.draggedItem)}}}}handleDrop(event){event.preventDefault();event.stopPropagation();let container;if(event.target.matches(DRAGGABLE_CONTAINER)){container=event.target}else{container=event.target.closest(DRAGGABLE_CONTAINER)}if(!container||!this.draggedItem)return;container.classList.remove("active_container");this.draggedItem.style.opacity="1";if(this.hasMultipleContainers&&!container.querySelector(".pb_draggable_item")){container.appendChild(this.draggedItem)}const reorderedItems=Array.from(this.element.querySelectorAll(".pb_draggable_item")).map((item=>({id:item.id,container:item.closest(DRAGGABLE_CONTAINER).id})));container.setAttribute("data-reordered-items",JSON.stringify(reorderedItems));const customEvent=new CustomEvent("pb-draggable-reorder",{detail:{reorderedItems:reorderedItems,containerId:container.id}});this.element.dispatchEvent(customEvent);this.setState({items:reorderedItems,isDragging:"",activeContainer:""});this.draggedItem=null;this.draggedItemId=null}handleDragEnd(event){event.target.classList.remove("is_dragging");event.target.style.opacity="1";this.setState({isDragging:"",activeContainer:""});this.draggedItem=null;this.draggedItemId=null;this.element.querySelectorAll(DRAGGABLE_CONTAINER).forEach((container=>{container.classList.remove("active_container")}))}}const OVERLAY_SELECTOR="[data-pb-overlay]";const OVERLAY_SCROLL_ELEMENT="[data-overlay-scroll-element]";const PREVIOUS_OVERLAY_CLASSNAME="[data-previous-overlay-classname]";const SUBSEQUENT_OVERLAY_CLASSNAME="[data-subsequent-overlay-classname]";class PbOverlay extends PbEnhancedElement{static get selector(){return OVERLAY_SELECTOR}get target(){return this.element.querySelector(OVERLAY_SCROLL_ELEMENT).children[0]}connect(){this.handleOverlayDynamic()}handleOverlayDynamic(){var _a,_b,_c;const isOverlayDynamic=(_a=this.element.dataset)==null?void 0:_a.overlayDynamic;if(isOverlayDynamic){const previousOverlayElement=this.element.querySelector(PREVIOUS_OVERLAY_CLASSNAME);const previousOverlayClassname=(_b=previousOverlayElement==null?void 0:previousOverlayElement.dataset)==null?void 0:_b.previousOverlayClassname;const subsequentOverlayElement=this.element.querySelector(SUBSEQUENT_OVERLAY_CLASSNAME);const subsequentOverlayClassname=(_c=subsequentOverlayElement==null?void 0:subsequentOverlayElement.dataset)==null?void 0:_c.subsequentOverlayClassname;const handleScrollChange=target=>{const{scrollLeft:scrollLeft,scrollWidth:scrollWidth,clientWidth:clientWidth}=target;const isScrollAtStart=scrollLeft===0;const isScrollAtEnd=scrollLeft+clientWidth>=scrollWidth-1;if(isScrollAtStart){previousOverlayElement.classList.remove(previousOverlayClassname)}else{previousOverlayElement.classList.add(previousOverlayClassname)}if(isScrollAtEnd){subsequentOverlayElement.classList.remove(subsequentOverlayClassname)}else{subsequentOverlayElement.classList.add(subsequentOverlayClassname)}};this.target.addEventListener("scroll",(event=>{handleScrollChange(event.target)}));handleScrollChange(this.target)}}disconnect(){var _a;if((_a=this.element.dataset)==null?void 0:_a.overlayDynamic){this.target.removeEventListener("scroll")}}}const SELECT_WRAPPER_SELECTOR="[data-pb-select]";const SELECT_VALIDATION_MESSAGE_CLASS$1=".pb_body_kit_negative";class PbSelect extends PbEnhancedElement{static get selector(){return SELECT_WRAPPER_SELECTOR}connect(){this.setValidationMessage()}setValidationMessage(){var _a;const validationMessage=(_a=this.element.dataset)==null?void 0:_a.validationMessage;if(validationMessage){const selectElement=this.element.querySelector("select");const setErrorTextContent=(text,timeout)=>{setTimeout((()=>{const errorMessageElement=this.element.querySelector(SELECT_VALIDATION_MESSAGE_CLASS$1);if(errorMessageElement){errorMessageElement.textContent=text}else{setErrorTextContent(text,100)}}),timeout)};selectElement.addEventListener("change",(e=>{if(!e.target.checkValidity()){setErrorTextContent(validationMessage,300)}}))}}}const DIALOG_WRAPPER_SELECTOR="[data-pb-dialog-wrapper]";class PbDialog extends PbEnhancedElement{static get selector(){return DIALOG_WRAPPER_SELECTOR}connect(){window.addEventListener("DOMContentLoaded",(()=>this.setupDialog()));window.addEventListener("turbo:frame-load",(()=>this.setupDialog()))}setupDialog(){const openTrigger=document.querySelectorAll("[data-open-dialog]");const closeTrigger=document.querySelectorAll("[data-close-dialog]");const dialogs=document.querySelectorAll(".pb_dialog_rails");const loadingButton=document.querySelector('[data-disable-with="Loading"]');if(loadingButton){loadingButton.addEventListener("click",(function(){const okayLoadingButton=document.querySelector('[data-disable-with="Loading"]');const cancelButton=document.querySelector('[data-disable-cancel-with="Loading"]');let currentClass=okayLoadingButton.className;let cancelClass=cancelButton?cancelButton.className:"";let newClass=currentClass.replace("_enabled","_disabled_loading");let newCancelClass=cancelClass.replace("_enabled","_disabled");okayLoadingButton.disabled=true;if(cancelButton)cancelButton.disabled=true;okayLoadingButton.className=newClass;if(cancelButton)cancelButton.className=newCancelClass}))}openTrigger.forEach((open=>{open.addEventListener("click",(()=>{var openTriggerData=open.dataset.openDialog;var targetDialog=document.getElementById(openTriggerData);if(targetDialog.open)return;targetDialog.showModal()}))}));closeTrigger.forEach((close=>{close.addEventListener("click",(()=>{var closeTriggerData=close.dataset.closeDialog;document.getElementById(closeTriggerData).close()}))}));dialogs.forEach((dialogElement=>{dialogElement.addEventListener("mousedown",(event=>{const dialogParentDataset=dialogElement.parentElement.dataset;if(dialogParentDataset.overlayClick==="overlay_close")return;const dialogModal=event.target.getBoundingClientRect();const clickedOutsideDialogModal=event.clientX<dialogModal.left||event.clientX>dialogModal.right||event.clientY<dialogModal.top||event.clientY>dialogModal.bottom;if(clickedOutsideDialogModal){dialogElement.close();event.stopPropagation()}}))}))}}const DATE_PICKER_WRAPPER_SELECTOR="[data-pb-date-picker]";const SELECT_VALIDATION_MESSAGE_CLASS=".pb_body_kit_negative";class PbDatePicker extends PbEnhancedElement{static get selector(){return DATE_PICKER_WRAPPER_SELECTOR}connect(){this.setValidationMessage()}setValidationMessage(){var _a;const validationMessage=(_a=this.element.dataset)==null?void 0:_a.validationMessage;const inputElement=this.element.querySelector("input");if(validationMessage){const setErrorTextContent=(text,timeout)=>{setTimeout((()=>{const errorMessageElement=this.element.querySelector(SELECT_VALIDATION_MESSAGE_CLASS);if(errorMessageElement){errorMessageElement.textContent=text}else{setErrorTextContent(text,100)}}),timeout)};inputElement.addEventListener("change",(e=>{if(!e.target.checkValidity()){setErrorTextContent(validationMessage,300)}}))}}}const MULTI_LEVEL_SELECT_SELECTOR="[data-multi_level_select_form]";class PbMultiLevelSelect extends PbEnhancedElement{static get selector(){return MULTI_LEVEL_SELECT_SELECTOR}get target(){return this.element.querySelector(".pb_body_kit_negative")}connect(){this.addEventListeners();this.observeHiddenInputs();this.observeRogueErrorInsideInnerContainer()}addEventListeners(){const inputElement=this.element.querySelector("input");inputElement.addEventListener("invalid",(()=>{this.handleErrorLabel(300)}));inputElement.addEventListener("blur",(()=>{this.justBlurred=true;setTimeout((()=>{this.justBlurred=false}),300)}))}handleErrorLabel(delay){setTimeout((()=>{const errorLabelElement=this.target;const wrapper=this.element.querySelector(".wrapper");if(errorLabelElement){errorLabelElement.remove();if(wrapper){if(wrapper.querySelector(".pb_body_kit_negative")){wrapper.querySelector(".pb_body_kit_negative").remove()}wrapper.appendChild(errorLabelElement)}this.element.classList.add("error")}else{this.handleErrorLabel(100)}}),delay)}observeHiddenInputs(){const container=this.element.querySelector(".input_inner_container");if(!container)return;this.mutationObserver=new MutationObserver((()=>{const hiddenInputs=container.querySelectorAll('input[type="hidden"]');if(hiddenInputs.length>0){this.clearError()}}));this.mutationObserver.observe(container,{childList:true})}observeRogueErrorInsideInnerContainer(){const container=this.element.querySelector(".input_inner_container");this.rogueErrorObserver=new MutationObserver((mutations=>{for(const mutation of mutations){for(const node of mutation.addedNodes){if(node.nodeType===Node.ELEMENT_NODE&&node.classList.contains("pb_body_kit_negative")){if(this.justBlurred){node.remove()}}}}}));this.rogueErrorObserver.observe(container,{childList:true,subtree:true})}clearError(e){const errorLabelElement=this.target;if(errorLabelElement){errorLabelElement.remove();this.element.classList.remove("error");this.element.querySelector("input").value=e.detail.value}}}PbTextInput.start();PbCopyButton.start();PbDrawer.start();window.formHelper=formHelper;window.datePickerHelper=datePickerHelper;window.dialogHelper=dialogHelper;PbCollapsible.start();PbPopover.start();PbTooltip.start();PbFixedConfirmationToast.start();PbTypeahead.start();PbTable.start();PbTextarea.start();PbDropdown.start();PbAdvancedTable.start();PbNav.start();PbStarRating.start();PbRadio.start();PbDraggable.start();PbOverlay.start();PbSelect.start();PbDialog.start();PbDatePicker.start();PbMultiLevelSelect.start();
|
1
|
+
var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:true,configurable:true,writable:true,value:value}):obj[key]=value;var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!=="symbol"?key+"":key,value);import{P as PbEnhancedElement,f as formHelper,a as datePickerHelper,b as dialogHelper,c as PbPopover,e as PbTooltip,g as PbTypeahead,h as PbTable,i as PbTextarea}from"./chunks/lib-BGzBzFZX.js";import{I as INPUTMASKS}from"./chunks/_typeahead-BY6AFq1l.js";import"./chunks/pb_form_validation-BvNy9Bd6.js";import"./chunks/lazysizes-B7xYodB-.js";import"./playbook-rails-react-bindings.js";import"react";import"react/jsx-runtime";import"react-dom";import"react-trix";import"trix";import"react-is";import"webpacker-react";class PbTextInput extends PbEnhancedElement{static get selector(){return'[data-pb-input-mask="true"]'}connect(){this.handleInput=this.handleInput.bind(this);this.element.addEventListener("input",this.handleInput);this.handleInput()}disconnect(){this.element.removeEventListener("input",this.handleInput)}handleInput(){var _a;const maskType=this.element.getAttribute("mask");const cursorPosition=this.element.selectionStart;const rawValue=this.element.value;let formattedValue=rawValue;const maskKey={currency:"currency",ssn:"ssn",postal_code:"postalCode",zip_code:"zipCode",credit_card:"creditCard",cvv:"cvv"}[maskType];if(maskKey&&INPUTMASKS[maskKey]){formattedValue=INPUTMASKS[maskKey].format(rawValue)}const sanitizedInput=(_a=this.element.closest(".text_input_wrapper"))==null?void 0:_a.querySelector('[data="sanitized-pb-input"]');if(sanitizedInput){switch(maskType){case"ssn":sanitizedInput.value=sanitizeSSN(formattedValue);break;case"currency":sanitizedInput.value=sanitizeCurrency(formattedValue);break;case"credit_card":sanitizedInput.value=sanitizeCreditCard(formattedValue);break;default:sanitizedInput.value=formattedValue}}this.element.value=formattedValue;setCursorPosition(this.element,cursorPosition,rawValue,formattedValue)}}function sanitizeSSN(input){return input.replace(/\D/g,"")}function sanitizeCurrency(input){return input.replace(/[$,]/g,"")}function sanitizeCreditCard(input){return input.replace(/\D/g,"")}function setCursorPosition(inputElement,cursorPosition,rawValue,formattedValue){const difference=formattedValue.length-rawValue.length;const newPosition=Math.max(0,cursorPosition+difference);requestAnimationFrame((()=>{inputElement.setSelectionRange(newPosition,newPosition)}))}class PbCopyButton extends PbEnhancedElement{static get selector(){return".pb_copy_button_kit"}connect(){this.handleClick=this.handleClick.bind(this);this.button=this.element.querySelector("button");if(this.button){this.button.addEventListener("click",this.handleClick)}}disconnect(){if(this.button){this.button.removeEventListener("click",this.handleClick)}}handleClick(){const fromId=this.element.getAttribute("data-from");if(fromId){const fromElement=document.querySelector(`#${fromId}`);if(fromElement){let contentToCopy="";if(fromElement.tagName.toLowerCase()==="input"){contentToCopy=fromElement.value}else{contentToCopy=fromElement.innerText}navigator.clipboard.writeText(contentToCopy).catch((err=>console.error("Failed to copy text",err)));return}}const textToCopy=this.element.getAttribute("data-copy-value");if(textToCopy){navigator.clipboard.writeText(textToCopy).catch((err=>console.error("Failed to copy text",err)))}else{console.warn("No data-copy-value attribute found or data-from element")}}}class PbDrawer extends PbEnhancedElement{static get selector(){return".pb_drawer_wrapper"}connect(){this.handleToggleClick=this.handleToggleClick.bind(this);this.handleOutsideClick=this.handleOutsideClick.bind(this);this.handleResize=this.handleResize.bind(this);this._toggleTriggers=Array.from(document.querySelectorAll("[data-open-drawer]"));this._toggleTriggers.forEach((el=>{el.addEventListener("click",this.handleToggleClick)}));this._wrappers=Array.from(document.querySelectorAll(".pb_drawer_wrapper"));this._wrappers.forEach((el=>{el.addEventListener("mousedown",this.handleOutsideClick)}));this._withinElementDrawers=Array.from(document.querySelectorAll(".pb_drawer_within_element_rails[data-breakpoint]"));window.addEventListener("resize",this.handleResize);this.handleResize()}disconnect(){this._toggleTriggers.forEach((el=>{el.removeEventListener("click",this.handleToggleClick)}));this._wrappers.forEach((el=>{el.removeEventListener("mousedown",this.handleOutsideClick)}));window.removeEventListener("resize",this.handleResize)}getOverlay(wrapper){if(wrapper.id&&wrapper.id.startsWith("drawer-wrapper-")){const overlayId=wrapper.id.replace("drawer-wrapper-","drawer-overlay-");return document.getElementById(overlayId)}return wrapper.querySelector(".pb_drawer_overlay")||wrapper.querySelector(".pb_drawer_no_overlay")}handleToggleClick(event){const trigger=event.currentTarget;const drawerId=trigger.dataset.openDrawer;const dialog=document.getElementById(drawerId);if(!dialog)return;if(dialog.classList.contains("pb_drawer_within_element_rails")){if(dialog.classList.contains("open")){this.closeWithinElementDrawer(dialog);dialog.dataset.manualOpen="false"}else{this.openWithinElementDrawer(dialog);dialog.dataset.manualOpen="true"}return}const wrapperId=`drawer-wrapper-${drawerId}`;const wrapper=document.getElementById(wrapperId);if(!wrapper)return;if(wrapper!==this.element)return;if(wrapper.classList.contains("open")){this.closeDrawer(wrapper,dialog);wrapper.dataset.manualOpen="false"}else{this.openDrawer(wrapper,dialog);wrapper.dataset.manualOpen="true"}}openWithinElementDrawer(dialog){if(dialog.classList.contains("open"))return;dialog.style.maxHeight="0px";dialog.offsetHeight;dialog.classList.add("open");const trigger=document.querySelector(`[data-open-drawer="${dialog.id}"]`);const triggerHeight=trigger?trigger.offsetHeight:0;const finalHeight=dialog.scrollHeight+triggerHeight+"px";dialog.style.maxHeight=finalHeight;dialog.addEventListener("transitionend",(function handleOpenEnd(e){if(e.propertyName==="max-height"){dialog.style.maxHeight="none";dialog.removeEventListener("transitionend",handleOpenEnd)}}))}closeWithinElementDrawer(dialog){if(!dialog.classList.contains("open"))return;const currentHeight=dialog.scrollHeight;dialog.style.maxHeight=currentHeight+"px";dialog.offsetHeight;dialog.classList.remove("open");dialog.style.maxHeight="0px";dialog.addEventListener("transitionend",(function handleCloseEnd(e){if(e.propertyName==="max-height"){dialog.removeEventListener("transitionend",handleCloseEnd);dialog.style.maxHeight="0px"}}))}openDrawer(wrapper,dialog){const behavior=wrapper.dataset.behavior;const size=wrapper.dataset.size;const placement=wrapper.dataset.placement;this.handlePushOpen(behavior,size,placement);wrapper.style.display="";const overlay=this.getOverlay(wrapper);if(overlay)overlay.style.display="";wrapper.classList.add("open");dialog.classList.add("open")}closeDrawer(wrapper,dialog){const behavior=wrapper.dataset.behavior;this.handlePushClose(behavior);if(wrapper.className.includes("open"))wrapper.style.display="none";const overlay=this.getOverlay(wrapper);if(overlay&&wrapper.className.includes("open"))overlay.style.display="none";wrapper.classList.remove("open");dialog.classList.remove("open")}handleOutsideClick(event){const wrapper=event.currentTarget;const dialog=wrapper.querySelector(".pb_drawer");const overlay=this.getOverlay(wrapper);if(dialog&&dialog.classList.contains("pb_drawer_within_element_rails")){return}if(wrapper.dataset.overlayClick==="overlay_close"&&event.target===overlay){this.closeDrawer(wrapper,dialog);event.stopPropagation();return}const dialogRect=dialog.getBoundingClientRect();const clickedOutside=event.clientX<dialogRect.left||event.clientX>dialogRect.right||event.clientY<dialogRect.top||event.clientY>dialogRect.bottom;if(clickedOutside){this.closeDrawer(wrapper,dialog);event.stopPropagation()}}handleResize(){const breakpointValues={none:0,xs:575,sm:768,md:992,lg:1200,xl:1400};this._wrappers.forEach((wrapper=>{const bp=wrapper.dataset.breakpoint||"none";if(bp==="none")return;const threshold=breakpointValues[bp]||0;const dialog=wrapper.querySelector(".pb_drawer");const trigger=dialog?document.querySelector(`[data-open-drawer="${dialog.id}"]`):null;if(window.innerWidth>=threshold){if(!wrapper.classList.contains("open")){this.openDrawer(wrapper,dialog)}if(trigger)trigger.style.display="none"}else{if(trigger)trigger.style.display="";if(wrapper.classList.contains("open")&&wrapper.dataset.manualOpen!=="true"){this.closeDrawer(wrapper,dialog)}}}));this._withinElementDrawers.forEach((drawer=>{const bp=drawer.dataset.breakpoint||"none";if(bp==="none")return;const threshold=breakpointValues[bp]||0;const trigger=document.querySelector(`[data-open-drawer="${drawer.id}"]`);if(window.innerWidth>=threshold){if(!drawer.classList.contains("open")){this.openWithinElementDrawer(drawer)}if(trigger)trigger.style.display="none"}else{if(trigger)trigger.style.display="";if(drawer.classList.contains("open")&&drawer.dataset.manualOpen!=="true"){this.closeWithinElementDrawer(drawer)}}}))}handlePushOpen(behavior,size,placement){if(behavior!=="push")return;const sizeMap={xl:"365px",lg:"300px",md:"250px",sm:"200px",xs:"64px",full:"100%"};const body=document.querySelector("body");if(!body)return;if(placement==="left"){body.style.cssText=`margin-left: ${sizeMap[size]} !important; margin-right: '' !important;`}else if(placement==="right"){body.style.cssText=`margin-right: ${sizeMap[size]} !important; margin-left: '' !important;`}body.classList.add("PBDrawer__Body--open")}handlePushClose(behavior){if(behavior!=="push")return;const body=document.querySelector("body");if(!body)return;if(body.classList.contains("PBDrawer__Body--open")){body.classList.add("PBDrawer__Body--close")}body.style.cssText="";body.classList.remove("PBDrawer__Body--open")}}const MAIN_SELECTOR="[data-collapsible-main]";const CONTENT_SELECTOR="[data-collapsible-content]";const DOWN_ARROW_SELECTOR$2="#collapsible_open_icon";const UP_ARROW_SELECTOR$2="#collapsible_close_icon";class PbCollapsible extends PbEnhancedElement{static get selector(){return MAIN_SELECTOR}connect(){this.element.addEventListener("click",(()=>{this.toggleElement(this.target)}));if(this.target.classList.contains("is-visible")){this.displayUpArrow()}else{this.displayDownArrow()}document.addEventListener(`${this.target.id}`,(()=>{this.toggleElement(this.target)}))}get target(){return this.element.parentNode.querySelector(CONTENT_SELECTOR)}showElement(elem){const getHeight=()=>{elem.style.display="block";const height2=elem.scrollHeight+"px";elem.style.display="";return height2};const height=getHeight();elem.classList.add("is-visible");elem.style.height=height;elem.style.overflow="hidden";window.setTimeout((()=>{elem.style.height="";elem.style.overflow="visible"}),300)}hideElement(elem){elem.style.height=elem.scrollHeight+"px";window.setTimeout((()=>{elem.style.height="0";elem.style.paddingTop="0";elem.style.paddingBottom="0";elem.style.overflow="hidden"}),1);window.setTimeout((()=>{elem.classList.remove("is-visible");elem.style.overflow=""}),300)}toggleElement(elem){if(elem.classList.contains("is-visible")){this.hideElement(elem);this.displayDownArrow();return}this.showElement(elem);this.displayUpArrow()}toggleArrows(showDownArrow){const downArrow=this.element.querySelector(DOWN_ARROW_SELECTOR$2);const upArrow=this.element.querySelector(UP_ARROW_SELECTOR$2);if(downArrow){downArrow.style.display=showDownArrow?"inline-block":"none"}if(upArrow){upArrow.style.display=showDownArrow?"none":"inline-block"}}displayDownArrow(){this.toggleArrows(true)}displayUpArrow(){this.toggleArrows(false)}}class PbFixedConfirmationToast extends PbEnhancedElement{static get selector(){return'[class*="pb_fixed_confirmation_toast_kit"]'}connect(){this.self=this.element;this.autoCloseToast(this.self);if(this.self.classList.contains("remove_toast")){this.self.addEventListener("click",(()=>{this.removeToast(this.self)}))}}removeToast(elem){elem.parentNode.removeChild(elem)}autoCloseToast(element){const classListValues=element.classList.value;const hasAutoCloseClass=classListValues.includes("auto_close");if(hasAutoCloseClass){const classList=classListValues.split(" ");const autoCloseValue=classList[classList.length-1].split("_")[2];const autoCloseIntValue=parseInt(autoCloseValue);setTimeout((()=>{this.removeToast(element)}),autoCloseIntValue)}}}const OPTION_SELECTOR$1="[data-dropdown-option-label]";class PbDropdownKeyboard{constructor(dropdown){this.dropdown=dropdown;this.dropdownElement=dropdown.element;this.options=Array.from(this.dropdownElement.querySelectorAll(OPTION_SELECTOR$1));this.focusedOptionIndex=-1;this.init()}init(){this.dropdownElement.addEventListener("keydown",this.handleKeyDown.bind(this))}handleKeyDown(event){switch(event.key){case"ArrowDown":event.preventDefault();if(!this.dropdown.target.classList.contains("open")){this.dropdown.showElement(this.dropdown.target);this.dropdown.updateArrowDisplay(true)}this.moveFocus(1);break;case"ArrowUp":event.preventDefault();this.moveFocus(-1);break;case"Enter":event.preventDefault();if(this.focusedOptionIndex!==-1){this.selectOption()}else{if(!this.dropdown.target.classList.contains("open")){this.dropdown.showElement(this.dropdown.target);this.dropdown.updateArrowDisplay(true)}}break;case"Escape":this.dropdown.hideElement(this.dropdown.target);break;case"Tab":this.dropdown.hideElement(this.dropdown.target);this.dropdown.updateArrowDisplay(false);this.resetFocus();break}}moveFocus(direction){if(this.focusedOptionIndex!==-1){this.options[this.focusedOptionIndex].classList.remove("pb_dropdown_option_focused")}this.focusedOptionIndex=(this.focusedOptionIndex+direction+this.options.length)%this.options.length;this.options[this.focusedOptionIndex].classList.add("pb_dropdown_option_focused")}selectOption(){const option=this.options[this.focusedOptionIndex];this.dropdown.onOptionSelected(option.dataset.dropdownOptionLabel,option);this.dropdown.hideElement(this.dropdown.target)}}const DROPDOWN_SELECTOR="[data-pb-dropdown]";const TRIGGER_SELECTOR="[data-dropdown-trigger]";const CONTAINER_SELECTOR="[data-dropdown-container]";const DOWN_ARROW_SELECTOR$1="#dropdown_open_icon";const UP_ARROW_SELECTOR$1="#dropdown_close_icon";const OPTION_SELECTOR="[data-dropdown-option-label]";const CUSTOM_DISPLAY_SELECTOR="[data-dropdown-custom-trigger]";const DROPDOWN_TRIGGER_DISPLAY="#dropdown_trigger_display";const DROPDOWN_PLACEHOLDER="[data-dropdown-placeholder]";const DROPDOWN_INPUT="#dropdown-selected-option";class PbDropdown extends PbEnhancedElement{static get selector(){return DROPDOWN_SELECTOR}get target(){return this.element.parentNode.querySelector(CONTAINER_SELECTOR)}connect(){this.keyboardHandler=new PbDropdownKeyboard(this);this.setDefaultValue();this.bindEventListeners();this.updateArrowDisplay(false);this.handleFormValidation();this.handleFormReset()}bindEventListeners(){const customTrigger=this.element.querySelector(CUSTOM_DISPLAY_SELECTOR)||this.element;customTrigger.addEventListener("click",(()=>this.toggleElement(this.target)));this.target.addEventListener("click",this.handleOptionClick.bind(this));document.addEventListener("click",this.handleDocumentClick.bind(this),true)}handleOptionClick(event){const option=event.target.closest(OPTION_SELECTOR);const hiddenInput=this.element.querySelector(DROPDOWN_INPUT);if(option){const value=option.dataset.dropdownOptionLabel;hiddenInput.value=JSON.parse(value).id;this.clearFormValidation(hiddenInput);this.onOptionSelected(value,option)}}handleDocumentClick(event){if(this.isClickOutside(event)&&this.target.classList.contains("open")){this.hideElement(this.target);this.updateArrowDisplay(false)}}isClickOutside(event){const customTrigger=this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);if(customTrigger){return!customTrigger.contains(event.target)}else{const triggerElement=this.element.querySelector(TRIGGER_SELECTOR);const containerElement=this.element.parentNode.querySelector(CONTAINER_SELECTOR);const isOutsideTrigger=triggerElement?!triggerElement.contains(event.target):true;const isOutsideContainer=containerElement?!containerElement.contains(event.target):true;return isOutsideTrigger&&isOutsideContainer}}onOptionSelected(value,selectedOption){const triggerElement=this.element.querySelector(DROPDOWN_TRIGGER_DISPLAY);const customDisplayElement=this.element.querySelector("#dropdown_trigger_custom_display");if(triggerElement){const selectedLabel=JSON.parse(value).label;triggerElement.textContent=selectedLabel;if(customDisplayElement){customDisplayElement.style.display="block";customDisplayElement.style.paddingRight="8px"}}const customTrigger=this.element.querySelector(CUSTOM_DISPLAY_SELECTOR);if(customTrigger){if(this.target.classList.contains("open")){this.hideElement(this.target);this.updateArrowDisplay(false)}}const options=this.element.querySelectorAll(OPTION_SELECTOR);options.forEach((option=>{option.classList.remove("pb_dropdown_option_selected")}));selectedOption.classList.add("pb_dropdown_option_selected")}showElement(elem){elem.classList.remove("close");elem.classList.add("open");elem.style.height=elem.scrollHeight+"px"}hideElement(elem){elem.style.height=elem.scrollHeight+"px";window.setTimeout((()=>{elem.classList.add("close");elem.classList.remove("open");this.resetFocus()}),0)}resetFocus(){if(this.keyboardHandler){this.keyboardHandler.focusedOptionIndex=-1;const options=this.element.querySelectorAll(OPTION_SELECTOR);options.forEach((option=>option.classList.remove("pb_dropdown_option_focused")))}}toggleElement(elem){if(elem.classList.contains("open")){this.hideElement(elem);this.updateArrowDisplay(false);return}this.showElement(elem);this.updateArrowDisplay(true)}updateArrowDisplay(isOpen){const downArrow=this.element.querySelector(DOWN_ARROW_SELECTOR$1);const upArrow=this.element.querySelector(UP_ARROW_SELECTOR$1);if(downArrow&&upArrow){downArrow.style.display=isOpen?"none":"inline-block";upArrow.style.display=isOpen?"inline-block":"none"}}handleFormValidation(){const hiddenInput=this.element.querySelector(DROPDOWN_INPUT);hiddenInput.addEventListener("invalid",(function(event){if(hiddenInput.hasAttribute("required")&&hiddenInput.value===""){event.preventDefault();hiddenInput.closest(".dropdown_wrapper").classList.add("error")}}),true)}clearFormValidation(input){if(input.checkValidity()){const dropdownWrapperElement=input.closest(".dropdown_wrapper");dropdownWrapperElement.classList.remove("error");const errorLabelElement=dropdownWrapperElement.querySelector(".pb_body_kit_negative");if(errorLabelElement){errorLabelElement.remove()}}}setDefaultValue(){const hiddenInput=this.element.querySelector(DROPDOWN_INPUT);const options=this.element.querySelectorAll(OPTION_SELECTOR);const defaultValue=hiddenInput.dataset.defaultValue||"";hiddenInput.value=defaultValue;if(defaultValue){const selectedOption=Array.from(options).find((option=>JSON.parse(option.dataset.dropdownOptionLabel).id===defaultValue));selectedOption.classList.add("pb_dropdown_option_selected");this.setTriggerElementText(JSON.parse(selectedOption.dataset.dropdownOptionLabel).label)}}handleFormReset(){const form=this.element.closest("form");if(form){form.addEventListener("reset",(()=>{this.resetDropdownValue()}))}}resetDropdownValue(){const hiddenInput=this.element.querySelector(DROPDOWN_INPUT);const options=this.element.querySelectorAll(OPTION_SELECTOR);options.forEach((option=>{option.classList.remove("pb_dropdown_option_selected")}));hiddenInput.value="";const defaultPlaceholder=this.element.querySelector(DROPDOWN_PLACEHOLDER);this.setTriggerElementText(defaultPlaceholder.dataset.dropdownPlaceholder)}setTriggerElementText(text){const triggerElement=this.element.querySelector(DROPDOWN_TRIGGER_DISPLAY);if(triggerElement){triggerElement.textContent=text}}}const ADVANCED_TABLE_SELECTOR="[data-advanced-table]";const DOWN_ARROW_SELECTOR="#advanced-table_open_icon";const UP_ARROW_SELECTOR="#advanced-table_close_icon";const _PbAdvancedTable=class _PbAdvancedTable extends PbEnhancedElement{static get selector(){return ADVANCED_TABLE_SELECTOR}get target(){const table=this.element.closest("table");return table.querySelectorAll(`[data-row-parent="${this.element.id}"]`)}connect(){this.element.addEventListener("click",(()=>{if(!_PbAdvancedTable.isCollapsing){const isExpanded=this.element.querySelector(UP_ARROW_SELECTOR).style.display==="inline-block";if(!isExpanded){_PbAdvancedTable.expandedRows.add(this.element.id)}else{_PbAdvancedTable.expandedRows.delete(this.element.id)}this.toggleElement(this.target)}}));const nestedButtons=this.element.closest("table").querySelectorAll("[data-advanced-table]");nestedButtons.forEach((button=>{button.addEventListener("click",(()=>{const isExpanded=button.querySelector(UP_ARROW_SELECTOR).style.display==="inline-block";if(isExpanded){_PbAdvancedTable.expandedRows.add(button.id)}else{_PbAdvancedTable.expandedRows.delete(button.id)}}))}))}showElement(elements){elements.forEach((elem=>{elem.style.display="table-row";elem.classList.add("is-visible");const childRowsAll=this.element.closest("table").querySelectorAll(`[data-advanced-table-content^="${elem.dataset.advancedTableContent}-"]`);childRowsAll.forEach((childRow=>{const dataContent=childRow.dataset.advancedTableContent;if(!dataContent){return}const ancestorIds=dataContent.split("-").slice(0,-1);const prefixedAncestorIds=ancestorIds.map((id=>`${childRow.id}_${id}`));const allAncestorsExpanded=prefixedAncestorIds.every((id=>_PbAdvancedTable.expandedRows.has(id)));const checkIfParentIsExpanded=()=>{if(dataContent.endsWith("sr")){const parentRowId=childRow.dataset.rowParent;const isParentVisible=childRow.previousElementSibling.classList.contains("is-visible");if(parentRowId){const isInSet=_PbAdvancedTable.expandedRows.has(parentRowId);if(isInSet&&isParentVisible){return true}}}return false};if(allAncestorsExpanded||checkIfParentIsExpanded()){childRow.style.display="table-row";childRow.classList.add("is-visible")}else{childRow.style.display="none";childRow.classList.remove("is-visible")}}))}))}hideElement(elements){elements.forEach((elem=>{elem.style.display="none";elem.classList.remove("is-visible");if(_PbAdvancedTable.expandedRows.has(elem.id)){_PbAdvancedTable.expandedRows.delete(elem.id)}const childrenArray=elem.dataset.advancedTableContent.split("-");const currentDepth=parseInt(elem.dataset.rowDepth);if(childrenArray.length>currentDepth){const childRows=this.element.closest("table").querySelectorAll(`[data-advanced-table-content^="${elem.dataset.advancedTableContent}-"]`);childRows.forEach((childRow=>{childRow.style.display="none";childRow.classList.remove("is-visible")}))}}))}toggleElement(elements){if(!elements.length)return;const isVisible=elements[0].classList.contains("is-visible");isVisible?this.hideElement(elements):this.showElement(elements);isVisible?this.displayDownArrow():this.displayUpArrow();const row=this.element.closest("tr");if(row){row.classList.toggle("bg-silver",!isVisible);row.classList.toggle("bg-white",isVisible)}}displayDownArrow(){this.element.querySelector(DOWN_ARROW_SELECTOR).style.display="inline-block";this.element.querySelector(UP_ARROW_SELECTOR).style.display="none"}displayUpArrow(){this.element.querySelector(UP_ARROW_SELECTOR).style.display="inline-block";this.element.querySelector(DOWN_ARROW_SELECTOR).style.display="none"}static handleToggleAllHeaders(element){const table=element.closest(".pb_table");const firstLevelButtons=table.querySelectorAll(".pb_advanced_table_body > .pb_table_tr[data-row-depth='0'] [data-advanced-table]");const allExpanded=Array.from(firstLevelButtons).every((button=>button.querySelector(UP_ARROW_SELECTOR).style.display==="inline-block"));if(allExpanded){firstLevelButtons.forEach((button=>{button.click();_PbAdvancedTable.expandedRows.delete(button.id)}))}else{firstLevelButtons.forEach((button=>{if(!_PbAdvancedTable.expandedRows.has(button.id)){button.click();_PbAdvancedTable.expandedRows.add(button.id)}}));_PbAdvancedTable.expandedRows.forEach((rowId=>{const nestedButton=table.querySelector(`[data-advanced-table][id="${rowId}"]`);if(nestedButton&&!firstLevelButtons.contains(nestedButton)){nestedButton.click()}}))}}static handleToggleAllSubRows(element,rowDepth){const table=element.closest(".pb_table");const parentRow=element.closest("tr");if(!parentRow){return}const rowParentId=parentRow.dataset.rowParent;const subRowButtons=table.querySelectorAll(`.pb_advanced_table_body > .pb_table_tr[data-row-depth='${rowDepth}'].pb_table_tr[data-row-parent='${rowParentId}'] [data-advanced-table]`);const allExpanded=Array.from(subRowButtons).every((button=>button.querySelector(UP_ARROW_SELECTOR).style.display==="inline-block"));if(allExpanded){subRowButtons.forEach((button=>{button.click();_PbAdvancedTable.expandedRows.delete(button.id)}))}else{subRowButtons.forEach((button=>{if(!_PbAdvancedTable.expandedRows.has(button.id)){button.click();_PbAdvancedTable.expandedRows.add(button.id)}}))}}};__publicField(_PbAdvancedTable,"expandedRows",new Set);__publicField(_PbAdvancedTable,"isCollapsing",false);let PbAdvancedTable=_PbAdvancedTable;window.expandAllRows=element=>{PbAdvancedTable.handleToggleAllHeaders(element)};window.expandAllSubRows=(element,rowDepth)=>{PbAdvancedTable.handleToggleAllSubRows(element,rowDepth)};const NAV_SELECTOR="[data-pb-nav-tab]";const NAV_ITEM_SELECTOR="[data-pb-tab-target]";class PbNav extends PbEnhancedElement{static get selector(){return NAV_SELECTOR}connect(){this.hideAndAddEventListeners()}hideAndAddEventListeners(){const navItems=this.element.querySelectorAll(NAV_ITEM_SELECTOR);navItems.forEach((navItem=>{if(!navItem.className.includes("active")){this.changeContentDisplay(navItem.dataset.pbTabTarget,"none")}navItem.addEventListener("click",(event=>this.handleNavItemClick(event)))}))}handleNavItemClick(event){event.preventDefault();const navItem=event.target.closest(NAV_ITEM_SELECTOR);this.changeContentDisplay(navItem.dataset.pbTabTarget,"block");const navItems=this.element.querySelectorAll(NAV_ITEM_SELECTOR);navItems.forEach((navItemSelected=>{if(navItem!==navItemSelected){this.changeContentDisplay(navItemSelected.dataset.pbTabTarget,"none")}}))}changeContentDisplay(contentId,display){const content=document.getElementById(contentId);content.style.display=display}}const STAR_RATING_WRAPPER_SELECTOR="[data-pb-star-rating-wrapper]";const STAR_RATING_SELECTOR="[data-pb-star-rating]";const STAR_RATING_INPUT_DATA_SELECTOR="[data-pb-star-rating-input]";class PbStarRating extends PbEnhancedElement{static get selector(){return STAR_RATING_WRAPPER_SELECTOR}connect(){this.addEventListeners();this.handleFormReset();this.setDefaultValue()}addEventListeners(){this.element.querySelectorAll(STAR_RATING_SELECTOR).forEach((star=>{star.addEventListener("click",(event=>{const clickedStarId=event.currentTarget.id;this.updateStarColors(clickedStarId);this.updateHiddenInputValue(clickedStarId);this.clearFormValidation()}));star.addEventListener("mouseenter",(event=>{const hoveredStarId=event.currentTarget.id;this.updateStarHoverColors(hoveredStarId)}));star.addEventListener("mouseleave",(()=>{this.removeStarHoverColors()}));star.addEventListener("keydown",(event=>{if(event.key==="Enter"||event.key===" "){event.preventDefault();this.handleStarClick(star.id)}}))}))}handleStarClick(starId){this.updateStarColors(starId);this.updateHiddenInputValue(starId)}updateStarColors(clickedStarId){const allStars=this.element.querySelectorAll(STAR_RATING_SELECTOR);allStars.forEach((star=>{const starId=star.id;const icon=star.querySelector(".interactive-star-icon");if(icon){if(starId<=clickedStarId){if(star.classList.contains("yellow_star")){icon.classList.add("yellow-star-selected")}else if(star.classList.contains("primary_star_light")){icon.classList.add("primary-star-selected")}else if(star.classList.contains("primary_star_dark")){icon.classList.add("primary-star-selected")}else if(star.classList.contains("subtle_star_light")){icon.classList.add("subtle-star-selected")}else if(star.classList.contains("subtle_star_dark")){icon.classList.add("subtle-star-selected")}else{icon.classList.add("yellow-star-selected")}}else{icon.classList.remove("yellow-star-selected","primary-star-selected","subtle-star-selected")}icon.classList.remove("star-hovered")}}))}updateHiddenInputValue(value){const hiddenInput=this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR);if(hiddenInput){hiddenInput.value=value}}updateStarHoverColors(hoveredStarId){const allStars=this.element.querySelectorAll(STAR_RATING_SELECTOR);allStars.forEach((star=>{const starId=star.id;const icon=star.querySelector(".interactive-star-icon");if(icon){if(starId<=hoveredStarId){if(!icon.classList.contains("yellow-star-selected")&&!icon.classList.contains("primary-star-selected")&&!icon.classList.contains("subtle-star-selected")){icon.classList.add("star-hovered")}}else{icon.classList.remove("star-hovered")}}}))}removeStarHoverColors(){const allStars=this.element.querySelectorAll(STAR_RATING_SELECTOR);allStars.forEach((star=>{const icon=star.querySelector(".interactive-star-icon");if(icon){if(!icon.classList.contains("yellow-star-selected")&&!icon.classList.contains("primary-star-selected")&&!icon.classList.contains("subtle-star-selected")){icon.classList.remove("star-hovered")}}}))}isStarSelected(){return this.element.querySelectorAll(".yellow-star-selected, .primary-star-selected, .subtle-star-selected").length>0}handleFormReset(){const form=this.element.closest("form");if(form){form.addEventListener("reset",(()=>{var _a;(_a=this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR))==null?void 0:_a.setAttribute("value","");this.resetStarRatingValues()}))}}resetStarRatingValues(){const allStars=this.element.querySelectorAll(STAR_RATING_SELECTOR);allStars.forEach((star=>{const icon=star.querySelector(".interactive-star-icon");if(icon){icon.classList.remove("yellow-star-selected","primary-star-selected","subtle-star-selected")}}))}clearFormValidation(){const hiddenInput=this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR);if(hiddenInput.checkValidity()){const errorLabelElement=this.element.querySelector(".pb_body_kit_negative");if(errorLabelElement){errorLabelElement.remove()}}}setDefaultValue(){const hiddenInput=this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR);const defaultValue=hiddenInput.value;if(defaultValue){this.updateStarColors(defaultValue)}}}const RADIO_SELECTOR="[data-pb-radio-children]";const RADIO_WRAPPER_SELECTOR="[data-pb-radio-children-wrapper]";class PbRadio extends PbEnhancedElement{static get selector(){return RADIO_SELECTOR}connect(){const radioWrapperElement=this.element.parentElement.querySelector(RADIO_WRAPPER_SELECTOR);radioWrapperElement.addEventListener("click",(()=>{this.element.querySelector("input[type='radio']").click()}))}}const DRAGGABLE_SELECTOR="[data-pb-draggable]";const DRAGGABLE_CONTAINER=".pb_draggable_container";class PbDraggable extends PbEnhancedElement{static get selector(){return DRAGGABLE_SELECTOR}connect(){this.state={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};this.draggedItem=null;this.draggedItemId=null;this.hasMultipleContainers=false;document.addEventListener("DOMContentLoaded",(()=>this.bindEventListeners()))}setState(newState){this.state={...this.state,...newState};if(newState.items){const customEvent=new CustomEvent("pb-draggable-reorder",{detail:{reorderedItems:this.state.items,containerId:this.element.querySelector(DRAGGABLE_CONTAINER).id}});this.element.dispatchEvent(customEvent)}}bindEventListeners(){const containers=this.element.querySelectorAll(DRAGGABLE_CONTAINER);this.hasMultipleContainers=containers.length>1;this.element.querySelectorAll(".pb_draggable_item img").forEach((img=>{img.setAttribute("draggable","false")}));this.element.querySelectorAll(".pb_draggable_item").forEach((item=>{item.addEventListener("dragstart",this.handleDragStart.bind(this));item.addEventListener("dragend",this.handleDragEnd.bind(this));item.addEventListener("dragenter",this.handleDragEnter.bind(this))}));containers.forEach((container=>{container.addEventListener("dragover",this.handleDragOver.bind(this));container.addEventListener("drop",this.handleDrop.bind(this))}))}handleDragStart(event){if(event.target.tagName.toLowerCase()==="img"){event.preventDefault();return}const container=event.target.closest(DRAGGABLE_CONTAINER);this.draggedItem=event.target;this.draggedItemId=event.target.id;this.setState({dragData:{id:this.draggedItemId,initialGroup:container.id},isDragging:this.draggedItemId});event.target.classList.add("is_dragging");if(event.dataTransfer){event.dataTransfer.effectAllowed="move";event.dataTransfer.setData("text/plain",this.draggedItemId)}setTimeout((()=>{event.target.style.opacity="0.5"}),0)}handleDragEnter(event){if(!this.draggedItem||event.target===this.draggedItem)return;if(this.hasMultipleContainers){this.handleMultiContainerDragEnter(event)}else{this.handleSingleContainerDragEnter(event)}}handleSingleContainerDragEnter(event){const targetItem=event.target.closest(".pb_draggable_item");if(!targetItem)return;const container=targetItem.parentNode;const items=Array.from(container.children);const draggedIndex=items.indexOf(this.draggedItem);const targetIndex=items.indexOf(targetItem);if(draggedIndex>targetIndex){container.insertBefore(this.draggedItem,targetItem)}else{container.insertBefore(this.draggedItem,targetItem.nextSibling)}}handleMultiContainerDragEnter(event){const targetContainer=event.target.closest(DRAGGABLE_CONTAINER);const targetItem=event.target.closest(".pb_draggable_item");if(!targetContainer)return;if(!targetItem){const lastItem=targetContainer.querySelector(".pb_draggable_item:last-child");if(lastItem){targetContainer.insertBefore(this.draggedItem,lastItem.nextSibling)}else{targetContainer.appendChild(this.draggedItem)}return}const container=targetItem.parentNode;const items=Array.from(container.children);const newItems=[...items].map((item=>({id:item.id,container:container.id})));this.setState({items:newItems});const rect=targetItem.getBoundingClientRect();const middleY=rect.top+rect.height/2;if(event.clientY<middleY){container.insertBefore(this.draggedItem,targetItem)}else{container.insertBefore(this.draggedItem,targetItem.nextSibling)}}handleDragOver(event){event.preventDefault();event.stopPropagation();if(this.hasMultipleContainers){this.handleMultiContainerDragOver(event)}else{this.handleSingleContainerDragOver(event)}}handleSingleContainerDragOver(event){const container=event.target.closest(DRAGGABLE_CONTAINER);if(container){container.classList.add("active_container")}}handleMultiContainerDragOver(event){let container;if(event.target.matches(DRAGGABLE_CONTAINER)){container=event.target}else{container=event.target.closest(DRAGGABLE_CONTAINER)}if(container){this.setState({activeContainer:container.id});container.classList.add("active_container");const lastItem=container.querySelector(".pb_draggable_item:last-child");if(!lastItem||lastItem&&event.clientY>lastItem.getBoundingClientRect().bottom){if(this.draggedItem&&this.draggedItem.parentNode!==container){container.appendChild(this.draggedItem)}}}}handleDrop(event){event.preventDefault();event.stopPropagation();let container;if(event.target.matches(DRAGGABLE_CONTAINER)){container=event.target}else{container=event.target.closest(DRAGGABLE_CONTAINER)}if(!container||!this.draggedItem)return;container.classList.remove("active_container");this.draggedItem.style.opacity="1";if(this.hasMultipleContainers&&!container.querySelector(".pb_draggable_item")){container.appendChild(this.draggedItem)}const reorderedItems=Array.from(this.element.querySelectorAll(".pb_draggable_item")).map((item=>({id:item.id,container:item.closest(DRAGGABLE_CONTAINER).id})));container.setAttribute("data-reordered-items",JSON.stringify(reorderedItems));const customEvent=new CustomEvent("pb-draggable-reorder",{detail:{reorderedItems:reorderedItems,containerId:container.id}});this.element.dispatchEvent(customEvent);this.setState({items:reorderedItems,isDragging:"",activeContainer:""});this.draggedItem=null;this.draggedItemId=null}handleDragEnd(event){event.target.classList.remove("is_dragging");event.target.style.opacity="1";this.setState({isDragging:"",activeContainer:""});this.draggedItem=null;this.draggedItemId=null;this.element.querySelectorAll(DRAGGABLE_CONTAINER).forEach((container=>{container.classList.remove("active_container")}))}}const OVERLAY_SELECTOR="[data-pb-overlay]";const OVERLAY_SCROLL_ELEMENT="[data-overlay-scroll-element]";const PREVIOUS_OVERLAY_CLASSNAME="[data-previous-overlay-classname]";const SUBSEQUENT_OVERLAY_CLASSNAME="[data-subsequent-overlay-classname]";class PbOverlay extends PbEnhancedElement{static get selector(){return OVERLAY_SELECTOR}get target(){return this.element.querySelector(OVERLAY_SCROLL_ELEMENT).children[0]}connect(){this.handleOverlayDynamic()}handleOverlayDynamic(){var _a,_b,_c;const isOverlayDynamic=(_a=this.element.dataset)==null?void 0:_a.overlayDynamic;if(isOverlayDynamic){const previousOverlayElement=this.element.querySelector(PREVIOUS_OVERLAY_CLASSNAME);const previousOverlayClassname=(_b=previousOverlayElement==null?void 0:previousOverlayElement.dataset)==null?void 0:_b.previousOverlayClassname;const subsequentOverlayElement=this.element.querySelector(SUBSEQUENT_OVERLAY_CLASSNAME);const subsequentOverlayClassname=(_c=subsequentOverlayElement==null?void 0:subsequentOverlayElement.dataset)==null?void 0:_c.subsequentOverlayClassname;const handleScrollChange=target=>{const{scrollLeft:scrollLeft,scrollWidth:scrollWidth,clientWidth:clientWidth}=target;const isScrollAtStart=scrollLeft===0;const isScrollAtEnd=scrollLeft+clientWidth>=scrollWidth-1;if(isScrollAtStart){previousOverlayElement.classList.remove(previousOverlayClassname)}else{previousOverlayElement.classList.add(previousOverlayClassname)}if(isScrollAtEnd){subsequentOverlayElement.classList.remove(subsequentOverlayClassname)}else{subsequentOverlayElement.classList.add(subsequentOverlayClassname)}};this.target.addEventListener("scroll",(event=>{handleScrollChange(event.target)}));handleScrollChange(this.target)}}disconnect(){var _a;if((_a=this.element.dataset)==null?void 0:_a.overlayDynamic){this.target.removeEventListener("scroll")}}}const SELECT_WRAPPER_SELECTOR="[data-pb-select]";const SELECT_VALIDATION_MESSAGE_CLASS$1=".pb_body_kit_negative";class PbSelect extends PbEnhancedElement{static get selector(){return SELECT_WRAPPER_SELECTOR}connect(){this.setValidationMessage()}setValidationMessage(){var _a;const validationMessage=(_a=this.element.dataset)==null?void 0:_a.validationMessage;if(validationMessage){const selectElement=this.element.querySelector("select");const setErrorTextContent=(text,timeout)=>{setTimeout((()=>{const errorMessageElement=this.element.querySelector(SELECT_VALIDATION_MESSAGE_CLASS$1);if(errorMessageElement){errorMessageElement.textContent=text}else{setErrorTextContent(text,100)}}),timeout)};selectElement.addEventListener("change",(e=>{if(!e.target.checkValidity()){setErrorTextContent(validationMessage,300)}}))}}}const DIALOG_WRAPPER_SELECTOR="[data-pb-dialog-wrapper]";class PbDialog extends PbEnhancedElement{static get selector(){return DIALOG_WRAPPER_SELECTOR}connect(){window.addEventListener("DOMContentLoaded",(()=>this.setupDialog()));window.addEventListener("turbo:frame-load",(()=>this.setupDialog()))}setupDialog(){const openTrigger=document.querySelectorAll("[data-open-dialog]");const closeTrigger=document.querySelectorAll("[data-close-dialog]");const dialogs=document.querySelectorAll(".pb_dialog_rails");const loadingButton=document.querySelector('[data-disable-with="Loading"]');if(loadingButton){loadingButton.addEventListener("click",(function(){const okayLoadingButton=document.querySelector('[data-disable-with="Loading"]');const cancelButton=document.querySelector('[data-disable-cancel-with="Loading"]');let currentClass=okayLoadingButton.className;let cancelClass=cancelButton?cancelButton.className:"";let newClass=currentClass.replace("_enabled","_disabled_loading");let newCancelClass=cancelClass.replace("_enabled","_disabled");okayLoadingButton.disabled=true;if(cancelButton)cancelButton.disabled=true;okayLoadingButton.className=newClass;if(cancelButton)cancelButton.className=newCancelClass}))}openTrigger.forEach((open=>{open.addEventListener("click",(()=>{var openTriggerData=open.dataset.openDialog;var targetDialog=document.getElementById(openTriggerData);if(targetDialog.open)return;targetDialog.showModal()}))}));closeTrigger.forEach((close=>{close.addEventListener("click",(()=>{var closeTriggerData=close.dataset.closeDialog;document.getElementById(closeTriggerData).close()}))}));dialogs.forEach((dialogElement=>{dialogElement.addEventListener("mousedown",(event=>{const dialogParentDataset=dialogElement.parentElement.dataset;if(dialogParentDataset.overlayClick==="overlay_close")return;const dialogModal=event.target.getBoundingClientRect();const clickedOutsideDialogModal=event.clientX<dialogModal.left||event.clientX>dialogModal.right||event.clientY<dialogModal.top||event.clientY>dialogModal.bottom;if(clickedOutsideDialogModal){dialogElement.close();event.stopPropagation()}}))}))}}const DATE_PICKER_WRAPPER_SELECTOR="[data-pb-date-picker]";const SELECT_VALIDATION_MESSAGE_CLASS=".pb_body_kit_negative";class PbDatePicker extends PbEnhancedElement{static get selector(){return DATE_PICKER_WRAPPER_SELECTOR}connect(){this.setValidationMessage()}setValidationMessage(){var _a;const validationMessage=(_a=this.element.dataset)==null?void 0:_a.validationMessage;const inputElement=this.element.querySelector("input");if(validationMessage){const setErrorTextContent=(text,timeout)=>{setTimeout((()=>{const errorMessageElement=this.element.querySelector(SELECT_VALIDATION_MESSAGE_CLASS);if(errorMessageElement){errorMessageElement.textContent=text}else{setErrorTextContent(text,100)}}),timeout)};inputElement.addEventListener("change",(e=>{if(!e.target.checkValidity()){setErrorTextContent(validationMessage,300)}}))}}}const MULTI_LEVEL_SELECT_SELECTOR="[data-multi_level_select_form]";class PbMultiLevelSelect extends PbEnhancedElement{static get selector(){return MULTI_LEVEL_SELECT_SELECTOR}get target(){return this.element.querySelector(".pb_body_kit_negative")}connect(){this.addEventListeners();this.observeHiddenInputs();this.observeRogueErrorInsideInnerContainer()}addEventListeners(){const inputElement=this.element.querySelector("input");inputElement.addEventListener("invalid",(()=>{this.handleErrorLabel(300)}));inputElement.addEventListener("blur",(()=>{this.justBlurred=true;setTimeout((()=>{this.justBlurred=false}),300)}))}handleErrorLabel(delay){setTimeout((()=>{const errorLabelElement=this.target;const wrapper=this.element.querySelector(".wrapper");if(errorLabelElement){errorLabelElement.remove();if(wrapper){if(wrapper.querySelector(".pb_body_kit_negative")){wrapper.querySelector(".pb_body_kit_negative").remove()}wrapper.appendChild(errorLabelElement)}this.element.classList.add("error")}else{this.handleErrorLabel(100)}}),delay)}observeHiddenInputs(){const container=this.element.querySelector(".input_inner_container");if(!container)return;this.mutationObserver=new MutationObserver((()=>{const hiddenInputs=container.querySelectorAll('input[type="hidden"]');if(hiddenInputs.length>0){this.clearError()}}));this.mutationObserver.observe(container,{childList:true})}observeRogueErrorInsideInnerContainer(){const container=this.element.querySelector(".input_inner_container");this.rogueErrorObserver=new MutationObserver((mutations=>{for(const mutation of mutations){for(const node of mutation.addedNodes){if(node.nodeType===Node.ELEMENT_NODE&&node.classList.contains("pb_body_kit_negative")){if(this.justBlurred){node.remove()}}}}}));this.rogueErrorObserver.observe(container,{childList:true,subtree:true})}clearError(e){const errorLabelElement=this.target;if(errorLabelElement){errorLabelElement.remove();this.element.classList.remove("error");this.element.querySelector("input").value=e.detail.value}}}PbTextInput.start();PbCopyButton.start();PbDrawer.start();window.formHelper=formHelper;window.datePickerHelper=datePickerHelper;window.dialogHelper=dialogHelper;PbCollapsible.start();PbPopover.start();PbTooltip.start();PbFixedConfirmationToast.start();PbTypeahead.start();PbTable.start();PbTextarea.start();PbDropdown.start();PbAdvancedTable.start();PbNav.start();PbStarRating.start();PbRadio.start();PbDraggable.start();PbOverlay.start();PbSelect.start();PbDialog.start();PbDatePicker.start();PbMultiLevelSelect.start();
|
data/lib/playbook/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playbook_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 14.17.0.pre.alpha.
|
4
|
+
version: 14.17.0.pre.alpha.play2065passphrasewithselect7273
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Power UX
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2025-04-
|
12
|
+
date: 2025-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -833,12 +833,9 @@ files:
|
|
833
833
|
- app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.html.erb
|
834
834
|
- app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.jsx
|
835
835
|
- app/pb_kits/playbook/pb_copy_button/docs/_copy_button_from.md
|
836
|
-
- app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.jsx
|
837
|
-
- app/pb_kits/playbook/pb_copy_button/docs/_copy_button_hook.md
|
838
836
|
- app/pb_kits/playbook/pb_copy_button/docs/example.yml
|
839
837
|
- app/pb_kits/playbook/pb_copy_button/docs/index.js
|
840
838
|
- app/pb_kits/playbook/pb_copy_button/index.js
|
841
|
-
- app/pb_kits/playbook/pb_copy_button/usePBCopy.ts
|
842
839
|
- app/pb_kits/playbook/pb_currency/_currency.scss
|
843
840
|
- app/pb_kits/playbook/pb_currency/_currency.tsx
|
844
841
|
- app/pb_kits/playbook/pb_currency/currency.html.erb
|
@@ -1579,8 +1576,6 @@ files:
|
|
1579
1576
|
- app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.html.erb
|
1580
1577
|
- app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx
|
1581
1578
|
- app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.md
|
1582
|
-
- app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx
|
1583
|
-
- app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md
|
1584
1579
|
- app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.html.erb
|
1585
1580
|
- app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx
|
1586
1581
|
- app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.md
|
@@ -1593,7 +1588,6 @@ files:
|
|
1593
1588
|
- app/pb_kits/playbook/pb_gauge/gauge.html.erb
|
1594
1589
|
- app/pb_kits/playbook/pb_gauge/gauge.rb
|
1595
1590
|
- app/pb_kits/playbook/pb_gauge/gauge.test.js
|
1596
|
-
- app/pb_kits/playbook/pb_gauge/gaugeTheme.ts
|
1597
1591
|
- app/pb_kits/playbook/pb_hashtag/_hashtag.scss
|
1598
1592
|
- app/pb_kits/playbook/pb_hashtag/_hashtag.tsx
|
1599
1593
|
- app/pb_kits/playbook/pb_hashtag/docs/_description.md
|
@@ -2988,8 +2982,6 @@ files:
|
|
2988
2982
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_no_label.jsx
|
2989
2983
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_options.html.erb
|
2990
2984
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_props_swift.md
|
2991
|
-
- app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.jsx
|
2992
|
-
- app/pb_kits/playbook/pb_text_input/docs/_text_input_sanitize.md
|
2993
2985
|
- app/pb_kits/playbook/pb_text_input/docs/example.yml
|
2994
2986
|
- app/pb_kits/playbook/pb_text_input/docs/index.js
|
2995
2987
|
- app/pb_kits/playbook/pb_text_input/index.js
|
@@ -3499,11 +3491,11 @@ files:
|
|
3499
3491
|
- app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
|
3500
3492
|
- app/pb_kits/playbook/utilities/text.ts
|
3501
3493
|
- app/pb_kits/playbook/utilities/validEmojiChecker.ts
|
3502
|
-
- dist/chunks/_typeahead-
|
3503
|
-
- dist/chunks/_weekday_stacked-
|
3494
|
+
- dist/chunks/_typeahead-BY6AFq1l.js
|
3495
|
+
- dist/chunks/_weekday_stacked-BwWArBYi.js
|
3504
3496
|
- dist/chunks/lazysizes-B7xYodB-.js
|
3505
|
-
- dist/chunks/lib-
|
3506
|
-
- dist/chunks/pb_form_validation-
|
3497
|
+
- dist/chunks/lib-BGzBzFZX.js
|
3498
|
+
- dist/chunks/pb_form_validation-BvNy9Bd6.js
|
3507
3499
|
- dist/chunks/vendor.js
|
3508
3500
|
- dist/menu.yml
|
3509
3501
|
- dist/playbook-doc.js
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import React, { useEffect, useState } from 'react'
|
2
|
-
import usePBCopy from '../../pb_copy_button/usePBCopy'
|
3
|
-
import Body from '../../pb_body/_body'
|
4
|
-
import Textarea from '../../pb_textarea/_textarea'
|
5
|
-
import Tooltip from '../../pb_tooltip/_tooltip'
|
6
|
-
|
7
|
-
const CopyButtonHook = ({...props}) => {
|
8
|
-
// This is how you can use the copy button hook to copy text to the clipboard
|
9
|
-
// eslint-disable-next-line no-unused-vars
|
10
|
-
const [copied, copyToClipboard] = usePBCopy({ from: 'hookbody' })
|
11
|
-
// I added a tooltip so it looks better in the ui
|
12
|
-
const [showTooltip, setShowTooltip] = useState(false)
|
13
|
-
|
14
|
-
const handleCopy = () => {
|
15
|
-
copyToClipboard()
|
16
|
-
setShowTooltip(true)
|
17
|
-
setTimeout(() => setShowTooltip(false), 1500)
|
18
|
-
}
|
19
|
-
|
20
|
-
useEffect(() => {
|
21
|
-
const el = document.getElementById('hookbody')
|
22
|
-
if (!el) return
|
23
|
-
|
24
|
-
el.addEventListener('click', handleCopy)
|
25
|
-
return () => {
|
26
|
-
el.removeEventListener('click', handleCopy)
|
27
|
-
}
|
28
|
-
}, [copyToClipboard])
|
29
|
-
|
30
|
-
return (
|
31
|
-
<div>
|
32
|
-
<Tooltip
|
33
|
-
delay={{ close: 1000 }}
|
34
|
-
forceOpenTooltip={showTooltip}
|
35
|
-
placement="top"
|
36
|
-
showTooltip={false}
|
37
|
-
text="Copied!"
|
38
|
-
>
|
39
|
-
<Body
|
40
|
-
cursor="pointer"
|
41
|
-
id="hookbody"
|
42
|
-
text="I'm a custom copy hook! Click this body to copy this text!"
|
43
|
-
/>
|
44
|
-
</Tooltip>
|
45
|
-
|
46
|
-
<Textarea
|
47
|
-
{...props}
|
48
|
-
placeholder="Paste here"
|
49
|
-
/>
|
50
|
-
</div>
|
51
|
-
)
|
52
|
-
}
|
53
|
-
|
54
|
-
export default CopyButtonHook
|
@@ -1,3 +0,0 @@
|
|
1
|
-
We provide a `usePBCopy` hook that you can import to your project. This hook will return a function that you can call to copy the text to the clipboard.
|
2
|
-
|
3
|
-
`usePBCopy({ from: 'your_id' })` will grab the `innerText` from `your_id` element, or `value` if it is an input element.
|
@@ -1,45 +0,0 @@
|
|
1
|
-
import { useState, useRef, useEffect } from 'react'
|
2
|
-
|
3
|
-
type UsePBCopyProps = {
|
4
|
-
value?: string
|
5
|
-
from?: string
|
6
|
-
timeout?: number
|
7
|
-
}
|
8
|
-
|
9
|
-
export default function usePBCopy({
|
10
|
-
value = '',
|
11
|
-
from = '',
|
12
|
-
timeout = 0,
|
13
|
-
}: UsePBCopyProps) {
|
14
|
-
const [copied, setCopied] = useState(false)
|
15
|
-
const timerRef = useRef<number>()
|
16
|
-
|
17
|
-
const copy = () => {
|
18
|
-
if (!value && !from) return
|
19
|
-
|
20
|
-
if (value) {
|
21
|
-
navigator.clipboard.writeText(value)
|
22
|
-
} else {
|
23
|
-
const el = document.getElementById(from)
|
24
|
-
let text = el?.innerText
|
25
|
-
if (el instanceof HTMLTextAreaElement || el instanceof HTMLInputElement) {
|
26
|
-
text = el.value
|
27
|
-
}
|
28
|
-
if (text) navigator.clipboard.writeText(text)
|
29
|
-
}
|
30
|
-
|
31
|
-
setCopied(true)
|
32
|
-
window.clearTimeout(timerRef.current)
|
33
|
-
timerRef.current = window.setTimeout(() => {
|
34
|
-
setCopied(false)
|
35
|
-
}, timeout)
|
36
|
-
}
|
37
|
-
|
38
|
-
useEffect(() => {
|
39
|
-
return () => {
|
40
|
-
window.clearTimeout(timerRef.current)
|
41
|
-
}
|
42
|
-
}, [])
|
43
|
-
|
44
|
-
return [copied, copy] as const
|
45
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import gaugeTheme from '../gaugeTheme'
|
3
|
-
import Highcharts from "highcharts"
|
4
|
-
import HighchartsReact from "highcharts-react-official"
|
5
|
-
import HighchartsMore from "highcharts/highcharts-more"
|
6
|
-
import SolidGauge from "highcharts/modules/solid-gauge"
|
7
|
-
|
8
|
-
HighchartsMore(Highcharts);
|
9
|
-
SolidGauge(Highcharts);
|
10
|
-
|
11
|
-
const data = [{ name: "Name", y: 45 }]
|
12
|
-
|
13
|
-
const baseOptions = {
|
14
|
-
title: { text: "" },
|
15
|
-
series: [{ data: data }],
|
16
|
-
};
|
17
|
-
|
18
|
-
const GaugePbStyles = () => {
|
19
|
-
const options = Highcharts.merge({}, gaugeTheme, baseOptions);
|
20
|
-
|
21
|
-
return (
|
22
|
-
<div>
|
23
|
-
<HighchartsReact
|
24
|
-
highcharts={Highcharts}
|
25
|
-
options={options}
|
26
|
-
/>
|
27
|
-
</div>
|
28
|
-
);
|
29
|
-
};
|
30
|
-
|
31
|
-
export default GaugePbStyles;
|
@@ -1 +0,0 @@
|
|
1
|
-
You don't need to use the Gauge Kit to apply Playbook styles to your Highcharts gauge chart. Just import gaugeTheme.ts and merge it with your chart options—Playbook’s styling will apply automatically.
|
@@ -1,83 +0,0 @@
|
|
1
|
-
import colors from '../tokens/exports/_colors.module.scss'
|
2
|
-
import typography from '../tokens/exports/_typography.module.scss'
|
3
|
-
|
4
|
-
const gaugeTheme = {
|
5
|
-
chart: {
|
6
|
-
type: "solidgauge",
|
7
|
-
events: {
|
8
|
-
render() {
|
9
|
-
this.container
|
10
|
-
const arc = this.container.querySelector('path.gauge-pane');
|
11
|
-
if (arc) arc.setAttribute('stroke-linejoin', 'round');
|
12
|
-
}
|
13
|
-
}
|
14
|
-
},
|
15
|
-
pane: {
|
16
|
-
size: "90%",
|
17
|
-
startAngle: -100,
|
18
|
-
endAngle: 100,
|
19
|
-
background: [
|
20
|
-
{
|
21
|
-
borderWidth: 20,
|
22
|
-
innerRadius: "90%",
|
23
|
-
outerRadius: "90%",
|
24
|
-
shape: "arc",
|
25
|
-
className: "gauge-pane",
|
26
|
-
borderColor: colors.border_light,
|
27
|
-
borderRadius: '50%',
|
28
|
-
},
|
29
|
-
],
|
30
|
-
},
|
31
|
-
tooltip: {
|
32
|
-
backgroundColor: {
|
33
|
-
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
34
|
-
stops: [
|
35
|
-
[0, colors.bg_dark],
|
36
|
-
[1, colors.bg_dark],
|
37
|
-
],
|
38
|
-
},
|
39
|
-
pointFormat:
|
40
|
-
'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
|
41
|
-
"<b>{point.y}</b>",
|
42
|
-
followPointer: true,
|
43
|
-
shadow: false,
|
44
|
-
borderWidth: 0,
|
45
|
-
borderRadius: 10,
|
46
|
-
style: {
|
47
|
-
fontFamily: typography.font_family_base,
|
48
|
-
color: colors.text_dk_default,
|
49
|
-
fontWeight: typography.regular,
|
50
|
-
fontSize: typography.text_smaller,
|
51
|
-
},
|
52
|
-
},
|
53
|
-
yAxis: {
|
54
|
-
min: 0,
|
55
|
-
max: 100,
|
56
|
-
lineWidth: 0,
|
57
|
-
tickPositions: [] as number[],
|
58
|
-
},
|
59
|
-
plotOptions: {
|
60
|
-
solidgauge: {
|
61
|
-
borderColor: colors.data_1,
|
62
|
-
borderWidth: 20,
|
63
|
-
color: colors.data_1,
|
64
|
-
radius: 90,
|
65
|
-
innerRadius: "90%",
|
66
|
-
y: -26,
|
67
|
-
dataLabels: {
|
68
|
-
borderWidth: 0,
|
69
|
-
color: colors.text_lt_default,
|
70
|
-
enabled: true,
|
71
|
-
format: '<span class="fix">{y:,f}</span>',
|
72
|
-
style: {
|
73
|
-
fontFamily: typography.font_family_base,
|
74
|
-
fontWeight: typography.regular,
|
75
|
-
fontSize: typography.heading_2,
|
76
|
-
},
|
77
|
-
y: -26,
|
78
|
-
},
|
79
|
-
},
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
export default gaugeTheme;
|
@@ -1,94 +0,0 @@
|
|
1
|
-
import React, { useState } from 'react'
|
2
|
-
|
3
|
-
import TextInput from '../../pb_text_input/_text_input'
|
4
|
-
|
5
|
-
const TextInputSanitize = (props) => {
|
6
|
-
const ref = React.createRef()
|
7
|
-
|
8
|
-
const [currency, setCurrency] = useState('')
|
9
|
-
const [sanitizedCurrency, setSanitizedCurrency] = useState('')
|
10
|
-
const handleOnChangeSanitizeCurrency = ({ target }, sanitizedValue) => {
|
11
|
-
setCurrency(target.value)
|
12
|
-
setSanitizedCurrency(sanitizedValue);
|
13
|
-
}
|
14
|
-
|
15
|
-
const [creditCard, setCreditCard] = useState('')
|
16
|
-
const [sanitizedCreditCard, setSanitizedCreditCard] = useState('')
|
17
|
-
const handleOnChangeSanitizeCC = ({ target }, sanitizedValue) => {
|
18
|
-
setCreditCard(target.value)
|
19
|
-
setSanitizedCreditCard(sanitizedValue);
|
20
|
-
}
|
21
|
-
|
22
|
-
const [ssn, setSSN] = useState('')
|
23
|
-
const [sanitizedSSN, setSanitizedSSN] = useState('')
|
24
|
-
const handleOnChangeSanitizeSSN = ({ target }, sanitizedValue) => {
|
25
|
-
setSSN(target.value)
|
26
|
-
setSanitizedSSN(sanitizedValue);
|
27
|
-
}
|
28
|
-
|
29
|
-
return (
|
30
|
-
<div>
|
31
|
-
<TextInput
|
32
|
-
label="Currency"
|
33
|
-
mask="currency"
|
34
|
-
onChange={handleOnChangeSanitizeCurrency}
|
35
|
-
placeholder="Enter Amount"
|
36
|
-
ref={ref}
|
37
|
-
value={currency}
|
38
|
-
{...props}
|
39
|
-
/>
|
40
|
-
|
41
|
-
{currency !== "" && (
|
42
|
-
<React.Fragment>{`The masked value is: ${currency}`}</React.Fragment>
|
43
|
-
)}
|
44
|
-
<br />
|
45
|
-
{sanitizedCurrency !== "" && (
|
46
|
-
<React.Fragment>{`The sanitized value is: ${sanitizedCurrency}`}</React.Fragment>
|
47
|
-
)}
|
48
|
-
|
49
|
-
<br />
|
50
|
-
<br />
|
51
|
-
|
52
|
-
<TextInput
|
53
|
-
label="Credit Card"
|
54
|
-
mask="creditCard"
|
55
|
-
onChange={handleOnChangeSanitizeCC}
|
56
|
-
placeholder="Enter Card"
|
57
|
-
ref={ref}
|
58
|
-
value={creditCard}
|
59
|
-
{...props}
|
60
|
-
/>
|
61
|
-
|
62
|
-
{creditCard !== "" && (
|
63
|
-
<React.Fragment>{`The masked value is: ${creditCard}`}</React.Fragment>
|
64
|
-
)}
|
65
|
-
<br />
|
66
|
-
{sanitizedCreditCard !== "" && (
|
67
|
-
<React.Fragment>{`The sanitized value is: ${sanitizedCreditCard}`}</React.Fragment>
|
68
|
-
)}
|
69
|
-
|
70
|
-
<br />
|
71
|
-
<br />
|
72
|
-
|
73
|
-
<TextInput
|
74
|
-
label="SSN"
|
75
|
-
mask="ssn"
|
76
|
-
onChange={handleOnChangeSanitizeSSN}
|
77
|
-
placeholder="Enter Amount"
|
78
|
-
ref={ref}
|
79
|
-
value={ssn}
|
80
|
-
{...props}
|
81
|
-
/>
|
82
|
-
|
83
|
-
{ssn !== "" && (
|
84
|
-
<React.Fragment>{`The masked value is: ${ssn}`}</React.Fragment>
|
85
|
-
)}
|
86
|
-
<br />
|
87
|
-
{sanitizedSSN !== "" && (
|
88
|
-
<React.Fragment>{`The sanitized value is: ${sanitizedSSN}`}</React.Fragment>
|
89
|
-
)}
|
90
|
-
</div>
|
91
|
-
)
|
92
|
-
}
|
93
|
-
|
94
|
-
export default TextInputSanitize
|