@wordpress/components 27.5.0 → 27.6.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 +25 -5
- package/build/alignment-matrix-control/icon.js +2 -2
- package/build/alignment-matrix-control/icon.js.map +1 -1
- package/build/alignment-matrix-control/index.js +2 -2
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/angle-picker-control/index.js +2 -2
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/animate/index.js +4 -4
- package/build/animate/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +2 -2
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/base-control/hooks.js +1 -4
- package/build/base-control/hooks.js.map +1 -1
- package/build/base-control/index.js +2 -2
- package/build/base-control/index.js.map +1 -1
- package/build/base-control/types.js.map +1 -1
- package/build/border-control/types.js.map +1 -1
- package/build/button/index.js +2 -2
- package/build/button/index.js.map +1 -1
- package/build/button-group/index.js +2 -2
- package/build/button-group/index.js.map +1 -1
- package/build/checkbox-control/index.js +2 -2
- package/build/checkbox-control/index.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-actions.js +3 -3
- package/build/circular-option-picker/circular-option-picker-actions.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option-group.js +2 -2
- package/build/circular-option-picker/circular-option-picker-option-group.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +2 -2
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker.js +2 -2
- package/build/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build/clipboard-button/index.js +2 -2
- package/build/clipboard-button/index.js.map +1 -1
- package/build/color-indicator/index.js +2 -2
- package/build/color-indicator/index.js.map +1 -1
- package/build/color-palette/index.js +2 -2
- package/build/color-palette/index.js.map +1 -1
- package/build/combobox-control/index.js +7 -2
- package/build/combobox-control/index.js.map +1 -1
- package/build/combobox-control/types.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +3 -3
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/index.js +2 -2
- package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-select-control/index.js +3 -3
- package/build/custom-select-control/index.js.map +1 -1
- package/build/dimension-control/index.js +2 -2
- package/build/dimension-control/index.js.map +1 -1
- package/build/drop-zone/index.js +2 -2
- package/build/drop-zone/index.js.map +1 -1
- package/build/dropdown/index.js +2 -2
- package/build/dropdown/index.js.map +1 -1
- package/build/dropdown-menu/index.js +5 -5
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu/index.native.js +4 -4
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/external-link/index.js +2 -2
- package/build/external-link/index.js.map +1 -1
- package/build/focal-point-picker/focal-point.js +2 -2
- package/build/focal-point-picker/focal-point.js.map +1 -1
- package/build/focal-point-picker/index.js +2 -2
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/form-toggle/index.js +2 -2
- package/build/form-toggle/index.js.map +1 -1
- package/build/form-token-field/index.js +3 -3
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +9 -5
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/form-token-field/token-input.js +2 -2
- package/build/form-token-field/token-input.js.map +1 -1
- package/build/form-token-field/token.js +2 -2
- package/build/form-token-field/token.js.map +1 -1
- package/build/guide/index.js +2 -2
- package/build/guide/index.js.map +1 -1
- package/build/input-control/index.js +3 -6
- package/build/input-control/index.js.map +1 -1
- package/build/menu-group/index.js +2 -2
- package/build/menu-group/index.js.map +1 -1
- package/build/menu-item/index.js +3 -3
- package/build/menu-item/index.js.map +1 -1
- package/build/mobile/color-settings/utils.native.js +1 -1
- package/build/mobile/color-settings/utils.native.js.map +1 -1
- package/build/modal/index.js +4 -4
- package/build/modal/index.js.map +1 -1
- package/build/navigation/back-button/index.js +2 -2
- package/build/navigation/back-button/index.js.map +1 -1
- package/build/navigation/group/index.js +2 -2
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/index.js +3 -3
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/item/base.js +2 -2
- package/build/navigation/item/base.js.map +1 -1
- package/build/navigation/item/index.js +2 -2
- package/build/navigation/item/index.js.map +1 -1
- package/build/navigation/menu/index.js +2 -2
- package/build/navigation/menu/index.js.map +1 -1
- package/build/notice/index.js +3 -3
- package/build/notice/index.js.map +1 -1
- package/build/notice/list.js +2 -2
- package/build/notice/list.js.map +1 -1
- package/build/number-control/index.js +2 -2
- package/build/number-control/index.js.map +1 -1
- package/build/palette-edit/index.js +5 -5
- package/build/palette-edit/index.js.map +1 -1
- package/build/palette-edit/styles.js +14 -15
- package/build/palette-edit/styles.js.map +1 -1
- package/build/panel/body.js +2 -2
- package/build/panel/body.js.map +1 -1
- package/build/panel/index.js +2 -2
- package/build/panel/index.js.map +1 -1
- package/build/panel/row.js +2 -2
- package/build/panel/row.js.map +1 -1
- package/build/placeholder/index.js +3 -3
- package/build/placeholder/index.js.map +1 -1
- package/build/popover/index.js +2 -2
- package/build/popover/index.js.map +1 -1
- package/build/radio-control/index.js +2 -2
- package/build/radio-control/index.js.map +1 -1
- package/build/range-control/index.js +3 -3
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/mark.js +3 -3
- package/build/range-control/mark.js.map +1 -1
- package/build/range-control/tooltip.js +2 -2
- package/build/range-control/tooltip.js.map +1 -1
- package/build/resizable-box/index.js +10 -10
- package/build/resizable-box/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/index.js +2 -2
- package/build/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build/responsive-wrapper/index.js +2 -2
- package/build/responsive-wrapper/index.js.map +1 -1
- package/build/search-control/index.js +2 -2
- package/build/search-control/index.js.map +1 -1
- package/build/select-control/index.js +2 -2
- package/build/select-control/index.js.map +1 -1
- package/build/snackbar/index.js +3 -3
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +2 -2
- package/build/snackbar/list.js.map +1 -1
- package/build/spinner/index.js +2 -2
- package/build/spinner/index.js.map +1 -1
- package/build/tab-panel/index.js +2 -2
- package/build/tab-panel/index.js.map +1 -1
- package/build/text-control/index.js +2 -2
- package/build/text-control/index.js.map +1 -1
- package/build/toolbar/toolbar/index.js +2 -2
- package/build/toolbar/toolbar/index.js.map +1 -1
- package/build/toolbar/toolbar-button/index.js +3 -3
- package/build/toolbar/toolbar-button/index.js.map +1 -1
- package/build/toolbar/toolbar-group/index.js +2 -2
- package/build/toolbar/toolbar-group/index.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +5 -6
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +6 -8
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build/tools-panel/types.js.map +1 -1
- package/build/truncate/hook.js +1 -1
- package/build/truncate/hook.js.map +1 -1
- package/build/unit-control/index.js +2 -2
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/unit-select-control.js +2 -2
- package/build/unit-control/unit-select-control.js.map +1 -1
- package/build-module/alignment-matrix-control/icon.js +2 -2
- package/build-module/alignment-matrix-control/icon.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +2 -2
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/angle-picker-control/index.js +2 -2
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/animate/index.js +4 -4
- package/build-module/animate/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +2 -2
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/base-control/hooks.js +1 -4
- package/build-module/base-control/hooks.js.map +1 -1
- package/build-module/base-control/index.js +2 -2
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/base-control/types.js.map +1 -1
- package/build-module/border-control/types.js.map +1 -1
- package/build-module/button/index.js +2 -2
- package/build-module/button/index.js.map +1 -1
- package/build-module/button-group/index.js +2 -2
- package/build-module/button-group/index.js.map +1 -1
- package/build-module/checkbox-control/index.js +2 -2
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-actions.js +3 -3
- package/build-module/circular-option-picker/circular-option-picker-actions.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option-group.js +2 -2
- package/build-module/circular-option-picker/circular-option-picker-option-group.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +2 -2
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +2 -2
- package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build-module/clipboard-button/index.js +2 -2
- package/build-module/clipboard-button/index.js.map +1 -1
- package/build-module/color-indicator/index.js +2 -2
- package/build-module/color-indicator/index.js.map +1 -1
- package/build-module/color-palette/index.js +2 -2
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/combobox-control/index.js +7 -2
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/combobox-control/types.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +3 -3
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js +2 -2
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-select-control/index.js +3 -3
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/dimension-control/index.js +2 -2
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/drop-zone/index.js +2 -2
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/dropdown/index.js +2 -2
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/dropdown-menu/index.js +5 -5
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +4 -4
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/external-link/index.js +2 -2
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/focal-point-picker/focal-point.js +2 -2
- package/build-module/focal-point-picker/focal-point.js.map +1 -1
- package/build-module/focal-point-picker/index.js +2 -2
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/form-toggle/index.js +2 -2
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/form-token-field/index.js +3 -3
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +9 -5
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/form-token-field/token-input.js +2 -2
- package/build-module/form-token-field/token-input.js.map +1 -1
- package/build-module/form-token-field/token.js +2 -2
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/guide/index.js +2 -2
- package/build-module/guide/index.js.map +1 -1
- package/build-module/input-control/index.js +3 -6
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/menu-group/index.js +2 -2
- package/build-module/menu-group/index.js.map +1 -1
- package/build-module/menu-item/index.js +3 -3
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/mobile/color-settings/utils.native.js +1 -1
- package/build-module/mobile/color-settings/utils.native.js.map +1 -1
- package/build-module/modal/index.js +4 -4
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigation/back-button/index.js +2 -2
- package/build-module/navigation/back-button/index.js.map +1 -1
- package/build-module/navigation/group/index.js +2 -2
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/index.js +3 -3
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/item/base.js +2 -2
- package/build-module/navigation/item/base.js.map +1 -1
- package/build-module/navigation/item/index.js +2 -2
- package/build-module/navigation/item/index.js.map +1 -1
- package/build-module/navigation/menu/index.js +2 -2
- package/build-module/navigation/menu/index.js.map +1 -1
- package/build-module/notice/index.js +3 -3
- package/build-module/notice/index.js.map +1 -1
- package/build-module/notice/list.js +2 -2
- package/build-module/notice/list.js.map +1 -1
- package/build-module/number-control/index.js +2 -2
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/palette-edit/index.js +6 -6
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/palette-edit/styles.js +13 -14
- package/build-module/palette-edit/styles.js.map +1 -1
- package/build-module/panel/body.js +2 -2
- package/build-module/panel/body.js.map +1 -1
- package/build-module/panel/index.js +2 -2
- package/build-module/panel/index.js.map +1 -1
- package/build-module/panel/row.js +2 -2
- package/build-module/panel/row.js.map +1 -1
- package/build-module/placeholder/index.js +3 -3
- package/build-module/placeholder/index.js.map +1 -1
- package/build-module/popover/index.js +2 -2
- package/build-module/popover/index.js.map +1 -1
- package/build-module/radio-control/index.js +2 -2
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/range-control/index.js +3 -3
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/mark.js +3 -3
- package/build-module/range-control/mark.js.map +1 -1
- package/build-module/range-control/tooltip.js +2 -2
- package/build-module/range-control/tooltip.js.map +1 -1
- package/build-module/resizable-box/index.js +10 -10
- package/build-module/resizable-box/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/index.js +2 -2
- package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
- package/build-module/responsive-wrapper/index.js +2 -2
- package/build-module/responsive-wrapper/index.js.map +1 -1
- package/build-module/search-control/index.js +2 -2
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/select-control/index.js +2 -2
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/snackbar/index.js +3 -3
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +2 -2
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/spinner/index.js +2 -2
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/tab-panel/index.js +2 -2
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/text-control/index.js +2 -2
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/toolbar/toolbar/index.js +2 -2
- package/build-module/toolbar/toolbar/index.js.map +1 -1
- package/build-module/toolbar/toolbar-button/index.js +3 -3
- package/build-module/toolbar/toolbar-button/index.js.map +1 -1
- package/build-module/toolbar/toolbar-group/index.js +2 -2
- package/build-module/toolbar/toolbar-group/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +5 -6
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/hook.js +6 -8
- package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-module/tools-panel/types.js.map +1 -1
- package/build-module/truncate/hook.js +1 -1
- package/build-module/truncate/hook.js.map +1 -1
- package/build-module/unit-control/index.js +2 -2
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/unit-select-control.js +2 -2
- package/build-module/unit-control/unit-select-control.js.map +1 -1
- package/build-style/style-rtl.css +18 -20
- package/build-style/style.css +18 -20
- package/build-types/alignment-matrix-control/cell.d.ts +1 -1
- package/build-types/alignment-matrix-control/cell.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/icon.d.ts +1 -1
- package/build-types/alignment-matrix-control/icon.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/index.d.ts +1 -1
- package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/stories/index.story.d.ts +2 -2
- package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts +4 -4
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts +4 -4
- package/build-types/angle-picker-control/angle-circle.d.ts +1 -1
- package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
- package/build-types/angle-picker-control/index.d.ts +1 -1
- package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +4 -4
- package/build-types/animate/index.d.ts.map +1 -1
- package/build-types/autocomplete/autocompleter-ui.d.ts +1 -1
- package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
- package/build-types/autocomplete/index.d.ts +3 -3
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/base-control/hooks.d.ts +1 -0
- package/build-types/base-control/hooks.d.ts.map +1 -1
- package/build-types/base-control/index.d.ts +2 -2
- package/build-types/base-control/index.d.ts.map +1 -1
- package/build-types/base-control/styles/base-control-styles.d.ts +5 -5
- package/build-types/base-control/types.d.ts +1 -2
- package/build-types/base-control/types.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +67 -57
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +68 -59
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +67 -57
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +67 -57
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
- package/build-types/border-box-control/stories/index.story.d.ts +1 -1
- package/build-types/border-box-control/stories/index.story.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 +68 -57
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +67 -57
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-style-picker/component.d.ts +1 -1
- package/build-types/border-control/stories/index.story.d.ts +12 -6
- package/build-types/border-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +4 -0
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/box-control/all-input-control.d.ts +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 +1 -1
- package/build-types/box-control/axial-input-controls.d.ts.map +1 -1
- package/build-types/box-control/icon.d.ts +1 -1
- package/build-types/box-control/icon.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts +1 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/input-controls.d.ts +1 -1
- package/build-types/box-control/input-controls.d.ts.map +1 -1
- package/build-types/box-control/linked-button.d.ts +1 -1
- package/build-types/box-control/linked-button.d.ts.map +1 -1
- package/build-types/box-control/stories/index.story.d.ts +427 -378
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-icon-styles.d.ts +6 -6
- package/build-types/box-control/styles/box-control-styles.d.ts +5 -5
- package/build-types/button/deprecated.d.ts +5 -51
- package/build-types/button/deprecated.d.ts.map +1 -1
- package/build-types/button/index.d.ts +1 -1
- package/build-types/button/index.d.ts.map +1 -1
- package/build-types/button/stories/index.story.d.ts +1 -1
- package/build-types/button/stories/index.story.d.ts.map +1 -1
- package/build-types/button-group/index.d.ts +1 -1
- package/build-types/button-group/index.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +67 -57
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/card-body/hook.d.ts +67 -57
- package/build-types/card/card-body/hook.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +67 -57
- package/build-types/card/card-divider/hook.d.ts.map +1 -1
- package/build-types/card/card-footer/hook.d.ts +67 -57
- package/build-types/card/card-footer/hook.d.ts.map +1 -1
- package/build-types/card/card-header/hook.d.ts +67 -57
- package/build-types/card/card-header/hook.d.ts.map +1 -1
- package/build-types/card/card-media/hook.d.ts +67 -57
- package/build-types/card/card-media/hook.d.ts.map +1 -1
- package/build-types/card/stories/index.story.d.ts +2 -2
- package/build-types/checkbox-control/index.d.ts +1 -1
- package/build-types/checkbox-control/index.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-actions.d.ts +2 -2
- 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-group.d.ts +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option-group.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker.d.ts +1 -1
- package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
- package/build-types/clipboard-button/index.d.ts +1 -1
- package/build-types/clipboard-button/index.d.ts.map +1 -1
- package/build-types/color-indicator/index.d.ts +1 -1
- package/build-types/color-indicator/index.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts +1 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +1 -1
- package/build-types/color-picker/color-copy-button.d.ts +1 -1
- package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
- package/build-types/color-picker/color-input.d.ts +1 -1
- package/build-types/color-picker/color-input.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts +2 -2
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.d.ts +1 -1
- package/build-types/color-picker/hex-input.d.ts.map +1 -1
- package/build-types/color-picker/hsl-input.d.ts +1 -1
- package/build-types/color-picker/hsl-input.d.ts.map +1 -1
- package/build-types/color-picker/input-with-slider.d.ts +1 -1
- package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
- package/build-types/color-picker/legacy-adapter.d.ts +1 -1
- package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
- package/build-types/color-picker/picker.d.ts +1 -1
- package/build-types/color-picker/picker.d.ts.map +1 -1
- package/build-types/color-picker/rgb-input.d.ts +1 -1
- package/build-types/color-picker/rgb-input.d.ts.map +1 -1
- package/build-types/color-picker/stories/index.story.d.ts +1 -1
- package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +6 -6
- package/build-types/combobox-control/index.d.ts +3 -1
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts +22 -2
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/combobox-control/styles.d.ts +1 -1
- package/build-types/combobox-control/types.d.ts +1 -0
- package/build-types/combobox-control/types.d.ts.map +1 -1
- package/build-types/composite/current/stories/utils.d.ts +1 -1
- package/build-types/composite/current/stories/utils.d.ts.map +1 -1
- package/build-types/composite/legacy/stories/utils.d.ts +1 -1
- package/build-types/composite/legacy/stories/utils.d.ts.map +1 -1
- package/build-types/confirm-dialog/stories/index.story.d.ts +2 -2
- package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +2 -2
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/index.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/styles/custom-gradient-picker-styles.d.ts +2 -2
- package/build-types/custom-select-control/index.d.ts +2 -2
- package/build-types/custom-select-control/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select.d.ts +1 -1
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/default-component/index.d.ts +1 -1
- package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/item.d.ts +1 -1
- package/build-types/custom-select-control-v2/item.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/legacy-component/index.d.ts +1 -1
- package/build-types/custom-select-control-v2/legacy-component/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/default.story.d.ts +3 -3
- package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/styles.d.ts +8 -8
- package/build-types/dashicon/index.d.ts +1 -1
- package/build-types/dashicon/index.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts +1 -1
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +5 -5
- package/build-types/date-time/date-time/styles.d.ts +1 -1
- package/build-types/date-time/time/index.d.ts +1 -1
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts +10 -10
- package/build-types/date-time/time/timezone.d.ts +1 -1
- package/build-types/date-time/time/timezone.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +1 -1
- package/build-types/dimension-control/index.d.ts.map +1 -1
- package/build-types/disabled/index.d.ts +1 -1
- package/build-types/disabled/index.d.ts.map +1 -1
- package/build-types/disclosure/index.d.ts +1 -1
- package/build-types/disclosure/index.d.ts.map +1 -1
- package/build-types/divider/styles.d.ts +1 -1
- package/build-types/draggable/index.d.ts +1 -1
- package/build-types/draggable/index.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/stories/index.story.d.ts +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown/index.d.ts +1 -1
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.story.d.ts +4 -4
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown/styles.d.ts +1 -1
- package/build-types/dropdown-menu/index.d.ts +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
- package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/index.d.ts +7 -7
- package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/styles.d.ts +12 -12
- package/build-types/duotone-picker/color-list-picker/index.d.ts +1 -1
- package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -1
- package/build-types/duotone-picker/custom-duotone-bar.d.ts +1 -1
- package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -1
- package/build-types/duotone-picker/duotone-picker.d.ts +1 -1
- package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
- package/build-types/duotone-picker/duotone-swatch.d.ts +1 -1
- package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +66 -56
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +67 -57
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/flex/flex-block/hook.d.ts +67 -57
- package/build-types/flex/flex-block/hook.d.ts.map +1 -1
- package/build-types/flex/flex-item/hook.d.ts +67 -57
- package/build-types/flex/flex-item/hook.d.ts.map +1 -1
- package/build-types/focal-point-picker/controls.d.ts +1 -1
- package/build-types/focal-point-picker/controls.d.ts.map +1 -1
- package/build-types/focal-point-picker/focal-point.d.ts +1 -1
- package/build-types/focal-point-picker/focal-point.d.ts.map +1 -1
- package/build-types/focal-point-picker/grid.d.ts +1 -1
- package/build-types/focal-point-picker/grid.d.ts.map +1 -1
- package/build-types/focal-point-picker/index.d.ts +1 -1
- package/build-types/focal-point-picker/index.d.ts.map +1 -1
- package/build-types/focal-point-picker/media.d.ts +1 -1
- package/build-types/focal-point-picker/media.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts +8 -8
- package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +9 -9
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts +1 -1
- package/build-types/focal-point-picker/test/index.d.ts +2 -0
- package/build-types/focal-point-picker/test/index.d.ts.map +1 -0
- package/build-types/focal-point-picker/test/media.d.ts +2 -0
- package/build-types/focal-point-picker/test/media.d.ts.map +1 -0
- package/build-types/focusable-iframe/index.d.ts +1 -1
- package/build-types/focusable-iframe/index.d.ts.map +1 -1
- package/build-types/font-size-picker/font-size-picker-select.d.ts +1 -1
- package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -1
- package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts +1 -1
- package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +4 -4
- package/build-types/form-file-upload/index.d.ts +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 +5 -5
- package/build-types/form-file-upload/stories/index.story.d.ts.map +1 -1
- package/build-types/form-toggle/index.d.ts +2 -2
- package/build-types/form-toggle/index.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/styles.d.ts +1 -1
- package/build-types/form-token-field/suggestions-list.d.ts +2 -1
- package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
- package/build-types/form-token-field/token-input.d.ts +2 -2
- package/build-types/form-token-field/token-input.d.ts.map +1 -1
- package/build-types/form-token-field/token.d.ts +1 -1
- package/build-types/form-token-field/token.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/grid/hook.d.ts +67 -57
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/guide/icons.d.ts +1 -1
- package/build-types/guide/icons.d.ts.map +1 -1
- package/build-types/guide/index.d.ts +1 -1
- package/build-types/guide/index.d.ts.map +1 -1
- package/build-types/guide/page-control.d.ts +1 -1
- package/build-types/guide/page-control.d.ts.map +1 -1
- package/build-types/guide/page.d.ts +1 -1
- package/build-types/guide/page.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +67 -57
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +67 -57
- package/build-types/heading/hook.d.ts.map +1 -1
- package/build-types/higher-order/navigate-regions/index.d.ts +1 -1
- package/build-types/higher-order/with-constrained-tabbing/index.d.ts +1 -1
- package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
- package/build-types/higher-order/with-fallback-styles/index.d.ts +1 -1
- package/build-types/higher-order/with-filters/index.d.ts +2 -2
- package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
- package/build-types/higher-order/with-notices/index.d.ts +2 -2
- package/build-types/higher-order/with-spoken-messages/index.d.ts +1 -1
- package/build-types/icon/index.d.ts +1 -1
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/input-control/backdrop.d.ts +1 -1
- package/build-types/input-control/backdrop.d.ts.map +1 -1
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-base.d.ts +1 -1
- package/build-types/input-control/input-base.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/label.d.ts +1 -1
- package/build-types/input-control/label.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts +8 -8
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/isolated-event-container/index.d.ts +1 -1
- package/build-types/isolated-event-container/index.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +67 -57
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +67 -57
- package/build-types/item-group/item-group/hook.d.ts.map +1 -1
- package/build-types/keyboard-shortcuts/index.d.ts +1 -1
- package/build-types/keyboard-shortcuts/index.d.ts.map +1 -1
- package/build-types/menu-group/index.d.ts +1 -1
- package/build-types/menu-group/index.d.ts.map +1 -1
- package/build-types/menu-item/index.d.ts +1 -1
- package/build-types/menu-item/index.d.ts.map +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +4 -4
- package/build-types/menu-item/stories/index.story.d.ts.map +1 -1
- package/build-types/menu-items-choice/index.d.ts +1 -1
- package/build-types/menu-items-choice/index.d.ts.map +1 -1
- package/build-types/navigable-container/container.d.ts +1 -1
- package/build-types/navigable-container/menu.d.ts +2 -2
- package/build-types/navigable-container/menu.d.ts.map +1 -1
- package/build-types/navigable-container/tabbable.d.ts +2 -2
- package/build-types/navigable-container/tabbable.d.ts.map +1 -1
- package/build-types/navigation/back-button/index.d.ts.map +1 -1
- package/build-types/navigation/group/index.d.ts +1 -1
- package/build-types/navigation/group/index.d.ts.map +1 -1
- package/build-types/navigation/index.d.ts +1 -1
- package/build-types/navigation/index.d.ts.map +1 -1
- package/build-types/navigation/item/base-content.d.ts +1 -1
- package/build-types/navigation/item/base-content.d.ts.map +1 -1
- package/build-types/navigation/item/base.d.ts +1 -1
- package/build-types/navigation/item/base.d.ts.map +1 -1
- package/build-types/navigation/item/index.d.ts +1 -1
- package/build-types/navigation/item/index.d.ts.map +1 -1
- package/build-types/navigation/menu/index.d.ts +1 -1
- package/build-types/navigation/menu/index.d.ts.map +1 -1
- package/build-types/navigation/menu/menu-title-search.d.ts +1 -1
- package/build-types/navigation/menu/menu-title.d.ts +1 -1
- package/build-types/navigation/menu/menu-title.d.ts.map +1 -1
- package/build-types/navigation/menu/search-no-results-found.d.ts +1 -1
- package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts +11 -11
- package/build-types/navigator/navigator-back-button/hook.d.ts +68 -59
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +68 -59
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/notice/index.d.ts +1 -1
- package/build-types/notice/index.d.ts.map +1 -1
- package/build-types/notice/list.d.ts +1 -1
- package/build-types/notice/list.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +1 -1
- package/build-types/number-control/stories/index.story.d.ts.map +1 -1
- package/build-types/palette-edit/index.d.ts +1 -1
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/palette-edit/styles.d.ts +1007 -756
- package/build-types/palette-edit/styles.d.ts.map +1 -1
- package/build-types/panel/body.d.ts +1 -1
- package/build-types/panel/body.d.ts.map +1 -1
- package/build-types/panel/header.d.ts +1 -1
- package/build-types/panel/header.d.ts.map +1 -1
- package/build-types/placeholder/index.d.ts +1 -1
- package/build-types/placeholder/index.d.ts.map +1 -1
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/e2e/index.story.d.ts +2 -2
- package/build-types/popover/stories/e2e/index.story.d.ts.map +1 -1
- package/build-types/popover/test/utils/index.d.ts +1 -1
- package/build-types/popover/test/utils/index.d.ts.map +1 -1
- package/build-types/progress-bar/index.d.ts +1 -1
- package/build-types/progress-bar/index.d.ts.map +1 -1
- package/build-types/progress-bar/styles.d.ts +3 -3
- package/build-types/query-controls/author-select.d.ts +1 -1
- package/build-types/query-controls/author-select.d.ts.map +1 -1
- package/build-types/query-controls/category-select.d.ts +1 -1
- package/build-types/query-controls/category-select.d.ts.map +1 -1
- package/build-types/query-controls/index.d.ts +1 -1
- package/build-types/query-controls/index.d.ts.map +1 -1
- package/build-types/radio-control/index.d.ts +1 -1
- package/build-types/radio-control/index.d.ts.map +1 -1
- package/build-types/radio-group/index.d.ts +1 -1
- package/build-types/radio-group/index.d.ts.map +1 -1
- package/build-types/radio-group/radio.d.ts +1 -1
- package/build-types/radio-group/radio.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/input-range.d.ts +1 -1
- package/build-types/range-control/mark.d.ts +1 -1
- package/build-types/range-control/mark.d.ts.map +1 -1
- package/build-types/range-control/rail.d.ts +1 -1
- package/build-types/range-control/rail.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +15 -15
- package/build-types/range-control/tooltip.d.ts +1 -1
- package/build-types/range-control/tooltip.d.ts.map +1 -1
- package/build-types/resizable-box/index.d.ts +3 -3
- package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +4 -4
- package/build-types/resizable-box/stories/index.story.d.ts +6 -6
- package/build-types/responsive-wrapper/index.d.ts +1 -1
- package/build-types/responsive-wrapper/index.d.ts.map +1 -1
- package/build-types/sandbox/index.d.ts +1 -1
- package/build-types/sandbox/index.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +67 -57
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/search-control/index.d.ts.map +1 -1
- package/build-types/search-control/styles.d.ts +1 -1
- package/build-types/select-control/chevron-down.d.ts +1 -1
- package/build-types/select-control/chevron-down.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts +3 -3
- package/build-types/shortcut/index.d.ts +1 -1
- package/build-types/shortcut/index.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts +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 +1 -1
- package/build-types/slot-fill/index.d.ts +7 -7
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/slot-fill/provider.d.ts +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/snackbar/index.d.ts +2 -2
- package/build-types/snackbar/index.d.ts.map +1 -1
- package/build-types/snackbar/list.d.ts +1 -1
- package/build-types/snackbar/list.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +67 -57
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/spinner/index.d.ts +2 -2
- package/build-types/spinner/index.d.ts.map +1 -1
- package/build-types/spinner/styles.d.ts +3 -3
- package/build-types/style-provider/index.d.ts +1 -1
- package/build-types/style-provider/index.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +67 -57
- package/build-types/surface/hook.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tab-panel/stories/index.story.d.ts +4 -4
- package/build-types/tab-panel/stories/index.story.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts +2 -2
- package/build-types/tabs/index.d.ts.map +1 -1
- package/build-types/tabs/styles.d.ts +3 -3
- package/build-types/tabs/tablist.d.ts +1 -1
- package/build-types/tabs/tablist.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +66 -57
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text/stories/index.story.d.ts +3 -3
- package/build-types/text-control/index.d.ts +3 -3
- package/build-types/text-control/index.d.ts.map +1 -1
- package/build-types/text-highlight/index.d.ts +1 -1
- package/build-types/text-highlight/index.d.ts.map +1 -1
- package/build-types/textarea-control/index.d.ts +2 -2
- package/build-types/textarea-control/index.d.ts.map +1 -1
- package/build-types/textarea-control/styles/textarea-control-styles.d.ts +1 -1
- package/build-types/theme/index.d.ts +1 -1
- package/build-types/theme/index.d.ts.map +1 -1
- package/build-types/theme/stories/index.story.d.ts +1 -1
- package/build-types/theme/styles.d.ts +1 -1
- package/build-types/tip/index.d.ts +1 -1
- package/build-types/tip/index.d.ts.map +1 -1
- package/build-types/toggle-control/index.d.ts +2 -2
- package/build-types/toggle-control/index.d.ts.map +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts +2 -2
- package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -1
- 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-base/component.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
- package/build-types/toolbar/stories/index.story.d.ts +3 -3
- package/build-types/toolbar/stories/index.story.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/index.d.ts +1 -1
- package/build-types/toolbar/toolbar/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar/toolbar-container.d.ts +1 -1
- package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts +5 -51
- package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +1 -1
- package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-group/index.d.ts +1 -1
- package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts +1 -1
- package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -1
- package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +1 -1
- package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -1
- package/build-types/tools-panel/styles.d.ts +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +69 -59
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +68 -58
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +67 -57
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +1 -1
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/tree-grid/index.d.ts +1 -1
- package/build-types/tree-grid/index.d.ts.map +1 -1
- package/build-types/tree-grid/item.d.ts +1 -1
- package/build-types/tree-grid/item.d.ts.map +1 -1
- package/build-types/tree-grid/roving-tab-index-item.d.ts +1 -1
- package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -1
- package/build-types/tree-grid/roving-tab-index.d.ts +1 -1
- package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -1
- package/build-types/tree-grid/row.d.ts +1 -1
- package/build-types/tree-grid/row.d.ts.map +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts +1 -1
- package/build-types/tree-grid/stories/index.story.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts +1 -1
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +67 -57
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +3 -3
- package/build-types/unit-control/unit-select-control.d.ts +1 -1
- package/build-types/v-stack/hook.d.ts +67 -57
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.story.d.ts +1 -1
- package/build-types/view/component.d.ts +251 -249
- package/build-types/view/component.d.ts.map +1 -1
- package/build-types/z-stack/styles.d.ts +2 -2
- package/package.json +22 -22
- package/src/alignment-matrix-control/icon.tsx +2 -2
- package/src/alignment-matrix-control/index.tsx +2 -5
- package/src/angle-picker-control/index.tsx +2 -2
- package/src/animate/index.tsx +4 -7
- package/src/autocomplete/autocompleter-ui.tsx +2 -2
- package/src/base-control/README.md +1 -1
- package/src/base-control/hooks.ts +1 -5
- package/src/base-control/index.tsx +2 -5
- package/src/base-control/test/index.tsx +3 -3
- package/src/base-control/types.ts +1 -2
- package/src/border-control/types.ts +4 -0
- package/src/button/index.tsx +2 -2
- package/src/button/style.scss +4 -6
- package/src/button-group/index.tsx +2 -2
- package/src/checkbox-control/index.tsx +2 -2
- package/src/circular-option-picker/circular-option-picker-actions.tsx +3 -3
- package/src/circular-option-picker/circular-option-picker-option-group.tsx +2 -2
- package/src/circular-option-picker/circular-option-picker-option.tsx +2 -2
- package/src/circular-option-picker/circular-option-picker.tsx +2 -5
- package/src/circular-option-picker/style.scss +1 -2
- package/src/clipboard-button/index.tsx +2 -2
- package/src/color-indicator/index.tsx +2 -2
- package/src/color-palette/index.tsx +2 -2
- package/src/combobox-control/README.md +1 -1
- package/src/combobox-control/index.tsx +8 -5
- package/src/combobox-control/stories/index.story.tsx +28 -0
- package/src/combobox-control/types.ts +1 -0
- package/src/custom-gradient-picker/gradient-bar/control-points.tsx +3 -3
- package/src/custom-gradient-picker/gradient-bar/index.tsx +2 -2
- package/src/custom-gradient-picker/index.tsx +2 -2
- package/src/custom-select-control/index.js +3 -6
- package/src/dimension-control/index.tsx +2 -5
- package/src/drop-zone/index.tsx +2 -2
- package/src/dropdown/index.tsx +2 -2
- package/src/dropdown-menu/index.native.js +6 -12
- package/src/dropdown-menu/index.tsx +9 -16
- package/src/external-link/index.tsx +2 -2
- package/src/focal-point-picker/focal-point.tsx +2 -4
- package/src/focal-point-picker/index.tsx +2 -5
- package/src/focal-point-picker/test/{index.js → index.tsx} +44 -17
- package/src/focal-point-picker/test/{media.js → media.tsx} +18 -13
- package/src/form-toggle/index.tsx +2 -2
- package/src/form-token-field/index.tsx +10 -8
- package/src/form-token-field/style.scss +9 -0
- package/src/form-token-field/suggestions-list.tsx +16 -10
- package/src/form-token-field/token-input.tsx +2 -2
- package/src/form-token-field/token.tsx +2 -2
- package/src/guide/index.tsx +2 -2
- package/src/input-control/index.tsx +3 -6
- package/src/input-control/test/index.js +2 -2
- package/src/menu-group/index.tsx +2 -2
- package/src/menu-item/index.tsx +3 -3
- package/src/mobile/color-settings/utils.native.js +1 -1
- package/src/modal/index.tsx +4 -4
- package/src/navigation/back-button/index.tsx +2 -5
- package/src/navigation/group/index.tsx +2 -2
- package/src/navigation/index.tsx +3 -3
- package/src/navigation/item/base.tsx +2 -2
- package/src/navigation/item/index.tsx +2 -2
- package/src/navigation/menu/index.tsx +2 -2
- package/src/notice/index.tsx +5 -10
- package/src/notice/list.tsx +2 -2
- package/src/number-control/index.tsx +2 -2
- package/src/palette-edit/index.tsx +10 -8
- package/src/palette-edit/styles.ts +2 -3
- package/src/panel/body.tsx +2 -2
- package/src/panel/index.tsx +2 -2
- package/src/panel/row.tsx +2 -2
- package/src/placeholder/index.tsx +3 -3
- package/src/placeholder/style.scss +1 -2
- package/src/popover/index.tsx +2 -2
- package/src/radio-control/index.tsx +2 -2
- package/src/range-control/index.tsx +3 -3
- package/src/range-control/mark.tsx +3 -3
- package/src/range-control/tooltip.tsx +2 -2
- package/src/resizable-box/index.tsx +10 -10
- package/src/resizable-box/resize-tooltip/index.tsx +2 -2
- package/src/responsive-wrapper/index.tsx +2 -2
- package/src/search-control/index.tsx +2 -5
- package/src/select-control/index.tsx +2 -2
- package/src/snackbar/index.tsx +5 -8
- package/src/snackbar/list.tsx +2 -2
- package/src/spinner/index.tsx +2 -2
- package/src/tab-panel/index.tsx +2 -2
- package/src/text-control/index.tsx +2 -2
- package/src/theme/stories/index.story.tsx +1 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +0 -2
- package/src/toolbar/toolbar/index.tsx +2 -2
- package/src/toolbar/toolbar/style.scss +0 -12
- package/src/toolbar/toolbar-button/index.tsx +3 -3
- package/src/toolbar/toolbar-group/index.tsx +2 -2
- package/src/tools-panel/tools-panel/hook.ts +9 -6
- package/src/tools-panel/tools-panel-item/hook.ts +12 -8
- package/src/tools-panel/types.ts +1 -0
- package/src/truncate/hook.ts +1 -1
- package/src/unit-control/index.tsx +2 -2
- package/src/unit-control/unit-select-control.tsx +2 -2
- package/src/utils/theme-variables.scss +4 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_toolbarButton","_toolbarGroupContainer","_toolbarGroupCollapsed","_toolbarContext","isNestedArray","arr","Array","isArray","ToolbarGroup","controls","children","className","isCollapsed","title","props","accessibleToolbarState","useContext","ToolbarContext","length","finalClassName","clsx","controlSets","_react","createElement","default","label","flatMap","controlSet","indexOfSet","map","control","indexOfControl","key","join","containerClassName","undefined","_default","exports"],"sources":["@wordpress/components/src/toolbar/toolbar-group/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ToolbarButton from '../toolbar-button';\nimport ToolbarGroupContainer from './toolbar-group-container';\nimport ToolbarGroupCollapsed from './toolbar-group-collapsed';\nimport ToolbarContext from '../toolbar-context';\nimport type { ToolbarGroupProps, ToolbarGroupControls } from './types';\n\nfunction isNestedArray< T = any >( arr: T[] | T[][] ): arr is T[][] {\n\treturn Array.isArray( arr ) && Array.isArray( arr[ 0 ] );\n}\n\n/**\n * Renders a collapsible group of controls\n *\n * The `controls` prop accepts an array of sets. A set is an array of controls.\n * Controls have the following shape:\n *\n * ```\n * {\n * icon: string,\n * title: string,\n * subscript: string,\n * onClick: Function,\n * isActive: boolean,\n * isDisabled: boolean\n * }\n * ```\n *\n * For convenience it is also possible to pass only an array of controls. It is\n * then assumed this is the only set.\n *\n * Either `controls` or `children` is required, otherwise this components\n * renders nothing.\n *\n * @param props Component props.\n * @param [props.controls] The controls to render in this toolbar.\n * @param [props.children] Any other things to render inside the toolbar besides the controls.\n * @param [props.className] Class to set on the container div.\n * @param [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.\n * @param [props.title] ARIA label for dropdown menu if is collapsed.\n */\nfunction ToolbarGroup( {\n\tcontrols = [],\n\tchildren,\n\tclassName,\n\tisCollapsed,\n\ttitle,\n\t...props\n}: ToolbarGroupProps ) {\n\t// It'll contain state if `ToolbarGroup` is being used within\n\t// `<Toolbar label=\"label\" />`\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ( ! controls || ! controls.length ) && ! children ) {\n\t\treturn null;\n\t}\n\n\tconst finalClassName = clsx(\n\t\t// Unfortunately, there's legacy code referencing to `.components-toolbar`\n\t\t// So we can't get rid of it\n\t\taccessibleToolbarState\n\t\t\t? 'components-toolbar-group'\n\t\t\t: 'components-toolbar',\n\t\tclassName\n\t);\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets: ToolbarGroupControls[][];\n\tif ( isNestedArray( controls ) ) {\n\t\tcontrolSets = controls;\n\t} else {\n\t\tcontrolSets = [ controls ];\n\t}\n\n\tif ( isCollapsed ) {\n\t\treturn (\n\t\t\t<ToolbarGroupCollapsed\n\t\t\t\tlabel={ title }\n\t\t\t\tcontrols={ controlSets }\n\t\t\t\tclassName={ finalClassName }\n\t\t\t\tchildren={ children }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToolbarGroupContainer className={ finalClassName } { ...props }>\n\t\t\t{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>\n\t\t\t\tcontrolSet.map( ( control, indexOfControl: number ) => (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tkey={ [ indexOfSet, indexOfControl ].join() }\n\t\t\t\t\t\tcontainerClassName={\n\t\t\t\t\t\t\tindexOfSet > 0 && indexOfControl === 0\n\t\t\t\t\t\t\t\t? 'has-left-divider'\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...control }\n\t\t\t\t\t/>\n\t\t\t\t) )\n\t\t\t) }\n\t\t\t{ children }\n\t\t</ToolbarGroupContainer>\n\t);\n}\n\nexport default ToolbarGroup;\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAKA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,sBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,sBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAOA,SAASM,aAAaA,CAAaC,GAAgB,EAAiB;EACnE,OAAOC,KAAK,CAACC,OAAO,CAAEF,GAAI,CAAC,IAAIC,KAAK,CAACC,OAAO,CAAEF,GAAG,CAAE,CAAC,CAAG,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASG,YAAYA,CAAE;EACtBC,QAAQ,GAAG,EAAE;EACbC,QAAQ;EACRC,SAAS;EACTC,WAAW;EACXC,KAAK;EACL,GAAGC;AACe,CAAC,EAAG;EACtB;EACA;EACA,MAAMC,sBAAsB,GAAG,IAAAC,mBAAU,EAAEC,uBAAe,CAAC;EAE3D,IAAK,CAAE,CAAER,QAAQ,IAAI,CAAEA,QAAQ,CAACS,MAAM,KAAM,CAAER,QAAQ,EAAG;IACxD,OAAO,IAAI;EACZ;EAEA,MAAMS,cAAc,GAAG,IAAAC,aAAI;EAC1B;EACA;EACAL,sBAAsB,GACnB,0BAA0B,GAC1B,oBAAoB,EACvBJ,SACD,CAAC;;EAED;EACA,IAAIU,WAAqC;EACzC,IAAKjB,aAAa,CAAEK,QAAS,CAAC,EAAG;IAChCY,WAAW,GAAGZ,QAAQ;EACvB,CAAC,MAAM;IACNY,WAAW,GAAG,CAAEZ,QAAQ,CAAE;EAC3B;EAEA,IAAKG,WAAW,EAAG;IAClB,OACC,IAAAU,MAAA,CAAAC,aAAA,EAACrB,sBAAA,CAAAsB,OAAqB;MACrBC,KAAK,EAAGZ,KAAO;MACfJ,QAAQ,EAAGY,WAAa;MACxBV,SAAS,EAAGQ,cAAgB;MAC5BT,QAAQ,EAAGA,QAAU;MAAA,GAChBI;IAAK,CACV,CAAC;EAEJ;EAEA,OACC,IAAAQ,MAAA,CAAAC,aAAA,EAACtB,sBAAA,CAAAuB,OAAqB;IAACb,SAAS,EAAGQ,cAAgB;IAAA,GAAML;EAAK,GAC3DO,WAAW,EAAEK,OAAO,CAAE,CAAEC,UAAU,EAAEC,UAAU,KAC/CD,UAAU,CAACE,GAAG,CAAE,CAAEC,OAAO,EAAEC,cAAsB,KAChD,IAAAT,MAAA,CAAAC,aAAA,EAACvB,cAAA,CAAAwB,OAAa;IACbQ,GAAG,EAAG,CAAEJ,UAAU,EAAEG,cAAc,CAAE,CAACE,IAAI,CAAC,CAAG;IAC7CC,kBAAkB,EACjBN,UAAU,GAAG,CAAC,IAAIG,cAAc,KAAK,CAAC,GACnC,kBAAkB,GAClBI,SACH;IAAA,GACIL;EAAO,CACZ,CACA,CACH,CAAC,EACCpB,QACoB,CAAC;AAE1B;AAAC,IAAA0B,QAAA,GAAAC,OAAA,CAAAb,OAAA,GAEchB,YAAY","ignoreList":[]}
|
|
@@ -171,17 +171,16 @@ function useToolsPanel(props) {
|
|
|
171
171
|
});
|
|
172
172
|
}, [panelItems, setMenuItems, menuItemOrder]);
|
|
173
173
|
|
|
174
|
-
//
|
|
175
|
-
//
|
|
176
|
-
//
|
|
177
|
-
|
|
178
|
-
const flagItemCustomization = (0, _element.useCallback)((label, group = 'default') => {
|
|
174
|
+
// Updates the status of the panel’s menu items. For default items the
|
|
175
|
+
// value represents whether it differs from the default and for optional
|
|
176
|
+
// items whether the item is shown.
|
|
177
|
+
const flagItemCustomization = (0, _element.useCallback)((value, label, group = 'default') => {
|
|
179
178
|
setMenuItems(items => {
|
|
180
179
|
const newState = {
|
|
181
180
|
...items,
|
|
182
181
|
[group]: {
|
|
183
182
|
...items[group],
|
|
184
|
-
[label]:
|
|
183
|
+
[label]: value
|
|
185
184
|
}
|
|
186
185
|
};
|
|
187
186
|
return newState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","styles","_interopRequireWildcard","_context","_useCx","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItemOrder","newMenuItems","optional","menuItems","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","key","keys","isMenuItemTypeEmpty","obj","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","useContextSystem","isResetting","useRef","wasResetting","current","useEffect","setPanelItems","useState","setMenuItemOrder","resetAllFilters","setResetAllFilters","registerPanelItem","useCallback","item","items","newItems","existingIndex","findIndex","oldItem","splice","includes","deregisterPanelItem","index","registerResetAllFilter","newFilter","filters","deregisterResetAllFilter","filterToRemove","filter","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","allControlsHidden","entries","some","isSelected","cx","useCx","classes","useMemo","wrapperStyle","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","resetAllItems","resetMenuItems","getFirstVisibleItemLabel","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","panelContext","hasMenuItems"],"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n\tResetAllFilter,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n\tmenuItemOrder,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst newMenuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label has already been flagged as customized\n\t\t// (for default controls), or toggled on (for optional controls), do not\n\t\t// overwrite its value as those controls would lose that state.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value = existingItemValue ? existingItemValue : hasValue();\n\n\t\tnewMenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\t// Loop the known, previously registered items first to maintain menu order.\n\tmenuItemOrder.forEach( ( key ) => {\n\t\tif ( newMenuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\n\t\tif ( newMenuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\t// Loop newMenuItems object adding any that aren't in the known items order.\n\tObject.keys( newMenuItems.default ).forEach( ( key ) => {\n\t\tif ( ! menuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\t} );\n\n\tObject.keys( newMenuItems.optional ).forEach( ( key ) => {\n\t\tif ( ! menuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\treturn menuItems;\n};\n\nconst isMenuItemTypeEmpty = (\n\tobj?: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => obj && Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\theadingLevel = 2,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper = false,\n\t\tshouldRenderPlaceholderItems = false,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResetting = useRef( false );\n\tconst wasResetting = isResetting.current;\n\n\t// `isResetting` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResetting.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\tconst [ menuItemOrder, setMenuItemOrder ] = useState< string[] >( [] );\n\tconst [ resetAllFilters, setResetAllFilters ] = useState<\n\t\tResetAllFilter[]\n\t>( [] );\n\n\tconst registerPanelItem = useCallback(\n\t\t( item: ToolsPanelItem ) => {\n\t\t\t// Add item to panel items.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t\t// and optional groups.\n\t\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t\t);\n\t\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t\t}\n\t\t\t\treturn [ ...newItems, item ];\n\t\t\t} );\n\n\t\t\t// Track the initial order of item registration. This is used for\n\t\t\t// maintaining menu item order later.\n\t\t\tsetMenuItemOrder( ( items ) => {\n\t\t\t\tif ( items.includes( item.label ) ) {\n\t\t\t\t\treturn items;\n\t\t\t\t}\n\n\t\t\t\treturn [ ...items, item.label ];\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems, setMenuItemOrder ]\n\t);\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback(\n\t\t( label: string ) => {\n\t\t\t// When switching selections between components injecting matching\n\t\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t\t// deregistration of the first panel doesn't occur until after the\n\t\t\t// registration of the next.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\tconst index = newItems.findIndex(\n\t\t\t\t\t( item ) => item.label === label\n\t\t\t\t);\n\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\t}\n\t\t\t\treturn newItems;\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\tconst registerResetAllFilter = useCallback(\n\t\t( newFilter: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn [ ...filters, newFilter ];\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\tconst deregisterResetAllFilter = useCallback(\n\t\t( filterToRemove: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn filters.filter(\n\t\t\t\t\t( filter ) => filter !== filterToRemove\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t\tmenuItemOrder,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ panelItems, setMenuItems, menuItemOrder ] );\n\n\t// Force a menu item to be checked.\n\t// This is intended for use with default panel items. They are displayed\n\t// separately to optional items and have different display states,\n\t// we need to update that when their value is customized.\n\tconst flagItemCustomization = useCallback(\n\t\t( label: string, group: ToolsPanelMenuItemKey = 'default' ) => {\n\t\t\tsetMenuItems( ( items ) => {\n\t\t\t\tconst newState = {\n\t\t\t\t\t...items,\n\t\t\t\t\t[ group ]: {\n\t\t\t\t\t\t...items[ group ],\n\t\t\t\t\t\t[ label ]: true,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn newState;\n\t\t\t} );\n\t\t},\n\t\t[ setMenuItems ]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst [ areAllOptionalControlsHidden, setAreAllOptionalControlsHidden ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems?.optional )\n\t\t) {\n\t\t\tconst allControlsHidden = ! Object.entries(\n\t\t\t\tmenuItems.optional\n\t\t\t).some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems, setAreAllOptionalControlsHidden ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx(\n\t\t\tstyles.ToolsPanel( DEFAULT_COLUMNS ),\n\t\t\twrapperStyle,\n\t\t\temptyStyle,\n\t\t\tclassName\n\t\t);\n\t}, [\n\t\tareAllOptionalControlsHidden,\n\t\tclassName,\n\t\tcx,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback(\n\t\t( label: string ) => {\n\t\t\tconst currentItem = panelItems.find(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tsetMenuItems( newMenuItems );\n\t\t},\n\t\t[ menuItems, panelItems, setMenuItems ]\n\t);\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResetting.current = true;\n\t\t\tresetAll( resetAllFilters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tmenuItemOrder,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t}, [ panelItems, resetAllFilters, resetAll, setMenuItems, menuItemOrder ] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || !! optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems: !! panelItems.length,\n\t\t\tisResetting: isResetting.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tregisterResetAllFilter,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tpanelItems,\n\t\t\tregisterResetAllFilter,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n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GC,UAAU;IACbP,YAAY;IACZoE,YAAY;IACZR,aAAa;IACbJ,UAAU;IACVzD,SAAS,EAAEkD;EACZ,CAAC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_element","require","styles","_interopRequireWildcard","_context","_useCx","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItemOrder","newMenuItems","optional","menuItems","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","key","keys","isMenuItemTypeEmpty","obj","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","useContextSystem","isResetting","useRef","wasResetting","current","useEffect","setPanelItems","useState","setMenuItemOrder","resetAllFilters","setResetAllFilters","registerPanelItem","useCallback","item","items","newItems","existingIndex","findIndex","oldItem","splice","includes","deregisterPanelItem","index","registerResetAllFilter","newFilter","filters","deregisterResetAllFilter","filterToRemove","filter","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","allControlsHidden","entries","some","isSelected","cx","useCx","classes","useMemo","wrapperStyle","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","resetAllItems","resetMenuItems","getFirstVisibleItemLabel","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","panelContext","hasMenuItems"],"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n\tResetAllFilter,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n\tmenuItemOrder,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst newMenuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label has already been flagged as customized\n\t\t// (for default controls), or toggled on (for optional controls), do not\n\t\t// overwrite its value as those controls would lose that state.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value = existingItemValue ? existingItemValue : hasValue();\n\n\t\tnewMenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\t// Loop the known, previously registered items first to maintain menu order.\n\tmenuItemOrder.forEach( ( key ) => {\n\t\tif ( newMenuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\n\t\tif ( newMenuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\t// Loop newMenuItems object adding any that aren't in the known items order.\n\tObject.keys( newMenuItems.default ).forEach( ( key ) => {\n\t\tif ( ! menuItems.default.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.default[ key ] = newMenuItems.default[ key ];\n\t\t}\n\t} );\n\n\tObject.keys( newMenuItems.optional ).forEach( ( key ) => {\n\t\tif ( ! menuItems.optional.hasOwnProperty( key ) ) {\n\t\t\tmenuItems.optional[ key ] = newMenuItems.optional[ key ];\n\t\t}\n\t} );\n\n\treturn menuItems;\n};\n\nconst isMenuItemTypeEmpty = (\n\tobj?: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => obj && Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\theadingLevel = 2,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper = false,\n\t\tshouldRenderPlaceholderItems = false,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResetting = useRef( false );\n\tconst wasResetting = isResetting.current;\n\n\t// `isResetting` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResetting.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\tconst [ menuItemOrder, setMenuItemOrder ] = useState< string[] >( [] );\n\tconst [ resetAllFilters, setResetAllFilters ] = useState<\n\t\tResetAllFilter[]\n\t>( [] );\n\n\tconst registerPanelItem = useCallback(\n\t\t( item: ToolsPanelItem ) => {\n\t\t\t// Add item to panel items.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t\t// and optional groups.\n\t\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t\t);\n\t\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t\t}\n\t\t\t\treturn [ ...newItems, item ];\n\t\t\t} );\n\n\t\t\t// Track the initial order of item registration. This is used for\n\t\t\t// maintaining menu item order later.\n\t\t\tsetMenuItemOrder( ( items ) => {\n\t\t\t\tif ( items.includes( item.label ) ) {\n\t\t\t\t\treturn items;\n\t\t\t\t}\n\n\t\t\t\treturn [ ...items, item.label ];\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems, setMenuItemOrder ]\n\t);\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback(\n\t\t( label: string ) => {\n\t\t\t// When switching selections between components injecting matching\n\t\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t\t// deregistration of the first panel doesn't occur until after the\n\t\t\t// registration of the next.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\tconst index = newItems.findIndex(\n\t\t\t\t\t( item ) => item.label === label\n\t\t\t\t);\n\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\t}\n\t\t\t\treturn newItems;\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\tconst registerResetAllFilter = useCallback(\n\t\t( newFilter: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn [ ...filters, newFilter ];\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\tconst deregisterResetAllFilter = useCallback(\n\t\t( filterToRemove: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn filters.filter(\n\t\t\t\t\t( filter ) => filter !== filterToRemove\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t\tmenuItemOrder,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ panelItems, setMenuItems, menuItemOrder ] );\n\n\t// Updates the status of the panel’s menu items. For default items the\n\t// value represents whether it differs from the default and for optional\n\t// items whether the item is shown.\n\tconst flagItemCustomization = useCallback(\n\t\t(\n\t\t\tvalue: boolean,\n\t\t\tlabel: string,\n\t\t\tgroup: ToolsPanelMenuItemKey = 'default'\n\t\t) => {\n\t\t\tsetMenuItems( ( items ) => {\n\t\t\t\tconst newState = {\n\t\t\t\t\t...items,\n\t\t\t\t\t[ group ]: {\n\t\t\t\t\t\t...items[ group ],\n\t\t\t\t\t\t[ label ]: value,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn newState;\n\t\t\t} );\n\t\t},\n\t\t[ setMenuItems ]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst [ areAllOptionalControlsHidden, setAreAllOptionalControlsHidden ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems?.optional )\n\t\t) {\n\t\t\tconst allControlsHidden = ! Object.entries(\n\t\t\t\tmenuItems.optional\n\t\t\t).some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems, setAreAllOptionalControlsHidden ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx(\n\t\t\tstyles.ToolsPanel( DEFAULT_COLUMNS ),\n\t\t\twrapperStyle,\n\t\t\temptyStyle,\n\t\t\tclassName\n\t\t);\n\t}, [\n\t\tareAllOptionalControlsHidden,\n\t\tclassName,\n\t\tcx,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback(\n\t\t( label: string ) => {\n\t\t\tconst currentItem = panelItems.find(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tsetMenuItems( newMenuItems );\n\t\t},\n\t\t[ menuItems, panelItems, setMenuItems ]\n\t);\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResetting.current = true;\n\t\t\tresetAll( resetAllFilters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tmenuItemOrder,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t}, [ panelItems, resetAllFilters, resetAll, setMenuItems, menuItemOrder ] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || !! optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems: !! panelItems.length,\n\t\t\tisResetting: isResetting.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tregisterResetAllFilter,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tpanelItems,\n\t\t\tregisterResetAllFilter,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t]\n\t);\n\n\treturn {\n\t\t...otherProps,\n\t\theadingLevel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAA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usePrevious)(isMenuItemChecked);
|
|
100
100
|
const isRegistered = menuItems?.[menuGroup]?.[label] !== undefined;
|
|
101
101
|
const isValueSet = hasValue();
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
// Notify the panel when an item's value has been set.
|
|
102
|
+
// Notify the panel when an item's value has changed except for optional
|
|
103
|
+
// items without value because the item should not cause itself to hide.
|
|
106
104
|
(0, _element.useEffect)(() => {
|
|
107
|
-
if (!
|
|
105
|
+
if (!isShownByDefault && !isValueSet) {
|
|
108
106
|
return;
|
|
109
107
|
}
|
|
110
|
-
flagItemCustomization(label, menuGroup);
|
|
111
|
-
}, [
|
|
108
|
+
flagItemCustomization(isValueSet, label, menuGroup);
|
|
109
|
+
}, [isValueSet, menuGroup, label, flagItemCustomization, isShownByDefault]);
|
|
112
110
|
|
|
113
111
|
// Determine if the panel item's corresponding menu is being toggled and
|
|
114
112
|
// trigger appropriate callback if it is.
|
|
@@ -122,7 +120,7 @@ function useToolsPanelItem(props) {
|
|
|
122
120
|
if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {
|
|
123
121
|
onSelect?.();
|
|
124
122
|
}
|
|
125
|
-
if (!isMenuItemChecked && wasMenuItemChecked) {
|
|
123
|
+
if (!isMenuItemChecked && isValueSet && wasMenuItemChecked) {
|
|
126
124
|
onDeselect?.();
|
|
127
125
|
}
|
|
128
126
|
}, [hasMatchingPanel, isMenuItemChecked, isRegistered, isResetting, isValueSet, wasMenuItemChecked, onSelect, onDeselect]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_element","styles","_interopRequireWildcard","_context","_context2","_useCx","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","noop","useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","useContextSystem","currentPanelId","menuItems","registerResetAllFilter","deregisterResetAllFilter","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","useToolsPanelContext","hasValueCallback","useCallback","resetAllFilterCallback","previousPanelId","usePrevious","hasMatchingPanel","useLayoutEffect","useEffect","menuGroup","isMenuItemChecked","wasMenuItemChecked","isRegistered","undefined","isValueSet","wasValueSet","newValueSet","isShown","cx","useCx","classes","useMemo","shouldApplyPlaceholderStyles","firstItemStyle","lastItemStyle","ToolsPanelItem","ToolsPanelItemPlaceholder"],"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nconst noop = () => {};\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault = false,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter = noop,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\t// hasValue is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst hasValueCallback = useCallback( hasValue, [ panelId ] );\n\t// resetAllFilter is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [ panelId ] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\t//\n\t// This is performed in a layout effect to ensure that the panel item\n\t// is registered before it is rendered preventing a rendering glitch.\n\t// See: https://github.com/WordPress/gutenberg/issues/56470\n\tuseLayoutEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t] );\n\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel ) {\n\t\t\tregisterResetAllFilter( resetAllFilterCallback );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( hasMatchingPanel ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilterCallback );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tresetAllFilterCallback,\n\t\thasMatchingPanel,\n\t] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\tconst isRegistered = menuItems?.[ menuGroup ]?.[ label ] !== undefined;\n\n\tconst isValueSet = hasValue();\n\tconst wasValueSet = usePrevious( isValueSet );\n\tconst newValueSet = isValueSet && ! wasValueSet;\n\n\t// Notify the panel when an item's value has been set.\n\tuseEffect( () => {\n\t\tif ( ! newValueSet ) {\n\t\t\treturn;\n\t\t}\n\n\t\tflagItemCustomization( label, menuGroup );\n\t}, [ newValueSet, menuGroup, label, flagItemCustomization ] );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\t// We check whether this item is currently registered as items rendered\n\t\t// via fills can persist through the parent panel being remounted.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45673\n\t\tif ( ! isRegistered || isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisRegistered,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t\tonSelect,\n\t\tonDeselect,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst shouldApplyPlaceholderStyles =\n\t\t\tshouldRenderPlaceholder && ! isShown;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tshouldApplyPlaceholderStyles && styles.ToolsPanelItemPlaceholder,\n\t\t\t! shouldApplyPlaceholderStyles && className,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\tlabel,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAUA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAiD,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,e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AAkB,EAClB5B,QAAQ,EACRD,UAAU,CACT,CAAC;;EAEH;EACA;EACA;EACA,MAAMmC,OAAO,GAAGvC,gBAAgB,GAC7BS,SAAS,GAAIsB,SAAS,CAAE,GAAI9B,KAAK,CAAE,KAAKkC,SAAS,GACjDH,iBAAiB;EAEpB,MAAMQ,EAAE,GAAG,IAAAC,YAAK,EAAC,CAAC;EAClB,MAAMC,OAAO,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC9B,MAAMC,4BAA4B,GACjC3B,uBAAuB,IAAI,CAAEsB,OAAO;IACrC,MAAMM,cAAc,GACnB3B,kBAAkB,KAAKjB,KAAK,IAAImB,mCAAmC;IACpE,MAAM0B,aAAa,GAClB3B,iBAAiB,KAAKlB,KAAK,IAAIoB,kCAAkC;IAClE,OAAOmB,EAAE,CACRtE,MAAM,CAAC6E,cAAc,EACrBH,4BAA4B,IAAI1E,MAAM,CAAC8E,yBAAyB,EAChE,CAAEJ,4BAA4B,IAAI9C,SAAS,EAC3C+C,cAAc,EACdC,aACD,CAAC;EACF,CAAC,EAAE,CACFP,OAAO,EACPtB,uBAAuB,EACvBnB,SAAS,EACT0C,EAAE,EACFtB,kBAAkB,EAClBC,iBAAiB,EACjBC,mCAAmC,EACnCC,kCAAkC,EAClCpB,KAAK,CACJ,CAAC;EAEH,OAAO;IACN,GAAGK,UAAU;IACbiC,OAAO;IACPtB,uBAAuB;IACvBnB,SAAS,EAAE4C;EACZ,CAAC;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_compose","require","_element","styles","_interopRequireWildcard","_context","_context2","_useCx","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","noop","useToolsPanelItem","props","className","hasValue","isShownByDefault","label","panelId","resetAllFilter","onDeselect","onSelect","otherProps","useContextSystem","currentPanelId","menuItems","registerResetAllFilter","deregisterResetAllFilter","registerPanelItem","deregisterPanelItem","flagItemCustomization","isResetting","shouldRenderPlaceholderItems","shouldRenderPlaceholder","firstDisplayedItem","lastDisplayedItem","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","useToolsPanelContext","hasValueCallback","useCallback","resetAllFilterCallback","previousPanelId","usePrevious","hasMatchingPanel","useLayoutEffect","useEffect","menuGroup","isMenuItemChecked","wasMenuItemChecked","isRegistered","undefined","isValueSet","isShown","cx","useCx","classes","useMemo","shouldApplyPlaceholderStyles","firstItemStyle","lastItemStyle","ToolsPanelItem","ToolsPanelItemPlaceholder"],"sources":["@wordpress/components/src/tools-panel/tools-panel-item/hook.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { usePrevious } from '@wordpress/compose';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseMemo,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useToolsPanelContext } from '../context';\nimport type { WordPressComponentProps } from '../../context';\nimport { useContextSystem } from '../../context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type { ToolsPanelItemProps } from '../types';\n\nconst noop = () => {};\n\nexport function useToolsPanelItem(\n\tprops: WordPressComponentProps< ToolsPanelItemProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\thasValue,\n\t\tisShownByDefault = false,\n\t\tlabel,\n\t\tpanelId,\n\t\tresetAllFilter = noop,\n\t\tonDeselect,\n\t\tonSelect,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanelItem' );\n\n\tconst {\n\t\tpanelId: currentPanelId,\n\t\tmenuItems,\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t\tflagItemCustomization,\n\t\tisResetting,\n\t\tshouldRenderPlaceholderItems: shouldRenderPlaceholder,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t} = useToolsPanelContext();\n\n\t// hasValue is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst hasValueCallback = useCallback( hasValue, [ panelId ] );\n\t// resetAllFilter is a new function on every render, so do not add it as a\n\t// dependency to the useCallback hook! If needed, we should use a ref.\n\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\tconst resetAllFilterCallback = useCallback( resetAllFilter, [ panelId ] );\n\tconst previousPanelId = usePrevious( currentPanelId );\n\n\tconst hasMatchingPanel =\n\t\tcurrentPanelId === panelId || currentPanelId === null;\n\n\t// Registering the panel item allows the panel to include it in its\n\t// automatically generated menu and determine its initial checked status.\n\t//\n\t// This is performed in a layout effect to ensure that the panel item\n\t// is registered before it is rendered preventing a rendering glitch.\n\t// See: https://github.com/WordPress/gutenberg/issues/56470\n\tuseLayoutEffect( () => {\n\t\tif ( hasMatchingPanel && previousPanelId !== null ) {\n\t\t\tregisterPanelItem( {\n\t\t\t\thasValue: hasValueCallback,\n\t\t\t\tisShownByDefault,\n\t\t\t\tlabel,\n\t\t\t\tpanelId,\n\t\t\t} );\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (\n\t\t\t\t( previousPanelId === null && !! currentPanelId ) ||\n\t\t\t\tcurrentPanelId === panelId\n\t\t\t) {\n\t\t\t\tderegisterPanelItem( label );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tcurrentPanelId,\n\t\thasMatchingPanel,\n\t\tisShownByDefault,\n\t\tlabel,\n\t\thasValueCallback,\n\t\tpanelId,\n\t\tpreviousPanelId,\n\t\tregisterPanelItem,\n\t\tderegisterPanelItem,\n\t] );\n\n\tuseEffect( () => {\n\t\tif ( hasMatchingPanel ) {\n\t\t\tregisterResetAllFilter( resetAllFilterCallback );\n\t\t}\n\t\treturn () => {\n\t\t\tif ( hasMatchingPanel ) {\n\t\t\t\tderegisterResetAllFilter( resetAllFilterCallback );\n\t\t\t}\n\t\t};\n\t}, [\n\t\tregisterResetAllFilter,\n\t\tderegisterResetAllFilter,\n\t\tresetAllFilterCallback,\n\t\thasMatchingPanel,\n\t] );\n\n\t// Note: `label` is used as a key when building menu item state in\n\t// `ToolsPanel`.\n\tconst menuGroup = isShownByDefault ? 'default' : 'optional';\n\tconst isMenuItemChecked = menuItems?.[ menuGroup ]?.[ label ];\n\tconst wasMenuItemChecked = usePrevious( isMenuItemChecked );\n\tconst isRegistered = menuItems?.[ menuGroup ]?.[ label ] !== undefined;\n\n\tconst isValueSet = hasValue();\n\t// Notify the panel when an item's value has changed except for optional\n\t// items without value because the item should not cause itself to hide.\n\tuseEffect( () => {\n\t\tif ( ! isShownByDefault && ! isValueSet ) {\n\t\t\treturn;\n\t\t}\n\n\t\tflagItemCustomization( isValueSet, label, menuGroup );\n\t}, [\n\t\tisValueSet,\n\t\tmenuGroup,\n\t\tlabel,\n\t\tflagItemCustomization,\n\t\tisShownByDefault,\n\t] );\n\n\t// Determine if the panel item's corresponding menu is being toggled and\n\t// trigger appropriate callback if it is.\n\tuseEffect( () => {\n\t\t// We check whether this item is currently registered as items rendered\n\t\t// via fills can persist through the parent panel being remounted.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45673\n\t\tif ( ! isRegistered || isResetting || ! hasMatchingPanel ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isMenuItemChecked && ! isValueSet && ! wasMenuItemChecked ) {\n\t\t\tonSelect?.();\n\t\t}\n\n\t\tif ( ! isMenuItemChecked && isValueSet && wasMenuItemChecked ) {\n\t\t\tonDeselect?.();\n\t\t}\n\t}, [\n\t\thasMatchingPanel,\n\t\tisMenuItemChecked,\n\t\tisRegistered,\n\t\tisResetting,\n\t\tisValueSet,\n\t\twasMenuItemChecked,\n\t\tonSelect,\n\t\tonDeselect,\n\t] );\n\n\t// The item is shown if it is a default control regardless of whether it\n\t// has a value. Optional items are shown when they are checked or have\n\t// a value.\n\tconst isShown = isShownByDefault\n\t\t? menuItems?.[ menuGroup ]?.[ label ] !== undefined\n\t\t: isMenuItemChecked;\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst shouldApplyPlaceholderStyles =\n\t\t\tshouldRenderPlaceholder && ! isShown;\n\t\tconst firstItemStyle =\n\t\t\tfirstDisplayedItem === label && __experimentalFirstVisibleItemClass;\n\t\tconst lastItemStyle =\n\t\t\tlastDisplayedItem === label && __experimentalLastVisibleItemClass;\n\t\treturn cx(\n\t\t\tstyles.ToolsPanelItem,\n\t\t\tshouldApplyPlaceholderStyles && styles.ToolsPanelItemPlaceholder,\n\t\t\t! shouldApplyPlaceholderStyles && className,\n\t\t\tfirstItemStyle,\n\t\t\tlastItemStyle\n\t\t);\n\t}, [\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName,\n\t\tcx,\n\t\tfirstDisplayedItem,\n\t\tlastDisplayedItem,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\tlabel,\n\t] );\n\n\treturn {\n\t\t...otherProps,\n\t\tisShown,\n\t\tshouldRenderPlaceholder,\n\t\tclassName: classes,\n\t};\n}\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAUA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAAiD,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CA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EACA;EACA,MAAMiC,OAAO,GAAGrC,gBAAgB,GAC7BS,SAAS,GAAIsB,SAAS,CAAE,GAAI9B,KAAK,CAAE,KAAKkC,SAAS,GACjDH,iBAAiB;EAEpB,MAAMM,EAAE,GAAG,IAAAC,YAAK,EAAC,CAAC;EAClB,MAAMC,OAAO,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC9B,MAAMC,4BAA4B,GACjCzB,uBAAuB,IAAI,CAAEoB,OAAO;IACrC,MAAMM,cAAc,GACnBzB,kBAAkB,KAAKjB,KAAK,IAAImB,mCAAmC;IACpE,MAAMwB,aAAa,GAClBzB,iBAAiB,KAAKlB,KAAK,IAAIoB,kCAAkC;IAClE,OAAOiB,EAAE,CACRpE,MAAM,CAAC2E,cAAc,EACrBH,4BAA4B,IAAIxE,MAAM,CAAC4E,yBAAyB,EAChE,CAAEJ,4BAA4B,IAAI5C,SAAS,EAC3C6C,cAAc,EACdC,aACD,CAAC;EACF,CAAC,EAAE,CACFP,OAAO,EACPpB,uBAAuB,EACvBnB,SAAS,EACTwC,EAAE,EACFpB,kBAAkB,EAClBC,iBAAiB,EACjBC,mCAAmC,EACnCC,kCAAkC,EAClCpB,KAAK,CACJ,CAAC;EAEH,OAAO;IACN,GAAGK,UAAU;IACb+B,OAAO;IACPpB,uBAAuB;IACvBnB,SAAS,EAAE0C;EACZ,CAAC;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/components/src/tools-panel/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { HeadingSize } from '../heading/types';\nimport type { DropdownMenu } from '../dropdown-menu';\n\nexport type ResetAllFilter = ( attributes?: any ) => any;\ntype ResetAll = ( filters?: ResetAllFilter[] ) => void;\n\nexport type ToolsPanelProps = {\n\t/**\n\t * The child elements.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * The dropdown menu props to configure the panel's `DropdownMenu`.\n\t */\n\tdropdownMenuProps?: React.ComponentProps< typeof DropdownMenu >;\n\t/**\n\t * Flags that the items in this ToolsPanel will be contained within an inner\n\t * wrapper element allowing the panel to lay them out accordingly.\n\t *\n\t * @default false\n\t */\n\thasInnerWrapper?: boolean;\n\t/**\n\t * The heading level of the panel's header.\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Text to be displayed within the panel's header and as the `aria-label`\n\t * for the panel's dropdown menu.\n\t */\n\tlabel: string;\n\t/**\n\t * If a `panelId` is set, it is passed through the `ToolsPanelContext` and\n\t * used to restrict panel items. When a `panelId` is set, items can only\n\t * register themselves if the `panelId` is explicitly `null` or the item's\n\t * `panelId` matches exactly.\n\t */\n\tpanelId?: string | null;\n\t/**\n\t * A function to call when the `Reset all` menu option is selected. As an\n\t * argument, it receives an array containing the `resetAllFilter` callbacks\n\t * of all the valid registered `ToolsPanelItems`.\n\t */\n\tresetAll: ResetAll;\n\t/**\n\t * Advises the `ToolsPanel` that its child `ToolsPanelItem`s should render\n\t * placeholder content instead of null when they are toggled off and hidden.\n\t * Note that placeholder items won't apply the `className` that would be\n\t * normally applied to a visible `ToolsPanelItem` via the `className` prop.\n\t *\n\t * @default false\n\t */\n\tshouldRenderPlaceholderItems?: boolean;\n\t/**\n\t * Experimental prop allowing for a custom CSS class to be applied to the\n\t * first visible `ToolsPanelItem` within the `ToolsPanel`.\n\t */\n\t__experimentalFirstVisibleItemClass?: string;\n\t/**\n\t * Experimental prop allowing for a custom CSS class to be applied to the\n\t * last visible `ToolsPanelItem` within the `ToolsPanel`.\n\t */\n\t__experimentalLastVisibleItemClass?: string;\n};\n\nexport type ToolsPanelHeaderProps = {\n\t/**\n\t * The dropdown menu props to configure the panel's `DropdownMenu`.\n\t */\n\tdropdownMenuProps?: React.ComponentProps< typeof DropdownMenu >;\n\t/**\n\t * The heading level of the panel's header.\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Text to be displayed within the panel header. It is also passed along as\n\t * the `label` for the panel header's `DropdownMenu`.\n\t */\n\tlabel: string;\n\t/**\n\t * The `resetAll` prop provides the callback to execute when the \"Reset all\"\n\t * menu item is selected. Its purpose is to facilitate resetting any control\n\t * values for items contained within this header's panel.\n\t */\n\tresetAll: ResetAll;\n\t/**\n\t * This is executed when an individual control's menu item is toggled. It\n\t * will update the panel's menu item state and call the panel item's\n\t * `onSelect` or `onDeselect` callbacks as appropriate.\n\t */\n\ttoggleItem: ( label: string ) => void;\n};\n\nexport type ToolsPanelItem = {\n\t/**\n\t * This is called when building the `ToolsPanel` menu to determine the\n\t * item's initial checked state.\n\t */\n\thasValue: () => boolean;\n\t/**\n\t * This prop identifies the current item as being displayed by default. This\n\t * means it will show regardless of whether it has a value set or is toggled\n\t * on in the panel's menu.\n\t *\n\t * @default false\n\t */\n\tisShownByDefault?: boolean;\n\t/**\n\t * The supplied label is dual purpose. It is used as:\n\t * 1. the human-readable label for the panel's dropdown menu\n\t * 2. a key to locate the corresponding item in the panel's menu context to\n\t * determine if the panel item should be displayed.\n\t * A panel item's `label` should be unique among all items within a single\n\t * panel.\n\t */\n\tlabel: string;\n\t/**\n\t * Panel items will ensure they are only registering with their intended panel\n\t * by comparing the `panelId` props set on both the item and the panel itself,\n\t * or if the `panelId` is explicitly `null`. This allows items to be injected\n\t * from a shared source.\n\t */\n\tpanelId?: string | null;\n};\n\nexport type ToolsPanelItemProps = ToolsPanelItem & {\n\t/**\n\t * The child elements.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Called when this item is deselected in the `ToolsPanel` menu. This is\n\t * normally used to reset the panel item control's value.\n\t */\n\tonDeselect?: () => void;\n\t/**\n\t * A callback to take action when this item is selected in the `ToolsPanel`\n\t * menu.\n\t */\n\tonSelect?: () => void;\n\n\t/**\n\t * A `ToolsPanel` will collect each item's `resetAllFilter` and pass an\n\t * array of these functions through to the panel's `resetAll` callback. They\n\t * can then be iterated over to perform additional tasks.\n\t *\n\t * @default noop\n\t */\n\tresetAllFilter?: ResetAllFilter;\n};\n\nexport type ToolsPanelMenuItemKey = 'default' | 'optional';\n\nexport type ToolsPanelMenuItems = {\n\t[ menuItemKey in ToolsPanelMenuItemKey ]: { [ key: string ]: boolean };\n};\n\nexport type ToolsPanelContext = {\n\tpanelId?: string | null;\n\tmenuItems: ToolsPanelMenuItems;\n\thasMenuItems: boolean;\n\tregisterPanelItem: ( item: ToolsPanelItem ) => void;\n\tderegisterPanelItem: ( label: string ) => void;\n\tregisterResetAllFilter: ( filter: ResetAllFilter ) => void;\n\tderegisterResetAllFilter: ( filter: ResetAllFilter ) => void;\n\tflagItemCustomization: (\n\t\tlabel: string,\n\t\tgroup?: ToolsPanelMenuItemKey\n\t) => void;\n\tisResetting: boolean;\n\tshouldRenderPlaceholderItems: boolean;\n\tareAllOptionalControlsHidden: boolean;\n\tfirstDisplayedItem?: string;\n\tlastDisplayedItem?: string;\n\t__experimentalFirstVisibleItemClass?: string;\n\t__experimentalLastVisibleItemClass?: string;\n};\n\nexport type ToolsPanelControlsGroupProps = {\n\titemClassName?: string;\n\titems: [ string, boolean ][];\n\ttoggleItem: ( label: string ) => void;\n};\n\nexport type ToolsPanelMenuItemsConfig = {\n\tpanelItems: ToolsPanelItem[];\n\tshouldReset: boolean;\n\tcurrentMenuItems?: ToolsPanelMenuItems;\n\tmenuItemOrder: string[];\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/components/src/tools-panel/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { HeadingSize } from '../heading/types';\nimport type { DropdownMenu } from '../dropdown-menu';\n\nexport type ResetAllFilter = ( attributes?: any ) => any;\ntype ResetAll = ( filters?: ResetAllFilter[] ) => void;\n\nexport type ToolsPanelProps = {\n\t/**\n\t * The child elements.\n\t */\n\tchildren: ReactNode;\n\t/**\n\t * The dropdown menu props to configure the panel's `DropdownMenu`.\n\t */\n\tdropdownMenuProps?: React.ComponentProps< typeof DropdownMenu >;\n\t/**\n\t * Flags that the items in this ToolsPanel will be contained within an inner\n\t * wrapper element allowing the panel to lay them out accordingly.\n\t *\n\t * @default false\n\t */\n\thasInnerWrapper?: boolean;\n\t/**\n\t * The heading level of the panel's header.\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Text to be displayed within the panel's header and as the `aria-label`\n\t * for the panel's dropdown menu.\n\t */\n\tlabel: string;\n\t/**\n\t * If a `panelId` is set, it is passed through the `ToolsPanelContext` and\n\t * used to restrict panel items. When a `panelId` is set, items can only\n\t * register themselves if the `panelId` is explicitly `null` or the item's\n\t * `panelId` matches exactly.\n\t */\n\tpanelId?: string | null;\n\t/**\n\t * A function to call when the `Reset all` menu option is selected. As an\n\t * argument, it receives an array containing the `resetAllFilter` callbacks\n\t * of all the valid registered `ToolsPanelItems`.\n\t */\n\tresetAll: ResetAll;\n\t/**\n\t * Advises the `ToolsPanel` that its child `ToolsPanelItem`s should render\n\t * placeholder content instead of null when they are toggled off and hidden.\n\t * Note that placeholder items won't apply the `className` that would be\n\t * normally applied to a visible `ToolsPanelItem` via the `className` prop.\n\t *\n\t * @default false\n\t */\n\tshouldRenderPlaceholderItems?: boolean;\n\t/**\n\t * Experimental prop allowing for a custom CSS class to be applied to the\n\t * first visible `ToolsPanelItem` within the `ToolsPanel`.\n\t */\n\t__experimentalFirstVisibleItemClass?: string;\n\t/**\n\t * Experimental prop allowing for a custom CSS class to be applied to the\n\t * last visible `ToolsPanelItem` within the `ToolsPanel`.\n\t */\n\t__experimentalLastVisibleItemClass?: string;\n};\n\nexport type ToolsPanelHeaderProps = {\n\t/**\n\t * The dropdown menu props to configure the panel's `DropdownMenu`.\n\t */\n\tdropdownMenuProps?: React.ComponentProps< typeof DropdownMenu >;\n\t/**\n\t * The heading level of the panel's header.\n\t *\n\t * @default 2\n\t */\n\theadingLevel?: HeadingSize;\n\t/**\n\t * Text to be displayed within the panel header. It is also passed along as\n\t * the `label` for the panel header's `DropdownMenu`.\n\t */\n\tlabel: string;\n\t/**\n\t * The `resetAll` prop provides the callback to execute when the \"Reset all\"\n\t * menu item is selected. Its purpose is to facilitate resetting any control\n\t * values for items contained within this header's panel.\n\t */\n\tresetAll: ResetAll;\n\t/**\n\t * This is executed when an individual control's menu item is toggled. It\n\t * will update the panel's menu item state and call the panel item's\n\t * `onSelect` or `onDeselect` callbacks as appropriate.\n\t */\n\ttoggleItem: ( label: string ) => void;\n};\n\nexport type ToolsPanelItem = {\n\t/**\n\t * This is called when building the `ToolsPanel` menu to determine the\n\t * item's initial checked state.\n\t */\n\thasValue: () => boolean;\n\t/**\n\t * This prop identifies the current item as being displayed by default. This\n\t * means it will show regardless of whether it has a value set or is toggled\n\t * on in the panel's menu.\n\t *\n\t * @default false\n\t */\n\tisShownByDefault?: boolean;\n\t/**\n\t * The supplied label is dual purpose. It is used as:\n\t * 1. the human-readable label for the panel's dropdown menu\n\t * 2. a key to locate the corresponding item in the panel's menu context to\n\t * determine if the panel item should be displayed.\n\t * A panel item's `label` should be unique among all items within a single\n\t * panel.\n\t */\n\tlabel: string;\n\t/**\n\t * Panel items will ensure they are only registering with their intended panel\n\t * by comparing the `panelId` props set on both the item and the panel itself,\n\t * or if the `panelId` is explicitly `null`. This allows items to be injected\n\t * from a shared source.\n\t */\n\tpanelId?: string | null;\n};\n\nexport type ToolsPanelItemProps = ToolsPanelItem & {\n\t/**\n\t * The child elements.\n\t */\n\tchildren?: ReactNode;\n\t/**\n\t * Called when this item is deselected in the `ToolsPanel` menu. This is\n\t * normally used to reset the panel item control's value.\n\t */\n\tonDeselect?: () => void;\n\t/**\n\t * A callback to take action when this item is selected in the `ToolsPanel`\n\t * menu.\n\t */\n\tonSelect?: () => void;\n\n\t/**\n\t * A `ToolsPanel` will collect each item's `resetAllFilter` and pass an\n\t * array of these functions through to the panel's `resetAll` callback. They\n\t * can then be iterated over to perform additional tasks.\n\t *\n\t * @default noop\n\t */\n\tresetAllFilter?: ResetAllFilter;\n};\n\nexport type ToolsPanelMenuItemKey = 'default' | 'optional';\n\nexport type ToolsPanelMenuItems = {\n\t[ menuItemKey in ToolsPanelMenuItemKey ]: { [ key: string ]: boolean };\n};\n\nexport type ToolsPanelContext = {\n\tpanelId?: string | null;\n\tmenuItems: ToolsPanelMenuItems;\n\thasMenuItems: boolean;\n\tregisterPanelItem: ( item: ToolsPanelItem ) => void;\n\tderegisterPanelItem: ( label: string ) => void;\n\tregisterResetAllFilter: ( filter: ResetAllFilter ) => void;\n\tderegisterResetAllFilter: ( filter: ResetAllFilter ) => void;\n\tflagItemCustomization: (\n\t\tvalue: boolean,\n\t\tlabel: string,\n\t\tgroup?: ToolsPanelMenuItemKey\n\t) => void;\n\tisResetting: boolean;\n\tshouldRenderPlaceholderItems: boolean;\n\tareAllOptionalControlsHidden: boolean;\n\tfirstDisplayedItem?: string;\n\tlastDisplayedItem?: string;\n\t__experimentalFirstVisibleItemClass?: string;\n\t__experimentalLastVisibleItemClass?: string;\n};\n\nexport type ToolsPanelControlsGroupProps = {\n\titemClassName?: string;\n\titems: [ string, boolean ][];\n\ttoggleItem: ( label: string ) => void;\n};\n\nexport type ToolsPanelMenuItemsConfig = {\n\tpanelItems: ToolsPanelItem[];\n\tshouldReset: boolean;\n\tcurrentMenuItems?: ToolsPanelMenuItems;\n\tmenuItemOrder: string[];\n};\n"],"mappings":"","ignoreList":[]}
|
package/build/truncate/hook.js
CHANGED
|
@@ -52,7 +52,7 @@ function useTruncate(props) {
|
|
|
52
52
|
// The `word-break: break-all` property first makes sure a text line
|
|
53
53
|
// breaks even when it contains 'unbreakable' content such as long URLs.
|
|
54
54
|
// See https://github.com/WordPress/gutenberg/issues/60860.
|
|
55
|
-
const truncateLines = /*#__PURE__*/(0, _react.css)(
|
|
55
|
+
const truncateLines = /*#__PURE__*/(0, _react.css)(numberOfLines === 1 ? 'word-break: break-all;' : '', " -webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + (process.env.NODE_ENV === "production" ? "" : ";label:truncateLines;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUEwRDJCIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuLyoqXG4gKiBXb3JkUHJlc3MgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB7IHVzZU1lbW8gfSBmcm9tICdAd29yZHByZXNzL2VsZW1lbnQnO1xuXG4vKipcbiAqIEludGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgdHlwZSB7IFdvcmRQcmVzc0NvbXBvbmVudFByb3BzIH0gZnJvbSAnLi4vY29udGV4dCc7XG5pbXBvcnQgeyB1c2VDb250ZXh0U3lzdGVtIH0gZnJvbSAnLi4vY29udGV4dCc7XG5pbXBvcnQgKiBhcyBzdHlsZXMgZnJvbSAnLi9zdHlsZXMnO1xuaW1wb3J0IHsgVFJVTkNBVEVfRUxMSVBTSVMsIFRSVU5DQVRFX1RZUEUsIHRydW5jYXRlQ29udGVudCB9IGZyb20gJy4vdXRpbHMnO1xuaW1wb3J0IHsgdXNlQ3ggfSBmcm9tICcuLi91dGlscy9ob29rcy91c2UtY3gnO1xuaW1wb3J0IHR5cGUgeyBUcnVuY2F0ZVByb3BzIH0gZnJvbSAnLi90eXBlcyc7XG5cbmV4cG9ydCBkZWZhdWx0I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ZW46IHRydW5jYXRlZENvbnRlbnQgfTtcbn1cbiJdfQ== */");
|
|
56
56
|
return cx(shouldTruncate && !numberOfLines && styles.Truncate, shouldTruncate && !!numberOfLines && truncateLines, className);
|
|
57
57
|
}, [className, cx, numberOfLines, shouldTruncate]);
|
|
58
58
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_element","_context","styles","_interopRequireWildcard","_utils","_useCx","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","useTruncate","props","className","children","ellipsis","TRUNCATE_ELLIPSIS","ellipsizeMode","TRUNCATE_TYPE","auto","limit","numberOfLines","otherProps","useContextSystem","cx","useCx","childrenAsText","toString","truncatedContent","truncateContent","shouldTruncate","classes","useMemo","truncateLines","css","process","env","NODE_ENV","Truncate"],"sources":["@wordpress/components/src/truncate/hook.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem } from '../context';\nimport * as styles from './styles';\nimport { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';\nimport { useCx } from '../utils/hooks/use-cx';\nimport type { TruncateProps } from './types';\n\nexport default function useTruncate(\n\tprops: WordPressComponentProps< TruncateProps, 'span' >\n) {\n\tconst {\n\t\tclassName,\n\t\tchildren,\n\t\tellipsis = TRUNCATE_ELLIPSIS,\n\t\tellipsizeMode = TRUNCATE_TYPE.auto,\n\t\tlimit = 0,\n\t\tnumberOfLines = 0,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Truncate' );\n\n\tconst cx = useCx();\n\n\tlet childrenAsText;\n\tif ( typeof children === 'string' ) {\n\t\tchildrenAsText = children;\n\t} else if ( typeof children === 'number' ) {\n\t\tchildrenAsText = children.toString();\n\t}\n\n\tconst truncatedContent = childrenAsText\n\t\t? truncateContent( childrenAsText, {\n\t\t\t\tellipsis,\n\t\t\t\tellipsizeMode,\n\t\t\t\tlimit,\n\t\t\t\tnumberOfLines,\n\t\t } )\n\t\t: children;\n\n\tconst shouldTruncate =\n\t\t!! childrenAsText && ellipsizeMode === TRUNCATE_TYPE.auto;\n\n\tconst classes = useMemo( () => {\n\t\t// The `word-break: break-all` property first makes sure a text line\n\t\t// breaks even when it contains 'unbreakable' content such as long URLs.\n\t\t// See https://github.com/WordPress/gutenberg/issues/60860.\n\t\tconst truncateLines = css`\n\t\t\
|
|
1
|
+
{"version":3,"names":["_react","require","_element","_context","styles","_interopRequireWildcard","_utils","_useCx","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","useTruncate","props","className","children","ellipsis","TRUNCATE_ELLIPSIS","ellipsizeMode","TRUNCATE_TYPE","auto","limit","numberOfLines","otherProps","useContextSystem","cx","useCx","childrenAsText","toString","truncatedContent","truncateContent","shouldTruncate","classes","useMemo","truncateLines","css","process","env","NODE_ENV","Truncate"],"sources":["@wordpress/components/src/truncate/hook.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem } from '../context';\nimport * as styles from './styles';\nimport { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';\nimport { useCx } from '../utils/hooks/use-cx';\nimport type { TruncateProps } from './types';\n\nexport default function useTruncate(\n\tprops: WordPressComponentProps< TruncateProps, 'span' >\n) {\n\tconst {\n\t\tclassName,\n\t\tchildren,\n\t\tellipsis = TRUNCATE_ELLIPSIS,\n\t\tellipsizeMode = TRUNCATE_TYPE.auto,\n\t\tlimit = 0,\n\t\tnumberOfLines = 0,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Truncate' );\n\n\tconst cx = useCx();\n\n\tlet childrenAsText;\n\tif ( typeof children === 'string' ) {\n\t\tchildrenAsText = children;\n\t} else if ( typeof children === 'number' ) {\n\t\tchildrenAsText = children.toString();\n\t}\n\n\tconst truncatedContent = childrenAsText\n\t\t? truncateContent( childrenAsText, {\n\t\t\t\tellipsis,\n\t\t\t\tellipsizeMode,\n\t\t\t\tlimit,\n\t\t\t\tnumberOfLines,\n\t\t } )\n\t\t: children;\n\n\tconst shouldTruncate =\n\t\t!! childrenAsText && ellipsizeMode === TRUNCATE_TYPE.auto;\n\n\tconst classes = useMemo( () => {\n\t\t// The `word-break: break-all` property first makes sure a text line\n\t\t// breaks even when it contains 'unbreakable' content such as long URLs.\n\t\t// See https://github.com/WordPress/gutenberg/issues/60860.\n\t\tconst truncateLines = css`\n\t\t\t${ numberOfLines === 1 ? 'word-break: break-all;' : '' }\n\t\t\t-webkit-box-orient: vertical;\n\t\t\t-webkit-line-clamp: ${ numberOfLines };\n\t\t\tdisplay: -webkit-box;\n\t\t\toverflow: hidden;\n\t\t`;\n\n\t\treturn cx(\n\t\t\tshouldTruncate && ! numberOfLines && styles.Truncate,\n\t\t\tshouldTruncate && !! numberOfLines && truncateLines,\n\t\t\tclassName\n\t\t);\n\t}, [ className, cx, numberOfLines, shouldTruncate ] );\n\n\treturn { ...otherProps, className: classes, children: truncatedContent };\n}\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA8C,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wB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}
|
|
19
19
|
});
|
|
20
20
|
var _react = require("react");
|
|
21
|
-
var
|
|
21
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
22
22
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
23
23
|
var _element = require("@wordpress/element");
|
|
24
24
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -97,7 +97,7 @@ function UnforwardedUnitControl(unitControlProps, forwardedRef) {
|
|
|
97
97
|
setUnit(parsedUnit);
|
|
98
98
|
}
|
|
99
99
|
}, [parsedUnit, setUnit]);
|
|
100
|
-
const classes = (0,
|
|
100
|
+
const classes = (0, _clsx.default)('components-unit-control',
|
|
101
101
|
// This class is added for legacy purposes to maintain it on the outer
|
|
102
102
|
// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139
|
|
103
103
|
'components-unit-control-wrapper', className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_deprecated","_element","_i18n","_unitControlStyles","_unitSelectControl","_utils","_hooks","_strings","_useDeprecatedProps","UnforwardedUnitControl","unitControlProps","forwardedRef","__unstableStateReducer","autoComplete","children","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","onChangeProp","onUnitChange","size","unit","unitProp","units","unitsProp","CSS_UNITS","value","valueProp","onFocus","onFocusProp","props","useDeprecated36pxDefaultSizeProp","deprecated","since","hint","version","nonNullValueProp","undefined","reFirstCharacterOfUnits","useMemo","list","getUnitsWithCurrentUnit","firstUnitValue","rest","firstCharacters","reduce","carry","first","escapeRegExp","substring","includes","RegExp","parsedQuantity","parsedUnit","getParsedQuantityAndUnit","setUnit","useControlledState","length","initial","fallback","useEffect","classes","classnames","handleOnQuantityChange","nextQuantityValue","changeProps","onChangeValue","getValidParsedQuantityAndUnit","join","handleOnUnitChange","nextUnitValue","data","nextValue","default","handleOnKeyDown","event","onKeyDown","metaKey","test","key","refInputSuffix","current","focus","useRef","inputSuffix","_react","createElement","ref","__","__next40pxDefaultSize","onBlur","step","_activeUnit$step","activeUnit","find","option","ValueInput","spinControls","suffix","type","UnitControl","exports","forwardRef","_default"],"sources":["@wordpress/components/src/unit-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { KeyboardEvent, ForwardedRef, SyntheticEvent } from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedQuantityAndUnit,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedQuantityAndUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport { escapeRegExp } from '../utils/strings';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\n\nfunction UnforwardedUnitControl(\n\tunitControlProps: WordPressComponentProps<\n\t\tUnitControlProps,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer,\n\t\tautoComplete = 'off',\n\t\t// @ts-expect-error Ensure that children is omitted from restProps\n\t\tchildren,\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tonUnitChange,\n\t\tsize = 'default',\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\tonFocus: onFocusProp,\n\t\t...props\n\t} = useDeprecated36pxDefaultSizeProp( unitControlProps );\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst [ units, reFirstCharacterOfUnits ] = useMemo( () => {\n\t\tconst list = getUnitsWithCurrentUnit(\n\t\t\tnonNullValueProp,\n\t\t\tunitProp,\n\t\t\tunitsProp\n\t\t);\n\t\tconst [ { value: firstUnitValue = '' } = {}, ...rest ] = list;\n\t\tconst firstCharacters = rest.reduce(\n\t\t\t( carry, { value } ) => {\n\t\t\t\tconst first = escapeRegExp( value?.substring( 0, 1 ) || '' );\n\t\t\t\treturn carry.includes( first )\n\t\t\t\t\t? carry\n\t\t\t\t\t: `${ carry }|${ first }`;\n\t\t\t},\n\t\t\tescapeRegExp( firstUnitValue.substring( 0, 1 ) )\n\t\t);\n\t\treturn [ list, new RegExp( `^(?:${ firstCharacters })$`, 'i' ) ];\n\t}, [ nonNullValueProp, unitProp, unitsProp ] );\n\tconst [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(\n\t\tnonNullValueProp,\n\t\tunitProp,\n\t\tunits\n\t);\n\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunits.length === 1 ? units[ 0 ].value : unitProp,\n\t\t{\n\t\t\tinitial: parsedUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( parsedUnit !== undefined ) {\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t}, [ parsedUnit, setUnit ] );\n\n\tconst classes = classnames(\n\t\t'components-unit-control',\n\t\t// This class is added for legacy purposes to maintain it on the outer\n\t\t// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139\n\t\t'components-unit-control-wrapper',\n\t\tclassName\n\t);\n\n\tconst handleOnQuantityChange = (\n\t\tnextQuantityValue: number | string | undefined,\n\t\tchangeProps: {\n\t\t\tevent: SyntheticEvent;\n\t\t}\n\t) => {\n\t\tif (\n\t\t\tnextQuantityValue === '' ||\n\t\t\ttypeof nextQuantityValue === 'undefined' ||\n\t\t\tnextQuantityValue === null\n\t\t) {\n\t\t\tonChangeProp?.( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tconst onChangeValue = getValidParsedQuantityAndUnit(\n\t\t\tnextQuantityValue,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t).join( '' );\n\n\t\tonChangeProp?.( onChangeValue, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnextUnitValue,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ nextUnitValue }`;\n\t\t}\n\n\t\tonChangeProp?.( nextValue, changeProps );\n\t\tonUnitChange?.( nextUnitValue, changeProps );\n\n\t\tsetUnit( nextUnitValue );\n\t};\n\n\tlet handleOnKeyDown;\n\tif ( ! disableUnits && isUnitSelectTabbable && units.length ) {\n\t\thandleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\t\tprops.onKeyDown?.( event );\n\t\t\t// Unless the meta key was pressed (to avoid interfering with\n\t\t\t// shortcuts, e.g. pastes), moves focus to the unit select if a key\n\t\t\t// matches the first character of a unit.\n\t\t\tif (\n\t\t\t\t! event.metaKey &&\n\t\t\t\treFirstCharacterOfUnits.test( event.key )\n\t\t\t) {\n\t\t\t\trefInputSuffix.current?.focus();\n\t\t\t}\n\t\t};\n\t}\n\n\tconst refInputSuffix = useRef< HTMLSelectElement >( null );\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\tref={ refInputSuffix }\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={\n\t\t\t\t[ 'small', 'compact' ].includes( size ) ||\n\t\t\t\t( size === 'default' && ! props.__next40pxDefaultSize )\n\t\t\t\t\t? 'small'\n\t\t\t\t\t: 'default'\n\t\t\t}\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t\tonFocus={ onFocusProp }\n\t\t\tonBlur={ unitControlProps.onBlur }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<ValueInput\n\t\t\t{ ...props }\n\t\t\tautoComplete={ autoComplete }\n\t\t\tclassName={ classes }\n\t\t\tdisabled={ disabled }\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\tlabel={ label }\n\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\tonChange={ handleOnQuantityChange }\n\t\t\tref={ forwardedRef }\n\t\t\tsize={ size }\n\t\t\tsuffix={ inputSuffix }\n\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\tstep={ step }\n\t\t\tonFocus={ onFocusProp }\n\t\t\t__unstableStateReducer={ __unstableStateReducer }\n\t\t/>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).\n *\n *\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nexport const UnitControl = forwardRef( UnforwardedUnitControl );\n\nexport { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';\nexport default UnitControl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAMA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAMA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAEA,IAAAS,mBAAA,GAAAT,OAAA;AA5BA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAeA,SAASU,sBAAsBA,CAC9BC,gBAIC,EACDC,YAAiC,EAChC;EACD,MAAM;IACLC,sBAAsB;IACtBC,YAAY,GAAG,KAAK;IACpB;IACAC,QAAQ;IACRC,SAAS;IACTC,QAAQ,GAAG,KAAK;IAChBC,YAAY,GAAG,KAAK;IACpBC,oBAAoB,GAAG,KAAK;IAC5BC,wBAAwB,GAAG,KAAK;IAChCC,oBAAoB,GAAG,IAAI;IAC3BC,KAAK;IACLC,QAAQ,EAAEC,YAAY;IACtBC,YAAY;IACZC,IAAI,GAAG,SAAS;IAChBC,IAAI,EAAEC,QAAQ;IACdC,KAAK,EAAEC,SAAS,GAAGC,gBAAS;IAC5BC,KAAK,EAAEC,SAAS;IAChBC,OAAO,EAAEC,WAAW;IACpB,GAAGC;EACJ,CAAC,GAAG,IAAAC,oDAAgC,EAAE1B,gBAAiB,CAAC;EAExD,IAAK,MAAM,IAAIA,gBAAgB,EA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;;EAErB;AACD;AACA;AACA;EACC,IAAK,CAAEA,IAAI,IAAIpE,KAAK,EAAG;IAAA,IAAAqE,gBAAA;IACtB,MAAMC,UAAU,GAAGtE,KAAK,CAACuE,IAAI,CAAIC,MAAM,IAAMA,MAAM,CAACrE,KAAK,KAAKL,IAAK,CAAC;IACpEsE,IAAI,IAAAC,gBAAA,GAAGC,UAAU,EAAEF,IAAI,cAAAC,gBAAA,cAAAA,gBAAA,GAAI,CAAC;EAC7B;EAEA,OACC,IAAAP,MAAA,CAAAC,aAAA,EAACxF,kBAAA,CAAAkG,UAAU;IAAA,GACLlE,KAAK;IACVtB,YAAY,EAAGA,YAAc;IAC7BE,SAAS,EAAGmD,OAAS;IACrBlD,QAAQ,EAAGA,QAAU;IACrBsF,YAAY,EAAC,MAAM;IACnBpF,oBAAoB,EAAGA,oBAAsB;IAC7CG,KAAK,EAAGA,KAAO;IACf4D,SAAS,EAAGF,eAAiB;IAC7BzD,QAAQ,EAAG8C,sBAAwB;IACnCwB,GAAG,EAAGjF,YAAc;IACpBc,IAAI,EAAGA,IAAM;IACb8E,MAAM,EAAGd,WAAa;IACtBe,IAAI,EAAGtF,oBAAoB,GAAG,MAAM,GAAG,QAAU;IACjDa,KAAK,EAAG0B,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,EAAI;IAC9BuC,IAAI,EAAGA,IAAM;IACb/D,OAAO,EAAGC,WAAa;IACvBtB,sBAAsB,EAAGA;EAAwB,CACjD,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM6F,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,IAAAE,mBAAU,EAAElG,sBAAuB,CAAC;AAAC,IAAAmG,QAAA,GAAAF,OAAA,CAAA5B,OAAA,GAGjD2B,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_deprecated","_element","_i18n","_unitControlStyles","_unitSelectControl","_utils","_hooks","_strings","_useDeprecatedProps","UnforwardedUnitControl","unitControlProps","forwardedRef","__unstableStateReducer","autoComplete","children","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","onChangeProp","onUnitChange","size","unit","unitProp","units","unitsProp","CSS_UNITS","value","valueProp","onFocus","onFocusProp","props","useDeprecated36pxDefaultSizeProp","deprecated","since","hint","version","nonNullValueProp","undefined","reFirstCharacterOfUnits","useMemo","list","getUnitsWithCurrentUnit","firstUnitValue","rest","firstCharacters","reduce","carry","first","escapeRegExp","substring","includes","RegExp","parsedQuantity","parsedUnit","getParsedQuantityAndUnit","setUnit","useControlledState","length","initial","fallback","useEffect","classes","clsx","handleOnQuantityChange","nextQuantityValue","changeProps","onChangeValue","getValidParsedQuantityAndUnit","join","handleOnUnitChange","nextUnitValue","data","nextValue","default","handleOnKeyDown","event","onKeyDown","metaKey","test","key","refInputSuffix","current","focus","useRef","inputSuffix","_react","createElement","ref","__","__next40pxDefaultSize","onBlur","step","_activeUnit$step","activeUnit","find","option","ValueInput","spinControls","suffix","type","UnitControl","exports","forwardRef","_default"],"sources":["@wordpress/components/src/unit-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { KeyboardEvent, ForwardedRef, SyntheticEvent } from 'react';\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedQuantityAndUnit,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedQuantityAndUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport { escapeRegExp } from '../utils/strings';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\n\nfunction UnforwardedUnitControl(\n\tunitControlProps: WordPressComponentProps<\n\t\tUnitControlProps,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer,\n\t\tautoComplete = 'off',\n\t\t// @ts-expect-error Ensure that children is omitted from restProps\n\t\tchildren,\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tonUnitChange,\n\t\tsize = 'default',\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\tonFocus: onFocusProp,\n\t\t...props\n\t} = useDeprecated36pxDefaultSizeProp( unitControlProps );\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst [ units, reFirstCharacterOfUnits ] = useMemo( () => {\n\t\tconst list = getUnitsWithCurrentUnit(\n\t\t\tnonNullValueProp,\n\t\t\tunitProp,\n\t\t\tunitsProp\n\t\t);\n\t\tconst [ { value: firstUnitValue = '' } = {}, ...rest ] = list;\n\t\tconst firstCharacters = rest.reduce(\n\t\t\t( carry, { value } ) => {\n\t\t\t\tconst first = escapeRegExp( value?.substring( 0, 1 ) || '' );\n\t\t\t\treturn carry.includes( first )\n\t\t\t\t\t? carry\n\t\t\t\t\t: `${ carry }|${ first }`;\n\t\t\t},\n\t\t\tescapeRegExp( firstUnitValue.substring( 0, 1 ) )\n\t\t);\n\t\treturn [ list, new RegExp( `^(?:${ firstCharacters })$`, 'i' ) ];\n\t}, [ nonNullValueProp, unitProp, unitsProp ] );\n\tconst [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(\n\t\tnonNullValueProp,\n\t\tunitProp,\n\t\tunits\n\t);\n\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunits.length === 1 ? units[ 0 ].value : unitProp,\n\t\t{\n\t\t\tinitial: parsedUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( parsedUnit !== undefined ) {\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t}, [ parsedUnit, setUnit ] );\n\n\tconst classes = clsx(\n\t\t'components-unit-control',\n\t\t// This class is added for legacy purposes to maintain it on the outer\n\t\t// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139\n\t\t'components-unit-control-wrapper',\n\t\tclassName\n\t);\n\n\tconst handleOnQuantityChange = (\n\t\tnextQuantityValue: number | string | undefined,\n\t\tchangeProps: {\n\t\t\tevent: SyntheticEvent;\n\t\t}\n\t) => {\n\t\tif (\n\t\t\tnextQuantityValue === '' ||\n\t\t\ttypeof nextQuantityValue === 'undefined' ||\n\t\t\tnextQuantityValue === null\n\t\t) {\n\t\t\tonChangeProp?.( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tconst onChangeValue = getValidParsedQuantityAndUnit(\n\t\t\tnextQuantityValue,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t).join( '' );\n\n\t\tonChangeProp?.( onChangeValue, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnextUnitValue,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ nextUnitValue }`;\n\t\t}\n\n\t\tonChangeProp?.( nextValue, changeProps );\n\t\tonUnitChange?.( nextUnitValue, changeProps );\n\n\t\tsetUnit( nextUnitValue );\n\t};\n\n\tlet handleOnKeyDown;\n\tif ( ! disableUnits && isUnitSelectTabbable && units.length ) {\n\t\thandleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\t\tprops.onKeyDown?.( event );\n\t\t\t// Unless the meta key was pressed (to avoid interfering with\n\t\t\t// shortcuts, e.g. pastes), moves focus to the unit select if a key\n\t\t\t// matches the first character of a unit.\n\t\t\tif (\n\t\t\t\t! event.metaKey &&\n\t\t\t\treFirstCharacterOfUnits.test( event.key )\n\t\t\t) {\n\t\t\t\trefInputSuffix.current?.focus();\n\t\t\t}\n\t\t};\n\t}\n\n\tconst refInputSuffix = useRef< HTMLSelectElement >( null );\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\tref={ refInputSuffix }\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={\n\t\t\t\t[ 'small', 'compact' ].includes( size ) ||\n\t\t\t\t( size === 'default' && ! props.__next40pxDefaultSize )\n\t\t\t\t\t? 'small'\n\t\t\t\t\t: 'default'\n\t\t\t}\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t\tonFocus={ onFocusProp }\n\t\t\tonBlur={ unitControlProps.onBlur }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<ValueInput\n\t\t\t{ ...props }\n\t\t\tautoComplete={ autoComplete }\n\t\t\tclassName={ classes }\n\t\t\tdisabled={ disabled }\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\tlabel={ label }\n\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\tonChange={ handleOnQuantityChange }\n\t\t\tref={ forwardedRef }\n\t\t\tsize={ size }\n\t\t\tsuffix={ inputSuffix }\n\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\tstep={ step }\n\t\t\tonFocus={ onFocusProp }\n\t\t\t__unstableStateReducer={ __unstableStateReducer }\n\t\t/>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).\n *\n *\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nexport const UnitControl = forwardRef( UnforwardedUnitControl );\n\nexport { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';\nexport default UnitControl;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAMA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAMA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAEA,IAAAS,mBAAA,GAAAT,OAAA;AA5BA;AACA;AACA;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CwB,GAAG,EAAGjF,YAAc;IACpBc,IAAI,EAAGA,IAAM;IACb8E,MAAM,EAAGd,WAAa;IACtBe,IAAI,EAAGtF,oBAAoB,GAAG,MAAM,GAAG,QAAU;IACjDa,KAAK,EAAG0B,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,EAAI;IAC9BuC,IAAI,EAAGA,IAAM;IACb/D,OAAO,EAAGC,WAAa;IACvBtB,sBAAsB,EAAGA;EAAwB,CACjD,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM6F,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,IAAAE,mBAAU,EAAElG,sBAAuB,CAAC;AAAC,IAAAmG,QAAA,GAAAF,OAAA,CAAA5B,OAAA,GAGjD2B,WAAW","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
var _unitControlStyles = require("./styles/unit-control-styles");
|
|
12
12
|
var _utils = require("./utils");
|
|
@@ -47,7 +47,7 @@ function UnitSelectControl({
|
|
|
47
47
|
data
|
|
48
48
|
});
|
|
49
49
|
};
|
|
50
|
-
const classes = (0,
|
|
50
|
+
const classes = (0, _clsx.default)('components-unit-control__select', className);
|
|
51
51
|
return (0, _react.createElement)(_unitControlStyles.UnitSelect, {
|
|
52
52
|
ref: ref,
|
|
53
53
|
className: classes,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_unitControlStyles","_utils","UnitSelectControl","className","isUnitSelectTabbable","isTabbable","onChange","size","unit","units","CSS_UNITS","props","ref","hasUnits","length","_react","createElement","UnitLabel","selectSize","handleOnChange","event","value","unitValue","target","data","find","option","classes","clsx","UnitSelect","tabIndex","undefined","map","key","label","_default","exports","default","forwardRef"],"sources":["@wordpress/components/src/unit-control/unit-select-control.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ChangeEvent, ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { UnitSelect, UnitLabel } from './styles/unit-control-styles';\nimport { CSS_UNITS, hasUnits } from './utils';\nimport type { UnitSelectControlProps } from './types';\n\nfunction UnitSelectControl(\n\t{\n\t\tclassName,\n\t\tisUnitSelectTabbable: isTabbable = true,\n\t\tonChange,\n\t\tsize = 'default',\n\t\tunit = 'px',\n\t\tunits = CSS_UNITS,\n\t\t...props\n\t}: WordPressComponentProps< UnitSelectControlProps, 'select', false >,\n\tref: ForwardedRef< any >\n) {\n\tif ( ! hasUnits( units ) || units?.length === 1 ) {\n\t\treturn (\n\t\t\t<UnitLabel\n\t\t\t\tclassName=\"components-unit-control__unit-label\"\n\t\t\t\tselectSize={ size }\n\t\t\t>\n\t\t\t\t{ unit }\n\t\t\t</UnitLabel>\n\t\t);\n\t}\n\n\tconst handleOnChange = ( event: ChangeEvent< HTMLSelectElement > ) => {\n\t\tconst { value: unitValue } = event.target;\n\t\tconst data = units.find( ( option ) => option.value === unitValue );\n\n\t\tonChange?.( unitValue, { event, data } );\n\t};\n\n\tconst classes = clsx( 'components-unit-control__select', className );\n\n\treturn (\n\t\t<UnitSelect\n\t\t\tref={ ref }\n\t\t\tclassName={ classes }\n\t\t\tonChange={ handleOnChange }\n\t\t\tselectSize={ size }\n\t\t\ttabIndex={ isTabbable ? undefined : -1 }\n\t\t\tvalue={ unit }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ units.map( ( option ) => (\n\t\t\t\t<option value={ option.value } key={ option.value }>\n\t\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,GAAK;IACXT,SAAS,EAAGwB,OAAS;IACrBrB,QAAQ,EAAGa,cAAgB;IAC3BD,UAAU,EAAGX,IAAM;IACnBuB,QAAQ,EAAGzB,UAAU,GAAG0B,SAAS,GAAG,CAAC,CAAG;IACxCV,KAAK,EAAGb,IAAM;IAAA,GACTG;EAAK,GAERF,KAAK,CAACuB,GAAG,CAAIN,MAAM,IACpB,IAAAX,MAAA,CAAAC,aAAA;IAAQK,KAAK,EAAGK,MAAM,CAACL,KAAO;IAACY,GAAG,EAAGP,MAAM,CAACL;EAAO,GAChDK,MAAM,CAACQ,KACF,CACP,CACS,CAAC;AAEf;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GACc,IAAAC,mBAAU,EAAEpC,iBAAkB,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
@@ -20,7 +20,7 @@ function AlignmentMatrixControlIcon({
|
|
|
20
20
|
}) {
|
|
21
21
|
const alignIndex = getAlignmentIndex(value);
|
|
22
22
|
const scale = (size / BASE_SIZE).toFixed(2);
|
|
23
|
-
const classes =
|
|
23
|
+
const classes = clsx('component-alignment-matrix-control-icon', className);
|
|
24
24
|
const styles = {
|
|
25
25
|
...style,
|
|
26
26
|
transform: `scale(${scale})`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["clsx","ALIGNMENTS","getAlignmentIndex","Root","Cell","Point","BASE_SIZE","AlignmentMatrixControlIcon","className","disablePointerEvents","size","style","value","props","alignIndex","scale","toFixed","classes","styles","transform","createElement","role","map","align","index","isActive","key"],"sources":["@wordpress/components/src/alignment-matrix-control/icon.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { ALIGNMENTS, getAlignmentIndex } from './utils';\nimport {\n\tRoot,\n\tCell,\n\tPoint,\n} from './styles/alignment-matrix-control-icon-styles';\nimport type { AlignmentMatrixControlIconProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\nconst BASE_SIZE = 24;\n\nfunction AlignmentMatrixControlIcon( {\n\tclassName,\n\tdisablePointerEvents = true,\n\tsize = BASE_SIZE,\n\tstyle = {},\n\tvalue = 'center',\n\t...props\n}: WordPressComponentProps< AlignmentMatrixControlIconProps, 'div', false > ) {\n\tconst alignIndex = getAlignmentIndex( value );\n\tconst scale = ( size / BASE_SIZE ).toFixed( 2 );\n\n\tconst classes = clsx(\n\t\t'component-alignment-matrix-control-icon',\n\t\tclassName\n\t);\n\n\tconst styles = {\n\t\t...style,\n\t\ttransform: `scale(${ scale })`,\n\t};\n\n\treturn (\n\t\t<Root\n\t\t\t{ ...props }\n\t\t\tclassName={ classes }\n\t\t\tdisablePointerEvents={ disablePointerEvents }\n\t\t\trole=\"presentation\"\n\t\t\tstyle={ styles }\n\t\t>\n\t\t\t{ ALIGNMENTS.map( ( align, index ) => {\n\t\t\t\tconst isActive = alignIndex === index;\n\n\t\t\t\treturn (\n\t\t\t\t\t<Cell key={ align }>\n\t\t\t\t\t\t<Point isActive={ isActive } />\n\t\t\t\t\t</Cell>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</Root>\n\t);\n}\n\nexport default AlignmentMatrixControlIcon;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,UAAU,EAAEC,iBAAiB,QAAQ,SAAS;AACvD,SACCC,IAAI,EACJC,IAAI,EACJC,KAAK,QACC,+CAA+C;AAItD,MAAMC,SAAS,GAAG,EAAE;AAEpB,SAASC,0BAA0BA,CAAE;EACpCC,SAAS;EACTC,oBAAoB,GAAG,IAAI;EAC3BC,IAAI,GAAGJ,SAAS;EAChBK,KAAK,GAAG,CAAC,CAAC;EACVC,KAAK,GAAG,QAAQ;EAChB,GAAGC;AACsE,CAAC,EAAG;EAC7E,MAAMC,UAAU,GAAGZ,iBAAiB,CAAEU,KAAM,CAAC;EAC7C,MAAMG,KAAK,GAAG,CAAEL,IAAI,GAAGJ,SAAS,EAAGU,OAAO,CAAE,CAAE,CAAC;EAE/C,MAAMC,OAAO,GAAGjB,IAAI,CACnB,yCAAyC,EACzCQ,SACD,CAAC;EAED,MAAMU,MAAM,GAAG;IACd,GAAGP,KAAK;IACRQ,SAAS,EAAG,SAASJ,KAAO;EAC7B,CAAC;EAED,OACCK,aAAA,CAACjB,IAAI;IAAA,GACCU,KAAK;IACVL,SAAS,EAAGS,OAAS;IACrBR,oBAAoB,EAAGA,oBAAsB;IAC7CY,IAAI,EAAC,cAAc;IACnBV,KAAK,EAAGO;EAAQ,GAEdjB,UAAU,CAACqB,GAAG,CAAE,CAAEC,KAAK,EAAEC,KAAK,KAAM;IACrC,MAAMC,QAAQ,GAAGX,UAAU,KAAKU,KAAK;IAErC,OACCJ,aAAA,CAAChB,IAAI;MAACsB,GAAG,EAAGH;IAAO,GAClBH,aAAA,CAACf,KAAK;MAACoB,QAAQ,EAAGA;IAAU,CAAE,CACzB,CAAC;EAET,CAAE,CACG,CAAC;AAET;AAEA,eAAelB,0BAA0B","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { createElement } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import clsx from 'clsx';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
@@ -61,7 +61,7 @@ export function AlignmentMatrixControl({
|
|
|
61
61
|
rtl: isRTL()
|
|
62
62
|
});
|
|
63
63
|
const activeId = compositeStore.useState('activeId');
|
|
64
|
-
const classes =
|
|
64
|
+
const classes = clsx('component-alignment-matrix-control', className);
|
|
65
65
|
return createElement(Composite, {
|
|
66
66
|
store: compositeStore,
|
|
67
67
|
render: createElement(Root, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["clsx","__","isRTL","useInstanceId","Cell","Composite","CompositeRow","useCompositeStore","Root","Row","AlignmentMatrixControlIcon","GRID","getItemId","getItemValue","AlignmentMatrixControl","className","id","label","defaultValue","value","onChange","width","props","baseId","compositeStore","defaultActiveId","activeId","setActiveId","nextActiveId","nextValue","rtl","useState","classes","createElement","store","render","role","size","map","cells","index","key","cell","cellId","isActive","Icon"],"sources":["@wordpress/components/src/alignment-matrix-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport { Composite, CompositeRow, useCompositeStore } from '../composite/v2';\nimport { Root, Row } from './styles/alignment-matrix-control-styles';\nimport AlignmentMatrixControlIcon from './icon';\nimport { GRID, getItemId, getItemValue } from './utils';\nimport type { WordPressComponentProps } from '../context';\nimport type { AlignmentMatrixControlProps } from './types';\n\n/**\n *\n * AlignmentMatrixControl components enable adjustments to horizontal and vertical alignments for UI.\n *\n * ```jsx\n * import { __experimentalAlignmentMatrixControl as AlignmentMatrixControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ alignment, setAlignment ] = useState( 'center center' );\n *\n * \treturn (\n * \t\t<AlignmentMatrixControl\n * \t\t\tvalue={ alignment }\n * \t\t\tonChange={ setAlignment }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport function AlignmentMatrixControl( {\n\tclassName,\n\tid,\n\tlabel = __( 'Alignment Matrix Control' ),\n\tdefaultValue = 'center center',\n\tvalue,\n\tonChange,\n\twidth = 92,\n\t...props\n}: WordPressComponentProps< AlignmentMatrixControlProps, 'div', false > ) {\n\tconst baseId = useInstanceId(\n\t\tAlignmentMatrixControl,\n\t\t'alignment-matrix-control',\n\t\tid\n\t);\n\n\tconst compositeStore = useCompositeStore( {\n\t\tdefaultActiveId: getItemId( baseId, defaultValue ),\n\t\tactiveId: getItemId( baseId, value ),\n\t\tsetActiveId: ( nextActiveId ) => {\n\t\t\tconst nextValue = getItemValue( baseId, nextActiveId );\n\t\t\tif ( nextValue ) {\n\t\t\t\tonChange?.( nextValue );\n\t\t\t}\n\t\t},\n\t\trtl: isRTL(),\n\t} );\n\n\tconst activeId = compositeStore.useState( 'activeId' );\n\n\tconst classes = clsx( 'component-alignment-matrix-control', className );\n\n\treturn (\n\t\t<Composite\n\t\t\tstore={ compositeStore }\n\t\t\trender={\n\t\t\t\t<Root\n\t\t\t\t\t{ ...props }\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tclassName={ classes }\n\t\t\t\t\tid={ baseId }\n\t\t\t\t\trole=\"grid\"\n\t\t\t\t\tsize={ width }\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t{ GRID.map( ( cells, index ) => (\n\t\t\t\t<CompositeRow render={ <Row role=\"row\" /> } key={ index }>\n\t\t\t\t\t{ cells.map( ( cell ) => {\n\t\t\t\t\t\tconst cellId = getItemId( baseId, cell );\n\t\t\t\t\t\tconst isActive = cellId === activeId;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Cell\n\t\t\t\t\t\t\t\tid={ cellId }\n\t\t\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\t\t\tkey={ cell }\n\t\t\t\t\t\t\t\tvalue={ cell }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</CompositeRow>\n\t\t\t) ) }\n\t\t</Composite>\n\t);\n}\n\nAlignmentMatrixControl.Icon = AlignmentMatrixControlIcon;\n\nexport default AlignmentMatrixControl;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;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