@wordpress/components 32.2.1-next.v.202602111440.0 → 32.2.1
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/CLAUDE.md +1 -0
- package/build/alignment-matrix-control/cell.cjs +2 -2
- package/build/alignment-matrix-control/cell.cjs.map +1 -1
- package/build/alignment-matrix-control/index.cjs +2 -2
- package/build/alignment-matrix-control/index.cjs.map +1 -1
- package/build/angle-picker-control/angle-circle.cjs +4 -4
- package/build/angle-picker-control/angle-circle.cjs.map +2 -2
- package/build/autocomplete/index.cjs +16 -8
- package/build/autocomplete/index.cjs.map +2 -2
- package/build/clipboard-button/index.cjs +1 -1
- package/build/clipboard-button/index.cjs.map +2 -2
- package/build/color-picker/color-copy-button.cjs +1 -1
- package/build/color-picker/color-copy-button.cjs.map +2 -2
- package/build/confirm-dialog/component.cjs +2 -2
- package/build/confirm-dialog/component.cjs.map +2 -2
- package/build/context/context-system-provider.cjs.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.cjs +2 -2
- package/build/custom-gradient-picker/gradient-bar/control-points.cjs.map +2 -2
- package/build/date-time/date/index.cjs +1 -1
- package/build/date-time/date/index.cjs.map +2 -2
- package/build/date-time/time/index.cjs +1 -1
- package/build/date-time/time/index.cjs.map +2 -2
- package/build/date-time/utils.cjs +9 -0
- package/build/date-time/utils.cjs.map +2 -2
- package/build/dropdown/index.cjs +1 -1
- package/build/dropdown/index.cjs.map +2 -2
- package/build/external-link/index.cjs +5 -1
- package/build/external-link/index.cjs.map +2 -2
- package/build/higher-order/with-spoken-messages/index.cjs.map +2 -2
- package/build/modal/index.cjs +2 -2
- package/build/modal/index.cjs.map +2 -2
- package/build/modal/use-modal-exit-animation.cjs +2 -2
- package/build/modal/use-modal-exit-animation.cjs.map +2 -2
- package/build/number-control/index.cjs +1 -1
- package/build/number-control/index.cjs.map +2 -2
- package/build/palette-edit/index.cjs +1 -1
- package/build/palette-edit/index.cjs.map +2 -2
- package/build/panel/body.cjs +1 -1
- package/build/panel/body.cjs.map +2 -2
- package/build/private-apis.cjs +0 -2
- package/build/private-apis.cjs.map +2 -2
- package/build/range-control/index.cjs +1 -1
- package/build/range-control/index.cjs.map +2 -2
- package/build/resizable-box/resize-tooltip/utils.cjs +1 -1
- package/build/resizable-box/resize-tooltip/utils.cjs.map +2 -2
- package/build/sandbox/index.cjs +126 -2
- package/build/sandbox/index.cjs.map +2 -2
- package/build/select-control/styles/select-control-styles.cjs +8 -8
- package/build/select-control/styles/select-control-styles.cjs.map +2 -2
- package/build/snackbar/list.cjs +4 -1
- package/build/snackbar/list.cjs.map +2 -2
- package/build/tabs/styles.cjs +5 -5
- package/build/tabs/styles.cjs.map +2 -2
- package/build/text/utils.cjs.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs +8 -8
- package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs.map +2 -2
- package/build/tree-grid/roving-tab-index-item.cjs +1 -1
- package/build/tree-grid/roving-tab-index-item.cjs.map +2 -2
- package/build/utils/element-rect.cjs +1 -1
- package/build/utils/element-rect.cjs.map +2 -2
- package/build/utils/hooks/use-update-effect.cjs.map +1 -1
- package/build/utils/rtl.cjs +2 -2
- package/build/utils/rtl.cjs.map +2 -2
- package/build/utils/use-responsive-value.cjs +1 -7
- package/build/utils/use-responsive-value.cjs.map +2 -2
- package/build/validated-form-controls/control-with-error.cjs +26 -3
- package/build/validated-form-controls/control-with-error.cjs.map +2 -2
- package/build/validated-form-controls/validity-indicator.cjs +2 -0
- package/build/validated-form-controls/validity-indicator.cjs.map +2 -2
- package/build-module/alignment-matrix-control/cell.mjs +2 -2
- package/build-module/alignment-matrix-control/cell.mjs.map +1 -1
- package/build-module/alignment-matrix-control/index.mjs +2 -2
- package/build-module/alignment-matrix-control/index.mjs.map +1 -1
- package/build-module/angle-picker-control/angle-circle.mjs +4 -4
- package/build-module/angle-picker-control/angle-circle.mjs.map +2 -2
- package/build-module/autocomplete/index.mjs +14 -7
- package/build-module/autocomplete/index.mjs.map +2 -2
- package/build-module/clipboard-button/index.mjs +1 -1
- package/build-module/clipboard-button/index.mjs.map +2 -2
- package/build-module/color-picker/color-copy-button.mjs +1 -1
- package/build-module/color-picker/color-copy-button.mjs.map +2 -2
- package/build-module/confirm-dialog/component.mjs +2 -2
- package/build-module/confirm-dialog/component.mjs.map +2 -2
- package/build-module/context/context-system-provider.mjs.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.mjs +2 -2
- package/build-module/custom-gradient-picker/gradient-bar/control-points.mjs.map +2 -2
- package/build-module/date-time/date/index.mjs +1 -1
- package/build-module/date-time/date/index.mjs.map +2 -2
- package/build-module/date-time/time/index.mjs +2 -2
- package/build-module/date-time/time/index.mjs.map +2 -2
- package/build-module/date-time/utils.mjs +8 -0
- package/build-module/date-time/utils.mjs.map +2 -2
- package/build-module/dropdown/index.mjs +1 -1
- package/build-module/dropdown/index.mjs.map +2 -2
- package/build-module/external-link/index.mjs +5 -1
- package/build-module/external-link/index.mjs.map +2 -2
- package/build-module/higher-order/with-spoken-messages/index.mjs.map +2 -2
- package/build-module/modal/index.mjs +2 -2
- package/build-module/modal/index.mjs.map +2 -2
- package/build-module/modal/use-modal-exit-animation.mjs +2 -2
- package/build-module/modal/use-modal-exit-animation.mjs.map +2 -2
- package/build-module/number-control/index.mjs +1 -1
- package/build-module/number-control/index.mjs.map +2 -2
- package/build-module/palette-edit/index.mjs +1 -1
- package/build-module/palette-edit/index.mjs.map +2 -2
- package/build-module/panel/body.mjs +1 -1
- package/build-module/panel/body.mjs.map +2 -2
- package/build-module/private-apis.mjs +0 -2
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/range-control/index.mjs +1 -1
- package/build-module/range-control/index.mjs.map +2 -2
- package/build-module/resizable-box/resize-tooltip/utils.mjs +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.mjs.map +2 -2
- package/build-module/sandbox/index.mjs +127 -3
- package/build-module/sandbox/index.mjs.map +2 -2
- package/build-module/select-control/styles/select-control-styles.mjs +8 -8
- package/build-module/select-control/styles/select-control-styles.mjs.map +2 -2
- package/build-module/snackbar/list.mjs +4 -1
- package/build-module/snackbar/list.mjs.map +2 -2
- package/build-module/tabs/styles.mjs +5 -5
- package/build-module/tabs/styles.mjs.map +2 -2
- package/build-module/text/utils.mjs.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs +8 -8
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs.map +2 -2
- package/build-module/tree-grid/roving-tab-index-item.mjs +1 -1
- package/build-module/tree-grid/roving-tab-index-item.mjs.map +2 -2
- package/build-module/utils/element-rect.mjs +1 -1
- package/build-module/utils/element-rect.mjs.map +2 -2
- package/build-module/utils/hooks/use-update-effect.mjs.map +1 -1
- package/build-module/utils/rtl.mjs +2 -2
- package/build-module/utils/rtl.mjs.map +2 -2
- package/build-module/utils/use-responsive-value.mjs +1 -7
- package/build-module/utils/use-responsive-value.mjs.map +2 -2
- package/build-module/validated-form-controls/control-with-error.mjs +27 -4
- package/build-module/validated-form-controls/control-with-error.mjs.map +2 -2
- package/build-module/validated-form-controls/validity-indicator.mjs +2 -0
- package/build-module/validated-form-controls/validity-indicator.mjs.map +2 -2
- package/build-style/style-rtl.css +8 -4
- package/build-style/style.css +8 -4
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts +19 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts +23 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -0
- package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
- package/build-types/angle-picker-control/index.d.ts +1 -1
- package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +25 -0
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -0
- package/build-types/animate/index.d.ts +1 -1
- package/build-types/animate/index.d.ts.map +1 -1
- package/build-types/animate/types.d.ts +1 -1
- package/build-types/animate/types.d.ts.map +1 -1
- package/build-types/autocomplete/get-autocomplete-match.d.ts +20 -0
- package/build-types/autocomplete/get-autocomplete-match.d.ts.map +1 -0
- package/build-types/autocomplete/index.d.ts +10 -2
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/autocomplete/test/get-autocomplete-match.d.ts +2 -0
- package/build-types/autocomplete/test/get-autocomplete-match.d.ts.map +1 -0
- package/build-types/autocomplete/types.d.ts +1 -1
- package/build-types/autocomplete/types.d.ts.map +1 -1
- package/build-types/badge/stories/e2e/index.story.d.ts +7 -0
- package/build-types/badge/stories/e2e/index.story.d.ts.map +1 -0
- package/build-types/base-control/index.d.ts +2 -2
- package/build-types/base-control/stories/index.story.d.ts +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +1 -1
- package/build-types/border-control/border-control/hook.d.ts +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -1
- package/build-types/border-control/border-control-style-picker/hook.d.ts +267 -0
- package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -0
- package/build-types/box-control/all-input-control.d.ts +4 -0
- package/build-types/box-control/all-input-control.d.ts.map +1 -0
- package/build-types/box-control/axial-input-controls.d.ts +4 -0
- package/build-types/box-control/axial-input-controls.d.ts.map +1 -0
- package/build-types/box-control/input-controls.d.ts +4 -0
- package/build-types/box-control/input-controls.d.ts.map +1 -0
- package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
- package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-visualizer-styles.d.ts +46 -0
- package/build-types/box-control/styles/box-control-visualizer-styles.d.ts.map +1 -0
- package/build-types/box-control/unit-control.d.ts +4 -0
- package/build-types/box-control/unit-control.d.ts.map +1 -0
- package/build-types/card/card/hook.d.ts +1 -1
- package/build-types/card/card-body/hook.d.ts +1 -1
- package/build-types/card/card-footer/hook.d.ts +1 -1
- package/build-types/card/card-header/hook.d.ts +1 -1
- package/build-types/card/card-media/hook.d.ts +1 -1
- package/build-types/color-palette/stories/index.story.d.ts +6 -5
- package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +1 -1
- package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/combobox-control/styles.d.ts +1 -1
- package/build-types/context/context-connect.d.ts +2 -2
- package/build-types/context/context-connect.d.ts.map +1 -1
- package/build-types/context/context-system-provider.d.ts +2 -2
- package/build-types/context/context-system-provider.d.ts.map +1 -1
- package/build-types/context/wordpress-component.d.ts +3 -3
- package/build-types/context/wordpress-component.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +2 -2
- package/build-types/custom-gradient-picker/test/index.d.ts +2 -0
- package/build-types/custom-gradient-picker/test/index.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/types.d.ts +1 -1
- package/build-types/custom-gradient-picker/types.d.ts.map +1 -1
- package/build-types/custom-select-control/styles.d.ts +11 -0
- package/build-types/custom-select-control/styles.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/types.d.ts +4 -4
- package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +2 -2
- package/build-types/date-time/date-picker/index.d.ts +23 -0
- package/build-types/date-time/date-picker/index.d.ts.map +1 -0
- package/build-types/date-time/date-picker/styles.d.ts +45 -0
- package/build-types/date-time/date-picker/styles.d.ts.map +1 -0
- package/build-types/date-time/date-picker/test/index.d.ts +2 -0
- package/build-types/date-time/date-picker/test/index.d.ts.map +1 -0
- package/build-types/date-time/date-picker/test/use-lilius.d.ts +2 -0
- package/build-types/date-time/date-picker/test/use-lilius.d.ts.map +1 -0
- package/build-types/date-time/date-picker/use-lilius/index.d.ts +169 -0
- package/build-types/date-time/date-picker/use-lilius/index.d.ts.map +1 -0
- package/build-types/date-time/date-time/styles.d.ts +1 -1
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/time-picker/index.d.ts +27 -0
- package/build-types/date-time/time-picker/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/styles.d.ts +93 -0
- package/build-types/date-time/time-picker/styles.d.ts.map +1 -0
- package/build-types/date-time/time-picker/test/index.d.ts +2 -0
- package/build-types/date-time/time-picker/test/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/time-input/index.d.ts +4 -0
- package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/time-input/test/index.d.ts +2 -0
- package/build-types/date-time/time-picker/time-input/test/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/timezone.d.ts +7 -0
- package/build-types/date-time/time-picker/timezone.d.ts.map +1 -0
- package/build-types/date-time/utils.d.ts +9 -0
- package/build-types/date-time/utils.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +28 -0
- package/build-types/dimension-control/index.d.ts.map +1 -0
- package/build-types/dimension-control/sizes.d.ts +26 -0
- package/build-types/dimension-control/sizes.d.ts.map +1 -0
- package/build-types/dimension-control/stories/index.story.d.ts +4 -0
- package/build-types/dimension-control/stories/index.story.d.ts.map +1 -0
- package/build-types/dimension-control/types.d.ts +47 -0
- package/build-types/dimension-control/types.d.ts.map +1 -0
- package/build-types/draggable/types.d.ts +1 -1
- package/build-types/draggable/types.d.ts.map +1 -1
- package/build-types/drop-zone/types.d.ts +1 -1
- package/build-types/drop-zone/types.d.ts.map +1 -1
- package/build-types/dropdown-menu/types.d.ts +1 -1
- package/build-types/dropdown-menu/types.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/index.d.ts +17 -0
- package/build-types/dropdown-menu-v2/index.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts +11 -0
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/styles.d.ts +42 -0
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/test/index.d.ts +2 -0
- package/build-types/dropdown-menu-v2/test/index.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/types.d.ts +252 -0
- package/build-types/dropdown-menu-v2/types.d.ts.map +1 -0
- package/build-types/elevation/hook.d.ts +1 -1
- package/build-types/external-link/index.d.ts.map +1 -1
- package/build-types/external-link/styles/external-link-styles.d.ts +10 -0
- package/build-types/external-link/styles/external-link-styles.d.ts.map +1 -0
- package/build-types/flex/flex/hook.d.ts +1 -1
- package/build-types/flex/flex-block/hook.d.ts +1 -1
- package/build-types/flex/flex-item/hook.d.ts +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/font-size-picker/stories/index.story.d.ts +8 -7
- package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +2 -2
- package/build-types/form-token-field/styles.d.ts +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts +6 -5
- package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +1 -1
- package/build-types/h-stack/hook.d.ts +1 -1
- package/build-types/heading/hook.d.ts +1 -1
- package/build-types/higher-order/navigate-regions/index.d.ts +1 -1
- package/build-types/higher-order/with-notices/types.d.ts +1 -1
- package/build-types/higher-order/with-notices/types.d.ts.map +1 -1
- package/build-types/higher-order/with-spoken-messages/index.d.ts +2 -3
- package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
- package/build-types/icon/index.d.ts +2 -2
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts +2 -2
- package/build-types/item-group/item/hook.d.ts +1 -1
- package/build-types/item-group/item-group/hook.d.ts +1 -1
- package/build-types/menu/index.d.ts +2 -2
- package/build-types/menu/item-help-text.d.ts +1 -1
- package/build-types/menu/item-label.d.ts +1 -1
- package/build-types/menu/styles.d.ts +2 -2
- package/build-types/menu-item/index.d.ts +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +4 -4
- package/build-types/menu-item/types.d.ts +1 -1
- package/build-types/menu-item/types.d.ts.map +1 -1
- package/build-types/mobile/inserter-button/sparkles.d.ts +3 -0
- package/build-types/mobile/inserter-button/sparkles.d.ts.map +1 -0
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/modal/types.d.ts +1 -1
- package/build-types/modal/types.d.ts.map +1 -1
- package/build-types/modal/use-modal-exit-animation.d.ts +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts +2 -2
- package/build-types/navigation/types.d.ts +1 -1
- package/build-types/navigation/types.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-button/hook.d.ts +1 -1
- package/build-types/navigator/navigator-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-provider/component.d.ts +38 -0
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -0
- package/build-types/navigator/navigator-provider/index.d.ts +2 -0
- package/build-types/navigator/navigator-provider/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-screen/index.d.ts +2 -0
- package/build-types/navigator/navigator-screen/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-to-parent-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-to-parent-button/index.d.ts.map +1 -0
- package/build-types/palette-edit/styles.d.ts +1 -1
- package/build-types/palette-edit/types.d.ts +1 -1
- package/build-types/palette-edit/types.d.ts.map +1 -1
- package/build-types/panel/types.d.ts +2 -2
- package/build-types/panel/types.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/radio-group/radio/index.d.ts +7 -0
- package/build-types/radio-group/radio/index.d.ts.map +1 -0
- package/build-types/radio-group/radio-context/index.d.ts +6 -0
- package/build-types/radio-group/radio-context/index.d.ts.map +1 -0
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/input-range.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +2 -2
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/sandbox/index.d.ts +1 -1
- package/build-types/sandbox/index.d.ts.map +1 -1
- package/build-types/sandbox/types.d.ts +11 -0
- package/build-types/sandbox/types.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +1 -1
- package/build-types/search-control/types.d.ts +1 -1
- package/build-types/search-control/types.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts +2 -2
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts +5 -0
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +12 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts +4 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
- package/build-types/slot-fill/types.d.ts +1 -1
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/slot-fill/use-slot.d.ts +9 -0
- package/build-types/slot-fill/use-slot.d.ts.map +1 -0
- package/build-types/snackbar/index.d.ts +1 -1
- package/build-types/snackbar/list.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +1 -1
- package/build-types/style-provider/test/index.d.ts +2 -0
- package/build-types/style-provider/test/index.d.ts.map +1 -0
- package/build-types/surface/hook.d.ts +1 -1
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +1 -1
- package/build-types/text/stories/index.story.d.ts +3 -3
- package/build-types/text/utils.d.ts +18 -18
- package/build-types/text/utils.d.ts.map +1 -1
- package/build-types/theme/stories/index.story.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
- package/build-types/toggle-group-control/types.d.ts +1 -1
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +1 -1
- package/build-types/tree-grid/types.d.ts +1 -1
- package/build-types/tree-grid/types.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +1 -1
- package/build-types/ui/context/constants.d.ts +8 -0
- package/build-types/ui/context/constants.d.ts.map +1 -0
- package/build-types/ui/context/context-connect.d.ts +40 -0
- package/build-types/ui/context/context-connect.d.ts.map +1 -0
- package/build-types/ui/context/context-system-provider.d.ts +7 -0
- package/build-types/ui/context/context-system-provider.d.ts.map +1 -0
- package/build-types/ui/context/get-styled-class-name-from-key.d.ts +2 -0
- package/build-types/ui/context/get-styled-class-name-from-key.d.ts.map +1 -0
- package/build-types/ui/context/index.d.ts +5 -0
- package/build-types/ui/context/index.d.ts.map +1 -0
- package/build-types/ui/context/test/context-connect.d.ts +2 -0
- package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
- package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
- package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
- package/build-types/ui/context/use-context-system.d.ts +20 -0
- package/build-types/ui/context/use-context-system.d.ts.map +1 -0
- package/build-types/ui/context/utils.d.ts +26 -0
- package/build-types/ui/context/utils.d.ts.map +1 -0
- package/build-types/ui/context/wordpress-component.d.ts +32 -0
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -0
- package/build-types/ui/shortcut/component.d.ts +12 -0
- package/build-types/ui/shortcut/component.d.ts.map +1 -0
- package/build-types/ui/shortcut/index.d.ts +3 -0
- package/build-types/ui/shortcut/index.d.ts.map +1 -0
- package/build-types/ui/tooltip/component.d.ts +29 -0
- package/build-types/ui/tooltip/component.d.ts.map +1 -0
- package/build-types/ui/tooltip/content.d.ts +9 -0
- package/build-types/ui/tooltip/content.d.ts.map +1 -0
- package/build-types/ui/tooltip/context.d.ts +10 -0
- package/build-types/ui/tooltip/context.d.ts.map +1 -0
- package/build-types/ui/tooltip/index.d.ts +3 -0
- package/build-types/ui/tooltip/index.d.ts.map +1 -0
- package/build-types/ui/tooltip/styles.d.ts +12 -0
- package/build-types/ui/tooltip/styles.d.ts.map +1 -0
- package/build-types/ui/tooltip/types.d.ts +62 -0
- package/build-types/ui/tooltip/types.d.ts.map +1 -0
- package/build-types/ui/utils/colors.d.ts +17 -0
- package/build-types/ui/utils/colors.d.ts.map +1 -0
- package/build-types/ui/utils/font-size.d.ts +18 -0
- package/build-types/ui/utils/font-size.d.ts.map +1 -0
- package/build-types/ui/utils/get-valid-children.d.ts +13 -0
- package/build-types/ui/utils/get-valid-children.d.ts.map +1 -0
- package/build-types/ui/utils/index.d.ts +2 -0
- package/build-types/ui/utils/index.d.ts.map +1 -0
- package/build-types/ui/utils/space.d.ts +23 -0
- package/build-types/ui/utils/space.d.ts.map +1 -0
- package/build-types/ui/utils/types.d.ts +14 -0
- package/build-types/ui/utils/types.d.ts.map +1 -0
- package/build-types/ui/utils/use-responsive-value.d.ts +5 -0
- package/build-types/ui/utils/use-responsive-value.d.ts.map +1 -0
- package/build-types/utils/hooks/use-latest-ref.d.ts +15 -0
- package/build-types/utils/hooks/use-latest-ref.d.ts.map +1 -0
- package/build-types/utils/hooks/use-update-effect.d.ts +3 -3
- package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
- package/build-types/utils/input/base.d.ts +3 -0
- package/build-types/utils/input/base.d.ts.map +1 -0
- package/build-types/utils/input/index.d.ts +2 -0
- package/build-types/utils/input/index.d.ts.map +1 -0
- package/build-types/utils/input/input-control.d.ts +2 -0
- package/build-types/utils/input/input-control.d.ts.map +1 -0
- package/build-types/utils/reduce-motion.d.ts +8 -0
- package/build-types/utils/reduce-motion.d.ts.map +1 -0
- package/build-types/utils/rtl.d.ts +4 -4
- package/build-types/utils/rtl.d.ts.map +1 -1
- package/build-types/utils/use-responsive-value.d.ts.map +1 -1
- package/build-types/utils/z-index.d.ts +3 -0
- package/build-types/utils/z-index.d.ts.map +1 -0
- package/build-types/v-stack/hook.d.ts +1 -1
- package/build-types/v-stack/stories/index.story.d.ts +1 -1
- package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
- package/build-types/validated-form-controls/test/checkbox-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/checkbox-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/combobox-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/combobox-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/custom-select-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/custom-select-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/form-token-field.d.ts +2 -0
- package/build-types/validated-form-controls/test/form-token-field.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/input-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/input-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/number-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/number-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/radio-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/radio-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/range-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/range-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/select-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/select-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/text-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/text-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/textarea-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/textarea-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/toggle-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/toggle-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/toggle-group-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/toggle-group-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/validity-indicator.d.ts +2 -1
- package/build-types/validated-form-controls/validity-indicator.d.ts.map +1 -1
- package/build-types/view/types.d.ts +8 -0
- package/build-types/view/types.d.ts.map +1 -0
- package/package.json +24 -24
- package/src/alignment-matrix-control/test/index.tsx +1 -1
- package/src/angle-picker-control/angle-circle.tsx +6 -5
- package/src/animate/types.ts +1 -1
- package/src/autocomplete/autocompleter-ui.tsx +1 -1
- package/src/autocomplete/index.tsx +33 -8
- package/src/autocomplete/test/index.tsx +110 -1
- package/src/autocomplete/types.ts +1 -1
- package/src/button/style.scss +8 -5
- package/src/calendar/style.scss +4 -2
- package/src/clipboard-button/index.tsx +1 -1
- package/src/color-palette/stories/index.story.tsx +56 -48
- package/src/color-picker/color-copy-button.tsx +1 -3
- package/src/composite/stories/index.story.tsx +1 -1
- package/src/confirm-dialog/component.tsx +2 -2
- package/src/context/context-connect.ts +3 -3
- package/src/context/context-system-provider.js +4 -4
- package/src/context/wordpress-component.ts +3 -5
- package/src/custom-gradient-picker/gradient-bar/control-points.tsx +3 -2
- package/src/custom-gradient-picker/types.ts +1 -1
- package/src/custom-select-control-v2/custom-select.tsx +1 -1
- package/src/custom-select-control-v2/stories/index.story.tsx +3 -3
- package/src/custom-select-control-v2/test/index.tsx +3 -3
- package/src/custom-select-control-v2/types.ts +4 -4
- package/src/date-time/date/index.tsx +1 -1
- package/src/date-time/test/utils.test.ts +8 -11
- package/src/date-time/time/index.tsx +2 -12
- package/src/date-time/time/test/index.tsx +69 -0
- package/src/date-time/utils.ts +18 -0
- package/src/draggable/index.native.js +17 -17
- package/src/draggable/types.ts +1 -1
- package/src/drop-zone/types.ts +1 -1
- package/src/dropdown/index.tsx +1 -1
- package/src/dropdown-menu/types.ts +1 -1
- package/src/external-link/index.tsx +5 -1
- package/src/font-size-picker/stories/index.story.tsx +133 -125
- package/src/form-token-field/style.scss +1 -0
- package/src/gradient-picker/stories/index.story.tsx +48 -42
- package/src/h-stack/test/index.tsx +1 -1
- package/src/heading/hook.ts +2 -2
- package/src/higher-order/with-notices/test/index.tsx +2 -2
- package/src/higher-order/with-notices/types.ts +1 -1
- package/src/higher-order/with-spoken-messages/index.tsx +2 -4
- package/src/icon/index.tsx +2 -2
- package/src/keyboard-shortcuts/index.tsx +1 -1
- package/src/menu/stories/index.story.tsx +1 -1
- package/src/menu-item/types.ts +1 -1
- package/src/modal/index.tsx +4 -3
- package/src/modal/types.ts +1 -1
- package/src/modal/use-modal-exit-animation.ts +2 -2
- package/src/navigation/README.md +1 -1
- package/src/navigation/types.ts +1 -1
- package/src/number-control/index.tsx +1 -1
- package/src/palette-edit/index.tsx +2 -2
- package/src/palette-edit/types.ts +1 -1
- package/src/panel/README.md +1 -1
- package/src/panel/body.tsx +1 -1
- package/src/panel/types.ts +2 -2
- package/src/popover/stories/index.story.tsx +1 -1
- package/src/private-apis.ts +0 -2
- package/src/radio-control/test/index.tsx +5 -4
- package/src/range-control/index.tsx +1 -1
- package/src/range-control/types.ts +2 -2
- package/src/resizable-box/index.tsx +1 -1
- package/src/resizable-box/resize-tooltip/index.tsx +1 -1
- package/src/resizable-box/resize-tooltip/label.tsx +1 -1
- package/src/resizable-box/resize-tooltip/utils.ts +2 -2
- package/src/sandbox/index.tsx +190 -10
- package/src/sandbox/test/index.tsx +65 -24
- package/src/sandbox/types.ts +11 -0
- package/src/search-control/types.ts +1 -1
- package/src/select-control/styles/select-control-styles.ts +1 -0
- package/src/slot-fill/types.ts +1 -1
- package/src/snackbar/list.tsx +7 -2
- package/src/tabs/styles.ts +1 -0
- package/src/text/utils.ts +18 -18
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +18 -16
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +4 -6
- package/src/toggle-group-control/types.ts +1 -1
- package/src/tree-grid/roving-tab-index-item.tsx +1 -1
- package/src/tree-grid/types.ts +1 -1
- package/src/utils/element-rect.ts +1 -1
- package/src/utils/hooks/use-update-effect.js +2 -2
- package/src/utils/rtl.js +4 -4
- package/src/utils/use-responsive-value.ts +1 -5
- package/src/v-stack/test/index.tsx +1 -1
- package/src/validated-form-controls/components/stories/overview.story.tsx +2 -1
- package/src/validated-form-controls/control-with-error.tsx +44 -4
- package/src/validated-form-controls/test/checkbox-control.tsx +49 -0
- package/src/validated-form-controls/test/combobox-control.tsx +61 -0
- package/src/validated-form-controls/test/control-with-error.tsx +182 -1
- package/src/validated-form-controls/test/custom-select-control.tsx +60 -0
- package/src/validated-form-controls/test/form-token-field.tsx +52 -0
- package/src/validated-form-controls/test/input-control.tsx +42 -0
- package/src/validated-form-controls/test/number-control.tsx +44 -0
- package/src/validated-form-controls/test/radio-control.tsx +61 -0
- package/src/validated-form-controls/test/range-control.tsx +73 -0
- package/src/validated-form-controls/test/select-control.tsx +57 -0
- package/src/validated-form-controls/test/text-control.tsx +49 -0
- package/src/validated-form-controls/test/textarea-control.tsx +51 -0
- package/src/validated-form-controls/test/toggle-control.tsx +49 -0
- package/src/validated-form-controls/test/toggle-group-control.tsx +28 -0
- package/src/validated-form-controls/validity-indicator.tsx +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- `ControlWithError`: Connect validation error messages to controls via `aria-describedby` ([#76742](https://github.com/WordPress/gutenberg/pull/76742)).
|
|
8
|
+
- `Autocomplete`: Fix value comparison to avoid resetting block inserter in RTC ([#76980](https://github.com/WordPress/gutenberg/pull/76980)).
|
|
9
|
+
|
|
10
|
+
### Enhancements
|
|
11
|
+
|
|
12
|
+
- `Sandbox`: Add `allowSameOrigin` prop to opt in to `allow-same-origin` on the iframe sandbox. The default is now `false`, removing same-origin access for user-controlled content like the Custom HTML block ([#77212](https://github.com/WordPress/gutenberg/pull/77212)).
|
|
13
|
+
|
|
14
|
+
## 32.4.0 (2026-03-18)
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
- Revert `word-break: break-word` addition ([#76230](https://github.com/WordPress/gutenberg/pull/76230)).
|
|
19
|
+
- `VisuallyHidden`: Add `word-break: normal` to prevent text wrapping issues in screen reader content ([#75539](https://github.com/WordPress/gutenberg/pull/75539)).
|
|
20
|
+
- `DateTimePicker`: Fix error that occurs when selecting a day outside the valid days for a month (e.g. February 30) ([#76400](https://github.com/WordPress/gutenberg/pull/76400)).
|
|
21
|
+
- `Button`: fix focus styles in High Contrast (forced colors) mode ([#76719](https://github.com/WordPress/gutenberg/pull/76719)).
|
|
22
|
+
|
|
23
|
+
### Enhancements
|
|
24
|
+
|
|
25
|
+
- `DateCalendar`, `DateRangeCalendar`: Add `showOutsideDays` and `fixedWeeks` props and style outside-month days ([#76199](https://github.com/WordPress/gutenberg/pull/76199)).
|
|
26
|
+
|
|
27
|
+
### Internal
|
|
28
|
+
|
|
29
|
+
- Remove `Avatar` and `AvatarGroup` from private APIs, moved to `@wordpress/editor` ([#75652](https://github.com/WordPress/gutenberg/pull/75652)).
|
|
30
|
+
|
|
31
|
+
- `SnackbarList`: Fix scaling distortion when a snackbar's content is updated in place via a shared notice ID ([#75709](https://github.com/WordPress/gutenberg/pull/75709)).
|
|
32
|
+
- `ToggleGroupControl`: Fix hover styles on disabled items ([#75737](https://github.com/WordPress/gutenberg/pull/75737)).
|
|
33
|
+
- `FormTokenField`: Fixed incorrect height of input field when rendered on pages using WordPress 7.0 form styles ([#75880](https://github.com/WordPress/gutenberg/pull/75880)).
|
|
34
|
+
- `SelectControl`: Fixed misalignment of option label on some variants when rendered on pages using WordPress 7.0 form styles ([#75880](https://github.com/WordPress/gutenberg/pull/75880)).
|
|
35
|
+
|
|
36
|
+
### Enhancements
|
|
37
|
+
|
|
38
|
+
- `ToggleGroupControl`: Make unselected item color consistent across all variants ([#75737](https://github.com/WordPress/gutenberg/pull/75737)).
|
|
39
|
+
|
|
40
|
+
## 32.2.0 (2026-02-18)
|
|
6
41
|
|
|
7
42
|
### Bug Fixes
|
|
8
43
|
|
|
44
|
+
- `Tabs`: Set explicit `font-family` on tab buttons to prevent inheriting unintended fonts ([#75537](https://github.com/WordPress/gutenberg/pull/75537)).
|
|
45
|
+
- `ExternalLink`: Add `wp-exclude-emoji` class to prevent Twemoji from replacing the arrow icon ([#75538](https://github.com/WordPress/gutenberg/pull/75538)).
|
|
9
46
|
- `TimePicker`: Fix date parsing for years below 1000 by implementing ISO 8601 compliant year formatting with zero-padding ([#75343](https://github.com/WordPress/gutenberg/pull/75343)).
|
|
10
47
|
- `Text`: Remove `text-wrap: balance` fallback. Only `text-wrap: pretty` is now used ([#75089](https://github.com/WordPress/gutenberg/pull/75089)).
|
|
11
48
|
- `RangeControl`: support forced-colors mode ([#75165](https://github.com/WordPress/gutenberg/pull/75165)).
|
|
@@ -16,12 +53,20 @@
|
|
|
16
53
|
### Enhancements
|
|
17
54
|
|
|
18
55
|
- Improve visual emphasis of the selected item in the ToggleGroupControl component ([#75138](https://github.com/WordPress/gutenberg/pull/75138)).
|
|
56
|
+
- `DateCalendar`, `DateRangeCalendar`: use lighter gray for disabled dates ([#75683](https://github.com/WordPress/gutenberg/pull/75683)).
|
|
19
57
|
|
|
20
58
|
### Internal
|
|
21
59
|
|
|
60
|
+
- Add `Avatar` and `AvatarGroup` components as private APIs ([#75595](https://github.com/WordPress/gutenberg/pull/75595)).
|
|
61
|
+
- Remove `Picker` from private APIs ([#75394](https://github.com/WordPress/gutenberg/pull/75394)).
|
|
22
62
|
- Expose `useDrag` from `@use-gesture/react` package via private API's ([#66735](https://github.com/WordPress/gutenberg/pull/66735)).
|
|
23
63
|
- `Disabled`, `Modal`, `Popover`, `Tooltip`: Move context code to separate files to help docgen prop extraction ([#75316](https://github.com/WordPress/gutenberg/pull/75316)).
|
|
24
64
|
- Update Emotion dependencies to ensure compatibility with React 19 ([#75324](https://github.com/WordPress/gutenberg/pull/75324)).
|
|
65
|
+
- Update Testing Library packages used in unit tests ([#75340](https://github.com/WordPress/gutenberg/pull/75340)).
|
|
66
|
+
- Clean up type declarations using the `React` namespace ([#75499](https://github.com/WordPress/gutenberg/pull/75499) and ([#75508](https://github.com/WordPress/gutenberg/pull/75508))).
|
|
67
|
+
- Always specify initial values for `useRef` calls ([#75513](https://github.com/WordPress/gutenberg/pull/75513)).
|
|
68
|
+
- Update `RefObject` type usage for React 19 compatibility ([#75567](https://github.com/WordPress/gutenberg/pull/75567)).
|
|
69
|
+
- Upgraded `@ariakit/react` (v0.4.21) and `@ariakit/test` (v0.4.13) ([#75620](https://github.com/WordPress/gutenberg/pull/75620)).
|
|
25
70
|
|
|
26
71
|
## 32.1.0 (2026-01-29)
|
|
27
72
|
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AGENTS.md
|
|
@@ -40,9 +40,9 @@ var import_visually_hidden = require("../visually-hidden/index.cjs");
|
|
|
40
40
|
var import_utils = require("./utils.cjs");
|
|
41
41
|
|
|
42
42
|
// packages/components/src/alignment-matrix-control/style.module.scss
|
|
43
|
-
if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='
|
|
43
|
+
if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='4c2e860238']")) {
|
|
44
44
|
const style = document.createElement("style");
|
|
45
|
-
style.setAttribute("data-wp-hash", "
|
|
45
|
+
style.setAttribute("data-wp-hash", "4c2e860238");
|
|
46
46
|
style.appendChild(document.createTextNode("._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid #0000;border-radius:4px;box-sizing:border-box;cursor:pointer;direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}"));
|
|
47
47
|
document.head.appendChild(style);
|
|
48
48
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/alignment-matrix-control/cell.tsx", "../../src/alignment-matrix-control/style.module.scss"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { Composite } from '../composite';\nimport Tooltip from '../tooltip';\nimport { VisuallyHidden } from '../visually-hidden';\n\n/**\n * Internal dependencies\n */\nimport { ALIGNMENT_LABEL } from './utils';\nimport styles from './style.module.scss';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport default function Cell({\n id,\n value,\n ...props\n}) {\n return /*#__PURE__*/_jsx(Tooltip, {\n text: ALIGNMENT_LABEL[value],\n children: /*#__PURE__*/_jsxs(Composite.Item, {\n id: id,\n render: /*#__PURE__*/_jsx(\"span\", {\n ...props,\n className: clsx(styles.cell, props.className),\n role: \"gridcell\"\n }),\n children: [/*#__PURE__*/_jsx(VisuallyHidden, {\n children: value\n }), /*#__PURE__*/_jsx(\"span\", {\n className: styles.point,\n role: \"presentation\"\n })]\n })\n });\n}", "if (typeof document !== 'undefined' && !document.head.querySelector(\"style[data-wp-hash='
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { Composite } from '../composite';\nimport Tooltip from '../tooltip';\nimport { VisuallyHidden } from '../visually-hidden';\n\n/**\n * Internal dependencies\n */\nimport { ALIGNMENT_LABEL } from './utils';\nimport styles from './style.module.scss';\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport default function Cell({\n id,\n value,\n ...props\n}) {\n return /*#__PURE__*/_jsx(Tooltip, {\n text: ALIGNMENT_LABEL[value],\n children: /*#__PURE__*/_jsxs(Composite.Item, {\n id: id,\n render: /*#__PURE__*/_jsx(\"span\", {\n ...props,\n className: clsx(styles.cell, props.className),\n role: \"gridcell\"\n }),\n children: [/*#__PURE__*/_jsx(VisuallyHidden, {\n children: value\n }), /*#__PURE__*/_jsx(\"span\", {\n className: styles.point,\n role: \"presentation\"\n })]\n })\n });\n}", "if (typeof document !== 'undefined' && !document.head.querySelector(\"style[data-wp-hash='4c2e860238']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"4c2e860238\");\n\tstyle.appendChild(document.createTextNode(\"._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid #0000;border-radius:4px;box-sizing:border-box;cursor:pointer;direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"grid-container\":\"_02e2af5803bf5bda__grid-container\",\"grid-row\":\"c421f8ed08c23077__grid-row\",\"cell\":\"_3af769f755097fdb__cell\",\"point\":\"_37ef12d4fb6d6131__point\"};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,uBAA0B;AAC1B,qBAAoB;AACpB,6BAA+B;AAK/B,mBAAgC;;;ACfhC,IAAI,OAAO,aAAa,eAAe,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AACxG,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,60CAA60C,CAAC;AACx3C,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,uBAAQ,EAAC,kBAAiB,qCAAoC,YAAW,8BAA6B,QAAO,2BAA0B,SAAQ,2BAA0B;;;ADWhL,yBAA2C;AAC5B,SAAR,KAAsB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,SAAoB,uCAAAA,KAAK,eAAAC,SAAS;AAAA,IAChC,MAAM,6BAAgB,KAAK;AAAA,IAC3B,UAAuB,uCAAAC,MAAM,2BAAU,MAAM;AAAA,MAC3C;AAAA,MACA,QAAqB,uCAAAF,KAAK,QAAQ;AAAA,QAChC,GAAG;AAAA,QACH,eAAW,YAAAG,SAAK,qBAAO,MAAM,MAAM,SAAS;AAAA,QAC5C,MAAM;AAAA,MACR,CAAC;AAAA,MACD,UAAU,CAAc,uCAAAH,KAAK,uCAAgB;AAAA,QAC3C,UAAU;AAAA,MACZ,CAAC,GAAgB,uCAAAA,KAAK,QAAQ;AAAA,QAC5B,WAAW,qBAAO;AAAA,QAClB,MAAM;AAAA,MACR,CAAC,CAAC;AAAA,IACJ,CAAC;AAAA,EACH,CAAC;AACH;",
|
|
6
6
|
"names": ["_jsx", "Tooltip", "_jsxs", "clsx"]
|
|
7
7
|
}
|
|
@@ -44,9 +44,9 @@ var import_icon = __toESM(require("./icon.cjs"));
|
|
|
44
44
|
var import_utils = require("./utils.cjs");
|
|
45
45
|
|
|
46
46
|
// packages/components/src/alignment-matrix-control/style.module.scss
|
|
47
|
-
if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='
|
|
47
|
+
if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='4c2e860238']")) {
|
|
48
48
|
const style = document.createElement("style");
|
|
49
|
-
style.setAttribute("data-wp-hash", "
|
|
49
|
+
style.setAttribute("data-wp-hash", "4c2e860238");
|
|
50
50
|
style.appendChild(document.createTextNode("._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid #0000;border-radius:4px;box-sizing:border-box;cursor:pointer;direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}"));
|
|
51
51
|
document.head.appendChild(style);
|
|
52
52
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/alignment-matrix-control/index.tsx", "../../src/alignment-matrix-control/style.module.scss"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport { Composite } from '../composite';\nimport AlignmentMatrixControlIcon from './icon';\nimport { GRID, getItemId, getItemValue } from './utils';\nimport styles from './style.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnforwardedAlignmentMatrixControl({\n className,\n id,\n label = __('Alignment Matrix Control'),\n defaultValue = 'center center',\n value,\n onChange,\n width = 92,\n ...props\n}) {\n const baseId = useInstanceId(UnforwardedAlignmentMatrixControl, 'alignment-matrix-control', id);\n const setActiveId = useCallback(nextActiveId => {\n const nextValue = getItemValue(baseId, nextActiveId);\n if (nextValue) {\n onChange?.(nextValue);\n }\n }, [baseId, onChange]);\n const classes = clsx('component-alignment-matrix-control', styles['grid-container'], className);\n return /*#__PURE__*/_jsx(Composite, {\n defaultActiveId: getItemId(baseId, defaultValue),\n activeId: getItemId(baseId, value),\n setActiveId: setActiveId,\n rtl: isRTL(),\n render: /*#__PURE__*/_jsx(\"div\", {\n ...props,\n className: classes,\n \"aria-label\": label,\n id: baseId,\n role: \"grid\",\n style: {\n width: `${width}px`\n }\n }),\n children: GRID.map((cells, index) => /*#__PURE__*/_jsx(Composite.Row, {\n render: /*#__PURE__*/_jsx(\"div\", {\n className: styles['grid-row'],\n role: \"row\"\n }),\n children: cells.map(cell => /*#__PURE__*/_jsx(Cell, {\n id: getItemId(baseId, cell),\n value: cell\n }, cell))\n }, index))\n });\n}\n\n/**\n * AlignmentMatrixControl components enable adjustments to horizontal and vertical alignments for UI.\n *\n * ```jsx\n * import { AlignmentMatrixControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ alignment, setAlignment ] = useState( 'center center' );\n *\n * \treturn (\n * \t\t<AlignmentMatrixControl\n * \t\t\tvalue={ alignment }\n * \t\t\tonChange={ setAlignment }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const AlignmentMatrixControl = Object.assign(UnforwardedAlignmentMatrixControl, {\n /**\n * Render an alignment matrix as an icon.\n *\n * ```jsx\n * import { AlignmentMatrixControl } from '@wordpress/components';\n *\n * <Icon icon={<AlignmentMatrixControl.Icon value=\"top left\" />} />\n * ```\n */\n Icon: Object.assign(AlignmentMatrixControlIcon, {\n displayName: 'AlignmentMatrixControl.Icon'\n })\n});\nexport default AlignmentMatrixControl;", "if (typeof document !== 'undefined' && !document.head.querySelector(\"style[data-wp-hash='
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport { Composite } from '../composite';\nimport AlignmentMatrixControlIcon from './icon';\nimport { GRID, getItemId, getItemValue } from './utils';\nimport styles from './style.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction UnforwardedAlignmentMatrixControl({\n className,\n id,\n label = __('Alignment Matrix Control'),\n defaultValue = 'center center',\n value,\n onChange,\n width = 92,\n ...props\n}) {\n const baseId = useInstanceId(UnforwardedAlignmentMatrixControl, 'alignment-matrix-control', id);\n const setActiveId = useCallback(nextActiveId => {\n const nextValue = getItemValue(baseId, nextActiveId);\n if (nextValue) {\n onChange?.(nextValue);\n }\n }, [baseId, onChange]);\n const classes = clsx('component-alignment-matrix-control', styles['grid-container'], className);\n return /*#__PURE__*/_jsx(Composite, {\n defaultActiveId: getItemId(baseId, defaultValue),\n activeId: getItemId(baseId, value),\n setActiveId: setActiveId,\n rtl: isRTL(),\n render: /*#__PURE__*/_jsx(\"div\", {\n ...props,\n className: classes,\n \"aria-label\": label,\n id: baseId,\n role: \"grid\",\n style: {\n width: `${width}px`\n }\n }),\n children: GRID.map((cells, index) => /*#__PURE__*/_jsx(Composite.Row, {\n render: /*#__PURE__*/_jsx(\"div\", {\n className: styles['grid-row'],\n role: \"row\"\n }),\n children: cells.map(cell => /*#__PURE__*/_jsx(Cell, {\n id: getItemId(baseId, cell),\n value: cell\n }, cell))\n }, index))\n });\n}\n\n/**\n * AlignmentMatrixControl components enable adjustments to horizontal and vertical alignments for UI.\n *\n * ```jsx\n * import { AlignmentMatrixControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ alignment, setAlignment ] = useState( 'center center' );\n *\n * \treturn (\n * \t\t<AlignmentMatrixControl\n * \t\t\tvalue={ alignment }\n * \t\t\tonChange={ setAlignment }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport const AlignmentMatrixControl = Object.assign(UnforwardedAlignmentMatrixControl, {\n /**\n * Render an alignment matrix as an icon.\n *\n * ```jsx\n * import { AlignmentMatrixControl } from '@wordpress/components';\n *\n * <Icon icon={<AlignmentMatrixControl.Icon value=\"top left\" />} />\n * ```\n */\n Icon: Object.assign(AlignmentMatrixControlIcon, {\n displayName: 'AlignmentMatrixControl.Icon'\n })\n});\nexport default AlignmentMatrixControl;", "if (typeof document !== 'undefined' && !document.head.querySelector(\"style[data-wp-hash='4c2e860238']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"4c2e860238\");\n\tstyle.appendChild(document.createTextNode(\"._02e2af5803bf5bda__grid-container{aspect-ratio:1;border:1px solid #0000;border-radius:4px;box-sizing:border-box;cursor:pointer;direction:ltr;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);outline:none}.c421f8ed08c23077__grid-row{box-sizing:border-box;display:grid;grid-column:1/-1;grid-template-columns:repeat(3,1fr)}._3af769f755097fdb__cell{align-items:center;appearance:none;border:none;box-sizing:border-box;display:flex;justify-content:center;margin:0;outline:none;padding:0;position:relative}._37ef12d4fb6d6131__point{aspect-ratio:1;border:3px solid;box-sizing:border-box;color:var(--wp-components-color-gray-400,#ccc);contain:strict;display:block;margin:auto;width:6px}._3af769f755097fdb__cell[data-active-item] ._37ef12d4fb6d6131__point{color:var(--wp-components-color-foreground,#1e1e1e);transform:scale(1.6666666667)}._3af769f755097fdb__cell:not([data-active-item]):hover ._37ef12d4fb6d6131__point{color:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9))}._3af769f755097fdb__cell[data-focus-visible] ._37ef12d4fb6d6131__point{outline:1px solid var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));outline-offset:1px}@media not (prefers-reduced-motion){._37ef12d4fb6d6131__point{transition-duration:.12s;transition-property:color,transform;transition-timing-function:linear}}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"grid-container\":\"_02e2af5803bf5bda__grid-container\",\"grid-row\":\"c421f8ed08c23077__grid-row\",\"cell\":\"_3af769f755097fdb__cell\",\"point\":\"_37ef12d4fb6d6131__point\"};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAA0B;AAC1B,qBAA8B;AAC9B,qBAA4B;AAK5B,kBAAiB;AACjB,uBAA0B;AAC1B,kBAAuC;AACvC,mBAA8C;;;AClB9C,IAAI,OAAO,aAAa,eAAe,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AACxG,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,60CAA60C,CAAC;AACx3C,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,uBAAQ,EAAC,kBAAiB,qCAAoC,YAAW,8BAA6B,QAAO,2BAA0B,SAAQ,2BAA0B;;;ADchL,yBAA4B;AAC5B,SAAS,kCAAkC;AAAA,EACzC;AAAA,EACA;AAAA,EACA,YAAQ,gBAAG,0BAA0B;AAAA,EACrC,eAAe;AAAA,EACf;A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,aAAa;AAAA,EACf,CAAC;AACH,CAAC;AACD,IAAO,mCAAQ;",
|
|
6
6
|
"names": ["clsx", "_jsx", "Cell", "AlignmentMatrixControlIcon"]
|
|
7
7
|
}
|
|
@@ -38,9 +38,9 @@ var import_element = require("@wordpress/element");
|
|
|
38
38
|
var import_compose = require("@wordpress/compose");
|
|
39
39
|
|
|
40
40
|
// packages/components/src/angle-picker-control/style.module.scss
|
|
41
|
-
if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='
|
|
41
|
+
if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='f35cc94692']")) {
|
|
42
42
|
const style = document.createElement("style");
|
|
43
|
-
style.setAttribute("data-wp-hash", "
|
|
43
|
+
style.setAttribute("data-wp-hash", "f35cc94692");
|
|
44
44
|
style.appendChild(document.createTextNode("._8f57b8d483c51fbe__circle-root{border:1px solid var(--wp-components-color-gray-600,#949494);border-radius:50%;box-sizing:border-box;cursor:grab;height:32px;overflow:hidden;width:32px}._8f57b8d483c51fbe__circle-root:active{cursor:grabbing}.b1bae984ac10fcc3__circle-indicator-wrapper{box-sizing:border-box;height:100%;position:relative;width:100%}.b1bae984ac10fcc3__circle-indicator-wrapper:focus-visible{outline:none}._6d2fe0a2cbb31bf0__circle-indicator{background:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));border-radius:50%;box-sizing:border-box;display:block;height:6px;left:50%;position:absolute;top:4px;transform:translateX(-50%);width:6px}"));
|
|
45
45
|
document.head.appendChild(style);
|
|
46
46
|
}
|
|
@@ -55,8 +55,8 @@ function AngleCircle({
|
|
|
55
55
|
...props
|
|
56
56
|
}) {
|
|
57
57
|
const angleCircleRef = (0, import_element.useRef)(null);
|
|
58
|
-
const angleCircleCenterRef = (0, import_element.useRef)();
|
|
59
|
-
const previousCursorValueRef = (0, import_element.useRef)();
|
|
58
|
+
const angleCircleCenterRef = (0, import_element.useRef)(void 0);
|
|
59
|
+
const previousCursorValueRef = (0, import_element.useRef)(void 0);
|
|
60
60
|
const setAngleCircleCenter = () => {
|
|
61
61
|
if (angleCircleRef.current === null) {
|
|
62
62
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/angle-picker-control/angle-circle.tsx", "../../src/angle-picker-control/style.module.scss"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { __experimentalUseDragging as useDragging } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction AngleCircle({\n value,\n onChange,\n className,\n ...props\n}) {\n const angleCircleRef = useRef(null);\n const angleCircleCenterRef = useRef();\n const previousCursorValueRef = useRef();\n const setAngleCircleCenter = () => {\n if (angleCircleRef.current === null) {\n return;\n }\n const rect = angleCircleRef.current.getBoundingClientRect();\n angleCircleCenterRef.current = {\n x: rect.x + rect.width / 2,\n y: rect.y + rect.height / 2\n };\n };\n const changeAngleToPosition = event => {\n if (event === undefined) {\n return;\n }\n\n // Prevent (drag) mouse events from selecting and accidentally\n // triggering actions from other elements.\n event.preventDefault();\n // Input control needs to lose focus and by preventDefault above, it doesn't.\n event.target?.focus();\n if (angleCircleCenterRef.current !== undefined && onChange !== undefined) {\n const {\n x: centerX,\n y: centerY\n } = angleCircleCenterRef.current;\n onChange(getAngle(centerX, centerY, event.clientX, event.clientY));\n }\n };\n const {\n startDrag,\n isDragging\n } = useDragging({\n onDragStart: event => {\n setAngleCircleCenter();\n changeAngleToPosition(event);\n },\n onDragMove: changeAngleToPosition,\n onDragEnd: changeAngleToPosition\n });\n useEffect(() => {\n if (isDragging) {\n if (previousCursorValueRef.current === undefined) {\n previousCursorValueRef.current = document.body.style.cursor;\n }\n document.body.style.cursor = 'grabbing';\n } else {\n document.body.style.cursor = previousCursorValueRef.current || '';\n previousCursorValueRef.current = undefined;\n }\n }, [isDragging]);\n return (\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n _jsx(\"div\", {\n ref: angleCircleRef,\n onMouseDown: startDrag,\n className: clsx('components-angle-picker-control__angle-circle', styles['circle-root'], className),\n ...props,\n children: /*#__PURE__*/_jsx(\"div\", {\n style: value ? {\n transform: `rotate(${value}deg)`\n } : undefined,\n className: clsx('components-angle-picker-control__angle-circle-indicator-wrapper', styles['circle-indicator-wrapper']),\n tabIndex: -1,\n children: /*#__PURE__*/_jsx(\"div\", {\n className: clsx('components-angle-picker-control__angle-circle-indicator', styles['circle-indicator'])\n })\n })\n })\n );\n}\nfunction getAngle(centerX, centerY, pointX, pointY) {\n const y = pointY - centerY;\n const x = pointX - centerX;\n const angleInRadians = Math.atan2(y, x);\n const angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90;\n if (angleInDeg < 0) {\n return 360 + angleInDeg;\n }\n return angleInDeg;\n}\nexport default AngleCircle;", "if (typeof document !== 'undefined' && !document.head.querySelector(\"style[data-wp-hash='
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAkC;AAClC,qBAAyD;;;ACTzD,IAAI,OAAO,aAAa,eAAe,CAAC,SAAS,KAAK,cAAc,kCAAkC,GAAG;AACxG,QAAM,QAAQ,SAAS,cAAc,OAAO;AAC5C,QAAM,aAAa,gBAAgB,YAAY;AAC/C,QAAM,YAAY,SAAS,eAAe,kqBAAkqB,CAAC;AAC7sB,WAAS,KAAK,YAAY,KAAK;AAChC;AACA,IAAO,uBAAQ,EAAC,eAAc,kCAAiC,4BAA2B,8CAA6C,oBAAmB,sCAAqC;;;ADS/L,yBAA4B;AAC5B,SAAS,YAAY;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,qBAAiB,uBAAO,IAAI;AAClC,QAAM,2BAAuB,uBAAO;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { __experimentalUseDragging as useDragging } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.module.scss';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction AngleCircle({\n value,\n onChange,\n className,\n ...props\n}) {\n const angleCircleRef = useRef(null);\n const angleCircleCenterRef = useRef(undefined);\n const previousCursorValueRef = useRef(undefined);\n const setAngleCircleCenter = () => {\n if (angleCircleRef.current === null) {\n return;\n }\n const rect = angleCircleRef.current.getBoundingClientRect();\n angleCircleCenterRef.current = {\n x: rect.x + rect.width / 2,\n y: rect.y + rect.height / 2\n };\n };\n const changeAngleToPosition = event => {\n if (event === undefined) {\n return;\n }\n\n // Prevent (drag) mouse events from selecting and accidentally\n // triggering actions from other elements.\n event.preventDefault();\n // Input control needs to lose focus and by preventDefault above, it doesn't.\n event.target?.focus();\n if (angleCircleCenterRef.current !== undefined && onChange !== undefined) {\n const {\n x: centerX,\n y: centerY\n } = angleCircleCenterRef.current;\n onChange(getAngle(centerX, centerY, event.clientX, event.clientY));\n }\n };\n const {\n startDrag,\n isDragging\n } = useDragging({\n onDragStart: event => {\n setAngleCircleCenter();\n changeAngleToPosition(event);\n },\n onDragMove: changeAngleToPosition,\n onDragEnd: changeAngleToPosition\n });\n useEffect(() => {\n if (isDragging) {\n if (previousCursorValueRef.current === undefined) {\n previousCursorValueRef.current = document.body.style.cursor;\n }\n document.body.style.cursor = 'grabbing';\n } else {\n document.body.style.cursor = previousCursorValueRef.current || '';\n previousCursorValueRef.current = undefined;\n }\n }, [isDragging]);\n return (\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n _jsx(\"div\", {\n ref: angleCircleRef,\n onMouseDown: startDrag,\n className: clsx('components-angle-picker-control__angle-circle', styles['circle-root'], className),\n ...props,\n children: /*#__PURE__*/_jsx(\"div\", {\n style: value ? {\n transform: `rotate(${value}deg)`\n } : undefined,\n className: clsx('components-angle-picker-control__angle-circle-indicator-wrapper', styles['circle-indicator-wrapper']),\n tabIndex: -1,\n children: /*#__PURE__*/_jsx(\"div\", {\n className: clsx('components-angle-picker-control__angle-circle-indicator', styles['circle-indicator'])\n })\n })\n })\n );\n}\nfunction getAngle(centerX, centerY, pointX, pointY) {\n const y = pointY - centerY;\n const x = pointX - centerX;\n const angleInRadians = Math.atan2(y, x);\n const angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90;\n if (angleInDeg < 0) {\n return 360 + angleInDeg;\n }\n return angleInDeg;\n}\nexport default AngleCircle;", "if (typeof document !== 'undefined' && !document.head.querySelector(\"style[data-wp-hash='f35cc94692']\")) {\n\tconst style = document.createElement(\"style\");\n\tstyle.setAttribute(\"data-wp-hash\", \"f35cc94692\");\n\tstyle.appendChild(document.createTextNode(\"._8f57b8d483c51fbe__circle-root{border:1px solid var(--wp-components-color-gray-600,#949494);border-radius:50%;box-sizing:border-box;cursor:grab;height:32px;overflow:hidden;width:32px}._8f57b8d483c51fbe__circle-root:active{cursor:grabbing}.b1bae984ac10fcc3__circle-indicator-wrapper{box-sizing:border-box;height:100%;position:relative;width:100%}.b1bae984ac10fcc3__circle-indicator-wrapper:focus-visible{outline:none}._6d2fe0a2cbb31bf0__circle-indicator{background:var(--wp-components-color-accent,var(--wp-admin-theme-color,#3858e9));border-radius:50%;box-sizing:border-box;display:block;height:6px;left:50%;position:absolute;top:4px;transform:translateX(-50%);width:6px}\"));\n\tdocument.head.appendChild(style);\n}\nexport default {\"circle-root\":\"_8f57b8d483c51fbe__circle-root\",\"circle-indicator-wrapper\":\"b1bae984ac10fcc3__circle-indicator-wrapper\",\"circle-indicator\":\"_6d2fe0a2cbb31bf0__circle-indicator\"};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,7 +32,8 @@ var autocomplete_exports = {};
|
|
|
32
32
|
__export(autocomplete_exports, {
|
|
33
33
|
default: () => Autocomplete,
|
|
34
34
|
useAutocomplete: () => useAutocomplete,
|
|
35
|
-
useAutocompleteProps: () => useAutocompleteProps
|
|
35
|
+
useAutocompleteProps: () => useAutocompleteProps,
|
|
36
|
+
useLastDifferentValue: () => useLastDifferentValue
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(autocomplete_exports);
|
|
38
39
|
var import_remove_accents = __toESM(require("remove-accents"));
|
|
@@ -255,17 +256,23 @@ function useAutocomplete({
|
|
|
255
256
|
})
|
|
256
257
|
};
|
|
257
258
|
}
|
|
259
|
+
function recordValuesMatch(a, b) {
|
|
260
|
+
return a.text === b.text && a.start === b.start && a.end === b.end;
|
|
261
|
+
}
|
|
258
262
|
function useLastDifferentValue(value) {
|
|
259
|
-
const history = (0, import_element.useRef)(
|
|
260
|
-
history.current.
|
|
261
|
-
if (
|
|
262
|
-
history.current.
|
|
263
|
+
const history = (0, import_element.useRef)([]);
|
|
264
|
+
const lastEntry = history.current[history.current.length - 1];
|
|
265
|
+
if (!lastEntry || !recordValuesMatch(value, lastEntry)) {
|
|
266
|
+
history.current.push(value);
|
|
267
|
+
}
|
|
268
|
+
if (history.current.length > 2) {
|
|
269
|
+
history.current.shift();
|
|
263
270
|
}
|
|
264
|
-
return
|
|
271
|
+
return history.current[0];
|
|
265
272
|
}
|
|
266
273
|
function useAutocompleteProps(options) {
|
|
267
274
|
const ref = (0, import_element.useRef)(null);
|
|
268
|
-
const onKeyDownRef = (0, import_element.useRef)();
|
|
275
|
+
const onKeyDownRef = (0, import_element.useRef)(void 0);
|
|
269
276
|
const {
|
|
270
277
|
record
|
|
271
278
|
} = options;
|
|
@@ -319,6 +326,7 @@ function Autocomplete({
|
|
|
319
326
|
// Annotate the CommonJS export names for ESM import in node:
|
|
320
327
|
0 && (module.exports = {
|
|
321
328
|
useAutocomplete,
|
|
322
|
-
useAutocompleteProps
|
|
329
|
+
useAutocompleteProps,
|
|
330
|
+
useLastDifferentValue
|
|
323
331
|
});
|
|
324
332
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/autocomplete/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { renderToString, useEffect, useState, useRef, useMemo } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { create, slice, insert, isCollapsed, getTextContent } from '@wordpress/rich-text';\nimport { speak } from '@wordpress/a11y';\nimport { isAppleOS } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { getAutoCompleterUI } from './autocompleter-ui';\nimport { escapeRegExp } from '../utils/strings';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport getNodeText from '../utils/get-node-text';\nimport { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst EMPTY_FILTERED_OPTIONS = [];\n\n// Used for generating the instance ID\nconst AUTOCOMPLETE_HOOK_REFERENCE = {};\nexport function useAutocomplete({\n record,\n onChange,\n onReplace,\n completers,\n contentRef\n}) {\n const instanceId = useInstanceId(AUTOCOMPLETE_HOOK_REFERENCE);\n const [selectedIndex, setSelectedIndex] = useState(0);\n const [filteredOptions, setFilteredOptions] = useState(EMPTY_FILTERED_OPTIONS);\n const [filterValue, setFilterValue] = useState('');\n const [autocompleter, setAutocompleter] = useState(null);\n const [AutocompleterUI, setAutocompleterUI] = useState(null);\n const backspacingRef = useRef(false);\n function insertCompletion(replacement) {\n if (autocompleter === null) {\n return;\n }\n const end = record.start;\n const start = end - autocompleter.triggerPrefix.length - filterValue.length;\n const toInsert = create({\n html: renderToString(replacement)\n });\n onChange(insert(record, toInsert, start, end));\n }\n function select(option) {\n const {\n getOptionCompletion\n } = autocompleter || {};\n if (option.isDisabled) {\n return;\n }\n if (getOptionCompletion) {\n const completion = getOptionCompletion(option.value, filterValue);\n const isCompletionObject = obj => {\n return obj !== null && typeof obj === 'object' && 'action' in obj && obj.action !== undefined && 'value' in obj && obj.value !== undefined;\n };\n const completionObject = isCompletionObject(completion) ? completion : {\n action: 'insert-at-caret',\n value: completion\n };\n if ('replace' === completionObject.action) {\n onReplace([completionObject.value]);\n // When replacing, the component will unmount, so don't reset\n // state (below) on an unmounted component.\n return;\n } else if ('insert-at-caret' === completionObject.action) {\n insertCompletion(completionObject.value);\n }\n }\n\n // Reset autocomplete state after insertion rather than before\n // so insertion events don't cause the completion menu to redisplay.\n reset();\n\n // Make sure that the content remains focused after making a selection\n // and that the text cursor position is not lost.\n contentRef.current?.focus();\n }\n function reset() {\n setSelectedIndex(0);\n setFilteredOptions(EMPTY_FILTERED_OPTIONS);\n setFilterValue('');\n setAutocompleter(null);\n setAutocompleterUI(null);\n }\n\n /**\n * Load options for an autocompleter.\n *\n * @param {Array} options\n */\n function onChangeOptions(options) {\n setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0);\n setFilteredOptions(options);\n }\n function handleKeyDown(event) {\n backspacingRef.current = event.key === 'Backspace';\n if (!autocompleter) {\n return;\n }\n if (filteredOptions.length === 0) {\n return;\n }\n if (event.defaultPrevented) {\n return;\n }\n switch (event.key) {\n case 'ArrowUp':\n {\n const newIndex = (selectedIndex === 0 ? filteredOptions.length : selectedIndex) - 1;\n setSelectedIndex(newIndex);\n // See the related PR as to why this is necessary: https://github.com/WordPress/gutenberg/pull/54902.\n if (isAppleOS()) {\n speak(getNodeText(filteredOptions[newIndex].label), 'assertive');\n }\n break;\n }\n case 'ArrowDown':\n {\n const newIndex = (selectedIndex + 1) % filteredOptions.length;\n setSelectedIndex(newIndex);\n if (isAppleOS()) {\n speak(getNodeText(filteredOptions[newIndex].label), 'assertive');\n }\n break;\n }\n case 'Escape':\n setAutocompleter(null);\n setAutocompleterUI(null);\n event.preventDefault();\n break;\n case 'Enter':\n select(filteredOptions[selectedIndex]);\n break;\n case 'ArrowLeft':\n case 'ArrowRight':\n reset();\n return;\n default:\n return;\n }\n\n // Any handled key should prevent original behavior. This relies on\n // the early return in the default case.\n event.preventDefault();\n }\n\n // textContent is a primitive (string), memoizing is not strictly necessary\n // but this is a preemptive performance improvement, since the autocompleter\n // is a potential bottleneck for the editor type metric.\n const textContent = useMemo(() => {\n if (isCollapsed(record)) {\n return getTextContent(slice(record, 0));\n }\n return '';\n }, [record]);\n useEffect(() => {\n if (!textContent) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n\n // Find the completer with the highest triggerPrefix index in the\n // textContent.\n const completer = completers.reduce((lastTrigger, currentCompleter) => {\n const triggerIndex = textContent.lastIndexOf(currentCompleter.triggerPrefix);\n const lastTriggerIndex = lastTrigger !== null ? textContent.lastIndexOf(lastTrigger.triggerPrefix) : -1;\n return triggerIndex > lastTriggerIndex ? currentCompleter : lastTrigger;\n }, null);\n if (!completer) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n const {\n allowContext,\n triggerPrefix\n } = completer;\n const triggerIndex = textContent.lastIndexOf(triggerPrefix);\n const textWithoutTrigger = textContent.slice(triggerIndex + triggerPrefix.length);\n const tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.\n // This is a final barrier to prevent the effect from completing with\n // an extremely long string, which causes the editor to slow-down\n // significantly. This could happen, for example, if `matchingWhileBackspacing`\n // is true and one of the \"words\" end up being too long. If that's the case,\n // it will be caught by this guard.\n if (tooDistantFromTrigger) {\n return;\n }\n const mismatch = filteredOptions.length === 0;\n const wordsFromTrigger = textWithoutTrigger.split(/\\s/);\n // We need to allow the effect to run when not backspacing and if there\n // was a mismatch. i.e when typing a trigger + the match string or when\n // clicking in an existing trigger word on the page. We do that if we\n // detect that we have one word from trigger in the current textual context.\n //\n // Ex.: \"Some text @a\" <-- \"@a\" will be detected as the trigger word and\n // allow the effect to run. It will run until there's a mismatch.\n const hasOneTriggerWord = wordsFromTrigger.length === 1;\n // This is used to allow the effect to run when backspacing and if\n // \"touching\" a word that \"belongs\" to a trigger. We consider a \"trigger\n // word\" any word up to the limit of 3 from the trigger character.\n // Anything beyond that is ignored if there's a mismatch. This allows\n // us to \"escape\" a mismatch when backspacing, but still imposing some\n // sane limits.\n //\n // Ex: \"Some text @marcelo sekkkk\" <--- \"kkkk\" caused a mismatch, but\n // if the user presses backspace here, it will show the completion popup again.\n const matchingWhileBackspacing = backspacingRef.current && wordsFromTrigger.length <= 3;\n if (mismatch && !(matchingWhileBackspacing || hasOneTriggerWord)) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n const textAfterSelection = getTextContent(slice(record, undefined, getTextContent(record).length));\n if (allowContext && !allowContext(textContent.slice(0, triggerIndex), textAfterSelection)) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n if (/^\\s/.test(textWithoutTrigger) || /\\s\\s+$/.test(textWithoutTrigger)) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n if (!/[\\u0000-\\uFFFF]*$/.test(textWithoutTrigger)) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n const safeTrigger = escapeRegExp(completer.triggerPrefix);\n const text = removeAccents(textContent);\n const match = text.slice(text.lastIndexOf(completer.triggerPrefix)).match(new RegExp(`${safeTrigger}([\\u0000-\\uFFFF]*)$`));\n const query = match && match[1];\n setAutocompleter(completer);\n setAutocompleterUI(() => completer !== autocompleter ? getAutoCompleterUI(completer) : AutocompleterUI);\n setFilterValue(query === null ? '' : query);\n // We want to avoid introducing unexpected side effects.\n // See https://github.com/WordPress/gutenberg/pull/41820\n }, [textContent]);\n const {\n key: selectedKey = ''\n } = filteredOptions[selectedIndex] || {};\n const {\n className\n } = autocompleter || {};\n const isExpanded = !!autocompleter && filteredOptions.length > 0;\n const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` : undefined;\n const activeId = isExpanded ? `components-autocomplete-item-${instanceId}-${selectedKey}` : null;\n const hasSelection = record.start !== undefined;\n const showPopover = !!textContent && hasSelection && !!AutocompleterUI;\n return {\n listBoxId,\n activeId,\n onKeyDown: withIgnoreIMEEvents(handleKeyDown),\n popover: showPopover && /*#__PURE__*/_jsx(AutocompleterUI, {\n className: className,\n filterValue: filterValue,\n instanceId: instanceId,\n listBoxId: listBoxId,\n selectedIndex: selectedIndex,\n onChangeOptions: onChangeOptions,\n onSelect: select,\n value: record,\n contentRef: contentRef,\n reset: reset\n })\n };\n}\nfunction useLastDifferentValue(value) {\n const history = useRef(new Set());\n history.current.add(value);\n\n // Keep the history size to 2.\n if (history.current.size > 2) {\n history.current.delete(Array.from(history.current)[0]);\n }\n return Array.from(history.current)[0];\n}\nexport function useAutocompleteProps(options) {\n const ref = useRef(null);\n const onKeyDownRef = useRef();\n const {\n record\n } = options;\n const previousRecord = useLastDifferentValue(record);\n const {\n popover,\n listBoxId,\n activeId,\n onKeyDown\n } = useAutocomplete({\n ...options,\n contentRef: ref\n });\n onKeyDownRef.current = onKeyDown;\n const mergedRefs = useMergeRefs([ref, useRefEffect(element => {\n function _onKeyDown(event) {\n onKeyDownRef.current?.(event);\n }\n element.addEventListener('keydown', _onKeyDown);\n return () => {\n element.removeEventListener('keydown', _onKeyDown);\n };\n }, [])]);\n\n // We only want to show the popover if the user has typed something.\n const didUserInput = record.text !== previousRecord?.text;\n if (!didUserInput) {\n return {\n ref: mergedRefs\n };\n }\n return {\n ref: mergedRefs,\n children: popover,\n 'aria-autocomplete': listBoxId ? 'list' : undefined,\n 'aria-owns': listBoxId,\n 'aria-activedescendant': activeId\n };\n}\nexport default function Autocomplete({\n children,\n isSelected,\n ...options\n}) {\n const {\n popover,\n ...props\n } = useAutocomplete(options);\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [children(props), isSelected && popover]\n });\n}"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA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O;AAAA,IACL;AAAA,IACA;AAAA,IACA,eAAW,mDAAoB,aAAa;AAAA,IAC5C,SAAS,eAA4B,uCAAAC,KAAK,iBAAiB;AAAA,MACzD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,UAAU;AAAA,MACV,OAAO;AAAA,MACP;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AACF;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { renderToString, useEffect, useState, useRef, useMemo } from '@wordpress/element';\nimport { useInstanceId, useMergeRefs, useRefEffect } from '@wordpress/compose';\nimport { create, slice, insert, isCollapsed, getTextContent } from '@wordpress/rich-text';\nimport { speak } from '@wordpress/a11y';\nimport { isAppleOS } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { getAutoCompleterUI } from './autocompleter-ui';\nimport { escapeRegExp } from '../utils/strings';\nimport { withIgnoreIMEEvents } from '../utils/with-ignore-ime-events';\nimport getNodeText from '../utils/get-node-text';\nimport { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from \"react/jsx-runtime\";\nconst EMPTY_FILTERED_OPTIONS = [];\n\n// Used for generating the instance ID\nconst AUTOCOMPLETE_HOOK_REFERENCE = {};\nexport function useAutocomplete({\n record,\n onChange,\n onReplace,\n completers,\n contentRef\n}) {\n const instanceId = useInstanceId(AUTOCOMPLETE_HOOK_REFERENCE);\n const [selectedIndex, setSelectedIndex] = useState(0);\n const [filteredOptions, setFilteredOptions] = useState(EMPTY_FILTERED_OPTIONS);\n const [filterValue, setFilterValue] = useState('');\n const [autocompleter, setAutocompleter] = useState(null);\n const [AutocompleterUI, setAutocompleterUI] = useState(null);\n const backspacingRef = useRef(false);\n function insertCompletion(replacement) {\n if (autocompleter === null) {\n return;\n }\n const end = record.start;\n const start = end - autocompleter.triggerPrefix.length - filterValue.length;\n const toInsert = create({\n html: renderToString(replacement)\n });\n onChange(insert(record, toInsert, start, end));\n }\n function select(option) {\n const {\n getOptionCompletion\n } = autocompleter || {};\n if (option.isDisabled) {\n return;\n }\n if (getOptionCompletion) {\n const completion = getOptionCompletion(option.value, filterValue);\n const isCompletionObject = obj => {\n return obj !== null && typeof obj === 'object' && 'action' in obj && obj.action !== undefined && 'value' in obj && obj.value !== undefined;\n };\n const completionObject = isCompletionObject(completion) ? completion : {\n action: 'insert-at-caret',\n value: completion\n };\n if ('replace' === completionObject.action) {\n onReplace([completionObject.value]);\n // When replacing, the component will unmount, so don't reset\n // state (below) on an unmounted component.\n return;\n } else if ('insert-at-caret' === completionObject.action) {\n insertCompletion(completionObject.value);\n }\n }\n\n // Reset autocomplete state after insertion rather than before\n // so insertion events don't cause the completion menu to redisplay.\n reset();\n\n // Make sure that the content remains focused after making a selection\n // and that the text cursor position is not lost.\n contentRef.current?.focus();\n }\n function reset() {\n setSelectedIndex(0);\n setFilteredOptions(EMPTY_FILTERED_OPTIONS);\n setFilterValue('');\n setAutocompleter(null);\n setAutocompleterUI(null);\n }\n\n /**\n * Load options for an autocompleter.\n *\n * @param {Array} options\n */\n function onChangeOptions(options) {\n setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0);\n setFilteredOptions(options);\n }\n function handleKeyDown(event) {\n backspacingRef.current = event.key === 'Backspace';\n if (!autocompleter) {\n return;\n }\n if (filteredOptions.length === 0) {\n return;\n }\n if (event.defaultPrevented) {\n return;\n }\n switch (event.key) {\n case 'ArrowUp':\n {\n const newIndex = (selectedIndex === 0 ? filteredOptions.length : selectedIndex) - 1;\n setSelectedIndex(newIndex);\n // See the related PR as to why this is necessary: https://github.com/WordPress/gutenberg/pull/54902.\n if (isAppleOS()) {\n speak(getNodeText(filteredOptions[newIndex].label), 'assertive');\n }\n break;\n }\n case 'ArrowDown':\n {\n const newIndex = (selectedIndex + 1) % filteredOptions.length;\n setSelectedIndex(newIndex);\n if (isAppleOS()) {\n speak(getNodeText(filteredOptions[newIndex].label), 'assertive');\n }\n break;\n }\n case 'Escape':\n setAutocompleter(null);\n setAutocompleterUI(null);\n event.preventDefault();\n break;\n case 'Enter':\n select(filteredOptions[selectedIndex]);\n break;\n case 'ArrowLeft':\n case 'ArrowRight':\n reset();\n return;\n default:\n return;\n }\n\n // Any handled key should prevent original behavior. This relies on\n // the early return in the default case.\n event.preventDefault();\n }\n\n // textContent is a primitive (string), memoizing is not strictly necessary\n // but this is a preemptive performance improvement, since the autocompleter\n // is a potential bottleneck for the editor type metric.\n const textContent = useMemo(() => {\n if (isCollapsed(record)) {\n return getTextContent(slice(record, 0));\n }\n return '';\n }, [record]);\n useEffect(() => {\n if (!textContent) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n\n // Find the completer with the highest triggerPrefix index in the\n // textContent.\n const completer = completers.reduce((lastTrigger, currentCompleter) => {\n const triggerIndex = textContent.lastIndexOf(currentCompleter.triggerPrefix);\n const lastTriggerIndex = lastTrigger !== null ? textContent.lastIndexOf(lastTrigger.triggerPrefix) : -1;\n return triggerIndex > lastTriggerIndex ? currentCompleter : lastTrigger;\n }, null);\n if (!completer) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n const {\n allowContext,\n triggerPrefix\n } = completer;\n const triggerIndex = textContent.lastIndexOf(triggerPrefix);\n const textWithoutTrigger = textContent.slice(triggerIndex + triggerPrefix.length);\n const tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.\n // This is a final barrier to prevent the effect from completing with\n // an extremely long string, which causes the editor to slow-down\n // significantly. This could happen, for example, if `matchingWhileBackspacing`\n // is true and one of the \"words\" end up being too long. If that's the case,\n // it will be caught by this guard.\n if (tooDistantFromTrigger) {\n return;\n }\n const mismatch = filteredOptions.length === 0;\n const wordsFromTrigger = textWithoutTrigger.split(/\\s/);\n // We need to allow the effect to run when not backspacing and if there\n // was a mismatch. i.e when typing a trigger + the match string or when\n // clicking in an existing trigger word on the page. We do that if we\n // detect that we have one word from trigger in the current textual context.\n //\n // Ex.: \"Some text @a\" <-- \"@a\" will be detected as the trigger word and\n // allow the effect to run. It will run until there's a mismatch.\n const hasOneTriggerWord = wordsFromTrigger.length === 1;\n // This is used to allow the effect to run when backspacing and if\n // \"touching\" a word that \"belongs\" to a trigger. We consider a \"trigger\n // word\" any word up to the limit of 3 from the trigger character.\n // Anything beyond that is ignored if there's a mismatch. This allows\n // us to \"escape\" a mismatch when backspacing, but still imposing some\n // sane limits.\n //\n // Ex: \"Some text @marcelo sekkkk\" <--- \"kkkk\" caused a mismatch, but\n // if the user presses backspace here, it will show the completion popup again.\n const matchingWhileBackspacing = backspacingRef.current && wordsFromTrigger.length <= 3;\n if (mismatch && !(matchingWhileBackspacing || hasOneTriggerWord)) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n const textAfterSelection = getTextContent(slice(record, undefined, getTextContent(record).length));\n if (allowContext && !allowContext(textContent.slice(0, triggerIndex), textAfterSelection)) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n if (/^\\s/.test(textWithoutTrigger) || /\\s\\s+$/.test(textWithoutTrigger)) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n if (!/[\\u0000-\\uFFFF]*$/.test(textWithoutTrigger)) {\n if (autocompleter) {\n reset();\n }\n return;\n }\n const safeTrigger = escapeRegExp(completer.triggerPrefix);\n const text = removeAccents(textContent);\n const match = text.slice(text.lastIndexOf(completer.triggerPrefix)).match(new RegExp(`${safeTrigger}([\\u0000-\\uFFFF]*)$`));\n const query = match && match[1];\n setAutocompleter(completer);\n setAutocompleterUI(() => completer !== autocompleter ? getAutoCompleterUI(completer) : AutocompleterUI);\n setFilterValue(query === null ? '' : query);\n // We want to avoid introducing unexpected side effects.\n // See https://github.com/WordPress/gutenberg/pull/41820\n }, [textContent]);\n const {\n key: selectedKey = ''\n } = filteredOptions[selectedIndex] || {};\n const {\n className\n } = autocompleter || {};\n const isExpanded = !!autocompleter && filteredOptions.length > 0;\n const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` : undefined;\n const activeId = isExpanded ? `components-autocomplete-item-${instanceId}-${selectedKey}` : null;\n const hasSelection = record.start !== undefined;\n const showPopover = !!textContent && hasSelection && !!AutocompleterUI;\n return {\n listBoxId,\n activeId,\n onKeyDown: withIgnoreIMEEvents(handleKeyDown),\n popover: showPopover && /*#__PURE__*/_jsx(AutocompleterUI, {\n className: className,\n filterValue: filterValue,\n instanceId: instanceId,\n listBoxId: listBoxId,\n selectedIndex: selectedIndex,\n onChangeOptions: onChangeOptions,\n onSelect: select,\n value: record,\n contentRef: contentRef,\n reset: reset\n })\n };\n}\n\n/**\n * Checks whether two records represent the same user-visible state\n * (same text content and cursor position).\n */\nfunction recordValuesMatch(a, b) {\n return a.text === b.text && a.start === b.start && a.end === b.end;\n}\n\n/**\n * Tracks the last record whose value differed from the current one.\n * Used to determine whether the user has actually typed something\n */\nexport function useLastDifferentValue(value) {\n const history = useRef([]);\n const lastEntry = history.current[history.current.length - 1];\n\n // Only add to history if the value is meaningfully different from\n // the most recent entry (analogous to Set.add being a no-op for\n // duplicate references in the original implementation).\n if (!lastEntry || !recordValuesMatch(value, lastEntry)) {\n history.current.push(value);\n }\n\n // Keep the history size to 2.\n if (history.current.length > 2) {\n history.current.shift();\n }\n return history.current[0];\n}\nexport function useAutocompleteProps(options) {\n const ref = useRef(null);\n const onKeyDownRef = useRef(undefined);\n const {\n record\n } = options;\n const previousRecord = useLastDifferentValue(record);\n const {\n popover,\n listBoxId,\n activeId,\n onKeyDown\n } = useAutocomplete({\n ...options,\n contentRef: ref\n });\n onKeyDownRef.current = onKeyDown;\n const mergedRefs = useMergeRefs([ref, useRefEffect(element => {\n function _onKeyDown(event) {\n onKeyDownRef.current?.(event);\n }\n element.addEventListener('keydown', _onKeyDown);\n return () => {\n element.removeEventListener('keydown', _onKeyDown);\n };\n }, [])]);\n\n // We only want to show the popover if the user has typed something.\n const didUserInput = record.text !== previousRecord?.text;\n if (!didUserInput) {\n return {\n ref: mergedRefs\n };\n }\n return {\n ref: mergedRefs,\n children: popover,\n 'aria-autocomplete': listBoxId ? 'list' : undefined,\n 'aria-owns': listBoxId,\n 'aria-activedescendant': activeId\n };\n}\nexport default function Autocomplete({\n children,\n isSelected,\n ...options\n}) {\n const {\n popover,\n ...props\n } = useAutocomplete(options);\n return /*#__PURE__*/_jsxs(_Fragment, {\n children: [children(props), isSelected && popover]\n });\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,4BAA0B;AAK1B,qBAAqE;AACrE,qBAA0D;AAC1D,uBAAmE;AACnE,kBAAsB;AACtB,sBAA0B;AAK1B,8BAAmC;AACnC,qBAA6B;AAC7B,oCAAoC;AACpC,2BAAwB;AACxB,yBAAkE;AAClE,IAAM,yBAAyB,CAAC;AAGhC,IAAM,8BAA8B,CAAC;AAC9B,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,iBAAa,8BAAc,2BAA2B;AAC5D,QAAM,CAAC,eAAe,gBAAgB,QAAI,yBAAS,CAAC;AACpD,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,yBAAS,sBAAsB;AAC7E,QAAM,CAAC,aAAa,cAAc,QAAI,yBAAS,EAAE;AACjD,QAAM,CAAC,eAAe,gBAAgB,QAAI,yBAAS,IAAI;AACvD,QAAM,CAAC,iBAAiB,kBAAkB,QAAI,yBAAS,IAAI;AAC3D,QAAM,qBAAiB,uBAAO,KAAK;AACnC,WAAS,iBAAiB,aAAa;AACrC,QAAI,kBAAkB,MAAM;AAC1B;AAAA,IACF;AACA,UAAM,MAAM,OAAO;AACnB,UAAM,QAAQ,MAAM,cAAc,cAAc,SAAS,YAAY;AACrE,UAAM,eAAW,yBAAO;AAAA,MACtB,UAAM,+BAAe,WAAW;AAAA,IAClC,CAAC;AACD,iBAAS,yBAAO,QAAQ,UAA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AAM;AACnD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,gBAAgB;AAAA,IAClB,GAAG;AAAA,IACH,YAAY;AAAA,EACd,CAAC;AACD,eAAa,UAAU;AACvB,QAAM,iBAAa,6BAAa,CAAC,SAAK,6BAAa,aAAW;AAC5D,aAAS,WAAW,OAAO;AACzB,mBAAa,UAAU,KAAK;AAAA,IAC9B;AACA,YAAQ,iBAAiB,WAAW,UAAU;AAC9C,WAAO,MAAM;AACX,cAAQ,oBAAoB,WAAW,UAAU;AAAA,IACnD;AAAA,EACF,GAAG,CAAC,CAAC,CAAC,CAAC;AAGP,QAAM,eAAe,OAAO,SAAS,gBAAgB;AACrD,MAAI,CAAC,cAAc;AACjB,WAAO;AAAA,MACL,KAAK;AAAA,IACP;AAAA,EACF;AACA,SAAO;AAAA,IACL,KAAK;AAAA,IACL,UAAU;AAAA,IACV,qBAAqB,YAAY,SAAS;AAAA,IAC1C,aAAa;AAAA,IACb,yBAAyB;AAAA,EAC3B;AACF;AACe,SAAR,aAA8B;AAAA,EACnC;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM;AAAA,IACJ;AAAA,IACA,GAAG;AAAA,EACL,IAAI,gBAAgB,OAAO;AAC3B,SAAoB,uCAAAC,MAAM,mBAAAC,UAAW;AAAA,IACnC,UAAU,CAAC,SAAS,KAAK,GAAG,cAAc,OAAO;AAAA,EACnD,CAAC;AACH;",
|
|
6
6
|
"names": ["getNodeText", "triggerIndex", "removeAccents", "_jsx", "_jsxs", "_Fragment"]
|
|
7
7
|
}
|
|
@@ -52,7 +52,7 @@ function ClipboardButton({
|
|
|
52
52
|
since: "5.8",
|
|
53
53
|
alternative: "wp.compose.useCopyToClipboard"
|
|
54
54
|
});
|
|
55
|
-
const timeoutIdRef = (0, import_element.useRef)();
|
|
55
|
+
const timeoutIdRef = (0, import_element.useRef)(void 0);
|
|
56
56
|
const ref = (0, import_compose.useCopyToClipboard)(text, () => {
|
|
57
57
|
onCopy();
|
|
58
58
|
if (timeoutIdRef.current) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/clipboard-button/index.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst TIMEOUT = 4000;\nexport default function ClipboardButton({\n className,\n children,\n onCopy,\n onFinishCopy,\n text,\n ...buttonProps\n}) {\n deprecated('wp.components.ClipboardButton', {\n since: '5.8',\n alternative: 'wp.compose.useCopyToClipboard'\n });\n const timeoutIdRef = useRef();\n const ref = useCopyToClipboard(text, () => {\n onCopy();\n if (timeoutIdRef.current) {\n clearTimeout(timeoutIdRef.current);\n }\n if (onFinishCopy) {\n timeoutIdRef.current = setTimeout(() => onFinishCopy(), TIMEOUT);\n }\n });\n useEffect(() => {\n return () => {\n if (timeoutIdRef.current) {\n clearTimeout(timeoutIdRef.current);\n }\n };\n }, []);\n const classes = clsx('components-clipboard-button', className);\n\n // Workaround for inconsistent behavior in Safari, where <textarea> is not\n // the document.activeElement at the moment when the copy event fires.\n // This causes documentHasSelection() in the copy-handler component to\n // mistakenly override the ClipboardButton, and copy a serialized string\n // of the current block instead.\n const focusOnCopyEventTarget = event => {\n // @ts-expect-error: Should be currentTarget, but not changing because this component is deprecated.\n event.target.focus();\n };\n return (\n /*#__PURE__*/\n // Disable reasons: the parent component takes care of the __next40pxDefaultSize prop.\n // eslint-disable-next-line @wordpress/components-no-missing-40px-size-prop\n _jsx(Button, {\n ...buttonProps,\n className: classes,\n ref: ref,\n onCopy: focusOnCopyEventTarget,\n children: children\n })\n );\n}"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAkC;AAClC,qBAAmC;AACnC,wBAAuB;AAKvB,oBAAmB;AACnB,yBAA4B;AAC5B,IAAM,UAAU;AACD,SAAR,gBAAiC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,wBAAAA,SAAW,iCAAiC;AAAA,IAC1C,OAAO;AAAA,IACP,aAAa;AAAA,EACf,CAAC;AACD,QAAM,mBAAe,uBAAO;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst TIMEOUT = 4000;\nexport default function ClipboardButton({\n className,\n children,\n onCopy,\n onFinishCopy,\n text,\n ...buttonProps\n}) {\n deprecated('wp.components.ClipboardButton', {\n since: '5.8',\n alternative: 'wp.compose.useCopyToClipboard'\n });\n const timeoutIdRef = useRef(undefined);\n const ref = useCopyToClipboard(text, () => {\n onCopy();\n if (timeoutIdRef.current) {\n clearTimeout(timeoutIdRef.current);\n }\n if (onFinishCopy) {\n timeoutIdRef.current = setTimeout(() => onFinishCopy(), TIMEOUT);\n }\n });\n useEffect(() => {\n return () => {\n if (timeoutIdRef.current) {\n clearTimeout(timeoutIdRef.current);\n }\n };\n }, []);\n const classes = clsx('components-clipboard-button', className);\n\n // Workaround for inconsistent behavior in Safari, where <textarea> is not\n // the document.activeElement at the moment when the copy event fires.\n // This causes documentHasSelection() in the copy-handler component to\n // mistakenly override the ClipboardButton, and copy a serialized string\n // of the current block instead.\n const focusOnCopyEventTarget = event => {\n // @ts-expect-error: Should be currentTarget, but not changing because this component is deprecated.\n event.target.focus();\n };\n return (\n /*#__PURE__*/\n // Disable reasons: the parent component takes care of the __next40pxDefaultSize prop.\n // eslint-disable-next-line @wordpress/components-no-missing-40px-size-prop\n _jsx(Button, {\n ...buttonProps,\n className: classes,\n ref: ref,\n onCopy: focusOnCopyEventTarget,\n children: children\n })\n );\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAkC;AAClC,qBAAmC;AACnC,wBAAuB;AAKvB,oBAAmB;AACnB,yBAA4B;AAC5B,IAAM,UAAU;AACD,SAAR,gBAAiC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAG;AACD,wBAAAA,SAAW,iCAAiC;AAAA,IAC1C,OAAO;AAAA,IACP,aAAa;AAAA,EACf,CAAC;AACD,QAAM,mBAAe,uBAAO,MAAS;AACrC,QAAM,UAAM,mCAAmB,MAAM,MAAM;AACzC,WAAO;AACP,QAAI,aAAa,SAAS;AACxB,mBAAa,aAAa,OAAO;AAAA,IACnC;AACA,QAAI,cAAc;AAChB,mBAAa,UAAU,WAAW,MAAM,aAAa,GAAG,OAAO;AAAA,IACjE;AAAA,EACF,CAAC;AACD,gCAAU,MAAM;AACd,WAAO,MAAM;AACX,UAAI,aAAa,SAAS;AACxB,qBAAa,aAAa,OAAO;AAAA,MACnC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,CAAC;AACL,QAAM,cAAU,YAAAC,SAAK,+BAA+B,SAAS;AAO7D,QAAM,yBAAyB,WAAS;AAEtC,UAAM,OAAO,MAAM;AAAA,EACrB;AACA;AAAA;AAAA;AAAA,IAIE,uCAAAC,KAAK,cAAAC,SAAQ;AAAA,MACX,GAAG;AAAA,MACH,WAAW;AAAA,MACX;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,IACF,CAAC;AAAA;AAEL;",
|
|
6
6
|
"names": ["deprecated", "clsx", "_jsx", "Button"]
|
|
7
7
|
}
|
|
@@ -46,7 +46,7 @@ var ColorCopyButton = (props) => {
|
|
|
46
46
|
colorType
|
|
47
47
|
} = props;
|
|
48
48
|
const [copiedColor, setCopiedColor] = (0, import_element.useState)(null);
|
|
49
|
-
const copyTimerRef = (0, import_element.useRef)();
|
|
49
|
+
const copyTimerRef = (0, import_element.useRef)(void 0);
|
|
50
50
|
const copyRef = (0, import_compose.useCopyToClipboard)(() => {
|
|
51
51
|
switch (colorType) {
|
|
52
52
|
case "hsl": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/color-picker/color-copy-button.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { copy, check } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { Button } from '../button';\nimport Tooltip from '../tooltip';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ColorCopyButton = props => {\n const {\n color,\n colorType\n } = props;\n const [copiedColor, setCopiedColor] = useState(null);\n const copyTimerRef = useRef();\n const copyRef = useCopyToClipboard(() => {\n switch (colorType) {\n case 'hsl':\n {\n return color.toHslString();\n }\n case 'rgb':\n {\n return color.toRgbString();\n }\n default:\n case 'hex':\n {\n return color.toHex();\n }\n }\n }, () => {\n if (copyTimerRef.current) {\n clearTimeout(copyTimerRef.current);\n }\n setCopiedColor(color.toHex());\n copyTimerRef.current = setTimeout(() => {\n setCopiedColor(null);\n copyTimerRef.current = undefined;\n }, 3000);\n });\n useEffect(() => {\n // Clear copyTimerRef on component unmount.\n return () => {\n if (copyTimerRef.current) {\n clearTimeout(copyTimerRef.current);\n }\n };\n }, []);\n const isCopied = copiedColor === color.toHex();\n const label = isCopied ? __('Copied!') : __('Copy');\n return /*#__PURE__*/_jsx(Tooltip, {\n delay: 0,\n hideOnClick: false,\n text: label,\n children: /*#__PURE__*/_jsx(Button, {\n size: \"compact\",\n \"aria-label\": label,\n ref: copyRef,\n icon: isCopied ? check : copy,\n showTooltip: false\n })\n });\n};"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAmC;AACnC,qBAA4C;AAC5C,mBAA4B;AAC5B,kBAAmB;AAKnB,oBAAuB;AACvB,qBAAoB;AACpB,yBAA4B;AACrB,IAAM,kBAAkB,WAAS;AACtC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,aAAa,cAAc,QAAI,yBAAS,IAAI;AACnD,QAAM,mBAAe,uBAAO;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCopyToClipboard } from '@wordpress/compose';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport { copy, check } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { Button } from '../button';\nimport Tooltip from '../tooltip';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ColorCopyButton = props => {\n const {\n color,\n colorType\n } = props;\n const [copiedColor, setCopiedColor] = useState(null);\n const copyTimerRef = useRef(undefined);\n const copyRef = useCopyToClipboard(() => {\n switch (colorType) {\n case 'hsl':\n {\n return color.toHslString();\n }\n case 'rgb':\n {\n return color.toRgbString();\n }\n default:\n case 'hex':\n {\n return color.toHex();\n }\n }\n }, () => {\n if (copyTimerRef.current) {\n clearTimeout(copyTimerRef.current);\n }\n setCopiedColor(color.toHex());\n copyTimerRef.current = setTimeout(() => {\n setCopiedColor(null);\n copyTimerRef.current = undefined;\n }, 3000);\n });\n useEffect(() => {\n // Clear copyTimerRef on component unmount.\n return () => {\n if (copyTimerRef.current) {\n clearTimeout(copyTimerRef.current);\n }\n };\n }, []);\n const isCopied = copiedColor === color.toHex();\n const label = isCopied ? __('Copied!') : __('Copy');\n return /*#__PURE__*/_jsx(Tooltip, {\n delay: 0,\n hideOnClick: false,\n text: label,\n children: /*#__PURE__*/_jsx(Button, {\n size: \"compact\",\n \"aria-label\": label,\n ref: copyRef,\n icon: isCopied ? check : copy,\n showTooltip: false\n })\n });\n};"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAmC;AACnC,qBAA4C;AAC5C,mBAA4B;AAC5B,kBAAmB;AAKnB,oBAAuB;AACvB,qBAAoB;AACpB,yBAA4B;AACrB,IAAM,kBAAkB,WAAS;AACtC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,CAAC,aAAa,cAAc,QAAI,yBAAS,IAAI;AACnD,QAAM,mBAAe,uBAAO,MAAS;AACrC,QAAM,cAAU,mCAAmB,MAAM;AACvC,YAAQ,WAAW;AAAA,MACjB,KAAK,OACH;AACE,eAAO,MAAM,YAAY;AAAA,MAC3B;AAAA,MACF,KAAK,OACH;AACE,eAAO,MAAM,YAAY;AAAA,MAC3B;AAAA,MACF;AAAA,MACA,KAAK,OACH;AACE,eAAO,MAAM,MAAM;AAAA,MACrB;AAAA,IACJ;AAAA,EACF,GAAG,MAAM;AACP,QAAI,aAAa,SAAS;AACxB,mBAAa,aAAa,OAAO;AAAA,IACnC;AACA,mBAAe,MAAM,MAAM,CAAC;AAC5B,iBAAa,UAAU,WAAW,MAAM;AACtC,qBAAe,IAAI;AACnB,mBAAa,UAAU;AAAA,IACzB,GAAG,GAAI;AAAA,EACT,CAAC;AACD,gCAAU,MAAM;AAEd,WAAO,MAAM;AACX,UAAI,aAAa,SAAS;AACxB,qBAAa,aAAa,OAAO;AAAA,MACnC;AAAA,IACF;AAAA,EACF,GAAG,CAAC,CAAC;AACL,QAAM,WAAW,gBAAgB,MAAM,MAAM;AAC7C,QAAM,QAAQ,eAAW,gBAAG,SAAS,QAAI,gBAAG,MAAM;AAClD,SAAoB,uCAAAA,KAAK,eAAAC,SAAS;AAAA,IAChC,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAuB,uCAAAD,KAAK,sBAAQ;AAAA,MAClC,MAAM;AAAA,MACN,cAAc;AAAA,MACd,KAAK;AAAA,MACL,MAAM,WAAW,qBAAQ;AAAA,MACzB,aAAa;AAAA,IACf,CAAC;AAAA,EACH,CAAC;AACH;",
|
|
6
6
|
"names": ["_jsx", "Tooltip"]
|
|
7
7
|
}
|
|
@@ -58,8 +58,8 @@ var UnconnectedConfirmDialog = (props, forwardedRef) => {
|
|
|
58
58
|
} = (0, import_context.useContextSystem)(props, "ConfirmDialog");
|
|
59
59
|
const cx = (0, import_use_cx.useCx)();
|
|
60
60
|
const wrapperClassName = cx(styles.wrapper);
|
|
61
|
-
const cancelButtonRef = (0, import_element.useRef)();
|
|
62
|
-
const confirmButtonRef = (0, import_element.useRef)();
|
|
61
|
+
const cancelButtonRef = (0, import_element.useRef)(null);
|
|
62
|
+
const confirmButtonRef = (0, import_element.useRef)(null);
|
|
63
63
|
const [isOpen, setIsOpen] = (0, import_element.useState)();
|
|
64
64
|
const [shouldSelfClose, setShouldSelfClose] = (0, import_element.useState)();
|
|
65
65
|
(0, import_element.useEffect)(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/confirm-dialog/component.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Modal from '../modal';\nimport { useContextSystem, contextConnect } from '../context';\nimport { Flex } from '../flex';\nimport Button from '../button';\nimport { Text } from '../text';\nimport { VStack } from '../v-stack';\nimport * as styles from './styles';\nimport { useCx } from '../utils/hooks/use-cx';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst UnconnectedConfirmDialog = (props, forwardedRef) => {\n const {\n isOpen: isOpenProp,\n onConfirm,\n onCancel,\n children,\n confirmButtonText,\n cancelButtonText,\n isBusy,\n ...otherProps\n } = useContextSystem(props, 'ConfirmDialog');\n const cx = useCx();\n const wrapperClassName = cx(styles.wrapper);\n const cancelButtonRef = useRef();\n const confirmButtonRef = useRef();\n const [isOpen, setIsOpen] = useState();\n const [shouldSelfClose, setShouldSelfClose] = useState();\n useEffect(() => {\n // We only allow the dialog to close itself if `isOpenProp` is *not* set.\n // If `isOpenProp` is set, then it (probably) means it's controlled by a\n // parent component. In that case, `shouldSelfClose` might do more harm than\n // good, so we disable it.\n const isIsOpenSet = typeof isOpenProp !== 'undefined';\n setIsOpen(isIsOpenSet ? isOpenProp : true);\n setShouldSelfClose(!isIsOpenSet);\n }, [isOpenProp]);\n const handleEvent = useCallback(callback => event => {\n callback?.(event);\n if (shouldSelfClose) {\n setIsOpen(false);\n }\n }, [shouldSelfClose, setIsOpen]);\n const handleEnter = useCallback(event => {\n // Avoid triggering the 'confirm' action when a button is focused,\n // as this can cause a double submission.\n const isConfirmOrCancelButton = event.target === cancelButtonRef.current || event.target === confirmButtonRef.current;\n if (!isConfirmOrCancelButton && event.key === 'Enter') {\n handleEvent(onConfirm)(event);\n }\n }, [handleEvent, onConfirm]);\n const cancelLabel = cancelButtonText ?? __('Cancel');\n const confirmLabel = confirmButtonText ?? __('OK');\n return /*#__PURE__*/_jsx(_Fragment, {\n children: isOpen && /*#__PURE__*/_jsx(Modal, {\n onRequestClose: handleEvent(onCancel),\n onKeyDown: handleEnter,\n closeButtonLabel: cancelLabel,\n isDismissible: true,\n ref: forwardedRef,\n overlayClassName: wrapperClassName,\n __experimentalHideHeader: true,\n ...otherProps,\n children: /*#__PURE__*/_jsxs(VStack, {\n spacing: 8,\n children: [/*#__PURE__*/_jsx(Text, {\n children: children\n }), /*#__PURE__*/_jsxs(Flex, {\n direction: \"row\",\n justify: \"flex-end\",\n children: [/*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n ref: cancelButtonRef,\n variant: \"tertiary\",\n onClick: handleEvent(onCancel),\n accessibleWhenDisabled: true,\n disabled: isBusy,\n children: cancelLabel\n }), /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n ref: confirmButtonRef,\n variant: \"primary\",\n onClick: handleEvent(onConfirm),\n accessibleWhenDisabled: true,\n disabled: isBusy,\n isBusy: isBusy,\n children: confirmLabel\n })]\n })]\n })\n })\n });\n};\n\n/**\n * `ConfirmDialog` is built of top of [`Modal`](/packages/components/src/modal/README.md)\n * and displays a confirmation dialog, with _confirm_ and _cancel_ buttons.\n * The dialog is confirmed by clicking the _confirm_ button or by pressing the `Enter` key.\n * It is cancelled (closed) by clicking the _cancel_ button, by pressing the `ESC` key, or by\n * clicking outside the dialog focus (i.e, the overlay).\n *\n * `ConfirmDialog` has two main implicit modes: controlled and uncontrolled.\n *\n * UnControlled:\n *\n * Allows the component to be used standalone, just by declaring it as part of another React's component render method:\n * - It will be automatically open (displayed) upon mounting;\n * - It will be automatically closed when clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay);\n * - `onCancel` is not mandatory but can be passed. Even if passed, the dialog will still be able to close itself.\n *\n * Activating this mode is as simple as omitting the `isOpen` prop. The only mandatory prop, in this case, is the `onConfirm` callback. The message is passed as the `children`. You can pass any JSX you'd like, which allows to further format the message or include sub-component if you'd like:\n *\n * ```jsx\n * import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n *\n * function Example() {\n * \treturn (\n * \t\t<ConfirmDialog onConfirm={ () => console.debug( ' Confirmed! ' ) }>\n * \t\t\tAre you sure? <strong>This action cannot be undone!</strong>\n * \t\t</ConfirmDialog>\n * \t);\n * }\n * ```\n *\n *\n * Controlled mode:\n * Let the parent component control when the dialog is open/closed. It's activated when a\n * boolean value is passed to `isOpen`:\n * - It will not be automatically closed. You need to let it know when to open/close by updating the value of the `isOpen` prop;\n * - Both `onConfirm` and the `onCancel` callbacks are mandatory props in this mode;\n * - You'll want to update the state that controls `isOpen` by updating it from the `onCancel` and `onConfirm` callbacks.\n *\n *```jsx\n * import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * function Example() {\n * \tconst [ isOpen, setIsOpen ] = useState( true );\n *\n * \tconst handleConfirm = () => {\n * \t\tconsole.debug( 'Confirmed!' );\n * \t\tsetIsOpen( false );\n * \t};\n *\n * \tconst handleCancel = () => {\n * \t\tconsole.debug( 'Cancelled!' );\n * \t\tsetIsOpen( false );\n * \t};\n *\n * \treturn (\n * \t\t<ConfirmDialog\n * \t\t\tisOpen={ isOpen }\n * \t\t\tonConfirm={ handleConfirm }\n * \t\t\tonCancel={ handleCancel }\n * \t\t>\n * \t\t\tAre you sure? <strong>This action cannot be undone!</strong>\n * \t\t</ConfirmDialog>\n * \t);\n * }\n * ```\n */\nexport const ConfirmDialog = contextConnect(UnconnectedConfirmDialog, 'ConfirmDialog');\nexport default ConfirmDialog;"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,qBAAyD;AAKzD,mBAAkB;AAClB,qBAAiD;AACjD,kBAAqB;AACrB,oBAAmB;AACnB,kBAAqB;AACrB,qBAAuB;AACvB,aAAwB;AACxB,oBAAsB;AACtB,yBAAkE;AAClE,IAAM,2BAA2B,CAAC,OAAO,iBAAiB;AACxD,QAAM;AAAA,IACJ,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,QAAI,iCAAiB,OAAO,eAAe;AAC3C,QAAM,SAAK,qBAAM;AACjB,QAAM,mBAAmB,GAAU,cAAO;AAC1C,QAAM,sBAAkB,uBAAO;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useEffect, useRef, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Modal from '../modal';\nimport { useContextSystem, contextConnect } from '../context';\nimport { Flex } from '../flex';\nimport Button from '../button';\nimport { Text } from '../text';\nimport { VStack } from '../v-stack';\nimport * as styles from './styles';\nimport { useCx } from '../utils/hooks/use-cx';\nimport { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nconst UnconnectedConfirmDialog = (props, forwardedRef) => {\n const {\n isOpen: isOpenProp,\n onConfirm,\n onCancel,\n children,\n confirmButtonText,\n cancelButtonText,\n isBusy,\n ...otherProps\n } = useContextSystem(props, 'ConfirmDialog');\n const cx = useCx();\n const wrapperClassName = cx(styles.wrapper);\n const cancelButtonRef = useRef(null);\n const confirmButtonRef = useRef(null);\n const [isOpen, setIsOpen] = useState();\n const [shouldSelfClose, setShouldSelfClose] = useState();\n useEffect(() => {\n // We only allow the dialog to close itself if `isOpenProp` is *not* set.\n // If `isOpenProp` is set, then it (probably) means it's controlled by a\n // parent component. In that case, `shouldSelfClose` might do more harm than\n // good, so we disable it.\n const isIsOpenSet = typeof isOpenProp !== 'undefined';\n setIsOpen(isIsOpenSet ? isOpenProp : true);\n setShouldSelfClose(!isIsOpenSet);\n }, [isOpenProp]);\n const handleEvent = useCallback(callback => event => {\n callback?.(event);\n if (shouldSelfClose) {\n setIsOpen(false);\n }\n }, [shouldSelfClose, setIsOpen]);\n const handleEnter = useCallback(event => {\n // Avoid triggering the 'confirm' action when a button is focused,\n // as this can cause a double submission.\n const isConfirmOrCancelButton = event.target === cancelButtonRef.current || event.target === confirmButtonRef.current;\n if (!isConfirmOrCancelButton && event.key === 'Enter') {\n handleEvent(onConfirm)(event);\n }\n }, [handleEvent, onConfirm]);\n const cancelLabel = cancelButtonText ?? __('Cancel');\n const confirmLabel = confirmButtonText ?? __('OK');\n return /*#__PURE__*/_jsx(_Fragment, {\n children: isOpen && /*#__PURE__*/_jsx(Modal, {\n onRequestClose: handleEvent(onCancel),\n onKeyDown: handleEnter,\n closeButtonLabel: cancelLabel,\n isDismissible: true,\n ref: forwardedRef,\n overlayClassName: wrapperClassName,\n __experimentalHideHeader: true,\n ...otherProps,\n children: /*#__PURE__*/_jsxs(VStack, {\n spacing: 8,\n children: [/*#__PURE__*/_jsx(Text, {\n children: children\n }), /*#__PURE__*/_jsxs(Flex, {\n direction: \"row\",\n justify: \"flex-end\",\n children: [/*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n ref: cancelButtonRef,\n variant: \"tertiary\",\n onClick: handleEvent(onCancel),\n accessibleWhenDisabled: true,\n disabled: isBusy,\n children: cancelLabel\n }), /*#__PURE__*/_jsx(Button, {\n __next40pxDefaultSize: true,\n ref: confirmButtonRef,\n variant: \"primary\",\n onClick: handleEvent(onConfirm),\n accessibleWhenDisabled: true,\n disabled: isBusy,\n isBusy: isBusy,\n children: confirmLabel\n })]\n })]\n })\n })\n });\n};\n\n/**\n * `ConfirmDialog` is built of top of [`Modal`](/packages/components/src/modal/README.md)\n * and displays a confirmation dialog, with _confirm_ and _cancel_ buttons.\n * The dialog is confirmed by clicking the _confirm_ button or by pressing the `Enter` key.\n * It is cancelled (closed) by clicking the _cancel_ button, by pressing the `ESC` key, or by\n * clicking outside the dialog focus (i.e, the overlay).\n *\n * `ConfirmDialog` has two main implicit modes: controlled and uncontrolled.\n *\n * UnControlled:\n *\n * Allows the component to be used standalone, just by declaring it as part of another React's component render method:\n * - It will be automatically open (displayed) upon mounting;\n * - It will be automatically closed when clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay);\n * - `onCancel` is not mandatory but can be passed. Even if passed, the dialog will still be able to close itself.\n *\n * Activating this mode is as simple as omitting the `isOpen` prop. The only mandatory prop, in this case, is the `onConfirm` callback. The message is passed as the `children`. You can pass any JSX you'd like, which allows to further format the message or include sub-component if you'd like:\n *\n * ```jsx\n * import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n *\n * function Example() {\n * \treturn (\n * \t\t<ConfirmDialog onConfirm={ () => console.debug( ' Confirmed! ' ) }>\n * \t\t\tAre you sure? <strong>This action cannot be undone!</strong>\n * \t\t</ConfirmDialog>\n * \t);\n * }\n * ```\n *\n *\n * Controlled mode:\n * Let the parent component control when the dialog is open/closed. It's activated when a\n * boolean value is passed to `isOpen`:\n * - It will not be automatically closed. You need to let it know when to open/close by updating the value of the `isOpen` prop;\n * - Both `onConfirm` and the `onCancel` callbacks are mandatory props in this mode;\n * - You'll want to update the state that controls `isOpen` by updating it from the `onCancel` and `onConfirm` callbacks.\n *\n *```jsx\n * import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * function Example() {\n * \tconst [ isOpen, setIsOpen ] = useState( true );\n *\n * \tconst handleConfirm = () => {\n * \t\tconsole.debug( 'Confirmed!' );\n * \t\tsetIsOpen( false );\n * \t};\n *\n * \tconst handleCancel = () => {\n * \t\tconsole.debug( 'Cancelled!' );\n * \t\tsetIsOpen( false );\n * \t};\n *\n * \treturn (\n * \t\t<ConfirmDialog\n * \t\t\tisOpen={ isOpen }\n * \t\t\tonConfirm={ handleConfirm }\n * \t\t\tonCancel={ handleCancel }\n * \t\t>\n * \t\t\tAre you sure? <strong>This action cannot be undone!</strong>\n * \t\t</ConfirmDialog>\n * \t);\n * }\n * ```\n */\nexport const ConfirmDialog = contextConnect(UnconnectedConfirmDialog, 'ConfirmDialog');\nexport default ConfirmDialog;"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,qBAAyD;AAKzD,mBAAkB;AAClB,qBAAiD;AACjD,kBAAqB;AAC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;AAAA,MACpC,WAAW;AAAA,MACX,kBAAkB;AAAA,MAClB,eAAe;AAAA,MACf,KAAK;AAAA,MACL,kBAAkB;AAAA,MAClB,0BAA0B;AAAA,MAC1B,GAAG;AAAA,MACH,UAAuB,uCAAAC,MAAM,uBAAQ;AAAA,QACnC,SAAS;AAAA,QACT,UAAU,CAAc,uCAAAH,KAAK,kBAAM;AAAA,UACjC;AAAA,QACF,CAAC,GAAgB,uCAAAG,MAAM,kBAAM;AAAA,UAC3B,WAAW;AAAA,UACX,SAAS;AAAA,UACT,UAAU,CAAc,uCAAAH,KAAK,cAAAI,SAAQ;AAAA,YACnC,uBAAuB;AAAA,YACvB,KAAK;AAAA,YACL,SAAS;AAAA,YACT,SAAS,YAAY,QAAQ;AAAA,YAC7B,wBAAwB;AAAA,YACxB,UAAU;AAAA,YACV,UAAU;AAAA,UACZ,CAAC,GAAgB,uCAAAJ,KAAK,cAAAI,SAAQ;AAAA,YAC5B,uBAAuB;AAAA,YACvB,KAAK;AAAA,YACL,SAAS;AAAA,YACT,SAAS,YAAY,SAAS;AAAA,YAC9B,wBAAwB;AAAA,YACxB,UAAU;AAAA,YACV;AAAA,YACA,UAAU;AAAA,UACZ,CAAC,CAAC;AAAA,QACJ,CAAC,CAAC;AAAA,MACJ,CAAC;AAAA,IACH,CAAC;AAAA,EACH,CAAC;AACH;AAqEO,IAAM,oBAAgB,+BAAe,0BAA0B,eAAe;AACrF,IAAO,oBAAQ;",
|
|
6
6
|
"names": ["_jsx", "_Fragment", "Modal", "_jsxs", "Button"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/context/context-system-provider.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\n// @ts-expect-error https://github.com/jonschlinkert/is-plain-object/pull/47\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport { createContext, useContext, useRef, useMemo, memo } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useUpdateEffect } from '../utils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComponentsContext = createContext(/** @type {Record<string, any>} */{});\nComponentsContext.displayName = 'ComponentsContext';\nexport const useComponentsContext = () => useContext(ComponentsContext);\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge({\n value\n}) {\n const parentContext = useComponentsContext();\n const valueRef = useRef(value);\n useUpdateEffect(() => {\n if (\n // Objects are equivalent.\n fastDeepEqual(valueRef.current, value) &&\n // But not the same reference.\n valueRef.current !== value) {\n globalThis.SCRIPT_DEBUG === true ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;\n }\n }, [value]);\n\n // `parentContext` will always be memoized (i.e., the result of this hook itself)\n // or the default value from when the `ComponentsContext` was originally\n // initialized (which will never change, it's a static variable)\n // so this memoization will prevent `deepmerge()` from rerunning unless\n // the references to `value` change OR the `parentContext` has an actual material change\n // (because again, it's guaranteed to be memoized or a static reference to the empty object\n // so we know that the only changes for `parentContext` are material ones... i.e., why we\n // don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n // correctly warning when the `value` isn't being properly memoized. All of that to say\n // that this should be super safe to assume that `useMemo` will only run on actual\n // changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n const config = useMemo(() => {\n // Deep clone `parentContext` to avoid mutating it later.\n return deepmerge(parentContext ?? {}, value ?? {}, {\n isMergeableObject: isPlainObject\n });\n }, [parentContext, value]);\n return config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object}
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6/index.js';\n// @ts-expect-error https://github.com/jonschlinkert/is-plain-object/pull/47\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport { createContext, useContext, useRef, useMemo, memo } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useUpdateEffect } from '../utils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport const ComponentsContext = createContext(/** @type {Record<string, any>} */{});\nComponentsContext.displayName = 'ComponentsContext';\nexport const useComponentsContext = () => useContext(ComponentsContext);\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge({\n value\n}) {\n const parentContext = useComponentsContext();\n const valueRef = useRef(value);\n useUpdateEffect(() => {\n if (\n // Objects are equivalent.\n fastDeepEqual(valueRef.current, value) &&\n // But not the same reference.\n valueRef.current !== value) {\n globalThis.SCRIPT_DEBUG === true ? warn(`Please memoize your context: ${JSON.stringify(value)}`) : void 0;\n }\n }, [value]);\n\n // `parentContext` will always be memoized (i.e., the result of this hook itself)\n // or the default value from when the `ComponentsContext` was originally\n // initialized (which will never change, it's a static variable)\n // so this memoization will prevent `deepmerge()` from rerunning unless\n // the references to `value` change OR the `parentContext` has an actual material change\n // (because again, it's guaranteed to be memoized or a static reference to the empty object\n // so we know that the only changes for `parentContext` are material ones... i.e., why we\n // don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n // correctly warning when the `value` isn't being properly memoized. All of that to say\n // that this should be super safe to assume that `useMemo` will only run on actual\n // changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n const config = useMemo(() => {\n // Deep clone `parentContext` to avoid mutating it later.\n return deepmerge(parentContext ?? {}, value ?? {}, {\n isMergeableObject: isPlainObject\n });\n }, [parentContext, value]);\n return config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {React.ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {React.JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ({\n children,\n value\n}) => {\n const contextValue = useContextSystemBridge({\n value\n });\n return /*#__PURE__*/_jsx(ComponentsContext.Provider, {\n value: contextValue,\n children: children\n });\n};\nexport const ContextSystemProvider = memo(BaseContextSystemProvider);"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,uBAAsB;AACtB,iBAA0B;AAE1B,6BAA8B;AAK9B,qBAAiE;AACjE,qBAAiB;AAKjB,mBAAgC;AAChC,yBAA4B;AACrB,IAAM,wBAAoB;AAAA;AAAA,EAAgD,CAAC;AAAC;AACnF,kBAAkB,cAAc;AACzB,IAAM,uBAAuB,UAAM,2BAAW,iBAAiB;AAWtE,SAAS,uBAAuB;AAAA,EAC9B;AACF,GAAG;AACD,QAAM,gBAAgB,qBAAqB;AAC3C,QAAM,eAAW,uBAAO,KAAK;AAC7B,oCAAgB,MAAM;AACpB;AAAA;AAAA,UAEA,WAAAA,SAAc,SAAS,SAAS,KAAK;AAAA,MAErC,SAAS,YAAY;AAAA,MAAO;AAC1B,iBAAW,iBAAiB,WAAO,eAAAC,SAAK,gCAAgC,KAAK,UAAU,KAAK,CAAC,EAAE,IAAI;AAAA,IACrG;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAcV,QAAM,aAAS,wBAAQ,MAAM;AAE3B,eAAO,iBAAAC,SAAU,iBAAiB,CAAC,GAAG,SAAS,CAAC,GAAG;AAAA,MACjD,mBAAmB;AAAA,IACrB,CAAC;AAAA,EACH,GAAG,CAAC,eAAe,KAAK,CAAC;AACzB,SAAO;AACT;AAmBA,IAAM,4BAA4B,CAAC;AAAA,EACjC;AAAA,EACA;AACF,MAAM;AACJ,QAAM,eAAe,uBAAuB;AAAA,IAC1C;AAAA,EACF,CAAC;AACD,SAAoB,uCAAAC,KAAK,kBAAkB,UAAU;AAAA,IACnD,OAAO;AAAA,IACP;AAAA,EACF,CAAC;AACH;AACO,IAAM,4BAAwB,qBAAK,yBAAyB;",
|
|
6
6
|
"names": ["fastDeepEqual", "warn", "deepmerge", "_jsx"]
|
|
7
7
|
}
|
|
@@ -110,7 +110,7 @@ function ControlPoints({
|
|
|
110
110
|
onStopControlPointChange,
|
|
111
111
|
__experimentalIsRenderedInSidebar
|
|
112
112
|
}) {
|
|
113
|
-
const controlPointMoveStateRef = (0, import_element.useRef)();
|
|
113
|
+
const controlPointMoveStateRef = (0, import_element.useRef)(void 0);
|
|
114
114
|
const onMouseMove = (event) => {
|
|
115
115
|
if (controlPointMoveStateRef.current === void 0 || gradientPickerDomRef.current === null) {
|
|
116
116
|
return;
|
|
@@ -134,7 +134,7 @@ function ControlPoints({
|
|
|
134
134
|
controlPointMoveStateRef.current.listenersActivated = false;
|
|
135
135
|
}
|
|
136
136
|
};
|
|
137
|
-
const cleanEventListenersRef = (0, import_element.useRef)();
|
|
137
|
+
const cleanEventListenersRef = (0, import_element.useRef)(void 0);
|
|
138
138
|
cleanEventListenersRef.current = cleanEventListeners;
|
|
139
139
|
(0, import_element.useEffect)(() => {
|
|
140
140
|
return () => {
|