@wordpress/components 29.0.1-next.a9f418477.0 → 29.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -10
- package/LICENSE.md +1 -1
- package/build/alignment-matrix-control/icon.js +1 -0
- package/build/alignment-matrix-control/icon.js.map +1 -1
- package/build/alignment-matrix-control/index.js +1 -0
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +1 -0
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.native.js +1 -0
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/autocomplete/get-default-use-items.js +1 -0
- package/build/autocomplete/get-default-use-items.js.map +1 -1
- package/build/autocomplete/index.js +1 -0
- package/build/autocomplete/index.js.map +1 -1
- package/build/badge/index.js +64 -0
- package/build/badge/index.js.map +1 -0
- package/build/badge/types.js +6 -0
- package/build/badge/types.js.map +1 -0
- package/build/border-box-control/utils.js +1 -0
- package/build/border-box-control/utils.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +1 -0
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/border-control-style-picker/component.js +1 -0
- package/build/border-control/border-control-style-picker/component.js.map +1 -1
- package/build/box-control/index.js +18 -14
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-control.js +222 -0
- package/build/box-control/input-control.js.map +1 -0
- package/build/box-control/types.js.map +1 -1
- package/build/box-control/utils.js +101 -48
- package/build/box-control/utils.js.map +1 -1
- package/build/button/index.native.js +1 -0
- package/build/button/index.native.js.map +1 -1
- package/build/button/types.js.map +1 -1
- package/build/button-group/index.js +10 -0
- package/build/button-group/index.js.map +1 -1
- package/build/button-group/types.js.map +1 -1
- package/build/color-indicator/index.native.js +1 -0
- package/build/color-indicator/index.native.js.map +1 -1
- package/build/color-palette/index.js +1 -0
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +1 -0
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-palette/utils.js +1 -0
- package/build/color-palette/utils.js.map +1 -1
- package/build/combobox-control/index.js +1 -0
- package/build/combobox-control/index.js.map +1 -1
- package/build/composite/legacy/index.js +1 -0
- package/build/composite/legacy/index.js.map +1 -1
- package/build/context/context-connect.js +1 -0
- package/build/context/context-connect.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +1 -0
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/index.js +1 -0
- package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js +1 -0
- package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build/custom-gradient-picker/index.js +1 -0
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js +1 -0
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/custom-gradient-picker/utils.js +1 -0
- package/build/custom-gradient-picker/utils.js.map +1 -1
- package/build/custom-select-control/index.js +2 -3
- package/build/custom-select-control/index.js.map +1 -1
- package/build/custom-select-control-v2/custom-select.js +2 -3
- package/build/custom-select-control-v2/custom-select.js.map +1 -1
- package/build/dashicon/index.js +1 -0
- package/build/dashicon/index.js.map +1 -1
- package/build/date-time/date/index.js +2 -0
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/date/use-lilius/index.js +1 -0
- package/build/date-time/date/use-lilius/index.js.map +1 -1
- package/build/date-time/time/index.js +1 -0
- package/build/date-time/time/index.js.map +1 -1
- package/build/dimension-control/index.js +2 -0
- package/build/dimension-control/index.js.map +1 -1
- package/build/dimension-control/sizes.js +1 -0
- package/build/dimension-control/sizes.js.map +1 -1
- package/build/draggable/index.js +1 -0
- package/build/draggable/index.js.map +1 -1
- package/build/draggable/index.native.js +1 -0
- package/build/draggable/index.native.js.map +1 -1
- package/build/dropdown-menu/index.js +1 -0
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu/index.native.js +1 -0
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/duotone-picker/color-list-picker/index.js +1 -0
- package/build/duotone-picker/color-list-picker/index.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +1 -0
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/duotone-picker/utils.js +1 -0
- package/build/duotone-picker/utils.js.map +1 -1
- package/build/external-link/index.js +1 -0
- package/build/external-link/index.js.map +1 -1
- package/build/font-size-picker/font-size-picker-select.js +1 -0
- package/build/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
- package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build/font-size-picker/index.js +1 -0
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +1 -0
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/font-size-picker/styles.js +9 -9
- package/build/font-size-picker/styles.js.map +1 -1
- package/build/font-size-picker/utils.js +1 -0
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-token-field/index.js +1 -0
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +1 -0
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/gradient-picker/index.js +1 -0
- package/build/gradient-picker/index.js.map +1 -1
- package/build/guide/index.js +1 -0
- package/build/guide/index.js.map +1 -1
- package/build/guide/page-control.js +1 -0
- package/build/guide/page-control.js.map +1 -1
- package/build/h-stack/hook.js +1 -0
- package/build/h-stack/hook.js.map +1 -1
- package/build/heading/hook.js +1 -1
- package/build/heading/hook.js.map +1 -1
- package/build/higher-order/navigate-regions/index.js +1 -0
- package/build/higher-order/navigate-regions/index.js.map +1 -1
- package/build/higher-order/with-fallback-styles/index.js +1 -0
- package/build/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build/higher-order/with-filters/index.js +1 -0
- package/build/higher-order/with-filters/index.js.map +1 -1
- package/build/higher-order/with-notices/index.js +1 -0
- package/build/higher-order/with-notices/index.js.map +1 -1
- package/build/input-control/index.js +9 -0
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/types.js.map +1 -1
- package/build/keyboard-shortcuts/index.js +1 -0
- package/build/keyboard-shortcuts/index.js.map +1 -1
- package/build/menu/checkbox-item.js +2 -0
- package/build/menu/checkbox-item.js.map +1 -1
- package/build/menu/index.js +25 -94
- package/build/menu/index.js.map +1 -1
- package/build/menu/item.js +10 -1
- package/build/menu/item.js.map +1 -1
- package/build/menu/popover.js +89 -0
- package/build/menu/popover.js.map +1 -0
- package/build/menu/radio-item.js +2 -0
- package/build/menu/radio-item.js.map +1 -1
- package/build/menu/styles.js +16 -16
- package/build/menu/styles.js.map +1 -1
- package/build/menu/submenu-trigger-item.js +58 -0
- package/build/menu/submenu-trigger-item.js.map +1 -0
- package/build/menu/trigger-button.js +45 -0
- package/build/menu/trigger-button.js.map +1 -0
- package/build/menu/types.js.map +1 -1
- package/build/menu-items-choice/index.js +1 -0
- package/build/menu-items-choice/index.js.map +1 -1
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
- package/build/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
- package/build/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build/mobile/bottom-sheet/picker-cell.native.js +1 -0
- package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js +1 -0
- package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build/mobile/color-settings/palette.screen.native.js +1 -0
- package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js +1 -0
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/media-edit/index.native.js +1 -0
- package/build/mobile/media-edit/index.native.js.map +1 -1
- package/build/mobile/picker/index.android.js +1 -0
- package/build/mobile/picker/index.android.js.map +1 -1
- package/build/mobile/picker/index.ios.js +1 -0
- package/build/mobile/picker/index.ios.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +1 -0
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js +1 -0
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build/navigable-container/container.js +1 -0
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigation/back-button/index.js +1 -0
- package/build/navigation/back-button/index.js.map +1 -1
- package/build/navigation/group/index.js +1 -0
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/index.js +6 -0
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/item/index.js +1 -0
- package/build/navigation/item/index.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +1 -0
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/search-no-results-found.js +1 -0
- package/build/navigation/menu/search-no-results-found.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js +12 -12
- package/build/navigation/styles/navigation-styles.js.map +1 -1
- package/build/navigator/navigator/component.js +1 -0
- package/build/navigator/navigator/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +1 -0
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/utils/router.js +1 -0
- package/build/navigator/utils/router.js.map +1 -1
- package/build/notice/index.js +1 -0
- package/build/notice/index.js.map +1 -1
- package/build/notice/list.js +1 -0
- package/build/notice/list.js.map +1 -1
- package/build/notice/list.native.js +1 -0
- package/build/notice/list.native.js.map +1 -1
- package/build/number-control/index.js +1 -0
- package/build/number-control/index.js.map +1 -1
- package/build/palette-edit/index.js +2 -0
- package/build/palette-edit/index.js.map +1 -1
- package/build/panel/actions.native.js +1 -0
- package/build/panel/actions.native.js.map +1 -1
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build/query-controls/index.js +1 -0
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/terms.js +1 -0
- package/build/query-controls/terms.js.map +1 -1
- package/build/radio-control/index.js +1 -0
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-control/index.native.js +1 -0
- package/build/radio-control/index.native.js.map +1 -1
- package/build/radio-group/index.js +6 -0
- package/build/radio-group/index.js.map +1 -1
- package/build/radio-group/radio.js +2 -3
- package/build/radio-group/radio.js.map +1 -1
- package/build/range-control/rail.js +1 -0
- package/build/range-control/rail.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +28 -28
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/resizable-box/index.js +1 -0
- package/build/resizable-box/index.js.map +1 -1
- package/build/sandbox/index.js +1 -0
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/index.native.js +1 -0
- package/build/sandbox/index.native.js.map +1 -1
- package/build/search-control/index.native.js +1 -0
- package/build/search-control/index.native.js.map +1 -1
- package/build/select-control/index.js +10 -0
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/types.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/context.js +4 -3
- package/build/slot-fill/context.js.map +1 -1
- package/build/slot-fill/fill.js +10 -15
- package/build/slot-fill/fill.js.map +1 -1
- package/build/slot-fill/provider.js +42 -55
- package/build/slot-fill/provider.js.map +1 -1
- package/build/slot-fill/slot.js +32 -23
- package/build/slot-fill/slot.js.map +1 -1
- package/build/slot-fill/types.js.map +1 -1
- package/build/snackbar/index.js +1 -0
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +1 -0
- package/build/snackbar/list.js.map +1 -1
- package/build/tab-panel/index.js +3 -3
- package/build/tab-panel/index.js.map +1 -1
- package/build/tabs/index.js +22 -4
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/types.js.map +1 -1
- package/build/text/hook.js +6 -6
- package/build/text/hook.js.map +1 -1
- package/build/text/styles.js +7 -7
- package/build/text/styles.js.map +1 -1
- package/build/text/utils.js +1 -0
- package/build/text/utils.js.map +1 -1
- package/build/theme/color-algorithms.js +1 -0
- package/build/theme/color-algorithms.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js +2 -3
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/toolbar/toolbar-group/index.js +1 -0
- package/build/toolbar/toolbar-group/index.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +1 -0
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +1 -0
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tooltip/index.js +2 -3
- package/build/tooltip/index.js.map +1 -1
- package/build/tree-grid/index.js +1 -0
- package/build/tree-grid/index.js.map +1 -1
- package/build/tree-select/index.js +11 -2
- package/build/tree-select/index.js.map +1 -1
- package/build/tree-select/types.js.map +1 -1
- package/build/unit-control/index.js +1 -0
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/index.native.js +1 -0
- package/build/unit-control/index.native.js.map +1 -1
- package/build/unit-control/unit-select-control.js +1 -0
- package/build/unit-control/unit-select-control.js.map +1 -1
- package/build/unit-control/utils.js +1 -0
- package/build/unit-control/utils.js.map +1 -1
- package/build/utils/colors-values.js +3 -0
- package/build/utils/colors-values.js.map +1 -1
- package/build/utils/config-values.js +0 -1
- package/build/utils/config-values.js.map +1 -1
- package/build/utils/get-valid-children.js +1 -0
- package/build/utils/get-valid-children.js.map +1 -1
- package/build/utils/hooks/use-animated-offset-rect.js +1 -0
- package/build/utils/hooks/use-animated-offset-rect.js.map +1 -1
- package/build/utils/hooks/use-cx.js +1 -0
- package/build/utils/hooks/use-cx.js.map +1 -1
- package/build/utils/math.js +1 -0
- package/build/utils/math.js.map +1 -1
- package/build/utils/rtl.js +1 -0
- package/build/utils/rtl.js.map +1 -1
- package/build/utils/values.js +1 -0
- package/build/utils/values.js.map +1 -1
- package/build/z-stack/component.js +1 -0
- package/build/z-stack/component.js.map +1 -1
- package/build-module/alignment-matrix-control/icon.js +1 -0
- package/build-module/alignment-matrix-control/icon.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +1 -0
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +1 -0
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/get-default-use-items.js +1 -0
- package/build-module/autocomplete/get-default-use-items.js.map +1 -1
- package/build-module/autocomplete/index.js +1 -0
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/badge/index.js +57 -0
- package/build-module/badge/index.js.map +1 -0
- package/build-module/badge/types.js +2 -0
- package/build-module/badge/types.js.map +1 -0
- package/build-module/border-box-control/utils.js +1 -0
- package/build-module/border-box-control/utils.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +1 -0
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/border-control-style-picker/component.js +1 -0
- package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
- package/build-module/box-control/index.js +20 -16
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-control.js +214 -0
- package/build-module/box-control/input-control.js.map +1 -0
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/box-control/utils.js +95 -46
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/button/index.native.js +1 -0
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/button/types.js.map +1 -1
- package/build-module/button-group/index.js +10 -0
- package/build-module/button-group/index.js.map +1 -1
- package/build-module/button-group/types.js.map +1 -1
- package/build-module/color-indicator/index.native.js +1 -0
- package/build-module/color-indicator/index.native.js.map +1 -1
- package/build-module/color-palette/index.js +1 -0
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +1 -0
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-palette/utils.js +1 -0
- package/build-module/color-palette/utils.js.map +1 -1
- package/build-module/combobox-control/index.js +1 -0
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/composite/legacy/index.js +1 -0
- package/build-module/composite/legacy/index.js.map +1 -1
- package/build-module/context/context-connect.js +1 -0
- package/build-module/context/context-connect.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +1 -0
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js +1 -0
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js +1 -0
- package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +1 -0
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js +1 -0
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/custom-gradient-picker/utils.js +1 -0
- package/build-module/custom-gradient-picker/utils.js.map +1 -1
- package/build-module/custom-select-control/index.js +2 -3
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/custom-select-control-v2/custom-select.js +1 -2
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
- package/build-module/dashicon/index.js +1 -0
- package/build-module/dashicon/index.js.map +1 -1
- package/build-module/date-time/date/index.js +2 -0
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/date/use-lilius/index.js +1 -0
- package/build-module/date-time/date/use-lilius/index.js.map +1 -1
- package/build-module/date-time/time/index.js +1 -0
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/dimension-control/index.js +2 -0
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/dimension-control/sizes.js +1 -0
- package/build-module/dimension-control/sizes.js.map +1 -1
- package/build-module/draggable/index.js +1 -0
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/draggable/index.native.js +1 -0
- package/build-module/draggable/index.native.js.map +1 -1
- package/build-module/dropdown-menu/index.js +1 -0
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +1 -0
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/duotone-picker/color-list-picker/index.js +1 -0
- package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +1 -0
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/duotone-picker/utils.js +1 -0
- package/build-module/duotone-picker/utils.js.map +1 -1
- package/build-module/external-link/index.js +1 -0
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-select.js +1 -0
- package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
- package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build-module/font-size-picker/index.js +1 -0
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +1 -0
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/font-size-picker/styles.js +9 -9
- package/build-module/font-size-picker/styles.js.map +1 -1
- package/build-module/font-size-picker/utils.js +1 -0
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-token-field/index.js +1 -0
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +1 -0
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/gradient-picker/index.js +1 -0
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/guide/index.js +1 -0
- package/build-module/guide/index.js.map +1 -1
- package/build-module/guide/page-control.js +1 -0
- package/build-module/guide/page-control.js.map +1 -1
- package/build-module/h-stack/hook.js +1 -0
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/heading/hook.js +1 -1
- package/build-module/heading/hook.js.map +1 -1
- package/build-module/higher-order/navigate-regions/index.js +1 -0
- package/build-module/higher-order/navigate-regions/index.js.map +1 -1
- package/build-module/higher-order/with-fallback-styles/index.js +1 -0
- package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build-module/higher-order/with-filters/index.js +1 -0
- package/build-module/higher-order/with-filters/index.js.map +1 -1
- package/build-module/higher-order/with-notices/index.js +1 -0
- package/build-module/higher-order/with-notices/index.js.map +1 -1
- package/build-module/input-control/index.js +9 -0
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/types.js.map +1 -1
- package/build-module/keyboard-shortcuts/index.js +1 -0
- package/build-module/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/menu/checkbox-item.js +2 -0
- package/build-module/menu/checkbox-item.js.map +1 -1
- package/build-module/menu/index.js +28 -97
- package/build-module/menu/index.js.map +1 -1
- package/build-module/menu/item.js +10 -1
- package/build-module/menu/item.js.map +1 -1
- package/build-module/menu/popover.js +81 -0
- package/build-module/menu/popover.js.map +1 -0
- package/build-module/menu/radio-item.js +2 -0
- package/build-module/menu/radio-item.js.map +1 -1
- package/build-module/menu/styles.js +16 -16
- package/build-module/menu/styles.js.map +1 -1
- package/build-module/menu/submenu-trigger-item.js +50 -0
- package/build-module/menu/submenu-trigger-item.js.map +1 -0
- package/build-module/menu/trigger-button.js +37 -0
- package/build-module/menu/trigger-button.js.map +1 -0
- package/build-module/menu/types.js.map +1 -1
- package/build-module/menu-items-choice/index.js +1 -0
- package/build-module/menu-items-choice/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js +1 -0
- package/build-module/mobile/bottom-sheet/bottom-sheet-navigation/navigation-container.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js +1 -0
- package/build-module/mobile/bottom-sheet/keyboard-avoiding-view.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/picker-cell.native.js +1 -0
- package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js +1 -0
- package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/palette.screen.native.js +1 -0
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js +1 -0
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/media-edit/index.native.js +1 -0
- package/build-module/mobile/media-edit/index.native.js.map +1 -1
- package/build-module/mobile/picker/index.android.js +1 -0
- package/build-module/mobile/picker/index.android.js.map +1 -1
- package/build-module/mobile/picker/index.ios.js +1 -0
- package/build-module/mobile/picker/index.ios.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +1 -0
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +1 -0
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build-module/navigable-container/container.js +1 -0
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigation/back-button/index.js +1 -0
- package/build-module/navigation/back-button/index.js.map +1 -1
- package/build-module/navigation/group/index.js +1 -0
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/index.js +6 -0
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/item/index.js +1 -0
- package/build-module/navigation/item/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +1 -0
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/search-no-results-found.js +1 -0
- package/build-module/navigation/menu/search-no-results-found.js.map +1 -1
- package/build-module/navigation/styles/navigation-styles.js +12 -12
- package/build-module/navigation/styles/navigation-styles.js.map +1 -1
- package/build-module/navigator/navigator/component.js +1 -0
- package/build-module/navigator/navigator/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +1 -0
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/utils/router.js +1 -0
- package/build-module/navigator/utils/router.js.map +1 -1
- package/build-module/notice/index.js +1 -0
- package/build-module/notice/index.js.map +1 -1
- package/build-module/notice/list.js +1 -0
- package/build-module/notice/list.js.map +1 -1
- package/build-module/notice/list.native.js +1 -0
- package/build-module/notice/list.native.js.map +1 -1
- package/build-module/number-control/index.js +1 -0
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/palette-edit/index.js +2 -0
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/panel/actions.native.js +1 -0
- package/build-module/panel/actions.native.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/query-controls/index.js +1 -0
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/terms.js +1 -0
- package/build-module/query-controls/terms.js.map +1 -1
- package/build-module/radio-control/index.js +1 -0
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-control/index.native.js +1 -0
- package/build-module/radio-control/index.native.js.map +1 -1
- package/build-module/radio-group/index.js +6 -0
- package/build-module/radio-group/index.js.map +1 -1
- package/build-module/radio-group/radio.js +1 -2
- package/build-module/radio-group/radio.js.map +1 -1
- package/build-module/range-control/rail.js +1 -0
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +28 -28
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/resizable-box/index.js +1 -0
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/sandbox/index.js +1 -0
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/index.native.js +1 -0
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/search-control/index.native.js +1 -0
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/select-control/index.js +10 -0
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/types.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -0
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/context.js +5 -3
- package/build-module/slot-fill/context.js.map +1 -1
- package/build-module/slot-fill/fill.js +10 -15
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/slot-fill/provider.js +42 -55
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/slot-fill/slot.js +33 -24
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/slot-fill/types.js.map +1 -1
- package/build-module/snackbar/index.js +1 -0
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +1 -0
- package/build-module/snackbar/list.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/tabs/index.js +22 -4
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/types.js.map +1 -1
- package/build-module/text/hook.js +6 -6
- package/build-module/text/hook.js.map +1 -1
- package/build-module/text/styles.js +7 -7
- package/build-module/text/styles.js.map +1 -1
- package/build-module/text/utils.js +1 -0
- package/build-module/text/utils.js.map +1 -1
- package/build-module/theme/color-algorithms.js +1 -0
- package/build-module/theme/color-algorithms.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +1 -2
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +8 -8
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/toolbar/toolbar-group/index.js +1 -0
- package/build-module/toolbar/toolbar-group/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +1 -0
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +1 -0
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tooltip/index.js +1 -2
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tree-grid/index.js +1 -0
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/tree-select/index.js +11 -2
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/tree-select/types.js.map +1 -1
- package/build-module/unit-control/index.js +1 -0
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/index.native.js +1 -0
- package/build-module/unit-control/index.native.js.map +1 -1
- package/build-module/unit-control/unit-select-control.js +1 -0
- package/build-module/unit-control/unit-select-control.js.map +1 -1
- package/build-module/unit-control/utils.js +1 -0
- package/build-module/unit-control/utils.js.map +1 -1
- package/build-module/utils/colors-values.js +3 -0
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-module/utils/config-values.js +0 -1
- package/build-module/utils/config-values.js.map +1 -1
- package/build-module/utils/get-valid-children.js +1 -0
- package/build-module/utils/get-valid-children.js.map +1 -1
- package/build-module/utils/hooks/use-animated-offset-rect.js +1 -0
- package/build-module/utils/hooks/use-animated-offset-rect.js.map +1 -1
- package/build-module/utils/hooks/use-cx.js +1 -0
- package/build-module/utils/hooks/use-cx.js.map +1 -1
- package/build-module/utils/math.js +1 -0
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/rtl.js +1 -0
- package/build-module/utils/rtl.js.map +1 -1
- package/build-module/utils/values.js +1 -0
- package/build-module/utils/values.js.map +1 -1
- package/build-module/z-stack/component.js +1 -0
- package/build-module/z-stack/component.js.map +1 -1
- package/build-style/style-rtl.css +60 -13
- package/build-style/style.css +60 -13
- package/build-types/alignment-matrix-control/stories/index.story.d.ts +1 -1
- package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
- package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
- package/build-types/animate/stories/index.story.d.ts +7 -7
- package/build-types/animate/stories/index.story.d.ts.map +1 -1
- package/build-types/badge/index.d.ts +8 -0
- package/build-types/badge/index.d.ts.map +1 -0
- package/build-types/badge/stories/index.story.d.ts +17 -0
- package/build-types/badge/stories/index.story.d.ts.map +1 -0
- package/build-types/badge/test/index.d.ts +2 -0
- package/build-types/badge/test/index.d.ts.map +1 -0
- package/build-types/badge/types.d.ts +13 -0
- package/build-types/badge/types.d.ts.map +1 -0
- package/build-types/base-control/stories/index.story.d.ts +1 -1
- package/build-types/border-box-control/stories/index.story.d.ts +1 -1
- package/build-types/border-control/stories/index.story.d.ts +5 -5
- package/build-types/box-control/index.d.ts +1 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/input-control.d.ts +3 -0
- package/build-types/box-control/input-control.d.ts.map +1 -0
- package/build-types/box-control/stories/index.story.d.ts +356 -11
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
- package/build-types/box-control/types.d.ts +26 -1
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/box-control/utils.d.ts +49 -15
- package/build-types/box-control/utils.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts +25 -7
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/button/types.d.ts +6 -4
- package/build-types/button/types.d.ts.map +1 -1
- package/build-types/button-group/index.d.ts +3 -1
- package/build-types/button-group/index.d.ts.map +1 -1
- package/build-types/button-group/stories/index.story.d.ts +6 -0
- package/build-types/button-group/stories/index.story.d.ts.map +1 -1
- package/build-types/button-group/types.d.ts +7 -0
- package/build-types/button-group/types.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts +5 -5
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.story.d.ts +3 -3
- package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts +4 -4
- package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
- package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/stories/index.story.d.ts +1 -1
- package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control/stories/index.story.d.ts +3 -3
- package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/index.story.d.ts +3 -3
- package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/stories/time.story.d.ts +1 -1
- package/build-types/date-time/stories/time.story.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts +4 -4
- package/build-types/dimension-control/index.d.ts.map +1 -1
- package/build-types/dimension-control/stories/index.story.d.ts +1 -1
- package/build-types/disabled/stories/index.story.d.ts.map +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +1 -1
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts +3 -3
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/font-size-picker/styles.d.ts.map +1 -1
- package/build-types/form-file-upload/stories/index.story.d.ts +5 -5
- package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts +3 -3
- package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/guide/stories/index.story.d.ts +1 -1
- package/build-types/guide/stories/index.story.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts +4 -4
- package/build-types/icon/stories/index.story.d.ts.map +1 -1
- package/build-types/input-control/index.d.ts +1 -0
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/stories/index.story.d.ts +7 -7
- package/build-types/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +11 -2
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
- package/build-types/menu/checkbox-item.d.ts.map +1 -1
- package/build-types/menu/index.d.ts +10 -1
- package/build-types/menu/index.d.ts.map +1 -1
- package/build-types/menu/item.d.ts.map +1 -1
- package/build-types/menu/popover.d.ts +3 -0
- package/build-types/menu/popover.d.ts.map +1 -0
- package/build-types/menu/radio-item.d.ts.map +1 -1
- package/build-types/menu/stories/index.story.d.ts +9 -9
- package/build-types/menu/stories/index.story.d.ts.map +1 -1
- package/build-types/menu/submenu-trigger-item.d.ts +3 -0
- package/build-types/menu/submenu-trigger-item.d.ts.map +1 -0
- package/build-types/menu/trigger-button.d.ts +3 -0
- package/build-types/menu/trigger-button.d.ts.map +1 -0
- package/build-types/menu/types.d.ts +208 -57
- package/build-types/menu/types.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +1 -1
- package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +4 -4
- package/build-types/modal/stories/index.story.d.ts.map +1 -1
- package/build-types/navigation/back-button/index.d.ts.map +1 -1
- package/build-types/navigation/index.d.ts.map +1 -1
- package/build-types/navigation/item/index.d.ts.map +1 -1
- package/build-types/navigation/stories/index.story.d.ts +6 -6
- package/build-types/navigation/stories/index.story.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts +4 -4
- package/build-types/notice/stories/index.story.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +2 -2
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/palette-edit/stories/index.story.d.ts +2 -2
- package/build-types/palette-edit/stories/index.story.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
- package/build-types/query-controls/stories/index.story.d.ts +1 -1
- package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-group/index.d.ts.map +1 -1
- package/build-types/radio-group/radio.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts +2 -2
- package/build-types/responsive-wrapper/stories/index.story.d.ts +1 -1
- package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
- package/build-types/sandbox/stories/index.story.d.ts +1 -1
- package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts +1 -1
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts +1 -0
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts +5 -5
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/types.d.ts +1 -1
- package/build-types/select-control/types.d.ts.map +1 -1
- package/build-types/shortcut/stories/index.story.d.ts +1 -1
- package/build-types/shortcut/stories/index.story.d.ts.map +1 -1
- package/build-types/slot-fill/context.d.ts.map +1 -1
- package/build-types/slot-fill/fill.d.ts.map +1 -1
- package/build-types/slot-fill/provider.d.ts.map +1 -1
- package/build-types/slot-fill/slot.d.ts.map +1 -1
- package/build-types/slot-fill/types.d.ts +13 -11
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.story.d.ts +4 -4
- package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts +21 -4
- package/build-types/tabs/index.d.ts.map +1 -1
- package/build-types/tabs/stories/index.story.d.ts +10 -10
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/types.d.ts +13 -13
- package/build-types/tabs/types.d.ts.map +1 -1
- package/build-types/text/stories/index.story.d.ts +3 -3
- package/build-types/theme/stories/index.story.d.ts +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
- package/build-types/toolbar/stories/index.story.d.ts +3 -3
- package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/tooltip/stories/index.story.d.ts +1 -1
- package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts +3 -2
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/tree-select/stories/index.story.d.ts +1 -1
- package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/types.d.ts +5 -1
- package/build-types/tree-select/types.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
- package/build-types/utils/colors-values.d.ts +3 -0
- package/build-types/utils/colors-values.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +0 -1
- package/build-types/v-stack/stories/index.story.d.ts +1 -1
- package/package.json +19 -19
- package/src/alignment-matrix-control/README.md +16 -15
- package/src/angle-picker-control/README.md +10 -9
- package/src/badge/README.md +24 -0
- package/src/badge/docs-manifest.json +5 -0
- package/src/badge/index.tsx +67 -0
- package/src/badge/stories/index.story.tsx +54 -0
- package/src/badge/styles.scss +49 -0
- package/src/badge/test/index.tsx +45 -0
- package/src/badge/types.ts +12 -0
- package/src/base-control/README.md +22 -21
- package/src/box-control/README.md +41 -24
- package/src/box-control/index.tsx +28 -14
- package/src/box-control/input-control.tsx +299 -0
- package/src/box-control/stories/index.story.tsx +12 -0
- package/src/box-control/types.ts +27 -1
- package/src/box-control/utils.ts +122 -60
- package/src/button/README.md +110 -220
- package/src/button/docs-manifest.json +5 -0
- package/src/button/stories/best-practices.mdx +31 -0
- package/src/button/stories/index.story.tsx +18 -0
- package/src/button/style.scss +9 -10
- package/src/button/test/index.tsx +9 -2
- package/src/button/types.ts +6 -4
- package/src/button-group/README.md +4 -0
- package/src/button-group/index.tsx +11 -1
- package/src/button-group/stories/index.story.tsx +8 -1
- package/src/button-group/types.ts +7 -0
- package/src/custom-select-control/index.tsx +1 -1
- package/src/custom-select-control-v2/custom-select.tsx +1 -2
- package/src/custom-select-control-v2/stories/index.story.tsx +4 -0
- package/src/date-time/date/index.tsx +1 -0
- package/src/dimension-control/index.tsx +1 -0
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
- package/src/disabled/stories/index.story.tsx +1 -0
- package/src/drop-zone/stories/index.story.tsx +7 -1
- package/src/font-size-picker/styles.ts +1 -0
- package/src/form-file-upload/README.md +22 -21
- package/src/gradient-picker/README.md +36 -35
- package/src/heading/hook.ts +1 -1
- package/src/heading/test/__snapshots__/index.tsx.snap +4 -4
- package/src/icon/README.md +9 -8
- package/src/input-control/README.md +1 -0
- package/src/input-control/index.tsx +10 -0
- package/src/input-control/stories/index.story.tsx +6 -1
- package/src/input-control/test/index.js +9 -3
- package/src/input-control/types.ts +11 -2
- package/src/menu/checkbox-item.tsx +2 -1
- package/src/menu/index.tsx +61 -165
- package/src/menu/item.tsx +17 -2
- package/src/menu/popover.tsx +103 -0
- package/src/menu/radio-item.tsx +2 -1
- package/src/menu/stories/index.story.tsx +533 -381
- package/src/menu/styles.ts +1 -1
- package/src/menu/submenu-trigger-item.tsx +61 -0
- package/src/menu/test/index.tsx +266 -182
- package/src/menu/trigger-button.tsx +46 -0
- package/src/menu/types.ts +210 -63
- package/src/modal/stories/index.story.tsx +4 -1
- package/src/navigation/back-button/index.tsx +1 -0
- package/src/navigation/index.tsx +7 -0
- package/src/navigation/item/index.tsx +2 -0
- package/src/navigation/styles/navigation-styles.tsx +3 -2
- package/src/navigation/test/index.tsx +4 -0
- package/src/navigator/test/index.tsx +4 -0
- package/src/number-control/index.tsx +1 -0
- package/src/palette-edit/index.tsx +1 -0
- package/src/panel/stories/index.story.tsx +3 -3
- package/src/private-apis.ts +2 -0
- package/src/radio-group/index.tsx +12 -1
- package/src/radio-group/radio.tsx +1 -2
- package/src/range-control/styles/range-control-styles.ts +8 -4
- package/src/select-control/README.md +3 -0
- package/src/select-control/index.tsx +10 -0
- package/src/select-control/stories/index.story.tsx +2 -0
- package/src/select-control/test/select-control.tsx +7 -1
- package/src/select-control/types.ts +1 -0
- package/src/slot-fill/context.ts +5 -3
- package/src/slot-fill/fill.ts +10 -15
- package/src/slot-fill/provider.tsx +63 -64
- package/src/slot-fill/slot.tsx +40 -27
- package/src/slot-fill/types.ts +23 -11
- package/src/style.scss +1 -0
- package/src/tab-panel/index.tsx +1 -2
- package/src/tab-panel/stories/index.story.tsx +4 -0
- package/src/tabs/README.md +151 -187
- package/src/tabs/docs-manifest.json +22 -0
- package/src/tabs/index.tsx +21 -4
- package/src/tabs/stories/best-practices.mdx +99 -0
- package/src/tabs/stories/index.story.tsx +5 -0
- package/src/tabs/types.ts +13 -14
- package/src/text/hook.ts +2 -2
- package/src/text/styles.ts +1 -1
- package/src/text/test/__snapshots__/index.tsx.snap +3 -3
- package/src/text/test/index.tsx +1 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +24 -24
- package/src/toggle-group-control/test/index.tsx +7 -1
- package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +1 -2
- package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +6 -6
- package/src/tooltip/index.tsx +1 -2
- package/src/tree-grid/stories/index.story.tsx +2 -0
- package/src/tree-select/README.md +144 -28
- package/src/tree-select/docs-manifest.json +5 -0
- package/src/tree-select/index.tsx +11 -2
- package/src/tree-select/stories/index.story.tsx +1 -0
- package/src/tree-select/types.ts +8 -1
- package/src/utils/colors-values.js +3 -0
- package/src/utils/config-values.js +0 -1
- package/tsconfig.json +0 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/build/box-control/all-input-control.js +0 -91
- package/build/box-control/all-input-control.js.map +0 -1
- package/build/box-control/axial-input-controls.js +0 -125
- package/build/box-control/axial-input-controls.js.map +0 -1
- package/build/box-control/input-controls.js +0 -133
- package/build/box-control/input-controls.js.map +0 -1
- package/build/slot-fill/use-slot.js +0 -32
- package/build/slot-fill/use-slot.js.map +0 -1
- package/build-module/box-control/all-input-control.js +0 -84
- package/build-module/box-control/all-input-control.js.map +0 -1
- package/build-module/box-control/axial-input-controls.js +0 -116
- package/build-module/box-control/axial-input-controls.js.map +0 -1
- package/build-module/box-control/input-controls.js +0 -124
- package/build-module/box-control/input-controls.js.map +0 -1
- package/build-module/slot-fill/use-slot.js +0 -24
- package/build-module/slot-fill/use-slot.js.map +0 -1
- package/build-types/box-control/all-input-control.d.ts +0 -3
- package/build-types/box-control/all-input-control.d.ts.map +0 -1
- package/build-types/box-control/axial-input-controls.d.ts +0 -3
- package/build-types/box-control/axial-input-controls.d.ts.map +0 -1
- package/build-types/box-control/input-controls.d.ts +0 -3
- package/build-types/box-control/input-controls.d.ts.map +0 -1
- package/build-types/slot-fill/use-slot.d.ts +0 -10
- package/build-types/slot-fill/use-slot.d.ts.map +0 -1
- package/src/box-control/all-input-control.tsx +0 -110
- package/src/box-control/axial-input-controls.tsx +0 -165
- package/src/box-control/input-controls.tsx +0 -167
- package/src/slot-fill/use-slot.ts +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["css","NumberControl","COLORS","rtl","CONFIG","space","rangeHeightValue","railHeight","rangeHeight","height","minHeight","process","env","NODE_ENV","thumbSize","deprecatedHeight","__next40pxDefaultSize","Root","_styled","target","label","wrapperColor","color","ui","borderFocus","wrapperMargin","marks","__nextHasNoMarginBottom","marginBottom","undefined","Wrapper","shouldForwardProp","prop","includes","BeforeIconWrapper","marginRight","AfterIconWrapper","marginLeft","railBackgroundColor","disabled","railColor","background","backgroundDisabled","Rail","gray","radiusFull","trackBackgroundColor","trackColor","Track","MarksWrapper","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","Mark","markLabelFill","isFilled","MarkLabel","left","transform","thumbColor","theme","accent","ThumbWrapper","radiusRound","thumbFocus","isFocused","Thumb","elevationXSmall","InputRange","tooltipShow","show","_ref","_ref2","tooltipPosition","position","isBottom","Tooltip","radiusSmall","InputNumber","ActionRightWrapper"],"sources":["@wordpress/components/src/range-control/styles/range-control-styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport NumberControl from '../../number-control';\nimport { COLORS, rtl, CONFIG } from '../../utils';\nimport { space } from '../../utils/space';\n\nimport type {\n\tRangeMarkProps,\n\tRailProps,\n\tThumbProps,\n\tTooltipProps,\n\tTrackProps,\n\tWrapperProps,\n\tRangeControlProps,\n} from '../types';\n\nconst rangeHeightValue = 30;\nconst railHeight = 4;\nconst rangeHeight = () =>\n\tcss( { height: rangeHeightValue, minHeight: rangeHeightValue } );\nconst thumbSize = 12;\n\nconst deprecatedHeight = ( {\n\t__next40pxDefaultSize,\n}: Pick< RangeControlProps, '__next40pxDefaultSize' > ) =>\n\t! __next40pxDefaultSize && css( { minHeight: rangeHeightValue } );\n\ntype RootProps = Pick< RangeControlProps, '__next40pxDefaultSize' >;\nexport const Root = styled.div< RootProps >`\n\t-webkit-tap-highlight-color: transparent;\n\talign-items: center;\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\tpadding: 0;\n\tposition: relative;\n\ttouch-action: none;\n\twidth: 100%;\n\tmin-height: 40px;\n\t/* TODO: remove after removing the __next40pxDefaultSize prop */\n\t${ deprecatedHeight };\n`;\n\nconst wrapperColor = ( { color = COLORS.ui.borderFocus }: WrapperProps ) =>\n\tcss( { color } );\n\nconst wrapperMargin = ( { marks, __nextHasNoMarginBottom }: WrapperProps ) => {\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\treturn css( { marginBottom: marks ? 16 : undefined } );\n\t}\n\treturn '';\n};\n\nexport const Wrapper = styled( 'div', {\n\tshouldForwardProp: ( prop: string ) =>\n\t\t! [ 'color', '__nextHasNoMarginBottom', 'marks' ].includes( prop ),\n} )< WrapperProps >`\n\tdisplay: block;\n\tflex: 1;\n\tposition: relative;\n\twidth: 100%;\n\n\t${ wrapperColor };\n\t${ rangeHeight };\n\t${ wrapperMargin };\n`;\n\nexport const BeforeIconWrapper = styled.span`\n\tdisplay: flex; // ensures the height isn't affected by line-height\n\tmargin-top: ${ railHeight }px;\n\n\t${ rtl( { marginRight: 6 } ) }\n`;\n\nexport const AfterIconWrapper = styled.span`\n\tdisplay: flex; // ensures the height isn't affected by line-height\n\tmargin-top: ${ railHeight }px;\n\n\t${ rtl( { marginLeft: 6 } ) }\n`;\n\nconst railBackgroundColor = ( { disabled, railColor }: RailProps ) => {\n\tlet background = railColor || '';\n\n\tif ( disabled ) {\n\t\tbackground = COLORS.ui.backgroundDisabled;\n\t}\n\n\treturn css( { background } );\n};\n\nexport const Rail = styled.span`\n\tbackground-color: ${ COLORS.gray[ 300 ] };\n\tleft: 0;\n\tpointer-events: none;\n\tright: 0;\n\tdisplay: block;\n\theight: ${ railHeight }px;\n\tposition: absolute;\n\tmargin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px;\n\ttop: 0;\n\tborder-radius: ${ CONFIG.radiusFull };\n\n\t${ railBackgroundColor };\n`;\n\nconst trackBackgroundColor = ( { disabled, trackColor }: TrackProps ) => {\n\tlet background = trackColor || 'currentColor';\n\n\tif ( disabled ) {\n\t\tbackground = COLORS.gray[ 400 ];\n\t}\n\n\treturn css( { background } );\n};\n\nexport const Track = styled.span`\n\tbackground-color: currentColor;\n\tborder-radius: ${ CONFIG.radiusFull };\n\theight: ${ railHeight }px;\n\tpointer-events: none;\n\tdisplay: block;\n\tposition: absolute;\n\tmargin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px;\n\ttop: 0;\n\n\t@media not ( prefers-reduced-motion ) {\n\t\ttransition: width ease 0.1s;\n\t}\n\n\t${ trackBackgroundColor };\n`;\n\nexport const MarksWrapper = styled.span`\n\tdisplay: block;\n\tpointer-events: none;\n\tposition: relative;\n\twidth: 100%;\n\tuser-select: none;\n\tmargin-top: 17px;\n`;\n\nexport const Mark = styled.span`\n\tposition: absolute;\n\tleft: 0;\n\ttop: -4px;\n\theight: 4px;\n\twidth: 2px;\n\ttransform: translateX( -50% );\n\tbackground-color: ${ COLORS.ui.background };\n\tz-index: 1;\n`;\n\nconst markLabelFill = ( { isFilled }: RangeMarkProps ) => {\n\treturn css( {\n\t\tcolor: isFilled ? COLORS.gray[ 700 ] : COLORS.gray[ 300 ],\n\t} );\n};\n\nexport const MarkLabel = styled.span`\n\tcolor: ${ COLORS.gray[ 300 ] };\n\tfont-size: 11px;\n\tposition: absolute;\n\ttop: 8px;\n\twhite-space: nowrap;\n\n\t${ rtl( { left: 0 } ) };\n\t${ rtl(\n\t\t{ transform: 'translateX( -50% )' },\n\t\t{ transform: 'translateX( 50% )' }\n\t) };\n\n\t${ markLabelFill };\n`;\n\nconst thumbColor = ( { disabled }: ThumbProps ) =>\n\tdisabled\n\t\t? css`\n\t\t\t\tbackground-color: ${ COLORS.gray[ 400 ] };\n\t\t `\n\t\t: css`\n\t\t\t\tbackground-color: ${ COLORS.theme.accent };\n\t\t `;\n\nexport const ThumbWrapper = styled.span`\n\talign-items: center;\n\tdisplay: flex;\n\theight: ${ thumbSize }px;\n\tjustify-content: center;\n\tmargin-top: ${ ( rangeHeightValue - thumbSize ) / 2 }px;\n\toutline: 0;\n\tpointer-events: none;\n\tposition: absolute;\n\ttop: 0;\n\tuser-select: none;\n\twidth: ${ thumbSize }px;\n\tborder-radius: ${ CONFIG.radiusRound };\n\tz-index: 3;\n\n\t@media not ( prefers-reduced-motion ) {\n\t\ttransition: left ease 0.1s;\n\t}\n\n\t${ thumbColor };\n\t${ rtl( { marginLeft: -10 } ) };\n\t${ rtl(\n\t\t{ transform: 'translateX( 4.5px )' },\n\t\t{ transform: 'translateX( -4.5px )' }\n\t) };\n`;\n\nconst thumbFocus = ( { isFocused }: ThumbProps ) => {\n\treturn isFocused\n\t\t? css`\n\t\t\t\t&::before {\n\t\t\t\t\tcontent: ' ';\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tbackground-color: ${ COLORS.theme.accent };\n\t\t\t\t\topacity: 0.4;\n\t\t\t\t\tborder-radius: ${ CONFIG.radiusRound };\n\t\t\t\t\theight: ${ thumbSize + 8 }px;\n\t\t\t\t\twidth: ${ thumbSize + 8 }px;\n\t\t\t\t\ttop: -4px;\n\t\t\t\t\tleft: -4px;\n\t\t\t\t}\n\t\t `\n\t\t: '';\n};\n\nexport const Thumb = styled.span< ThumbProps >`\n\talign-items: center;\n\tborder-radius: ${ CONFIG.radiusRound };\n\theight: 100%;\n\toutline: 0;\n\tposition: absolute;\n\tuser-select: none;\n\twidth: 100%;\n\tbox-shadow: ${ CONFIG.elevationXSmall };\n\n\t${ thumbColor };\n\t${ thumbFocus };\n`;\n\nexport const InputRange = styled.input`\n\tbox-sizing: border-box;\n\tcursor: pointer;\n\tdisplay: block;\n\theight: 100%;\n\tleft: 0;\n\tmargin: 0 -${ thumbSize / 2 }px;\n\topacity: 0;\n\toutline: none;\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\twidth: calc( 100% + ${ thumbSize }px );\n`;\n\nconst tooltipShow = ( { show }: TooltipProps ) => {\n\treturn css`\n\t\tdisplay: ${ show ? 'inline-block' : 'none' };\n\t\topacity: ${ show ? 1 : 0 };\n\n\t\t@media not ( prefers-reduced-motion ) {\n\t\t\ttransition:\n\t\t\t\topacity 120ms ease,\n\t\t\t\tdisplay 120ms ease allow-discrete;\n\t\t}\n\n\t\t@starting-style {\n\t\t\topacity: 0;\n\t\t}\n\t`;\n};\n\nconst tooltipPosition = ( { position }: TooltipProps ) => {\n\tconst isBottom = position === 'bottom';\n\n\tif ( isBottom ) {\n\t\treturn css`\n\t\t\tbottom: -80%;\n\t\t`;\n\t}\n\n\treturn css`\n\t\ttop: -80%;\n\t`;\n};\n\nexport const Tooltip = styled.span< TooltipProps >`\n\tbackground: rgba( 0, 0, 0, 0.8 );\n\tborder-radius: ${ CONFIG.radiusSmall };\n\tcolor: white;\n\tfont-size: 12px;\n\tmin-width: 32px;\n\tpadding: 4px 8px;\n\tpointer-events: none;\n\tposition: absolute;\n\ttext-align: center;\n\tuser-select: none;\n\tline-height: 1.4;\n\n\t${ tooltipShow };\n\n\t${ tooltipPosition };\n\t${ rtl(\n\t\t{ transform: 'translateX(-50%)' },\n\t\t{ transform: 'translateX(50%)' }\n\t) }\n`;\n\n// @todo Refactor RangeControl with latest HStack configuration\n// @see: packages/components/src/h-stack\nexport const InputNumber = styled( NumberControl )`\n\tdisplay: inline-block;\n\tfont-size: 13px;\n\tmargin-top: 0;\n\n\tinput[type='number']& {\n\t\t${ rangeHeight };\n\t}\n\n\t${ rtl( { marginLeft: `${ space( 4 ) } !important` } ) }\n`;\n\nexport const ActionRightWrapper = styled.span`\n\tdisplay: block;\n\tmargin-top: 0;\n\n\tbutton,\n\tbutton.is-small {\n\t\tmargin-left: 0;\n\t\t${ rangeHeight };\n\t}\n\n\t${ rtl( { marginLeft: 8 } ) }\n`;\n"],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,QAAQ;EAEtC,IAAKC,QAAQ,EAAG;IACf,OAAAH,KAAA;EAGD;EAEA,OAAAD,IAAA;AAGD,CAAC;AAED,OAAO,MAAMK,OAAO,gBAAA5D,OAAA,SAAAP,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAM,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,qDAEDhB,MAAM,CAAC2E,WAAW,0JAWjCR,WAAW,OAEXI,eAAe,OACfxE,GAAG,CACL;EAAEyD,SAAS,EAAE;AAAmB,CAAC,EACjC;EAAEA,SAAS,EAAE;AAAkB,CAChC,CAAC,SAAAjD,OAAA,CAAAC,GAAA,CAAAC,QAAA,gpVACD;;AAED;AACA;AACA,OAAO,MAAMmE,WAAW,gBAAG9D,OAAA,CAAQjB,aAAa,EAAAU,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAM,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,4EAM7CZ,WAAW,QAGZL,GAAG,CAAE;EAAEkC,UAAU,EAAE,GAAIhC,KAAK,CAAE,CAAE,CAAC;AAAe,CAAE,CAAC,SAAAM,OAAA,CAAAC,GAAA,CAAAC,QAAA,gpVACtD;AAED,OAAO,MAAMoE,kBAAkB,gBAAA/D,OAAA,SAAAP,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAM,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,uEAO1BZ,WAAW,QAGZL,GAAG,CAAE;EAAEkC,UAAU,EAAE;AAAE,CAAE,CAAC,SAAA1B,OAAA,CAAAC,GAAA,CAAAC,QAAA,gpVAC3B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["css","NumberControl","COLORS","rtl","CONFIG","space","rangeHeightValue","railHeight","rangeHeight","height","minHeight","process","env","NODE_ENV","thumbSize","deprecatedHeight","__next40pxDefaultSize","Root","_styled","target","label","wrapperColor","color","ui","borderFocus","wrapperMargin","marks","__nextHasNoMarginBottom","marginBottom","undefined","Wrapper","shouldForwardProp","prop","includes","BeforeIconWrapper","marginRight","AfterIconWrapper","marginLeft","railBackgroundColor","disabled","railColor","background","backgroundDisabled","Rail","gray","radiusFull","trackBackgroundColor","trackColor","Track","MarksWrapper","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","Mark","markLabelFill","isFilled","MarkLabel","left","transform","thumbColor","theme","accent","ThumbWrapper","radiusRound","thumbFocus","isFocused","Thumb","elevationXSmall","InputRange","tooltipShow","show","_ref","_ref2","tooltipPosition","position","isBottom","Tooltip","radiusSmall","InputNumber","ActionRightWrapper"],"sources":["@wordpress/components/src/range-control/styles/range-control-styles.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport NumberControl from '../../number-control';\nimport { COLORS, rtl, CONFIG } from '../../utils';\nimport { space } from '../../utils/space';\n\nimport type {\n\tRangeMarkProps,\n\tRailProps,\n\tThumbProps,\n\tTooltipProps,\n\tTrackProps,\n\tWrapperProps,\n\tRangeControlProps,\n} from '../types';\n\nconst rangeHeightValue = 30;\nconst railHeight = 4;\nconst rangeHeight = () =>\n\tcss( { height: rangeHeightValue, minHeight: rangeHeightValue } );\nconst thumbSize = 12;\n\nconst deprecatedHeight = ( {\n\t__next40pxDefaultSize,\n}: Pick< RangeControlProps, '__next40pxDefaultSize' > ) =>\n\t! __next40pxDefaultSize && css( { minHeight: rangeHeightValue } );\n\ntype RootProps = Pick< RangeControlProps, '__next40pxDefaultSize' >;\nexport const Root = styled.div< RootProps >`\n\t-webkit-tap-highlight-color: transparent;\n\talign-items: center;\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\tpadding: 0;\n\tposition: relative;\n\ttouch-action: none;\n\twidth: 100%;\n\tmin-height: 40px;\n\t/* TODO: remove after removing the __next40pxDefaultSize prop */\n\t${ deprecatedHeight };\n`;\n\nconst wrapperColor = ( { color = COLORS.ui.borderFocus }: WrapperProps ) =>\n\tcss( { color } );\n\nconst wrapperMargin = ( { marks, __nextHasNoMarginBottom }: WrapperProps ) => {\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\treturn css( { marginBottom: marks ? 16 : undefined } );\n\t}\n\treturn '';\n};\n\nexport const Wrapper = styled( 'div', {\n\tshouldForwardProp: ( prop: string ) =>\n\t\t! [ 'color', '__nextHasNoMarginBottom', 'marks' ].includes( prop ),\n} )< WrapperProps >`\n\tdisplay: block;\n\tflex: 1;\n\tposition: relative;\n\twidth: 100%;\n\n\t${ wrapperColor };\n\t${ rangeHeight };\n\t${ wrapperMargin };\n`;\n\nexport const BeforeIconWrapper = styled.span`\n\tdisplay: flex; // ensures the height isn't affected by line-height\n\tmargin-top: ${ railHeight }px;\n\n\t${ rtl( { marginRight: 6 } ) }\n`;\n\nexport const AfterIconWrapper = styled.span`\n\tdisplay: flex; // ensures the height isn't affected by line-height\n\tmargin-top: ${ railHeight }px;\n\n\t${ rtl( { marginLeft: 6 } ) }\n`;\n\nconst railBackgroundColor = ( { disabled, railColor }: RailProps ) => {\n\tlet background = railColor || '';\n\n\tif ( disabled ) {\n\t\tbackground = COLORS.ui.backgroundDisabled;\n\t}\n\n\treturn css( { background } );\n};\n\nexport const Rail = styled.span`\n\tbackground-color: ${ COLORS.gray[ 300 ] };\n\tleft: 0;\n\tpointer-events: none;\n\tright: 0;\n\tdisplay: block;\n\theight: ${ railHeight }px;\n\tposition: absolute;\n\tmargin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px;\n\ttop: 0;\n\tborder-radius: ${ CONFIG.radiusFull };\n\n\t${ railBackgroundColor };\n`;\n\nconst trackBackgroundColor = ( { disabled, trackColor }: TrackProps ) => {\n\tlet background = trackColor || 'currentColor';\n\n\tif ( disabled ) {\n\t\tbackground = COLORS.gray[ 400 ];\n\t}\n\n\treturn css( { background } );\n};\n\nexport const Track = styled.span`\n\tbackground-color: currentColor;\n\tborder-radius: ${ CONFIG.radiusFull };\n\theight: ${ railHeight }px;\n\tpointer-events: none;\n\tdisplay: block;\n\tposition: absolute;\n\tmargin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px;\n\ttop: 0;\n\n\t.is-marked & {\n\t\t@media not ( prefers-reduced-motion ) {\n\t\t\ttransition: width ease 0.1s;\n\t\t}\n\t}\n\n\t${ trackBackgroundColor };\n`;\n\nexport const MarksWrapper = styled.span`\n\tdisplay: block;\n\tpointer-events: none;\n\tposition: relative;\n\twidth: 100%;\n\tuser-select: none;\n\tmargin-top: 17px;\n`;\n\nexport const Mark = styled.span`\n\tposition: absolute;\n\tleft: 0;\n\ttop: -4px;\n\theight: 4px;\n\twidth: 2px;\n\ttransform: translateX( -50% );\n\tbackground-color: ${ COLORS.ui.background };\n\tz-index: 1;\n`;\n\nconst markLabelFill = ( { isFilled }: RangeMarkProps ) => {\n\treturn css( {\n\t\tcolor: isFilled ? COLORS.gray[ 700 ] : COLORS.gray[ 300 ],\n\t} );\n};\n\nexport const MarkLabel = styled.span`\n\tcolor: ${ COLORS.gray[ 300 ] };\n\tfont-size: 11px;\n\tposition: absolute;\n\ttop: 8px;\n\twhite-space: nowrap;\n\n\t${ rtl( { left: 0 } ) };\n\t${ rtl(\n\t\t{ transform: 'translateX( -50% )' },\n\t\t{ transform: 'translateX( 50% )' }\n\t) };\n\n\t${ markLabelFill };\n`;\n\nconst thumbColor = ( { disabled }: ThumbProps ) =>\n\tdisabled\n\t\t? css`\n\t\t\t\tbackground-color: ${ COLORS.gray[ 400 ] };\n\t\t `\n\t\t: css`\n\t\t\t\tbackground-color: ${ COLORS.theme.accent };\n\t\t `;\n\nexport const ThumbWrapper = styled.span`\n\talign-items: center;\n\tdisplay: flex;\n\theight: ${ thumbSize }px;\n\tjustify-content: center;\n\tmargin-top: ${ ( rangeHeightValue - thumbSize ) / 2 }px;\n\toutline: 0;\n\tpointer-events: none;\n\tposition: absolute;\n\ttop: 0;\n\tuser-select: none;\n\twidth: ${ thumbSize }px;\n\tborder-radius: ${ CONFIG.radiusRound };\n\tz-index: 3;\n\n\t.is-marked & {\n\t\t@media not ( prefers-reduced-motion ) {\n\t\t\ttransition: left ease 0.1s;\n\t\t}\n\t}\n\n\t${ thumbColor };\n\t${ rtl( { marginLeft: -10 } ) };\n\t${ rtl(\n\t\t{ transform: 'translateX( 4.5px )' },\n\t\t{ transform: 'translateX( -4.5px )' }\n\t) };\n`;\n\nconst thumbFocus = ( { isFocused }: ThumbProps ) => {\n\treturn isFocused\n\t\t? css`\n\t\t\t\t&::before {\n\t\t\t\t\tcontent: ' ';\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tbackground-color: ${ COLORS.theme.accent };\n\t\t\t\t\topacity: 0.4;\n\t\t\t\t\tborder-radius: ${ CONFIG.radiusRound };\n\t\t\t\t\theight: ${ thumbSize + 8 }px;\n\t\t\t\t\twidth: ${ thumbSize + 8 }px;\n\t\t\t\t\ttop: -4px;\n\t\t\t\t\tleft: -4px;\n\t\t\t\t}\n\t\t `\n\t\t: '';\n};\n\nexport const Thumb = styled.span< ThumbProps >`\n\talign-items: center;\n\tborder-radius: ${ CONFIG.radiusRound };\n\theight: 100%;\n\toutline: 0;\n\tposition: absolute;\n\tuser-select: none;\n\twidth: 100%;\n\tbox-shadow: ${ CONFIG.elevationXSmall };\n\n\t${ thumbColor };\n\t${ thumbFocus };\n`;\n\nexport const InputRange = styled.input`\n\tbox-sizing: border-box;\n\tcursor: pointer;\n\tdisplay: block;\n\theight: 100%;\n\tleft: 0;\n\tmargin: 0 -${ thumbSize / 2 }px;\n\topacity: 0;\n\toutline: none;\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\twidth: calc( 100% + ${ thumbSize }px );\n`;\n\nconst tooltipShow = ( { show }: TooltipProps ) => {\n\treturn css`\n\t\tdisplay: ${ show ? 'inline-block' : 'none' };\n\t\topacity: ${ show ? 1 : 0 };\n\n\t\t@media not ( prefers-reduced-motion ) {\n\t\t\ttransition:\n\t\t\t\topacity 120ms ease,\n\t\t\t\tdisplay 120ms ease allow-discrete;\n\t\t}\n\n\t\t@starting-style {\n\t\t\topacity: 0;\n\t\t}\n\t`;\n};\n\nconst tooltipPosition = ( { position }: TooltipProps ) => {\n\tconst isBottom = position === 'bottom';\n\n\tif ( isBottom ) {\n\t\treturn css`\n\t\t\tbottom: -80%;\n\t\t`;\n\t}\n\n\treturn css`\n\t\ttop: -80%;\n\t`;\n};\n\nexport const Tooltip = styled.span< TooltipProps >`\n\tbackground: rgba( 0, 0, 0, 0.8 );\n\tborder-radius: ${ CONFIG.radiusSmall };\n\tcolor: white;\n\tfont-size: 12px;\n\tmin-width: 32px;\n\tpadding: 4px 8px;\n\tpointer-events: none;\n\tposition: absolute;\n\ttext-align: center;\n\tuser-select: none;\n\tline-height: 1.4;\n\n\t${ tooltipShow };\n\n\t${ tooltipPosition };\n\t${ rtl(\n\t\t{ transform: 'translateX(-50%)' },\n\t\t{ transform: 'translateX(50%)' }\n\t) }\n`;\n\n// @todo Refactor RangeControl with latest HStack configuration\n// @see: packages/components/src/h-stack\nexport const InputNumber = styled( NumberControl )`\n\tdisplay: inline-block;\n\tfont-size: 13px;\n\tmargin-top: 0;\n\n\tinput[type='number']& {\n\t\t${ rangeHeight };\n\t}\n\n\t${ rtl( { marginLeft: `${ space( 4 ) } !important` } ) }\n`;\n\nexport const ActionRightWrapper = styled.span`\n\tdisplay: block;\n\tmargin-top: 0;\n\n\tbutton,\n\tbutton.is-small {\n\t\tmargin-left: 0;\n\t\t${ rangeHeight };\n\t}\n\n\t${ rtl( { marginLeft: 8 } ) }\n`;\n"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,GAAG,QAAQ,gBAAgB;AAGpC;AACA;AACA;AACA,OAAOC,aAAa,MAAM,sBAAsB;AAChD,SAASC,MAAM,EAAEC,GAAG,EAAEC,MAAM,QAAQ,aAAa;AACjD,SAASC,KAAK,QAAQ,mBAAmB;AAYzC,MAAMC,gBAAgB,GAAG,EAAE;AAC3B,MAAMC,UAAU,GAAG,CAAC;AACpB,MAAMC,WA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ACfxE,GAAG,CACL;EAAEyD,SAAS,EAAE;AAAmB,CAAC,EACjC;EAAEA,SAAS,EAAE;AAAkB,CAChC,CAAC,SAAAjD,OAAA,CAAAC,GAAA,CAAAC,QAAA,4tVACD;;AAED;AACA;AACA,OAAO,MAAMmE,WAAW,gBAAG9D,OAAA,CAAQjB,aAAa,EAAAU,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAM,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,CAAC,CAAC,4EAM7CZ,WAAW,QAGZL,GAAG,CAAE;EAAEkC,UAAU,EAAE,GAAIhC,KAAK,CAAE,CAAE,CAAC;AAAe,CAAE,CAAC,SAAAM,OAAA,CAAAC,GAAA,CAAAC,QAAA,4tVACtD;AAED,OAAO,MAAMoE,kBAAkB,gBAAA/D,OAAA,SAAAP,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAM,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,uEAO1BZ,WAAW,QAGZL,GAAG,CAAE;EAAEkC,UAAU,EAAE;AAAE,CAAE,CAAC,SAAA1B,OAAA,CAAAC,GAAA,CAAAC,QAAA,4tVAC3B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","clsx","Resizable","ResizeTooltip","jsx","_jsx","jsxs","_jsxs","HANDLE_CLASS_NAME","SIDE_HANDLE_CLASS_NAME","CORNER_HANDLE_CLASS_NAME","HANDLE_CLASSES","top","right","bottom","left","topLeft","topRight","bottomRight","bottomLeft","HANDLE_STYLES_OVERRIDES","width","undefined","height","HANDLE_STYLES","UnforwardedResizableBox","className","children","showHandle","__experimentalShowTooltip","showTooltip","__experimentalTooltipProps","tooltipProps","props","ref","handleComponent","Object","fromEntries","keys","map","key","tabIndex","handleClasses","handleStyles","ResizableBox"],"sources":["@wordpress/components/src/resizable-box/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { Resizable } from 're-resizable';\nimport type { ResizableProps } from 're-resizable';\nimport type { ReactNode, ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport ResizeTooltip from './resize-tooltip';\n\nconst HANDLE_CLASS_NAME = 'components-resizable-box__handle';\nconst SIDE_HANDLE_CLASS_NAME = 'components-resizable-box__side-handle';\nconst CORNER_HANDLE_CLASS_NAME = 'components-resizable-box__corner-handle';\n\nconst HANDLE_CLASSES = {\n\ttop: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top'\n\t),\n\tright: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottom: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom'\n\t),\n\tleft: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-left'\n\t),\n\ttopLeft: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top',\n\t\t'components-resizable-box__handle-left'\n\t),\n\ttopRight: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top',\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottomRight: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom',\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottomLeft: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom',\n\t\t'components-resizable-box__handle-left'\n\t),\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDES = {\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\nconst HANDLE_STYLES = {\n\ttop: HANDLE_STYLES_OVERRIDES,\n\tright: HANDLE_STYLES_OVERRIDES,\n\tbottom: HANDLE_STYLES_OVERRIDES,\n\tleft: HANDLE_STYLES_OVERRIDES,\n\ttopLeft: HANDLE_STYLES_OVERRIDES,\n\ttopRight: HANDLE_STYLES_OVERRIDES,\n\tbottomRight: HANDLE_STYLES_OVERRIDES,\n\tbottomLeft: HANDLE_STYLES_OVERRIDES,\n};\n\ntype ResizableBoxProps = ResizableProps & {\n\tchildren: ReactNode;\n\tshowHandle?: boolean;\n\t__experimentalShowTooltip?: boolean;\n\t__experimentalTooltipProps?: Parameters< typeof ResizeTooltip >[ 0 ];\n};\n\nfunction UnforwardedResizableBox(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tshowHandle = true,\n\t\t__experimentalShowTooltip: showTooltip = false,\n\t\t__experimentalTooltipProps: tooltipProps = {},\n\t\t...props\n\t}: ResizableBoxProps,\n\tref: ForwardedRef< Resizable >\n): JSX.Element {\n\treturn (\n\t\t<Resizable\n\t\t\tclassName={ clsx(\n\t\t\t\t'components-resizable-box__container',\n\t\t\t\tshowHandle && 'has-show-handle',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t// Add a focusable element within the drag handle. Unfortunately,\n\t\t\t// `re-resizable` does not make them properly focusable by default,\n\t\t\t// causing focus to move the the block wrapper which triggers block\n\t\t\t// drag.\n\t\t\thandleComponent={ Object.fromEntries(\n\t\t\t\tObject.keys( HANDLE_CLASSES ).map( ( key ) => [\n\t\t\t\t\tkey,\n\t\t\t\t\t<div key={ key } tabIndex={ -1 } />,\n\t\t\t\t] )\n\t\t\t) }\n\t\t\thandleClasses={ HANDLE_CLASSES }\n\t\t\thandleStyles={ HANDLE_STYLES }\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t\t{ showTooltip && <ResizeTooltip { ...tooltipProps } /> }\n\t\t</Resizable>\n\t);\n}\n\nexport const ResizableBox = forwardRef( UnforwardedResizableBox );\n\nexport default ResizableBox;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,SAAS,QAAQ,cAAc;AAIxC;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7C,MAAMC,iBAAiB,GAAG,kCAAkC;AAC5D,MAAMC,sBAAsB,GAAG,uCAAuC;AACtE,MAAMC,wBAAwB,GAAG,yCAAyC;AAE1E,MAAMC,cAAc,GAAG;EACtBC,GAAG,EAAEX,IAAI,CACRO,iBAAiB,EACjBC,sBAAsB,EACtB,sCACD,CAAC;EACDI,KAAK,EAAEZ,IAAI,CACVO,iBAAiB,EACjBC,sBAAsB,EACtB,wCACD,CAAC;EACDK,MAAM,EAAEb,IAAI,CACXO,iBAAiB,EACjBC,sBAAsB,EACtB,yCACD,CAAC;EACDM,IAAI,EAAEd,IAAI,CACTO,iBAAiB,EACjBC,sBAAsB,EACtB,uCACD,CAAC;EACDO,OAAO,EAAEf,IAAI,CACZO,iBAAiB,EACjBE,wBAAwB,EACxB,sCAAsC,EACtC,uCACD,CAAC;EACDO,QAAQ,EAAEhB,IAAI,CACbO,iBAAiB,EACjBE,wBAAwB,EACxB,sCAAsC,EACtC,wCACD,CAAC;EACDQ,WAAW,EAAEjB,IAAI,CAChBO,iBAAiB,EACjBE,wBAAwB,EACxB,yCAAyC,EACzC,wCACD,CAAC;EACDS,UAAU,EAAElB,IAAI,CACfO,iBAAiB,EACjBE,wBAAwB,EACxB,yCAAyC,EACzC,uCACD;AACD,CAAC;;AAED;AACA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CAAC;AAEd;AAEA,OAAO,MAAMY,YAAY,GAAG5C,UAAU,CAAEyB,uBAAwB,CAAC;AAEjE,eAAemB,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["forwardRef","clsx","Resizable","ResizeTooltip","jsx","_jsx","jsxs","_jsxs","HANDLE_CLASS_NAME","SIDE_HANDLE_CLASS_NAME","CORNER_HANDLE_CLASS_NAME","HANDLE_CLASSES","top","right","bottom","left","topLeft","topRight","bottomRight","bottomLeft","HANDLE_STYLES_OVERRIDES","width","undefined","height","HANDLE_STYLES","UnforwardedResizableBox","className","children","showHandle","__experimentalShowTooltip","showTooltip","__experimentalTooltipProps","tooltipProps","props","ref","handleComponent","Object","fromEntries","keys","map","key","tabIndex","handleClasses","handleStyles","ResizableBox"],"sources":["@wordpress/components/src/resizable-box/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { Resizable } from 're-resizable';\nimport type { ResizableProps } from 're-resizable';\nimport type { ReactNode, ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport ResizeTooltip from './resize-tooltip';\n\nconst HANDLE_CLASS_NAME = 'components-resizable-box__handle';\nconst SIDE_HANDLE_CLASS_NAME = 'components-resizable-box__side-handle';\nconst CORNER_HANDLE_CLASS_NAME = 'components-resizable-box__corner-handle';\n\nconst HANDLE_CLASSES = {\n\ttop: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top'\n\t),\n\tright: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottom: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom'\n\t),\n\tleft: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tSIDE_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-left'\n\t),\n\ttopLeft: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top',\n\t\t'components-resizable-box__handle-left'\n\t),\n\ttopRight: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-top',\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottomRight: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom',\n\t\t'components-resizable-box__handle-right'\n\t),\n\tbottomLeft: clsx(\n\t\tHANDLE_CLASS_NAME,\n\t\tCORNER_HANDLE_CLASS_NAME,\n\t\t'components-resizable-box__handle-bottom',\n\t\t'components-resizable-box__handle-left'\n\t),\n};\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDES = {\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\nconst HANDLE_STYLES = {\n\ttop: HANDLE_STYLES_OVERRIDES,\n\tright: HANDLE_STYLES_OVERRIDES,\n\tbottom: HANDLE_STYLES_OVERRIDES,\n\tleft: HANDLE_STYLES_OVERRIDES,\n\ttopLeft: HANDLE_STYLES_OVERRIDES,\n\ttopRight: HANDLE_STYLES_OVERRIDES,\n\tbottomRight: HANDLE_STYLES_OVERRIDES,\n\tbottomLeft: HANDLE_STYLES_OVERRIDES,\n};\n\ntype ResizableBoxProps = ResizableProps & {\n\tchildren: ReactNode;\n\tshowHandle?: boolean;\n\t__experimentalShowTooltip?: boolean;\n\t__experimentalTooltipProps?: Parameters< typeof ResizeTooltip >[ 0 ];\n};\n\nfunction UnforwardedResizableBox(\n\t{\n\t\tclassName,\n\t\tchildren,\n\t\tshowHandle = true,\n\t\t__experimentalShowTooltip: showTooltip = false,\n\t\t__experimentalTooltipProps: tooltipProps = {},\n\t\t...props\n\t}: ResizableBoxProps,\n\tref: ForwardedRef< Resizable >\n): JSX.Element {\n\treturn (\n\t\t<Resizable\n\t\t\tclassName={ clsx(\n\t\t\t\t'components-resizable-box__container',\n\t\t\t\tshowHandle && 'has-show-handle',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\t// Add a focusable element within the drag handle. Unfortunately,\n\t\t\t// `re-resizable` does not make them properly focusable by default,\n\t\t\t// causing focus to move the the block wrapper which triggers block\n\t\t\t// drag.\n\t\t\thandleComponent={ Object.fromEntries(\n\t\t\t\tObject.keys( HANDLE_CLASSES ).map( ( key ) => [\n\t\t\t\t\tkey,\n\t\t\t\t\t<div key={ key } tabIndex={ -1 } />,\n\t\t\t\t] )\n\t\t\t) }\n\t\t\thandleClasses={ HANDLE_CLASSES }\n\t\t\thandleStyles={ HANDLE_STYLES }\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ children }\n\t\t\t{ showTooltip && <ResizeTooltip { ...tooltipProps } /> }\n\t\t</Resizable>\n\t);\n}\n\nexport const ResizableBox = forwardRef( UnforwardedResizableBox );\n\nexport default ResizableBox;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,SAAS,QAAQ,cAAc;AAIxC;AACA;AACA;AACA,OAAOC,aAAa,MAAM,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE7C,MAAMC,iBAAiB,GAAG,kCAAkC;AAC5D,MAAMC,sBAAsB,GAAG,uCAAuC;AACtE,MAAMC,wBAAwB,GAAG,yCAAyC;AAE1E,MAAMC,cAAc,GAAG;EACtBC,GAAG,EAAEX,IAAI,CACRO,iBAAiB,EACjBC,sBAAsB,EACtB,sCACD,CAAC;EACDI,KAAK,EAA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B,EAChB;EACd,oBACC3B,KAAA,CAACL,SAAS;IACTwB,SAAS,EAAGzB,IAAI,CACf,qCAAqC,EACrC2B,UAAU,IAAI,iBAAiB,EAC/BF,SACD;IACA;IACA;IACA;IACA;IAAA;IACAS,eAAe,EAAGC,MAAM,CAACC,WAAW,CACnCD,MAAM,CAACE,IAAI,CAAE3B,cAAe,CAAC,CAAC4B,GAAG,CAAIC,GAAG,IAAM,CAC7CA,GAAG,eACHnC,IAAA;MAAiBoC,QAAQ,EAAG,CAAC;IAAG,GAArBD,GAAuB,CAAC,CAClC,CACH,CAAG;IACHE,aAAa,EAAG/B,cAAgB;IAChCgC,YAAY,EAAGnB,aAAe;IAC9BU,GAAG,EAAGA,GAAK;IAAA,GACND,KAAK;IAAAN,QAAA,GAERA,QAAQ,EACRG,WAAW,iBAAIzB,IAAA,CAACF,aAAa;MAAA,GAAM6B;IAAY,CAAI,CAAC;EAAA,CAC5C,CAAC;AAEd;AAEA,OAAO,MAAMY,YAAY,GAAG5C,UAAU,CAAEyB,uBAAwB,CAAC;AAEjE,eAAemB,YAAY","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["renderToString","useRef","useState","useEffect","useFocusableIframe","useMergeRefs","jsx","_jsx","jsxs","_jsxs","observeAndResizeJS","MutationObserver","window","document","body","parent","sendResize","clientBoundingRect","getBoundingClientRect","postMessage","action","width","height","observer","observe","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","addEventListener","removeViewportStyles","ruleOrNode","style","forEach","test","Array","prototype","call","querySelectorAll","styleSheets","stylesheet","cssRules","rules","position","setAttribute","SandBox","html","title","type","styles","scripts","onFocus","tabIndex","ref","setWidth","setHeight","isFrameAccessible","current","contentDocument","e","trySandBox","forceRerender","ownerDocument","getAttribute","htmlDoc","lang","documentElement","className","children","dangerouslySetInnerHTML","__html","map","i","toString","src","open","write","close","tryNoForceSandBox","checkMessageForResize","event","iframe","contentWindow","source","data","JSON","parse","defaultView","removeEventListener","sandbox","Math","ceil"],"sources":["@wordpress/components/src/sandbox/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\trenderToString,\n\tuseRef,\n\tuseState,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useFocusableIframe, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport type { SandBoxProps } from './types';\n\nconst observeAndResizeJS = function () {\n\tconst { MutationObserver } = window;\n\n\tif ( ! MutationObserver || ! document.body || ! window.parent ) {\n\t\treturn;\n\t}\n\n\tfunction sendResize() {\n\t\tconst clientBoundingRect = document.body.getBoundingClientRect();\n\n\t\twindow.parent.postMessage(\n\t\t\t{\n\t\t\t\taction: 'resize',\n\t\t\t\twidth: clientBoundingRect.width,\n\t\t\t\theight: clientBoundingRect.height,\n\t\t\t},\n\t\t\t'*'\n\t\t);\n\t}\n\n\tconst observer = new MutationObserver( sendResize );\n\tobserver.observe( document.body, {\n\t\tattributes: true,\n\t\tattributeOldValue: false,\n\t\tcharacterData: true,\n\t\tcharacterDataOldValue: false,\n\t\tchildList: true,\n\t\tsubtree: true,\n\t} );\n\n\twindow.addEventListener( 'load', sendResize, true );\n\n\t// Hack: Remove viewport unit styles, as these are relative\n\t// the iframe root and interfere with our mechanism for\n\t// determining the unconstrained page bounds.\n\tfunction removeViewportStyles( ruleOrNode: ElementCSSInlineStyle ) {\n\t\tif ( ruleOrNode.style ) {\n\t\t\t(\n\t\t\t\t[ 'width', 'height', 'minHeight', 'maxHeight' ] as const\n\t\t\t ).forEach( function ( style ) {\n\t\t\t\tif (\n\t\t\t\t\t/^\\\\d+(vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test(\n\t\t\t\t\t\truleOrNode.style[ style ]\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\truleOrNode.style[ style ] = '';\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tArray.prototype.forEach.call(\n\t\tdocument.querySelectorAll( '[style]' ),\n\t\tremoveViewportStyles\n\t);\n\tArray.prototype.forEach.call(\n\t\tdocument.styleSheets,\n\t\tfunction ( stylesheet ) {\n\t\t\tArray.prototype.forEach.call(\n\t\t\t\tstylesheet.cssRules || stylesheet.rules,\n\t\t\t\tremoveViewportStyles\n\t\t\t);\n\t\t}\n\t);\n\n\tdocument.body.style.position = 'absolute';\n\tdocument.body.style.width = '100%';\n\tdocument.body.setAttribute( 'data-resizable-iframe-connected', '' );\n\n\tsendResize();\n\n\t// Resize events can change the width of elements with 100% width, but we don't\n\t// get an DOM mutations for that, so do the resize when the window is resized, too.\n\twindow.addEventListener( 'resize', sendResize, true );\n};\n\n// TODO: These styles shouldn't be coupled with WordPress.\nconst style = `\n\tbody {\n\t\tmargin: 0;\n\t}\n\thtml,\n\tbody,\n\tbody > div {\n\t\twidth: 100%;\n\t}\n\thtml.wp-has-aspect-ratio,\n\tbody.wp-has-aspect-ratio,\n\tbody.wp-has-aspect-ratio > div,\n\tbody.wp-has-aspect-ratio > div iframe {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\toverflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */\n\t}\n\tbody > div > * {\n\t\tmargin-top: 0 !important; /* Has to have !important to override inline styles. */\n\t\tmargin-bottom: 0 !important;\n\t}\n`;\n\n/**\n * This component provides an isolated environment for arbitrary HTML via iframes.\n *\n * ```jsx\n * import { SandBox } from '@wordpress/components';\n *\n * const MySandBox = () => (\n * \t<SandBox html=\"<p>Content</p>\" title=\"SandBox\" type=\"embed\" />\n * );\n * ```\n */\nfunction SandBox( {\n\thtml = '',\n\ttitle = '',\n\ttype,\n\tstyles = [],\n\tscripts = [],\n\tonFocus,\n\ttabIndex,\n}: SandBoxProps ) {\n\tconst ref = useRef< HTMLIFrameElement >();\n\tconst [ width, setWidth ] = useState( 0 );\n\tconst [ height, setHeight ] = useState( 0 );\n\n\tfunction isFrameAccessible() {\n\t\ttry {\n\t\t\treturn !! ref.current?.contentDocument?.body;\n\t\t} catch ( e ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction trySandBox( forceRerender = false ) {\n\t\tif ( ! isFrameAccessible() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { contentDocument, ownerDocument } =\n\t\t\tref.current as HTMLIFrameElement & {\n\t\t\t\tcontentDocument: Document;\n\t\t\t};\n\n\t\tif (\n\t\t\t! forceRerender &&\n\t\t\tnull !==\n\t\t\t\tcontentDocument?.body.getAttribute(\n\t\t\t\t\t'data-resizable-iframe-connected'\n\t\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Put the html snippet into a html document, and then write it to the iframe's document\n\t\t// we can use this in the future to inject custom styles or scripts.\n\t\t// Scripts go into the body rather than the head, to support embedded content such as Instagram\n\t\t// that expect the scripts to be part of the body.\n\t\tconst htmlDoc = (\n\t\t\t<html\n\t\t\t\tlang={ ownerDocument.documentElement.lang }\n\t\t\t\tclassName={ type }\n\t\t\t>\n\t\t\t\t<head>\n\t\t\t\t\t<title>{ title }</title>\n\t\t\t\t\t<style dangerouslySetInnerHTML={ { __html: style } } />\n\t\t\t\t\t{ styles.map( ( rules, i ) => (\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ { __html: rules } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</head>\n\t\t\t\t<body\n\t\t\t\t\tdata-resizable-iframe-connected=\"data-resizable-iframe-connected\"\n\t\t\t\t\tclassName={ type }\n\t\t\t\t>\n\t\t\t\t\t<div dangerouslySetInnerHTML={ { __html: html } } />\n\t\t\t\t\t<script\n\t\t\t\t\t\ttype=\"text/javascript\"\n\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t__html: `(${ observeAndResizeJS.toString() })();`,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ scripts.map( ( src ) => (\n\t\t\t\t\t\t<script key={ src } src={ src } />\n\t\t\t\t\t) ) }\n\t\t\t\t</body>\n\t\t\t</html>\n\t\t);\n\n\t\t// Writing the document like this makes it act in the same way as if it was\n\t\t// loaded over the network, so DOM creation and mutation, script execution, etc.\n\t\t// all work as expected.\n\t\tcontentDocument.open();\n\t\tcontentDocument.write( '<!DOCTYPE html>' + renderToString( htmlDoc ) );\n\t\tcontentDocument.close();\n\t}\n\n\tuseEffect( () => {\n\t\ttrySandBox();\n\n\t\tfunction tryNoForceSandBox() {\n\t\t\ttrySandBox( false );\n\t\t}\n\n\t\tfunction checkMessageForResize( event: MessageEvent ) {\n\t\t\tconst iframe = ref.current;\n\n\t\t\t// Verify that the mounted element is the source of the message.\n\t\t\tif ( ! iframe || iframe.contentWindow !== event.source ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Attempt to parse the message data as JSON if passed as string.\n\t\t\tlet data = event.data || {};\n\n\t\t\tif ( 'string' === typeof data ) {\n\t\t\t\ttry {\n\t\t\t\t\tdata = JSON.parse( data );\n\t\t\t\t} catch ( e ) {}\n\t\t\t}\n\n\t\t\t// Update the state only if the message is formatted as we expect,\n\t\t\t// i.e. as an object with a 'resize' action.\n\t\t\tif ( 'resize' !== data.action ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetWidth( data.width );\n\t\t\tsetHeight( data.height );\n\t\t}\n\n\t\tconst iframe = ref.current;\n\t\tconst defaultView = iframe?.ownerDocument?.defaultView;\n\n\t\t// This used to be registered using <iframe onLoad={} />, but it made the iframe blank\n\t\t// after reordering the containing block. See these two issues for more details:\n\t\t// https://github.com/WordPress/gutenberg/issues/6146\n\t\t// https://github.com/facebook/react/issues/18752\n\t\tiframe?.addEventListener( 'load', tryNoForceSandBox, false );\n\t\tdefaultView?.addEventListener( 'message', checkMessageForResize );\n\n\t\treturn () => {\n\t\t\tiframe?.removeEventListener( 'load', tryNoForceSandBox, false );\n\t\t\tdefaultView?.removeEventListener(\n\t\t\t\t'message',\n\t\t\t\tcheckMessageForResize\n\t\t\t);\n\t\t};\n\t\t// Passing `exhaustive-deps` will likely involve a more detailed refactor.\n\t\t// See https://github.com/WordPress/gutenberg/pull/44378\n\t}, [] );\n\n\tuseEffect( () => {\n\t\ttrySandBox();\n\t\t// Passing `exhaustive-deps` will likely involve a more detailed refactor.\n\t\t// See https://github.com/WordPress/gutenberg/pull/44378\n\t}, [ title, styles, scripts ] );\n\n\tuseEffect( () => {\n\t\ttrySandBox( true );\n\t\t// Passing `exhaustive-deps` will likely involve a more detailed refactor.\n\t\t// See https://github.com/WordPress/gutenberg/pull/44378\n\t}, [ html, type ] );\n\n\treturn (\n\t\t<iframe\n\t\t\tref={ useMergeRefs( [ ref, useFocusableIframe() ] ) }\n\t\t\ttitle={ title }\n\t\t\ttabIndex={ tabIndex }\n\t\t\tclassName=\"components-sandbox\"\n\t\t\tsandbox=\"allow-scripts allow-same-origin allow-presentation\"\n\t\t\tonFocus={ onFocus }\n\t\t\twidth={ Math.ceil( width ) }\n\t\t\theight={ Math.ceil( height ) }\n\t\t/>\n\t);\n}\n\nexport default SandBox;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,cAAc,EACdC,MAAM,EACNC,QAAQ,EACRC,SAAS,QACH,oBAAoB;AAC3B,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,oBAAoB;;AAErE;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAKA,MAAMC,kBAAkB,GAAG,SAAAA,CAAA,EAAY;EACtC,MAAM;IAAEC;EAAiB,CAAC,GAAGC,MAAM;EAEnC,IAAK,CAAED,gBAAgB,IAAI,CAAEE,QAAQ,CAACC,IAAI,IAAI,CAAEF,MAAM,CAACG,MAAM,EAAG;IAC/D;EACD;EAEA,SAASC,UAAUA,CAAA,EAAG;IACrB,MAAMC,kBAAkB,GAAGJ,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,CAAC;MAC/DS,WAAW,EAAEC,mBAAmB,CAC/B,SAAS,EACTT,qBACD,CAAC;IACF,CAAC;IACD;IACA;EACD,CAAC,EAAE,EAAG,CAAC;EAEP9E,SAAS,CAAE,MAAM;IAChB2D,UAAU,CAAC,CAAC;IACZ;IACA;EACD,CAAC,EAAE,CAAEb,KAAK,EAAEE,MAAM,EAAEC,OAAO,CAAG,CAAC;EAE/BjD,SAAS,CAAE,MAAM;IAChB2D,UAAU,CAAE,IAAK,CAAC;IAClB;IACA;EACD,CAAC,EAAE,CAAEd,IAAI,EAAEE,IAAI,CAAG,CAAC;EAEnB,oBACC3C,IAAA;IACCgD,GAAG,EAAGlD,YAAY,CAAE,CAAEkD,GAAG,EAAEnD,kBAAkB,CAAC,CAAC,CAAG,CAAG;IACrD6C,KAAK,EAAGA,KAAO;IACfK,QAAQ,EAAGA,QAAU;IACrBe,SAAS,EAAC,oBAAoB;IAC9BsB,OAAO,EAAC,oDAAoD;IAC5DtC,OAAO,EAAGA,OAAS;IACnBhC,KAAK,EAAGuE,IAAI,CAACC,IAAI,CAAExE,KAAM,CAAG;IAC5BC,MAAM,EAAGsE,IAAI,CAACC,IAAI,CAAEvE,MAAO;EAAG,CAC9B,CAAC;AAEJ;AAEA,eAAeyB,OAAO","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["renderToString","useRef","useState","useEffect","useFocusableIframe","useMergeRefs","jsx","_jsx","jsxs","_jsxs","observeAndResizeJS","MutationObserver","window","document","body","parent","sendResize","clientBoundingRect","getBoundingClientRect","postMessage","action","width","height","observer","observe","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","addEventListener","removeViewportStyles","ruleOrNode","style","forEach","test","Array","prototype","call","querySelectorAll","styleSheets","stylesheet","cssRules","rules","position","setAttribute","SandBox","html","title","type","styles","scripts","onFocus","tabIndex","ref","setWidth","setHeight","isFrameAccessible","current","contentDocument","e","trySandBox","forceRerender","ownerDocument","getAttribute","htmlDoc","lang","documentElement","className","children","dangerouslySetInnerHTML","__html","map","i","toString","src","open","write","close","tryNoForceSandBox","checkMessageForResize","event","iframe","contentWindow","source","data","JSON","parse","defaultView","removeEventListener","sandbox","Math","ceil"],"sources":["@wordpress/components/src/sandbox/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\trenderToString,\n\tuseRef,\n\tuseState,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useFocusableIframe, useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport type { SandBoxProps } from './types';\n\nconst observeAndResizeJS = function () {\n\tconst { MutationObserver } = window;\n\n\tif ( ! MutationObserver || ! document.body || ! window.parent ) {\n\t\treturn;\n\t}\n\n\tfunction sendResize() {\n\t\tconst clientBoundingRect = document.body.getBoundingClientRect();\n\n\t\twindow.parent.postMessage(\n\t\t\t{\n\t\t\t\taction: 'resize',\n\t\t\t\twidth: clientBoundingRect.width,\n\t\t\t\theight: clientBoundingRect.height,\n\t\t\t},\n\t\t\t'*'\n\t\t);\n\t}\n\n\tconst observer = new MutationObserver( sendResize );\n\tobserver.observe( document.body, {\n\t\tattributes: true,\n\t\tattributeOldValue: false,\n\t\tcharacterData: true,\n\t\tcharacterDataOldValue: false,\n\t\tchildList: true,\n\t\tsubtree: true,\n\t} );\n\n\twindow.addEventListener( 'load', sendResize, true );\n\n\t// Hack: Remove viewport unit styles, as these are relative\n\t// the iframe root and interfere with our mechanism for\n\t// determining the unconstrained page bounds.\n\tfunction removeViewportStyles( ruleOrNode: ElementCSSInlineStyle ) {\n\t\tif ( ruleOrNode.style ) {\n\t\t\t(\n\t\t\t\t[ 'width', 'height', 'minHeight', 'maxHeight' ] as const\n\t\t\t ).forEach( function ( style ) {\n\t\t\t\tif (\n\t\t\t\t\t/^\\\\d+(vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test(\n\t\t\t\t\t\truleOrNode.style[ style ]\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\truleOrNode.style[ style ] = '';\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t}\n\n\tArray.prototype.forEach.call(\n\t\tdocument.querySelectorAll( '[style]' ),\n\t\tremoveViewportStyles\n\t);\n\tArray.prototype.forEach.call(\n\t\tdocument.styleSheets,\n\t\tfunction ( stylesheet ) {\n\t\t\tArray.prototype.forEach.call(\n\t\t\t\tstylesheet.cssRules || stylesheet.rules,\n\t\t\t\tremoveViewportStyles\n\t\t\t);\n\t\t}\n\t);\n\n\tdocument.body.style.position = 'absolute';\n\tdocument.body.style.width = '100%';\n\tdocument.body.setAttribute( 'data-resizable-iframe-connected', '' );\n\n\tsendResize();\n\n\t// Resize events can change the width of elements with 100% width, but we don't\n\t// get an DOM mutations for that, so do the resize when the window is resized, too.\n\twindow.addEventListener( 'resize', sendResize, true );\n};\n\n// TODO: These styles shouldn't be coupled with WordPress.\nconst style = `\n\tbody {\n\t\tmargin: 0;\n\t}\n\thtml,\n\tbody,\n\tbody > div {\n\t\twidth: 100%;\n\t}\n\thtml.wp-has-aspect-ratio,\n\tbody.wp-has-aspect-ratio,\n\tbody.wp-has-aspect-ratio > div,\n\tbody.wp-has-aspect-ratio > div iframe {\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\toverflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */\n\t}\n\tbody > div > * {\n\t\tmargin-top: 0 !important; /* Has to have !important to override inline styles. */\n\t\tmargin-bottom: 0 !important;\n\t}\n`;\n\n/**\n * This component provides an isolated environment for arbitrary HTML via iframes.\n *\n * ```jsx\n * import { SandBox } from '@wordpress/components';\n *\n * const MySandBox = () => (\n * \t<SandBox html=\"<p>Content</p>\" title=\"SandBox\" type=\"embed\" />\n * );\n * ```\n */\nfunction SandBox( {\n\thtml = '',\n\ttitle = '',\n\ttype,\n\tstyles = [],\n\tscripts = [],\n\tonFocus,\n\ttabIndex,\n}: SandBoxProps ) {\n\tconst ref = useRef< HTMLIFrameElement >();\n\tconst [ width, setWidth ] = useState( 0 );\n\tconst [ height, setHeight ] = useState( 0 );\n\n\tfunction isFrameAccessible() {\n\t\ttry {\n\t\t\treturn !! ref.current?.contentDocument?.body;\n\t\t} catch ( e ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tfunction trySandBox( forceRerender = false ) {\n\t\tif ( ! isFrameAccessible() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { contentDocument, ownerDocument } =\n\t\t\tref.current as HTMLIFrameElement & {\n\t\t\t\tcontentDocument: Document;\n\t\t\t};\n\n\t\tif (\n\t\t\t! forceRerender &&\n\t\t\tnull !==\n\t\t\t\tcontentDocument?.body.getAttribute(\n\t\t\t\t\t'data-resizable-iframe-connected'\n\t\t\t\t)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Put the html snippet into a html document, and then write it to the iframe's document\n\t\t// we can use this in the future to inject custom styles or scripts.\n\t\t// Scripts go into the body rather than the head, to support embedded content such as Instagram\n\t\t// that expect the scripts to be part of the body.\n\t\tconst htmlDoc = (\n\t\t\t<html\n\t\t\t\tlang={ ownerDocument.documentElement.lang }\n\t\t\t\tclassName={ type }\n\t\t\t>\n\t\t\t\t<head>\n\t\t\t\t\t<title>{ title }</title>\n\t\t\t\t\t<style dangerouslySetInnerHTML={ { __html: style } } />\n\t\t\t\t\t{ styles.map( ( rules, i ) => (\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ { __html: rules } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</head>\n\t\t\t\t<body\n\t\t\t\t\tdata-resizable-iframe-connected=\"data-resizable-iframe-connected\"\n\t\t\t\t\tclassName={ type }\n\t\t\t\t>\n\t\t\t\t\t<div dangerouslySetInnerHTML={ { __html: html } } />\n\t\t\t\t\t<script\n\t\t\t\t\t\ttype=\"text/javascript\"\n\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t__html: `(${ observeAndResizeJS.toString() })();`,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t{ scripts.map( ( src ) => (\n\t\t\t\t\t\t<script key={ src } src={ src } />\n\t\t\t\t\t) ) }\n\t\t\t\t</body>\n\t\t\t</html>\n\t\t);\n\n\t\t// Writing the document like this makes it act in the same way as if it was\n\t\t// loaded over the network, so DOM creation and mutation, script execution, etc.\n\t\t// all work as expected.\n\t\tcontentDocument.open();\n\t\tcontentDocument.write( '<!DOCTYPE html>' + renderToString( htmlDoc ) );\n\t\tcontentDocument.close();\n\t}\n\n\tuseEffect( () => {\n\t\ttrySandBox();\n\n\t\tfunction tryNoForceSandBox() {\n\t\t\ttrySandBox( false );\n\t\t}\n\n\t\tfunction checkMessageForResize( event: MessageEvent ) {\n\t\t\tconst iframe = ref.current;\n\n\t\t\t// Verify that the mounted element is the source of the message.\n\t\t\tif ( ! iframe || iframe.contentWindow !== event.source ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Attempt to parse the message data as JSON if passed as string.\n\t\t\tlet data = event.data || {};\n\n\t\t\tif ( 'string' === typeof data ) {\n\t\t\t\ttry {\n\t\t\t\t\tdata = JSON.parse( data );\n\t\t\t\t} catch ( e ) {}\n\t\t\t}\n\n\t\t\t// Update the state only if the message is formatted as we expect,\n\t\t\t// i.e. as an object with a 'resize' action.\n\t\t\tif ( 'resize' !== data.action ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetWidth( data.width );\n\t\t\tsetHeight( data.height );\n\t\t}\n\n\t\tconst iframe = ref.current;\n\t\tconst defaultView = iframe?.ownerDocument?.defaultView;\n\n\t\t// This used to be registered using <iframe onLoad={} />, but it made the iframe blank\n\t\t// after reordering the containing block. See these two issues for more details:\n\t\t// https://github.com/WordPress/gutenberg/issues/6146\n\t\t// https://github.com/facebook/react/issues/18752\n\t\tiframe?.addEventListener( 'load', tryNoForceSandBox, false );\n\t\tdefaultView?.addEventListener( 'message', checkMessageForResize );\n\n\t\treturn () => {\n\t\t\tiframe?.removeEventListener( 'load', tryNoForceSandBox, false );\n\t\t\tdefaultView?.removeEventListener(\n\t\t\t\t'message',\n\t\t\t\tcheckMessageForResize\n\t\t\t);\n\t\t};\n\t\t// Passing `exhaustive-deps` will likely involve a more detailed refactor.\n\t\t// See https://github.com/WordPress/gutenberg/pull/44378\n\t}, [] );\n\n\tuseEffect( () => {\n\t\ttrySandBox();\n\t\t// Passing `exhaustive-deps` will likely involve a more detailed refactor.\n\t\t// See https://github.com/WordPress/gutenberg/pull/44378\n\t}, [ title, styles, scripts ] );\n\n\tuseEffect( () => {\n\t\ttrySandBox( true );\n\t\t// Passing `exhaustive-deps` will likely involve a more detailed refactor.\n\t\t// See https://github.com/WordPress/gutenberg/pull/44378\n\t}, [ html, type ] );\n\n\treturn (\n\t\t<iframe\n\t\t\tref={ useMergeRefs( [ ref, useFocusableIframe() ] ) }\n\t\t\ttitle={ title }\n\t\t\ttabIndex={ tabIndex }\n\t\t\tclassName=\"components-sandbox\"\n\t\t\tsandbox=\"allow-scripts allow-same-origin allow-presentation\"\n\t\t\tonFocus={ onFocus }\n\t\t\twidth={ Math.ceil( width ) }\n\t\t\theight={ Math.ceil( height ) }\n\t\t/>\n\t);\n}\n\nexport default SandBox;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,cAAc,EACdC,MAAM,EACNC,QAAQ,EACRC,SAAS,QACH,oBAAoB;AAC3B,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,oBAAoB;;AAErE;AACA;AACA;AAFA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAKA,MAAMC,kBAAkB,GAAG,SAAAA,CAAA,EAAY;EACtC,MAAM;IAAEC;EAAiB,CAAC,GAAGC,MAAM;EAEnC,IAAK,CAAED,gBAAgB,IAAI,CAAEE,QAAQ,CAACC,IAAI,IAAI,CAAEF,M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AsB,CAAC;IAEjE,OAAO,MAAM;MACZE,MAAM,EAAEO,mBAAmB,CAAE,MAAM,EAAEV,iBAAiB,EAAE,KAAM,CAAC;MAC/DS,WAAW,EAAEC,mBAAmB,CAC/B,SAAS,EACTT,qBACD,CAAC;IACF,CAAC;IACD;IACA;EACD,CAAC,EAAE,EAAG,CAAC;EAEP9E,SAAS,CAAE,MAAM;IAChB2D,UAAU,CAAC,CAAC;IACZ;IACA;EACD,CAAC,EAAE,CAAEb,KAAK,EAAEE,MAAM,EAAEC,OAAO,CAAG,CAAC;EAE/BjD,SAAS,CAAE,MAAM;IAChB2D,UAAU,CAAE,IAAK,CAAC;IAClB;IACA;EACD,CAAC,EAAE,CAAEd,IAAI,EAAEE,IAAI,CAAG,CAAC;EAEnB,oBACC3C,IAAA;IACCgD,GAAG,EAAGlD,YAAY,CAAE,CAAEkD,GAAG,EAAEnD,kBAAkB,CAAC,CAAC,CAAG,CAAG;IACrD6C,KAAK,EAAGA,KAAO;IACfK,QAAQ,EAAGA,QAAU;IACrBe,SAAS,EAAC,oBAAoB;IAC9BsB,OAAO,EAAC,oDAAoD;IAC5DtC,OAAO,EAAGA,OAAS;IACnBhC,KAAK,EAAGuE,IAAI,CAACC,IAAI,CAAExE,KAAM,CAAG;IAC5BC,MAAM,EAAGsE,IAAI,CAACC,IAAI,CAAEvE,MAAO;EAAG,CAC9B,CAAC;AAEJ;AAEA,eAAeyB,OAAO","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Dimensions","StyleSheet","WebView","Platform","renderToString","memo","useRef","useState","useEffect","forwardRef","useCallback","usePreferredColorScheme","sandboxStyles","jsx","_jsx","jsxs","_jsxs","observeAndResizeJS","style","EMPTY_ARRAY","Sandbox","containerStyle","customJS","html","lang","providerUrl","scripts","styles","title","type","url","onWindowEvents","viewportProps","onLoadEnd","testID","ref","colorScheme","height","setHeight","contentHtml","setContentHtml","getHtmlDoc","windowSize","get","isLandscape","setIsLandscape","width","wasLandscape","key","select","android","ios","addViewportProps","trim","replace","htmlDoc","children","name","content","dangerouslySetInnerHTML","__html","map","rules","i","className","src","getInjectedJavaScript","injectedJS","Object","keys","forEach","eventType","updateContentHtml","forceRerender","newContentHtml","setImmediate","getSizeStyle","contentHeight","Math","ceil","aspectRatio","onChangeDimensions","dimensions","window","onMessage","message","data","nativeEvent","JSON","parse","e","action","console","warn","dimensionsChangeSubscription","addEventListener","remove","current","injectedJavaScript","source","baseUrl","originWhitelist","isAndroid","workaroundStyles","webView","scrollEnabled","setBuiltInZoomControls","showsHorizontalScrollIndicator","showsVerticalScrollIndicator","mediaPlaybackRequiresUserAction","create","opacity"],"sources":["@wordpress/components/src/sandbox/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Dimensions, StyleSheet } from 'react-native';\nimport { WebView } from 'react-native-webview';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPlatform,\n\trenderToString,\n\tmemo,\n\tuseRef,\n\tuseState,\n\tuseEffect,\n\tforwardRef,\n\tuseCallback,\n} from '@wordpress/element';\nimport { usePreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport sandboxStyles from './style.scss';\n\nconst observeAndResizeJS = `\n\t(function() {\n\t\tconst { MutationObserver } = window;\n\n\t\tif ( ! MutationObserver || ! document.body || ! window.parent ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction sendResize() {\n\t\t\tconst clientBoundingRect = document.body.getBoundingClientRect();\n\n\t\t\t// The function postMessage is exposed by the react-native-webview library\n\t\t\t// to communicate between React Native and the WebView, in this case,\n\t\t\t// we use it for notifying resize changes.\n\t\t\twindow.ReactNativeWebView.postMessage(\n\t\t\t\tJSON.stringify( {\n\t\t\t\t\taction: 'resize',\n\t\t\t\t\twidth: clientBoundingRect.width,\n\t\t\t\t\theight: clientBoundingRect.height,\n\t\t\t\t} )\n\t\t\t);\n\t\t}\n\n\t\tconst observer = new MutationObserver( sendResize );\n\t\tobserver.observe( document.body, {\n\t\t\tattributes: true,\n\t\t\tattributeOldValue: false,\n\t\t\tcharacterData: true,\n\t\t\tcharacterDataOldValue: false,\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t} );\n\n\t\twindow.addEventListener( 'load', sendResize, true );\n\n\t\t// Hack: Remove viewport unit styles, as these are relative\n\t\t// the iframe root and interfere with our mechanism for\n\t\t// determining the unconstrained page bounds.\n\t\tfunction removeViewportStyles( ruleOrNode ) {\n\t\t\tif ( ruleOrNode.style ) {\n\t\t\t\t[ 'width', 'height', 'minHeight', 'maxHeight' ].forEach( function (\n\t\t\t\t\tstyle\n\t\t\t\t) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t/^\\\\d+(vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test( ruleOrNode.style[ style ] )\n\t\t\t\t\t) {\n\t\t\t\t\t\truleOrNode.style[ style ] = '';\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.querySelectorAll( '[style]' ),\n\t\t\tremoveViewportStyles\n\t\t);\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.styleSheets,\n\t\t\tfunction ( stylesheet ) {\n\t\t\t\tArray.prototype.forEach.call(\n\t\t\t\t\tstylesheet.cssRules || stylesheet.rules,\n\t\t\t\t\tremoveViewportStyles\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\n\t\tdocument.body.style.position = 'absolute';\n\t\tdocument.body.style.width = '100%';\n\t\tdocument.body.setAttribute( 'data-resizable-iframe-connected', '' );\n\n\t\tsendResize();\n\n\t\t// Resize events can change the width of elements with 100% width, but we don't\n\t\t// get an DOM mutations for that, so do the resize when the window is resized, too.\n\t\twindow.addEventListener( 'resize', sendResize, true );\n\t\twindow.addEventListener( 'orientationchange', sendResize, true );\n\t})();\n`;\n\nconst style = `\n\tbody {\n\t\tmargin: 0;\n\t}\n\thtml,\n\tbody,\n\tbody > div,\n\tbody > div iframe {\n\t\twidth: 100%;\n\t}\n\tbody > div > * {\n\t\tmargin-top: 0 !important; /* Has to have !important to override inline styles. */\n\t\tmargin-bottom: 0 !important;\n\t}\n\n\t.wp-block-embed__wrapper {\n\t\tposition: relative;\n\t}\n\n\tbody.wp-has-aspect-ratio > div iframe {\n\t\theight: 100%;\n\t\toverflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */\n\t}\n\n\t/**\n\t * Add responsiveness to embeds with aspect ratios.\n\t *\n\t * These styles have been copied from the web version (https://github.com/WordPress/gutenberg/blob/7901895ca20cf61e402925e31571d659dab64721/packages/block-library/src/embed/style.scss#L42-L89) and\n\t * adapted for the native version.\n\t */\n\t.wp-has-aspect-ratio.wp-block-embed__wrapper::before {\n\t\tcontent: \"\";\n\t\tdisplay: block;\n\t\tpadding-top: 50%; // Default to 2:1 aspect ratio.\n\t}\n\t.wp-has-aspect-ratio iframe {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\t.wp-embed-aspect-21-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 42.85%; // 9 / 21 * 100\n\t}\n\t.wp-embed-aspect-18-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 50%; // 9 / 18 * 100\n\t}\n\t.wp-embed-aspect-16-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 56.25%; // 9 / 16 * 100\n\t}\n\t.wp-embed-aspect-4-3.wp-block-embed__wrapper::before {\n\t\tpadding-top: 75%; // 3 / 4 * 100\n\t}\n\t.wp-embed-aspect-1-1.wp-block-embed__wrapper::before {\n\t\tpadding-top: 100%; // 1 / 1 * 100\n\t}\n\t.wp-embed-aspect-9-16.wp-block-embed__wrapper::before {\n\t\tpadding-top: 177.77%; // 16 / 9 * 100\n\t}\n\t.wp-embed-aspect-1-2.wp-block-embed__wrapper::before {\n\t\tpadding-top: 200%; // 2 / 1 * 100\n\t}\n`;\n\nconst EMPTY_ARRAY = [];\n\nconst Sandbox = forwardRef( function Sandbox(\n\t{\n\t\tcontainerStyle,\n\t\tcustomJS,\n\t\thtml = '',\n\t\tlang = 'en',\n\t\tproviderUrl = '',\n\t\tscripts = EMPTY_ARRAY,\n\t\tstyles = EMPTY_ARRAY,\n\t\ttitle = '',\n\t\ttype,\n\t\turl,\n\t\tonWindowEvents = {},\n\t\tviewportProps = '',\n\t\tonLoadEnd = () => {},\n\t\ttestID,\n\t},\n\tref\n) {\n\tconst colorScheme = usePreferredColorScheme();\n\tconst [ height, setHeight ] = useState( 0 );\n\tconst [ contentHtml, setContentHtml ] = useState( getHtmlDoc() );\n\n\tconst windowSize = Dimensions.get( 'window' );\n\tconst [ isLandscape, setIsLandscape ] = useState(\n\t\twindowSize.width >= windowSize.height\n\t);\n\tconst wasLandscape = useRef( isLandscape );\n\t// On Android, we need to recreate the WebView on any of the following actions, otherwise it disappears:\n\t// - Device rotation\n\t// - Light/dark mode changes\n\t// For this purpose, the key prop used in the WebView will be updated with the value of the actions.\n\tconst key = Platform.select( {\n\t\tandroid: `${ url }-${\n\t\t\tisLandscape ? 'landscape' : 'portrait'\n\t\t}-${ colorScheme }`,\n\t\tios: url,\n\t} );\n\n\tfunction getHtmlDoc() {\n\t\t// Put the html snippet into a html document, and update the state to refresh the WebView,\n\t\t// we can use this in the future to inject custom styles or scripts.\n\t\t// Scripts go into the body rather than the head, to support embedded content such as Instagram\n\t\t// that expect the scripts to be part of the body.\n\n\t\t// Avoid comma issues with props.viewportProps.\n\t\tconst addViewportProps = viewportProps\n\t\t\t.trim()\n\t\t\t.replace( /(^[^,])/, ', $1' );\n\n\t\tconst htmlDoc = (\n\t\t\t<html lang={ lang }>\n\t\t\t\t<head>\n\t\t\t\t\t<title>{ title }</title>\n\t\t\t\t\t<meta\n\t\t\t\t\t\tname=\"viewport\"\n\t\t\t\t\t\tcontent={ `width=device-width, initial-scale=1${ addViewportProps }` }\n\t\t\t\t\t></meta>\n\t\t\t\t\t<style dangerouslySetInnerHTML={ { __html: style } } />\n\t\t\t\t\t{ styles.map( ( rules, i ) => (\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ { __html: rules } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</head>\n\t\t\t\t<body\n\t\t\t\t\tdata-resizable-iframe-connected=\"data-resizable-iframe-connected\"\n\t\t\t\t\tclassName={ type }\n\t\t\t\t>\n\t\t\t\t\t<div dangerouslySetInnerHTML={ { __html: html } } />\n\t\t\t\t\t{ scripts.map( ( src ) => (\n\t\t\t\t\t\t<script key={ src } src={ src } />\n\t\t\t\t\t) ) }\n\t\t\t\t</body>\n\t\t\t</html>\n\t\t);\n\t\treturn '<!DOCTYPE html>' + renderToString( htmlDoc );\n\t}\n\n\tconst getInjectedJavaScript = useCallback( () => {\n\t\t// Allow parent to override the resize observers with prop.customJS (legacy support)\n\t\tlet injectedJS = customJS || observeAndResizeJS;\n\n\t\t// Add any event listeners that were passed in.\n\t\tObject.keys( onWindowEvents ).forEach( ( eventType ) => {\n\t\t\tinjectedJS += `\n\t\t\t\twindow.addEventListener( '${ eventType }', function( event ) {\n\t\t\t\t\twindow.ReactNativeWebView.postMessage( JSON.stringify( { type: '${ eventType }', ...event.data } ) );\n\t\t\t\t});`;\n\t\t} );\n\n\t\treturn injectedJS;\n\t}, [ customJS, onWindowEvents ] );\n\n\tfunction updateContentHtml( forceRerender = false ) {\n\t\tconst newContentHtml = getHtmlDoc();\n\n\t\tif ( forceRerender && contentHtml === newContentHtml ) {\n\t\t\t// The re-render is forced by updating the state with empty HTML,\n\t\t\t// waiting for the JS code to be executed with \"setImmediate\" and then\n\t\t\t// setting the content HTML again.\n\t\t\tsetContentHtml( '' );\n\t\t\tsetImmediate( () => setContentHtml( newContentHtml ) );\n\t\t} else {\n\t\t\tsetContentHtml( newContentHtml );\n\t\t}\n\t}\n\n\tfunction getSizeStyle() {\n\t\tconst contentHeight = Math.ceil( height );\n\n\t\treturn contentHeight ? { height: contentHeight } : { aspectRatio: 1 };\n\t}\n\n\tfunction onChangeDimensions( dimensions ) {\n\t\tsetIsLandscape( dimensions.window.width >= dimensions.window.height );\n\t}\n\n\tconst onMessage = useCallback(\n\t\t( message ) => {\n\t\t\tlet data = message?.nativeEvent?.data;\n\n\t\t\ttry {\n\t\t\t\tdata = JSON.parse( data );\n\t\t\t} catch ( e ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// check for resize event\n\t\t\tif ( 'resize' === data?.action ) {\n\t\t\t\tsetHeight( data.height );\n\t\t\t}\n\n\t\t\t// Forward the event to parent event listeners\n\t\t\tObject.keys( onWindowEvents ).forEach( ( eventType ) => {\n\t\t\t\tif ( data?.type === eventType ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tonWindowEvents[ eventType ]( data );\n\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`Error handling event ${ eventType }`,\n\t\t\t\t\t\t\te\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\t[ onWindowEvents ]\n\t);\n\n\tuseEffect( () => {\n\t\tconst dimensionsChangeSubscription = Dimensions.addEventListener(\n\t\t\t'change',\n\t\t\tonChangeDimensions\n\t\t);\n\t\treturn () => {\n\t\t\tdimensionsChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tupdateContentHtml();\n\t\t// See https://github.com/WordPress/gutenberg/pull/41166\n\t}, [ html, title, type, styles, scripts ] );\n\n\tuseEffect( () => {\n\t\t// When device orientation changes we have to recalculate the size,\n\t\t// for this purpose we reset the current size value.\n\t\tif ( wasLandscape.current !== isLandscape ) {\n\t\t\tsetHeight( 0 );\n\t\t}\n\t\twasLandscape.current = isLandscape;\n\t}, [ isLandscape ] );\n\n\treturn (\n\t\t<WebView\n\t\t\tcontainerStyle={ [\n\t\t\t\tsandboxStyles[ 'sandbox-webview__container' ],\n\t\t\t\tcontainerStyle,\n\t\t\t] }\n\t\t\tinjectedJavaScript={ getInjectedJavaScript() }\n\t\t\tkey={ key }\n\t\t\tref={ ref }\n\t\t\tsource={ { baseUrl: providerUrl, html: contentHtml } }\n\t\t\t// Wildcard value is required for static HTML\n\t\t\t// Reference: https://github.com/react-native-webview/react-native-webview/blob/master/docs/Reference.md#source\n\t\t\toriginWhitelist={ [ '*' ] }\n\t\t\tstyle={ [\n\t\t\t\tsandboxStyles[ 'sandbox-webview__content' ],\n\t\t\t\tgetSizeStyle(),\n\t\t\t\tPlatform.isAndroid && workaroundStyles.webView,\n\t\t\t] }\n\t\t\tonMessage={ onMessage }\n\t\t\tscrollEnabled={ false }\n\t\t\tsetBuiltInZoomControls={ false }\n\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\tshowsVerticalScrollIndicator={ false }\n\t\t\tmediaPlaybackRequiresUserAction={ false }\n\t\t\tonLoadEnd={ onLoadEnd }\n\t\t\ttestID={ testID }\n\t\t/>\n\t);\n} );\n\nconst workaroundStyles = StyleSheet.create( {\n\twebView: {\n\t\t/**\n\t\t * The slight opacity below is a workaround for an Android crash caused from combining Android\n\t\t * 12's new scroll overflow behavior and webviews.\n\t\t * https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-808869253\n\t\t */\n\t\topacity: 0.99,\n\t},\n} );\n\nexport default memo( Sandbox );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,cAAc;AACrD,SAASC,OAAO,QAAQ,sBAAsB;;AAE9C;AACA;AACA;AACA,SACCC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,MAAM,EACNC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,WAAW,QACL,oBAAoB;AAC3B,SAASC,uBAAuB,QAAQ,oBAAoB;;AAE5D;AACA;AACA;AACA,OAAOC,aAAa,MAAM,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEzC,MAAMC,kBAAkB,GAAG;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,KAAK,GAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,WAAW,GAAG,EAAE;AAEtB,MAAMC,OAAO,GAAGX,UAAU,CAAE,SAASW,OAAOA,CAC3C;EACCC,cAAc;EACdC,QAAQ;EACRC,IAAI,GAAG,EAAE;EACTC,IAAI,GAAG,IAAI;EACXC,WAAW,GAAG,EAAE;EAChBC,OAAO,GAAGP,WAAW;EACrBQ,MAAM,GAAGR,WAAW;EACpBS,KAAK,GAAG,EAAE;EACVC,IAAI;EACJC,GAAG;EACHC,cAAc,GAAG,CAAC,CAAC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AAE;EAC3CN,OAAO,EAAE;IACR;AACF;AACA;AACA;AACA;IACEO,OAAO,EAAE;EACV;AACD,CAAE,CAAC;AAEH,eAAe1G,IAAI,CAAEe,OAAQ,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Dimensions","StyleSheet","WebView","Platform","renderToString","memo","useRef","useState","useEffect","forwardRef","useCallback","usePreferredColorScheme","sandboxStyles","jsx","_jsx","jsxs","_jsxs","observeAndResizeJS","style","EMPTY_ARRAY","Sandbox","containerStyle","customJS","html","lang","providerUrl","scripts","styles","title","type","url","onWindowEvents","viewportProps","onLoadEnd","testID","ref","colorScheme","height","setHeight","contentHtml","setContentHtml","getHtmlDoc","windowSize","get","isLandscape","setIsLandscape","width","wasLandscape","key","select","android","ios","addViewportProps","trim","replace","htmlDoc","children","name","content","dangerouslySetInnerHTML","__html","map","rules","i","className","src","getInjectedJavaScript","injectedJS","Object","keys","forEach","eventType","updateContentHtml","forceRerender","newContentHtml","setImmediate","getSizeStyle","contentHeight","Math","ceil","aspectRatio","onChangeDimensions","dimensions","window","onMessage","message","data","nativeEvent","JSON","parse","e","action","console","warn","dimensionsChangeSubscription","addEventListener","remove","current","injectedJavaScript","source","baseUrl","originWhitelist","isAndroid","workaroundStyles","webView","scrollEnabled","setBuiltInZoomControls","showsHorizontalScrollIndicator","showsVerticalScrollIndicator","mediaPlaybackRequiresUserAction","create","opacity"],"sources":["@wordpress/components/src/sandbox/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Dimensions, StyleSheet } from 'react-native';\nimport { WebView } from 'react-native-webview';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tPlatform,\n\trenderToString,\n\tmemo,\n\tuseRef,\n\tuseState,\n\tuseEffect,\n\tforwardRef,\n\tuseCallback,\n} from '@wordpress/element';\nimport { usePreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport sandboxStyles from './style.scss';\n\nconst observeAndResizeJS = `\n\t(function() {\n\t\tconst { MutationObserver } = window;\n\n\t\tif ( ! MutationObserver || ! document.body || ! window.parent ) {\n\t\t\treturn;\n\t\t}\n\n\t\tfunction sendResize() {\n\t\t\tconst clientBoundingRect = document.body.getBoundingClientRect();\n\n\t\t\t// The function postMessage is exposed by the react-native-webview library\n\t\t\t// to communicate between React Native and the WebView, in this case,\n\t\t\t// we use it for notifying resize changes.\n\t\t\twindow.ReactNativeWebView.postMessage(\n\t\t\t\tJSON.stringify( {\n\t\t\t\t\taction: 'resize',\n\t\t\t\t\twidth: clientBoundingRect.width,\n\t\t\t\t\theight: clientBoundingRect.height,\n\t\t\t\t} )\n\t\t\t);\n\t\t}\n\n\t\tconst observer = new MutationObserver( sendResize );\n\t\tobserver.observe( document.body, {\n\t\t\tattributes: true,\n\t\t\tattributeOldValue: false,\n\t\t\tcharacterData: true,\n\t\t\tcharacterDataOldValue: false,\n\t\t\tchildList: true,\n\t\t\tsubtree: true,\n\t\t} );\n\n\t\twindow.addEventListener( 'load', sendResize, true );\n\n\t\t// Hack: Remove viewport unit styles, as these are relative\n\t\t// the iframe root and interfere with our mechanism for\n\t\t// determining the unconstrained page bounds.\n\t\tfunction removeViewportStyles( ruleOrNode ) {\n\t\t\tif ( ruleOrNode.style ) {\n\t\t\t\t[ 'width', 'height', 'minHeight', 'maxHeight' ].forEach( function (\n\t\t\t\t\tstyle\n\t\t\t\t) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t/^\\\\d+(vw|vh|svw|lvw|dvw|svh|lvh|dvh|vi|svi|lvi|dvi|vb|svb|lvb|dvb|vmin|svmin|lvmin|dvmin|vmax|svmax|lvmax|dvmax)$/.test( ruleOrNode.style[ style ] )\n\t\t\t\t\t) {\n\t\t\t\t\t\truleOrNode.style[ style ] = '';\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.querySelectorAll( '[style]' ),\n\t\t\tremoveViewportStyles\n\t\t);\n\t\tArray.prototype.forEach.call(\n\t\t\tdocument.styleSheets,\n\t\t\tfunction ( stylesheet ) {\n\t\t\t\tArray.prototype.forEach.call(\n\t\t\t\t\tstylesheet.cssRules || stylesheet.rules,\n\t\t\t\t\tremoveViewportStyles\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\n\t\tdocument.body.style.position = 'absolute';\n\t\tdocument.body.style.width = '100%';\n\t\tdocument.body.setAttribute( 'data-resizable-iframe-connected', '' );\n\n\t\tsendResize();\n\n\t\t// Resize events can change the width of elements with 100% width, but we don't\n\t\t// get an DOM mutations for that, so do the resize when the window is resized, too.\n\t\twindow.addEventListener( 'resize', sendResize, true );\n\t\twindow.addEventListener( 'orientationchange', sendResize, true );\n\t})();\n`;\n\nconst style = `\n\tbody {\n\t\tmargin: 0;\n\t}\n\thtml,\n\tbody,\n\tbody > div,\n\tbody > div iframe {\n\t\twidth: 100%;\n\t}\n\tbody > div > * {\n\t\tmargin-top: 0 !important; /* Has to have !important to override inline styles. */\n\t\tmargin-bottom: 0 !important;\n\t}\n\n\t.wp-block-embed__wrapper {\n\t\tposition: relative;\n\t}\n\n\tbody.wp-has-aspect-ratio > div iframe {\n\t\theight: 100%;\n\t\toverflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */\n\t}\n\n\t/**\n\t * Add responsiveness to embeds with aspect ratios.\n\t *\n\t * These styles have been copied from the web version (https://github.com/WordPress/gutenberg/blob/7901895ca20cf61e402925e31571d659dab64721/packages/block-library/src/embed/style.scss#L42-L89) and\n\t * adapted for the native version.\n\t */\n\t.wp-has-aspect-ratio.wp-block-embed__wrapper::before {\n\t\tcontent: \"\";\n\t\tdisplay: block;\n\t\tpadding-top: 50%; // Default to 2:1 aspect ratio.\n\t}\n\t.wp-has-aspect-ratio iframe {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\theight: 100%;\n\t\twidth: 100%;\n\t}\n\t.wp-embed-aspect-21-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 42.85%; // 9 / 21 * 100\n\t}\n\t.wp-embed-aspect-18-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 50%; // 9 / 18 * 100\n\t}\n\t.wp-embed-aspect-16-9.wp-block-embed__wrapper::before {\n\t\tpadding-top: 56.25%; // 9 / 16 * 100\n\t}\n\t.wp-embed-aspect-4-3.wp-block-embed__wrapper::before {\n\t\tpadding-top: 75%; // 3 / 4 * 100\n\t}\n\t.wp-embed-aspect-1-1.wp-block-embed__wrapper::before {\n\t\tpadding-top: 100%; // 1 / 1 * 100\n\t}\n\t.wp-embed-aspect-9-16.wp-block-embed__wrapper::before {\n\t\tpadding-top: 177.77%; // 16 / 9 * 100\n\t}\n\t.wp-embed-aspect-1-2.wp-block-embed__wrapper::before {\n\t\tpadding-top: 200%; // 2 / 1 * 100\n\t}\n`;\n\nconst EMPTY_ARRAY = [];\n\nconst Sandbox = forwardRef( function Sandbox(\n\t{\n\t\tcontainerStyle,\n\t\tcustomJS,\n\t\thtml = '',\n\t\tlang = 'en',\n\t\tproviderUrl = '',\n\t\tscripts = EMPTY_ARRAY,\n\t\tstyles = EMPTY_ARRAY,\n\t\ttitle = '',\n\t\ttype,\n\t\turl,\n\t\tonWindowEvents = {},\n\t\tviewportProps = '',\n\t\tonLoadEnd = () => {},\n\t\ttestID,\n\t},\n\tref\n) {\n\tconst colorScheme = usePreferredColorScheme();\n\tconst [ height, setHeight ] = useState( 0 );\n\tconst [ contentHtml, setContentHtml ] = useState( getHtmlDoc() );\n\n\tconst windowSize = Dimensions.get( 'window' );\n\tconst [ isLandscape, setIsLandscape ] = useState(\n\t\twindowSize.width >= windowSize.height\n\t);\n\tconst wasLandscape = useRef( isLandscape );\n\t// On Android, we need to recreate the WebView on any of the following actions, otherwise it disappears:\n\t// - Device rotation\n\t// - Light/dark mode changes\n\t// For this purpose, the key prop used in the WebView will be updated with the value of the actions.\n\tconst key = Platform.select( {\n\t\tandroid: `${ url }-${\n\t\t\tisLandscape ? 'landscape' : 'portrait'\n\t\t}-${ colorScheme }`,\n\t\tios: url,\n\t} );\n\n\tfunction getHtmlDoc() {\n\t\t// Put the html snippet into a html document, and update the state to refresh the WebView,\n\t\t// we can use this in the future to inject custom styles or scripts.\n\t\t// Scripts go into the body rather than the head, to support embedded content such as Instagram\n\t\t// that expect the scripts to be part of the body.\n\n\t\t// Avoid comma issues with props.viewportProps.\n\t\tconst addViewportProps = viewportProps\n\t\t\t.trim()\n\t\t\t.replace( /(^[^,])/, ', $1' );\n\n\t\tconst htmlDoc = (\n\t\t\t<html lang={ lang }>\n\t\t\t\t<head>\n\t\t\t\t\t<title>{ title }</title>\n\t\t\t\t\t<meta\n\t\t\t\t\t\tname=\"viewport\"\n\t\t\t\t\t\tcontent={ `width=device-width, initial-scale=1${ addViewportProps }` }\n\t\t\t\t\t></meta>\n\t\t\t\t\t<style dangerouslySetInnerHTML={ { __html: style } } />\n\t\t\t\t\t{ styles.map( ( rules, i ) => (\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tkey={ i }\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ { __html: rules } }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) ) }\n\t\t\t\t</head>\n\t\t\t\t<body\n\t\t\t\t\tdata-resizable-iframe-connected=\"data-resizable-iframe-connected\"\n\t\t\t\t\tclassName={ type }\n\t\t\t\t>\n\t\t\t\t\t<div dangerouslySetInnerHTML={ { __html: html } } />\n\t\t\t\t\t{ scripts.map( ( src ) => (\n\t\t\t\t\t\t<script key={ src } src={ src } />\n\t\t\t\t\t) ) }\n\t\t\t\t</body>\n\t\t\t</html>\n\t\t);\n\t\treturn '<!DOCTYPE html>' + renderToString( htmlDoc );\n\t}\n\n\tconst getInjectedJavaScript = useCallback( () => {\n\t\t// Allow parent to override the resize observers with prop.customJS (legacy support)\n\t\tlet injectedJS = customJS || observeAndResizeJS;\n\n\t\t// Add any event listeners that were passed in.\n\t\tObject.keys( onWindowEvents ).forEach( ( eventType ) => {\n\t\t\tinjectedJS += `\n\t\t\t\twindow.addEventListener( '${ eventType }', function( event ) {\n\t\t\t\t\twindow.ReactNativeWebView.postMessage( JSON.stringify( { type: '${ eventType }', ...event.data } ) );\n\t\t\t\t});`;\n\t\t} );\n\n\t\treturn injectedJS;\n\t}, [ customJS, onWindowEvents ] );\n\n\tfunction updateContentHtml( forceRerender = false ) {\n\t\tconst newContentHtml = getHtmlDoc();\n\n\t\tif ( forceRerender && contentHtml === newContentHtml ) {\n\t\t\t// The re-render is forced by updating the state with empty HTML,\n\t\t\t// waiting for the JS code to be executed with \"setImmediate\" and then\n\t\t\t// setting the content HTML again.\n\t\t\tsetContentHtml( '' );\n\t\t\tsetImmediate( () => setContentHtml( newContentHtml ) );\n\t\t} else {\n\t\t\tsetContentHtml( newContentHtml );\n\t\t}\n\t}\n\n\tfunction getSizeStyle() {\n\t\tconst contentHeight = Math.ceil( height );\n\n\t\treturn contentHeight ? { height: contentHeight } : { aspectRatio: 1 };\n\t}\n\n\tfunction onChangeDimensions( dimensions ) {\n\t\tsetIsLandscape( dimensions.window.width >= dimensions.window.height );\n\t}\n\n\tconst onMessage = useCallback(\n\t\t( message ) => {\n\t\t\tlet data = message?.nativeEvent?.data;\n\n\t\t\ttry {\n\t\t\t\tdata = JSON.parse( data );\n\t\t\t} catch ( e ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// check for resize event\n\t\t\tif ( 'resize' === data?.action ) {\n\t\t\t\tsetHeight( data.height );\n\t\t\t}\n\n\t\t\t// Forward the event to parent event listeners\n\t\t\tObject.keys( onWindowEvents ).forEach( ( eventType ) => {\n\t\t\t\tif ( data?.type === eventType ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tonWindowEvents[ eventType ]( data );\n\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`Error handling event ${ eventType }`,\n\t\t\t\t\t\t\te\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\t[ onWindowEvents ]\n\t);\n\n\tuseEffect( () => {\n\t\tconst dimensionsChangeSubscription = Dimensions.addEventListener(\n\t\t\t'change',\n\t\t\tonChangeDimensions\n\t\t);\n\t\treturn () => {\n\t\t\tdimensionsChangeSubscription.remove();\n\t\t};\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tupdateContentHtml();\n\t\t// See https://github.com/WordPress/gutenberg/pull/41166\n\t}, [ html, title, type, styles, scripts ] );\n\n\tuseEffect( () => {\n\t\t// When device orientation changes we have to recalculate the size,\n\t\t// for this purpose we reset the current size value.\n\t\tif ( wasLandscape.current !== isLandscape ) {\n\t\t\tsetHeight( 0 );\n\t\t}\n\t\twasLandscape.current = isLandscape;\n\t}, [ isLandscape ] );\n\n\treturn (\n\t\t<WebView\n\t\t\tcontainerStyle={ [\n\t\t\t\tsandboxStyles[ 'sandbox-webview__container' ],\n\t\t\t\tcontainerStyle,\n\t\t\t] }\n\t\t\tinjectedJavaScript={ getInjectedJavaScript() }\n\t\t\tkey={ key }\n\t\t\tref={ ref }\n\t\t\tsource={ { baseUrl: providerUrl, html: contentHtml } }\n\t\t\t// Wildcard value is required for static HTML\n\t\t\t// Reference: https://github.com/react-native-webview/react-native-webview/blob/master/docs/Reference.md#source\n\t\t\toriginWhitelist={ [ '*' ] }\n\t\t\tstyle={ [\n\t\t\t\tsandboxStyles[ 'sandbox-webview__content' ],\n\t\t\t\tgetSizeStyle(),\n\t\t\t\tPlatform.isAndroid && workaroundStyles.webView,\n\t\t\t] }\n\t\t\tonMessage={ onMessage }\n\t\t\tscrollEnabled={ false }\n\t\t\tsetBuiltInZoomControls={ false }\n\t\t\tshowsHorizontalScrollIndicator={ false }\n\t\t\tshowsVerticalScrollIndicator={ false }\n\t\t\tmediaPlaybackRequiresUserAction={ false }\n\t\t\tonLoadEnd={ onLoadEnd }\n\t\t\ttestID={ testID }\n\t\t/>\n\t);\n} );\n\nconst workaroundStyles = StyleSheet.create( {\n\twebView: {\n\t\t/**\n\t\t * The slight opacity below is a workaround for an Android crash caused from combining Android\n\t\t * 12's new scroll overflow behavior and webviews.\n\t\t * https://github.com/react-native-webview/react-native-webview/issues/1915#issuecomment-808869253\n\t\t */\n\t\topacity: 0.99,\n\t},\n} );\n\nexport default memo( Sandbox );\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,cAAc;AACrD,SAASC,OAAO,QAAQ,sBAAsB;;AAE9C;AACA;AACA;AACA,SACCC,QAAQ,EACRC,cAAc,EACdC,IAAI,EACJC,MAAM,EACNC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,WAAW,QACL,oBAAoB;AAC3B,SAASC,uBAAuB,QAAQ,oBAAoB;;AAE5D;AACA;AACA;AACA,OAAOC,aAAa,MAAM,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEzC,MAAMC,kBAAkB,GAAG;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMC,KAAK,GAAG;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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3BnF,KAAK,EAAG,CACPN,aAAa,CAAE,0BAA0B,CAAE,EAC3CgE,YAAY,CAAC,CAAC,EACdzE,QAAQ,CAACmG,SAAS,IAAIC,gBAAgB,CAACC,OAAO,CAC5C;IACHpB,SAAS,EAAGA,SAAW;IACvBqB,aAAa,EAAG,KAAO;IACvBC,sBAAsB,EAAG,KAAO;IAChCC,8BAA8B,EAAG,KAAO;IACxCC,4BAA4B,EAAG,KAAO;IACtCC,+BAA+B,EAAG,KAAO;IACzC5E,SAAS,EAAGA,SAAW;IACvBC,MAAM,EAAGA;EAAQ,GAlBXc,GAmBN,CAAC;AAEJ,CAAE,CAAC;AAEH,MAAMuD,gBAAgB,GAAGtG,UAAU,CAAC6G,MAAM,CAAE;EAC3CN,OAAO,EAAE;IACR;AACF;AACA;AACA;AACA;IACEO,OAAO,EAAE;EACV;AACD,CAAE,CAAC;AAEH,eAAe1G,IAAI,CAAEe,OAAQ,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TextInput","Text","View","TouchableOpacity","Platform","useColorScheme","Keyboard","useState","useRef","useMemo","useEffect","useCallback","__","Icon","cancelCircleFilled","cancelCircleFilledIcon","arrowLeft","arrowLeftIcon","close","closeIcon","allStyles","platformStyles","Button","Gridicons","jsx","_jsx","jsxs","_jsxs","baseStyles","selector","selectModifiedStyles","styles","modifier","modifierMatcher","RegExp","modifierSelectors","Object","keys","filter","match","reduce","modifiedStyles","modifierSelector","blockElementSelector","split","mergeStyles","updateStyles","selectors","forEach","SearchControl","value","onChange","placeholder","isActive","setIsActive","currentStyles","setCurrentStyles","isDark","inputRef","onCancelTimer","isIOS","OS","darkStyles","activeStyles","activeDarkStyles","futureStyles","mergeFutureStyles","shouldUseConditions","shouldUseModified","every","should","updatedStyles","clearInput","onPress","current","focus","onFocus","onCancel","clearTimeout","setTimeout","blur","onKeyboardDidHide","keyboardHideSubscription","addListener","remove","containerStyle","innerContainerStyle","inputContainerStyle","formInputStyle","placeholderStyle","inputButtonStyle","inputButtonLeftStyle","inputButtonRightStyle","cancelButtonStyle","cancelButtonTextStyle","iconStyle","rightIconStyle","renderLeftButton","button","label","icon","onClick","style","search","fill","color","children","renderRightButton","renderCancel","accessible","accessibilityRole","accessibilityLabel","accessibilityHint","activeOpacity","ref","placeholderTextColor","onChangeText"],"sources":["@wordpress/components/src/search-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tTextInput,\n\tText,\n\tView,\n\tTouchableOpacity,\n\tPlatform,\n\tuseColorScheme,\n\tKeyboard,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseMemo,\n\tuseEffect,\n\tuseCallback,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tcancelCircleFilled as cancelCircleFilledIcon,\n\tarrowLeft as arrowLeftIcon,\n\tclose as closeIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport allStyles from './style.scss';\nimport platformStyles from './platform-style.scss';\nimport Button from '../button';\nimport Gridicons from '../mobile/gridicons';\n\n// Merge platform specific styles with the default styles.\nconst baseStyles = { ...allStyles };\nfor ( const selector in platformStyles ) {\n\tbaseStyles[ selector ] = {\n\t\t...baseStyles[ selector ],\n\t\t...platformStyles[ selector ],\n\t};\n}\n\nfunction selectModifiedStyles( styles, modifier ) {\n\tconst modifierMatcher = new RegExp( `--${ modifier }$` );\n\tconst modifierSelectors = Object.keys( styles ).filter( ( selector ) =>\n\t\tselector.match( modifierMatcher )\n\t);\n\n\treturn modifierSelectors.reduce( ( modifiedStyles, modifierSelector ) => {\n\t\tconst blockElementSelector = modifierSelector.split( '--' )[ 0 ];\n\t\tmodifiedStyles[ blockElementSelector ] = styles[ modifierSelector ];\n\t\treturn modifiedStyles;\n\t}, {} );\n}\n\nfunction mergeStyles( styles, updateStyles, selectors ) {\n\tselectors.forEach( ( selector ) => {\n\t\tstyles[ selector ] = {\n\t\t\t...styles[ selector ],\n\t\t\t...updateStyles[ selector ],\n\t\t};\n\t} );\n\n\treturn styles;\n}\n\nfunction SearchControl( {\n\tvalue,\n\tonChange,\n\tplaceholder = __( 'Search blocks' ),\n} ) {\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst [ currentStyles, setCurrentStyles ] = useState( baseStyles );\n\n\tconst isDark = useColorScheme() === 'dark';\n\tconst inputRef = useRef();\n\tconst onCancelTimer = useRef();\n\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst darkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'dark' );\n\t}, [] );\n\n\tconst activeStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active' );\n\t}, [] );\n\n\tconst activeDarkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active-dark' );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tlet futureStyles = { ...baseStyles };\n\n\t\tfunction mergeFutureStyles( modifiedStyles, shouldUseConditions ) {\n\t\t\tconst shouldUseModified = shouldUseConditions.every(\n\t\t\t\t( should ) => should\n\t\t\t);\n\n\t\t\tconst updatedStyles = shouldUseModified\n\t\t\t\t? modifiedStyles\n\t\t\t\t: futureStyles;\n\n\t\t\tconst selectors = Object.keys( modifiedStyles );\n\n\t\t\tfutureStyles = mergeStyles(\n\t\t\t\tfutureStyles,\n\t\t\t\tupdatedStyles,\n\t\t\t\tselectors\n\t\t\t);\n\t\t}\n\n\t\tmergeFutureStyles( activeStyles, [ isActive ] );\n\t\tmergeFutureStyles( darkStyles, [ isDark ] );\n\t\tmergeFutureStyles( activeDarkStyles, [ isActive, isDark ] );\n\n\t\tsetCurrentStyles( futureStyles );\n\t\t// See https://github.com/WordPress/gutenberg/pull/41166\n\t}, [ isActive, isDark ] );\n\n\tconst clearInput = useCallback( () => {\n\t\tonChange( '' );\n\t}, [ onChange ] );\n\n\tconst onPress = useCallback( () => {\n\t\tsetIsActive( true );\n\t\tinputRef.current?.focus();\n\t}, [] );\n\n\tconst onFocus = useCallback( () => {\n\t\tsetIsActive( true );\n\t}, [] );\n\n\tconst onCancel = useCallback( () => {\n\t\tclearTimeout( onCancelTimer.current );\n\t\tonCancelTimer.current = setTimeout( () => {\n\t\t\tinputRef.current?.blur();\n\t\t\tclearInput();\n\t\t\tsetIsActive( false );\n\t\t}, 0 );\n\t}, [ clearInput ] );\n\n\tconst onKeyboardDidHide = useCallback( () => {\n\t\tif ( ! isIOS ) {\n\t\t\tonCancel();\n\t\t}\n\t}, [ isIOS, onCancel ] );\n\n\tuseEffect( () => {\n\t\tconst keyboardHideSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidHide',\n\t\t\tonKeyboardDidHide\n\t\t);\n\t\treturn () => {\n\t\t\tclearTimeout( onCancelTimer.current );\n\t\t\tkeyboardHideSubscription.remove();\n\t\t};\n\t}, [ onKeyboardDidHide ] );\n\n\tconst {\n\t\t'search-control__container': containerStyle,\n\t\t'search-control__inner-container': innerContainerStyle,\n\t\t'search-control__input-container': inputContainerStyle,\n\t\t'search-control__form-input': formInputStyle,\n\t\t'search-control__form-input-placeholder': placeholderStyle,\n\t\t'search-control__input-button': inputButtonStyle,\n\t\t'search-control__input-button-left': inputButtonLeftStyle,\n\t\t'search-control__input-button-right': inputButtonRightStyle,\n\t\t'search-control__cancel-button': cancelButtonStyle,\n\t\t'search-control__cancel-button-text': cancelButtonTextStyle,\n\t\t'search-control__icon': iconStyle,\n\t\t'search-control__right-icon': rightIconStyle,\n\t} = currentStyles;\n\n\tfunction renderLeftButton() {\n\t\tconst button =\n\t\t\t! isIOS && isActive ? (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Cancel search' ) }\n\t\t\t\t\ticon={ arrowLeftIcon }\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t\tstyle={ iconStyle }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Icon icon={ Gridicons.search } fill={ iconStyle?.color } />\n\t\t\t);\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonLeftStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderRightButton() {\n\t\tlet button;\n\n\t\t// Add a View element to properly center the input placeholder via flexbox.\n\t\tif ( isIOS && ! isActive ) {\n\t\t\tbutton = <View />;\n\t\t}\n\n\t\tif ( !! value ) {\n\t\t\tbutton = (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Clear search' ) }\n\t\t\t\t\ticon={ isIOS ? cancelCircleFilledIcon : closeIcon }\n\t\t\t\t\tonClick={ clearInput }\n\t\t\t\t\tstyle={ [ iconStyle, rightIconStyle ] }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonRightStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderCancel() {\n\t\tif ( ! isIOS ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<View style={ cancelButtonStyle }>\n\t\t\t\t<Text\n\t\t\t\t\tonPress={ onCancel }\n\t\t\t\t\tstyle={ cancelButtonTextStyle }\n\t\t\t\t\taccessible\n\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\taccessibilityLabel={ __( 'Cancel search' ) }\n\t\t\t\t\taccessibilityHint={ __( 'Cancel search' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<TouchableOpacity\n\t\t\tstyle={ containerStyle }\n\t\t\tonPress={ onPress }\n\t\t\tactiveOpacity={ 1 }\n\t\t>\n\t\t\t<View style={ innerContainerStyle }>\n\t\t\t\t<View style={ inputContainerStyle }>\n\t\t\t\t\t{ renderLeftButton() }\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tref={ inputRef }\n\t\t\t\t\t\tstyle={ formInputStyle }\n\t\t\t\t\t\tplaceholderTextColor={ placeholderStyle?.color }\n\t\t\t\t\t\tonChangeText={ onChange }\n\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t/>\n\t\t\t\t\t{ renderRightButton() }\n\t\t\t\t</View>\n\t\t\t\t{ isActive && renderCancel() }\n\t\t\t</View>\n\t\t</TouchableOpacity>\n\t);\n}\n\nexport default SearchControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,IAAI,EACJC,IAAI,EACJC,gBAAgB,EAChBC,QAAQ,EACRC,cAAc,EACdC,QAAQ,QACF,cAAc;;AAErB;AACA;AACA;AACA,SACCC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,WAAW,QACL,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,IAAI,EACJC,kBAAkB,IAAIC,sBAAsB,EAC5CC,SAAS,IAAIC,aAAa,EAC1BC,KAAK,IAAIC,SAAS,QACZ,kBAAkB;;AAEzB;AACA;AACA;AACA,OAAOC,SAAS,MAAM,cAAc;AACpC,OAAOC,cAAc,MAAM,uBAAuB;AAClD,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,SAAS,MAAM,qBAAqB;;AAE3C;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AACA,MAAMC,UAAU,GAAG;EAAE,GAAGR;AAAU,CAAC;AACnC,KAAM,MAAMS,QAAQ,IAAIR,cAAc,EAAG;EACxCO,UAAU,CAAEC,QAAQ,CAAE,GAAG;IACxB,GAAGD,UAAU,CAAEC,QAAQ,CAAE;IACzB,GAAGR,cAAc,CAAEQ,QAAQ;EAC5B,CAAC;AACF;AAEA,SAASC,oBAAoBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EACjD,MAAMC,eAAe,GAAG,IAAIC,MAAM,CAA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U,CAAC;AAErB;AAEA,eAAe3D,aAAa","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["TextInput","Text","View","TouchableOpacity","Platform","useColorScheme","Keyboard","useState","useRef","useMemo","useEffect","useCallback","__","Icon","cancelCircleFilled","cancelCircleFilledIcon","arrowLeft","arrowLeftIcon","close","closeIcon","allStyles","platformStyles","Button","Gridicons","jsx","_jsx","jsxs","_jsxs","baseStyles","selector","selectModifiedStyles","styles","modifier","modifierMatcher","RegExp","modifierSelectors","Object","keys","filter","match","reduce","modifiedStyles","modifierSelector","blockElementSelector","split","mergeStyles","updateStyles","selectors","forEach","SearchControl","value","onChange","placeholder","isActive","setIsActive","currentStyles","setCurrentStyles","isDark","inputRef","onCancelTimer","isIOS","OS","darkStyles","activeStyles","activeDarkStyles","futureStyles","mergeFutureStyles","shouldUseConditions","shouldUseModified","every","should","updatedStyles","clearInput","onPress","current","focus","onFocus","onCancel","clearTimeout","setTimeout","blur","onKeyboardDidHide","keyboardHideSubscription","addListener","remove","containerStyle","innerContainerStyle","inputContainerStyle","formInputStyle","placeholderStyle","inputButtonStyle","inputButtonLeftStyle","inputButtonRightStyle","cancelButtonStyle","cancelButtonTextStyle","iconStyle","rightIconStyle","renderLeftButton","button","label","icon","onClick","style","search","fill","color","children","renderRightButton","renderCancel","accessible","accessibilityRole","accessibilityLabel","accessibilityHint","activeOpacity","ref","placeholderTextColor","onChangeText"],"sources":["@wordpress/components/src/search-control/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tTextInput,\n\tText,\n\tView,\n\tTouchableOpacity,\n\tPlatform,\n\tuseColorScheme,\n\tKeyboard,\n} from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tuseRef,\n\tuseMemo,\n\tuseEffect,\n\tuseCallback,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tIcon,\n\tcancelCircleFilled as cancelCircleFilledIcon,\n\tarrowLeft as arrowLeftIcon,\n\tclose as closeIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport allStyles from './style.scss';\nimport platformStyles from './platform-style.scss';\nimport Button from '../button';\nimport Gridicons from '../mobile/gridicons';\n\n// Merge platform specific styles with the default styles.\nconst baseStyles = { ...allStyles };\nfor ( const selector in platformStyles ) {\n\tbaseStyles[ selector ] = {\n\t\t...baseStyles[ selector ],\n\t\t...platformStyles[ selector ],\n\t};\n}\n\nfunction selectModifiedStyles( styles, modifier ) {\n\tconst modifierMatcher = new RegExp( `--${ modifier }$` );\n\tconst modifierSelectors = Object.keys( styles ).filter( ( selector ) =>\n\t\tselector.match( modifierMatcher )\n\t);\n\n\treturn modifierSelectors.reduce( ( modifiedStyles, modifierSelector ) => {\n\t\tconst blockElementSelector = modifierSelector.split( '--' )[ 0 ];\n\t\tmodifiedStyles[ blockElementSelector ] = styles[ modifierSelector ];\n\t\treturn modifiedStyles;\n\t}, {} );\n}\n\nfunction mergeStyles( styles, updateStyles, selectors ) {\n\tselectors.forEach( ( selector ) => {\n\t\tstyles[ selector ] = {\n\t\t\t...styles[ selector ],\n\t\t\t...updateStyles[ selector ],\n\t\t};\n\t} );\n\n\treturn styles;\n}\n\nfunction SearchControl( {\n\tvalue,\n\tonChange,\n\tplaceholder = __( 'Search blocks' ),\n} ) {\n\tconst [ isActive, setIsActive ] = useState( false );\n\tconst [ currentStyles, setCurrentStyles ] = useState( baseStyles );\n\n\tconst isDark = useColorScheme() === 'dark';\n\tconst inputRef = useRef();\n\tconst onCancelTimer = useRef();\n\n\tconst isIOS = Platform.OS === 'ios';\n\n\tconst darkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'dark' );\n\t}, [] );\n\n\tconst activeStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active' );\n\t}, [] );\n\n\tconst activeDarkStyles = useMemo( () => {\n\t\treturn selectModifiedStyles( baseStyles, 'active-dark' );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tlet futureStyles = { ...baseStyles };\n\n\t\tfunction mergeFutureStyles( modifiedStyles, shouldUseConditions ) {\n\t\t\tconst shouldUseModified = shouldUseConditions.every(\n\t\t\t\t( should ) => should\n\t\t\t);\n\n\t\t\tconst updatedStyles = shouldUseModified\n\t\t\t\t? modifiedStyles\n\t\t\t\t: futureStyles;\n\n\t\t\tconst selectors = Object.keys( modifiedStyles );\n\n\t\t\tfutureStyles = mergeStyles(\n\t\t\t\tfutureStyles,\n\t\t\t\tupdatedStyles,\n\t\t\t\tselectors\n\t\t\t);\n\t\t}\n\n\t\tmergeFutureStyles( activeStyles, [ isActive ] );\n\t\tmergeFutureStyles( darkStyles, [ isDark ] );\n\t\tmergeFutureStyles( activeDarkStyles, [ isActive, isDark ] );\n\n\t\tsetCurrentStyles( futureStyles );\n\t\t// See https://github.com/WordPress/gutenberg/pull/41166\n\t}, [ isActive, isDark ] );\n\n\tconst clearInput = useCallback( () => {\n\t\tonChange( '' );\n\t}, [ onChange ] );\n\n\tconst onPress = useCallback( () => {\n\t\tsetIsActive( true );\n\t\tinputRef.current?.focus();\n\t}, [] );\n\n\tconst onFocus = useCallback( () => {\n\t\tsetIsActive( true );\n\t}, [] );\n\n\tconst onCancel = useCallback( () => {\n\t\tclearTimeout( onCancelTimer.current );\n\t\tonCancelTimer.current = setTimeout( () => {\n\t\t\tinputRef.current?.blur();\n\t\t\tclearInput();\n\t\t\tsetIsActive( false );\n\t\t}, 0 );\n\t}, [ clearInput ] );\n\n\tconst onKeyboardDidHide = useCallback( () => {\n\t\tif ( ! isIOS ) {\n\t\t\tonCancel();\n\t\t}\n\t}, [ isIOS, onCancel ] );\n\n\tuseEffect( () => {\n\t\tconst keyboardHideSubscription = Keyboard.addListener(\n\t\t\t'keyboardDidHide',\n\t\t\tonKeyboardDidHide\n\t\t);\n\t\treturn () => {\n\t\t\tclearTimeout( onCancelTimer.current );\n\t\t\tkeyboardHideSubscription.remove();\n\t\t};\n\t}, [ onKeyboardDidHide ] );\n\n\tconst {\n\t\t'search-control__container': containerStyle,\n\t\t'search-control__inner-container': innerContainerStyle,\n\t\t'search-control__input-container': inputContainerStyle,\n\t\t'search-control__form-input': formInputStyle,\n\t\t'search-control__form-input-placeholder': placeholderStyle,\n\t\t'search-control__input-button': inputButtonStyle,\n\t\t'search-control__input-button-left': inputButtonLeftStyle,\n\t\t'search-control__input-button-right': inputButtonRightStyle,\n\t\t'search-control__cancel-button': cancelButtonStyle,\n\t\t'search-control__cancel-button-text': cancelButtonTextStyle,\n\t\t'search-control__icon': iconStyle,\n\t\t'search-control__right-icon': rightIconStyle,\n\t} = currentStyles;\n\n\tfunction renderLeftButton() {\n\t\tconst button =\n\t\t\t! isIOS && isActive ? (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Cancel search' ) }\n\t\t\t\t\ticon={ arrowLeftIcon }\n\t\t\t\t\tonClick={ onCancel }\n\t\t\t\t\tstyle={ iconStyle }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Icon icon={ Gridicons.search } fill={ iconStyle?.color } />\n\t\t\t);\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonLeftStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderRightButton() {\n\t\tlet button;\n\n\t\t// Add a View element to properly center the input placeholder via flexbox.\n\t\tif ( isIOS && ! isActive ) {\n\t\t\tbutton = <View />;\n\t\t}\n\n\t\tif ( !! value ) {\n\t\t\tbutton = (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ __( 'Clear search' ) }\n\t\t\t\t\ticon={ isIOS ? cancelCircleFilledIcon : closeIcon }\n\t\t\t\t\tonClick={ clearInput }\n\t\t\t\t\tstyle={ [ iconStyle, rightIconStyle ] }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<View style={ [ inputButtonStyle, inputButtonRightStyle ] }>\n\t\t\t\t{ button }\n\t\t\t</View>\n\t\t);\n\t}\n\n\tfunction renderCancel() {\n\t\tif ( ! isIOS ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn (\n\t\t\t<View style={ cancelButtonStyle }>\n\t\t\t\t<Text\n\t\t\t\t\tonPress={ onCancel }\n\t\t\t\t\tstyle={ cancelButtonTextStyle }\n\t\t\t\t\taccessible\n\t\t\t\t\taccessibilityRole=\"button\"\n\t\t\t\t\taccessibilityLabel={ __( 'Cancel search' ) }\n\t\t\t\t\taccessibilityHint={ __( 'Cancel search' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t</Text>\n\t\t\t</View>\n\t\t);\n\t}\n\n\treturn (\n\t\t<TouchableOpacity\n\t\t\tstyle={ containerStyle }\n\t\t\tonPress={ onPress }\n\t\t\tactiveOpacity={ 1 }\n\t\t>\n\t\t\t<View style={ innerContainerStyle }>\n\t\t\t\t<View style={ inputContainerStyle }>\n\t\t\t\t\t{ renderLeftButton() }\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tref={ inputRef }\n\t\t\t\t\t\tstyle={ formInputStyle }\n\t\t\t\t\t\tplaceholderTextColor={ placeholderStyle?.color }\n\t\t\t\t\t\tonChangeText={ onChange }\n\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tplaceholder={ placeholder }\n\t\t\t\t\t/>\n\t\t\t\t\t{ renderRightButton() }\n\t\t\t\t</View>\n\t\t\t\t{ isActive && renderCancel() }\n\t\t\t</View>\n\t\t</TouchableOpacity>\n\t);\n}\n\nexport default SearchControl;\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,SAAS,EACTC,IAAI,EACJC,IAAI,EACJC,gBAAgB,EAChBC,QAAQ,EACRC,cAAc,EACdC,QAAQ,QACF,cAAc;;AAErB;AACA;AACA;AACA,SACCC,QAAQ,EACRC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,WAAW,QACL,oBAAoB;AAC3B,SAASC,EAAE,QAAQ,iBAA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A,oBACCa,IAAA,CAACtB,gBAAgB;IAChBmG,KAAK,EAAGjB,cAAgB;IACxBZ,OAAO,EAAGA,OAAS;IACnBwC,aAAa,EAAG,CAAG;IAAAP,QAAA,eAEnB/E,KAAA,CAACzB,IAAI;MAACoG,KAAK,EAAGhB,mBAAqB;MAAAoB,QAAA,gBAClC/E,KAAA,CAACzB,IAAI;QAACoG,KAAK,EAAGf,mBAAqB;QAAAmB,QAAA,GAChCT,gBAAgB,CAAC,CAAC,eACpBxE,IAAA,CAACzB,SAAS;UACTkH,GAAG,EAAGxD,QAAU;UAChB4C,KAAK,EAAGd,cAAgB;UACxB2B,oBAAoB,EAAG1B,gBAAgB,EAAEgB,KAAO;UAChDW,YAAY,EAAGjE,QAAU;UACzByB,OAAO,EAAGA,OAAS;UACnB1B,KAAK,EAAGA,KAAO;UACfE,WAAW,EAAGA;QAAa,CAC3B,CAAC,EACAuD,iBAAiB,CAAC,CAAC;MAAA,CAChB,CAAC,EACLtD,QAAQ,IAAIuD,YAAY,CAAC,CAAC;IAAA,CACvB;EAAC,CACU,CAAC;AAErB;AAEA,eAAe3D,aAAa","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* wp:polyfill */
|
|
1
2
|
/**
|
|
2
3
|
* External dependencies
|
|
3
4
|
*/
|
|
@@ -16,6 +17,7 @@ import BaseControl from '../base-control';
|
|
|
16
17
|
import { Select, StyledInputBase } from './styles/select-control-styles';
|
|
17
18
|
import SelectControlChevronDown from './chevron-down';
|
|
18
19
|
import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
|
|
20
|
+
import { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';
|
|
19
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
22
|
function useUniqueId(idProp) {
|
|
21
23
|
const instanceId = useInstanceId(SelectControl);
|
|
@@ -59,6 +61,7 @@ function UnforwardedSelectControl(props, ref) {
|
|
|
59
61
|
variant = 'default',
|
|
60
62
|
__next40pxDefaultSize = false,
|
|
61
63
|
__nextHasNoMarginBottom = false,
|
|
64
|
+
__shouldNotWarnDeprecated36pxSize,
|
|
62
65
|
...restProps
|
|
63
66
|
} = useDeprecated36pxDefaultSizeProp(props);
|
|
64
67
|
const id = useUniqueId(idProp);
|
|
@@ -86,6 +89,12 @@ function UnforwardedSelectControl(props, ref) {
|
|
|
86
89
|
});
|
|
87
90
|
};
|
|
88
91
|
const classes = clsx('components-select-control', className);
|
|
92
|
+
maybeWarnDeprecated36pxSize({
|
|
93
|
+
componentName: 'SelectControl',
|
|
94
|
+
__next40pxDefaultSize,
|
|
95
|
+
size,
|
|
96
|
+
__shouldNotWarnDeprecated36pxSize
|
|
97
|
+
});
|
|
89
98
|
return /*#__PURE__*/_jsx(BaseControl, {
|
|
90
99
|
help: help,
|
|
91
100
|
id: id,
|
|
@@ -139,6 +148,7 @@ function UnforwardedSelectControl(props, ref) {
|
|
|
139
148
|
*
|
|
140
149
|
* return (
|
|
141
150
|
* <SelectControl
|
|
151
|
+
* __next40pxDefaultSize
|
|
142
152
|
* __nextHasNoMarginBottom
|
|
143
153
|
* label="Size"
|
|
144
154
|
* value={ size }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useInstanceId","forwardRef","BaseControl","Select","StyledInputBase","SelectControlChevronDown","useDeprecated36pxDefaultSizeProp","jsx","_jsx","useUniqueId","idProp","instanceId","SelectControl","id","SelectOptions","options","map","label","value","optionProps","index","key","children","UnforwardedSelectControl","props","ref","className","disabled","help","hideLabelFromVision","multiple","onChange","size","valueProp","labelPosition","prefix","suffix","variant","__next40pxDefaultSize","__nextHasNoMarginBottom","restProps","helpId","undefined","length","handleOnChange","event","selectedOptions","Array","from","target","filter","selected","newValues","classes","__associatedWPComponentName","isBorderless","__unstableInputWidth","selectSize"],"sources":["@wordpress/components/src/select-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport { Select, StyledInputBase } from './styles/select-control-styles';\nimport type { WordPressComponentProps } from '../context';\nimport type { SelectControlProps } from './types';\nimport SelectControlChevronDown from './chevron-down';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( SelectControl );\n\tconst id = `inspector-select-control-${ instanceId }`;\n\n\treturn idProp || id;\n}\n\nfunction SelectOptions( {\n\toptions,\n}: {\n\toptions: NonNullable< SelectControlProps[ 'options' ] >;\n} ) {\n\treturn options.map( ( { id, label, value, ...optionProps }, index ) => {\n\t\tconst key = id || `${ label }-${ value }-${ index }`;\n\n\t\treturn (\n\t\t\t<option key={ key } value={ value } { ...optionProps }>\n\t\t\t\t{ label }\n\t\t\t</option>\n\t\t);\n\t} );\n}\n\nfunction UnforwardedSelectControl< V extends string >(\n\tprops: WordPressComponentProps< SelectControlProps< V >, 'select', false >,\n\tref: React.ForwardedRef< HTMLSelectElement >\n) {\n\tconst {\n\t\tclassName,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision,\n\t\tid: idProp,\n\t\tlabel,\n\t\tmultiple = false,\n\t\tonChange,\n\t\toptions = [],\n\t\tsize = 'default',\n\t\tvalue: valueProp,\n\t\tlabelPosition = 'top',\n\t\tchildren,\n\t\tprefix,\n\t\tsuffix,\n\t\tvariant = 'default',\n\t\t__next40pxDefaultSize = false,\n\t\t__nextHasNoMarginBottom = false,\n\t\t...restProps\n\t} = useDeprecated36pxDefaultSizeProp( props );\n\tconst id = useUniqueId( idProp );\n\tconst helpId = help ? `${ id }__help` : undefined;\n\n\t// Disable reason: A select with an onchange throws a warning.\n\tif ( ! options?.length && ! children ) {\n\t\treturn null;\n\t}\n\n\tconst handleOnChange = (\n\t\tevent: React.ChangeEvent< HTMLSelectElement >\n\t) => {\n\t\tif ( props.multiple ) {\n\t\t\tconst selectedOptions = Array.from( event.target.options ).filter(\n\t\t\t\t( { selected } ) => selected\n\t\t\t);\n\t\t\tconst newValues = selectedOptions.map(\n\t\t\t\t( { value } ) => value as V\n\t\t\t);\n\t\t\tprops.onChange?.( newValues, { event } );\n\t\t\treturn;\n\t\t}\n\n\t\tprops.onChange?.( event.target.value as V, { event } );\n\t};\n\n\tconst classes = clsx( 'components-select-control', className );\n\n\treturn (\n\t\t<BaseControl\n\t\t\thelp={ help }\n\t\t\tid={ id }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"SelectControl\"\n\t\t>\n\t\t\t<StyledInputBase\n\t\t\t\tclassName={ classes }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\tid={ id }\n\t\t\t\tisBorderless={ variant === 'minimal' }\n\t\t\t\tlabel={ label }\n\t\t\t\tsize={ size }\n\t\t\t\tsuffix={\n\t\t\t\t\tsuffix || ( ! multiple && <SelectControlChevronDown /> )\n\t\t\t\t}\n\t\t\t\tprefix={ prefix }\n\t\t\t\tlabelPosition={ labelPosition }\n\t\t\t\t__unstableInputWidth={\n\t\t\t\t\tvariant === 'minimal' ? 'auto' : undefined\n\t\t\t\t}\n\t\t\t\tvariant={ variant }\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t>\n\t\t\t\t<Select\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\taria-describedby={ helpId }\n\t\t\t\t\tclassName=\"components-select-control__input\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\tid={ id }\n\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tselectSize={ size }\n\t\t\t\t\tvalue={ valueProp }\n\t\t\t\t\tvariant={ variant }\n\t\t\t\t>\n\t\t\t\t\t{ children || <SelectOptions options={ options } /> }\n\t\t\t\t</Select>\n\t\t\t</StyledInputBase>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * `SelectControl` allows users to select from a single or multiple option menu.\n * It functions as a wrapper around the browser's native `<select>` element.\n *\n * ```jsx\n * import { SelectControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MySelectControl = () => {\n * const [ size, setSize ] = useState( '50%' );\n *\n * return (\n * <SelectControl\n * __nextHasNoMarginBottom\n * label=\"Size\"\n * value={ size }\n * options={ [\n * { label: 'Big', value: '100%' },\n * { label: 'Medium', value: '50%' },\n * { label: 'Small', value: '25%' },\n * ] }\n * onChange={ setSize }\n * />\n * );\n * };\n * ```\n */\nexport const SelectControl = forwardRef( UnforwardedSelectControl ) as <\n\tV extends string,\n>(\n\tprops: WordPressComponentProps<\n\t\tSelectControlProps< V >,\n\t\t'select',\n\t\tfalse\n\t> & { ref?: React.Ref< HTMLSelectElement > }\n) => React.JSX.Element | null;\n\nexport default SelectControl;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,WAAW,MAAM,iBAAiB;AACzC,SAASC,MAAM,EAAEC,eAAe,QAAQ,gCAAgC;AAGxE,OAAOC,wBAAwB,MAAM,gBAAgB;AACrD,SAASC,gCAAgC,QAAQ,+BAA+B;AAAC,SAAAC,GAAA,IAAAC,IAAA;
|
|
1
|
+
{"version":3,"names":["clsx","useInstanceId","forwardRef","BaseControl","Select","StyledInputBase","SelectControlChevronDown","useDeprecated36pxDefaultSizeProp","maybeWarnDeprecated36pxSize","jsx","_jsx","useUniqueId","idProp","instanceId","SelectControl","id","SelectOptions","options","map","label","value","optionProps","index","key","children","UnforwardedSelectControl","props","ref","className","disabled","help","hideLabelFromVision","multiple","onChange","size","valueProp","labelPosition","prefix","suffix","variant","__next40pxDefaultSize","__nextHasNoMarginBottom","__shouldNotWarnDeprecated36pxSize","restProps","helpId","undefined","length","handleOnChange","event","selectedOptions","Array","from","target","filter","selected","newValues","classes","componentName","__associatedWPComponentName","isBorderless","__unstableInputWidth","selectSize"],"sources":["@wordpress/components/src/select-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport { Select, StyledInputBase } from './styles/select-control-styles';\nimport type { WordPressComponentProps } from '../context';\nimport type { SelectControlProps } from './types';\nimport SelectControlChevronDown from './chevron-down';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nfunction useUniqueId( idProp?: string ) {\n\tconst instanceId = useInstanceId( SelectControl );\n\tconst id = `inspector-select-control-${ instanceId }`;\n\n\treturn idProp || id;\n}\n\nfunction SelectOptions( {\n\toptions,\n}: {\n\toptions: NonNullable< SelectControlProps[ 'options' ] >;\n} ) {\n\treturn options.map( ( { id, label, value, ...optionProps }, index ) => {\n\t\tconst key = id || `${ label }-${ value }-${ index }`;\n\n\t\treturn (\n\t\t\t<option key={ key } value={ value } { ...optionProps }>\n\t\t\t\t{ label }\n\t\t\t</option>\n\t\t);\n\t} );\n}\n\nfunction UnforwardedSelectControl< V extends string >(\n\tprops: WordPressComponentProps< SelectControlProps< V >, 'select', false >,\n\tref: React.ForwardedRef< HTMLSelectElement >\n) {\n\tconst {\n\t\tclassName,\n\t\tdisabled = false,\n\t\thelp,\n\t\thideLabelFromVision,\n\t\tid: idProp,\n\t\tlabel,\n\t\tmultiple = false,\n\t\tonChange,\n\t\toptions = [],\n\t\tsize = 'default',\n\t\tvalue: valueProp,\n\t\tlabelPosition = 'top',\n\t\tchildren,\n\t\tprefix,\n\t\tsuffix,\n\t\tvariant = 'default',\n\t\t__next40pxDefaultSize = false,\n\t\t__nextHasNoMarginBottom = false,\n\t\t__shouldNotWarnDeprecated36pxSize,\n\t\t...restProps\n\t} = useDeprecated36pxDefaultSizeProp( props );\n\tconst id = useUniqueId( idProp );\n\tconst helpId = help ? `${ id }__help` : undefined;\n\n\t// Disable reason: A select with an onchange throws a warning.\n\tif ( ! options?.length && ! children ) {\n\t\treturn null;\n\t}\n\n\tconst handleOnChange = (\n\t\tevent: React.ChangeEvent< HTMLSelectElement >\n\t) => {\n\t\tif ( props.multiple ) {\n\t\t\tconst selectedOptions = Array.from( event.target.options ).filter(\n\t\t\t\t( { selected } ) => selected\n\t\t\t);\n\t\t\tconst newValues = selectedOptions.map(\n\t\t\t\t( { value } ) => value as V\n\t\t\t);\n\t\t\tprops.onChange?.( newValues, { event } );\n\t\t\treturn;\n\t\t}\n\n\t\tprops.onChange?.( event.target.value as V, { event } );\n\t};\n\n\tconst classes = clsx( 'components-select-control', className );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'SelectControl',\n\t\t__next40pxDefaultSize,\n\t\tsize,\n\t\t__shouldNotWarnDeprecated36pxSize,\n\t} );\n\n\treturn (\n\t\t<BaseControl\n\t\t\thelp={ help }\n\t\t\tid={ id }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"SelectControl\"\n\t\t>\n\t\t\t<StyledInputBase\n\t\t\t\tclassName={ classes }\n\t\t\t\tdisabled={ disabled }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\tid={ id }\n\t\t\t\tisBorderless={ variant === 'minimal' }\n\t\t\t\tlabel={ label }\n\t\t\t\tsize={ size }\n\t\t\t\tsuffix={\n\t\t\t\t\tsuffix || ( ! multiple && <SelectControlChevronDown /> )\n\t\t\t\t}\n\t\t\t\tprefix={ prefix }\n\t\t\t\tlabelPosition={ labelPosition }\n\t\t\t\t__unstableInputWidth={\n\t\t\t\t\tvariant === 'minimal' ? 'auto' : undefined\n\t\t\t\t}\n\t\t\t\tvariant={ variant }\n\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t>\n\t\t\t\t<Select\n\t\t\t\t\t{ ...restProps }\n\t\t\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\t\t\taria-describedby={ helpId }\n\t\t\t\t\tclassName=\"components-select-control__input\"\n\t\t\t\t\tdisabled={ disabled }\n\t\t\t\t\tid={ id }\n\t\t\t\t\tmultiple={ multiple }\n\t\t\t\t\tonChange={ handleOnChange }\n\t\t\t\t\tref={ ref }\n\t\t\t\t\tselectSize={ size }\n\t\t\t\t\tvalue={ valueProp }\n\t\t\t\t\tvariant={ variant }\n\t\t\t\t>\n\t\t\t\t\t{ children || <SelectOptions options={ options } /> }\n\t\t\t\t</Select>\n\t\t\t</StyledInputBase>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * `SelectControl` allows users to select from a single or multiple option menu.\n * It functions as a wrapper around the browser's native `<select>` element.\n *\n * ```jsx\n * import { SelectControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MySelectControl = () => {\n * const [ size, setSize ] = useState( '50%' );\n *\n * return (\n * <SelectControl\n * __next40pxDefaultSize\n * __nextHasNoMarginBottom\n * label=\"Size\"\n * value={ size }\n * options={ [\n * { label: 'Big', value: '100%' },\n * { label: 'Medium', value: '50%' },\n * { label: 'Small', value: '25%' },\n * ] }\n * onChange={ setSize }\n * />\n * );\n * };\n * ```\n */\nexport const SelectControl = forwardRef( UnforwardedSelectControl ) as <\n\tV extends string,\n>(\n\tprops: WordPressComponentProps<\n\t\tSelectControlProps< V >,\n\t\t'select',\n\t\tfalse\n\t> & { ref?: React.Ref< HTMLSelectElement > }\n) => React.JSX.Element | null;\n\nexport default SelectControl;\n"],"mappings":";AAAA;AACA;AACA;A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AGZ,UAAU,CAAEuB,wBAAyB,CAQrC;AAE7B,eAAeX,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/components/src/select-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { InputBaseProps } from '../input-control/types';\nimport type { BaseControlProps } from '../base-control/types';\n\ntype SelectControlBaseProps< V extends string > = Pick<\n\tInputBaseProps,\n\t| '__next36pxDefaultSize'\n\t| '__next40pxDefaultSize'\n\t| 'disabled'\n\t| 'hideLabelFromVision'\n\t| 'label'\n\t| 'labelPosition'\n\t| 'prefix'\n\t| 'size'\n\t| 'suffix'\n> &\n\tPick< BaseControlProps, 'help' | '__nextHasNoMarginBottom' > & {\n\t\t/**\n\t\t * An array of option property objects to be rendered,\n\t\t * each with a `label` and `value` property, as well as any other\n\t\t * `<option>` attributes.\n\t\t */\n\t\toptions?: readonly ( {\n\t\t\t/**\n\t\t\t * The label to be shown to the user.\n\t\t\t */\n\t\t\tlabel: string;\n\t\t\t/**\n\t\t\t * The internal value used to choose the selected value.\n\t\t\t * This is also the value passed to `onChange` when the option is selected.\n\t\t\t */\n\t\t\tvalue: V;\n\t\t} & Omit<\n\t\t\tReact.OptionHTMLAttributes< HTMLOptionElement >,\n\t\t\t'label' | 'value'\n\t\t> )[];\n\t\t/**\n\t\t * As an alternative to the `options` prop, `optgroup`s and `options` can be\n\t\t * passed in as `children` for more customizability.\n\t\t */\n\t\tchildren?: ReactNode;\n\t\t/**\n\t\t * The style variant of the control.\n\t\t *\n\t\t * @default 'default'\n\t\t */\n\t\tvariant?: 'default' | 'minimal';\n\t};\n\nexport type SelectControlSingleSelectionProps< V extends string = string > =\n\tSelectControlBaseProps< V > & {\n\t\t/**\n\t\t * If this property is added, multiple values can be selected. The `value` passed should be an array.\n\t\t *\n\t\t * In most cases, it is preferable to use the `FormTokenField` or `CheckboxControl` components instead.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tmultiple?: false;\n\t\t/**\n\t\t * The value of the selected option.\n\t\t *\n\t\t * If `multiple` is true, the `value` should be an array with the values of the selected options.\n\t\t */\n\t\tvalue?: NoInfer< V >;\n\t\t/**\n\t\t * A function that receives the value of the new option that is being selected as input.\n\t\t *\n\t\t * If `multiple` is `true`, the value received is an array of the selected value.\n\t\t * Otherwise, the value received is a single value with the new selected value.\n\t\t */\n\t\tonChange?: (\n\t\t\tvalue: NoInfer< V >,\n\t\t\textra?: { event?: ChangeEvent< HTMLSelectElement > }\n\t\t) => void;\n\t};\n\nexport type SelectControlMultipleSelectionProps< V extends string > =\n\tSelectControlBaseProps< V > & {\n\t\t/**\n\t\t * If this property is added, multiple values can be selected. The `value` passed should be an array.\n\t\t *\n\t\t * In most cases, it is preferable to use the `FormTokenField` or `CheckboxControl` components instead.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tmultiple: true;\n\t\t/**\n\t\t * The value of the selected option.\n\t\t *\n\t\t * If `multiple` is true, the `value` should be an array with the values of the selected options.\n\t\t */\n\t\tvalue?: NoInfer< V >[];\n\t\t/**\n\t\t * A function that receives the value of the new option that is being selected as input.\n\t\t *\n\t\t * If `multiple` is `true`, the value received is an array of the selected value.\n\t\t * Otherwise, the value received is a single value with the new selected value.\n\t\t */\n\t\tonChange?: (\n\t\t\tvalue: NoInfer< V >[],\n\t\t\textra?: { event?: ChangeEvent< HTMLSelectElement > }\n\t\t) => void;\n\t};\n\nexport type SelectControlProps< V extends string = string > =\n\t| SelectControlSingleSelectionProps< V >\n\t| SelectControlMultipleSelectionProps< V >;\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/components/src/select-control/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { InputBaseProps } from '../input-control/types';\nimport type { BaseControlProps } from '../base-control/types';\n\ntype SelectControlBaseProps< V extends string > = Pick<\n\tInputBaseProps,\n\t| '__next36pxDefaultSize'\n\t| '__next40pxDefaultSize'\n\t| '__shouldNotWarnDeprecated36pxSize'\n\t| 'disabled'\n\t| 'hideLabelFromVision'\n\t| 'label'\n\t| 'labelPosition'\n\t| 'prefix'\n\t| 'size'\n\t| 'suffix'\n> &\n\tPick< BaseControlProps, 'help' | '__nextHasNoMarginBottom' > & {\n\t\t/**\n\t\t * An array of option property objects to be rendered,\n\t\t * each with a `label` and `value` property, as well as any other\n\t\t * `<option>` attributes.\n\t\t */\n\t\toptions?: readonly ( {\n\t\t\t/**\n\t\t\t * The label to be shown to the user.\n\t\t\t */\n\t\t\tlabel: string;\n\t\t\t/**\n\t\t\t * The internal value used to choose the selected value.\n\t\t\t * This is also the value passed to `onChange` when the option is selected.\n\t\t\t */\n\t\t\tvalue: V;\n\t\t} & Omit<\n\t\t\tReact.OptionHTMLAttributes< HTMLOptionElement >,\n\t\t\t'label' | 'value'\n\t\t> )[];\n\t\t/**\n\t\t * As an alternative to the `options` prop, `optgroup`s and `options` can be\n\t\t * passed in as `children` for more customizability.\n\t\t */\n\t\tchildren?: ReactNode;\n\t\t/**\n\t\t * The style variant of the control.\n\t\t *\n\t\t * @default 'default'\n\t\t */\n\t\tvariant?: 'default' | 'minimal';\n\t};\n\nexport type SelectControlSingleSelectionProps< V extends string = string > =\n\tSelectControlBaseProps< V > & {\n\t\t/**\n\t\t * If this property is added, multiple values can be selected. The `value` passed should be an array.\n\t\t *\n\t\t * In most cases, it is preferable to use the `FormTokenField` or `CheckboxControl` components instead.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tmultiple?: false;\n\t\t/**\n\t\t * The value of the selected option.\n\t\t *\n\t\t * If `multiple` is true, the `value` should be an array with the values of the selected options.\n\t\t */\n\t\tvalue?: NoInfer< V >;\n\t\t/**\n\t\t * A function that receives the value of the new option that is being selected as input.\n\t\t *\n\t\t * If `multiple` is `true`, the value received is an array of the selected value.\n\t\t * Otherwise, the value received is a single value with the new selected value.\n\t\t */\n\t\tonChange?: (\n\t\t\tvalue: NoInfer< V >,\n\t\t\textra?: { event?: ChangeEvent< HTMLSelectElement > }\n\t\t) => void;\n\t};\n\nexport type SelectControlMultipleSelectionProps< V extends string > =\n\tSelectControlBaseProps< V > & {\n\t\t/**\n\t\t * If this property is added, multiple values can be selected. The `value` passed should be an array.\n\t\t *\n\t\t * In most cases, it is preferable to use the `FormTokenField` or `CheckboxControl` components instead.\n\t\t *\n\t\t * @default false\n\t\t */\n\t\tmultiple: true;\n\t\t/**\n\t\t * The value of the selected option.\n\t\t *\n\t\t * If `multiple` is true, the `value` should be an array with the values of the selected options.\n\t\t */\n\t\tvalue?: NoInfer< V >[];\n\t\t/**\n\t\t * A function that receives the value of the new option that is being selected as input.\n\t\t *\n\t\t * If `multiple` is `true`, the value received is an array of the selected value.\n\t\t * Otherwise, the value received is a single value with the new selected value.\n\t\t */\n\t\tonChange?: (\n\t\t\tvalue: NoInfer< V >[],\n\t\t\textra?: { event?: ChangeEvent< HTMLSelectElement > }\n\t\t) => void;\n\t};\n\nexport type SelectControlProps< V extends string = string > =\n\t| SelectControlSingleSelectionProps< V >\n\t| SelectControlMultipleSelectionProps< V >;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useState","isShallowEqual","observableMap","SlotFillContext","jsx","_jsx","createSlotRegistry","slots","fills","registerSlot","name","ref","fillProps","set","unregisterSlot","slot","get","delete","updateSlot","registerFill","unregisterFill","fillsForName","filter","fillRef","SlotFillProvider","children","registry","Provider","value"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { observableMap } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport type {\n\tSlotFillProviderProps,\n\tSlotFillBubblesVirtuallyContext,\n} from '../types';\n\nfunction createSlotRegistry(): SlotFillBubblesVirtuallyContext {\n\tconst slots: SlotFillBubblesVirtuallyContext[ 'slots' ] = observableMap();\n\tconst fills: SlotFillBubblesVirtuallyContext[ 'fills' ] = observableMap();\n\n\tconst registerSlot: SlotFillBubblesVirtuallyContext[ 'registerSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tslots.set( name, { ref, fillProps } );\n\t};\n\n\tconst unregisterSlot: SlotFillBubblesVirtuallyContext[ 'unregisterSlot' ] =\n\t\t( name, ref ) => {\n\t\t\tconst slot = slots.get( name );\n\t\t\tif ( ! slot ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Make sure we're not unregistering a slot registered by another element\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412\n\t\t\tif ( slot.ref !== ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tslots.delete( name );\n\t\t};\n\n\tconst updateSlot: SlotFillBubblesVirtuallyContext[ 'updateSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tconst slot = slots.get( name );\n\t\tif ( ! slot ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( slot.ref !== ref ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isShallowEqual( slot.fillProps, fillProps ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tslots.set( name, { ref, fillProps } );\n\t};\n\n\tconst registerFill: SlotFillBubblesVirtuallyContext[ 'registerFill' ] = (\n\t\tname,\n\t\tref\n\t) => {\n\t\tfills.set( name, [ ...( fills.get( name ) || [] ), ref ] );\n\t};\n\n\tconst unregisterFill: SlotFillBubblesVirtuallyContext[ 'unregisterFill' ] =\n\t\t( name, ref ) => {\n\t\t\tconst fillsForName = fills.get( name );\n\t\t\tif ( ! fillsForName ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfills.set(\n\t\t\t\tname,\n\t\t\t\tfillsForName.filter( ( fillRef ) => fillRef !== ref )\n\t\t\t);\n\t\t};\n\n\treturn {\n\t\tslots,\n\t\tfills,\n\t\tregisterSlot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n\nexport default function SlotFillProvider( {\n\tchildren,\n}: SlotFillProviderProps ) {\n\tconst [ registry ] = useState( createSlotRegistry );\n\treturn (\n\t\t<SlotFillContext.Provider value={ registry }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAOC,cAAc,MAAM,6BAA6B;AACxD,SAASC,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMlD,SAASC,kBAAkBA,CAAA,EAAoC;EAC9D,MAAMC,KAAiD,GAAGL,aAAa,CAAC,CAAC;EACzE,MAAMM,KAAiD,GAAGN,aAAa,CAAC,CAAC;EAEzE,MAAMO,YAA+D,GAAGA,CACvEC,IAAI,EACJC,GAAG,EACHC,SAAS,KACL;IACJL,KAAK,CAACM,GAAG,CAAEH,IAAI,EAAE;MAAEC,GAAG;MAAEC;IAAU,CAAE,CAAC;EACtC,CAAC;EAED,MAAME,cAAmE,GACxEA,CAAEJ,IAAI,EAAEC,GAAG,KAAM;IAChB,MAAMI,IAAI,GAAGR,KAAK,CAACS,GAAG,CAAEN,IAAK,CAAC;IAC9B,IAAK,CAAEK,IAAI,EAAG;MACb;IACD;;IAEA;IACA;IACA,IAAKA,IAAI,CAACJ,GAAG,KAAKA,GAAG,EAAG;MACvB;IACD;IAEAJ,KAAK,CAACU,MAAM,CAAEP,IAAK,CAAC;EACrB,CAAC;EAEF,MAAMQ,UAA2D,GAAGA,CACnER,IAAI,EACJC,GAAG,EACHC,SAA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":3,"names":["useState","isShallowEqual","observableMap","SlotFillContext","jsx","_jsx","createSlotRegistry","slots","fills","registerSlot","name","ref","fillProps","set","unregisterSlot","slot","get","delete","updateSlot","registerFill","unregisterFill","fillsForName","filter","fillRef","SlotFillProvider","children","registry","Provider","value"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { observableMap } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport type {\n\tSlotFillProviderProps,\n\tSlotFillBubblesVirtuallyContext,\n} from '../types';\n\nfunction createSlotRegistry(): SlotFillBubblesVirtuallyContext {\n\tconst slots: SlotFillBubblesVirtuallyContext[ 'slots' ] = observableMap();\n\tconst fills: SlotFillBubblesVirtuallyContext[ 'fills' ] = observableMap();\n\n\tconst registerSlot: SlotFillBubblesVirtuallyContext[ 'registerSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tslots.set( name, { ref, fillProps } );\n\t};\n\n\tconst unregisterSlot: SlotFillBubblesVirtuallyContext[ 'unregisterSlot' ] =\n\t\t( name, ref ) => {\n\t\t\tconst slot = slots.get( name );\n\t\t\tif ( ! slot ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Make sure we're not unregistering a slot registered by another element\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412\n\t\t\tif ( slot.ref !== ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tslots.delete( name );\n\t\t};\n\n\tconst updateSlot: SlotFillBubblesVirtuallyContext[ 'updateSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tconst slot = slots.get( name );\n\t\tif ( ! slot ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( slot.ref !== ref ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isShallowEqual( slot.fillProps, fillProps ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tslots.set( name, { ref, fillProps } );\n\t};\n\n\tconst registerFill: SlotFillBubblesVirtuallyContext[ 'registerFill' ] = (\n\t\tname,\n\t\tref\n\t) => {\n\t\tfills.set( name, [ ...( fills.get( name ) || [] ), ref ] );\n\t};\n\n\tconst unregisterFill: SlotFillBubblesVirtuallyContext[ 'unregisterFill' ] =\n\t\t( name, ref ) => {\n\t\t\tconst fillsForName = fills.get( name );\n\t\t\tif ( ! fillsForName ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfills.set(\n\t\t\t\tname,\n\t\t\t\tfillsForName.filter( ( fillRef ) => fillRef !== ref )\n\t\t\t);\n\t\t};\n\n\treturn {\n\t\tslots,\n\t\tfills,\n\t\tregisterSlot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n\nexport default function SlotFillProvider( {\n\tchildren,\n}: SlotFillProviderProps ) {\n\tconst [ registry ] = useState( createSlotRegistry );\n\treturn (\n\t\t<SlotFillContext.Provider value={ registry }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAOC,cAAc,MAAM,6BAA6B;AACxD,SAASC,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMlD,SAASC,kBAAkBA,CAAA,EAAoC;EAC9D,MAAMC,KAAiD,GAAGL,aAAa,CAAC,CAAC;EACzE,MAAMM,KAAiD,GAAGN,aAAa,CAAC,CAAC;EAEzE,MAAMO,YAA+D,GAAGA,CACvEC,IAAI,EACJC,GAAG,EACHC,SAAS,KACL;IACJL,KAAK,CAACM,GAAG,CAAEH,IAAI,EAAE;MAAEC,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D,CAAC;EACF,CAAC;EAEF,OAAO;IACNJ,KAAK;IACLC,KAAK;IACLC,YAAY;IACZS,UAAU;IACVJ,cAAc;IACdK,YAAY;IACZC;EACD,CAAC;AACF;AAEA,eAAe,SAASI,gBAAgBA,CAAE;EACzCC;AACsB,CAAC,EAAG;EAC1B,MAAM,CAAEC,QAAQ,CAAE,GAAG1B,QAAQ,CAAEM,kBAAmB,CAAC;EACnD,oBACCD,IAAA,CAACF,eAAe,CAACwB,QAAQ;IAACC,KAAK,EAAGF,QAAU;IAAAD,QAAA,EACzCA;EAAQ,CACe,CAAC;AAE7B","ignoreList":[]}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { observableMap } from '@wordpress/compose';
|
|
4
5
|
import { createContext } from '@wordpress/element';
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Internal dependencies
|
|
7
9
|
*/
|
|
8
10
|
|
|
9
11
|
const initialValue = {
|
|
12
|
+
slots: observableMap(),
|
|
13
|
+
fills: observableMap(),
|
|
10
14
|
registerSlot: () => {},
|
|
11
15
|
unregisterSlot: () => {},
|
|
12
16
|
registerFill: () => {},
|
|
13
17
|
unregisterFill: () => {},
|
|
14
|
-
|
|
15
|
-
getFills: () => [],
|
|
16
|
-
subscribe: () => () => {}
|
|
18
|
+
updateFill: () => {}
|
|
17
19
|
};
|
|
18
20
|
export const SlotFillContext = createContext(initialValue);
|
|
19
21
|
export default SlotFillContext;
|