@wordpress/components 23.5.0 → 23.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -8
- package/build/angle-picker-control/angle-circle.js +1 -4
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/angle-picker-control/index.js +10 -22
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +24 -15
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/animate/index.js +29 -19
- package/build/animate/index.js.map +1 -1
- package/build/animate/types.js.map +1 -0
- package/build/animation/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +5 -5
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/get-default-use-items.js.map +1 -1
- package/build/autocomplete/index.js +25 -91
- package/build/autocomplete/index.js.map +1 -1
- package/build/autocomplete/types.js +6 -0
- package/build/autocomplete/types.js.map +1 -0
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/color-picker/color-input.js +0 -4
- package/build/color-picker/color-input.js.map +1 -1
- package/build/color-picker/component.js +5 -4
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/hsl-input.js.map +1 -1
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/legacy-adapter.js.map +1 -1
- package/build/color-picker/picker.js.map +1 -1
- package/build/color-picker/rgb-input.js.map +1 -1
- package/build/color-picker/use-deprecated-props.js.map +1 -1
- package/build/custom-gradient-picker/constants.js +1 -1
- package/build/custom-gradient-picker/constants.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +9 -3
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/index.js +14 -7
- package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js +34 -52
- package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build/custom-gradient-picker/index.js +45 -14
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js +14 -3
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
- package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
- package/build/custom-gradient-picker/types.js +6 -0
- package/build/custom-gradient-picker/types.js.map +1 -0
- package/build/custom-gradient-picker/utils.js +17 -10
- package/build/custom-gradient-picker/utils.js.map +1 -1
- package/build/dimension-control/index.js +31 -5
- package/build/dimension-control/index.js.map +1 -1
- package/build/dimension-control/sizes.js +2 -4
- package/build/dimension-control/sizes.js.map +1 -1
- package/build/dimension-control/types.js +6 -0
- package/build/dimension-control/types.js.map +1 -0
- package/build/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
- package/build/duotone-picker/color-list-picker/index.js.map +1 -0
- package/build/duotone-picker/color-list-picker/types.js +6 -0
- package/build/duotone-picker/color-list-picker/types.js.map +1 -0
- package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +39 -2
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/duotone-picker/duotone-swatch.js.map +1 -1
- package/build/duotone-picker/index.js.map +1 -1
- package/build/duotone-picker/types.js +6 -0
- package/build/duotone-picker/types.js.map +1 -0
- package/build/duotone-picker/utils.js +13 -11
- package/build/duotone-picker/utils.js.map +1 -1
- package/build/flex/flex/hook.js +3 -3
- package/build/flex/flex/hook.js.map +1 -1
- package/build/font-size-picker/index.js +2 -1
- package/build/font-size-picker/index.js.map +1 -1
- package/build/form-token-field/index.js +10 -4
- package/build/form-token-field/index.js.map +1 -1
- package/build/gradient-picker/index.js +61 -7
- package/build/gradient-picker/index.js.map +1 -1
- package/build/gradient-picker/types.js +6 -0
- package/build/gradient-picker/types.js.map +1 -0
- package/build/guide/icons.js.map +1 -1
- package/build/guide/index.js +46 -8
- package/build/guide/index.js.map +1 -1
- package/build/guide/page-control.js.map +1 -1
- package/build/guide/page.js.map +1 -1
- package/build/guide/types.js +6 -0
- package/build/guide/types.js.map +1 -0
- package/build/h-stack/utils.js +5 -5
- package/build/h-stack/utils.js.map +1 -1
- package/build/higher-order/navigate-regions/index.js +33 -3
- package/build/higher-order/navigate-regions/index.js.map +1 -1
- package/build/higher-order/with-fallback-styles/index.js +2 -2
- package/build/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build/higher-order/with-filters/index.js +31 -7
- package/build/higher-order/with-filters/index.js.map +1 -1
- package/build/higher-order/with-focus-return/index.js +10 -10
- package/build/higher-order/with-focus-return/index.js.map +1 -1
- package/build/higher-order/with-notices/index.js +28 -25
- package/build/higher-order/with-notices/index.js.map +1 -1
- package/build/higher-order/with-notices/types.js +6 -0
- package/build/higher-order/with-notices/types.js.map +1 -0
- package/build/higher-order/with-spoken-messages/index.js.map +1 -1
- package/build/icon/index.js +1 -8
- package/build/icon/index.js.map +1 -1
- package/build/index.native.js +18 -9
- package/build/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +1 -1
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet-text-control/index.native.js +4 -3
- package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build/navigation/back-button/index.js +6 -5
- package/build/navigation/back-button/index.js.map +1 -1
- package/build/navigation/constants.js.map +1 -1
- package/build/navigation/context.js +7 -4
- package/build/navigation/context.js.map +1 -1
- package/build/navigation/group/context.js.map +1 -1
- package/build/navigation/group/index.js +5 -1
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/index.js +49 -3
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/item/base-content.js +0 -1
- package/build/navigation/item/base-content.js.map +1 -1
- package/build/navigation/item/base.js.map +1 -1
- package/build/navigation/item/index.js +5 -1
- package/build/navigation/item/index.js.map +1 -1
- package/build/navigation/item/use-navigation-tree-item.js +1 -1
- package/build/navigation/item/use-navigation-tree-item.js.map +1 -1
- package/build/navigation/menu/context.js.map +1 -1
- package/build/navigation/menu/index.js +5 -1
- package/build/navigation/menu/index.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +8 -6
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/menu-title.js +4 -2
- package/build/navigation/menu/menu-title.js.map +1 -1
- package/build/navigation/menu/search-no-results-found.js.map +1 -1
- package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js +36 -36
- package/build/navigation/styles/navigation-styles.js.map +1 -1
- package/build/navigation/types.js +6 -0
- package/build/navigation/types.js.map +1 -0
- package/build/navigation/use-create-navigation-tree.js +7 -0
- package/build/navigation/use-create-navigation-tree.js.map +1 -1
- package/build/navigation/use-navigation-tree-nodes.js +3 -5
- package/build/navigation/use-navigation-tree-nodes.js.map +1 -1
- package/build/navigation/utils.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +5 -3
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/number-control/index.js +1 -3
- package/build/number-control/index.js.map +1 -1
- package/build/palette-edit/index.js +65 -26
- package/build/palette-edit/index.js.map +1 -1
- package/build/palette-edit/types.js +6 -0
- package/build/palette-edit/types.js.map +1 -0
- package/build/panel/body.js +15 -17
- package/build/panel/body.js.map +1 -1
- package/build/placeholder/index.js.map +1 -1
- package/build/query-controls/author-select.js +0 -4
- package/build/query-controls/author-select.js.map +1 -1
- package/build/query-controls/category-select.js +0 -4
- package/build/query-controls/category-select.js.map +1 -1
- package/build/query-controls/terms.js +30 -15
- package/build/query-controls/terms.js.map +1 -1
- package/build/range-control/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
- package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/responsive-wrapper/index.js +12 -13
- package/build/responsive-wrapper/index.js.map +1 -1
- package/build/sandbox/index.native.js +80 -67
- package/build/sandbox/index.native.js.map +1 -1
- package/build/select-control/index.js +19 -16
- package/build/select-control/index.js.map +1 -1
- package/build/tab-panel/index.js +1 -1
- package/build/tab-panel/index.js.map +1 -1
- package/build/toolbar/toolbar-button/index.js +32 -10
- package/build/toolbar/toolbar-button/index.js.map +1 -1
- package/build/toolbar/toolbar-button/toolbar-button-container.js +12 -4
- package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
- package/build/toolbar/toolbar-button/types.js +6 -0
- package/build/toolbar/toolbar-button/types.js.map +1 -0
- package/build/toolbar/toolbar-context/index.js +4 -2
- package/build/toolbar/toolbar-context/index.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +45 -6
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tooltip/index.js +18 -6
- package/build/tooltip/index.js.map +1 -1
- package/build/tree-select/index.js.map +1 -1
- package/build/ui/context/get-styled-class-name-from-key.js +2 -2
- package/build/ui/context/get-styled-class-name-from-key.js.map +1 -1
- package/build/utils/font.js +3 -7
- package/build/utils/font.js.map +1 -1
- package/build/utils/input/input-control.js +1 -1
- package/build/utils/input/input-control.js.map +1 -1
- package/build/v-stack/hook.js +2 -0
- package/build/v-stack/hook.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js +1 -4
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/angle-picker-control/index.js +12 -21
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +20 -13
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/animate/index.js +27 -17
- package/build-module/animate/index.js.map +1 -1
- package/build-module/animation/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +6 -6
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/get-default-use-items.js.map +1 -1
- package/build-module/autocomplete/index.js +28 -94
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/autocomplete/types.js +2 -0
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/color-picker/color-input.js +0 -4
- package/build-module/color-picker/color-input.js.map +1 -1
- package/build-module/color-picker/component.js +3 -3
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/hsl-input.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/legacy-adapter.js.map +1 -1
- package/build-module/color-picker/picker.js +4 -0
- package/build-module/color-picker/picker.js.map +1 -1
- package/build-module/color-picker/rgb-input.js.map +1 -1
- package/build-module/color-picker/use-deprecated-props.js.map +1 -1
- package/build-module/custom-gradient-picker/constants.js +1 -1
- package/build-module/custom-gradient-picker/constants.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +9 -3
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js +14 -7
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js +34 -52
- package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +44 -16
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js +14 -3
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
- package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
- package/build-module/custom-gradient-picker/types.js +2 -0
- package/build-module/custom-gradient-picker/types.js.map +1 -0
- package/build-module/custom-gradient-picker/utils.js +17 -10
- package/build-module/custom-gradient-picker/utils.js.map +1 -1
- package/build-module/dimension-control/index.js +28 -3
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/dimension-control/sizes.js +6 -5
- package/build-module/dimension-control/sizes.js.map +1 -1
- package/build-module/dimension-control/types.js +2 -0
- package/build-module/dimension-control/types.js.map +1 -0
- package/build-module/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
- package/build-module/duotone-picker/color-list-picker/index.js.map +1 -0
- package/build-module/duotone-picker/color-list-picker/types.js +2 -0
- package/build-module/duotone-picker/color-list-picker/types.js.map +1 -0
- package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +38 -2
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
- package/build-module/duotone-picker/index.js.map +1 -1
- package/build-module/duotone-picker/types.js +2 -0
- package/build-module/duotone-picker/types.js.map +1 -0
- package/build-module/duotone-picker/utils.js +17 -11
- package/build-module/duotone-picker/utils.js.map +1 -1
- package/build-module/flex/flex/hook.js +3 -3
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/font-size-picker/index.js +2 -1
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/form-token-field/index.js +10 -5
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/gradient-picker/index.js +61 -9
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/gradient-picker/types.js +2 -0
- package/build-module/gradient-picker/types.js.map +1 -0
- package/build-module/guide/icons.js.map +1 -1
- package/build-module/guide/index.js +45 -8
- package/build-module/guide/index.js.map +1 -1
- package/build-module/guide/page-control.js.map +1 -1
- package/build-module/guide/page.js +4 -0
- package/build-module/guide/page.js.map +1 -1
- package/build-module/guide/types.js +2 -0
- package/build-module/guide/types.js.map +1 -0
- package/build-module/h-stack/utils.js +5 -5
- package/build-module/h-stack/utils.js.map +1 -1
- package/build-module/higher-order/navigate-regions/index.js +33 -3
- package/build-module/higher-order/navigate-regions/index.js.map +1 -1
- package/build-module/higher-order/with-fallback-styles/index.js +2 -2
- package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build-module/higher-order/with-filters/index.js +31 -7
- package/build-module/higher-order/with-filters/index.js.map +1 -1
- package/build-module/higher-order/with-focus-return/index.js +10 -10
- package/build-module/higher-order/with-focus-return/index.js.map +1 -1
- package/build-module/higher-order/with-notices/index.js +29 -26
- package/build-module/higher-order/with-notices/index.js.map +1 -1
- package/build-module/higher-order/with-notices/types.js +2 -0
- package/build-module/higher-order/with-notices/types.js.map +1 -0
- package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
- package/build-module/icon/index.js +2 -9
- package/build-module/icon/index.js.map +1 -1
- package/build-module/index.native.js +1 -0
- package/build-module/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-text-control/index.native.js +4 -3
- package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build-module/navigation/back-button/index.js +4 -3
- package/build-module/navigation/back-button/index.js.map +1 -1
- package/build-module/navigation/constants.js.map +1 -1
- package/build-module/navigation/context.js +7 -4
- package/build-module/navigation/context.js.map +1 -1
- package/build-module/navigation/group/context.js +4 -0
- package/build-module/navigation/group/context.js.map +1 -1
- package/build-module/navigation/group/index.js +2 -1
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/index.js +46 -3
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/item/base-content.js +0 -1
- package/build-module/navigation/item/base-content.js.map +1 -1
- package/build-module/navigation/item/base.js.map +1 -1
- package/build-module/navigation/item/index.js +2 -1
- package/build-module/navigation/item/index.js.map +1 -1
- package/build-module/navigation/item/use-navigation-tree-item.js +1 -1
- package/build-module/navigation/item/use-navigation-tree-item.js.map +1 -1
- package/build-module/navigation/menu/context.js +4 -0
- package/build-module/navigation/menu/context.js.map +1 -1
- package/build-module/navigation/menu/index.js +2 -1
- package/build-module/navigation/menu/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +8 -6
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/menu-title.js +4 -2
- package/build-module/navigation/menu/menu-title.js.map +1 -1
- package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
- package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
- package/build-module/navigation/styles/navigation-styles.js +36 -36
- package/build-module/navigation/styles/navigation-styles.js.map +1 -1
- package/build-module/navigation/types.js +2 -0
- package/build-module/navigation/types.js.map +1 -0
- package/build-module/navigation/use-create-navigation-tree.js +7 -0
- package/build-module/navigation/use-create-navigation-tree.js.map +1 -1
- package/build-module/navigation/use-navigation-tree-nodes.js +2 -2
- package/build-module/navigation/use-navigation-tree-nodes.js.map +1 -1
- package/build-module/navigation/utils.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +5 -3
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/number-control/index.js +1 -3
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/palette-edit/index.js +63 -26
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/palette-edit/types.js +2 -0
- package/build-module/palette-edit/types.js.map +1 -0
- package/build-module/panel/body.js +12 -12
- package/build-module/panel/body.js.map +1 -1
- package/build-module/placeholder/index.js.map +1 -1
- package/build-module/query-controls/author-select.js +0 -4
- package/build-module/query-controls/author-select.js.map +1 -1
- package/build-module/query-controls/category-select.js +1 -5
- package/build-module/query-controls/category-select.js.map +1 -1
- package/build-module/query-controls/terms.js +29 -16
- package/build-module/query-controls/terms.js.map +1 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +5 -5
- package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/responsive-wrapper/index.js +12 -12
- package/build-module/responsive-wrapper/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +70 -58
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/select-control/index.js +20 -17
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/tab-panel/index.js +2 -2
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/toolbar/toolbar-button/index.js +32 -9
- package/build-module/toolbar/toolbar-button/index.js.map +1 -1
- package/build-module/toolbar/toolbar-button/toolbar-button-container.js +12 -4
- package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
- package/build-module/toolbar/toolbar-button/types.js +2 -0
- package/build-module/toolbar/toolbar-button/types.js.map +1 -0
- package/build-module/toolbar/toolbar-context/index.js +4 -2
- package/build-module/toolbar/toolbar-context/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +45 -6
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tooltip/index.js +16 -6
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/ui/context/get-styled-class-name-from-key.js +1 -1
- package/build-module/ui/context/get-styled-class-name-from-key.js.map +1 -1
- package/build-module/utils/font.js +3 -6
- package/build-module/utils/font.js.map +1 -1
- package/build-module/utils/input/input-control.js +1 -1
- package/build-module/utils/input/input-control.js.map +1 -1
- package/build-module/v-stack/hook.js +2 -0
- package/build-module/v-stack/hook.js.map +1 -1
- package/build-style/style-rtl.css +54 -39
- package/build-style/style.css +56 -39
- package/build-types/alignment-matrix-control/types.d.ts +4 -4
- package/build-types/alignment-matrix-control/types.d.ts.map +1 -1
- package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
- package/build-types/angle-picker-control/index.d.ts.map +1 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +5 -0
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
- package/build-types/angle-picker-control/types.d.ts +2 -2
- package/build-types/angle-picker-control/types.d.ts.map +1 -1
- package/build-types/animate/index.d.ts +27 -22
- package/build-types/animate/index.d.ts.map +1 -1
- package/build-types/animate/stories/index.d.ts +18 -0
- package/build-types/animate/stories/index.d.ts.map +1 -0
- package/build-types/animate/types.d.ts +30 -0
- package/build-types/animate/types.d.ts.map +1 -0
- package/build-types/animation/index.d.ts +8 -1
- package/build-types/animation/index.d.ts.map +1 -1
- package/build-types/autocomplete/autocompleter-ui.d.ts +4 -0
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -0
- package/build-types/autocomplete/get-default-use-items.d.ts +3 -0
- package/build-types/autocomplete/get-default-use-items.d.ts.map +1 -0
- package/build-types/autocomplete/index.d.ts +23 -0
- package/build-types/autocomplete/index.d.ts.map +1 -0
- package/build-types/autocomplete/test/index.d.ts +2 -0
- package/build-types/autocomplete/test/index.d.ts.map +1 -0
- package/build-types/autocomplete/types.d.ts +201 -0
- package/build-types/autocomplete/types.d.ts.map +1 -0
- package/build-types/base-control/types.d.ts +2 -2
- package/build-types/base-control/types.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/styles.d.ts +3 -3
- package/build-types/border-box-control/styles.d.ts.map +1 -1
- package/build-types/border-box-control/types.d.ts +8 -8
- package/build-types/border-box-control/types.d.ts.map +1 -1
- package/build-types/border-box-control/utils.d.ts +5 -5
- package/build-types/border-box-control/utils.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +3 -3
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +2 -2
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/border-control/styles.d.ts +4 -4
- package/build-types/border-control/styles.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +6 -6
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +6 -6
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/button/deprecated.d.ts +6 -6
- package/build-types/button/types.d.ts +10 -10
- package/build-types/button/types.d.ts.map +1 -1
- package/build-types/button-group/types.d.ts +1 -1
- package/build-types/button-group/types.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +1 -1
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/types.d.ts +10 -10
- package/build-types/card/types.d.ts.map +1 -1
- package/build-types/checkbox-control/types.d.ts +1 -1
- package/build-types/checkbox-control/types.d.ts.map +1 -1
- package/build-types/circular-option-picker/types.d.ts +4 -4
- package/build-types/circular-option-picker/types.d.ts.map +1 -1
- package/build-types/color-indicator/types.d.ts +1 -1
- package/build-types/color-indicator/types.d.ts.map +1 -1
- package/build-types/color-palette/types.d.ts +7 -7
- package/build-types/color-palette/types.d.ts.map +1 -1
- package/build-types/color-palette/utils.d.ts +1 -1
- package/build-types/color-palette/utils.d.ts.map +1 -1
- package/build-types/color-picker/color-input.d.ts +1 -11
- package/build-types/color-picker/color-input.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts +8 -9
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.d.ts +1 -10
- package/build-types/color-picker/hex-input.d.ts.map +1 -1
- package/build-types/color-picker/hsl-input.d.ts +1 -10
- package/build-types/color-picker/hsl-input.d.ts.map +1 -1
- package/build-types/color-picker/input-with-slider.d.ts +1 -9
- package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
- package/build-types/color-picker/legacy-adapter.d.ts +1 -3
- package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
- package/build-types/color-picker/picker.d.ts +4 -7
- package/build-types/color-picker/picker.d.ts.map +1 -1
- package/build-types/color-picker/rgb-input.d.ts +1 -10
- package/build-types/color-picker/rgb-input.d.ts.map +1 -1
- package/build-types/color-picker/stories/index.d.ts +19 -0
- package/build-types/color-picker/stories/index.d.ts.map +1 -0
- package/build-types/color-picker/styles.d.ts +3 -3
- package/build-types/color-picker/test/index.d.ts +2 -0
- package/build-types/color-picker/test/index.d.ts.map +1 -0
- package/build-types/color-picker/types.d.ts +107 -3
- package/build-types/color-picker/types.d.ts.map +1 -1
- package/build-types/color-picker/use-deprecated-props.d.ts +1 -44
- package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
- package/build-types/combobox-control/types.d.ts +2 -2
- package/build-types/combobox-control/types.d.ts.map +1 -1
- package/build-types/confirm-dialog/component.d.ts +4 -4
- package/build-types/confirm-dialog/types.d.ts +5 -5
- package/build-types/confirm-dialog/types.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/constants.d.ts +25 -0
- package/build-types/custom-gradient-picker/constants.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts +8 -0
- package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +8 -0
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +4 -0
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts +2 -0
- package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts +90 -0
- package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/index.d.ts +28 -0
- package/build-types/custom-gradient-picker/index.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/serializer.d.ts +14 -0
- package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/stories/index.d.ts +12 -0
- package/build-types/custom-gradient-picker/stories/index.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +12 -0
- package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/test/serializer.d.ts +2 -0
- package/build-types/custom-gradient-picker/test/serializer.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/types.d.ts +120 -0
- package/build-types/custom-gradient-picker/types.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/utils.d.ts +13 -0
- package/build-types/custom-gradient-picker/utils.d.ts.map +1 -0
- package/build-types/custom-select-control/styles.d.ts +1 -1
- package/build-types/custom-select-control/styles.d.ts.map +1 -1
- package/build-types/dashicon/types.d.ts +2 -2
- package/build-types/dashicon/types.d.ts.map +1 -1
- package/build-types/date-time/date-time/styles.d.ts +1 -4
- package/build-types/date-time/date-time/styles.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts +1 -1
- package/build-types/date-time/types.d.ts +4 -4
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +28 -0
- package/build-types/dimension-control/index.d.ts.map +1 -0
- package/build-types/dimension-control/sizes.d.ts +26 -0
- package/build-types/dimension-control/sizes.d.ts.map +1 -0
- package/build-types/dimension-control/stories/index.d.ts +12 -0
- package/build-types/dimension-control/stories/index.d.ts.map +1 -0
- package/build-types/dimension-control/types.d.ts +47 -0
- package/build-types/dimension-control/types.d.ts.map +1 -0
- package/build-types/divider/types.d.ts +1 -1
- package/build-types/divider/types.d.ts.map +1 -1
- package/build-types/draggable/types.d.ts +1 -1
- package/build-types/draggable/types.d.ts.map +1 -1
- package/build-types/drop-zone/types.d.ts +2 -2
- package/build-types/drop-zone/types.d.ts.map +1 -1
- package/build-types/dropdown/types.d.ts +3 -3
- package/build-types/dropdown/types.d.ts.map +1 -1
- package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -0
- package/build-types/{color-list-picker → duotone-picker/color-list-picker}/types.d.ts +4 -4
- package/build-types/duotone-picker/color-list-picker/types.d.ts.map +1 -0
- package/build-types/duotone-picker/custom-duotone-bar.d.ts +6 -0
- package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -0
- package/build-types/duotone-picker/duotone-picker.d.ts +38 -0
- package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -0
- package/build-types/duotone-picker/duotone-swatch.d.ts +5 -0
- package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -0
- package/build-types/duotone-picker/index.d.ts +3 -0
- package/build-types/duotone-picker/index.d.ts.map +1 -0
- package/build-types/duotone-picker/stories/duotone-picker.d.ts +12 -0
- package/build-types/duotone-picker/stories/duotone-picker.d.ts.map +1 -0
- package/build-types/duotone-picker/stories/duotone-swatch.d.ts +14 -0
- package/build-types/duotone-picker/stories/duotone-swatch.d.ts.map +1 -0
- package/build-types/duotone-picker/types.d.ts +60 -0
- package/build-types/duotone-picker/types.d.ts.map +1 -0
- package/build-types/duotone-picker/utils.d.ts +52 -0
- package/build-types/duotone-picker/utils.d.ts.map +1 -0
- package/build-types/elevation/types.d.ts +1 -1
- package/build-types/elevation/types.d.ts.map +1 -1
- package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
- package/build-types/external-link/types.d.ts +1 -1
- package/build-types/external-link/types.d.ts.map +1 -1
- package/build-types/flex/types.d.ts +4 -4
- package/build-types/flex/types.d.ts.map +1 -1
- package/build-types/focal-point-picker/types.d.ts +7 -7
- package/build-types/focal-point-picker/types.d.ts.map +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/stories/index.d.ts.map +1 -1
- package/build-types/font-size-picker/types.d.ts +9 -5
- package/build-types/font-size-picker/types.d.ts.map +1 -1
- package/build-types/form-file-upload/types.d.ts +1 -1
- package/build-types/form-file-upload/types.d.ts.map +1 -1
- package/build-types/form-toggle/types.d.ts +1 -1
- package/build-types/form-toggle/types.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/stories/index.d.ts +6 -0
- package/build-types/form-token-field/stories/index.d.ts.map +1 -1
- package/build-types/form-token-field/styles.d.ts +1 -1
- package/build-types/form-token-field/styles.d.ts.map +1 -1
- package/build-types/form-token-field/types.d.ts +7 -1
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/gradient-picker/index.d.ts +50 -0
- package/build-types/gradient-picker/index.d.ts.map +1 -0
- package/build-types/gradient-picker/stories/index.d.ts +14 -0
- package/build-types/gradient-picker/stories/index.d.ts.map +1 -0
- package/build-types/gradient-picker/types.d.ts +87 -0
- package/build-types/gradient-picker/types.d.ts.map +1 -0
- package/build-types/grid/types.d.ts +2 -2
- package/build-types/grid/types.d.ts.map +1 -1
- package/build-types/guide/icons.d.ts +5 -0
- package/build-types/guide/icons.d.ts.map +1 -0
- package/build-types/guide/index.d.ts +37 -0
- package/build-types/guide/index.d.ts.map +1 -0
- package/build-types/guide/page-control.d.ts +4 -0
- package/build-types/guide/page-control.d.ts.map +1 -0
- package/build-types/guide/page.d.ts +7 -0
- package/build-types/guide/page.d.ts.map +1 -0
- package/build-types/guide/stories/index.d.ts +9 -0
- package/build-types/guide/stories/index.d.ts.map +1 -0
- package/build-types/guide/test/index.d.ts +2 -0
- package/build-types/guide/test/index.d.ts.map +1 -0
- package/build-types/guide/types.d.ts +65 -0
- package/build-types/guide/types.d.ts.map +1 -0
- package/build-types/h-stack/types.d.ts +6 -6
- package/build-types/h-stack/types.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +1 -1
- package/build-types/heading/types.d.ts +2 -2
- package/build-types/heading/types.d.ts.map +1 -1
- package/build-types/higher-order/navigate-regions/index.d.ts +46 -0
- package/build-types/higher-order/navigate-regions/index.d.ts.map +1 -0
- package/build-types/higher-order/with-fallback-styles/index.d.ts +44 -0
- package/build-types/higher-order/with-fallback-styles/index.d.ts.map +1 -0
- package/build-types/higher-order/with-filters/index.d.ts +89 -0
- package/build-types/higher-order/with-filters/index.d.ts.map +1 -0
- package/build-types/higher-order/with-filters/test/index.d.ts +2 -0
- package/build-types/higher-order/with-filters/test/index.d.ts.map +1 -0
- package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
- package/build-types/higher-order/with-focus-return/index.d.ts +20 -0
- package/build-types/higher-order/with-focus-return/index.d.ts.map +1 -0
- package/build-types/higher-order/with-focus-return/test/index.d.ts +2 -0
- package/build-types/higher-order/with-focus-return/test/index.d.ts.map +1 -0
- package/build-types/higher-order/with-notices/index.d.ts +37 -0
- package/build-types/higher-order/with-notices/index.d.ts.map +1 -0
- package/build-types/higher-order/with-notices/test/index.d.ts +2 -0
- package/build-types/higher-order/with-notices/test/index.d.ts.map +1 -0
- package/build-types/higher-order/with-notices/types.d.ts +34 -0
- package/build-types/higher-order/with-notices/types.d.ts.map +1 -0
- package/build-types/higher-order/with-spoken-messages/index.d.ts +13 -2
- package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
- package/build-types/higher-order/with-spoken-messages/test/index.d.ts +2 -0
- package/build-types/higher-order/with-spoken-messages/test/index.d.ts.map +1 -0
- package/build-types/icon/index.d.ts +10 -6
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/icon/test/index.d.ts +2 -0
- package/build-types/icon/test/index.d.ts.map +1 -0
- package/build-types/input-control/reducer/actions.d.ts +15 -15
- package/build-types/input-control/reducer/actions.d.ts.map +1 -1
- package/build-types/input-control/reducer/state.d.ts +1 -1
- package/build-types/input-control/reducer/state.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts +4 -4
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +7 -7
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +1 -1
- package/build-types/item-group/types.d.ts +2 -2
- package/build-types/item-group/types.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/types.d.ts +3 -3
- package/build-types/keyboard-shortcuts/types.d.ts.map +1 -1
- package/build-types/menu-group/types.d.ts +1 -1
- package/build-types/menu-group/types.d.ts.map +1 -1
- package/build-types/menu-item/index.d.ts +1 -1
- package/build-types/menu-items-choice/types.d.ts +2 -2
- package/build-types/menu-items-choice/types.d.ts.map +1 -1
- package/build-types/modal/types.d.ts +1 -1
- package/build-types/modal/types.d.ts.map +1 -1
- package/build-types/navigable-container/container.d.ts +1 -1
- package/build-types/navigable-container/menu.d.ts +1 -1
- package/build-types/navigable-container/tabbable.d.ts +1 -1
- package/build-types/navigation/back-button/index.d.ts +5 -0
- package/build-types/navigation/back-button/index.d.ts.map +1 -0
- package/build-types/navigation/constants.d.ts +3 -0
- package/build-types/navigation/constants.d.ts.map +1 -0
- package/build-types/navigation/context.d.ts +5 -0
- package/build-types/navigation/context.d.ts.map +1 -0
- package/build-types/navigation/group/context.d.ts +8 -0
- package/build-types/navigation/group/context.d.ts.map +1 -0
- package/build-types/navigation/group/index.d.ts +5 -0
- package/build-types/navigation/group/index.d.ts.map +1 -0
- package/build-types/navigation/index.d.ts +46 -0
- package/build-types/navigation/index.d.ts.map +1 -0
- package/build-types/navigation/item/base-content.d.ts +4 -0
- package/build-types/navigation/item/base-content.d.ts.map +1 -0
- package/build-types/navigation/item/base.d.ts +4 -0
- package/build-types/navigation/item/base.d.ts.map +1 -0
- package/build-types/navigation/item/index.d.ts +5 -0
- package/build-types/navigation/item/index.d.ts.map +1 -0
- package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
- package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
- package/build-types/navigation/menu/context.d.ts +8 -0
- package/build-types/navigation/menu/context.d.ts.map +1 -0
- package/build-types/navigation/menu/index.d.ts +5 -0
- package/build-types/navigation/menu/index.d.ts.map +1 -0
- package/build-types/navigation/menu/menu-title-search.d.ts +4 -0
- package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
- package/build-types/navigation/menu/menu-title.d.ts +4 -0
- package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
- package/build-types/navigation/menu/search-no-results-found.d.ts +4 -0
- package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
- package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
- package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
- package/build-types/navigation/stories/index.d.ts +18 -0
- package/build-types/navigation/stories/index.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
- package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/default.d.ts +10 -0
- package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/group.d.ts +10 -0
- package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
- package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
- package/build-types/navigation/stories/utils/search.d.ts +10 -0
- package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
- package/build-types/navigation/styles/navigation-styles.d.ts +58 -0
- package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
- package/build-types/navigation/test/index.d.ts +2 -0
- package/build-types/navigation/test/index.d.ts.map +1 -0
- package/build-types/navigation/types.d.ts +267 -0
- package/build-types/navigation/types.d.ts.map +1 -0
- package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
- package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
- package/build-types/navigation/use-navigation-tree-nodes.d.ts +11 -0
- package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
- package/build-types/navigation/utils.d.ts +3 -0
- package/build-types/navigation/utils.d.ts.map +1 -0
- 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-screen/component.d.ts +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -1
- package/build-types/navigator/types.d.ts +12 -12
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/notice/types.d.ts +7 -7
- package/build-types/notice/types.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/types.d.ts +1 -1
- package/build-types/number-control/types.d.ts.map +1 -1
- package/build-types/palette-edit/index.d.ts +37 -0
- package/build-types/palette-edit/index.d.ts.map +1 -0
- package/build-types/palette-edit/stories/index.d.ts +13 -0
- package/build-types/palette-edit/stories/index.d.ts.map +1 -0
- package/build-types/palette-edit/styles.d.ts +51 -0
- package/build-types/palette-edit/styles.d.ts.map +1 -0
- package/build-types/palette-edit/test/index.d.ts +2 -0
- package/build-types/palette-edit/test/index.d.ts.map +1 -0
- package/build-types/palette-edit/types.d.ts +114 -0
- package/build-types/palette-edit/types.d.ts.map +1 -0
- package/build-types/panel/body.d.ts +9 -0
- package/build-types/panel/body.d.ts.map +1 -0
- package/build-types/panel/stories/index.d.ts +19 -0
- package/build-types/panel/stories/index.d.ts.map +1 -0
- package/build-types/panel/test/body.d.ts +2 -0
- package/build-types/panel/test/body.d.ts.map +1 -0
- package/build-types/panel/types.d.ts +73 -3
- package/build-types/panel/types.d.ts.map +1 -1
- package/build-types/placeholder/index.d.ts +1 -1
- package/build-types/placeholder/index.d.ts.map +1 -1
- package/build-types/placeholder/types.d.ts +2 -2
- package/build-types/placeholder/types.d.ts.map +1 -1
- package/build-types/popover/limit-shift.d.ts +2 -2
- package/build-types/popover/limit-shift.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +10 -10
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts +2 -2
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/query-controls/author-select.d.ts.map +1 -1
- package/build-types/query-controls/category-select.d.ts.map +1 -1
- package/build-types/query-controls/terms.d.ts.map +1 -1
- package/build-types/query-controls/types.d.ts +12 -12
- package/build-types/query-controls/types.d.ts.map +1 -1
- package/build-types/radio-control/types.d.ts +1 -1
- package/build-types/radio-control/types.d.ts.map +1 -1
- package/build-types/radio-group/index.d.ts +1 -1
- package/build-types/radio-group/radio/index.d.ts +1 -1
- package/build-types/range-control/index.d.ts +2 -2
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +17 -17
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts +2 -2
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/responsive-wrapper/index.d.ts.map +1 -1
- package/build-types/responsive-wrapper/stories/index.d.ts +10 -0
- package/build-types/responsive-wrapper/stories/index.d.ts.map +1 -1
- package/build-types/responsive-wrapper/types.d.ts +3 -3
- package/build-types/responsive-wrapper/types.d.ts.map +1 -1
- package/build-types/sandbox/types.d.ts +1 -1
- package/build-types/sandbox/types.d.ts.map +1 -1
- package/build-types/scrollable/types.d.ts +2 -2
- package/build-types/scrollable/types.d.ts.map +1 -1
- package/build-types/search-control/types.d.ts +1 -1
- package/build-types/search-control/types.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts +2 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/stories/index.d.ts +3 -3
- package/build-types/select-control/stories/index.d.ts.map +1 -1
- package/build-types/select-control/types.d.ts +44 -20
- package/build-types/select-control/types.d.ts.map +1 -1
- package/build-types/shortcut/types.d.ts +1 -1
- package/build-types/shortcut/types.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
- package/build-types/slot-fill/provider.d.ts +1 -0
- package/build-types/slot-fill/provider.d.ts.map +1 -1
- package/build-types/snackbar/types.d.ts +3 -3
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/spacer/types.d.ts +1 -1
- package/build-types/spacer/types.d.ts.map +1 -1
- package/build-types/spinner/index.d.ts +1 -1
- package/build-types/style-provider/types.d.ts +1 -1
- package/build-types/style-provider/types.d.ts.map +1 -1
- package/build-types/surface/types.d.ts +2 -2
- package/build-types/surface/types.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tab-panel/types.d.ts +5 -5
- package/build-types/tab-panel/types.d.ts.map +1 -1
- package/build-types/text/types.d.ts +3 -3
- package/build-types/text/types.d.ts.map +1 -1
- package/build-types/text-control/types.d.ts +1 -1
- package/build-types/text-control/types.d.ts.map +1 -1
- package/build-types/text-highlight/types.d.ts +1 -1
- package/build-types/text-highlight/types.d.ts.map +1 -1
- package/build-types/textarea-control/types.d.ts +1 -1
- package/build-types/textarea-control/types.d.ts.map +1 -1
- package/build-types/theme/types.d.ts +3 -3
- package/build-types/theme/types.d.ts.map +1 -1
- package/build-types/tip/types.d.ts +1 -1
- package/build-types/tip/types.d.ts.map +1 -1
- package/build-types/toggle-control/types.d.ts +1 -1
- package/build-types/toggle-control/types.d.ts.map +1 -1
- package/build-types/toggle-group-control/types.d.ts +10 -10
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/types.d.ts +1 -1
- package/build-types/toolbar/toolbar/types.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts +165 -11
- package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +6 -1
- package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/types.d.ts +45 -0
- package/build-types/toolbar/toolbar-button/types.d.ts.map +1 -0
- package/build-types/toolbar/toolbar-context/index.d.ts +6 -1
- package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +1 -1
- package/build-types/toolbar/toolbar-item/index.d.ts +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +12 -11
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/tree-grid/types.d.ts +5 -5
- package/build-types/tree-grid/types.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/tree-select/types.d.ts +4 -10
- package/build-types/tree-select/types.d.ts.map +1 -1
- package/build-types/truncate/types.d.ts +2 -2
- package/build-types/truncate/types.d.ts.map +1 -1
- package/build-types/ui/context/context-connect.d.ts +1 -1
- package/build-types/ui/context/context-connect.d.ts.map +1 -1
- package/build-types/ui/context/wordpress-component.d.ts +3 -3
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
- package/build-types/ui/control-group/types.d.ts +2 -2
- package/build-types/ui/control-group/types.d.ts.map +1 -1
- package/build-types/ui/control-label/types.d.ts +1 -1
- package/build-types/ui/control-label/types.d.ts.map +1 -1
- package/build-types/ui/form-group/form-group-content.d.ts +1 -1
- package/build-types/ui/form-group/form-group-help.d.ts +1 -1
- package/build-types/ui/form-group/form-group-label.d.ts +1 -1
- package/build-types/ui/form-group/types.d.ts +5 -5
- package/build-types/ui/form-group/types.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +3 -3
- package/build-types/ui/spinner/component.d.ts +1 -1
- package/build-types/ui/tooltip/content.d.ts +1 -1
- package/build-types/ui/tooltip/types.d.ts +2 -2
- package/build-types/ui/tooltip/types.d.ts.map +1 -1
- package/build-types/ui/utils/font-size.d.ts +1 -1
- package/build-types/ui/utils/font-size.d.ts.map +1 -1
- package/build-types/ui/utils/space.d.ts +1 -1
- package/build-types/ui/utils/space.d.ts.map +1 -1
- package/build-types/ui/utils/types.d.ts +4 -4
- package/build-types/ui/utils/types.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +5 -5
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/utils/breakpoint-values.d.ts +1 -1
- package/build-types/utils/colors-values.d.ts +1 -1
- package/build-types/utils/config-values.d.ts +9 -9
- package/build-types/utils/events.d.ts +1 -1
- package/build-types/utils/events.d.ts.map +1 -1
- package/build-types/utils/font-values.d.ts +1 -1
- package/build-types/utils/font.d.ts.map +1 -1
- package/build-types/utils/hooks/use-controlled-value.d.ts +1 -1
- package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
- package/build-types/utils/input/input-control.d.ts.map +1 -1
- package/build-types/utils/types.d.ts +4 -4
- package/build-types/utils/types.d.ts.map +1 -1
- package/build-types/v-stack/component.d.ts +1 -4
- package/build-types/v-stack/component.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.d.ts +1 -4
- package/build-types/v-stack/stories/index.d.ts.map +1 -1
- package/build-types/v-stack/types.d.ts +5 -3
- package/build-types/v-stack/types.d.ts.map +1 -1
- package/build-types/view/types.d.ts +1 -1
- package/build-types/view/types.d.ts.map +1 -1
- package/build-types/visually-hidden/types.d.ts +1 -1
- package/build-types/visually-hidden/types.d.ts.map +1 -1
- package/build-types/z-stack/types.d.ts +1 -1
- package/build-types/z-stack/types.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/angle-picker-control/angle-circle.tsx +0 -1
- package/src/angle-picker-control/index.tsx +14 -27
- package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +16 -9
- package/src/animate/index.tsx +75 -0
- package/src/animate/stories/index.tsx +102 -0
- package/src/animate/types.ts +32 -0
- package/src/autocomplete/README.md +51 -0
- package/src/autocomplete/{autocompleter-ui.js → autocompleter-ui.tsx} +21 -10
- package/src/autocomplete/{get-default-use-items.js → get-default-use-items.tsx} +11 -6
- package/src/autocomplete/{index.js → index.tsx} +77 -111
- package/src/autocomplete/test/{index.js → index.tsx} +31 -20
- package/src/autocomplete/types.ts +220 -0
- package/src/border-box-control/stories/index.tsx +1 -1
- package/src/border-control/test/index.js +0 -2
- package/src/box-control/axial-input-controls.tsx +1 -1
- package/src/button/style.scss +12 -1
- package/src/button/types.ts +2 -2
- package/src/circular-option-picker/style.scss +10 -0
- package/src/circular-option-picker/types.ts +1 -1
- package/src/color-indicator/style.scss +1 -0
- package/src/color-palette/test/__snapshots__/index.tsx.snap +16 -14
- package/src/color-picker/README.md +2 -2
- package/src/color-picker/color-input.tsx +1 -12
- package/src/color-picker/component.tsx +9 -18
- package/src/color-picker/hex-input.tsx +2 -7
- package/src/color-picker/hsl-input.tsx +2 -7
- package/src/color-picker/input-with-slider.tsx +1 -9
- package/src/color-picker/legacy-adapter.tsx +1 -2
- package/src/color-picker/picker.tsx +5 -6
- package/src/color-picker/rgb-input.tsx +2 -7
- package/src/color-picker/stories/index.tsx +51 -0
- package/src/color-picker/test/{index.js → index.tsx} +36 -18
- package/src/color-picker/types.ts +128 -1
- package/src/color-picker/use-deprecated-props.ts +2 -53
- package/src/combobox-control/stories/index.tsx +1 -1
- package/src/custom-gradient-picker/{constants.js → constants.ts} +2 -2
- package/src/custom-gradient-picker/gradient-bar/{control-points.js → control-points.tsx} +171 -132
- package/src/custom-gradient-picker/gradient-bar/{index.js → index.tsx} +32 -8
- package/src/custom-gradient-picker/gradient-bar/test/{utils.js → utils.ts} +58 -31
- package/src/custom-gradient-picker/gradient-bar/utils.ts +193 -0
- package/src/custom-gradient-picker/{index.js → index.tsx} +63 -20
- package/src/custom-gradient-picker/serializer.ts +82 -0
- package/src/custom-gradient-picker/stories/index.tsx +45 -0
- package/src/custom-gradient-picker/style.scss +25 -4
- package/src/custom-gradient-picker/test/{serializer.js → serializer.ts} +39 -33
- package/src/custom-gradient-picker/types.ts +137 -0
- package/src/custom-gradient-picker/{utils.js → utils.ts} +37 -20
- package/src/custom-select-control/test/index.js +6 -4
- package/src/dimension-control/README.md +22 -55
- package/src/dimension-control/index.tsx +101 -0
- package/src/dimension-control/{sizes.js → sizes.ts} +8 -5
- package/src/dimension-control/stories/index.tsx +48 -0
- package/src/dimension-control/types.ts +48 -0
- package/src/{color-list-picker → duotone-picker/color-list-picker}/index.tsx +7 -6
- package/src/{color-list-picker → duotone-picker/color-list-picker}/types.ts +2 -2
- package/src/duotone-picker/{custom-duotone-bar.js → custom-duotone-bar.tsx} +7 -1
- package/src/duotone-picker/{duotone-picker.js → duotone-picker.tsx} +39 -2
- package/src/duotone-picker/{duotone-swatch.js → duotone-swatch.tsx} +2 -1
- package/src/duotone-picker/stories/{duotone-picker.js → duotone-picker.tsx} +15 -8
- package/src/duotone-picker/stories/{duotone-swatch.js → duotone-swatch.tsx} +9 -3
- package/src/duotone-picker/types.ts +61 -0
- package/src/duotone-picker/{utils.js → utils.ts} +29 -14
- package/src/flex/flex/hook.ts +2 -2
- package/src/flex/flex-item/README.md +1 -1
- package/src/font-size-picker/README.md +26 -20
- package/src/font-size-picker/index.tsx +2 -1
- package/src/font-size-picker/stories/index.tsx +1 -0
- package/src/font-size-picker/test/index.tsx +23 -0
- package/src/font-size-picker/types.ts +4 -0
- package/src/form-token-field/README.md +1 -0
- package/src/form-token-field/index.tsx +14 -4
- package/src/form-token-field/stories/index.tsx +13 -0
- package/src/form-token-field/style.scss +0 -7
- package/src/form-token-field/test/index.tsx +81 -0
- package/src/form-token-field/types.ts +6 -0
- package/src/gradient-picker/README.md +16 -23
- package/src/gradient-picker/{index.js → index.tsx} +70 -14
- package/src/gradient-picker/stories/{index.js → index.tsx} +19 -8
- package/src/gradient-picker/types.ts +89 -0
- package/src/guide/README.md +17 -15
- package/src/guide/{icons.js → icons.tsx} +1 -1
- package/src/guide/{index.js → index.tsx} +47 -7
- package/src/guide/{page-control.js → page-control.tsx} +2 -1
- package/src/guide/{page.js → page.tsx} +8 -1
- package/src/guide/stories/{index.js → index.tsx} +11 -5
- package/src/guide/test/{index.js → index.tsx} +22 -4
- package/src/guide/types.ts +68 -0
- package/src/h-stack/README.md +2 -2
- package/src/h-stack/types.ts +2 -2
- package/src/h-stack/utils.ts +3 -3
- package/src/higher-order/navigate-regions/{index.js → index.tsx} +47 -11
- package/src/higher-order/with-fallback-styles/{index.js → index.tsx} +22 -5
- package/src/higher-order/with-filters/{index.js → index.tsx} +44 -12
- package/src/higher-order/with-filters/test/{index.js → index.tsx} +5 -1
- package/src/higher-order/with-focus-return/index.tsx +74 -0
- package/src/higher-order/with-focus-return/test/{index.js → index.tsx} +2 -2
- package/src/higher-order/with-notices/README.md +4 -1
- package/src/higher-order/with-notices/index.tsx +116 -0
- package/src/higher-order/with-notices/test/{index.js → index.tsx} +11 -6
- package/src/higher-order/with-notices/types.ts +35 -0
- package/src/higher-order/with-spoken-messages/test/{index.js → index.tsx} +2 -1
- package/src/icon/index.tsx +11 -15
- package/src/icon/test/{index.js → index.tsx} +6 -2
- package/src/index.native.js +1 -0
- package/src/item-group/test/index.js +5 -3
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +1 -1
- package/src/mobile/bottom-sheet/cell.native.js +1 -1
- package/src/mobile/bottom-sheet-text-control/README.md +8 -1
- package/src/mobile/bottom-sheet-text-control/index.native.js +2 -1
- package/src/mobile/link-settings/test/link-settings-navigation.native.js +1 -1
- package/src/navigation/README.md +16 -2
- package/src/navigation/back-button/{index.js → index.tsx} +22 -6
- package/src/navigation/{context.js → context.tsx} +8 -5
- package/src/navigation/group/context.tsx +15 -0
- package/src/navigation/group/{index.js → index.tsx} +9 -1
- package/src/navigation/{index.js → index.tsx} +63 -7
- package/src/navigation/item/{base-content.js → base-content.tsx} +5 -2
- package/src/navigation/item/{base.js → base.tsx} +3 -1
- package/src/navigation/item/{index.js → index.tsx} +8 -2
- package/src/navigation/item/{use-navigation-tree-item.js → use-navigation-tree-item.tsx} +9 -2
- package/src/navigation/menu/context.tsx +18 -0
- package/src/navigation/menu/{index.js → index.tsx} +5 -1
- package/src/navigation/menu/{menu-title-search.js → menu-title-search.tsx} +11 -7
- package/src/navigation/menu/{menu-title.js → menu-title.tsx} +5 -3
- package/src/navigation/menu/{search-no-results-found.js → search-no-results-found.tsx} +5 -1
- package/src/navigation/menu/{use-navigation-tree-menu.js → use-navigation-tree-menu.tsx} +3 -1
- package/src/navigation/stories/index.tsx +53 -0
- package/src/navigation/stories/utils/{controlled-state.js → controlled-state.tsx} +32 -13
- package/src/navigation/stories/utils/{default.js → default.tsx} +20 -6
- package/src/navigation/stories/utils/{group.js → group.tsx} +21 -7
- package/src/navigation/stories/utils/{hide-if-empty.js → hide-if-empty.tsx} +19 -6
- package/src/navigation/stories/utils/{more-examples.js → more-examples.tsx} +30 -12
- package/src/navigation/stories/utils/{search.js → search.tsx} +21 -7
- package/src/navigation/test/{index.js → index.tsx} +17 -4
- package/src/navigation/types.ts +325 -0
- package/src/navigation/{use-create-navigation-tree.js → use-create-navigation-tree.tsx} +37 -25
- package/src/navigation/{use-navigation-tree-nodes.js → use-navigation-tree-nodes.tsx} +10 -6
- package/src/navigation/{utils.js → utils.tsx} +2 -2
- package/src/navigator/navigator-screen/component.tsx +13 -7
- package/src/navigator/test/index.tsx +65 -22
- package/src/number-control/index.tsx +0 -2
- package/src/palette-edit/{index.js → index.tsx} +114 -48
- package/src/palette-edit/stories/index.tsx +82 -0
- package/src/palette-edit/test/{index.js → index.tsx} +15 -3
- package/src/palette-edit/types.ts +126 -0
- package/src/panel/README.md +53 -35
- package/src/panel/{body.js → body.tsx} +31 -17
- package/src/panel/stories/{index.js → index.tsx} +16 -6
- package/src/panel/test/{body.js → body.tsx} +12 -17
- package/src/panel/types.ts +78 -0
- package/src/placeholder/index.tsx +2 -6
- package/src/placeholder/test/index.tsx +1 -1
- package/src/placeholder/types.ts +2 -2
- package/src/popover/test/index.tsx +5 -2
- package/src/query-controls/author-select.tsx +1 -6
- package/src/query-controls/category-select.tsx +1 -6
- package/src/query-controls/terms.ts +29 -18
- package/src/range-control/index.tsx +2 -6
- package/src/range-control/types.ts +3 -3
- package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.ts +2 -1
- package/src/resizable-box/resize-tooltip/utils.ts +1 -1
- package/src/responsive-wrapper/README.md +8 -2
- package/src/responsive-wrapper/index.tsx +18 -17
- package/src/responsive-wrapper/stories/index.tsx +41 -0
- package/src/responsive-wrapper/style.scss +5 -11
- package/src/responsive-wrapper/types.ts +2 -2
- package/src/sandbox/index.native.js +71 -78
- package/src/select-control/index.tsx +16 -16
- package/src/select-control/stories/index.tsx +24 -12
- package/src/select-control/types.ts +68 -40
- package/src/slot-fill/test/slot.js +8 -6
- package/src/style.scss +1 -1
- package/src/tab-panel/index.tsx +7 -2
- package/src/tab-panel/types.ts +4 -4
- package/src/toolbar/toolbar-button/README.md +13 -1
- package/src/toolbar/toolbar-button/{index.js → index.tsx} +55 -20
- package/src/toolbar/toolbar-button/toolbar-button-container.tsx +13 -0
- package/src/toolbar/toolbar-button/types.ts +46 -0
- package/src/toolbar/toolbar-context/index.ts +15 -0
- package/src/tools-panel/test/index.tsx +86 -0
- package/src/tools-panel/tools-panel/hook.ts +44 -4
- package/src/tools-panel/types.ts +1 -0
- package/src/tooltip/index.js +11 -1
- package/src/tooltip/test/index.js +251 -301
- package/src/tree-select/index.tsx +5 -2
- package/src/tree-select/types.ts +6 -13
- package/src/ui/context/get-styled-class-name-from-key.ts +1 -1
- package/src/utils/font.js +1 -6
- package/src/utils/input/input-control.js +1 -0
- package/src/v-stack/README.md +2 -2
- package/src/v-stack/hook.ts +6 -4
- package/src/v-stack/stories/index.tsx +28 -7
- package/src/v-stack/test/__snapshots__/index.tsx.snap +20 -18
- package/src/v-stack/types.ts +5 -3
- package/tsconfig.json +1 -15
- package/tsconfig.tsbuildinfo +1 -1
- package/build/color-list-picker/index.js.map +0 -1
- package/build-module/color-list-picker/index.js.map +0 -1
- package/build-types/color-list-picker/index.d.ts.map +0 -1
- package/build-types/color-list-picker/types.d.ts.map +0 -1
- package/src/animate/index.js +0 -58
- package/src/animate/stories/index.js +0 -53
- package/src/color-picker/stories/index.js +0 -41
- package/src/custom-gradient-picker/gradient-bar/utils.js +0 -187
- package/src/custom-gradient-picker/serializer.js +0 -46
- package/src/custom-gradient-picker/stories/index.js +0 -33
- package/src/dimension-control/index.js +0 -73
- package/src/higher-order/with-focus-return/index.js +0 -64
- package/src/higher-order/with-notices/index.js +0 -104
- package/src/navigation/group/context.js +0 -9
- package/src/navigation/menu/context.js +0 -11
- package/src/navigation/stories/index.js +0 -33
- package/src/toolbar/toolbar-button/toolbar-button-container.js +0 -6
- package/src/toolbar/toolbar-context/index.js +0 -10
- /package/build/{color-list-picker → animate}/types.js +0 -0
- /package/build-module/{color-list-picker → animate}/types.js +0 -0
- /package/build-module/{color-list-picker → animate}/types.js.map +0 -0
- /package/{build/color-list-picker → build-module/autocomplete}/types.js.map +0 -0
- /package/build-types/{color-list-picker → duotone-picker/color-list-picker}/index.d.ts +0 -0
- /package/src/animation/{index.js → index.tsx} +0 -0
- /package/src/custom-gradient-picker/gradient-bar/{constants.js → constants.ts} +0 -0
- /package/src/custom-gradient-picker/styles/{custom-gradient-picker-styles.js → custom-gradient-picker-styles.tsx} +0 -0
- /package/src/{color-list-picker → duotone-picker/color-list-picker}/style.scss +0 -0
- /package/src/duotone-picker/{index.js → index.ts} +0 -0
- /package/src/higher-order/with-filters/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- /package/src/higher-order/with-spoken-messages/{index.js → index.tsx} +0 -0
- /package/src/navigation/{constants.js → constants.tsx} +0 -0
- /package/src/navigation/styles/{navigation-styles.js → navigation-styles.tsx} +0 -0
- /package/src/panel/test/__snapshots__/{body.js.snap → body.tsx.snap} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/autocomplete/autocompleter-ui.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/autocomplete/autocompleter-ui.tsx"],"names":["classnames","useLayoutEffect","useRef","useEffect","useState","useAnchor","useMergeRefs","useRefEffect","getDefaultUseItems","Button","Popover","VisuallyHidden","createPortal","getAutoCompleterUI","autocompleter","useItems","AutocompleterUI","filterValue","instanceId","listBoxId","className","selectedIndex","onChangeOptions","onSelect","onReset","reset","contentRef","items","popoverAnchor","editableContentElement","current","needsA11yCompat","setNeedsA11yCompat","popoverRef","popoverRefs","node","ownerDocument","useOnClickOutside","length","ListBox","Component","map","option","index","key","isDisabled","label","body","ref","handler","listener","event","contains","target","document","addEventListener","removeEventListener"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,eADD,EAECC,MAFD,EAGCC,SAHD,EAICC,QAJD,QAKO,oBALP,C,CAMA;AACA;;AACA,SAASC,SAAT,QAA0B,sBAA1B;AACA,SAASC,YAAT,EAAuBC,YAAvB,QAA2C,oBAA3C;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,SAASC,YAAT,QAA6B,WAA7B;AAGA,OAAO,SAASC,kBAAT,CAA6BC,aAA7B,EAA0D;AAChE,QAAMC,QAAQ,GAAGD,aAAa,CAACC,QAAd,GACdD,aAAa,CAACC,QADA,GAEdP,kBAAkB,CAAEM,aAAF,CAFrB;;AAIA,WAASE,eAAT,OAW0B;AAAA,QAXA;AACzBC,MAAAA,WADyB;AAEzBC,MAAAA,UAFyB;AAGzBC,MAAAA,SAHyB;AAIzBC,MAAAA,SAJyB;AAKzBC,MAAAA,aALyB;AAMzBC,MAAAA,eANyB;AAOzBC,MAAAA,QAPyB;AAQzBC,MAAAA,OARyB;AASzBC,MAAAA,KATyB;AAUzBC,MAAAA;AAVyB,KAWA;AACzB,UAAM,CAAEC,KAAF,IAAYZ,QAAQ,CAAEE,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I,MAAAA,QAAQ,CAACE,mBAAT,CAA8B,WAA9B,EAA2CN,QAA3C;AACAI,MAAAA,QAAQ,CAACE,mBAAT,CAA8B,YAA9B,EAA4CN,QAA5C;AACA,KAHD,CAbgB,CAiBhB;AACA;AACA;AACA,GApBQ,EAoBN,CAAED,OAAF,CApBM,CAAT;AAqBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseLayoutEffect,\n\tuseRef,\n\tuseEffect,\n\tuseState,\n} from '@wordpress/element';\n// Error expected because `@wordpress/rich-text` is not yet fully typed.\n// @ts-expect-error\nimport { useAnchor } from '@wordpress/rich-text';\nimport { useMergeRefs, useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport getDefaultUseItems from './get-default-use-items';\nimport Button from '../button';\nimport Popover from '../popover';\nimport { VisuallyHidden } from '../visually-hidden';\nimport { createPortal } from 'react-dom';\nimport type { AutocompleterUIProps, WPCompleter } from './types';\n\nexport function getAutoCompleterUI( autocompleter: WPCompleter ) {\n\tconst useItems = autocompleter.useItems\n\t\t? autocompleter.useItems\n\t\t: getDefaultUseItems( autocompleter );\n\n\tfunction AutocompleterUI( {\n\t\tfilterValue,\n\t\tinstanceId,\n\t\tlistBoxId,\n\t\tclassName,\n\t\tselectedIndex,\n\t\tonChangeOptions,\n\t\tonSelect,\n\t\tonReset,\n\t\treset,\n\t\tcontentRef,\n\t}: AutocompleterUIProps ) {\n\t\tconst [ items ] = useItems( filterValue );\n\t\tconst popoverAnchor = useAnchor( {\n\t\t\teditableContentElement: contentRef.current,\n\t\t} );\n\n\t\tconst [ needsA11yCompat, setNeedsA11yCompat ] = useState( false );\n\t\tconst popoverRef = useRef< HTMLElement >( null );\n\t\tconst popoverRefs = useMergeRefs( [\n\t\t\tpopoverRef,\n\t\t\tuseRefEffect(\n\t\t\t\t( node ) => {\n\t\t\t\t\tif ( ! contentRef.current ) return;\n\n\t\t\t\t\t// If the popover is rendered in a different document than\n\t\t\t\t\t// the content, we need to duplicate the options list in the\n\t\t\t\t\t// content document so that it's available to the screen\n\t\t\t\t\t// readers, which check the DOM ID based aira-* attributes.\n\t\t\t\t\tsetNeedsA11yCompat(\n\t\t\t\t\t\tnode.ownerDocument !== contentRef.current.ownerDocument\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t[ contentRef ]\n\t\t\t),\n\t\t] );\n\n\t\tuseOnClickOutside( popoverRef, reset );\n\n\t\tuseLayoutEffect( () => {\n\t\t\tonChangeOptions( items );\n\t\t\t// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/41820\n\t\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t}, [ items ] );\n\n\t\tif ( items.length === 0 ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst ListBox = ( {\n\t\t\tComponent = 'div',\n\t\t}: {\n\t\t\tComponent?: React.ElementType;\n\t\t} ) => (\n\t\t\t<Component\n\t\t\t\tid={ listBoxId }\n\t\t\t\trole=\"listbox\"\n\t\t\t\tclassName=\"components-autocomplete__results\"\n\t\t\t>\n\t\t\t\t{ items.map( ( option, index ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey={ option.key }\n\t\t\t\t\t\tid={ `components-autocomplete-item-${ instanceId }-${ option.key }` }\n\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\taria-selected={ index === selectedIndex }\n\t\t\t\t\t\tdisabled={ option.isDisabled }\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'components-autocomplete__result',\n\t\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'is-selected': index === selectedIndex,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonClick={ () => onSelect( option ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ option.label }\n\t\t\t\t\t</Button>\n\t\t\t\t) ) }\n\t\t\t</Component>\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<Popover\n\t\t\t\t\tfocusOnMount={ false }\n\t\t\t\t\tonClose={ onReset }\n\t\t\t\t\tplacement=\"top-start\"\n\t\t\t\t\tclassName=\"components-autocomplete__popover\"\n\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\tref={ popoverRefs }\n\t\t\t\t>\n\t\t\t\t\t<ListBox />\n\t\t\t\t</Popover>\n\t\t\t\t{ contentRef.current &&\n\t\t\t\t\tneedsA11yCompat &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<ListBox Component={ VisuallyHidden } />,\n\t\t\t\t\t\tcontentRef.current.ownerDocument.body\n\t\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn AutocompleterUI;\n}\n\nfunction useOnClickOutside(\n\tref: React.RefObject< HTMLElement >,\n\thandler: AutocompleterUIProps[ 'reset' ]\n) {\n\tuseEffect( () => {\n\t\tconst listener = ( event: MouseEvent | TouchEvent ) => {\n\t\t\t// Do nothing if clicking ref's element or descendent elements, or if the ref is not referencing an element\n\t\t\tif (\n\t\t\t\t! ref.current ||\n\t\t\t\tref.current.contains( event.target as Node )\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\thandler( event );\n\t\t};\n\t\tdocument.addEventListener( 'mousedown', listener );\n\t\tdocument.addEventListener( 'touchstart', listener );\n\t\treturn () => {\n\t\t\tdocument.removeEventListener( 'mousedown', listener );\n\t\t\tdocument.removeEventListener( 'touchstart', listener );\n\t\t};\n\t\t// Disable reason: `ref` is a ref object and should not be included in a\n\t\t// hook's dependency list.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ handler ] );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/autocomplete/get-default-use-items.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/autocomplete/get-default-use-items.tsx"],"names":["removeAccents","debounce","useLayoutEffect","useState","escapeRegExp","filterOptions","search","options","maxResults","filtered","i","length","option","keywords","label","isMatch","some","keyword","test","push","getDefaultUseItems","autocompleter","filterValue","items","setItems","isDebounced","loadOptions","promise","Promise","resolve","then","optionsData","canceled","keyedOptions","map","optionData","optionIndex","key","name","value","getOptionLabel","getOptionKeywords","isDisabled","isOptionDisabled","RegExp","cancel"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,oBAA1C;AAEA;AACA;AACA;;AACA,SAASC,YAAT,QAA6B,kBAA7B;;AAGA,SAASC,aAAT,CACCC,MADD,EAIE;AAAA,MAFDC,OAEC,uEAF+B,EAE/B;AAAA,MADDC,UACC,uEADY,EACZ;AACD,QAAMC,QAAQ,GAAG,EAAjB;;AACA,OAAM,IAAIC,CAAC,GAAG,CAAd,EAAiBA,CAAC,GAAGH,OAAO,CAACI,MAA7B,EAAqCD,CAAC,EAAtC,EAA2C;AAC1C,UAAME,MAAM,GAAGL,OAAO,CAAEG,CAAF,CAAtB,CAD0C,CAG1C;;AACA,QAAI;AAAEG,MAAAA,QAAQ,GAAG;AAAb,QAAoBD,MAAxB;;AACA,QAAK,aAAa,OAAOA,MAAM,CAACE,KAAhC,EAAwC;AACvCD,MAAAA,QAAQ,GAAG,CAAE,GAAGA,QAAL,EAAeD,MAAM,CAACE,KAAtB,CAAX;AACA;;AAED,UAAMC,OAAO,GAAGF,QAAQ,CAACG,IAAT,CAAiBC,OAAF,IAC9BX,MAAM,CAACY,IAAP,CAAalB,aAAa,CAAEiB,OAAF,CAA1B,CADe,CAAhB;;AAGA,QAAK,CAAEF,OAAP,EAAiB;AAChB;AACA;;AAEDN,IAAAA,QAAQ,CAACU,IAAT,CAAeP,MAAf,EAhB0C,CAkB1C;;AACA,QAAKH,QAAQ,CAACE,M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,EAEd,GAFc,CAAf;AAIAE,UAAAA,QAAQ,CAAEnB,aAAa,CAAEC,MAAF,EAAU2B,YAAV,CAAf,CAAR;AACA,SAlCkC,CAAnC;AAoCA,eAAON,OAAP;AACA,OAvC0B,EAwC3BF,WAAW,GAAG,GAAH,GAAS,CAxCO,CAA5B;AA2CA,YAAME,OAAO,GAAGD,WAAW,EAA3B;AAEA,aAAO,MAAM;AACZA,QAAAA,WAAW,CAACmB,MAAZ;;AACA,YAAKlB,OAAL,EAAe;AACdA,UAAAA,OAAO,CAACK,QAAR,GAAmB,IAAnB;AACA;AACD,OALD;AAMA,KArDc,EAqDZ,CAAEV,WAAF,CArDY,CAAf;AAuDA,WAAO,CAAEC,KAAF,CAAP;AACA,GArED;AAsEA","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport { debounce } from '@wordpress/compose';\nimport { useLayoutEffect, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { escapeRegExp } from '../utils/strings';\nimport type { CancelablePromise, KeyedOption, WPCompleter } from './types';\n\nfunction filterOptions(\n\tsearch: RegExp,\n\toptions: Array< KeyedOption > = [],\n\tmaxResults = 10\n) {\n\tconst filtered = [];\n\tfor ( let i = 0; i < options.length; i++ ) {\n\t\tconst option = options[ i ];\n\n\t\t// Merge label into keywords.\n\t\tlet { keywords = [] } = option;\n\t\tif ( 'string' === typeof option.label ) {\n\t\t\tkeywords = [ ...keywords, option.label ];\n\t\t}\n\n\t\tconst isMatch = keywords.some( ( keyword ) =>\n\t\t\tsearch.test( removeAccents( keyword ) )\n\t\t);\n\t\tif ( ! isMatch ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tfiltered.push( option );\n\n\t\t// Abort early if max reached.\n\t\tif ( filtered.length === maxResults ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn filtered;\n}\n\nexport default function getDefaultUseItems( autocompleter: WPCompleter ) {\n\treturn ( filterValue: string ) => {\n\t\tconst [ items, setItems ] = useState< Array< KeyedOption > >( [] );\n\t\t/*\n\t\t * We support both synchronous and asynchronous retrieval of completer options\n\t\t * but internally treat all as async so we maintain a single, consistent code path.\n\t\t *\n\t\t * Because networks can be slow, and the internet is wonderfully unpredictable,\n\t\t * we don't want two promises updating the state at once. This ensures that only\n\t\t * the most recent promise will act on `optionsData`. This doesn't use the state\n\t\t * because `setState` is batched, and so there's no guarantee that setting\n\t\t * `activePromise` in the state would result in it actually being in `this.state`\n\t\t * before the promise resolves and we check to see if this is the active promise or not.\n\t\t */\n\t\tuseLayoutEffect( () => {\n\t\t\tconst { options, isDebounced } = autocompleter;\n\t\t\tconst loadOptions = debounce(\n\t\t\t\t() => {\n\t\t\t\t\tconst promise: CancelablePromise = Promise.resolve(\n\t\t\t\t\t\ttypeof options === 'function'\n\t\t\t\t\t\t\t? options( filterValue )\n\t\t\t\t\t\t\t: options\n\t\t\t\t\t).then( ( optionsData ) => {\n\t\t\t\t\t\tif ( promise.canceled ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst keyedOptions = optionsData.map(\n\t\t\t\t\t\t\t( optionData, optionIndex ) => ( {\n\t\t\t\t\t\t\t\tkey: `${ autocompleter.name }-${ optionIndex }`,\n\t\t\t\t\t\t\t\tvalue: optionData,\n\t\t\t\t\t\t\t\tlabel: autocompleter.getOptionLabel(\n\t\t\t\t\t\t\t\t\toptionData\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tkeywords: autocompleter.getOptionKeywords\n\t\t\t\t\t\t\t\t\t? autocompleter.getOptionKeywords(\n\t\t\t\t\t\t\t\t\t\t\toptionData\n\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\tisDisabled: autocompleter.isOptionDisabled\n\t\t\t\t\t\t\t\t\t? autocompleter.isOptionDisabled(\n\t\t\t\t\t\t\t\t\t\t\toptionData\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// Create a regular expression to filter the options.\n\t\t\t\t\t\tconst search = new RegExp(\n\t\t\t\t\t\t\t'(?:\\\\b|\\\\s|^)' + escapeRegExp( filterValue ),\n\t\t\t\t\t\t\t'i'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tsetItems( filterOptions( search, keyedOptions ) );\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn promise;\n\t\t\t\t},\n\t\t\t\tisDebounced ? 250 : 0\n\t\t\t);\n\n\t\t\tconst promise = loadOptions();\n\n\t\t\treturn () => {\n\t\t\t\tloadOptions.cancel();\n\t\t\t\tif ( promise ) {\n\t\t\t\t\tpromise.canceled = true;\n\t\t\t\t}\n\t\t\t};\n\t\t}, [ filterValue ] );\n\n\t\treturn [ items ] as const;\n\t};\n}\n"]}
|
|
@@ -11,7 +11,9 @@ import removeAccents from 'remove-accents';
|
|
|
11
11
|
import { renderToString, useEffect, useState, useRef, useMemo } from '@wordpress/element';
|
|
12
12
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
13
13
|
import { useInstanceId, useDebounce, useMergeRefs, useRefEffect } from '@wordpress/compose';
|
|
14
|
-
import { create, slice, insert, isCollapsed, getTextContent
|
|
14
|
+
import { create, slice, insert, isCollapsed, getTextContent // Error expected because `@wordpress/rich-text` is not yet fully typed.
|
|
15
|
+
// @ts-expect-error
|
|
16
|
+
} from '@wordpress/rich-text';
|
|
15
17
|
import { speak } from '@wordpress/a11y';
|
|
16
18
|
/**
|
|
17
19
|
* Internal dependencies
|
|
@@ -19,84 +21,8 @@ import { speak } from '@wordpress/a11y';
|
|
|
19
21
|
|
|
20
22
|
import { getAutoCompleterUI } from './autocompleter-ui';
|
|
21
23
|
import { escapeRegExp } from '../utils/strings';
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
* A raw completer option.
|
|
25
|
-
*
|
|
26
|
-
* @typedef {*} CompleterOption
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @callback FnGetOptions
|
|
31
|
-
*
|
|
32
|
-
* @return {(CompleterOption[]|Promise.<CompleterOption[]>)} The completer options or a promise for them.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @callback FnGetOptionKeywords
|
|
37
|
-
* @param {CompleterOption} option a completer option.
|
|
38
|
-
*
|
|
39
|
-
* @return {string[]} list of key words to search.
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* @callback FnIsOptionDisabled
|
|
44
|
-
* @param {CompleterOption} option a completer option.
|
|
45
|
-
*
|
|
46
|
-
* @return {string[]} whether or not the given option is disabled.
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* @callback FnGetOptionLabel
|
|
51
|
-
* @param {CompleterOption} option a completer option.
|
|
52
|
-
*
|
|
53
|
-
* @return {(string|Array.<(string|WPElement)>)} list of react components to render.
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* @callback FnAllowContext
|
|
58
|
-
* @param {string} before the string before the auto complete trigger and query.
|
|
59
|
-
* @param {string} after the string after the autocomplete trigger and query.
|
|
60
|
-
*
|
|
61
|
-
* @return {boolean} true if the completer can handle.
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @typedef {Object} OptionCompletion
|
|
66
|
-
* @property {'insert-at-caret'|'replace'} action the intended placement of the completion.
|
|
67
|
-
* @property {OptionCompletionValue} value the completion value.
|
|
68
|
-
*/
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* A completion value.
|
|
72
|
-
*
|
|
73
|
-
* @typedef {(string|WPElement|Object)} OptionCompletionValue
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @callback FnGetOptionCompletion
|
|
78
|
-
* @param {CompleterOption} value the value of the completer option.
|
|
79
|
-
* @param {string} query the text value of the autocomplete query.
|
|
80
|
-
*
|
|
81
|
-
* @return {(OptionCompletion|OptionCompletionValue)} the completion for the given option. If an
|
|
82
|
-
* OptionCompletionValue is returned, the
|
|
83
|
-
* completion action defaults to `insert-at-caret`.
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @typedef {Object} WPCompleter
|
|
88
|
-
* @property {string} name a way to identify a completer, useful for selective overriding.
|
|
89
|
-
* @property {?string} className A class to apply to the popup menu.
|
|
90
|
-
* @property {string} triggerPrefix the prefix that will display the menu.
|
|
91
|
-
* @property {(CompleterOption[]|FnGetOptions)} options the completer options or a function to get them.
|
|
92
|
-
* @property {?FnGetOptionKeywords} getOptionKeywords get the keywords for a given option.
|
|
93
|
-
* @property {?FnIsOptionDisabled} isOptionDisabled get whether or not the given option is disabled.
|
|
94
|
-
* @property {FnGetOptionLabel} getOptionLabel get the label for a given option.
|
|
95
|
-
* @property {?FnAllowContext} allowContext filter the context under which the autocomplete activates.
|
|
96
|
-
* @property {FnGetOptionCompletion} getOptionCompletion get the completion associated with a given option.
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
function useAutocomplete(_ref) {
|
|
24
|
+
const EMPTY_FILTERED_OPTIONS = [];
|
|
25
|
+
export function useAutocomplete(_ref) {
|
|
100
26
|
let {
|
|
101
27
|
record,
|
|
102
28
|
onChange,
|
|
@@ -107,13 +33,17 @@ function useAutocomplete(_ref) {
|
|
|
107
33
|
const debouncedSpeak = useDebounce(speak, 500);
|
|
108
34
|
const instanceId = useInstanceId(useAutocomplete);
|
|
109
35
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
110
|
-
const [filteredOptions, setFilteredOptions] = useState(
|
|
36
|
+
const [filteredOptions, setFilteredOptions] = useState(EMPTY_FILTERED_OPTIONS);
|
|
111
37
|
const [filterValue, setFilterValue] = useState('');
|
|
112
38
|
const [autocompleter, setAutocompleter] = useState(null);
|
|
113
39
|
const [AutocompleterUI, setAutocompleterUI] = useState(null);
|
|
114
40
|
const backspacing = useRef(false);
|
|
115
41
|
|
|
116
42
|
function insertCompletion(replacement) {
|
|
43
|
+
if (autocompleter === null) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
117
47
|
const end = record.start;
|
|
118
48
|
const start = end - autocompleter.triggerPrefix.length - filterValue.length;
|
|
119
49
|
const toInsert = create({
|
|
@@ -133,21 +63,23 @@ function useAutocomplete(_ref) {
|
|
|
133
63
|
|
|
134
64
|
if (getOptionCompletion) {
|
|
135
65
|
const completion = getOptionCompletion(option.value, filterValue);
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
value
|
|
139
|
-
}
|
|
66
|
+
|
|
67
|
+
const isCompletionObject = obj => {
|
|
68
|
+
return obj !== null && typeof obj === 'object' && 'action' in obj && obj.action !== undefined && 'value' in obj && obj.value !== undefined;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const completionObject = isCompletionObject(completion) ? completion : {
|
|
140
72
|
action: 'insert-at-caret',
|
|
141
73
|
value: completion
|
|
142
|
-
}
|
|
74
|
+
};
|
|
143
75
|
|
|
144
|
-
if ('replace' === action) {
|
|
145
|
-
onReplace([value]); // When replacing, the component will unmount, so don't reset
|
|
76
|
+
if ('replace' === completionObject.action) {
|
|
77
|
+
onReplace([completionObject.value]); // When replacing, the component will unmount, so don't reset
|
|
146
78
|
// state (below) on an unmounted component.
|
|
147
79
|
|
|
148
80
|
return;
|
|
149
|
-
} else if ('insert-at-caret' === action) {
|
|
150
|
-
insertCompletion(value);
|
|
81
|
+
} else if ('insert-at-caret' === completionObject.action) {
|
|
82
|
+
insertCompletion(completionObject.value);
|
|
151
83
|
}
|
|
152
84
|
} // Reset autocomplete state after insertion rather than before
|
|
153
85
|
// so insertion events don't cause the completion menu to redisplay.
|
|
@@ -158,7 +90,7 @@ function useAutocomplete(_ref) {
|
|
|
158
90
|
|
|
159
91
|
function reset() {
|
|
160
92
|
setSelectedIndex(0);
|
|
161
|
-
setFilteredOptions(
|
|
93
|
+
setFilteredOptions(EMPTY_FILTERED_OPTIONS);
|
|
162
94
|
setFilterValue('');
|
|
163
95
|
setAutocompleter(null);
|
|
164
96
|
setAutocompleterUI(null);
|
|
@@ -325,7 +257,7 @@ function useAutocomplete(_ref) {
|
|
|
325
257
|
const query = match && match[1];
|
|
326
258
|
setAutocompleter(completer);
|
|
327
259
|
setAutocompleterUI(() => completer !== autocompleter ? getAutoCompleterUI(completer) : AutocompleterUI);
|
|
328
|
-
setFilterValue(query); // Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
|
|
260
|
+
setFilterValue(query === null ? '' : query); // Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
|
|
329
261
|
// See https://github.com/WordPress/gutenberg/pull/41820
|
|
330
262
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
331
263
|
}, [textContent]);
|
|
@@ -336,7 +268,7 @@ function useAutocomplete(_ref) {
|
|
|
336
268
|
className
|
|
337
269
|
} = autocompleter || {};
|
|
338
270
|
const isExpanded = !!autocompleter && filteredOptions.length > 0;
|
|
339
|
-
const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` :
|
|
271
|
+
const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` : undefined;
|
|
340
272
|
const activeId = isExpanded ? `components-autocomplete-item-${instanceId}-${selectedKey}` : null;
|
|
341
273
|
const hasSelection = record.start !== undefined;
|
|
342
274
|
return {
|
|
@@ -370,7 +302,7 @@ function useLastDifferentValue(value) {
|
|
|
370
302
|
}
|
|
371
303
|
|
|
372
304
|
export function useAutocompleteProps(options) {
|
|
373
|
-
const ref = useRef();
|
|
305
|
+
const ref = useRef(null);
|
|
374
306
|
const onKeyDownRef = useRef();
|
|
375
307
|
const {
|
|
376
308
|
record
|
|
@@ -387,7 +319,9 @@ export function useAutocompleteProps(options) {
|
|
|
387
319
|
onKeyDownRef.current = onKeyDown;
|
|
388
320
|
const mergedRefs = useMergeRefs([ref, useRefEffect(element => {
|
|
389
321
|
function _onKeyDown(event) {
|
|
390
|
-
|
|
322
|
+
var _onKeyDownRef$current;
|
|
323
|
+
|
|
324
|
+
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
|
|
391
325
|
}
|
|
392
326
|
|
|
393
327
|
element.addEventListener('keydown', _onKeyDown);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/autocomplete/index.js"],"names":["removeAccents","renderToString","useEffect","useState","useRef","useMemo","__","_n","sprintf","useInstanceId","useDebounce","useMergeRefs","useRefEffect","create","slice","insert","isCollapsed","getTextContent","speak","getAutoCompleterUI","escapeRegExp","EMPTY_ARRAY","useAutocomplete","record","onChange","onReplace","completers","contentRef","debouncedSpeak","instanceId","selectedIndex","setSelectedIndex","filteredOptions","setFilteredOptions","filterValue","setFilterValue","autocompleter","setAutocompleter","AutocompleterUI","setAutocompleterUI","backspacing","insertCompletion","replacement","end","start","triggerPrefix","length","toInsert","html","select","option","getOptionCompletion","isDisabled","completion","value","action","undefined","reset","announce","options","onChangeOptions","handleKeyDown","event","current","key","defaultPrevented","isComposing","keyCode","preventDefault","textContent","completer","find","allowContext","index","lastIndexOf","textWithoutTrigger","tooDistantFromTrigger","mismatch","wordsFromTrigger","split","hasOneTriggerWord","matchingWhileBackspacing","textAfterSelection","test","safeTrigger","text","match","RegExp","query","selectedKey","className","isExpanded","listBoxId","activeId","hasSelection","onKeyDown","popover","useLastDifferentValue","history","Set","add","size","delete","Array","from","useAutocompleteProps","ref","onKeyDownRef","previousRecord","mergedRefs","element","_onKeyDown","addEventListener","removeEventListener","didUserInput","children","Autocomplete","isSelected","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,SAFD,EAGCC,QAHD,EAICC,MAJD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P;AAOA;AAED,eAAe,SAASuB,YAAT,QAA8D;AAAA,MAAvC;AAAED,IAAAA,QAAF;AAAYE,IAAAA,UAAZ;AAAwB,OAAG1D;AAA3B,GAAuC;AAC5E,QAAM;AAAEqC,IAAAA,OAAF;AAAW,OAAGsB;AAAd,MAAwBhG,eAAe,CAAEqC,OAAF,CAA7C;AACA,SACC,8BACGwD,QAAQ,CAAEG,KAAF,CADX,EAEGD,UAAU,IAAIrB,OAFjB,CADD;AAMA","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trenderToString,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tuseInstanceId,\n\tuseDebounce,\n\tuseMergeRefs,\n\tuseRefEffect,\n} from '@wordpress/compose';\nimport {\n\tcreate,\n\tslice,\n\tinsert,\n\tisCollapsed,\n\tgetTextContent,\n} from '@wordpress/rich-text';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { getAutoCompleterUI } from './autocompleter-ui';\nimport { escapeRegExp } from '../utils/strings';\n\nconst EMPTY_ARRAY = [];\n\n/**\n * A raw completer option.\n *\n * @typedef {*} CompleterOption\n */\n\n/**\n * @callback FnGetOptions\n *\n * @return {(CompleterOption[]|Promise.<CompleterOption[]>)} The completer options or a promise for them.\n */\n\n/**\n * @callback FnGetOptionKeywords\n * @param {CompleterOption} option a completer option.\n *\n * @return {string[]} list of key words to search.\n */\n\n/**\n * @callback FnIsOptionDisabled\n * @param {CompleterOption} option a completer option.\n *\n * @return {string[]} whether or not the given option is disabled.\n */\n\n/**\n * @callback FnGetOptionLabel\n * @param {CompleterOption} option a completer option.\n *\n * @return {(string|Array.<(string|WPElement)>)} list of react components to render.\n */\n\n/**\n * @callback FnAllowContext\n * @param {string} before the string before the auto complete trigger and query.\n * @param {string} after the string after the autocomplete trigger and query.\n *\n * @return {boolean} true if the completer can handle.\n */\n\n/**\n * @typedef {Object} OptionCompletion\n * @property {'insert-at-caret'|'replace'} action the intended placement of the completion.\n * @property {OptionCompletionValue} value the completion value.\n */\n\n/**\n * A completion value.\n *\n * @typedef {(string|WPElement|Object)} OptionCompletionValue\n */\n\n/**\n * @callback FnGetOptionCompletion\n * @param {CompleterOption} value the value of the completer option.\n * @param {string} query the text value of the autocomplete query.\n *\n * @return {(OptionCompletion|OptionCompletionValue)} the completion for the given option. If an\n * \t\t\t\t\t\t\t\t\t\t\t\t\t OptionCompletionValue is returned, the\n * \t\t\t\t\t\t\t\t\t\t\t\t\t completion action defaults to `insert-at-caret`.\n */\n\n/**\n * @typedef {Object} WPCompleter\n * @property {string} name a way to identify a completer, useful for selective overriding.\n * @property {?string} className A class to apply to the popup menu.\n * @property {string} triggerPrefix the prefix that will display the menu.\n * @property {(CompleterOption[]|FnGetOptions)} options the completer options or a function to get them.\n * @property {?FnGetOptionKeywords} getOptionKeywords get the keywords for a given option.\n * @property {?FnIsOptionDisabled} isOptionDisabled get whether or not the given option is disabled.\n * @property {FnGetOptionLabel} getOptionLabel get the label for a given option.\n * @property {?FnAllowContext} allowContext filter the context under which the autocomplete activates.\n * @property {FnGetOptionCompletion} getOptionCompletion get the completion associated with a given option.\n */\n\nfunction useAutocomplete( {\n\trecord,\n\tonChange,\n\tonReplace,\n\tcompleters,\n\tcontentRef,\n} ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst instanceId = useInstanceId( useAutocomplete );\n\tconst [ selectedIndex, setSelectedIndex ] = useState( 0 );\n\tconst [ filteredOptions, setFilteredOptions ] = useState( EMPTY_ARRAY );\n\tconst [ filterValue, setFilterValue ] = useState( '' );\n\tconst [ autocompleter, setAutocompleter ] = useState( null );\n\tconst [ AutocompleterUI, setAutocompleterUI ] = useState( null );\n\tconst backspacing = useRef( false );\n\n\tfunction insertCompletion( replacement ) {\n\t\tconst end = record.start;\n\t\tconst start =\n\t\t\tend - autocompleter.triggerPrefix.length - filterValue.length;\n\t\tconst toInsert = create( { html: renderToString( replacement ) } );\n\n\t\tonChange( insert( record, toInsert, start, end ) );\n\t}\n\n\tfunction select( option ) {\n\t\tconst { getOptionCompletion } = autocompleter || {};\n\n\t\tif ( option.isDisabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( getOptionCompletion ) {\n\t\t\tconst completion = getOptionCompletion( option.value, filterValue );\n\n\t\t\tconst { action, value } =\n\t\t\t\tundefined === completion.action ||\n\t\t\t\tundefined === completion.value\n\t\t\t\t\t? { action: 'insert-at-caret', value: completion }\n\t\t\t\t\t: completion;\n\n\t\t\tif ( 'replace' === action ) {\n\t\t\t\tonReplace( [ value ] );\n\t\t\t\t// When replacing, the component will unmount, so don't reset\n\t\t\t\t// state (below) on an unmounted component.\n\t\t\t\treturn;\n\t\t\t} else if ( 'insert-at-caret' === action ) {\n\t\t\t\tinsertCompletion( value );\n\t\t\t}\n\t\t}\n\n\t\t// Reset autocomplete state after insertion rather than before\n\t\t// so insertion events don't cause the completion menu to redisplay.\n\t\treset();\n\t}\n\n\tfunction reset() {\n\t\tsetSelectedIndex( 0 );\n\t\tsetFilteredOptions( EMPTY_ARRAY );\n\t\tsetFilterValue( '' );\n\t\tsetAutocompleter( null );\n\t\tsetAutocompleterUI( null );\n\t}\n\n\tfunction announce( options ) {\n\t\tif ( ! debouncedSpeak ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( !! options.length ) {\n\t\t\tdebouncedSpeak(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\toptions.length\n\t\t\t\t\t),\n\t\t\t\t\toptions.length\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t} else {\n\t\t\tdebouncedSpeak( __( 'No results.' ), 'assertive' );\n\t\t}\n\t}\n\n\t/**\n\t * Load options for an autocompleter.\n\t *\n\t * @param {Array} options\n\t */\n\tfunction onChangeOptions( options ) {\n\t\tsetSelectedIndex(\n\t\t\toptions.length === filteredOptions.length ? selectedIndex : 0\n\t\t);\n\t\tsetFilteredOptions( options );\n\t\tannounce( options );\n\t}\n\n\tfunction handleKeyDown( event ) {\n\t\tbackspacing.current = event.key === 'Backspace';\n\n\t\tif ( ! autocompleter ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( filteredOptions.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tevent.defaultPrevented ||\n\t\t\t// Ignore keydowns from IMEs\n\t\t\tevent.isComposing ||\n\t\t\t// Workaround for Mac Safari where the final Enter/Backspace of an IME composition\n\t\t\t// is `isComposing=false`, even though it's technically still part of the composition.\n\t\t\t// These can only be detected by keyCode.\n\t\t\tevent.keyCode === 229\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tswitch ( event.key ) {\n\t\t\tcase 'ArrowUp':\n\t\t\t\tsetSelectedIndex(\n\t\t\t\t\t( selectedIndex === 0\n\t\t\t\t\t\t? filteredOptions.length\n\t\t\t\t\t\t: selectedIndex ) - 1\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowDown':\n\t\t\t\tsetSelectedIndex(\n\t\t\t\t\t( selectedIndex + 1 ) % filteredOptions.length\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'Escape':\n\t\t\t\tsetAutocompleter( null );\n\t\t\t\tsetAutocompleterUI( null );\n\t\t\t\tevent.preventDefault();\n\t\t\t\tbreak;\n\n\t\t\tcase 'Enter':\n\t\t\t\tselect( filteredOptions[ selectedIndex ] );\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowLeft':\n\t\t\tcase 'ArrowRight':\n\t\t\t\treset();\n\t\t\t\treturn;\n\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\t// Any handled key should prevent original behavior. This relies on\n\t\t// the early return in the default case.\n\t\tevent.preventDefault();\n\t}\n\n\t// textContent is a primitive (string), memoizing is not strictly necessary\n\t// but this is a preemptive performance improvement, since the autocompleter\n\t// is a potential bottleneck for the editor type metric.\n\tconst textContent = useMemo( () => {\n\t\tif ( isCollapsed( record ) ) {\n\t\t\treturn getTextContent( slice( record, 0 ) );\n\t\t}\n\t}, [ record ] );\n\n\tuseEffect( () => {\n\t\tif ( ! textContent ) {\n\t\t\tif ( autocompleter ) reset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst completer = completers?.find(\n\t\t\t( { triggerPrefix, allowContext } ) => {\n\t\t\t\tconst index = textContent.lastIndexOf( triggerPrefix );\n\n\t\t\t\tif ( index === -1 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst textWithoutTrigger = textContent.slice(\n\t\t\t\t\tindex + triggerPrefix.length\n\t\t\t\t);\n\n\t\t\t\tconst tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.\n\t\t\t\t// This is a final barrier to prevent the effect from completing with\n\t\t\t\t// an extremely long string, which causes the editor to slow-down\n\t\t\t\t// significantly. This could happen, for example, if `matchingWhileBackspacing`\n\t\t\t\t// is true and one of the \"words\" end up being too long. If that's the case,\n\t\t\t\t// it will be caught by this guard.\n\t\t\t\tif ( tooDistantFromTrigger ) return false;\n\n\t\t\t\tconst mismatch = filteredOptions.length === 0;\n\t\t\t\tconst wordsFromTrigger = textWithoutTrigger.split( /\\s/ );\n\t\t\t\t// We need to allow the effect to run when not backspacing and if there\n\t\t\t\t// was a mismatch. i.e when typing a trigger + the match string or when\n\t\t\t\t// clicking in an existing trigger word on the page. We do that if we\n\t\t\t\t// detect that we have one word from trigger in the current textual context.\n\t\t\t\t//\n\t\t\t\t// Ex.: \"Some text @a\" <-- \"@a\" will be detected as the trigger word and\n\t\t\t\t// allow the effect to run. It will run until there's a mismatch.\n\t\t\t\tconst hasOneTriggerWord = wordsFromTrigger.length === 1;\n\t\t\t\t// This is used to allow the effect to run when backspacing and if\n\t\t\t\t// \"touching\" a word that \"belongs\" to a trigger. We consider a \"trigger\n\t\t\t\t// word\" any word up to the limit of 3 from the trigger character.\n\t\t\t\t// Anything beyond that is ignored if there's a mismatch. This allows\n\t\t\t\t// us to \"escape\" a mismatch when backspacing, but still imposing some\n\t\t\t\t// sane limits.\n\t\t\t\t//\n\t\t\t\t// Ex: \"Some text @marcelo sekkkk\" <--- \"kkkk\" caused a mismatch, but\n\t\t\t\t// if the user presses backspace here, it will show the completion popup again.\n\t\t\t\tconst matchingWhileBackspacing =\n\t\t\t\t\tbackspacing.current &&\n\t\t\t\t\ttextWithoutTrigger.split( /\\s/ ).length <= 3;\n\n\t\t\t\tif (\n\t\t\t\t\tmismatch &&\n\t\t\t\t\t! ( matchingWhileBackspacing || hasOneTriggerWord )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst textAfterSelection = getTextContent(\n\t\t\t\t\tslice( record, undefined, getTextContent( record ).length )\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\tallowContext &&\n\t\t\t\t\t! allowContext(\n\t\t\t\t\t\ttextContent.slice( 0, index ),\n\t\t\t\t\t\ttextAfterSelection\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t/^\\s/.test( textWithoutTrigger ) ||\n\t\t\t\t\t/\\s\\s+$/.test( textWithoutTrigger )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn /[\\u0000-\\uFFFF]*$/.test( textWithoutTrigger );\n\t\t\t}\n\t\t);\n\n\t\tif ( ! completer ) {\n\t\t\tif ( autocompleter ) reset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst safeTrigger = escapeRegExp( completer.triggerPrefix );\n\t\tconst text = removeAccents( textContent );\n\t\tconst match = text\n\t\t\t.slice( text.lastIndexOf( completer.triggerPrefix ) )\n\t\t\t.match( new RegExp( `${ safeTrigger }([\\u0000-\\uFFFF]*)$` ) );\n\t\tconst query = match && match[ 1 ];\n\n\t\tsetAutocompleter( completer );\n\t\tsetAutocompleterUI( () =>\n\t\t\tcompleter !== autocompleter\n\t\t\t\t? getAutoCompleterUI( completer )\n\t\t\t\t: AutocompleterUI\n\t\t);\n\t\tsetFilterValue( query );\n\t\t// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.\n\t\t// See https://github.com/WordPress/gutenberg/pull/41820\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ textContent ] );\n\n\tconst { key: selectedKey = '' } = filteredOptions[ selectedIndex ] || {};\n\tconst { className } = autocompleter || {};\n\tconst isExpanded = !! autocompleter && filteredOptions.length > 0;\n\tconst listBoxId = isExpanded\n\t\t? `components-autocomplete-listbox-${ instanceId }`\n\t\t: null;\n\tconst activeId = isExpanded\n\t\t? `components-autocomplete-item-${ instanceId }-${ selectedKey }`\n\t\t: null;\n\tconst hasSelection = record.start !== undefined;\n\n\treturn {\n\t\tlistBoxId,\n\t\tactiveId,\n\t\tonKeyDown: handleKeyDown,\n\t\tpopover: hasSelection && AutocompleterUI && (\n\t\t\t<AutocompleterUI\n\t\t\t\tclassName={ className }\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tinstanceId={ instanceId }\n\t\t\t\tlistBoxId={ listBoxId }\n\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\tonChangeOptions={ onChangeOptions }\n\t\t\t\tonSelect={ select }\n\t\t\t\tvalue={ record }\n\t\t\t\tcontentRef={ contentRef }\n\t\t\t\treset={ reset }\n\t\t\t/>\n\t\t),\n\t};\n}\n\nfunction useLastDifferentValue( value ) {\n\tconst history = useRef( new Set() );\n\n\thistory.current.add( value );\n\n\t// Keep the history size to 2.\n\tif ( history.current.size > 2 ) {\n\t\thistory.current.delete( Array.from( history.current )[ 0 ] );\n\t}\n\n\treturn Array.from( history.current )[ 0 ];\n}\n\nexport function useAutocompleteProps( options ) {\n\tconst ref = useRef();\n\tconst onKeyDownRef = useRef();\n\tconst { record } = options;\n\tconst previousRecord = useLastDifferentValue( record );\n\tconst { popover, listBoxId, activeId, onKeyDown } = useAutocomplete( {\n\t\t...options,\n\t\tcontentRef: ref,\n\t} );\n\tonKeyDownRef.current = onKeyDown;\n\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tuseRefEffect( ( element ) => {\n\t\t\tfunction _onKeyDown( event ) {\n\t\t\t\tonKeyDownRef.current( event );\n\t\t\t}\n\t\t\telement.addEventListener( 'keydown', _onKeyDown );\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'keydown', _onKeyDown );\n\t\t\t};\n\t\t}, [] ),\n\t] );\n\n\t// We only want to show the popover if the user has typed something.\n\tconst didUserInput = record.text !== previousRecord?.text;\n\n\tif ( ! didUserInput ) {\n\t\treturn { ref: mergedRefs };\n\t}\n\n\treturn {\n\t\tref: mergedRefs,\n\t\tchildren: popover,\n\t\t'aria-autocomplete': listBoxId ? 'list' : undefined,\n\t\t'aria-owns': listBoxId,\n\t\t'aria-activedescendant': activeId,\n\t};\n}\n\nexport default function Autocomplete( { children, isSelected, ...options } ) {\n\tconst { popover, ...props } = useAutocomplete( options );\n\treturn (\n\t\t<>\n\t\t\t{ children( props ) }\n\t\t\t{ isSelected && popover }\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/autocomplete/index.tsx"],"names":["removeAccents","renderToString","useEffect","useState","useRef","useMemo","__","_n","sprintf","useInstanceId","useDebounce","useMergeRefs","useRefEffect","create","slice","insert","isCollapsed","getTextContent","speak","getAutoCompleterUI","escapeRegExp","EMPTY_FILTERED_OPTIONS","useAutocomplete","record","onChange","onReplace","completers","contentRef","debouncedSpeak","instanceId","selectedIndex","setSelectedIndex","filteredOptions","setFilteredOptions","filterValue","setFilterValue","autocompleter","setAutocompleter","AutocompleterUI","setAutocompleterUI","backspacing","insertCompletion","replacement","end","start","triggerPrefix","length","toInsert","html","select","option","getOptionCompletion","isDisabled","completion","value","isCompletionObject","obj","action","undefined","completionObject","reset","announce","options","onChangeOptions","handleKeyDown","event","current","key","defaultPrevented","isComposing","keyCode","preventDefault","textContent","completer","find","allowContext","index","lastIndexOf","textWithoutTrigger","tooDistantFromTrigger","mismatch","wordsFromTrigger","split","hasOneTriggerWord","matchingWhileBackspacing","textAfterSelection","test","safeTrigger","text","match","RegExp","query","selectedKey","className","isExpanded","listBoxId","activeId","hasSelection","onKeyDown","popover","useLastDifferentValue","history","Set","add","size","delete","Array","from","useAutocompleteProps","ref","onKeyDownRef","previousRecord","mergedRefs","element","_onKeyDown","addEventListener","removeEventListener","didUserInput","children","Autocomplete","isSelected","props"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,gBAA1B;AAEA;AACA;AACA;;AACA,SACCC,cADD,EAECC,SAFD,EAGCC,QAHD,EAICC,MAJD,EAKCC,OALD,QAMO,oBANP;AAOA,SAASC,EAAT,EAAaC,EAAb,EAAiBC,OAAjB,QAAgC,iBAAhC;AACA,SACCC,aADD,EAECC,WAFD,EAGCC,YAHD,EAICC,YAJD,QAKO,oBALP;AAMA,SACCC,MADD,EAECC,KAFD,EAGCC,MAHD,EAICC,WAJD,EAKCC,cALD,CAMC;AACA;AAPD,OAQO,sBARP;AASA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AACA,SAASC,YAAT,QAA6B,kBAA7B;AAYA,MAAMC,sBAAqC,GAAG,EAA9C;AAEA,OAAO,SAASC,eAAT,OAMmB;AAAA,MANO;AAChCC,IAAAA,MADgC;AAEhCC,IAAAA,QAFgC;AAGhCC,IAAAA,SAHgC;AAIhCC,IAAAA,UAJgC;AAKhCC,IAAAA;AALgC,GAMP;AACzB,QAAMC,cAAc,GAAGlB,WAAW,CAAEQ,KAAF,EAAS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4C;AAAA;;AAC3C,+BAAA6C,YAAY,CAAC5C,OAAb,qFAAA4C,YAAY,EAAY7C,KAAZ,CAAZ;AACA;;AACDgD,IAAAA,OAAO,CAACE,gBAAR,CAA0B,SAA1B,EAAqCD,UAArC;AACA,WAAO,MAAM;AACZD,MAAAA,OAAO,CAACG,mBAAR,CAA6B,SAA7B,EAAwCF,UAAxC;AACA,KAFD;AAGA,GARW,EAQT,EARS,CAFoB,CAAF,CAA/B,CAXqE,CAwBrE;;AACA,QAAMG,YAAY,GAAG9F,MAAM,CAACiE,IAAP,MAAgBuB,cAAhB,aAAgBA,cAAhB,uBAAgBA,cAAc,CAAEvB,IAAhC,CAArB;;AAEA,MAAK,CAAE6B,YAAP,EAAsB;AACrB,WAAO;AAAER,MAAAA,GAAG,EAAEG;AAAP,KAAP;AACA;;AAED,SAAO;AACNH,IAAAA,GAAG,EAAEG,UADC;AAENM,IAAAA,QAAQ,EAAEnB,OAFJ;AAGN,yBAAqBJ,SAAS,GAAG,MAAH,GAAYrC,SAHpC;AAIN,iBAAaqC,SAJP;AAKN,6BAAyBC;AALnB,GAAP;AAOA;AAED,eAAe,SAASuB,YAAT,QAIQ;AAAA,MAJe;AACrCD,IAAAA,QADqC;AAErCE,IAAAA,UAFqC;AAGrC,OAAG1D;AAHkC,GAIf;AACtB,QAAM;AAAEqC,IAAAA,OAAF;AAAW,OAAGsB;AAAd,MAAwBnG,eAAe,CAAEwC,OAAF,CAA7C;AACA,SACC,8BACGwD,QAAQ,CAAEG,KAAF,CADX,EAEGD,UAAU,IAAIrB,OAFjB,CADD;AAMA","sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport {\n\trenderToString,\n\tuseEffect,\n\tuseState,\n\tuseRef,\n\tuseMemo,\n} from '@wordpress/element';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tuseInstanceId,\n\tuseDebounce,\n\tuseMergeRefs,\n\tuseRefEffect,\n} from '@wordpress/compose';\nimport {\n\tcreate,\n\tslice,\n\tinsert,\n\tisCollapsed,\n\tgetTextContent,\n\t// Error expected because `@wordpress/rich-text` is not yet fully typed.\n\t// @ts-expect-error\n} from '@wordpress/rich-text';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { getAutoCompleterUI } from './autocompleter-ui';\nimport { escapeRegExp } from '../utils/strings';\nimport type {\n\tAutocompleteProps,\n\tAutocompleterUIProps,\n\tInsertOption,\n\tKeyedOption,\n\tOptionCompletion,\n\tReplaceOption,\n\tUseAutocompleteProps,\n\tWPCompleter,\n} from './types';\n\nconst EMPTY_FILTERED_OPTIONS: KeyedOption[] = [];\n\nexport function useAutocomplete( {\n\trecord,\n\tonChange,\n\tonReplace,\n\tcompleters,\n\tcontentRef,\n}: UseAutocompleteProps ) {\n\tconst debouncedSpeak = useDebounce( speak, 500 );\n\tconst instanceId = useInstanceId( useAutocomplete );\n\tconst [ selectedIndex, setSelectedIndex ] = useState( 0 );\n\n\tconst [ filteredOptions, setFilteredOptions ] = useState<\n\t\tArray< KeyedOption >\n\t>( EMPTY_FILTERED_OPTIONS );\n\tconst [ filterValue, setFilterValue ] =\n\t\tuseState< AutocompleterUIProps[ 'filterValue' ] >( '' );\n\tconst [ autocompleter, setAutocompleter ] = useState< WPCompleter | null >(\n\t\tnull\n\t);\n\tconst [ AutocompleterUI, setAutocompleterUI ] = useState<\n\t\t( ( props: AutocompleterUIProps ) => JSX.Element | null ) | null\n\t>( null );\n\n\tconst backspacing = useRef( false );\n\n\tfunction insertCompletion( replacement: React.ReactNode ) {\n\t\tif ( autocompleter === null ) {\n\t\t\treturn;\n\t\t}\n\t\tconst end = record.start;\n\t\tconst start =\n\t\t\tend - autocompleter.triggerPrefix.length - filterValue.length;\n\t\tconst toInsert = create( { html: renderToString( replacement ) } );\n\n\t\tonChange( insert( record, toInsert, start, end ) );\n\t}\n\n\tfunction select( option: KeyedOption ) {\n\t\tconst { getOptionCompletion } = autocompleter || {};\n\n\t\tif ( option.isDisabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( getOptionCompletion ) {\n\t\t\tconst completion = getOptionCompletion( option.value, filterValue );\n\n\t\t\tconst isCompletionObject = (\n\t\t\t\tobj: OptionCompletion\n\t\t\t): obj is InsertOption | ReplaceOption => {\n\t\t\t\treturn (\n\t\t\t\t\tobj !== null &&\n\t\t\t\t\ttypeof obj === 'object' &&\n\t\t\t\t\t'action' in obj &&\n\t\t\t\t\tobj.action !== undefined &&\n\t\t\t\t\t'value' in obj &&\n\t\t\t\t\tobj.value !== undefined\n\t\t\t\t);\n\t\t\t};\n\n\t\t\tconst completionObject = isCompletionObject( completion )\n\t\t\t\t? completion\n\t\t\t\t: ( {\n\t\t\t\t\t\taction: 'insert-at-caret',\n\t\t\t\t\t\tvalue: completion,\n\t\t\t\t } as InsertOption );\n\n\t\t\tif ( 'replace' === completionObject.action ) {\n\t\t\t\tonReplace( [ completionObject.value ] );\n\t\t\t\t// When replacing, the component will unmount, so don't reset\n\t\t\t\t// state (below) on an unmounted component.\n\t\t\t\treturn;\n\t\t\t} else if ( 'insert-at-caret' === completionObject.action ) {\n\t\t\t\tinsertCompletion( completionObject.value );\n\t\t\t}\n\t\t}\n\n\t\t// Reset autocomplete state after insertion rather than before\n\t\t// so insertion events don't cause the completion menu to redisplay.\n\t\treset();\n\t}\n\n\tfunction reset() {\n\t\tsetSelectedIndex( 0 );\n\t\tsetFilteredOptions( EMPTY_FILTERED_OPTIONS );\n\t\tsetFilterValue( '' );\n\t\tsetAutocompleter( null );\n\t\tsetAutocompleterUI( null );\n\t}\n\n\tfunction announce( options: Array< KeyedOption > ) {\n\t\tif ( ! debouncedSpeak ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( !! options.length ) {\n\t\t\tdebouncedSpeak(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\toptions.length\n\t\t\t\t\t),\n\t\t\t\t\toptions.length\n\t\t\t\t),\n\t\t\t\t'assertive'\n\t\t\t);\n\t\t} else {\n\t\t\tdebouncedSpeak( __( 'No results.' ), 'assertive' );\n\t\t}\n\t}\n\n\t/**\n\t * Load options for an autocompleter.\n\t *\n\t * @param {Array} options\n\t */\n\tfunction onChangeOptions( options: Array< KeyedOption > ) {\n\t\tsetSelectedIndex(\n\t\t\toptions.length === filteredOptions.length ? selectedIndex : 0\n\t\t);\n\t\tsetFilteredOptions( options );\n\t\tannounce( options );\n\t}\n\n\tfunction handleKeyDown( event: KeyboardEvent ) {\n\t\tbackspacing.current = event.key === 'Backspace';\n\n\t\tif ( ! autocompleter ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( filteredOptions.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tevent.defaultPrevented ||\n\t\t\t// Ignore keydowns from IMEs\n\t\t\tevent.isComposing ||\n\t\t\t// Workaround for Mac Safari where the final Enter/Backspace of an IME composition\n\t\t\t// is `isComposing=false`, even though it's technically still part of the composition.\n\t\t\t// These can only be detected by keyCode.\n\t\t\tevent.keyCode === 229\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tswitch ( event.key ) {\n\t\t\tcase 'ArrowUp':\n\t\t\t\tsetSelectedIndex(\n\t\t\t\t\t( selectedIndex === 0\n\t\t\t\t\t\t? filteredOptions.length\n\t\t\t\t\t\t: selectedIndex ) - 1\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowDown':\n\t\t\t\tsetSelectedIndex(\n\t\t\t\t\t( selectedIndex + 1 ) % filteredOptions.length\n\t\t\t\t);\n\t\t\t\tbreak;\n\n\t\t\tcase 'Escape':\n\t\t\t\tsetAutocompleter( null );\n\t\t\t\tsetAutocompleterUI( null );\n\t\t\t\tevent.preventDefault();\n\t\t\t\tbreak;\n\n\t\t\tcase 'Enter':\n\t\t\t\tselect( filteredOptions[ selectedIndex ] );\n\t\t\t\tbreak;\n\n\t\t\tcase 'ArrowLeft':\n\t\t\tcase 'ArrowRight':\n\t\t\t\treset();\n\t\t\t\treturn;\n\n\t\t\tdefault:\n\t\t\t\treturn;\n\t\t}\n\n\t\t// Any handled key should prevent original behavior. This relies on\n\t\t// the early return in the default case.\n\t\tevent.preventDefault();\n\t}\n\n\t// textContent is a primitive (string), memoizing is not strictly necessary\n\t// but this is a preemptive performance improvement, since the autocompleter\n\t// is a potential bottleneck for the editor type metric.\n\tconst textContent = useMemo( () => {\n\t\tif ( isCollapsed( record ) ) {\n\t\t\treturn getTextContent( slice( record, 0 ) );\n\t\t}\n\t}, [ record ] );\n\n\tuseEffect( () => {\n\t\tif ( ! textContent ) {\n\t\t\tif ( autocompleter ) reset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst completer = completers?.find(\n\t\t\t( { triggerPrefix, allowContext } ) => {\n\t\t\t\tconst index = textContent.lastIndexOf( triggerPrefix );\n\n\t\t\t\tif ( index === -1 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst textWithoutTrigger = textContent.slice(\n\t\t\t\t\tindex + triggerPrefix.length\n\t\t\t\t);\n\n\t\t\t\tconst tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.\n\t\t\t\t// This is a final barrier to prevent the effect from completing with\n\t\t\t\t// an extremely long string, which causes the editor to slow-down\n\t\t\t\t// significantly. This could happen, for example, if `matchingWhileBackspacing`\n\t\t\t\t// is true and one of the \"words\" end up being too long. If that's the case,\n\t\t\t\t// it will be caught by this guard.\n\t\t\t\tif ( tooDistantFromTrigger ) return false;\n\n\t\t\t\tconst mismatch = filteredOptions.length === 0;\n\t\t\t\tconst wordsFromTrigger = textWithoutTrigger.split( /\\s/ );\n\t\t\t\t// We need to allow the effect to run when not backspacing and if there\n\t\t\t\t// was a mismatch. i.e when typing a trigger + the match string or when\n\t\t\t\t// clicking in an existing trigger word on the page. We do that if we\n\t\t\t\t// detect that we have one word from trigger in the current textual context.\n\t\t\t\t//\n\t\t\t\t// Ex.: \"Some text @a\" <-- \"@a\" will be detected as the trigger word and\n\t\t\t\t// allow the effect to run. It will run until there's a mismatch.\n\t\t\t\tconst hasOneTriggerWord = wordsFromTrigger.length === 1;\n\t\t\t\t// This is used to allow the effect to run when backspacing and if\n\t\t\t\t// \"touching\" a word that \"belongs\" to a trigger. We consider a \"trigger\n\t\t\t\t// word\" any word up to the limit of 3 from the trigger character.\n\t\t\t\t// Anything beyond that is ignored if there's a mismatch. This allows\n\t\t\t\t// us to \"escape\" a mismatch when backspacing, but still imposing some\n\t\t\t\t// sane limits.\n\t\t\t\t//\n\t\t\t\t// Ex: \"Some text @marcelo sekkkk\" <--- \"kkkk\" caused a mismatch, but\n\t\t\t\t// if the user presses backspace here, it will show the completion popup again.\n\t\t\t\tconst matchingWhileBackspacing =\n\t\t\t\t\tbackspacing.current &&\n\t\t\t\t\ttextWithoutTrigger.split( /\\s/ ).length <= 3;\n\n\t\t\t\tif (\n\t\t\t\t\tmismatch &&\n\t\t\t\t\t! ( matchingWhileBackspacing || hasOneTriggerWord )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tconst textAfterSelection = getTextContent(\n\t\t\t\t\tslice( record, undefined, getTextContent( record ).length )\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\tallowContext &&\n\t\t\t\t\t! allowContext(\n\t\t\t\t\t\ttextContent.slice( 0, index ),\n\t\t\t\t\t\ttextAfterSelection\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\t/^\\s/.test( textWithoutTrigger ) ||\n\t\t\t\t\t/\\s\\s+$/.test( textWithoutTrigger )\n\t\t\t\t) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\treturn /[\\u0000-\\uFFFF]*$/.test( textWithoutTrigger );\n\t\t\t}\n\t\t);\n\n\t\tif ( ! completer ) {\n\t\t\tif ( autocompleter ) reset();\n\t\t\treturn;\n\t\t}\n\n\t\tconst safeTrigger = escapeRegExp( completer.triggerPrefix );\n\t\tconst text = removeAccents( textContent );\n\t\tconst match = text\n\t\t\t.slice( text.lastIndexOf( completer.triggerPrefix ) )\n\t\t\t.match( new RegExp( `${ safeTrigger }([\\u0000-\\uFFFF]*)$` ) );\n\t\tconst query = match && match[ 1 ];\n\n\t\tsetAutocompleter( completer );\n\t\tsetAutocompleterUI( () =>\n\t\t\tcompleter !== autocompleter\n\t\t\t\t? getAutoCompleterUI( completer )\n\t\t\t\t: AutocompleterUI\n\t\t);\n\t\tsetFilterValue( query === null ? '' : query );\n\t\t// Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.\n\t\t// See https://github.com/WordPress/gutenberg/pull/41820\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ textContent ] );\n\n\tconst { key: selectedKey = '' } = filteredOptions[ selectedIndex ] || {};\n\tconst { className } = autocompleter || {};\n\tconst isExpanded = !! autocompleter && filteredOptions.length > 0;\n\tconst listBoxId = isExpanded\n\t\t? `components-autocomplete-listbox-${ instanceId }`\n\t\t: undefined;\n\tconst activeId = isExpanded\n\t\t? `components-autocomplete-item-${ instanceId }-${ selectedKey }`\n\t\t: null;\n\tconst hasSelection = record.start !== undefined;\n\n\treturn {\n\t\tlistBoxId,\n\t\tactiveId,\n\t\tonKeyDown: handleKeyDown,\n\t\tpopover: hasSelection && AutocompleterUI && (\n\t\t\t<AutocompleterUI\n\t\t\t\tclassName={ className }\n\t\t\t\tfilterValue={ filterValue }\n\t\t\t\tinstanceId={ instanceId }\n\t\t\t\tlistBoxId={ listBoxId }\n\t\t\t\tselectedIndex={ selectedIndex }\n\t\t\t\tonChangeOptions={ onChangeOptions }\n\t\t\t\tonSelect={ select }\n\t\t\t\tvalue={ record }\n\t\t\t\tcontentRef={ contentRef }\n\t\t\t\treset={ reset }\n\t\t\t/>\n\t\t),\n\t};\n}\n\nfunction useLastDifferentValue( value: UseAutocompleteProps[ 'record' ] ) {\n\tconst history = useRef< Set< typeof value > >( new Set() );\n\n\thistory.current.add( value );\n\n\t// Keep the history size to 2.\n\tif ( history.current.size > 2 ) {\n\t\thistory.current.delete( Array.from( history.current )[ 0 ] );\n\t}\n\n\treturn Array.from( history.current )[ 0 ];\n}\n\nexport function useAutocompleteProps( options: UseAutocompleteProps ) {\n\tconst ref = useRef< HTMLElement >( null );\n\tconst onKeyDownRef = useRef< ( event: KeyboardEvent ) => void >();\n\tconst { record } = options;\n\tconst previousRecord = useLastDifferentValue( record );\n\tconst { popover, listBoxId, activeId, onKeyDown } = useAutocomplete( {\n\t\t...options,\n\t\tcontentRef: ref,\n\t} );\n\tonKeyDownRef.current = onKeyDown;\n\n\tconst mergedRefs = useMergeRefs( [\n\t\tref,\n\t\tuseRefEffect( ( element: HTMLElement ) => {\n\t\t\tfunction _onKeyDown( event: KeyboardEvent ) {\n\t\t\t\tonKeyDownRef.current?.( event );\n\t\t\t}\n\t\t\telement.addEventListener( 'keydown', _onKeyDown );\n\t\t\treturn () => {\n\t\t\t\telement.removeEventListener( 'keydown', _onKeyDown );\n\t\t\t};\n\t\t}, [] ),\n\t] );\n\n\t// We only want to show the popover if the user has typed something.\n\tconst didUserInput = record.text !== previousRecord?.text;\n\n\tif ( ! didUserInput ) {\n\t\treturn { ref: mergedRefs };\n\t}\n\n\treturn {\n\t\tref: mergedRefs,\n\t\tchildren: popover,\n\t\t'aria-autocomplete': listBoxId ? 'list' : undefined,\n\t\t'aria-owns': listBoxId,\n\t\t'aria-activedescendant': activeId,\n\t};\n}\n\nexport default function Autocomplete( {\n\tchildren,\n\tisSelected,\n\t...options\n}: AutocompleteProps ) {\n\tconst { popover, ...props } = useAutocomplete( options );\n\treturn (\n\t\t<>\n\t\t\t{ children( props ) }\n\t\t\t{ isSelected && popover }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/box-control/axial-input-controls.tsx"],"names":["parseQuantityAndUnitFromRawValue","UnitControl","LABELS","Layout","groupedSides","AxialInputControls","onChange","onFocus","onHoverOn","onHoverOff","values","selectedUnits","setSelectedUnits","sides","props","createHandleOnFocus","side","event","createHandleOnHoverOn","top","bottom","left","right","createHandleOnHoverOff","createHandleOnChange","next","nextValues","isNumeric","undefined","isNaN","parseFloat","nextValue","createHandleOnUnitChange","newUnits","filteredSides","length","filter","includes","first","last","only","map","parsedQuantity","parsedUnit","selectedUnit","join"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,gCAAT,QAAiD,uBAAjD;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,MAAT,QAAuB,SAAvB;AACA,SAASC,MAAT,QAAuB,6BAAvB;AAGA,MAAMC,YAAY,GAAG,CAAE,UAAF,EAAc,YAAd,CAArB;AAGA,eAAe,SAASC,kBAAT,OAUkB;AAAA,MAVW;AAC3CC,IAAAA,QAD2C;AAE3CC,IAAAA,OAF2C;AAG3CC,IAAAA,SAH2C;AAI3CC,IAAAA,UAJ2C;AAK3CC,IAAAA,MAL2C;AAM3CC,IAAAA,aAN2C;AAO3CC,IAAAA,gBAP2C;AAQ3CC,IAAAA,KAR2C;AAS3C,OAAGC;AATwC,GAUX;;AAChC,QAAMC,mBAAmB,GACtBC,IAAF,IACEC,KAAF,IAAmD;AAClD,QAAK,CAAEV,OAAP,EAAiB;AAChB;AACA;;AACDA,IAAAA,OAAO,CAAEU,KAAF,EAAS;AAAED,MAAAA;AAAF,KAAT,CAAP;AACA,GAPF;;AASA,QAAME,qBAAqB,GAAKF,IAAF,IAAyB,MAAM;AAC5D,QAAK,CAAER,SAAP,EAAmB;AAClB;AACA;;AACD,QAAKQ,IAAI,KAAK,UAAd,EAA2B;AAC1BR,MAAAA,SAAS,CAAE;AACVW,QAAAA,GAAG,EAA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A,UAAMuB,YAAY,GACjB5B,IAAI,KAAK,UAAT,GACGL,aAAa,CAACQ,GADjB,GAEGR,aAAa,CAACU,IAHlB;AAIA,WACC,cAAC,WAAD,eACMP,KADN;AAEC,MAAA,OAAO,EAAGwB,KAAK,KAAKtB,IAFrB;AAGC,MAAA,MAAM,EAAGuB,IAAI,KAAKvB,IAHnB;AAIC,MAAA,MAAM,EAAGwB,IAAI,KAAKxB,IAJnB;AAKC,MAAA,KAAK,EAAG,CACP0B,cADO,EAEPE,YAFO,aAEPA,YAFO,cAEPA,YAFO,GAESD,UAFT,EAGNE,IAHM,CAGA,EAHA,CALT;AASC,MAAA,QAAQ,EAAGrB,oBAAoB,CAAER,IAAF,CAThC;AAUC,MAAA,YAAY,EAAGgB,wBAAwB,CAAEhB,IAAF,CAVxC;AAWC,MAAA,OAAO,EAAGD,mBAAmB,CAAEC,IAAF,CAX9B;AAYC,MAAA,SAAS,EAAGE,qBAAqB,CAAEF,IAAF,CAZlC;AAaC,MAAA,UAAU,EAAGO,sBAAsB,CAAEP,IAAF,CAbpC;AAcC,MAAA,KAAK,EAAGd,MAAM,CAAEc,IAAF,CAdf;AAeC,MAAA,GAAG,EAAGA;AAfP,OADD;AAmBA,GA5BC,CALH,CADD;AAqCA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport UnitControl from './unit-control';\nimport { LABELS } from './utils';\nimport { Layout } from './styles/box-control-styles';\nimport type { BoxControlInputControlProps } from './types';\n\nconst groupedSides = [ 'vertical', 'horizontal' ] as const;\ntype GroupedSide = typeof groupedSides[ number ];\n\nexport default function AxialInputControls( {\n\tonChange,\n\tonFocus,\n\tonHoverOn,\n\tonHoverOff,\n\tvalues,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tsides,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst createHandleOnFocus =\n\t\t( side: GroupedSide ) =>\n\t\t( event: React.FocusEvent< HTMLInputElement > ) => {\n\t\t\tif ( ! onFocus ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonFocus( event, { side } );\n\t\t};\n\n\tconst createHandleOnHoverOn = ( side: GroupedSide ) => () => {\n\t\tif ( ! onHoverOn ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( side === 'vertical' ) {\n\t\t\tonHoverOn( {\n\t\t\t\ttop: true,\n\t\t\t\tbottom: true,\n\t\t\t} );\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tonHoverOn( {\n\t\t\t\tleft: true,\n\t\t\t\tright: true,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst createHandleOnHoverOff = ( side: GroupedSide ) => () => {\n\t\tif ( ! onHoverOff ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( side === 'vertical' ) {\n\t\t\tonHoverOff( {\n\t\t\t\ttop: false,\n\t\t\t\tbottom: false,\n\t\t\t} );\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tonHoverOff( {\n\t\t\t\tleft: false,\n\t\t\t\tright: false,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst createHandleOnChange = ( side: GroupedSide ) => ( next?: string ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextValues = { ...values };\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\n\t\tif ( side === 'vertical' ) {\n\t\t\tnextValues.top = nextValue;\n\t\t\tnextValues.bottom = nextValue;\n\t\t}\n\n\t\tif ( side === 'horizontal' ) {\n\t\t\tnextValues.left = nextValue;\n\t\t\tnextValues.right = nextValue;\n\t\t}\n\n\t\tonChange( nextValues );\n\t};\n\n\tconst createHandleOnUnitChange =\n\t\t( side: GroupedSide ) => ( next?: string ) => {\n\t\t\tconst newUnits = { ...selectedUnits };\n\n\t\t\tif ( side === 'vertical' ) {\n\t\t\t\tnewUnits.top = next;\n\t\t\t\tnewUnits.bottom = next;\n\t\t\t}\n\n\t\t\tif ( side === 'horizontal' ) {\n\t\t\t\tnewUnits.left = next;\n\t\t\t\tnewUnits.right = next;\n\t\t\t}\n\n\t\t\tsetSelectedUnits( newUnits );\n\t\t};\n\n\t// Filter sides if custom configuration provided, maintaining default order.\n\tconst filteredSides = sides?.length\n\t\t? groupedSides.filter( ( side ) => sides.includes( side ) )\n\t\t: groupedSides;\n\n\tconst first = filteredSides[ 0 ];\n\tconst last = filteredSides[ filteredSides.length - 1 ];\n\tconst only = first === last && first;\n\n\treturn (\n\t\t<Layout\n\t\t\tgap={ 0 }\n\t\t\talign=\"top\"\n\t\t\tclassName=\"component-box-control__vertical-horizontal-input-controls\"\n\t\t>\n\t\t\t{ filteredSides.map( ( side ) => {\n\t\t\t\tconst [ parsedQuantity, parsedUnit ] =\n\t\t\t\t\tparseQuantityAndUnitFromRawValue(\n\t\t\t\t\t\tside === 'vertical' ? values.top : values.left\n\t\t\t\t\t);\n\t\t\t\tconst selectedUnit =\n\t\t\t\t\tside === 'vertical'\n\t\t\t\t\t\t? selectedUnits.top\n\t\t\t\t\t\t: selectedUnits.left;\n\t\t\t\treturn (\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\tisFirst={ first === side }\n\t\t\t\t\t\tisLast={ last === side }\n\t\t\t\t\t\tisOnly={ only === side }\n\t\t\t\t\t\tvalue={ [\n\t\t\t\t\t\t\tparsedQuantity,\n\t\t\t\t\t\t\tselectedUnit ?? parsedUnit,\n\t\t\t\t\t\t].join( '' ) }\n\t\t\t\t\t\tonChange={ createHandleOnChange( side ) }\n\t\t\t\t\t\tonUnitChange={ createHandleOnUnitChange( side ) }\n\t\t\t\t\t\tonFocus={ createHandleOnFocus( side ) }\n\t\t\t\t\t\tonHoverOn={ createHandleOnHoverOn( side ) }\n\t\t\t\t\t\tonHoverOff={ createHandleOnHoverOff( side ) }\n\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\tkey={ side }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Layout>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/box-control/axial-input-controls.tsx"],"names":["parseQuantityAndUnitFromRawValue","UnitControl","LABELS","Layout","groupedSides","AxialInputControls","onChange","onFocus","onHoverOn","onHoverOff","values","selectedUnits","setSelectedUnits","sides","props","createHandleOnFocus","side","event","createHandleOnHoverOn","top","bottom","left","right","createHandleOnHoverOff","createHandleOnChange","next","nextValues","isNumeric","undefined","isNaN","parseFloat","nextValue","createHandleOnUnitChange","newUnits","filteredSides","length","filter","includes","first","last","only","map","parsedQuantity","parsedUnit","selectedUnit","join"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,gCAAT,QAAiD,uBAAjD;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,MAAT,QAAuB,SAAvB;AACA,SAASC,MAAT,QAAuB,6BAAvB;AAGA,MAAMC,YAAY,GAAG,CAAE,UAAF,EAAc,YAAd,CAArB;AAGA,eAAe,SAASC,kBAAT,OAUkB;AAAA,MAVW;AAC3CC,IAAAA,QAD2C;AAE3CC,IAAAA,OAF2C;AAG3CC,IAAAA,SAH2C;AAI3CC,IAAAA,UAJ2C;AAK3CC,IAAAA,MAL2C;AAM3CC,IAAAA,aAN2C;AAO3CC,IAAAA,gBAP2C;AAQ3CC,IAAAA,KAR2C;AAS3C,OAAGC;AATwC,GAUX;;AAChC,QAAMC,mBAAmB,GACtBC,IAAF,IACEC,KAAF,IAAmD;AAClD,QAAK,CAAEV,OAAP,EAAiB;AAChB;AACA;;AACDA,IAAAA,OAAO,CAAEU,KAAF,EAAS;AAAED,MAAAA;AAAF,KAAT,CAAP;AACA,GAPF;;AASA,QAAME,qBAAqB,GAAKF,IAAF,IAAyB,MAAM;AAC5D,QAAK,CAAER,SAAP,EAAmB;AAClB;AACA;;AACD,QAAKQ,IAAI,KAAK,UAAd,EAA2B;AAC1BR,MAAAA,SAAS,CA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MAAM,CAACW,IADX,CADjC;AAIA,UAAMuB,YAAY,GACjB5B,IAAI,KAAK,UAAT,GACGL,aAAa,CAACQ,GADjB,GAEGR,aAAa,CAACU,IAHlB;AAIA,WACC,cAAC,WAAD,eACMP,KADN;AAEC,MAAA,OAAO,EAAGwB,KAAK,KAAKtB,IAFrB;AAGC,MAAA,MAAM,EAAGuB,IAAI,KAAKvB,IAHnB;AAIC,MAAA,MAAM,EAAGwB,IAAI,KAAKxB,IAJnB;AAKC,MAAA,KAAK,EAAG,CACP0B,cADO,EAEPE,YAFO,aAEPA,YAFO,cAEPA,YAFO,GAESD,UAFT,EAGNE,IAHM,CAGA,EAHA,CALT;AASC,MAAA,QAAQ,EAAGrB,oBAAoB,CAAER,IAAF,CAThC;AAUC,MAAA,YAAY,EAAGgB,wBAAwB,CAAEhB,IAAF,CAVxC;AAWC,MAAA,OAAO,EAAGD,mBAAmB,CAAEC,IAAF,CAX9B;AAYC,MAAA,SAAS,EAAGE,qBAAqB,CAAEF,IAAF,CAZlC;AAaC,MAAA,UAAU,EAAGO,sBAAsB,CAAEP,IAAF,CAbpC;AAcC,MAAA,KAAK,EAAGd,MAAM,CAAEc,IAAF,CAdf;AAeC,MAAA,GAAG,EAAGA;AAfP,OADD;AAmBA,GA5BC,CALH,CADD;AAqCA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control/utils';\nimport UnitControl from './unit-control';\nimport { LABELS } from './utils';\nimport { Layout } from './styles/box-control-styles';\nimport type { BoxControlInputControlProps } from './types';\n\nconst groupedSides = [ 'vertical', 'horizontal' ] as const;\ntype GroupedSide = ( typeof groupedSides )[ number ];\n\nexport default function AxialInputControls( {\n\tonChange,\n\tonFocus,\n\tonHoverOn,\n\tonHoverOff,\n\tvalues,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tsides,\n\t...props\n}: BoxControlInputControlProps ) {\n\tconst createHandleOnFocus =\n\t\t( side: GroupedSide ) =>\n\t\t( event: React.FocusEvent< HTMLInputElement > ) => {\n\t\t\tif ( ! onFocus ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tonFocus( event, { side } );\n\t\t};\n\n\tconst createHandleOnHoverOn = ( side: GroupedSide ) => () => {\n\t\tif ( ! onHoverOn ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( side === 'vertical' ) {\n\t\t\tonHoverOn( {\n\t\t\t\ttop: true,\n\t\t\t\tbottom: true,\n\t\t\t} );\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tonHoverOn( {\n\t\t\t\tleft: true,\n\t\t\t\tright: true,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst createHandleOnHoverOff = ( side: GroupedSide ) => () => {\n\t\tif ( ! onHoverOff ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( side === 'vertical' ) {\n\t\t\tonHoverOff( {\n\t\t\t\ttop: false,\n\t\t\t\tbottom: false,\n\t\t\t} );\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tonHoverOff( {\n\t\t\t\tleft: false,\n\t\t\t\tright: false,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst createHandleOnChange = ( side: GroupedSide ) => ( next?: string ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\t\tconst nextValues = { ...values };\n\t\tconst isNumeric = next !== undefined && ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\n\t\tif ( side === 'vertical' ) {\n\t\t\tnextValues.top = nextValue;\n\t\t\tnextValues.bottom = nextValue;\n\t\t}\n\n\t\tif ( side === 'horizontal' ) {\n\t\t\tnextValues.left = nextValue;\n\t\t\tnextValues.right = nextValue;\n\t\t}\n\n\t\tonChange( nextValues );\n\t};\n\n\tconst createHandleOnUnitChange =\n\t\t( side: GroupedSide ) => ( next?: string ) => {\n\t\t\tconst newUnits = { ...selectedUnits };\n\n\t\t\tif ( side === 'vertical' ) {\n\t\t\t\tnewUnits.top = next;\n\t\t\t\tnewUnits.bottom = next;\n\t\t\t}\n\n\t\t\tif ( side === 'horizontal' ) {\n\t\t\t\tnewUnits.left = next;\n\t\t\t\tnewUnits.right = next;\n\t\t\t}\n\n\t\t\tsetSelectedUnits( newUnits );\n\t\t};\n\n\t// Filter sides if custom configuration provided, maintaining default order.\n\tconst filteredSides = sides?.length\n\t\t? groupedSides.filter( ( side ) => sides.includes( side ) )\n\t\t: groupedSides;\n\n\tconst first = filteredSides[ 0 ];\n\tconst last = filteredSides[ filteredSides.length - 1 ];\n\tconst only = first === last && first;\n\n\treturn (\n\t\t<Layout\n\t\t\tgap={ 0 }\n\t\t\talign=\"top\"\n\t\t\tclassName=\"component-box-control__vertical-horizontal-input-controls\"\n\t\t>\n\t\t\t{ filteredSides.map( ( side ) => {\n\t\t\t\tconst [ parsedQuantity, parsedUnit ] =\n\t\t\t\t\tparseQuantityAndUnitFromRawValue(\n\t\t\t\t\t\tside === 'vertical' ? values.top : values.left\n\t\t\t\t\t);\n\t\t\t\tconst selectedUnit =\n\t\t\t\t\tside === 'vertical'\n\t\t\t\t\t\t? selectedUnits.top\n\t\t\t\t\t\t: selectedUnits.left;\n\t\t\t\treturn (\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\tisFirst={ first === side }\n\t\t\t\t\t\tisLast={ last === side }\n\t\t\t\t\t\tisOnly={ only === side }\n\t\t\t\t\t\tvalue={ [\n\t\t\t\t\t\t\tparsedQuantity,\n\t\t\t\t\t\t\tselectedUnit ?? parsedUnit,\n\t\t\t\t\t\t].join( '' ) }\n\t\t\t\t\t\tonChange={ createHandleOnChange( side ) }\n\t\t\t\t\t\tonUnitChange={ createHandleOnUnitChange( side ) }\n\t\t\t\t\t\tonFocus={ createHandleOnFocus( side ) }\n\t\t\t\t\t\tonHoverOn={ createHandleOnHoverOn( side ) }\n\t\t\t\t\t\tonHoverOff={ createHandleOnHoverOff( side ) }\n\t\t\t\t\t\tlabel={ LABELS[ side ] }\n\t\t\t\t\t\tkey={ side }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Layout>\n\t);\n}\n"]}
|
|
@@ -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
|
|
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,QAKF;AAAA,MALI;AAC3BC,IAAAA,SAD2B;AAE3BC,IAAAA,KAF2B;AAG3BC,IAAAA,QAH2B;AAI3BC,IAAAA;AAJ2B,GAKJ;AACvB,QAAMC,KAAK,GAAG;AAAEH,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAd;;AACA,UAASH,SAAT;AACC,SAAK,KAAL;AACC,aAAO,cAAC,QAAD,EAAeI,KAAf,CAAP;;AACD,SAAK,KAAL;AACC,aAAO,cAAC,QAAD,EAAeA,KAAf,CAAP;;AACD;AACA,SAAK,KAAL;AACC,aAAO,cAAC,QAAD,EAAeA,KAAf,CAAP;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"]}
|
|
@@ -35,7 +35,7 @@ const options = [{
|
|
|
35
35
|
value: 'hex'
|
|
36
36
|
}];
|
|
37
37
|
|
|
38
|
-
const
|
|
38
|
+
const UnconnectedColorPicker = (props, forwardedRef) => {
|
|
39
39
|
const {
|
|
40
40
|
enableAlpha = false,
|
|
41
41
|
color: colorProp,
|
|
@@ -87,6 +87,6 @@ const ColorPicker = (props, forwardedRef) => {
|
|
|
87
87
|
}))));
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
const
|
|
91
|
-
export default
|
|
90
|
+
export const ColorPicker = contextConnect(UnconnectedColorPicker, 'ColorPicker');
|
|
91
|
+
export default ColorPicker;
|
|
92
92
|
//# sourceMappingURL=component.js.map
|
|
@@ -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","
|
|
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,Q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AA,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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-picker/hex-input.tsx"],"names":["colord","__","InputControl","Text","Spacer","space","COLORS","HexInput","color","onChange","enableAlpha","handleChange","nextValue","hexValue","startsWith","stateReducer","state","action","nativeEvent","payload","event","inputType","value","slice","toUpperCase","ui","theme","toHex"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-picker/hex-input.tsx"],"names":["colord","__","InputControl","Text","Spacer","space","COLORS","HexInput","color","onChange","enableAlpha","handleChange","nextValue","hexValue","startsWith","stateReducer","state","action","nativeEvent","payload","event","inputType","value","slice","toUpperCase","ui","theme","toHex"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,SAASC,MAAT,QAAuB,wBAAvB;AAIA,OAAO,MAAMC,QAAQ,GAAG,QAAuD;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAqD;;AAC9E,QAAMC,YAAY,GAAKC,SAAF,IAAqC;AACzD,QAAK,CAAEA,SAAP,EAAmB;AACnB,UAAMC,QAAQ,GAAGD,SAAS,CAACE,UAAV,CAAsB,GAAtB,IACdF,SADc,GAEd,MAAMA,SAFT;AAIAH,IAAAA,QAAQ,CAAET,MAAM,CAAEa,QAAF,CAAR,CAAR;AACA,GAPD;;AASA,QAAME,YAA0B,GAAG,CAAEC,KAAF,EAASC,MAAT,KAAqB;AAAA;;AACvD,UAAMC,WAAW,sBAAGD,MAAM,CAACE,OAAV,6EAAG,gBAAgBC,KAAnB,0DAAG,sBAAuBF,WAA3C;;AAEA,QAAK,uBAAsBA,WAAtB,aAAsBA,WAAtB,uBAAsBA,WAAW,CAAEG,SAAnC,CAAL,EAAoD;AACnD,aAAO,EAAE,GAAGL;AAAL,OAAP;AACA;;AAED,UAAMM,KAAK,GAAG,gBAAAN,KAAK,CAACM,KAAN,sDAAaR,UAAb,CAAyB,GAAzB,IACXE,KAAK,CAACM,KAAN,CAAYC,KAAZ,CAAmB,CAAnB,EAAuBC,WAAvB,EADW,oBAEXR,KAAK,CAACM,KAFK,kDAEX,cAAaE,WAAb,EAFH;AAIA,WAAO,EAAE,GAAGR,KAAL;AAAYM,MAAAA;AAAZ,KAAP;AACA,GAZD;;AAcA,SACC,cAAC,YAAD;AACC,IAAA,MAAM,EACL,cAAC,MAAD;AACC,MAAA,EAAE,EAAGnB,IADN;AAEC,MAAA,UAAU,EAAGE,KAAK,CAAE,CAAF,CAFnB;AAGC,MAAA,KAAK,EAAGC,MAAM,CAACmB,EAAP,CAAUC,KAHnB;AAIC,MAAA,UAAU,EAAG;AAJd,WAFF;AAWC,IAAA,KAAK,EAAGlB,KAAK,CAACmB,KAAN,GAAcJ,KAAd,CAAqB,CAArB,EAAyBC,WAAzB,EAXT;AAYC,IAAA,QAAQ,EAAGb,YAZZ;AAaC,IAAA,SAAS,EAAGD,WAAW,GAAG,CAAH,GAAO,CAb/B;AAcC,IAAA,KAAK,EAAGT,EAAE,CAAE,WAAF,CAdX;AAeC,IAAA,mBAAmB,MAfpB;AAgBC,IAAA,IAAI,EAAC,kBAhBN;AAiBC,IAAA,sBAAsB,EAAGc,YAjB1B;AAkBC,IAAA,oBAAoB,EAAC;AAlBtB,IADD;AAsBA,CA9CM","sourcesContent":["/**\n * External dependencies\n */\nimport { colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { InputControl } from '../input-control';\nimport { Text } from '../text';\nimport { Spacer } from '../spacer';\nimport { space } from '../ui/utils/space';\nimport { COLORS } from '../utils/colors-values';\nimport type { StateReducer } from '../input-control/reducer/state';\nimport type { HexInputProps } from './types';\n\nexport const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {\n\tconst handleChange = ( nextValue: string | undefined ) => {\n\t\tif ( ! nextValue ) return;\n\t\tconst hexValue = nextValue.startsWith( '#' )\n\t\t\t? nextValue\n\t\t\t: '#' + nextValue;\n\n\t\tonChange( colord( hexValue ) );\n\t};\n\n\tconst stateReducer: StateReducer = ( state, action ) => {\n\t\tconst nativeEvent = action.payload?.event?.nativeEvent as InputEvent;\n\n\t\tif ( 'insertFromPaste' !== nativeEvent?.inputType ) {\n\t\t\treturn { ...state };\n\t\t}\n\n\t\tconst value = state.value?.startsWith( '#' )\n\t\t\t? state.value.slice( 1 ).toUpperCase()\n\t\t\t: state.value?.toUpperCase();\n\n\t\treturn { ...state, value };\n\t};\n\n\treturn (\n\t\t<InputControl\n\t\t\tprefix={\n\t\t\t\t<Spacer\n\t\t\t\t\tas={ Text }\n\t\t\t\t\tmarginLeft={ space( 4 ) }\n\t\t\t\t\tcolor={ COLORS.ui.theme }\n\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t>\n\t\t\t\t\t#\n\t\t\t\t</Spacer>\n\t\t\t}\n\t\t\tvalue={ color.toHex().slice( 1 ).toUpperCase() }\n\t\t\tonChange={ handleChange }\n\t\t\tmaxLength={ enableAlpha ? 9 : 7 }\n\t\t\tlabel={ __( 'Hex color' ) }\n\t\t\thideLabelFromVision\n\t\t\tsize=\"__unstable-large\"\n\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\t__unstableInputWidth=\"9em\"\n\t\t/>\n\t);\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-picker/hsl-input.tsx"],"names":["colord","InputWithSlider","HslInput","color","onChange","enableAlpha","h","s","l","a","toHsl","nextH","nextS","nextL","Math","trunc","nextA"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-picker/hsl-input.tsx"],"names":["colord","InputWithSlider","HslInput","color","onChange","enableAlpha","h","s","l","a","toHsl","nextH","nextS","nextL","Math","trunc","nextA"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,qBAAhC;AAGA,OAAO,MAAMC,QAAQ,GAAG,QAAuD;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAqD;AAC9E,QAAM;AAAEC,IAAAA,CAAF;AAAKC,IAAAA,CAAL;AAAQC,IAAAA,CAAR;AAAWC,IAAAA;AAAX,MAAiBN,KAAK,CAACO,KAAN,EAAvB;AAEA,SACC,8BACC,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,KAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGJ,CALT;AAMC,IAAA,QAAQ,EAAKK,KAAF,IAAqB;AAC/BP,MAAAA,QAAQ,CAAEJ,MAAM,CAAE;AAAEM,QAAAA,CAAC,EAAEK,KAAL;AAAYJ,QAAAA,CAAZ;AAAeC,QAAAA,CAAf;AAAkBC,QAAAA;AAAlB,OAAF,CAAR,CAAR;AACA;AARF,IADD,EAWC,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,YAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGF,CALT;AAMC,IAAA,QAAQ,EAAKK,KAAF,IAAqB;AAC/BR,MAAAA,QAAQ,CACPJ,MAAM,CAAE;AACPM,QAAAA,CADO;AAEPC,QAAAA,CAAC,EAAEK,KAFI;AAGPJ,QAAAA,CAHO;AAIPC,QAAAA;AAJO,OAAF,CADC,CAAR;AAQA;AAfF,IAXD,EA4BC,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,WAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGD,CALT;AAMC,IAAA,QAAQ,EAAKK,KAAF,IAAqB;AAC/BT,MAAAA,QAAQ,CACPJ,MAAM,CAAE;AACPM,QAAAA,CADO;AAEPC,QAAAA,CAFO;AAGPC,QAAAA,CAAC,EAAEK,KAHI;AAIPJ,QAAAA;AAJO,OAAF,CADC,CAAR;AAQA;AAfF,IA5BD,EA6CGJ,WAAW,IACZ,cAAC,eAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,GAAG,EAAG,GAFP;AAGC,IAAA,KAAK,EAAC,OAHP;AAIC,IAAA,YAAY,EAAC,GAJd;AAKC,IAAA,KAAK,EAAGS,IAAI,CAACC,KAAL,CAAY,MAAMN,CAAlB,CALT;AAMC,IAAA,QAAQ,EAAKO,KAAF,IAAqB;AAC/BZ,MAAAA,QAAQ,CACPJ,MAAM,CAAE;AACPM,QAAAA,CADO;AAEPC,QAAAA,CAFO;AAGPC,QAAAA,CAHO;AAIPC,QAAAA,CAAC,EAAEO,KAAK,GAAG;AAJJ,OAAF,CADC,CAAR;AAQA;AAfF,IA9CF,CADD;AAmEA,CAtEM","sourcesContent":["/**\n * External dependencies\n */\nimport { colord } from 'colord';\n\n/**\n * Internal dependencies\n */\nimport { InputWithSlider } from './input-with-slider';\nimport type { HslInputProps } from './types';\n\nexport const HslInput = ( { color, onChange, enableAlpha }: HslInputProps ) => {\n\tconst { h, s, l, a } = color.toHsl();\n\n\treturn (\n\t\t<>\n\t\t\t<InputWithSlider\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ 359 }\n\t\t\t\tlabel=\"Hue\"\n\t\t\t\tabbreviation=\"H\"\n\t\t\t\tvalue={ h }\n\t\t\t\tonChange={ ( nextH: number ) => {\n\t\t\t\t\tonChange( colord( { h: nextH, s, l, a } ) );\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<InputWithSlider\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ 100 }\n\t\t\t\tlabel=\"Saturation\"\n\t\t\t\tabbreviation=\"S\"\n\t\t\t\tvalue={ s }\n\t\t\t\tonChange={ ( nextS: number ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tcolord( {\n\t\t\t\t\t\t\th,\n\t\t\t\t\t\t\ts: nextS,\n\t\t\t\t\t\t\tl,\n\t\t\t\t\t\t\ta,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t<InputWithSlider\n\t\t\t\tmin={ 0 }\n\t\t\t\tmax={ 100 }\n\t\t\t\tlabel=\"Lightness\"\n\t\t\t\tabbreviation=\"L\"\n\t\t\t\tvalue={ l }\n\t\t\t\tonChange={ ( nextL: number ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tcolord( {\n\t\t\t\t\t\t\th,\n\t\t\t\t\t\t\ts,\n\t\t\t\t\t\t\tl: nextL,\n\t\t\t\t\t\t\ta,\n\t\t\t\t\t\t} )\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ enableAlpha && (\n\t\t\t\t<InputWithSlider\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ 100 }\n\t\t\t\t\tlabel=\"Alpha\"\n\t\t\t\t\tabbreviation=\"A\"\n\t\t\t\t\tvalue={ Math.trunc( 100 * a ) }\n\t\t\t\t\tonChange={ ( nextA: number ) => {\n\t\t\t\t\t\tonChange(\n\t\t\t\t\t\t\tcolord( {\n\t\t\t\t\t\t\t\th,\n\t\t\t\t\t\t\t\ts,\n\t\t\t\t\t\t\t\tl,\n\t\t\t\t\t\t\t\ta: nextA / 100,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-picker/input-with-slider.tsx"],"names":["HStack","Text","Spacer","space","RangeControl","NumberControlWrapper","COLORS","InputWithSlider","min","max","label","abbreviation","onChange","value","onNumberControlChange","newValue","parseInt","ui","theme"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,YAAvB;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,SAASC,YAAT,EAAuBC,oBAAvB,QAAmD,UAAnD;AACA,SAASC,MAAT,QAAuB,wBAAvB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-picker/input-with-slider.tsx"],"names":["HStack","Text","Spacer","space","RangeControl","NumberControlWrapper","COLORS","InputWithSlider","min","max","label","abbreviation","onChange","value","onNumberControlChange","newValue","parseInt","ui","theme"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,YAAvB;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,SAASC,YAAT,EAAuBC,oBAAvB,QAAmD,UAAnD;AACA,SAASC,MAAT,QAAuB,wBAAvB;AAGA,OAAO,MAAMC,eAAe,GAAG,QAOF;AAAA,MAPI;AAChCC,IAAAA,GADgC;AAEhCC,IAAAA,GAFgC;AAGhCC,IAAAA,KAHgC;AAIhCC,IAAAA,YAJgC;AAKhCC,IAAAA,QALgC;AAMhCC,IAAAA;AANgC,GAOJ;;AAC5B,QAAMC,qBAAqB,GAAKC,QAAF,IAAkC;AAC/D,QAAK,CAAEA,QAAP,EAAkB;AACjBH,MAAAA,QAAQ,CAAE,CAAF,CAAR;AACA;AACA;;AACD,QAAK,OAAOG,QAAP,KAAoB,QAAzB,EAAoC;AACnCH,MAAAA,QAAQ,CAAEI,QAAQ,CAAED,QAAF,EAAY,EAAZ,CAAV,CAAR;AACA;AACA;;AACDH,IAAAA,QAAQ,CAAEG,QAAF,CAAR;AACA,GAVD;;AAYA,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,oBAAD;AACC,IAAA,GAAG,EAAGP,GADP;AAEC,IAAA,GAAG,EAAGC,GAFP;AAGC,IAAA,KAAK,EAAGC,KAHT;AAIC,IAAA,mBAAmB,MAJpB;AAKC,IAAA,KAAK,EAAGG,KALT;AAMC,IAAA,QAAQ,EAAGC,qBANZ;AAOC,IAAA,MAAM,EACL,cAAC,MAAD;AACC,MAAA,EAAE,EAAGb,IADN;AAEC,MAAA,WAAW,EAAGE,KAAK,CAAE,CAAF,CAFpB;AAGC,MAAA,KAAK,EAAGG,MAAM,CAACW,EAAP,CAAUC,KAHnB;AAIC,MAAA,UAAU,EAAG;AAJd,OAMGP,YANH,CARF;AAiBC,IAAA,YAAY,EAAC,MAjBd;AAkBC,IAAA,IAAI,EAAC;AAlBN,IADD,EAqBC,cAAC,YAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EAAGD,KAFT;AAGC,IAAA,mBAAmB,MAHpB;AAIC,IAAA,GAAG,EAAGF,GAJP;AAKC,IAAA,GAAG,EAAGC,GALP;AAMC,IAAA,KAAK,EAAGI,KANT,CAOC;AACA;AARD;AASC,IAAA,QAAQ,EAAGD,QATZ;AAUC,IAAA,cAAc,EAAG;AAVlB,IArBD,CADD;AAoCA,CAxDM","sourcesContent":["/**\n * Internal dependencies\n */\nimport { HStack } from '../h-stack';\nimport { Text } from '../text';\nimport { Spacer } from '../spacer';\nimport { space } from '../ui/utils/space';\nimport { RangeControl, NumberControlWrapper } from './styles';\nimport { COLORS } from '../utils/colors-values';\nimport type { InputWithSliderProps } from './types';\n\nexport const InputWithSlider = ( {\n\tmin,\n\tmax,\n\tlabel,\n\tabbreviation,\n\tonChange,\n\tvalue,\n}: InputWithSliderProps ) => {\n\tconst onNumberControlChange = ( newValue?: number | string ) => {\n\t\tif ( ! newValue ) {\n\t\t\tonChange( 0 );\n\t\t\treturn;\n\t\t}\n\t\tif ( typeof newValue === 'string' ) {\n\t\t\tonChange( parseInt( newValue, 10 ) );\n\t\t\treturn;\n\t\t}\n\t\tonChange( newValue );\n\t};\n\n\treturn (\n\t\t<HStack spacing={ 4 }>\n\t\t\t<NumberControlWrapper\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onNumberControlChange }\n\t\t\t\tprefix={\n\t\t\t\t\t<Spacer\n\t\t\t\t\t\tas={ Text }\n\t\t\t\t\t\tpaddingLeft={ space( 4 ) }\n\t\t\t\t\t\tcolor={ COLORS.ui.theme }\n\t\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ abbreviation }\n\t\t\t\t\t</Spacer>\n\t\t\t\t}\n\t\t\t\tspinControls=\"none\"\n\t\t\t\tsize=\"__unstable-large\"\n\t\t\t/>\n\t\t\t<RangeControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tvalue={ value }\n\t\t\t\t// @ts-expect-error\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/40535#issuecomment-1172418185\n\t\t\t\tonChange={ onChange }\n\t\t\t\twithInputField={ false }\n\t\t\t/>\n\t\t</HStack>\n\t);\n};\n"]}
|