@wordpress/components 23.8.0 → 24.0.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 +71 -0
- package/CONTRIBUTING.md +65 -1
- package/README.md +1 -3
- package/build/autocomplete/autocompleter-ui.js +0 -2
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/index.js +2 -0
- package/build/autocomplete/index.js.map +1 -1
- package/build/button/index.js +2 -0
- package/build/button/index.js.map +1 -1
- package/build/card/card-media/component.js +2 -1
- package/build/card/card-media/component.js.map +1 -1
- package/build/checkbox-control/index.js +2 -2
- package/build/checkbox-control/index.js.map +1 -1
- package/build/color-palette/index.native.js +12 -0
- package/build/color-palette/index.native.js.map +1 -1
- package/build/combobox-control/index.js +7 -5
- package/build/combobox-control/index.js.map +1 -1
- package/build/combobox-control/styles.js +3 -3
- package/build/combobox-control/styles.js.map +1 -1
- package/build/custom-gradient-picker/index.native.js +3 -1
- package/build/custom-gradient-picker/index.native.js.map +1 -1
- package/build/dimension-control/index.js +1 -1
- package/build/dimension-control/index.js.map +1 -1
- package/build/draggable/index.js +8 -8
- package/build/draggable/index.js.map +1 -1
- package/build/form-token-field/index.js +5 -3
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/styles.js +3 -3
- package/build/form-token-field/styles.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +6 -6
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/color-settings/palette.screen.native.js +0 -8
- package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build/mobile/global-styles-context/index.native.js +13 -1
- package/build/mobile/global-styles-context/index.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +21 -4
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-results.native.js +3 -1
- package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build/mobile/segmented-control/index.native.js +4 -2
- package/build/mobile/segmented-control/index.native.js.map +1 -1
- package/build/modal/index.js +2 -1
- package/build/modal/index.js.map +1 -1
- package/build/navigable-container/container.js +39 -19
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigable-container/index.js.map +1 -1
- package/build/navigable-container/menu.js +37 -5
- package/build/navigable-container/menu.js.map +1 -1
- package/build/navigable-container/tabbable.js +45 -4
- package/build/navigable-container/tabbable.js.map +1 -1
- package/build/navigable-container/types.js +6 -0
- package/build/navigable-container/types.js.map +1 -0
- package/build/navigator/navigator-screen/component.js +1 -1
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/palette-edit/index.js +34 -12
- package/build/palette-edit/index.js.map +1 -1
- package/build/popover/index.js +1 -8
- package/build/popover/index.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/sandbox/index.native.js +10 -3
- package/build/sandbox/index.native.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/fill.js +2 -1
- package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +45 -35
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/use-slot.js +11 -26
- package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build/slot-fill/fill.js +7 -31
- package/build/slot-fill/fill.js.map +1 -1
- package/build/slot-fill/index.js +20 -7
- package/build/slot-fill/index.js.map +1 -1
- package/build/slot-fill/provider.js +0 -6
- package/build/slot-fill/provider.js.map +1 -1
- package/build/slot-fill/slot.js +0 -5
- package/build/slot-fill/slot.js.map +1 -1
- package/build/spinner/styles.js +4 -4
- package/build/spinner/styles.js.map +1 -1
- package/build/tab-panel/index.js.map +1 -1
- package/build/theme/color-algorithms.js +1 -1
- package/build/theme/color-algorithms.js.map +1 -1
- package/build/toolbar/toolbar-button/index.js +1 -2
- package/build/toolbar/toolbar-button/index.js.map +1 -1
- package/build/toolbar/toolbar-item/index.js +4 -2
- package/build/toolbar/toolbar-item/index.js.map +1 -1
- package/build/tree-grid/index.js +3 -3
- package/build/tree-grid/index.js.map +1 -1
- package/build/utils/colors-values.js +3 -3
- package/build/utils/colors-values.js.map +1 -1
- package/build/utils/use-deprecated-props.js +35 -0
- package/build/utils/use-deprecated-props.js.map +1 -0
- package/build/view/component.js +1 -2
- package/build/view/component.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +1 -3
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/index.js +3 -3
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/button/index.js +2 -0
- package/build-module/button/index.js.map +1 -1
- package/build-module/card/card-media/component.js +2 -1
- package/build-module/card/card-media/component.js.map +1 -1
- package/build-module/checkbox-control/index.js +2 -2
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +13 -1
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/combobox-control/index.js +6 -5
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/combobox-control/styles.js +3 -3
- package/build-module/combobox-control/styles.js.map +1 -1
- package/build-module/custom-gradient-picker/index.native.js +3 -1
- package/build-module/custom-gradient-picker/index.native.js.map +1 -1
- package/build-module/dimension-control/index.js +1 -1
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/draggable/index.js +8 -8
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/form-token-field/index.js +4 -3
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/styles.js +3 -3
- package/build-module/form-token-field/styles.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +6 -5
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/color-settings/palette.screen.native.js +0 -8
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/index.native.js +13 -1
- package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +21 -3
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js +3 -1
- package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
- package/build-module/mobile/segmented-control/index.native.js +4 -2
- package/build-module/mobile/segmented-control/index.native.js.map +1 -1
- package/build-module/modal/index.js +2 -1
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigable-container/container.js +43 -19
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigable-container/index.js +0 -2
- package/build-module/navigable-container/index.js.map +1 -1
- package/build-module/navigable-container/menu.js +36 -4
- package/build-module/navigable-container/menu.js.map +1 -1
- package/build-module/navigable-container/tabbable.js +44 -3
- package/build-module/navigable-container/tabbable.js.map +1 -1
- package/build-module/navigable-container/types.js +2 -0
- package/build-module/navigable-container/types.js.map +1 -0
- package/build-module/navigator/navigator-screen/component.js +1 -1
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/palette-edit/index.js +34 -13
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/popover/index.js +1 -8
- package/build-module/popover/index.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/sandbox/index.native.js +10 -3
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/fill.js +2 -1
- package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +46 -36
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot.js +12 -27
- package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build-module/slot-fill/fill.js +7 -31
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/slot-fill/index.js +17 -8
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/slot-fill/provider.js +0 -6
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/slot-fill/slot.js +0 -5
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/spinner/styles.js +4 -4
- package/build-module/spinner/styles.js.map +1 -1
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/theme/color-algorithms.js +1 -1
- package/build-module/theme/color-algorithms.js.map +1 -1
- package/build-module/toolbar/toolbar-button/index.js +1 -2
- package/build-module/toolbar/toolbar-button/index.js.map +1 -1
- package/build-module/toolbar/toolbar-item/index.js +5 -2
- package/build-module/toolbar/toolbar-item/index.js.map +1 -1
- package/build-module/tree-grid/index.js +3 -3
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/utils/colors-values.js +3 -3
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-module/utils/use-deprecated-props.js +25 -0
- package/build-module/utils/use-deprecated-props.js.map +1 -0
- package/build-module/view/component.js +1 -2
- package/build-module/view/component.js.map +1 -1
- package/build-style/style-rtl.css +83 -70
- package/build-style/style.css +83 -70
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/autocomplete/types.d.ts +2 -18
- package/build-types/autocomplete/types.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-styles.d.ts +1 -1
- package/build-types/button/deprecated.d.ts +12 -6
- package/build-types/button/deprecated.d.ts.map +1 -1
- package/build-types/button/index.d.ts.map +1 -1
- package/build-types/button/types.d.ts +7 -0
- package/build-types/button/types.d.ts.map +1 -1
- package/build-types/card/card-media/component.d.ts +2 -1
- package/build-types/card/card-media/component.d.ts.map +1 -1
- package/build-types/card/stories/index.d.ts +21 -1
- package/build-types/card/stories/index.d.ts.map +1 -1
- package/build-types/checkbox-control/index.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +1 -1
- package/build-types/color-picker/styles.d.ts +3 -3
- package/build-types/combobox-control/index.d.ts +1 -1
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.d.ts.map +1 -1
- package/build-types/combobox-control/styles.d.ts +1 -1
- package/build-types/combobox-control/types.d.ts +8 -1
- package/build-types/combobox-control/types.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +1 -1
- package/build-types/date-time/time/styles.d.ts +4 -4
- package/build-types/dimension-control/index.d.ts +1 -1
- package/build-types/draggable/index.d.ts +1 -1
- package/build-types/draggable/index.d.ts.map +1 -1
- package/build-types/draggable/stories/index.d.ts +8 -0
- package/build-types/draggable/stories/index.d.ts.map +1 -1
- package/build-types/draggable/types.d.ts +7 -0
- package/build-types/draggable/types.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/styles.d.ts +1 -1
- package/build-types/form-token-field/types.d.ts +8 -1
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/navigable-container/container.d.ts +20 -1
- package/build-types/navigable-container/container.d.ts.map +1 -1
- package/build-types/navigable-container/index.d.ts +5 -2
- package/build-types/navigable-container/index.d.ts.map +1 -1
- package/build-types/navigable-container/menu.d.ts +45 -11
- package/build-types/navigable-container/menu.d.ts.map +1 -1
- package/build-types/navigable-container/stories/navigable-menu.d.ts +12 -0
- package/build-types/navigable-container/stories/navigable-menu.d.ts.map +1 -0
- package/build-types/navigable-container/stories/tabbable-container.d.ts +12 -0
- package/build-types/navigable-container/stories/tabbable-container.d.ts.map +1 -0
- package/build-types/navigable-container/tabbable.d.ts +52 -9
- package/build-types/navigable-container/tabbable.d.ts.map +1 -1
- package/build-types/navigable-container/test/navigable-menu.d.ts +2 -0
- package/build-types/navigable-container/test/navigable-menu.d.ts.map +1 -0
- package/build-types/navigable-container/test/tababble-container.d.ts +2 -0
- package/build-types/navigable-container/test/tababble-container.d.ts.map +1 -0
- package/build-types/navigable-container/types.d.ts +61 -0
- package/build-types/navigable-container/types.d.ts.map +1 -0
- package/build-types/navigation/styles/navigation-styles.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +2 -1
- package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +2 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/component.d.ts +2 -1
- package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +2 -1
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-to-parent-button/component.d.ts +2 -1
- package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +1 -1
- package/build-types/number-control/stories/index.d.ts +1 -1
- package/build-types/palette-edit/index.d.ts +1 -1
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/palette-edit/stories/index.d.ts.map +1 -1
- package/build-types/palette-edit/styles.d.ts +16 -10
- package/build-types/palette-edit/styles.d.ts.map +1 -1
- package/build-types/palette-edit/types.d.ts +8 -0
- package/build-types/palette-edit/types.d.ts.map +1 -1
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/e2e/index.d.ts +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +1 -1
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
- package/build-types/slot-fill/fill.d.ts +4 -2
- package/build-types/slot-fill/fill.d.ts.map +1 -1
- package/build-types/slot-fill/index.d.ts +14 -3
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/slot-fill/provider.d.ts +0 -2
- 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/spinner/styles.d.ts.map +1 -1
- package/build-types/toolbar/stories/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts +12 -6
- package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-item/index.d.ts +6 -4
- package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
- package/build-types/tree-grid/index.d.ts.map +1 -1
- package/build-types/tree-grid/types.d.ts +7 -0
- package/build-types/tree-grid/types.d.ts.map +1 -1
- package/build-types/ui/context/wordpress-component.d.ts +1 -1
- package/build-types/ui/context/wordpress-component.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/use-deprecated-props.d.ts +9 -0
- package/build-types/utils/use-deprecated-props.d.ts.map +1 -0
- package/build-types/view/component.d.ts +1 -1
- package/build-types/view/component.d.ts.map +1 -1
- package/package.json +21 -22
- package/src/autocomplete/README.md +82 -54
- package/src/autocomplete/autocompleter-ui.tsx +0 -2
- package/src/autocomplete/index.tsx +1 -2
- package/src/autocomplete/types.ts +3 -19
- package/src/button/index.tsx +2 -0
- package/src/button/style.scss +13 -6
- package/src/button/types.ts +7 -0
- package/src/card/card-media/README.md +1 -1
- package/src/card/card-media/component.tsx +2 -1
- package/src/card/stories/index.tsx +47 -26
- package/src/checkbox-control/index.tsx +6 -2
- package/src/checkbox-control/style.scss +1 -4
- package/src/color-palette/index.native.js +20 -1
- package/src/color-picker/test/index.tsx +99 -99
- package/src/combobox-control/index.tsx +24 -18
- package/src/combobox-control/stories/index.tsx +0 -1
- package/src/combobox-control/styles.ts +4 -4
- package/src/combobox-control/types.ts +8 -1
- package/src/custom-gradient-picker/index.native.js +1 -1
- package/src/custom-gradient-picker/style.scss +2 -2
- package/src/dimension-control/README.md +1 -1
- package/src/dimension-control/index.tsx +1 -1
- package/src/draggable/README.md +8 -1
- package/src/draggable/index.tsx +7 -10
- package/src/draggable/stories/index.tsx +69 -33
- package/src/draggable/types.ts +7 -0
- package/src/form-toggle/style.scss +1 -5
- package/src/form-token-field/index.tsx +7 -3
- package/src/form-token-field/styles.ts +4 -4
- package/src/form-token-field/types.ts +8 -1
- package/src/index.ts +1 -0
- package/src/mobile/bottom-sheet/cell.native.js +4 -5
- package/src/mobile/color-settings/palette.screen.native.js +0 -7
- package/src/mobile/global-styles-context/index.native.js +12 -1
- package/src/mobile/global-styles-context/utils.native.js +18 -3
- package/src/mobile/link-picker/link-picker-results.native.js +3 -0
- package/src/mobile/segmented-control/index.native.js +2 -2
- package/src/modal/index.tsx +6 -1
- package/src/modal/style.scss +21 -13
- package/src/navigable-container/README.md +24 -13
- package/src/navigable-container/{container.js → container.tsx} +57 -27
- package/src/navigable-container/{index.js → index.tsx} +0 -1
- package/src/navigable-container/menu.tsx +100 -0
- package/src/navigable-container/stories/{navigable-menu.js → navigable-menu.tsx} +15 -10
- package/src/navigable-container/stories/{tabbable-container.js → tabbable-container.tsx} +15 -6
- package/src/navigable-container/tabbable.tsx +92 -0
- package/src/navigable-container/test/{navigable-menu.js → navigable-menu.tsx} +3 -1
- package/src/navigable-container/test/{tababble-container.js → tababble-container.tsx} +53 -24
- package/src/navigable-container/types.ts +76 -0
- package/src/navigator/navigator-screen/component.tsx +1 -1
- package/src/palette-edit/index.tsx +45 -7
- package/src/palette-edit/stories/index.tsx +4 -0
- package/src/palette-edit/types.ts +11 -0
- package/src/popover/index.tsx +2 -15
- package/src/private-apis.ts +2 -0
- package/src/sandbox/index.native.js +12 -1
- package/src/slot-fill/bubbles-virtually/fill.js +2 -1
- package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +46 -60
- package/src/slot-fill/bubbles-virtually/use-slot.js +14 -41
- package/src/slot-fill/fill.js +4 -26
- package/src/slot-fill/index.js +14 -8
- package/src/slot-fill/provider.js +0 -6
- package/src/slot-fill/slot.js +0 -5
- package/src/snackbar/style.scss +2 -1
- package/src/spinner/styles.ts +2 -0
- package/src/style.scss +6 -0
- package/src/tab-panel/index.tsx +1 -1
- package/src/theme/color-algorithms.ts +1 -1
- package/src/theme/stories/index.tsx +1 -1
- package/src/theme/test/color-algorithms.ts +2 -2
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +4 -4
- package/src/toolbar/stories/index.tsx +26 -24
- package/src/toolbar/toolbar-button/index.tsx +10 -13
- package/src/toolbar/toolbar-item/{index.js → index.tsx} +12 -3
- package/src/tree-grid/README.md +18 -0
- package/src/tree-grid/index.tsx +7 -2
- package/src/tree-grid/types.ts +7 -0
- package/src/ui/context/wordpress-component.ts +1 -1
- package/src/utils/colors-values.js +3 -3
- package/src/utils/theme-variables.scss +4 -4
- package/src/utils/use-deprecated-props.ts +29 -0
- package/src/view/component.tsx +2 -2
- package/tsconfig.json +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/src/CONTRIBUTING.md +0 -78
- package/src/README.md +0 -20
- package/src/navigable-container/menu.js +0 -62
- package/src/navigable-container/tabbable.js +0 -46
|
@@ -41,31 +41,52 @@ const meta: ComponentMeta< typeof Card > = {
|
|
|
41
41
|
export default meta;
|
|
42
42
|
|
|
43
43
|
const Template: ComponentStory< typeof Card > = ( args ) => (
|
|
44
|
-
<Card { ...args }
|
|
45
|
-
<CardHeader>
|
|
46
|
-
<Heading>CardHeader</Heading>
|
|
47
|
-
</CardHeader>
|
|
48
|
-
<CardBody>
|
|
49
|
-
<Text>CardBody</Text>
|
|
50
|
-
</CardBody>
|
|
51
|
-
<CardBody>
|
|
52
|
-
<Text>CardBody (before CardDivider)</Text>
|
|
53
|
-
</CardBody>
|
|
54
|
-
<CardDivider />
|
|
55
|
-
<CardBody>
|
|
56
|
-
<Text>CardBody (after CardDivider)</Text>
|
|
57
|
-
</CardBody>
|
|
58
|
-
<CardMedia>
|
|
59
|
-
<img
|
|
60
|
-
alt="Card Media"
|
|
61
|
-
src="https://images.unsplash.com/photo-1566125882500-87e10f726cdc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1867&q=80"
|
|
62
|
-
/>
|
|
63
|
-
</CardMedia>
|
|
64
|
-
<CardFooter>
|
|
65
|
-
<Text>CardFooter</Text>
|
|
66
|
-
<Button variant="secondary">Action Button</Button>
|
|
67
|
-
</CardFooter>
|
|
68
|
-
</Card>
|
|
44
|
+
<Card { ...args } />
|
|
69
45
|
);
|
|
70
46
|
|
|
71
|
-
export const Default
|
|
47
|
+
export const Default = Template.bind( {} );
|
|
48
|
+
Default.args = {
|
|
49
|
+
children: (
|
|
50
|
+
<>
|
|
51
|
+
<CardHeader>
|
|
52
|
+
<Heading>CardHeader</Heading>
|
|
53
|
+
</CardHeader>
|
|
54
|
+
<CardBody>
|
|
55
|
+
<Text>CardBody</Text>
|
|
56
|
+
</CardBody>
|
|
57
|
+
<CardBody>
|
|
58
|
+
<Text>CardBody (before CardDivider)</Text>
|
|
59
|
+
</CardBody>
|
|
60
|
+
<CardDivider />
|
|
61
|
+
<CardBody>
|
|
62
|
+
<Text>CardBody (after CardDivider)</Text>
|
|
63
|
+
</CardBody>
|
|
64
|
+
<CardMedia>
|
|
65
|
+
<img
|
|
66
|
+
alt="Card Media"
|
|
67
|
+
src="https://images.unsplash.com/photo-1566125882500-87e10f726cdc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1867&q=80"
|
|
68
|
+
/>
|
|
69
|
+
</CardMedia>
|
|
70
|
+
<CardFooter>
|
|
71
|
+
<Text>CardFooter</Text>
|
|
72
|
+
<Button variant="secondary">Action Button</Button>
|
|
73
|
+
</CardFooter>
|
|
74
|
+
</>
|
|
75
|
+
),
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* `CardMedia` provides a container for full-bleed content within a `Card`,
|
|
80
|
+
* such as images, video, or even just a background color. The corners will be rounded if necessary.
|
|
81
|
+
*/
|
|
82
|
+
export const FullBleedContent = Template.bind( {} );
|
|
83
|
+
FullBleedContent.args = {
|
|
84
|
+
...Default.args,
|
|
85
|
+
children: (
|
|
86
|
+
<CardMedia>
|
|
87
|
+
<div style={ { padding: 16, background: 'beige' } }>
|
|
88
|
+
Some full bleed content
|
|
89
|
+
</div>
|
|
90
|
+
</CardMedia>
|
|
91
|
+
),
|
|
92
|
+
};
|
|
@@ -50,6 +50,7 @@ export function CheckboxControl(
|
|
|
50
50
|
checked,
|
|
51
51
|
indeterminate,
|
|
52
52
|
help,
|
|
53
|
+
id: idProp,
|
|
53
54
|
onChange,
|
|
54
55
|
...additionalProps
|
|
55
56
|
} = props;
|
|
@@ -81,8 +82,11 @@ export function CheckboxControl(
|
|
|
81
82
|
},
|
|
82
83
|
[ checked, indeterminate ]
|
|
83
84
|
);
|
|
84
|
-
const
|
|
85
|
-
|
|
85
|
+
const id = useInstanceId(
|
|
86
|
+
CheckboxControl,
|
|
87
|
+
'inspector-checkbox-control',
|
|
88
|
+
idProp
|
|
89
|
+
);
|
|
86
90
|
const onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>
|
|
87
91
|
onChange( event.target.checked );
|
|
88
92
|
|
|
@@ -27,10 +27,7 @@ $checkbox-input-size-sm: 24px; // Width & height for small viewports.
|
|
|
27
27
|
@include reduce-motion("transition");
|
|
28
28
|
|
|
29
29
|
&:focus {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// Only visible in Windows High Contrast mode.
|
|
33
|
-
outline: 2px solid transparent;
|
|
30
|
+
@include button-style-outset__focus(var(--wp-admin-theme-color));
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
&:checked,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
/**
|
|
16
16
|
* WordPress dependencies
|
|
17
17
|
*/
|
|
18
|
-
import { __ } from '@wordpress/i18n';
|
|
18
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
19
19
|
import { useRef, useEffect } from '@wordpress/element';
|
|
20
20
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
21
21
|
|
|
@@ -175,6 +175,22 @@ function ColorPalette( {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
function getColorGradientName( value ) {
|
|
179
|
+
const fallbackName = sprintf(
|
|
180
|
+
/* translators: %s: the hex color value */
|
|
181
|
+
__( 'Unlabeled color. %s' ),
|
|
182
|
+
value
|
|
183
|
+
);
|
|
184
|
+
const foundColorName = isGradientSegment
|
|
185
|
+
? defaultSettings.gradients?.find(
|
|
186
|
+
( gradient ) => gradient.gradient === value
|
|
187
|
+
)
|
|
188
|
+
: defaultSettings.allColors?.find(
|
|
189
|
+
( color ) => color.color === value
|
|
190
|
+
);
|
|
191
|
+
return foundColorName ? foundColorName?.name : fallbackName;
|
|
192
|
+
}
|
|
193
|
+
|
|
178
194
|
function onColorPress( color ) {
|
|
179
195
|
deselectCustomGradient();
|
|
180
196
|
performAnimation( color );
|
|
@@ -251,6 +267,8 @@ function ColorPalette( {
|
|
|
251
267
|
const scaleValue = isSelected( color )
|
|
252
268
|
? scaleInterpolation
|
|
253
269
|
: 1;
|
|
270
|
+
const colorName = getColorGradientName( color );
|
|
271
|
+
|
|
254
272
|
return (
|
|
255
273
|
<View key={ `${ color }-${ isSelected( color ) }` }>
|
|
256
274
|
<TouchableWithoutFeedback
|
|
@@ -260,6 +278,7 @@ function ColorPalette( {
|
|
|
260
278
|
selected: isSelected( color ),
|
|
261
279
|
} }
|
|
262
280
|
accessibilityHint={ color }
|
|
281
|
+
accessibilityLabel={ colorName }
|
|
263
282
|
testID={ color }
|
|
264
283
|
>
|
|
265
284
|
<Animated.View
|
|
@@ -1,49 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { screen, render } from '@testing-library/react';
|
|
5
|
+
import userEvent from '@testing-library/user-event';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
8
9
|
*/
|
|
9
10
|
import { ColorPicker } from '..';
|
|
10
11
|
|
|
11
|
-
/**
|
|
12
|
-
* Ordinarily we'd try to select the component by role but the slider role appears
|
|
13
|
-
* on several elements and we'd end up encoding assumptions about order when
|
|
14
|
-
* trying to select the appropriate element. We might as well just use the class name
|
|
15
|
-
* on the container which will be more durable if, for example, the order changes.
|
|
16
|
-
*/
|
|
17
|
-
function getSaturation( container: HTMLElement ) {
|
|
18
|
-
return container.querySelector(
|
|
19
|
-
'.react-colorful__saturation .react-colorful__interactive'
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type PageXPageY = { pageX: number; pageY: number };
|
|
24
|
-
|
|
25
|
-
// Fix to pass `pageX` and `pageY`
|
|
26
|
-
// See https://github.com/testing-library/react-testing-library/issues/268
|
|
27
|
-
class FakeMouseEvent extends MouseEvent {
|
|
28
|
-
constructor( type: MouseEvent[ 'type' ], values?: PageXPageY ) {
|
|
29
|
-
super( type, { buttons: 1, bubbles: true, ...values } );
|
|
30
|
-
|
|
31
|
-
Object.assign( this, {
|
|
32
|
-
pageX: values?.pageX ?? 0,
|
|
33
|
-
pageY: values?.pageY ?? 0,
|
|
34
|
-
} );
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function moveReactColorfulSlider(
|
|
39
|
-
sliderElement: Element,
|
|
40
|
-
from: PageXPageY,
|
|
41
|
-
to: PageXPageY
|
|
42
|
-
) {
|
|
43
|
-
fireEvent( sliderElement, new FakeMouseEvent( 'mousedown', from ) );
|
|
44
|
-
fireEvent( sliderElement, new FakeMouseEvent( 'mousemove', to ) );
|
|
45
|
-
}
|
|
46
|
-
|
|
47
12
|
const hslaMatcher = expect.objectContaining( {
|
|
48
13
|
h: expect.any( Number ),
|
|
49
14
|
s: expect.any( Number ),
|
|
@@ -73,99 +38,134 @@ const legacyColorMatcher = {
|
|
|
73
38
|
describe( 'ColorPicker', () => {
|
|
74
39
|
describe( 'legacy props', () => {
|
|
75
40
|
it( 'should fire onChangeComplete with the legacy color format', async () => {
|
|
41
|
+
const user = userEvent.setup();
|
|
76
42
|
const onChangeComplete = jest.fn();
|
|
77
|
-
const color = '#
|
|
43
|
+
const color = '#000';
|
|
78
44
|
|
|
79
|
-
|
|
45
|
+
render(
|
|
80
46
|
<ColorPicker
|
|
81
47
|
onChangeComplete={ onChangeComplete }
|
|
82
48
|
color={ color }
|
|
49
|
+
enableAlpha={ false }
|
|
83
50
|
/>
|
|
84
51
|
);
|
|
85
52
|
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
if ( saturation === null ) {
|
|
89
|
-
throw new Error( 'The saturation slider could not be found' );
|
|
90
|
-
}
|
|
53
|
+
const formatSelector = screen.getByRole( 'combobox' );
|
|
54
|
+
expect( formatSelector ).toBeVisible();
|
|
91
55
|
|
|
92
|
-
|
|
56
|
+
await user.selectOptions( formatSelector, 'hex' );
|
|
93
57
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
{ pageX: 0, pageY: 0 },
|
|
97
|
-
{ pageX: 10, pageY: 10 }
|
|
98
|
-
);
|
|
58
|
+
const hexInput = screen.getByRole( 'textbox' );
|
|
59
|
+
expect( hexInput ).toBeVisible();
|
|
99
60
|
|
|
100
|
-
await
|
|
101
|
-
|
|
102
|
-
);
|
|
61
|
+
await user.clear( hexInput );
|
|
62
|
+
await user.type( hexInput, '1ab' );
|
|
103
63
|
|
|
104
|
-
expect( onChangeComplete ).
|
|
64
|
+
expect( onChangeComplete ).toHaveBeenCalledTimes( 3 );
|
|
65
|
+
expect( onChangeComplete ).toHaveBeenLastCalledWith(
|
|
105
66
|
legacyColorMatcher
|
|
106
67
|
);
|
|
107
68
|
} );
|
|
108
69
|
} );
|
|
70
|
+
describe( 'Hex input', () => {
|
|
71
|
+
it( 'should fire onChange with the correct value from the hex input', async () => {
|
|
72
|
+
const user = userEvent.setup();
|
|
73
|
+
const onChange = jest.fn();
|
|
74
|
+
const color = '#000';
|
|
75
|
+
|
|
76
|
+
render(
|
|
77
|
+
<ColorPicker
|
|
78
|
+
onChange={ onChange }
|
|
79
|
+
color={ color }
|
|
80
|
+
enableAlpha={ false }
|
|
81
|
+
/>
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const formatSelector = screen.getByRole( 'combobox' );
|
|
85
|
+
expect( formatSelector ).toBeVisible();
|
|
86
|
+
|
|
87
|
+
await user.selectOptions( formatSelector, 'hex' );
|
|
109
88
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const color = 'rgba(1, 1, 1, 0.5)';
|
|
89
|
+
const hexInput = screen.getByRole( 'textbox' );
|
|
90
|
+
expect( hexInput ).toBeVisible();
|
|
113
91
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
);
|
|
92
|
+
await user.clear( hexInput );
|
|
93
|
+
await user.type( hexInput, '1ab' );
|
|
117
94
|
|
|
118
|
-
|
|
95
|
+
expect( onChange ).toHaveBeenCalledTimes( 3 );
|
|
96
|
+
expect( onChange ).toHaveBeenLastCalledWith( '#11aabb' );
|
|
97
|
+
} );
|
|
98
|
+
} );
|
|
119
99
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
100
|
+
describe.each( [
|
|
101
|
+
[ 'red', 'Red', '#7dffff' ],
|
|
102
|
+
[ 'green', 'Green', '#ff7dff' ],
|
|
103
|
+
[ 'blue', 'Blue', '#ffff7d' ],
|
|
104
|
+
] )( 'RGB inputs', ( colorInput, inputLabel, expected ) => {
|
|
105
|
+
it( `should fire onChange with the correct value when the ${ colorInput } value is updated`, async () => {
|
|
106
|
+
const user = userEvent.setup();
|
|
107
|
+
const onChange = jest.fn();
|
|
108
|
+
const color = '#fff';
|
|
123
109
|
|
|
124
|
-
|
|
110
|
+
render(
|
|
111
|
+
<ColorPicker
|
|
112
|
+
onChange={ onChange }
|
|
113
|
+
color={ color }
|
|
114
|
+
enableAlpha={ false }
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
125
117
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
{ pageX: 0, pageY: 0 },
|
|
129
|
-
{ pageX: 10, pageY: 10 }
|
|
130
|
-
);
|
|
118
|
+
const formatSelector = screen.getByRole( 'combobox' );
|
|
119
|
+
expect( formatSelector ).toBeVisible();
|
|
131
120
|
|
|
132
|
-
|
|
121
|
+
await user.selectOptions( formatSelector, 'rgb' );
|
|
133
122
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
123
|
+
const inputElement = screen.getByRole( 'spinbutton', {
|
|
124
|
+
name: inputLabel,
|
|
125
|
+
} );
|
|
126
|
+
expect( inputElement ).toBeVisible();
|
|
138
127
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
const color = 'hsla(125, 20%, 50%, 0.5)';
|
|
128
|
+
await user.clear( inputElement );
|
|
129
|
+
await user.type( inputElement, '125' );
|
|
142
130
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
enableAlpha={ false }
|
|
148
|
-
/>
|
|
149
|
-
);
|
|
131
|
+
expect( onChange ).toHaveBeenCalledTimes( 4 );
|
|
132
|
+
expect( onChange ).toHaveBeenLastCalledWith( expected );
|
|
133
|
+
} );
|
|
134
|
+
} );
|
|
150
135
|
|
|
151
|
-
|
|
136
|
+
describe.each( [
|
|
137
|
+
[ 'hue', 'Hue', '#aad52a' ],
|
|
138
|
+
[ 'saturation', 'Saturation', '#20dfdf' ],
|
|
139
|
+
[ 'lightness', 'Lightness', '#95eaea' ],
|
|
140
|
+
] )( 'HSL inputs', ( colorInput, inputLabel, expected ) => {
|
|
141
|
+
it( `should fire onChange with the correct value when the ${ colorInput } value is updated`, async () => {
|
|
142
|
+
const user = userEvent.setup();
|
|
143
|
+
const onChange = jest.fn();
|
|
144
|
+
const color = '#2ad5d5';
|
|
145
|
+
|
|
146
|
+
render(
|
|
147
|
+
<ColorPicker
|
|
148
|
+
onChange={ onChange }
|
|
149
|
+
color={ color }
|
|
150
|
+
enableAlpha={ false }
|
|
151
|
+
/>
|
|
152
|
+
);
|
|
152
153
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
154
|
+
const formatSelector = screen.getByRole( 'combobox' );
|
|
155
|
+
expect( formatSelector ).toBeVisible();
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
await user.selectOptions( formatSelector, 'hsl' );
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
);
|
|
159
|
+
const inputElement = screen.getByRole( 'spinbutton', {
|
|
160
|
+
name: inputLabel,
|
|
161
|
+
} );
|
|
162
|
+
expect( inputElement ).toBeVisible();
|
|
164
163
|
|
|
165
|
-
|
|
164
|
+
await user.clear( inputElement );
|
|
165
|
+
await user.type( inputElement, '75' );
|
|
166
166
|
|
|
167
|
-
|
|
168
|
-
expect
|
|
169
|
-
);
|
|
167
|
+
expect( onChange ).toHaveBeenCalledTimes( 3 );
|
|
168
|
+
expect( onChange ).toHaveBeenLastCalledWith( expected );
|
|
169
|
+
} );
|
|
170
170
|
} );
|
|
171
171
|
} );
|
|
@@ -32,6 +32,7 @@ import { useControlledValue } from '../utils/hooks';
|
|
|
32
32
|
import { normalizeTextString } from '../utils/strings';
|
|
33
33
|
import type { ComboboxControlOption, ComboboxControlProps } from './types';
|
|
34
34
|
import type { TokenInputProps } from '../form-token-field/types';
|
|
35
|
+
import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
|
|
35
36
|
|
|
36
37
|
const noop = () => {};
|
|
37
38
|
|
|
@@ -104,23 +105,28 @@ const getIndexOfMatchingSuggestion = (
|
|
|
104
105
|
* }
|
|
105
106
|
* ```
|
|
106
107
|
*/
|
|
107
|
-
function ComboboxControl( {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
108
|
+
function ComboboxControl( props: ComboboxControlProps ) {
|
|
109
|
+
const {
|
|
110
|
+
__nextHasNoMarginBottom = false,
|
|
111
|
+
__next40pxDefaultSize = false,
|
|
112
|
+
value: valueProp,
|
|
113
|
+
label,
|
|
114
|
+
options,
|
|
115
|
+
onChange: onChangeProp,
|
|
116
|
+
onFilterValueChange = noop,
|
|
117
|
+
hideLabelFromVision,
|
|
118
|
+
help,
|
|
119
|
+
allowReset = true,
|
|
120
|
+
className,
|
|
121
|
+
messages = {
|
|
122
|
+
selected: __( 'Item selected.' ),
|
|
123
|
+
},
|
|
124
|
+
__experimentalRenderItem,
|
|
125
|
+
} = useDeprecated36pxDefaultSizeProp< ComboboxControlProps >(
|
|
126
|
+
props,
|
|
127
|
+
'wp.components.ComboboxControl'
|
|
128
|
+
);
|
|
129
|
+
|
|
124
130
|
const [ value, setValue ] = useControlledValue( {
|
|
125
131
|
value: valueProp,
|
|
126
132
|
onChange: onChangeProp,
|
|
@@ -314,7 +320,7 @@ function ComboboxControl( {
|
|
|
314
320
|
onKeyDown={ onKeyDown }
|
|
315
321
|
>
|
|
316
322
|
<InputWrapperFlex
|
|
317
|
-
|
|
323
|
+
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
318
324
|
>
|
|
319
325
|
<FlexBlock>
|
|
320
326
|
<TokenInput
|
|
@@ -12,9 +12,9 @@ import { space } from '../ui/utils/space';
|
|
|
12
12
|
import type { ComboboxControlProps } from './types';
|
|
13
13
|
|
|
14
14
|
const deprecatedDefaultSize = ( {
|
|
15
|
-
|
|
16
|
-
}: Pick< ComboboxControlProps, '
|
|
17
|
-
!
|
|
15
|
+
__next40pxDefaultSize,
|
|
16
|
+
}: Pick< ComboboxControlProps, '__next40pxDefaultSize' > ) =>
|
|
17
|
+
! __next40pxDefaultSize &&
|
|
18
18
|
css`
|
|
19
19
|
height: 28px; // 30px - 2px vertical borders on parent container
|
|
20
20
|
padding-left: ${ space( 1 ) };
|
|
@@ -22,7 +22,7 @@ const deprecatedDefaultSize = ( {
|
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
24
|
export const InputWrapperFlex = styled( Flex )`
|
|
25
|
-
height:
|
|
25
|
+
height: 38px; // 40px - 2px vertical borders on parent container
|
|
26
26
|
padding-left: ${ space( 2 ) };
|
|
27
27
|
padding-right: ${ space( 2 ) };
|
|
28
28
|
|
|
@@ -26,11 +26,18 @@ export type ComboboxControlProps = Pick<
|
|
|
26
26
|
item: ComboboxControlOption;
|
|
27
27
|
} ) => React.ReactNode;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Deprecated. Use `__next40pxDefaultSize` instead.
|
|
30
30
|
*
|
|
31
31
|
* @default false
|
|
32
|
+
* @deprecated
|
|
32
33
|
*/
|
|
33
34
|
__next36pxDefaultSize?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Start opting into the larger default height that will become the default size in a future version.
|
|
37
|
+
*
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
__next40pxDefaultSize?: boolean;
|
|
34
41
|
/**
|
|
35
42
|
* Show a reset button to clear the input.
|
|
36
43
|
*
|
|
@@ -25,7 +25,7 @@ function CustomGradientPicker( { setColor, currentValue, isGradientColor } ) {
|
|
|
25
25
|
const [ currentColor, setCurrentColor ] = useState( currentValue );
|
|
26
26
|
|
|
27
27
|
const { getGradientType, gradients, gradientOptions } = colorsUtils;
|
|
28
|
-
const gradientAST = getGradientAstWithDefault( currentColor );
|
|
28
|
+
const { gradientAST } = getGradientAstWithDefault( currentColor );
|
|
29
29
|
const gradientType = getGradientType( currentColor );
|
|
30
30
|
|
|
31
31
|
function isLinearGradient( type ) {
|
|
@@ -76,14 +76,14 @@ $components-custom-gradient-picker__padding: $grid-unit-20; // 48px container, 1
|
|
|
76
76
|
padding: 0;
|
|
77
77
|
|
|
78
78
|
// Shadow and stroke.
|
|
79
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $white, 0 0 $border-width-focus 0 rgba($black, 0.25);
|
|
79
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $white, 0 0 $border-width-focus-fallback 0 rgba($black, 0.25);
|
|
80
80
|
|
|
81
81
|
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
82
82
|
outline: 2px solid transparent;
|
|
83
83
|
|
|
84
84
|
&:focus,
|
|
85
85
|
&.is-active {
|
|
86
|
-
box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus) * 2) $white, 0 0 $border-width-focus 0 rgba($black, 0.25);
|
|
86
|
+
box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus) * 2) $white, 0 0 $border-width-focus-fallback 0 rgba($black, 0.25);
|
|
87
87
|
|
|
88
88
|
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
89
89
|
outline: $border-width-tab solid transparent;
|
|
@@ -9,8 +9,8 @@ This feature is still experimental. “Experimental” means this is an early im
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
11
11
|
```jsx
|
|
12
|
-
import { useState } from 'react';
|
|
13
12
|
import { __experimentalDimensionControl as DimensionControl } from '@wordpress/components';
|
|
13
|
+
import { useState } from '@wordpress/element';
|
|
14
14
|
|
|
15
15
|
export default function MyCustomDimensionControl() {
|
|
16
16
|
const [ paddingSize, setPaddingSize ] = useState( '' );
|
|
@@ -23,8 +23,8 @@ import type { SelectControlSingleSelectionProps } from '../select-control/types'
|
|
|
23
23
|
* This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
|
|
24
24
|
*
|
|
25
25
|
* ```jsx
|
|
26
|
-
* import { useState } from 'react';
|
|
27
26
|
* import { __experimentalDimensionControl as DimensionControl } from '@wordpress/components';
|
|
27
|
+
* import { useState } from '@wordpress/element';
|
|
28
28
|
*
|
|
29
29
|
* export default function MyCustomDimensionControl() {
|
|
30
30
|
* const [ paddingSize, setPaddingSize ] = useState( '' );
|
package/src/draggable/README.md
CHANGED
|
@@ -8,9 +8,16 @@ Note that the drag handle needs to declare the `draggable="true"` property and b
|
|
|
8
8
|
|
|
9
9
|
The component accepts the following props:
|
|
10
10
|
|
|
11
|
+
### `appendToOwnerDocument`: `boolean`
|
|
12
|
+
|
|
13
|
+
Whether to append the cloned element to the `ownerDocument` body. By default, elements sourced by id are appended to the element's wrapper.
|
|
14
|
+
|
|
15
|
+
- Required: No
|
|
16
|
+
- Default: `false`
|
|
17
|
+
|
|
11
18
|
### `elementId`: `string`
|
|
12
19
|
|
|
13
|
-
The HTML id of the element to clone on drag
|
|
20
|
+
The HTML id of the element to clone on drag.
|
|
14
21
|
|
|
15
22
|
- Required: Yes
|
|
16
23
|
|
package/src/draggable/index.tsx
CHANGED
|
@@ -63,6 +63,7 @@ export function Draggable( {
|
|
|
63
63
|
onDragStart,
|
|
64
64
|
onDragOver,
|
|
65
65
|
onDragEnd,
|
|
66
|
+
appendToOwnerDocument = false,
|
|
66
67
|
cloneClassname,
|
|
67
68
|
elementId,
|
|
68
69
|
transferData,
|
|
@@ -173,7 +174,11 @@ export function Draggable( {
|
|
|
173
174
|
cloneWrapper.appendChild( clone );
|
|
174
175
|
|
|
175
176
|
// Inject the cloneWrapper into the DOM.
|
|
176
|
-
|
|
177
|
+
if ( appendToOwnerDocument ) {
|
|
178
|
+
ownerDocument.body.appendChild( cloneWrapper );
|
|
179
|
+
} else {
|
|
180
|
+
elementWrapper?.appendChild( cloneWrapper );
|
|
181
|
+
}
|
|
177
182
|
}
|
|
178
183
|
|
|
179
184
|
// Mark the current cursor coordinates.
|
|
@@ -207,14 +212,8 @@ export function Draggable( {
|
|
|
207
212
|
// Update cursor to 'grabbing', document wide.
|
|
208
213
|
ownerDocument.body.classList.add( bodyClass );
|
|
209
214
|
|
|
210
|
-
// Allow the Synthetic Event to be accessed from asynchronous code.
|
|
211
|
-
// https://reactjs.org/docs/events.html#event-pooling
|
|
212
|
-
event.persist();
|
|
213
|
-
|
|
214
|
-
let timerId: number | undefined;
|
|
215
|
-
|
|
216
215
|
if ( onDragStart ) {
|
|
217
|
-
|
|
216
|
+
onDragStart( event );
|
|
218
217
|
}
|
|
219
218
|
|
|
220
219
|
cleanup.current = () => {
|
|
@@ -231,8 +230,6 @@ export function Draggable( {
|
|
|
231
230
|
ownerDocument.body.classList.remove( bodyClass );
|
|
232
231
|
|
|
233
232
|
ownerDocument.removeEventListener( 'dragover', throttledDragOver );
|
|
234
|
-
|
|
235
|
-
clearTimeout( timerId );
|
|
236
233
|
};
|
|
237
234
|
}
|
|
238
235
|
|