@wordpress/components 23.1.0 → 23.3.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 +53 -0
- package/CONTRIBUTING.md +1 -1
- package/LICENSE.md +1 -1
- package/build/alignment-matrix-control/utils.js +2 -2
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +1 -3
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +8 -4
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/button/deprecated.js +8 -6
- package/build/button/deprecated.js.map +1 -1
- package/build/button/index.js +52 -23
- package/build/button/index.js.map +1 -1
- package/build/button/types.js +6 -0
- package/build/button/types.js.map +1 -0
- package/build/color-list-picker/index.js.map +1 -1
- package/build/color-list-picker/types.js +6 -0
- package/build/color-list-picker/types.js.map +1 -0
- package/build/color-palette/index.js +9 -61
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +24 -9
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-palette/utils.js +103 -0
- package/build/color-palette/utils.js.map +1 -0
- package/build/color-picker/component.js +1 -0
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/styles.js +8 -10
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +5 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js +1 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/dropdown/index.js +20 -8
- package/build/dropdown/index.js.map +1 -1
- package/build/focal-point-picker/utils.js +1 -1
- package/build/focal-point-picker/utils.js.map +1 -1
- package/build/form-token-field/token.js +1 -1
- package/build/form-token-field/token.js.map +1 -1
- package/build/gradient-picker/index.js +9 -1
- package/build/gradient-picker/index.js.map +1 -1
- package/build/h-stack/component.js +0 -1
- package/build/h-stack/component.js.map +1 -1
- package/build/index.js +7 -17
- package/build/index.js.map +1 -1
- package/build/index.native.js +8 -18
- package/build/index.native.js.map +1 -1
- package/build/input-control/input-field.js +4 -2
- package/build/input-control/input-field.js.map +1 -1
- package/build/item-group/item/component.js +27 -3
- package/build/item-group/item/component.js.map +1 -1
- package/build/item-group/item-group/component.js +26 -3
- package/build/item-group/item-group/component.js.map +1 -1
- package/build/item-group/styles.js +14 -14
- package/build/item-group/styles.js.map +1 -1
- package/build/keyboard-shortcuts/index.js +44 -16
- package/build/keyboard-shortcuts/index.js.map +1 -1
- package/build/keyboard-shortcuts/types.js +6 -0
- package/build/keyboard-shortcuts/types.js.map +1 -0
- package/build/modal/index.js +1 -1
- package/build/modal/index.js.map +1 -1
- package/build/notice/index.js +16 -18
- package/build/notice/index.js.map +1 -1
- package/build/notice/list.js +23 -8
- package/build/notice/list.js.map +1 -1
- package/build/notice/types.js +6 -0
- package/build/notice/types.js.map +1 -0
- package/build/number-control/index.js +1 -1
- package/build/number-control/index.js.map +1 -1
- package/build/panel/row.js +5 -3
- package/build/panel/row.js.map +1 -1
- package/build/query-controls/author-select.js +7 -3
- package/build/query-controls/author-select.js.map +1 -1
- package/build/query-controls/category-select.js +7 -3
- package/build/query-controls/category-select.js.map +1 -1
- package/build/query-controls/index.js +69 -20
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/terms.js +4 -3
- package/build/query-controls/terms.js.map +1 -1
- package/build/query-controls/types.js +6 -0
- package/build/query-controls/types.js.map +1 -0
- package/build/resizable-box/index.js +5 -4
- package/build/resizable-box/index.js.map +1 -1
- package/build/responsive-wrapper/index.js +18 -1
- package/build/responsive-wrapper/index.js.map +1 -1
- package/build/responsive-wrapper/types.js +6 -0
- package/build/responsive-wrapper/types.js.map +1 -0
- package/build/sandbox/index.js +35 -24
- package/build/sandbox/index.js.map +1 -1
- package/build/sandbox/types.js +6 -0
- package/build/sandbox/types.js.map +1 -0
- package/build/slot-fill/bubbles-virtually/fill.js +1 -0
- package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build/slot-fill/slot.js +1 -0
- package/build/slot-fill/slot.js.map +1 -1
- package/build/slot-fill/use-slot.js +1 -11
- package/build/slot-fill/use-slot.js.map +1 -1
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js.map +1 -1
- package/build/tab-panel/index.js +40 -7
- package/build/tab-panel/index.js.map +1 -1
- package/build/toolbar/index.js +42 -60
- package/build/toolbar/index.js.map +1 -1
- package/build/toolbar/toolbar/index.js +74 -0
- package/build/toolbar/toolbar/index.js.map +1 -0
- package/build/toolbar/{toolbar-container.js → toolbar/toolbar-container.js} +0 -0
- package/build/toolbar/toolbar/toolbar-container.js.map +1 -0
- package/build/toolbar/{toolbar-container.native.js → toolbar/toolbar-container.native.js} +0 -0
- package/build/toolbar/toolbar/toolbar-container.native.js.map +1 -0
- package/build/{toolbar-button → toolbar/toolbar-button}/index.js +1 -1
- package/build/toolbar/toolbar-button/index.js.map +1 -0
- package/build/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.js +0 -0
- package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -0
- package/build/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.native.js +0 -0
- package/build/toolbar/toolbar-button/toolbar-button-container.native.js.map +1 -0
- package/build/{toolbar-context → toolbar/toolbar-context}/index.js +0 -0
- package/build/toolbar/toolbar-context/index.js.map +1 -0
- package/build/{toolbar-dropdown-menu → toolbar/toolbar-dropdown-menu}/index.js +1 -1
- package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -0
- package/build/{toolbar-group → toolbar/toolbar-group}/index.js +0 -0
- package/build/toolbar/toolbar-group/index.js.map +1 -0
- package/build/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.js +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -0
- package/build/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.native.js +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.native.js.map +1 -0
- package/build/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.js +0 -0
- package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -0
- package/build/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.native.js +0 -0
- package/build/toolbar/toolbar-group/toolbar-group-container.native.js.map +1 -0
- package/build/{toolbar-item → toolbar/toolbar-item}/index.js +0 -0
- package/build/toolbar/toolbar-item/index.js.map +1 -0
- package/build/{toolbar-item → toolbar/toolbar-item}/index.native.js +0 -0
- package/build/toolbar/toolbar-item/index.native.js.map +1 -0
- package/build/tree-grid/index.js +4 -4
- package/build/tree-grid/index.js.map +1 -1
- package/build/tree-select/index.js +2 -6
- package/build/tree-select/index.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +2 -2
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +1 -2
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +7 -4
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/button/deprecated.js +8 -5
- package/build-module/button/deprecated.js.map +1 -1
- package/build-module/button/index.js +51 -22
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/types.js +2 -0
- package/build-module/button/types.js.map +1 -0
- package/build-module/color-list-picker/index.js.map +1 -1
- package/build-module/color-list-picker/types.js +2 -0
- package/build-module/color-list-picker/types.js.map +1 -0
- package/build-module/color-palette/index.js +7 -54
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +24 -8
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-palette/utils.js +79 -0
- package/build-module/color-palette/utils.js.map +1 -0
- package/build-module/color-picker/component.js +1 -0
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/styles.js +8 -9
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +5 -1
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build-module/date-time/date/index.js +1 -1
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/dropdown/index.js +19 -8
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/focal-point-picker/utils.js +1 -1
- package/build-module/focal-point-picker/utils.js.map +1 -1
- package/build-module/form-token-field/token.js +1 -1
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/gradient-picker/index.js +9 -2
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/h-stack/component.js +0 -1
- package/build-module/h-stack/component.js.map +1 -1
- package/build-module/index.js +1 -6
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +1 -6
- package/build-module/index.native.js.map +1 -1
- package/build-module/input-control/input-field.js +4 -2
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/item-group/item/component.js +26 -2
- package/build-module/item-group/item/component.js.map +1 -1
- package/build-module/item-group/item-group/component.js +25 -2
- package/build-module/item-group/item-group/component.js.map +1 -1
- package/build-module/item-group/styles.js +14 -14
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/keyboard-shortcuts/index.js +48 -16
- package/build-module/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/keyboard-shortcuts/types.js +2 -0
- package/build-module/keyboard-shortcuts/types.js.map +1 -0
- package/build-module/modal/index.js +1 -1
- package/build-module/modal/index.js.map +1 -1
- package/build-module/notice/index.js +14 -15
- package/build-module/notice/index.js.map +1 -1
- package/build-module/notice/list.js +23 -8
- package/build-module/notice/list.js.map +1 -1
- package/build-module/notice/types.js +2 -0
- package/build-module/notice/types.js.map +1 -0
- package/build-module/number-control/index.js +1 -1
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/panel/row.js +5 -3
- package/build-module/panel/row.js.map +1 -1
- package/build-module/query-controls/author-select.js +7 -3
- package/build-module/query-controls/author-select.js.map +1 -1
- package/build-module/query-controls/category-select.js +8 -4
- package/build-module/query-controls/category-select.js.map +1 -1
- package/build-module/query-controls/index.js +65 -20
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/terms.js +8 -4
- package/build-module/query-controls/terms.js.map +1 -1
- package/build-module/query-controls/types.js +2 -0
- package/build-module/query-controls/types.js.map +1 -0
- package/build-module/resizable-box/index.js +3 -2
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/responsive-wrapper/index.js +20 -1
- package/build-module/responsive-wrapper/index.js.map +1 -1
- package/build-module/responsive-wrapper/types.js +2 -0
- package/build-module/responsive-wrapper/types.js.map +1 -0
- package/build-module/sandbox/index.js +37 -23
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/sandbox/types.js +2 -0
- package/build-module/sandbox/types.js.map +1 -0
- package/build-module/slot-fill/bubbles-virtually/fill.js +1 -0
- package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build-module/slot-fill/slot.js +1 -0
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/slot-fill/use-slot.js +2 -12
- package/build-module/slot-fill/use-slot.js.map +1 -1
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/tab-panel/index.js +40 -7
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/toolbar/index.js +6 -58
- package/build-module/toolbar/index.js.map +1 -1
- package/build-module/toolbar/toolbar/index.js +59 -0
- package/build-module/toolbar/toolbar/index.js.map +1 -0
- package/build-module/toolbar/{toolbar-container.js → toolbar/toolbar-container.js} +0 -0
- package/{build → build-module/toolbar}/toolbar/toolbar-container.js.map +1 -1
- package/build-module/toolbar/{toolbar-container.native.js → toolbar/toolbar-container.native.js} +0 -0
- package/build-module/toolbar/toolbar/toolbar-container.native.js.map +1 -0
- package/build-module/{toolbar-button → toolbar/toolbar-button}/index.js +1 -1
- package/build-module/toolbar/toolbar-button/index.js.map +1 -0
- package/build-module/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.js +0 -0
- package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -0
- package/build-module/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.native.js +0 -0
- package/build-module/toolbar/toolbar-button/toolbar-button-container.native.js.map +1 -0
- package/build-module/{toolbar-context → toolbar/toolbar-context}/index.js +0 -0
- package/build-module/toolbar/toolbar-context/index.js.map +1 -0
- package/build-module/{toolbar-dropdown-menu → toolbar/toolbar-dropdown-menu}/index.js +1 -1
- package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -0
- package/build-module/{toolbar-group → toolbar/toolbar-group}/index.js +0 -0
- package/build-module/toolbar/toolbar-group/index.js.map +1 -0
- package/build-module/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.js +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -0
- package/build-module/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.native.js +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.native.js.map +1 -0
- package/build-module/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.js +0 -0
- package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -0
- package/build-module/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.native.js +0 -0
- package/build-module/toolbar/toolbar-group/toolbar-group-container.native.js.map +1 -0
- package/build-module/{toolbar-item → toolbar/toolbar-item}/index.js +0 -0
- package/build-module/toolbar/toolbar-item/index.js.map +1 -0
- package/build-module/{toolbar-item → toolbar/toolbar-item}/index.native.js +0 -0
- package/build-module/toolbar/toolbar-item/index.native.js.map +1 -0
- package/build-module/tree-grid/index.js +4 -4
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/tree-select/index.js +2 -6
- package/build-module/tree-select/index.js.map +1 -1
- package/build-style/style-rtl.css +6 -1
- package/build-style/style.css +6 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +171 -160
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
- package/build-types/border-control/border-control/hook.d.ts +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -1
- package/build-types/button/deprecated.d.ts +143 -7
- package/build-types/button/deprecated.d.ts.map +1 -1
- package/build-types/button/index.d.ts +20 -3
- package/build-types/button/index.d.ts.map +1 -1
- package/build-types/button/stories/index.d.ts +20 -0
- package/build-types/button/stories/index.d.ts.map +1 -0
- package/build-types/button/test/index.d.ts +2 -0
- package/build-types/button/test/index.d.ts.map +1 -0
- package/build-types/button/types.d.ts +134 -0
- package/build-types/button/types.d.ts.map +1 -0
- package/build-types/color-list-picker/index.d.ts +5 -0
- package/build-types/color-list-picker/index.d.ts.map +1 -0
- package/build-types/color-list-picker/types.d.ts +42 -0
- package/build-types/color-list-picker/types.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts +2 -4
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.d.ts +2 -2
- package/build-types/color-palette/styles.d.ts +1 -1
- package/build-types/color-palette/types.d.ts +1 -1
- package/build-types/color-palette/types.d.ts.map +1 -1
- package/build-types/color-palette/utils.d.ts +14 -0
- package/build-types/color-palette/utils.d.ts.map +1 -0
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/dashicon/types.d.ts +0 -4
- package/build-types/dashicon/types.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +3 -3
- package/build-types/dropdown/index.d.ts +4 -4
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.d.ts.map +1 -1
- package/build-types/dropdown/types.d.ts +9 -10
- package/build-types/dropdown/types.d.ts.map +1 -1
- package/build-types/focal-point-picker/utils.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +2 -2
- package/build-types/h-stack/component.d.ts +0 -1
- package/build-types/h-stack/component.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/item-group/item/component.d.ts +24 -2
- package/build-types/item-group/item/component.d.ts.map +1 -1
- package/build-types/item-group/item-group/component.d.ts +23 -2
- package/build-types/item-group/item-group/component.d.ts.map +1 -1
- package/build-types/item-group/stories/index.d.ts +15 -0
- package/build-types/item-group/stories/index.d.ts.map +1 -0
- package/build-types/item-group/styles.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/index.d.ts +38 -0
- package/build-types/keyboard-shortcuts/index.d.ts.map +1 -0
- package/build-types/keyboard-shortcuts/stories/index.d.ts +12 -0
- package/build-types/keyboard-shortcuts/stories/index.d.ts.map +1 -0
- package/build-types/keyboard-shortcuts/test/index.d.ts +2 -0
- package/build-types/keyboard-shortcuts/test/index.d.ts.map +1 -0
- package/build-types/keyboard-shortcuts/types.d.ts +48 -0
- package/build-types/keyboard-shortcuts/types.d.ts.map +1 -0
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +2 -2
- package/build-types/navigator/navigator-button/component.d.ts +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +2 -2
- package/build-types/notice/index.d.ts +16 -0
- package/build-types/notice/index.d.ts.map +1 -0
- package/build-types/notice/list.d.ts +32 -0
- package/build-types/notice/list.d.ts.map +1 -0
- package/build-types/notice/stories/index.d.ts +17 -0
- package/build-types/notice/stories/index.d.ts.map +1 -0
- package/build-types/notice/test/index.d.ts +2 -0
- package/build-types/notice/test/index.d.ts.map +1 -0
- package/build-types/notice/test/list.d.ts +2 -0
- package/build-types/notice/test/list.d.ts.map +1 -0
- package/build-types/notice/types.d.ts +128 -0
- package/build-types/notice/types.d.ts.map +1 -0
- package/build-types/number-control/styles/number-control-styles.d.ts +2 -2
- package/build-types/number-control/styles/number-control-styles.d.ts.map +1 -1
- package/build-types/placeholder/stories/index.d.ts.map +1 -1
- package/build-types/query-controls/author-select.d.ts +4 -0
- package/build-types/query-controls/author-select.d.ts.map +1 -0
- package/build-types/query-controls/category-select.d.ts +4 -0
- package/build-types/query-controls/category-select.d.ts.map +1 -0
- package/build-types/query-controls/index.d.ts +30 -0
- package/build-types/query-controls/index.d.ts.map +1 -0
- package/build-types/query-controls/stories/index.d.ts +13 -0
- package/build-types/query-controls/stories/index.d.ts.map +1 -0
- package/build-types/query-controls/terms.d.ts +13 -0
- package/build-types/query-controls/terms.d.ts.map +1 -0
- package/build-types/query-controls/test/terms.d.ts +2 -0
- package/build-types/query-controls/test/terms.d.ts.map +1 -0
- package/build-types/query-controls/types.d.ts +131 -0
- package/build-types/query-controls/types.d.ts.map +1 -0
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/resizable-box/index.d.ts +6 -7
- package/build-types/resizable-box/index.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.d.ts +61 -0
- package/build-types/resizable-box/stories/index.d.ts.map +1 -0
- package/build-types/responsive-wrapper/index.d.ts +24 -0
- package/build-types/responsive-wrapper/index.d.ts.map +1 -0
- package/build-types/responsive-wrapper/stories/index.d.ts +12 -0
- package/build-types/responsive-wrapper/stories/index.d.ts.map +1 -0
- package/build-types/responsive-wrapper/types.d.ts +22 -0
- package/build-types/responsive-wrapper/types.d.ts.map +1 -0
- package/build-types/sandbox/index.d.ts +19 -0
- package/build-types/sandbox/index.d.ts.map +1 -0
- package/build-types/sandbox/stories/index.d.ts +12 -0
- package/build-types/sandbox/stories/index.d.ts.map +1 -0
- package/build-types/sandbox/test/index.d.ts +2 -0
- package/build-types/sandbox/test/index.d.ts.map +1 -0
- package/build-types/sandbox/types.d.ts +36 -0
- package/build-types/sandbox/types.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
- package/build-types/slot-fill/use-slot.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts +9 -2
- package/build-types/snackbar/index.d.ts.map +1 -1
- package/build-types/snackbar/list.d.ts.map +1 -1
- package/build-types/snackbar/types.d.ts +15 -88
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.d.ts +1 -0
- package/build-types/tab-panel/stories/index.d.ts.map +1 -1
- package/build-types/tab-panel/types.d.ts +11 -5
- package/build-types/tab-panel/types.d.ts.map +1 -1
- package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/ui/form-group/form-group.d.ts +2 -2
- package/package.json +18 -17
- package/src/alignment-matrix-control/utils.tsx +2 -2
- package/src/autocomplete/autocompleter-ui.js +1 -2
- package/src/autocomplete/test/index.js +1 -5
- package/src/border-box-control/border-box-control-linked-button/component.tsx +1 -1
- package/src/border-box-control/border-box-control-linked-button/hook.ts +1 -1
- package/src/border-control/border-control-dropdown/component.tsx +9 -8
- package/src/box-control/test/index.js +11 -35
- package/src/button/README.md +49 -55
- package/src/button/{deprecated.js → deprecated.tsx} +19 -4
- package/src/button/{index.js → index.tsx} +95 -34
- package/src/button/stories/index.tsx +106 -0
- package/src/button/style.scss +3 -2
- package/src/button/test/{index.js → index.tsx} +30 -7
- package/src/button/types.ts +138 -0
- package/src/checkbox-control/test/index.tsx +1 -5
- package/src/color-list-picker/{index.js → index.tsx} +3 -2
- package/src/color-list-picker/types.ts +46 -0
- package/src/color-palette/README.md +1 -1
- package/src/color-palette/index.native.js +11 -4
- package/src/color-palette/index.tsx +11 -67
- package/src/color-palette/test/index.tsx +4 -14
- package/src/color-palette/test/utils.ts +1 -1
- package/src/color-palette/types.ts +1 -1
- package/src/color-palette/utils.ts +98 -0
- package/src/color-picker/component.tsx +1 -0
- package/src/color-picker/stories/index.js +20 -60
- package/src/color-picker/styles.ts +0 -5
- package/src/color-picker/test/index.js +6 -15
- package/src/combobox-control/index.js +9 -1
- package/src/combobox-control/test/index.js +1 -6
- package/src/confirm-dialog/test/index.js +9 -29
- package/src/custom-gradient-picker/gradient-bar/utils.js +1 -1
- package/src/dashicon/types.ts +0 -6
- package/src/date-time/date/index.tsx +2 -1
- package/src/date-time/date/test/index.tsx +2 -8
- package/src/date-time/time/test/index.tsx +9 -29
- package/src/dimension-control/test/index.test.js +2 -8
- package/src/disabled/test/index.tsx +1 -5
- package/src/draggable/test/index.native.js +4 -4
- package/src/dropdown/README.md +1 -8
- package/src/dropdown/index.tsx +17 -6
- package/src/dropdown/stories/index.tsx +3 -3
- package/src/dropdown/test/index.tsx +2 -8
- package/src/dropdown/types.ts +9 -10
- package/src/dropdown-menu/README.md +1 -1
- package/src/dropdown-menu/stories/index.js +96 -27
- package/src/dropdown-menu/test/index.js +2 -8
- package/src/external-link/test/index.tsx +1 -6
- package/src/focal-point-picker/stories/index.tsx +1 -1
- package/src/focal-point-picker/test/index.js +3 -11
- package/src/focal-point-picker/utils.ts +4 -1
- package/src/font-size-picker/test/index.tsx +14 -44
- package/src/form-file-upload/test/index.tsx +2 -17
- package/src/form-toggle/test/index.tsx +1 -5
- package/src/form-token-field/test/index.tsx +80 -163
- package/src/form-token-field/token.tsx +1 -1
- package/src/gradient-picker/index.js +15 -4
- package/src/guide/stories/index.js +14 -41
- package/src/guide/test/index.js +5 -17
- package/src/h-stack/component.tsx +0 -1
- package/src/higher-order/with-filters/test/index.js +24 -24
- package/src/higher-order/with-focus-outside/test/index.js +11 -25
- package/src/higher-order/with-focus-return/test/index.js +1 -5
- package/src/index.js +8 -6
- package/src/index.native.js +8 -6
- package/src/input-control/input-field.tsx +3 -1
- package/src/input-control/test/index.js +1 -6
- package/src/isolated-event-container/test/index.js +2 -8
- package/src/item-group/item/component.tsx +26 -2
- package/src/item-group/item-group/component.tsx +25 -2
- package/src/item-group/stories/index.tsx +103 -0
- package/src/item-group/styles.ts +1 -0
- package/src/item-group/test/__snapshots__/index.js.snap +11 -10
- package/src/keyboard-shortcuts/README.md +1 -1
- package/src/keyboard-shortcuts/index.tsx +93 -0
- package/src/keyboard-shortcuts/stories/index.tsx +60 -0
- package/src/keyboard-shortcuts/test/{index.js → index.tsx} +16 -6
- package/src/keyboard-shortcuts/types.ts +51 -0
- package/src/modal/index.tsx +1 -2
- package/src/navigable-container/test/navigable-menu.js +5 -17
- package/src/navigable-container/test/tababble-container.js +3 -11
- package/src/navigation/test/index.js +3 -11
- package/src/navigator/test/index.tsx +6 -20
- package/src/notice/README.md +89 -42
- package/src/notice/{index.js → index.tsx} +28 -20
- package/src/notice/list.tsx +72 -0
- package/src/notice/stories/index.tsx +119 -0
- package/src/notice/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/notice/test/{index.js → index.tsx} +7 -4
- package/src/notice/test/{list.js → list.tsx} +0 -0
- package/src/notice/types.ts +136 -0
- package/src/number-control/index.tsx +1 -1
- package/src/number-control/test/index.tsx +28 -86
- package/src/panel/row.js +3 -3
- package/src/panel/stories/index.js +62 -80
- package/src/panel/test/body.js +2 -8
- package/src/placeholder/stories/index.tsx +1 -0
- package/src/placeholder/style.scss +1 -1
- package/src/query-controls/README.md +56 -56
- package/src/query-controls/author-select.tsx +37 -0
- package/src/query-controls/category-select.tsx +46 -0
- package/src/query-controls/index.tsx +192 -0
- package/src/query-controls/stories/index.tsx +205 -0
- package/src/query-controls/terms.ts +57 -0
- package/src/query-controls/test/{terms.js → terms.ts} +36 -20
- package/src/query-controls/types.ts +150 -0
- package/src/resizable-box/README.md +2 -2
- package/src/resizable-box/index.tsx +7 -6
- package/src/resizable-box/stories/index.tsx +92 -0
- package/src/responsive-wrapper/README.md +29 -0
- package/src/responsive-wrapper/{index.js → index.tsx} +23 -2
- package/src/responsive-wrapper/stories/index.tsx +38 -0
- package/src/responsive-wrapper/types.ts +20 -0
- package/src/sandbox/README.md +45 -2
- package/src/sandbox/{index.js → index.tsx} +47 -24
- package/src/sandbox/stories/index.tsx +32 -0
- package/src/sandbox/test/{index.js → index.tsx} +9 -4
- package/src/sandbox/types.ts +34 -0
- package/src/select-control/test/select-control.tsx +1 -6
- package/src/slot-fill/bubbles-virtually/fill.js +1 -0
- package/src/slot-fill/slot.js +1 -1
- package/src/slot-fill/stories/index.js +12 -17
- package/src/slot-fill/use-slot.js +6 -16
- package/src/snackbar/index.tsx +6 -5
- package/src/snackbar/list.tsx +4 -2
- package/src/snackbar/types.ts +18 -92
- package/src/style.scss +3 -3
- package/src/tab-panel/README.md +1 -0
- package/src/tab-panel/index.tsx +42 -6
- package/src/tab-panel/stories/index.tsx +20 -0
- package/src/tab-panel/style.scss +8 -0
- package/src/tab-panel/test/index.tsx +124 -7
- package/src/tab-panel/types.ts +11 -5
- package/src/theme/test/index.tsx +4 -4
- package/src/toggle-group-control/stories/index.tsx +1 -0
- package/src/toggle-group-control/test/index.tsx +7 -23
- package/src/toolbar/index.js +6 -52
- package/src/toolbar/stories/index.js +71 -75
- package/src/toolbar/test/index.js +1 -2
- package/src/{toolbar-group/test/index.js → toolbar/test/toolbar-group.js} +1 -1
- package/src/toolbar/{README.md → toolbar/README.md} +0 -0
- package/src/toolbar/toolbar/index.js +52 -0
- package/src/toolbar/{style.native.scss → toolbar/style.native.scss} +0 -0
- package/src/toolbar/{style.scss → toolbar/style.scss} +0 -0
- package/src/toolbar/{toolbar-container.js → toolbar/toolbar-container.js} +0 -0
- package/src/toolbar/{toolbar-container.native.js → toolbar/toolbar-container.native.js} +0 -0
- package/src/{toolbar-button → toolbar/toolbar-button}/README.md +0 -0
- package/src/{toolbar-button → toolbar/toolbar-button}/index.js +1 -1
- package/src/{toolbar-button → toolbar/toolbar-button}/style.scss +0 -0
- package/src/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.js +0 -0
- package/src/{toolbar-button → toolbar/toolbar-button}/toolbar-button-container.native.js +0 -0
- package/src/{toolbar-context → toolbar/toolbar-context}/index.js +0 -0
- package/src/{toolbar-dropdown-menu → toolbar/toolbar-dropdown-menu}/README.md +0 -0
- package/src/{toolbar-dropdown-menu → toolbar/toolbar-dropdown-menu}/index.js +1 -1
- package/src/{toolbar-group → toolbar/toolbar-group}/README.md +0 -0
- package/src/{toolbar-group → toolbar/toolbar-group}/index.js +0 -0
- package/src/{toolbar-group → toolbar/toolbar-group}/style.native.scss +0 -0
- package/src/{toolbar-group → toolbar/toolbar-group}/style.scss +0 -0
- package/src/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.js +1 -1
- package/src/{toolbar-group → toolbar/toolbar-group}/toolbar-group-collapsed.native.js +1 -1
- package/src/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.js +0 -0
- package/src/{toolbar-group → toolbar/toolbar-group}/toolbar-group-container.native.js +0 -0
- package/src/{toolbar-item → toolbar/toolbar-item}/README.md +0 -0
- package/src/{toolbar-item → toolbar/toolbar-item}/index.js +0 -0
- package/src/{toolbar-item → toolbar/toolbar-item}/index.native.js +0 -0
- package/src/tools-panel/stories/index.js +3 -0
- package/src/tools-panel/test/index.js +1 -1
- package/src/tree-grid/index.js +3 -5
- package/src/tree-select/index.tsx +3 -6
- package/src/ui/context/test/context-connect.tsx +2 -0
- package/src/ui/context/test/wordpress-component.tsx +2 -0
- package/src/unit-control/test/index.tsx +21 -74
- package/src/utils/hooks/test/use-latest-ref.js +15 -18
- package/tsconfig.json +1 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/build/toolbar/toolbar-container.native.js.map +0 -1
- package/build/toolbar-button/index.js.map +0 -1
- package/build/toolbar-button/toolbar-button-container.js.map +0 -1
- package/build/toolbar-button/toolbar-button-container.native.js.map +0 -1
- package/build/toolbar-context/index.js.map +0 -1
- package/build/toolbar-dropdown-menu/index.js.map +0 -1
- package/build/toolbar-group/index.js.map +0 -1
- package/build/toolbar-group/toolbar-group-collapsed.js.map +0 -1
- package/build/toolbar-group/toolbar-group-collapsed.native.js.map +0 -1
- package/build/toolbar-group/toolbar-group-container.js.map +0 -1
- package/build/toolbar-group/toolbar-group-container.native.js.map +0 -1
- package/build/toolbar-item/index.js.map +0 -1
- package/build/toolbar-item/index.native.js.map +0 -1
- package/build-module/toolbar/toolbar-container.js.map +0 -1
- package/build-module/toolbar/toolbar-container.native.js.map +0 -1
- package/build-module/toolbar-button/index.js.map +0 -1
- package/build-module/toolbar-button/toolbar-button-container.js.map +0 -1
- package/build-module/toolbar-button/toolbar-button-container.native.js.map +0 -1
- package/build-module/toolbar-context/index.js.map +0 -1
- package/build-module/toolbar-dropdown-menu/index.js.map +0 -1
- package/build-module/toolbar-group/index.js.map +0 -1
- package/build-module/toolbar-group/toolbar-group-collapsed.js.map +0 -1
- package/build-module/toolbar-group/toolbar-group-collapsed.native.js.map +0 -1
- package/build-module/toolbar-group/toolbar-group-container.js.map +0 -1
- package/build-module/toolbar-group/toolbar-group-container.native.js.map +0 -1
- package/build-module/toolbar-item/index.js.map +0 -1
- package/build-module/toolbar-item/index.native.js.map +0 -1
- package/src/button/stories/index.js +0 -179
- package/src/item-group/stories/index.js +0 -270
- package/src/keyboard-shortcuts/index.js +0 -56
- package/src/notice/list.js +0 -48
- package/src/notice/stories/index.js +0 -74
- package/src/query-controls/author-select.js +0 -23
- package/src/query-controls/category-select.js +0 -31
- package/src/query-controls/index.js +0 -121
- package/src/query-controls/terms.js +0 -40
- package/src/resizable-box/stories/index.js +0 -97
- package/src/toolbar-button/stories/index.js +0 -33
- package/src/toolbar-group/stories/index.js +0 -33
|
@@ -9,6 +9,11 @@ import {
|
|
|
9
9
|
} from '@wordpress/element';
|
|
10
10
|
import { useFocusableIframe, useMergeRefs } from '@wordpress/compose';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import type { SandBoxProps } from './types';
|
|
16
|
+
|
|
12
17
|
const observeAndResizeJS = function () {
|
|
13
18
|
const { MutationObserver } = window;
|
|
14
19
|
|
|
@@ -44,11 +49,11 @@ const observeAndResizeJS = function () {
|
|
|
44
49
|
// Hack: Remove viewport unit styles, as these are relative
|
|
45
50
|
// the iframe root and interfere with our mechanism for
|
|
46
51
|
// determining the unconstrained page bounds.
|
|
47
|
-
function removeViewportStyles( ruleOrNode ) {
|
|
52
|
+
function removeViewportStyles( ruleOrNode: ElementCSSInlineStyle ) {
|
|
48
53
|
if ( ruleOrNode.style ) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
(
|
|
55
|
+
[ 'width', 'height', 'minHeight', 'maxHeight' ] as const
|
|
56
|
+
).forEach( function ( style ) {
|
|
52
57
|
if (
|
|
53
58
|
/^\\d+(vmin|vmax|vh|vw)$/.test( ruleOrNode.style[ style ] )
|
|
54
59
|
) {
|
|
@@ -83,6 +88,7 @@ const observeAndResizeJS = function () {
|
|
|
83
88
|
window.addEventListener( 'resize', sendResize, true );
|
|
84
89
|
};
|
|
85
90
|
|
|
91
|
+
// TODO: These styles shouldn't be coupled with WordPress.
|
|
86
92
|
const style = `
|
|
87
93
|
body {
|
|
88
94
|
margin: 0;
|
|
@@ -106,37 +112,53 @@ const style = `
|
|
|
106
112
|
}
|
|
107
113
|
`;
|
|
108
114
|
|
|
109
|
-
|
|
115
|
+
/**
|
|
116
|
+
* This component provides an isolated environment for arbitrary HTML via iframes.
|
|
117
|
+
*
|
|
118
|
+
* ```jsx
|
|
119
|
+
* import { SandBox } from '@wordpress/components';
|
|
120
|
+
*
|
|
121
|
+
* const MySandBox = () => (
|
|
122
|
+
* <SandBox html="<p>Content</p>" title="SandBox" type="embed" />
|
|
123
|
+
* );
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
function SandBox( {
|
|
110
127
|
html = '',
|
|
111
128
|
title = '',
|
|
112
129
|
type,
|
|
113
130
|
styles = [],
|
|
114
131
|
scripts = [],
|
|
115
132
|
onFocus,
|
|
116
|
-
} ) {
|
|
117
|
-
const ref = useRef();
|
|
133
|
+
}: SandBoxProps ) {
|
|
134
|
+
const ref = useRef< HTMLIFrameElement >();
|
|
118
135
|
const [ width, setWidth ] = useState( 0 );
|
|
119
136
|
const [ height, setHeight ] = useState( 0 );
|
|
120
137
|
|
|
121
138
|
function isFrameAccessible() {
|
|
122
139
|
try {
|
|
123
|
-
return !! ref.current
|
|
140
|
+
return !! ref.current?.contentDocument?.body;
|
|
124
141
|
} catch ( e ) {
|
|
125
142
|
return false;
|
|
126
143
|
}
|
|
127
144
|
}
|
|
128
145
|
|
|
129
|
-
function
|
|
146
|
+
function trySandBox( forceRerender = false ) {
|
|
130
147
|
if ( ! isFrameAccessible() ) {
|
|
131
148
|
return;
|
|
132
149
|
}
|
|
133
150
|
|
|
134
|
-
const { contentDocument, ownerDocument } =
|
|
135
|
-
|
|
151
|
+
const { contentDocument, ownerDocument } =
|
|
152
|
+
ref.current as HTMLIFrameElement & {
|
|
153
|
+
contentDocument: Document;
|
|
154
|
+
};
|
|
136
155
|
|
|
137
156
|
if (
|
|
138
157
|
! forceRerender &&
|
|
139
|
-
null !==
|
|
158
|
+
null !==
|
|
159
|
+
contentDocument?.body.getAttribute(
|
|
160
|
+
'data-resizable-iframe-connected'
|
|
161
|
+
)
|
|
140
162
|
) {
|
|
141
163
|
return;
|
|
142
164
|
}
|
|
@@ -187,13 +209,13 @@ export default function Sandbox( {
|
|
|
187
209
|
}
|
|
188
210
|
|
|
189
211
|
useEffect( () => {
|
|
190
|
-
|
|
212
|
+
trySandBox();
|
|
191
213
|
|
|
192
|
-
function
|
|
193
|
-
|
|
214
|
+
function tryNoForceSandBox() {
|
|
215
|
+
trySandBox( false );
|
|
194
216
|
}
|
|
195
217
|
|
|
196
|
-
function checkMessageForResize( event ) {
|
|
218
|
+
function checkMessageForResize( event: MessageEvent ) {
|
|
197
219
|
const iframe = ref.current;
|
|
198
220
|
|
|
199
221
|
// Verify that the mounted element is the source of the message.
|
|
@@ -221,19 +243,18 @@ export default function Sandbox( {
|
|
|
221
243
|
}
|
|
222
244
|
|
|
223
245
|
const iframe = ref.current;
|
|
224
|
-
const
|
|
225
|
-
const { defaultView } = ownerDocument;
|
|
246
|
+
const defaultView = iframe?.ownerDocument?.defaultView;
|
|
226
247
|
|
|
227
248
|
// This used to be registered using <iframe onLoad={} />, but it made the iframe blank
|
|
228
249
|
// after reordering the containing block. See these two issues for more details:
|
|
229
250
|
// https://github.com/WordPress/gutenberg/issues/6146
|
|
230
251
|
// https://github.com/facebook/react/issues/18752
|
|
231
|
-
iframe
|
|
232
|
-
defaultView
|
|
252
|
+
iframe?.addEventListener( 'load', tryNoForceSandBox, false );
|
|
253
|
+
defaultView?.addEventListener( 'message', checkMessageForResize );
|
|
233
254
|
|
|
234
255
|
return () => {
|
|
235
|
-
iframe?.removeEventListener( 'load',
|
|
236
|
-
defaultView
|
|
256
|
+
iframe?.removeEventListener( 'load', tryNoForceSandBox, false );
|
|
257
|
+
defaultView?.addEventListener( 'message', checkMessageForResize );
|
|
237
258
|
};
|
|
238
259
|
// Ignore reason: passing `exhaustive-deps` will likely involve a more detailed refactor.
|
|
239
260
|
// See https://github.com/WordPress/gutenberg/pull/44378
|
|
@@ -241,14 +262,14 @@ export default function Sandbox( {
|
|
|
241
262
|
}, [] );
|
|
242
263
|
|
|
243
264
|
useEffect( () => {
|
|
244
|
-
|
|
265
|
+
trySandBox();
|
|
245
266
|
// Ignore reason: passing `exhaustive-deps` will likely involve a more detailed refactor.
|
|
246
267
|
// See https://github.com/WordPress/gutenberg/pull/44378
|
|
247
268
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
248
269
|
}, [ title, styles, scripts ] );
|
|
249
270
|
|
|
250
271
|
useEffect( () => {
|
|
251
|
-
|
|
272
|
+
trySandBox( true );
|
|
252
273
|
// Ignore reason: passing `exhaustive-deps` will likely involve a more detailed refactor.
|
|
253
274
|
// See https://github.com/WordPress/gutenberg/pull/44378
|
|
254
275
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -266,3 +287,5 @@ export default function Sandbox( {
|
|
|
266
287
|
/>
|
|
267
288
|
);
|
|
268
289
|
}
|
|
290
|
+
|
|
291
|
+
export default SandBox;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import SandBox from '..';
|
|
10
|
+
|
|
11
|
+
const meta: ComponentMeta< typeof SandBox > = {
|
|
12
|
+
component: SandBox,
|
|
13
|
+
title: 'Components/SandBox',
|
|
14
|
+
argTypes: {
|
|
15
|
+
onFocus: { control: { type: null } },
|
|
16
|
+
},
|
|
17
|
+
parameters: {
|
|
18
|
+
actions: { argTypesRegex: '^on.*' },
|
|
19
|
+
controls: { expanded: true },
|
|
20
|
+
docs: { source: { state: 'open' } },
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export default meta;
|
|
24
|
+
|
|
25
|
+
const Template: ComponentStory< typeof SandBox > = ( args ) => (
|
|
26
|
+
<SandBox { ...args } />
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
export const Default = Template.bind( {} );
|
|
30
|
+
Default.args = {
|
|
31
|
+
html: '<p>Arbitrary HTML content</p>',
|
|
32
|
+
};
|
|
@@ -11,9 +11,9 @@ import { useState } from '@wordpress/element';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import
|
|
14
|
+
import SandBox from '..';
|
|
15
15
|
|
|
16
|
-
describe( '
|
|
16
|
+
describe( 'SandBox', () => {
|
|
17
17
|
const TestWrapper = () => {
|
|
18
18
|
const [ html, setHtml ] = useState(
|
|
19
19
|
// MutationObserver implementation from JSDom does not work as intended
|
|
@@ -33,7 +33,7 @@ describe( 'Sandbox', () => {
|
|
|
33
33
|
<button onClick={ updateHtml } className="mock-button">
|
|
34
34
|
Mock Button
|
|
35
35
|
</button>
|
|
36
|
-
<
|
|
36
|
+
<SandBox html={ html } title="SandBox Title" />
|
|
37
37
|
</div>
|
|
38
38
|
);
|
|
39
39
|
};
|
|
@@ -41,7 +41,12 @@ describe( 'Sandbox', () => {
|
|
|
41
41
|
it( 'should rerender with new emdeded content if html prop changes', () => {
|
|
42
42
|
render( <TestWrapper /> );
|
|
43
43
|
|
|
44
|
-
const iframe =
|
|
44
|
+
const iframe =
|
|
45
|
+
screen.getByTitle< HTMLIFrameElement >( 'SandBox Title' );
|
|
46
|
+
|
|
47
|
+
if ( ! iframe.contentWindow ) {
|
|
48
|
+
throw new Error();
|
|
49
|
+
}
|
|
45
50
|
|
|
46
51
|
let sandboxedIframe = within(
|
|
47
52
|
iframe.contentWindow.document.body
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type SandBoxProps = {
|
|
2
|
+
/**
|
|
3
|
+
* The HTML to render in the body of the iframe document.
|
|
4
|
+
*
|
|
5
|
+
* @default ''
|
|
6
|
+
*/
|
|
7
|
+
html?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The `<title>` of the iframe document.
|
|
10
|
+
*
|
|
11
|
+
* @default ''
|
|
12
|
+
*/
|
|
13
|
+
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The CSS class name to apply to the `<html>` and `<body>` elements of the iframe.
|
|
16
|
+
*/
|
|
17
|
+
type?: string;
|
|
18
|
+
/**
|
|
19
|
+
* An array of CSS strings to inject into the `<head>` of the iframe document.
|
|
20
|
+
*
|
|
21
|
+
* @default []
|
|
22
|
+
*/
|
|
23
|
+
styles?: string[];
|
|
24
|
+
/**
|
|
25
|
+
* An array of script URLs to inject as `<script>` tags into the bottom of the `<body>` of the iframe document.
|
|
26
|
+
*
|
|
27
|
+
* @default []
|
|
28
|
+
*/
|
|
29
|
+
scripts?: string[];
|
|
30
|
+
/**
|
|
31
|
+
* The `onFocus` callback for the iframe.
|
|
32
|
+
*/
|
|
33
|
+
onFocus?: React.DOMAttributes< HTMLIFrameElement >[ 'onFocus' ];
|
|
34
|
+
};
|
|
@@ -9,12 +9,7 @@ import userEvent from '@testing-library/user-event';
|
|
|
9
9
|
*/
|
|
10
10
|
import SelectControl from '..';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const setupUser = () =>
|
|
15
|
-
userEvent.setup( {
|
|
16
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
17
|
-
} );
|
|
12
|
+
const setupUser = () => userEvent.setup();
|
|
18
13
|
|
|
19
14
|
describe( 'SelectControl', () => {
|
|
20
15
|
it( 'should not render when no options or children are provided', () => {
|
package/src/slot-fill/slot.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { text, number } from '@storybook/addon-knobs';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -11,19 +6,21 @@ import { createContext, useContext } from '@wordpress/element';
|
|
|
11
6
|
/**
|
|
12
7
|
* Internal dependencies
|
|
13
8
|
*/
|
|
14
|
-
import { Slot, Fill, Provider } from '../';
|
|
9
|
+
import { Slot, Fill, Provider as SlotFillProvider } from '../';
|
|
15
10
|
|
|
16
11
|
export default {
|
|
17
12
|
title: 'Components/SlotFill',
|
|
13
|
+
subcomponents: { Fill, SlotFillProvider },
|
|
18
14
|
component: Slot,
|
|
19
15
|
parameters: {
|
|
20
|
-
|
|
16
|
+
controls: { expanded: true },
|
|
17
|
+
docs: { source: { state: 'open' } },
|
|
21
18
|
},
|
|
22
19
|
};
|
|
23
20
|
|
|
24
21
|
export const _default = () => {
|
|
25
22
|
return (
|
|
26
|
-
<
|
|
23
|
+
<SlotFillProvider>
|
|
27
24
|
<h2>Profile</h2>
|
|
28
25
|
<p>
|
|
29
26
|
Name: <Slot bubblesVirtually as="span" name="name" />
|
|
@@ -33,15 +30,13 @@ export const _default = () => {
|
|
|
33
30
|
</p>
|
|
34
31
|
<Fill name="name">Grace</Fill>
|
|
35
32
|
<Fill name="age">33</Fill>
|
|
36
|
-
</
|
|
33
|
+
</SlotFillProvider>
|
|
37
34
|
);
|
|
38
35
|
};
|
|
39
36
|
|
|
40
37
|
export const withFillProps = () => {
|
|
41
|
-
const name = text( 'name', 'Grace' );
|
|
42
|
-
const age = number( 'age', 33 );
|
|
43
38
|
return (
|
|
44
|
-
<
|
|
39
|
+
<SlotFillProvider>
|
|
45
40
|
<h2>Profile</h2>
|
|
46
41
|
<p>
|
|
47
42
|
Name:{ ' ' }
|
|
@@ -49,7 +44,7 @@ export const withFillProps = () => {
|
|
|
49
44
|
bubblesVirtually
|
|
50
45
|
as="span"
|
|
51
46
|
name="name"
|
|
52
|
-
fillProps={ { name } }
|
|
47
|
+
fillProps={ { name: 'Grace' } }
|
|
53
48
|
/>
|
|
54
49
|
</p>
|
|
55
50
|
<p>
|
|
@@ -58,12 +53,12 @@ export const withFillProps = () => {
|
|
|
58
53
|
bubblesVirtually
|
|
59
54
|
as="span"
|
|
60
55
|
name="age"
|
|
61
|
-
fillProps={ { age } }
|
|
56
|
+
fillProps={ { age: 33 } }
|
|
62
57
|
/>
|
|
63
58
|
</p>
|
|
64
59
|
<Fill name="name">{ ( fillProps ) => fillProps.name }</Fill>
|
|
65
60
|
<Fill name="age">{ ( fillProps ) => fillProps.age }</Fill>
|
|
66
|
-
</
|
|
61
|
+
</SlotFillProvider>
|
|
67
62
|
);
|
|
68
63
|
};
|
|
69
64
|
|
|
@@ -74,7 +69,7 @@ export const withContext = () => {
|
|
|
74
69
|
return <Fill name={ name }>{ value }</Fill>;
|
|
75
70
|
};
|
|
76
71
|
return (
|
|
77
|
-
<
|
|
72
|
+
<SlotFillProvider>
|
|
78
73
|
<h2>Profile</h2>
|
|
79
74
|
<p>
|
|
80
75
|
Name: <Slot bubblesVirtually as="span" name="name" />
|
|
@@ -88,6 +83,6 @@ export const withContext = () => {
|
|
|
88
83
|
<Context.Provider value={ 33 }>
|
|
89
84
|
<ContextFill name="age" />
|
|
90
85
|
</Context.Provider>
|
|
91
|
-
</
|
|
86
|
+
</SlotFillProvider>
|
|
92
87
|
);
|
|
93
88
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import { useContext,
|
|
5
|
+
import { useContext, useSyncExternalStore } from '@wordpress/element';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
@@ -17,21 +17,11 @@ import SlotFillContext from './context';
|
|
|
17
17
|
*/
|
|
18
18
|
const useSlot = ( name ) => {
|
|
19
19
|
const { getSlot, subscribe } = useContext( SlotFillContext );
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
setSlot( getSlot( name ) );
|
|
26
|
-
} );
|
|
27
|
-
|
|
28
|
-
return unsubscribe;
|
|
29
|
-
// Ignore reason: Modifying this dep array could introduce unexpected changes in behavior,
|
|
30
|
-
// so we'll leave it as=is until the hook can be properly refactored for exhaustive-deps.
|
|
31
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
|
-
}, [ name ] );
|
|
33
|
-
|
|
34
|
-
return slot;
|
|
20
|
+
return useSyncExternalStore(
|
|
21
|
+
subscribe,
|
|
22
|
+
() => getSlot( name ),
|
|
23
|
+
() => getSlot( name )
|
|
24
|
+
);
|
|
35
25
|
};
|
|
36
26
|
|
|
37
27
|
export default useSlot;
|
package/src/snackbar/index.tsx
CHANGED
|
@@ -16,7 +16,8 @@ import warning from '@wordpress/warning';
|
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import Button from '../button';
|
|
19
|
-
import type {
|
|
19
|
+
import type { SnackbarProps } from './types';
|
|
20
|
+
import type { NoticeAction } from '../notice/types';
|
|
20
21
|
import type { WordPressComponentProps } from '../ui/context';
|
|
21
22
|
|
|
22
23
|
const NOTICE_TIMEOUT = 10000;
|
|
@@ -73,7 +74,7 @@ function UnforwardedSnackbar(
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
function onActionClick(
|
|
76
|
-
event: MouseEvent
|
|
77
|
+
event: MouseEvent< HTMLButtonElement >,
|
|
77
78
|
onClick: NoticeAction[ 'onClick' ]
|
|
78
79
|
) {
|
|
79
80
|
event.stopPropagation();
|
|
@@ -139,9 +140,9 @@ function UnforwardedSnackbar(
|
|
|
139
140
|
key={ index }
|
|
140
141
|
href={ url }
|
|
141
142
|
variant="tertiary"
|
|
142
|
-
onClick={ (
|
|
143
|
-
|
|
144
|
-
}
|
|
143
|
+
onClick={ (
|
|
144
|
+
event: MouseEvent< HTMLButtonElement >
|
|
145
|
+
) => onActionClick( event, onClick ) }
|
|
145
146
|
className="components-snackbar__action"
|
|
146
147
|
>
|
|
147
148
|
{ label }
|
package/src/snackbar/list.tsx
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
__unstableMotion as motion,
|
|
18
18
|
__unstableAnimatePresence as AnimatePresence,
|
|
19
19
|
} from '../animation';
|
|
20
|
-
import type {
|
|
20
|
+
import type { SnackbarListProps } from './types';
|
|
21
21
|
import type { WordPressComponentProps } from '../ui/context';
|
|
22
22
|
|
|
23
23
|
const SNACKBAR_VARIANTS = {
|
|
@@ -61,7 +61,9 @@ export function SnackbarList( {
|
|
|
61
61
|
const listRef = useRef< HTMLDivElement | null >( null );
|
|
62
62
|
const isReducedMotion = useReducedMotion();
|
|
63
63
|
className = classnames( 'components-snackbar-list', className );
|
|
64
|
-
const removeNotice =
|
|
64
|
+
const removeNotice =
|
|
65
|
+
( notice: SnackbarListProps[ 'notices' ][ number ] ) => () =>
|
|
66
|
+
onRemove?.( notice.id );
|
|
65
67
|
return (
|
|
66
68
|
<div className={ className } tabIndex={ -1 } ref={ listRef }>
|
|
67
69
|
{ children }
|
package/src/snackbar/types.ts
CHANGED
|
@@ -1,116 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type { MutableRefObject, ReactNode
|
|
4
|
+
import type { MutableRefObject, ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
type NoticeActionWithOnClick = {
|
|
13
|
-
label: string;
|
|
14
|
-
url?: string;
|
|
15
|
-
onClick: ( event: SyntheticEvent ) => void;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
// TODO: move this type to the Notice component once it gets typed.
|
|
19
|
-
export type NoticeAction = NoticeActionWithURL | NoticeActionWithOnClick;
|
|
20
|
-
|
|
21
|
-
export type Notice = {
|
|
22
|
-
id: string;
|
|
23
|
-
spokenMessage: string;
|
|
24
|
-
actions: NoticeAction[];
|
|
25
|
-
icon?: ReactNode;
|
|
26
|
-
onDismiss?: () => void;
|
|
27
|
-
content: string;
|
|
28
|
-
isDismissible: boolean;
|
|
29
|
-
explicitDismiss: boolean;
|
|
30
|
-
};
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type { NoticeProps, NoticeChildren } from '../notice/types';
|
|
31
10
|
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The displayed message of a notice.
|
|
35
|
-
*
|
|
36
|
-
* Also used as the spoken message for assistive technology,
|
|
37
|
-
* unless `spokenMessage` is provided as an alternative message.
|
|
38
|
-
*/
|
|
39
|
-
children: string;
|
|
40
|
-
/**
|
|
41
|
-
* Used to provide a custom spoken message.
|
|
42
|
-
*
|
|
43
|
-
* @default children
|
|
44
|
-
*/
|
|
45
|
-
spokenMessage?: Notice[ 'spokenMessage' ];
|
|
46
|
-
/**
|
|
47
|
-
* A politeness level for the notice's spoken message. Should be provided as
|
|
48
|
-
* one of the valid options for an `aria-live` attribute value. Note that this
|
|
49
|
-
* value should be considered a suggestion; assistive technologies may
|
|
50
|
-
* override it based on internal heuristics.
|
|
51
|
-
*
|
|
52
|
-
* A value of `'assertive'` is to be used for important, and usually
|
|
53
|
-
* time-sensitive, information. It will interrupt anything else the screen
|
|
54
|
-
* reader is announcing in that moment.
|
|
55
|
-
* A value of `'polite'` is to be used for advisory information. It should
|
|
56
|
-
* not interrupt what the screen reader is announcing in that moment
|
|
57
|
-
* (the "speech queue") or interrupt the current task.
|
|
58
|
-
*
|
|
59
|
-
* @see https://www.w3.org/TR/wai-aria-1.1/#aria-live
|
|
60
|
-
*
|
|
61
|
-
* @default 'polite'
|
|
62
|
-
*/
|
|
63
|
-
politeness?: 'polite' | 'assertive';
|
|
64
|
-
/**
|
|
65
|
-
* An array of action objects.
|
|
66
|
-
*
|
|
67
|
-
* Each member object should contain
|
|
68
|
-
* a `label` and either a `url` link string or `onClick` callback function.
|
|
69
|
-
*
|
|
70
|
-
* @default []
|
|
71
|
-
*/
|
|
72
|
-
actions?: Notice[ 'actions' ];
|
|
73
|
-
/**
|
|
74
|
-
* Called to remove the snackbar from the UI.
|
|
75
|
-
*/
|
|
76
|
-
onRemove?: () => void;
|
|
11
|
+
type SnackbarOnlyProps = {
|
|
77
12
|
/**
|
|
78
13
|
* The icon to render in the snackbar.
|
|
79
14
|
*
|
|
80
15
|
* @default null
|
|
81
16
|
*/
|
|
82
|
-
icon?:
|
|
17
|
+
icon?: ReactNode;
|
|
83
18
|
/**
|
|
84
19
|
* Whether to require user action to dismiss the snackbar.
|
|
85
20
|
* By default, this is dismissed on a timeout, without user interaction.
|
|
86
21
|
*
|
|
87
22
|
* @default false
|
|
88
23
|
*/
|
|
89
|
-
explicitDismiss?:
|
|
90
|
-
/**
|
|
91
|
-
* A callback executed when the snackbar is dismissed.
|
|
92
|
-
*
|
|
93
|
-
* It is distinct from onRemove, which _looks_ like a callback but is
|
|
94
|
-
* actually the function to call to remove the snackbar from the UI.
|
|
95
|
-
*/
|
|
96
|
-
onDismiss?: Notice[ 'onDismiss' ];
|
|
24
|
+
explicitDismiss?: boolean;
|
|
97
25
|
/**
|
|
98
26
|
* A ref to the list that contains the snackbar.
|
|
99
27
|
*/
|
|
100
28
|
listRef?: MutableRefObject< HTMLDivElement | null >;
|
|
101
29
|
};
|
|
102
30
|
|
|
31
|
+
export type SnackbarProps = NoticeProps & SnackbarOnlyProps;
|
|
32
|
+
|
|
103
33
|
export type SnackbarListProps = {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
children?:
|
|
112
|
-
/**
|
|
113
|
-
* Function called when a notice should be removed / dismissed.
|
|
114
|
-
*/
|
|
115
|
-
onRemove?: ( id: Notice[ 'id' ] ) => void;
|
|
34
|
+
notices: Array<
|
|
35
|
+
Omit< SnackbarProps, 'children' > & {
|
|
36
|
+
id: string;
|
|
37
|
+
content: string;
|
|
38
|
+
}
|
|
39
|
+
>;
|
|
40
|
+
onRemove: ( id: string ) => void;
|
|
41
|
+
children?: NoticeChildren | Array< NoticeChildren >;
|
|
116
42
|
};
|
package/src/style.scss
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
@import "./tab-panel/style.scss";
|
|
45
45
|
@import "./text-control/style.scss";
|
|
46
46
|
@import "./tip/style.scss";
|
|
47
|
-
@import "./toolbar/style.scss";
|
|
48
|
-
@import "./toolbar-button/style.scss";
|
|
49
|
-
@import "./toolbar-group/style.scss";
|
|
47
|
+
@import "./toolbar/toolbar/style.scss";
|
|
48
|
+
@import "./toolbar/toolbar-button/style.scss";
|
|
49
|
+
@import "./toolbar/toolbar-group/style.scss";
|
|
50
50
|
@import "./tooltip/style.scss";
|
package/src/tab-panel/README.md
CHANGED
|
@@ -121,6 +121,7 @@ An array of objects containing the following properties:
|
|
|
121
121
|
- `title`:`(string)` Defines the translated text for the tab.
|
|
122
122
|
- `className`:`(string)` Optional. Defines the class to put on the tab.
|
|
123
123
|
- `icon`:`(ReactNode)` Optional. When set, displays the icon in place of the tab title. The title is then rendered as an aria-label and tooltip.
|
|
124
|
+
- `disabled`:`(boolean)` Optional. Determines if the tab should be disabled or selectable.
|
|
124
125
|
|
|
125
126
|
> > **Note:** Other fields may be added to the object and accessed from the child function if desired.
|
|
126
127
|
|