playbook_ui 15.1.0.pre.alpha.PLAY2468phonenuminputvalidation10993 → 15.1.0.pre.alpha.PLAY251810942
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_dropdown/_dropdown.scss +105 -29
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +13 -37
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +25 -198
- data/dist/chunks/{_line_graph-C3zTTfo0.js → _line_graph-C9stNsP3.js} +1 -1
- data/dist/chunks/{_typeahead-CfKPIYmd.js → _typeahead-D3MtsWXG.js} +1 -1
- data/dist/chunks/{_weekday_stacked-CUTwEQ-P.js → _weekday_stacked-Bvc7R5vH.js} +1 -1
- data/dist/chunks/pb_form_validation-CleM960_.js +1 -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/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -6
- data/dist/chunks/pb_form_validation-D1VURgVg.js +0 -1
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: 15.1.0.pre.alpha.
|
|
4
|
+
version: 15.1.0.pre.alpha.PLAY251810942
|
|
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-10-
|
|
12
|
+
date: 2025-10-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: actionpack
|
|
@@ -3707,13 +3707,13 @@ files:
|
|
|
3707
3707
|
- app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
|
|
3708
3708
|
- app/pb_kits/playbook/utilities/text.ts
|
|
3709
3709
|
- app/pb_kits/playbook/utilities/validEmojiChecker.ts
|
|
3710
|
-
- dist/chunks/_line_graph-
|
|
3711
|
-
- dist/chunks/_typeahead-
|
|
3712
|
-
- dist/chunks/_weekday_stacked-
|
|
3710
|
+
- dist/chunks/_line_graph-C9stNsP3.js
|
|
3711
|
+
- dist/chunks/_typeahead-D3MtsWXG.js
|
|
3712
|
+
- dist/chunks/_weekday_stacked-Bvc7R5vH.js
|
|
3713
3713
|
- dist/chunks/componentRegistry-DzmmLR2x.js
|
|
3714
3714
|
- dist/chunks/lazysizes-B7xYodB-.js
|
|
3715
3715
|
- dist/chunks/lib-QZuu1ltS.js
|
|
3716
|
-
- dist/chunks/pb_form_validation-
|
|
3716
|
+
- dist/chunks/pb_form_validation-CleM960_.js
|
|
3717
3717
|
- dist/chunks/vendor.js
|
|
3718
3718
|
- dist/menu.yml
|
|
3719
3719
|
- dist/playbook-doc.js
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as PbEnhancedElement,d as debounce}from"./lib-QZuu1ltS.js";const KIT_SELECTOR='[class^="pb_"][class*="_kit"]';const ERROR_MESSAGE_SELECTOR=".pb_body_kit_negative";const FORM_SELECTOR='form[data-pb-form-validation="true"]';const REQUIRED_FIELDS_SELECTOR="input[required],textarea[required],select[required]";const PHONE_NUMBER_VALIDATION_ERROR_SELECTOR='[data-pb-phone-validation-error="true"]';const FIELD_EVENTS=["change","valid","invalid"];class PbFormValidation extends PbEnhancedElement{static get selector(){return FORM_SELECTOR}connect(){this.formValidationFields.forEach((field=>{const isPhoneNumberInput=field.closest(".pb_phone_number_input");if(isPhoneNumberInput)return;FIELD_EVENTS.forEach((e=>{field.addEventListener(e,debounce((event=>{this.validateFormField(event)}),250),false)}))}));this.element.addEventListener("submit",(event=>{if(this.hasPhoneNumberValidationErrors()){event.preventDefault();return false}}))}validateFormField(event){event.preventDefault();const{target:target}=event;target.setCustomValidity("");const isValid=event.target.validity.valid;if(isValid){this.clearError(target)}else{this.showValidationMessage(target)}}showValidationMessage(target){const{parentElement:parentElement}=target;const kitElement=parentElement.closest(KIT_SELECTOR);const isPhoneNumberInput=kitElement&&kitElement.classList.contains("pb_phone_number_input");this.clearError(target);kitElement.classList.add("error");if(!isPhoneNumberInput){const errorMessageContainer=this.errorMessageContainer;if(target.dataset.message)target.setCustomValidity(target.dataset.message);errorMessageContainer.innerHTML=target.validationMessage;parentElement.appendChild(errorMessageContainer)}}clearError(target){const{parentElement:parentElement}=target;parentElement.closest(KIT_SELECTOR).classList.remove("error");const errorMessageContainer=parentElement.querySelector(ERROR_MESSAGE_SELECTOR);if(errorMessageContainer)errorMessageContainer.remove()}hasPhoneNumberValidationErrors(){const phoneNumberErrors=this.element.querySelectorAll(PHONE_NUMBER_VALIDATION_ERROR_SELECTOR);return phoneNumberErrors.length>0}get errorMessageContainer(){const errorContainer=document.createElement("div");const kitClassName=ERROR_MESSAGE_SELECTOR.replace(/\./,"");errorContainer.classList.add(kitClassName);return errorContainer}get formValidationFields(){return this._formValidationFields=this._formValidationFields||this.element.querySelectorAll(REQUIRED_FIELDS_SELECTOR)}}window.PbFormValidation=PbFormValidation;
|