@wordpress/components 28.12.0 → 28.13.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 +45 -1
- package/CONTRIBUTING.md +16 -16
- package/build/autocomplete/autocompleter-ui.js +1 -0
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +1 -0
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +2 -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 -1
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control/hook.js +3 -1
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/border-control/types.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 +13 -13
- 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/color-palette/index.js +2 -0
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/color-copy-button.js +6 -4
- package/build/color-picker/color-copy-button.js.map +1 -1
- package/build/color-picker/component.js +1 -0
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/styles.js +21 -28
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +17 -12
- package/build/combobox-control/index.js.map +1 -1
- package/build/composite/hover.js +1 -1
- package/build/composite/hover.js.map +1 -1
- package/build/composite/typeahead.js +1 -1
- package/build/composite/typeahead.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/dashicon/types.js.map +1 -1
- package/build/dimension-control/index.js +7 -0
- package/build/dimension-control/index.js.map +1 -1
- package/build/disabled/index.js +8 -1
- package/build/disabled/index.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +2 -0
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/font-size-picker/font-size-picker-toggle-group.js +1 -0
- package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build/font-size-picker/index.js +7 -0
- package/build/font-size-picker/index.js.map +1 -1
- package/build/form-file-upload/index.js +3 -1
- package/build/form-file-upload/index.js.map +1 -1
- package/build/gradient-picker/index.js +34 -32
- 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/styles.js +16 -16
- package/build/menu/styles.js.map +1 -1
- package/build/modal/index.js +2 -2
- package/build/modal/index.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/range-control/index.js +11 -0
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/types.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/fill.js +14 -31
- package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +13 -4
- package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/slot.js +11 -9
- package/build/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/use-slot.js +1 -8
- package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build/slot-fill/fill.js +7 -24
- package/build/slot-fill/fill.js.map +1 -1
- package/build/slot-fill/index.js +5 -10
- package/build/slot-fill/index.js.map +1 -1
- package/build/slot-fill/provider.js +2 -2
- package/build/slot-fill/provider.js.map +1 -1
- package/build/slot-fill/slot.js +37 -77
- package/build/slot-fill/slot.js.map +1 -1
- package/build/slot-fill/types.js.map +1 -1
- package/build/text-control/index.js +7 -0
- package/build/text-control/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +9 -0
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/component.js +1 -0
- package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build/toggle-group-control/types.js.map +1 -1
- package/build/utils/deprecated-36px-size.js +3 -2
- package/build/utils/deprecated-36px-size.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +1 -0
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +1 -0
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +2 -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 -1
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control/hook.js +3 -1
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/border-control/types.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 +13 -13
- 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/color-palette/index.js +2 -0
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/color-copy-button.js +6 -4
- package/build-module/color-picker/color-copy-button.js.map +1 -1
- 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 +20 -27
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +18 -13
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/composite/hover.js +1 -1
- package/build-module/composite/hover.js.map +1 -1
- package/build-module/composite/typeahead.js +1 -1
- package/build-module/composite/typeahead.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/dashicon/types.js.map +1 -1
- package/build-module/dimension-control/index.js +7 -0
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/disabled/index.js +8 -1
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +2 -0
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/font-size-picker/font-size-picker-toggle-group.js +1 -0
- package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -1
- package/build-module/font-size-picker/index.js +7 -0
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/form-file-upload/index.js +3 -1
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/gradient-picker/index.js +34 -32
- 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/styles.js +16 -16
- package/build-module/menu/styles.js.map +1 -1
- package/build-module/modal/index.js +2 -2
- package/build-module/modal/index.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/range-control/index.js +11 -0
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/types.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/fill.js +15 -32
- package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +13 -4
- package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/slot.js +11 -9
- package/build-module/slot-fill/bubbles-virtually/slot.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/use-slot.js +2 -9
- package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
- package/build-module/slot-fill/fill.js +7 -24
- package/build-module/slot-fill/fill.js.map +1 -1
- package/build-module/slot-fill/index.js +5 -8
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/slot-fill/provider.js +2 -3
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/slot-fill/slot.js +38 -78
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/slot-fill/types.js.map +1 -1
- package/build-module/text-control/index.js +7 -0
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +9 -0
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option/component.js +1 -0
- package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build-module/toggle-group-control/types.js.map +1 -1
- package/build-module/utils/deprecated-36px-size.js +3 -2
- package/build-module/utils/deprecated-36px-size.js.map +1 -1
- package/build-style/style-rtl.css +3 -10
- package/build-style/style.css +3 -10
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +1 -0
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
- package/build-types/border-control/stories/index.story.d.ts +10 -5
- package/build-types/border-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +7 -0
- package/build-types/border-control/types.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 +13 -13
- package/build-types/box-control/input-controls.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-styles.d.ts +2 -1
- package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +2 -0
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.story.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/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-indicator/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -4
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/combobox-control/index.d.ts +1 -0
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/typeahead.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/stories/index.story.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-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/dashicon/types.d.ts +1 -1
- package/build-types/dashicon/types.d.ts.map +1 -1
- package/build-types/date-time/stories/date-time.story.d.ts.map +1 -1
- package/build-types/date-time/stories/date.story.d.ts.map +1 -1
- package/build-types/date-time/stories/time.story.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +1 -0
- package/build-types/dimension-control/index.d.ts.map +1 -1
- package/build-types/disabled/index.d.ts +8 -1
- package/build-types/disabled/index.d.ts.map +1 -1
- package/build-types/disabled/stories/index.story.d.ts.map +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
- package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
- package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -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-token-field/stories/index.story.d.ts.map +1 -1
- package/build-types/gradient-picker/index.d.ts +32 -32
- package/build-types/gradient-picker/index.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/gradient-picker/types.d.ts +1 -5
- package/build-types/gradient-picker/types.d.ts.map +1 -1
- package/build-types/h-stack/stories/index.story.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/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-items-choice/stories/index.story.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts.map +1 -1
- package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/radio-control/stories/index.story.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +3 -1
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/stories/index.story.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +7 -0
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/responsive-wrapper/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts +1 -1
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/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/bubbles-virtually/use-slot-fills.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts +3 -7
- package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
- package/build-types/slot-fill/fill.d.ts.map +1 -1
- package/build-types/slot-fill/index.d.ts +5 -12
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/slot-fill/provider.d.ts.map +1 -1
- package/build-types/slot-fill/slot.d.ts +1 -1
- package/build-types/slot-fill/slot.d.ts.map +1 -1
- package/build-types/slot-fill/types.d.ts +15 -18
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/slot-fill/use-slot.d.ts +1 -1
- package/build-types/slot-fill/use-slot.d.ts.map +1 -1
- package/build-types/text-control/index.d.ts +1 -0
- package/build-types/text-control/index.d.ts.map +1 -1
- package/build-types/text-control/stories/index.story.d.ts.map +1 -1
- package/build-types/textarea-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts +2 -0
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -0
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
- package/build-types/toggle-group-control/types.d.ts +7 -0
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/tools-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/stories/index.story.d.ts.map +1 -1
- package/build-types/unit-control/stories/index.story.d.ts.map +1 -1
- package/build-types/utils/deprecated-36px-size.d.ts +2 -1
- package/build-types/utils/deprecated-36px-size.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.story.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/autocomplete/autocompleter-ui.tsx +1 -0
- package/src/base-control/stories/index.story.tsx +2 -1
- package/src/border-box-control/border-box-control/component.tsx +1 -0
- package/src/border-box-control/border-box-control-split-controls/component.tsx +1 -0
- package/src/border-control/border-control/component.tsx +1 -0
- package/src/border-control/border-control/hook.ts +2 -0
- package/src/border-control/types.ts +7 -0
- package/src/box-control/README.md +79 -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 +13 -13
- package/src/box-control/input-controls.tsx +1 -0
- package/src/box-control/types.ts +2 -0
- package/src/checkbox-control/stories/index.story.tsx +2 -1
- 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/stories/index.story.tsx +2 -1
- package/src/circular-option-picker/style.scss +2 -2
- package/src/color-indicator/stories/index.story.tsx +2 -1
- package/src/color-palette/index.tsx +5 -1
- package/src/color-palette/stories/index.story.tsx +2 -1
- package/src/color-picker/color-copy-button.tsx +8 -10
- package/src/color-picker/component.tsx +1 -0
- package/src/color-picker/stories/index.story.tsx +2 -1
- package/src/color-picker/styles.ts +0 -13
- package/src/combobox-control/README.md +1 -0
- package/src/combobox-control/index.tsx +19 -13
- package/src/combobox-control/stories/index.story.tsx +3 -1
- package/src/combobox-control/style.scss +0 -6
- package/src/combobox-control/test/index.tsx +7 -1
- package/src/composite/hover.tsx +1 -1
- package/src/composite/typeahead.tsx +3 -1
- package/src/custom-gradient-picker/gradient-bar/control-points.tsx +2 -0
- package/src/custom-gradient-picker/stories/index.story.tsx +2 -1
- package/src/custom-gradient-picker/style.scss +1 -1
- package/src/custom-select-control/stories/index.story.tsx +2 -1
- package/src/custom-select-control-v2/stories/index.story.tsx +2 -1
- package/src/dashicon/types.ts +0 -2
- package/src/date-time/stories/date-time.story.tsx +2 -1
- package/src/date-time/stories/date.story.tsx +2 -1
- package/src/date-time/stories/time.story.tsx +2 -1
- package/src/dimension-control/README.md +1 -0
- package/src/dimension-control/index.tsx +8 -0
- package/src/dimension-control/stories/index.story.tsx +1 -0
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +24 -24
- package/src/dimension-control/test/index.test.js +7 -1
- package/src/disabled/README.md +9 -7
- package/src/disabled/index.tsx +8 -1
- package/src/disabled/stories/index.story.tsx +1 -0
- package/src/drop-zone/stories/index.story.tsx +2 -1
- package/src/dropdown-menu/stories/index.story.tsx +2 -1
- package/src/duotone-picker/duotone-picker.tsx +2 -0
- package/src/font-size-picker/README.md +1 -0
- package/src/font-size-picker/font-size-picker-toggle-group.tsx +1 -0
- package/src/font-size-picker/index.tsx +8 -0
- package/src/font-size-picker/stories/index.story.tsx +1 -0
- package/src/font-size-picker/test/index.tsx +5 -1
- package/src/form-file-upload/index.tsx +9 -3
- package/src/form-file-upload/stories/index.story.tsx +2 -1
- package/src/form-token-field/stories/index.story.tsx +2 -1
- package/src/gradient-picker/README.md +107 -69
- package/src/gradient-picker/docs-manifest.json +5 -0
- package/src/gradient-picker/index.tsx +34 -32
- package/src/gradient-picker/stories/index.story.tsx +2 -1
- package/src/gradient-picker/types.ts +3 -5
- package/src/h-stack/stories/index.story.tsx +2 -1
- package/src/higher-order/with-constrained-tabbing/README.md +13 -3
- package/src/higher-order/with-focus-return/README.md +9 -2
- 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/input-control/stories/index.story.tsx +2 -1
- package/src/menu/styles.ts +1 -1
- package/src/menu-group/stories/index.story.tsx +2 -1
- package/src/menu-item/stories/index.story.tsx +2 -1
- package/src/menu-items-choice/stories/index.story.tsx +2 -1
- package/src/modal/index.tsx +2 -2
- package/src/modal/stories/index.story.tsx +1 -1
- package/src/number-control/stories/index.story.tsx +2 -1
- package/src/placeholder/stories/index.story.tsx +1 -0
- package/src/private-apis.ts +0 -2
- package/src/radio-control/stories/index.story.tsx +2 -1
- package/src/range-control/README.md +4 -3
- package/src/range-control/index.tsx +11 -0
- package/src/range-control/stories/index.story.tsx +9 -1
- package/src/range-control/test/index.tsx +7 -1
- package/src/range-control/types.ts +7 -0
- package/src/responsive-wrapper/stories/index.story.tsx +2 -1
- package/src/search-control/stories/index.story.tsx +2 -1
- package/src/select-control/stories/index.story.tsx +2 -1
- package/src/slot-fill/README.md +26 -15
- package/src/slot-fill/bubbles-virtually/fill.tsx +18 -28
- package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +26 -16
- package/src/slot-fill/bubbles-virtually/slot.tsx +13 -9
- package/src/slot-fill/bubbles-virtually/use-slot.ts +3 -26
- package/src/slot-fill/fill.ts +7 -22
- package/src/slot-fill/index.tsx +5 -7
- package/src/slot-fill/provider.tsx +8 -17
- package/src/slot-fill/slot.tsx +48 -85
- package/src/slot-fill/types.ts +14 -51
- package/src/text-control/README.md +1 -0
- package/src/text-control/index.tsx +8 -0
- package/src/text-control/stories/index.story.tsx +3 -1
- package/src/text-control/test/text-control.tsx +7 -1
- package/src/textarea-control/stories/index.story.tsx +2 -1
- package/src/toggle-control/stories/index.story.tsx +2 -1
- package/src/toggle-group-control/stories/index.story.tsx +3 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +12 -12
- package/src/toggle-group-control/test/index.tsx +7 -1
- package/src/toggle-group-control/toggle-group-control/README.md +2 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +10 -0
- package/src/toggle-group-control/toggle-group-control-option/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option/component.tsx +1 -0
- package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -1
- package/src/toggle-group-control/types.ts +7 -0
- package/src/tools-panel/stories/index.story.tsx +3 -0
- package/src/tree-select/stories/index.story.tsx +2 -1
- package/src/unit-control/stories/index.story.tsx +2 -1
- package/src/utils/deprecated-36px-size.ts +3 -0
- package/src/v-stack/stories/index.story.tsx +2 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useState","isShallowEqual","observableMap","SlotFillContext","jsx","_jsx","createSlotRegistry","slots","fills","registerSlot","name","ref","fillProps","slot","get","set","unregisterSlot","delete","updateSlot","slotFills","forEach","fill","
|
|
1
|
+
{"version":3,"names":["useState","isShallowEqual","observableMap","SlotFillContext","jsx","_jsx","createSlotRegistry","slots","fills","registerSlot","name","ref","fillProps","slot","get","set","unregisterSlot","delete","updateSlot","slotFills","forEach","fill","rerender","registerFill","unregisterFill","fillsForName","filter","fillRef","SlotFillProvider","children","registry","Provider","value"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport isShallowEqual from '@wordpress/is-shallow-equal';\nimport { observableMap } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport type {\n\tSlotFillProviderProps,\n\tSlotFillBubblesVirtuallyContext,\n} from '../types';\n\nfunction createSlotRegistry(): SlotFillBubblesVirtuallyContext {\n\tconst slots: SlotFillBubblesVirtuallyContext[ 'slots' ] = observableMap();\n\tconst fills: SlotFillBubblesVirtuallyContext[ 'fills' ] = observableMap();\n\n\tconst registerSlot: SlotFillBubblesVirtuallyContext[ 'registerSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tconst slot = slots.get( name );\n\n\t\tslots.set( name, {\n\t\t\t...slot,\n\t\t\tref: ref || slot?.ref,\n\t\t\tfillProps: fillProps || slot?.fillProps || {},\n\t\t} );\n\t};\n\n\tconst unregisterSlot: SlotFillBubblesVirtuallyContext[ 'unregisterSlot' ] =\n\t\t( name, ref ) => {\n\t\t\tconst slot = slots.get( name );\n\t\t\tif ( ! slot ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Make sure we're not unregistering a slot registered by another element\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412\n\t\t\tif ( slot.ref !== ref ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tslots.delete( name );\n\t\t};\n\n\tconst updateSlot: SlotFillBubblesVirtuallyContext[ 'updateSlot' ] = (\n\t\tname,\n\t\tref,\n\t\tfillProps\n\t) => {\n\t\tconst slot = slots.get( name );\n\t\tif ( ! slot ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( slot.ref !== ref ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isShallowEqual( slot.fillProps, fillProps ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tslot.fillProps = fillProps;\n\t\tconst slotFills = fills.get( name );\n\t\tif ( slotFills ) {\n\t\t\t// Force update fills.\n\t\t\tslotFills.forEach( ( fill ) => fill.rerender() );\n\t\t}\n\t};\n\n\tconst registerFill: SlotFillBubblesVirtuallyContext[ 'registerFill' ] = (\n\t\tname,\n\t\tref\n\t) => {\n\t\tfills.set( name, [ ...( fills.get( name ) || [] ), ref ] );\n\t};\n\n\tconst unregisterFill: SlotFillBubblesVirtuallyContext[ 'unregisterFill' ] =\n\t\t( name, ref ) => {\n\t\t\tconst fillsForName = fills.get( name );\n\t\t\tif ( ! fillsForName ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfills.set(\n\t\t\t\tname,\n\t\t\t\tfillsForName.filter( ( fillRef ) => fillRef !== ref )\n\t\t\t);\n\t\t};\n\n\treturn {\n\t\tslots,\n\t\tfills,\n\t\tregisterSlot,\n\t\tupdateSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t};\n}\n\nexport default function SlotFillProvider( {\n\tchildren,\n}: SlotFillProviderProps ) {\n\tconst [ registry ] = useState( createSlotRegistry );\n\treturn (\n\t\t<SlotFillContext.Provider value={ registry }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,OAAOC,cAAc,MAAM,6BAA6B;AACxD,SAASC,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAMlD,SAASC,kBAAkBA,CAAA,EAAoC;EAC9D,MAAMC,KAAiD,GAAGL,aAAa,CAAC,CAAC;EACzE,MAAMM,KAAiD,GAAGN,aAAa,CAAC,CAAC;EAEzE,MAAMO,YAA+D,GAAGA,CACvEC,IAAI,EACJC,GAAG,EACHC,SAAS,KACL;IACJ,MAAMC,IAAI,GAAGN,KAAK,CAACO,GAAG,CAAEJ,IAAK,CAAC;IAE9BH,KAAK,CAACQ,GAAG,CAAEL,IAAI,EAAE;MAChB,GA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,GACxEA,CAAEd,IAAI,EAAEC,GAAG,KAAM;IAChB,MAAMc,YAAY,GAAGjB,KAAK,CAACM,GAAG,CAAEJ,IAAK,CAAC;IACtC,IAAK,CAAEe,YAAY,EAAG;MACrB;IACD;IAEAjB,KAAK,CAACO,GAAG,CACRL,IAAI,EACJe,YAAY,CAACC,MAAM,CAAIC,OAAO,IAAMA,OAAO,KAAKhB,GAAI,CACrD,CAAC;EACF,CAAC;EAEF,OAAO;IACNJ,KAAK;IACLC,KAAK;IACLC,YAAY;IACZS,UAAU;IACVF,cAAc;IACdO,YAAY;IACZC;EACD,CAAC;AACF;AAEA,eAAe,SAASI,gBAAgBA,CAAE;EACzCC;AACsB,CAAC,EAAG;EAC1B,MAAM,CAAEC,QAAQ,CAAE,GAAG9B,QAAQ,CAAEM,kBAAmB,CAAC;EACnD,oBACCD,IAAA,CAACF,eAAe,CAAC4B,QAAQ;IAACC,KAAK,EAAGF,QAAU;IAAAD,QAAA,EACzCA;EAAQ,CACe,CAAC;AAE7B","ignoreList":[]}
|
|
@@ -21,7 +21,6 @@ function Slot(props, forwardedRef) {
|
|
|
21
21
|
as,
|
|
22
22
|
// `children` is not allowed. However, if it is passed,
|
|
23
23
|
// it will be displayed as is, so remove `children`.
|
|
24
|
-
// @ts-ignore
|
|
25
24
|
children,
|
|
26
25
|
...restProps
|
|
27
26
|
} = props;
|
|
@@ -31,20 +30,23 @@ function Slot(props, forwardedRef) {
|
|
|
31
30
|
...registry
|
|
32
31
|
} = useContext(SlotFillContext);
|
|
33
32
|
const ref = useRef(null);
|
|
33
|
+
|
|
34
|
+
// We don't want to unregister and register the slot whenever
|
|
35
|
+
// `fillProps` change, which would cause the fill to be re-mounted. Instead,
|
|
36
|
+
// we can just update the slot (see hook below).
|
|
37
|
+
// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973
|
|
38
|
+
const fillPropsRef = useRef(fillProps);
|
|
39
|
+
useLayoutEffect(() => {
|
|
40
|
+
fillPropsRef.current = fillProps;
|
|
41
|
+
}, [fillProps]);
|
|
34
42
|
useLayoutEffect(() => {
|
|
35
|
-
registerSlot(name, ref,
|
|
43
|
+
registerSlot(name, ref, fillPropsRef.current);
|
|
36
44
|
return () => {
|
|
37
45
|
unregisterSlot(name, ref);
|
|
38
46
|
};
|
|
39
|
-
// We don't want to unregister and register the slot whenever
|
|
40
|
-
// `fillProps` change, which would cause the fill to be re-mounted. Instead,
|
|
41
|
-
// we can just update the slot (see hook below).
|
|
42
|
-
// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973
|
|
43
47
|
}, [registerSlot, unregisterSlot, name]);
|
|
44
|
-
// fillProps may be an update that interacts with the layout, so we
|
|
45
|
-
// useLayoutEffect.
|
|
46
48
|
useLayoutEffect(() => {
|
|
47
|
-
registry.updateSlot(name,
|
|
49
|
+
registry.updateSlot(name, ref, fillPropsRef.current);
|
|
48
50
|
});
|
|
49
51
|
return /*#__PURE__*/_jsx(View, {
|
|
50
52
|
as: as,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","useLayoutEffect","useContext","forwardRef","useMergeRefs","View","SlotFillContext","jsx","_jsx","Slot","props","forwardedRef","name","fillProps","as","children","restProps","registerSlot","unregisterSlot","registry","ref","updateSlot"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { View } from '../../view';\nimport SlotFillContext from './slot-fill-context';\nimport type { WordPressComponentProps } from '../../context';\nimport type { SlotComponentProps } from '../types';\n\nfunction Slot(\n\tprops: WordPressComponentProps<\n\t\tOmit< SlotComponentProps, 'bubblesVirtually' >,\n\t\t'div'\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tname,\n\t\tfillProps = {},\n\t\tas,\n\t\t// `children` is not allowed. However, if it is passed,\n\t\t// it will be displayed as is, so remove `children`.\n\t\
|
|
1
|
+
{"version":3,"names":["useRef","useLayoutEffect","useContext","forwardRef","useMergeRefs","View","SlotFillContext","jsx","_jsx","Slot","props","forwardedRef","name","fillProps","as","children","restProps","registerSlot","unregisterSlot","registry","ref","fillPropsRef","current","updateSlot"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/slot.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseRef,\n\tuseLayoutEffect,\n\tuseContext,\n\tforwardRef,\n} from '@wordpress/element';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { View } from '../../view';\nimport SlotFillContext from './slot-fill-context';\nimport type { WordPressComponentProps } from '../../context';\nimport type { SlotComponentProps } from '../types';\n\nfunction Slot(\n\tprops: WordPressComponentProps<\n\t\tOmit< SlotComponentProps, 'bubblesVirtually' >,\n\t\t'div'\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\tname,\n\t\tfillProps = {},\n\t\tas,\n\t\t// `children` is not allowed. However, if it is passed,\n\t\t// it will be displayed as is, so remove `children`.\n\t\tchildren,\n\t\t...restProps\n\t} = props;\n\n\tconst { registerSlot, unregisterSlot, ...registry } =\n\t\tuseContext( SlotFillContext );\n\n\tconst ref = useRef< HTMLElement >( null );\n\n\t// We don't want to unregister and register the slot whenever\n\t// `fillProps` change, which would cause the fill to be re-mounted. Instead,\n\t// we can just update the slot (see hook below).\n\t// For more context, see https://github.com/WordPress/gutenberg/pull/44403#discussion_r994415973\n\tconst fillPropsRef = useRef( fillProps );\n\tuseLayoutEffect( () => {\n\t\tfillPropsRef.current = fillProps;\n\t}, [ fillProps ] );\n\n\tuseLayoutEffect( () => {\n\t\tregisterSlot( name, ref, fillPropsRef.current );\n\t\treturn () => {\n\t\t\tunregisterSlot( name, ref );\n\t\t};\n\t}, [ registerSlot, unregisterSlot, name ] );\n\n\tuseLayoutEffect( () => {\n\t\tregistry.updateSlot( name, ref, fillPropsRef.current );\n\t} );\n\n\treturn (\n\t\t<View\n\t\t\tas={ as }\n\t\t\tref={ useMergeRefs( [ forwardedRef, ref ] ) }\n\t\t\t{ ...restProps }\n\t\t/>\n\t);\n}\n\nexport default forwardRef( Slot );\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,MAAM,EACNC,eAAe,EACfC,UAAU,EACVC,UAAU,QACJ,oBAAoB;AAC3B,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,IAAI,QAAQ,YAAY;AACjC,OAAOC,eAAe,MAAM,qBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAIlD,SAASC,IAAIA,CACZC,KAGC,EACDC,YAAiC,EAChC;EACD,MAAM;IACLC,IAAI;IACJC,SAAS,GAAG,CAAC,CAAC;IACdC,EAAE;IACF;IACA;IACAC,QAAQ;IACR,GAAGC;EACJ,CAAC,GAAGN,KAAK;EAET,MAAM;IAAEO,YAAY;IAAEC,cAAc;IAAE,GAAGC;EAAS,CAAC,GAClDjB,UAAU,CAAEI,eAAgB,CAAC;EAE9B,MAAMc,GAAG,GAAGpB,MAAM,CAAiB,IAAK,CAAC;;EAEzC;EACA;EACA;EACA;EACA,MAAMqB,YAAY,GAAGrB,MAAM,CAAEa,SAAU,CAAC;EACxCZ,eAAe,CAAE,MAAM;IACtBoB,YAAY,CAACC,OAAO,GAAGT,SAAS;EACjC,CAAC,EAAE,CAAEA,SAAS,CAAG,CAAC;EAElBZ,eAAe,CAAE,MAAM;IACtBgB,YAAY,CAAEL,IAAI,EAAEQ,GAAG,EAAEC,YAAY,CAACC,OAAQ,CAAC;IAC/C,OAAO,MAAM;MACZJ,cAAc,CAAEN,IAAI,EAAEQ,GAAI,CAAC;IAC5B,CAAC;EACF,CAAC,EAAE,CAAEH,YAAY,EAAEC,cAAc,EAAEN,IAAI,CAAG,CAAC;EAE3CX,eAAe,CAAE,MAAM;IACtBkB,QAAQ,CAACI,UAAU,CAAEX,IAAI,EAAEQ,GAAG,EAAEC,YAAY,CAACC,OAAQ,CAAC;EACvD,CAAE,CAAC;EAEH,oBACCd,IAAA,CAACH,IAAI;IACJS,EAAE,EAAGA,EAAI;IACTM,GAAG,EAAGhB,YAAY,CAAE,CAAEO,YAAY,EAAES,GAAG,CAAG,CAAG;IAAA,GACxCJ;EAAS,CACd,CAAC;AAEJ;AAEA,eAAeb,UAAU,CAAEM,IAAK,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useContext } from '@wordpress/element';
|
|
5
5
|
import { useObservableValue } from '@wordpress/compose';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -11,15 +11,8 @@ import SlotFillContext from './slot-fill-context';
|
|
|
11
11
|
export default function useSlot(name) {
|
|
12
12
|
const registry = useContext(SlotFillContext);
|
|
13
13
|
const slot = useObservableValue(registry.slots, name);
|
|
14
|
-
const api = useMemo(() => ({
|
|
15
|
-
updateSlot: fillProps => registry.updateSlot(name, fillProps),
|
|
16
|
-
unregisterSlot: ref => registry.unregisterSlot(name, ref),
|
|
17
|
-
registerFill: ref => registry.registerFill(name, ref),
|
|
18
|
-
unregisterFill: ref => registry.unregisterFill(name, ref)
|
|
19
|
-
}), [name, registry]);
|
|
20
14
|
return {
|
|
21
|
-
...slot
|
|
22
|
-
...api
|
|
15
|
+
...slot
|
|
23
16
|
};
|
|
24
17
|
}
|
|
25
18
|
//# sourceMappingURL=use-slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useContext","useObservableValue","SlotFillContext","useSlot","name","registry","slot","slots"],"sources":["@wordpress/components/src/slot-fill/bubbles-virtually/use-slot.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\nimport { useObservableValue } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './slot-fill-context';\nimport type { SlotKey } from '../types';\n\nexport default function useSlot( name: SlotKey ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slot = useObservableValue( registry.slots, name );\n\treturn { ...slot };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,kBAAkB,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,OAAOC,eAAe,MAAM,qBAAqB;AAGjD,eAAe,SAASC,OAAOA,CAAEC,IAAa,EAAG;EAChD,MAAMC,QAAQ,GAAGL,UAAU,CAAEE,eAAgB,CAAC;EAC9C,MAAMI,IAAI,GAAGL,kBAAkB,CAAEI,QAAQ,CAACE,KAAK,EAAEH,IAAK,CAAC;EACvD,OAAO;IAAE,GAAGE;EAAK,CAAC;AACnB","ignoreList":[]}
|
|
@@ -12,10 +12,7 @@ export default function Fill({
|
|
|
12
12
|
name,
|
|
13
13
|
children
|
|
14
14
|
}) {
|
|
15
|
-
const
|
|
16
|
-
registerFill,
|
|
17
|
-
unregisterFill
|
|
18
|
-
} = useContext(SlotFillContext);
|
|
15
|
+
const registry = useContext(SlotFillContext);
|
|
19
16
|
const slot = useSlot(name);
|
|
20
17
|
const ref = useRef({
|
|
21
18
|
name,
|
|
@@ -23,30 +20,16 @@ export default function Fill({
|
|
|
23
20
|
});
|
|
24
21
|
useLayoutEffect(() => {
|
|
25
22
|
const refValue = ref.current;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, []);
|
|
23
|
+
refValue.name = name;
|
|
24
|
+
registry.registerFill(name, refValue);
|
|
25
|
+
return () => registry.unregisterFill(name, refValue);
|
|
26
|
+
}, [registry, name]);
|
|
31
27
|
useLayoutEffect(() => {
|
|
32
28
|
ref.current.children = children;
|
|
33
29
|
if (slot) {
|
|
34
|
-
slot.
|
|
30
|
+
slot.rerender();
|
|
35
31
|
}
|
|
36
|
-
|
|
37
|
-
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
38
|
-
}, [children]);
|
|
39
|
-
useLayoutEffect(() => {
|
|
40
|
-
if (name === ref.current.name) {
|
|
41
|
-
// Ignore initial effect.
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
unregisterFill(ref.current.name, ref.current);
|
|
45
|
-
ref.current.name = name;
|
|
46
|
-
registerFill(name, ref.current);
|
|
47
|
-
// The useLayoutEffects here are written to fire at specific times, and introducing new dependencies could cause unexpected changes in behavior.
|
|
48
|
-
// We'll leave them as-is until a more detailed investigation/refactor can be performed.
|
|
49
|
-
}, [name]);
|
|
32
|
+
}, [slot, children]);
|
|
50
33
|
return null;
|
|
51
34
|
}
|
|
52
35
|
//# sourceMappingURL=fill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useContext","useLayoutEffect","useRef","SlotFillContext","useSlot","Fill","name","children","
|
|
1
|
+
{"version":3,"names":["useContext","useLayoutEffect","useRef","SlotFillContext","useSlot","Fill","name","children","registry","slot","ref","refValue","current","registerFill","unregisterFill","rerender"],"sources":["@wordpress/components/src/slot-fill/fill.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useContext, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport useSlot from './use-slot';\nimport type { FillComponentProps } from './types';\n\nexport default function Fill( { name, children }: FillComponentProps ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst slot = useSlot( name );\n\n\tconst ref = useRef( {\n\t\tname,\n\t\tchildren,\n\t} );\n\n\tuseLayoutEffect( () => {\n\t\tconst refValue = ref.current;\n\t\trefValue.name = name;\n\t\tregistry.registerFill( name, refValue );\n\t\treturn () => registry.unregisterFill( name, refValue );\n\t}, [ registry, name ] );\n\n\tuseLayoutEffect( () => {\n\t\tref.current.children = children;\n\t\tif ( slot ) {\n\t\t\tslot.rerender();\n\t\t}\n\t}, [ slot, children ] );\n\n\treturn null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,eAAe,EAAEC,MAAM,QAAQ,oBAAoB;;AAExE;AACA;AACA;AACA,OAAOC,eAAe,MAAM,WAAW;AACvC,OAAOC,OAAO,MAAM,YAAY;AAGhC,eAAe,SAASC,IAAIA,CAAE;EAAEC,IAAI;EAAEC;AAA6B,CAAC,EAAG;EACtE,MAAMC,QAAQ,GAAGR,UAAU,CAAEG,eAAgB,CAAC;EAC9C,MAAMM,IAAI,GAAGL,OAAO,CAAEE,IAAK,CAAC;EAE5B,MAAMI,GAAG,GAAGR,MAAM,CAAE;IACnBI,IAAI;IACJC;EACD,CAAE,CAAC;EAEHN,eAAe,CAAE,MAAM;IACtB,MAAMU,QAAQ,GAAGD,GAAG,CAACE,OAAO;IAC5BD,QAAQ,CAACL,IAAI,GAAGA,IAAI;IACpBE,QAAQ,CAACK,YAAY,CAAEP,IAAI,EAAEK,QAAS,CAAC;IACvC,OAAO,MAAMH,QAAQ,CAACM,cAAc,CAAER,IAAI,EAAEK,QAAS,CAAC;EACvD,CAAC,EAAE,CAAEH,QAAQ,EAAEF,IAAI,CAAG,CAAC;EAEvBL,eAAe,CAAE,MAAM;IACtBS,GAAG,CAACE,OAAO,CAACL,QAAQ,GAAGA,QAAQ;IAC/B,IAAKE,IAAI,EAAG;MACXA,IAAI,CAACM,QAAQ,CAAC,CAAC;IAChB;EACD,CAAC,EAAE,CAAEN,IAAI,EAAEF,QAAQ,CAAG,CAAC;EAEvB,OAAO,IAAI;AACZ","ignoreList":[]}
|
|
@@ -77,18 +77,15 @@ export function createSlotFill(key) {
|
|
|
77
77
|
...props
|
|
78
78
|
});
|
|
79
79
|
SlotComponent.displayName = `${baseName}Slot`;
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated 6.8.0
|
|
82
|
+
* Please use `slotFill.name` instead of `slotFill.Slot.__unstableName`.
|
|
83
|
+
*/
|
|
80
84
|
SlotComponent.__unstableName = key;
|
|
81
85
|
return {
|
|
86
|
+
name: key,
|
|
82
87
|
Fill: FillComponent,
|
|
83
88
|
Slot: SlotComponent
|
|
84
89
|
};
|
|
85
90
|
}
|
|
86
|
-
export const createPrivateSlotFill = name => {
|
|
87
|
-
const privateKey = Symbol(name);
|
|
88
|
-
const privateSlotFill = createSlotFill(privateKey);
|
|
89
|
-
return {
|
|
90
|
-
privateKey,
|
|
91
|
-
...privateSlotFill
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
91
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useContext","BaseFill","BaseSlot","BubblesVirtuallyFill","BubblesVirtuallySlot","BubblesVirtuallySlotFillProvider","SlotFillProvider","SlotFillContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","default","useSlot","useSlotFills","Fill","props","children","UnforwardedSlot","ref","bubblesVirtually","restProps","Slot","Provider","passthrough","parent","isDefault","displayName","createSlotFill","key","baseName","description","FillComponent","name","SlotComponent","__unstableName"
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","BaseFill","BaseSlot","BubblesVirtuallyFill","BubblesVirtuallySlot","BubblesVirtuallySlotFillProvider","SlotFillProvider","SlotFillContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","default","useSlot","useSlotFills","Fill","props","children","UnforwardedSlot","ref","bubblesVirtually","restProps","Slot","Provider","passthrough","parent","isDefault","displayName","createSlotFill","key","baseName","description","FillComponent","name","SlotComponent","__unstableName"],"sources":["@wordpress/components/src/slot-fill/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseFill from './fill';\nimport BaseSlot from './slot';\nimport BubblesVirtuallyFill from './bubbles-virtually/fill';\nimport BubblesVirtuallySlot from './bubbles-virtually/slot';\nimport BubblesVirtuallySlotFillProvider from './bubbles-virtually/slot-fill-provider';\nimport SlotFillProvider from './provider';\nimport SlotFillContext from './bubbles-virtually/slot-fill-context';\nimport type { WordPressComponentProps } from '../context';\n\nexport { default as useSlot } from './bubbles-virtually/use-slot';\nexport { default as useSlotFills } from './bubbles-virtually/use-slot-fills';\nimport type {\n\tDistributiveOmit,\n\tFillComponentProps,\n\tSlotComponentProps,\n\tSlotFillProviderProps,\n\tSlotKey,\n} from './types';\n\nexport function Fill( props: FillComponentProps ) {\n\t// We're adding both Fills here so they can register themselves before\n\t// their respective slot has been registered. Only the Fill that has a slot\n\t// will render. The other one will return null.\n\treturn (\n\t\t<>\n\t\t\t<BaseFill { ...props } />\n\t\t\t<BubblesVirtuallyFill { ...props } />\n\t\t</>\n\t);\n}\n\nexport function UnforwardedSlot(\n\tprops: SlotComponentProps &\n\t\tOmit< WordPressComponentProps< {}, 'div' >, 'className' >,\n\tref: ForwardedRef< any >\n) {\n\tconst { bubblesVirtually, ...restProps } = props;\n\tif ( bubblesVirtually ) {\n\t\treturn <BubblesVirtuallySlot { ...restProps } ref={ ref } />;\n\t}\n\treturn <BaseSlot { ...restProps } />;\n}\nexport const Slot = forwardRef( UnforwardedSlot );\n\nexport function Provider( {\n\tchildren,\n\tpassthrough = false,\n}: SlotFillProviderProps ) {\n\tconst parent = useContext( SlotFillContext );\n\tif ( ! parent.isDefault && passthrough ) {\n\t\treturn <>{ children }</>;\n\t}\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<BubblesVirtuallySlotFillProvider>\n\t\t\t\t{ children }\n\t\t\t</BubblesVirtuallySlotFillProvider>\n\t\t</SlotFillProvider>\n\t);\n}\nProvider.displayName = 'SlotFillProvider';\n\nexport function createSlotFill( key: SlotKey ) {\n\tconst baseName = typeof key === 'symbol' ? key.description : key;\n\tconst FillComponent = ( props: Omit< FillComponentProps, 'name' > ) => (\n\t\t<Fill name={ key } { ...props } />\n\t);\n\tFillComponent.displayName = `${ baseName }Fill`;\n\n\tconst SlotComponent = (\n\t\tprops: DistributiveOmit< SlotComponentProps, 'name' >\n\t) => <Slot name={ key } { ...props } />;\n\tSlotComponent.displayName = `${ baseName }Slot`;\n\t/**\n\t * @deprecated 6.8.0\n\t * Please use `slotFill.name` instead of `slotFill.Slot.__unstableName`.\n\t */\n\tSlotComponent.__unstableName = key;\n\n\treturn {\n\t\tname: key,\n\t\tFill: FillComponent,\n\t\tSlot: SlotComponent,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;AACA,OAAOC,QAAQ,MAAM,QAAQ;AAC7B,OAAOC,QAAQ,MAAM,QAAQ;AAC7B,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,oBAAoB,MAAM,0BAA0B;AAC3D,OAAOC,gCAAgC,MAAM,wCAAwC;AACrF,OAAOC,gBAAgB,MAAM,YAAY;AACzC,OAAOC,eAAe,MAAM,uCAAuC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAGpE,SAASC,OAAO,IAAIC,OAAO,QAAQ,8BAA8B;AACjE,SAASD,OAAO,IAAIE,YAAY,QAAQ,oCAAoC;AAS5E,OAAO,SAASC,IAAIA,CAAEC,KAAyB,EAAG;EACjD;EACA;EACA;EACA,oBACCL,KAAA,CAAAF,SAAA;IAAAQ,QAAA,gBACCV,IAAA,CAACR,QAAQ;MAAA,GAAMiB;IAAK,CAAI,CAAC,eACzBT,IAAA,CAACN,oBAAoB;MAAA,GAAMe;IAAK,CAAI,CAAC;EAAA,CACpC,CAAC;AAEL;AAEA,OAAO,SAASE,eAAeA,CAC9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AI,CAAC;EACvCkB,aAAa,CAACP,WAAW,GAAG,GAAIG,QAAQ,MAAO;EAC/C;AACD;AACA;AACA;EACCI,aAAa,CAACC,cAAc,GAAGN,GAAG;EAElC,OAAO;IACNI,IAAI,EAAEJ,GAAG;IACTd,IAAI,EAAEiB,aAAa;IACnBV,IAAI,EAAEY;EACP,CAAC;AACF","ignoreList":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
4
|
import { useState } from '@wordpress/element';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -27,7 +26,7 @@ function createSlotRegistry() {
|
|
|
27
26
|
// assigned into the instance, such that its own rendering of children
|
|
28
27
|
// will be empty (the new Slot will subsume all fills for this name).
|
|
29
28
|
if (previousSlot) {
|
|
30
|
-
previousSlot.
|
|
29
|
+
previousSlot.rerender();
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
function registerFill(name, instance) {
|
|
@@ -63,7 +62,7 @@ function createSlotRegistry() {
|
|
|
63
62
|
function forceUpdateSlot(name) {
|
|
64
63
|
const slot = getSlot(name);
|
|
65
64
|
if (slot) {
|
|
66
|
-
slot.
|
|
65
|
+
slot.rerender();
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
function triggerListeners() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useState","SlotFillContext","jsx","_jsx","createSlotRegistry","slots","fills","listeners","registerSlot","name","slot","previousSlot","triggerListeners","forceUpdateSlot","
|
|
1
|
+
{"version":3,"names":["useState","SlotFillContext","jsx","_jsx","createSlotRegistry","slots","fills","listeners","registerSlot","name","slot","previousSlot","triggerListeners","forceUpdateSlot","rerender","registerFill","instance","unregisterSlot","unregisterFill","_fills$name$filter","filter","fill","getSlot","getFills","slotInstance","forEach","listener","subscribe","push","l","SlotFillProvider","children","contextValue","Provider","value"],"sources":["@wordpress/components/src/slot-fill/provider.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type {\n\tFillComponentProps,\n\tBaseSlotFillContext,\n\tSlotFillProviderProps,\n\tSlotKey,\n\tRerenderable,\n} from './types';\n\nfunction createSlotRegistry(): BaseSlotFillContext {\n\tconst slots: Record< SlotKey, Rerenderable > = {};\n\tconst fills: Record< SlotKey, FillComponentProps[] > = {};\n\tlet listeners: Array< () => void > = [];\n\n\tfunction registerSlot( name: SlotKey, slot: Rerenderable ) {\n\t\tconst previousSlot = slots[ name ];\n\t\tslots[ name ] = slot;\n\t\ttriggerListeners();\n\n\t\t// Sometimes the fills are registered after the initial render of slot\n\t\t// But before the registerSlot call, we need to rerender the slot.\n\t\tforceUpdateSlot( name );\n\n\t\t// If a new instance of a slot is being mounted while another with the\n\t\t// same name exists, force its update _after_ the new slot has been\n\t\t// assigned into the instance, such that its own rendering of children\n\t\t// will be empty (the new Slot will subsume all fills for this name).\n\t\tif ( previousSlot ) {\n\t\t\tpreviousSlot.rerender();\n\t\t}\n\t}\n\n\tfunction registerFill( name: SlotKey, instance: FillComponentProps ) {\n\t\tfills[ name ] = [ ...( fills[ name ] || [] ), instance ];\n\t\tforceUpdateSlot( name );\n\t}\n\n\tfunction unregisterSlot( name: SlotKey, instance: Rerenderable ) {\n\t\t// If a previous instance of a Slot by this name unmounts, do nothing,\n\t\t// as the slot and its fills should only be removed for the current\n\t\t// known instance.\n\t\tif ( slots[ name ] !== instance ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdelete slots[ name ];\n\t\ttriggerListeners();\n\t}\n\n\tfunction unregisterFill( name: SlotKey, instance: FillComponentProps ) {\n\t\tfills[ name ] =\n\t\t\tfills[ name ]?.filter( ( fill ) => fill !== instance ) ?? [];\n\t\tforceUpdateSlot( name );\n\t}\n\n\tfunction getSlot( name: SlotKey ): Rerenderable | undefined {\n\t\treturn slots[ name ];\n\t}\n\n\tfunction getFills(\n\t\tname: SlotKey,\n\t\tslotInstance: Rerenderable\n\t): FillComponentProps[] {\n\t\t// Fills should only be returned for the current instance of the slot\n\t\t// in which they occupy.\n\t\tif ( slots[ name ] !== slotInstance ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn fills[ name ];\n\t}\n\n\tfunction forceUpdateSlot( name: SlotKey ) {\n\t\tconst slot = getSlot( name );\n\n\t\tif ( slot ) {\n\t\t\tslot.rerender();\n\t\t}\n\t}\n\n\tfunction triggerListeners() {\n\t\tlisteners.forEach( ( listener ) => listener() );\n\t}\n\n\tfunction subscribe( listener: () => void ) {\n\t\tlisteners.push( listener );\n\n\t\treturn () => {\n\t\t\tlisteners = listeners.filter( ( l ) => l !== listener );\n\t\t};\n\t}\n\n\treturn {\n\t\tregisterSlot,\n\t\tunregisterSlot,\n\t\tregisterFill,\n\t\tunregisterFill,\n\t\tgetSlot,\n\t\tgetFills,\n\t\tsubscribe,\n\t};\n}\n\nexport function SlotFillProvider( { children }: SlotFillProviderProps ) {\n\tconst [ contextValue ] = useState( createSlotRegistry );\n\treturn (\n\t\t<SlotFillContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</SlotFillContext.Provider>\n\t);\n}\n\nexport default SlotFillProvider;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,eAAe,MAAM,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASxC,SAASC,kBAAkBA,CAAA,EAAwB;EAClD,MAAMC,KAAsC,GAAG,CAAC,CAAC;EACjD,MAAMC,KAA8C,GAAG,CAAC,CAAC;EACzD,IAAIC,SAA8B,GAAG,EAAE;EAEvC,SAASC,YAAYA,CAAEC,IAAa,EAAEC,IAAkB,EAAG;IAC1D,MAAMC,YAAY,GAAGN,KAAK,CAAEI,IAAI,CAAE;IAClCJ,KAAK,CAAEI,IAAI,CAAE,GAAGC,IAAI;IACpBE,gBAAgB,CAA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AKC,IAAI,EAAG;MACXA,IAAI,CAACI,QAAQ,CAAC,CAAC;IAChB;EACD;EAEA,SAASF,gBAAgBA,CAAA,EAAG;IAC3BL,SAAS,CAACkB,OAAO,CAAIC,QAAQ,IAAMA,QAAQ,CAAC,CAAE,CAAC;EAChD;EAEA,SAASC,SAASA,CAAED,QAAoB,EAAG;IAC1CnB,SAAS,CAACqB,IAAI,CAAEF,QAAS,CAAC;IAE1B,OAAO,MAAM;MACZnB,SAAS,GAAGA,SAAS,CAACa,MAAM,CAAIS,CAAC,IAAMA,CAAC,KAAKH,QAAS,CAAC;IACxD,CAAC;EACF;EAEA,OAAO;IACNlB,YAAY;IACZS,cAAc;IACdF,YAAY;IACZG,cAAc;IACdI,OAAO;IACPC,QAAQ;IACRI;EACD,CAAC;AACF;AAEA,OAAO,SAASG,gBAAgBA,CAAE;EAAEC;AAAgC,CAAC,EAAG;EACvE,MAAM,CAAEC,YAAY,CAAE,GAAGhC,QAAQ,CAAEI,kBAAmB,CAAC;EACvD,oBACCD,IAAA,CAACF,eAAe,CAACgC,QAAQ;IAACC,KAAK,EAAGF,YAAc;IAAAD,QAAA,EAC7CA;EAAQ,CACe,CAAC;AAE7B;AAEA,eAAeD,gBAAgB","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* WordPress dependencies
|
|
7
7
|
*/
|
|
8
|
-
import {
|
|
8
|
+
import { useContext, useEffect, useReducer, useRef, Children, cloneElement, isEmptyElement } from '@wordpress/element';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
@@ -21,85 +21,45 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
21
21
|
function isFunction(maybeFunc) {
|
|
22
22
|
return typeof maybeFunc === 'function';
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
forceUpdate() {
|
|
55
|
-
if (this.isUnmounted) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
super.forceUpdate();
|
|
59
|
-
}
|
|
60
|
-
render() {
|
|
61
|
-
var _getFills;
|
|
62
|
-
const {
|
|
63
|
-
children,
|
|
64
|
-
name,
|
|
65
|
-
fillProps = {},
|
|
66
|
-
getFills
|
|
67
|
-
} = this.props;
|
|
68
|
-
const fills = ((_getFills = getFills(name, this)) !== null && _getFills !== void 0 ? _getFills : []).map(fill => {
|
|
69
|
-
const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
|
|
70
|
-
return Children.map(fillChildren, (child, childIndex) => {
|
|
71
|
-
if (!child || typeof child === 'string') {
|
|
72
|
-
return child;
|
|
73
|
-
}
|
|
74
|
-
let childKey = childIndex;
|
|
75
|
-
if (typeof child === 'object' && 'key' in child && child?.key) {
|
|
76
|
-
childKey = child.key;
|
|
77
|
-
}
|
|
78
|
-
return cloneElement(child, {
|
|
79
|
-
key: childKey
|
|
80
|
-
});
|
|
24
|
+
function Slot(props) {
|
|
25
|
+
var _registry$getFills;
|
|
26
|
+
const registry = useContext(SlotFillContext);
|
|
27
|
+
const [, rerender] = useReducer(() => [], []);
|
|
28
|
+
const ref = useRef({
|
|
29
|
+
rerender
|
|
30
|
+
});
|
|
31
|
+
const {
|
|
32
|
+
name,
|
|
33
|
+
children,
|
|
34
|
+
fillProps = {}
|
|
35
|
+
} = props;
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
const refValue = ref.current;
|
|
38
|
+
registry.registerSlot(name, refValue);
|
|
39
|
+
return () => registry.unregisterSlot(name, refValue);
|
|
40
|
+
}, [registry, name]);
|
|
41
|
+
const fills = ((_registry$getFills = registry.getFills(name, ref.current)) !== null && _registry$getFills !== void 0 ? _registry$getFills : []).map(fill => {
|
|
42
|
+
const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
|
|
43
|
+
return Children.map(fillChildren, (child, childIndex) => {
|
|
44
|
+
if (!child || typeof child === 'string') {
|
|
45
|
+
return child;
|
|
46
|
+
}
|
|
47
|
+
let childKey = childIndex;
|
|
48
|
+
if (typeof child === 'object' && 'key' in child && child?.key) {
|
|
49
|
+
childKey = child.key;
|
|
50
|
+
}
|
|
51
|
+
return cloneElement(child, {
|
|
52
|
+
key: childKey
|
|
81
53
|
});
|
|
82
|
-
}).filter(
|
|
83
|
-
// In some cases fills are rendered only when some conditions apply.
|
|
84
|
-
// This ensures that we only use non-empty fills when rendering, i.e.,
|
|
85
|
-
// it allows us to render wrappers only when the fills are actually present.
|
|
86
|
-
element => !isEmptyElement(element));
|
|
87
|
-
return /*#__PURE__*/_jsx(_Fragment, {
|
|
88
|
-
children: isFunction(children) ? children(fills) : fills
|
|
89
54
|
});
|
|
90
|
-
}
|
|
55
|
+
}).filter(
|
|
56
|
+
// In some cases fills are rendered only when some conditions apply.
|
|
57
|
+
// This ensures that we only use non-empty fills when rendering, i.e.,
|
|
58
|
+
// it allows us to render wrappers only when the fills are actually present.
|
|
59
|
+
element => !isEmptyElement(element));
|
|
60
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
61
|
+
children: isFunction(children) ? children(fills) : fills
|
|
62
|
+
});
|
|
91
63
|
}
|
|
92
|
-
const Slot = props => /*#__PURE__*/_jsx(SlotFillContext.Consumer, {
|
|
93
|
-
children: ({
|
|
94
|
-
registerSlot,
|
|
95
|
-
unregisterSlot,
|
|
96
|
-
getFills
|
|
97
|
-
}) => /*#__PURE__*/_jsx(SlotComponent, {
|
|
98
|
-
...props,
|
|
99
|
-
registerSlot: registerSlot,
|
|
100
|
-
unregisterSlot: unregisterSlot,
|
|
101
|
-
getFills: getFills
|
|
102
|
-
})
|
|
103
|
-
});
|
|
104
64
|
export default Slot;
|
|
105
65
|
//# sourceMappingURL=slot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useContext","useEffect","useReducer","useRef","Children","cloneElement","isEmptyElement","SlotFillContext","Fragment","_Fragment","jsx","_jsx","isFunction","maybeFunc","Slot","props","_registry$getFills","registry","rerender","ref","name","children","fillProps","refValue","current","registerSlot","unregisterSlot","fills","getFills","map","fill","fillChildren","child","childIndex","childKey","key","filter","element"],"sources":["@wordpress/components/src/slot-fill/slot.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactElement, ReactNode, Key } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseContext,\n\tuseEffect,\n\tuseReducer,\n\tuseRef,\n\tChildren,\n\tcloneElement,\n\tisEmptyElement,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SlotFillContext from './context';\nimport type { SlotComponentProps } from './types';\n\n/**\n * Whether the argument is a function.\n *\n * @param maybeFunc The argument to check.\n * @return True if the argument is a function, false otherwise.\n */\nfunction isFunction( maybeFunc: any ): maybeFunc is Function {\n\treturn typeof maybeFunc === 'function';\n}\n\nfunction Slot( props: Omit< SlotComponentProps, 'bubblesVirtually' > ) {\n\tconst registry = useContext( SlotFillContext );\n\tconst [ , rerender ] = useReducer( () => [], [] );\n\tconst ref = useRef( { rerender } );\n\n\tconst { name, children, fillProps = {} } = props;\n\n\tuseEffect( () => {\n\t\tconst refValue = ref.current;\n\t\tregistry.registerSlot( name, refValue );\n\t\treturn () => registry.unregisterSlot( name, refValue );\n\t}, [ registry, name ] );\n\n\tconst fills: ReactNode[] = ( registry.getFills( name, ref.current ) ?? [] )\n\t\t.map( ( fill ) => {\n\t\t\tconst fillChildren = isFunction( fill.children )\n\t\t\t\t? fill.children( fillProps )\n\t\t\t\t: fill.children;\n\t\t\treturn Children.map( fillChildren, ( child, childIndex ) => {\n\t\t\t\tif ( ! child || typeof child === 'string' ) {\n\t\t\t\t\treturn child;\n\t\t\t\t}\n\t\t\t\tlet childKey: Key = childIndex;\n\t\t\t\tif (\n\t\t\t\t\ttypeof child === 'object' &&\n\t\t\t\t\t'key' in child &&\n\t\t\t\t\tchild?.key\n\t\t\t\t) {\n\t\t\t\t\tchildKey = child.key;\n\t\t\t\t}\n\n\t\t\t\treturn cloneElement( child as ReactElement, {\n\t\t\t\t\tkey: childKey,\n\t\t\t\t} );\n\t\t\t} );\n\t\t} )\n\t\t.filter(\n\t\t\t// In some cases fills are rendered only when some conditions apply.\n\t\t\t// This ensures that we only use non-empty fills when rendering, i.e.,\n\t\t\t// it allows us to render wrappers only when the fills are actually present.\n\t\t\t( element ) => ! isEmptyElement( element )\n\t\t);\n\n\treturn <>{ isFunction( children ) ? children( fills ) : fills }</>;\n}\n\nexport default Slot;\n"],"mappings":"AAAA;AACA;AACA;;AAGA;AACA;AACA;AACA,SACCA,UAAU,EACVC,SAAS,EACTC,UAAU,EACVC,MAAM,EACNC,QAAQ,EACRC,YAAY,EACZC,cAAc,QACR,oBAAoB;;AAE3B;AACA;AACA;AACA,OAAOC,eAAe,MAAM,WAAW;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAGxC;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,UAAUA,CAAEC,SAAc,EAA0B;EAC5D,OAAO,OAAOA,SAAS,KAAK,UAAU;AACvC;AAEA,SAASC,IAAIA,CAAEC,KAAqD,EAAG;EAAA,IAAAC,kBAAA;EACtE,MAAMC,QAAQ,GAAGjB,UAAU,CAAEO,eAAgB,CAAC;EAC9C,MAAM,GAAIW,QAAQ,CAAE,GAAGhB,UAAU,CAAE,MAAM,EAAE,EAAE,EAAG,CAAC;EACjD,MAAMiB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AO,IAAM,CAAE/B,cAAc,CAAE+B,OAAQ,CAC1C,CAAC;EAEF,oBAAO1B,IAAA,CAAAF,SAAA;IAAAY,QAAA,EAAIT,UAAU,CAAES,QAAS,CAAC,GAAGA,QAAQ,CAAEM,KAAM,CAAC,GAAGA;EAAK,CAAI,CAAC;AACnE;AAEA,eAAeb,IAAI","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/components/src/slot-fill/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type {
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/components/src/slot-fill/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, RefObject } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport type { ObservableMap } from '@wordpress/compose';\n\nexport type DistributiveOmit< T, K extends keyof any > = T extends any\n\t? Omit< T, K >\n\t: never;\n\nexport type SlotKey = string | symbol;\n\nexport type FillProps = Record< string, any >;\n\ntype SlotPropBase = {\n\t/**\n\t * Slot name.\n\t */\n\tname: SlotKey;\n\n\t/**\n\t * props to pass from `Slot` to `Fill`.\n\t *\n\t * @default {}\n\t */\n\tfillProps?: FillProps;\n};\n\nexport type SlotComponentProps =\n\t| ( SlotPropBase & {\n\t\t\t/**\n\t\t\t * By default, events will bubble to their parents on the DOM hierarchy (native event bubbling).\n\t\t\t * If set to true, events will bubble to their virtual parent in the React elements hierarchy instead,\n\t\t\t * also accept an optional `className`, `id`, etc. to add to the slot container.\n\t\t\t */\n\t\t\tbubblesVirtually: true;\n\n\t\t\t/**\n\t\t\t * A function that returns nodes to be rendered.\n\t\t\t * Supported only when `bubblesVirtually` is `false`.\n\t\t\t */\n\t\t\tchildren?: never;\n\n\t\t\t/**\n\t\t\t * Additional className for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tclassName?: string;\n\n\t\t\t/**\n\t\t\t * Additional styles for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tstyle?: React.CSSProperties;\n\t } )\n\t| ( SlotPropBase & {\n\t\t\t/**\n\t\t\t * By default, events will bubble to their parents on the DOM hierarchy (native event bubbling).\n\t\t\t * If set to true, events will bubble to their virtual parent in the React elements hierarchy instead,\n\t\t\t * also accept an optional `className`, `id`, etc. to add to the slot container.\n\t\t\t */\n\t\t\tbubblesVirtually?: false;\n\n\t\t\t/**\n\t\t\t * A function that returns nodes to be rendered.\n\t\t\t * Supported only when `bubblesVirtually` is `false`.\n\t\t\t */\n\t\t\tchildren?: ( fills: ReactNode ) => ReactNode;\n\n\t\t\t/**\n\t\t\t * Additional className for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tclassName?: never;\n\n\t\t\t/**\n\t\t\t * Additional styles for the `Slot` component.\n\t\t\t * Supported only when `bubblesVirtually` is `true`.\n\t\t\t */\n\t\t\tstyle?: never;\n\t } );\n\nexport type FillComponentProps = {\n\t/**\n\t * The name of the slot to fill into.\n\t */\n\tname: SlotKey;\n\n\t/**\n\t * Children elements or render function.\n\t */\n\tchildren?: ReactNode | ( ( fillProps: FillProps ) => ReactNode );\n};\n\nexport type SlotFillProviderProps = {\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n\n\t/**\n\t * Whether to pass slots to the parent provider if existent.\n\t */\n\tpassthrough?: boolean;\n};\n\nexport type SlotRef = RefObject< HTMLElement >;\nexport type Rerenderable = { rerender: () => void };\n\nexport type SlotFillBubblesVirtuallyContext = {\n\tslots: ObservableMap< SlotKey, { ref: SlotRef; fillProps: FillProps } >;\n\tfills: ObservableMap< SlotKey, Rerenderable[] >;\n\tregisterSlot: ( name: SlotKey, ref: SlotRef, fillProps: FillProps ) => void;\n\tunregisterSlot: ( name: SlotKey, ref: SlotRef ) => void;\n\tupdateSlot: ( name: SlotKey, ref: SlotRef, fillProps: FillProps ) => void;\n\tregisterFill: ( name: SlotKey, ref: Rerenderable ) => void;\n\tunregisterFill: ( name: SlotKey, ref: Rerenderable ) => void;\n\n\t/**\n\t * This helps the provider know if it's using the default context value or not.\n\t */\n\tisDefault?: boolean;\n};\n\nexport type BaseSlotFillContext = {\n\tregisterSlot: ( name: SlotKey, slot: Rerenderable ) => void;\n\tunregisterSlot: ( name: SlotKey, slot: Rerenderable ) => void;\n\tregisterFill: ( name: SlotKey, instance: FillComponentProps ) => void;\n\tunregisterFill: ( name: SlotKey, instance: FillComponentProps ) => void;\n\tgetSlot: ( name: SlotKey ) => Rerenderable | undefined;\n\tgetFills: (\n\t\tname: SlotKey,\n\t\tslotInstance: Rerenderable\n\t) => FillComponentProps[];\n\tsubscribe: ( listener: () => void ) => () => void;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ import { forwardRef } from '@wordpress/element';
|
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
import BaseControl from '../base-control';
|
|
17
|
+
import { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
function UnforwardedTextControl(props, ref) {
|
|
19
20
|
const {
|
|
@@ -31,6 +32,11 @@ function UnforwardedTextControl(props, ref) {
|
|
|
31
32
|
} = props;
|
|
32
33
|
const id = useInstanceId(TextControl, 'inspector-text-control', idProp);
|
|
33
34
|
const onChangeValue = event => onChange(event.target.value);
|
|
35
|
+
maybeWarnDeprecated36pxSize({
|
|
36
|
+
componentName: 'TextControl',
|
|
37
|
+
size: undefined,
|
|
38
|
+
__next40pxDefaultSize
|
|
39
|
+
});
|
|
34
40
|
return /*#__PURE__*/_jsx(BaseControl, {
|
|
35
41
|
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
|
|
36
42
|
__associatedWPComponentName: "TextControl",
|
|
@@ -67,6 +73,7 @@ function UnforwardedTextControl(props, ref) {
|
|
|
67
73
|
* return (
|
|
68
74
|
* <TextControl
|
|
69
75
|
* __nextHasNoMarginBottom
|
|
76
|
+
* __next40pxDefaultSize
|
|
70
77
|
* label="Additional CSS Class"
|
|
71
78
|
* value={ className }
|
|
72
79
|
* onChange={ ( value ) => setClassName( value ) }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useInstanceId","forwardRef","BaseControl","jsx","_jsx","UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","__next40pxDefaultSize","label","hideLabelFromVision","value","help","id","idProp","className","onChange","type","additionalProps","TextControl","onChangeValue","event","target","
|
|
1
|
+
{"version":3,"names":["clsx","useInstanceId","forwardRef","BaseControl","maybeWarnDeprecated36pxSize","jsx","_jsx","UnforwardedTextControl","props","ref","__nextHasNoMarginBottom","__next40pxDefaultSize","label","hideLabelFromVision","value","help","id","idProp","className","onChange","type","additionalProps","TextControl","onChangeValue","event","target","componentName","size","undefined","__associatedWPComponentName","children"],"sources":["@wordpress/components/src/text-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ChangeEvent, ForwardedRef } from 'react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BaseControl from '../base-control';\nimport type { WordPressComponentProps } from '../context';\nimport type { TextControlProps } from './types';\nimport { maybeWarnDeprecated36pxSize } from '../utils/deprecated-36px-size';\n\nfunction UnforwardedTextControl(\n\tprops: WordPressComponentProps< TextControlProps, 'input', false >,\n\tref: ForwardedRef< HTMLInputElement >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom,\n\t\t__next40pxDefaultSize = false,\n\t\tlabel,\n\t\thideLabelFromVision,\n\t\tvalue,\n\t\thelp,\n\t\tid: idProp,\n\t\tclassName,\n\t\tonChange,\n\t\ttype = 'text',\n\t\t...additionalProps\n\t} = props;\n\tconst id = useInstanceId( TextControl, 'inspector-text-control', idProp );\n\tconst onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>\n\t\tonChange( event.target.value );\n\n\tmaybeWarnDeprecated36pxSize( {\n\t\tcomponentName: 'TextControl',\n\t\tsize: undefined,\n\t\t__next40pxDefaultSize,\n\t} );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t__associatedWPComponentName=\"TextControl\"\n\t\t\tlabel={ label }\n\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\tid={ id }\n\t\t\thelp={ help }\n\t\t\tclassName={ className }\n\t\t>\n\t\t\t<input\n\t\t\t\tclassName={ clsx( 'components-text-control__input', {\n\t\t\t\t\t'is-next-40px-default-size': __next40pxDefaultSize,\n\t\t\t\t} ) }\n\t\t\t\ttype={ type }\n\t\t\t\tid={ id }\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChangeValue }\n\t\t\t\taria-describedby={ !! help ? id + '__help' : undefined }\n\t\t\t\tref={ ref }\n\t\t\t\t{ ...additionalProps }\n\t\t\t/>\n\t\t</BaseControl>\n\t);\n}\n\n/**\n * TextControl components let users enter and edit text.\n *\n * ```jsx\n * import { TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyTextControl = () => {\n * const [ className, setClassName ] = useState( '' );\n *\n * return (\n * <TextControl\n * __nextHasNoMarginBottom\n * __next40pxDefaultSize\n * label=\"Additional CSS Class\"\n * value={ className }\n * onChange={ ( value ) => setClassName( value ) }\n * />\n * );\n * };\n * ```\n */\nexport const TextControl = forwardRef( UnforwardedTextControl );\n\nexport default TextControl;\n"],"mappings":"AAAA;AACA;AACA;;AAEA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA;AACA;AACA,OAAOC,WAAW,MAAM,iBAAiB;AAGzC,SAASC,2BAA2B,QAAQ,+BAA+B;AAAC,SAAAC,GAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAGpB,UAAU,CAAEK,sBAAuB,CAAC;AAE/D,eAAee,WAAW","ignoreList":[]}
|
|
@@ -21,11 +21,13 @@ import { ToggleGroupControlAsButtonGroup } from './as-button-group';
|
|
|
21
21
|
import { useTrackElementOffsetRect } from '../../utils/element-rect';
|
|
22
22
|
import { useMergeRefs } from '@wordpress/compose';
|
|
23
23
|
import { useAnimatedOffsetRect } from '../../utils/hooks/use-animated-offset-rect';
|
|
24
|
+
import { maybeWarnDeprecated36pxSize } from '../../utils/deprecated-36px-size';
|
|
24
25
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
26
|
function UnconnectedToggleGroupControl(props, forwardedRef) {
|
|
26
27
|
const {
|
|
27
28
|
__nextHasNoMarginBottom = false,
|
|
28
29
|
__next40pxDefaultSize = false,
|
|
30
|
+
__shouldNotWarnDeprecated36pxSize,
|
|
29
31
|
className,
|
|
30
32
|
isAdaptiveWidth = false,
|
|
31
33
|
isBlock = false,
|
|
@@ -57,6 +59,12 @@ function UnconnectedToggleGroupControl(props, forwardedRef) {
|
|
|
57
59
|
size: normalizedSize
|
|
58
60
|
}), isBlock && styles.block, className), [className, cx, isBlock, isDeselectable, normalizedSize]);
|
|
59
61
|
const MainControl = isDeselectable ? ToggleGroupControlAsButtonGroup : ToggleGroupControlAsRadioGroup;
|
|
62
|
+
maybeWarnDeprecated36pxSize({
|
|
63
|
+
componentName: 'ToggleGroupControl',
|
|
64
|
+
size,
|
|
65
|
+
__next40pxDefaultSize,
|
|
66
|
+
__shouldNotWarnDeprecated36pxSize
|
|
67
|
+
});
|
|
60
68
|
return /*#__PURE__*/_jsxs(BaseControl, {
|
|
61
69
|
help: help,
|
|
62
70
|
__nextHasNoMarginBottom: __nextHasNoMarginBottom,
|
|
@@ -106,6 +114,7 @@ function UnconnectedToggleGroupControl(props, forwardedRef) {
|
|
|
106
114
|
* value="vertical"
|
|
107
115
|
* isBlock
|
|
108
116
|
* __nextHasNoMarginBottom
|
|
117
|
+
* __next40pxDefaultSize
|
|
109
118
|
* >
|
|
110
119
|
* <ToggleGroupControlOption value="horizontal" label="Horizontal" />
|
|
111
120
|
* <ToggleGroupControlOption value="vertical" label="Vertical" />
|