@wordpress/components 25.6.1 → 26.0.1-next.5a1d1283.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -1
- package/CONTRIBUTING.md +1 -1
- package/README.md +3 -8
- package/build/color-picker/hsv-color-picker.native.js +92 -0
- package/build/color-picker/hsv-color-picker.native.js.map +1 -0
- package/build/color-picker/hue-picker.native.js +195 -0
- package/build/color-picker/hue-picker.native.js.map +1 -0
- package/build/color-picker/index.native.js +3 -2
- package/build/color-picker/index.native.js.map +1 -1
- package/build/color-picker/saturation-picker.native.js +178 -0
- package/build/color-picker/saturation-picker.native.js.map +1 -0
- package/build/item-group/item/component.js +0 -1
- package/build/item-group/item/component.js.map +1 -1
- package/build/item-group/item-group/component.js +0 -1
- package/build/item-group/item-group/component.js.map +1 -1
- package/build/menu-item/index.js +6 -4
- package/build/menu-item/index.js.map +1 -1
- package/build/menu-item/types.js.map +1 -1
- package/build/mobile/link-settings/link-settings-navigation.native.js +1 -1
- package/build/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +1 -2
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/palette-edit/styles.js +10 -10
- package/build/palette-edit/styles.js.map +1 -1
- package/build/popover/index.js +38 -75
- package/build/popover/index.js.map +1 -1
- package/build/popover/overlay-middlewares.js.map +1 -1
- package/build/popover/types.js.map +1 -1
- package/build/popover/utils.js +5 -50
- package/build/popover/utils.js.map +1 -1
- package/build/progress-bar/styles.js +6 -5
- package/build/progress-bar/styles.js.map +1 -1
- package/build/search-control/index.native.js +27 -24
- package/build/search-control/index.native.js.map +1 -1
- package/build/shortcut/index.js +13 -0
- package/build/shortcut/index.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-context.js +3 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +14 -8
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/index.js +5 -0
- package/build/slot-fill/index.js.map +1 -1
- package/build/spinner/index.js +0 -1
- package/build/spinner/index.js.map +1 -1
- package/build/theme/index.js +0 -1
- package/build/theme/index.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js +0 -1
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +5 -1
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tree-select/index.js +0 -1
- package/build/tree-select/index.js.map +1 -1
- package/build/unit-control/index.js +0 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/utils/hooks/use-cx.js +2 -1
- package/build/utils/hooks/use-cx.js.map +1 -1
- package/build/view/component.js +1 -2
- package/build/view/component.js.map +1 -1
- package/build-module/color-picker/hsv-color-picker.native.js +84 -0
- package/build-module/color-picker/hsv-color-picker.native.js.map +1 -0
- package/build-module/color-picker/hue-picker.native.js +185 -0
- package/build-module/color-picker/hue-picker.native.js.map +1 -0
- package/build-module/color-picker/index.native.js +2 -1
- package/build-module/color-picker/index.native.js.map +1 -1
- package/build-module/color-picker/saturation-picker.native.js +168 -0
- package/build-module/color-picker/saturation-picker.native.js.map +1 -0
- package/build-module/item-group/item/component.js +0 -1
- package/build-module/item-group/item/component.js.map +1 -1
- package/build-module/item-group/item-group/component.js +0 -1
- package/build-module/item-group/item-group/component.js.map +1 -1
- package/build-module/menu-item/index.js +4 -2
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/menu-item/types.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-navigation.native.js +1 -1
- package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +1 -2
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/palette-edit/styles.js +10 -10
- package/build-module/palette-edit/styles.js.map +1 -1
- package/build-module/popover/index.js +42 -79
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/overlay-middlewares.js.map +1 -1
- package/build-module/popover/types.js.map +1 -1
- package/build-module/popover/utils.js +4 -47
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/progress-bar/styles.js +6 -5
- package/build-module/progress-bar/styles.js.map +1 -1
- package/build-module/search-control/index.native.js +28 -25
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/shortcut/index.js +13 -0
- package/build-module/shortcut/index.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js +3 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-context.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +14 -8
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/index.js +6 -1
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/spinner/index.js +0 -1
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/theme/index.js +0 -1
- package/build-module/theme/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +0 -1
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +5 -1
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tree-select/index.js +0 -1
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/unit-control/index.js +0 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/utils/hooks/use-cx.js +2 -1
- package/build-module/utils/hooks/use-cx.js.map +1 -1
- package/build-module/view/component.js +1 -2
- package/build-module/view/component.js.map +1 -1
- package/build-types/alignment-matrix-control/stories/index.story.d.ts +2 -2
- 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 +2 -2
- package/build-types/angle-picker-control/stories/index.story.d.ts.map +1 -1
- package/build-types/animate/stories/index.story.d.ts +9 -9
- package/build-types/animate/stories/index.story.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts +4 -4
- package/build-types/base-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-box-control/stories/index.story.d.ts +2 -2
- package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-control/stories/index.story.d.ts +2 -2
- package/build-types/border-control/stories/index.story.d.ts.map +1 -1
- package/build-types/button/stories/e2e/index.story.d.ts +3 -3
- package/build-types/button/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts +10 -9
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/button-group/stories/index.story.d.ts +3 -3
- package/build-types/button-group/stories/index.story.d.ts.map +1 -1
- package/build-types/card/stories/index.story.d.ts +2 -2
- package/build-types/card/stories/index.story.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.story.d.ts +4 -4
- package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts +2 -2
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-indicator/stories/index.story.d.ts +3 -3
- package/build-types/color-indicator/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-palette/styles.d.ts +1 -1
- package/build-types/color-picker/stories/index.story.d.ts +2 -2
- package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts +2 -2
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/stories/index.story.d.ts +2 -2
- package/build-types/custom-gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +1 -1
- package/build-types/date-time/stories/date-time.story.d.ts +5 -5
- package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
- package/build-types/date-time/stories/date.story.d.ts +5 -5
- package/build-types/date-time/stories/date.story.d.ts.map +1 -1
- package/build-types/date-time/stories/time.story.d.ts +3 -3
- package/build-types/date-time/stories/time.story.d.ts.map +1 -1
- package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
- package/build-types/disabled/stories/index.story.d.ts +4 -4
- package/build-types/disabled/stories/index.story.d.ts.map +1 -1
- package/build-types/divider/stories/index.story.d.ts +5 -5
- package/build-types/divider/stories/index.story.d.ts.map +1 -1
- package/build-types/draggable/stories/index.story.d.ts +4 -4
- package/build-types/draggable/stories/index.story.d.ts.map +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts +2 -2
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.story.d.ts +6 -5
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
- package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts +2 -2
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/duotone-picker/stories/duotone-picker.story.d.ts +2 -2
- 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 +2 -2
- package/build-types/duotone-picker/stories/duotone-swatch.story.d.ts.map +1 -1
- package/build-types/elevation/stories/index.story.d.ts +5 -5
- package/build-types/elevation/stories/index.story.d.ts.map +1 -1
- package/build-types/external-link/stories/index.story.d.ts +3 -3
- package/build-types/external-link/stories/index.story.d.ts.map +1 -1
- package/build-types/flex/stories/index.story.d.ts +4 -4
- package/build-types/flex/stories/index.story.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts +2 -2
- package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/font-size-picker/stories/e2e/index.story.d.ts +2 -2
- package/build-types/font-size-picker/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/font-size-picker/stories/index.story.d.ts +8 -8
- package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/form-file-upload/stories/index.story.d.ts +2 -2
- package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
- package/build-types/form-toggle/stories/index.story.d.ts +3 -3
- package/build-types/form-toggle/stories/index.story.d.ts.map +1 -1
- package/build-types/form-token-field/stories/index.story.d.ts +7 -7
- package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts +2 -2
- package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/grid/stories/index.story.d.ts +3 -3
- package/build-types/grid/stories/index.story.d.ts.map +1 -1
- package/build-types/guide/stories/index.story.d.ts +2 -2
- package/build-types/guide/stories/index.story.d.ts.map +1 -1
- package/build-types/h-stack/stories/e2e/index.story.d.ts +3 -3
- package/build-types/h-stack/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/h-stack/stories/index.story.d.ts +3 -3
- package/build-types/h-stack/stories/index.story.d.ts.map +1 -1
- package/build-types/heading/stories/index.story.d.ts +3 -3
- package/build-types/heading/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/stories/index.story.d.ts +2 -2
- package/build-types/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/item-group/item/component.d.ts +0 -1
- package/build-types/item-group/item/component.d.ts.map +1 -1
- package/build-types/item-group/item-group/component.d.ts +0 -1
- package/build-types/item-group/item-group/component.d.ts.map +1 -1
- package/build-types/item-group/stories/index.story.d.ts +6 -6
- package/build-types/item-group/stories/index.story.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts +2 -2
- package/build-types/keyboard-shortcuts/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +3 -3
- package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-item/index.d.ts +5 -58
- package/build-types/menu-item/index.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +74 -0
- package/build-types/menu-item/stories/index.story.d.ts.map +1 -0
- package/build-types/menu-item/types.d.ts +3 -2
- package/build-types/menu-item/types.d.ts.map +1 -1
- package/build-types/menu-items-choice/stories/index.story.d.ts +3 -3
- package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
- package/build-types/modal/stories/index.story.d.ts +4 -4
- package/build-types/modal/stories/index.story.d.ts.map +1 -1
- package/build-types/navigable-container/stories/navigable-menu.story.d.ts +3 -3
- package/build-types/navigable-container/stories/navigable-menu.story.d.ts.map +1 -1
- package/build-types/navigable-container/stories/tabbable-container.story.d.ts +3 -3
- package/build-types/navigable-container/stories/tabbable-container.story.d.ts.map +1 -1
- package/build-types/navigation/index.d.ts +0 -1
- package/build-types/navigation/index.d.ts.map +1 -1
- package/build-types/navigation/stories/index.story.d.ts +2 -2
- package/build-types/navigation/stories/index.story.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/controlled-state.d.ts +2 -2
- package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/default.d.ts +2 -2
- package/build-types/navigation/stories/utils/default.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/group.d.ts +2 -2
- package/build-types/navigation/stories/utils/group.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts +2 -2
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/more-examples.d.ts +2 -2
- package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/search.d.ts +2 -2
- package/build-types/navigation/stories/utils/search.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts +1 -1
- package/build-types/navigator/navigator-provider/component.d.ts +0 -1
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/stories/index.story.d.ts +5 -5
- package/build-types/navigator/stories/index.story.d.ts.map +1 -1
- package/build-types/notice/stories/index.story.d.ts +3 -3
- package/build-types/notice/stories/index.story.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +2 -2
- package/build-types/number-control/stories/index.story.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/palette-edit/styles.d.ts +1 -1
- package/build-types/palette-edit/styles.d.ts.map +1 -1
- package/build-types/panel/stories/index.story.d.ts +6 -6
- package/build-types/panel/stories/index.story.d.ts.map +1 -1
- package/build-types/placeholder/stories/index.story.d.ts +3 -3
- package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/overlay-middlewares.d.ts +2 -2
- package/build-types/popover/overlay-middlewares.d.ts.map +1 -1
- package/build-types/popover/stories/index.story.d.ts +7 -7
- package/build-types/popover/stories/index.story.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +6 -0
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts +1 -21
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts +3 -3
- package/build-types/progress-bar/stories/index.story.d.ts.map +1 -1
- package/build-types/progress-bar/styles.d.ts.map +1 -1
- package/build-types/query-controls/stories/index.story.d.ts +4 -4
- package/build-types/query-controls/stories/index.story.d.ts.map +1 -1
- package/build-types/radio-control/stories/index.story.d.ts +3 -3
- package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
- package/build-types/range-control/stories/index.story.d.ts +9 -9
- package/build-types/range-control/stories/index.story.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.story.d.ts +2 -2
- package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
- package/build-types/responsive-wrapper/stories/index.story.d.ts +3 -3
- package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
- package/build-types/sandbox/stories/index.story.d.ts +2 -2
- package/build-types/sandbox/stories/index.story.d.ts.map +1 -1
- package/build-types/scroll-lock/stories/index.story.d.ts +3 -3
- package/build-types/scroll-lock/stories/index.story.d.ts.map +1 -1
- package/build-types/scrollable/stories/index.story.d.ts +3 -3
- package/build-types/scrollable/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts +2 -2
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts +2 -2
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/shortcut/index.d.ts +13 -0
- package/build-types/shortcut/index.d.ts.map +1 -1
- package/build-types/shortcut/stories/index.story.d.ts +13 -0
- package/build-types/shortcut/stories/index.story.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -6
- package/build-types/slot-fill/index.d.ts +1 -1
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/snackbar/stories/index.story.d.ts +7 -7
- package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
- package/build-types/snackbar/stories/list.story.d.ts +3 -3
- package/build-types/snackbar/stories/list.story.d.ts.map +1 -1
- package/build-types/spacer/stories/index.story.d.ts +3 -3
- package/build-types/spacer/stories/index.story.d.ts.map +1 -1
- package/build-types/spinner/index.d.ts +0 -1
- package/build-types/spinner/index.d.ts.map +1 -1
- package/build-types/spinner/stories/index.story.d.ts +4 -4
- package/build-types/spinner/stories/index.story.d.ts.map +1 -1
- package/build-types/surface/stories/index.story.d.ts +3 -3
- package/build-types/surface/stories/index.story.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.story.d.ts +2 -2
- package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/text-control/stories/index.story.d.ts +4 -4
- package/build-types/text-control/stories/index.story.d.ts.map +1 -1
- package/build-types/text-highlight/stories/index.story.d.ts +3 -3
- package/build-types/text-highlight/stories/index.story.d.ts.map +1 -1
- package/build-types/textarea-control/stories/index.story.d.ts +3 -3
- package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
- package/build-types/theme/index.d.ts +0 -1
- package/build-types/theme/index.d.ts.map +1 -1
- package/build-types/theme/stories/index.story.d.ts +4 -4
- package/build-types/theme/stories/index.story.d.ts.map +1 -1
- package/build-types/tip/stories/index.story.d.ts +3 -3
- package/build-types/tip/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts +2 -2
- package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/stories/index.story.d.ts +6 -6
- package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toolbar/stories/index.story.d.ts +2 -2
- package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
- package/build-types/tools-panel/stories/index.story.d.ts +8 -8
- package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/component.d.ts +0 -1
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts +2 -2
- package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts +0 -1
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/tree-select/stories/index.story.d.ts +2 -2
- package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
- package/build-types/truncate/stories/index.story.d.ts +4 -4
- package/build-types/truncate/stories/index.story.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +0 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/stories/index.story.d.ts +7 -7
- package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
- package/build-types/utils/hooks/use-cx.d.ts +2 -1
- package/build-types/utils/hooks/use-cx.d.ts.map +1 -1
- package/build-types/v-stack/stories/e2e/index.story.d.ts +3 -3
- package/build-types/v-stack/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.story.d.ts +2 -2
- package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
- package/build-types/view/component.d.ts +0 -1
- package/build-types/view/component.d.ts.map +1 -1
- package/build-types/view/stories/index.story.d.ts +3 -3
- package/build-types/view/stories/index.story.d.ts.map +1 -1
- package/build-types/visually-hidden/stories/index.story.d.ts +5 -5
- package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -1
- package/build-types/z-stack/stories/index.story.d.ts +3 -3
- package/build-types/z-stack/stories/index.story.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/alignment-matrix-control/stories/index.story.tsx +7 -3
- package/src/angle-picker-control/stories/index.story.tsx +3 -3
- package/src/animate/stories/index.story.tsx +12 -10
- package/src/base-control/stories/index.story.tsx +5 -9
- package/src/border-box-control/stories/index.story.tsx +5 -9
- package/src/border-control/stories/index.story.tsx +8 -14
- package/src/button/stories/e2e/index.story.tsx +3 -3
- package/src/button/stories/index.story.tsx +10 -10
- package/src/button-group/stories/index.story.tsx +4 -6
- package/src/card/stories/index.story.tsx +5 -5
- package/src/checkbox-control/stories/index.story.tsx +7 -6
- package/src/circular-option-picker/stories/index.story.tsx +16 -4
- package/src/color-indicator/stories/index.story.tsx +4 -6
- package/src/color-palette/stories/index.story.tsx +12 -21
- package/src/color-picker/hsv-color-picker.native.js +88 -0
- package/src/color-picker/hue-picker.native.js +194 -0
- package/src/color-picker/index.native.js +2 -1
- package/src/color-picker/saturation-picker.native.js +163 -0
- package/src/color-picker/stories/index.story.tsx +3 -3
- package/src/color-picker/style.native.scss +23 -0
- package/src/combobox-control/stories/index.story.tsx +3 -3
- package/src/custom-gradient-picker/stories/index.story.tsx +3 -3
- package/src/date-time/stories/date-time.story.tsx +8 -10
- package/src/date-time/stories/date.story.tsx +8 -9
- package/src/date-time/stories/time.story.tsx +4 -4
- package/src/dimension-control/stories/index.story.tsx +3 -3
- package/src/disabled/stories/index.story.tsx +4 -4
- package/src/divider/stories/index.story.tsx +6 -6
- package/src/draggable/stories/index.story.tsx +5 -7
- package/src/drop-zone/stories/index.story.tsx +3 -3
- package/src/dropdown/stories/index.story.tsx +8 -6
- package/src/dropdown-menu/stories/index.story.tsx +3 -3
- package/src/dropdown-menu-v2/stories/index.story.tsx +24 -10
- package/src/duotone-picker/stories/duotone-picker.story.tsx +3 -6
- package/src/duotone-picker/stories/duotone-swatch.story.tsx +3 -3
- package/src/elevation/stories/index.story.tsx +7 -7
- package/src/external-link/stories/index.story.tsx +4 -6
- package/src/flex/stories/index.story.tsx +6 -6
- package/src/focal-point-picker/stories/index.story.tsx +3 -3
- package/src/font-size-picker/stories/e2e/index.story.tsx +3 -3
- package/src/font-size-picker/stories/index.story.tsx +10 -10
- package/src/form-file-upload/stories/index.story.tsx +3 -3
- package/src/form-toggle/stories/index.story.tsx +4 -7
- package/src/form-token-field/stories/index.story.tsx +10 -11
- package/src/gradient-picker/stories/index.story.tsx +3 -3
- package/src/grid/stories/index.story.tsx +4 -4
- package/src/guide/stories/index.story.tsx +3 -3
- package/src/h-stack/stories/e2e/index.story.tsx +4 -4
- package/src/h-stack/stories/index.story.tsx +4 -4
- package/src/heading/stories/index.story.tsx +3 -3
- package/src/icon/stories/index.story.tsx +5 -5
- package/src/input-control/stories/index.story.tsx +5 -3
- package/src/item-group/item/component.tsx +0 -1
- package/src/item-group/item-group/component.tsx +0 -1
- package/src/item-group/stories/index.story.tsx +11 -12
- package/src/keyboard-shortcuts/stories/index.story.tsx +3 -3
- package/src/menu-group/stories/index.story.tsx +5 -5
- package/src/menu-item/README.md +1 -1
- package/src/menu-item/index.tsx +5 -2
- package/src/menu-item/stories/index.story.tsx +80 -0
- package/src/menu-item/types.ts +3 -2
- package/src/menu-items-choice/stories/index.story.tsx +4 -6
- package/src/mobile/link-settings/link-settings-navigation.native.js +1 -1
- package/src/modal/stories/index.story.tsx +5 -10
- package/src/navigable-container/stories/navigable-menu.story.tsx +3 -3
- package/src/navigable-container/stories/tabbable-container.story.tsx +3 -3
- package/src/navigation/index.tsx +0 -1
- package/src/navigation/stories/index.story.tsx +16 -2
- package/src/navigation/stories/utils/controlled-state.tsx +2 -2
- package/src/navigation/stories/utils/default.tsx +2 -2
- package/src/navigation/stories/utils/group.tsx +2 -2
- package/src/navigation/stories/utils/hide-if-empty.tsx +2 -2
- package/src/navigation/stories/utils/more-examples.tsx +2 -2
- package/src/navigation/stories/utils/search.tsx +2 -2
- package/src/navigator/navigator-provider/component.tsx +0 -1
- package/src/navigator/stories/index.story.tsx +9 -10
- package/src/notice/stories/index.story.tsx +6 -6
- package/src/number-control/stories/index.story.tsx +3 -3
- package/src/palette-edit/stories/index.story.tsx +3 -3
- package/src/palette-edit/styles.js +0 -1
- package/src/panel/stories/index.story.tsx +9 -11
- package/src/placeholder/stories/index.story.tsx +4 -6
- package/src/popover/README.md +2 -2
- package/src/popover/index.tsx +69 -103
- package/src/popover/overlay-middlewares.tsx +2 -2
- package/src/popover/stories/index.story.tsx +8 -10
- package/src/popover/test/index.tsx +15 -1
- package/src/popover/types.ts +6 -0
- package/src/popover/utils.ts +5 -56
- package/src/progress-bar/stories/index.story.tsx +4 -6
- package/src/progress-bar/styles.ts +4 -1
- package/src/query-controls/stories/index.story.tsx +5 -6
- package/src/radio-control/stories/index.story.tsx +4 -6
- package/src/radio-group/stories/index.story.js +1 -0
- package/src/range-control/stories/index.story.tsx +12 -18
- package/src/resizable-box/stories/index.story.tsx +3 -3
- package/src/responsive-wrapper/stories/index.story.tsx +4 -5
- package/src/sandbox/stories/index.story.tsx +3 -5
- package/src/scroll-lock/stories/index.story.tsx +3 -3
- package/src/scrollable/stories/index.story.tsx +4 -4
- package/src/search-control/index.native.js +39 -27
- package/src/search-control/stories/index.story.tsx +3 -3
- package/src/select-control/stories/index.story.tsx +3 -3
- package/src/shortcut/index.tsx +13 -0
- package/src/shortcut/stories/index.story.tsx +33 -0
- package/src/slot-fill/README.md +5 -5
- package/src/slot-fill/bubbles-virtually/slot-fill-context.js +3 -0
- package/src/slot-fill/bubbles-virtually/slot.js +17 -5
- package/src/slot-fill/index.js +6 -1
- package/src/slot-fill/stories/index.story.js +2 -0
- package/src/slot-fill/test/__snapshots__/slot.js.snap +12 -4
- package/src/snackbar/stories/index.story.tsx +10 -13
- package/src/snackbar/stories/list.story.tsx +3 -3
- package/src/spacer/stories/index.story.tsx +4 -4
- package/src/spinner/index.tsx +0 -1
- package/src/spinner/stories/index.story.tsx +5 -5
- package/src/surface/stories/index.story.tsx +4 -4
- package/src/tab-panel/stories/index.story.tsx +5 -13
- package/src/tab-panel/test/index.tsx +9 -25
- package/src/text-control/stories/index.story.tsx +7 -6
- package/src/text-highlight/stories/index.story.tsx +4 -6
- package/src/textarea-control/stories/index.story.tsx +4 -6
- package/src/theme/index.tsx +0 -1
- package/src/theme/stories/index.story.tsx +5 -5
- package/src/tip/stories/index.story.tsx +4 -4
- package/src/toggle-control/stories/index.story.tsx +3 -3
- package/src/toggle-group-control/stories/index.story.tsx +17 -11
- package/src/toolbar/stories/index.story.tsx +13 -3
- package/src/tools-panel/stories/index.story.tsx +17 -12
- package/src/tools-panel/tools-panel/component.tsx +0 -1
- package/src/tools-panel/tools-panel-header/component.tsx +3 -0
- package/src/tree-grid/stories/index.story.tsx +5 -3
- package/src/tree-select/index.tsx +0 -1
- package/src/tree-select/stories/index.story.tsx +3 -3
- package/src/truncate/stories/index.story.tsx +5 -7
- package/src/unit-control/index.tsx +0 -1
- package/src/unit-control/stories/index.story.tsx +10 -9
- package/src/utils/hooks/use-cx.ts +2 -1
- package/src/v-stack/stories/e2e/index.story.tsx +4 -4
- package/src/v-stack/stories/index.story.tsx +3 -3
- package/src/view/component.tsx +0 -1
- package/src/view/stories/index.story.tsx +4 -4
- package/src/visually-hidden/stories/index.story.tsx +7 -7
- package/src/z-stack/stories/index.story.tsx +4 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/build/popover/limit-shift.js +0 -129
- package/build/popover/limit-shift.js.map +0 -1
- package/build-module/popover/limit-shift.js +0 -122
- package/build-module/popover/limit-shift.js.map +0 -1
- package/build-types/popover/limit-shift.d.ts +0 -87
- package/build-types/popover/limit-shift.d.ts.map +0 -1
- package/src/popover/limit-shift.ts +0 -205
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import ColorIndicator from '..';
|
|
10
10
|
|
|
11
|
-
const meta:
|
|
11
|
+
const meta: Meta< typeof ColorIndicator > = {
|
|
12
12
|
component: ColorIndicator,
|
|
13
13
|
title: 'Components/ColorIndicator',
|
|
14
14
|
argTypes: {
|
|
@@ -25,13 +25,11 @@ const meta: ComponentMeta< typeof ColorIndicator > = {
|
|
|
25
25
|
};
|
|
26
26
|
export default meta;
|
|
27
27
|
|
|
28
|
-
const Template:
|
|
28
|
+
const Template: StoryFn< typeof ColorIndicator > = ( { ...args } ) => (
|
|
29
29
|
<ColorIndicator { ...args } />
|
|
30
30
|
);
|
|
31
31
|
|
|
32
|
-
export const Default:
|
|
33
|
-
{}
|
|
34
|
-
);
|
|
32
|
+
export const Default: StoryFn< typeof ColorIndicator > = Template.bind( {} );
|
|
35
33
|
Default.args = {
|
|
36
34
|
colorValue: '#0073aa',
|
|
37
35
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import type { CSSProperties } from 'react';
|
|
5
|
-
import type {
|
|
5
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -13,10 +13,8 @@ import { useState } from '@wordpress/element';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import ColorPalette from '..';
|
|
16
|
-
import Popover from '../../popover';
|
|
17
|
-
import { Provider as SlotFillProvider } from '../../slot-fill';
|
|
18
16
|
|
|
19
|
-
const meta:
|
|
17
|
+
const meta: Meta< typeof ColorPalette > = {
|
|
20
18
|
title: 'Components/ColorPalette',
|
|
21
19
|
component: ColorPalette,
|
|
22
20
|
argTypes: {
|
|
@@ -31,25 +29,18 @@ const meta: ComponentMeta< typeof ColorPalette > = {
|
|
|
31
29
|
};
|
|
32
30
|
export default meta;
|
|
33
31
|
|
|
34
|
-
const Template:
|
|
35
|
-
onChange,
|
|
36
|
-
...args
|
|
37
|
-
} ) => {
|
|
32
|
+
const Template: StoryFn< typeof ColorPalette > = ( { onChange, ...args } ) => {
|
|
38
33
|
const [ color, setColor ] = useState< string | undefined >();
|
|
39
34
|
|
|
40
35
|
return (
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/>
|
|
50
|
-
{ /* @ts-expect-error The 'Slot' component hasn't been typed yet. */ }
|
|
51
|
-
<Popover.Slot />
|
|
52
|
-
</SlotFillProvider>
|
|
36
|
+
<ColorPalette
|
|
37
|
+
{ ...args }
|
|
38
|
+
value={ color }
|
|
39
|
+
onChange={ ( newColor ) => {
|
|
40
|
+
setColor( newColor );
|
|
41
|
+
onChange?.( newColor );
|
|
42
|
+
} }
|
|
43
|
+
/>
|
|
53
44
|
);
|
|
54
45
|
};
|
|
55
46
|
|
|
@@ -84,7 +75,7 @@ MultipleOrigins.args = {
|
|
|
84
75
|
],
|
|
85
76
|
};
|
|
86
77
|
|
|
87
|
-
export const CSSVariables:
|
|
78
|
+
export const CSSVariables: StoryFn< typeof ColorPalette > = ( args ) => {
|
|
88
79
|
return (
|
|
89
80
|
<div
|
|
90
81
|
style={
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { View, Dimensions } from 'react-native';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useRef } from '@wordpress/element';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import HuePicker from './hue-picker';
|
|
15
|
+
import SaturationValuePicker from './saturation-picker';
|
|
16
|
+
import styles from './style.native.scss';
|
|
17
|
+
|
|
18
|
+
const HsvColorPicker = ( props ) => {
|
|
19
|
+
const maxWidth = Dimensions.get( 'window' ).width - 32;
|
|
20
|
+
const satValPickerRef = useRef( null );
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
containerStyle = {},
|
|
24
|
+
currentColor,
|
|
25
|
+
huePickerContainerStyle = {},
|
|
26
|
+
huePickerBorderRadius = 0,
|
|
27
|
+
huePickerHue = 0,
|
|
28
|
+
huePickerBarWidth = maxWidth,
|
|
29
|
+
huePickerBarHeight = 12,
|
|
30
|
+
huePickerSliderSize = 24,
|
|
31
|
+
onHuePickerDragStart,
|
|
32
|
+
onHuePickerDragMove,
|
|
33
|
+
onHuePickerDragEnd,
|
|
34
|
+
onHuePickerDragTerminate,
|
|
35
|
+
onHuePickerPress,
|
|
36
|
+
satValPickerContainerStyle = {},
|
|
37
|
+
satValPickerBorderRadius = 0,
|
|
38
|
+
satValPickerSize = { width: maxWidth, height: 200 },
|
|
39
|
+
satValPickerSliderSize = 24,
|
|
40
|
+
satValPickerHue = 0,
|
|
41
|
+
satValPickerSaturation = 1,
|
|
42
|
+
satValPickerValue = 1,
|
|
43
|
+
onSatValPickerDragStart,
|
|
44
|
+
onSatValPickerDragMove,
|
|
45
|
+
onSatValPickerDragEnd,
|
|
46
|
+
onSatValPickerDragTerminate,
|
|
47
|
+
onSatValPickerPress,
|
|
48
|
+
} = props;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<View
|
|
52
|
+
style={ [ styles[ 'hsv-container' ], containerStyle ] }
|
|
53
|
+
testID="hsv-color-picker"
|
|
54
|
+
>
|
|
55
|
+
<SaturationValuePicker
|
|
56
|
+
containerStyle={ satValPickerContainerStyle }
|
|
57
|
+
currentColor={ currentColor }
|
|
58
|
+
borderRadius={ satValPickerBorderRadius }
|
|
59
|
+
size={ satValPickerSize }
|
|
60
|
+
sliderSize={ satValPickerSliderSize }
|
|
61
|
+
hue={ satValPickerHue }
|
|
62
|
+
saturation={ satValPickerSaturation }
|
|
63
|
+
value={ satValPickerValue }
|
|
64
|
+
onDragStart={ onSatValPickerDragStart }
|
|
65
|
+
onDragMove={ onSatValPickerDragMove }
|
|
66
|
+
onDragEnd={ onSatValPickerDragEnd }
|
|
67
|
+
onDragTerminate={ onSatValPickerDragTerminate }
|
|
68
|
+
onPress={ onSatValPickerPress }
|
|
69
|
+
ref={ satValPickerRef }
|
|
70
|
+
/>
|
|
71
|
+
<HuePicker
|
|
72
|
+
containerStyle={ huePickerContainerStyle }
|
|
73
|
+
borderRadius={ huePickerBorderRadius }
|
|
74
|
+
hue={ huePickerHue }
|
|
75
|
+
barWidth={ huePickerBarWidth }
|
|
76
|
+
barHeight={ huePickerBarHeight }
|
|
77
|
+
sliderSize={ huePickerSliderSize }
|
|
78
|
+
onDragStart={ onHuePickerDragStart }
|
|
79
|
+
onDragMove={ onHuePickerDragMove }
|
|
80
|
+
onDragEnd={ onHuePickerDragEnd }
|
|
81
|
+
onDragTerminate={ onHuePickerDragTerminate }
|
|
82
|
+
onPress={ onHuePickerPress }
|
|
83
|
+
/>
|
|
84
|
+
</View>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export default HsvColorPicker;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Animated, View, PanResponder } from 'react-native';
|
|
5
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import React, { Component } from '@wordpress/element';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import styles from './style.scss';
|
|
16
|
+
|
|
17
|
+
export default class HuePicker extends Component {
|
|
18
|
+
constructor( props ) {
|
|
19
|
+
super( props );
|
|
20
|
+
this.hueColors = [
|
|
21
|
+
'#ff0000',
|
|
22
|
+
'#ffff00',
|
|
23
|
+
'#00ff00',
|
|
24
|
+
'#00ffff',
|
|
25
|
+
'#0000ff',
|
|
26
|
+
'#ff00ff',
|
|
27
|
+
'#ff0000',
|
|
28
|
+
];
|
|
29
|
+
this.sliderX = new Animated.Value(
|
|
30
|
+
( props.barHeight * props.hue ) / 360
|
|
31
|
+
);
|
|
32
|
+
this.panResponder = PanResponder.create( {
|
|
33
|
+
onStartShouldSetPanResponder: () => true,
|
|
34
|
+
onStartShouldSetPanResponderCapture: () => true,
|
|
35
|
+
onMoveShouldSetPanResponder: () => true,
|
|
36
|
+
onMoveShouldSetPanResponderCapture: () => true,
|
|
37
|
+
onPanResponderGrant: ( evt, gestureState ) => {
|
|
38
|
+
const { onPress } = this.props;
|
|
39
|
+
this.dragStartValue = this.computeHueValuePress( evt );
|
|
40
|
+
|
|
41
|
+
if ( onPress ) {
|
|
42
|
+
onPress( {
|
|
43
|
+
hue: this.computeHueValuePress( evt ),
|
|
44
|
+
nativeEvent: evt.nativeEvent,
|
|
45
|
+
} );
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this.fireDragEvent( 'onDragStart', gestureState );
|
|
49
|
+
},
|
|
50
|
+
onPanResponderMove: ( evt, gestureState ) => {
|
|
51
|
+
this.fireDragEvent( 'onDragMove', gestureState );
|
|
52
|
+
},
|
|
53
|
+
onPanResponderTerminationRequest: () => true,
|
|
54
|
+
onPanResponderRelease: ( evt, gestureState ) => {
|
|
55
|
+
this.fireDragEvent( 'onDragEnd', gestureState );
|
|
56
|
+
},
|
|
57
|
+
onPanResponderTerminate: ( evt, gestureState ) => {
|
|
58
|
+
this.fireDragEvent( 'onDragTerminate', gestureState );
|
|
59
|
+
},
|
|
60
|
+
onShouldBlockNativeResponder: () => true,
|
|
61
|
+
} );
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
componentDidUpdate( prevProps ) {
|
|
65
|
+
const { hue = 0, barWidth = 200, sliderSize = 24 } = this.props;
|
|
66
|
+
const borderWidth = sliderSize / 10;
|
|
67
|
+
if ( prevProps.hue !== hue || prevProps.barWidth !== barWidth ) {
|
|
68
|
+
this.sliderX.setValue(
|
|
69
|
+
( ( barWidth - sliderSize + borderWidth ) * hue ) / 360
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
normalizeValue( value ) {
|
|
75
|
+
if ( value < 0 ) return 0;
|
|
76
|
+
if ( value > 1 ) return 1;
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
getContainerStyle() {
|
|
81
|
+
const {
|
|
82
|
+
sliderSize = 24,
|
|
83
|
+
barHeight = 12,
|
|
84
|
+
containerStyle = {},
|
|
85
|
+
} = this.props;
|
|
86
|
+
const paddingLeft = sliderSize / 2;
|
|
87
|
+
const paddingTop =
|
|
88
|
+
sliderSize - barHeight > 0 ? ( sliderSize - barHeight ) / 2 : 0;
|
|
89
|
+
return [
|
|
90
|
+
styles[ 'hsv-container' ],
|
|
91
|
+
containerStyle,
|
|
92
|
+
{
|
|
93
|
+
paddingTop,
|
|
94
|
+
paddingBottom: paddingTop,
|
|
95
|
+
paddingLeft,
|
|
96
|
+
paddingRight: paddingLeft,
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
computeHueValueDrag( gestureState ) {
|
|
102
|
+
const { dx } = gestureState;
|
|
103
|
+
const { barWidth = 200 } = this.props;
|
|
104
|
+
const { dragStartValue } = this;
|
|
105
|
+
const diff = dx / barWidth;
|
|
106
|
+
const updatedHue =
|
|
107
|
+
this.normalizeValue( dragStartValue / 360 + diff ) * 360;
|
|
108
|
+
return updatedHue;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
computeHueValuePress( event ) {
|
|
112
|
+
const { nativeEvent } = event;
|
|
113
|
+
const { locationX } = nativeEvent;
|
|
114
|
+
const { barWidth = 200 } = this.props;
|
|
115
|
+
const updatedHue = this.normalizeValue( locationX / barWidth ) * 360;
|
|
116
|
+
return updatedHue;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
fireDragEvent( eventName, gestureState ) {
|
|
120
|
+
const { [ eventName ]: event } = this.props;
|
|
121
|
+
if ( event ) {
|
|
122
|
+
event( {
|
|
123
|
+
hue: this.computeHueValueDrag( gestureState ),
|
|
124
|
+
gestureState,
|
|
125
|
+
} );
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
firePressEvent( event ) {
|
|
130
|
+
const { onPress } = this.props;
|
|
131
|
+
if ( onPress ) {
|
|
132
|
+
onPress( {
|
|
133
|
+
hue: this.computeHueValuePress( event ),
|
|
134
|
+
nativeEvent: event.nativeEvent,
|
|
135
|
+
} );
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
render() {
|
|
140
|
+
const { hueColors } = this;
|
|
141
|
+
const {
|
|
142
|
+
sliderSize = 24,
|
|
143
|
+
barWidth = 200,
|
|
144
|
+
barHeight = 12,
|
|
145
|
+
borderRadius = 0,
|
|
146
|
+
} = this.props;
|
|
147
|
+
const borderWidth = sliderSize / 10;
|
|
148
|
+
return (
|
|
149
|
+
<View
|
|
150
|
+
style={ this.getContainerStyle() }
|
|
151
|
+
{ ...this.panResponder.panHandlers }
|
|
152
|
+
hitSlop={ {
|
|
153
|
+
top: 10,
|
|
154
|
+
bottom: 10,
|
|
155
|
+
left: 0,
|
|
156
|
+
right: 0,
|
|
157
|
+
} }
|
|
158
|
+
>
|
|
159
|
+
<LinearGradient
|
|
160
|
+
colors={ hueColors }
|
|
161
|
+
style={ {
|
|
162
|
+
borderRadius,
|
|
163
|
+
} }
|
|
164
|
+
start={ { x: 0, y: 0 } }
|
|
165
|
+
end={ { x: 1, y: 0 } }
|
|
166
|
+
>
|
|
167
|
+
<View
|
|
168
|
+
style={ {
|
|
169
|
+
width: barWidth,
|
|
170
|
+
height: barHeight,
|
|
171
|
+
} }
|
|
172
|
+
/>
|
|
173
|
+
</LinearGradient>
|
|
174
|
+
<Animated.View
|
|
175
|
+
pointerEvents="none"
|
|
176
|
+
style={ [
|
|
177
|
+
styles[ 'hue-slider' ],
|
|
178
|
+
{
|
|
179
|
+
width: sliderSize,
|
|
180
|
+
height: sliderSize,
|
|
181
|
+
left: ( sliderSize - borderWidth ) / 2,
|
|
182
|
+
borderRadius: sliderSize / 2,
|
|
183
|
+
transform: [
|
|
184
|
+
{
|
|
185
|
+
translateX: this.sliderX,
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
},
|
|
189
|
+
] }
|
|
190
|
+
/>
|
|
191
|
+
</View>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { View, Text, TouchableWithoutFeedback, Platform } from 'react-native';
|
|
5
|
-
import HsvColorPicker from 'react-native-hsv-color-picker';
|
|
6
5
|
import { colord, extend } from 'colord';
|
|
7
6
|
import namesPlugin from 'colord/plugins/names';
|
|
8
7
|
/**
|
|
@@ -17,6 +16,7 @@ import { Icon, check, close } from '@wordpress/icons';
|
|
|
17
16
|
* Internal dependencies
|
|
18
17
|
*/
|
|
19
18
|
import styles from './style.scss';
|
|
19
|
+
import HsvColorPicker from './hsv-color-picker.native.js';
|
|
20
20
|
|
|
21
21
|
extend( [ namesPlugin ] );
|
|
22
22
|
|
|
@@ -122,6 +122,7 @@ function ColorPicker( {
|
|
|
122
122
|
<>
|
|
123
123
|
<HsvColorPicker
|
|
124
124
|
huePickerHue={ hue }
|
|
125
|
+
currentColor={ currentColor }
|
|
125
126
|
onHuePickerDragMove={ updateColor }
|
|
126
127
|
onHuePickerPress={
|
|
127
128
|
! isBottomSheetContentScrolling && updateColor
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { View, PanResponder } from 'react-native';
|
|
5
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
6
|
+
import { colord } from 'colord';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
import React, { Component } from '@wordpress/element';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import styles from './style.native.scss';
|
|
17
|
+
|
|
18
|
+
export default class SaturationValuePicker extends Component {
|
|
19
|
+
constructor( props ) {
|
|
20
|
+
super( props );
|
|
21
|
+
|
|
22
|
+
this.panResponder = PanResponder.create( {
|
|
23
|
+
onStartShouldSetPanResponder: () => true,
|
|
24
|
+
onStartShouldSetPanResponderCapture: () => true,
|
|
25
|
+
onMoveShouldSetPanResponder: () => true,
|
|
26
|
+
onMoveShouldSetPanResponderCapture: () => true,
|
|
27
|
+
onPanResponderGrant: ( evt, gestureState ) => {
|
|
28
|
+
const { onPress } = this.props;
|
|
29
|
+
const { saturation, value } = this.computeSatValPress( evt );
|
|
30
|
+
this.dragStartValue = {
|
|
31
|
+
saturation,
|
|
32
|
+
value,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
if ( onPress ) {
|
|
36
|
+
onPress( {
|
|
37
|
+
...this.computeSatValPress( evt ),
|
|
38
|
+
nativeEvent: evt.nativeEvent,
|
|
39
|
+
} );
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
this.fireDragEvent( 'onDragStart', gestureState );
|
|
43
|
+
},
|
|
44
|
+
onPanResponderMove: ( evt, gestureState ) => {
|
|
45
|
+
this.fireDragEvent( 'onDragMove', gestureState );
|
|
46
|
+
},
|
|
47
|
+
onPanResponderTerminationRequest: () => true,
|
|
48
|
+
onPanResponderRelease: ( evt, gestureState ) => {
|
|
49
|
+
this.fireDragEvent( 'onDragEnd', gestureState );
|
|
50
|
+
},
|
|
51
|
+
onPanResponderTerminate: ( evt, gestureState ) => {
|
|
52
|
+
this.fireDragEvent( 'onDragTerminate', gestureState );
|
|
53
|
+
},
|
|
54
|
+
onShouldBlockNativeResponder: () => true,
|
|
55
|
+
} );
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
normalizeValue( value ) {
|
|
59
|
+
if ( value < 0 ) return 0;
|
|
60
|
+
if ( value > 1 ) return 1;
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
computeSatValDrag( gestureState ) {
|
|
65
|
+
const { dx, dy } = gestureState;
|
|
66
|
+
const { size } = this.props;
|
|
67
|
+
const { saturation, value } = this.dragStartValue;
|
|
68
|
+
const diffx = dx / size.width;
|
|
69
|
+
const diffy = dy / size.height;
|
|
70
|
+
return {
|
|
71
|
+
saturation: this.normalizeValue( saturation + diffx ),
|
|
72
|
+
value: this.normalizeValue( value - diffy ),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
computeSatValPress( event ) {
|
|
77
|
+
const { nativeEvent } = event;
|
|
78
|
+
const { locationX, locationY } = nativeEvent;
|
|
79
|
+
const { size } = this.props;
|
|
80
|
+
return {
|
|
81
|
+
saturation: this.normalizeValue( locationX / size.width ),
|
|
82
|
+
value: 1 - this.normalizeValue( locationY / size.height ),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
fireDragEvent( eventName, gestureState ) {
|
|
87
|
+
const { [ eventName ]: event } = this.props;
|
|
88
|
+
if ( event ) {
|
|
89
|
+
event( {
|
|
90
|
+
...this.computeSatValDrag( gestureState ),
|
|
91
|
+
gestureState,
|
|
92
|
+
} );
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
render() {
|
|
97
|
+
const {
|
|
98
|
+
size,
|
|
99
|
+
sliderSize = 24,
|
|
100
|
+
hue = 0,
|
|
101
|
+
value = 1,
|
|
102
|
+
saturation = 1,
|
|
103
|
+
containerStyle = {},
|
|
104
|
+
borderRadius = 0,
|
|
105
|
+
currentColor,
|
|
106
|
+
} = this.props;
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<View
|
|
110
|
+
style={ [
|
|
111
|
+
styles[ 'hsv-container' ],
|
|
112
|
+
containerStyle,
|
|
113
|
+
{
|
|
114
|
+
height: size.height + sliderSize,
|
|
115
|
+
width: size.width + sliderSize,
|
|
116
|
+
},
|
|
117
|
+
] }
|
|
118
|
+
{ ...this.panResponder.panHandlers }
|
|
119
|
+
>
|
|
120
|
+
<LinearGradient
|
|
121
|
+
style={ [
|
|
122
|
+
styles[ 'gradient-container' ],
|
|
123
|
+
{
|
|
124
|
+
borderRadius,
|
|
125
|
+
},
|
|
126
|
+
] }
|
|
127
|
+
colors={ [
|
|
128
|
+
'#fff',
|
|
129
|
+
colord( { h: hue, s: 100, l: 50 } ).toHex(),
|
|
130
|
+
] }
|
|
131
|
+
start={ { x: 0, y: 0.5 } }
|
|
132
|
+
end={ { x: 1, y: 0.5 } }
|
|
133
|
+
>
|
|
134
|
+
<LinearGradient colors={ [ 'rgba(0, 0, 0, 0)', '#000' ] }>
|
|
135
|
+
<View
|
|
136
|
+
style={ {
|
|
137
|
+
height: size.height,
|
|
138
|
+
width: size.width,
|
|
139
|
+
} }
|
|
140
|
+
/>
|
|
141
|
+
</LinearGradient>
|
|
142
|
+
</LinearGradient>
|
|
143
|
+
<View
|
|
144
|
+
pointerEvents="none"
|
|
145
|
+
style={ [
|
|
146
|
+
styles[ 'saturation-slider' ],
|
|
147
|
+
{
|
|
148
|
+
width: sliderSize,
|
|
149
|
+
height: sliderSize,
|
|
150
|
+
borderRadius: sliderSize / 2,
|
|
151
|
+
borderWidth: sliderSize / 10,
|
|
152
|
+
backgroundColor: currentColor,
|
|
153
|
+
transform: [
|
|
154
|
+
{ translateX: size.width * saturation },
|
|
155
|
+
{ translateY: size.height * ( 1 - value ) },
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
] }
|
|
159
|
+
/>
|
|
160
|
+
</View>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -13,7 +13,7 @@ import { useState } from '@wordpress/element';
|
|
|
13
13
|
*/
|
|
14
14
|
import { ColorPicker } from '../component';
|
|
15
15
|
|
|
16
|
-
const meta:
|
|
16
|
+
const meta: Meta< typeof ColorPicker > = {
|
|
17
17
|
component: ColorPicker,
|
|
18
18
|
title: 'Components/ColorPicker',
|
|
19
19
|
argTypes: {
|
|
@@ -30,7 +30,7 @@ const meta: ComponentMeta< typeof ColorPicker > = {
|
|
|
30
30
|
};
|
|
31
31
|
export default meta;
|
|
32
32
|
|
|
33
|
-
const Template:
|
|
33
|
+
const Template: StoryFn< typeof ColorPicker > = ( { onChange, ...props } ) => {
|
|
34
34
|
const [ color, setColor ] = useState< string | undefined >();
|
|
35
35
|
|
|
36
36
|
return (
|
|
@@ -62,3 +62,26 @@
|
|
|
62
62
|
.pickerPointer {
|
|
63
63
|
height: 16px;
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
.hsv-container {
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.gradient-gontainer {
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.saturation-slider {
|
|
76
|
+
top: 0;
|
|
77
|
+
left: 0;
|
|
78
|
+
position: absolute;
|
|
79
|
+
border-color: $white;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.hue-slider {
|
|
83
|
+
position: absolute;
|
|
84
|
+
background-color: #fff;
|
|
85
|
+
box-shadow: 0 7px 10px rgba(0, 0, 0, 0.5);
|
|
86
|
+
z-index: 5;
|
|
87
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -22,7 +22,7 @@ const countries = [
|
|
|
22
22
|
{ name: 'American Samoa', code: 'AS' },
|
|
23
23
|
];
|
|
24
24
|
|
|
25
|
-
const meta:
|
|
25
|
+
const meta: Meta< typeof ComboboxControl > = {
|
|
26
26
|
title: 'Components/ComboboxControl',
|
|
27
27
|
component: ComboboxControl,
|
|
28
28
|
argTypes: {
|
|
@@ -43,7 +43,7 @@ const mapCountryOption = ( country: ( typeof countries )[ number ] ) => ( {
|
|
|
43
43
|
|
|
44
44
|
const countryOptions = countries.map( mapCountryOption );
|
|
45
45
|
|
|
46
|
-
const Template:
|
|
46
|
+
const Template: StoryFn< typeof ComboboxControl > = ( {
|
|
47
47
|
onChange,
|
|
48
48
|
...args
|
|
49
49
|
} ) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { Meta, StoryFn } from '@storybook/react';
|
|
5
5
|
/**
|
|
6
6
|
* WordPress dependencies
|
|
7
7
|
*/
|
|
@@ -12,7 +12,7 @@ import { useState } from '@wordpress/element';
|
|
|
12
12
|
*/
|
|
13
13
|
import CustomGradientPicker from '../';
|
|
14
14
|
|
|
15
|
-
const meta:
|
|
15
|
+
const meta: Meta< typeof CustomGradientPicker > = {
|
|
16
16
|
title: 'Components/CustomGradientPicker',
|
|
17
17
|
component: CustomGradientPicker,
|
|
18
18
|
parameters: {
|
|
@@ -23,7 +23,7 @@ const meta: ComponentMeta< typeof CustomGradientPicker > = {
|
|
|
23
23
|
};
|
|
24
24
|
export default meta;
|
|
25
25
|
|
|
26
|
-
const CustomGradientPickerWithState:
|
|
26
|
+
const CustomGradientPickerWithState: StoryFn<
|
|
27
27
|
typeof CustomGradientPicker
|
|
28
28
|
> = ( { onChange, ...props } ) => {
|
|
29
29
|
const [ gradient, setGradient ] = useState< string >();
|