@wordpress/components 28.13.1-next.082ed6819.0 → 28.14.1-next.cd6172eb0.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 +46 -2
- package/CONTRIBUTING.md +16 -16
- package/build/angle-picker-control/index.js +1 -1
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/autocomplete/index.js +0 -1
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-control/border-control/component.js +2 -0
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/box-control/all-input-control.js +1 -0
- package/build/box-control/all-input-control.js.map +1 -1
- package/build/box-control/axial-input-controls.js +1 -0
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/box-control/index.js +22 -15
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-controls.js +1 -0
- package/build/box-control/input-controls.js.map +1 -1
- package/build/box-control/types.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-actions.js +1 -0
- package/build/circular-option-picker/circular-option-picker-actions.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +1 -0
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/clipboard-button/index.js +5 -3
- package/build/clipboard-button/index.js.map +1 -1
- package/build/color-palette/index.native.js +0 -1
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-picker/input-with-slider.js +2 -2
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/composite/item.js +0 -9
- package/build/composite/item.js.map +1 -1
- package/build/context/context-connect.js +0 -1
- package/build/context/context-connect.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +2 -0
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-picker/index.js +2 -0
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/types.js.map +1 -1
- package/build/custom-select-control/index.js +8 -0
- package/build/custom-select-control/index.js.map +1 -1
- package/build/custom-select-control/types.js.map +1 -1
- package/build/drop-zone/index.js +19 -13
- package/build/drop-zone/index.js.map +1 -1
- package/build/drop-zone/types.js.map +1 -1
- package/build/dropdown-menu/index.js +1 -0
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/duotone-picker/color-list-picker/index.js +9 -14
- package/build/duotone-picker/color-list-picker/index.js.map +1 -1
- package/build/external-link/index.js +0 -1
- package/build/external-link/index.js.map +1 -1
- package/build/font-size-picker/font-size-picker-select.js +1 -0
- package/build/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build/font-size-picker/index.js +1 -0
- package/build/font-size-picker/index.js.map +1 -1
- package/build/form-file-upload/index.js +11 -1
- package/build/form-file-upload/index.js.map +1 -1
- package/build/form-file-upload/types.js.map +1 -1
- package/build/form-token-field/index.js +6 -1
- package/build/form-token-field/index.js.map +1 -1
- package/build/gradient-picker/index.js +2 -0
- package/build/gradient-picker/index.js.map +1 -1
- package/build/gradient-picker/types.js.map +1 -1
- package/build/icon/index.js +9 -0
- package/build/icon/index.js.map +1 -1
- package/build/menu/checkbox-item.js +5 -9
- package/build/menu/checkbox-item.js.map +1 -1
- package/build/menu/group-label.js +4 -1
- package/build/menu/group-label.js.map +1 -1
- package/build/menu/group.js +4 -1
- package/build/menu/group.js.map +1 -1
- package/build/menu/item-help-text.js +5 -0
- package/build/menu/item-help-text.js.map +1 -1
- package/build/menu/item-label.js +5 -0
- package/build/menu/item-label.js.map +1 -1
- package/build/menu/item.js +4 -8
- package/build/menu/item.js.map +1 -1
- package/build/menu/radio-item.js +5 -9
- package/build/menu/radio-item.js.map +1 -1
- package/build/menu/separator.js +5 -2
- package/build/menu/separator.js.map +1 -1
- package/build/modal/aria-helper.js +0 -1
- package/build/modal/aria-helper.js.map +1 -1
- package/build/modal/index.js +0 -1
- package/build/modal/index.js.map +1 -1
- package/build/number-control/index.js +8 -0
- package/build/number-control/index.js.map +1 -1
- package/build/number-control/types.js.map +1 -1
- package/build/range-control/index.js +2 -1
- package/build/range-control/index.js.map +1 -1
- package/build/resizable-box/index.js +9 -1
- package/build/resizable-box/index.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/fill.js +8 -12
- package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +6 -10
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +4 -10
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/types.js.map +1 -1
- package/build/style-provider/index.js +0 -1
- package/build/style-provider/index.js.map +1 -1
- package/build/tabs/tab.js +0 -17
- package/build/tabs/tab.js.map +1 -1
- package/build/toolbar/toolbar-button/index.js +2 -0
- package/build/toolbar/toolbar-button/index.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js +2 -0
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/unit-control/index.js +10 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/types.js.map +1 -1
- package/build-module/angle-picker-control/index.js +1 -1
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/autocomplete/index.js +0 -1
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-control/border-control/component.js +2 -0
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/box-control/all-input-control.js +1 -0
- package/build-module/box-control/all-input-control.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js +1 -0
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/box-control/index.js +22 -15
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-controls.js +1 -0
- package/build-module/box-control/input-controls.js.map +1 -1
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-actions.js +1 -0
- package/build-module/circular-option-picker/circular-option-picker-actions.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +1 -0
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/clipboard-button/index.js +5 -3
- package/build-module/clipboard-button/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +0 -1
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +2 -2
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/composite/item.js +0 -9
- package/build-module/composite/item.js.map +1 -1
- package/build-module/context/context-connect.js +0 -1
- package/build-module/context/context-connect.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +2 -0
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +2 -0
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/types.js.map +1 -1
- package/build-module/custom-select-control/index.js +8 -0
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/custom-select-control/types.js.map +1 -1
- package/build-module/drop-zone/index.js +19 -13
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/drop-zone/types.js.map +1 -1
- package/build-module/dropdown-menu/index.js +1 -0
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/duotone-picker/color-list-picker/index.js +10 -15
- package/build-module/duotone-picker/color-list-picker/index.js.map +1 -1
- package/build-module/external-link/index.js +0 -1
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-select.js +1 -0
- package/build-module/font-size-picker/font-size-picker-select.js.map +1 -1
- package/build-module/font-size-picker/index.js +1 -0
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/form-file-upload/index.js +13 -2
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/form-file-upload/types.js.map +1 -1
- package/build-module/form-token-field/index.js +6 -1
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/gradient-picker/index.js +2 -0
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/gradient-picker/types.js.map +1 -1
- package/build-module/icon/index.js +9 -0
- package/build-module/icon/index.js.map +1 -1
- package/build-module/menu/checkbox-item.js +5 -9
- package/build-module/menu/checkbox-item.js.map +1 -1
- package/build-module/menu/group-label.js +4 -1
- package/build-module/menu/group-label.js.map +1 -1
- package/build-module/menu/group.js +4 -1
- package/build-module/menu/group.js.map +1 -1
- package/build-module/menu/item-help-text.js +6 -1
- package/build-module/menu/item-help-text.js.map +1 -1
- package/build-module/menu/item-label.js +6 -1
- package/build-module/menu/item-label.js.map +1 -1
- package/build-module/menu/item.js +4 -8
- package/build-module/menu/item.js.map +1 -1
- package/build-module/menu/radio-item.js +5 -9
- package/build-module/menu/radio-item.js.map +1 -1
- package/build-module/menu/separator.js +5 -2
- package/build-module/menu/separator.js.map +1 -1
- package/build-module/modal/aria-helper.js +0 -1
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/modal/index.js +0 -1
- package/build-module/modal/index.js.map +1 -1
- package/build-module/number-control/index.js +8 -0
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/number-control/types.js.map +1 -1
- package/build-module/range-control/index.js +2 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/resizable-box/index.js +9 -1
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/fill.js +9 -13
- package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +6 -10
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +4 -10
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/types.js.map +1 -1
- package/build-module/style-provider/index.js +0 -1
- package/build-module/style-provider/index.js.map +1 -1
- package/build-module/tabs/tab.js +0 -15
- package/build-module/tabs/tab.js.map +1 -1
- package/build-module/toolbar/toolbar-button/index.js +2 -0
- package/build-module/toolbar/toolbar-button/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +2 -0
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/unit-control/index.js +10 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/types.js.map +1 -1
- package/build-style/style-rtl.css +12 -8
- package/build-style/style.css +12 -8
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/box-control/all-input-control.d.ts.map +1 -1
- package/build-types/box-control/axial-input-controls.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts +14 -13
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/input-controls.d.ts.map +1 -1
- package/build-types/box-control/stories/index.story.d.ts +42 -6
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-styles.d.ts +3 -2
- package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +16 -2
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-actions.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
- package/build-types/clipboard-button/index.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +3 -2
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/composite/item.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/index.d.ts +1 -1
- package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/types.d.ts +6 -0
- package/build-types/custom-gradient-picker/types.d.ts.map +1 -1
- package/build-types/custom-select-control/index.d.ts.map +1 -1
- package/build-types/custom-select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-select-control/types.d.ts +7 -0
- package/build-types/custom-select-control/types.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts +8 -4
- package/build-types/date-time/time/styles.d.ts.map +1 -1
- package/build-types/drop-zone/index.d.ts +1 -1
- package/build-types/drop-zone/index.d.ts.map +1 -1
- package/build-types/drop-zone/types.d.ts +5 -0
- package/build-types/drop-zone/types.d.ts.map +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
- package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/form-file-upload/index.d.ts +2 -1
- package/build-types/form-file-upload/index.d.ts.map +1 -1
- package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
- package/build-types/form-file-upload/types.d.ts +10 -8
- package/build-types/form-file-upload/types.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/stories/index.story.d.ts.map +1 -1
- package/build-types/gradient-picker/index.d.ts +1 -1
- package/build-types/gradient-picker/index.d.ts.map +1 -1
- package/build-types/gradient-picker/types.d.ts +6 -0
- package/build-types/gradient-picker/types.d.ts.map +1 -1
- package/build-types/icon/index.d.ts +23 -7
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/icon/stories/index.story.d.ts +7 -1
- package/build-types/icon/stories/index.story.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts +2 -2
- package/build-types/menu/checkbox-item.d.ts.map +1 -1
- package/build-types/menu/group-label.d.ts.map +1 -1
- package/build-types/menu/group.d.ts.map +1 -1
- package/build-types/menu/index.d.ts.map +1 -1
- package/build-types/menu/item-help-text.d.ts.map +1 -1
- package/build-types/menu/item-label.d.ts.map +1 -1
- package/build-types/menu/item.d.ts.map +1 -1
- package/build-types/menu/radio-item.d.ts.map +1 -1
- package/build-types/menu/separator.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +2 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +2 -1
- package/build-types/number-control/stories/index.story.d.ts.map +1 -1
- package/build-types/number-control/types.d.ts +7 -0
- package/build-types/number-control/types.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +2 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/resizable-box/index.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/use-slot-fills.d.ts +1 -1
- package/build-types/slot-fill/types.d.ts +4 -3
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/tabs/tab.d.ts +3 -0
- package/build-types/tabs/tab.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
- package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/component.d.ts +2 -0
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +3 -2
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +2 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +7 -0
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/angle-picker-control/index.tsx +1 -1
- package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -1
- package/src/border-control/border-control/component.tsx +2 -0
- package/src/box-control/README.md +80 -60
- package/src/box-control/all-input-control.tsx +1 -0
- package/src/box-control/axial-input-controls.tsx +1 -0
- package/src/box-control/docs-manifest.json +5 -0
- package/src/box-control/index.tsx +23 -15
- package/src/box-control/input-controls.tsx +1 -0
- package/src/box-control/stories/index.story.tsx +1 -0
- package/src/box-control/test/index.tsx +33 -26
- package/src/box-control/types.ts +71 -54
- package/src/circular-option-picker/circular-option-picker-actions.tsx +1 -0
- package/src/circular-option-picker/circular-option-picker-option.tsx +1 -0
- package/src/circular-option-picker/style.scss +2 -2
- package/src/clipboard-button/index.tsx +5 -3
- package/src/color-picker/input-with-slider.tsx +1 -1
- package/src/composite/item.tsx +1 -19
- package/src/custom-gradient-picker/gradient-bar/control-points.tsx +2 -0
- package/src/custom-gradient-picker/index.tsx +2 -0
- package/src/custom-gradient-picker/style.scss +1 -1
- package/src/custom-gradient-picker/types.ts +6 -0
- package/src/custom-select-control/README.md +2 -0
- package/src/custom-select-control/index.tsx +9 -0
- package/src/custom-select-control/stories/index.story.tsx +1 -0
- package/src/custom-select-control/test/index.tsx +13 -9
- package/src/custom-select-control/types.ts +7 -0
- package/src/drop-zone/index.tsx +21 -24
- package/src/drop-zone/types.ts +5 -0
- package/src/dropdown-menu/index.tsx +1 -0
- package/src/dropdown-menu/style.scss +1 -1
- package/src/duotone-picker/color-list-picker/index.tsx +8 -8
- package/src/duotone-picker/color-list-picker/style.scss +0 -6
- package/src/font-size-picker/font-size-picker-select.tsx +1 -0
- package/src/font-size-picker/index.tsx +1 -0
- package/src/form-file-upload/README.md +58 -48
- package/src/form-file-upload/docs-manifest.json +5 -0
- package/src/form-file-upload/index.tsx +12 -1
- package/src/form-file-upload/stories/index.story.tsx +1 -0
- package/src/form-file-upload/test/index.tsx +5 -1
- package/src/form-file-upload/types.ts +10 -8
- package/src/form-token-field/README.md +1 -0
- package/src/form-token-field/index.tsx +7 -0
- package/src/form-token-field/stories/index.story.tsx +2 -0
- package/src/form-token-field/test/index.tsx +5 -1
- package/src/gradient-picker/README.md +8 -0
- package/src/gradient-picker/index.tsx +2 -0
- package/src/gradient-picker/types.ts +6 -0
- package/src/icon/README.md +22 -65
- package/src/icon/docs-manifest.json +5 -0
- package/src/icon/index.tsx +28 -13
- package/src/icon/stories/index.story.tsx +50 -8
- package/src/menu/checkbox-item.tsx +9 -7
- package/src/menu/group-label.tsx +8 -1
- package/src/menu/group.tsx +8 -1
- package/src/menu/item-help-text.tsx +10 -1
- package/src/menu/item-label.tsx +10 -1
- package/src/menu/item.tsx +8 -6
- package/src/menu/radio-item.tsx +9 -7
- package/src/menu/separator.tsx +9 -2
- package/src/menu-items-choice/style.scss +1 -0
- package/src/number-control/README.md +2 -1
- package/src/number-control/index.tsx +9 -0
- package/src/number-control/stories/index.story.tsx +1 -0
- package/src/number-control/test/index.tsx +5 -1
- package/src/number-control/types.ts +7 -0
- package/src/range-control/index.tsx +1 -0
- package/src/resizable-box/index.tsx +10 -0
- package/src/resizable-box/style.scss +8 -0
- package/src/slot-fill/bubbles-virtually/fill.tsx +7 -11
- package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +2 -13
- package/src/slot-fill/bubbles-virtually/slot.tsx +4 -7
- package/src/slot-fill/types.ts +4 -3
- package/src/tabs/tab.tsx +0 -18
- package/src/tabs/test/index.tsx +1492 -947
- package/src/toolbar/toolbar-button/index.tsx +2 -0
- package/src/tools-panel/stories/index.story.tsx +12 -0
- package/src/tools-panel/tools-panel/README.md +4 -0
- package/src/tools-panel/tools-panel/component.tsx +2 -0
- package/src/unit-control/README.md +3 -3
- package/src/unit-control/index.tsx +11 -1
- package/src/unit-control/stories/index.story.tsx +1 -0
- package/src/unit-control/test/index.tsx +5 -1
- package/src/unit-control/types.ts +7 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/menu/use-temporary-focus-visible-fix.js +0 -27
- package/build/menu/use-temporary-focus-visible-fix.js.map +0 -1
- package/build-module/menu/use-temporary-focus-visible-fix.js +0 -20
- package/build-module/menu/use-temporary-focus-visible-fix.js.map +0 -1
- package/build-types/menu/use-temporary-focus-visible-fix.d.ts +0 -8
- package/build-types/menu/use-temporary-focus-visible-fix.d.ts.map +0 -1
- package/src/menu/use-temporary-focus-visible-fix.ts +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","useInstanceId","useCallback","useMemo","CircularOptionPicker","CustomGradientPicker","VStack","ColorHeading","jsx","_jsx","jsxs","_jsxs","isMultipleOriginObject","obj","Array","isArray","gradients","isMultipleOriginArray","arr","length","every","gradientObj","SingleOrigin","className","clearGradient","onChange","value","additionalProps","gradientOptions","map","gradient","name","slug","index","Option","isSelected","tooltipText","style","color","background","onClick","OptionGroup","options","MultipleOrigin","headingLevel","instanceId","spacing","children","gradientSet","id","level","Component","props","asButtons","loop","actions","ariaLabel","ariaLabelledby","metaProps","_metaProps","GradientPicker","clearable","disableCustomGradients","__experimentalIsRenderedInSidebar","undefined","ButtonAction","accessibleWhenDisabled","disabled"],"sources":["@wordpress/components/src/gradient-picker/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CircularOptionPicker from '../circular-option-picker';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { VStack } from '../v-stack';\nimport { ColorHeading } from '../color-palette/styles';\nimport type {\n\tGradientPickerComponentProps,\n\tPickerProps,\n\tOriginObject,\n\tGradientObject,\n} from './types';\n\n// The Multiple Origin Gradients have a `gradients` property (an array of\n// gradient objects), while Single Origin ones have a `gradient` property.\nconst isMultipleOriginObject = (\n\tobj: Record< string, any >\n): obj is OriginObject =>\n\tArray.isArray( obj.gradients ) && ! ( 'gradient' in obj );\n\nconst isMultipleOriginArray = ( arr: any[] ): arr is OriginObject[] => {\n\treturn (\n\t\tarr.length > 0 &&\n\t\tarr.every( ( gradientObj ) => isMultipleOriginObject( gradientObj ) )\n\t);\n};\n\nfunction SingleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\t...additionalProps\n}: PickerProps< GradientObject > ) {\n\tconst gradientOptions = useMemo( () => {\n\t\treturn gradients.map( ( { gradient, name, slug }, index ) => (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ slug }\n\t\t\t\tvalue={ gradient }\n\t\t\t\tisSelected={ value === gradient }\n\t\t\t\ttooltipText={\n\t\t\t\t\tname ||\n\t\t\t\t\t// translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\tsprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t\tstyle={ { color: 'rgba( 0,0,0,0 )', background: gradient } }\n\t\t\t\tonClick={\n\t\t\t\t\tvalue === gradient\n\t\t\t\t\t\t? clearGradient\n\t\t\t\t\t\t: () => onChange( gradient, index )\n\t\t\t\t}\n\t\t\t\taria-label={\n\t\t\t\t\tname\n\t\t\t\t\t\t? // translators: %s: The name of the gradient e.g: \"Angular red to blue\".\n\t\t\t\t\t\t sprintf( __( 'Gradient: %s' ), name )\n\t\t\t\t\t\t: // translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\t\t sprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t/>\n\t\t) );\n\t}, [ gradients, value, onChange, clearGradient ] );\n\treturn (\n\t\t<CircularOptionPicker.OptionGroup\n\t\t\tclassName={ className }\n\t\t\toptions={ gradientOptions }\n\t\t\t{ ...additionalProps }\n\t\t/>\n\t);\n}\n\nfunction MultipleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\theadingLevel,\n}: PickerProps< OriginObject > ) {\n\tconst instanceId = useInstanceId( MultipleOrigin );\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ gradients.map( ( { name, gradients: gradientSet }, index ) => {\n\t\t\t\tconst id = `color-palette-${ instanceId }-${ index }`;\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading level={ headingLevel } id={ id }>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t</ColorHeading>\n\t\t\t\t\t\t<SingleOrigin\n\t\t\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\t\t\tgradients={ gradientSet }\n\t\t\t\t\t\t\tonChange={ ( gradient ) =>\n\t\t\t\t\t\t\t\tonChange( gradient, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\taria-labelledby={ id }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nfunction Component( props: PickerProps< any > ) {\n\tconst {\n\t\tasButtons,\n\t\tloop,\n\t\tactions,\n\t\theadingLevel,\n\t\t'aria-label': ariaLabel,\n\t\t'aria-labelledby': ariaLabelledby,\n\t\t...additionalProps\n\t} = props;\n\tconst options = isMultipleOriginArray( props.gradients ) ? (\n\t\t<MultipleOrigin headingLevel={ headingLevel } { ...additionalProps } />\n\t) : (\n\t\t<SingleOrigin { ...additionalProps } />\n\t);\n\n\tlet metaProps:\n\t\t| { asButtons: false; loop?: boolean; 'aria-label': string }\n\t\t| { asButtons: false; loop?: boolean; 'aria-labelledby': string }\n\t\t| { asButtons: true };\n\n\tif ( asButtons ) {\n\t\tmetaProps = { asButtons: true };\n\t} else {\n\t\tconst _metaProps: { asButtons: false; loop?: boolean } = {\n\t\t\tasButtons: false,\n\t\t\tloop,\n\t\t};\n\n\t\tif ( ariaLabel ) {\n\t\t\tmetaProps = { ..._metaProps, 'aria-label': ariaLabel };\n\t\t} else if ( ariaLabelledby ) {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-labelledby': ariaLabelledby,\n\t\t\t};\n\t\t} else {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-label': __( 'Custom color picker.' ),\n\t\t\t};\n\t\t}\n\t}\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\t{ ...metaProps }\n\t\t\tactions={ actions }\n\t\t\toptions={ options }\n\t\t/>\n\t);\n}\n\n/**\n * GradientPicker is a React component that renders a color gradient picker to\n * define a multi step gradient. There's either a _linear_ or a _radial_ type\n * available.\n *\n * ```jsx\n * import { useState } from 'react';\n * import { GradientPicker } from '@wordpress/components';\n *\n * const MyGradientPicker = () => {\n * const [ gradient, setGradient ] = useState( null );\n *\n * return (\n * <GradientPicker\n * value={ gradient }\n * onChange={ ( currentGradient ) => setGradient( currentGradient ) }\n * gradients={ [\n * {\n * name: 'JShine',\n * gradient:\n * 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',\n * slug: 'jshine',\n * },\n * {\n * name: 'Moonlit Asteroid',\n * gradient:\n * 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',\n * slug: 'moonlit-asteroid',\n * },\n * {\n * name: 'Rastafarie',\n * gradient:\n * 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',\n * slug: 'rastafari',\n * },\n * ] }\n * />\n * );\n * };\n *```\n *\n */\nexport function GradientPicker( {\n\tclassName,\n\tgradients = [],\n\tonChange,\n\tvalue,\n\tclearable = true,\n\tdisableCustomGradients = false,\n\t__experimentalIsRenderedInSidebar,\n\theadingLevel = 2,\n\t...additionalProps\n}: GradientPickerComponentProps ) {\n\tconst clearGradient = useCallback(\n\t\t() => onChange( undefined ),\n\t\t[ onChange ]\n\t);\n\n\treturn (\n\t\t<VStack spacing={ gradients.length ? 4 : 0 }>\n\t\t\t{ ! disableCustomGradients && (\n\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( gradients.length > 0 || clearable ) && (\n\t\t\t\t<Component\n\t\t\t\t\t{ ...additionalProps }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tactions={\n\t\t\t\t\t\tclearable &&\n\t\t\t\t\t\t! disableCustomGradients && (\n\t\t\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\t\t\tonClick={ clearGradient }\n\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport default GradientPicker;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;;AAEzD;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,YAAY,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQvD;AACA;AACA,MAAMC,sBAAsB,GAC3BC,GAA0B,IAE1BC,KAAK,CAACC,OAAO,CAAEF,GAAG,CAACG,SAAU,CAAC,IAAI,EAAI,UA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AAEuC,SAAU,CAAC,EAC3B,CAAEvC,QAAQ,CACX,CAAC;EAED,oBACCd,KAAA,CAACL,MAAM;IAACwC,OAAO,EAAG9B,SAAS,CAACG,MAAM,GAAG,CAAC,GAAG,CAAG;IAAA4B,QAAA,GACzC,CAAEe,sBAAsB,iBACzBrD,IAAA,CAACJ,oBAAoB;MACpB0D,iCAAiC,EAChCA,iCACA;MACDrC,KAAK,EAAGA,KAAO;MACfD,QAAQ,EAAGA;IAAU,CACrB,CACD,EACC,CAAET,SAAS,CAACG,MAAM,GAAG,CAAC,IAAI0C,SAAS,kBACpCpD,IAAA,CAAC0C,SAAS;MAAA,GACJxB,eAAe;MACpBJ,SAAS,EAAGA,SAAW;MACvBC,aAAa,EAAGA,aAAe;MAC/BR,SAAS,EAAGA,SAAW;MACvBS,QAAQ,EAAGA,QAAU;MACrBC,KAAK,EAAGA,KAAO;MACf6B,OAAO,EACNM,SAAS,IACT,CAAEC,sBAAsB,iBACvBrD,IAAA,CAACL,oBAAoB,CAAC6D,YAAY;QACjCzB,OAAO,EAAGhB,aAAe;QACzB0C,sBAAsB;QACtBC,QAAQ,EAAG,CAAEzC,KAAO;QAAAqB,QAAA,EAElBhD,EAAE,CAAE,OAAQ;MAAC,CACmB,CAEpC;MACD6C,YAAY,EAAGA;IAAc,CAC7B,CACD;EAAA,CACM,CAAC;AAEX;AAEA,eAAegB,cAAc","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","sprintf","useInstanceId","useCallback","useMemo","CircularOptionPicker","CustomGradientPicker","VStack","ColorHeading","jsx","_jsx","jsxs","_jsxs","isMultipleOriginObject","obj","Array","isArray","gradients","isMultipleOriginArray","arr","length","every","gradientObj","SingleOrigin","className","clearGradient","onChange","value","additionalProps","gradientOptions","map","gradient","name","slug","index","Option","isSelected","tooltipText","style","color","background","onClick","OptionGroup","options","MultipleOrigin","headingLevel","instanceId","spacing","children","gradientSet","id","level","Component","props","asButtons","loop","actions","ariaLabel","ariaLabelledby","metaProps","_metaProps","GradientPicker","clearable","enableAlpha","disableCustomGradients","__experimentalIsRenderedInSidebar","undefined","ButtonAction","accessibleWhenDisabled","disabled"],"sources":["@wordpress/components/src/gradient-picker/index.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CircularOptionPicker from '../circular-option-picker';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { VStack } from '../v-stack';\nimport { ColorHeading } from '../color-palette/styles';\nimport type {\n\tGradientPickerComponentProps,\n\tPickerProps,\n\tOriginObject,\n\tGradientObject,\n} from './types';\n\n// The Multiple Origin Gradients have a `gradients` property (an array of\n// gradient objects), while Single Origin ones have a `gradient` property.\nconst isMultipleOriginObject = (\n\tobj: Record< string, any >\n): obj is OriginObject =>\n\tArray.isArray( obj.gradients ) && ! ( 'gradient' in obj );\n\nconst isMultipleOriginArray = ( arr: any[] ): arr is OriginObject[] => {\n\treturn (\n\t\tarr.length > 0 &&\n\t\tarr.every( ( gradientObj ) => isMultipleOriginObject( gradientObj ) )\n\t);\n};\n\nfunction SingleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\t...additionalProps\n}: PickerProps< GradientObject > ) {\n\tconst gradientOptions = useMemo( () => {\n\t\treturn gradients.map( ( { gradient, name, slug }, index ) => (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ slug }\n\t\t\t\tvalue={ gradient }\n\t\t\t\tisSelected={ value === gradient }\n\t\t\t\ttooltipText={\n\t\t\t\t\tname ||\n\t\t\t\t\t// translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\tsprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t\tstyle={ { color: 'rgba( 0,0,0,0 )', background: gradient } }\n\t\t\t\tonClick={\n\t\t\t\t\tvalue === gradient\n\t\t\t\t\t\t? clearGradient\n\t\t\t\t\t\t: () => onChange( gradient, index )\n\t\t\t\t}\n\t\t\t\taria-label={\n\t\t\t\t\tname\n\t\t\t\t\t\t? // translators: %s: The name of the gradient e.g: \"Angular red to blue\".\n\t\t\t\t\t\t sprintf( __( 'Gradient: %s' ), name )\n\t\t\t\t\t\t: // translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\t\t sprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t/>\n\t\t) );\n\t}, [ gradients, value, onChange, clearGradient ] );\n\treturn (\n\t\t<CircularOptionPicker.OptionGroup\n\t\t\tclassName={ className }\n\t\t\toptions={ gradientOptions }\n\t\t\t{ ...additionalProps }\n\t\t/>\n\t);\n}\n\nfunction MultipleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\theadingLevel,\n}: PickerProps< OriginObject > ) {\n\tconst instanceId = useInstanceId( MultipleOrigin );\n\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ gradients.map( ( { name, gradients: gradientSet }, index ) => {\n\t\t\t\tconst id = `color-palette-${ instanceId }-${ index }`;\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading level={ headingLevel } id={ id }>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t</ColorHeading>\n\t\t\t\t\t\t<SingleOrigin\n\t\t\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\t\t\tgradients={ gradientSet }\n\t\t\t\t\t\t\tonChange={ ( gradient ) =>\n\t\t\t\t\t\t\t\tonChange( gradient, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\taria-labelledby={ id }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nfunction Component( props: PickerProps< any > ) {\n\tconst {\n\t\tasButtons,\n\t\tloop,\n\t\tactions,\n\t\theadingLevel,\n\t\t'aria-label': ariaLabel,\n\t\t'aria-labelledby': ariaLabelledby,\n\t\t...additionalProps\n\t} = props;\n\tconst options = isMultipleOriginArray( props.gradients ) ? (\n\t\t<MultipleOrigin headingLevel={ headingLevel } { ...additionalProps } />\n\t) : (\n\t\t<SingleOrigin { ...additionalProps } />\n\t);\n\n\tlet metaProps:\n\t\t| { asButtons: false; loop?: boolean; 'aria-label': string }\n\t\t| { asButtons: false; loop?: boolean; 'aria-labelledby': string }\n\t\t| { asButtons: true };\n\n\tif ( asButtons ) {\n\t\tmetaProps = { asButtons: true };\n\t} else {\n\t\tconst _metaProps: { asButtons: false; loop?: boolean } = {\n\t\t\tasButtons: false,\n\t\t\tloop,\n\t\t};\n\n\t\tif ( ariaLabel ) {\n\t\t\tmetaProps = { ..._metaProps, 'aria-label': ariaLabel };\n\t\t} else if ( ariaLabelledby ) {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-labelledby': ariaLabelledby,\n\t\t\t};\n\t\t} else {\n\t\t\tmetaProps = {\n\t\t\t\t..._metaProps,\n\t\t\t\t'aria-label': __( 'Custom color picker.' ),\n\t\t\t};\n\t\t}\n\t}\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\t{ ...metaProps }\n\t\t\tactions={ actions }\n\t\t\toptions={ options }\n\t\t/>\n\t);\n}\n\n/**\n * GradientPicker is a React component that renders a color gradient picker to\n * define a multi step gradient. There's either a _linear_ or a _radial_ type\n * available.\n *\n * ```jsx\n * import { useState } from 'react';\n * import { GradientPicker } from '@wordpress/components';\n *\n * const MyGradientPicker = () => {\n * const [ gradient, setGradient ] = useState( null );\n *\n * return (\n * <GradientPicker\n * value={ gradient }\n * onChange={ ( currentGradient ) => setGradient( currentGradient ) }\n * gradients={ [\n * {\n * name: 'JShine',\n * gradient:\n * 'linear-gradient(135deg,#12c2e9 0%,#c471ed 50%,#f64f59 100%)',\n * slug: 'jshine',\n * },\n * {\n * name: 'Moonlit Asteroid',\n * gradient:\n * 'linear-gradient(135deg,#0F2027 0%, #203A43 0%, #2c5364 100%)',\n * slug: 'moonlit-asteroid',\n * },\n * {\n * name: 'Rastafarie',\n * gradient:\n * 'linear-gradient(135deg,#1E9600 0%, #FFF200 0%, #FF0000 100%)',\n * slug: 'rastafari',\n * },\n * ] }\n * />\n * );\n * };\n *```\n *\n */\nexport function GradientPicker( {\n\tclassName,\n\tgradients = [],\n\tonChange,\n\tvalue,\n\tclearable = true,\n\tenableAlpha = true,\n\tdisableCustomGradients = false,\n\t__experimentalIsRenderedInSidebar,\n\theadingLevel = 2,\n\t...additionalProps\n}: GradientPickerComponentProps ) {\n\tconst clearGradient = useCallback(\n\t\t() => onChange( undefined ),\n\t\t[ onChange ]\n\t);\n\n\treturn (\n\t\t<VStack spacing={ gradients.length ? 4 : 0 }>\n\t\t\t{ ! disableCustomGradients && (\n\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t}\n\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( gradients.length > 0 || clearable ) && (\n\t\t\t\t<Component\n\t\t\t\t\t{ ...additionalProps }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tactions={\n\t\t\t\t\t\tclearable &&\n\t\t\t\t\t\t! disableCustomGradients && (\n\t\t\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\t\t\tonClick={ clearGradient }\n\t\t\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport default GradientPicker;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,WAAW,EAAEC,OAAO,QAAQ,oBAAoB;;AAEzD;AACA;AACA;AACA,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,OAAOC,oBAAoB,MAAM,2BAA2B;AAC5D,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,YAAY,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQvD;AACA;AACA,MAAMC,sBAAsB,GAC3BC,GAA0B,IAE1BC,KAAK,CAACC,OAAO,CAAEF,GAAG,CAACG,SAAU,CAAC,IAAI,EAAI,UAAU,IAAIH,GAAG,CAAE;AAE1D,MAAMI,qBAAqB,GAAKC,GAAU,IAA6B;EACtE,OACCA,GAAG,CAACC,MAAM,GAAG,CAAC,IACdD,GAAG,CAACE,KAAK,CAAIC,WAAW,IAAMT,sBAAsB,CAAES,WAAY,CAAE,CAAC;AAEvE,CAAC;AAED,SAASC,YAAYA,CAAE;EACtBC,SAAS;EACTC,aAAa;EACbR,SAAS;EACTS,QAAQ;EACRC,KAAK;EACL,GAAGC;AAC2B,CAAC,EAAG;EAClC,MAAMC,eAAe,GAAGzB,OAAO,CAAE,MAAM;IACtC,OAAOa,SAAS,CAACa,GAAG,CAAE,CAAE;MAAEC,Q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S,kBACpCpD,IAAA,CAAC0C,SAAS;MAAA,GACJxB,eAAe;MACpBJ,SAAS,EAAGA,SAAW;MACvBC,aAAa,EAAGA,aAAe;MAC/BR,SAAS,EAAGA,SAAW;MACvBS,QAAQ,EAAGA,QAAU;MACrBC,KAAK,EAAGA,KAAO;MACf6B,OAAO,EACNM,SAAS,IACT,CAAEE,sBAAsB,iBACvBtD,IAAA,CAACL,oBAAoB,CAAC8D,YAAY;QACjC1B,OAAO,EAAGhB,aAAe;QACzB2C,sBAAsB;QACtBC,QAAQ,EAAG,CAAE1C,KAAO;QAAAqB,QAAA,EAElBhD,EAAE,CAAE,OAAQ;MAAC,CACmB,CAEpC;MACD6C,YAAY,EAAGA;IAAc,CAC7B,CACD;EAAA,CACM,CAAC;AAEX;AAEA,eAAegB,cAAc","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/components/src/gradient-picker/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { HeadingSize } from '../heading/types';\n\nexport type GradientObject = {\n\tgradient: string;\n\tname: string;\n\tslug: string;\n};\nexport type OriginObject = { name: string; gradients: GradientObject[] };\nexport type GradientsProp = GradientObject[] | OriginObject[];\n\ntype GradientPickerBaseProps = {\n\t/**\n\t * The class name added to the wrapper.\n\t */\n\tclassName?: string;\n\t/**\n\t * The function called when a new gradient has been defined. It is passed to\n\t * the `currentGradient` as an argument.\n\t */\n\tonChange: ( currentGradient: string | undefined ) => void;\n\t/**\n\t * The current value of the gradient. Pass a css gradient string (See default value for example).\n\t * Optionally pass in a `null` value to specify no gradient is currently selected.\n\t *\n\t * @default 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'\n\t */\n\tvalue?: GradientObject[ 'gradient' ] | null;\n\t/**\n\t * Whether the palette should have a clearing button or not.\n\t *\n\t * @default true\n\t */\n\tclearable?: boolean;\n\t/**\n\t * The heading level. Only applies in cases where gradients are provided\n\t * from multiple origins (i.e. when the array passed as the `gradients` prop\n\t * contains two or more items).\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Whether the control should present as a set of buttons,\n\t * each with its own tab stop.\n\t *\n\t * @default false\n\t */\n\tasButtons?: boolean;\n\t/**\n\t * Prevents keyboard interaction from wrapping around.\n\t * Only used when `asButtons` is not true.\n\t *\n\t * @default true\n\t */\n\tloop?: boolean;\n} & (\n\t| {\n\t\t\t// TODO: [#54055] Either this or `aria-labelledby` should be required\n\t\t\t/**\n\t\t\t * A label to identify the purpose of the control.\n\t\t\t */\n\t\t\t'aria-label'?: string;\n\t\t\t'aria-labelledby'?: never;\n\t }\n\t| {\n\t\t\t// TODO: [#54055] Either this or `aria-label` should be required\n\t\t\t/**\n\t\t\t * An ID of an element to provide a label for the control.\n\t\t\t */\n\t\t\t'aria-labelledby'?: string;\n\t\t\t'aria-label'?: never;\n\t }\n);\n\nexport type GradientPickerComponentProps = GradientPickerBaseProps & {\n\t/**\n\t * An array of objects as predefined gradients displayed above the gradient\n\t * selector. Alternatively, if there are multiple sets (or 'origins') of\n\t * gradients, you can pass an array of objects each with a `name` and a\n\t * `gradients` array which will in turn contain the predefined gradient objects.\n\t *\n\t * @default []\n\t */\n\tgradients?: GradientsProp;\n\t/**\n\t * Start opting in to the new margin-free styles that will become the default\n\t * in a future version, currently scheduled to be WordPress 6.4. (The prop\n\t * can be safely removed once this happens.)\n\t *\n\t * @default false\n\t * @deprecated Default behavior since WP 6.5. Prop can be safely removed.\n\t * @ignore\n\t */\n\t__nextHasNoMargin?: boolean;\n\t/**\n\t * If true, the gradient picker will not be displayed and only defined\n\t * gradients from `gradients` will be shown.\n\t *\n\t * @default false\n\t */\n\tdisableCustomGradients?: boolean;\n\t/**\n\t * Whether this is rendered in the sidebar.\n\t *\n\t * @default false\n\t */\n\t__experimentalIsRenderedInSidebar?: boolean;\n};\n\nexport type PickerProps< TOriginType extends GradientObject | OriginObject > =\n\tGradientPickerBaseProps & {\n\t\tclearGradient: () => void;\n\t\tonChange: (\n\t\t\tcurrentGradient: string | undefined,\n\t\t\tindex: number\n\t\t) => void;\n\t\tactions?: React.ReactNode;\n\t\tgradients: TOriginType[];\n\t};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/components/src/gradient-picker/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { HeadingSize } from '../heading/types';\n\nexport type GradientObject = {\n\tgradient: string;\n\tname: string;\n\tslug: string;\n};\nexport type OriginObject = { name: string; gradients: GradientObject[] };\nexport type GradientsProp = GradientObject[] | OriginObject[];\n\ntype GradientPickerBaseProps = {\n\t/**\n\t * The class name added to the wrapper.\n\t */\n\tclassName?: string;\n\t/**\n\t * The function called when a new gradient has been defined. It is passed to\n\t * the `currentGradient` as an argument.\n\t */\n\tonChange: ( currentGradient: string | undefined ) => void;\n\t/**\n\t * The current value of the gradient. Pass a css gradient string (See default value for example).\n\t * Optionally pass in a `null` value to specify no gradient is currently selected.\n\t *\n\t * @default 'linear-gradient(135deg,rgba(6,147,227,1) 0%,rgb(155,81,224) 100%)'\n\t */\n\tvalue?: GradientObject[ 'gradient' ] | null;\n\t/**\n\t * Whether the palette should have a clearing button or not.\n\t *\n\t * @default true\n\t */\n\tclearable?: boolean;\n\t/**\n\t * The heading level. Only applies in cases where gradients are provided\n\t * from multiple origins (i.e. when the array passed as the `gradients` prop\n\t * contains two or more items).\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Whether the control should present as a set of buttons,\n\t * each with its own tab stop.\n\t *\n\t * @default false\n\t */\n\tasButtons?: boolean;\n\t/**\n\t * Prevents keyboard interaction from wrapping around.\n\t * Only used when `asButtons` is not true.\n\t *\n\t * @default true\n\t */\n\tloop?: boolean;\n\t/**\n\t * Whether to enable alpha transparency options in the picker.\n\t *\n\t * @default true\n\t */\n\tenableAlpha?: boolean;\n} & (\n\t| {\n\t\t\t// TODO: [#54055] Either this or `aria-labelledby` should be required\n\t\t\t/**\n\t\t\t * A label to identify the purpose of the control.\n\t\t\t */\n\t\t\t'aria-label'?: string;\n\t\t\t'aria-labelledby'?: never;\n\t }\n\t| {\n\t\t\t// TODO: [#54055] Either this or `aria-label` should be required\n\t\t\t/**\n\t\t\t * An ID of an element to provide a label for the control.\n\t\t\t */\n\t\t\t'aria-labelledby'?: string;\n\t\t\t'aria-label'?: never;\n\t }\n);\n\nexport type GradientPickerComponentProps = GradientPickerBaseProps & {\n\t/**\n\t * An array of objects as predefined gradients displayed above the gradient\n\t * selector. Alternatively, if there are multiple sets (or 'origins') of\n\t * gradients, you can pass an array of objects each with a `name` and a\n\t * `gradients` array which will in turn contain the predefined gradient objects.\n\t *\n\t * @default []\n\t */\n\tgradients?: GradientsProp;\n\t/**\n\t * Start opting in to the new margin-free styles that will become the default\n\t * in a future version, currently scheduled to be WordPress 6.4. (The prop\n\t * can be safely removed once this happens.)\n\t *\n\t * @default false\n\t * @deprecated Default behavior since WP 6.5. Prop can be safely removed.\n\t * @ignore\n\t */\n\t__nextHasNoMargin?: boolean;\n\t/**\n\t * If true, the gradient picker will not be displayed and only defined\n\t * gradients from `gradients` will be shown.\n\t *\n\t * @default false\n\t */\n\tdisableCustomGradients?: boolean;\n\t/**\n\t * Whether this is rendered in the sidebar.\n\t *\n\t * @default false\n\t */\n\t__experimentalIsRenderedInSidebar?: boolean;\n};\n\nexport type PickerProps< TOriginType extends GradientObject | OriginObject > =\n\tGradientPickerBaseProps & {\n\t\tclearGradient: () => void;\n\t\tonChange: (\n\t\t\tcurrentGradient: string | undefined,\n\t\t\tindex: number\n\t\t) => void;\n\t\tactions?: React.ReactNode;\n\t\tgradients: TOriginType[];\n\t};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -13,6 +13,15 @@ import { SVG } from '@wordpress/primitives';
|
|
|
13
13
|
*/
|
|
14
14
|
import Dashicon from '../dashicon';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
/**
|
|
17
|
+
* Renders a raw icon without any initial styling or wrappers.
|
|
18
|
+
*
|
|
19
|
+
* ```jsx
|
|
20
|
+
* import { wordpress } from '@wordpress/icons';
|
|
21
|
+
*
|
|
22
|
+
* <Icon icon={ wordpress } />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
16
25
|
function Icon({
|
|
17
26
|
icon = null,
|
|
18
27
|
size = 'string' === typeof icon ? 20 : 24,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cloneElement","createElement","isValidElement","SVG","Dashicon","jsx","_jsx","Icon","icon","size","additionalProps","type","appliedProps","props","width","height"],"sources":["@wordpress/components/src/icon/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentType, HTMLProps, SVGProps } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcloneElement,\n\tcreateElement,\n\tisValidElement,\n} from '@wordpress/element';\nimport { SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Dashicon from '../dashicon';\nimport type { IconKey as DashiconIconKey } from '../dashicon/types';\n\nexport type IconType =\n\t| DashiconIconKey\n\t| ComponentType< { size?: number } >\n\t| ( ( props: { size?: number } ) => JSX.Element )\n\t| JSX.Element;\n\
|
|
1
|
+
{"version":3,"names":["cloneElement","createElement","isValidElement","SVG","Dashicon","jsx","_jsx","Icon","icon","size","additionalProps","type","appliedProps","props","width","height"],"sources":["@wordpress/components/src/icon/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ComponentType, HTMLProps, SVGProps } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcloneElement,\n\tcreateElement,\n\tisValidElement,\n} from '@wordpress/element';\nimport { SVG } from '@wordpress/primitives';\n\n/**\n * Internal dependencies\n */\nimport Dashicon from '../dashicon';\nimport type { IconKey as DashiconIconKey } from '../dashicon/types';\n\nexport type IconType =\n\t| DashiconIconKey\n\t| ComponentType< { size?: number } >\n\t| ( ( props: { size?: number } ) => JSX.Element )\n\t| JSX.Element;\n\ntype AdditionalProps< T > = T extends ComponentType< infer U >\n\t? U\n\t: T extends DashiconIconKey\n\t? SVGProps< SVGSVGElement >\n\t: {};\n\nexport type Props = {\n\t/**\n\t * The icon to render. In most cases, you should use an icon from\n\t * [the `@wordpress/icons` package](https://wordpress.github.io/gutenberg/?path=/story/icons-icon--library).\n\t *\n\t * Other supported values are: component instances, functions,\n\t * [Dashicons](https://developer.wordpress.org/resource/dashicons/)\n\t * (specified as strings), and `null`.\n\t *\n\t * The `size` value, as well as any other additional props, will be passed through.\n\t *\n\t * @default null\n\t */\n\ticon?: IconType | null;\n\t/**\n\t * The size (width and height) of the icon.\n\t *\n\t * Defaults to `20` when `icon` is a string (i.e. a Dashicon id), otherwise `24`.\n\t *\n\t * @default `'string' === typeof icon ? 20 : 24`.\n\t */\n\tsize?: number;\n} & AdditionalProps< IconType >;\n\n/**\n * Renders a raw icon without any initial styling or wrappers.\n *\n * ```jsx\n * import { wordpress } from '@wordpress/icons';\n *\n * <Icon icon={ wordpress } />\n * ```\n */\nfunction Icon( {\n\ticon = null,\n\tsize = 'string' === typeof icon ? 20 : 24,\n\t...additionalProps\n}: Props ) {\n\tif ( 'string' === typeof icon ) {\n\t\treturn (\n\t\t\t<Dashicon\n\t\t\t\ticon={ icon }\n\t\t\t\tsize={ size }\n\t\t\t\t{ ...( additionalProps as HTMLProps< HTMLSpanElement > ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( isValidElement( icon ) && Dashicon === icon.type ) {\n\t\treturn cloneElement( icon, {\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( 'function' === typeof icon ) {\n\t\treturn createElement( icon, {\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\tif ( icon && ( icon.type === 'svg' || icon.type === SVG ) ) {\n\t\tconst appliedProps = {\n\t\t\t...icon.props,\n\t\t\twidth: size,\n\t\t\theight: size,\n\t\t\t...additionalProps,\n\t\t};\n\n\t\treturn <SVG { ...appliedProps } />;\n\t}\n\n\tif ( isValidElement( icon ) ) {\n\t\treturn cloneElement( icon, {\n\t\t\t// @ts-ignore Just forwarding the size prop along\n\t\t\tsize,\n\t\t\t...additionalProps,\n\t\t} );\n\t}\n\n\treturn icon;\n}\n\nexport default Icon;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,YAAY,EACZC,aAAa,EACbC,cAAc,QACR,oBAAoB;AAC3B,SAASC,GAAG,QAAQ,uBAAuB;;AAE3C;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAuCnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,IAAIA,CAAE;EACdC,IAAI,GAAG,IAAI;EACXC,IAAI,GAAG,QAAQ,KAAK,OAAOD,IAAI,GAAG,EAAE,GAAG,EAAE;EACzC,GAAGE;AACG,CAAC,EAAG;EACV,IAAK,QAAQ,KAAK,OAAOF,IAAI,EAAG;IAC/B,oBACCF,IAAA,CAACF,QAAQ;MACRI,IAAI,EAAGA,IAAM;MACbC,IAAI,EAAGA,IAAM;MAAA,GACNC;IAAe,CACtB,CAAC;EAEJ;EAEA,IAAKR,cAAc,CAAEM,IAAK,CAAC,IAAIJ,QAAQ,KAAKI,IAAI,CAACG,IAAI,EAAG;IACvD,OAAOX,YAAY,CAAEQ,IAAI,EAAE;MAC1B,GAAGE;IACJ,CAAE,CAAC;EACJ;EAEA,IAAK,UAAU,KAAK,OAAOF,IAAI,EAAG;IACjC,OAAOP,aAAa,CAAEO,IAAI,EAAE;MAC3BC,IAAI;MACJ,GAAGC;IACJ,CAAE,CAAC;EACJ;EAEA,IAAKF,IAAI,KAAMA,IAAI,CAACG,IAAI,KAAK,KAAK,IAAIH,IAAI,CAACG,IAAI,KAAKR,GAAG,CAAE,EAAG;IAC3D,MAAMS,YAAY,GAAG;MACpB,GAAGJ,IAAI,CAACK,KAAK;MACbC,KAAK,EAAEL,IAAI;MACXM,MAAM,EAAEN,IAAI;MACZ,GAAGC;IACJ,CAAC;IAED,oBAAOJ,IAAA,CAACH,GAAG;MAAA,GAAMS;IAAY,CAAI,CAAC;EACnC;EAEA,IAAKV,cAAc,CAAEM,IAAK,CAAC,EAAG;IAC7B,OAAOR,YAAY,CAAEQ,IAAI,EAAE;MAC1B;MACAC,IAAI;MACJ,GAAGC;IACJ,CAAE,CAAC;EACJ;EAEA,OAAOF,IAAI;AACZ;AAEA,eAAeD,IAAI","ignoreList":[]}
|
|
@@ -15,29 +15,25 @@ import { Icon, check } from '@wordpress/icons';
|
|
|
15
15
|
|
|
16
16
|
import { MenuContext } from './context';
|
|
17
17
|
import * as Styled from './styles';
|
|
18
|
-
import { useTemporaryFocusVisibleFix } from './use-temporary-focus-visible-fix';
|
|
19
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
19
|
export const MenuCheckboxItem = forwardRef(function MenuCheckboxItem({
|
|
21
20
|
suffix,
|
|
22
21
|
children,
|
|
23
|
-
onBlur,
|
|
24
22
|
hideOnClick = false,
|
|
25
23
|
...props
|
|
26
24
|
}, ref) {
|
|
27
|
-
// TODO: Remove when https://github.com/ariakit/ariakit/issues/4083 is fixed
|
|
28
|
-
const focusVisibleFixProps = useTemporaryFocusVisibleFix({
|
|
29
|
-
onBlur
|
|
30
|
-
});
|
|
31
25
|
const menuContext = useContext(MenuContext);
|
|
26
|
+
if (!menuContext?.store) {
|
|
27
|
+
throw new Error('Menu.CheckboxItem can only be rendered inside a Menu component');
|
|
28
|
+
}
|
|
32
29
|
return /*#__PURE__*/_jsxs(Styled.MenuCheckboxItem, {
|
|
33
30
|
ref: ref,
|
|
34
31
|
...props,
|
|
35
|
-
...focusVisibleFixProps,
|
|
36
32
|
accessibleWhenDisabled: true,
|
|
37
33
|
hideOnClick: hideOnClick,
|
|
38
|
-
store: menuContext
|
|
34
|
+
store: menuContext.store,
|
|
39
35
|
children: [/*#__PURE__*/_jsx(Ariakit.MenuItemCheck, {
|
|
40
|
-
store: menuContext
|
|
36
|
+
store: menuContext.store,
|
|
41
37
|
render: /*#__PURE__*/_jsx(Styled.ItemPrefixWrapper, {})
|
|
42
38
|
// Override some ariakit inline styles
|
|
43
39
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Ariakit","forwardRef","useContext","Icon","check","MenuContext","Styled","
|
|
1
|
+
{"version":3,"names":["Ariakit","forwardRef","useContext","Icon","check","MenuContext","Styled","jsx","_jsx","jsxs","_jsxs","MenuCheckboxItem","suffix","children","hideOnClick","props","ref","menuContext","store","Error","accessibleWhenDisabled","MenuItemCheck","render","ItemPrefixWrapper","style","width","height","icon","size","MenuItemContentWrapper","MenuItemChildrenWrapper","ItemSuffixWrapper"],"sources":["@wordpress/components/src/menu/checkbox-item.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\nimport { Icon, check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport type { MenuCheckboxItemProps } from './types';\nimport * as Styled from './styles';\n\nexport const MenuCheckboxItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuCheckboxItemProps, 'div', false >\n>( function MenuCheckboxItem(\n\t{ suffix, children, hideOnClick = false, ...props },\n\tref\n) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.CheckboxItem can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuCheckboxItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\taccessibleWhenDisabled\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ menuContext.store }\n\t\t>\n\t\t\t<Ariakit.MenuItemCheck\n\t\t\t\tstore={ menuContext.store }\n\t\t\t\trender={ <Styled.ItemPrefixWrapper /> }\n\t\t\t\t// Override some ariakit inline styles\n\t\t\t\tstyle={ { width: 'auto', height: 'auto' } }\n\t\t\t>\n\t\t\t\t<Icon icon={ check } size={ 24 } />\n\t\t\t</Ariakit.MenuItemCheck>\n\n\t\t\t<Styled.MenuItemContentWrapper>\n\t\t\t\t<Styled.MenuItemChildrenWrapper>\n\t\t\t\t\t{ children }\n\t\t\t\t</Styled.MenuItemChildrenWrapper>\n\n\t\t\t\t{ suffix && (\n\t\t\t\t\t<Styled.ItemSuffixWrapper>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t</Styled.ItemSuffixWrapper>\n\t\t\t\t) }\n\t\t\t</Styled.MenuItemContentWrapper>\n\t\t</Styled.MenuCheckboxItem>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;AAC3D,SAASC,IAAI,EAAEC,KAAK,QAAQ,kBAAkB;;AAE9C;AACA;AACA;;AAEA,SAASC,WAAW,QAAQ,WAAW;AAEvC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEnC,OAAO,MAAMC,gBAAgB,GAAGV,UAAU,CAGvC,SAASU,gBAAgBA,CAC3B;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,WAAW,GAAG,KAAK;EAAE,GAAGC;AAAM,CAAC,EACnDC,GAAG,EACF;EACD,MAAMC,WAAW,GAAGf,UAAU,CAAEG,WAAY,CAAC;EAE7C,IAAK,CAAEY,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,gEACD,CAAC;EACF;EAEA,oBACCT,KAAA,CAACJ,MAAM,CAACK,gBAAgB;IACvBK,GAAG,EAAGA,GAAK;IAAA,GACND,KAAK;IACVK,sBAAsB;IACtBN,WAAW,EAAGA,WAAa;IAC3BI,KAAK,EAAGD,WAAW,CAACC,KAAO;IAAAL,QAAA,gBAE3BL,IAAA,CAACR,OAAO,CAACqB,aAAa;MACrBH,KAAK,EAAGD,WAAW,CAACC,KAAO;MAC3BI,MAAM,eAAGd,IAAA,CAACF,MAAM,CAACiB,iBAAiB,IAAE;MACpC;MAAA;MACAC,KAAK,EAAG;QAAEC,KAAK,EAAE,MAAM;QAAEC,MAAM,EAAE;MAAO,CAAG;MAAAb,QAAA,eAE3CL,IAAA,CAACL,IAAI;QAACwB,IAAI,EAAGvB,KAAO;QAACwB,IAAI,EAAG;MAAI,CAAE;IAAC,CACb,CAAC,eAExBlB,KAAA,CAACJ,MAAM,CAACuB,sBAAsB;MAAAhB,QAAA,gBAC7BL,IAAA,CAACF,MAAM,CAACwB,uBAAuB;QAAAjB,QAAA,EAC5BA;MAAQ,CACqB,CAAC,EAE/BD,MAAM,iBACPJ,IAAA,CAACF,MAAM,CAACyB,iBAAiB;QAAAlB,QAAA,EACtBD;MAAM,CACiB,CAC1B;IAAA,CAC6B,CAAC;EAAA,CACR,CAAC;AAE5B,CAAE,CAAC","ignoreList":[]}
|
|
@@ -13,6 +13,9 @@ import * as Styled from './styles';
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
export const MenuGroupLabel = forwardRef(function MenuGroup(props, ref) {
|
|
15
15
|
const menuContext = useContext(MenuContext);
|
|
16
|
+
if (!menuContext?.store) {
|
|
17
|
+
throw new Error('Menu.GroupLabel can only be rendered inside a Menu component');
|
|
18
|
+
}
|
|
16
19
|
return /*#__PURE__*/_jsx(Styled.MenuGroupLabel, {
|
|
17
20
|
ref: ref,
|
|
18
21
|
render:
|
|
@@ -26,7 +29,7 @@ export const MenuGroupLabel = forwardRef(function MenuGroup(props, ref) {
|
|
|
26
29
|
lineHeight: "16px"
|
|
27
30
|
}),
|
|
28
31
|
...props,
|
|
29
|
-
store: menuContext
|
|
32
|
+
store: menuContext.store
|
|
30
33
|
});
|
|
31
34
|
});
|
|
32
35
|
//# sourceMappingURL=group-label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useContext","MenuContext","Text","Styled","jsx","_jsx","MenuGroupLabel","MenuGroup","props","ref","menuContext","render","upperCase","variant","size","weight","lineHeight"
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","MenuContext","Text","Styled","jsx","_jsx","MenuGroupLabel","MenuGroup","props","ref","menuContext","store","Error","render","upperCase","variant","size","weight","lineHeight"],"sources":["@wordpress/components/src/menu/group-label.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport { Text } from '../text';\nimport type { MenuGroupLabelProps } from './types';\nimport * as Styled from './styles';\n\nexport const MenuGroupLabel = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuGroupLabelProps, 'div', false >\n>( function MenuGroup( props, ref ) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.GroupLabel can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuGroupLabel\n\t\t\tref={ ref }\n\t\t\trender={\n\t\t\t\t// @ts-expect-error The `children` prop is passed\n\t\t\t\t<Text\n\t\t\t\t\tupperCase\n\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\tsize=\"11px\"\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tlineHeight=\"16px\"\n\t\t\t\t/>\n\t\t\t}\n\t\t\t{ ...props }\n\t\t\tstore={ menuContext.store }\n\t\t/>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAEA,SAASC,WAAW,QAAQ,WAAW;AACvC,SAASC,IAAI,QAAQ,SAAS;AAE9B,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,cAAc,GAAGP,UAAU,CAGrC,SAASQ,SAASA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACnC,MAAMC,WAAW,GAAGV,UAAU,CAAEC,WAAY,CAAC;EAE7C,IAAK,CAAES,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,8DACD,CAAC;EACF;EAEA,oBACCP,IAAA,CAACF,MAAM,CAACG,cAAc;IACrBG,GAAG,EAAGA,GAAK;IACXI,MAAM;IAAA;IACL;IACAR,IAAA,CAACH,IAAI;MACJY,SAAS;MACTC,OAAO,EAAC,OAAO;MACfC,IAAI,EAAC,MAAM;MACXC,MAAM,EAAG,GAAK;MACdC,UAAU,EAAC;IAAM,CACjB,CACD;IAAA,GACIV,KAAK;IACVG,KAAK,EAAGD,WAAW,CAACC;EAAO,CAC3B,CAAC;AAEJ,CAAE,CAAC","ignoreList":[]}
|
|
@@ -12,10 +12,13 @@ import * as Styled from './styles';
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
export const MenuGroup = forwardRef(function MenuGroup(props, ref) {
|
|
14
14
|
const menuContext = useContext(MenuContext);
|
|
15
|
+
if (!menuContext?.store) {
|
|
16
|
+
throw new Error('Menu.Group can only be rendered inside a Menu component');
|
|
17
|
+
}
|
|
15
18
|
return /*#__PURE__*/_jsx(Styled.MenuGroup, {
|
|
16
19
|
ref: ref,
|
|
17
20
|
...props,
|
|
18
|
-
store: menuContext
|
|
21
|
+
store: menuContext.store
|
|
19
22
|
});
|
|
20
23
|
});
|
|
21
24
|
//# sourceMappingURL=group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useContext","MenuContext","Styled","jsx","_jsx","MenuGroup","props","ref","menuContext","store"],"sources":["@wordpress/components/src/menu/group.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport type { MenuGroupProps } from './types';\nimport * as Styled from './styles';\n\nexport const MenuGroup = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuGroupProps, 'div', false >\n>( function MenuGroup( props, ref ) {\n\tconst menuContext = useContext( MenuContext );\n\treturn (\n\t\t<Styled.MenuGroup\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tstore={ menuContext
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","MenuContext","Styled","jsx","_jsx","MenuGroup","props","ref","menuContext","store","Error"],"sources":["@wordpress/components/src/menu/group.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport type { MenuGroupProps } from './types';\nimport * as Styled from './styles';\n\nexport const MenuGroup = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuGroupProps, 'div', false >\n>( function MenuGroup( props, ref ) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.Group can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuGroup\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tstore={ menuContext.store }\n\t\t/>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAEA,SAASC,WAAW,QAAQ,WAAW;AAEvC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,SAAS,GAAGN,UAAU,CAGhC,SAASM,SAASA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACnC,MAAMC,WAAW,GAAGR,UAAU,CAAEC,WAAY,CAAC;EAE7C,IAAK,CAAEO,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,yDACD,CAAC;EACF;EAEA,oBACCN,IAAA,CAACF,MAAM,CAACG,SAAS;IAChBE,GAAG,EAAGA,GAAK;IAAA,GACND,KAAK;IACVG,KAAK,EAAGD,WAAW,CAACC;EAAO,CAC3B,CAAC;AAEJ,CAAE,CAAC","ignoreList":[]}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { forwardRef } from '@wordpress/element';
|
|
4
|
+
import { forwardRef, useContext } from '@wordpress/element';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { MenuContext } from './context';
|
|
10
11
|
import * as Styled from './styles';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
export const MenuItemHelpText = forwardRef(function MenuItemHelpText(props, ref) {
|
|
14
|
+
const menuContext = useContext(MenuContext);
|
|
15
|
+
if (!menuContext?.store) {
|
|
16
|
+
throw new Error('Menu.ItemHelpText can only be rendered inside a Menu component');
|
|
17
|
+
}
|
|
13
18
|
return /*#__PURE__*/_jsx(Styled.MenuItemHelpText, {
|
|
14
19
|
numberOfLines: 2,
|
|
15
20
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","Styled","jsx","_jsx","MenuItemHelpText","props","ref","numberOfLines"],"sources":["@wordpress/components/src/menu/item-help-text.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport * as Styled from './styles';\n\nexport const MenuItemHelpText = forwardRef<\n\tHTMLSpanElement,\n\tWordPressComponentProps< { children: React.ReactNode }, 'span', true >\n>( function MenuItemHelpText( props, ref ) {\n\treturn (\n\t\t<Styled.MenuItemHelpText numberOfLines={ 2 } ref={ ref } { ...props } />\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;;
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","MenuContext","Styled","jsx","_jsx","MenuItemHelpText","props","ref","menuContext","store","Error","numberOfLines"],"sources":["@wordpress/components/src/menu/item-help-text.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport * as Styled from './styles';\n\nexport const MenuItemHelpText = forwardRef<\n\tHTMLSpanElement,\n\tWordPressComponentProps< { children: React.ReactNode }, 'span', true >\n>( function MenuItemHelpText( props, ref ) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.ItemHelpText can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuItemHelpText numberOfLines={ 2 } ref={ ref } { ...props } />\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAEA,SAASC,WAAW,QAAQ,WAAW;AACvC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,gBAAgB,GAAGN,UAAU,CAGvC,SAASM,gBAAgBA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EAC1C,MAAMC,WAAW,GAAGR,UAAU,CAAEC,WAAY,CAAC;EAE7C,IAAK,CAAEO,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,gEACD,CAAC;EACF;EAEA,oBACCN,IAAA,CAACF,MAAM,CAACG,gBAAgB;IAACM,aAAa,EAAG,CAAG;IAACJ,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AAE1E,CAAE,CAAC","ignoreList":[]}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { forwardRef } from '@wordpress/element';
|
|
4
|
+
import { forwardRef, useContext } from '@wordpress/element';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { MenuContext } from './context';
|
|
10
11
|
import * as Styled from './styles';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
export const MenuItemLabel = forwardRef(function MenuItemLabel(props, ref) {
|
|
14
|
+
const menuContext = useContext(MenuContext);
|
|
15
|
+
if (!menuContext?.store) {
|
|
16
|
+
throw new Error('Menu.ItemLabel can only be rendered inside a Menu component');
|
|
17
|
+
}
|
|
13
18
|
return /*#__PURE__*/_jsx(Styled.MenuItemLabel, {
|
|
14
19
|
numberOfLines: 1,
|
|
15
20
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","Styled","jsx","_jsx","MenuItemLabel","props","ref","numberOfLines"],"sources":["@wordpress/components/src/menu/item-label.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport * as Styled from './styles';\n\nexport const MenuItemLabel = forwardRef<\n\tHTMLSpanElement,\n\tWordPressComponentProps< { children: React.ReactNode }, 'span', true >\n>( function MenuItemLabel( props, ref ) {\n\treturn (\n\t\t<Styled.MenuItemLabel numberOfLines={ 1 } ref={ ref } { ...props } />\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;;
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","MenuContext","Styled","jsx","_jsx","MenuItemLabel","props","ref","menuContext","store","Error","numberOfLines"],"sources":["@wordpress/components/src/menu/item-label.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport * as Styled from './styles';\n\nexport const MenuItemLabel = forwardRef<\n\tHTMLSpanElement,\n\tWordPressComponentProps< { children: React.ReactNode }, 'span', true >\n>( function MenuItemLabel( props, ref ) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.ItemLabel can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuItemLabel numberOfLines={ 1 } ref={ ref } { ...props } />\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAEA,SAASC,WAAW,QAAQ,WAAW;AACvC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,aAAa,GAAGN,UAAU,CAGpC,SAASM,aAAaA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACvC,MAAMC,WAAW,GAAGR,UAAU,CAAEC,WAAY,CAAC;EAE7C,IAAK,CAAEO,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,6DACD,CAAC;EACF;EAEA,oBACCN,IAAA,CAACF,MAAM,CAACG,aAAa;IAACM,aAAa,EAAG,CAAG;IAACJ,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AAEvE,CAAE,CAAC","ignoreList":[]}
|
|
@@ -9,28 +9,24 @@ import { forwardRef, useContext } from '@wordpress/element';
|
|
|
9
9
|
|
|
10
10
|
import * as Styled from './styles';
|
|
11
11
|
import { MenuContext } from './context';
|
|
12
|
-
import { useTemporaryFocusVisibleFix } from './use-temporary-focus-visible-fix';
|
|
13
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
13
|
export const MenuItem = forwardRef(function MenuItem({
|
|
15
14
|
prefix,
|
|
16
15
|
suffix,
|
|
17
16
|
children,
|
|
18
|
-
onBlur,
|
|
19
17
|
hideOnClick = true,
|
|
20
18
|
...props
|
|
21
19
|
}, ref) {
|
|
22
|
-
// TODO: Remove when https://github.com/ariakit/ariakit/issues/4083 is fixed
|
|
23
|
-
const focusVisibleFixProps = useTemporaryFocusVisibleFix({
|
|
24
|
-
onBlur
|
|
25
|
-
});
|
|
26
20
|
const menuContext = useContext(MenuContext);
|
|
21
|
+
if (!menuContext?.store) {
|
|
22
|
+
throw new Error('Menu.Item can only be rendered inside a Menu component');
|
|
23
|
+
}
|
|
27
24
|
return /*#__PURE__*/_jsxs(Styled.MenuItem, {
|
|
28
25
|
ref: ref,
|
|
29
26
|
...props,
|
|
30
|
-
...focusVisibleFixProps,
|
|
31
27
|
accessibleWhenDisabled: true,
|
|
32
28
|
hideOnClick: hideOnClick,
|
|
33
|
-
store: menuContext
|
|
29
|
+
store: menuContext.store,
|
|
34
30
|
children: [/*#__PURE__*/_jsx(Styled.ItemPrefixWrapper, {
|
|
35
31
|
children: prefix
|
|
36
32
|
}), /*#__PURE__*/_jsxs(Styled.MenuItemContentWrapper, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useContext","Styled","MenuContext","
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","Styled","MenuContext","jsx","_jsx","jsxs","_jsxs","MenuItem","prefix","suffix","children","hideOnClick","props","ref","menuContext","store","Error","accessibleWhenDisabled","ItemPrefixWrapper","MenuItemContentWrapper","MenuItemChildrenWrapper","ItemSuffixWrapper"],"sources":["@wordpress/components/src/menu/item.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport type { MenuItemProps } from './types';\nimport * as Styled from './styles';\nimport { MenuContext } from './context';\n\nexport const MenuItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuItemProps, 'div', false >\n>( function MenuItem(\n\t{ prefix, suffix, children, hideOnClick = true, ...props },\n\tref\n) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.Item can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\taccessibleWhenDisabled\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ menuContext.store }\n\t\t>\n\t\t\t<Styled.ItemPrefixWrapper>{ prefix }</Styled.ItemPrefixWrapper>\n\n\t\t\t<Styled.MenuItemContentWrapper>\n\t\t\t\t<Styled.MenuItemChildrenWrapper>\n\t\t\t\t\t{ children }\n\t\t\t\t</Styled.MenuItemChildrenWrapper>\n\n\t\t\t\t{ suffix && (\n\t\t\t\t\t<Styled.ItemSuffixWrapper>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t</Styled.ItemSuffixWrapper>\n\t\t\t\t) }\n\t\t\t</Styled.MenuItemContentWrapper>\n\t\t</Styled.MenuItem>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAGA,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,WAAW,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAExC,OAAO,MAAMC,QAAQ,GAAGR,UAAU,CAG/B,SAASQ,QAAQA,CACnB;EAAEC,MAAM;EAAEC,MAAM;EAAEC,QAAQ;EAAEC,WAAW,GAAG,IAAI;EAAE,GAAGC;AAAM,CAAC,EAC1DC,GAAG,EACF;EACD,MAAMC,WAAW,GAAGd,UAAU,CAAEE,WAAY,CAAC;EAE7C,IAAK,CAAEY,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,wDACD,CAAC;EACF;EAEA,oBACCV,KAAA,CAACL,MAAM,CAACM,QAAQ;IACfM,GAAG,EAAGA,GAAK;IAAA,GACND,KAAK;IACVK,sBAAsB;IACtBN,WAAW,EAAGA,WAAa;IAC3BI,KAAK,EAAGD,WAAW,CAACC,KAAO;IAAAL,QAAA,gBAE3BN,IAAA,CAACH,MAAM,CAACiB,iBAAiB;MAAAR,QAAA,EAAGF;IAAM,CAA4B,CAAC,eAE/DF,KAAA,CAACL,MAAM,CAACkB,sBAAsB;MAAAT,QAAA,gBAC7BN,IAAA,CAACH,MAAM,CAACmB,uBAAuB;QAAAV,QAAA,EAC5BA;MAAQ,CACqB,CAAC,EAE/BD,MAAM,iBACPL,IAAA,CAACH,MAAM,CAACoB,iBAAiB;QAAAX,QAAA,EACtBD;MAAM,CACiB,CAC1B;IAAA,CAC6B,CAAC;EAAA,CAChB,CAAC;AAEpB,CAAE,CAAC","ignoreList":[]}
|
|
@@ -16,7 +16,6 @@ import { Icon } from '@wordpress/icons';
|
|
|
16
16
|
import { MenuContext } from './context';
|
|
17
17
|
import * as Styled from './styles';
|
|
18
18
|
import { SVG, Circle } from '@wordpress/primitives';
|
|
19
|
-
import { useTemporaryFocusVisibleFix } from './use-temporary-focus-visible-fix';
|
|
20
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
20
|
const radioCheck = /*#__PURE__*/_jsx(SVG, {
|
|
22
21
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -30,24 +29,21 @@ const radioCheck = /*#__PURE__*/_jsx(SVG, {
|
|
|
30
29
|
export const MenuRadioItem = forwardRef(function MenuRadioItem({
|
|
31
30
|
suffix,
|
|
32
31
|
children,
|
|
33
|
-
onBlur,
|
|
34
32
|
hideOnClick = false,
|
|
35
33
|
...props
|
|
36
34
|
}, ref) {
|
|
37
|
-
// TODO: Remove when https://github.com/ariakit/ariakit/issues/4083 is fixed
|
|
38
|
-
const focusVisibleFixProps = useTemporaryFocusVisibleFix({
|
|
39
|
-
onBlur
|
|
40
|
-
});
|
|
41
35
|
const menuContext = useContext(MenuContext);
|
|
36
|
+
if (!menuContext?.store) {
|
|
37
|
+
throw new Error('Menu.RadioItem can only be rendered inside a Menu component');
|
|
38
|
+
}
|
|
42
39
|
return /*#__PURE__*/_jsxs(Styled.MenuRadioItem, {
|
|
43
40
|
ref: ref,
|
|
44
41
|
...props,
|
|
45
|
-
...focusVisibleFixProps,
|
|
46
42
|
accessibleWhenDisabled: true,
|
|
47
43
|
hideOnClick: hideOnClick,
|
|
48
|
-
store: menuContext
|
|
44
|
+
store: menuContext.store,
|
|
49
45
|
children: [/*#__PURE__*/_jsx(Ariakit.MenuItemCheck, {
|
|
50
|
-
store: menuContext
|
|
46
|
+
store: menuContext.store,
|
|
51
47
|
render: /*#__PURE__*/_jsx(Styled.ItemPrefixWrapper, {})
|
|
52
48
|
// Override some ariakit inline styles
|
|
53
49
|
,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Ariakit","forwardRef","useContext","Icon","MenuContext","Styled","SVG","Circle","
|
|
1
|
+
{"version":3,"names":["Ariakit","forwardRef","useContext","Icon","MenuContext","Styled","SVG","Circle","jsx","_jsx","jsxs","_jsxs","radioCheck","xmlns","viewBox","children","cx","cy","r","MenuRadioItem","suffix","hideOnClick","props","ref","menuContext","store","Error","accessibleWhenDisabled","MenuItemCheck","render","ItemPrefixWrapper","style","width","height","icon","size","MenuItemContentWrapper","MenuItemChildrenWrapper","ItemSuffixWrapper"],"sources":["@wordpress/components/src/menu/radio-item.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\nimport { Icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport type { MenuRadioItemProps } from './types';\nimport * as Styled from './styles';\nimport { SVG, Circle } from '@wordpress/primitives';\n\nconst radioCheck = (\n\t<SVG xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\">\n\t\t<Circle cx={ 12 } cy={ 12 } r={ 3 }></Circle>\n\t</SVG>\n);\n\nexport const MenuRadioItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< MenuRadioItemProps, 'div', false >\n>( function MenuRadioItem(\n\t{ suffix, children, hideOnClick = false, ...props },\n\tref\n) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.RadioItem can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuRadioItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\taccessibleWhenDisabled\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ menuContext.store }\n\t\t>\n\t\t\t<Ariakit.MenuItemCheck\n\t\t\t\tstore={ menuContext.store }\n\t\t\t\trender={ <Styled.ItemPrefixWrapper /> }\n\t\t\t\t// Override some ariakit inline styles\n\t\t\t\tstyle={ { width: 'auto', height: 'auto' } }\n\t\t\t>\n\t\t\t\t<Icon icon={ radioCheck } size={ 24 } />\n\t\t\t</Ariakit.MenuItemCheck>\n\n\t\t\t<Styled.MenuItemContentWrapper>\n\t\t\t\t<Styled.MenuItemChildrenWrapper>\n\t\t\t\t\t{ children }\n\t\t\t\t</Styled.MenuItemChildrenWrapper>\n\n\t\t\t\t{ suffix && (\n\t\t\t\t\t<Styled.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,gBAE3BN,IAAA,CAACT,OAAO,CAAC4B,aAAa;MACrBH,KAAK,EAAGD,WAAW,CAACC,KAAO;MAC3BI,MAAM,eAAGpB,IAAA,CAACJ,MAAM,CAACyB,iBAAiB,IAAE;MACpC;MAAA;MACAC,KAAK,EAAG;QAAEC,KAAK,EAAE,MAAM;QAAEC,MAAM,EAAE;MAAO,CAAG;MAAAlB,QAAA,eAE3CN,IAAA,CAACN,IAAI;QAAC+B,IAAI,EAAGtB,UAAY;QAACuB,IAAI,EAAG;MAAI,CAAE;IAAC,CAClB,CAAC,eAExBxB,KAAA,CAACN,MAAM,CAAC+B,sBAAsB;MAAArB,QAAA,gBAC7BN,IAAA,CAACJ,MAAM,CAACgC,uBAAuB;QAAAtB,QAAA,EAC5BA;MAAQ,CACqB,CAAC,EAE/BK,MAAM,iBACPX,IAAA,CAACJ,MAAM,CAACiC,iBAAiB;QAAAvB,QAAA,EACtBK;MAAM,CACiB,CAC1B;IAAA,CAC6B,CAAC;EAAA,CACX,CAAC;AAEzB,CAAE,CAAC","ignoreList":[]}
|
|
@@ -12,11 +12,14 @@ import * as Styled from './styles';
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
export const MenuSeparator = forwardRef(function MenuSeparator(props, ref) {
|
|
14
14
|
const menuContext = useContext(MenuContext);
|
|
15
|
+
if (!menuContext?.store) {
|
|
16
|
+
throw new Error('Menu.Separator can only be rendered inside a Menu component');
|
|
17
|
+
}
|
|
15
18
|
return /*#__PURE__*/_jsx(Styled.MenuSeparator, {
|
|
16
19
|
ref: ref,
|
|
17
20
|
...props,
|
|
18
|
-
store: menuContext
|
|
19
|
-
variant: menuContext
|
|
21
|
+
store: menuContext.store,
|
|
22
|
+
variant: menuContext.variant
|
|
20
23
|
});
|
|
21
24
|
});
|
|
22
25
|
//# sourceMappingURL=separator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useContext","MenuContext","Styled","jsx","_jsx","MenuSeparator","props","ref","menuContext","store","variant"],"sources":["@wordpress/components/src/menu/separator.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport type { MenuSeparatorProps } from './types';\nimport * as Styled from './styles';\n\nexport const MenuSeparator = forwardRef<\n\tHTMLHRElement,\n\tWordPressComponentProps< MenuSeparatorProps, 'hr', false >\n>( function MenuSeparator( props, ref ) {\n\tconst menuContext = useContext( MenuContext );\n\treturn (\n\t\t<Styled.MenuSeparator\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tstore={ menuContext
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","MenuContext","Styled","jsx","_jsx","MenuSeparator","props","ref","menuContext","store","Error","variant"],"sources":["@wordpress/components/src/menu/separator.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { MenuContext } from './context';\nimport type { MenuSeparatorProps } from './types';\nimport * as Styled from './styles';\n\nexport const MenuSeparator = forwardRef<\n\tHTMLHRElement,\n\tWordPressComponentProps< MenuSeparatorProps, 'hr', false >\n>( function MenuSeparator( props, ref ) {\n\tconst menuContext = useContext( MenuContext );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.Separator can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.MenuSeparator\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tstore={ menuContext.store }\n\t\t\tvariant={ menuContext.variant }\n\t\t/>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAEA,SAASC,WAAW,QAAQ,WAAW;AAEvC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,aAAa,GAAGN,UAAU,CAGpC,SAASM,aAAaA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACvC,MAAMC,WAAW,GAAGR,UAAU,CAAEC,WAAY,CAAC;EAE7C,IAAK,CAAEO,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,6DACD,CAAC;EACF;EAEA,oBACCN,IAAA,CAACF,MAAM,CAACG,aAAa;IACpBE,GAAG,EAAGA,GAAK;IAAA,GACND,KAAK;IACVG,KAAK,EAAGD,WAAW,CAACC,KAAO;IAC3BE,OAAO,EAAGH,WAAW,CAACG;EAAS,CAC/B,CAAC;AAEJ,CAAE,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LIVE_REGION_ARIA_ROLES","Set","hiddenElementsByDepth","modalize","modalElement","elements","Array","from","document","body","children","hiddenElements","push","element","elementShouldBeHidden","setAttribute","role","getAttribute","tagName","hasAttribute","has","unmodalize","pop","removeAttribute"],"sources":["@wordpress/components/src/modal/aria-helper.ts"],"sourcesContent":["const LIVE_REGION_ARIA_ROLES = new Set( [\n\t'alert',\n\t'status',\n\t'log',\n\t'marquee',\n\t'timer',\n] );\n\nconst hiddenElementsByDepth: Element[][] = [];\n\n/**\n * Hides all elements in the body element from screen-readers except\n * the provided element and elements that should not be hidden from\n * screen-readers.\n *\n * The reason we do this is because `aria-modal=\"true\"` currently is bugged\n * in Safari, and support is spotty in other browsers overall. In the future\n * we should consider removing these helper functions in favor of\n * `aria-modal=\"true\"`.\n *\n * @param modalElement The element that should not be hidden.\n */\nexport function modalize( modalElement?: HTMLDivElement ) {\n\tconst elements = Array.from( document.body.children );\n\tconst hiddenElements: Element[] = [];\n\thiddenElementsByDepth.push( hiddenElements );\n\tfor ( const element of elements ) {\n\t\tif ( element === modalElement ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( elementShouldBeHidden( element ) ) {\n\t\t\telement.setAttribute( 'aria-hidden', 'true' );\n\t\t\thiddenElements.push( element );\n\t\t}\n\t}\n}\n\n/**\n * Determines if the passed element should not be hidden from screen readers.\n *\n * @param element The element that should be checked.\n *\n * @return Whether the element should not be hidden from screen-readers.\n */\nexport function elementShouldBeHidden( element: Element ) {\n\tconst role = element.getAttribute( 'role' );\n\treturn ! (\n\t\telement.tagName === 'SCRIPT' ||\n\t\telement.hasAttribute( 'hidden' ) ||\n\t\telement.hasAttribute( 'aria-hidden' ) ||\n\t\telement.hasAttribute( 'aria-live' ) ||\n\t\t( role && LIVE_REGION_ARIA_ROLES.has( role ) )\n\t);\n}\n\n/**\n * Accessibly reveals the elements hidden by the latest modal.\n */\nexport function unmodalize() {\n\tconst hiddenElements = hiddenElementsByDepth.pop();\n\tif ( ! hiddenElements ) {\n\t\treturn;\n\t}\n\n\tfor ( const element of hiddenElements ) {\n\t\telement.removeAttribute( 'aria-hidden' );\n\t}\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["LIVE_REGION_ARIA_ROLES","Set","hiddenElementsByDepth","modalize","modalElement","elements","Array","from","document","body","children","hiddenElements","push","element","elementShouldBeHidden","setAttribute","role","getAttribute","tagName","hasAttribute","has","unmodalize","pop","removeAttribute"],"sources":["@wordpress/components/src/modal/aria-helper.ts"],"sourcesContent":["const LIVE_REGION_ARIA_ROLES = new Set( [\n\t'alert',\n\t'status',\n\t'log',\n\t'marquee',\n\t'timer',\n] );\n\nconst hiddenElementsByDepth: Element[][] = [];\n\n/**\n * Hides all elements in the body element from screen-readers except\n * the provided element and elements that should not be hidden from\n * screen-readers.\n *\n * The reason we do this is because `aria-modal=\"true\"` currently is bugged\n * in Safari, and support is spotty in other browsers overall. In the future\n * we should consider removing these helper functions in favor of\n * `aria-modal=\"true\"`.\n *\n * @param modalElement The element that should not be hidden.\n */\nexport function modalize( modalElement?: HTMLDivElement ) {\n\tconst elements = Array.from( document.body.children );\n\tconst hiddenElements: Element[] = [];\n\thiddenElementsByDepth.push( hiddenElements );\n\tfor ( const element of elements ) {\n\t\tif ( element === modalElement ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif ( elementShouldBeHidden( element ) ) {\n\t\t\telement.setAttribute( 'aria-hidden', 'true' );\n\t\t\thiddenElements.push( element );\n\t\t}\n\t}\n}\n\n/**\n * Determines if the passed element should not be hidden from screen readers.\n *\n * @param element The element that should be checked.\n *\n * @return Whether the element should not be hidden from screen-readers.\n */\nexport function elementShouldBeHidden( element: Element ) {\n\tconst role = element.getAttribute( 'role' );\n\treturn ! (\n\t\telement.tagName === 'SCRIPT' ||\n\t\telement.hasAttribute( 'hidden' ) ||\n\t\telement.hasAttribute( 'aria-hidden' ) ||\n\t\telement.hasAttribute( 'aria-live' ) ||\n\t\t( role && LIVE_REGION_ARIA_ROLES.has( role ) )\n\t);\n}\n\n/**\n * Accessibly reveals the elements hidden by the latest modal.\n */\nexport function unmodalize() {\n\tconst hiddenElements = hiddenElementsByDepth.pop();\n\tif ( ! hiddenElements ) {\n\t\treturn;\n\t}\n\n\tfor ( const element of hiddenElements ) {\n\t\telement.removeAttribute( 'aria-hidden' );\n\t}\n}\n"],"mappings":"AAAA,MAAMA,sBAAsB,GAAG,IAAIC,GAAG,CAAE,CACvC,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,OAAO,CACN,CAAC;AAEH,MAAMC,qBAAkC,GAAG,EAAE;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,QAAQA,CAAEC,YAA6B,EAAG;EACzD,MAAMC,QAAQ,GAAGC,KAAK,CAACC,IAAI,CAAEC,QAAQ,CAACC,IAAI,CAACC,QAAS,CAAC;EACrD,MAAMC,cAAyB,GAAG,EAAE;EACpCT,qBAAqB,CAACU,IAAI,CAAED,cAAe,CAAC;EAC5C,KAAM,MAAME,OAAO,IAAIR,QAAQ,EAAG;IACjC,IA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