@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
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## 12.0.0 (2026-02-18)
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- The design tokens stylesheet (`@wordpress/theme/design-tokens.css`) is no longer embedded in the DataViews stylesheet. Applications using DataViews outside of WordPress must now explicitly include the design tokens stylesheet. See the README for installation instructions. [#75182](https://github.com/WordPress/gutenberg/pull/75182)
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
- DataForm: Fix text selection in panel layout summary rows by replacing `::after` overlay with accessible card pattern. [#75565](https://github.com/WordPress/gutenberg/pull/75565)
|
|
14
|
+
- DataViews: Improve styling for filters when long values are in use. [#75369](https://github.com/WordPress/gutenberg/pull/75369)
|
|
15
|
+
- DataForm: Fix label case for regular layout. [#75292](https://github.com/WordPress/gutenberg/pull/75292)
|
|
16
|
+
- DataViews: Add title attribute in grid item title field. [#75085](https://github.com/WordPress/gutenberg/pull/75085)
|
|
17
|
+
- DataViews: Fix title truncation in list layout. [#75063](https://github.com/WordPress/gutenberg/pull/75063)
|
|
18
|
+
- DataViews: Fix fields async validation. [#74948](https://github.com/WordPress/gutenberg/pull/74948)
|
|
19
|
+
- DataForm: Fix color picker styles. [#75427](https://github.com/WordPress/gutenberg/pull/75427)
|
|
20
|
+
|
|
21
|
+
### Enhancements
|
|
22
|
+
|
|
23
|
+
- DataForm: add edit variant. [#75462](https://github.com/WordPress/gutenberg/pull/75462)
|
|
24
|
+
- DataForm: Update trigger mechanism for panel layout. [#75290](https://github.com/WordPress/gutenberg/pull/75290)
|
|
25
|
+
- DataViews: Add `onReset` prop to control view reset functionality from the view config dropdown. [#75093](https://github.com/WordPress/gutenberg/pull/75093)
|
|
26
|
+
- DataForm: Add automatic field labeling - forms now automatically mark the minority of fields (required or optional) to reduce visual noise. [#74430](https://github.com/WordPress/gutenberg/pull/74430)
|
|
27
|
+
- DataViews: Add details form layout validation. [#74996](https://github.com/WordPress/gutenberg/pull/74996)
|
|
28
|
+
- Add new `adaptiveSelect` DataForm control. [#74937](https://github.com/WordPress/gutenberg/pull/74937)
|
|
29
|
+
- DataViews: Consistent rendering of selection checkbox and actions in grid layout. [#75056](https://github.com/WordPress/gutenberg/pull/75056)
|
|
30
|
+
|
|
31
|
+
### Code Quality
|
|
32
|
+
- DataForm: Style SummaryButton in panel layout with `is-disabled` classname. [#75470](https://github.com/WordPress/gutenberg/pull/75470)
|
|
33
|
+
|
|
34
|
+
### Internal
|
|
35
|
+
|
|
36
|
+
- DataForm: Use public `ColorPicker` component instead of internal `Picker` in color control. [#75394](https://github.com/WordPress/gutenberg/pull/75394)
|
|
37
|
+
- Update Testing Library packages used in unit tests. [#75340](https://github.com/WordPress/gutenberg/pull/75340)
|
|
38
|
+
- Always specify initial values for `useRef` calls. [#75513](https://github.com/WordPress/gutenberg/pull/75513)
|
|
39
|
+
- Clean up type declarations using the `React` namespace. [#75508](https://github.com/WordPress/gutenberg/pull/75508)
|
|
40
|
+
- Update `RefObject` type usage for React 19 compatibility. [#75567](https://github.com/WordPress/gutenberg/pull/75567)
|
|
41
|
+
- Upgraded `@ariakit/react` (v0.4.21). [#75620](https://github.com/WordPress/gutenberg/pull/75620)
|
|
42
|
+
|
|
43
|
+
## 11.3.0 (2026-01-29)
|
|
44
|
+
|
|
45
|
+
### Enhancements
|
|
46
|
+
|
|
47
|
+
- DataViews: Add card form layout validation. [#74547](https://github.com/WordPress/gutenberg/pull/74547)
|
|
48
|
+
- DataViews: Show validation errors when a panel closes. [#74995](https://github.com/WordPress/gutenberg/pull/74995)
|
|
6
49
|
|
|
7
50
|
### Bug Fixes
|
|
8
51
|
|
|
52
|
+
- DataForm: Sync React-level validation to native inputs on date fields. [#74994](https://github.com/WordPress/gutenberg/pull/74994)
|
|
9
53
|
- Fix primary action visibility in table layout when the action doesn't support bulk operations, and fix compact action menu not visible on mobile when there is only one action. [#74836](https://github.com/WordPress/gutenberg/pull/74836)
|
|
10
54
|
- DataViews: Use regular casing for bulk selection count. [#74573](https://github.com/WordPress/gutenberg/pull/74573)
|
|
11
55
|
|
|
@@ -16,6 +60,7 @@
|
|
|
16
60
|
|
|
17
61
|
### Enhancements
|
|
18
62
|
|
|
63
|
+
- Add new `combobox` DataForm control. [#74891](https://github.com/WordPress/gutenberg/pull/74891)
|
|
19
64
|
- Include total items count in footer. [#73491](https://github.com/WordPress/gutenberg/pull/73491)
|
|
20
65
|
|
|
21
66
|
## 11.2.0 (2026-01-16)
|
package/README.md
CHANGED
|
@@ -14,6 +14,19 @@ Install the module
|
|
|
14
14
|
npm install @wordpress/dataviews --save
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
## Stylesheet Dependencies
|
|
18
|
+
|
|
19
|
+
DataViews depends on stylesheets from `@wordpress/components` and `@wordpress/theme`. In a WordPress admin page context, these are loaded automatically. For applications outside WordPress, you will need to include these stylesheets:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @wordpress/components @wordpress/theme
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import '@wordpress/components/build-style/style.css';
|
|
27
|
+
import '@wordpress/theme/design-tokens.css';
|
|
28
|
+
```
|
|
29
|
+
|
|
17
30
|
## `DataViews`
|
|
18
31
|
|
|
19
32
|
<div class="callout callout-info">At <a href="https://wordpress.github.io/gutenberg/">WordPress Gutenberg's Storybook</a> there's an <a href="https://wordpress.github.io/gutenberg/?path=/docs/dataviews-dataviews--docs">example implementation of the Dataviews component</a>.</div>
|
|
@@ -465,6 +478,33 @@ Optional. Pass an object with a list of `perPageSizes` to control the available
|
|
|
465
478
|
|
|
466
479
|
An element to display when the `data` prop is empty. Defaults to `<p>No results</p>`.
|
|
467
480
|
|
|
481
|
+
#### `onReset`: `( () => void ) | false`
|
|
482
|
+
|
|
483
|
+
Callback function to reset the view to its default state, or `false` to indicate the view is not modified.
|
|
484
|
+
|
|
485
|
+
- Type: `function` or `false`
|
|
486
|
+
- Optional
|
|
487
|
+
|
|
488
|
+
This prop controls the "Reset view" button in the view configuration dropdown:
|
|
489
|
+
|
|
490
|
+
- When `undefined` (not provided): No reset functionality is shown. Use this when view persistence is not supported.
|
|
491
|
+
- When `false`: The "Reset view" button is shown but disabled. Use this when view persistence is supported but the current view matches the default (not modified).
|
|
492
|
+
- When a function: The "Reset view" button is shown and enabled. A blue dot indicator appears on the view options button to signal that the view has been modified. The function is called when the user clicks the reset button.
|
|
493
|
+
|
|
494
|
+
Example:
|
|
495
|
+
|
|
496
|
+
```jsx
|
|
497
|
+
const { view, setView, isModified, resetToDefault } = useView( 'my-view-key' );
|
|
498
|
+
|
|
499
|
+
<DataViews
|
|
500
|
+
data={ data }
|
|
501
|
+
view={ view }
|
|
502
|
+
onChangeView={ setView }
|
|
503
|
+
onReset={ isModified ? resetToDefault : false }
|
|
504
|
+
// ...other props
|
|
505
|
+
/>
|
|
506
|
+
```
|
|
507
|
+
|
|
468
508
|
### Styling
|
|
469
509
|
|
|
470
510
|
These are the CSS Custom Properties that can be used to tweak the appearance of the component:
|
|
@@ -1202,7 +1242,7 @@ Example:
|
|
|
1202
1242
|
id: 'title',
|
|
1203
1243
|
type: 'text',
|
|
1204
1244
|
header: (
|
|
1205
|
-
<Stack direction="row" gap="
|
|
1245
|
+
<Stack direction="row" gap="xs" justify="start">
|
|
1206
1246
|
<Icon icon={ icon } />
|
|
1207
1247
|
<span>Title</span>
|
|
1208
1248
|
</Stack>
|
|
@@ -2017,7 +2057,9 @@ For example:
|
|
|
2017
2057
|
#### Panel
|
|
2018
2058
|
|
|
2019
2059
|
- `type`: `panel`. Required.
|
|
2020
|
-
- `labelPosition`: one of `side`, `top`, or `none`. Optional. `
|
|
2060
|
+
- `labelPosition`: one of `side`, `top`, or `none`. Optional. `side` by default.
|
|
2061
|
+
- `editVisibility`: one of `always`, or `on-hover`. Optional. `on-hover` by default.
|
|
2062
|
+
- `openAs`: one of `dropdown`, `modal`. Optional. `dropdown` by default.
|
|
2021
2063
|
- `summary`: Summary field configuration. Optional. Specifies which field(s) to display in the panel header. Can be:
|
|
2022
2064
|
- A string (single field ID)
|
|
2023
2065
|
- An array of strings (multiple field IDs)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/dataviews/src/components/dataform-controls/adaptive-select.tsx
|
|
31
|
+
var adaptive_select_exports = {};
|
|
32
|
+
__export(adaptive_select_exports, {
|
|
33
|
+
default: () => AdaptiveSelect
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(adaptive_select_exports);
|
|
36
|
+
var import_use_elements = __toESM(require("../../hooks/use-elements.cjs"));
|
|
37
|
+
var import_combobox = __toESM(require("./combobox.cjs"));
|
|
38
|
+
var import_select = __toESM(require("./select.cjs"));
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var ELEMENTS_THRESHOLD = 10;
|
|
41
|
+
function AdaptiveSelect(props) {
|
|
42
|
+
const { field } = props;
|
|
43
|
+
const { elements } = (0, import_use_elements.default)({
|
|
44
|
+
elements: field.elements,
|
|
45
|
+
getElements: field.getElements
|
|
46
|
+
});
|
|
47
|
+
if (elements.length >= ELEMENTS_THRESHOLD) {
|
|
48
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_combobox.default, { ...props });
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_select.default, { ...props });
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=adaptive-select.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/dataform-controls/adaptive-select.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { DataFormControlProps } from '../../types';\nimport useElements from '../../hooks/use-elements';\nimport Combobox from './combobox';\nimport Select from './select';\n\nconst ELEMENTS_THRESHOLD = 10;\n\nexport default function AdaptiveSelect< Item >(\n\tprops: DataFormControlProps< Item >\n) {\n\tconst { field } = props;\n\tconst { elements } = useElements( {\n\t\telements: field.elements,\n\t\tgetElements: field.getElements,\n\t} );\n\tif ( elements.length >= ELEMENTS_THRESHOLD ) {\n\t\treturn <Combobox { ...props } />;\n\t}\n\treturn <Select { ...props } />;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,0BAAwB;AACxB,sBAAqB;AACrB,oBAAmB;AAaV;AAXT,IAAM,qBAAqB;AAEZ,SAAR,eACN,OACC;AACD,QAAM,EAAE,MAAM,IAAI;AAClB,QAAM,EAAE,SAAS,QAAI,oBAAAA,SAAa;AAAA,IACjC,UAAU,MAAM;AAAA,IAChB,aAAa,MAAM;AAAA,EACpB,CAAE;AACF,MAAK,SAAS,UAAU,oBAAqB;AAC5C,WAAO,4CAAC,gBAAAC,SAAA,EAAW,GAAG,OAAQ;AAAA,EAC/B;AACA,SAAO,4CAAC,cAAAC,SAAA,EAAS,GAAG,OAAQ;AAC7B;",
|
|
6
|
+
"names": ["useElements", "Combobox", "Select"]
|
|
7
|
+
}
|
|
@@ -45,6 +45,7 @@ function ArrayControl({
|
|
|
45
45
|
field,
|
|
46
46
|
onChange,
|
|
47
47
|
hideLabelFromVision,
|
|
48
|
+
markWhenOptional,
|
|
48
49
|
validity
|
|
49
50
|
}) {
|
|
50
51
|
const { label, placeholder, getValue, setValue, isValid } = field;
|
|
@@ -81,6 +82,7 @@ function ArrayControl({
|
|
|
81
82
|
ValidatedFormTokenField,
|
|
82
83
|
{
|
|
83
84
|
required: !!isValid?.required,
|
|
85
|
+
markWhenOptional,
|
|
84
86
|
customValidity: (0, import_get_custom_validity.default)(isValid, validity),
|
|
85
87
|
label: hideLabelFromVision ? void 0 : label,
|
|
86
88
|
value: arrayValueAsElements,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/array.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis, Spinner } from '@wordpress/components';\nimport { useCallback, useMemo } 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 { ValidatedFormTokenField } = unlock( privateApis );\n\nexport default function ArrayControl< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { label, placeholder, getValue, setValue, isValid } = field;\n\tconst value = getValue( { item: data } );\n\n\tconst { elements, isLoading } = useElements( {\n\t\telements: field.elements,\n\t\tgetElements: field.getElements,\n\t} );\n\n\t// Convert stored values to element objects for the token field\n\tconst arrayValueAsElements = useMemo(\n\t\t() =>\n\t\t\tArray.isArray( value )\n\t\t\t\t? value.map( ( token ) => {\n\t\t\t\t\t\tconst element = elements?.find(\n\t\t\t\t\t\t\t( suggestion ) => suggestion.value === token\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn element || { value: token, label: token };\n\t\t\t\t } )\n\t\t\t\t: [],\n\t\t[ value, elements ]\n\t);\n\n\tconst onChangeControl = useCallback(\n\t\t( tokens: ( string | { value: string; label?: string } )[] ) => {\n\t\t\tconst valueTokens = tokens.map( ( token ) => {\n\t\t\t\tif ( typeof token === 'object' && 'value' in token ) {\n\t\t\t\t\treturn token.value;\n\t\t\t\t}\n\t\t\t\t// If it's a string, it's either a new suggestion value or user input\n\t\t\t\treturn token;\n\t\t\t} );\n\n\t\t\tonChange( setValue( { item: data, value: valueTokens } ) );\n\t\t},\n\t\t[ onChange, setValue, data ]\n\t);\n\n\tif ( isLoading ) {\n\t\treturn <Spinner />;\n\t}\n\n\treturn (\n\t\t<ValidatedFormTokenField\n\t\t\trequired={ !! isValid?.required }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\tlabel={ hideLabelFromVision ? undefined : label }\n\t\t\tvalue={ arrayValueAsElements }\n\t\t\tonChange={ onChangeControl }\n\t\t\tplaceholder={ placeholder }\n\t\t\tsuggestions={ elements?.map( ( element ) => element.value ) }\n\t\t\t__experimentalValidateInput={ ( token: string ) => {\n\t\t\t\t// If elements validation is required, check if token is valid\n\t\t\t\tif ( field.isValid?.elements && elements ) {\n\t\t\t\t\treturn elements.some(\n\t\t\t\t\t\t( element ) =>\n\t\t\t\t\t\t\telement.value === token || element.label === token\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// For non-elements validation, allow all tokens\n\t\t\t\treturn true;\n\t\t\t} }\n\t\t\t__experimentalExpandOnFocus={ elements && elements.length > 0 }\n\t\t\t__experimentalShowHowTo={ ! field.isValid?.elements }\n\t\t\tdisplayTransform={ ( token: any ) => {\n\t\t\t\t// For existing tokens (element objects), display their label\n\t\t\t\tif ( typeof token === 'object' && 'label' in token ) {\n\t\t\t\t\treturn token.label;\n\t\t\t\t}\n\t\t\t\t// For suggestions (value strings), find the corresponding element and show its label\n\t\t\t\tif ( typeof token === 'string' && elements ) {\n\t\t\t\t\tconst element = elements.find(\n\t\t\t\t\t\t( el ) => el.value === token\n\t\t\t\t\t);\n\t\t\t\t\treturn element?.label || token;\n\t\t\t\t}\n\t\t\t\treturn token;\n\t\t\t} }\n\t\t\t__experimentalRenderItem={ ( { item }: { item: any } ) => {\n\t\t\t\t// Custom rendering for suggestion items (item is a value string)\n\t\t\t\tif ( typeof item === 'string' && elements ) {\n\t\t\t\t\tconst element = elements.find(\n\t\t\t\t\t\t( el ) => el.value === item\n\t\t\t\t\t);\n\t\t\t\t\treturn <span>{ element?.label || item }</span>;\n\t\t\t\t}\n\t\t\t\treturn <span>{ item }</span>;\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqC;AACrC,qBAAqC;AAMrC,yBAAuB;AACvB,iCAA8B;AAC9B,0BAAwB;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { privateApis, Spinner } from '@wordpress/components';\nimport { useCallback, useMemo } 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 { ValidatedFormTokenField } = unlock( privateApis );\n\nexport default function ArrayControl< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { label, placeholder, getValue, setValue, isValid } = field;\n\tconst value = getValue( { item: data } );\n\n\tconst { elements, isLoading } = useElements( {\n\t\telements: field.elements,\n\t\tgetElements: field.getElements,\n\t} );\n\n\t// Convert stored values to element objects for the token field\n\tconst arrayValueAsElements = useMemo(\n\t\t() =>\n\t\t\tArray.isArray( value )\n\t\t\t\t? value.map( ( token ) => {\n\t\t\t\t\t\tconst element = elements?.find(\n\t\t\t\t\t\t\t( suggestion ) => suggestion.value === token\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn element || { value: token, label: token };\n\t\t\t\t } )\n\t\t\t\t: [],\n\t\t[ value, elements ]\n\t);\n\n\tconst onChangeControl = useCallback(\n\t\t( tokens: ( string | { value: string; label?: string } )[] ) => {\n\t\t\tconst valueTokens = tokens.map( ( token ) => {\n\t\t\t\tif ( typeof token === 'object' && 'value' in token ) {\n\t\t\t\t\treturn token.value;\n\t\t\t\t}\n\t\t\t\t// If it's a string, it's either a new suggestion value or user input\n\t\t\t\treturn token;\n\t\t\t} );\n\n\t\t\tonChange( setValue( { item: data, value: valueTokens } ) );\n\t\t},\n\t\t[ onChange, setValue, data ]\n\t);\n\n\tif ( isLoading ) {\n\t\treturn <Spinner />;\n\t}\n\n\treturn (\n\t\t<ValidatedFormTokenField\n\t\t\trequired={ !! isValid?.required }\n\t\t\tmarkWhenOptional={ markWhenOptional }\n\t\t\tcustomValidity={ getCustomValidity( isValid, validity ) }\n\t\t\tlabel={ hideLabelFromVision ? undefined : label }\n\t\t\tvalue={ arrayValueAsElements }\n\t\t\tonChange={ onChangeControl }\n\t\t\tplaceholder={ placeholder }\n\t\t\tsuggestions={ elements?.map( ( element ) => element.value ) }\n\t\t\t__experimentalValidateInput={ ( token: string ) => {\n\t\t\t\t// If elements validation is required, check if token is valid\n\t\t\t\tif ( field.isValid?.elements && elements ) {\n\t\t\t\t\treturn elements.some(\n\t\t\t\t\t\t( element ) =>\n\t\t\t\t\t\t\telement.value === token || element.label === token\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// For non-elements validation, allow all tokens\n\t\t\t\treturn true;\n\t\t\t} }\n\t\t\t__experimentalExpandOnFocus={ elements && elements.length > 0 }\n\t\t\t__experimentalShowHowTo={ ! field.isValid?.elements }\n\t\t\tdisplayTransform={ ( token: any ) => {\n\t\t\t\t// For existing tokens (element objects), display their label\n\t\t\t\tif ( typeof token === 'object' && 'label' in token ) {\n\t\t\t\t\treturn token.label;\n\t\t\t\t}\n\t\t\t\t// For suggestions (value strings), find the corresponding element and show its label\n\t\t\t\tif ( typeof token === 'string' && elements ) {\n\t\t\t\t\tconst element = elements.find(\n\t\t\t\t\t\t( el ) => el.value === token\n\t\t\t\t\t);\n\t\t\t\t\treturn element?.label || token;\n\t\t\t\t}\n\t\t\t\treturn token;\n\t\t\t} }\n\t\t\t__experimentalRenderItem={ ( { item }: { item: any } ) => {\n\t\t\t\t// Custom rendering for suggestion items (item is a value string)\n\t\t\t\tif ( typeof item === 'string' && elements ) {\n\t\t\t\t\tconst element = elements.find(\n\t\t\t\t\t\t( el ) => el.value === item\n\t\t\t\t\t);\n\t\t\t\t\treturn <span>{ element?.label || item }</span>;\n\t\t\t\t}\n\t\t\t\treturn <span>{ item }</span>;\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqC;AACrC,qBAAqC;AAMrC,yBAAuB;AACvB,iCAA8B;AAC9B,0BAAwB;AAkDf;AAhDT,IAAM,EAAE,wBAAwB,QAAI,2BAAQ,6BAAY;AAEzC,SAAR,aAAuC;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,OAAO,aAAa,UAAU,UAAU,QAAQ,IAAI;AAC5D,QAAM,QAAQ,SAAU,EAAE,MAAM,KAAK,CAAE;AAEvC,QAAM,EAAE,UAAU,UAAU,QAAI,oBAAAA,SAAa;AAAA,IAC5C,UAAU,MAAM;AAAA,IAChB,aAAa,MAAM;AAAA,EACpB,CAAE;AAGF,QAAM,2BAAuB;AAAA,IAC5B,MACC,MAAM,QAAS,KAAM,IAClB,MAAM,IAAK,CAAE,UAAW;AACxB,YAAM,UAAU,UAAU;AAAA,QACzB,CAAE,eAAgB,WAAW,UAAU;AAAA,MACxC;AACA,aAAO,WAAW,EAAE,OAAO,OAAO,OAAO,MAAM;AAAA,IAC/C,CAAE,IACF,CAAC;AAAA,IACL,CAAE,OAAO,QAAS;AAAA,EACnB;AAEA,QAAM,sBAAkB;AAAA,IACvB,CAAE,WAA8D;AAC/D,YAAM,cAAc,OAAO,IAAK,CAAE,UAAW;AAC5C,YAAK,OAAO,UAAU,YAAY,WAAW,OAAQ;AACpD,iBAAO,MAAM;AAAA,QACd;AAEA,eAAO;AAAA,MACR,CAAE;AAEF,eAAU,SAAU,EAAE,MAAM,MAAM,OAAO,YAAY,CAAE,CAAE;AAAA,IAC1D;AAAA,IACA,CAAE,UAAU,UAAU,IAAK;AAAA,EAC5B;AAEA,MAAK,WAAY;AAChB,WAAO,4CAAC,6BAAQ;AAAA,EACjB;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAC,CAAE,SAAS;AAAA,MACvB;AAAA,MACA,oBAAiB,2BAAAC,SAAmB,SAAS,QAAS;AAAA,MACtD,OAAQ,sBAAsB,SAAY;AAAA,MAC1C,OAAQ;AAAA,MACR,UAAW;AAAA,MACX;AAAA,MACA,aAAc,UAAU,IAAK,CAAE,YAAa,QAAQ,KAAM;AAAA,MAC1D,6BAA8B,CAAE,UAAmB;AAElD,YAAK,MAAM,SAAS,YAAY,UAAW;AAC1C,iBAAO,SAAS;AAAA,YACf,CAAE,YACD,QAAQ,UAAU,SAAS,QAAQ,UAAU;AAAA,UAC/C;AAAA,QACD;AAGA,eAAO;AAAA,MACR;AAAA,MACA,6BAA8B,YAAY,SAAS,SAAS;AAAA,MAC5D,yBAA0B,CAAE,MAAM,SAAS;AAAA,MAC3C,kBAAmB,CAAE,UAAgB;AAEpC,YAAK,OAAO,UAAU,YAAY,WAAW,OAAQ;AACpD,iBAAO,MAAM;AAAA,QACd;AAEA,YAAK,OAAO,UAAU,YAAY,UAAW;AAC5C,gBAAM,UAAU,SAAS;AAAA,YACxB,CAAE,OAAQ,GAAG,UAAU;AAAA,UACxB;AACA,iBAAO,SAAS,SAAS;AAAA,QAC1B;AACA,eAAO;AAAA,MACR;AAAA,MACA,0BAA2B,CAAE,EAAE,KAAK,MAAsB;AAEzD,YAAK,OAAO,SAAS,YAAY,UAAW;AAC3C,gBAAM,UAAU,SAAS;AAAA,YACxB,CAAE,OAAQ,GAAG,UAAU;AAAA,UACxB;AACA,iBAAO,4CAAC,UAAO,mBAAS,SAAS,MAAM;AAAA,QACxC;AACA,eAAO,4CAAC,UAAO,gBAAM;AAAA,MACtB;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["useElements", "getCustomValidity"]
|
|
7
7
|
}
|
|
@@ -44,6 +44,7 @@ function Checkbox({
|
|
|
44
44
|
onChange,
|
|
45
45
|
data,
|
|
46
46
|
hideLabelFromVision,
|
|
47
|
+
markWhenOptional,
|
|
47
48
|
validity
|
|
48
49
|
}) {
|
|
49
50
|
const { getValue, setValue, label, description, isValid } = field;
|
|
@@ -56,6 +57,7 @@ function Checkbox({
|
|
|
56
57
|
ValidatedCheckboxControl,
|
|
57
58
|
{
|
|
58
59
|
required: !!field.isValid?.required,
|
|
60
|
+
markWhenOptional,
|
|
59
61
|
customValidity: (0, import_get_custom_validity.default)(isValid, validity),
|
|
60
62
|
hidden: hideLabelFromVision,
|
|
61
63
|
label,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/checkbox.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 { ValidatedCheckboxControl } = unlock( privateApis );\n\nexport default function Checkbox< Item >( {\n\tfield,\n\tonChange,\n\tdata,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { getValue, setValue, label, description, 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}, [ data, getValue, onChange, setValue ] );\n\n\treturn (\n\t\t<ValidatedCheckboxControl\n\t\t\trequired={ !! field.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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA4B;AAC5B,qBAA4B;AAM5B,yBAAuB;AACvB,iCAA8B;
|
|
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 { ValidatedCheckboxControl } = unlock( privateApis );\n\nexport default function Checkbox< Item >( {\n\tfield,\n\tonChange,\n\tdata,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { getValue, setValue, label, description, 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}, [ data, getValue, onChange, setValue ] );\n\n\treturn (\n\t\t<ValidatedCheckboxControl\n\t\t\trequired={ !! field.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": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA4B;AAC5B,qBAA4B;AAM5B,yBAAuB;AACvB,iCAA8B;AAqB5B;AAnBF,IAAM,EAAE,yBAAyB,QAAI,2BAAQ,6BAAY;AAE1C,SAAR,SAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,UAAU,UAAU,OAAO,aAAa,QAAQ,IAAI;AAE5D,QAAM,sBAAkB,4BAAa,MAAM;AAC1C;AAAA,MACC,SAAU,EAAE,MAAM,MAAM,OAAO,CAAE,SAAU,EAAE,MAAM,KAAK,CAAE,EAAE,CAAE;AAAA,IAC/D;AAAA,EACD,GAAG,CAAE,MAAM,UAAU,UAAU,QAAS,CAAE;AAE1C,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAC,CAAE,MAAM,SAAS;AAAA,MAC7B;AAAA,MACA,oBAAiB,2BAAAA,SAAmB,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": ["getCustomValidity"]
|
|
7
7
|
}
|
|
@@ -36,11 +36,12 @@ module.exports = __toCommonJS(color_exports);
|
|
|
36
36
|
var import_colord = require("colord");
|
|
37
37
|
var import_components = require("@wordpress/components");
|
|
38
38
|
var import_element = require("@wordpress/element");
|
|
39
|
+
var import_i18n = require("@wordpress/i18n");
|
|
39
40
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
40
41
|
var import_get_custom_validity = __toESM(require("./utils/get-custom-validity.cjs"));
|
|
41
42
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
-
var { ValidatedInputControl
|
|
43
|
-
var
|
|
43
|
+
var { ValidatedInputControl } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
44
|
+
var ColorPickerDropdown = ({
|
|
44
45
|
color,
|
|
45
46
|
onColorChange
|
|
46
47
|
}) => {
|
|
@@ -48,33 +49,21 @@ var ColorPicker = ({
|
|
|
48
49
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
49
50
|
import_components.Dropdown,
|
|
50
51
|
{
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
className: "dataviews-controls__color-picker-dropdown",
|
|
53
|
+
popoverProps: { resize: false },
|
|
54
|
+
renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
import_components.Button,
|
|
53
56
|
{
|
|
54
|
-
type: "button",
|
|
55
57
|
onClick: onToggle,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
borderRadius: "50%",
|
|
60
|
-
backgroundColor: validColor,
|
|
61
|
-
border: "1px solid #ddd",
|
|
62
|
-
cursor: "pointer",
|
|
63
|
-
outline: isOpen ? "2px solid #007cba" : "none",
|
|
64
|
-
outlineOffset: "2px",
|
|
65
|
-
display: "flex",
|
|
66
|
-
alignItems: "center",
|
|
67
|
-
justifyContent: "center",
|
|
68
|
-
padding: 0,
|
|
69
|
-
margin: 0
|
|
70
|
-
},
|
|
71
|
-
"aria-label": "Open color picker"
|
|
58
|
+
"aria-label": (0, import_i18n.__)("Open color picker"),
|
|
59
|
+
size: "small",
|
|
60
|
+
icon: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ColorIndicator, { colorValue: validColor })
|
|
72
61
|
}
|
|
73
|
-
)
|
|
74
|
-
renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
75
|
-
|
|
62
|
+
),
|
|
63
|
+
renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
import_components.ColorPicker,
|
|
76
65
|
{
|
|
77
|
-
color:
|
|
66
|
+
color: validColor,
|
|
78
67
|
onChange: onColorChange,
|
|
79
68
|
enableAlpha: true
|
|
80
69
|
}
|
|
@@ -87,13 +76,14 @@ function Color({
|
|
|
87
76
|
field,
|
|
88
77
|
onChange,
|
|
89
78
|
hideLabelFromVision,
|
|
79
|
+
markWhenOptional,
|
|
90
80
|
validity
|
|
91
81
|
}) {
|
|
92
82
|
const { label, placeholder, description, setValue, isValid } = field;
|
|
93
83
|
const value = field.getValue({ item: data }) || "";
|
|
94
84
|
const handleColorChange = (0, import_element.useCallback)(
|
|
95
|
-
(
|
|
96
|
-
onChange(setValue({ item: data, value:
|
|
85
|
+
(newColor) => {
|
|
86
|
+
onChange(setValue({ item: data, value: newColor }));
|
|
97
87
|
},
|
|
98
88
|
[data, onChange, setValue]
|
|
99
89
|
);
|
|
@@ -107,6 +97,7 @@ function Color({
|
|
|
107
97
|
ValidatedInputControl,
|
|
108
98
|
{
|
|
109
99
|
required: !!field.isValid?.required,
|
|
100
|
+
markWhenOptional,
|
|
110
101
|
customValidity: (0, import_get_custom_validity.default)(isValid, validity),
|
|
111
102
|
label,
|
|
112
103
|
placeholder,
|
|
@@ -115,13 +106,13 @@ function Color({
|
|
|
115
106
|
onChange: handleInputChange,
|
|
116
107
|
hideLabelFromVision,
|
|
117
108
|
type: "text",
|
|
118
|
-
prefix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
119
|
-
|
|
109
|
+
prefix: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.__experimentalInputControlPrefixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
110
|
+
ColorPickerDropdown,
|
|
120
111
|
{
|
|
121
112
|
color: value,
|
|
122
113
|
onColorChange: handleColorChange
|
|
123
114
|
}
|
|
124
|
-
)
|
|
115
|
+
) })
|
|
125
116
|
}
|
|
126
117
|
);
|
|
127
118
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/dataform-controls/color.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tDropdown,\n\tprivateApis,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\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';\n\nconst { ValidatedInputControl
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAuB;AAKvB,
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tColorIndicator,\n\tColorPicker,\n\tDropdown,\n\tprivateApis,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\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 { ValidatedInputControl } = unlock( privateApis );\n\nconst ColorPickerDropdown = ( {\n\tcolor,\n\tonColorChange,\n}: {\n\tcolor: string;\n\tonColorChange: ( newColor: string ) => void;\n} ) => {\n\tconst validColor = color && colord( color ).isValid() ? color : '#ffffff';\n\n\treturn (\n\t\t<Dropdown\n\t\t\tclassName=\"dataviews-controls__color-picker-dropdown\"\n\t\t\tpopoverProps={ { resize: false } }\n\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\taria-label={ __( 'Open color picker' ) }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ () => <ColorIndicator colorValue={ validColor } /> }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\trenderContent={ () => (\n\t\t\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t\t\t<ColorPicker\n\t\t\t\t\t\tcolor={ validColor }\n\t\t\t\t\t\tonChange={ onColorChange }\n\t\t\t\t\t\tenableAlpha\n\t\t\t\t\t/>\n\t\t\t\t</DropdownContentWrapper>\n\t\t\t) }\n\t\t/>\n\t);\n};\n\nexport default function Color< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tmarkWhenOptional,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { label, placeholder, description, setValue, isValid } = field;\n\tconst value = field.getValue( { item: data } ) || '';\n\n\tconst handleColorChange = useCallback(\n\t\t( newColor: string ) => {\n\t\t\tonChange( setValue( { item: data, value: newColor } ) );\n\t\t},\n\t\t[ data, onChange, setValue ]\n\t);\n\n\tconst handleInputChange = useCallback(\n\t\t( newValue: string | undefined ) => {\n\t\t\tonChange( setValue( { item: data, value: newValue || '' } ) );\n\t\t},\n\t\t[ data, onChange, setValue ]\n\t);\n\n\treturn (\n\t\t<ValidatedInputControl\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\tplaceholder={ placeholder }\n\t\t\tvalue={ value }\n\t\t\thelp={ description }\n\t\t\tonChange={ handleInputChange }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\ttype=\"text\"\n\t\t\tprefix={\n\t\t\t\t<InputControlPrefixWrapper variant=\"control\">\n\t\t\t\t\t<ColorPickerDropdown\n\t\t\t\t\t\tcolor={ value }\n\t\t\t\t\t\tonColorChange={ handleColorChange }\n\t\t\t\t\t/>\n\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t}\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAuB;AAKvB,wBAQO;AACP,qBAA4B;AAC5B,kBAAmB;AAMnB,yBAAuB;AACvB,iCAA8B;AAsBZ;AApBlB,IAAM,EAAE,sBAAsB,QAAI,2BAAQ,6BAAY;AAEtD,IAAM,sBAAsB,CAAE;AAAA,EAC7B;AAAA,EACA;AACD,MAGO;AACN,QAAM,aAAa,aAAS,sBAAQ,KAAM,EAAE,QAAQ,IAAI,QAAQ;AAEhE,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,cAAe,EAAE,QAAQ,MAAM;AAAA,MAC/B,cAAe,CAAE,EAAE,SAAS,MAC3B;AAAA,QAAC;AAAA;AAAA,UACA,SAAU;AAAA,UACV,kBAAa,gBAAI,mBAAoB;AAAA,UACrC,MAAK;AAAA,UACL,MAAO,MAAM,4CAAC,oCAAe,YAAa,YAAa;AAAA;AAAA,MACxD;AAAA,MAED,eAAgB,MACf,4CAAC,kBAAAA,sCAAA,EAAuB,aAAY,QACnC;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ;AAAA,UACR,UAAW;AAAA,UACX,aAAW;AAAA;AAAA,MACZ,GACD;AAAA;AAAA,EAEF;AAEF;AAEe,SAAR,MAAgC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,OAAO,aAAa,aAAa,UAAU,QAAQ,IAAI;AAC/D,QAAM,QAAQ,MAAM,SAAU,EAAE,MAAM,KAAK,CAAE,KAAK;AAElD,QAAM,wBAAoB;AAAA,IACzB,CAAE,aAAsB;AACvB,eAAU,SAAU,EAAE,MAAM,MAAM,OAAO,SAAS,CAAE,CAAE;AAAA,IACvD;AAAA,IACA,CAAE,MAAM,UAAU,QAAS;AAAA,EAC5B;AAEA,QAAM,wBAAoB;AAAA,IACzB,CAAE,aAAkC;AACnC,eAAU,SAAU,EAAE,MAAM,MAAM,OAAO,YAAY,GAAG,CAAE,CAAE;AAAA,IAC7D;AAAA,IACA,CAAE,MAAM,UAAU,QAAS;AAAA,EAC5B;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAC,CAAE,MAAM,SAAS;AAAA,MAC7B;AAAA,MACA,oBAAiB,2BAAAC,SAAmB,SAAS,QAAS;AAAA,MACtD;AAAA,MACA;AAAA,MACA;AAAA,MACA,MAAO;AAAA,MACP,UAAW;AAAA,MACX;AAAA,MACA,MAAK;AAAA,MACL,QACC,4CAAC,kBAAAC,yCAAA,EAA0B,SAAQ,WAClC;AAAA,QAAC;AAAA;AAAA,UACA,OAAQ;AAAA,UACR,eAAgB;AAAA;AAAA,MACjB,GACD;AAAA;AAAA,EAEF;AAEF;",
|
|
6
|
+
"names": ["DropdownContentWrapper", "getCustomValidity", "InputControlPrefixWrapper"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/dataviews/src/components/dataform-controls/combobox.tsx
|
|
31
|
+
var combobox_exports = {};
|
|
32
|
+
__export(combobox_exports, {
|
|
33
|
+
default: () => Combobox
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(combobox_exports);
|
|
36
|
+
var import_components = require("@wordpress/components");
|
|
37
|
+
var import_element = require("@wordpress/element");
|
|
38
|
+
var import_use_elements = __toESM(require("../../hooks/use-elements.cjs"));
|
|
39
|
+
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
40
|
+
var import_get_custom_validity = __toESM(require("./utils/get-custom-validity.cjs"));
|
|
41
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var { ValidatedComboboxControl } = (0, import_lock_unlock.unlock)(import_components.privateApis);
|
|
43
|
+
function Combobox({
|
|
44
|
+
data,
|
|
45
|
+
field,
|
|
46
|
+
onChange,
|
|
47
|
+
hideLabelFromVision,
|
|
48
|
+
validity
|
|
49
|
+
}) {
|
|
50
|
+
const { label, description, placeholder, getValue, setValue, isValid } = field;
|
|
51
|
+
const value = getValue({ item: data }) ?? "";
|
|
52
|
+
const onChangeControl = (0, import_element.useCallback)(
|
|
53
|
+
(newValue) => onChange(setValue({ item: data, value: newValue ?? "" })),
|
|
54
|
+
[data, onChange, setValue]
|
|
55
|
+
);
|
|
56
|
+
const { elements, isLoading } = (0, import_use_elements.default)({
|
|
57
|
+
elements: field.elements,
|
|
58
|
+
getElements: field.getElements
|
|
59
|
+
});
|
|
60
|
+
if (isLoading) {
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {});
|
|
62
|
+
}
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
ValidatedComboboxControl,
|
|
65
|
+
{
|
|
66
|
+
required: !!field.isValid?.required,
|
|
67
|
+
customValidity: (0, import_get_custom_validity.default)(isValid, validity),
|
|
68
|
+
label,
|
|
69
|
+
value,
|
|
70
|
+
help: description,
|
|
71
|
+
placeholder,
|
|
72
|
+
options: elements,
|
|
73
|
+
onChange: onChangeControl,
|
|
74
|
+
hideLabelFromVision,
|
|
75
|
+
allowReset: true,
|
|
76
|
+
expandOnFocus: true
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=combobox.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/dataform-controls/combobox.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 { ValidatedComboboxControl } = unlock( privateApis );\n\nexport default function Combobox< Item >( {\n\tdata,\n\tfield,\n\tonChange,\n\thideLabelFromVision,\n\tvalidity,\n}: DataFormControlProps< Item > ) {\n\tconst { label, description, placeholder, getValue, setValue, isValid } =\n\t\tfield;\n\tconst value = getValue( { item: data } ) ?? '';\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string | null ) =>\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<ValidatedComboboxControl\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\tplaceholder={ placeholder }\n\t\t\toptions={ elements }\n\t\t\tonChange={ onChangeControl }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tallowReset\n\t\t\texpandOnFocus\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqC;AACrC,qBAA4B;AAM5B,0BAAwB;AACxB,yBAAuB;AACvB,iCAA8B;AA2BrB;AAzBT,IAAM,EAAE,yBAAyB,QAAI,2BAAQ,6BAAY;AAE1C,SAAR,SAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,EAAE,OAAO,aAAa,aAAa,UAAU,UAAU,QAAQ,IACpE;AACD,QAAM,QAAQ,SAAU,EAAE,MAAM,KAAK,CAAE,KAAK;AAE5C,QAAM,sBAAkB;AAAA,IACvB,CAAE,aACD,SAAU,SAAU,EAAE,MAAM,MAAM,OAAO,YAAY,GAAG,CAAE,CAAE;AAAA,IAC7D,CAAE,MAAM,UAAU,QAAS;AAAA,EAC5B;AAEA,QAAM,EAAE,UAAU,UAAU,QAAI,oBAAAA,SAAa;AAAA,IAC5C,UAAU,MAAM;AAAA,IAChB,aAAa,MAAM;AAAA,EACpB,CAAE;AAEF,MAAK,WAAY;AAChB,WAAO,4CAAC,6BAAQ;AAAA,EACjB;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAW,CAAC,CAAE,MAAM,SAAS;AAAA,MAC7B,oBAAiB,2BAAAC,SAAmB,SAAS,QAAS;AAAA,MACtD;AAAA,MACA;AAAA,MACA,MAAO;AAAA,MACP;AAAA,MACA,SAAU;AAAA,MACV,UAAW;AAAA,MACX;AAAA,MACA,YAAU;AAAA,MACV,eAAa;AAAA;AAAA,EACd;AAEF;",
|
|
6
|
+
"names": ["useElements", "getCustomValidity"]
|
|
7
|
+
}
|