playbook_ui 14.13.0.pre.alpha.play1754pbtagprogressradio6121 → 14.13.0.pre.alpha.play1834depupdatesass6024
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_date_picker/_date_picker.tsx +1 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +1 -4
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -7
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +3 -6
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +2 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +0 -3
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +6 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +19 -7
- data/app/pb_kits/playbook/pb_nav/nav.html.erb +8 -3
- data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +6 -1
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +6 -1
- data/app/pb_kits/playbook/pb_progress_pills/progress_pills.html.erb +6 -1
- data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +11 -4
- data/app/pb_kits/playbook/pb_progress_step/progress_step.html.erb +5 -1
- data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +5 -1
- data/app/pb_kits/playbook/pb_radio/radio.html.erb +11 -5
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +2 -29
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +3 -31
- data/app/pb_kits/playbook/pb_table/table_body.html.erb +7 -13
- data/app/pb_kits/playbook/pb_table/table_body.rb +0 -2
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +7 -13
- data/app/pb_kits/playbook/pb_table/table_row.rb +0 -4
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +0 -14
- data/app/pb_kits/playbook/pb_text_input/index.js +0 -9
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -5
- data/dist/chunks/{_typeahead-C_q1qAtC.js → _typeahead-DQTwAd_2.js} +4 -4
- data/dist/chunks/_weekday_stacked-CnPEqV7l.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +4 -13
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.jsx +0 -90
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +0 -5
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.html.erb +0 -27
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.html.erb +0 -47
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.jsx +0 -88
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +0 -96
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.jsx +0 -101
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.md +0 -1
- data/dist/chunks/_weekday_stacked-DCeouuO3.js +0 -45
@@ -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-DQTwAd_2.js";import"react/jsx-runtime";import"react";import"./chunks/lib-WQEeEj3t.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-WQEeEj3t.js";import{I as INPUTMASKS}from"./chunks/_typeahead-C_q1qAtC.js";import"./chunks/pb_form_validation-Cq64l4zn.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")}}}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")}))}}PbTextInput.start();PbCopyButton.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();
|
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-WQEeEj3t.js";import{I as INPUTMASKS}from"./chunks/_typeahead-DQTwAd_2.js";import"./chunks/pb_form_validation-Cq64l4zn.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"}[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;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 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")}}}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")}))}}PbTextInput.start();PbCopyButton.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();
|
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.13.0.pre.alpha.
|
4
|
+
version: 14.13.0.pre.alpha.play1834depupdatesass6024
|
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-02-
|
12
|
+
date: 2025-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|
@@ -1187,8 +1187,6 @@ files:
|
|
1187
1187
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md
|
1188
1188
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb
|
1189
1189
|
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md
|
1190
|
-
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.jsx
|
1191
|
-
- app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md
|
1192
1190
|
- app/pb_kits/playbook/pb_draggable/docs/example.yml
|
1193
1191
|
- app/pb_kits/playbook/pb_draggable/docs/index.js
|
1194
1192
|
- app/pb_kits/playbook/pb_draggable/draggable.html.erb
|
@@ -1631,7 +1629,6 @@ files:
|
|
1631
1629
|
- app/pb_kits/playbook/pb_icon/icon.test.js
|
1632
1630
|
- app/pb_kits/playbook/pb_icon_button/_icon_button.scss
|
1633
1631
|
- app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb
|
1634
|
-
- app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.html.erb
|
1635
1632
|
- app/pb_kits/playbook/pb_icon_button/docs/example.yml
|
1636
1633
|
- app/pb_kits/playbook/pb_icon_button/icon_button.html.erb
|
1637
1634
|
- app/pb_kits/playbook/pb_icon_button/icon_button.rb
|
@@ -2746,9 +2743,6 @@ files:
|
|
2746
2743
|
- app/pb_kits/playbook/pb_table/docs/_table_vertical_border.jsx
|
2747
2744
|
- app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.html.erb
|
2748
2745
|
- app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.jsx
|
2749
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.html.erb
|
2750
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.jsx
|
2751
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.md
|
2752
2746
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.html.erb
|
2753
2747
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx
|
2754
2748
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_rails.md
|
@@ -2767,9 +2761,6 @@ files:
|
|
2767
2761
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md
|
2768
2762
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.html.erb
|
2769
2763
|
- app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table_rails.md
|
2770
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb
|
2771
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.jsx
|
2772
|
-
- app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.md
|
2773
2764
|
- app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents.jsx
|
2774
2765
|
- app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents.md
|
2775
2766
|
- app/pb_kits/playbook/pb_table/docs/_table_with_subcomponents_as_divs.html.erb
|
@@ -3341,8 +3332,8 @@ files:
|
|
3341
3332
|
- app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
|
3342
3333
|
- app/pb_kits/playbook/utilities/text.ts
|
3343
3334
|
- app/pb_kits/playbook/utilities/validEmojiChecker.ts
|
3344
|
-
- dist/chunks/_typeahead-
|
3345
|
-
- dist/chunks/_weekday_stacked-
|
3335
|
+
- dist/chunks/_typeahead-DQTwAd_2.js
|
3336
|
+
- dist/chunks/_weekday_stacked-CnPEqV7l.js
|
3346
3337
|
- dist/chunks/lazysizes-B7xYodB-.js
|
3347
3338
|
- dist/chunks/lib-WQEeEj3t.js
|
3348
3339
|
- dist/chunks/pb_form_validation-Cq64l4zn.js
|
@@ -1,90 +0,0 @@
|
|
1
|
-
import React, { useState } from "react";
|
2
|
-
import { Flex, Table, Body, Avatar, DraggableProvider } from "playbook-ui";
|
3
|
-
|
4
|
-
// Initial items to be dragged
|
5
|
-
const data = [
|
6
|
-
{
|
7
|
-
id: "1",
|
8
|
-
task: "Task 1",
|
9
|
-
assignee_name: "Terry Miles",
|
10
|
-
assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
|
11
|
-
},
|
12
|
-
{
|
13
|
-
id: "2",
|
14
|
-
task: "Task 2",
|
15
|
-
assignee_name: "Sophia Miles",
|
16
|
-
assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
|
17
|
-
},
|
18
|
-
{
|
19
|
-
id: "3",
|
20
|
-
task: "Task 3",
|
21
|
-
assignee_name: "Alice Jones",
|
22
|
-
assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
|
23
|
-
},
|
24
|
-
{
|
25
|
-
id: "4",
|
26
|
-
task: "Task 4",
|
27
|
-
assignee_name: "Mike James",
|
28
|
-
assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
|
29
|
-
},
|
30
|
-
{
|
31
|
-
id: "5",
|
32
|
-
task: "Task 5",
|
33
|
-
assignee_name: "James Guy",
|
34
|
-
assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
|
35
|
-
}
|
36
|
-
];
|
37
|
-
|
38
|
-
const DraggableWithTableReact = (props) => {
|
39
|
-
const [initialState, setInitialState] = useState(data);
|
40
|
-
|
41
|
-
return (
|
42
|
-
<>
|
43
|
-
<DraggableProvider initialItems={data}
|
44
|
-
onReorder={(items) => setInitialState(items)}
|
45
|
-
>
|
46
|
-
<Table
|
47
|
-
responsive="none"
|
48
|
-
size="sm"
|
49
|
-
{...props}
|
50
|
-
>
|
51
|
-
<Table.Head>
|
52
|
-
<Table.Row>
|
53
|
-
<Table.Header>{"id"}</Table.Header>
|
54
|
-
<Table.Header>{"name"}</Table.Header>
|
55
|
-
<Table.Header>{"task number"}</Table.Header>
|
56
|
-
</Table.Row>
|
57
|
-
</Table.Head>
|
58
|
-
<Table.Body draggableContainer>
|
59
|
-
{initialState.map(({ id, task, assignee_name, assignee_img }) => (
|
60
|
-
<Table.Row
|
61
|
-
dragId={id}
|
62
|
-
draggableItem
|
63
|
-
key={id}
|
64
|
-
>
|
65
|
-
<Table.Cell>{id}</Table.Cell>
|
66
|
-
<Table.Cell>
|
67
|
-
<Flex align="center">
|
68
|
-
<Avatar
|
69
|
-
imageUrl={assignee_img}
|
70
|
-
size="xs"
|
71
|
-
/>
|
72
|
-
<Body
|
73
|
-
paddingLeft="xxs"
|
74
|
-
text={assignee_name}
|
75
|
-
{...props}
|
76
|
-
/>
|
77
|
-
</Flex>
|
78
|
-
</Table.Cell>
|
79
|
-
<Table.Cell>{task}</Table.Cell>
|
80
|
-
</Table.Row>
|
81
|
-
))}
|
82
|
-
</Table.Body>
|
83
|
-
</Table>
|
84
|
-
</DraggableProvider>
|
85
|
-
</>
|
86
|
-
|
87
|
-
);
|
88
|
-
};
|
89
|
-
|
90
|
-
export default DraggableWithTableReact;
|
@@ -1,5 +0,0 @@
|
|
1
|
-
The draggable kit can also be used in conjunction with the table kit to create draggable table rows. To do this:
|
2
|
-
|
3
|
-
- Wrap the Table with the `DraggableProvider` and manage state as shown.
|
4
|
-
- use the `draggableContainer` prop on the Table.Body to designate it as the Draggable Container
|
5
|
-
- use the `draggableItem` prop on the Table.Row to designate it as the Draggable Item. Make sure to also pass id to the `dragId` prop here.
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<%= pb_rails("flex", props: { align: "center"}) do %>
|
2
|
-
<%= pb_rails("icon_button", props: {size: "lg"}) %> <span>Large</span>
|
3
|
-
<% end %>
|
4
|
-
|
5
|
-
<%= pb_rails("flex", props: { align: "center" }) do %>
|
6
|
-
<%= pb_rails("icon_button", props: {size: "sm"}) %> <span>Small</span>
|
7
|
-
<% end %>
|
8
|
-
|
9
|
-
<%= pb_rails("flex", props: { align: "center" }) do %>
|
10
|
-
<%= pb_rails("icon_button", props: {size: "xs"}) %> <span>XSmall</span>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<%= pb_rails("flex", props: { align: "center", margin_top: "md" }) do %>
|
14
|
-
<%= pb_rails("icon_button", props: {size: "1x"}) %> <span>1x</span>
|
15
|
-
<% end %>
|
16
|
-
|
17
|
-
<%= pb_rails("flex", props: { align: "center" }) do %>
|
18
|
-
<%= pb_rails("icon_button", props: {size: "2x"}) %> <span>2x</span>
|
19
|
-
<% end %>
|
20
|
-
|
21
|
-
<%= pb_rails("flex", props: { align: "center" }) do %>
|
22
|
-
<%= pb_rails("icon_button", props: {size: "3x"}) %> <span>3x</span>
|
23
|
-
<% end %>
|
24
|
-
|
25
|
-
<%= pb_rails("flex", props: { align: "center" }) do %>
|
26
|
-
<%= pb_rails("icon_button", props: {size: "4x"}) %> <span>4x</span>
|
27
|
-
<% end %>
|
@@ -1,47 +0,0 @@
|
|
1
|
-
<%= pb_rails("table", props: { size: "sm" }) do %>
|
2
|
-
<%= pb_rails("table/table_head") do %>
|
3
|
-
<%= pb_rails("table/table_row") do %>
|
4
|
-
<%= pb_rails("table/table_header", props: { text: "Column 1" }) %>
|
5
|
-
<%= pb_rails("table/table_header", props: { text: "Column 2" }) %>
|
6
|
-
<%= pb_rails("table/table_header", props: { text: "Column 3" }) %>
|
7
|
-
<%= pb_rails("table/table_header", props: { text: "Column 4" }) %>
|
8
|
-
<%= pb_rails("table/table_header", props: { text: "Column 5" }) %>
|
9
|
-
<%= pb_rails("table/table_header", props: { text: "" }) %>
|
10
|
-
<% end %>
|
11
|
-
<% end %>
|
12
|
-
<%= pb_rails("table/table_body") do %>
|
13
|
-
<%= pb_rails("table/table_row", props: { cursor: "pointer", html_options: { onclick: "alert('Row 1 clicked')" } }) do %>
|
14
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1" }) %>
|
15
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2" }) %>
|
16
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3" }) %>
|
17
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4" }) %>
|
18
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5" }) %>
|
19
|
-
<%= pb_rails("table/table_cell", props: { text_align: "right" }) do %>
|
20
|
-
<%= pb_rails("icon", props: { color: "primary_action", fixed_width: true, icon: "chevron-right", size: "xs" }) %>
|
21
|
-
<% end %>
|
22
|
-
<% end %>
|
23
|
-
|
24
|
-
<%= pb_rails("table/table_row", props: { cursor: "pointer", html_options: { onclick: "alert('Row 2 clicked')" } }) do %>
|
25
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1" }) %>
|
26
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2" }) %>
|
27
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3" }) %>
|
28
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4" }) %>
|
29
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5" }) %>
|
30
|
-
<%= pb_rails("table/table_cell", props: { text_align: "right" }) do %>
|
31
|
-
<%= pb_rails("icon", props: { color: "primary_action", fixed_width: true, icon: "chevron-right", size: "xs" }) %>
|
32
|
-
<% end %>
|
33
|
-
<% end %>
|
34
|
-
|
35
|
-
<%= pb_rails("table/table_row", props: { cursor: "pointer", html_options: { onclick: "alert('Row 3 clicked')" } }) do %>
|
36
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 1" }) %>
|
37
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2" }) %>
|
38
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3" }) %>
|
39
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4" }) %>
|
40
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5" }) %>
|
41
|
-
<%= pb_rails("table/table_cell", props: { text_align: "right" }) do %>
|
42
|
-
<%= pb_rails("icon", props: { color: "primary_action", fixed_width: true, icon: "chevron-right", size: "xs" }) %>
|
43
|
-
<% end %>
|
44
|
-
<% end %>
|
45
|
-
<% end %>
|
46
|
-
<% end %>
|
47
|
-
|
@@ -1,88 +0,0 @@
|
|
1
|
-
import React from 'react'
|
2
|
-
import { Table, Icon } from 'playbook-ui'
|
3
|
-
|
4
|
-
const TableWithClickableRows = (props) => {
|
5
|
-
|
6
|
-
|
7
|
-
return (
|
8
|
-
<Table
|
9
|
-
size="sm"
|
10
|
-
{...props}
|
11
|
-
>
|
12
|
-
<Table.Head>
|
13
|
-
<Table.Row>
|
14
|
-
<Table.Header>{"Column 1"}</Table.Header>
|
15
|
-
<Table.Header>{"Column 2"}</Table.Header>
|
16
|
-
<Table.Header>{"Column 3"}</Table.Header>
|
17
|
-
<Table.Header>{"Column 4"}</Table.Header>
|
18
|
-
<Table.Header>{"Column 5"}</Table.Header>
|
19
|
-
<Table.Header>{""}</Table.Header>
|
20
|
-
</Table.Row>
|
21
|
-
</Table.Head>
|
22
|
-
<Table.Body>
|
23
|
-
<Table.Row
|
24
|
-
cursor="pointer"
|
25
|
-
htmlOptions={{ onClick: () => alert("Row 1 clicked") }}
|
26
|
-
{...props}
|
27
|
-
>
|
28
|
-
<Table.Cell>{"Value 1"}</Table.Cell>
|
29
|
-
<Table.Cell>{"Value 2"}</Table.Cell>
|
30
|
-
<Table.Cell>{"Value 3"}</Table.Cell>
|
31
|
-
<Table.Cell>{"Value 4"}</Table.Cell>
|
32
|
-
<Table.Cell>{"Value 5"}</Table.Cell>
|
33
|
-
<Table.Cell textAlign="right">
|
34
|
-
<Icon
|
35
|
-
color="primary_action"
|
36
|
-
fixedWidth
|
37
|
-
icon="chevron-right"
|
38
|
-
size="xs"
|
39
|
-
{...props}
|
40
|
-
/>
|
41
|
-
</Table.Cell>
|
42
|
-
</Table.Row>
|
43
|
-
<Table.Row
|
44
|
-
cursor="pointer"
|
45
|
-
htmlOptions={{ onClick: () => alert("Row 2 clicked") }}
|
46
|
-
{...props}
|
47
|
-
>
|
48
|
-
<Table.Cell>{"Value 1"}</Table.Cell>
|
49
|
-
<Table.Cell>{"Value 2"}</Table.Cell>
|
50
|
-
<Table.Cell>{"Value 3"}</Table.Cell>
|
51
|
-
<Table.Cell>{"Value 4"}</Table.Cell>
|
52
|
-
<Table.Cell>{"Value 5"}</Table.Cell>
|
53
|
-
<Table.Cell textAlign="right">
|
54
|
-
<Icon
|
55
|
-
color="primary_action"
|
56
|
-
fixedWidth
|
57
|
-
icon="chevron-right"
|
58
|
-
size="xs"
|
59
|
-
{...props}
|
60
|
-
/>
|
61
|
-
</Table.Cell>
|
62
|
-
</Table.Row>
|
63
|
-
<Table.Row
|
64
|
-
cursor="pointer"
|
65
|
-
htmlOptions={{ onClick: () => alert("Row 3 clicked") }}
|
66
|
-
{...props}
|
67
|
-
>
|
68
|
-
<Table.Cell>{"Value 1"}</Table.Cell>
|
69
|
-
<Table.Cell>{"Value 2"}</Table.Cell>
|
70
|
-
<Table.Cell>{"Value 3"}</Table.Cell>
|
71
|
-
<Table.Cell>{"Value 4"}</Table.Cell>
|
72
|
-
<Table.Cell>{"Value 5"}</Table.Cell>
|
73
|
-
<Table.Cell textAlign="right">
|
74
|
-
<Icon
|
75
|
-
color="primary_action"
|
76
|
-
fixedWidth
|
77
|
-
icon="chevron-right"
|
78
|
-
size="xs"
|
79
|
-
{...props}
|
80
|
-
/>
|
81
|
-
</Table.Cell>
|
82
|
-
</Table.Row>
|
83
|
-
</Table.Body>
|
84
|
-
</Table>
|
85
|
-
)
|
86
|
-
}
|
87
|
-
|
88
|
-
export default TableWithClickableRows
|
@@ -1 +0,0 @@
|
|
1
|
-
Clickable table rows do not require any additional props. This doc example showcases how to set them up using `html_options`/`htmlOptions` and click events. Using the global prop for cursor to set it to "pointer" is also recommended for better UX.
|
@@ -1,96 +0,0 @@
|
|
1
|
-
<% checkboxes = [
|
2
|
-
{ name: 'Coffee', id: 'coffee', checked: false },
|
3
|
-
{ name: 'Ice Cream', id: 'ice-cream', checked: false },
|
4
|
-
{ name: 'Chocolate', id: 'chocolate', checked: true }
|
5
|
-
] %>
|
6
|
-
|
7
|
-
<%= pb_rails("flex", props: { justify: "end", margin_bottom: "sm" }) do %>
|
8
|
-
<%= pb_rails("flex", props: { justify: "end", margin_bottom: "sm" }) do %>
|
9
|
-
<%= pb_rails("button", props: { text: "Delete", id: "delete-button" }) %>
|
10
|
-
<% end %>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<%= pb_rails("table", props: { size: "sm" }) do %>
|
14
|
-
<%= pb_rails("table/table_head") do %>
|
15
|
-
<%= pb_rails("table/table_row") do %>
|
16
|
-
<%= pb_rails("table/table_header") do %>
|
17
|
-
<%= pb_rails("checkbox", props: {
|
18
|
-
checked: true,
|
19
|
-
value: "checkbox-value",
|
20
|
-
name: "main-checkbox-selectable",
|
21
|
-
indeterminate: true,
|
22
|
-
id: "checkbox-selectable"
|
23
|
-
}) %>
|
24
|
-
<% end %>
|
25
|
-
<%= pb_rails("table/table_header", props: { text: "Column 1" }) %>
|
26
|
-
<%= pb_rails("table/table_header", props: { text: "Column 2" }) %>
|
27
|
-
<%= pb_rails("table/table_header", props: { text: "Column 3" }) %>
|
28
|
-
<%= pb_rails("table/table_header", props: { text: "Column 4" }) %>
|
29
|
-
<%= pb_rails("table/table_header", props: { text: "Column 5" }) %>
|
30
|
-
<% end %>
|
31
|
-
<% end %>
|
32
|
-
<%= pb_rails("table/table_body") do %>
|
33
|
-
<% checkboxes.each_with_index do |checkbox, index| %>
|
34
|
-
<%= pb_rails("table/table_row") do %>
|
35
|
-
<%= pb_rails("table/table_cell") do %>
|
36
|
-
<%= pb_rails("checkbox", props: { checked: checkbox[:checked], id: "#{checkbox[:id]}-selectable-checkbox", name: "#{checkbox[:id]}-selectable-checkbox", on_change: "updateCheckboxes(#{index})", value: "check-box value" }) %>
|
37
|
-
<% end %>
|
38
|
-
<%= pb_rails("table/table_cell") do %>
|
39
|
-
<%= pb_rails("image", props: { alt: "picture of a misty forest", size: "xs", url: "https://unsplash.it/500/400/?image=634" }) %>
|
40
|
-
<% end %>
|
41
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 2" }) %>
|
42
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 3" }) %>
|
43
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 4" }) %>
|
44
|
-
<%= pb_rails("table/table_cell", props: { text: "Value 5" }) %>
|
45
|
-
<% end %>
|
46
|
-
<% end %>
|
47
|
-
<% end %>
|
48
|
-
<% end %>
|
49
|
-
|
50
|
-
<script>
|
51
|
-
document.addEventListener('DOMContentLoaded', function() {
|
52
|
-
const mainCheckboxWrapper = document.getElementById('checkbox-selectable');
|
53
|
-
const mainCheckbox = document.getElementsByName("main-checkbox-selectable")[0];
|
54
|
-
const childCheckboxes = document.querySelectorAll('input[type="checkbox"][id$="selectable-checkbox"]');
|
55
|
-
const deleteButton = document.getElementById('delete-button');
|
56
|
-
|
57
|
-
const updateDeleteButton = () => {
|
58
|
-
const anyChecked = Array.from(childCheckboxes).some(checkbox => checkbox.checked);
|
59
|
-
deleteButton.style.display = anyChecked ? 'block' : 'none';
|
60
|
-
};
|
61
|
-
|
62
|
-
const updateMainCheckbox = () => {
|
63
|
-
// Count the number of checked child checkboxes
|
64
|
-
const checkedCount = Array.from(childCheckboxes).filter(cb => cb.checked).length;
|
65
|
-
// Determine if the main checkbox should be in an indeterminate state
|
66
|
-
const indeterminate = checkedCount > 0 && checkedCount < childCheckboxes.length;
|
67
|
-
|
68
|
-
// Set the main checkbox states
|
69
|
-
mainCheckbox.indeterminate = indeterminate;
|
70
|
-
mainCheckbox.checked = checkedCount > 0;
|
71
|
-
|
72
|
-
// Determine the icon class to add and remove based on the number of checked checkboxes
|
73
|
-
const iconClassToAdd = checkedCount === 0 ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
|
74
|
-
const iconClassToRemove = checkedCount === 0 ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
|
75
|
-
|
76
|
-
// Add and remove the icon class to the main checkbox wrapper
|
77
|
-
mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.add(iconClassToAdd);
|
78
|
-
mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.remove(iconClassToRemove);
|
79
|
-
|
80
|
-
// Toggle the visibility of the checkbox icon based on the indeterminate state
|
81
|
-
mainCheckboxWrapper.getElementsByClassName("indeterminate_icon")[0].classList.toggle('hidden', !indeterminate);
|
82
|
-
mainCheckboxWrapper.getElementsByClassName("check_icon")[0].classList.toggle('hidden', indeterminate);
|
83
|
-
|
84
|
-
updateDeleteButton();
|
85
|
-
};
|
86
|
-
|
87
|
-
mainCheckbox.addEventListener('change', function() {
|
88
|
-
childCheckboxes.forEach(cb => cb.checked = this.checked);
|
89
|
-
updateMainCheckbox();
|
90
|
-
});
|
91
|
-
|
92
|
-
childCheckboxes.forEach(cb => {
|
93
|
-
cb.addEventListener('change', updateMainCheckbox);
|
94
|
-
});
|
95
|
-
});
|
96
|
-
</script>
|