@wordpress/dataviews 11.3.1-next.v.0 → 12.0.0
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.
- package/CHANGELOG.md +46 -1
- package/README.md +44 -2
- package/build/components/dataform-controls/adaptive-select.cjs +52 -0
- package/build/components/dataform-controls/adaptive-select.cjs.map +7 -0
- package/build/components/dataform-controls/array.cjs +2 -0
- package/build/components/dataform-controls/array.cjs.map +2 -2
- package/build/components/dataform-controls/checkbox.cjs +2 -0
- package/build/components/dataform-controls/checkbox.cjs.map +2 -2
- package/build/components/dataform-controls/color.cjs +21 -30
- package/build/components/dataform-controls/color.cjs.map +3 -3
- package/build/components/dataform-controls/combobox.cjs +80 -0
- package/build/components/dataform-controls/combobox.cjs.map +7 -0
- package/build/components/dataform-controls/date.cjs +58 -19
- package/build/components/dataform-controls/date.cjs.map +2 -2
- package/build/components/dataform-controls/datetime.cjs +11 -3
- package/build/components/dataform-controls/datetime.cjs.map +2 -2
- package/build/components/dataform-controls/email.cjs +2 -0
- package/build/components/dataform-controls/email.cjs.map +2 -2
- package/build/components/dataform-controls/index.cjs +5 -1
- package/build/components/dataform-controls/index.cjs.map +3 -3
- package/build/components/dataform-controls/password.cjs +2 -0
- package/build/components/dataform-controls/password.cjs.map +2 -2
- package/build/components/dataform-controls/radio.cjs +2 -0
- package/build/components/dataform-controls/radio.cjs.map +2 -2
- package/build/components/dataform-controls/select.cjs +2 -0
- package/build/components/dataform-controls/select.cjs.map +2 -2
- package/build/components/dataform-controls/telephone.cjs +2 -0
- package/build/components/dataform-controls/telephone.cjs.map +2 -2
- package/build/components/dataform-controls/text.cjs +2 -0
- package/build/components/dataform-controls/text.cjs.map +2 -2
- package/build/components/dataform-controls/textarea.cjs +2 -0
- package/build/components/dataform-controls/textarea.cjs.map +2 -2
- package/build/components/dataform-controls/toggle-group.cjs +2 -0
- package/build/components/dataform-controls/toggle-group.cjs.map +2 -2
- package/build/components/dataform-controls/toggle.cjs +2 -0
- package/build/components/dataform-controls/toggle.cjs.map +2 -2
- package/build/components/dataform-controls/url.cjs +2 -0
- package/build/components/dataform-controls/url.cjs.map +2 -2
- package/build/components/dataform-controls/utils/relative-date-control.cjs +1 -1
- package/build/components/dataform-controls/utils/relative-date-control.cjs.map +1 -1
- package/build/components/dataform-controls/utils/validated-input.cjs +2 -0
- package/build/components/dataform-controls/utils/validated-input.cjs.map +2 -2
- package/build/components/dataform-controls/utils/validated-number.cjs +2 -0
- package/build/components/dataform-controls/utils/validated-number.cjs.map +2 -2
- package/build/components/dataform-layouts/card/index.cjs +28 -3
- package/build/components/dataform-layouts/card/index.cjs.map +3 -3
- package/build/components/dataform-layouts/data-form-layout.cjs +11 -2
- package/build/components/dataform-layouts/data-form-layout.cjs.map +2 -2
- package/build/components/dataform-layouts/details/index.cjs +69 -12
- package/build/components/dataform-layouts/details/index.cjs.map +3 -3
- package/build/components/dataform-layouts/index.cjs +5 -5
- package/build/components/dataform-layouts/index.cjs.map +1 -1
- package/build/components/dataform-layouts/normalize-form.cjs +2 -1
- package/build/components/dataform-layouts/normalize-form.cjs.map +2 -2
- package/build/components/dataform-layouts/panel/dropdown.cjs +88 -63
- package/build/components/dataform-layouts/panel/dropdown.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/index.cjs +13 -175
- package/build/components/dataform-layouts/panel/index.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/modal.cjs +28 -18
- package/build/components/dataform-layouts/panel/modal.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/summary-button.cjs +125 -56
- package/build/components/dataform-layouts/panel/summary-button.cjs.map +3 -3
- package/build/components/dataform-layouts/panel/utils/get-first-validation-error.cjs +59 -0
- package/build/components/dataform-layouts/panel/utils/get-first-validation-error.cjs.map +7 -0
- package/build/components/dataform-layouts/panel/utils/get-label-classname.cjs +45 -0
- package/build/components/dataform-layouts/panel/utils/get-label-classname.cjs.map +7 -0
- package/build/components/dataform-layouts/panel/utils/get-label-content.cjs +36 -0
- package/build/components/dataform-layouts/panel/utils/get-label-content.cjs.map +7 -0
- package/build/components/dataform-layouts/panel/utils/use-field-from-form-field.cjs +77 -0
- package/build/components/dataform-layouts/panel/utils/use-field-from-form-field.cjs.map +7 -0
- package/build/components/dataform-layouts/regular/index.cjs +6 -3
- package/build/components/dataform-layouts/regular/index.cjs.map +2 -2
- package/build/components/dataform-layouts/row/index.cjs +5 -2
- package/build/components/dataform-layouts/row/index.cjs.map +2 -2
- package/build/components/dataform-layouts/validation-badge.cjs +67 -0
- package/build/components/dataform-layouts/validation-badge.cjs.map +7 -0
- package/build/components/dataviews-bulk-actions/index.cjs +4 -4
- package/build/components/dataviews-bulk-actions/index.cjs.map +2 -2
- package/build/components/dataviews-context/index.cjs.map +2 -2
- package/build/components/dataviews-filters/filter.cjs +1 -1
- package/build/components/dataviews-filters/filter.cjs.map +1 -1
- package/build/components/dataviews-filters/filters.cjs +1 -1
- package/build/components/dataviews-filters/filters.cjs.map +1 -1
- package/build/components/dataviews-filters/search-widget.cjs +25 -11
- package/build/components/dataviews-filters/search-widget.cjs.map +2 -2
- package/build/components/dataviews-filters/toggle.cjs.map +1 -1
- package/build/components/dataviews-footer/index.cjs +1 -1
- package/build/components/dataviews-footer/index.cjs.map +1 -1
- package/build/components/dataviews-layouts/activity/activity-item.cjs +4 -4
- package/build/components/dataviews-layouts/activity/activity-item.cjs.map +1 -1
- package/build/components/dataviews-layouts/activity/index.cjs +1 -1
- package/build/components/dataviews-layouts/activity/index.cjs.map +1 -1
- package/build/components/dataviews-layouts/grid/composite-grid.cjs +27 -38
- package/build/components/dataviews-layouts/grid/composite-grid.cjs.map +2 -2
- package/build/components/dataviews-layouts/grid/index.cjs +2 -2
- package/build/components/dataviews-layouts/grid/index.cjs.map +1 -1
- package/build/components/dataviews-layouts/list/index.cjs +7 -8
- package/build/components/dataviews-layouts/list/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/picker-grid/index.cjs +5 -5
- package/build/components/dataviews-layouts/picker-grid/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/picker-table/index.cjs +1 -1
- package/build/components/dataviews-layouts/picker-table/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/table/column-primary.cjs +1 -1
- package/build/components/dataviews-layouts/table/column-primary.cjs.map +1 -1
- package/build/components/dataviews-layouts/table/index.cjs +1 -1
- package/build/components/dataviews-layouts/table/index.cjs.map +2 -2
- package/build/components/dataviews-layouts/utils/item-click-wrapper.cjs.map +2 -2
- package/build/components/dataviews-pagination/index.cjs +3 -3
- package/build/components/dataviews-pagination/index.cjs.map +2 -2
- package/build/components/dataviews-picker-footer/index.cjs +3 -3
- package/build/components/dataviews-picker-footer/index.cjs.map +2 -2
- package/build/components/dataviews-view-config/index.cjs +74 -57
- package/build/components/dataviews-view-config/index.cjs.map +3 -3
- package/build/components/dataviews-view-config/properties-section.cjs +1 -1
- package/build/components/dataviews-view-config/properties-section.cjs.map +1 -1
- package/build/dataviews/index.cjs +7 -5
- package/build/dataviews/index.cjs.map +2 -2
- package/build/dataviews-picker/index.cjs +3 -3
- package/build/dataviews-picker/index.cjs.map +2 -2
- package/build/hooks/use-form-validity.cjs +61 -28
- package/build/hooks/use-form-validity.cjs.map +2 -2
- package/build/hooks/use-report-validity.cjs +39 -0
- package/build/hooks/use-report-validity.cjs.map +7 -0
- package/build/types/dataform.cjs.map +1 -1
- package/build/types/field-api.cjs.map +1 -1
- package/build-module/components/dataform-controls/adaptive-select.mjs +21 -0
- package/build-module/components/dataform-controls/adaptive-select.mjs.map +7 -0
- package/build-module/components/dataform-controls/array.mjs +2 -0
- package/build-module/components/dataform-controls/array.mjs.map +2 -2
- package/build-module/components/dataform-controls/checkbox.mjs +2 -0
- package/build-module/components/dataform-controls/checkbox.mjs.map +2 -2
- package/build-module/components/dataform-controls/color.mjs +26 -31
- package/build-module/components/dataform-controls/color.mjs.map +2 -2
- package/build-module/components/dataform-controls/combobox.mjs +49 -0
- package/build-module/components/dataform-controls/combobox.mjs.map +7 -0
- package/build-module/components/dataform-controls/date.mjs +58 -19
- package/build-module/components/dataform-controls/date.mjs.map +2 -2
- package/build-module/components/dataform-controls/datetime.mjs +11 -3
- package/build-module/components/dataform-controls/datetime.mjs.map +2 -2
- package/build-module/components/dataform-controls/email.mjs +2 -0
- package/build-module/components/dataform-controls/email.mjs.map +2 -2
- package/build-module/components/dataform-controls/index.mjs +5 -1
- package/build-module/components/dataform-controls/index.mjs.map +2 -2
- package/build-module/components/dataform-controls/password.mjs +2 -0
- package/build-module/components/dataform-controls/password.mjs.map +2 -2
- package/build-module/components/dataform-controls/radio.mjs +2 -0
- package/build-module/components/dataform-controls/radio.mjs.map +2 -2
- package/build-module/components/dataform-controls/select.mjs +2 -0
- package/build-module/components/dataform-controls/select.mjs.map +2 -2
- package/build-module/components/dataform-controls/telephone.mjs +2 -0
- package/build-module/components/dataform-controls/telephone.mjs.map +2 -2
- package/build-module/components/dataform-controls/text.mjs +2 -0
- package/build-module/components/dataform-controls/text.mjs.map +2 -2
- package/build-module/components/dataform-controls/textarea.mjs +2 -0
- package/build-module/components/dataform-controls/textarea.mjs.map +2 -2
- package/build-module/components/dataform-controls/toggle-group.mjs +2 -0
- package/build-module/components/dataform-controls/toggle-group.mjs.map +2 -2
- package/build-module/components/dataform-controls/toggle.mjs +2 -0
- package/build-module/components/dataform-controls/toggle.mjs.map +2 -2
- package/build-module/components/dataform-controls/url.mjs +2 -0
- package/build-module/components/dataform-controls/url.mjs.map +2 -2
- package/build-module/components/dataform-controls/utils/relative-date-control.mjs +1 -1
- package/build-module/components/dataform-controls/utils/relative-date-control.mjs.map +1 -1
- package/build-module/components/dataform-controls/utils/validated-input.mjs +2 -0
- package/build-module/components/dataform-controls/utils/validated-input.mjs.map +2 -2
- package/build-module/components/dataform-controls/utils/validated-number.mjs +2 -0
- package/build-module/components/dataform-controls/utils/validated-number.mjs.map +2 -2
- package/build-module/components/dataform-layouts/card/index.mjs +29 -3
- package/build-module/components/dataform-layouts/card/index.mjs.map +2 -2
- package/build-module/components/dataform-layouts/data-form-layout.mjs +12 -3
- package/build-module/components/dataform-layouts/data-form-layout.mjs.map +2 -2
- package/build-module/components/dataform-layouts/details/index.mjs +77 -13
- package/build-module/components/dataform-layouts/details/index.mjs.map +2 -2
- package/build-module/components/dataform-layouts/index.mjs +5 -5
- package/build-module/components/dataform-layouts/index.mjs.map +1 -1
- package/build-module/components/dataform-layouts/normalize-form.mjs +2 -1
- package/build-module/components/dataform-layouts/normalize-form.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/dropdown.mjs +91 -66
- package/build-module/components/dataform-layouts/panel/dropdown.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/index.mjs +14 -176
- package/build-module/components/dataform-layouts/panel/index.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/modal.mjs +30 -20
- package/build-module/components/dataform-layouts/panel/modal.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/summary-button.mjs +117 -58
- package/build-module/components/dataform-layouts/panel/summary-button.mjs.map +2 -2
- package/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs +38 -0
- package/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs.map +7 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs +14 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs.map +7 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs +15 -0
- package/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs.map +7 -0
- package/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs +46 -0
- package/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs.map +7 -0
- package/build-module/components/dataform-layouts/regular/index.mjs +6 -3
- package/build-module/components/dataform-layouts/regular/index.mjs.map +2 -2
- package/build-module/components/dataform-layouts/row/index.mjs +5 -2
- package/build-module/components/dataform-layouts/row/index.mjs.map +2 -2
- package/build-module/components/dataform-layouts/validation-badge.mjs +46 -0
- package/build-module/components/dataform-layouts/validation-badge.mjs.map +7 -0
- package/build-module/components/dataviews-bulk-actions/index.mjs +4 -4
- package/build-module/components/dataviews-bulk-actions/index.mjs.map +2 -2
- package/build-module/components/dataviews-context/index.mjs.map +2 -2
- package/build-module/components/dataviews-filters/filter.mjs +1 -1
- package/build-module/components/dataviews-filters/filter.mjs.map +1 -1
- package/build-module/components/dataviews-filters/filters.mjs +1 -1
- package/build-module/components/dataviews-filters/filters.mjs.map +1 -1
- package/build-module/components/dataviews-filters/search-widget.mjs +25 -11
- package/build-module/components/dataviews-filters/search-widget.mjs.map +2 -2
- package/build-module/components/dataviews-filters/toggle.mjs.map +1 -1
- package/build-module/components/dataviews-footer/index.mjs +1 -1
- package/build-module/components/dataviews-footer/index.mjs.map +1 -1
- package/build-module/components/dataviews-layouts/activity/activity-item.mjs +4 -4
- package/build-module/components/dataviews-layouts/activity/activity-item.mjs.map +1 -1
- package/build-module/components/dataviews-layouts/activity/index.mjs +1 -1
- package/build-module/components/dataviews-layouts/activity/index.mjs.map +1 -1
- package/build-module/components/dataviews-layouts/grid/composite-grid.mjs +27 -38
- package/build-module/components/dataviews-layouts/grid/composite-grid.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/grid/index.mjs +2 -2
- package/build-module/components/dataviews-layouts/grid/index.mjs.map +1 -1
- package/build-module/components/dataviews-layouts/list/index.mjs +7 -8
- package/build-module/components/dataviews-layouts/list/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/picker-grid/index.mjs +5 -5
- package/build-module/components/dataviews-layouts/picker-grid/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/picker-table/index.mjs +1 -1
- package/build-module/components/dataviews-layouts/picker-table/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/table/column-primary.mjs +1 -1
- package/build-module/components/dataviews-layouts/table/column-primary.mjs.map +1 -1
- package/build-module/components/dataviews-layouts/table/index.mjs +1 -1
- package/build-module/components/dataviews-layouts/table/index.mjs.map +2 -2
- package/build-module/components/dataviews-layouts/utils/item-click-wrapper.mjs.map +2 -2
- package/build-module/components/dataviews-pagination/index.mjs +3 -3
- package/build-module/components/dataviews-pagination/index.mjs.map +2 -2
- package/build-module/components/dataviews-picker-footer/index.mjs +3 -3
- package/build-module/components/dataviews-picker-footer/index.mjs.map +2 -2
- package/build-module/components/dataviews-view-config/index.mjs +74 -59
- package/build-module/components/dataviews-view-config/index.mjs.map +2 -2
- package/build-module/components/dataviews-view-config/properties-section.mjs +1 -1
- package/build-module/components/dataviews-view-config/properties-section.mjs.map +1 -1
- package/build-module/dataviews/index.mjs +7 -5
- package/build-module/dataviews/index.mjs.map +2 -2
- package/build-module/dataviews-picker/index.mjs +3 -3
- package/build-module/dataviews-picker/index.mjs.map +2 -2
- package/build-module/hooks/use-form-validity.mjs +61 -28
- package/build-module/hooks/use-form-validity.mjs.map +2 -2
- package/build-module/hooks/use-report-validity.mjs +18 -0
- package/build-module/hooks/use-report-validity.mjs.map +7 -0
- package/build-style/style-rtl.css +149 -217
- package/build-style/style.css +149 -217
- package/build-types/components/dataform-controls/adaptive-select.d.ts +6 -0
- package/build-types/components/dataform-controls/adaptive-select.d.ts.map +1 -0
- package/build-types/components/dataform-controls/array.d.ts +1 -1
- package/build-types/components/dataform-controls/array.d.ts.map +1 -1
- package/build-types/components/dataform-controls/checkbox.d.ts +1 -1
- package/build-types/components/dataform-controls/checkbox.d.ts.map +1 -1
- package/build-types/components/dataform-controls/color.d.ts +1 -1
- package/build-types/components/dataform-controls/color.d.ts.map +1 -1
- package/build-types/components/dataform-controls/combobox.d.ts +6 -0
- package/build-types/components/dataform-controls/combobox.d.ts.map +1 -0
- package/build-types/components/dataform-controls/date.d.ts +1 -1
- package/build-types/components/dataform-controls/date.d.ts.map +1 -1
- package/build-types/components/dataform-controls/datetime.d.ts +1 -1
- package/build-types/components/dataform-controls/datetime.d.ts.map +1 -1
- package/build-types/components/dataform-controls/email.d.ts +1 -1
- package/build-types/components/dataform-controls/email.d.ts.map +1 -1
- package/build-types/components/dataform-controls/index.d.ts.map +1 -1
- package/build-types/components/dataform-controls/password.d.ts +1 -1
- package/build-types/components/dataform-controls/password.d.ts.map +1 -1
- package/build-types/components/dataform-controls/radio.d.ts +1 -1
- package/build-types/components/dataform-controls/radio.d.ts.map +1 -1
- package/build-types/components/dataform-controls/select.d.ts +1 -1
- package/build-types/components/dataform-controls/select.d.ts.map +1 -1
- package/build-types/components/dataform-controls/telephone.d.ts +1 -1
- package/build-types/components/dataform-controls/telephone.d.ts.map +1 -1
- package/build-types/components/dataform-controls/text.d.ts +1 -1
- package/build-types/components/dataform-controls/text.d.ts.map +1 -1
- package/build-types/components/dataform-controls/textarea.d.ts +1 -1
- package/build-types/components/dataform-controls/textarea.d.ts.map +1 -1
- package/build-types/components/dataform-controls/toggle-group.d.ts +1 -1
- package/build-types/components/dataform-controls/toggle-group.d.ts.map +1 -1
- package/build-types/components/dataform-controls/toggle.d.ts +1 -1
- package/build-types/components/dataform-controls/toggle.d.ts.map +1 -1
- package/build-types/components/dataform-controls/url.d.ts +1 -1
- package/build-types/components/dataform-controls/url.d.ts.map +1 -1
- package/build-types/components/dataform-controls/utils/validated-input.d.ts +1 -1
- package/build-types/components/dataform-controls/utils/validated-input.d.ts.map +1 -1
- package/build-types/components/dataform-controls/utils/validated-number.d.ts +1 -1
- package/build-types/components/dataform-controls/utils/validated-number.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/card/index.d.ts +3 -1
- package/build-types/components/dataform-layouts/card/index.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/data-form-layout.d.ts +2 -1
- package/build-types/components/dataform-layouts/data-form-layout.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/details/index.d.ts +1 -1
- package/build-types/components/dataform-layouts/details/index.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/normalize-form.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/dropdown.d.ts +2 -12
- package/build-types/components/dataform-layouts/panel/dropdown.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/index.d.ts +1 -1
- package/build-types/components/dataform-layouts/panel/index.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/modal.d.ts +2 -10
- package/build-types/components/dataform-layouts/panel/modal.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/summary-button.d.ts +6 -5
- package/build-types/components/dataform-layouts/panel/summary-button.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/panel/utils/get-first-validation-error.d.ts +4 -0
- package/build-types/components/dataform-layouts/panel/utils/get-first-validation-error.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-classname.d.ts +4 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-classname.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-content.d.ts +3 -0
- package/build-types/components/dataform-layouts/panel/utils/get-label-content.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/panel/utils/use-field-from-form-field.d.ts +23 -0
- package/build-types/components/dataform-layouts/panel/utils/use-field-from-form-field.d.ts.map +1 -0
- package/build-types/components/dataform-layouts/regular/index.d.ts +1 -1
- package/build-types/components/dataform-layouts/regular/index.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/row/index.d.ts +1 -1
- package/build-types/components/dataform-layouts/row/index.d.ts.map +1 -1
- package/build-types/components/dataform-layouts/validation-badge.d.ts +8 -0
- package/build-types/components/dataform-layouts/validation-badge.d.ts.map +1 -0
- package/build-types/components/dataviews-context/index.d.ts +1 -0
- package/build-types/components/dataviews-context/index.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/filter.d.ts +1 -1
- package/build-types/components/dataviews-filters/filter.d.ts.map +1 -1
- package/build-types/components/dataviews-filters/search-widget.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/list/index.d.ts.map +1 -1
- package/build-types/components/dataviews-layouts/utils/item-click-wrapper.d.ts +1 -0
- package/build-types/components/dataviews-layouts/utils/item-click-wrapper.d.ts.map +1 -1
- package/build-types/components/dataviews-view-config/index.d.ts.map +1 -1
- package/build-types/dataform/stories/content.story.d.ts +14 -0
- package/build-types/dataform/stories/content.story.d.ts.map +1 -0
- package/build-types/dataform/stories/index.story.d.ts +10 -2
- package/build-types/dataform/stories/index.story.d.ts.map +1 -1
- package/build-types/dataform/stories/layout-panel.d.ts +3 -1
- package/build-types/dataform/stories/layout-panel.d.ts.map +1 -1
- package/build-types/dataform/stories/validation.d.ts +1 -1
- package/build-types/dataform/stories/validation.d.ts.map +1 -1
- package/build-types/dataviews/index.d.ts +2 -1
- package/build-types/dataviews/index.d.ts.map +1 -1
- package/build-types/dataviews/stories/fixtures.d.ts +1 -0
- package/build-types/dataviews/stories/fixtures.d.ts.map +1 -1
- package/build-types/dataviews/stories/index.story.d.ts +14 -2
- package/build-types/dataviews/stories/index.story.d.ts.map +1 -1
- package/build-types/dataviews/stories/layout-activity.d.ts +2 -1
- package/build-types/dataviews/stories/layout-activity.d.ts.map +1 -1
- package/build-types/dataviews/stories/layout-list.d.ts +2 -1
- package/build-types/dataviews/stories/layout-list.d.ts.map +1 -1
- package/build-types/field-types/stories/index.story.d.ts +42 -16
- package/build-types/field-types/stories/index.story.d.ts.map +1 -1
- package/build-types/hooks/use-form-validity.d.ts.map +1 -1
- package/build-types/hooks/use-report-validity.d.ts +14 -0
- package/build-types/hooks/use-report-validity.d.ts.map +1 -0
- package/build-types/types/dataform.d.ts +4 -0
- package/build-types/types/dataform.d.ts.map +1 -1
- package/build-types/types/field-api.d.ts +4 -0
- package/build-types/types/field-api.d.ts.map +1 -1
- package/build-wp/index.js +3749 -2632
- package/package.json +22 -21
- package/src/components/dataform-controls/adaptive-select.tsx +23 -0
- package/src/components/dataform-controls/array.tsx +2 -0
- package/src/components/dataform-controls/checkbox.tsx +2 -0
- package/src/components/dataform-controls/color.tsx +31 -36
- package/src/components/dataform-controls/combobox.tsx +58 -0
- package/src/components/dataform-controls/date.tsx +69 -26
- package/src/components/dataform-controls/datetime.tsx +16 -6
- package/src/components/dataform-controls/email.tsx +2 -0
- package/src/components/dataform-controls/index.tsx +5 -1
- package/src/components/dataform-controls/password.tsx +2 -0
- package/src/components/dataform-controls/radio.tsx +2 -0
- package/src/components/dataform-controls/select.tsx +2 -0
- package/src/components/dataform-controls/style.scss +4 -0
- package/src/components/dataform-controls/telephone.tsx +2 -0
- package/src/components/dataform-controls/text.tsx +2 -0
- package/src/components/dataform-controls/textarea.tsx +2 -0
- package/src/components/dataform-controls/toggle-group.tsx +2 -0
- package/src/components/dataform-controls/toggle.tsx +2 -0
- package/src/components/dataform-controls/url.tsx +2 -0
- package/src/components/dataform-controls/utils/relative-date-control.tsx +1 -1
- package/src/components/dataform-controls/utils/validated-input.tsx +2 -0
- package/src/components/dataform-controls/utils/validated-number.tsx +2 -0
- package/src/components/dataform-layouts/card/index.tsx +40 -3
- package/src/components/dataform-layouts/data-form-layout.tsx +18 -4
- package/src/components/dataform-layouts/details/index.tsx +66 -4
- package/src/components/dataform-layouts/details/style.scss +5 -0
- package/src/components/dataform-layouts/index.tsx +5 -5
- package/src/components/dataform-layouts/normalize-form.ts +1 -0
- package/src/components/dataform-layouts/panel/dropdown.tsx +110 -94
- package/src/components/dataform-layouts/panel/index.tsx +10 -243
- package/src/components/dataform-layouts/panel/modal.tsx +43 -29
- package/src/components/dataform-layouts/panel/style.scss +109 -27
- package/src/components/dataform-layouts/panel/summary-button.tsx +140 -62
- package/src/components/dataform-layouts/panel/utils/get-first-validation-error.ts +47 -0
- package/src/components/dataform-layouts/panel/utils/get-label-classname.ts +18 -0
- package/src/components/dataform-layouts/panel/utils/get-label-content.tsx +26 -0
- package/src/components/dataform-layouts/panel/utils/use-field-from-form-field.ts +78 -0
- package/src/components/dataform-layouts/regular/index.tsx +8 -3
- package/src/components/dataform-layouts/regular/style.scss +10 -0
- package/src/components/dataform-layouts/row/index.tsx +5 -2
- package/src/components/dataform-layouts/test/normalize-form.ts +5 -0
- package/src/components/dataform-layouts/validation-badge.tsx +63 -0
- package/src/components/dataviews-bulk-actions/index.tsx +4 -4
- package/src/components/dataviews-context/index.ts +1 -0
- package/src/components/dataviews-filters/filter.tsx +2 -2
- package/src/components/dataviews-filters/filters.tsx +1 -1
- package/src/components/dataviews-filters/search-widget.tsx +10 -2
- package/src/components/dataviews-filters/style.scss +8 -0
- package/src/components/dataviews-filters/toggle.tsx +1 -1
- package/src/components/dataviews-footer/index.tsx +1 -1
- package/src/components/dataviews-layouts/activity/activity-item.tsx +4 -4
- package/src/components/dataviews-layouts/activity/index.tsx +1 -1
- package/src/components/dataviews-layouts/grid/composite-grid.tsx +35 -35
- package/src/components/dataviews-layouts/grid/index.tsx +2 -2
- package/src/components/dataviews-layouts/grid/style.scss +15 -1
- package/src/components/dataviews-layouts/list/index.tsx +7 -8
- package/src/components/dataviews-layouts/list/style.scss +1 -0
- package/src/components/dataviews-layouts/picker-grid/index.tsx +5 -5
- package/src/components/dataviews-layouts/picker-table/index.tsx +1 -1
- package/src/components/dataviews-layouts/table/column-primary.tsx +1 -1
- package/src/components/dataviews-layouts/table/index.tsx +1 -1
- package/src/components/dataviews-layouts/utils/item-click-wrapper.tsx +1 -0
- package/src/components/dataviews-pagination/index.tsx +3 -3
- package/src/components/dataviews-picker-footer/index.tsx +3 -3
- package/src/components/dataviews-view-config/index.tsx +61 -50
- package/src/components/dataviews-view-config/properties-section.tsx +1 -1
- package/src/components/dataviews-view-config/style.scss +21 -0
- package/src/dataform/stories/content.story.mdx +159 -0
- package/src/dataform/stories/content.story.tsx +390 -0
- package/src/dataform/stories/index.story.tsx +14 -2
- package/src/dataform/stories/layout-panel.tsx +19 -2
- package/src/dataform/stories/validation.tsx +100 -7
- package/src/dataform/test/dataform.tsx +2 -2
- package/src/dataviews/index.tsx +7 -4
- package/src/dataviews/stories/empty.tsx +1 -1
- package/src/dataviews/stories/fixtures.tsx +93 -4
- package/src/dataviews/stories/free-composition.tsx +6 -6
- package/src/dataviews/stories/index.story.tsx +12 -0
- package/src/dataviews/stories/layout-activity.tsx +6 -3
- package/src/dataviews/stories/layout-list.tsx +3 -0
- package/src/dataviews-picker/index.tsx +4 -4
- package/src/dataviews-picker/stories/fixtures.tsx +2 -2
- package/src/dataviews-picker/stories/index.story.tsx +1 -1
- package/src/field-types/stories/index.story.tsx +101 -5
- package/src/hooks/test/use-form-validity.ts +303 -178
- package/src/hooks/use-form-validity.ts +85 -36
- package/src/hooks/use-report-validity.ts +32 -0
- package/src/style.scss +0 -2
- package/src/types/dataform.ts +5 -0
- package/src/types/field-api.ts +4 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/datetime.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport { format } from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getSettings } from '@wordpress/date';\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps, FormatDatetime } from '../../types';\nimport { OPERATOR_IN_THE_PAST, OPERATOR_OVER } from '../../constants';\nimport RelativeDateControl from './utils/relative-date-control';\nimport getCustomValidity from './utils/get-custom-validity';\nimport parseDateTime from '../../field-types/utils/parse-date-time';\nimport { unlock } from '../../lock-unlock';\n\nconst { DateCalendar, ValidatedInputControl } = unlock( componentsPrivateApis );\n\nconst formatDateTime = ( date?: Date | string ): string => {\n\tif ( ! date ) {\n\t\treturn '';\n\t}\n\tif ( typeof date === 'string' ) {\n\t\treturn date;\n\t}\n\t// Format as datetime-local input expects: YYYY-MM-DDTHH:mm\n\treturn format( date, \"yyyy-MM-dd'T'HH:mm\" );\n};\n\nfunction CalendarDateTimeControl< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { id, label, description, setValue, getValue, isValid } = field;\n\tconst fieldValue = getValue( { item: data } );\n\tconst value = typeof fieldValue === 'string' ? fieldValue : undefined;\n\n\tconst [ calendarMonth, setCalendarMonth ] = useState< Date >( () => {\n\t\tconst parsedDate = parseDateTime( value );\n\t\treturn parsedDate || new Date(); // Default to current month\n\t} );\n\n\tconst inputControlRef = useRef< HTMLInputElement >( null );\n\tconst validationTimeoutRef
|
|
5
|
-
"mappings": ";AAGA,SAAS,cAAc;AAKvB;AAAA,EACC;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AAMtB,SAAS,sBAAsB,qBAAqB;AACpD,OAAO,yBAAyB;AAChC,OAAO,uBAAuB;AAC9B,OAAO,mBAAmB;AAC1B,SAAS,cAAc;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { format } from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { getSettings } from '@wordpress/date';\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps, FormatDatetime } from '../../types';\nimport { OPERATOR_IN_THE_PAST, OPERATOR_OVER } from '../../constants';\nimport RelativeDateControl from './utils/relative-date-control';\nimport getCustomValidity from './utils/get-custom-validity';\nimport parseDateTime from '../../field-types/utils/parse-date-time';\nimport { unlock } from '../../lock-unlock';\n\nconst { DateCalendar, ValidatedInputControl } = unlock( componentsPrivateApis );\n\nconst formatDateTime = ( date?: Date | string ): string => {\n\tif ( ! date ) {\n\t\treturn '';\n\t}\n\tif ( typeof date === 'string' ) {\n\t\treturn date;\n\t}\n\t// Format as datetime-local input expects: YYYY-MM-DDTHH:mm\n\treturn format( date, \"yyyy-MM-dd'T'HH:mm\" );\n};\n\nfunction CalendarDateTimeControl< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { id, label, description, setValue, getValue, isValid } = field;\n\tconst fieldValue = getValue( { item: data } );\n\tconst value = typeof fieldValue === 'string' ? fieldValue : undefined;\n\n\tconst [ calendarMonth, setCalendarMonth ] = useState< Date >( () => {\n\t\tconst parsedDate = parseDateTime( value );\n\t\treturn parsedDate || new Date(); // Default to current month\n\t} );\n\n\tconst inputControlRef = useRef< HTMLInputElement >( null );\n\tconst validationTimeoutRef =\n\t\tuseRef< ReturnType< typeof setTimeout > >( undefined );\n\tconst previousFocusRef = useRef< Element | null >( null );\n\n\tconst onChangeCallback = useCallback(\n\t\t( newValue: string | undefined ) =>\n\t\t\tonChange( setValue( { item: data, value: newValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\t// Cleanup timeout on unmount\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif ( validationTimeoutRef.current ) {\n\t\t\t\tclearTimeout( validationTimeoutRef.current );\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\tconst onSelectDate = useCallback(\n\t\t( newDate: Date | undefined | null ) => {\n\t\t\tlet dateTimeValue: string | undefined;\n\t\t\tif ( newDate ) {\n\t\t\t\t// Preserve time if it exists in current value, otherwise use current time\n\t\t\t\tlet finalDateTime = newDate;\n\n\t\t\t\tif ( value ) {\n\t\t\t\t\tconst currentDateTime = parseDateTime( value );\n\t\t\t\t\tif ( currentDateTime ) {\n\t\t\t\t\t\t// Preserve the time part\n\t\t\t\t\t\tfinalDateTime = new Date( newDate );\n\t\t\t\t\t\tfinalDateTime.setHours( currentDateTime.getHours() );\n\t\t\t\t\t\tfinalDateTime.setMinutes(\n\t\t\t\t\t\t\tcurrentDateTime.getMinutes()\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tdateTimeValue = finalDateTime.toISOString();\n\t\t\t\tonChangeCallback( dateTimeValue );\n\n\t\t\t\t// Clear any existing timeout\n\t\t\t\tif ( validationTimeoutRef.current ) {\n\t\t\t\t\tclearTimeout( validationTimeoutRef.current );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tonChangeCallback( undefined );\n\t\t\t}\n\t\t\t// Save the currently focused element\n\t\t\tpreviousFocusRef.current =\n\t\t\t\tinputControlRef.current &&\n\t\t\t\tinputControlRef.current.ownerDocument.activeElement;\n\n\t\t\t// Trigger validation display by simulating focus, blur, and changes.\n\t\t\t// Use a timeout to ensure it runs after the value update.\n\t\t\tvalidationTimeoutRef.current = setTimeout( () => {\n\t\t\t\tif ( inputControlRef.current ) {\n\t\t\t\t\tinputControlRef.current.focus();\n\t\t\t\t\tinputControlRef.current.blur();\n\t\t\t\t\tonChangeCallback( dateTimeValue );\n\n\t\t\t\t\t// Restore focus to the previously focused element\n\t\t\t\t\tif (\n\t\t\t\t\t\tpreviousFocusRef.current &&\n\t\t\t\t\t\tpreviousFocusRef.current instanceof HTMLElement\n\t\t\t\t\t) {\n\t\t\t\t\t\tpreviousFocusRef.current.focus();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}, 0 );\n\t\t},\n\t\t[ onChangeCallback, value ]\n\t);\n\n\tconst handleManualDateTimeChange = useCallback(\n\t\t( newValue?: string ) => {\n\t\t\tif ( newValue ) {\n\t\t\t\t// Convert from datetime-local format to ISO string\n\t\t\t\tconst dateTime = new Date( newValue );\n\t\t\t\tonChangeCallback( dateTime.toISOString() );\n\n\t\t\t\t// Update calendar month to match\n\t\t\t\tconst parsedDate = parseDateTime( dateTime.toISOString() );\n\t\t\t\tif ( parsedDate ) {\n\t\t\t\t\tsetCalendarMonth( parsedDate );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tonChangeCallback( undefined );\n\t\t\t}\n\t\t},\n\t\t[ onChangeCallback ]\n\t);\n\n\tconst { format: fieldFormat } = field;\n\tconst weekStartsOn =\n\t\t( fieldFormat as FormatDatetime ).weekStartsOn ??\n\t\tgetSettings().l10n.startOfWeek;\n\tconst {\n\t\ttimezone: { string: timezoneString },\n\t} = getSettings();\n\n\tlet displayLabel = label;\n\tif ( isValid?.required && ! markWhenOptional && ! hideLabelFromVision ) {\n\t\tdisplayLabel = `${ label } (${ __( 'Required' ) })`;\n\t} else if (\n\t\t! isValid?.required &&\n\t\tmarkWhenOptional &&\n\t\t! hideLabelFromVision\n\t) {\n\t\tdisplayLabel = `${ label } (${ __( 'Optional' ) })`;\n\t}\n\n\treturn (\n\t\t<BaseControl\n\t\t\tid={ id }\n\t\t\tlabel={ displayLabel }\n\t\t\thelp={ description }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t>\n\t\t\t<Stack direction=\"column\" gap=\"lg\">\n\t\t\t\t{ /* Calendar widget */ }\n\t\t\t\t<DateCalendar\n\t\t\t\t\tstyle={ { width: '100%' } }\n\t\t\t\t\tselected={\n\t\t\t\t\t\tvalue ? parseDateTime( value ) || undefined : undefined\n\t\t\t\t\t}\n\t\t\t\t\tonSelect={ onSelectDate }\n\t\t\t\t\tmonth={ calendarMonth }\n\t\t\t\t\tonMonthChange={ setCalendarMonth }\n\t\t\t\t\ttimeZone={ timezoneString || undefined }\n\t\t\t\t\tweekStartsOn={ weekStartsOn }\n\t\t\t\t/>\n\t\t\t\t{ /* Manual datetime input */ }\n\t\t\t\t<ValidatedInputControl\n\t\t\t\t\tref={ inputControlRef }\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\trequired={ !! isValid?.required }\n\t\t\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\t\t\ttype=\"datetime-local\"\n\t\t\t\t\tlabel={ __( 'Date time' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tvalue={\n\t\t\t\t\t\tvalue\n\t\t\t\t\t\t\t? formatDateTime(\n\t\t\t\t\t\t\t\t\tparseDateTime( value ) || undefined\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: ''\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ handleManualDateTimeChange }\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</BaseControl>\n\t);\n}\n\nexport default function DateTime< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\toperator,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tif ( operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER ) {\n\t\treturn (\n\t\t\t<RelativeDateControl\n\t\t\t\tclassName=\"dataviews-controls__datetime\"\n\t\t\t\tdata={ data }\n\t\t\t\tfield={ field }\n\t\t\t\tonChange={ onChange }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\toperator={ operator }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<CalendarDateTimeControl\n\t\t\tdata={ data }\n\t\t\tfield={ field }\n\t\t\tonChange={ onChange }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\tvalidity={ validity }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,cAAc;AAKvB;AAAA,EACC;AAAA,EACA,eAAe;AAAA,OACT;AACP,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AACzD,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,aAAa;AAMtB,SAAS,sBAAsB,qBAAqB;AACpD,OAAO,yBAAyB;AAChC,OAAO,uBAAuB;AAC9B,OAAO,mBAAmB;AAC1B,SAAS,cAAc;AAwJpB,SAEC,KAFD;AAtJH,IAAM,EAAE,cAAc,sBAAsB,IAAI,OAAQ,qBAAsB;AAE9E,IAAM,iBAAiB,CAAE,SAAkC;AAC1D,MAAK,CAAE,MAAO;AACb,WAAO;AAAA,EACR;AACA,MAAK,OAAO,SAAS,UAAW;AAC/B,WAAO;AAAA,EACR;AAEA,SAAO,OAAQ,MAAM,oBAAqB;AAC3C;AAEA,SAAS,wBAAiC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,IAAI,OAAO,aAAa,UAAU,UAAU,QAAQ,IAAI;AAChE,QAAM,aAAa,SAAU,EAAE,MAAM,KAAK,CAAE;AAC5C,QAAM,QAAQ,OAAO,eAAe,WAAW,aAAa;AAE5D,QAAM,CAAE,eAAe,gBAAiB,IAAI,SAAkB,MAAM;AACnE,UAAM,aAAa,cAAe,KAAM;AACxC,WAAO,cAAc,oBAAI,KAAK;AAAA,EAC/B,CAAE;AAEF,QAAM,kBAAkB,OAA4B,IAAK;AACzD,QAAM,uBACL,OAA2C,MAAU;AACtD,QAAM,mBAAmB,OAA0B,IAAK;AAExD,QAAM,mBAAmB;AAAA,IACxB,CAAE,aACD,SAAU,SAAU,EAAE,MAAM,MAAM,OAAO,SAAS,CAAE,CAAE;AAAA,IACvD,CAAE,MAAM,UAAU,QAAS;AAAA,EAC5B;AAGA,YAAW,MAAM;AAChB,WAAO,MAAM;AACZ,UAAK,qBAAqB,SAAU;AACnC,qBAAc,qBAAqB,OAAQ;AAAA,MAC5C;AAAA,IACD;AAAA,EACD,GAAG,CAAC,CAAE;AAEN,QAAM,eAAe;AAAA,IACpB,CAAE,YAAsC;AACvC,UAAI;AACJ,UAAK,SAAU;AAEd,YAAI,gBAAgB;AAEpB,YAAK,OAAQ;AACZ,gBAAM,kBAAkB,cAAe,KAAM;AAC7C,cAAK,iBAAkB;AAEtB,4BAAgB,IAAI,KAAM,OAAQ;AAClC,0BAAc,SAAU,gBAAgB,SAAS,CAAE;AACnD,0BAAc;AAAA,cACb,gBAAgB,WAAW;AAAA,YAC5B;AAAA,UACD;AAAA,QACD;AAEA,wBAAgB,cAAc,YAAY;AAC1C,yBAAkB,aAAc;AAGhC,YAAK,qBAAqB,SAAU;AACnC,uBAAc,qBAAqB,OAAQ;AAAA,QAC5C;AAAA,MACD,OAAO;AACN,yBAAkB,MAAU;AAAA,MAC7B;AAEA,uBAAiB,UAChB,gBAAgB,WAChB,gBAAgB,QAAQ,cAAc;AAIvC,2BAAqB,UAAU,WAAY,MAAM;AAChD,YAAK,gBAAgB,SAAU;AAC9B,0BAAgB,QAAQ,MAAM;AAC9B,0BAAgB,QAAQ,KAAK;AAC7B,2BAAkB,aAAc;AAGhC,cACC,iBAAiB,WACjB,iBAAiB,mBAAmB,aACnC;AACD,6BAAiB,QAAQ,MAAM;AAAA,UAChC;AAAA,QACD;AAAA,MACD,GAAG,CAAE;AAAA,IACN;AAAA,IACA,CAAE,kBAAkB,KAAM;AAAA,EAC3B;AAEA,QAAM,6BAA6B;AAAA,IAClC,CAAE,aAAuB;AACxB,UAAK,UAAW;AAEf,cAAM,WAAW,IAAI,KAAM,QAAS;AACpC,yBAAkB,SAAS,YAAY,CAAE;AAGzC,cAAM,aAAa,cAAe,SAAS,YAAY,CAAE;AACzD,YAAK,YAAa;AACjB,2BAAkB,UAAW;AAAA,QAC9B;AAAA,MACD,OAAO;AACN,yBAAkB,MAAU;AAAA,MAC7B;AAAA,IACD;AAAA,IACA,CAAE,gBAAiB;AAAA,EACpB;AAEA,QAAM,EAAE,QAAQ,YAAY,IAAI;AAChC,QAAM,eACH,YAAgC,gBAClC,YAAY,EAAE,KAAK;AACpB,QAAM;AAAA,IACL,UAAU,EAAE,QAAQ,eAAe;AAAA,EACpC,IAAI,YAAY;AAEhB,MAAI,eAAe;AACnB,MAAK,SAAS,YAAY,CAAE,oBAAoB,CAAE,qBAAsB;AACvE,mBAAe,GAAI,KAAM,KAAM,GAAI,UAAW,CAAE;AAAA,EACjD,WACC,CAAE,SAAS,YACX,oBACA,CAAE,qBACD;AACD,mBAAe,GAAI,KAAM,KAAM,GAAI,UAAW,CAAE;AAAA,EACjD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,OAAQ;AAAA,MACR,MAAO;AAAA,MACP;AAAA,MAEA,+BAAC,SAAM,WAAU,UAAS,KAAI,MAE7B;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,EAAE,OAAO,OAAO;AAAA,YACxB,UACC,QAAQ,cAAe,KAAM,KAAK,SAAY;AAAA,YAE/C,UAAW;AAAA,YACX,OAAQ;AAAA,YACR,eAAgB;AAAA,YAChB,UAAW,kBAAkB;AAAA,YAC7B;AAAA;AAAA,QACD;AAAA,QAEA;AAAA,UAAC;AAAA;AAAA,YACA,KAAM;AAAA,YACN,uBAAqB;AAAA,YACrB,UAAW,CAAC,CAAE,SAAS;AAAA,YACvB,gBAAiB,kBAAmB,SAAS,QAAS;AAAA,YACtD,MAAK;AAAA,YACL,OAAQ,GAAI,WAAY;AAAA,YACxB,qBAAmB;AAAA,YACnB,OACC,QACG;AAAA,cACA,cAAe,KAAM,KAAK;AAAA,YAC1B,IACA;AAAA,YAEJ,UAAW;AAAA;AAAA,QACZ;AAAA,SACD;AAAA;AAAA,EACD;AAEF;AAEe,SAAR,SAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,MAAK,aAAa,wBAAwB,aAAa,eAAgB;AACtE,WACC;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ function Email({
|
|
|
11
11
|
field,
|
|
12
12
|
onChange,
|
|
13
13
|
hideLabelFromVision,
|
|
14
|
+
markWhenOptional,
|
|
14
15
|
validity
|
|
15
16
|
}) {
|
|
16
17
|
return /* @__PURE__ */ jsx(
|
|
@@ -21,6 +22,7 @@ function Email({
|
|
|
21
22
|
field,
|
|
22
23
|
onChange,
|
|
23
24
|
hideLabelFromVision,
|
|
25
|
+
markWhenOptional,
|
|
24
26
|
validity,
|
|
25
27
|
type: "email",
|
|
26
28
|
prefix: /* @__PURE__ */ jsx(InputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ jsx(Icon, { icon: envelope }) })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/email.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n} from '@wordpress/components';\nimport { envelope } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport ValidatedText from './utils/validated-input';\n\nexport default function Email< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\treturn (\n\t\t<ValidatedText\n\t\t\t{ ...{\n\t\t\t\tdata,\n\t\t\t\tfield,\n\t\t\t\tonChange,\n\t\t\t\thideLabelFromVision,\n\t\t\t\tvalidity,\n\t\t\t\ttype: 'email',\n\t\t\t\tprefix: (\n\t\t\t\t\t<InputControlPrefixWrapper variant=\"icon\">\n\t\t\t\t\t\t<Icon icon={ envelope } />\n\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,2CAA2C;AAAA,OACrC;AACP,SAAS,gBAAgB;AAMzB,OAAO,mBAAmB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n} from '@wordpress/components';\nimport { envelope } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport ValidatedText from './utils/validated-input';\n\nexport default function Email< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\treturn (\n\t\t<ValidatedText\n\t\t\t{ ...{\n\t\t\t\tdata,\n\t\t\t\tfield,\n\t\t\t\tonChange,\n\t\t\t\thideLabelFromVision,\n\t\t\t\tmarkWhenOptional,\n\t\t\t\tvalidity,\n\t\t\t\ttype: 'email',\n\t\t\t\tprefix: (\n\t\t\t\t\t<InputControlPrefixWrapper variant=\"icon\">\n\t\t\t\t\t\t<Icon icon={ envelope } />\n\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,2CAA2C;AAAA,OACrC;AACP,SAAS,gBAAgB;AAMzB,OAAO,mBAAmB;AAsBpB;AApBS,SAAR,MAAgC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,SACC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAM;AAAA,QACN,QACC,oBAAC,6BAA0B,SAAQ,QAClC,8BAAC,QAAK,MAAO,UAAW,GACzB;AAAA,MAEF;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// packages/dataviews/src/components/dataform-controls/index.tsx
|
|
2
2
|
import checkbox from "./checkbox.mjs";
|
|
3
|
+
import combobox from "./combobox.mjs";
|
|
3
4
|
import datetime from "./datetime.mjs";
|
|
4
5
|
import date from "./date.mjs";
|
|
6
|
+
import adaptiveSelect from "./adaptive-select.mjs";
|
|
5
7
|
import email from "./email.mjs";
|
|
6
8
|
import telephone from "./telephone.mjs";
|
|
7
9
|
import url from "./url.mjs";
|
|
@@ -19,9 +21,11 @@ import password from "./password.mjs";
|
|
|
19
21
|
import hasElements from "../../field-types/utils/has-elements.mjs";
|
|
20
22
|
import { jsx } from "react/jsx-runtime";
|
|
21
23
|
var FORM_CONTROLS = {
|
|
24
|
+
adaptiveSelect,
|
|
22
25
|
array,
|
|
23
26
|
checkbox,
|
|
24
27
|
color,
|
|
28
|
+
combobox,
|
|
25
29
|
datetime,
|
|
26
30
|
date,
|
|
27
31
|
email,
|
|
@@ -61,7 +65,7 @@ function getControl(field, fallback) {
|
|
|
61
65
|
return createConfiguredControl(field.Edit);
|
|
62
66
|
}
|
|
63
67
|
if (hasElements(field) && field.type !== "array") {
|
|
64
|
-
return getControlByType("
|
|
68
|
+
return getControlByType("adaptiveSelect");
|
|
65
69
|
}
|
|
66
70
|
if (fallback === null) {
|
|
67
71
|
return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { ComponentType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps, Field, EditConfig } from '../../types';\nimport checkbox from './checkbox';\nimport datetime from './datetime';\nimport date from './date';\nimport email from './email';\nimport telephone from './telephone';\nimport url from './url';\nimport integer from './integer';\nimport number from './number';\nimport radio from './radio';\nimport select from './select';\nimport text from './text';\nimport toggle from './toggle';\nimport textarea from './textarea';\nimport toggleGroup from './toggle-group';\nimport array from './array';\nimport color from './color';\nimport password from './password';\nimport hasElements from '../../field-types/utils/has-elements';\n\ninterface FormControls {\n\t[ key: string ]: ComponentType< DataFormControlProps< any > >;\n}\n\nconst FORM_CONTROLS: FormControls = {\n\tarray,\n\tcheckbox,\n\tcolor,\n\tdatetime,\n\tdate,\n\temail,\n\ttelephone,\n\turl,\n\tinteger,\n\tnumber,\n\tpassword,\n\tradio,\n\tselect,\n\ttext,\n\ttoggle,\n\ttextarea,\n\ttoggleGroup,\n};\n\nfunction isEditConfig( value: any ): value is EditConfig {\n\treturn (\n\t\tvalue && typeof value === 'object' && typeof value.control === 'string'\n\t);\n}\n\nfunction createConfiguredControl( config: EditConfig ) {\n\tconst { control, ...controlConfig } = config;\n\tconst BaseControlType = getControlByType( control );\n\tif ( BaseControlType === null ) {\n\t\treturn null;\n\t}\n\n\treturn function ConfiguredControl< Item >(\n\t\tprops: DataFormControlProps< Item >\n\t) {\n\t\treturn <BaseControlType { ...props } config={ controlConfig } />;\n\t};\n}\n\nexport function getControl< Item >(\n\tfield: Field< Item >,\n\tfallback: string | null\n): ComponentType< DataFormControlProps< Item > > | null {\n\tif ( typeof field.Edit === 'function' ) {\n\t\treturn field.Edit;\n\t}\n\n\tif ( typeof field.Edit === 'string' ) {\n\t\treturn getControlByType( field.Edit );\n\t}\n\n\tif ( isEditConfig( field.Edit ) ) {\n\t\treturn createConfiguredControl( field.Edit );\n\t}\n\n\tif ( hasElements( field ) && field.type !== 'array' ) {\n\t\treturn getControlByType( '
|
|
5
|
-
"mappings": ";AASA,OAAO,cAAc;AACrB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB,OAAO,SAAS;AAChB,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,OAAO,iBAAiB;AACxB,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,OAAO,iBAAiB;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { ComponentType } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps, Field, EditConfig } from '../../types';\nimport checkbox from './checkbox';\nimport combobox from './combobox';\nimport datetime from './datetime';\nimport date from './date';\nimport adaptiveSelect from './adaptive-select';\nimport email from './email';\nimport telephone from './telephone';\nimport url from './url';\nimport integer from './integer';\nimport number from './number';\nimport radio from './radio';\nimport select from './select';\nimport text from './text';\nimport toggle from './toggle';\nimport textarea from './textarea';\nimport toggleGroup from './toggle-group';\nimport array from './array';\nimport color from './color';\nimport password from './password';\nimport hasElements from '../../field-types/utils/has-elements';\n\ninterface FormControls {\n\t[ key: string ]: ComponentType< DataFormControlProps< any > >;\n}\n\nconst FORM_CONTROLS: FormControls = {\n\tadaptiveSelect,\n\tarray,\n\tcheckbox,\n\tcolor,\n\tcombobox,\n\tdatetime,\n\tdate,\n\temail,\n\ttelephone,\n\turl,\n\tinteger,\n\tnumber,\n\tpassword,\n\tradio,\n\tselect,\n\ttext,\n\ttoggle,\n\ttextarea,\n\ttoggleGroup,\n};\n\nfunction isEditConfig( value: any ): value is EditConfig {\n\treturn (\n\t\tvalue && typeof value === 'object' && typeof value.control === 'string'\n\t);\n}\n\nfunction createConfiguredControl( config: EditConfig ) {\n\tconst { control, ...controlConfig } = config;\n\tconst BaseControlType = getControlByType( control );\n\tif ( BaseControlType === null ) {\n\t\treturn null;\n\t}\n\n\treturn function ConfiguredControl< Item >(\n\t\tprops: DataFormControlProps< Item >\n\t) {\n\t\treturn <BaseControlType { ...props } config={ controlConfig } />;\n\t};\n}\n\nexport function getControl< Item >(\n\tfield: Field< Item >,\n\tfallback: string | null\n): ComponentType< DataFormControlProps< Item > > | null {\n\tif ( typeof field.Edit === 'function' ) {\n\t\treturn field.Edit;\n\t}\n\n\tif ( typeof field.Edit === 'string' ) {\n\t\treturn getControlByType( field.Edit );\n\t}\n\n\tif ( isEditConfig( field.Edit ) ) {\n\t\treturn createConfiguredControl( field.Edit );\n\t}\n\n\tif ( hasElements( field ) && field.type !== 'array' ) {\n\t\treturn getControlByType( 'adaptiveSelect' );\n\t}\n\n\tif ( fallback === null ) {\n\t\treturn null;\n\t}\n\n\treturn getControlByType( fallback );\n}\n\nexport function getControlByType( type: string ) {\n\tif ( Object.keys( FORM_CONTROLS ).includes( type ) ) {\n\t\treturn FORM_CONTROLS[ type ];\n\t}\n\n\treturn null;\n}\n"],
|
|
5
|
+
"mappings": ";AASA,OAAO,cAAc;AACrB,OAAO,cAAc;AACrB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,OAAO,oBAAoB;AAC3B,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB,OAAO,SAAS;AAChB,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,OAAO,iBAAiB;AACxB,OAAO,WAAW;AAClB,OAAO,WAAW;AAClB,OAAO,cAAc;AACrB,OAAO,iBAAiB;AA4Cf;AAtCT,IAAM,gBAA8B;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEA,SAAS,aAAc,OAAkC;AACxD,SACC,SAAS,OAAO,UAAU,YAAY,OAAO,MAAM,YAAY;AAEjE;AAEA,SAAS,wBAAyB,QAAqB;AACtD,QAAM,EAAE,SAAS,GAAG,cAAc,IAAI;AACtC,QAAM,kBAAkB,iBAAkB,OAAQ;AAClD,MAAK,oBAAoB,MAAO;AAC/B,WAAO;AAAA,EACR;AAEA,SAAO,SAAS,kBACf,OACC;AACD,WAAO,oBAAC,mBAAkB,GAAG,OAAQ,QAAS,eAAgB;AAAA,EAC/D;AACD;AAEO,SAAS,WACf,OACA,UACuD;AACvD,MAAK,OAAO,MAAM,SAAS,YAAa;AACvC,WAAO,MAAM;AAAA,EACd;AAEA,MAAK,OAAO,MAAM,SAAS,UAAW;AACrC,WAAO,iBAAkB,MAAM,IAAK;AAAA,EACrC;AAEA,MAAK,aAAc,MAAM,IAAK,GAAI;AACjC,WAAO,wBAAyB,MAAM,IAAK;AAAA,EAC5C;AAEA,MAAK,YAAa,KAAM,KAAK,MAAM,SAAS,SAAU;AACrD,WAAO,iBAAkB,gBAAiB;AAAA,EAC3C;AAEA,MAAK,aAAa,MAAO;AACxB,WAAO;AAAA,EACR;AAEA,SAAO,iBAAkB,QAAS;AACnC;AAEO,SAAS,iBAAkB,MAAe;AAChD,MAAK,OAAO,KAAM,aAAc,EAAE,SAAU,IAAK,GAAI;AACpD,WAAO,cAAe,IAAK;AAAA,EAC5B;AAEA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -13,6 +13,7 @@ function Password({
|
|
|
13
13
|
field,
|
|
14
14
|
onChange,
|
|
15
15
|
hideLabelFromVision,
|
|
16
|
+
markWhenOptional,
|
|
16
17
|
validity
|
|
17
18
|
}) {
|
|
18
19
|
const [isVisible, setIsVisible] = useState(false);
|
|
@@ -27,6 +28,7 @@ function Password({
|
|
|
27
28
|
field,
|
|
28
29
|
onChange,
|
|
29
30
|
hideLabelFromVision,
|
|
31
|
+
markWhenOptional,
|
|
30
32
|
validity,
|
|
31
33
|
type: isVisible ? "text" : "password",
|
|
32
34
|
suffix: /* @__PURE__ */ jsx(InputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ jsx(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/password.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\tButton,\n} from '@wordpress/components';\nimport { useCallback, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { seen, unseen } from '@wordpress/icons';\n/**\n * Internal dependencies\n */\nimport ValidatedText from './utils/validated-input';\nimport type { DataFormControlProps } from '../../types';\n\nexport default function Password< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst [ isVisible, setIsVisible ] = useState( false );\n\n\tconst toggleVisibility = useCallback( () => {\n\t\tsetIsVisible( ( prev ) => ! prev );\n\t}, [] );\n\n\treturn (\n\t\t<ValidatedText\n\t\t\t{ ...{\n\t\t\t\tdata,\n\t\t\t\tfield,\n\t\t\t\tonChange,\n\t\t\t\thideLabelFromVision,\n\t\t\t\tvalidity,\n\t\t\t\ttype: isVisible ? 'text' : 'password',\n\t\t\t\tsuffix: (\n\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ isVisible ? unseen : seen }\n\t\t\t\t\t\t\tonClick={ toggleVisibility }\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisVisible\n\t\t\t\t\t\t\t\t\t? __( 'Hide password' )\n\t\t\t\t\t\t\t\t\t: __( 'Show password' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC,2CAA2C;AAAA,EAC3C;AAAA,OACM;AACP,SAAS,aAAa,gBAAgB;AACtC,SAAS,UAAU;AACnB,SAAS,MAAM,cAAc;AAI7B,OAAO,mBAAmB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,\n\tButton,\n} from '@wordpress/components';\nimport { useCallback, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { seen, unseen } from '@wordpress/icons';\n/**\n * Internal dependencies\n */\nimport ValidatedText from './utils/validated-input';\nimport type { DataFormControlProps } from '../../types';\n\nexport default function Password< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst [ isVisible, setIsVisible ] = useState( false );\n\n\tconst toggleVisibility = useCallback( () => {\n\t\tsetIsVisible( ( prev ) => ! prev );\n\t}, [] );\n\n\treturn (\n\t\t<ValidatedText\n\t\t\t{ ...{\n\t\t\t\tdata,\n\t\t\t\tfield,\n\t\t\t\tonChange,\n\t\t\t\thideLabelFromVision,\n\t\t\t\tmarkWhenOptional,\n\t\t\t\tvalidity,\n\t\t\t\ttype: isVisible ? 'text' : 'password',\n\t\t\t\tsuffix: (\n\t\t\t\t\t<InputControlSuffixWrapper variant=\"control\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ isVisible ? unseen : seen }\n\t\t\t\t\t\t\tonClick={ toggleVisibility }\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tisVisible\n\t\t\t\t\t\t\t\t\t? __( 'Hide password' )\n\t\t\t\t\t\t\t\t\t: __( 'Show password' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</InputControlSuffixWrapper>\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC,2CAA2C;AAAA,EAC3C;AAAA,OACM;AACP,SAAS,aAAa,gBAAgB;AACtC,SAAS,UAAU;AACnB,SAAS,MAAM,cAAc;AAI7B,OAAO,mBAAmB;AA6BpB;AA1BS,SAAR,SAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,CAAE,WAAW,YAAa,IAAI,SAAU,KAAM;AAEpD,QAAM,mBAAmB,YAAa,MAAM;AAC3C,iBAAc,CAAE,SAAU,CAAE,IAAK;AAAA,EAClC,GAAG,CAAC,CAAE;AAEN,SACC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAM,YAAY,SAAS;AAAA,QAC3B,QACC,oBAAC,6BAA0B,SAAQ,WAClC;AAAA,UAAC;AAAA;AAAA,YACA,MAAO,YAAY,SAAS;AAAA,YAC5B,SAAU;AAAA,YACV,MAAK;AAAA,YACL,OACC,YACG,GAAI,eAAgB,IACpB,GAAI,eAAgB;AAAA;AAAA,QAEzB,GACD;AAAA,MAEF;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ function Radio({
|
|
|
11
11
|
field,
|
|
12
12
|
onChange,
|
|
13
13
|
hideLabelFromVision,
|
|
14
|
+
markWhenOptional,
|
|
14
15
|
validity
|
|
15
16
|
}) {
|
|
16
17
|
const { label, description, getValue, setValue, isValid } = field;
|
|
@@ -30,6 +31,7 @@ function Radio({
|
|
|
30
31
|
ValidatedRadioControl,
|
|
31
32
|
{
|
|
32
33
|
required: !!field.isValid?.required,
|
|
34
|
+
markWhenOptional,
|
|
33
35
|
customValidity: getCustomValidity(isValid, validity),
|
|
34
36
|
label,
|
|
35
37
|
help: description,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/radio.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis, Spinner } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport { unlock } from '../../lock-unlock';\nimport getCustomValidity from './utils/get-custom-validity';\nimport useElements from '../../hooks/use-elements';\n\nconst { ValidatedRadioControl } = unlock( privateApis );\n\nexport default function Radio< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { label, description, getValue, setValue, isValid } = field;\n\tconst { elements, isLoading } = useElements( {\n\t\telements: field.elements,\n\t\tgetElements: field.getElements,\n\t} );\n\tconst value = getValue( { item: data } );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string ) =>\n\t\t\tonChange( setValue( { item: data, value: newValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\tif ( isLoading ) {\n\t\treturn <Spinner />;\n\t}\n\n\treturn (\n\t\t<ValidatedRadioControl\n\t\t\trequired={ !! field.isValid?.required }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\tlabel={ label }\n\t\t\thelp={ description }\n\t\t\tonChange={ onChangeControl }\n\t\t\toptions={ elements }\n\t\t\tselected={ value }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,aAAa,eAAe;AACrC,SAAS,mBAAmB;AAM5B,SAAS,cAAc;AACvB,OAAO,uBAAuB;AAC9B,OAAO,iBAAiB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis, Spinner } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport { unlock } from '../../lock-unlock';\nimport getCustomValidity from './utils/get-custom-validity';\nimport useElements from '../../hooks/use-elements';\n\nconst { ValidatedRadioControl } = unlock( privateApis );\n\nexport default function Radio< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { label, description, getValue, setValue, isValid } = field;\n\tconst { elements, isLoading } = useElements( {\n\t\telements: field.elements,\n\t\tgetElements: field.getElements,\n\t} );\n\tconst value = getValue( { item: data } );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string ) =>\n\t\t\tonChange( setValue( { item: data, value: newValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\tif ( isLoading ) {\n\t\treturn <Spinner />;\n\t}\n\n\treturn (\n\t\t<ValidatedRadioControl\n\t\t\trequired={ !! field.isValid?.required }\n\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\tlabel={ label }\n\t\t\thelp={ description }\n\t\t\tonChange={ onChangeControl }\n\t\t\toptions={ elements }\n\t\t\tselected={ value }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,aAAa,eAAe;AACrC,SAAS,mBAAmB;AAM5B,SAAS,cAAc;AACvB,OAAO,uBAAuB;AAC9B,OAAO,iBAAiB;AA0Bf;AAxBT,IAAM,EAAE,sBAAsB,IAAI,OAAQ,WAAY;AAEvC,SAAR,MAAgC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,OAAO,aAAa,UAAU,UAAU,QAAQ,IAAI;AAC5D,QAAM,EAAE,UAAU,UAAU,IAAI,YAAa;AAAA,IAC5C,UAAU,MAAM;AAAA,IAChB,aAAa,MAAM;AAAA,EACpB,CAAE;AACF,QAAM,QAAQ,SAAU,EAAE,MAAM,KAAK,CAAE;AAEvC,QAAM,kBAAkB;AAAA,IACvB,CAAE,aACD,SAAU,SAAU,EAAE,MAAM,MAAM,OAAO,SAAS,CAAE,CAAE;AAAA,IACvD,CAAE,MAAM,UAAU,QAAS;AAAA,EAC5B;AAEA,MAAK,WAAY;AAChB,WAAO,oBAAC,WAAQ;AAAA,EACjB;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAC,CAAE,MAAM,SAAS;AAAA,MAC7B;AAAA,MACA,gBAAiB,kBAAmB,SAAS,QAAS;AAAA,MACtD;AAAA,MACA,MAAO;AAAA,MACP,UAAW;AAAA,MACX,SAAU;AAAA,MACV,UAAW;AAAA,MACX;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ function Select({
|
|
|
11
11
|
field,
|
|
12
12
|
onChange,
|
|
13
13
|
hideLabelFromVision,
|
|
14
|
+
markWhenOptional,
|
|
14
15
|
validity
|
|
15
16
|
}) {
|
|
16
17
|
const { type, label, description, getValue, setValue, isValid } = field;
|
|
@@ -31,6 +32,7 @@ function Select({
|
|
|
31
32
|
ValidatedSelectControl,
|
|
32
33
|
{
|
|
33
34
|
required: !!field.isValid?.required,
|
|
35
|
+
markWhenOptional,
|
|
34
36
|
customValidity: getCustomValidity(isValid, validity),
|
|
35
37
|
label,
|
|
36
38
|
value,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/select.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis, Spinner } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport useElements from '../../hooks/use-elements';\nimport { unlock } from '../../lock-unlock';\nimport getCustomValidity from './utils/get-custom-validity';\n\nconst { ValidatedSelectControl } = unlock( privateApis );\n\nexport default function Select< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { type, label, description, getValue, setValue, isValid } = field;\n\n\tconst isMultiple = type === 'array';\n\tconst value = getValue( { item: data } ) ?? ( isMultiple ? [] : '' );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: any ) =>\n\t\t\tonChange( setValue( { item: data, value: newValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\tconst { elements, isLoading } = useElements( {\n\t\telements: field.elements,\n\t\tgetElements: field.getElements,\n\t} );\n\n\tif ( isLoading ) {\n\t\treturn <Spinner />;\n\t}\n\n\treturn (\n\t\t<ValidatedSelectControl\n\t\t\trequired={ !! field.isValid?.required }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\tlabel={ label }\n\t\t\tvalue={ value }\n\t\t\thelp={ description }\n\t\t\toptions={ elements }\n\t\t\tonChange={ onChangeControl }\n\t\t\t__next40pxDefaultSize\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tmultiple={ isMultiple }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,aAAa,eAAe;AACrC,SAAS,mBAAmB;AAM5B,OAAO,iBAAiB;AACxB,SAAS,cAAc;AACvB,OAAO,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis, Spinner } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport useElements from '../../hooks/use-elements';\nimport { unlock } from '../../lock-unlock';\nimport getCustomValidity from './utils/get-custom-validity';\n\nconst { ValidatedSelectControl } = unlock( privateApis );\n\nexport default function Select< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { type, label, description, getValue, setValue, isValid } = field;\n\n\tconst isMultiple = type === 'array';\n\tconst value = getValue( { item: data } ) ?? ( isMultiple ? [] : '' );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: any ) =>\n\t\t\tonChange( setValue( { item: data, value: newValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\tconst { elements, isLoading } = useElements( {\n\t\telements: field.elements,\n\t\tgetElements: field.getElements,\n\t} );\n\n\tif ( isLoading ) {\n\t\treturn <Spinner />;\n\t}\n\n\treturn (\n\t\t<ValidatedSelectControl\n\t\t\trequired={ !! field.isValid?.required }\n\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\tlabel={ label }\n\t\t\tvalue={ value }\n\t\t\thelp={ description }\n\t\t\toptions={ elements }\n\t\t\tonChange={ onChangeControl }\n\t\t\t__next40pxDefaultSize\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tmultiple={ isMultiple }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,aAAa,eAAe;AACrC,SAAS,mBAAmB;AAM5B,OAAO,iBAAiB;AACxB,SAAS,cAAc;AACvB,OAAO,uBAAuB;AA6BrB;AA3BT,IAAM,EAAE,uBAAuB,IAAI,OAAQ,WAAY;AAExC,SAAR,OAAiC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,MAAM,OAAO,aAAa,UAAU,UAAU,QAAQ,IAAI;AAElE,QAAM,aAAa,SAAS;AAC5B,QAAM,QAAQ,SAAU,EAAE,MAAM,KAAK,CAAE,MAAO,aAAa,CAAC,IAAI;AAEhE,QAAM,kBAAkB;AAAA,IACvB,CAAE,aACD,SAAU,SAAU,EAAE,MAAM,MAAM,OAAO,SAAS,CAAE,CAAE;AAAA,IACvD,CAAE,MAAM,UAAU,QAAS;AAAA,EAC5B;AAEA,QAAM,EAAE,UAAU,UAAU,IAAI,YAAa;AAAA,IAC5C,UAAU,MAAM;AAAA,IAChB,aAAa,MAAM;AAAA,EACpB,CAAE;AAEF,MAAK,WAAY;AAChB,WAAO,oBAAC,WAAQ;AAAA,EACjB;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAC,CAAE,MAAM,SAAS;AAAA,MAC7B;AAAA,MACA,gBAAiB,kBAAmB,SAAS,QAAS;AAAA,MACtD;AAAA,MACA;AAAA,MACA,MAAO;AAAA,MACP,SAAU;AAAA,MACV,UAAW;AAAA,MACX,uBAAqB;AAAA,MACrB;AAAA,MACA,UAAW;AAAA;AAAA,EACZ;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ function Telephone({
|
|
|
11
11
|
field,
|
|
12
12
|
onChange,
|
|
13
13
|
hideLabelFromVision,
|
|
14
|
+
markWhenOptional,
|
|
14
15
|
validity
|
|
15
16
|
}) {
|
|
16
17
|
return /* @__PURE__ */ jsx(
|
|
@@ -21,6 +22,7 @@ function Telephone({
|
|
|
21
22
|
field,
|
|
22
23
|
onChange,
|
|
23
24
|
hideLabelFromVision,
|
|
25
|
+
markWhenOptional,
|
|
24
26
|
validity,
|
|
25
27
|
type: "tel",
|
|
26
28
|
prefix: /* @__PURE__ */ jsx(InputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ jsx(Icon, { icon: mobile }) })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/telephone.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n} from '@wordpress/components';\nimport { mobile } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport ValidatedText from './utils/validated-input';\n\nexport default function Telephone< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\treturn (\n\t\t<ValidatedText\n\t\t\t{ ...{\n\t\t\t\tdata,\n\t\t\t\tfield,\n\t\t\t\tonChange,\n\t\t\t\thideLabelFromVision,\n\t\t\t\tvalidity,\n\t\t\t\ttype: 'tel',\n\t\t\t\tprefix: (\n\t\t\t\t\t<InputControlPrefixWrapper variant=\"icon\">\n\t\t\t\t\t\t<Icon icon={ mobile } />\n\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,2CAA2C;AAAA,OACrC;AACP,SAAS,cAAc;AAMvB,OAAO,mBAAmB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n} from '@wordpress/components';\nimport { mobile } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport ValidatedText from './utils/validated-input';\n\nexport default function Telephone< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\treturn (\n\t\t<ValidatedText\n\t\t\t{ ...{\n\t\t\t\tdata,\n\t\t\t\tfield,\n\t\t\t\tonChange,\n\t\t\t\thideLabelFromVision,\n\t\t\t\tmarkWhenOptional,\n\t\t\t\tvalidity,\n\t\t\t\ttype: 'tel',\n\t\t\t\tprefix: (\n\t\t\t\t\t<InputControlPrefixWrapper variant=\"icon\">\n\t\t\t\t\t\t<Icon icon={ mobile } />\n\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,2CAA2C;AAAA,OACrC;AACP,SAAS,cAAc;AAMvB,OAAO,mBAAmB;AAsBpB;AApBS,SAAR,UAAoC;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,SACC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAM;AAAA,QACN,QACC,oBAAC,6BAA0B,SAAQ,QAClC,8BAAC,QAAK,MAAO,QAAS,GACvB;AAAA,MAEF;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,6 +7,7 @@ function Text({
|
|
|
7
7
|
field,
|
|
8
8
|
onChange,
|
|
9
9
|
hideLabelFromVision,
|
|
10
|
+
markWhenOptional,
|
|
10
11
|
config,
|
|
11
12
|
validity
|
|
12
13
|
}) {
|
|
@@ -19,6 +20,7 @@ function Text({
|
|
|
19
20
|
field,
|
|
20
21
|
onChange,
|
|
21
22
|
hideLabelFromVision,
|
|
23
|
+
markWhenOptional,
|
|
22
24
|
validity,
|
|
23
25
|
prefix: prefix ? createElement(prefix) : void 0,
|
|
24
26
|
suffix: suffix ? createElement(suffix) : void 0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/text.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport ValidatedText from './utils/validated-input';\n\nexport default function Text< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tconfig,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { prefix, suffix } = config || {};\n\n\treturn (\n\t\t<ValidatedText\n\t\t\t{ ...{\n\t\t\t\tdata,\n\t\t\t\tfield,\n\t\t\t\tonChange,\n\t\t\t\thideLabelFromVision,\n\t\t\t\tvalidity,\n\t\t\t\tprefix: prefix ? createElement( prefix ) : undefined,\n\t\t\t\tsuffix: suffix ? createElement( suffix ) : undefined,\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,qBAAqB;AAM9B,OAAO,mBAAmB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport ValidatedText from './utils/validated-input';\n\nexport default function Text< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tconfig,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { prefix, suffix } = config || {};\n\n\treturn (\n\t\t<ValidatedText\n\t\t\t{ ...{\n\t\t\t\tdata,\n\t\t\t\tfield,\n\t\t\t\tonChange,\n\t\t\t\thideLabelFromVision,\n\t\t\t\tmarkWhenOptional,\n\t\t\t\tvalidity,\n\t\t\t\tprefix: prefix ? createElement( prefix ) : undefined,\n\t\t\t\tsuffix: suffix ? createElement( suffix ) : undefined,\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,qBAAqB;AAM9B,OAAO,mBAAmB;AAcxB;AAZa,SAAR,KAA+B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,QAAQ,OAAO,IAAI,UAAU,CAAC;AAEtC,SACC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,QAAQ,SAAS,cAAe,MAAO,IAAI;AAAA,QAC3C,QAAQ,SAAS,cAAe,MAAO,IAAI;AAAA,MAC5C;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,6 +10,7 @@ function Textarea({
|
|
|
10
10
|
field,
|
|
11
11
|
onChange,
|
|
12
12
|
hideLabelFromVision,
|
|
13
|
+
markWhenOptional,
|
|
13
14
|
config,
|
|
14
15
|
validity
|
|
15
16
|
}) {
|
|
@@ -24,6 +25,7 @@ function Textarea({
|
|
|
24
25
|
ValidatedTextareaControl,
|
|
25
26
|
{
|
|
26
27
|
required: !!isValid.required,
|
|
28
|
+
markWhenOptional,
|
|
27
29
|
customValidity: getCustomValidity(isValid, validity),
|
|
28
30
|
label,
|
|
29
31
|
placeholder,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/textarea.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport { unlock } from '../../lock-unlock';\nimport getCustomValidity from './utils/get-custom-validity';\n\nconst { ValidatedTextareaControl } = unlock( privateApis );\n\nexport default function Textarea< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tconfig,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { rows = 4 } = config || {};\n\tconst { label, placeholder, description, setValue, isValid } = field;\n\tconst value = field.getValue( { item: data } );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string ) =>\n\t\t\tonChange( setValue( { item: data, value: newValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\treturn (\n\t\t<ValidatedTextareaControl\n\t\t\trequired={ !! isValid.required }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\tlabel={ label }\n\t\t\tplaceholder={ placeholder }\n\t\t\tvalue={ value ?? '' }\n\t\t\thelp={ description }\n\t\t\tonChange={ onChangeControl }\n\t\t\trows={ rows }\n\t\t\tminLength={\n\t\t\t\tisValid.minLength ? isValid.minLength.constraint : undefined\n\t\t\t}\n\t\t\tmaxLength={\n\t\t\t\tisValid.maxLength ? isValid.maxLength.constraint : undefined\n\t\t\t}\n\t\t\t__next40pxDefaultSize\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAM5B,SAAS,cAAc;AACvB,OAAO,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport { unlock } from '../../lock-unlock';\nimport getCustomValidity from './utils/get-custom-validity';\n\nconst { ValidatedTextareaControl } = unlock( privateApis );\n\nexport default function Textarea< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tconfig,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { rows = 4 } = config || {};\n\tconst { label, placeholder, description, setValue, isValid } = field;\n\tconst value = field.getValue( { item: data } );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string ) =>\n\t\t\tonChange( setValue( { item: data, value: newValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\treturn (\n\t\t<ValidatedTextareaControl\n\t\t\trequired={ !! isValid.required }\n\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\tlabel={ label }\n\t\t\tplaceholder={ placeholder }\n\t\t\tvalue={ value ?? '' }\n\t\t\thelp={ description }\n\t\t\tonChange={ onChangeControl }\n\t\t\trows={ rows }\n\t\t\tminLength={\n\t\t\t\tisValid.minLength ? isValid.minLength.constraint : undefined\n\t\t\t}\n\t\t\tmaxLength={\n\t\t\t\tisValid.maxLength ? isValid.maxLength.constraint : undefined\n\t\t\t}\n\t\t\t__next40pxDefaultSize\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAM5B,SAAS,cAAc;AACvB,OAAO,uBAAuB;AAwB5B;AAtBF,IAAM,EAAE,yBAAyB,IAAI,OAAQ,WAAY;AAE1C,SAAR,SAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,OAAO,EAAE,IAAI,UAAU,CAAC;AAChC,QAAM,EAAE,OAAO,aAAa,aAAa,UAAU,QAAQ,IAAI;AAC/D,QAAM,QAAQ,MAAM,SAAU,EAAE,MAAM,KAAK,CAAE;AAE7C,QAAM,kBAAkB;AAAA,IACvB,CAAE,aACD,SAAU,SAAU,EAAE,MAAM,MAAM,OAAO,SAAS,CAAE,CAAE;AAAA,IACvD,CAAE,MAAM,UAAU,QAAS;AAAA,EAC5B;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAC,CAAE,QAAQ;AAAA,MACtB;AAAA,MACA,gBAAiB,kBAAmB,SAAS,QAAS;AAAA,MACtD;AAAA,MACA;AAAA,MACA,OAAQ,SAAS;AAAA,MACjB,MAAO;AAAA,MACP,UAAW;AAAA,MACX;AAAA,MACA,WACC,QAAQ,YAAY,QAAQ,UAAU,aAAa;AAAA,MAEpD,WACC,QAAQ,YAAY,QAAQ,UAAU,aAAa;AAAA,MAEpD,uBAAqB;AAAA,MACrB;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -15,6 +15,7 @@ function ToggleGroup({
|
|
|
15
15
|
field,
|
|
16
16
|
onChange,
|
|
17
17
|
hideLabelFromVision,
|
|
18
|
+
markWhenOptional,
|
|
18
19
|
validity
|
|
19
20
|
}) {
|
|
20
21
|
const { getValue, setValue, isValid } = field;
|
|
@@ -38,6 +39,7 @@ function ToggleGroup({
|
|
|
38
39
|
ValidatedToggleGroupControl,
|
|
39
40
|
{
|
|
40
41
|
required: !!field.isValid?.required,
|
|
42
|
+
markWhenOptional,
|
|
41
43
|
customValidity: getCustomValidity(isValid, validity),
|
|
42
44
|
__next40pxDefaultSize: true,
|
|
43
45
|
isBlock: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/toggle-group.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tSpinner,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport { unlock } from '../../lock-unlock';\nimport getCustomValidity from './utils/get-custom-validity';\nimport useElements from '../../hooks/use-elements';\n\nconst { ValidatedToggleGroupControl } = unlock( privateApis );\n\nexport default function ToggleGroup< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { getValue, setValue, isValid } = field;\n\tconst value = getValue( { item: data } );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string | number | undefined ) =>\n\t\t\tonChange( setValue( { item: data, value: newValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\tconst { elements, isLoading } = useElements( {\n\t\telements: field.elements,\n\t\tgetElements: field.getElements,\n\t} );\n\n\tif ( isLoading ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( elements.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst selectedOption = elements.find( ( el ) => el.value === value );\n\treturn (\n\t\t<ValidatedToggleGroupControl\n\t\t\trequired={ !! field.isValid?.required }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\t__next40pxDefaultSize\n\t\t\tisBlock\n\t\t\tlabel={ field.label }\n\t\t\thelp={ selectedOption?.description || field.description }\n\t\t\tonChange={ onChangeControl }\n\t\t\tvalue={ value }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t>\n\t\t\t{ elements.map( ( el ) => (\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ el.value }\n\t\t\t\t\tlabel={ el.label }\n\t\t\t\t\tvalue={ el.value }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ValidatedToggleGroupControl>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,0CAA0C;AAAA,EAC1C;AAAA,OACM;AACP,SAAS,mBAAmB;AAM5B,SAAS,cAAc;AACvB,OAAO,uBAAuB;AAC9B,OAAO,iBAAiB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\tSpinner,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport { unlock } from '../../lock-unlock';\nimport getCustomValidity from './utils/get-custom-validity';\nimport useElements from '../../hooks/use-elements';\n\nconst { ValidatedToggleGroupControl } = unlock( privateApis );\n\nexport default function ToggleGroup< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { getValue, setValue, isValid } = field;\n\tconst value = getValue( { item: data } );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string | number | undefined ) =>\n\t\t\tonChange( setValue( { item: data, value: newValue } ) ),\n\t\t[ data, onChange, setValue ]\n\t);\n\n\tconst { elements, isLoading } = useElements( {\n\t\telements: field.elements,\n\t\tgetElements: field.getElements,\n\t} );\n\n\tif ( isLoading ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( elements.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst selectedOption = elements.find( ( el ) => el.value === value );\n\treturn (\n\t\t<ValidatedToggleGroupControl\n\t\t\trequired={ !! field.isValid?.required }\n\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\t__next40pxDefaultSize\n\t\t\tisBlock\n\t\t\tlabel={ field.label }\n\t\t\thelp={ selectedOption?.description || field.description }\n\t\t\tonChange={ onChangeControl }\n\t\t\tvalue={ value }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t>\n\t\t\t{ elements.map( ( el ) => (\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ el.value }\n\t\t\t\t\tlabel={ el.label }\n\t\t\t\t\tvalue={ el.value }\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</ValidatedToggleGroupControl>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,0CAA0C;AAAA,EAC1C;AAAA,OACM;AACP,SAAS,mBAAmB;AAM5B,SAAS,cAAc;AACvB,OAAO,uBAAuB;AAC9B,OAAO,iBAAiB;AA2Bf;AAzBT,IAAM,EAAE,4BAA4B,IAAI,OAAQ,WAAY;AAE7C,SAAR,YAAsC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,UAAU,UAAU,QAAQ,IAAI;AACxC,QAAM,QAAQ,SAAU,EAAE,MAAM,KAAK,CAAE;AAEvC,QAAM,kBAAkB;AAAA,IACvB,CAAE,aACD,SAAU,SAAU,EAAE,MAAM,MAAM,OAAO,SAAS,CAAE,CAAE;AAAA,IACvD,CAAE,MAAM,UAAU,QAAS;AAAA,EAC5B;AAEA,QAAM,EAAE,UAAU,UAAU,IAAI,YAAa;AAAA,IAC5C,UAAU,MAAM;AAAA,IAChB,aAAa,MAAM;AAAA,EACpB,CAAE;AAEF,MAAK,WAAY;AAChB,WAAO,oBAAC,WAAQ;AAAA,EACjB;AAEA,MAAK,SAAS,WAAW,GAAI;AAC5B,WAAO;AAAA,EACR;AAEA,QAAM,iBAAiB,SAAS,KAAM,CAAE,OAAQ,GAAG,UAAU,KAAM;AACnE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAC,CAAE,MAAM,SAAS;AAAA,MAC7B;AAAA,MACA,gBAAiB,kBAAmB,SAAS,QAAS;AAAA,MACtD,uBAAqB;AAAA,MACrB,SAAO;AAAA,MACP,OAAQ,MAAM;AAAA,MACd,MAAO,gBAAgB,eAAe,MAAM;AAAA,MAC5C,UAAW;AAAA,MACX;AAAA,MACA;AAAA,MAEE,mBAAS,IAAK,CAAE,OACjB;AAAA,QAAC;AAAA;AAAA,UAEA,OAAQ,GAAG;AAAA,UACX,OAAQ,GAAG;AAAA;AAAA,QAFL,GAAG;AAAA,MAGV,CACC;AAAA;AAAA,EACH;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,6 +10,7 @@ function Toggle({
|
|
|
10
10
|
onChange,
|
|
11
11
|
data,
|
|
12
12
|
hideLabelFromVision,
|
|
13
|
+
markWhenOptional,
|
|
13
14
|
validity
|
|
14
15
|
}) {
|
|
15
16
|
const { label, description, getValue, setValue, isValid } = field;
|
|
@@ -22,6 +23,7 @@ function Toggle({
|
|
|
22
23
|
ValidatedToggleControl,
|
|
23
24
|
{
|
|
24
25
|
required: !!isValid.required,
|
|
26
|
+
markWhenOptional,
|
|
25
27
|
customValidity: getCustomValidity(isValid, validity),
|
|
26
28
|
hidden: hideLabelFromVision,
|
|
27
29
|
label,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/toggle.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport { unlock } from '../../lock-unlock';\nimport getCustomValidity from './utils/get-custom-validity';\n\nconst { ValidatedToggleControl } = unlock( privateApis );\n\nexport default function Toggle< Item >( {\n\tfield,\n\tonChange,\n\tdata,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { label, description, getValue, setValue, isValid } = field;\n\n\tconst onChangeControl = useCallback( () => {\n\t\tonChange(\n\t\t\tsetValue( { item: data, value: ! getValue( { item: data } ) } )\n\t\t);\n\t}, [ onChange, setValue, data, getValue ] );\n\n\treturn (\n\t\t<ValidatedToggleControl\n\t\t\trequired={ !! isValid.required }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\thidden={ hideLabelFromVision }\n\t\t\tlabel={ label }\n\t\t\thelp={ description }\n\t\t\tchecked={ getValue( { item: data } ) }\n\t\t\tonChange={ onChangeControl }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAM5B,SAAS,cAAc;AACvB,OAAO,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport { unlock } from '../../lock-unlock';\nimport getCustomValidity from './utils/get-custom-validity';\n\nconst { ValidatedToggleControl } = unlock( privateApis );\n\nexport default function Toggle< Item >( {\n\tfield,\n\tonChange,\n\tdata,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { label, description, getValue, setValue, isValid } = field;\n\n\tconst onChangeControl = useCallback( () => {\n\t\tonChange(\n\t\t\tsetValue( { item: data, value: ! getValue( { item: data } ) } )\n\t\t);\n\t}, [ onChange, setValue, data, getValue ] );\n\n\treturn (\n\t\t<ValidatedToggleControl\n\t\t\trequired={ !! isValid.required }\n\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\thidden={ hideLabelFromVision }\n\t\t\tlabel={ label }\n\t\t\thelp={ description }\n\t\t\tchecked={ getValue( { item: data } ) }\n\t\t\tonChange={ onChangeControl }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAM5B,SAAS,cAAc;AACvB,OAAO,uBAAuB;AAqB5B;AAnBF,IAAM,EAAE,uBAAuB,IAAI,OAAQ,WAAY;AAExC,SAAR,OAAiC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,OAAO,aAAa,UAAU,UAAU,QAAQ,IAAI;AAE5D,QAAM,kBAAkB,YAAa,MAAM;AAC1C;AAAA,MACC,SAAU,EAAE,MAAM,MAAM,OAAO,CAAE,SAAU,EAAE,MAAM,KAAK,CAAE,EAAE,CAAE;AAAA,IAC/D;AAAA,EACD,GAAG,CAAE,UAAU,UAAU,MAAM,QAAS,CAAE;AAE1C,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAC,CAAE,QAAQ;AAAA,MACtB;AAAA,MACA,gBAAiB,kBAAmB,SAAS,QAAS;AAAA,MACtD,QAAS;AAAA,MACT;AAAA,MACA,MAAO;AAAA,MACP,SAAU,SAAU,EAAE,MAAM,KAAK,CAAE;AAAA,MACnC,UAAW;AAAA;AAAA,EACZ;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,6 +11,7 @@ function Url({
|
|
|
11
11
|
field,
|
|
12
12
|
onChange,
|
|
13
13
|
hideLabelFromVision,
|
|
14
|
+
markWhenOptional,
|
|
14
15
|
validity
|
|
15
16
|
}) {
|
|
16
17
|
return /* @__PURE__ */ jsx(
|
|
@@ -21,6 +22,7 @@ function Url({
|
|
|
21
22
|
field,
|
|
22
23
|
onChange,
|
|
23
24
|
hideLabelFromVision,
|
|
25
|
+
markWhenOptional,
|
|
24
26
|
validity,
|
|
25
27
|
type: "url",
|
|
26
28
|
prefix: /* @__PURE__ */ jsx(InputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ jsx(Icon, { icon: link }) })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/url.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n} from '@wordpress/components';\nimport { link } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport ValidatedText from './utils/validated-input';\n\nexport default function Url< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\treturn (\n\t\t<ValidatedText\n\t\t\t{ ...{\n\t\t\t\tdata,\n\t\t\t\tfield,\n\t\t\t\tonChange,\n\t\t\t\thideLabelFromVision,\n\t\t\t\tvalidity,\n\t\t\t\ttype: 'url',\n\t\t\t\tprefix: (\n\t\t\t\t\t<InputControlPrefixWrapper variant=\"icon\">\n\t\t\t\t\t\t<Icon icon={ link } />\n\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,2CAA2C;AAAA,OACrC;AACP,SAAS,YAAY;AAMrB,OAAO,mBAAmB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n} from '@wordpress/components';\nimport { link } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport ValidatedText from './utils/validated-input';\n\nexport default function Url< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\treturn (\n\t\t<ValidatedText\n\t\t\t{ ...{\n\t\t\t\tdata,\n\t\t\t\tfield,\n\t\t\t\tonChange,\n\t\t\t\thideLabelFromVision,\n\t\t\t\tmarkWhenOptional,\n\t\t\t\tvalidity,\n\t\t\t\ttype: 'url',\n\t\t\t\tprefix: (\n\t\t\t\t\t<InputControlPrefixWrapper variant=\"icon\">\n\t\t\t\t\t\t<Icon icon={ link } />\n\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t),\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,2CAA2C;AAAA,OACrC;AACP,SAAS,YAAY;AAMrB,OAAO,mBAAmB;AAsBpB;AApBS,SAAR,IAA8B;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,SACC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAM;AAAA,QACN,QACC,oBAAC,6BAA0B,SAAQ,QAClC,8BAAC,QAAK,MAAO,MAAO,GACrB;AAAA,MAEF;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -61,7 +61,7 @@ function RelativeDateControl({
|
|
|
61
61
|
className: clsx(className, "dataviews-controls__relative-date"),
|
|
62
62
|
label,
|
|
63
63
|
hideLabelFromVision,
|
|
64
|
-
children: /* @__PURE__ */ jsxs(Stack, { direction: "row", gap: "
|
|
64
|
+
children: /* @__PURE__ */ jsxs(Stack, { direction: "row", gap: "sm", children: [
|
|
65
65
|
/* @__PURE__ */ jsx(
|
|
66
66
|
NumberControl,
|
|
67
67
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/dataform-controls/utils/relative-date-control.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\tSelectControl,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { OPERATOR_IN_THE_PAST, OPERATOR_OVER } from '../../../constants';\nimport type { DataFormControlProps } from '../../../types';\n\ntype VALID_OPERATORS = 'inThePast' | 'over';\n\ninterface TimeUnitOption {\n\tvalue: string;\n\tlabel: string;\n}\n\nconst TIME_UNITS_OPTIONS: Record< VALID_OPERATORS, TimeUnitOption[] > = {\n\t[ OPERATOR_IN_THE_PAST ]: [\n\t\t{ value: 'days', label: __( 'Days' ) },\n\t\t{ value: 'weeks', label: __( 'Weeks' ) },\n\t\t{ value: 'months', label: __( 'Months' ) },\n\t\t{ value: 'years', label: __( 'Years' ) },\n\t],\n\t[ OPERATOR_OVER ]: [\n\t\t{ value: 'days', label: __( 'Days ago' ) },\n\t\t{ value: 'weeks', label: __( 'Weeks ago' ) },\n\t\t{ value: 'months', label: __( 'Months ago' ) },\n\t\t{ value: 'years', label: __( 'Years ago' ) },\n\t],\n};\n\nexport default function RelativeDateControl< Item >( {\n\tclassName,\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\toperator,\n}: DataFormControlProps< Item > & {\n\tclassName: string;\n} ) {\n\tconst options: TimeUnitOption[] =\n\t\tTIME_UNITS_OPTIONS[\n\t\t\toperator === OPERATOR_IN_THE_PAST ? 'inThePast' : 'over'\n\t\t];\n\n\tconst { id, label, getValue, setValue } = field;\n\tconst fieldValue = getValue( { item: data } );\n\tconst { value: relValue = '', unit = options[ 0 ].value } =\n\t\tfieldValue && typeof fieldValue === 'object' ? fieldValue : {};\n\n\tconst onChangeValue = useCallback(\n\t\t( newValue: string | undefined ) =>\n\t\t\tonChange(\n\t\t\t\tsetValue( {\n\t\t\t\t\titem: data,\n\t\t\t\t\tvalue: { value: Number( newValue ), unit },\n\t\t\t\t} )\n\t\t\t),\n\t\t[ onChange, setValue, data, unit ]\n\t);\n\n\tconst onChangeUnit = useCallback(\n\t\t( newUnit: string | undefined ) =>\n\t\t\tonChange(\n\t\t\t\tsetValue( {\n\t\t\t\t\titem: data,\n\t\t\t\t\tvalue: { value: relValue, unit: newUnit },\n\t\t\t\t} )\n\t\t\t),\n\t\t[ onChange, setValue, data, relValue ]\n\t);\n\n\treturn (\n\t\t<BaseControl\n\t\t\tid={ id }\n\t\t\tclassName={ clsx( className, 'dataviews-controls__relative-date' ) }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t>\n\t\t\t<Stack direction=\"row\" gap=\"
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\tSelectControl,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Stack } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { OPERATOR_IN_THE_PAST, OPERATOR_OVER } from '../../../constants';\nimport type { DataFormControlProps } from '../../../types';\n\ntype VALID_OPERATORS = 'inThePast' | 'over';\n\ninterface TimeUnitOption {\n\tvalue: string;\n\tlabel: string;\n}\n\nconst TIME_UNITS_OPTIONS: Record< VALID_OPERATORS, TimeUnitOption[] > = {\n\t[ OPERATOR_IN_THE_PAST ]: [\n\t\t{ value: 'days', label: __( 'Days' ) },\n\t\t{ value: 'weeks', label: __( 'Weeks' ) },\n\t\t{ value: 'months', label: __( 'Months' ) },\n\t\t{ value: 'years', label: __( 'Years' ) },\n\t],\n\t[ OPERATOR_OVER ]: [\n\t\t{ value: 'days', label: __( 'Days ago' ) },\n\t\t{ value: 'weeks', label: __( 'Weeks ago' ) },\n\t\t{ value: 'months', label: __( 'Months ago' ) },\n\t\t{ value: 'years', label: __( 'Years ago' ) },\n\t],\n};\n\nexport default function RelativeDateControl< Item >( {\n\tclassName,\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\toperator,\n}: DataFormControlProps< Item > & {\n\tclassName: string;\n} ) {\n\tconst options: TimeUnitOption[] =\n\t\tTIME_UNITS_OPTIONS[\n\t\t\toperator === OPERATOR_IN_THE_PAST ? 'inThePast' : 'over'\n\t\t];\n\n\tconst { id, label, getValue, setValue } = field;\n\tconst fieldValue = getValue( { item: data } );\n\tconst { value: relValue = '', unit = options[ 0 ].value } =\n\t\tfieldValue && typeof fieldValue === 'object' ? fieldValue : {};\n\n\tconst onChangeValue = useCallback(\n\t\t( newValue: string | undefined ) =>\n\t\t\tonChange(\n\t\t\t\tsetValue( {\n\t\t\t\t\titem: data,\n\t\t\t\t\tvalue: { value: Number( newValue ), unit },\n\t\t\t\t} )\n\t\t\t),\n\t\t[ onChange, setValue, data, unit ]\n\t);\n\n\tconst onChangeUnit = useCallback(\n\t\t( newUnit: string | undefined ) =>\n\t\t\tonChange(\n\t\t\t\tsetValue( {\n\t\t\t\t\titem: data,\n\t\t\t\t\tvalue: { value: relValue, unit: newUnit },\n\t\t\t\t} )\n\t\t\t),\n\t\t[ onChange, setValue, data, relValue ]\n\t);\n\n\treturn (\n\t\t<BaseControl\n\t\t\tid={ id }\n\t\t\tclassName={ clsx( className, 'dataviews-controls__relative-date' ) }\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t>\n\t\t\t<Stack direction=\"row\" gap=\"sm\">\n\t\t\t\t<NumberControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"dataviews-controls__relative-date-number\"\n\t\t\t\t\tspinControls=\"none\"\n\t\t\t\t\tmin={ 1 }\n\t\t\t\t\tstep={ 1 }\n\t\t\t\t\tvalue={ relValue }\n\t\t\t\t\tonChange={ onChangeValue }\n\t\t\t\t/>\n\t\t\t\t<SelectControl\n\t\t\t\t\tclassName=\"dataviews-controls__relative-date-unit\"\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Unit' ) }\n\t\t\t\t\tvalue={ unit }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tonChange={ onChangeUnit }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t</Stack>\n\t\t</BaseControl>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";AAGA,OAAO,UAAU;AAKjB;AAAA,EACC;AAAA,EACA;AAAA,EACA,+BAA+B;AAAA,OACzB;AACP,SAAS,mBAAmB;AAC5B,SAAS,UAAU;AACnB,SAAS,aAAa;AAKtB,SAAS,sBAAsB,qBAAqB;AA0EjD,SACC,KADD;AAhEH,IAAM,qBAAkE;AAAA,EACvE,CAAE,oBAAqB,GAAG;AAAA,IACzB,EAAE,OAAO,QAAQ,OAAO,GAAI,MAAO,EAAE;AAAA,IACrC,EAAE,OAAO,SAAS,OAAO,GAAI,OAAQ,EAAE;AAAA,IACvC,EAAE,OAAO,UAAU,OAAO,GAAI,QAAS,EAAE;AAAA,IACzC,EAAE,OAAO,SAAS,OAAO,GAAI,OAAQ,EAAE;AAAA,EACxC;AAAA,EACA,CAAE,aAAc,GAAG;AAAA,IAClB,EAAE,OAAO,QAAQ,OAAO,GAAI,UAAW,EAAE;AAAA,IACzC,EAAE,OAAO,SAAS,OAAO,GAAI,WAAY,EAAE;AAAA,IAC3C,EAAE,OAAO,UAAU,OAAO,GAAI,YAAa,EAAE;AAAA,IAC7C,EAAE,OAAO,SAAS,OAAO,GAAI,WAAY,EAAE;AAAA,EAC5C;AACD;AAEe,SAAR,oBAA8C;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAEI;AACH,QAAM,UACL,mBACC,aAAa,uBAAuB,cAAc,MACnD;AAED,QAAM,EAAE,IAAI,OAAO,UAAU,SAAS,IAAI;AAC1C,QAAM,aAAa,SAAU,EAAE,MAAM,KAAK,CAAE;AAC5C,QAAM,EAAE,OAAO,WAAW,IAAI,OAAO,QAAS,CAAE,EAAE,MAAM,IACvD,cAAc,OAAO,eAAe,WAAW,aAAa,CAAC;AAE9D,QAAM,gBAAgB;AAAA,IACrB,CAAE,aACD;AAAA,MACC,SAAU;AAAA,QACT,MAAM;AAAA,QACN,OAAO,EAAE,OAAO,OAAQ,QAAS,GAAG,KAAK;AAAA,MAC1C,CAAE;AAAA,IACH;AAAA,IACD,CAAE,UAAU,UAAU,MAAM,IAAK;AAAA,EAClC;AAEA,QAAM,eAAe;AAAA,IACpB,CAAE,YACD;AAAA,MACC,SAAU;AAAA,QACT,MAAM;AAAA,QACN,OAAO,EAAE,OAAO,UAAU,MAAM,QAAQ;AAAA,MACzC,CAAE;AAAA,IACH;AAAA,IACD,CAAE,UAAU,UAAU,MAAM,QAAS;AAAA,EACtC;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,WAAY,KAAM,WAAW,mCAAoC;AAAA,MACjE;AAAA,MACA;AAAA,MAEA,+BAAC,SAAM,WAAU,OAAM,KAAI,MAC1B;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,WAAU;AAAA,YACV,cAAa;AAAA,YACb,KAAM;AAAA,YACN,MAAO;AAAA,YACP,OAAQ;AAAA,YACR,UAAW;AAAA;AAAA,QACZ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,uBAAqB;AAAA,YACrB,OAAQ,GAAI,MAAO;AAAA,YACnB,OAAQ;AAAA,YACR;AAAA,YACA,UAAW;AAAA,YACX,qBAAmB;AAAA;AAAA,QACpB;AAAA,SACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,6 +10,7 @@ function ValidatedText({
|
|
|
10
10
|
field,
|
|
11
11
|
onChange,
|
|
12
12
|
hideLabelFromVision,
|
|
13
|
+
markWhenOptional,
|
|
13
14
|
type,
|
|
14
15
|
prefix,
|
|
15
16
|
suffix,
|
|
@@ -30,6 +31,7 @@ function ValidatedText({
|
|
|
30
31
|
ValidatedInputControl,
|
|
31
32
|
{
|
|
32
33
|
required: !!isValid.required,
|
|
34
|
+
markWhenOptional,
|
|
33
35
|
customValidity: getCustomValidity(isValid, validity),
|
|
34
36
|
label,
|
|
35
37
|
placeholder,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/dataform-controls/utils/validated-input.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../../types';\nimport { unlock } from '../../../lock-unlock';\nimport getCustomValidity from './get-custom-validity';\n\nconst { ValidatedInputControl } = unlock( privateApis );\n\nexport type DataFormValidatedTextControlProps< Item > =\n\tDataFormControlProps< Item > & {\n\t\t/**\n\t\t * The input type of the control.\n\t\t */\n\t\ttype?: 'text' | 'email' | 'tel' | 'url' | 'password';\n\t\t/**\n\t\t * Optional prefix element to display before the input.\n\t\t */\n\t\tprefix?: React.ReactElement;\n\t\t/**\n\t\t * Optional suffix element to display after the input.\n\t\t */\n\t\tsuffix?: React.ReactElement;\n\t};\n\nexport default function ValidatedText< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\ttype,\n\tprefix,\n\tsuffix,\n\tvalidity,\n}: DataFormValidatedTextControlProps< Item > ) {\n\tconst { label, placeholder, description, getValue, setValue, isValid } =\n\t\tfield;\n\tconst value = getValue( { item: data } );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string ) =>\n\t\t\tonChange(\n\t\t\t\tsetValue( {\n\t\t\t\t\titem: data,\n\t\t\t\t\tvalue: newValue,\n\t\t\t\t} )\n\t\t\t),\n\t\t[ data, setValue, onChange ]\n\t);\n\n\treturn (\n\t\t<ValidatedInputControl\n\t\t\trequired={ !! isValid.required }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\tlabel={ label }\n\t\t\tplaceholder={ placeholder }\n\t\t\tvalue={ value ?? '' }\n\t\t\thelp={ description }\n\t\t\tonChange={ onChangeControl }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\ttype={ type }\n\t\t\tprefix={ prefix }\n\t\t\tsuffix={ suffix }\n\t\t\tpattern={ isValid.pattern ? isValid.pattern.constraint : undefined }\n\t\t\tminLength={\n\t\t\t\tisValid.minLength ? isValid.minLength.constraint : undefined\n\t\t\t}\n\t\t\tmaxLength={\n\t\t\t\tisValid.maxLength ? isValid.maxLength.constraint : undefined\n\t\t\t}\n\t\t\t__next40pxDefaultSize\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAM5B,SAAS,cAAc;AACvB,OAAO,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis } from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../../types';\nimport { unlock } from '../../../lock-unlock';\nimport getCustomValidity from './get-custom-validity';\n\nconst { ValidatedInputControl } = unlock( privateApis );\n\nexport type DataFormValidatedTextControlProps< Item > =\n\tDataFormControlProps< Item > & {\n\t\t/**\n\t\t * The input type of the control.\n\t\t */\n\t\ttype?: 'text' | 'email' | 'tel' | 'url' | 'password';\n\t\t/**\n\t\t * Optional prefix element to display before the input.\n\t\t */\n\t\tprefix?: React.ReactElement;\n\t\t/**\n\t\t * Optional suffix element to display after the input.\n\t\t */\n\t\tsuffix?: React.ReactElement;\n\t};\n\nexport default function ValidatedText< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\ttype,\n\tprefix,\n\tsuffix,\n\tvalidity,\n}: DataFormValidatedTextControlProps< Item > ) {\n\tconst { label, placeholder, description, getValue, setValue, isValid } =\n\t\tfield;\n\tconst value = getValue( { item: data } );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string ) =>\n\t\t\tonChange(\n\t\t\t\tsetValue( {\n\t\t\t\t\titem: data,\n\t\t\t\t\tvalue: newValue,\n\t\t\t\t} )\n\t\t\t),\n\t\t[ data, setValue, onChange ]\n\t);\n\n\treturn (\n\t\t<ValidatedInputControl\n\t\t\trequired={ !! isValid.required }\n\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\tlabel={ label }\n\t\t\tplaceholder={ placeholder }\n\t\t\tvalue={ value ?? '' }\n\t\t\thelp={ description }\n\t\t\tonChange={ onChangeControl }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\ttype={ type }\n\t\t\tprefix={ prefix }\n\t\t\tsuffix={ suffix }\n\t\t\tpattern={ isValid.pattern ? isValid.pattern.constraint : undefined }\n\t\t\tminLength={\n\t\t\t\tisValid.minLength ? isValid.minLength.constraint : undefined\n\t\t\t}\n\t\t\tmaxLength={\n\t\t\t\tisValid.maxLength ? isValid.maxLength.constraint : undefined\n\t\t\t}\n\t\t\t__next40pxDefaultSize\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAM5B,SAAS,cAAc;AACvB,OAAO,uBAAuB;AA+C5B;AA7CF,IAAM,EAAE,sBAAsB,IAAI,OAAQ,WAAY;AAkBvC,SAAR,cAAwC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAA+C;AAC9C,QAAM,EAAE,OAAO,aAAa,aAAa,UAAU,UAAU,QAAQ,IACpE;AACD,QAAM,QAAQ,SAAU,EAAE,MAAM,KAAK,CAAE;AAEvC,QAAM,kBAAkB;AAAA,IACvB,CAAE,aACD;AAAA,MACC,SAAU;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACR,CAAE;AAAA,IACH;AAAA,IACD,CAAE,MAAM,UAAU,QAAS;AAAA,EAC5B;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAC,CAAE,QAAQ;AAAA,MACtB;AAAA,MACA,gBAAiB,kBAAmB,SAAS,QAAS;AAAA,MACtD;AAAA,MACA;AAAA,MACA,OAAQ,SAAS;AAAA,MACjB,MAAO;AAAA,MACP,UAAW;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,SAAU,QAAQ,UAAU,QAAQ,QAAQ,aAAa;AAAA,MACzD,WACC,QAAQ,YAAY,QAAQ,UAAU,aAAa;AAAA,MAEpD,WACC,QAAQ,YAAY,QAAQ,UAAU,aAAa;AAAA,MAEpD,uBAAqB;AAAA;AAAA,EACtB;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -72,6 +72,7 @@ function ValidatedNumber({
|
|
|
72
72
|
field,
|
|
73
73
|
onChange,
|
|
74
74
|
hideLabelFromVision,
|
|
75
|
+
markWhenOptional,
|
|
75
76
|
operator,
|
|
76
77
|
validity
|
|
77
78
|
}) {
|
|
@@ -125,6 +126,7 @@ function ValidatedNumber({
|
|
|
125
126
|
ValidatedNumberControl,
|
|
126
127
|
{
|
|
127
128
|
required: !!isValid.required,
|
|
129
|
+
markWhenOptional,
|
|
128
130
|
customValidity: getCustomValidity(isValid, validity),
|
|
129
131
|
label,
|
|
130
132
|
help: description,
|