@wordpress/components 25.1.0 → 25.1.2
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 +29 -1
- package/README.md +1 -1
- package/build/alignment-matrix-control/cell.js +4 -5
- package/build/alignment-matrix-control/cell.js.map +1 -1
- package/build/alignment-matrix-control/icon.js +2 -4
- package/build/alignment-matrix-control/icon.js.map +1 -1
- package/build/alignment-matrix-control/index.js +6 -7
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/angle-picker-control/angle-circle.js +4 -7
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/angle-picker-control/index.js +2 -4
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +28 -1
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/index.js +0 -20
- package/build/autocomplete/index.js.map +1 -1
- package/build/base-control/index.js +2 -4
- package/build/base-control/index.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +4 -6
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +2 -4
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +15 -13
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-box-control/border-box-control-visualizer/component.js +2 -6
- package/build/border-box-control/border-box-control-visualizer/component.js.map +1 -1
- package/build/border-control/border-control/component.js +4 -6
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +4 -6
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/border-control-style-picker/component.js +2 -4
- package/build/border-control/border-control-style-picker/component.js.map +1 -1
- package/build/box-control/all-input-control.js +2 -4
- package/build/box-control/all-input-control.js.map +1 -1
- package/build/box-control/axial-input-controls.js +2 -4
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/box-control/icon.js +4 -7
- package/build/box-control/icon.js.map +1 -1
- package/build/box-control/index.js +7 -6
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-controls.js +2 -4
- package/build/box-control/input-controls.js.map +1 -1
- package/build/box-control/linked-button.js +2 -4
- package/build/box-control/linked-button.js.map +1 -1
- package/build/box-control/unit-control.js +6 -6
- package/build/box-control/unit-control.js.map +1 -1
- package/build/button/deprecated.js +2 -4
- package/build/button/deprecated.js.map +1 -1
- package/build/button/index.js +20 -7
- package/build/button/index.js.map +1 -1
- package/build/button-group/index.js +4 -5
- package/build/button-group/index.js.map +1 -1
- package/build/card/card/component.js +2 -4
- package/build/card/card/component.js.map +1 -1
- package/build/card/card-body/component.js +4 -8
- package/build/card/card-body/component.js.map +1 -1
- package/build/card/card-divider/component.js +2 -6
- package/build/card/card-divider/component.js.map +1 -1
- package/build/card/card-footer/component.js +2 -6
- package/build/card/card-footer/component.js.map +1 -1
- package/build/card/card-header/component.js +2 -6
- package/build/card/card-header/component.js.map +1 -1
- package/build/card/card-media/component.js +2 -6
- package/build/card/card-media/component.js.map +1 -1
- package/build/checkbox-control/index.js +4 -5
- package/build/checkbox-control/index.js.map +1 -1
- package/build/circular-option-picker/index.js +19 -16
- package/build/circular-option-picker/index.js.map +1 -1
- package/build/clipboard-button/index.js +9 -20
- package/build/clipboard-button/index.js.map +1 -1
- package/build/clipboard-button/types.js +6 -0
- package/build/clipboard-button/types.js.map +1 -0
- package/build/color-control/index.native.js +4 -5
- package/build/color-control/index.native.js.map +1 -1
- package/build/color-indicator/index.js +4 -5
- package/build/color-indicator/index.js.map +1 -1
- package/build/color-palette/index.js +11 -11
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/color-input.js +6 -3
- package/build/color-picker/color-input.js.map +1 -1
- package/build/color-picker/component.js +4 -5
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/legacy-adapter.js +2 -1
- package/build/color-picker/legacy-adapter.js.map +1 -1
- package/build/confirm-dialog/component.js +13 -6
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +8 -8
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-select-control/index.js +34 -32
- package/build/custom-select-control/index.js.map +1 -1
- package/build/dashicon/index.js +4 -7
- package/build/dashicon/index.js.map +1 -1
- package/build/dashicon/index.native.js +4 -7
- package/build/dashicon/index.native.js.map +1 -1
- package/build/disabled/index.js +4 -7
- package/build/disabled/index.js.map +1 -1
- package/build/divider/component.js +4 -8
- package/build/divider/component.js.map +1 -1
- package/build/drop-zone/index.js +2 -4
- package/build/drop-zone/index.js.map +1 -1
- package/build/dropdown/dropdown-content-wrapper.js +2 -6
- package/build/dropdown/dropdown-content-wrapper.js.map +1 -1
- package/build/dropdown/index.js +29 -24
- package/build/dropdown/index.js.map +1 -1
- package/build/dropdown-menu/index.js +98 -93
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu/index.native.js +2 -4
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/dropdown-menu-v2/index.js +14 -12
- package/build/dropdown-menu-v2/index.js.map +1 -1
- package/build/dropdown-menu-v2/styles.js +16 -16
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/elevation/component.js +2 -6
- package/build/elevation/component.js.map +1 -1
- package/build/external-link/index.js +2 -4
- package/build/external-link/index.js.map +1 -1
- package/build/flex/flex/component.js +2 -6
- package/build/flex/flex/component.js.map +1 -1
- package/build/flex/flex-block/component.js +2 -6
- package/build/flex/flex-block/component.js.map +1 -1
- package/build/flex/flex-item/component.js +2 -6
- package/build/flex/flex-item/component.js.map +1 -1
- package/build/focal-point-picker/controls.js +4 -7
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/focal-point.js +2 -4
- package/build/focal-point-picker/focal-point.js.map +1 -1
- package/build/focal-point-picker/grid.js +2 -6
- package/build/focal-point-picker/grid.js.map +1 -1
- package/build/focal-point-picker/index.js +4 -6
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/index.native.js +2 -4
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/focal-point-picker/media.js +7 -10
- package/build/focal-point-picker/media.js.map +1 -1
- package/build/focal-point-picker/tooltip/index.native.js +2 -4
- package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build/focusable-iframe/index.js +4 -5
- package/build/focusable-iframe/index.js.map +1 -1
- package/build/font-size-picker/index.js +5 -3
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/styles.js +19 -26
- package/build/font-size-picker/styles.js.map +1 -1
- package/build/footer-message-control/index.native.js +2 -1
- package/build/footer-message-control/index.native.js.map +1 -1
- package/build/form-file-upload/index.js +4 -5
- package/build/form-file-upload/index.js.map +1 -1
- package/build/form-toggle/index.js +4 -5
- package/build/form-toggle/index.js.map +1 -1
- package/build/form-token-field/index.js +4 -5
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/token-input.js +4 -6
- package/build/form-token-field/token-input.js.map +1 -1
- package/build/gradient-picker/index.js +14 -12
- package/build/gradient-picker/index.js.map +1 -1
- package/build/grid/component.js +2 -4
- package/build/grid/component.js.map +1 -1
- package/build/guide/page.js +2 -1
- package/build/guide/page.js.map +1 -1
- package/build/h-stack/component.js +2 -6
- package/build/h-stack/component.js.map +1 -1
- package/build/h-stack/hook.js +4 -7
- package/build/h-stack/hook.js.map +1 -1
- package/build/heading/component.js +2 -6
- package/build/heading/component.js.map +1 -1
- package/build/higher-order/navigate-regions/index.js +3 -1
- package/build/higher-order/navigate-regions/index.js.map +1 -1
- package/build/higher-order/with-constrained-tabbing/index.js +2 -1
- package/build/higher-order/with-constrained-tabbing/index.js.map +1 -1
- package/build/higher-order/with-fallback-styles/index.js +3 -3
- package/build/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build/higher-order/with-filters/index.js +2 -1
- package/build/higher-order/with-filters/index.js.map +1 -1
- package/build/higher-order/with-focus-outside/index.js +5 -7
- package/build/higher-order/with-focus-outside/index.js.map +1 -1
- package/build/higher-order/with-focus-outside/index.native.js +5 -7
- package/build/higher-order/with-focus-outside/index.native.js.map +1 -1
- package/build/higher-order/with-focus-return/index.js +2 -1
- package/build/higher-order/with-focus-return/index.js.map +1 -1
- package/build/higher-order/with-notices/index.js +3 -4
- package/build/higher-order/with-notices/index.js.map +1 -1
- package/build/higher-order/with-spoken-messages/index.js +2 -6
- package/build/higher-order/with-spoken-messages/index.js.map +1 -1
- package/build/icon/index.js +6 -6
- package/build/icon/index.js.map +1 -1
- package/build/input-control/index.js +5 -5
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-base.js +3 -4
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/input-field.js +3 -6
- package/build/input-control/input-field.js.map +1 -1
- package/build/input-control/input-prefix-wrapper.js +4 -8
- package/build/input-control/input-prefix-wrapper.js.map +1 -1
- package/build/input-control/input-suffix-wrapper.js +4 -8
- package/build/input-control/input-suffix-wrapper.js.map +1 -1
- package/build/input-control/label.js +4 -7
- package/build/input-control/label.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +2 -4
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/isolated-event-container/index.js +2 -4
- package/build/isolated-event-container/index.js.map +1 -1
- package/build/item-group/item/component.js +2 -6
- package/build/item-group/item/component.js.map +1 -1
- package/build/item-group/item-group/component.js +2 -6
- package/build/item-group/item-group/component.js.map +1 -1
- package/build/item-group/styles.js +10 -10
- package/build/item-group/styles.js.map +1 -1
- package/build/menu-item/index.js +4 -5
- package/build/menu-item/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +4 -6
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +2 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +5 -6
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/color-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/color-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cycle-picker-cell.native.js +4 -5
- package/build/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/footer-message-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/footer-message-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js +8 -8
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +4 -7
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/picker-cell.native.js +4 -5
- package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/radio-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/radio-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/range-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/ripple.native.js +4 -6
- package/build/mobile/bottom-sheet/ripple.native.js.map +1 -1
- package/build/mobile/bottom-sheet/switch-cell.native.js +2 -4
- package/build/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
- package/build/mobile/color-settings/index.native.js +5 -5
- package/build/mobile/color-settings/index.native.js.map +1 -1
- package/build/mobile/cycle-select-control/index.native.js +4 -5
- package/build/mobile/cycle-select-control/index.native.js.map +1 -1
- package/build/mobile/focal-point-settings-panel/index.native.js +5 -5
- package/build/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build/mobile/global-styles-context/index.native.js +2 -6
- package/build/mobile/global-styles-context/index.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js +4 -5
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/image/image-editing-button.native.js +4 -5
- package/build/mobile/image/image-editing-button.native.js.map +1 -1
- package/build/mobile/image/index.native.js +15 -15
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-avoiding-view/index.ios.js +2 -4
- package/build/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js +4 -5
- package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +2 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js +4 -6
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-navigation.native.js +4 -5
- package/build/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-screen.native.js +2 -4
- package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build/mobile/picker/index.ios.js +4 -6
- package/build/mobile/picker/index.ios.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +4 -5
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/modal/index.js +4 -6
- package/build/modal/index.js.map +1 -1
- package/build/navigable-container/container.js +6 -9
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigable-container/menu.js +4 -5
- package/build/navigable-container/menu.js.map +1 -1
- package/build/navigable-container/tabbable.js +4 -5
- package/build/navigable-container/tabbable.js.map +1 -1
- package/build/navigation/item/base.js +4 -5
- package/build/navigation/item/base.js.map +1 -1
- package/build/navigation/item/index.js +3 -4
- package/build/navigation/item/index.js.map +1 -1
- package/build/navigator/navigator-back-button/component.js +4 -7
- package/build/navigator/navigator-back-button/component.js.map +1 -1
- package/build/navigator/navigator-button/component.js +4 -7
- package/build/navigator/navigator-button/component.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +4 -5
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +9 -10
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/navigator-to-parent-button/component.js +4 -7
- package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build/notice/list.js +2 -4
- package/build/notice/list.js.map +1 -1
- package/build/notice/list.native.js +2 -4
- package/build/notice/list.native.js.map +1 -1
- package/build/number-control/index.js +12 -10
- package/build/number-control/index.js.map +1 -1
- package/build/number-control/styles/number-control-styles.js +9 -15
- package/build/number-control/styles/number-control-styles.js.map +1 -1
- package/build/palette-edit/index.js +11 -12
- package/build/palette-edit/index.js.map +1 -1
- package/build/panel/body.js +8 -8
- package/build/panel/body.js.map +1 -1
- package/build/placeholder/index.js +2 -4
- package/build/placeholder/index.js.map +1 -1
- package/build/popover/index.js +11 -12
- package/build/popover/index.js.map +1 -1
- package/build/popover/utils.js +15 -1
- package/build/popover/utils.js.map +1 -1
- package/build/query-controls/category-select.js +4 -6
- package/build/query-controls/category-select.js.map +1 -1
- package/build/radio-control/index.js +4 -5
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-control/index.native.js +4 -5
- package/build/radio-control/index.native.js.map +1 -1
- package/build/radio-group/index.js +5 -5
- package/build/radio-group/index.js.map +1 -1
- package/build/radio-group/radio/index.js +5 -5
- package/build/radio-group/radio/index.js.map +1 -1
- package/build/range-control/index.js +2 -4
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/index.native.js +4 -5
- package/build/range-control/index.native.js.map +1 -1
- package/build/range-control/input-range.js +2 -6
- package/build/range-control/input-range.js.map +1 -1
- package/build/range-control/mark.js +2 -4
- package/build/range-control/mark.js.map +1 -1
- package/build/range-control/rail.js +6 -7
- package/build/range-control/rail.js.map +1 -1
- package/build/range-control/tooltip.js +2 -4
- package/build/range-control/tooltip.js.map +1 -1
- package/build/resizable-box/index.js +5 -5
- package/build/resizable-box/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/index.js +4 -5
- package/build/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/label.js +4 -7
- package/build/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build/scrollable/component.js +2 -6
- package/build/scrollable/component.js.map +1 -1
- package/build/search-control/index.js +2 -4
- package/build/search-control/index.js.map +1 -1
- package/build/select-control/index.js +4 -5
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/index.native.js +4 -5
- package/build/select-control/index.native.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +4 -5
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/index.js +17 -13
- package/build/slot-fill/index.js.map +1 -1
- package/build/slot-fill/index.native.js +10 -9
- package/build/slot-fill/index.native.js.map +1 -1
- package/build/slot-fill/slot.js +2 -4
- package/build/slot-fill/slot.js.map +1 -1
- package/build/snackbar/list.js +2 -4
- package/build/snackbar/list.js.map +1 -1
- package/build/spacer/component.js +2 -6
- package/build/spacer/component.js.map +1 -1
- package/build/spinner/index.js +4 -6
- package/build/spinner/index.js.map +1 -1
- package/build/surface/component.js +2 -6
- package/build/surface/component.js.map +1 -1
- package/build/tab-panel/index.js +4 -5
- package/build/tab-panel/index.js.map +1 -1
- package/build/text/component.js +4 -6
- package/build/text/component.js.map +1 -1
- package/build/text-control/index.js +4 -5
- package/build/text-control/index.js.map +1 -1
- package/build/text-control/index.native.js +4 -5
- package/build/text-control/index.native.js.map +1 -1
- package/build/textarea-control/index.js +4 -5
- package/build/textarea-control/index.js.map +1 -1
- package/build/theme/index.js +4 -7
- package/build/theme/index.js.map +1 -1
- package/build/toggle-control/index.native.js +4 -5
- package/build/toggle-control/index.native.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-button-group.js +4 -6
- package/build/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js +4 -6
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +2 -4
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/component.js +2 -6
- package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +6 -7
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js +2 -4
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build/toolbar/toolbar/index.js +9 -13
- package/build/toolbar/toolbar/index.js.map +1 -1
- package/build/toolbar/toolbar/toolbar-container.js +9 -13
- package/build/toolbar/toolbar/toolbar-container.js.map +1 -1
- package/build/toolbar/toolbar-button/index.js +13 -11
- package/build/toolbar/toolbar-button/index.js.map +1 -1
- package/build/toolbar/toolbar-context/index.js.map +1 -1
- package/build/toolbar/toolbar-dropdown-menu/index.js +8 -10
- package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
- package/build/toolbar/toolbar-group/index.js +11 -10
- package/build/toolbar/toolbar-group/index.js.map +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.js +6 -6
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.native.js +4 -5
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.native.js.map +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-container.js +4 -7
- package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
- package/build/toolbar/toolbar-item/index.js +13 -11
- package/build/toolbar/toolbar-item/index.js.map +1 -1
- package/build/toolbar/toolbar-item/types.js +6 -0
- package/build/toolbar/toolbar-item/types.js.map +1 -0
- package/build/tools-panel/tools-panel/component.js +2 -4
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +2 -4
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/tools-panel-item/component.js +4 -8
- package/build/tools-panel/tools-panel-item/component.js.map +1 -1
- package/build/tooltip/index.js +4 -5
- package/build/tooltip/index.js.map +1 -1
- package/build/tooltip/index.native.js +2 -1
- package/build/tooltip/index.native.js.map +1 -1
- package/build/tree-grid/cell.js +2 -4
- package/build/tree-grid/cell.js.map +1 -1
- package/build/tree-grid/index.js +2 -4
- package/build/tree-grid/index.js.map +1 -1
- package/build/tree-grid/item.js +4 -5
- package/build/tree-grid/item.js.map +1 -1
- package/build/tree-grid/roving-tab-index-item.js +2 -1
- package/build/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build/tree-grid/row.js +2 -6
- package/build/tree-grid/row.js.map +1 -1
- package/build/tree-select/index.js +4 -7
- package/build/tree-select/index.js.map +1 -1
- package/build/truncate/component.js +4 -6
- package/build/truncate/component.js.map +1 -1
- package/build/ui/control-group/component.js +8 -12
- package/build/ui/control-group/component.js.map +1 -1
- package/build/ui/control-label/component.js +4 -8
- package/build/ui/control-label/component.js.map +1 -1
- package/build/ui/form-group/form-group-content.js +4 -5
- package/build/ui/form-group/form-group-content.js.map +1 -1
- package/build/ui/form-group/form-group-label.js +2 -1
- package/build/ui/form-group/form-group-label.js.map +1 -1
- package/build/ui/form-group/form-group.js +8 -8
- package/build/ui/form-group/form-group.js.map +1 -1
- package/build/ui/shortcut/component.js +4 -7
- package/build/ui/shortcut/component.js.map +1 -1
- package/build/ui/spinner/component.js +2 -6
- package/build/ui/spinner/component.js.map +1 -1
- package/build/ui/tooltip/component.js +3 -4
- package/build/ui/tooltip/component.js.map +1 -1
- package/build/ui/tooltip/content.js +5 -8
- package/build/ui/tooltip/content.js.map +1 -1
- package/build/unit-control/index.js +31 -94
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/index.native.js +7 -7
- package/build/unit-control/index.native.js.map +1 -1
- package/build/unit-control/unit-select-control.js +15 -7
- package/build/unit-control/unit-select-control.js.map +1 -1
- package/build/v-stack/component.js +2 -6
- package/build/v-stack/component.js.map +1 -1
- package/build/visually-hidden/component.js +4 -8
- package/build/visually-hidden/component.js.map +1 -1
- package/build/z-stack/component.js +7 -9
- package/build/z-stack/component.js.map +1 -1
- package/build/z-stack/styles.js +23 -42
- package/build/z-stack/styles.js.map +1 -1
- package/build-module/alignment-matrix-control/cell.js +4 -4
- package/build-module/alignment-matrix-control/cell.js.map +1 -1
- package/build-module/alignment-matrix-control/icon.js +2 -3
- package/build-module/alignment-matrix-control/icon.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +6 -6
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js +4 -4
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/angle-picker-control/index.js +2 -3
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +27 -2
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/index.js +1 -19
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/base-control/index.js +2 -3
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +4 -5
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js +2 -3
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +15 -12
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-visualizer/component.js +2 -3
- package/build-module/border-box-control/border-box-control-visualizer/component.js.map +1 -1
- package/build-module/border-control/border-control/component.js +4 -5
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +4 -5
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/border-control-style-picker/component.js +2 -3
- package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
- package/build-module/box-control/all-input-control.js +2 -3
- package/build-module/box-control/all-input-control.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js +2 -3
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/box-control/icon.js +4 -4
- package/build-module/box-control/icon.js.map +1 -1
- package/build-module/box-control/index.js +7 -5
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-controls.js +2 -3
- package/build-module/box-control/input-controls.js.map +1 -1
- package/build-module/box-control/linked-button.js +2 -3
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/box-control/unit-control.js +6 -5
- package/build-module/box-control/unit-control.js.map +1 -1
- package/build-module/button/deprecated.js +2 -3
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/index.js +20 -6
- package/build-module/button/index.js.map +1 -1
- package/build-module/button-group/index.js +4 -4
- package/build-module/button-group/index.js.map +1 -1
- package/build-module/card/card/component.js +2 -3
- package/build-module/card/card/component.js.map +1 -1
- package/build-module/card/card-body/component.js +4 -5
- package/build-module/card/card-body/component.js.map +1 -1
- package/build-module/card/card-divider/component.js +2 -3
- package/build-module/card/card-divider/component.js.map +1 -1
- package/build-module/card/card-footer/component.js +2 -3
- package/build-module/card/card-footer/component.js.map +1 -1
- package/build-module/card/card-header/component.js +2 -3
- package/build-module/card/card-header/component.js.map +1 -1
- package/build-module/card/card-media/component.js +2 -3
- package/build-module/card/card-media/component.js.map +1 -1
- package/build-module/checkbox-control/index.js +4 -4
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/circular-option-picker/index.js +19 -15
- package/build-module/circular-option-picker/index.js.map +1 -1
- package/build-module/clipboard-button/index.js +9 -20
- package/build-module/clipboard-button/index.js.map +1 -1
- package/build-module/clipboard-button/types.js +2 -0
- package/build-module/clipboard-button/types.js.map +1 -0
- package/build-module/color-control/index.native.js +4 -4
- package/build-module/color-control/index.native.js.map +1 -1
- package/build-module/color-indicator/index.js +4 -4
- package/build-module/color-indicator/index.js.map +1 -1
- package/build-module/color-palette/index.js +11 -10
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/color-input.js +6 -3
- package/build-module/color-picker/color-input.js.map +1 -1
- package/build-module/color-picker/component.js +4 -4
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/legacy-adapter.js +2 -1
- package/build-module/color-picker/legacy-adapter.js.map +1 -1
- package/build-module/confirm-dialog/component.js +14 -6
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +8 -7
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-select-control/index.js +34 -31
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/dashicon/index.js +4 -4
- package/build-module/dashicon/index.js.map +1 -1
- package/build-module/dashicon/index.native.js +4 -4
- package/build-module/dashicon/index.native.js.map +1 -1
- package/build-module/disabled/index.js +4 -4
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/divider/component.js +4 -5
- package/build-module/divider/component.js.map +1 -1
- package/build-module/drop-zone/index.js +2 -3
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/dropdown/dropdown-content-wrapper.js +2 -3
- package/build-module/dropdown/dropdown-content-wrapper.js.map +1 -1
- package/build-module/dropdown/index.js +29 -24
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/dropdown-menu/index.js +95 -91
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +2 -3
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/dropdown-menu-v2/index.js +14 -11
- package/build-module/dropdown-menu-v2/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/styles.js +16 -16
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/elevation/component.js +2 -3
- package/build-module/elevation/component.js.map +1 -1
- package/build-module/external-link/index.js +2 -3
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/flex/flex/component.js +2 -3
- package/build-module/flex/flex/component.js.map +1 -1
- package/build-module/flex/flex-block/component.js +2 -3
- package/build-module/flex/flex-block/component.js.map +1 -1
- package/build-module/flex/flex-item/component.js +2 -3
- package/build-module/flex/flex-item/component.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +4 -4
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/focal-point.js +2 -3
- package/build-module/focal-point-picker/focal-point.js.map +1 -1
- package/build-module/focal-point-picker/grid.js +2 -3
- package/build-module/focal-point-picker/grid.js.map +1 -1
- package/build-module/focal-point-picker/index.js +4 -5
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +2 -3
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/focal-point-picker/media.js +7 -7
- package/build-module/focal-point-picker/media.js.map +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js +2 -3
- package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build-module/focusable-iframe/index.js +4 -4
- package/build-module/focusable-iframe/index.js.map +1 -1
- package/build-module/font-size-picker/index.js +5 -4
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/styles.js +17 -23
- package/build-module/font-size-picker/styles.js.map +1 -1
- package/build-module/footer-message-control/index.native.js +2 -1
- package/build-module/footer-message-control/index.native.js.map +1 -1
- package/build-module/form-file-upload/index.js +4 -4
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/form-toggle/index.js +4 -4
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/form-token-field/index.js +4 -4
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/token-input.js +4 -5
- package/build-module/form-token-field/token-input.js.map +1 -1
- package/build-module/gradient-picker/index.js +14 -11
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/grid/component.js +2 -3
- package/build-module/grid/component.js.map +1 -1
- package/build-module/guide/page.js +2 -1
- package/build-module/guide/page.js.map +1 -1
- package/build-module/h-stack/component.js +2 -3
- package/build-module/h-stack/component.js.map +1 -1
- package/build-module/h-stack/hook.js +4 -4
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/heading/component.js +2 -3
- package/build-module/heading/component.js.map +1 -1
- package/build-module/higher-order/navigate-regions/index.js +3 -1
- package/build-module/higher-order/navigate-regions/index.js.map +1 -1
- package/build-module/higher-order/with-constrained-tabbing/index.js +2 -1
- package/build-module/higher-order/with-constrained-tabbing/index.js.map +1 -1
- package/build-module/higher-order/with-fallback-styles/index.js +3 -2
- package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build-module/higher-order/with-filters/index.js +2 -1
- package/build-module/higher-order/with-filters/index.js.map +1 -1
- package/build-module/higher-order/with-focus-outside/index.js +5 -4
- package/build-module/higher-order/with-focus-outside/index.js.map +1 -1
- package/build-module/higher-order/with-focus-outside/index.native.js +5 -4
- package/build-module/higher-order/with-focus-outside/index.native.js.map +1 -1
- package/build-module/higher-order/with-focus-return/index.js +2 -1
- package/build-module/higher-order/with-focus-return/index.js.map +1 -1
- package/build-module/higher-order/with-notices/index.js +3 -3
- package/build-module/higher-order/with-notices/index.js.map +1 -1
- package/build-module/higher-order/with-spoken-messages/index.js +2 -3
- package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
- package/build-module/icon/index.js +6 -6
- package/build-module/icon/index.js.map +1 -1
- package/build-module/input-control/index.js +5 -4
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-base.js +3 -3
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/input-field.js +3 -3
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/input-control/input-prefix-wrapper.js +4 -5
- package/build-module/input-control/input-prefix-wrapper.js.map +1 -1
- package/build-module/input-control/input-suffix-wrapper.js +4 -5
- package/build-module/input-control/input-suffix-wrapper.js.map +1 -1
- package/build-module/input-control/label.js +4 -4
- package/build-module/input-control/label.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +2 -3
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/isolated-event-container/index.js +2 -3
- package/build-module/isolated-event-container/index.js.map +1 -1
- package/build-module/item-group/item/component.js +2 -3
- package/build-module/item-group/item/component.js.map +1 -1
- package/build-module/item-group/item-group/component.js +2 -3
- package/build-module/item-group/item-group/component.js.map +1 -1
- package/build-module/item-group/styles.js +10 -10
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/menu-item/index.js +4 -4
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +4 -5
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js +2 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-screen.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +5 -5
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/color-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/color-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js +4 -4
- package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/footer-message-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/footer-message-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js +8 -7
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +4 -4
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/link-suggestion-item-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/picker-cell.native.js +4 -4
- package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/radio-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/radio-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/range-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/ripple.native.js +4 -5
- package/build-module/mobile/bottom-sheet/ripple.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/switch-cell.native.js +2 -3
- package/build-module/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
- package/build-module/mobile/color-settings/index.native.js +5 -4
- package/build-module/mobile/color-settings/index.native.js.map +1 -1
- package/build-module/mobile/cycle-select-control/index.native.js +4 -4
- package/build-module/mobile/cycle-select-control/index.native.js.map +1 -1
- package/build-module/mobile/focal-point-settings-panel/index.native.js +5 -4
- package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/index.native.js +2 -3
- package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +4 -4
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/image/image-editing-button.native.js +4 -4
- package/build-module/mobile/image/image-editing-button.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +15 -14
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js +2 -3
- package/build-module/mobile/keyboard-avoiding-view/index.ios.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js +4 -4
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +2 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js +4 -5
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-navigation.native.js +4 -4
- package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-screen.native.js +2 -3
- package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build-module/mobile/picker/index.ios.js +4 -5
- package/build-module/mobile/picker/index.ios.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +4 -4
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/modal/index.js +4 -5
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigable-container/container.js +6 -6
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigable-container/menu.js +4 -4
- package/build-module/navigable-container/menu.js.map +1 -1
- package/build-module/navigable-container/tabbable.js +4 -4
- package/build-module/navigable-container/tabbable.js.map +1 -1
- package/build-module/navigation/item/base.js +4 -4
- package/build-module/navigation/item/base.js.map +1 -1
- package/build-module/navigation/item/index.js +3 -3
- package/build-module/navigation/item/index.js.map +1 -1
- package/build-module/navigator/navigator-back-button/component.js +4 -4
- package/build-module/navigator/navigator-back-button/component.js.map +1 -1
- package/build-module/navigator/navigator-button/component.js +4 -4
- package/build-module/navigator/navigator-button/component.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +4 -4
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +9 -7
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/navigator-to-parent-button/component.js +4 -4
- package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build-module/notice/list.js +2 -3
- package/build-module/notice/list.js.map +1 -1
- package/build-module/notice/list.native.js +2 -3
- package/build-module/notice/list.native.js.map +1 -1
- package/build-module/number-control/index.js +12 -10
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/number-control/styles/number-control-styles.js +7 -14
- package/build-module/number-control/styles/number-control-styles.js.map +1 -1
- package/build-module/palette-edit/index.js +11 -11
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/panel/body.js +8 -7
- package/build-module/panel/body.js.map +1 -1
- package/build-module/placeholder/index.js +2 -3
- package/build-module/placeholder/index.js.map +1 -1
- package/build-module/popover/index.js +12 -12
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/utils.js +11 -0
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/query-controls/category-select.js +4 -5
- package/build-module/query-controls/category-select.js.map +1 -1
- package/build-module/radio-control/index.js +4 -4
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-control/index.native.js +4 -4
- package/build-module/radio-control/index.native.js.map +1 -1
- package/build-module/radio-group/index.js +5 -4
- package/build-module/radio-group/index.js.map +1 -1
- package/build-module/radio-group/radio/index.js +5 -4
- package/build-module/radio-group/radio/index.js.map +1 -1
- package/build-module/range-control/index.js +2 -3
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/index.native.js +4 -4
- package/build-module/range-control/index.native.js.map +1 -1
- package/build-module/range-control/input-range.js +2 -3
- package/build-module/range-control/input-range.js.map +1 -1
- package/build-module/range-control/mark.js +2 -3
- package/build-module/range-control/mark.js.map +1 -1
- package/build-module/range-control/rail.js +6 -6
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/range-control/tooltip.js +2 -3
- package/build-module/range-control/tooltip.js.map +1 -1
- package/build-module/resizable-box/index.js +5 -4
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/index.js +4 -4
- package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/label.js +4 -4
- package/build-module/resizable-box/resize-tooltip/label.js.map +1 -1
- package/build-module/scrollable/component.js +2 -3
- package/build-module/scrollable/component.js.map +1 -1
- package/build-module/search-control/index.js +2 -3
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/select-control/index.js +4 -4
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/index.native.js +4 -4
- package/build-module/select-control/index.native.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +4 -4
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/index.js +17 -12
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/slot-fill/index.native.js +10 -8
- package/build-module/slot-fill/index.native.js.map +1 -1
- package/build-module/slot-fill/slot.js +2 -3
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/snackbar/list.js +2 -3
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/spacer/component.js +2 -3
- package/build-module/spacer/component.js.map +1 -1
- package/build-module/spinner/index.js +4 -5
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/surface/component.js +2 -3
- package/build-module/surface/component.js.map +1 -1
- package/build-module/tab-panel/index.js +4 -4
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/text/component.js +4 -5
- package/build-module/text/component.js.map +1 -1
- package/build-module/text-control/index.js +4 -4
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/text-control/index.native.js +4 -4
- package/build-module/text-control/index.native.js.map +1 -1
- package/build-module/textarea-control/index.js +4 -4
- package/build-module/textarea-control/index.js.map +1 -1
- package/build-module/theme/index.js +4 -4
- package/build-module/theme/index.js.map +1 -1
- package/build-module/toggle-control/index.native.js +4 -4
- package/build-module/toggle-control/index.native.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js +4 -5
- package/build-module/toggle-group-control/toggle-group-control/as-button-group.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +4 -5
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +2 -3
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option/component.js +2 -3
- package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +6 -6
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +2 -3
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build-module/toolbar/toolbar/index.js +10 -13
- package/build-module/toolbar/toolbar/index.js.map +1 -1
- package/build-module/toolbar/toolbar/toolbar-container.js +9 -12
- package/build-module/toolbar/toolbar/toolbar-container.js.map +1 -1
- package/build-module/toolbar/toolbar-button/index.js +13 -10
- package/build-module/toolbar/toolbar-button/index.js.map +1 -1
- package/build-module/toolbar/toolbar-context/index.js.map +1 -1
- package/build-module/toolbar/toolbar-dropdown-menu/index.js +8 -9
- package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
- package/build-module/toolbar/toolbar-group/index.js +11 -9
- package/build-module/toolbar/toolbar-group/index.js.map +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js +6 -5
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.native.js +4 -4
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.native.js.map +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-container.js +4 -4
- package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
- package/build-module/toolbar/toolbar-item/index.js +13 -10
- package/build-module/toolbar/toolbar-item/index.js.map +1 -1
- package/build-module/toolbar/toolbar-item/types.js +2 -0
- package/build-module/toolbar/toolbar-item/types.js.map +1 -0
- package/build-module/tools-panel/tools-panel/component.js +2 -3
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +2 -3
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/component.js +4 -5
- package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
- package/build-module/tooltip/index.js +4 -4
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tooltip/index.native.js +2 -1
- package/build-module/tooltip/index.native.js.map +1 -1
- package/build-module/tree-grid/cell.js +2 -3
- package/build-module/tree-grid/cell.js.map +1 -1
- package/build-module/tree-grid/index.js +2 -3
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/tree-grid/item.js +4 -4
- package/build-module/tree-grid/item.js.map +1 -1
- package/build-module/tree-grid/roving-tab-index-item.js +2 -1
- package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build-module/tree-grid/row.js +2 -3
- package/build-module/tree-grid/row.js.map +1 -1
- package/build-module/tree-select/index.js +4 -4
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/truncate/component.js +4 -5
- package/build-module/truncate/component.js.map +1 -1
- package/build-module/ui/control-group/component.js +8 -9
- package/build-module/ui/control-group/component.js.map +1 -1
- package/build-module/ui/control-label/component.js +4 -5
- package/build-module/ui/control-label/component.js.map +1 -1
- package/build-module/ui/form-group/form-group-content.js +4 -4
- package/build-module/ui/form-group/form-group-content.js.map +1 -1
- package/build-module/ui/form-group/form-group-label.js +2 -1
- package/build-module/ui/form-group/form-group-label.js.map +1 -1
- package/build-module/ui/form-group/form-group.js +8 -7
- package/build-module/ui/form-group/form-group.js.map +1 -1
- package/build-module/ui/shortcut/component.js +4 -4
- package/build-module/ui/shortcut/component.js.map +1 -1
- package/build-module/ui/spinner/component.js +2 -3
- package/build-module/ui/spinner/component.js.map +1 -1
- package/build-module/ui/tooltip/component.js +3 -3
- package/build-module/ui/tooltip/component.js.map +1 -1
- package/build-module/ui/tooltip/content.js +5 -5
- package/build-module/ui/tooltip/content.js.map +1 -1
- package/build-module/unit-control/index.js +31 -88
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/index.native.js +7 -6
- package/build-module/unit-control/index.native.js.map +1 -1
- package/build-module/unit-control/unit-select-control.js +19 -6
- package/build-module/unit-control/unit-select-control.js.map +1 -1
- package/build-module/v-stack/component.js +2 -3
- package/build-module/v-stack/component.js.map +1 -1
- package/build-module/visually-hidden/component.js +4 -5
- package/build-module/visually-hidden/component.js.map +1 -1
- package/build-module/z-stack/component.js +7 -6
- package/build-module/z-stack/component.js.map +1 -1
- package/build-module/z-stack/styles.js +22 -44
- package/build-module/z-stack/styles.js.map +1 -1
- package/build-style/style-rtl.css +16 -21
- package/build-style/style.css +16 -21
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/button/deprecated.d.ts +6 -6
- package/build-types/button/index.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.d.ts +1 -0
- package/build-types/button/stories/e2e/index.d.ts.map +1 -1
- package/build-types/button/types.d.ts +16 -9
- package/build-types/button/types.d.ts.map +1 -1
- package/build-types/circular-option-picker/types.d.ts +2 -2
- package/build-types/circular-option-picker/types.d.ts.map +1 -1
- package/build-types/clipboard-button/index.d.ts +4 -15
- package/build-types/clipboard-button/index.d.ts.map +1 -1
- package/build-types/clipboard-button/types.d.ts +11 -0
- package/build-types/clipboard-button/types.d.ts.map +1 -0
- package/build-types/confirm-dialog/component.d.ts.map +1 -1
- package/build-types/dropdown/index.d.ts +1 -1
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/dropdown/types.d.ts +7 -0
- package/build-types/dropdown/types.d.ts.map +1 -1
- package/build-types/dropdown-menu/index.d.ts +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.d.ts +4 -3
- package/build-types/dropdown-menu/stories/index.d.ts.map +1 -1
- package/build-types/dropdown-menu/types.d.ts +7 -0
- package/build-types/dropdown-menu/types.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/styles.d.ts +4 -4
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/types.d.ts +2 -2
- package/build-types/dropdown-menu-v2/types.d.ts.map +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +0 -6
- package/build-types/font-size-picker/styles.d.ts.map +1 -1
- package/build-types/item-group/styles.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
- package/build-types/navigator/navigator-button/component.d.ts +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +1 -1
- package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +5 -3
- package/build-types/number-control/styles/number-control-styles.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/index.d.ts +0 -1
- package/build-types/popover/stories/index.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts +10 -0
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/types.d.ts +6 -0
- package/build-types/select-control/types.d.ts.map +1 -1
- package/build-types/toolbar/stories/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts +6 -6
- package/build-types/toolbar/toolbar-context/index.d.ts +2 -2
- package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-item/index.d.ts +4 -6
- package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-item/types.d.ts +17 -0
- package/build-types/toolbar/toolbar-item/types.d.ts.map +1 -0
- package/build-types/unit-control/index.d.ts +3 -6
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/stories/index.d.ts.map +1 -1
- package/build-types/unit-control/unit-select-control.d.ts +7 -6
- package/build-types/unit-control/unit-select-control.d.ts.map +1 -1
- package/build-types/z-stack/component.d.ts.map +1 -1
- package/build-types/z-stack/stories/index.d.ts.map +1 -1
- package/build-types/z-stack/styles.d.ts +5 -4
- package/build-types/z-stack/styles.d.ts.map +1 -1
- package/package.json +21 -20
- package/src/autocomplete/autocompleter-ui.tsx +44 -2
- package/src/autocomplete/index.tsx +2 -32
- package/src/box-control/test/index.tsx +28 -60
- package/src/button/README.md +15 -0
- package/src/button/index.tsx +11 -4
- package/src/button/stories/e2e/index.tsx +22 -0
- package/src/button/style.scss +18 -25
- package/src/button/test/index.tsx +13 -0
- package/src/button/types.ts +17 -9
- package/src/circular-option-picker/types.ts +2 -5
- package/src/clipboard-button/{index.js → index.tsx} +11 -17
- package/src/clipboard-button/types.ts +11 -0
- package/src/confirm-dialog/component.tsx +12 -2
- package/src/confirm-dialog/stories/index.js +8 -15
- package/src/confirm-dialog/test/index.js +42 -0
- package/src/dropdown/index.tsx +20 -10
- package/src/dropdown/types.ts +8 -0
- package/src/dropdown-menu/index.tsx +101 -85
- package/src/dropdown-menu/stories/index.tsx +1 -1
- package/src/dropdown-menu/types.ts +8 -0
- package/src/dropdown-menu-v2/index.tsx +2 -2
- package/src/dropdown-menu-v2/styles.ts +7 -5
- package/src/dropdown-menu-v2/types.ts +2 -2
- package/src/font-size-picker/index.tsx +9 -5
- package/src/font-size-picker/styles.ts +0 -10
- package/src/item-group/styles.ts +13 -5
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +16 -29
- package/src/mobile/bottom-sheet/cell.native.js +1 -1
- package/src/mobile/html-text-input/test/__snapshots__/index.native.js.snap +46 -0
- package/src/mobile/html-text-input/test/index.native.js +2 -2
- package/src/mobile/image/index.native.js +1 -1
- package/src/mobile/link-settings/test/link-settings-navigation.native.js +5 -16
- package/src/modal/style.scss +2 -2
- package/src/number-control/index.tsx +6 -3
- package/src/number-control/styles/number-control-styles.ts +8 -16
- package/src/popover/index.tsx +3 -2
- package/src/popover/stories/index.tsx +0 -13
- package/src/popover/test/index.tsx +22 -1
- package/src/popover/utils.ts +12 -0
- package/src/search-control/README.md +7 -1
- package/src/select-control/index.tsx +1 -0
- package/src/select-control/types.ts +6 -0
- package/src/toolbar/stories/index.tsx +0 -3
- package/src/toolbar/toolbar/index.tsx +3 -6
- package/src/toolbar/toolbar/toolbar-container.tsx +5 -9
- package/src/toolbar/toolbar-context/index.ts +2 -4
- package/src/toolbar/toolbar-dropdown-menu/index.js +0 -1
- package/src/toolbar/toolbar-item/index.tsx +13 -15
- package/src/toolbar/toolbar-item/types.ts +27 -0
- package/src/tooltip/test/index.native.js +1 -3
- package/src/unit-control/index.tsx +29 -95
- package/src/unit-control/stories/index.tsx +0 -4
- package/src/unit-control/test/index.tsx +151 -223
- package/src/unit-control/unit-select-control.tsx +20 -10
- package/src/z-stack/component.tsx +4 -2
- package/src/z-stack/stories/index.tsx +6 -13
- package/src/z-stack/styles.ts +23 -24
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -24,17 +23,19 @@ export function Option({
|
|
|
24
23
|
tooltipText,
|
|
25
24
|
...additionalProps
|
|
26
25
|
}) {
|
|
27
|
-
const optionButton = createElement(Button,
|
|
26
|
+
const optionButton = createElement(Button, {
|
|
28
27
|
isPressed: isSelected,
|
|
29
|
-
className: "components-circular-option-picker__option"
|
|
30
|
-
|
|
28
|
+
className: "components-circular-option-picker__option",
|
|
29
|
+
...additionalProps
|
|
30
|
+
});
|
|
31
31
|
return createElement("div", {
|
|
32
32
|
className: classnames(className, 'components-circular-option-picker__option-wrapper')
|
|
33
33
|
}, tooltipText ? createElement(Tooltip, {
|
|
34
34
|
text: tooltipText
|
|
35
|
-
}, optionButton) : optionButton, isSelected && createElement(Icon,
|
|
36
|
-
icon: check
|
|
37
|
-
|
|
35
|
+
}, optionButton) : optionButton, isSelected && createElement(Icon, {
|
|
36
|
+
icon: check,
|
|
37
|
+
...(selectedIconProps ? selectedIconProps : {})
|
|
38
|
+
}));
|
|
38
39
|
}
|
|
39
40
|
export function DropdownLinkAction({
|
|
40
41
|
buttonProps,
|
|
@@ -42,28 +43,31 @@ export function DropdownLinkAction({
|
|
|
42
43
|
dropdownProps,
|
|
43
44
|
linkText
|
|
44
45
|
}) {
|
|
45
|
-
return createElement(Dropdown,
|
|
46
|
+
return createElement(Dropdown, {
|
|
46
47
|
className: classnames('components-circular-option-picker__dropdown-link-action', className),
|
|
47
48
|
renderToggle: ({
|
|
48
49
|
isOpen,
|
|
49
50
|
onToggle
|
|
50
|
-
}) => createElement(Button,
|
|
51
|
+
}) => createElement(Button, {
|
|
51
52
|
"aria-expanded": isOpen,
|
|
52
53
|
"aria-haspopup": "true",
|
|
53
54
|
onClick: onToggle,
|
|
54
|
-
variant: "link"
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
variant: "link",
|
|
56
|
+
...buttonProps
|
|
57
|
+
}, linkText),
|
|
58
|
+
...dropdownProps
|
|
59
|
+
});
|
|
57
60
|
}
|
|
58
61
|
export function ButtonAction({
|
|
59
62
|
className,
|
|
60
63
|
children,
|
|
61
64
|
...additionalProps
|
|
62
65
|
}) {
|
|
63
|
-
return createElement(Button,
|
|
66
|
+
return createElement(Button, {
|
|
64
67
|
className: classnames('components-circular-option-picker__clear', className),
|
|
65
|
-
variant: "tertiary"
|
|
66
|
-
|
|
68
|
+
variant: "tertiary",
|
|
69
|
+
...additionalProps
|
|
70
|
+
}, children);
|
|
67
71
|
}
|
|
68
72
|
/**
|
|
69
73
|
*`CircularOptionPicker` is a component that displays a set of options as circular buttons.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/circular-option-picker/index.tsx"],"names":["classnames","Icon","check","Button","Dropdown","Tooltip","Option","className","isSelected","selectedIconProps","tooltipText","additionalProps","optionButton","DropdownLinkAction","buttonProps","dropdownProps","linkText","isOpen","onToggle","ButtonAction","children","CircularOptionPicker","props","actions","options"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/circular-option-picker/index.tsx"],"names":["classnames","Icon","check","Button","Dropdown","Tooltip","Option","className","isSelected","selectedIconProps","tooltipText","additionalProps","optionButton","DropdownLinkAction","buttonProps","dropdownProps","linkText","isOpen","onToggle","ButtonAction","children","CircularOptionPicker","props","actions","options"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,IAAT,EAAeC,KAAf,QAA4B,kBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,QAAP,MAAqB,aAArB;AACA,OAAOC,OAAP,MAAoB,YAApB;AASA,OAAO,SAASC,MAAT,CAAiB;AACvBC,EAAAA,SADuB;AAEvBC,EAAAA,UAFuB;AAGvBC,EAAAA,iBAHuB;AAIvBC,EAAAA,WAJuB;AAKvB,KAAGC;AALoB,CAAjB,EAMU;AAChB,QAAMC,YAAY,GACjB,cAAC,MAAD;AACC,IAAA,SAAS,EAAGJ,UADb;AAEC,IAAA,SAAS,EAAC,2CAFX;AAAA,OAGMG;AAHN,IADD;AAOA,SACC;AACC,IAAA,SAAS,EAAGX,UAAU,CACrBO,SADqB,EAErB,mDAFqB;AADvB,KAMGG,WAAW,GACZ,cAAC,OAAD;AAAS,IAAA,IAAI,EAAGA;AAAhB,KAAgCE,YAAhC,CADY,GAGZA,YATF,EAWGJ,UAAU,IACX,cAAC,IAAD;AACC,IAAA,IAAI,EAAGN,KADR;AAAA,QAEQO,iBAAiB,GAAGA,iBAAH,GAAuB,EAFhD;AAAA,IAZF,CADD;AAoBA;AAED,OAAO,SAASI,kBAAT,CAA6B;AACnCC,EAAAA,WADmC;AAEnCP,EAAAA,SAFmC;AAGnCQ,EAAAA,aAHmC;AAInCC,EAAAA;AAJmC,CAA7B,EAKsB;AAC5B,SACC,cAAC,QAAD;AACC,IAAA,SAAS,EAAGhB,UAAU,CACrB,yDADqB,EAErBO,SAFqB,CADvB;AAKC,IAAA,YAAY,EAAG,CAAE;AAAEU,MAAAA,MAAF;AAAUC,MAAAA;AAAV,KAAF,KACd,cAAC,MAAD;AACC,uBAAgBD,MADjB;AAEC,uBAAc,MAFf;AAGC,MAAA,OAAO,EAAGC,QAHX;AAIC,MAAA,OAAO,EAAC,MAJT;AAAA,SAKMJ;AALN,OAOGE,QAPH,CANF;AAAA,OAgBMD;AAhBN,IADD;AAoBA;AAED,OAAO,SAASI,YAAT,CAAuB;AAC7BZ,EAAAA,SAD6B;AAE7Ba,EAAAA,QAF6B;AAG7B,KAAGT;AAH0B,CAAvB,EAI8D;AACpE,SACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAGX,UAAU,CACrB,0CADqB,EAErBO,SAFqB,CADvB;AAKC,IAAA,OAAO,EAAC,UALT;AAAA,OAMMI;AANN,KAQGS,QARH,CADD;AAYA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASC,oBAAT,CAA+BC,KAA/B,EAAkE;AACjE,QAAM;AAAEC,IAAAA,OAAF;AAAWhB,IAAAA,SAAX;AAAsBiB,IAAAA,OAAtB;AAA+BJ,IAAAA;AAA/B,MAA4CE,KAAlD;AACA,SACC;AACC,IAAA,SAAS,EAAGtB,UAAU,CACrB,mCADqB,EAErBO,SAFqB;AADvB,KAMC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGiB,OADH,CAND,EASGJ,QATH,EAUGG,OAAO,IACR;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,OADH,CAXF,CADD;AAkBA;;AAEDF,oBAAoB,CAACf,MAArB,GAA8BA,MAA9B;AACAe,oBAAoB,CAACF,YAArB,GAAoCA,YAApC;AACAE,oBAAoB,CAACR,kBAArB,GAA0CA,kBAA1C;AAEA,eAAeQ,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { Icon, check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Button from '../button';\nimport Dropdown from '../dropdown';\nimport Tooltip from '../tooltip';\nimport type {\n\tCircularOptionPickerProps,\n\tDropdownLinkActionProps,\n\tOptionProps,\n} from './types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { ButtonAsButtonProps } from '../button/types';\n\nexport function Option( {\n\tclassName,\n\tisSelected,\n\tselectedIconProps,\n\ttooltipText,\n\t...additionalProps\n}: OptionProps ) {\n\tconst optionButton = (\n\t\t<Button\n\t\t\tisPressed={ isSelected }\n\t\t\tclassName=\"components-circular-option-picker__option\"\n\t\t\t{ ...additionalProps }\n\t\t/>\n\t);\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\tclassName,\n\t\t\t\t'components-circular-option-picker__option-wrapper'\n\t\t\t) }\n\t\t>\n\t\t\t{ tooltipText ? (\n\t\t\t\t<Tooltip text={ tooltipText }>{ optionButton }</Tooltip>\n\t\t\t) : (\n\t\t\t\toptionButton\n\t\t\t) }\n\t\t\t{ isSelected && (\n\t\t\t\t<Icon\n\t\t\t\t\ticon={ check }\n\t\t\t\t\t{ ...( selectedIconProps ? selectedIconProps : {} ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport function DropdownLinkAction( {\n\tbuttonProps,\n\tclassName,\n\tdropdownProps,\n\tlinkText,\n}: DropdownLinkActionProps ) {\n\treturn (\n\t\t<Dropdown\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-circular-option-picker__dropdown-link-action',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t<Button\n\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t>\n\t\t\t\t\t{ linkText }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\t{ ...dropdownProps }\n\t\t/>\n\t);\n}\n\nexport function ButtonAction( {\n\tclassName,\n\tchildren,\n\t...additionalProps\n}: WordPressComponentProps< ButtonAsButtonProps, 'button', false > ) {\n\treturn (\n\t\t<Button\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-circular-option-picker__clear',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tvariant=\"tertiary\"\n\t\t\t{ ...additionalProps }\n\t\t>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\n/**\n *`CircularOptionPicker` is a component that displays a set of options as circular buttons.\n *\n * ```jsx\n * import { CircularOptionPicker } from '../circular-option-picker';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ currentColor, setCurrentColor ] = useState();\n * \tconst colors = [\n * \t\t{ color: '#f00', name: 'Red' },\n * \t\t{ color: '#0f0', name: 'Green' },\n * \t\t{ color: '#00f', name: 'Blue' },\n * \t];\n * \tconst colorOptions = (\n * \t\t<>\n * \t\t\t{ colors.map( ( { color, name }, index ) => {\n * \t\t\t\treturn (\n * \t\t\t\t\t<CircularOptionPicker.Option\n * \t\t\t\t\t\tkey={ `${ color }-${ index }` }\n * \t\t\t\t\t\ttooltipText={ name }\n * \t\t\t\t\t\tstyle={ { backgroundColor: color, color } }\n * \t\t\t\t\t\tisSelected={ index === currentColor }\n * \t\t\t\t\t\tonClick={ () => setCurrentColor( index ) }\n * \t\t\t\t\t\taria-label={ name }\n * \t\t\t\t\t/>\n * \t\t\t\t);\n * \t\t\t} ) }\n * \t\t</>\n * \t);\n * \treturn (\n * \t\t<CircularOptionPicker\n * \t\t\t\toptions={ colorOptions }\n * \t\t\t\tactions={\n * \t\t\t\t\t<CircularOptionPicker.ButtonAction\n * \t\t\t\t\t\tonClick={ () => setCurrentColor( undefined ) }\n * \t\t\t\t\t>\n * \t\t\t\t\t\t{ 'Clear' }\n * \t\t\t\t\t</CircularOptionPicker.ButtonAction>\n * \t\t\t\t}\n * \t\t\t/>\n * \t);\n * };\n * ```\n */\n\nfunction CircularOptionPicker( props: CircularOptionPickerProps ) {\n\tconst { actions, className, options, children } = props;\n\treturn (\n\t\t<div\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-circular-option-picker',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<div className=\"components-circular-option-picker__swatches\">\n\t\t\t\t{ options }\n\t\t\t</div>\n\t\t\t{ children }\n\t\t\t{ actions && (\n\t\t\t\t<div className=\"components-circular-option-picker__custom-clear-wrapper\">\n\t\t\t\t\t{ actions }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nCircularOptionPicker.Option = Option;\nCircularOptionPicker.ButtonAction = ButtonAction;\nCircularOptionPicker.DropdownLinkAction = DropdownLinkAction;\n\nexport default CircularOptionPicker;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -18,15 +17,6 @@ import deprecated from '@wordpress/deprecated';
|
|
|
18
17
|
|
|
19
18
|
import Button from '../button';
|
|
20
19
|
const TIMEOUT = 4000;
|
|
21
|
-
/**
|
|
22
|
-
* @param {Object} props
|
|
23
|
-
* @param {string} [props.className]
|
|
24
|
-
* @param {import('react').ReactNode} props.children
|
|
25
|
-
* @param {() => void} props.onCopy
|
|
26
|
-
* @param {() => void} [props.onFinishCopy]
|
|
27
|
-
* @param {string} props.text
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
20
|
export default function ClipboardButton({
|
|
31
21
|
className,
|
|
32
22
|
children,
|
|
@@ -39,21 +29,22 @@ export default function ClipboardButton({
|
|
|
39
29
|
since: '5.8',
|
|
40
30
|
alternative: 'wp.compose.useCopyToClipboard'
|
|
41
31
|
});
|
|
42
|
-
/** @type {import('react').MutableRefObject<ReturnType<setTimeout> | undefined>} */
|
|
43
|
-
|
|
44
32
|
const timeoutId = useRef();
|
|
45
33
|
const ref = useCopyToClipboard(text, () => {
|
|
46
|
-
onCopy();
|
|
34
|
+
onCopy();
|
|
47
35
|
|
|
48
|
-
|
|
36
|
+
if (timeoutId.current) {
|
|
37
|
+
clearTimeout(timeoutId.current);
|
|
38
|
+
}
|
|
49
39
|
|
|
50
40
|
if (onFinishCopy) {
|
|
51
41
|
timeoutId.current = setTimeout(() => onFinishCopy(), TIMEOUT);
|
|
52
42
|
}
|
|
53
43
|
});
|
|
54
44
|
useEffect(() => {
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
if (timeoutId.current) {
|
|
46
|
+
clearTimeout(timeoutId.current);
|
|
47
|
+
}
|
|
57
48
|
}, []);
|
|
58
49
|
const classes = classnames('components-clipboard-button', className); // Workaround for inconsistent behavior in Safari, where <textarea> is not
|
|
59
50
|
// the document.activeElement at the moment when the copy event fires.
|
|
@@ -61,17 +52,15 @@ export default function ClipboardButton({
|
|
|
61
52
|
// mistakenly override the ClipboardButton, and copy a serialized string
|
|
62
53
|
// of the current block instead.
|
|
63
54
|
|
|
64
|
-
/** @type {import('react').ClipboardEventHandler<HTMLButtonElement>} */
|
|
65
|
-
|
|
66
55
|
const focusOnCopyEventTarget = event => {
|
|
67
56
|
// @ts-expect-error: Should be currentTarget, but not changing because this component is deprecated.
|
|
68
57
|
event.target.focus();
|
|
69
58
|
};
|
|
70
59
|
|
|
71
|
-
return createElement(Button,
|
|
60
|
+
return createElement(Button, { ...buttonProps,
|
|
72
61
|
className: classes,
|
|
73
62
|
ref: ref,
|
|
74
63
|
onCopy: focusOnCopyEventTarget
|
|
75
|
-
}
|
|
64
|
+
}, children);
|
|
76
65
|
}
|
|
77
66
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/clipboard-button/index.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/clipboard-button/index.tsx"],"names":["classnames","useRef","useEffect","useCopyToClipboard","deprecated","Button","TIMEOUT","ClipboardButton","className","children","onCopy","onFinishCopy","text","buttonProps","since","alternative","timeoutId","ref","current","clearTimeout","setTimeout","classes","focusOnCopyEventTarget","event","target","focus"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,EAAiBC,SAAjB,QAAkC,oBAAlC;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,WAAnB;AAIA,MAAMC,OAAO,GAAG,IAAhB;AAEA,eAAe,SAASC,eAAT,CAA0B;AACxCC,EAAAA,SADwC;AAExCC,EAAAA,QAFwC;AAGxCC,EAAAA,MAHwC;AAIxCC,EAAAA,YAJwC;AAKxCC,EAAAA,IALwC;AAMxC,KAAGC;AANqC,CAA1B,EAOuD;AACrET,EAAAA,UAAU,CAAE,+BAAF,EAAmC;AAC5CU,IAAAA,KAAK,EAAE,KADqC;AAE5CC,IAAAA,WAAW,EAAE;AAF+B,GAAnC,CAAV;AAKA,QAAMC,SAAS,GAAGf,MAAM,EAAxB;AACA,QAAMgB,GAAG,GAAGd,kBAAkB,CAAES,IAAF,EAAQ,MAAM;AAC3CF,IAAAA,MAAM;;AACN,QAAKM,SAAS,CAACE,OAAf,EAAyB;AACxBC,MAAAA,YAAY,CAAEH,SAAS,CAACE,OAAZ,CAAZ;AACA;;AAED,QAAKP,YAAL,EAAoB;AACnBK,MAAAA,SAAS,CAACE,OAAV,GAAoBE,UAAU,CAAE,MAAMT,YAAY,EAApB,EAAwBL,OAAxB,CAA9B;AACA;AACD,GAT6B,CAA9B;AAWAJ,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKc,SAAS,CAACE,OAAf,EAAyB;AACxBC,MAAAA,YAAY,CAAEH,SAAS,CAACE,OAAZ,CAAZ;AACA;AACD,GAJQ,EAIN,EAJM,CAAT;AAMA,QAAMG,OAAO,GAAGrB,UAAU,CAAE,6BAAF,EAAiCQ,SAAjC,CAA1B,CAxBqE,CA0BrE;AACA;AACA;AACA;AACA;;AACA,QAAMc,sBAAmD,GAAKC,KAAF,IAAa;AACxE;AACAA,IAAAA,KAAK,CAACC,MAAN,CAAaC,KAAb;AACA,GAHD;;AAKA,SACC,cAAC,MAAD,OACMZ,WADN;AAEC,IAAA,SAAS,EAAGQ,OAFb;AAGC,IAAA,GAAG,EAAGJ,GAHP;AAIC,IAAA,MAAM,EAAGK;AAJV,KAMGb,QANH,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\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 type { ClipboardButtonProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\nconst TIMEOUT = 4000;\n\nexport default function ClipboardButton( {\n\tclassName,\n\tchildren,\n\tonCopy,\n\tonFinishCopy,\n\ttext,\n\t...buttonProps\n}: WordPressComponentProps< ClipboardButtonProps, 'button', false > ) {\n\tdeprecated( 'wp.components.ClipboardButton', {\n\t\tsince: '5.8',\n\t\talternative: 'wp.compose.useCopyToClipboard',\n\t} );\n\n\tconst timeoutId = useRef< NodeJS.Timeout >();\n\tconst ref = useCopyToClipboard( text, () => {\n\t\tonCopy();\n\t\tif ( timeoutId.current ) {\n\t\t\tclearTimeout( timeoutId.current );\n\t\t}\n\n\t\tif ( onFinishCopy ) {\n\t\t\ttimeoutId.current = setTimeout( () => onFinishCopy(), TIMEOUT );\n\t\t}\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( timeoutId.current ) {\n\t\t\tclearTimeout( timeoutId.current );\n\t\t}\n\t}, [] );\n\n\tconst classes = classnames( 'components-clipboard-button', className );\n\n\t// Workaround for inconsistent behavior in Safari, where <textarea> is not\n\t// the document.activeElement at the moment when the copy event fires.\n\t// This causes documentHasSelection() in the copy-handler component to\n\t// mistakenly override the ClipboardButton, and copy a serialized string\n\t// of the current block instead.\n\tconst focusOnCopyEventTarget: React.ClipboardEventHandler = ( event ) => {\n\t\t// @ts-expect-error: Should be currentTarget, but not changing because this component is deprecated.\n\t\tevent.target.focus();\n\t};\n\n\treturn (\n\t\t<Button\n\t\t\t{ ...buttonProps }\n\t\t\tclassName={ classes }\n\t\t\tref={ ref }\n\t\t\tonCopy={ focusOnCopyEventTarget }\n\t\t>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -13,12 +12,13 @@ function ColorControl({
|
|
|
13
12
|
withColorIndicator,
|
|
14
13
|
...props
|
|
15
14
|
}) {
|
|
16
|
-
return createElement(ColorCell,
|
|
15
|
+
return createElement(ColorCell, {
|
|
17
16
|
label: label,
|
|
18
17
|
onPress: onPress,
|
|
19
18
|
color: color,
|
|
20
|
-
withColorIndicator: withColorIndicator
|
|
21
|
-
|
|
19
|
+
withColorIndicator: withColorIndicator,
|
|
20
|
+
...props
|
|
21
|
+
});
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export default ColorControl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-control/index.native.js"],"names":["ColorCell","ColorControl","label","onPress","color","withColorIndicator","props"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-control/index.native.js"],"names":["ColorCell","ColorControl","label","onPress","color","withColorIndicator","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,mCAAtB;;AAEA,SAASC,YAAT,CAAuB;AACtBC,EAAAA,KADsB;AAEtBC,EAAAA,OAFsB;AAGtBC,EAAAA,KAHsB;AAItBC,EAAAA,kBAJsB;AAKtB,KAAGC;AALmB,CAAvB,EAMI;AACH,SACC,cAAC,SAAD;AACC,IAAA,KAAK,EAAGJ,KADT;AAEC,IAAA,OAAO,EAAGC,OAFX;AAGC,IAAA,KAAK,EAAGC,KAHT;AAIC,IAAA,kBAAkB,EAAGC,kBAJtB;AAAA,OAKMC;AALN,IADD;AASA;;AAED,eAAeL,YAAf","sourcesContent":["/**\n * Internal dependencies\n */\nimport ColorCell from '../mobile/bottom-sheet/color-cell';\n\nfunction ColorControl( {\n\tlabel,\n\tonPress,\n\tcolor,\n\twithColorIndicator,\n\t...props\n} ) {\n\treturn (\n\t\t<ColorCell\n\t\t\tlabel={ label }\n\t\t\tonPress={ onPress }\n\t\t\tcolor={ color }\n\t\t\twithColorIndicator={ withColorIndicator }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nexport default ColorControl;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -20,13 +19,14 @@ function UnforwardedColorIndicator(props, forwardedRef) {
|
|
|
20
19
|
colorValue,
|
|
21
20
|
...additionalProps
|
|
22
21
|
} = props;
|
|
23
|
-
return createElement("span",
|
|
22
|
+
return createElement("span", {
|
|
24
23
|
className: classnames('component-color-indicator', className),
|
|
25
24
|
style: {
|
|
26
25
|
background: colorValue
|
|
27
26
|
},
|
|
28
|
-
ref: forwardedRef
|
|
29
|
-
|
|
27
|
+
ref: forwardedRef,
|
|
28
|
+
...additionalProps
|
|
29
|
+
});
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* ColorIndicator is a React component that renders a specific color in a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-indicator/index.tsx"],"names":["classnames","forwardRef","UnforwardedColorIndicator","props","forwardedRef","className","colorValue","additionalProps","background","ColorIndicator"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-indicator/index.tsx"],"names":["classnames","forwardRef","UnforwardedColorIndicator","props","forwardedRef","className","colorValue","additionalProps","background","ColorIndicator"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;;AAGA;AACA;AACA;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AAIA,SAASC,yBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,UAAb;AAAyB,OAAGC;AAA5B,MAAgDJ,KAAtD;AAEA,SACC;AACC,IAAA,SAAS,EAAGH,UAAU,CAAE,2BAAF,EAA+BK,SAA/B,CADvB;AAEC,IAAA,KAAK,EAAG;AAAEG,MAAAA,UAAU,EAAEF;AAAd,KAFT;AAGC,IAAA,GAAG,EAAGF,YAHP;AAAA,OAIMG;AAJN,IADD;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAME,cAAc,GAAGR,UAAU,CAAEC,yBAAF,CAAjC;AAEP,eAAeO,cAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { ColorIndicatorProps } from './types';\n\nfunction UnforwardedColorIndicator(\n\tprops: WordPressComponentProps< ColorIndicatorProps, 'span', false >,\n\tforwardedRef: ForwardedRef< HTMLSpanElement >\n) {\n\tconst { className, colorValue, ...additionalProps } = props;\n\n\treturn (\n\t\t<span\n\t\t\tclassName={ classnames( 'component-color-indicator', className ) }\n\t\t\tstyle={ { background: colorValue } }\n\t\t\tref={ forwardedRef }\n\t\t\t{ ...additionalProps }\n\t\t/>\n\t);\n}\n\n/**\n * ColorIndicator is a React component that renders a specific color in a\n * circle. It's often used to summarize a collection of used colors in a child\n * component.\n *\n * ```jsx\n * import { ColorIndicator } from '@wordpress/components';\n *\n * const MyColorIndicator = () => <ColorIndicator colorValue=\"#0073aa\" />;\n * ```\n */\nexport const ColorIndicator = forwardRef( UnforwardedColorIndicator );\n\nexport default ColorIndicator;\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -123,10 +122,11 @@ export function CustomColorPickerDropdown({
|
|
|
123
122
|
}),
|
|
124
123
|
...receivedPopoverProps
|
|
125
124
|
}), [isRenderedInSidebar, receivedPopoverProps]);
|
|
126
|
-
return createElement(Dropdown,
|
|
125
|
+
return createElement(Dropdown, {
|
|
127
126
|
contentClassName: "components-color-palette__custom-color-dropdown-content",
|
|
128
|
-
popoverProps: popoverProps
|
|
129
|
-
|
|
127
|
+
popoverProps: popoverProps,
|
|
128
|
+
...props
|
|
129
|
+
});
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
function UnforwardedColorPalette(props, forwardedRef) {
|
|
@@ -172,10 +172,11 @@ function UnforwardedColorPalette(props, forwardedRef) {
|
|
|
172
172
|
}, __('Clear')),
|
|
173
173
|
headingLevel
|
|
174
174
|
};
|
|
175
|
-
return createElement(VStack,
|
|
175
|
+
return createElement(VStack, {
|
|
176
176
|
spacing: 3,
|
|
177
|
-
ref: forwardedRef
|
|
178
|
-
|
|
177
|
+
ref: forwardedRef,
|
|
178
|
+
...otherProps
|
|
179
|
+
}, !disableCustomColors && createElement(CustomColorPickerDropdown, {
|
|
179
180
|
isRenderedInSidebar: __experimentalIsRenderedInSidebar,
|
|
180
181
|
renderContent: renderCustomColorPicker,
|
|
181
182
|
renderToggle: ({
|
|
@@ -204,11 +205,11 @@ function UnforwardedColorPalette(props, forwardedRef) {
|
|
|
204
205
|
'components-color-palette__custom-color-value--is-hex': isHex
|
|
205
206
|
})
|
|
206
207
|
}, displayValue)))
|
|
207
|
-
}), hasMultipleColorOrigins ? createElement(MultiplePalettes,
|
|
208
|
+
}), hasMultipleColorOrigins ? createElement(MultiplePalettes, { ...paletteCommonProps,
|
|
208
209
|
colors: colors
|
|
209
|
-
})
|
|
210
|
+
}) : createElement(SinglePalette, { ...paletteCommonProps,
|
|
210
211
|
colors: colors
|
|
211
|
-
}))
|
|
212
|
+
}));
|
|
212
213
|
}
|
|
213
214
|
/**
|
|
214
215
|
* Allows the user to pick a color from a list of pre-defined color entries.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-palette/index.tsx"],"names":["colord","extend","namesPlugin","a11yPlugin","classnames","__","sprintf","useCallback","useMemo","useState","forwardRef","Dropdown","ColorPicker","CircularOptionPicker","VStack","Truncate","ColorHeading","DropdownContentWrapper","extractColorNameFromCurrentValue","isMultiplePaletteArray","normalizeColorValue","SinglePalette","className","clearColor","colors","onChange","value","actions","colorOptions","map","color","name","index","colordColor","isSelected","fill","contrast","backgroundColor","MultiplePalettes","headingLevel","length","colorPalette","newColor","CustomColorPickerDropdown","isRenderedInSidebar","popoverProps","receivedPopoverProps","props","shift","placement","offset","UnforwardedColorPalette","forwardedRef","clearable","disableCustomColors","enableAlpha","__experimentalIsRenderedInSidebar","otherProps","normalizedColorValue","setNormalizedColorValue","undefined","customColorPaletteCallbackRef","node","hasMultipleColorOrigins","buttonLabelName","renderCustomColorPicker","isHex","startsWith","displayValue","replace","customColorAccessibleLabel","split","join","paletteCommonProps","isOpen","onToggle","background","ColorPalette"],"mappings":";;;AAAA;AACA;AACA;AAEA,SAASA,MAAT,EAAiBC,MAAjB,QAA+B,QAA/B;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAC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SAAS,EAAC,qDADX;AAEC,MAAA,OAAO,EAAG;AAFX,OAIC,cAAC,QAAD;AAAU,MAAA,SAAS,EAAC;AAApB,OACGA,KAAK,GACJsC,eADI,GAEJ,mBAHJ,CAJD,EAcC,cAAC,QAAD;AACC,MAAA,SAAS,EAAG5D,UAAU,CACrB,8CADqB,EAErB;AACC,gEACC8D;AAFF,OAFqB;AADvB,OASGE,YATH,CAdD,CAfD;AAJF,IAFF,EAmDGL,uBAAuB,GACxB,cAAC,gBAAD,eACMU,kBADN;AAEC,IAAA,MAAM,EAAGjD;AAFV,KADwB,GAMxB,cAAC,aAAD,eACMiD,kBADN;AAEC,IAAA,MAAM,EAAGjD;AAFV,KAzDF,CADD;AAiEA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMqD,YAAY,GAAGnE,UAAU,CAAEyC,uBAAF,CAA/B;AAEP,eAAe0B,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\nimport type {\n\tColorObject,\n\tColorPaletteProps,\n\tCustomColorPickerDropdownProps,\n\tMultiplePalettesProps,\n\tPaletteObject,\n\tSinglePaletteProps,\n} from './types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { DropdownProps } from '../dropdown/types';\nimport {\n\textractColorNameFromCurrentValue,\n\tisMultiplePaletteArray,\n\tnormalizeColorValue,\n} from './utils';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nfunction SinglePalette( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n}: SinglePaletteProps ) {\n\tconst colorOptions = useMemo( () => {\n\t\treturn colors.map( ( { color, name }, index ) => {\n\t\t\tconst colordColor = colord( color );\n\t\t\tconst isSelected = value === color;\n\n\t\t\treturn (\n\t\t\t\t<CircularOptionPicker.Option\n\t\t\t\t\tkey={ `${ color }-${ index }` }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tselectedIconProps={\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfill:\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t}\n\t\t\t\t\ttooltipText={\n\t\t\t\t\t\tname ||\n\t\t\t\t\t\t// translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\tsprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t\tstyle={ { backgroundColor: color, color } }\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisSelected ? clearColor : () => onChange( color, index )\n\t\t\t\t\t}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tname\n\t\t\t\t\t\t\t? // translators: %s: The name of the color e.g: \"vivid red\".\n\t\t\t\t\t\t\t sprintf( __( 'Color: %s' ), name )\n\t\t\t\t\t\t\t: // translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\t\t sprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ colors, value, onChange, clearColor ] );\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\tclassName={ className }\n\t\t\toptions={ colorOptions }\n\t\t\tactions={ actions }\n\t\t/>\n\t);\n}\n\nfunction MultiplePalettes( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n\theadingLevel,\n}: MultiplePalettesProps ) {\n\tif ( colors.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ colors.map( ( { name, colors: colorPalette }, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading level={ headingLevel }>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t</ColorHeading>\n\t\t\t\t\t\t<SinglePalette\n\t\t\t\t\t\t\tclearColor={ clearColor }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tonChange={ ( newColor ) =>\n\t\t\t\t\t\t\t\tonChange( newColor, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\tcolors.length === index + 1 ? actions : null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport function CustomColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tpopoverProps: receivedPopoverProps,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\tconst popoverProps = useMemo< DropdownProps[ 'popoverProps' ] >(\n\t\t() => ( {\n\t\t\tshift: true,\n\t\t\t...( isRenderedInSidebar\n\t\t\t\t? {\n\t\t\t\t\t\t// When in the sidebar: open to the left (stacking),\n\t\t\t\t\t\t// leaving the same gap as the parent popover.\n\t\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t\toffset: 34,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\t// Default behavior: open below the anchor\n\t\t\t\t\t\tplacement: 'bottom',\n\t\t\t\t\t\toffset: 8,\n\t\t\t\t } ),\n\t\t\t...receivedPopoverProps,\n\t\t} ),\n\t\t[ isRenderedInSidebar, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"components-color-palette__custom-color-dropdown-content\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction UnforwardedColorPalette(\n\tprops: WordPressComponentProps< ColorPaletteProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tclearable = true,\n\t\tcolors = [],\n\t\tdisableCustomColors = false,\n\t\tenableAlpha = false,\n\t\tonChange,\n\t\tvalue,\n\t\t__experimentalIsRenderedInSidebar = false,\n\t\theadingLevel = 2,\n\t\t...otherProps\n\t} = props;\n\tconst [ normalizedColorValue, setNormalizedColorValue ] = useState( value );\n\n\tconst clearColor = useCallback( () => onChange( undefined ), [ onChange ] );\n\n\tconst customColorPaletteCallbackRef = useCallback(\n\t\t( node: HTMLElement | null ) => {\n\t\t\tsetNormalizedColorValue( normalizeColorValue( value, node ) );\n\t\t},\n\t\t[ value ]\n\t);\n\n\tconst hasMultipleColorOrigins = isMultiplePaletteArray( colors );\n\tconst buttonLabelName = useMemo(\n\t\t() =>\n\t\t\textractColorNameFromCurrentValue(\n\t\t\t\tvalue,\n\t\t\t\tcolors,\n\t\t\t\thasMultipleColorOrigins\n\t\t\t),\n\t\t[ value, colors, hasMultipleColorOrigins ]\n\t);\n\n\tconst renderCustomColorPicker = () => (\n\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t<ColorPicker\n\t\t\t\tcolor={ normalizedColorValue }\n\t\t\t\tonChange={ ( color ) => onChange( color ) }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t</DropdownContentWrapper>\n\t);\n\tconst isHex = value?.startsWith( '#' );\n\n\t// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n\tconst displayValue = value?.replace( /^var\\((.+)\\)$/, '$1' );\n\tconst customColorAccessibleLabel = !! displayValue\n\t\t? sprintf(\n\t\t\t\t// translators: %1$s: The name of the color e.g: \"vivid red\". %2$s: The color's hex code, with added hyphens e.g: \"#-f-0-0\".\n\t\t\t\t__(\n\t\t\t\t\t'Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t),\n\t\t\t\tbuttonLabelName,\n\t\t\t\tisHex ? displayValue.split( '' ).join( '-' ) : displayValue\n\t\t )\n\t\t: __( 'Custom color picker.' );\n\n\tconst paletteCommonProps = {\n\t\tclearable,\n\t\tclearColor,\n\t\tonChange,\n\t\tvalue,\n\t\tactions: !! clearable && (\n\t\t\t<CircularOptionPicker.ButtonAction onClick={ clearColor }>\n\t\t\t\t{ __( 'Clear' ) }\n\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t),\n\t\theadingLevel,\n\t};\n\n\treturn (\n\t\t<VStack spacing={ 3 } ref={ forwardedRef } { ...otherProps }>\n\t\t\t{ ! disableCustomColors && (\n\t\t\t\t<CustomColorPickerDropdown\n\t\t\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\t\t\trenderContent={ renderCustomColorPicker }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-wrapper\"\n\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tref={ customColorPaletteCallbackRef }\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-button\"\n\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\taria-label={ customColorAccessibleLabel }\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tbackground: value,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-text-wrapper\"\n\t\t\t\t\t\t\t\tspacing={ 0.5 }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Truncate className=\"components-color-palette__custom-color-name\">\n\t\t\t\t\t\t\t\t\t{ value\n\t\t\t\t\t\t\t\t\t\t? buttonLabelName\n\t\t\t\t\t\t\t\t\t\t: 'No color selected' }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t\t\tThis `Truncate` is always rendered, even if\n\t\t\t\t\t\t\t\tthere is no `displayValue`, to ensure the layout\n\t\t\t\t\t\t\t\tdoes not shift\n\t\t\t\t\t\t\t\t*/ }\n\t\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'components-color-palette__custom-color-value',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'components-color-palette__custom-color-value--is-hex':\n\t\t\t\t\t\t\t\t\t\t\t\tisHex,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ displayValue }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasMultipleColorOrigins ? (\n\t\t\t\t<MultiplePalettes\n\t\t\t\t\t{ ...paletteCommonProps }\n\t\t\t\t\tcolors={ colors as PaletteObject[] }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SinglePalette\n\t\t\t\t\t{ ...paletteCommonProps }\n\t\t\t\t\tcolors={ colors as ColorObject[] }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Allows the user to pick a color from a list of pre-defined color entries.\n *\n * ```jsx\n * import { ColorPalette } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyColorPalette = () => {\n * const [ color, setColor ] = useState ( '#f00' )\n * const colors = [\n * { name: 'red', color: '#f00' },\n * { name: 'white', color: '#fff' },\n * { name: 'blue', color: '#00f' },\n * ];\n * return (\n * <ColorPalette\n * colors={ colors }\n * value={ color }\n * onChange={ ( color ) => setColor( color ) }\n * />\n * );\n * } );\n * ```\n */\nexport const ColorPalette = forwardRef( UnforwardedColorPalette );\n\nexport default ColorPalette;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-palette/index.tsx"],"names":["colord","extend","namesPlugin","a11yPlugin","classnames","__","sprintf","useCallback","useMemo","useState","forwardRef","Dropdown","ColorPicker","CircularOptionPicker","VStack","Truncate","ColorHeading","DropdownContentWrapper","extractColorNameFromCurrentValue","isMultiplePaletteArray","normalizeColorValue","SinglePalette","className","clearColor","colors","onChange","value","actions","colorOptions","map","color","name","index","colordColor","isSelected","fill","contrast","backgroundColor","MultiplePalettes","headingLevel","length","colorPalette","newColor","CustomColorPickerDropdown","isRenderedInSidebar","popoverProps","receivedPopoverProps","props","shift","placement","offset","UnforwardedColorPalette","forwardedRef","clearable","disableCustomColors","enableAlpha","__experimentalIsRenderedInSidebar","otherProps","normalizedColorValue","setNormalizedColorValue","undefined","customColorPaletteCallbackRef","node","hasMultipleColorOrigins","buttonLabelName","renderCustomColorPicker","isHex","startsWith","displayValue","replace","customColorAccessibleLabel","split","join","paletteCommonProps","isOpen","onToggle","background","ColorPalette"],"mappings":";;AAAA;AACA;AACA;AAEA,SAASA,MAAT,EAAiBC,MAAjB,QAA+B,Q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,EAAElD;AADL;AAPT,MAJD,EAeC,cAAC,MAAD;AACC,MAAA,SAAS,EAAC,qDADX;AAEC,MAAA,OAAO,EAAG;AAFX,OAIC,cAAC,QAAD;AAAU,MAAA,SAAS,EAAC;AAApB,OACGA,KAAK,GACJsC,eADI,GAEJ,mBAHJ,CAJD,EAcC,cAAC,QAAD;AACC,MAAA,SAAS,EAAG5D,UAAU,CACrB,8CADqB,EAErB;AACC,gEACC8D;AAFF,OAFqB;AADvB,OASGE,YATH,CAdD,CAfD;AAJF,IAFF,EAmDGL,uBAAuB,GACxB,cAAC,gBAAD,OACMU,kBADN;AAEC,IAAA,MAAM,EAAGjD;AAFV,IADwB,GAMxB,cAAC,aAAD,OACMiD,kBADN;AAEC,IAAA,MAAM,EAAGjD;AAFV,IAzDF,CADD;AAiEA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMqD,YAAY,GAAGnE,UAAU,CAAEyC,uBAAF,CAA/B;AAEP,eAAe0B,YAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo, useState, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport Dropdown from '../dropdown';\nimport { ColorPicker } from '../color-picker';\nimport CircularOptionPicker from '../circular-option-picker';\nimport { VStack } from '../v-stack';\nimport { Truncate } from '../truncate';\nimport { ColorHeading } from './styles';\nimport DropdownContentWrapper from '../dropdown/dropdown-content-wrapper';\nimport type {\n\tColorObject,\n\tColorPaletteProps,\n\tCustomColorPickerDropdownProps,\n\tMultiplePalettesProps,\n\tPaletteObject,\n\tSinglePaletteProps,\n} from './types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { DropdownProps } from '../dropdown/types';\nimport {\n\textractColorNameFromCurrentValue,\n\tisMultiplePaletteArray,\n\tnormalizeColorValue,\n} from './utils';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\nfunction SinglePalette( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n}: SinglePaletteProps ) {\n\tconst colorOptions = useMemo( () => {\n\t\treturn colors.map( ( { color, name }, index ) => {\n\t\t\tconst colordColor = colord( color );\n\t\t\tconst isSelected = value === color;\n\n\t\t\treturn (\n\t\t\t\t<CircularOptionPicker.Option\n\t\t\t\t\tkey={ `${ color }-${ index }` }\n\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\tselectedIconProps={\n\t\t\t\t\t\tisSelected\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tfill:\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast() >\n\t\t\t\t\t\t\t\t\t\tcolordColor.contrast( '#000' )\n\t\t\t\t\t\t\t\t\t\t\t? '#fff'\n\t\t\t\t\t\t\t\t\t\t\t: '#000',\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t: {}\n\t\t\t\t\t}\n\t\t\t\t\ttooltipText={\n\t\t\t\t\t\tname ||\n\t\t\t\t\t\t// translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\tsprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t\tstyle={ { backgroundColor: color, color } }\n\t\t\t\t\tonClick={\n\t\t\t\t\t\tisSelected ? clearColor : () => onChange( color, index )\n\t\t\t\t\t}\n\t\t\t\t\taria-label={\n\t\t\t\t\t\tname\n\t\t\t\t\t\t\t? // translators: %s: The name of the color e.g: \"vivid red\".\n\t\t\t\t\t\t\t sprintf( __( 'Color: %s' ), name )\n\t\t\t\t\t\t\t: // translators: %s: color hex code e.g: \"#f00\".\n\t\t\t\t\t\t\t sprintf( __( 'Color code: %s' ), color )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t);\n\t\t} );\n\t}, [ colors, value, onChange, clearColor ] );\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\tclassName={ className }\n\t\t\toptions={ colorOptions }\n\t\t\tactions={ actions }\n\t\t/>\n\t);\n}\n\nfunction MultiplePalettes( {\n\tclassName,\n\tclearColor,\n\tcolors,\n\tonChange,\n\tvalue,\n\tactions,\n\theadingLevel,\n}: MultiplePalettesProps ) {\n\tif ( colors.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ colors.map( ( { name, colors: colorPalette }, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading level={ headingLevel }>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t</ColorHeading>\n\t\t\t\t\t\t<SinglePalette\n\t\t\t\t\t\t\tclearColor={ clearColor }\n\t\t\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\t\t\tonChange={ ( newColor ) =>\n\t\t\t\t\t\t\t\tonChange( newColor, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\t\tcolors.length === index + 1 ? actions : null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport function CustomColorPickerDropdown( {\n\tisRenderedInSidebar,\n\tpopoverProps: receivedPopoverProps,\n\t...props\n}: CustomColorPickerDropdownProps ) {\n\tconst popoverProps = useMemo< DropdownProps[ 'popoverProps' ] >(\n\t\t() => ( {\n\t\t\tshift: true,\n\t\t\t...( isRenderedInSidebar\n\t\t\t\t? {\n\t\t\t\t\t\t// When in the sidebar: open to the left (stacking),\n\t\t\t\t\t\t// leaving the same gap as the parent popover.\n\t\t\t\t\t\tplacement: 'left-start',\n\t\t\t\t\t\toffset: 34,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\t// Default behavior: open below the anchor\n\t\t\t\t\t\tplacement: 'bottom',\n\t\t\t\t\t\toffset: 8,\n\t\t\t\t } ),\n\t\t\t...receivedPopoverProps,\n\t\t} ),\n\t\t[ isRenderedInSidebar, receivedPopoverProps ]\n\t);\n\n\treturn (\n\t\t<Dropdown\n\t\t\tcontentClassName=\"components-color-palette__custom-color-dropdown-content\"\n\t\t\tpopoverProps={ popoverProps }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n}\n\nfunction UnforwardedColorPalette(\n\tprops: WordPressComponentProps< ColorPaletteProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tclearable = true,\n\t\tcolors = [],\n\t\tdisableCustomColors = false,\n\t\tenableAlpha = false,\n\t\tonChange,\n\t\tvalue,\n\t\t__experimentalIsRenderedInSidebar = false,\n\t\theadingLevel = 2,\n\t\t...otherProps\n\t} = props;\n\tconst [ normalizedColorValue, setNormalizedColorValue ] = useState( value );\n\n\tconst clearColor = useCallback( () => onChange( undefined ), [ onChange ] );\n\n\tconst customColorPaletteCallbackRef = useCallback(\n\t\t( node: HTMLElement | null ) => {\n\t\t\tsetNormalizedColorValue( normalizeColorValue( value, node ) );\n\t\t},\n\t\t[ value ]\n\t);\n\n\tconst hasMultipleColorOrigins = isMultiplePaletteArray( colors );\n\tconst buttonLabelName = useMemo(\n\t\t() =>\n\t\t\textractColorNameFromCurrentValue(\n\t\t\t\tvalue,\n\t\t\t\tcolors,\n\t\t\t\thasMultipleColorOrigins\n\t\t\t),\n\t\t[ value, colors, hasMultipleColorOrigins ]\n\t);\n\n\tconst renderCustomColorPicker = () => (\n\t\t<DropdownContentWrapper paddingSize=\"none\">\n\t\t\t<ColorPicker\n\t\t\t\tcolor={ normalizedColorValue }\n\t\t\t\tonChange={ ( color ) => onChange( color ) }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t</DropdownContentWrapper>\n\t);\n\tconst isHex = value?.startsWith( '#' );\n\n\t// Leave hex values as-is. Remove the `var()` wrapper from CSS vars.\n\tconst displayValue = value?.replace( /^var\\((.+)\\)$/, '$1' );\n\tconst customColorAccessibleLabel = !! displayValue\n\t\t? sprintf(\n\t\t\t\t// translators: %1$s: The name of the color e.g: \"vivid red\". %2$s: The color's hex code, with added hyphens e.g: \"#-f-0-0\".\n\t\t\t\t__(\n\t\t\t\t\t'Custom color picker. The currently selected color is called \"%1$s\" and has a value of \"%2$s\".'\n\t\t\t\t),\n\t\t\t\tbuttonLabelName,\n\t\t\t\tisHex ? displayValue.split( '' ).join( '-' ) : displayValue\n\t\t )\n\t\t: __( 'Custom color picker.' );\n\n\tconst paletteCommonProps = {\n\t\tclearable,\n\t\tclearColor,\n\t\tonChange,\n\t\tvalue,\n\t\tactions: !! clearable && (\n\t\t\t<CircularOptionPicker.ButtonAction onClick={ clearColor }>\n\t\t\t\t{ __( 'Clear' ) }\n\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t),\n\t\theadingLevel,\n\t};\n\n\treturn (\n\t\t<VStack spacing={ 3 } ref={ forwardedRef } { ...otherProps }>\n\t\t\t{ ! disableCustomColors && (\n\t\t\t\t<CustomColorPickerDropdown\n\t\t\t\t\tisRenderedInSidebar={ __experimentalIsRenderedInSidebar }\n\t\t\t\t\trenderContent={ renderCustomColorPicker }\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-wrapper\"\n\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tref={ customColorPaletteCallbackRef }\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-button\"\n\t\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\t\taria-label={ customColorAccessibleLabel }\n\t\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\t\tbackground: value,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\t\tclassName=\"components-color-palette__custom-color-text-wrapper\"\n\t\t\t\t\t\t\t\tspacing={ 0.5 }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Truncate className=\"components-color-palette__custom-color-name\">\n\t\t\t\t\t\t\t\t\t{ value\n\t\t\t\t\t\t\t\t\t\t? buttonLabelName\n\t\t\t\t\t\t\t\t\t\t: 'No color selected' }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t\t\tThis `Truncate` is always rendered, even if\n\t\t\t\t\t\t\t\tthere is no `displayValue`, to ensure the layout\n\t\t\t\t\t\t\t\tdoes not shift\n\t\t\t\t\t\t\t\t*/ }\n\t\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'components-color-palette__custom-color-value',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'components-color-palette__custom-color-value--is-hex':\n\t\t\t\t\t\t\t\t\t\t\t\tisHex,\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ displayValue }\n\t\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasMultipleColorOrigins ? (\n\t\t\t\t<MultiplePalettes\n\t\t\t\t\t{ ...paletteCommonProps }\n\t\t\t\t\tcolors={ colors as PaletteObject[] }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<SinglePalette\n\t\t\t\t\t{ ...paletteCommonProps }\n\t\t\t\t\tcolors={ colors as ColorObject[] }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\n/**\n * Allows the user to pick a color from a list of pre-defined color entries.\n *\n * ```jsx\n * import { ColorPalette } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyColorPalette = () => {\n * const [ color, setColor ] = useState ( '#f00' )\n * const colors = [\n * { name: 'red', color: '#f00' },\n * { name: 'white', color: '#fff' },\n * { name: 'blue', color: '#00f' },\n * ];\n * return (\n * <ColorPalette\n * colors={ colors }\n * value={ color }\n * onChange={ ( color ) => setColor( color ) }\n * />\n * );\n * } );\n * ```\n */\nexport const ColorPalette = forwardRef( UnforwardedColorPalette );\n\nexport default ColorPalette;\n"]}
|
|
@@ -20,14 +20,17 @@ export const ColorInput = ({
|
|
|
20
20
|
|
|
21
21
|
switch (colorType) {
|
|
22
22
|
case 'hsl':
|
|
23
|
-
return createElement(HslInput, props
|
|
23
|
+
return createElement(HslInput, { ...props
|
|
24
|
+
});
|
|
24
25
|
|
|
25
26
|
case 'rgb':
|
|
26
|
-
return createElement(RgbInput, props
|
|
27
|
+
return createElement(RgbInput, { ...props
|
|
28
|
+
});
|
|
27
29
|
|
|
28
30
|
default:
|
|
29
31
|
case 'hex':
|
|
30
|
-
return createElement(HexInput, props
|
|
32
|
+
return createElement(HexInput, { ...props
|
|
33
|
+
});
|
|
31
34
|
}
|
|
32
35
|
};
|
|
33
36
|
//# sourceMappingURL=color-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-picker/color-input.tsx"],"names":["RgbInput","HslInput","HexInput","ColorInput","colorType","color","onChange","enableAlpha","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,aAAzB;AACA,SAASC,QAAT,QAAyB,aAAzB;AACA,SAASC,QAAT,QAAyB,aAAzB;AAGA,OAAO,MAAMC,UAAU,GAAG,CAAE;AAC3BC,EAAAA,SAD2B;AAE3BC,EAAAA,KAF2B;AAG3BC,EAAAA,QAH2B;AAI3BC,EAAAA;AAJ2B,CAAF,KAKF;AACvB,QAAMC,KAAK,GAAG;AAAEH,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAd;;AACA,UAASH,SAAT;AACC,SAAK,KAAL;AACC,aAAO,cAAC,QAAD,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-picker/color-input.tsx"],"names":["RgbInput","HslInput","HexInput","ColorInput","colorType","color","onChange","enableAlpha","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,aAAzB;AACA,SAASC,QAAT,QAAyB,aAAzB;AACA,SAASC,QAAT,QAAyB,aAAzB;AAGA,OAAO,MAAMC,UAAU,GAAG,CAAE;AAC3BC,EAAAA,SAD2B;AAE3BC,EAAAA,KAF2B;AAG3BC,EAAAA,QAH2B;AAI3BC,EAAAA;AAJ2B,CAAF,KAKF;AACvB,QAAMC,KAAK,GAAG;AAAEH,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAd;;AACA,UAASH,SAAT;AACC,SAAK,KAAL;AACC,aAAO,cAAC,QAAD,OAAeI;AAAf,QAAP;;AACD,SAAK,KAAL;AACC,aAAO,cAAC,QAAD,OAAeA;AAAf,QAAP;;AACD;AACA,SAAK,KAAL;AACC,aAAO,cAAC,QAAD,OAAeA;AAAf,QAAP;AAPF;AASA,CAhBM","sourcesContent":["/**\n * Internal dependencies\n */\nimport { RgbInput } from './rgb-input';\nimport { HslInput } from './hsl-input';\nimport { HexInput } from './hex-input';\nimport type { ColorInputProps } from './types';\n\nexport const ColorInput = ( {\n\tcolorType,\n\tcolor,\n\tonChange,\n\tenableAlpha,\n}: ColorInputProps ) => {\n\tconst props = { color, onChange, enableAlpha };\n\tswitch ( colorType ) {\n\t\tcase 'hsl':\n\t\t\treturn <HslInput { ...props } />;\n\t\tcase 'rgb':\n\t\t\treturn <RgbInput { ...props } />;\n\t\tdefault:\n\t\tcase 'hex':\n\t\t\treturn <HexInput { ...props } />;\n\t}\n};\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -58,9 +57,10 @@ const UnconnectedColorPicker = (props, forwardedRef) => {
|
|
|
58
57
|
debouncedSetColor(nextValue.toHex());
|
|
59
58
|
}, [debouncedSetColor]);
|
|
60
59
|
const [colorType, setColorType] = useState(copyFormat || 'hex');
|
|
61
|
-
return createElement(ColorfulWrapper,
|
|
62
|
-
ref: forwardedRef
|
|
63
|
-
|
|
60
|
+
return createElement(ColorfulWrapper, {
|
|
61
|
+
ref: forwardedRef,
|
|
62
|
+
...divProps
|
|
63
|
+
}, createElement(Picker, {
|
|
64
64
|
onChange: handleChange,
|
|
65
65
|
color: safeColordColor,
|
|
66
66
|
enableAlpha: enableAlpha
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-picker/component.tsx"],"names":["colord","extend","namesPlugin","useCallback","useState","useMemo","useDebounce","__","useContextSystem","contextConnect","ColorfulWrapper","SelectControl","AuxiliaryColorArtefactWrapper","AuxiliaryColorArtefactHStackHeader","ColorInputWrapper","ColorCopyButton","ColorInput","Picker","useControlledValue","options","label","value","UnconnectedColorPicker","props","forwardedRef","enableAlpha","color","colorProp","onChange","defaultValue","copyFormat","divProps","setColor","safeColordColor","debouncedSetColor","handleChange","nextValue","toHex","colorType","setColorType","nextColorType","ColorPicker"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-picker/component.tsx"],"names":["colord","extend","namesPlugin","useCallback","useState","useMemo","useDebounce","__","useContextSystem","contextConnect","ColorfulWrapper","SelectControl","AuxiliaryColorArtefactWrapper","AuxiliaryColorArtefactHStackHeader","ColorInputWrapper","ColorCopyButton","ColorInput","Picker","useControlledValue","options","label","value","UnconnectedColorPicker","props","forwardedRef","enableAlpha","color","colorProp","onChange","defaultValue","copyFormat","divProps","setColor","safeColordColor","debouncedSetColor","handleChange","nextValue","toHex","colorType","setColorType","nextColorType","ColorPicker"],"mappings":";;AAAA;AACA;AACA;AAEA,SAASA,MAAT,EAAiBC,MAAjB,QAAuC,QAAvC;AACA,OAAOC,WAAP,MAAwB,sBAAxB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,EAAsBC,QAAtB,EAAgCC,OAAhC,QAA+C,oBAA/C;AACA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,EAA2BC,cAA3B,QAAiD,eAAjD;AACA,SACCC,eADD,EAECC,aAFD,EAGCC,6BAHD,EAICC,kCAJD,EAKCC,iBALD,QAMO,UANP;AAOA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,UAAT,QAA2B,eAA3B;AACA,SAASC,MAAT,QAAuB,UAAvB;AACA,SAASC,kBAAT,QAAmC,gBAAnC;AAIAjB,MAAM,CAAE,CAAEC,WAAF,CAAF,CAAN;AAEA,MAAMiB,OAAO,GAAG,CACf;AAAEC,EAAAA,KAAK,EAAE,KAAT;AAAgBC,EAAAA,KAAK,EAAE;AAAvB,CADe,EAEf;AAAED,EAAAA,KAAK,EAAE,KAAT;AAAgBC,EAAAA,KAAK,EAAE;AAAvB,CAFe,EAGf;AAAED,EAAAA,KAAK,EAAE,KAAT;AAAgBC,EAAAA,KAAK,EAAE;AAAvB,CAHe,CAAhB;;AAMA,MAAMC,sBAAsB,GAAG,CAC9BC,KAD8B,EAE9BC,YAF8B,KAG1B;AACJ,QAAM;AACLC,IAAAA,WAAW,GAAG,KADT;AAELC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AAA,KAAK,EAAGjC,EAAE,CAAE,cAAF,CAPX;AAQC,IAAA,mBAAmB;AARpB,IADD,EAWC,cAAC,eAAD;AACC,IAAA,KAAK,EAAG0B,eADT;AAEC,IAAA,SAAS,EAAGH,UAAU,IAAIQ;AAF3B,IAXD,CADD,EAiBC,cAAC,iBAAD;AAAmB,IAAA,SAAS,EAAC,QAA7B;AAAsC,IAAA,GAAG,EAAG;AAA5C,KACC,cAAC,UAAD;AACC,IAAA,SAAS,EAAGA,SADb;AAEC,IAAA,KAAK,EAAGL,eAFT;AAGC,IAAA,QAAQ,EAAGE,YAHZ;AAIC,IAAA,WAAW,EAAGV;AAJf,IADD,CAjBD,CAND,CADD;AAmCA,CAxED;;AA0EA,OAAO,MAAMgB,WAAW,GAAGhC,cAAc,CACxCa,sBADwC,EAExC,aAFwC,CAAlC;AAKP,eAAemB,WAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport { colord, extend, Colord } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { useCallback, useState, useMemo } from '@wordpress/element';\nimport { useDebounce } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem, contextConnect } from '../ui/context';\nimport {\n\tColorfulWrapper,\n\tSelectControl,\n\tAuxiliaryColorArtefactWrapper,\n\tAuxiliaryColorArtefactHStackHeader,\n\tColorInputWrapper,\n} from './styles';\nimport { ColorCopyButton } from './color-copy-button';\nimport { ColorInput } from './color-input';\nimport { Picker } from './picker';\nimport { useControlledValue } from '../utils/hooks';\n\nimport type { ColorPickerProps, ColorType } from './types';\n\nextend( [ namesPlugin ] );\n\nconst options = [\n\t{ label: 'RGB', value: 'rgb' as const },\n\t{ label: 'HSL', value: 'hsl' as const },\n\t{ label: 'Hex', value: 'hex' as const },\n];\n\nconst UnconnectedColorPicker = (\n\tprops: ColorPickerProps,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tenableAlpha = false,\n\t\tcolor: colorProp,\n\t\tonChange,\n\t\tdefaultValue = '#fff',\n\t\tcopyFormat,\n\t\t...divProps\n\t} = useContextSystem( props, 'ColorPicker' );\n\n\t// Use a safe default value for the color and remove the possibility of `undefined`.\n\tconst [ color, setColor ] = useControlledValue( {\n\t\tonChange,\n\t\tvalue: colorProp,\n\t\tdefaultValue,\n\t} );\n\n\tconst safeColordColor = useMemo( () => {\n\t\treturn colord( color || '' );\n\t}, [ color ] );\n\n\tconst debouncedSetColor = useDebounce( setColor );\n\n\tconst handleChange = useCallback(\n\t\t( nextValue: Colord ) => {\n\t\t\tdebouncedSetColor( nextValue.toHex() );\n\t\t},\n\t\t[ debouncedSetColor ]\n\t);\n\n\tconst [ colorType, setColorType ] = useState< ColorType >(\n\t\tcopyFormat || 'hex'\n\t);\n\n\treturn (\n\t\t<ColorfulWrapper ref={ forwardedRef } { ...divProps }>\n\t\t\t<Picker\n\t\t\t\tonChange={ handleChange }\n\t\t\t\tcolor={ safeColordColor }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t\t<AuxiliaryColorArtefactWrapper>\n\t\t\t\t<AuxiliaryColorArtefactHStackHeader justify=\"space-between\">\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\tvalue={ colorType }\n\t\t\t\t\t\tonChange={ ( nextColorType ) =>\n\t\t\t\t\t\t\tsetColorType( nextColorType as ColorType )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlabel={ __( 'Color format' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t/>\n\t\t\t\t\t<ColorCopyButton\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\tcolorType={ copyFormat || colorType }\n\t\t\t\t\t/>\n\t\t\t\t</AuxiliaryColorArtefactHStackHeader>\n\t\t\t\t<ColorInputWrapper direction=\"column\" gap={ 2 }>\n\t\t\t\t\t<ColorInput\n\t\t\t\t\t\tcolorType={ colorType }\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t</ColorInputWrapper>\n\t\t\t</AuxiliaryColorArtefactWrapper>\n\t\t</ColorfulWrapper>\n\t);\n};\n\nexport const ColorPicker = contextConnect(\n\tUnconnectedColorPicker,\n\t'ColorPicker'\n);\n\nexport default ColorPicker;\n"]}
|
|
@@ -6,6 +6,7 @@ import { createElement } from "@wordpress/element";
|
|
|
6
6
|
import ColorPicker from './component';
|
|
7
7
|
import { useDeprecatedProps } from './use-deprecated-props';
|
|
8
8
|
export const LegacyAdapter = props => {
|
|
9
|
-
return createElement(ColorPicker, useDeprecatedProps(props)
|
|
9
|
+
return createElement(ColorPicker, { ...useDeprecatedProps(props)
|
|
10
|
+
});
|
|
10
11
|
};
|
|
11
12
|
//# sourceMappingURL=legacy-adapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-picker/legacy-adapter.tsx"],"names":["ColorPicker","useDeprecatedProps","LegacyAdapter","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,WAAP,MAAwB,aAAxB;AAEA,SAASC,kBAAT,QAAmC,wBAAnC;AAEA,OAAO,MAAMC,aAAa,GAAKC,KAAF,IAAiC;AAC7D,SAAO,cAAC,WAAD,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-picker/legacy-adapter.tsx"],"names":["ColorPicker","useDeprecatedProps","LegacyAdapter","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,WAAP,MAAwB,aAAxB;AAEA,SAASC,kBAAT,QAAmC,wBAAnC;AAEA,OAAO,MAAMC,aAAa,GAAKC,KAAF,IAAiC;AAC7D,SAAO,cAAC,WAAD,OAAkBF,kBAAkB,CAAEE,KAAF;AAApC,IAAP;AACA,CAFM","sourcesContent":["/**\n * Internal dependencies\n */\nimport ColorPicker from './component';\nimport type { LegacyAdapterProps } from './types';\nimport { useDeprecatedProps } from './use-deprecated-props';\n\nexport const LegacyAdapter = ( props: LegacyAdapterProps ) => {\n\treturn <ColorPicker { ...useDeprecatedProps( props ) } />;\n};\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import { createElement, Fragment } from "@wordpress/element";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -9,7 +8,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
9
8
|
* WordPress dependencies
|
|
10
9
|
*/
|
|
11
10
|
import { __ } from '@wordpress/i18n';
|
|
12
|
-
import { useCallback, useEffect, useState } from '@wordpress/element';
|
|
11
|
+
import { useCallback, useEffect, useRef, useState } from '@wordpress/element';
|
|
13
12
|
/**
|
|
14
13
|
* Internal dependencies
|
|
15
14
|
*/
|
|
@@ -35,6 +34,8 @@ function ConfirmDialog(props, forwardedRef) {
|
|
|
35
34
|
} = useContextSystem(props, 'ConfirmDialog');
|
|
36
35
|
const cx = useCx();
|
|
37
36
|
const wrapperClassName = cx(styles.wrapper);
|
|
37
|
+
const cancelButtonRef = useRef();
|
|
38
|
+
const confirmButtonRef = useRef();
|
|
38
39
|
const [isOpen, setIsOpen] = useState();
|
|
39
40
|
const [shouldSelfClose, setShouldSelfClose] = useState();
|
|
40
41
|
useEffect(() => {
|
|
@@ -54,29 +55,36 @@ function ConfirmDialog(props, forwardedRef) {
|
|
|
54
55
|
}
|
|
55
56
|
}, [shouldSelfClose, setIsOpen]);
|
|
56
57
|
const handleEnter = useCallback(event => {
|
|
57
|
-
|
|
58
|
+
// Avoid triggering the 'confirm' action when a button is focused,
|
|
59
|
+
// as this can cause a double submission.
|
|
60
|
+
const isConfirmOrCancelButton = event.target === cancelButtonRef.current || event.target === confirmButtonRef.current;
|
|
61
|
+
|
|
62
|
+
if (!isConfirmOrCancelButton && event.key === 'Enter') {
|
|
58
63
|
handleEvent(onConfirm)(event);
|
|
59
64
|
}
|
|
60
65
|
}, [handleEvent, onConfirm]);
|
|
61
66
|
const cancelLabel = cancelButtonText !== null && cancelButtonText !== void 0 ? cancelButtonText : __('Cancel');
|
|
62
67
|
const confirmLabel = confirmButtonText !== null && confirmButtonText !== void 0 ? confirmButtonText : __('OK');
|
|
63
|
-
return createElement(Fragment, null, isOpen && createElement(Modal,
|
|
68
|
+
return createElement(Fragment, null, isOpen && createElement(Modal, {
|
|
64
69
|
onRequestClose: handleEvent(onCancel),
|
|
65
70
|
onKeyDown: handleEnter,
|
|
66
71
|
closeButtonLabel: cancelLabel,
|
|
67
72
|
isDismissible: true,
|
|
68
73
|
ref: forwardedRef,
|
|
69
74
|
overlayClassName: wrapperClassName,
|
|
70
|
-
__experimentalHideHeader: true
|
|
71
|
-
|
|
75
|
+
__experimentalHideHeader: true,
|
|
76
|
+
...otherProps
|
|
77
|
+
}, createElement(VStack, {
|
|
72
78
|
spacing: 8
|
|
73
79
|
}, createElement(Text, null, children), createElement(Flex, {
|
|
74
80
|
direction: "row",
|
|
75
81
|
justify: "flex-end"
|
|
76
82
|
}, createElement(Button, {
|
|
83
|
+
ref: cancelButtonRef,
|
|
77
84
|
variant: "tertiary",
|
|
78
85
|
onClick: handleEvent(onCancel)
|
|
79
86
|
}, cancelLabel), createElement(Button, {
|
|
87
|
+
ref: confirmButtonRef,
|
|
80
88
|
variant: "primary",
|
|
81
89
|
onClick: handleEvent(onConfirm)
|
|
82
90
|
}, confirmLabel)))));
|