@wordpress/components 40.0.0 → 40.1.1-next.v.202609031004.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 +26 -0
- package/build/border-box-control/border-box-control/component.cjs +37 -5
- package/build/border-box-control/border-box-control/component.cjs.map +3 -3
- package/build/border-box-control/border-box-control/hook.cjs +24 -3
- package/build/border-box-control/border-box-control/hook.cjs.map +3 -3
- package/build/border-box-control/border-box-control-linked-button/hook.cjs +2 -2
- package/build/border-box-control/border-box-control-linked-button/hook.cjs.map +2 -2
- package/build/border-box-control/border-box-control-split-controls/hook.cjs +2 -2
- package/build/border-box-control/border-box-control-split-controls/hook.cjs.map +2 -2
- package/build/border-box-control/border-box-control-visualizer/hook.cjs +2 -2
- package/build/border-box-control/border-box-control-visualizer/hook.cjs.map +2 -2
- package/build/color-palette/index.cjs +1 -1
- package/build/color-palette/index.cjs.map +2 -2
- package/build/context/context-system-provider.cjs +2 -5
- package/build/context/context-system-provider.cjs.map +3 -3
- package/build/context/use-context-system.cjs +7 -2
- package/build/context/use-context-system.cjs.map +2 -2
- package/build/icon/index.cjs +30 -12
- package/build/icon/index.cjs.map +2 -2
- package/build/item-group/item/hook.cjs +1 -1
- package/build/item-group/item/hook.cjs.map +2 -2
- package/build/item-group/item-group/hook.cjs +1 -1
- package/build/item-group/item-group/hook.cjs.map +2 -2
- package/build/resizable-box/index.cjs.map +1 -1
- package/build/snackbar/index.cjs +8 -5
- package/build/snackbar/index.cjs.map +2 -2
- package/build/tools-panel/tools-panel/hook.cjs +102 -106
- package/build/tools-panel/tools-panel/hook.cjs.map +2 -2
- package/build/tools-panel/tools-panel-item/hook.cjs +33 -33
- package/build/tools-panel/tools-panel-item/hook.cjs.map +2 -2
- package/build-module/border-box-control/border-box-control/component.mjs +38 -6
- package/build-module/border-box-control/border-box-control/component.mjs.map +2 -2
- package/build-module/border-box-control/border-box-control/hook.mjs +14 -3
- package/build-module/border-box-control/border-box-control/hook.mjs.map +2 -2
- package/build-module/border-box-control/border-box-control-linked-button/hook.mjs +2 -2
- package/build-module/border-box-control/border-box-control-linked-button/hook.mjs.map +2 -2
- package/build-module/border-box-control/border-box-control-split-controls/hook.mjs +2 -2
- package/build-module/border-box-control/border-box-control-split-controls/hook.mjs.map +2 -2
- package/build-module/border-box-control/border-box-control-visualizer/hook.mjs +2 -2
- package/build-module/border-box-control/border-box-control-visualizer/hook.mjs.map +2 -2
- package/build-module/color-palette/index.mjs +1 -1
- package/build-module/color-palette/index.mjs.map +2 -2
- package/build-module/context/context-system-provider.mjs +2 -5
- package/build-module/context/context-system-provider.mjs.map +3 -3
- package/build-module/context/use-context-system.mjs +7 -2
- package/build-module/context/use-context-system.mjs.map +2 -2
- package/build-module/icon/index.mjs +30 -12
- package/build-module/icon/index.mjs.map +2 -2
- package/build-module/item-group/item/hook.mjs +1 -1
- package/build-module/item-group/item/hook.mjs.map +2 -2
- package/build-module/item-group/item-group/hook.mjs +1 -1
- package/build-module/item-group/item-group/hook.mjs.map +2 -2
- package/build-module/resizable-box/index.mjs.map +1 -1
- package/build-module/snackbar/index.mjs +8 -5
- package/build-module/snackbar/index.mjs.map +2 -2
- package/build-module/tools-panel/tools-panel/hook.mjs +103 -107
- package/build-module/tools-panel/tools-panel/hook.mjs.map +2 -2
- package/build-module/tools-panel/tools-panel-item/hook.mjs +35 -35
- package/build-module/tools-panel/tools-panel-item/hook.mjs.map +2 -2
- package/build-style/style-rtl.css +7 -35
- package/build-style/style.css +7 -35
- package/build-types/border-box-control/border-box-control/component.d.ts +4 -0
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +4 -2
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/types.d.ts +6 -2
- package/build-types/border-box-control/types.d.ts.map +1 -1
- package/build-types/composite/types.d.ts +1 -1
- package/build-types/context/context-system-provider.d.ts +8 -6
- package/build-types/context/context-system-provider.d.ts.map +1 -1
- package/build-types/context/use-context-system.d.ts.map +1 -1
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +6 -2
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +4 -4
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +52 -9
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/package.json +26 -25
- package/src/angle-picker-control/style.module.scss +1 -1
- package/src/autocomplete/test/get-autocomplete-match.ts +2 -1
- package/src/base-control/stories/index.story.tsx +2 -2
- package/src/border-box-control/border-box-control/README.md +5 -3
- package/src/border-box-control/border-box-control/component.tsx +83 -15
- package/src/border-box-control/border-box-control/hook.ts +19 -1
- package/src/border-box-control/stories/index.story.tsx +10 -0
- package/src/border-box-control/style.module.scss +34 -3
- package/src/border-box-control/test/{index.tsx → index.jsdom.test.tsx} +133 -0
- package/src/border-box-control/test/utils.ts +11 -0
- package/src/border-box-control/types.ts +6 -2
- package/src/border-control/test/{index.js → index.jsdom.test.tsx} +20 -13
- package/src/checkbox-control/style.scss +2 -2
- package/src/checkbox-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +8 -5
- package/src/color-palette/index.tsx +1 -1
- package/src/composite/README.md +1 -1
- package/src/composite/types.ts +1 -1
- package/src/context/{context-system-provider.js → context-system-provider.tsx} +19 -5
- package/src/context/stories/{ComponentsProvider.stories.jsx → ComponentsProvider.stories.tsx} +2 -2
- package/src/context/test/__snapshots__/{context-system-provider.js.snap → context-system-provider.jsdom.test.tsx.snap} +3 -3
- package/src/context/test/context-connect.tsx +1 -2
- package/src/context/test/{context-system-provider.js → context-system-provider.jsdom.test.tsx} +81 -43
- package/src/context/test/wordpress-component.tsx +1 -2
- package/src/context/use-context-system.js +13 -4
- package/src/custom-gradient-picker/test/serializer.ts +1 -0
- package/src/date-time/test/utils.test.ts +9 -0
- package/src/draggable/style.module.scss +1 -1
- package/src/dropdown/style.module.scss +2 -2
- package/src/font-size-picker/test/utils.ts +1 -0
- package/src/icon/index.tsx +28 -12
- package/src/icon/test/{index.tsx → index.jsdom.test.tsx} +66 -0
- package/src/input-control/test/{index.js → index.jsdom.test.tsx} +16 -10
- package/src/item-group/style.module.scss +1 -2
- package/src/navigator/test/router.ts +1 -0
- package/src/notice/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +5 -2
- package/src/popover/README.md +2 -2
- package/src/popover/test/{index.tsx → index.jsdom.test.tsx} +23 -0
- package/src/popover/types.ts +9 -3
- package/src/query-controls/test/terms.ts +1 -0
- package/src/resizable-box/index.tsx +1 -1
- package/src/slot-fill/test/{index.js → index.jsdom.test.tsx} +3 -3
- package/src/slot-fill/test/{slot.js → slot.jsdom.test.tsx} +17 -9
- package/src/snackbar/index.tsx +10 -6
- package/src/snackbar/test/{index.tsx → index.jsdom.test.tsx} +28 -2
- package/src/snackbar/test/list.jsdom.test.tsx +99 -0
- package/src/surface/style.module.scss +2 -2
- package/src/textarea-control/style.module.scss +1 -1
- package/src/tip/style.scss +1 -1
- package/src/toggle-group-control/toggle-group-control/style.module.scss +1 -1
- package/src/tools-panel/test/{index.tsx → index.jsdom.test.tsx} +528 -9
- package/src/tools-panel/tools-panel/hook.ts +195 -180
- package/src/tools-panel/tools-panel-item/README.md +42 -1
- package/src/tools-panel/tools-panel-item/hook.ts +97 -69
- package/src/tools-panel/types.ts +54 -9
- package/src/truncate/style.module.scss +0 -1
- package/src/unit-control/test/utils.ts +1 -0
- package/src/utils/hooks/test/{use-controlled-state.js → use-controlled-state.jsdom.test.tsx} +17 -3
- package/src/utils/hooks/test/{use-controlled-value.js → use-controlled-value.jsdom.test.tsx} +3 -1
- package/src/utils/hooks/test/{use-cx.js → use-cx.jsdom.test.tsx} +3 -1
- package/src/utils/test/colors.js +1 -0
- package/src/utils/test/{get-node-text.js → get-node-text.tsx} +1 -0
- package/src/utils/test/math.js +1 -0
- package/src/utils/test/rtl.js +1 -0
- package/src/utils/test/space.js +1 -0
- package/src/utils/test/strings.js +1 -0
- package/src/utils/test/unit-values.js +1 -0
- package/src/view/test/{index.js → index.jsdom.test.tsx} +5 -1
- package/src/snackbar/test/list.tsx +0 -39
- /package/src/alignment-matrix-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/autocomplete/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/badge/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/base-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/box-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/button/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/card/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/card/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/checkbox-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/circular-option-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/color-indicator/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/color-indicator/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/color-palette/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/color-palette/test/{utils.ts → utils.jsdom.test.ts} +0 -0
- /package/src/color-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/combobox-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/composite/legacy/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/composite/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/confirm-dialog/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/content-editable-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/custom-gradient-picker/gradient-bar/test/{utils.ts → utils.jsdom.test.ts} +0 -0
- /package/src/custom-gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/custom-select-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/custom-select-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/custom-select-control-v2/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/date-time/date-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/date-time/date-picker/test/{use-lilius.ts → use-lilius.jsdom.test.ts} +0 -0
- /package/src/date-time/date-time/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/date-time/time-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/date-time/time-picker/time-input/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/disabled/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/divider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/dropdown/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/dropdown-menu/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/duotone-picker/test/{custom-duotone-bar.tsx → custom-duotone-bar.jsdom.test.tsx} +0 -0
- /package/src/duotone-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/elevation/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/elevation/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/external-link/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/flex/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/flex/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/focal-point-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/focal-point-picker/test/{media.tsx → media.jsdom.test.tsx} +0 -0
- /package/src/font-size-picker/test/{font-size-picker-select.tsx → font-size-picker-select.jsdom.test.tsx} +0 -0
- /package/src/font-size-picker/test/{font-size-picker-toggle-group.tsx → font-size-picker-toggle-group.jsdom.test.tsx} +0 -0
- /package/src/font-size-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/form-file-upload/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/form-toggle/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/form-toggle/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/form-token-field/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/grid/test/{grid.tsx → grid.jsdom.test.tsx} +0 -0
- /package/src/guide/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/h-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/h-stack/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/heading/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/heading/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-fallback-styles/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-filters/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/higher-order/with-filters/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-focus-outside/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-focus-return/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-notices/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/higher-order/with-spoken-messages/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/input-control/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/isolated-event-container/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/item-group/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/item-group/test/{index.js → index.jsdom.test.tsx} +0 -0
- /package/src/keyboard-shortcuts/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/menu/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/menu-group/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/menu-item/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/menu-item/test/{index.js → index.jsdom.test.tsx} +0 -0
- /package/src/modal/test/{aria-helper.ts → aria-helper.jsdom.test.ts} +0 -0
- /package/src/modal/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/navigable-container/test/{navigable-menu.tsx → navigable-menu.jsdom.test.tsx} +0 -0
- /package/src/navigable-container/test/{tababble-container.tsx → tababble-container.jsdom.test.tsx} +0 -0
- /package/src/navigator/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/notice/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/notice/test/{list.tsx → list.jsdom.test.tsx} +0 -0
- /package/src/number-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/palette-edit/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/panel/test/__snapshots__/{body.tsx.snap → body.jsdom.test.tsx.snap} +0 -0
- /package/src/panel/test/__snapshots__/{header.tsx.snap → header.jsdom.test.tsx.snap} +0 -0
- /package/src/panel/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/panel/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +0 -0
- /package/src/panel/test/{body.tsx → body.jsdom.test.tsx} +0 -0
- /package/src/panel/test/{header.tsx → header.jsdom.test.tsx} +0 -0
- /package/src/panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/panel/test/{row.tsx → row.jsdom.test.tsx} +0 -0
- /package/src/placeholder/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/progress-bar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/radio-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/range-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/resizable-box/resize-tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/resizable-box/resize-tooltip/test/{label.tsx → label.jsdom.test.tsx} +0 -0
- /package/src/sandbox/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/scroll-lock/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/scrollable/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/search-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/select-control/test/__snapshots__/{select-control.tsx.snap → select-control.jsdom.test.tsx.snap} +0 -0
- /package/src/select-control/test/{select-control.tsx → select-control.jsdom.test.tsx} +0 -0
- /package/src/shortcut/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/shortcut/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/slot-fill/test/__snapshots__/{slot.js.snap → slot.jsdom.test.tsx.snap} +0 -0
- /package/src/spacer/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/spacer/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/style-provider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/surface/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/tab-panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/tabs/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/text/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/text/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/text-control/test/{text-control.tsx → text-control.jsdom.test.tsx} +0 -0
- /package/src/text-highlight/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/toggle-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/toggle-group-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/toggle-group-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/toolbar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/toolbar/test/{toolbar-group.tsx → toolbar-group.jsdom.test.tsx} +0 -0
- /package/src/tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/tree-grid/test/__snapshots__/{cell.tsx.snap → cell.jsdom.test.tsx.snap} +0 -0
- /package/src/tree-grid/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/tree-grid/test/__snapshots__/{roving-tab-index-item.tsx.snap → roving-tab-index-item.jsdom.test.tsx.snap} +0 -0
- /package/src/tree-grid/test/__snapshots__/{roving-tab-index.tsx.snap → roving-tab-index.jsdom.test.tsx.snap} +0 -0
- /package/src/tree-grid/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +0 -0
- /package/src/tree-grid/test/{cell.tsx → cell.jsdom.test.tsx} +0 -0
- /package/src/tree-grid/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/tree-grid/test/{roving-tab-index-item.tsx → roving-tab-index-item.jsdom.test.tsx} +0 -0
- /package/src/tree-grid/test/{roving-tab-index.tsx → roving-tab-index.jsdom.test.tsx} +0 -0
- /package/src/tree-grid/test/{row.tsx → row.jsdom.test.tsx} +0 -0
- /package/src/truncate/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/unit-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/utils/test/{polymorphic-element.tsx → polymorphic-element.jsdom.test.tsx} +0 -0
- /package/src/v-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
- /package/src/v-stack/test/{index.tsx → index.jsdom.test.tsx} +0 -0
- /package/src/validated-form-controls/test/{content-editable-control.tsx → content-editable-control.jsdom.test.tsx} +0 -0
- /package/src/validated-form-controls/test/{custom-select-control.tsx → custom-select-control.jsdom.test.tsx} +0 -0
- /package/src/validated-form-controls/test/{input-control.tsx → input-control.jsdom.test.tsx} +0 -0
- /package/src/validated-form-controls/test/{range-control.tsx → range-control.jsdom.test.tsx} +0 -0
- /package/src/validated-form-controls/test/{textarea-control.tsx → textarea-control.jsdom.test.tsx} +0 -0
- /package/src/view/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
package/src/context/test/{context-system-provider.js → context-system-provider.jsdom.test.tsx}
RENAMED
|
@@ -1,18 +1,65 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
|
+
import type {
|
|
4
|
+
ComponentPropsWithoutRef,
|
|
5
|
+
ForwardedRef,
|
|
6
|
+
ReactElement,
|
|
7
|
+
ReactNode,
|
|
8
|
+
} from 'react';
|
|
3
9
|
import { cloneElement } from '@wordpress/element';
|
|
10
|
+
import warn from '@wordpress/warning';
|
|
4
11
|
import { contextConnect } from '../context-connect';
|
|
5
12
|
import { ContextSystemProvider } from '../context-system-provider';
|
|
6
13
|
import { useContextSystem } from '../use-context-system';
|
|
7
14
|
|
|
15
|
+
jest.mock( '@wordpress/warning', () => jest.fn() );
|
|
16
|
+
|
|
8
17
|
const View = styled.div``;
|
|
9
18
|
|
|
19
|
+
type TestComponentProps = ComponentPropsWithoutRef< 'div' > & {
|
|
20
|
+
quote?: ReactNode;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function TestComponent(
|
|
24
|
+
props: TestComponentProps,
|
|
25
|
+
ref: ForwardedRef< HTMLDivElement >
|
|
26
|
+
) {
|
|
27
|
+
return <View { ...useContextSystem( props, 'Component' ) } ref={ ref } />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function TestComponentWithQuote(
|
|
31
|
+
props: TestComponentProps,
|
|
32
|
+
ref: ForwardedRef< HTMLDivElement >
|
|
33
|
+
) {
|
|
34
|
+
const { quote, ...otherProps } = useContextSystem( props, 'Component' );
|
|
35
|
+
return (
|
|
36
|
+
<View { ...otherProps } ref={ ref }>
|
|
37
|
+
{ quote }
|
|
38
|
+
</View>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
10
42
|
describe( 'props', () => {
|
|
11
|
-
test( 'should
|
|
12
|
-
|
|
13
|
-
|
|
43
|
+
test( 'should not warn when rerendered without a value', () => {
|
|
44
|
+
jest.mocked( warn ).mockClear();
|
|
45
|
+
|
|
46
|
+
const { rerender } = render(
|
|
47
|
+
<ContextSystemProvider>
|
|
48
|
+
<div />
|
|
49
|
+
</ContextSystemProvider>
|
|
14
50
|
);
|
|
15
|
-
|
|
51
|
+
|
|
52
|
+
rerender(
|
|
53
|
+
<ContextSystemProvider>
|
|
54
|
+
<div />
|
|
55
|
+
</ContextSystemProvider>
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
expect( warn ).not.toHaveBeenCalled();
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
test( 'should render correctly', () => {
|
|
62
|
+
const ConnectedComponent = contextConnect( TestComponent, 'Component' );
|
|
16
63
|
const { container } = render(
|
|
17
64
|
<ContextSystemProvider>
|
|
18
65
|
<ConnectedComponent />
|
|
@@ -23,19 +70,10 @@ describe( 'props', () => {
|
|
|
23
70
|
} );
|
|
24
71
|
|
|
25
72
|
test( 'should render context props', () => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
);
|
|
31
|
-
return (
|
|
32
|
-
<View { ...otherProps } ref={ ref }>
|
|
33
|
-
{ quote }
|
|
34
|
-
</View>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const ConnectedComponent = contextConnect( Component, 'Component' );
|
|
73
|
+
const ConnectedComponent = contextConnect(
|
|
74
|
+
TestComponentWithQuote,
|
|
75
|
+
'Component'
|
|
76
|
+
);
|
|
39
77
|
|
|
40
78
|
const contextValue = {
|
|
41
79
|
Component: {
|
|
@@ -54,19 +92,10 @@ describe( 'props', () => {
|
|
|
54
92
|
} );
|
|
55
93
|
|
|
56
94
|
test( 'should render _override props', () => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
return (
|
|
63
|
-
<View { ...otherProps } ref={ ref }>
|
|
64
|
-
{ quote }
|
|
65
|
-
</View>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const ConnectedComponent = contextConnect( Component, 'Component' );
|
|
95
|
+
const ConnectedComponent = contextConnect(
|
|
96
|
+
TestComponentWithQuote,
|
|
97
|
+
'Component'
|
|
98
|
+
);
|
|
70
99
|
|
|
71
100
|
const contextValue = {
|
|
72
101
|
Component: {
|
|
@@ -99,10 +128,7 @@ describe( 'props', () => {
|
|
|
99
128
|
|
|
100
129
|
describe( 'children', () => {
|
|
101
130
|
test( 'should pass through children', () => {
|
|
102
|
-
const
|
|
103
|
-
<View { ...useContextSystem( props, 'Component' ) } ref={ ref } />
|
|
104
|
-
);
|
|
105
|
-
const ConnectedComponent = contextConnect( Component, 'Component' );
|
|
131
|
+
const ConnectedComponent = contextConnect( TestComponent, 'Component' );
|
|
106
132
|
|
|
107
133
|
render(
|
|
108
134
|
<ContextSystemProvider>
|
|
@@ -114,13 +140,11 @@ describe( 'children', () => {
|
|
|
114
140
|
} );
|
|
115
141
|
|
|
116
142
|
test( 'should not accept children via `context`', () => {
|
|
117
|
-
const
|
|
118
|
-
<View { ...useContextSystem( props, 'Component' ) } ref={ ref } />
|
|
119
|
-
);
|
|
120
|
-
const ConnectedComponent = contextConnect( Component, 'Component' );
|
|
143
|
+
const ConnectedComponent = contextConnect( TestComponent, 'Component' );
|
|
121
144
|
|
|
122
145
|
render(
|
|
123
146
|
<ContextSystemProvider
|
|
147
|
+
// @ts-expect-error Verify that the unsupported `context` prop is ignored.
|
|
124
148
|
context={ { Component: { children: 'Override' } } }
|
|
125
149
|
>
|
|
126
150
|
<ConnectedComponent />
|
|
@@ -132,13 +156,18 @@ describe( 'children', () => {
|
|
|
132
156
|
|
|
133
157
|
// This matches the behavior for normal, non-context-connected components.
|
|
134
158
|
test( 'should not override inherent children', () => {
|
|
135
|
-
const Component = (
|
|
159
|
+
const Component = (
|
|
160
|
+
props: TestComponentProps,
|
|
161
|
+
ref: ForwardedRef< HTMLDivElement >
|
|
162
|
+
) => (
|
|
136
163
|
<View { ...useContextSystem( props, 'Component' ) } ref={ ref }>
|
|
137
164
|
Inherent
|
|
138
165
|
</View>
|
|
139
166
|
);
|
|
140
167
|
const ConnectedComponent = contextConnect( Component, 'Component' );
|
|
141
|
-
const NormalComponent = (
|
|
168
|
+
const NormalComponent = (
|
|
169
|
+
props: ComponentPropsWithoutRef< 'div' >
|
|
170
|
+
) => <div { ...props }>Inherent</div>;
|
|
142
171
|
|
|
143
172
|
render(
|
|
144
173
|
<ContextSystemProvider>
|
|
@@ -153,12 +182,21 @@ describe( 'children', () => {
|
|
|
153
182
|
} );
|
|
154
183
|
|
|
155
184
|
describe( 'when connected component does a `cloneElement()`', () => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
185
|
+
type CloneComponentProps = {
|
|
186
|
+
content: ReactElement;
|
|
187
|
+
children?: ReactNode;
|
|
188
|
+
className?: string;
|
|
189
|
+
};
|
|
190
|
+
const ComponentThatClones = (
|
|
191
|
+
{ content, ...props }: CloneComponentProps,
|
|
192
|
+
ref: ForwardedRef< HTMLElement >
|
|
193
|
+
) => {
|
|
194
|
+
void ref;
|
|
195
|
+
return cloneElement(
|
|
159
196
|
content,
|
|
160
197
|
useContextSystem( props, 'ComponentThatClones' )
|
|
161
198
|
);
|
|
199
|
+
};
|
|
162
200
|
const ConnectedComponentThatClones = contextConnect(
|
|
163
201
|
ComponentThatClones,
|
|
164
202
|
'ComponentThatClones'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { describe, it } from 'vitest';
|
|
1
2
|
import type { ForwardedRef } from 'react';
|
|
2
3
|
import { forwardRef } from '@wordpress/element';
|
|
3
4
|
import type { WordPressComponentProps } from '../wordpress-component';
|
|
4
5
|
|
|
5
6
|
// Static TypeScript checks
|
|
6
|
-
/* eslint-disable jest/expect-expect */
|
|
7
7
|
describe( 'WordPressComponentProps', () => {
|
|
8
8
|
it( 'should not accept a ref', () => {
|
|
9
9
|
const Foo = ( props: WordPressComponentProps< {}, 'div' > ) => (
|
|
@@ -24,4 +24,3 @@ describe( 'WordPressComponentProps', () => {
|
|
|
24
24
|
<ForwardedFoo ref={ null } />;
|
|
25
25
|
} );
|
|
26
26
|
} );
|
|
27
|
-
/* eslint-enable jest/expect-expect */
|
|
@@ -33,11 +33,20 @@ export function useContextSystem( props, namespace ) {
|
|
|
33
33
|
...getNamespace( namespace ),
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
const { _overrides
|
|
36
|
+
const { _overrides, ...otherContextProps } = contextProps;
|
|
37
|
+
/** @type {Record<string, unknown>} */
|
|
38
|
+
const overrideProps = /** @type {Record<string, unknown>} */ ( _overrides );
|
|
37
39
|
|
|
38
40
|
const initialMergedProps = Object.entries( otherContextProps ).length
|
|
39
41
|
? Object.assign( {}, otherContextProps, props )
|
|
40
42
|
: props;
|
|
43
|
+
/**
|
|
44
|
+
* @type {P & {
|
|
45
|
+
* children?: React.ReactNode,
|
|
46
|
+
* renderChildren?: (props: P) => React.ReactNode
|
|
47
|
+
* }}
|
|
48
|
+
*/
|
|
49
|
+
const propsWithChildren = initialMergedProps;
|
|
41
50
|
|
|
42
51
|
const cx = useCx();
|
|
43
52
|
|
|
@@ -48,9 +57,9 @@ export function useContextSystem( props, namespace ) {
|
|
|
48
57
|
|
|
49
58
|
// Provides the ability to customize the render of the component.
|
|
50
59
|
const rendered =
|
|
51
|
-
typeof
|
|
52
|
-
?
|
|
53
|
-
:
|
|
60
|
+
typeof propsWithChildren.renderChildren === 'function'
|
|
61
|
+
? propsWithChildren.renderChildren( initialMergedProps )
|
|
62
|
+
: propsWithChildren.children;
|
|
54
63
|
|
|
55
64
|
for ( const key in initialMergedProps ) {
|
|
56
65
|
// @ts-expect-error A string key cannot index the merged props type.
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
afterAll,
|
|
3
|
+
afterEach,
|
|
4
|
+
beforeAll,
|
|
5
|
+
beforeEach,
|
|
6
|
+
describe,
|
|
7
|
+
expect,
|
|
8
|
+
it,
|
|
9
|
+
} from 'vitest';
|
|
1
10
|
import timezoneMock from 'timezone-mock';
|
|
2
11
|
import { getSettings, setSettings, type DateSettings } from '@wordpress/date';
|
|
3
12
|
import { inputToDate, getDaysInMonth } from '../utils';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
.invisible-drag-image {
|
|
4
4
|
position: fixed;
|
|
5
|
-
/* stylelint-disable-next-line
|
|
5
|
+
/* stylelint-disable-next-line logical-css/require-logical-properties -- Offscreen drag-image stand-in; flipping with writing direction has no benefit. */
|
|
6
6
|
left: -1000px;
|
|
7
7
|
height: 50px;
|
|
8
8
|
width: 50px;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
.content-wrapper {
|
|
4
4
|
// Negative margin to reset (offset) the default padding on .components-popover__content.
|
|
5
|
-
/* stylelint-disable
|
|
5
|
+
/* stylelint-disable logical-css/require-logical-properties -- Preserve the previous physical offsets against Popover padding. */
|
|
6
6
|
margin-left: -$grid-unit-10;
|
|
7
7
|
margin-right: -$grid-unit-10;
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
&:last-of-type {
|
|
14
14
|
margin-bottom: -$grid-unit-10;
|
|
15
15
|
}
|
|
16
|
-
/* stylelint-enable
|
|
16
|
+
/* stylelint-enable logical-css/require-logical-properties */
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
.padding-small {
|
package/src/icon/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentType, HTMLProps, SVGProps } from 'react';
|
|
1
|
+
import type { ComponentType, CSSProperties, HTMLProps, SVGProps } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
cloneElement,
|
|
4
4
|
createElement,
|
|
@@ -19,6 +19,7 @@ type SizeProps = {
|
|
|
19
19
|
size?: number;
|
|
20
20
|
width?: number | string;
|
|
21
21
|
height?: number | string;
|
|
22
|
+
style?: CSSProperties;
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
type AdditionalProps< T > = T extends ComponentType< infer U >
|
|
@@ -88,23 +89,38 @@ function Icon( {
|
|
|
88
89
|
} );
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
if ( isValidElement< SizeProps >( icon ) ) {
|
|
93
|
+
const { style: consumerStyle, ...restProps } =
|
|
94
|
+
additionalProps as SVGProps< SVGSVGElement >;
|
|
95
|
+
const mergedStyle =
|
|
96
|
+
icon.props.style || consumerStyle
|
|
97
|
+
? { ...icon.props.style, ...consumerStyle }
|
|
98
|
+
: undefined;
|
|
99
|
+
const styleProps = mergedStyle ? { style: mergedStyle } : {};
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
if ( icon.type === 'svg' || icon.type === SVG ) {
|
|
102
|
+
const appliedProps = {
|
|
103
|
+
...icon.props,
|
|
104
|
+
width: size,
|
|
105
|
+
height: size,
|
|
106
|
+
...restProps,
|
|
107
|
+
// Merge styles so the icon's intrinsic style (e.g. `fill: none` on
|
|
108
|
+
// stroke-based icons) is preserved unless the consumer overrides
|
|
109
|
+
// the same property explicitly.
|
|
110
|
+
...styleProps,
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
return <SVG { ...appliedProps } />;
|
|
114
|
+
}
|
|
101
115
|
|
|
102
|
-
if ( isValidElement< SizeProps >( icon ) ) {
|
|
103
116
|
return cloneElement( icon, {
|
|
104
117
|
size,
|
|
105
118
|
width: size,
|
|
106
119
|
height: size,
|
|
107
|
-
...
|
|
120
|
+
...restProps,
|
|
121
|
+
// Merge styles so the icon's intrinsic style is preserved unless
|
|
122
|
+
// the consumer overrides the same property explicitly.
|
|
123
|
+
...styleProps,
|
|
108
124
|
} );
|
|
109
125
|
}
|
|
110
126
|
|
|
@@ -95,4 +95,70 @@ describe( 'Icon', () => {
|
|
|
95
95
|
|
|
96
96
|
expect( screen.getByTestId( testId ) ).toHaveClass( className );
|
|
97
97
|
} );
|
|
98
|
+
|
|
99
|
+
it( "merges a consumer 'style' prop with the icon's intrinsic style", () => {
|
|
100
|
+
const strokeIcon = (
|
|
101
|
+
<SVG style={ { fill: 'none' } }>
|
|
102
|
+
<Path d="M5 4v3h5.5v12h3V7H19V4z" />
|
|
103
|
+
</SVG>
|
|
104
|
+
);
|
|
105
|
+
render(
|
|
106
|
+
<Icon
|
|
107
|
+
data-testid={ testId }
|
|
108
|
+
icon={ strokeIcon }
|
|
109
|
+
style={ { marginInlineStart: 4 } }
|
|
110
|
+
/>
|
|
111
|
+
);
|
|
112
|
+
const icon = screen.getByTestId( testId );
|
|
113
|
+
|
|
114
|
+
// The icon's intrinsic `fill: none` survives…
|
|
115
|
+
expect( icon ).toHaveStyle( 'fill: none' );
|
|
116
|
+
// …alongside the consumer-supplied style.
|
|
117
|
+
expect( icon ).toHaveStyle( 'margin-inline-start: 4px' );
|
|
118
|
+
} );
|
|
119
|
+
|
|
120
|
+
it( "lets a consumer 'style' override the icon's intrinsic style", () => {
|
|
121
|
+
const strokeIcon = (
|
|
122
|
+
<SVG style={ { fill: 'none' } }>
|
|
123
|
+
<Path d="M5 4v3h5.5v12h3V7H19V4z" />
|
|
124
|
+
</SVG>
|
|
125
|
+
);
|
|
126
|
+
render(
|
|
127
|
+
<Icon
|
|
128
|
+
data-testid={ testId }
|
|
129
|
+
icon={ strokeIcon }
|
|
130
|
+
style={ { fill: 'red' } }
|
|
131
|
+
/>
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
expect( screen.getByTestId( testId ) ).toHaveStyle( 'fill: red' );
|
|
135
|
+
} );
|
|
136
|
+
|
|
137
|
+
it( "merges a consumer 'style' with a non-svg element's intrinsic style", () => {
|
|
138
|
+
render(
|
|
139
|
+
<Icon
|
|
140
|
+
icon={
|
|
141
|
+
<span data-testid={ testId } style={ { fill: 'none' } } />
|
|
142
|
+
}
|
|
143
|
+
style={ { marginInlineStart: 4 } }
|
|
144
|
+
/>
|
|
145
|
+
);
|
|
146
|
+
const icon = screen.getByTestId( testId );
|
|
147
|
+
|
|
148
|
+
expect( icon ).toHaveStyle( 'fill: none' );
|
|
149
|
+
expect( icon ).toHaveStyle( 'margin-inline-start: 4px' );
|
|
150
|
+
} );
|
|
151
|
+
|
|
152
|
+
it( "does not add a 'style' prop to a non-svg element without styles", () => {
|
|
153
|
+
let hasStyleProp = true;
|
|
154
|
+
const CustomIcon = ( props: Record< string, unknown > ) => {
|
|
155
|
+
hasStyleProp = 'style' in props;
|
|
156
|
+
return <span data-testid={ testId } />;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
render( <Icon icon={ <CustomIcon /> } /> );
|
|
160
|
+
|
|
161
|
+
expect( screen.getByTestId( testId ) ).toBeVisible();
|
|
162
|
+
expect( hasStyleProp ).toBe( false );
|
|
163
|
+
} );
|
|
98
164
|
} );
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { render, screen } from '@testing-library/react';
|
|
2
2
|
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import type { KeyboardEvent } from 'react';
|
|
3
4
|
import { useState } from '@wordpress/element';
|
|
4
5
|
import BaseInputControl from '../';
|
|
5
6
|
import InputControlPrefixWrapper from '../input-prefix-wrapper';
|
|
7
|
+
import type { InputControlProps } from '../types';
|
|
6
8
|
|
|
7
|
-
const getInput = () => screen.getByTestId( 'input' );
|
|
9
|
+
const getInput = () => screen.getByTestId< HTMLInputElement >( 'input' );
|
|
8
10
|
|
|
9
11
|
describe( 'InputControl', () => {
|
|
10
|
-
const InputControl = ( props ) => {
|
|
12
|
+
const InputControl = ( props: InputControlProps ) => {
|
|
11
13
|
return <BaseInputControl { ...props } data-testid="input" />;
|
|
12
14
|
};
|
|
13
|
-
|
|
14
15
|
describe( 'Basic rendering', () => {
|
|
15
16
|
it( 'should render', () => {
|
|
16
17
|
render( <InputControl /> );
|
|
@@ -85,14 +86,16 @@ describe( 'InputControl', () => {
|
|
|
85
86
|
it( 'should work as a controlled component given normal, falsy or nullish values', async () => {
|
|
86
87
|
const user = await userEvent.setup();
|
|
87
88
|
const spy = jest.fn();
|
|
88
|
-
const heldKeySet = new Set();
|
|
89
|
+
const heldKeySet = new Set< string >();
|
|
89
90
|
const Example = () => {
|
|
90
|
-
const [ state, setState ] = useState
|
|
91
|
-
|
|
91
|
+
const [ state, setState ] = useState< string | undefined >(
|
|
92
|
+
'one'
|
|
93
|
+
);
|
|
94
|
+
const onChange = ( value: string | undefined ) => {
|
|
92
95
|
setState( value );
|
|
93
96
|
spy( value );
|
|
94
97
|
};
|
|
95
|
-
const onKeyDown = ( { key } ) => {
|
|
98
|
+
const onKeyDown = ( { key }: KeyboardEvent ) => {
|
|
96
99
|
heldKeySet.add( key );
|
|
97
100
|
if ( key === 'Escape' ) {
|
|
98
101
|
if ( heldKeySet.has( 'Meta' ) ) {
|
|
@@ -104,7 +107,8 @@ describe( 'InputControl', () => {
|
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
};
|
|
107
|
-
const onKeyUp = ( { key } ) =>
|
|
110
|
+
const onKeyUp = ( { key }: KeyboardEvent ) =>
|
|
111
|
+
heldKeySet.delete( key );
|
|
108
112
|
return (
|
|
109
113
|
<InputControl
|
|
110
114
|
value={ state }
|
|
@@ -189,7 +193,8 @@ describe( 'InputControl', () => {
|
|
|
189
193
|
let { value } = state;
|
|
190
194
|
if (
|
|
191
195
|
action.type === 'COMMIT' &&
|
|
192
|
-
action.payload.event
|
|
196
|
+
action.payload.event?.type === 'blur' &&
|
|
197
|
+
value !== undefined
|
|
193
198
|
) {
|
|
194
199
|
value = value.replace( /\bnow\b/, 'meow' );
|
|
195
200
|
}
|
|
@@ -219,7 +224,8 @@ describe( 'InputControl', () => {
|
|
|
219
224
|
<InputControl
|
|
220
225
|
label="Test"
|
|
221
226
|
prefix={ prefix }
|
|
222
|
-
|
|
227
|
+
// @ts-expect-error Verify the legacy value that is omitted from the public type.
|
|
228
|
+
size="__unstable-large"
|
|
223
229
|
/>
|
|
224
230
|
);
|
|
225
231
|
|
|
@@ -48,15 +48,18 @@ exports[`Notice should match snapshot 1`] = `
|
|
|
48
48
|
>
|
|
49
49
|
<svg
|
|
50
50
|
aria-hidden="true"
|
|
51
|
-
fill="currentColor"
|
|
52
51
|
focusable="false"
|
|
53
52
|
height="24"
|
|
53
|
+
stroke="currentColor"
|
|
54
|
+
stroke-width="1.5"
|
|
55
|
+
style="fill: none;"
|
|
54
56
|
viewBox="0 0 24 24"
|
|
55
57
|
width="24"
|
|
56
58
|
xmlns="http://www.w3.org/2000/svg"
|
|
57
59
|
>
|
|
58
60
|
<path
|
|
59
|
-
d="
|
|
61
|
+
d="M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75"
|
|
62
|
+
vector-effect="non-scaling-stroke"
|
|
60
63
|
/>
|
|
61
64
|
</svg>
|
|
62
65
|
</button>
|
package/src/popover/README.md
CHANGED
|
@@ -183,9 +183,9 @@ Used to show/hide the arrow that points at the popover's anchor.
|
|
|
183
183
|
- Required: No
|
|
184
184
|
- Default: `true`
|
|
185
185
|
|
|
186
|
-
### `offset`: `number`
|
|
186
|
+
### `offset`: `number | { mainAxis?: number; crossAxis?: number }`
|
|
187
187
|
|
|
188
|
-
The distance (in px) between the anchor and the popover.
|
|
188
|
+
The distance (in px) between the anchor and the popover. A number displaces the popover along its main axis; pass an object to also displace it along its cross axis.
|
|
189
189
|
|
|
190
190
|
- Required: No
|
|
191
191
|
|
|
@@ -174,6 +174,29 @@ describe( 'Popover', () => {
|
|
|
174
174
|
} );
|
|
175
175
|
} );
|
|
176
176
|
|
|
177
|
+
describe( 'offset', () => {
|
|
178
|
+
it( 'should displace the popover along its cross axis when passed an offset object', async () => {
|
|
179
|
+
render(
|
|
180
|
+
<Popover
|
|
181
|
+
placement="right-start"
|
|
182
|
+
offset={ { mainAxis: 16, crossAxis: 24 } }
|
|
183
|
+
animate={ false }
|
|
184
|
+
flip={ false }
|
|
185
|
+
shift={ false }
|
|
186
|
+
data-testid="popover-element"
|
|
187
|
+
>
|
|
188
|
+
Hello
|
|
189
|
+
</Popover>
|
|
190
|
+
);
|
|
191
|
+
const popover = screen.getByTestId( 'popover-element' );
|
|
192
|
+
|
|
193
|
+
await waitFor( () => expect( popover ).toBeVisible() );
|
|
194
|
+
expect( popover ).toHaveStyle(
|
|
195
|
+
'transform: translateX(16px) translateY(24px)'
|
|
196
|
+
);
|
|
197
|
+
} );
|
|
198
|
+
} );
|
|
199
|
+
|
|
177
200
|
describe( 'style', () => {
|
|
178
201
|
it( 'outputs inline styles added through the style prop in addition to built-in popover positioning styles', async () => {
|
|
179
202
|
render(
|
package/src/popover/types.ts
CHANGED
|
@@ -105,9 +105,15 @@ export type PopoverProps = {
|
|
|
105
105
|
*/
|
|
106
106
|
noArrow?: boolean;
|
|
107
107
|
/**
|
|
108
|
-
* The distance (in px) between the anchor and the popover.
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
* The distance (in px) between the anchor and the popover. Pass an object to
|
|
109
|
+
* also displace the popover along its cross axis.
|
|
110
|
+
*/
|
|
111
|
+
offset?:
|
|
112
|
+
| number
|
|
113
|
+
| {
|
|
114
|
+
mainAxis?: number;
|
|
115
|
+
crossAxis?: number;
|
|
116
|
+
};
|
|
111
117
|
/**
|
|
112
118
|
* A callback invoked when the popover should be closed.
|
|
113
119
|
*/
|
|
@@ -102,7 +102,7 @@ function UnforwardedResizableBox(
|
|
|
102
102
|
) }
|
|
103
103
|
// Add a focusable element within the drag handle. Unfortunately,
|
|
104
104
|
// `re-resizable` does not make them properly focusable by default,
|
|
105
|
-
// causing focus to move the
|
|
105
|
+
// causing focus to move the block wrapper which triggers block
|
|
106
106
|
// drag.
|
|
107
107
|
handleComponent={ Object.fromEntries(
|
|
108
108
|
Object.keys( HANDLE_CLASSES ).map( ( key ) => [
|
|
@@ -79,7 +79,7 @@ describe( 'createSlotFill', () => {
|
|
|
79
79
|
|
|
80
80
|
test( 'should forward ref to the slot when using bubblesVirtually', () => {
|
|
81
81
|
const TestSlotFill = createSlotFill( 'TestRefSlot' );
|
|
82
|
-
const ref = createRef();
|
|
82
|
+
const ref = createRef< HTMLElement >();
|
|
83
83
|
|
|
84
84
|
render(
|
|
85
85
|
<SlotFillProvider>
|
|
@@ -91,12 +91,12 @@ describe( 'createSlotFill', () => {
|
|
|
91
91
|
);
|
|
92
92
|
|
|
93
93
|
expect( ref.current ).not.toBeNull();
|
|
94
|
-
expect( ref.current
|
|
94
|
+
expect( ref.current!.tagName ).toBe( 'DIV' );
|
|
95
95
|
} );
|
|
96
96
|
|
|
97
97
|
test( 'should forward ref without bubblesVirtually (ref stays null for fragment-based slot)', () => {
|
|
98
98
|
const TestSlotFill = createSlotFill( 'TestRefSlotBase' );
|
|
99
|
-
const ref = createRef();
|
|
99
|
+
const ref = createRef< HTMLElement >();
|
|
100
100
|
|
|
101
101
|
render(
|
|
102
102
|
<SlotFillProvider>
|