playbook_ui 15.1.0.pre.alpha.PLAY2468phonenuminputvalidation10993 → 15.1.0.pre.alpha.alphaforaudiences151011000
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_advanced_table/Hooks/useTableState.ts +0 -2
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +4 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_stacked_alert.html.erb +16 -16
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_stacked_alert.jsx +2 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.html.erb +31 -31
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.jsx +4 -3
- 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/app/pb_kits/playbook/pb_text_input/_text_input.tsx +14 -6
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.html.erb +8 -4
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +5 -0
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.md +1 -0
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +3 -1
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +6 -0
- data/dist/chunks/{_line_graph-C3zTTfo0.js → _line_graph-BnK1i7QI.js} +1 -1
- data/dist/chunks/{_typeahead-CfKPIYmd.js → _typeahead-pbS3fEzb.js} +1 -1
- data/dist/chunks/{_weekday_stacked-CUTwEQ-P.js → _weekday_stacked-OOFiMFSs.js} +2 -2
- data/dist/chunks/pb_form_validation-CleM960_.js +1 -0
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +2 -2
- 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 -5
- 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.alphaforaudiences151011000
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Power UX
|
|
@@ -3180,6 +3180,7 @@ files:
|
|
|
3180
3180
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_custom.jsx
|
|
3181
3181
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_default.html.erb
|
|
3182
3182
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx
|
|
3183
|
+
- app/pb_kits/playbook/pb_text_input/docs/_text_input_default.md
|
|
3183
3184
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_default_swift.md
|
|
3184
3185
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled.html.erb
|
|
3185
3186
|
- app/pb_kits/playbook/pb_text_input/docs/_text_input_disabled.jsx
|
|
@@ -3707,13 +3708,13 @@ files:
|
|
|
3707
3708
|
- app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
|
|
3708
3709
|
- app/pb_kits/playbook/utilities/text.ts
|
|
3709
3710
|
- app/pb_kits/playbook/utilities/validEmojiChecker.ts
|
|
3710
|
-
- dist/chunks/_line_graph-
|
|
3711
|
-
- dist/chunks/_typeahead-
|
|
3712
|
-
- dist/chunks/_weekday_stacked-
|
|
3711
|
+
- dist/chunks/_line_graph-BnK1i7QI.js
|
|
3712
|
+
- dist/chunks/_typeahead-pbS3fEzb.js
|
|
3713
|
+
- dist/chunks/_weekday_stacked-OOFiMFSs.js
|
|
3713
3714
|
- dist/chunks/componentRegistry-DzmmLR2x.js
|
|
3714
3715
|
- dist/chunks/lazysizes-B7xYodB-.js
|
|
3715
3716
|
- dist/chunks/lib-QZuu1ltS.js
|
|
3716
|
-
- dist/chunks/pb_form_validation-
|
|
3717
|
+
- dist/chunks/pb_form_validation-CleM960_.js
|
|
3717
3718
|
- dist/chunks/vendor.js
|
|
3718
3719
|
- dist/menu.yml
|
|
3719
3720
|
- 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;
|