@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
|
@@ -93,6 +93,16 @@ export type ToolsPanelHeaderProps = {
|
|
|
93
93
|
toggleItem: (label: string) => void;
|
|
94
94
|
};
|
|
95
95
|
export type ToolsPanelItem = {
|
|
96
|
+
/**
|
|
97
|
+
* For optional items only, this determines whether the item is shown on
|
|
98
|
+
* first render even when `hasValue()` returns `false`.
|
|
99
|
+
*
|
|
100
|
+
* An item is always shown while it has a value, so this only controls the
|
|
101
|
+
* initial state of items without one.
|
|
102
|
+
*
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
defaultShown?: boolean;
|
|
96
106
|
/**
|
|
97
107
|
* This is called when building the `ToolsPanel` menu to determine the
|
|
98
108
|
* item's initial checked state.
|
|
@@ -115,6 +125,27 @@ export type ToolsPanelItem = {
|
|
|
115
125
|
* panel.
|
|
116
126
|
*/
|
|
117
127
|
label: string;
|
|
128
|
+
/**
|
|
129
|
+
* A callback executed when the user shows or hides the item via the
|
|
130
|
+
* `ToolsPanel` menu, passed `true` when it was shown and `false` when it
|
|
131
|
+
* was hidden.
|
|
132
|
+
*
|
|
133
|
+
* Unlike `onDeselect`, this fires whether or not the item has a value, and
|
|
134
|
+
* only in response to an explicit menu action. Visibility changes with
|
|
135
|
+
* another cause do not trigger it, such as an item becoming visible
|
|
136
|
+
* because it received a value or because `defaultShown` was set, or
|
|
137
|
+
* hiding because `Reset all` ran.
|
|
138
|
+
*
|
|
139
|
+
* Items flagged with `isShownByDefault` are always visible and stay so when
|
|
140
|
+
* toggled off, so this is never called for them.
|
|
141
|
+
*
|
|
142
|
+
* A single menu action may also call `onSelect` or `onDeselect`, which are
|
|
143
|
+
* unchanged. Showing an item without a value calls this with `true` and
|
|
144
|
+
* `onSelect`; hiding an item that has a value calls this with `false` and
|
|
145
|
+
* `onDeselect`. Use this callback to track visibility and `onDeselect` to
|
|
146
|
+
* reset a value, rather than treating them as interchangeable.
|
|
147
|
+
*/
|
|
148
|
+
onShownChange?: (isShown: boolean) => void;
|
|
118
149
|
/**
|
|
119
150
|
* Panel items will ensure they are only registering with their intended panel
|
|
120
151
|
* by comparing the `panelId` props set on both the item and the panel itself,
|
|
@@ -147,6 +178,18 @@ export type ToolsPanelItemProps = ToolsPanelItem & {
|
|
|
147
178
|
*/
|
|
148
179
|
resetAllFilter?: ResetAllFilter;
|
|
149
180
|
};
|
|
181
|
+
/**
|
|
182
|
+
* The shape of an item as it is held in `ToolsPanel` state. It extends
|
|
183
|
+
* `ToolsPanelItem` with the data the panel needs but that isn't part of the
|
|
184
|
+
* item's own API surface.
|
|
185
|
+
*/
|
|
186
|
+
export type RegisteredToolsPanelItem = ToolsPanelItem & {
|
|
187
|
+
/**
|
|
188
|
+
* The item's `resetAllFilter`, collected at registration time so the panel
|
|
189
|
+
* doesn't need a second round of effects to gather them.
|
|
190
|
+
*/
|
|
191
|
+
resetAllFilter?: ResetAllFilter;
|
|
192
|
+
};
|
|
150
193
|
export type ToolsPanelMenuItemKey = 'default' | 'optional';
|
|
151
194
|
export type ToolsPanelMenuItems = {
|
|
152
195
|
[menuItemKey in ToolsPanelMenuItemKey]: {
|
|
@@ -157,11 +200,17 @@ export type ToolsPanelContext = {
|
|
|
157
200
|
panelId?: string | null;
|
|
158
201
|
menuItems: ToolsPanelMenuItems;
|
|
159
202
|
hasMenuItems: boolean;
|
|
160
|
-
registerPanelItem: (item:
|
|
161
|
-
deregisterPanelItem: (label: string) => void;
|
|
203
|
+
registerPanelItem: (item: RegisteredToolsPanelItem) => void;
|
|
204
|
+
deregisterPanelItem: (label: string, item?: RegisteredToolsPanelItem) => void;
|
|
162
205
|
registerResetAllFilter: (filter: ResetAllFilter) => void;
|
|
163
206
|
deregisterResetAllFilter: (filter: ResetAllFilter) => void;
|
|
164
|
-
flagItemCustomization: (value: boolean, label: string,
|
|
207
|
+
flagItemCustomization: (value: boolean, label: string,
|
|
208
|
+
/**
|
|
209
|
+
* Ignored, and kept only so that existing three argument callers
|
|
210
|
+
* still typecheck. The group a value lands in now follows from the
|
|
211
|
+
* registered item's `isShownByDefault` rather than from the caller.
|
|
212
|
+
*/
|
|
213
|
+
group?: ToolsPanelMenuItemKey) => void;
|
|
165
214
|
isResetting: boolean;
|
|
166
215
|
shouldRenderPlaceholderItems: boolean;
|
|
167
216
|
areAllOptionalControlsHidden: boolean;
|
|
@@ -175,11 +224,5 @@ export type ToolsPanelControlsGroupProps = {
|
|
|
175
224
|
items: [string, boolean][];
|
|
176
225
|
toggleItem: (label: string) => void;
|
|
177
226
|
};
|
|
178
|
-
export type ToolsPanelMenuItemsConfig = {
|
|
179
|
-
panelItems: ToolsPanelItem[];
|
|
180
|
-
shouldReset: boolean;
|
|
181
|
-
currentMenuItems?: ToolsPanelMenuItems;
|
|
182
|
-
menuItemOrder: string[];
|
|
183
|
-
};
|
|
184
227
|
export {};
|
|
185
228
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools-panel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,CAAE,UAAU,CAAC,EAAE,GAAG,KAAM,GAAG,CAAC;AACzD,K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,KACzB,IAAI,CAAC;IACV,WAAW,EAAE,OAAO,CAAC;IACrB,4BAA4B,EAAE,OAAO,CAAC;IACtC,4BAA4B,EAAE,OAAO,CAAC;IACtC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mCAAmC,CAAC,EAAE,MAAM,CAAC;IAC7C,kCAAkC,CAAC,EAAE,MAAM,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,CAAE,MAAM,EAAE,OAAO,CAAE,EAAE,CAAC;IAC7B,UAAU,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;CACtC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.1.1-next.v.202609031004.0",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -62,27 +62,27 @@
|
|
|
62
62
|
"@types/gradient-parser": "^1.1.0",
|
|
63
63
|
"@types/highlight-words-core": "^1.2.1",
|
|
64
64
|
"@use-gesture/react": "^10.3.1",
|
|
65
|
-
"@wordpress/a11y": "^4.54.0",
|
|
66
|
-
"@wordpress/base-styles": "^13.
|
|
67
|
-
"@wordpress/compose": "^8.7.0",
|
|
68
|
-
"@wordpress/date": "^5.54.0",
|
|
69
|
-
"@wordpress/deprecated": "^4.54.0",
|
|
70
|
-
"@wordpress/dom": "^4.54.0",
|
|
71
|
-
"@wordpress/element": "^8.6.0",
|
|
72
|
-
"@wordpress/escape-html": "^3.54.0",
|
|
73
|
-
"@wordpress/hooks": "^4.54.0",
|
|
74
|
-
"@wordpress/html-entities": "^4.54.0",
|
|
75
|
-
"@wordpress/i18n": "^6.27.0",
|
|
76
|
-
"@wordpress/icons": "^
|
|
77
|
-
"@wordpress/is-shallow-equal": "^5.54.0",
|
|
78
|
-
"@wordpress/kebab-case": "^1.1.0",
|
|
79
|
-
"@wordpress/keycodes": "^4.54.0",
|
|
80
|
-
"@wordpress/primitives": "^4.54.0",
|
|
81
|
-
"@wordpress/private-apis": "^1.54.0",
|
|
82
|
-
"@wordpress/rich-text": "^7.
|
|
83
|
-
"@wordpress/style-runtime": "^0.10.0",
|
|
84
|
-
"@wordpress/ui": "^0.
|
|
85
|
-
"@wordpress/warning": "^3.54.0",
|
|
65
|
+
"@wordpress/a11y": "^4.54.1-next.v.202609031004.0",
|
|
66
|
+
"@wordpress/base-styles": "^13.1.1-next.v.202609031004.0",
|
|
67
|
+
"@wordpress/compose": "^8.7.2-next.v.202609031004.0",
|
|
68
|
+
"@wordpress/date": "^5.54.1-next.v.202609031004.0",
|
|
69
|
+
"@wordpress/deprecated": "^4.54.1-next.v.202609031004.0",
|
|
70
|
+
"@wordpress/dom": "^4.54.1-next.v.202609031004.0",
|
|
71
|
+
"@wordpress/element": "^8.6.2-next.v.202609031004.0",
|
|
72
|
+
"@wordpress/escape-html": "^3.54.1-next.v.202609031004.0",
|
|
73
|
+
"@wordpress/hooks": "^4.54.1-next.v.202609031004.0",
|
|
74
|
+
"@wordpress/html-entities": "^4.54.1-next.v.202609031004.0",
|
|
75
|
+
"@wordpress/i18n": "^6.27.1-next.v.202609031004.0",
|
|
76
|
+
"@wordpress/icons": "^16.0.1-next.v.202609031004.0",
|
|
77
|
+
"@wordpress/is-shallow-equal": "^5.54.1-next.v.202609031004.0",
|
|
78
|
+
"@wordpress/kebab-case": "^1.1.1-next.v.202609031004.0",
|
|
79
|
+
"@wordpress/keycodes": "^4.54.1-next.v.202609031004.0",
|
|
80
|
+
"@wordpress/primitives": "^4.54.2-next.v.202609031004.0",
|
|
81
|
+
"@wordpress/private-apis": "^1.54.2-next.v.202609031004.0",
|
|
82
|
+
"@wordpress/rich-text": "^7.55.1-next.v.202609031004.0",
|
|
83
|
+
"@wordpress/style-runtime": "^0.10.1-next.v.202609031004.0",
|
|
84
|
+
"@wordpress/ui": "^0.22.1-next.v.202609031004.0",
|
|
85
|
+
"@wordpress/warning": "^3.54.1-next.v.202609031004.0",
|
|
86
86
|
"change-case": "^4.1.2",
|
|
87
87
|
"clsx": "^2.1.1",
|
|
88
88
|
"colord": "^2.9.3",
|
|
@@ -111,11 +111,12 @@
|
|
|
111
111
|
"@testing-library/user-event": "^14.6.1",
|
|
112
112
|
"@types/jest": "^30.0.0",
|
|
113
113
|
"@types/react-dom": "^18.3.1",
|
|
114
|
-
"@wordpress/jest-console": "^9.2.0",
|
|
114
|
+
"@wordpress/jest-console": "^9.2.2-next.v.202609031004.0",
|
|
115
115
|
"@wordpress/stylelint-tools": "file:../../tools/stylelint",
|
|
116
116
|
"snapshot-diff": "^0.10.0",
|
|
117
117
|
"storybook": "^10.5.3",
|
|
118
|
-
"timezone-mock": "^1.3.6"
|
|
118
|
+
"timezone-mock": "^1.3.6",
|
|
119
|
+
"vitest": "^4.1.10"
|
|
119
120
|
},
|
|
120
121
|
"peerDependencies": {
|
|
121
122
|
"@types/react": "^18 || ^19",
|
|
@@ -130,5 +131,5 @@
|
|
|
130
131
|
"publishConfig": {
|
|
131
132
|
"access": "public"
|
|
132
133
|
},
|
|
133
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "7275d6c6d93b542fca3cd98cdb9c7344ddd11e19"
|
|
134
135
|
}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
border-radius: $radius-round;
|
|
32
32
|
box-sizing: border-box;
|
|
33
33
|
display: block;
|
|
34
|
-
/* stylelint-disable-next-line
|
|
34
|
+
/* stylelint-disable-next-line logical-css/require-logical-properties -- Geometric centering */
|
|
35
35
|
left: 50%;
|
|
36
36
|
top: 4px;
|
|
37
37
|
transform: translateX(-50%);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
1
2
|
import { getAutocompleteMatch } from '../get-autocomplete-match';
|
|
2
3
|
import type { WPCompleter } from '../types';
|
|
3
4
|
|
|
@@ -174,7 +175,7 @@ describe( 'getAutocompleteMatch', () => {
|
|
|
174
175
|
} );
|
|
175
176
|
|
|
176
177
|
it( 'should pass correct before/after text to allowContext', () => {
|
|
177
|
-
const allowContext =
|
|
178
|
+
const allowContext = vi.fn().mockReturnValue( true );
|
|
178
179
|
const completers = [
|
|
179
180
|
createCompleter( {
|
|
180
181
|
triggerPrefix: '@',
|
|
@@ -19,9 +19,9 @@ const meta: Meta< typeof BaseControl > = {
|
|
|
19
19
|
controls: { expanded: true },
|
|
20
20
|
docs: { canvas: { sourceState: 'shown' } },
|
|
21
21
|
componentStatus: {
|
|
22
|
-
status: 'recommended',
|
|
22
|
+
status: 'not-recommended',
|
|
23
23
|
whereUsed: 'global',
|
|
24
|
-
notes: '`
|
|
24
|
+
notes: 'Use [`Field`](?path=/docs/design-system-components-form-primitives-field--docs) from `@wordpress/ui` instead. For a purely visual label outside `Field.Root`, use `Field.VisualLabel`. For a group legend, use [`Fieldset`](?path=/docs/design-system-components-form-primitives-fieldset--docs) and `Fieldset.Legend`.',
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
};
|
|
@@ -103,7 +103,9 @@ Provides control over whether the label will only be visible to screen readers.
|
|
|
103
103
|
|
|
104
104
|
### `label`: `string`
|
|
105
105
|
|
|
106
|
-
If provided, a label will be generated using this as the content.
|
|
106
|
+
If provided, a label will be generated using this as the content. A visible
|
|
107
|
+
label is rendered in a row alongside the linked/unlinked toggle; when there is
|
|
108
|
+
no visible label the toggle is rendered beside the border inputs instead.
|
|
107
109
|
|
|
108
110
|
_Whether it is visible only to screen readers is controlled via
|
|
109
111
|
`hideLabelFromVision`._
|
|
@@ -130,9 +132,9 @@ The available base placements are 'top', 'right', 'bottom', 'left'. Each of thes
|
|
|
130
132
|
|
|
131
133
|
- Required: No
|
|
132
134
|
|
|
133
|
-
### `popoverOffset`: `number`
|
|
135
|
+
### `popoverOffset`: `number | { mainAxis?: number; crossAxis?: number }`
|
|
134
136
|
|
|
135
|
-
The space between the popover and the control wrapper.
|
|
137
|
+
The space between the popover and the control wrapper. A number displaces the popover along its main axis; pass an object to also displace it along its cross axis.
|
|
136
138
|
|
|
137
139
|
- Required: No
|
|
138
140
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
import { useMemo, useState } from '@wordpress/element';
|
|
3
|
-
import { useMergeRefs } from '@wordpress/compose';
|
|
3
|
+
import { useInstanceId, useMergeRefs } from '@wordpress/compose';
|
|
4
4
|
import BorderBoxControlLinkedButton from '../border-box-control-linked-button';
|
|
5
5
|
import BorderBoxControlSplitControls from '../border-box-control-split-controls';
|
|
6
6
|
import { BorderControl } from '../../border-control';
|
|
7
|
-
import
|
|
7
|
+
import BaseControl from '../../base-control';
|
|
8
|
+
import { Grid } from '../../grid';
|
|
8
9
|
import { View } from '../../view';
|
|
9
10
|
import { VisuallyHidden } from '../../visually-hidden';
|
|
10
11
|
import type { WordPressComponentProps } from '../../context';
|
|
@@ -16,17 +17,22 @@ import type {
|
|
|
16
17
|
BorderControlProps,
|
|
17
18
|
} from '../../border-control/types';
|
|
18
19
|
|
|
19
|
-
const BorderLabel = ( props: LabelProps ) => {
|
|
20
|
-
const { label, hideLabelFromVision } = props;
|
|
20
|
+
const BorderLabel = ( props: LabelProps & { id?: string } ) => {
|
|
21
|
+
const { id, label, hideLabelFromVision } = props;
|
|
21
22
|
|
|
22
23
|
if ( ! label ) {
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
// The visible label is rendered as `BaseControl.VisualLabel` so it carries
|
|
28
|
+
// the stable `.components-base-control__label` className consumers style
|
|
29
|
+
// against; `StyledLabel` is an emotion component with a generated one.
|
|
26
30
|
return hideLabelFromVision ? (
|
|
27
|
-
<VisuallyHidden as="
|
|
31
|
+
<VisuallyHidden as="span" id={ id }>
|
|
32
|
+
{ label }
|
|
33
|
+
</VisuallyHidden>
|
|
28
34
|
) : (
|
|
29
|
-
<
|
|
35
|
+
<BaseControl.VisualLabel id={ id }>{ label }</BaseControl.VisualLabel>
|
|
30
36
|
);
|
|
31
37
|
};
|
|
32
38
|
|
|
@@ -42,6 +48,8 @@ const UnconnectedBorderBoxControl = (
|
|
|
42
48
|
enableAlpha,
|
|
43
49
|
enableStyle,
|
|
44
50
|
hasMixedBorders,
|
|
51
|
+
hasVisibleLabel,
|
|
52
|
+
headerClassName,
|
|
45
53
|
hideLabelFromVision,
|
|
46
54
|
isLinked,
|
|
47
55
|
label,
|
|
@@ -55,9 +63,27 @@ const UnconnectedBorderBoxControl = (
|
|
|
55
63
|
toggleLinked,
|
|
56
64
|
wrapperClassName,
|
|
57
65
|
__experimentalIsRenderedInSidebar,
|
|
66
|
+
'aria-label': ariaLabel,
|
|
67
|
+
'aria-labelledby': ariaLabelledBy,
|
|
58
68
|
...otherProps
|
|
59
69
|
} = useBorderBoxControl( props );
|
|
60
70
|
|
|
71
|
+
// The label names the group of border controls rather than a single input,
|
|
72
|
+
// so it is associated via `aria-labelledby` instead of `htmlFor`.
|
|
73
|
+
const generatedLabelId = useInstanceId(
|
|
74
|
+
BorderBoxControl,
|
|
75
|
+
'border-box-control-label'
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
// A consumer-provided accessible name takes precedence, so the generated
|
|
79
|
+
// relationship is only used as a fallback. Where an external name wins,
|
|
80
|
+
// the unused ID is left off the internal label. Empty values are treated
|
|
81
|
+
// as absent, matching the accessible name computation, which skips an
|
|
82
|
+
// empty `aria-label` or `aria-labelledby` rather than resolving a name
|
|
83
|
+
// from it.
|
|
84
|
+
const labelId =
|
|
85
|
+
label && ! ariaLabel && ! ariaLabelledBy ? generatedLabelId : undefined;
|
|
86
|
+
|
|
61
87
|
// Use internal state instead of a ref to make sure that the component
|
|
62
88
|
// re-renders when the popover's anchor updates.
|
|
63
89
|
const [ popoverAnchor, setPopoverAnchor ] = useState< Element | null >(
|
|
@@ -80,12 +106,46 @@ const UnconnectedBorderBoxControl = (
|
|
|
80
106
|
);
|
|
81
107
|
|
|
82
108
|
const mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] );
|
|
109
|
+
|
|
83
110
|
return (
|
|
84
|
-
<View
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
111
|
+
<View
|
|
112
|
+
className={ className }
|
|
113
|
+
// Whichever naming source wins, it describes the border controls
|
|
114
|
+
// as a whole, so the wrapper needs a role for that accessible
|
|
115
|
+
// name to attach to. Without a name there is no group to expose.
|
|
116
|
+
role={ label || ariaLabel || ariaLabelledBy ? 'group' : undefined }
|
|
117
|
+
aria-label={ ariaLabel }
|
|
118
|
+
aria-labelledby={ ariaLabelledBy ?? labelId }
|
|
119
|
+
{ ...otherProps }
|
|
120
|
+
ref={ mergedRef }
|
|
121
|
+
>
|
|
122
|
+
{ hasVisibleLabel ? (
|
|
123
|
+
// The toggle shares the label's row so that it lines up with
|
|
124
|
+
// the equivalent toggle on sibling controls, e.g. the border
|
|
125
|
+
// radius one.
|
|
126
|
+
<Grid
|
|
127
|
+
className={ headerClassName }
|
|
128
|
+
columns={ 2 }
|
|
129
|
+
templateColumns="1fr min-content"
|
|
130
|
+
alignment="center"
|
|
131
|
+
>
|
|
132
|
+
<BorderLabel
|
|
133
|
+
id={ labelId }
|
|
134
|
+
label={ label }
|
|
135
|
+
hideLabelFromVision={ hideLabelFromVision }
|
|
136
|
+
/>
|
|
137
|
+
<BorderBoxControlLinkedButton
|
|
138
|
+
onClick={ toggleLinked }
|
|
139
|
+
isLinked={ isLinked }
|
|
140
|
+
/>
|
|
141
|
+
</Grid>
|
|
142
|
+
) : (
|
|
143
|
+
<BorderLabel
|
|
144
|
+
id={ labelId }
|
|
145
|
+
label={ label }
|
|
146
|
+
hideLabelFromVision={ hideLabelFromVision }
|
|
147
|
+
/>
|
|
148
|
+
) }
|
|
89
149
|
<View className={ wrapperClassName }>
|
|
90
150
|
{ isLinked ? (
|
|
91
151
|
<BorderControl
|
|
@@ -123,10 +183,14 @@ const UnconnectedBorderBoxControl = (
|
|
|
123
183
|
}
|
|
124
184
|
/>
|
|
125
185
|
) }
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
186
|
+
{ /* With no label row to join, the toggle sits alongside the
|
|
187
|
+
inputs instead. */ }
|
|
188
|
+
{ ! hasVisibleLabel && (
|
|
189
|
+
<BorderBoxControlLinkedButton
|
|
190
|
+
onClick={ toggleLinked }
|
|
191
|
+
isLinked={ isLinked }
|
|
192
|
+
/>
|
|
193
|
+
) }
|
|
130
194
|
</View>
|
|
131
195
|
</View>
|
|
132
196
|
);
|
|
@@ -136,6 +200,10 @@ const UnconnectedBorderBoxControl = (
|
|
|
136
200
|
* An input control for the color, style, and width of the border of a box. The
|
|
137
201
|
* border can be customized as a whole, or individually for each side of the box.
|
|
138
202
|
*
|
|
203
|
+
* The controls are exposed as a group named by the `label` prop. Passing
|
|
204
|
+
* `aria-labelledby` or `aria-label` names the group instead, taking precedence
|
|
205
|
+
* over `label`; with none of the three, the wrapper is not exposed as a group.
|
|
206
|
+
*
|
|
139
207
|
* ```jsx
|
|
140
208
|
* import { BorderBoxControl } from '@wordpress/components';
|
|
141
209
|
* import { __ } from '@wordpress/i18n';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
1
2
|
import { useState } from '@wordpress/element';
|
|
2
3
|
import styles from '../style.module.scss';
|
|
3
4
|
import {
|
|
@@ -23,6 +24,8 @@ export function useBorderBoxControl(
|
|
|
23
24
|
onChange,
|
|
24
25
|
enableAlpha = false,
|
|
25
26
|
enableStyle = true,
|
|
27
|
+
hideLabelFromVision,
|
|
28
|
+
label,
|
|
26
29
|
value,
|
|
27
30
|
__experimentalIsRenderedInSidebar = false,
|
|
28
31
|
// Deprecated props, no longer used.
|
|
@@ -31,6 +34,11 @@ export function useBorderBoxControl(
|
|
|
31
34
|
...otherProps
|
|
32
35
|
} = useContextSystem( props, 'BorderBoxControl' );
|
|
33
36
|
|
|
37
|
+
// A visible label gives the control a header row to place the linked/
|
|
38
|
+
// unlinked toggle in, alongside that label. Without one the toggle stays
|
|
39
|
+
// inside the input wrapper, positioned absolutely.
|
|
40
|
+
const hasVisibleLabel = !! label && ! hideLabelFromVision;
|
|
41
|
+
|
|
34
42
|
const mixedBorders = hasMixedBorders( value );
|
|
35
43
|
const splitBorders = hasSplitBorders( value );
|
|
36
44
|
|
|
@@ -99,13 +107,23 @@ export function useBorderBoxControl(
|
|
|
99
107
|
}
|
|
100
108
|
};
|
|
101
109
|
|
|
102
|
-
|
|
110
|
+
// The linked control reserves an inline-end gutter for the absolutely
|
|
111
|
+
// positioned toggle. Once the toggle moves up into the header row that
|
|
112
|
+
// gutter only shortens the input, so drop it.
|
|
113
|
+
const linkedControlClassName = clsx( styles[ 'linked-border-control' ], {
|
|
114
|
+
[ styles[ 'linked-border-control-full-width' ] ]: hasVisibleLabel,
|
|
115
|
+
} );
|
|
103
116
|
const wrapperClassName = styles.wrapper;
|
|
117
|
+
const headerClassName = styles.header;
|
|
104
118
|
|
|
105
119
|
return {
|
|
106
120
|
...otherProps,
|
|
107
121
|
className,
|
|
108
122
|
colors,
|
|
123
|
+
hasVisibleLabel,
|
|
124
|
+
headerClassName,
|
|
125
|
+
hideLabelFromVision,
|
|
126
|
+
label,
|
|
109
127
|
disableUnits: mixedBorders && ! hasWidthValue,
|
|
110
128
|
enableAlpha,
|
|
111
129
|
enableStyle,
|
|
@@ -79,3 +79,13 @@ Default.args = {
|
|
|
79
79
|
label: 'Borders',
|
|
80
80
|
enableStyle: true,
|
|
81
81
|
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* With no visible label there is no label row for the linked/unlinked toggle to
|
|
85
|
+
* join, so it is rendered alongside the border inputs instead.
|
|
86
|
+
*/
|
|
87
|
+
export const WithoutLabel = Template.bind( {} );
|
|
88
|
+
WithoutLabel.args = {
|
|
89
|
+
...Default.args,
|
|
90
|
+
label: undefined,
|
|
91
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use "@wordpress/base-styles/variables" as *;
|
|
2
|
+
|
|
1
3
|
.linked-border-control {
|
|
2
4
|
/* Preserve the original `&&` specificity so this beats BorderControl's margin reset. */
|
|
3
5
|
&#{&} {
|
|
@@ -6,14 +8,43 @@
|
|
|
6
8
|
}
|
|
7
9
|
}
|
|
8
10
|
|
|
11
|
+
/* No inline-end gutter is needed when the toggle sits in the header row. */
|
|
12
|
+
.linked-border-control-full-width {
|
|
13
|
+
&#{&} {
|
|
14
|
+
margin-inline-end: 0;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* The label row the linked/unlinked toggle joins when a visible label is
|
|
19
|
+
rendered. Laid out as a content-driven grid like `BoxControl`'s label row, so
|
|
20
|
+
a label that wraps grows the row rather than overflowing a fixed height. */
|
|
21
|
+
.header {
|
|
22
|
+
/* The row is as tall as the toggle (24px, `Button` `size="small"`), so 4px
|
|
23
|
+
here leaves the same 28px between label and inputs as the sibling
|
|
24
|
+
controls, which instead pair a fixed 16px row with a 12px margin. */
|
|
25
|
+
margin-bottom: $grid-unit-05;
|
|
26
|
+
|
|
27
|
+
/* The label (a `BaseControl.VisualLabel`, so a `span`) supplies its own
|
|
28
|
+
bottom margin as the gap to the input below. In the header row that gap
|
|
29
|
+
comes from the row itself, and the margin would both pull the vertically
|
|
30
|
+
centred label off centre and pad the row out once the label wraps. */
|
|
31
|
+
> span {
|
|
32
|
+
margin-bottom: 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
9
36
|
.wrapper {
|
|
10
37
|
position: relative;
|
|
38
|
+
|
|
39
|
+
/* Without a header row the toggle is positioned against the input instead. */
|
|
40
|
+
.linked-button {
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 8px;
|
|
43
|
+
inset-inline-end: 0;
|
|
44
|
+
}
|
|
11
45
|
}
|
|
12
46
|
|
|
13
47
|
.linked-button {
|
|
14
|
-
position: absolute;
|
|
15
|
-
top: 8px;
|
|
16
|
-
inset-inline-end: 0;
|
|
17
48
|
line-height: 0;
|
|
18
49
|
}
|
|
19
50
|
|