@wordpress/components 20.0.2-next.957ca95e4c.0 → 21.0.1
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 +68 -1
- package/CONTRIBUTING.md +3 -54
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build/angle-picker-control/index.js +10 -0
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.js +3 -3
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js +10 -7
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +1 -2
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js +10 -7
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-box-control/styles.js +7 -7
- package/build/border-box-control/styles.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +2 -1
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/box-control/linked-button.js +3 -3
- package/build/box-control/linked-button.js.map +1 -1
- package/build/card/styles.js +17 -17
- package/build/card/styles.js.map +1 -1
- package/build/checkbox-control/index.js +3 -3
- package/build/checkbox-control/index.js.map +1 -1
- package/build/color-palette/index.js +1 -1
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/input-with-slider.js +2 -1
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/combobox-control/index.js +1 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/custom-gradient-picker/index.js +1 -1
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/date-time/date/index.js +1 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/time/timezone.js +1 -1
- package/build/date-time/time/timezone.js.map +1 -1
- package/build/disabled/index.js +14 -6
- package/build/disabled/index.js.map +1 -1
- package/build/disabled/styles/disabled-styles.js +8 -18
- package/build/disabled/styles/disabled-styles.js.map +1 -1
- package/build/drop-zone/index.js +44 -9
- package/build/drop-zone/index.js.map +1 -1
- package/build/drop-zone/provider.js.map +1 -1
- package/build/drop-zone/types.js +6 -0
- package/build/drop-zone/types.js.map +1 -0
- package/build/dropdown/index.js +11 -4
- package/build/dropdown/index.js.map +1 -1
- package/build/flex/flex/hook.js +6 -30
- package/build/flex/flex/hook.js.map +1 -1
- package/build/focal-point-picker/controls.js +10 -5
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/focal-point.js.map +1 -1
- package/build/focal-point-picker/grid.js.map +1 -1
- package/build/focal-point-picker/index.js +83 -16
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/media.js +4 -0
- package/build/focal-point-picker/media.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-picker-style.js +70 -41
- package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-style.js +12 -12
- package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build/focal-point-picker/types.js +6 -0
- package/build/focal-point-picker/types.js.map +1 -0
- package/build/focal-point-picker/utils.js +6 -6
- package/build/focal-point-picker/utils.js.map +1 -1
- package/build/font-size-picker/index.js +11 -0
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/utils.js +1 -1
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-file-upload/index.js +22 -2
- package/build/form-file-upload/index.js.map +1 -1
- package/build/form-file-upload/types.js +6 -0
- package/build/form-file-upload/types.js.map +1 -0
- package/build/form-toggle/index.js +1 -3
- package/build/form-toggle/index.js.map +1 -1
- package/build/form-token-field/index.js +4 -6
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +1 -3
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/gradient-picker/index.js +25 -26
- package/build/gradient-picker/index.js.map +1 -1
- package/build/icon/index.js +1 -2
- package/build/icon/index.js.map +1 -1
- package/build/input-control/input-base.js +3 -2
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/label.js +2 -2
- package/build/input-control/label.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +41 -128
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/modal/aria-helper.js +3 -10
- package/build/modal/aria-helper.js.map +1 -1
- package/build/navigable-container/container.js +5 -1
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigable-container/menu.js +10 -12
- package/build/navigable-container/menu.js.map +1 -1
- package/build/navigable-container/tabbable.js +2 -4
- package/build/navigable-container/tabbable.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +2 -1
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/use-navigation-tree-menu.js +2 -1
- package/build/navigation/menu/use-navigation-tree-menu.js.map +1 -1
- package/build/navigator/navigator-button/hook.js +1 -1
- package/build/navigator/navigator-button/hook.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +2 -2
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/number-control/index.js +29 -25
- package/build/number-control/index.js.map +1 -1
- package/build/number-control/types.js +6 -0
- package/build/number-control/types.js.map +1 -0
- package/build/placeholder/index.js +1 -3
- package/build/placeholder/index.js.map +1 -1
- package/build/popover/index.js +190 -160
- package/build/popover/index.js.map +1 -1
- package/build/popover/types.js +6 -0
- package/build/popover/types.js.map +1 -0
- package/build/popover/utils.js +125 -24
- package/build/popover/utils.js.map +1 -1
- package/build/radio-control/index.js +7 -4
- package/build/radio-control/index.js.map +1 -1
- package/build/range-control/index.js +4 -1
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +33 -33
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/sandbox/index.js +2 -2
- package/build/sandbox/index.js.map +1 -1
- package/build/search-control/index.js +38 -10
- package/build/search-control/index.js.map +1 -1
- package/build/search-control/types.js +6 -0
- package/build/search-control/types.js.map +1 -0
- package/build/select-control/index.native.js +2 -1
- package/build/select-control/index.native.js.map +1 -1
- package/build/tab-panel/index.js +48 -9
- package/build/tab-panel/index.js.map +1 -1
- package/build/tab-panel/types.js +6 -0
- package/build/tab-panel/types.js.map +1 -0
- package/build/text-control/index.js +2 -0
- package/build/text-control/index.js.map +1 -1
- package/build/textarea-control/index.js +3 -3
- package/build/textarea-control/index.js.map +1 -1
- package/build/toggle-control/index.js +44 -4
- package/build/toggle-control/index.js.map +1 -1
- package/build/toggle-control/types.js +6 -0
- package/build/toggle-control/types.js.map +1 -0
- package/build/toggle-group-control/toggle-group-control/component.js +2 -2
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build/tooltip/index.js +9 -7
- package/build/tooltip/index.js.map +1 -1
- package/build/ui/context/context-connect.js +31 -22
- package/build/ui/context/context-connect.js.map +1 -1
- package/build/ui/context/context-system-provider.js +4 -3
- package/build/ui/context/context-system-provider.js.map +1 -1
- package/build/unit-control/index.js +1 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/styles/unit-control-styles.js +9 -9
- package/build/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build/utils/colors-values.js +2 -30
- package/build/utils/colors-values.js.map +1 -1
- package/build/utils/math.js +4 -4
- package/build/utils/math.js.map +1 -1
- package/build/utils/values.js +62 -6
- package/build/utils/values.js.map +1 -1
- package/build/view/component.js +6 -7
- package/build/view/component.js.map +1 -1
- package/build/view/types.js +6 -0
- package/build/view/types.js.map +1 -0
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build-module/angle-picker-control/index.js +9 -0
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.js +4 -4
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js +11 -8
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js +1 -2
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js +11 -8
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-box-control/styles.js +7 -7
- package/build-module/border-box-control/styles.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +2 -1
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/box-control/linked-button.js +3 -3
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/card/styles.js +17 -17
- package/build-module/card/styles.js.map +1 -1
- package/build-module/checkbox-control/index.js +3 -3
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/color-palette/index.js +1 -1
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +2 -1
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/combobox-control/index.js +1 -1
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +1 -1
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/date-time/date/index.js +2 -3
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/time/timezone.js +1 -1
- package/build-module/date-time/time/timezone.js.map +1 -1
- package/build-module/disabled/index.js +16 -8
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/disabled/styles/disabled-styles.js +6 -12
- package/build-module/disabled/styles/disabled-styles.js.map +1 -1
- package/build-module/drop-zone/index.js +40 -9
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/drop-zone/provider.js.map +1 -1
- package/build-module/drop-zone/types.js +2 -0
- package/build-module/drop-zone/types.js.map +1 -0
- package/build-module/dropdown/index.js +10 -4
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/flex/flex/hook.js +7 -29
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +11 -6
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/focal-point.js.map +1 -1
- package/build-module/focal-point-picker/grid.js.map +1 -1
- package/build-module/focal-point-picker/index.js +81 -16
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/media.js +4 -0
- package/build-module/focal-point-picker/media.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js +68 -40
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-style.js +12 -12
- package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build-module/focal-point-picker/types.js +2 -0
- package/build-module/focal-point-picker/types.js.map +1 -0
- package/build-module/focal-point-picker/utils.js +6 -6
- package/build-module/focal-point-picker/utils.js.map +1 -1
- package/build-module/font-size-picker/index.js +10 -0
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/utils.js +1 -1
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-file-upload/index.js +21 -4
- package/build-module/form-file-upload/index.js.map +1 -1
- package/build-module/form-file-upload/types.js +2 -0
- package/build-module/form-file-upload/types.js.map +1 -0
- package/build-module/form-toggle/index.js +1 -3
- package/build-module/form-toggle/index.js.map +1 -1
- package/build-module/form-token-field/index.js +4 -5
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +1 -2
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/gradient-picker/index.js +25 -26
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/icon/index.js +1 -2
- package/build-module/icon/index.js.map +1 -1
- package/build-module/input-control/input-base.js +4 -3
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/label.js +3 -3
- package/build-module/input-control/label.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +41 -127
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/modal/aria-helper.js +3 -8
- package/build-module/modal/aria-helper.js.map +1 -1
- package/build-module/navigable-container/container.js +5 -1
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigable-container/menu.js +10 -11
- package/build-module/navigable-container/menu.js.map +1 -1
- package/build-module/navigable-container/tabbable.js +2 -3
- package/build-module/navigable-container/tabbable.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +2 -1
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/use-navigation-tree-menu.js +2 -1
- package/build-module/navigation/menu/use-navigation-tree-menu.js.map +1 -1
- package/build-module/navigator/navigator-button/hook.js +1 -1
- package/build-module/navigator/navigator-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +2 -2
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/number-control/index.js +31 -23
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/number-control/types.js +2 -0
- package/build-module/number-control/types.js.map +1 -0
- package/build-module/placeholder/index.js +1 -3
- package/build-module/placeholder/index.js.map +1 -1
- package/build-module/popover/index.js +192 -162
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/types.js +2 -0
- package/build-module/popover/types.js.map +1 -0
- package/build-module/popover/utils.js +118 -23
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/radio-control/index.js +7 -5
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/range-control/index.js +4 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +33 -33
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/sandbox/index.js +2 -2
- package/build-module/sandbox/index.js.map +1 -1
- package/build-module/search-control/index.js +34 -7
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/search-control/types.js +2 -0
- package/build-module/search-control/types.js.map +1 -0
- package/build-module/select-control/index.native.js +1 -1
- package/build-module/select-control/index.native.js.map +1 -1
- package/build-module/tab-panel/index.js +46 -10
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tab-panel/types.js +2 -0
- package/build-module/tab-panel/types.js.map +1 -0
- package/build-module/text-control/index.js +2 -0
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/textarea-control/index.js +3 -3
- package/build-module/textarea-control/index.js.map +1 -1
- package/build-module/toggle-control/index.js +38 -4
- package/build-module/toggle-control/index.js.map +1 -1
- package/build-module/toggle-control/types.js +2 -0
- package/build-module/toggle-control/types.js.map +1 -0
- package/build-module/toggle-group-control/toggle-group-control/component.js +2 -2
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build-module/tooltip/index.js +10 -8
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/ui/context/context-connect.js +30 -23
- package/build-module/ui/context/context-connect.js.map +1 -1
- package/build-module/ui/context/context-system-provider.js +5 -4
- package/build-module/ui/context/context-system-provider.js.map +1 -1
- package/build-module/unit-control/index.js +1 -1
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/styles/unit-control-styles.js +9 -9
- package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-module/utils/colors-values.js +2 -30
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-module/utils/math.js +4 -4
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/values.js +48 -6
- package/build-module/utils/values.js.map +1 -1
- package/build-module/view/component.js +5 -8
- package/build-module/view/component.js.map +1 -1
- package/build-module/view/types.js +2 -0
- package/build-module/view/types.js.map +1 -0
- package/build-style/style-rtl.css +4 -31
- package/build-style/style.css +4 -31
- package/build-types/base-field/hook.d.ts +54 -55
- package/build-types/base-field/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/component.d.ts +10 -2
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +56 -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/component.d.ts +2 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +55 -56
- 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/component.d.ts +9 -2
- package/build-types/border-box-control/border-box-control-split-controls/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +56 -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/component.d.ts +2 -1
- package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +55 -56
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
- package/build-types/border-box-control/styles.d.ts.map +1 -1
- package/build-types/border-box-control/types.d.ts +5 -4
- package/build-types/border-box-control/types.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +14 -2
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +56 -57
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts +10 -2
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +56 -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 +6 -2
- package/build-types/border-control/border-control-style-picker/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-style-picker/hook.d.ts +55 -56
- package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
- package/build-types/border-control/stories/index.d.ts +74 -6
- package/build-types/border-control/stories/index.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +6 -8
- package/build-types/border-control/types.d.ts.map +1 -1
- package/build-types/button-group/index.d.ts +1 -3
- package/build-types/button-group/index.d.ts.map +1 -1
- package/build-types/card/card/component.d.ts +9 -2
- package/build-types/card/card/component.d.ts.map +1 -1
- package/build-types/card/card/hook.d.ts +55 -56
- package/build-types/card/card/hook.d.ts.map +1 -1
- package/build-types/card/card-body/component.d.ts +9 -2
- package/build-types/card/card-body/component.d.ts.map +1 -1
- package/build-types/card/card-body/hook.d.ts +55 -56
- package/build-types/card/card-body/hook.d.ts.map +1 -1
- package/build-types/card/card-divider/component.d.ts +7 -2
- package/build-types/card/card-divider/component.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +55 -55
- package/build-types/card/card-footer/component.d.ts +11 -2
- package/build-types/card/card-footer/component.d.ts.map +1 -1
- package/build-types/card/card-footer/hook.d.ts +55 -56
- package/build-types/card/card-footer/hook.d.ts.map +1 -1
- package/build-types/card/card-header/component.d.ts +1 -1
- package/build-types/card/card-header/component.d.ts.map +1 -1
- package/build-types/card/card-header/hook.d.ts +55 -56
- package/build-types/card/card-header/hook.d.ts.map +1 -1
- package/build-types/card/card-media/component.d.ts +2 -1
- package/build-types/card/card-media/component.d.ts.map +1 -1
- package/build-types/card/card-media/hook.d.ts +55 -56
- package/build-types/card/card-media/hook.d.ts.map +1 -1
- package/build-types/checkbox-control/index.d.ts +1 -1
- package/build-types/checkbox-control/index.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
- package/build-types/checkbox-control/types.d.ts +1 -1
- package/build-types/checkbox-control/types.d.ts.map +1 -1
- package/build-types/color-indicator/index.d.ts +1 -3
- package/build-types/color-indicator/index.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +1 -3
- package/build-types/color-palette/styles.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts +2 -1
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +12 -25
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/confirm-dialog/component.d.ts +4 -8
- package/build-types/confirm-dialog/component.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +4 -8
- package/build-types/date-time/date/styles.d.ts.map +1 -1
- package/build-types/date-time/date-time/styles.d.ts +4 -6
- package/build-types/date-time/date-time/styles.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts +21 -43
- package/build-types/date-time/time/styles.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/disabled/styles/disabled-styles.d.ts +1 -5
- package/build-types/disabled/styles/disabled-styles.d.ts.map +1 -1
- package/build-types/divider/component.d.ts +7 -2
- package/build-types/divider/component.d.ts.map +1 -1
- package/build-types/drop-zone/index.d.ts +29 -0
- package/build-types/drop-zone/index.d.ts.map +1 -0
- package/build-types/drop-zone/provider.d.ts +5 -0
- package/build-types/drop-zone/provider.d.ts.map +1 -0
- package/build-types/drop-zone/stories/index.d.ts +12 -0
- package/build-types/drop-zone/stories/index.d.ts.map +1 -0
- package/build-types/drop-zone/types.d.ts +29 -0
- package/build-types/drop-zone/types.d.ts.map +1 -0
- package/build-types/dropdown/dropdown-content-wrapper.d.ts +2 -1
- package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -1
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/elevation/component.d.ts +2 -1
- package/build-types/elevation/component.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +54 -55
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/external-link/index.d.ts +1 -1
- package/build-types/external-link/index.d.ts.map +1 -1
- package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
- package/build-types/flex/flex/component.d.ts +2 -1
- package/build-types/flex/flex/component.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +55 -56
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/flex/flex-block/component.d.ts +2 -1
- package/build-types/flex/flex-block/component.d.ts.map +1 -1
- package/build-types/flex/flex-block/hook.d.ts +55 -56
- package/build-types/flex/flex-block/hook.d.ts.map +1 -1
- package/build-types/flex/flex-item/component.d.ts +2 -1
- package/build-types/flex/flex-item/component.d.ts.map +1 -1
- package/build-types/flex/flex-item/hook.d.ts +55 -56
- package/build-types/flex/flex-item/hook.d.ts.map +1 -1
- package/build-types/focal-point-picker/controls.d.ts +4 -0
- package/build-types/focal-point-picker/controls.d.ts.map +1 -0
- package/build-types/focal-point-picker/focal-point.d.ts +5 -0
- package/build-types/focal-point-picker/focal-point.d.ts.map +1 -0
- package/build-types/focal-point-picker/grid.d.ts +5 -0
- package/build-types/focal-point-picker/grid.d.ts.map +1 -0
- package/build-types/focal-point-picker/index.d.ts +51 -0
- package/build-types/focal-point-picker/index.d.ts.map +1 -0
- package/build-types/focal-point-picker/media.d.ts +4 -0
- package/build-types/focal-point-picker/media.d.ts.map +1 -0
- package/build-types/focal-point-picker/stories/index.d.ts +15 -0
- package/build-types/focal-point-picker/stories/index.d.ts.map +1 -0
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +56 -0
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -0
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts +19 -0
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts.map +1 -0
- package/build-types/focal-point-picker/types.d.ts +79 -0
- package/build-types/focal-point-picker/types.d.ts.map +1 -0
- package/build-types/focal-point-picker/utils.d.ts +26 -0
- package/build-types/focal-point-picker/utils.d.ts.map +1 -0
- package/build-types/form-file-upload/index.d.ts +22 -0
- package/build-types/form-file-upload/index.d.ts.map +1 -0
- package/build-types/form-file-upload/stories/index.d.ts +23 -0
- package/build-types/form-file-upload/stories/index.d.ts.map +1 -0
- package/build-types/form-file-upload/test/index.d.ts +2 -0
- package/build-types/form-file-upload/test/index.d.ts.map +1 -0
- package/build-types/form-file-upload/types.d.ts +63 -0
- package/build-types/form-file-upload/types.d.ts.map +1 -0
- package/build-types/form-toggle/index.d.ts +1 -1
- package/build-types/form-toggle/index.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/styles.d.ts +1 -3
- package/build-types/form-token-field/styles.d.ts.map +1 -1
- package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
- package/build-types/form-token-field/token-input.d.ts +1 -3
- package/build-types/form-token-field/token-input.d.ts.map +1 -1
- package/build-types/grid/component.d.ts +2 -1
- package/build-types/grid/component.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +55 -56
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/h-stack/component.d.ts +5 -2
- package/build-types/h-stack/component.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +55 -56
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/heading/component.d.ts +4 -2
- package/build-types/heading/component.d.ts.map +1 -1
- package/build-types/heading/hook.d.ts +54 -55
- package/build-types/heading/hook.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.map +1 -1
- package/build-types/input-control/input-field.d.ts +1 -3
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/input-control/input-prefix-wrapper.d.ts +2 -1
- package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
- package/build-types/input-control/input-suffix-wrapper.d.ts +2 -1
- package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
- package/build-types/input-control/label.d.ts.map +1 -1
- package/build-types/input-control/stories/index.d.ts +5 -5
- package/build-types/input-control/stories/index.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts +2 -6
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +3 -0
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/item-group/item/component.d.ts +2 -1
- package/build-types/item-group/item/component.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +54 -55
- package/build-types/item-group/item/hook.d.ts.map +1 -1
- package/build-types/item-group/item-group/component.d.ts +2 -1
- package/build-types/item-group/item-group/component.d.ts.map +1 -1
- package/build-types/item-group/item-group/hook.d.ts +54 -55
- package/build-types/item-group/item-group/hook.d.ts.map +1 -1
- package/build-types/modal/aria-helper.d.ts.map +1 -1
- package/build-types/navigable-container/menu.d.ts.map +1 -1
- package/build-types/navigable-container/tabbable.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +4 -2
- package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +59 -60
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/component.d.ts +7 -2
- package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +59 -60
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-provider/component.d.ts +2 -1
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +10 -28
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
- package/build-types/number-control/types.d.ts +72 -0
- package/build-types/number-control/types.d.ts.map +1 -0
- 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 +28 -24
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/index.d.ts +12 -0
- package/build-types/popover/stories/index.d.ts.map +1 -0
- package/build-types/popover/types.d.ts +179 -0
- package/build-types/popover/types.d.ts.map +1 -0
- package/build-types/popover/utils.d.ts +42 -24
- package/build-types/popover/utils.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/range-control/index.d.ts +2 -4
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/input-range.d.ts +2 -4
- package/build-types/range-control/input-range.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +5 -10
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/resizable-box/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/label.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -3
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
- package/build-types/scrollable/component.d.ts +2 -1
- package/build-types/scrollable/component.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +55 -56
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/search-control/index.d.ts +29 -0
- package/build-types/search-control/index.d.ts.map +1 -0
- package/build-types/search-control/stories/index.d.ts +47 -0
- package/build-types/search-control/stories/index.d.ts.map +1 -0
- package/build-types/search-control/types.d.ts +39 -0
- package/build-types/search-control/types.d.ts.map +1 -0
- package/build-types/select-control/index.d.ts +1 -3
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/stories/index.d.ts +2 -6
- package/build-types/select-control/stories/index.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts +1 -3
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/spacer/component.d.ts +2 -1
- package/build-types/spacer/component.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +55 -56
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/spinner/index.d.ts +1 -3
- package/build-types/spinner/index.d.ts.map +1 -1
- package/build-types/surface/component.d.ts +2 -1
- package/build-types/surface/component.d.ts.map +1 -1
- package/build-types/surface/hook.d.ts +55 -56
- package/build-types/surface/hook.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts +42 -0
- package/build-types/tab-panel/index.d.ts.map +1 -0
- package/build-types/tab-panel/stories/index.d.ts +12 -0
- package/build-types/tab-panel/stories/index.d.ts.map +1 -0
- package/build-types/tab-panel/test/index.d.ts +2 -0
- package/build-types/tab-panel/test/index.d.ts.map +1 -0
- package/build-types/tab-panel/types.d.ts +64 -0
- package/build-types/tab-panel/types.d.ts.map +1 -0
- package/build-types/text/component.d.ts +1 -1
- package/build-types/text/component.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +55 -56
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text-control/index.d.ts +2 -4
- package/build-types/text-control/index.d.ts.map +1 -1
- package/build-types/text-control/types.d.ts +1 -1
- package/build-types/text-control/types.d.ts.map +1 -1
- package/build-types/textarea-control/index.d.ts +1 -1
- package/build-types/textarea-control/index.d.ts.map +1 -1
- package/build-types/textarea-control/types.d.ts +1 -1
- package/build-types/textarea-control/types.d.ts.map +1 -1
- package/build-types/toggle-control/index.d.ts +26 -0
- package/build-types/toggle-control/index.d.ts.map +1 -0
- package/build-types/toggle-control/stories/index.d.ts +13 -0
- package/build-types/toggle-control/stories/index.d.ts.map +1 -0
- package/build-types/toggle-control/test/index.d.ts +2 -0
- package/build-types/toggle-control/test/index.d.ts.map +1 -0
- package/build-types/toggle-control/types.d.ts +20 -0
- package/build-types/toggle-control/types.d.ts.map +1 -0
- package/build-types/toggle-group-control/stories/index.d.ts +4 -2
- package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts +12 -2
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +2 -4
- 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 +2 -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-icon/component.d.ts +3 -5
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/types.d.ts +2 -2
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/component.d.ts +2 -1
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +55 -56
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts +2 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +55 -56
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/component.d.ts +6 -2
- package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +55 -56
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/truncate/component.d.ts +2 -1
- package/build-types/truncate/component.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +55 -56
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/ui/context/context-connect.d.ts +10 -9
- package/build-types/ui/context/context-connect.d.ts.map +1 -1
- package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
- package/build-types/ui/context/test/context-connect.d.ts +2 -0
- package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
- package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
- package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
- package/build-types/ui/context/wordpress-component.d.ts +8 -9
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
- package/build-types/ui/control-group/component.d.ts +4 -1
- package/build-types/ui/control-group/component.d.ts.map +1 -1
- package/build-types/ui/control-group/hook.d.ts +55 -56
- package/build-types/ui/control-group/hook.d.ts.map +1 -1
- package/build-types/ui/control-label/component.d.ts +4 -1
- package/build-types/ui/control-label/component.d.ts.map +1 -1
- package/build-types/ui/control-label/hook.d.ts +55 -56
- package/build-types/ui/control-label/hook.d.ts.map +1 -1
- package/build-types/ui/form-group/form-group.d.ts +4 -8
- package/build-types/ui/form-group/form-group.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +112 -114
- package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
- package/build-types/ui/shortcut/component.d.ts +2 -1
- package/build-types/ui/shortcut/component.d.ts.map +1 -1
- package/build-types/ui/spinner/component.d.ts +1 -1
- package/build-types/ui/tooltip/component.d.ts +11 -1
- package/build-types/ui/tooltip/component.d.ts.map +1 -1
- package/build-types/ui/tooltip/content.d.ts +7 -1
- package/build-types/ui/tooltip/styles.d.ts +1 -3
- package/build-types/ui/tooltip/styles.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +2 -12
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/stories/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +5 -10
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +3 -35
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/utils/colors-values.d.ts +0 -18
- package/build-types/utils/colors-values.d.ts.map +1 -1
- package/build-types/utils/math.d.ts +6 -6
- package/build-types/utils/math.d.ts.map +1 -1
- package/build-types/utils/values.d.ts +10 -8
- package/build-types/utils/values.d.ts.map +1 -1
- package/build-types/v-stack/component.d.ts +8 -2
- package/build-types/v-stack/component.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +55 -56
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/build-types/v-stack/stories/index.d.ts +8 -1
- package/build-types/v-stack/stories/index.d.ts.map +1 -1
- package/build-types/view/component.d.ts +8 -6
- package/build-types/view/component.d.ts.map +1 -1
- package/build-types/view/stories/index.d.ts +12 -0
- package/build-types/view/stories/index.d.ts.map +1 -0
- package/build-types/view/types.d.ts +8 -0
- package/build-types/view/types.d.ts.map +1 -0
- package/build-types/visually-hidden/component.d.ts +2 -1
- package/build-types/visually-hidden/component.d.ts.map +1 -1
- package/build-types/z-stack/component.d.ts +2 -1
- package/build-types/z-stack/component.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +1 -1
- package/src/angle-picker-control/README.md +9 -1
- package/src/angle-picker-control/index.js +12 -0
- package/src/angle-picker-control/stories/index.js +3 -3
- package/src/autocomplete/autocompleter-ui.js +6 -3
- package/src/base-field/test/__snapshots__/index.js.snap +3 -5
- package/src/border-box-control/border-box-control/component.tsx +28 -12
- package/src/border-box-control/border-box-control-linked-button/component.tsx +1 -2
- package/src/border-box-control/border-box-control-split-controls/component.tsx +25 -11
- package/src/border-box-control/stories/index.js +1 -0
- package/src/border-box-control/styles.ts +2 -1
- package/src/border-box-control/types.ts +5 -4
- package/src/border-control/border-control-dropdown/component.tsx +3 -8
- package/src/border-control/types.ts +7 -9
- package/src/box-control/linked-button.js +3 -3
- package/src/box-control/test/index.js +5 -5
- package/src/button/style.scss +4 -3
- package/src/card/styles.ts +1 -1
- package/src/card/test/__snapshots__/index.tsx.snap +39 -51
- package/src/checkbox-control/index.tsx +3 -6
- package/src/checkbox-control/stories/index.tsx +6 -2
- package/src/checkbox-control/types.ts +4 -1
- package/src/color-palette/index.js +1 -1
- package/src/color-palette/test/__snapshots__/index.js.snap +67 -91
- package/src/color-picker/input-with-slider.tsx +1 -0
- package/src/combobox-control/index.js +1 -1
- package/src/combobox-control/test/index.js +311 -0
- package/src/custom-gradient-picker/index.js +1 -1
- package/src/date-time/date/index.tsx +2 -2
- package/src/date-time/time/timezone.tsx +1 -1
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +1122 -164
- package/src/dimension-control/test/index.test.js +29 -38
- package/src/disabled/index.tsx +27 -9
- package/src/disabled/styles/disabled-styles.tsx +2 -2
- package/src/disabled/test/index.tsx +38 -0
- package/src/drop-zone/README.md +3 -3
- package/src/drop-zone/{index.js → index.tsx} +48 -13
- package/src/drop-zone/{provider.js → provider.ts} +5 -1
- package/src/drop-zone/stories/index.tsx +30 -0
- package/src/drop-zone/types.ts +29 -0
- package/src/dropdown/README.md +6 -4
- package/src/dropdown/index.js +15 -3
- package/src/dropdown/stories/index.js +1 -1
- package/src/flex/flex/hook.ts +5 -54
- package/src/flex/test/__snapshots__/index.tsx.snap +7 -15
- package/src/focal-point-picker/README.md +2 -2
- package/src/focal-point-picker/{controls.js → controls.tsx} +38 -10
- package/src/focal-point-picker/{focal-point.js → focal-point.tsx} +7 -1
- package/src/focal-point-picker/{grid.js → grid.tsx} +6 -1
- package/src/focal-point-picker/{index.js → index.tsx} +99 -15
- package/src/focal-point-picker/{media.js → media.tsx} +10 -4
- package/src/focal-point-picker/stories/index.tsx +93 -0
- package/src/focal-point-picker/styles/{focal-point-picker-style.js → focal-point-picker-style.ts} +31 -5
- package/src/focal-point-picker/styles/{focal-point-style.js → focal-point-style.ts} +2 -1
- package/src/focal-point-picker/test/index.js +27 -7
- package/src/focal-point-picker/types.ts +93 -0
- package/src/focal-point-picker/{utils.js → utils.ts} +9 -9
- package/src/font-size-picker/README.md +9 -0
- package/src/font-size-picker/index.js +9 -0
- package/src/font-size-picker/stories/index.js +3 -5
- package/src/font-size-picker/test/index.js +15 -2
- package/src/font-size-picker/test/utils.js +1 -2
- package/src/font-size-picker/utils.js +1 -1
- package/src/form-file-upload/README.md +6 -1
- package/src/form-file-upload/{index.js → index.tsx} +22 -4
- package/src/form-file-upload/stories/index.tsx +74 -0
- package/src/form-file-upload/test/{index.js → index.tsx} +7 -3
- package/src/form-file-upload/types.ts +63 -0
- package/src/form-toggle/index.tsx +1 -6
- package/src/form-token-field/index.tsx +4 -5
- package/src/form-token-field/suggestions-list.tsx +1 -2
- package/src/gradient-picker/index.js +41 -47
- package/src/gradient-picker/stories/index.js +10 -0
- package/src/h-stack/test/__snapshots__/index.tsx.snap +3 -12
- package/src/higher-order/with-filters/test/__snapshots__/index.js.snap +87 -0
- package/src/higher-order/with-filters/test/index.js +20 -74
- package/src/icon/index.tsx +1 -1
- package/src/icon/stories/index.js +18 -0
- package/src/icon/test/index.js +32 -83
- package/src/input-control/input-base.tsx +9 -11
- package/src/input-control/label.tsx +9 -4
- package/src/input-control/styles/input-control-styles.tsx +0 -43
- package/src/input-control/types.ts +3 -0
- package/src/isolated-event-container/test/index.js +53 -11
- package/src/item-group/test/__snapshots__/index.js.snap +16 -16
- package/src/keyboard-shortcuts/test/index.js +16 -31
- package/src/menu-item/test/__snapshots__/index.js.snap +60 -62
- package/src/menu-item/test/index.js +30 -22
- package/src/modal/aria-helper.js +3 -8
- package/src/modal/style.scss +3 -4
- package/src/navigable-container/README.md +2 -0
- package/src/navigable-container/container.js +8 -1
- package/src/navigable-container/menu.js +14 -11
- package/src/navigable-container/stories/navigable-menu.js +49 -0
- package/src/navigable-container/stories/tabbable-container.js +40 -0
- package/src/navigable-container/tabbable.js +2 -3
- package/src/navigable-container/test/navigable-menu.js +277 -0
- package/src/navigable-container/test/tababble-container.js +175 -0
- package/src/navigation/menu/menu-title-search.js +2 -0
- package/src/navigation/menu/use-navigation-tree-menu.js +2 -0
- package/src/navigator/navigator-button/hook.ts +1 -1
- package/src/navigator/navigator-screen/component.tsx +6 -1
- package/src/number-control/index.tsx +209 -0
- package/src/number-control/stories/index.js +6 -18
- package/src/number-control/types.ts +75 -0
- package/src/panel/README.md +1 -1
- package/src/panel/test/__snapshots__/header.js.snap +9 -0
- package/src/panel/test/__snapshots__/index.js.snap +17 -0
- package/src/panel/test/__snapshots__/row.js.snap +17 -0
- package/src/panel/test/header.js +30 -23
- package/src/panel/test/index.js +33 -25
- package/src/panel/test/row.js +18 -11
- package/src/placeholder/index.tsx +4 -5
- package/src/placeholder/style.scss +4 -0
- package/src/popover/README.md +128 -48
- package/src/popover/{index.js → index.tsx} +284 -182
- package/src/popover/stories/{index.js → index.tsx} +52 -54
- package/src/popover/test/index.js +7 -5
- package/src/popover/types.ts +192 -0
- package/src/popover/utils.ts +242 -0
- package/src/radio-control/index.tsx +28 -29
- package/src/radio-control/style.scss +0 -17
- package/src/range-control/index.tsx +4 -1
- package/src/range-control/styles/range-control-styles.ts +8 -8
- package/src/sandbox/index.js +2 -2
- package/src/search-control/README.md +5 -3
- package/src/search-control/{index.js → index.tsx} +35 -7
- package/src/search-control/stories/index.tsx +66 -0
- package/src/search-control/types.ts +43 -0
- package/src/select-control/index.native.js +1 -1
- package/src/slot-fill/test/index.js +69 -12
- package/src/style.scss +0 -1
- package/src/surface/test/__snapshots__/index.tsx.snap +10 -10
- package/src/tab-panel/README.md +1 -2
- package/src/tab-panel/{index.js → index.tsx} +58 -13
- package/src/tab-panel/stories/index.tsx +37 -0
- package/src/tab-panel/test/index.tsx +120 -0
- package/src/tab-panel/types.ts +65 -0
- package/src/text-control/index.tsx +2 -0
- package/src/text-control/types.ts +5 -1
- package/src/textarea-control/index.tsx +3 -6
- package/src/textarea-control/types.ts +1 -1
- package/src/toggle-control/index.tsx +97 -0
- package/src/toggle-control/stories/index.tsx +58 -0
- package/src/toggle-control/test/index.tsx +53 -0
- package/src/toggle-control/types.ts +28 -0
- package/src/toggle-group-control/stories/index.tsx +10 -3
- package/src/toggle-group-control/toggle-group-control/component.tsx +3 -3
- package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +1 -1
- package/src/toggle-group-control/types.ts +2 -2
- package/src/tooltip/index.js +11 -7
- package/src/ui/context/context-connect.ts +58 -31
- package/src/ui/context/context-system-provider.js +5 -4
- package/src/ui/context/test/context-connect.tsx +55 -0
- package/src/ui/context/test/wordpress-component.tsx +36 -0
- package/src/ui/context/wordpress-component.ts +18 -12
- package/src/ui/control-group/test/__snapshots__/index.js.snap +1 -4
- package/src/unit-control/index.tsx +1 -1
- package/src/unit-control/stories/index.tsx +7 -16
- package/src/unit-control/styles/unit-control-styles.ts +2 -2
- package/src/unit-control/test/__snapshots__/index.tsx.snap +4 -6
- package/src/unit-control/types.ts +3 -44
- package/src/utils/colors-values.js +2 -24
- package/src/utils/math.js +4 -4
- package/src/utils/values.js +48 -6
- package/src/v-stack/test/__snapshots__/index.tsx.snap +3 -12
- package/src/view/{component.js → component.tsx} +13 -4
- package/src/view/stories/index.tsx +32 -0
- package/src/view/types.ts +6 -0
- package/tsconfig.json +1 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/src/focal-point-picker/stories/index.js +0 -76
- package/src/navigable-container/test/menu.js +0 -310
- package/src/navigable-container/test/tabbable.js +0 -158
- package/src/number-control/index.js +0 -192
- package/src/popover/utils.js +0 -107
- package/src/search-control/stories/index.js +0 -39
- package/src/tab-panel/stories/index.js +0 -39
- package/src/tab-panel/test/index.js +0 -179
- package/src/toggle-control/index.js +0 -55
- package/src/toggle-control/stories/index.js +0 -64
- package/src/toggle-control/style.scss +0 -14
- package/src/toggle-control/test/index.js +0 -52
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-picker/input-with-slider.tsx"],"names":["InputWithSlider","min","max","label","abbreviation","onChange","value","Text","COLORS","ui","theme"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AAiBO,MAAMA,eAAe,GAAG,QAOF;AAAA,MAPI;AAChCC,IAAAA,GADgC;AAEhCC,IAAAA,GAFgC;AAGhCC,IAAAA,KAHgC;AAIhCC,IAAAA,YAJgC;AAKhCC,IAAAA,QALgC;AAMhCC,IAAAA;AANgC,GAOJ;AAC5B,SACC,4BAAC,cAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,4BAAD;AACC,IAAA,GAAG,EAAGL,GADP;AAEC,IAAA,GAAG,EAAGC,GAFP;AAGC,IAAA,KAAK,EAAGC,KAHT;AAIC,IAAA,mBAAmB,MAJpB;AAKC,IAAA,KAAK,EAAGG,KALT;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-picker/input-with-slider.tsx"],"names":["InputWithSlider","min","max","label","abbreviation","onChange","value","Text","COLORS","ui","theme"],"mappings":";;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AACA;;AARA;AACA;AACA;AAiBO,MAAMA,eAAe,GAAG,QAOF;AAAA,MAPI;AAChCC,IAAAA,GADgC;AAEhCC,IAAAA,GAFgC;AAGhCC,IAAAA,KAHgC;AAIhCC,IAAAA,YAJgC;AAKhCC,IAAAA,QALgC;AAMhCC,IAAAA;AANgC,GAOJ;AAC5B,SACC,4BAAC,cAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,4BAAC,4BAAD;AACC,IAAA,GAAG,EAAGL,GADP;AAEC,IAAA,GAAG,EAAGC,GAFP;AAGC,IAAA,KAAK,EAAGC,KAHT;AAIC,IAAA,mBAAmB,MAJpB;AAKC,IAAA,KAAK,EAAGG,KALT,CAMC;AAND;AAOC,IAAA,QAAQ,EAAGD,QAPZ;AAQC,IAAA,MAAM,EACL,4BAAC,cAAD;AACC,MAAA,EAAE,EAAGE,UADN;AAEC,MAAA,WAAW,EAAG,kBAAO,CAAP,CAFf;AAGC,MAAA,KAAK,EAAGC,qBAAOC,EAAP,CAAUC,KAHnB;AAIC,MAAA,UAAU,EAAG;AAJd,OAMGN,YANH,CATF;AAkBC,IAAA,cAAc,MAlBf;AAmBC,IAAA,IAAI,EAAC;AAnBN,IADD,EAsBC,4BAAC,oBAAD;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,mBAAmB,MAFpB;AAGC,IAAA,GAAG,EAAGF,GAHP;AAIC,IAAA,GAAG,EAAGC,GAJP;AAKC,IAAA,KAAK,EAAGI,KALT,CAMC;AACA;AAPD;AAQC,IAAA,QAAQ,EAAGD,QARZ;AASC,IAAA,cAAc,EAAG;AATlB,IAtBD,CADD;AAoCA,CA5CM","sourcesContent":["/**\n * Internal dependencies\n */\nimport { HStack } from '../h-stack';\nimport { Text } from '../text';\nimport { Spacer } from '../spacer';\nimport { space } from '../ui/utils/space';\nimport { RangeControl, NumberControlWrapper } from './styles';\nimport { COLORS } from '../utils/colors-values';\n\ninterface InputWithSliderProps {\n\tmin: number;\n\tmax: number;\n\tvalue: number;\n\tlabel: string;\n\tabbreviation: string;\n\tonChange: ( value: number ) => void;\n}\n\nexport const InputWithSlider = ( {\n\tmin,\n\tmax,\n\tlabel,\n\tabbreviation,\n\tonChange,\n\tvalue,\n}: InputWithSliderProps ) => {\n\treturn (\n\t\t<HStack spacing={ 4 }>\n\t\t\t<NumberControlWrapper\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tvalue={ value }\n\t\t\t\t// @ts-expect-error TODO: Resolve discrepancy in NumberControl\n\t\t\t\tonChange={ onChange }\n\t\t\t\tprefix={\n\t\t\t\t\t<Spacer\n\t\t\t\t\t\tas={ Text }\n\t\t\t\t\t\tpaddingLeft={ space( 4 ) }\n\t\t\t\t\t\tcolor={ COLORS.ui.theme }\n\t\t\t\t\t\tlineHeight={ 1 }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ abbreviation }\n\t\t\t\t\t</Spacer>\n\t\t\t\t}\n\t\t\t\thideHTMLArrows\n\t\t\t\tsize=\"__unstable-large\"\n\t\t\t/>\n\t\t\t<RangeControl\n\t\t\t\tlabel={ label }\n\t\t\t\thideLabelFromVision\n\t\t\t\tmin={ min }\n\t\t\t\tmax={ max }\n\t\t\t\tvalue={ value }\n\t\t\t\t// @ts-expect-error\n\t\t\t\t// See: https://github.com/WordPress/gutenberg/pull/40535#issuecomment-1172418185\n\t\t\t\tonChange={ onChange }\n\t\t\t\twithInputField={ false }\n\t\t\t/>\n\t\t</HStack>\n\t);\n};\n"]}
|
|
@@ -111,7 +111,7 @@ function ComboboxControl(_ref) {
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
return startsWithMatch.concat(containsMatch);
|
|
114
|
-
}, [inputValue, options
|
|
114
|
+
}, [inputValue, options]);
|
|
115
115
|
|
|
116
116
|
const onSuggestionSelected = newSelectedSuggestion => {
|
|
117
117
|
setValue(newSelectedSuggestion.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/combobox-control/index.js"],"names":["noop","DetectOutside","Component","handleFocusOutside","event","props","onFocusOutside","render","children","ComboboxControl","__nextHasNoMarginBottom","__next36pxDefaultSize","value","valueProp","label","options","onChange","onChangeProp","onFilterValueChange","hideLabelFromVision","help","allowReset","className","messages","selected","__experimentalRenderItem","setValue","currentOption","find","option","currentLabel","instanceId","selectedSuggestion","setSelectedSuggestion","isExpanded","setIsExpanded","inputHasFocus","setInputHasFocus","inputValue","setInputValue","inputContainer","matchingSuggestions","startsWithMatch","containsMatch","match","forEach","index","indexOf","push","concat","onSuggestionSelected","newSelectedSuggestion","handleArrowNavigation","offset","nextIndex","length","onKeyDown","preventDefault","defaultPrevented","code","onBlur","onFocus","onInputChange","text","handleOnReset","current","focus","hasMatchingSuggestions","hasSelectedMatchingSuggestions","message","closeSmall","suggestion"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAWA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,aAAa,GAAG,+BACrB,cAAcC,kBAAd,CAAwB;AACvBC,EAAAA,kBAAkB,CAAEC,KAAF,EAAU;AAC3B,SAAKC,KAAL,CAAWC,cAAX,CAA2BF,KAA3B;AACA;;AAEDG,EAAAA,MAAM,GAAG;AACR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AA,KAAK,EAAG,cAAI,OAAJ;AALT,IADD,CAxBF,CALD,EAwCG9B,UAAU,IACX,4BAAC,wBAAD;AACC,IAAA,UAAU,EAAGH,UADd;AAEC,IAAA,KAAK,EAAG;AAAEjB,MAAAA,KAAK,EAAEwB;AAAT,KAFT;AAGC,IAAA,gBAAgB,EAAKiC,UAAF,IAClBA,UAAU,CAACzD,KAJb;AAMC,IAAA,WAAW,EAAG2B,mBANf;AAOC,IAAA,aAAa,EAAGA,mBAAmB,CAACM,OAApB,CACff,kBADe,CAPjB;AAUC,IAAA,OAAO,EAAGC,qBAVX;AAWC,IAAA,QAAQ,EAAGiB,oBAXZ;AAYC,IAAA,cAAc,MAZf;AAaC,IAAA,wBAAwB,EACvBzB;AAdF,IAzCF,CAZD,CADD,CADD;AA6EA;AACA;;eAEchB,e","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tComponent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { InputWrapperFlex } from './styles';\nimport TokenInput from '../form-token-field/token-input';\nimport SuggestionsList from '../form-token-field/suggestions-list';\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { FlexBlock, FlexItem } from '../flex';\nimport withFocusOutside from '../higher-order/with-focus-outside';\nimport { useControlledValue } from '../utils/hooks';\nimport { normalizeTextString } from '../utils/strings';\n\nconst noop = () => {};\n\nconst DetectOutside = withFocusOutside(\n\tclass extends Component {\n\t\thandleFocusOutside( event ) {\n\t\t\tthis.props.onFocusOutside( event );\n\t\t}\n\n\t\trender() {\n\t\t\treturn this.props.children;\n\t\t}\n\t}\n);\n\nfunction ComboboxControl( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__next36pxDefaultSize,\n\tvalue: valueProp,\n\tlabel,\n\toptions,\n\tonChange: onChangeProp,\n\tonFilterValueChange = noop,\n\thideLabelFromVision,\n\thelp,\n\tallowReset = true,\n\tclassName,\n\tmessages = {\n\t\tselected: __( 'Item selected.' ),\n\t},\n\t__experimentalRenderItem,\n} ) {\n\tconst [ value, setValue ] = useControlledValue( {\n\t\tvalue: valueProp,\n\t\tonChange: onChangeProp,\n\t} );\n\n\tconst currentOption = options.find( ( option ) => option.value === value );\n\tconst currentLabel = currentOption?.label ?? '';\n\t// Use a custom prefix when generating the `instanceId` to avoid having\n\t// duplicate input IDs when rendering this component and `FormTokenField`\n\t// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).\n\tconst instanceId = useInstanceId( ComboboxControl, 'combobox-control' );\n\tconst [ selectedSuggestion, setSelectedSuggestion ] = useState(\n\t\tcurrentOption || null\n\t);\n\tconst [ isExpanded, setIsExpanded ] = useState( false );\n\tconst [ inputHasFocus, setInputHasFocus ] = useState( false );\n\tconst [ inputValue, setInputValue ] = useState( '' );\n\tconst inputContainer = useRef();\n\n\tconst matchingSuggestions = useMemo( () => {\n\t\tconst startsWithMatch = [];\n\t\tconst containsMatch = [];\n\t\tconst match = normalizeTextString( inputValue );\n\t\toptions.forEach( ( option ) => {\n\t\t\tconst index = normalizeTextString( option.label ).indexOf( match );\n\t\t\tif ( index === 0 ) {\n\t\t\t\tstartsWithMatch.push( option );\n\t\t\t} else if ( index > 0 ) {\n\t\t\t\tcontainsMatch.push( option );\n\t\t\t}\n\t\t} );\n\n\t\treturn startsWithMatch.concat( containsMatch );\n\t}, [ inputValue, options, value ] );\n\n\tconst onSuggestionSelected = ( newSelectedSuggestion ) => {\n\t\tsetValue( newSelectedSuggestion.value );\n\t\tspeak( messages.selected, 'assertive' );\n\t\tsetSelectedSuggestion( newSelectedSuggestion );\n\t\tsetInputValue( '' );\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst handleArrowNavigation = ( offset = 1 ) => {\n\t\tconst index = matchingSuggestions.indexOf( selectedSuggestion );\n\t\tlet nextIndex = index + offset;\n\t\tif ( nextIndex < 0 ) {\n\t\t\tnextIndex = matchingSuggestions.length - 1;\n\t\t} else if ( nextIndex >= matchingSuggestions.length ) {\n\t\t\tnextIndex = 0;\n\t\t}\n\t\tsetSelectedSuggestion( matchingSuggestions[ nextIndex ] );\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onKeyDown = ( event ) => {\n\t\tlet preventDefault = false;\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( event.code ) {\n\t\t\tcase 'Enter':\n\t\t\t\tif ( selectedSuggestion ) {\n\t\t\t\t\tonSuggestionSelected( selectedSuggestion );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowUp':\n\t\t\t\thandleArrowNavigation( -1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\t\thandleArrowNavigation( 1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'Escape':\n\t\t\t\tsetIsExpanded( false );\n\t\t\t\tsetSelectedSuggestion( null );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst onBlur = () => {\n\t\tsetInputHasFocus( false );\n\t};\n\n\tconst onFocus = () => {\n\t\tsetInputHasFocus( true );\n\t\tsetIsExpanded( true );\n\t\tonFilterValueChange( '' );\n\t\tsetInputValue( '' );\n\t};\n\n\tconst onFocusOutside = () => {\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst onInputChange = ( event ) => {\n\t\tconst text = event.value;\n\t\tsetInputValue( text );\n\t\tonFilterValueChange( text );\n\t\tif ( inputHasFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tsetValue( null );\n\t\tinputContainer.current.focus();\n\t};\n\n\t// Update current selections when the filter input changes.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tconst hasSelectedMatchingSuggestions =\n\t\t\tmatchingSuggestions.indexOf( selectedSuggestion ) > 0;\n\n\t\tif ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {\n\t\t\t// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.\n\t\t\tsetSelectedSuggestion( matchingSuggestions[ 0 ] );\n\t\t}\n\t}, [ matchingSuggestions, selectedSuggestion ] );\n\n\t// Announcements.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tif ( isExpanded ) {\n\t\t\tconst message = hasMatchingSuggestions\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t )\n\t\t\t\t: __( 'No results.' );\n\n\t\t\tspeak( message, 'polite' );\n\t\t}\n\t}, [ matchingSuggestions, isExpanded ] );\n\n\t// Disable reason: There is no appropriate role which describes the\n\t// input container intended accessible usability.\n\t// TODO: Refactor click detection to use blur to stop propagation.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<DetectOutside onFocusOutside={ onFocusOutside }>\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'components-combobox-control'\n\t\t\t\t) }\n\t\t\t\ttabIndex=\"-1\"\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ `components-form-token-input-${ instanceId }` }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\thelp={ help }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-combobox-control__suggestions-container\"\n\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<InputWrapperFlex\n\t\t\t\t\t\t__next36pxDefaultSize={ __next36pxDefaultSize }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<TokenInput\n\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__input\"\n\t\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t\tref={ inputContainer }\n\t\t\t\t\t\t\t\tvalue={ isExpanded ? inputValue : currentLabel }\n\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\tcurrentLabel\n\t\t\t\t\t\t\t\t\t\t? `${ currentLabel }, ${ label }`\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tselectedSuggestionIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t{ allowReset && (\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__reset\"\n\t\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</InputWrapperFlex>\n\t\t\t\t\t{ isExpanded && (\n\t\t\t\t\t\t<SuggestionsList\n\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\tmatch={ { label: inputValue } }\n\t\t\t\t\t\t\tdisplayTransform={ ( suggestion ) =>\n\t\t\t\t\t\t\t\tsuggestion.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuggestions={ matchingSuggestions }\n\t\t\t\t\t\t\tselectedIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonHover={ setSelectedSuggestion }\n\t\t\t\t\t\t\tonSelect={ onSuggestionSelected }\n\t\t\t\t\t\t\tscrollIntoView\n\t\t\t\t\t\t\t__experimentalRenderItem={\n\t\t\t\t\t\t\t\t__experimentalRenderItem\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</div>\n\t\t\t</BaseControl>\n\t\t</DetectOutside>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n\nexport default ComboboxControl;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/combobox-control/index.js"],"names":["noop","DetectOutside","Component","handleFocusOutside","event","props","onFocusOutside","render","children","ComboboxControl","__nextHasNoMarginBottom","__next36pxDefaultSize","value","valueProp","label","options","onChange","onChangeProp","onFilterValueChange","hideLabelFromVision","help","allowReset","className","messages","selected","__experimentalRenderItem","setValue","currentOption","find","option","currentLabel","instanceId","selectedSuggestion","setSelectedSuggestion","isExpanded","setIsExpanded","inputHasFocus","setInputHasFocus","inputValue","setInputValue","inputContainer","matchingSuggestions","startsWithMatch","containsMatch","match","forEach","index","indexOf","push","concat","onSuggestionSelected","newSelectedSuggestion","handleArrowNavigation","offset","nextIndex","length","onKeyDown","preventDefault","defaultPrevented","code","onBlur","onFocus","onInputChange","text","handleOnReset","current","focus","hasMatchingSuggestions","hasSelectedMatchingSuggestions","message","closeSmall","suggestion"],"mappings":";;;;;;;;;AASA;;AANA;;AAKA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA/BA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAWA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEA,MAAMC,aAAa,GAAG,+BACrB,cAAcC,kBAAd,CAAwB;AACvBC,EAAAA,kBAAkB,CAAEC,KAAF,EAAU;AAC3B,SAAKC,KAAL,CAAWC,cAAX,CAA2BF,KAA3B;AACA;;AAEDG,EAAAA,MAAM,GAAG;AACR,WAAO,KAAKF,KAAL,CAAWG,QAAlB;AACA;;AAPsB,CADH,CAAtB;;AAYA,SAASC,eAAT,OAiBI;AAAA;;AAAA,MAjBsB;AACzB;AACAC,IAAAA,uBAAuB,GAAG,KAFD;AAGzBC,IAAAA,qBAHyB;AAIzBC,IAAAA,KAAK,EAAEC,SAJkB;AAKzBC,IAAAA,KALyB;AAMzBC,IAAAA,OANyB;AAOzBC,IAAAA,QAAQ,EAAEC,YAPe;AAQzBC,IAAAA,mBAAmB,GAAGlB,IARG;AASzBmB,IAAAA,mBATyB;AAUzBC,IAAAA,IAVyB;AAWzBC,IAAAA,UAAU,GAAG,IAXY;AAYzBC,IAAAA,SAZyB;AAazBC,IAAAA,QAAQ,GAAG;AACVC,MAAAA,QAAQ,EAAE,cAAI,gBAAJ;AADA,KAbc;AAgBzBC,IAAAA;AAhByB,GAiBtB;AACH,QAAM,CAAEb,KAAF,EAASc,QAAT,IAAsB,+BAAoB;AAC/Cd,IAAAA,KAAK,EAAEC,SADwC;AAE/CG,IAAAA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,UAFd;AAGC,IAAA,GAAG,EAAGS,cAHP;AAIC,IAAA,KAAK,EAAGN,UAAU,GAAGI,UAAH,GAAgBR,YAJnC;AAKC,kBACCA,YAAY,GACR,GAAGA,YAAc,KAAKhB,KAAO,EADrB,GAET,IARL;AAUC,IAAA,OAAO,EAAG+C,OAVX;AAWC,IAAA,MAAM,EAAGD,MAXV;AAYC,IAAA,UAAU,EAAG1B,UAZd;AAaC,IAAA,uBAAuB,EAAGO,mBAAmB,CAACM,OAApB,CACzBf,kBADyB,CAb3B;AAgBC,IAAA,QAAQ,EAAG8B;AAhBZ,IADD,CAHD,EAuBGzC,UAAU,IACX,4BAAC,cAAD,QACC,4BAAC,eAAD;AACC,IAAA,SAAS,EAAC,oCADX;AAEC,IAAA,IAAI,EAAGiD,iBAFR;AAGC,IAAA,QAAQ,EAAG,CAAE1D,KAHd;AAIC,IAAA,OAAO,EAAGoD,aAJX;AAKC,IAAA,KAAK,EAAG,cAAI,OAAJ;AALT,IADD,CAxBF,CALD,EAwCG9B,UAAU,IACX,4BAAC,wBAAD;AACC,IAAA,UAAU,EAAGH,UADd;AAEC,IAAA,KAAK,EAAG;AAAEjB,MAAAA,KAAK,EAAEwB;AAAT,KAFT;AAGC,IAAA,gBAAgB,EAAKiC,UAAF,IAClBA,UAAU,CAACzD,KAJb;AAMC,IAAA,WAAW,EAAG2B,mBANf;AAOC,IAAA,aAAa,EAAGA,mBAAmB,CAACM,OAApB,CACff,kBADe,CAPjB;AAUC,IAAA,OAAO,EAAGC,qBAVX;AAWC,IAAA,QAAQ,EAAGiB,oBAXZ;AAYC,IAAA,cAAc,MAZf;AAaC,IAAA,wBAAwB,EACvBzB;AAdF,IAzCF,CAZD,CADD,CADD;AA6EA;AACA;;eAEchB,e","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tComponent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n} from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport { speak } from '@wordpress/a11y';\nimport { closeSmall } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { InputWrapperFlex } from './styles';\nimport TokenInput from '../form-token-field/token-input';\nimport SuggestionsList from '../form-token-field/suggestions-list';\nimport BaseControl from '../base-control';\nimport Button from '../button';\nimport { FlexBlock, FlexItem } from '../flex';\nimport withFocusOutside from '../higher-order/with-focus-outside';\nimport { useControlledValue } from '../utils/hooks';\nimport { normalizeTextString } from '../utils/strings';\n\nconst noop = () => {};\n\nconst DetectOutside = withFocusOutside(\n\tclass extends Component {\n\t\thandleFocusOutside( event ) {\n\t\t\tthis.props.onFocusOutside( event );\n\t\t}\n\n\t\trender() {\n\t\t\treturn this.props.children;\n\t\t}\n\t}\n);\n\nfunction ComboboxControl( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\t__next36pxDefaultSize,\n\tvalue: valueProp,\n\tlabel,\n\toptions,\n\tonChange: onChangeProp,\n\tonFilterValueChange = noop,\n\thideLabelFromVision,\n\thelp,\n\tallowReset = true,\n\tclassName,\n\tmessages = {\n\t\tselected: __( 'Item selected.' ),\n\t},\n\t__experimentalRenderItem,\n} ) {\n\tconst [ value, setValue ] = useControlledValue( {\n\t\tvalue: valueProp,\n\t\tonChange: onChangeProp,\n\t} );\n\n\tconst currentOption = options.find( ( option ) => option.value === value );\n\tconst currentLabel = currentOption?.label ?? '';\n\t// Use a custom prefix when generating the `instanceId` to avoid having\n\t// duplicate input IDs when rendering this component and `FormTokenField`\n\t// in the same page (see https://github.com/WordPress/gutenberg/issues/42112).\n\tconst instanceId = useInstanceId( ComboboxControl, 'combobox-control' );\n\tconst [ selectedSuggestion, setSelectedSuggestion ] = useState(\n\t\tcurrentOption || null\n\t);\n\tconst [ isExpanded, setIsExpanded ] = useState( false );\n\tconst [ inputHasFocus, setInputHasFocus ] = useState( false );\n\tconst [ inputValue, setInputValue ] = useState( '' );\n\tconst inputContainer = useRef();\n\n\tconst matchingSuggestions = useMemo( () => {\n\t\tconst startsWithMatch = [];\n\t\tconst containsMatch = [];\n\t\tconst match = normalizeTextString( inputValue );\n\t\toptions.forEach( ( option ) => {\n\t\t\tconst index = normalizeTextString( option.label ).indexOf( match );\n\t\t\tif ( index === 0 ) {\n\t\t\t\tstartsWithMatch.push( option );\n\t\t\t} else if ( index > 0 ) {\n\t\t\t\tcontainsMatch.push( option );\n\t\t\t}\n\t\t} );\n\n\t\treturn startsWithMatch.concat( containsMatch );\n\t}, [ inputValue, options ] );\n\n\tconst onSuggestionSelected = ( newSelectedSuggestion ) => {\n\t\tsetValue( newSelectedSuggestion.value );\n\t\tspeak( messages.selected, 'assertive' );\n\t\tsetSelectedSuggestion( newSelectedSuggestion );\n\t\tsetInputValue( '' );\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst handleArrowNavigation = ( offset = 1 ) => {\n\t\tconst index = matchingSuggestions.indexOf( selectedSuggestion );\n\t\tlet nextIndex = index + offset;\n\t\tif ( nextIndex < 0 ) {\n\t\t\tnextIndex = matchingSuggestions.length - 1;\n\t\t} else if ( nextIndex >= matchingSuggestions.length ) {\n\t\t\tnextIndex = 0;\n\t\t}\n\t\tsetSelectedSuggestion( matchingSuggestions[ nextIndex ] );\n\t\tsetIsExpanded( true );\n\t};\n\n\tconst onKeyDown = ( event ) => {\n\t\tlet preventDefault = false;\n\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tswitch ( event.code ) {\n\t\t\tcase 'Enter':\n\t\t\t\tif ( selectedSuggestion ) {\n\t\t\t\t\tonSuggestionSelected( selectedSuggestion );\n\t\t\t\t\tpreventDefault = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowUp':\n\t\t\t\thandleArrowNavigation( -1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'ArrowDown':\n\t\t\t\thandleArrowNavigation( 1 );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tcase 'Escape':\n\t\t\t\tsetIsExpanded( false );\n\t\t\t\tsetSelectedSuggestion( null );\n\t\t\t\tpreventDefault = true;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif ( preventDefault ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\tconst onBlur = () => {\n\t\tsetInputHasFocus( false );\n\t};\n\n\tconst onFocus = () => {\n\t\tsetInputHasFocus( true );\n\t\tsetIsExpanded( true );\n\t\tonFilterValueChange( '' );\n\t\tsetInputValue( '' );\n\t};\n\n\tconst onFocusOutside = () => {\n\t\tsetIsExpanded( false );\n\t};\n\n\tconst onInputChange = ( event ) => {\n\t\tconst text = event.value;\n\t\tsetInputValue( text );\n\t\tonFilterValueChange( text );\n\t\tif ( inputHasFocus ) {\n\t\t\tsetIsExpanded( true );\n\t\t}\n\t};\n\n\tconst handleOnReset = () => {\n\t\tsetValue( null );\n\t\tinputContainer.current.focus();\n\t};\n\n\t// Update current selections when the filter input changes.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tconst hasSelectedMatchingSuggestions =\n\t\t\tmatchingSuggestions.indexOf( selectedSuggestion ) > 0;\n\n\t\tif ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {\n\t\t\t// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.\n\t\t\tsetSelectedSuggestion( matchingSuggestions[ 0 ] );\n\t\t}\n\t}, [ matchingSuggestions, selectedSuggestion ] );\n\n\t// Announcements.\n\tuseEffect( () => {\n\t\tconst hasMatchingSuggestions = matchingSuggestions.length > 0;\n\t\tif ( isExpanded ) {\n\t\t\tconst message = hasMatchingSuggestions\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %d: number of results. */\n\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t'%d result found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\t'%d results found, use up and down arrow keys to navigate.',\n\t\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t\t\t),\n\t\t\t\t\t\tmatchingSuggestions.length\n\t\t\t\t )\n\t\t\t\t: __( 'No results.' );\n\n\t\t\tspeak( message, 'polite' );\n\t\t}\n\t}, [ matchingSuggestions, isExpanded ] );\n\n\t// Disable reason: There is no appropriate role which describes the\n\t// input container intended accessible usability.\n\t// TODO: Refactor click detection to use blur to stop propagation.\n\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\treturn (\n\t\t<DetectOutside onFocusOutside={ onFocusOutside }>\n\t\t\t<BaseControl\n\t\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\tclassName,\n\t\t\t\t\t'components-combobox-control'\n\t\t\t\t) }\n\t\t\t\ttabIndex=\"-1\"\n\t\t\t\tlabel={ label }\n\t\t\t\tid={ `components-form-token-input-${ instanceId }` }\n\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\thelp={ help }\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-combobox-control__suggestions-container\"\n\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<InputWrapperFlex\n\t\t\t\t\t\t__next36pxDefaultSize={ __next36pxDefaultSize }\n\t\t\t\t\t>\n\t\t\t\t\t\t<FlexBlock>\n\t\t\t\t\t\t\t<TokenInput\n\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__input\"\n\t\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\t\tref={ inputContainer }\n\t\t\t\t\t\t\t\tvalue={ isExpanded ? inputValue : currentLabel }\n\t\t\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\t\t\tcurrentLabel\n\t\t\t\t\t\t\t\t\t\t? `${ currentLabel }, ${ label }`\n\t\t\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonFocus={ onFocus }\n\t\t\t\t\t\t\t\tonBlur={ onBlur }\n\t\t\t\t\t\t\t\tisExpanded={ isExpanded }\n\t\t\t\t\t\t\t\tselectedSuggestionIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t\t{ allowReset && (\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"components-combobox-control__reset\"\n\t\t\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\t\t\tdisabled={ ! value }\n\t\t\t\t\t\t\t\t\tonClick={ handleOnReset }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Reset' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</InputWrapperFlex>\n\t\t\t\t\t{ isExpanded && (\n\t\t\t\t\t\t<SuggestionsList\n\t\t\t\t\t\t\tinstanceId={ instanceId }\n\t\t\t\t\t\t\tmatch={ { label: inputValue } }\n\t\t\t\t\t\t\tdisplayTransform={ ( suggestion ) =>\n\t\t\t\t\t\t\t\tsuggestion.label\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsuggestions={ matchingSuggestions }\n\t\t\t\t\t\t\tselectedIndex={ matchingSuggestions.indexOf(\n\t\t\t\t\t\t\t\tselectedSuggestion\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonHover={ setSelectedSuggestion }\n\t\t\t\t\t\t\tonSelect={ onSuggestionSelected }\n\t\t\t\t\t\t\tscrollIntoView\n\t\t\t\t\t\t\t__experimentalRenderItem={\n\t\t\t\t\t\t\t\t__experimentalRenderItem\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</div>\n\t\t\t</BaseControl>\n\t\t</DetectOutside>\n\t);\n\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n}\n\nexport default ComboboxControl;\n"]}
|
|
@@ -152,7 +152,7 @@ function CustomGradientPicker(_ref3) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
return (0, _element.createElement)(_vStack.VStack, {
|
|
155
|
-
spacing:
|
|
155
|
+
spacing: 4,
|
|
156
156
|
className: (0, _classnames.default)('components-custom-gradient-picker', {
|
|
157
157
|
'is-next-has-no-margin': __nextHasNoMargin
|
|
158
158
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/index.js"],"names":["GradientAnglePicker","gradientAST","hasGradient","onChange","angle","orientation","value","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","type","GradientTypePicker","onSetLinearGradient","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","restGradientAST","handleOnChange","next","GRADIENT_OPTIONS","CustomGradientPicker","__nextHasNoMargin","__experimentalIsRenderedInSidebar","background","DEFAULT_GRADIENT","controlPoints","colorStops","map","colorStop","color","position","parseInt","length","since","version","hint","newControlPoints"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAMA;;AAhCA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAwBA,MAAMA,mBAAmB,GAAG,QAA8C;AAAA;;AAAA,MAA5C;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,WAAf;AAA4BC,IAAAA;AAA5B,GAA4C;AACzE,QAAMC,KAAK,4BACVH,WADU,aACVA,WADU,iDACVA,WAAW,CAAEI,WADH,2DACV,uBAA0BC,KAD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AAFb,KAMC,4BAAC,oBAAD;AACC,IAAA,iCAAiC,EAChCC,iCAFF;AAIC,IAAA,UAAU,EAAGC,UAJd;AAKC,IAAA,WAAW,EAAGpB,WALf;AAMC,IAAA,KAAK,EAAGsB,aANT;AAOC,IAAA,QAAQ,EAAKW,gBAAF,IAAwB;AAClChC,MAAAA,QAAQ,CACP,mCACC,4CACCF,WADD,EAECkC,gBAFD,CADD,CADO,CAAR;AAQA;AAhBF,IAND,EAwBC,4BAAC,UAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,4BAAC,yCAAD,QACC,4BAAC,kBAAD;AACC,IAAA,WAAW,EAAGlC,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IADD,CAJD,EAWC,4BAAC,4CAAD,QACGF,WAAW,CAACS,IAAZ,KAAqB,iBAArB,IACD,4BAAC,mBAAD;AACC,IAAA,WAAW,EAAGT,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAFF,CAXD,CAxBD,CADD;AAgDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from './gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport {\n\tgetGradientAstWithDefault,\n\tgetLinearGradientRepresentation,\n\tgetGradientAstWithControlPoints,\n\tgetStopCssColor,\n} from './utils';\nimport { serializeGradient } from './serializer';\nimport {\n\tDEFAULT_LINEAR_GRADIENT_ANGLE,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tGRADIENT_OPTIONS,\n\tDEFAULT_GRADIENT,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\n\nconst GradientAnglePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst angle =\n\t\tgradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n\tconst onAngleChange = ( newAngle ) => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: {\n\t\t\t\t\ttype: 'angular',\n\t\t\t\t\tvalue: newAngle,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t};\n\treturn (\n\t\t<AnglePickerControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tonChange={ onAngleChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst { type } = gradientAST;\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\t...( gradientAST.orientation\n\t\t\t\t\t? {}\n\t\t\t\t\t: { orientation: HORIZONTAL_GRADIENT_ORIENTATION } ),\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tconst { orientation, ...restGradientAST } = gradientAST;\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...restGradientAST,\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next ) => {\n\t\tif ( next === 'linear-gradient' ) {\n\t\t\tonSetLinearGradient();\n\t\t}\n\t\tif ( next === 'radial-gradient' ) {\n\t\t\tonSetRadialGradient();\n\t\t}\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"components-custom-gradient-picker__type-picker\"\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\tonChange={ handleOnChange }\n\t\t\toptions={ GRADIENT_OPTIONS }\n\t\t\tsize=\"__unstable-large\"\n\t\t\tvalue={ hasGradient && type }\n\t\t/>\n\t);\n};\n\nexport default function CustomGradientPicker( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMargin = false,\n\tvalue,\n\tonChange,\n\t__experimentalIsRenderedInSidebar,\n} ) {\n\tconst gradientAST = getGradientAstWithDefault( value );\n\t// On radial gradients the bar should display a linear gradient.\n\t// On radial gradients the bar represents a slice of the gradient from the center until the outside.\n\t// On liner gradients the bar represents the color stops from left to right independently of the angle.\n\tconst background = getLinearGradientRepresentation( gradientAST );\n\tconst hasGradient = gradientAST.value !== DEFAULT_GRADIENT;\n\t// Control points color option may be hex from presets, custom colors will be rgb.\n\t// The position should always be a percentage.\n\tconst controlPoints = gradientAST.colorStops.map( ( colorStop ) => ( {\n\t\tcolor: getStopCssColor( colorStop ),\n\t\tposition: parseInt( colorStop.length.value ),\n\t} ) );\n\n\tif ( ! __nextHasNoMargin ) {\n\t\tdeprecated(\n\t\t\t'Outer margin styles for wp.components.CustomGradientPicker',\n\t\t\t{\n\t\t\t\tsince: '6.1',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMargin` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tspacing={
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/custom-gradient-picker/index.js"],"names":["GradientAnglePicker","gradientAST","hasGradient","onChange","angle","orientation","value","DEFAULT_LINEAR_GRADIENT_ANGLE","onAngleChange","newAngle","type","GradientTypePicker","onSetLinearGradient","HORIZONTAL_GRADIENT_ORIENTATION","onSetRadialGradient","restGradientAST","handleOnChange","next","GRADIENT_OPTIONS","CustomGradientPicker","__nextHasNoMargin","__experimentalIsRenderedInSidebar","background","DEFAULT_GRADIENT","controlPoints","colorStops","map","colorStop","color","position","parseInt","length","since","version","hint","newControlPoints"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AAMA;;AAhCA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAwBA,MAAMA,mBAAmB,GAAG,QAA8C;AAAA;;AAAA,MAA5C;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,WAAf;AAA4BC,IAAAA;AAA5B,GAA4C;AACzE,QAAMC,KAAK,4BACVH,WADU,aACVA,WADU,iDACVA,WAAW,CAAEI,WADH,2DACV,uBAA0BC,KADhB,yEACyBC,wCADpC;;AAEA,QAAMC,aAAa,GAAKC,QAAF,IAAgB;AACrCN,IAAAA,QAAQ,CACP,mCAAmB,EAClB,GAAGF,WADe;AAElBI,MAAAA,WAAW,EAAE;AACZK,QAAAA,IAAI,EAAE,SADM;AAEZJ,QAAAA,KAAK,EAAEG;AAFK;AAFK,KAAnB,CADO,CAAR;AASA,GAVD;;AAWA,SACC,4BAAC,2BAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,QAAQ,EAAGD,aAFZ;AAGC,IAAA,aAAa,EAAC,KAHf;AAIC,IAAA,KAAK,EAAGN,WAAW,GAAGE,KAAH,GAAW;AAJ/B,IADD;AAQA,CAtBD;;AAwBA,MAAMO,kBAAkB,GAAG,SAA8C;AAAA,MAA5C;AAAEV,IAAAA,WAAF;AAAeC,IAAAA,WAAf;AAA4BC,IAAAA;AAA5B,GAA4C;AACxE,QAAM;AAAEO,IAAAA;AAAF,MAAWT,WAAjB;;AACA,QAAMW,mBAAmB,GAAG,MAAM;AACjCT,IAAAA,QAAQ,CACP,mCAAmB,EAClB,GAAGF,WADe;AAElB,UAAKA,WAAW,CAACI,WAAZ,GACF,EADE,GAEF;AAAEA,QAAAA,WAAW,EAAEQ;AAAf,OAFH,CAFkB;AAKlBH,MAAAA,IAAI,EAAE;AALY,KAAnB,CADO,CAAR;AASA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IAAAA,QAAQ,EAAEC,QAAQ,CAAEH,SAAS,CAACI,MAAV,CAAiBzB,KAAnB;AAFkD,GAAnB,CAA5B,CAAtB;;AAKA,MAAK,CAAEc,iBAAP,EAA2B;AAC1B,6BACC,4DADD,EAEC;AACCY,MAAAA,KAAK,EAAE,KADR;AAECC,MAAAA,OAAO,EAAE,KAFV;AAGCC,MAAAA,IAAI,EAAE;AAHP,KAFD;AAQA;;AAED,SACC,4BAAC,cAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,SAAS,EAAG,yBAAY,mCAAZ,EAAiD;AAC5D,+BAAyBd;AADmC,KAAjD;AAFb,KAMC,4BAAC,oBAAD;AACC,IAAA,iCAAiC,EAChCC,iCAFF;AAIC,IAAA,UAAU,EAAGC,UAJd;AAKC,IAAA,WAAW,EAAGpB,WALf;AAMC,IAAA,KAAK,EAAGsB,aANT;AAOC,IAAA,QAAQ,EAAKW,gBAAF,IAAwB;AAClChC,MAAAA,QAAQ,CACP,mCACC,4CACCF,WADD,EAECkC,gBAFD,CADD,CADO,CAAR;AAQA;AAhBF,IAND,EAwBC,4BAAC,UAAD;AACC,IAAA,GAAG,EAAG,CADP;AAEC,IAAA,SAAS,EAAC;AAFX,KAIC,4BAAC,yCAAD,QACC,4BAAC,kBAAD;AACC,IAAA,WAAW,EAAGlC,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IADD,CAJD,EAWC,4BAAC,4CAAD,QACGF,WAAW,CAACS,IAAZ,KAAqB,iBAArB,IACD,4BAAC,mBAAD;AACC,IAAA,WAAW,EAAGT,WADf;AAEC,IAAA,WAAW,EAAGC,WAFf;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IAFF,CAXD,CAxBD,CADD;AAgDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport AnglePickerControl from '../angle-picker-control';\nimport CustomGradientBar from './gradient-bar';\nimport { Flex } from '../flex';\nimport SelectControl from '../select-control';\nimport { VStack } from '../v-stack';\nimport {\n\tgetGradientAstWithDefault,\n\tgetLinearGradientRepresentation,\n\tgetGradientAstWithControlPoints,\n\tgetStopCssColor,\n} from './utils';\nimport { serializeGradient } from './serializer';\nimport {\n\tDEFAULT_LINEAR_GRADIENT_ANGLE,\n\tHORIZONTAL_GRADIENT_ORIENTATION,\n\tGRADIENT_OPTIONS,\n\tDEFAULT_GRADIENT,\n} from './constants';\nimport {\n\tAccessoryWrapper,\n\tSelectWrapper,\n} from './styles/custom-gradient-picker-styles';\n\nconst GradientAnglePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst angle =\n\t\tgradientAST?.orientation?.value ?? DEFAULT_LINEAR_GRADIENT_ANGLE;\n\tconst onAngleChange = ( newAngle ) => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\torientation: {\n\t\t\t\t\ttype: 'angular',\n\t\t\t\t\tvalue: newAngle,\n\t\t\t\t},\n\t\t\t} )\n\t\t);\n\t};\n\treturn (\n\t\t<AnglePickerControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tonChange={ onAngleChange }\n\t\t\tlabelPosition=\"top\"\n\t\t\tvalue={ hasGradient ? angle : '' }\n\t\t/>\n\t);\n};\n\nconst GradientTypePicker = ( { gradientAST, hasGradient, onChange } ) => {\n\tconst { type } = gradientAST;\n\tconst onSetLinearGradient = () => {\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...gradientAST,\n\t\t\t\t...( gradientAST.orientation\n\t\t\t\t\t? {}\n\t\t\t\t\t: { orientation: HORIZONTAL_GRADIENT_ORIENTATION } ),\n\t\t\t\ttype: 'linear-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst onSetRadialGradient = () => {\n\t\tconst { orientation, ...restGradientAST } = gradientAST;\n\t\tonChange(\n\t\t\tserializeGradient( {\n\t\t\t\t...restGradientAST,\n\t\t\t\ttype: 'radial-gradient',\n\t\t\t} )\n\t\t);\n\t};\n\n\tconst handleOnChange = ( next ) => {\n\t\tif ( next === 'linear-gradient' ) {\n\t\t\tonSetLinearGradient();\n\t\t}\n\t\tif ( next === 'radial-gradient' ) {\n\t\t\tonSetRadialGradient();\n\t\t}\n\t};\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"components-custom-gradient-picker__type-picker\"\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tlabelPosition=\"top\"\n\t\t\tonChange={ handleOnChange }\n\t\t\toptions={ GRADIENT_OPTIONS }\n\t\t\tsize=\"__unstable-large\"\n\t\t\tvalue={ hasGradient && type }\n\t\t/>\n\t);\n};\n\nexport default function CustomGradientPicker( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMargin = false,\n\tvalue,\n\tonChange,\n\t__experimentalIsRenderedInSidebar,\n} ) {\n\tconst gradientAST = getGradientAstWithDefault( value );\n\t// On radial gradients the bar should display a linear gradient.\n\t// On radial gradients the bar represents a slice of the gradient from the center until the outside.\n\t// On liner gradients the bar represents the color stops from left to right independently of the angle.\n\tconst background = getLinearGradientRepresentation( gradientAST );\n\tconst hasGradient = gradientAST.value !== DEFAULT_GRADIENT;\n\t// Control points color option may be hex from presets, custom colors will be rgb.\n\t// The position should always be a percentage.\n\tconst controlPoints = gradientAST.colorStops.map( ( colorStop ) => ( {\n\t\tcolor: getStopCssColor( colorStop ),\n\t\tposition: parseInt( colorStop.length.value ),\n\t} ) );\n\n\tif ( ! __nextHasNoMargin ) {\n\t\tdeprecated(\n\t\t\t'Outer margin styles for wp.components.CustomGradientPicker',\n\t\t\t{\n\t\t\t\tsince: '6.1',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMargin` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t\t}\n\t\t);\n\t}\n\n\treturn (\n\t\t<VStack\n\t\t\tspacing={ 4 }\n\t\t\tclassName={ classnames( 'components-custom-gradient-picker', {\n\t\t\t\t'is-next-has-no-margin': __nextHasNoMargin,\n\t\t\t} ) }\n\t\t>\n\t\t\t<CustomGradientBar\n\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t}\n\t\t\t\tbackground={ background }\n\t\t\t\thasGradient={ hasGradient }\n\t\t\t\tvalue={ controlPoints }\n\t\t\t\tonChange={ ( newControlPoints ) => {\n\t\t\t\t\tonChange(\n\t\t\t\t\t\tserializeGradient(\n\t\t\t\t\t\t\tgetGradientAstWithControlPoints(\n\t\t\t\t\t\t\t\tgradientAST,\n\t\t\t\t\t\t\t\tnewControlPoints\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} }\n\t\t\t/>\n\t\t\t<Flex\n\t\t\t\tgap={ 3 }\n\t\t\t\tclassName=\"components-custom-gradient-picker__ui-line\"\n\t\t\t>\n\t\t\t\t<SelectWrapper>\n\t\t\t\t\t<GradientTypePicker\n\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t</SelectWrapper>\n\t\t\t\t<AccessoryWrapper>\n\t\t\t\t\t{ gradientAST.type === 'linear-gradient' && (\n\t\t\t\t\t\t<GradientAnglePicker\n\t\t\t\t\t\t\tgradientAST={ gradientAST }\n\t\t\t\t\t\t\thasGradient={ hasGradient }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</AccessoryWrapper>\n\t\t\t</Flex>\n\t\t</VStack>\n\t);\n}\n"]}
|
|
@@ -238,7 +238,7 @@ function Day(_ref2) {
|
|
|
238
238
|
function getDayLabel(date, isSelected, numEvents) {
|
|
239
239
|
const {
|
|
240
240
|
formats
|
|
241
|
-
} = (0, _date.
|
|
241
|
+
} = (0, _date.getSettings)();
|
|
242
242
|
const localizedDate = (0, _date.dateI18n)(formats.date, date, -date.getTimezoneOffset());
|
|
243
243
|
|
|
244
244
|
if (isSelected && numEvents > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/date-time/date/index.tsx"],"names":["DatePicker","currentDate","onChange","events","isInvalidDate","onMonthPreviewed","startOfWeek","weekStartsOn","date","Date","calendar","viewing","setSelected","setViewing","isSelected","viewPreviousMonth","viewNextMonth","selected","focusable","setFocusable","isFocusWithinCalendar","setIsFocusWithinCalendar","prevCurrentDate","setPrevCurrentDate","arrowRight","arrowLeft","TIMEZONELESS_FORMAT","getTimezoneOffset","map","day","toString","week","index","filter","event","length","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","nextFocusable","key","preventDefault","Day","column","isFocusable","isFocusAllowed","isToday","isInvalid","numEvents","onClick","onKeyDown","ref","current","focus","getDayLabel","formats","localizedDate"],"mappings":";;;;;;;;;;AAyBA;;AAtBA;;AACA;;AAkBA;;AACA;;AACA;;AAOA;;AAQA;;AACA;;AACA;;AAzCA;AACA;AACA;;AAiBA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,UAAT,OAOc;AAAA,MAPO;AAC3BC,IAAAA,WAD2B;AAE3BC,IAAAA,QAF2B;AAG3BC,IAAAA,MAAM,GAAG,EAHkB;AAI3BC,IAAAA,aAJ2B;AAK3BC,IAAAA,gBAL2B;AAM3BC,IAAAA,WAAW,EAAEC,YAAY,GAAG;AAND,GAOP;AACpB,QAAMC,IAAI,GAAGP,WAAW,GAAG,wBAAaA,WAAb,CAAH,GAAgC,IAAIQ,IAAJ,EAAxD;AAEA,QAAM;AACLC,IAAAA,QADK;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AsBlD,IAAtB,EAAkCM,UAAlC,EAAuDsC,SAAvD,EAA2E;AAC1E,QAAM;AAAEO,IAAAA;AAAF,MAAc,sCAApB;AACA,QAAMC,aAAa,GAAG,oBACrBD,OAAO,CAACnD,IADa,EAErBA,IAFqB,EAGrB,CAACA,IAAI,CAACmB,iBAAL,EAHoB,CAAtB;;AAKA,MAAKb,UAAU,IAAIsC,SAAS,GAAG,CAA/B,EAAmC;AAClC,WAAO,oBACN;AACA,kBACC,qCADD,EAEC,uCAFD,EAGCA,SAHD,CAFM,EAONQ,aAPM,EAQNR,SARM,CAAP;AAUA,GAXD,MAWO,IAAKtC,UAAL,EAAkB;AACxB,WAAO,oBACN;AACA,kBAAI,gBAAJ,CAFM,EAGN8C,aAHM,CAAP;AAKA,GANM,MAMA,IAAKR,SAAS,GAAG,CAAjB,EAAqB;AAC3B,WAAO,oBACN;AACA,kBACC,2BADD,EAEC,6BAFD,EAGCA,SAHD,CAFM,EAONQ,aAPM,EAQNR,SARM,CAAP;AAUA;;AACD,SAAOQ,aAAP;AACA;;eAEc5D,U","sourcesContent":["/**\n * External dependencies\n */\nimport { useLilius } from 'use-lilius';\nimport {\n\tformat,\n\tisSameDay,\n\tsubMonths,\n\taddMonths,\n\tstartOfDay,\n\tisEqual,\n\taddDays,\n\tsubWeeks,\n\taddWeeks,\n\tisSameMonth,\n\tstartOfWeek,\n\tendOfWeek,\n} from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf, isRTL } from '@wordpress/i18n';\nimport { arrowLeft, arrowRight } from '@wordpress/icons';\nimport { dateI18n, __experimentalGetSettings } from '@wordpress/date';\nimport { useState, useRef, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DatePickerProps } from '../types';\nimport {\n\tWrapper,\n\tNavigator,\n\tNavigatorHeading,\n\tCalendar,\n\tDayOfWeek,\n\tDayButton,\n} from './styles';\nimport { inputToDate } from '../utils';\nimport Button from '../../button';\nimport { TIMEZONELESS_FORMAT } from '../constants';\n\n/**\n * DatePicker is a React component that renders a calendar for date selection.\n *\n * ```jsx\n * import { DatePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDatePicker = () => {\n * const [ date, setDate ] = useState( new Date() );\n *\n * return (\n * <DatePicker\n * currentDate={ date }\n * onChange={ ( newDate ) => setDate( newDate ) }\n * />\n * );\n * };\n * ```\n */\nexport function DatePicker( {\n\tcurrentDate,\n\tonChange,\n\tevents = [],\n\tisInvalidDate,\n\tonMonthPreviewed,\n\tstartOfWeek: weekStartsOn = 0,\n}: DatePickerProps ) {\n\tconst date = currentDate ? inputToDate( currentDate ) : new Date();\n\n\tconst {\n\t\tcalendar,\n\t\tviewing,\n\t\tsetSelected,\n\t\tsetViewing,\n\t\tisSelected,\n\t\tviewPreviousMonth,\n\t\tviewNextMonth,\n\t} = useLilius( {\n\t\tselected: [ startOfDay( date ) ],\n\t\tviewing: startOfDay( date ),\n\t\tweekStartsOn,\n\t} );\n\n\t// Used to implement a roving tab index. Tracks the day that receives focus\n\t// when the user tabs into the calendar.\n\tconst [ focusable, setFocusable ] = useState( startOfDay( date ) );\n\n\t// Allows us to only programmatically focus() a day when focus was already\n\t// within the calendar. This stops us stealing focus from e.g. a TimePicker\n\t// input.\n\tconst [ isFocusWithinCalendar, setIsFocusWithinCalendar ] =\n\t\tuseState( false );\n\n\t// Update internal state when currentDate prop changes.\n\tconst [ prevCurrentDate, setPrevCurrentDate ] = useState( currentDate );\n\tif ( currentDate !== prevCurrentDate ) {\n\t\tsetPrevCurrentDate( currentDate );\n\t\tsetSelected( [ startOfDay( date ) ] );\n\t\tsetViewing( startOfDay( date ) );\n\t\tsetFocusable( startOfDay( date ) );\n\t}\n\n\treturn (\n\t\t<Wrapper\n\t\t\tclassName=\"components-datetime__date\"\n\t\t\trole=\"application\"\n\t\t\taria-label={ __( 'Calendar' ) }\n\t\t>\n\t\t\t<Navigator>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ isRTL() ? arrowRight : arrowLeft }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\taria-label={ __( 'View previous month' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tviewPreviousMonth();\n\t\t\t\t\t\tsetFocusable( subMonths( focusable, 1 ) );\n\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\tsubMonths( viewing, 1 ),\n\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\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/>\n\t\t\t\t<NavigatorHeading level={ 3 }>\n\t\t\t\t\t<strong>\n\t\t\t\t\t\t{ dateI18n(\n\t\t\t\t\t\t\t'F',\n\t\t\t\t\t\t\tviewing,\n\t\t\t\t\t\t\t-viewing.getTimezoneOffset()\n\t\t\t\t\t\t) }\n\t\t\t\t\t</strong>{ ' ' }\n\t\t\t\t\t{ dateI18n( 'Y', viewing, -viewing.getTimezoneOffset() ) }\n\t\t\t\t</NavigatorHeading>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ isRTL() ? arrowLeft : arrowRight }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\taria-label={ __( 'View next month' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tviewNextMonth();\n\t\t\t\t\t\tsetFocusable( addMonths( focusable, 1 ) );\n\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\taddMonths( viewing, 1 ),\n\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\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/>\n\t\t\t</Navigator>\n\t\t\t<Calendar\n\t\t\t\tonFocus={ () => setIsFocusWithinCalendar( true ) }\n\t\t\t\tonBlur={ () => setIsFocusWithinCalendar( false ) }\n\t\t\t>\n\t\t\t\t{ calendar[ 0 ][ 0 ].map( ( day ) => (\n\t\t\t\t\t<DayOfWeek key={ day.toString() }>\n\t\t\t\t\t\t{ dateI18n( 'D', day, -day.getTimezoneOffset() ) }\n\t\t\t\t\t</DayOfWeek>\n\t\t\t\t) ) }\n\t\t\t\t{ calendar[ 0 ].map( ( week ) =>\n\t\t\t\t\tweek.map( ( day, index ) => {\n\t\t\t\t\t\tif ( ! isSameMonth( day, viewing ) ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Day\n\t\t\t\t\t\t\t\tkey={ day.toString() }\n\t\t\t\t\t\t\t\tday={ day }\n\t\t\t\t\t\t\t\tcolumn={ index + 1 }\n\t\t\t\t\t\t\t\tisSelected={ isSelected( day ) }\n\t\t\t\t\t\t\t\tisFocusable={ isEqual( day, focusable ) }\n\t\t\t\t\t\t\t\tisFocusAllowed={ isFocusWithinCalendar }\n\t\t\t\t\t\t\t\tisToday={ isSameDay( day, new Date() ) }\n\t\t\t\t\t\t\t\tisInvalid={\n\t\t\t\t\t\t\t\t\tisInvalidDate ? isInvalidDate( day ) : false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnumEvents={\n\t\t\t\t\t\t\t\t\tevents.filter( ( event ) =>\n\t\t\t\t\t\t\t\t\t\tisSameDay( event.date, day )\n\t\t\t\t\t\t\t\t\t).length\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetSelected( [ day ] );\n\t\t\t\t\t\t\t\t\tsetFocusable( day );\n\t\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\t\t\t\t// Don't change the selected date's time fields.\n\t\t\t\t\t\t\t\t\t\t\tnew Date(\n\t\t\t\t\t\t\t\t\t\t\t\tday.getFullYear(),\n\t\t\t\t\t\t\t\t\t\t\t\tday.getMonth(),\n\t\t\t\t\t\t\t\t\t\t\t\tday.getDate(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getHours(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getMinutes(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getSeconds(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getMilliseconds()\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\tlet nextFocusable;\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addDays(\n\t\t\t\t\t\t\t\t\t\t\tday,\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? 1 : -1\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowRight' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addDays(\n\t\t\t\t\t\t\t\t\t\t\tday,\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? -1 : 1\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowUp' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = subWeeks( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowDown' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addWeeks( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'PageUp' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = subMonths( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'PageDown' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addMonths( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'Home' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = startOfWeek( day );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'End' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = startOfDay(\n\t\t\t\t\t\t\t\t\t\t\tendOfWeek( day )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( nextFocusable ) {\n\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\tsetFocusable( nextFocusable );\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t! isSameMonth(\n\t\t\t\t\t\t\t\t\t\t\t\tnextFocusable,\n\t\t\t\t\t\t\t\t\t\t\t\tviewing\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tsetViewing( nextFocusable );\n\t\t\t\t\t\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\t\t\t\t\t\tnextFocusable,\n\t\t\t\t\t\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} }\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) }\n\t\t\t</Calendar>\n\t\t</Wrapper>\n\t);\n}\n\ntype DayProps = {\n\tday: Date;\n\tcolumn: number;\n\tisSelected: boolean;\n\tisFocusable: boolean;\n\tisFocusAllowed: boolean;\n\tisToday: boolean;\n\tnumEvents: number;\n\tisInvalid: boolean;\n\tonClick: () => void;\n\tonKeyDown: ( event: KeyboardEvent ) => void;\n};\n\nfunction Day( {\n\tday,\n\tcolumn,\n\tisSelected,\n\tisFocusable,\n\tisFocusAllowed,\n\tisToday,\n\tisInvalid,\n\tnumEvents,\n\tonClick,\n\tonKeyDown,\n}: DayProps ) {\n\tconst ref = useRef< HTMLButtonElement >();\n\n\t// Focus the day when it becomes focusable, e.g. because an arrow key is\n\t// pressed. Only do this if focus is allowed - this stops us stealing focus\n\t// from e.g. a TimePicker input.\n\tuseEffect( () => {\n\t\tif ( ref.current && isFocusable && isFocusAllowed ) {\n\t\t\tref.current.focus();\n\t\t}\n\t\t// isFocusAllowed is not a dep as there is no point calling focus() on\n\t\t// an already focused element.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ isFocusable ] );\n\n\treturn (\n\t\t<DayButton\n\t\t\tref={ ref }\n\t\t\tclassName=\"components-datetime__date__day\" // Unused, for backwards compatibility.\n\t\t\tdisabled={ isInvalid }\n\t\t\ttabIndex={ isFocusable ? 0 : -1 }\n\t\t\taria-label={ getDayLabel( day, isSelected, numEvents ) }\n\t\t\tcolumn={ column }\n\t\t\tisSelected={ isSelected }\n\t\t\tisToday={ isToday }\n\t\t\thasEvents={ numEvents > 0 }\n\t\t\tonClick={ onClick }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t>\n\t\t\t{ dateI18n( 'j', day, -day.getTimezoneOffset() ) }\n\t\t</DayButton>\n\t);\n}\n\nfunction getDayLabel( date: Date, isSelected: boolean, numEvents: number ) {\n\tconst { formats } = __experimentalGetSettings();\n\tconst localizedDate = dateI18n(\n\t\tformats.date,\n\t\tdate,\n\t\t-date.getTimezoneOffset()\n\t);\n\tif ( isSelected && numEvents > 0 ) {\n\t\treturn sprintf(\n\t\t\t// translators: 1: The calendar date. 2: Number of events on the calendar date.\n\t\t\t_n(\n\t\t\t\t'%1$s. Selected. There is %2$d event',\n\t\t\t\t'%1$s. Selected. There are %2$d events',\n\t\t\t\tnumEvents\n\t\t\t),\n\t\t\tlocalizedDate,\n\t\t\tnumEvents\n\t\t);\n\t} else if ( isSelected ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: The calendar date.\n\t\t\t__( '%1$s. Selected' ),\n\t\t\tlocalizedDate\n\t\t);\n\t} else if ( numEvents > 0 ) {\n\t\treturn sprintf(\n\t\t\t// translators: 1: The calendar date. 2: Number of events on the calendar date.\n\t\t\t_n(\n\t\t\t\t'%1$s. There is %2$d event',\n\t\t\t\t'%1$s. There are %2$d events',\n\t\t\t\tnumEvents\n\t\t\t),\n\t\t\tlocalizedDate,\n\t\t\tnumEvents\n\t\t);\n\t}\n\treturn localizedDate;\n}\n\nexport default DatePicker;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/date-time/date/index.tsx"],"names":["DatePicker","currentDate","onChange","events","isInvalidDate","onMonthPreviewed","startOfWeek","weekStartsOn","date","Date","calendar","viewing","setSelected","setViewing","isSelected","viewPreviousMonth","viewNextMonth","selected","focusable","setFocusable","isFocusWithinCalendar","setIsFocusWithinCalendar","prevCurrentDate","setPrevCurrentDate","arrowRight","arrowLeft","TIMEZONELESS_FORMAT","getTimezoneOffset","map","day","toString","week","index","filter","event","length","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","getMilliseconds","nextFocusable","key","preventDefault","Day","column","isFocusable","isFocusAllowed","isToday","isInvalid","numEvents","onClick","onKeyDown","ref","current","focus","getDayLabel","formats","localizedDate"],"mappings":";;;;;;;;;;AAyBA;;AAtBA;;AACA;;AAkBA;;AACA;;AACA;;AAOA;;AAQA;;AACA;;AACA;;AAzCA;AACA;AACA;;AAiBA;AACA;AACA;;AAsBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,S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sC,SAAnB,CALzB;AAMC,IAAA,MAAM,EAAGL,MANV;AAOC,IAAA,UAAU,EAAGjC,UAPd;AAQC,IAAA,OAAO,EAAGoC,OARX;AASC,IAAA,SAAS,EAAGE,SAAS,GAAG,CATzB;AAUC,IAAA,OAAO,EAAGC,OAVX;AAWC,IAAA,SAAS,EAAGC;AAXb,KAaG,oBAAU,GAAV,EAAezB,GAAf,EAAoB,CAACA,GAAG,CAACF,iBAAJ,EAArB,CAbH,CADD;AAiBA;;AAED,SAAS+B,WAAT,CAAsBlD,IAAtB,EAAkCM,UAAlC,EAAuDsC,SAAvD,EAA2E;AAC1E,QAAM;AAAEO,IAAAA;AAAF,MAAc,wBAApB;AACA,QAAMC,aAAa,GAAG,oBACrBD,OAAO,CAACnD,IADa,EAErBA,IAFqB,EAGrB,CAACA,IAAI,CAACmB,iBAAL,EAHoB,CAAtB;;AAKA,MAAKb,UAAU,IAAIsC,SAAS,GAAG,CAA/B,EAAmC;AAClC,WAAO,oBACN;AACA,kBACC,qCADD,EAEC,uCAFD,EAGCA,SAHD,CAFM,EAONQ,aAPM,EAQNR,SARM,CAAP;AAUA,GAXD,MAWO,IAAKtC,UAAL,EAAkB;AACxB,WAAO,oBACN;AACA,kBAAI,gBAAJ,CAFM,EAGN8C,aAHM,CAAP;AAKA,GANM,MAMA,IAAKR,SAAS,GAAG,CAAjB,EAAqB;AAC3B,WAAO,oBACN;AACA,kBACC,2BADD,EAEC,6BAFD,EAGCA,SAHD,CAFM,EAONQ,aAPM,EAQNR,SARM,CAAP;AAUA;;AACD,SAAOQ,aAAP;AACA;;eAEc5D,U","sourcesContent":["/**\n * External dependencies\n */\nimport { useLilius } from 'use-lilius';\nimport {\n\tformat,\n\tisSameDay,\n\tsubMonths,\n\taddMonths,\n\tstartOfDay,\n\tisEqual,\n\taddDays,\n\tsubWeeks,\n\taddWeeks,\n\tisSameMonth,\n\tstartOfWeek,\n\tendOfWeek,\n} from 'date-fns';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf, isRTL } from '@wordpress/i18n';\nimport { arrowLeft, arrowRight } from '@wordpress/icons';\nimport { dateI18n, getSettings } from '@wordpress/date';\nimport { useState, useRef, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DatePickerProps } from '../types';\nimport {\n\tWrapper,\n\tNavigator,\n\tNavigatorHeading,\n\tCalendar,\n\tDayOfWeek,\n\tDayButton,\n} from './styles';\nimport { inputToDate } from '../utils';\nimport Button from '../../button';\nimport { TIMEZONELESS_FORMAT } from '../constants';\n\n/**\n * DatePicker is a React component that renders a calendar for date selection.\n *\n * ```jsx\n * import { DatePicker } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDatePicker = () => {\n * const [ date, setDate ] = useState( new Date() );\n *\n * return (\n * <DatePicker\n * currentDate={ date }\n * onChange={ ( newDate ) => setDate( newDate ) }\n * />\n * );\n * };\n * ```\n */\nexport function DatePicker( {\n\tcurrentDate,\n\tonChange,\n\tevents = [],\n\tisInvalidDate,\n\tonMonthPreviewed,\n\tstartOfWeek: weekStartsOn = 0,\n}: DatePickerProps ) {\n\tconst date = currentDate ? inputToDate( currentDate ) : new Date();\n\n\tconst {\n\t\tcalendar,\n\t\tviewing,\n\t\tsetSelected,\n\t\tsetViewing,\n\t\tisSelected,\n\t\tviewPreviousMonth,\n\t\tviewNextMonth,\n\t} = useLilius( {\n\t\tselected: [ startOfDay( date ) ],\n\t\tviewing: startOfDay( date ),\n\t\tweekStartsOn,\n\t} );\n\n\t// Used to implement a roving tab index. Tracks the day that receives focus\n\t// when the user tabs into the calendar.\n\tconst [ focusable, setFocusable ] = useState( startOfDay( date ) );\n\n\t// Allows us to only programmatically focus() a day when focus was already\n\t// within the calendar. This stops us stealing focus from e.g. a TimePicker\n\t// input.\n\tconst [ isFocusWithinCalendar, setIsFocusWithinCalendar ] =\n\t\tuseState( false );\n\n\t// Update internal state when currentDate prop changes.\n\tconst [ prevCurrentDate, setPrevCurrentDate ] = useState( currentDate );\n\tif ( currentDate !== prevCurrentDate ) {\n\t\tsetPrevCurrentDate( currentDate );\n\t\tsetSelected( [ startOfDay( date ) ] );\n\t\tsetViewing( startOfDay( date ) );\n\t\tsetFocusable( startOfDay( date ) );\n\t}\n\n\treturn (\n\t\t<Wrapper\n\t\t\tclassName=\"components-datetime__date\"\n\t\t\trole=\"application\"\n\t\t\taria-label={ __( 'Calendar' ) }\n\t\t>\n\t\t\t<Navigator>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ isRTL() ? arrowRight : arrowLeft }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\taria-label={ __( 'View previous month' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tviewPreviousMonth();\n\t\t\t\t\t\tsetFocusable( subMonths( focusable, 1 ) );\n\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\tsubMonths( viewing, 1 ),\n\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\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/>\n\t\t\t\t<NavigatorHeading level={ 3 }>\n\t\t\t\t\t<strong>\n\t\t\t\t\t\t{ dateI18n(\n\t\t\t\t\t\t\t'F',\n\t\t\t\t\t\t\tviewing,\n\t\t\t\t\t\t\t-viewing.getTimezoneOffset()\n\t\t\t\t\t\t) }\n\t\t\t\t\t</strong>{ ' ' }\n\t\t\t\t\t{ dateI18n( 'Y', viewing, -viewing.getTimezoneOffset() ) }\n\t\t\t\t</NavigatorHeading>\n\t\t\t\t<Button\n\t\t\t\t\ticon={ isRTL() ? arrowLeft : arrowRight }\n\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\taria-label={ __( 'View next month' ) }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tviewNextMonth();\n\t\t\t\t\t\tsetFocusable( addMonths( focusable, 1 ) );\n\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\taddMonths( viewing, 1 ),\n\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\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/>\n\t\t\t</Navigator>\n\t\t\t<Calendar\n\t\t\t\tonFocus={ () => setIsFocusWithinCalendar( true ) }\n\t\t\t\tonBlur={ () => setIsFocusWithinCalendar( false ) }\n\t\t\t>\n\t\t\t\t{ calendar[ 0 ][ 0 ].map( ( day ) => (\n\t\t\t\t\t<DayOfWeek key={ day.toString() }>\n\t\t\t\t\t\t{ dateI18n( 'D', day, -day.getTimezoneOffset() ) }\n\t\t\t\t\t</DayOfWeek>\n\t\t\t\t) ) }\n\t\t\t\t{ calendar[ 0 ].map( ( week ) =>\n\t\t\t\t\tweek.map( ( day, index ) => {\n\t\t\t\t\t\tif ( ! isSameMonth( day, viewing ) ) {\n\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Day\n\t\t\t\t\t\t\t\tkey={ day.toString() }\n\t\t\t\t\t\t\t\tday={ day }\n\t\t\t\t\t\t\t\tcolumn={ index + 1 }\n\t\t\t\t\t\t\t\tisSelected={ isSelected( day ) }\n\t\t\t\t\t\t\t\tisFocusable={ isEqual( day, focusable ) }\n\t\t\t\t\t\t\t\tisFocusAllowed={ isFocusWithinCalendar }\n\t\t\t\t\t\t\t\tisToday={ isSameDay( day, new Date() ) }\n\t\t\t\t\t\t\t\tisInvalid={\n\t\t\t\t\t\t\t\t\tisInvalidDate ? isInvalidDate( day ) : false\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnumEvents={\n\t\t\t\t\t\t\t\t\tevents.filter( ( event ) =>\n\t\t\t\t\t\t\t\t\t\tisSameDay( event.date, day )\n\t\t\t\t\t\t\t\t\t).length\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tsetSelected( [ day ] );\n\t\t\t\t\t\t\t\t\tsetFocusable( day );\n\t\t\t\t\t\t\t\t\tonChange?.(\n\t\t\t\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\t\t\t\t// Don't change the selected date's time fields.\n\t\t\t\t\t\t\t\t\t\t\tnew Date(\n\t\t\t\t\t\t\t\t\t\t\t\tday.getFullYear(),\n\t\t\t\t\t\t\t\t\t\t\t\tday.getMonth(),\n\t\t\t\t\t\t\t\t\t\t\t\tday.getDate(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getHours(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getMinutes(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getSeconds(),\n\t\t\t\t\t\t\t\t\t\t\t\tdate.getMilliseconds()\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\t\tlet nextFocusable;\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowLeft' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addDays(\n\t\t\t\t\t\t\t\t\t\t\tday,\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? 1 : -1\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowRight' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addDays(\n\t\t\t\t\t\t\t\t\t\t\tday,\n\t\t\t\t\t\t\t\t\t\t\tisRTL() ? -1 : 1\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowUp' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = subWeeks( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'ArrowDown' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addWeeks( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'PageUp' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = subMonths( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'PageDown' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = addMonths( day, 1 );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'Home' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = startOfWeek( day );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( event.key === 'End' ) {\n\t\t\t\t\t\t\t\t\t\tnextFocusable = startOfDay(\n\t\t\t\t\t\t\t\t\t\t\tendOfWeek( day )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( nextFocusable ) {\n\t\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\t\tsetFocusable( nextFocusable );\n\t\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t\t! isSameMonth(\n\t\t\t\t\t\t\t\t\t\t\t\tnextFocusable,\n\t\t\t\t\t\t\t\t\t\t\t\tviewing\n\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\t\tsetViewing( nextFocusable );\n\t\t\t\t\t\t\t\t\t\t\tonMonthPreviewed?.(\n\t\t\t\t\t\t\t\t\t\t\t\tformat(\n\t\t\t\t\t\t\t\t\t\t\t\t\tnextFocusable,\n\t\t\t\t\t\t\t\t\t\t\t\t\tTIMEZONELESS_FORMAT\n\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} }\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) }\n\t\t\t</Calendar>\n\t\t</Wrapper>\n\t);\n}\n\ntype DayProps = {\n\tday: Date;\n\tcolumn: number;\n\tisSelected: boolean;\n\tisFocusable: boolean;\n\tisFocusAllowed: boolean;\n\tisToday: boolean;\n\tnumEvents: number;\n\tisInvalid: boolean;\n\tonClick: () => void;\n\tonKeyDown: ( event: KeyboardEvent ) => void;\n};\n\nfunction Day( {\n\tday,\n\tcolumn,\n\tisSelected,\n\tisFocusable,\n\tisFocusAllowed,\n\tisToday,\n\tisInvalid,\n\tnumEvents,\n\tonClick,\n\tonKeyDown,\n}: DayProps ) {\n\tconst ref = useRef< HTMLButtonElement >();\n\n\t// Focus the day when it becomes focusable, e.g. because an arrow key is\n\t// pressed. Only do this if focus is allowed - this stops us stealing focus\n\t// from e.g. a TimePicker input.\n\tuseEffect( () => {\n\t\tif ( ref.current && isFocusable && isFocusAllowed ) {\n\t\t\tref.current.focus();\n\t\t}\n\t\t// isFocusAllowed is not a dep as there is no point calling focus() on\n\t\t// an already focused element.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ isFocusable ] );\n\n\treturn (\n\t\t<DayButton\n\t\t\tref={ ref }\n\t\t\tclassName=\"components-datetime__date__day\" // Unused, for backwards compatibility.\n\t\t\tdisabled={ isInvalid }\n\t\t\ttabIndex={ isFocusable ? 0 : -1 }\n\t\t\taria-label={ getDayLabel( day, isSelected, numEvents ) }\n\t\t\tcolumn={ column }\n\t\t\tisSelected={ isSelected }\n\t\t\tisToday={ isToday }\n\t\t\thasEvents={ numEvents > 0 }\n\t\t\tonClick={ onClick }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t>\n\t\t\t{ dateI18n( 'j', day, -day.getTimezoneOffset() ) }\n\t\t</DayButton>\n\t);\n}\n\nfunction getDayLabel( date: Date, isSelected: boolean, numEvents: number ) {\n\tconst { formats } = getSettings();\n\tconst localizedDate = dateI18n(\n\t\tformats.date,\n\t\tdate,\n\t\t-date.getTimezoneOffset()\n\t);\n\tif ( isSelected && numEvents > 0 ) {\n\t\treturn sprintf(\n\t\t\t// translators: 1: The calendar date. 2: Number of events on the calendar date.\n\t\t\t_n(\n\t\t\t\t'%1$s. Selected. There is %2$d event',\n\t\t\t\t'%1$s. Selected. There are %2$d events',\n\t\t\t\tnumEvents\n\t\t\t),\n\t\t\tlocalizedDate,\n\t\t\tnumEvents\n\t\t);\n\t} else if ( isSelected ) {\n\t\treturn sprintf(\n\t\t\t// translators: %s: The calendar date.\n\t\t\t__( '%1$s. Selected' ),\n\t\t\tlocalizedDate\n\t\t);\n\t} else if ( numEvents > 0 ) {\n\t\treturn sprintf(\n\t\t\t// translators: 1: The calendar date. 2: Number of events on the calendar date.\n\t\t\t_n(\n\t\t\t\t'%1$s. There is %2$d event',\n\t\t\t\t'%1$s. There are %2$d events',\n\t\t\t\tnumEvents\n\t\t\t),\n\t\t\tlocalizedDate,\n\t\t\tnumEvents\n\t\t);\n\t}\n\treturn localizedDate;\n}\n\nexport default DatePicker;\n"]}
|
|
@@ -32,7 +32,7 @@ var _styles = require("./styles");
|
|
|
32
32
|
const TimeZone = () => {
|
|
33
33
|
const {
|
|
34
34
|
timezone
|
|
35
|
-
} = (0, _date.
|
|
35
|
+
} = (0, _date.getSettings)(); // Convert timezone offset to hours.
|
|
36
36
|
|
|
37
37
|
const userTimezoneOffset = -1 * (new Date().getTimezoneOffset() / 60); // System timezone and user timezone match, nothing needed.
|
|
38
38
|
// Compare as numbers because it comes over as string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/date-time/time/timezone.tsx"],"names":["TimeZone","timezone","userTimezoneOffset","Date","getTimezoneOffset","Number","offset","offsetSymbol","zoneAbbr","abbr","isNaN","timezoneDetail","string","replace"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA,MAAMA,QAAQ,GAAG,MAAM;AACtB,QAAM;AAAEC,IAAAA;AAAF,MAAe,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/date-time/time/timezone.tsx"],"names":["TimeZone","timezone","userTimezoneOffset","Date","getTimezoneOffset","Number","offset","offsetSymbol","zoneAbbr","abbr","isNaN","timezoneDetail","string","replace"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA,MAAMA,QAAQ,GAAG,MAAM;AACtB,QAAM;AAAEC,IAAAA;AAAF,MAAe,wBAArB,CADsB,CAGtB;;AACA,QAAMC,kBAAkB,GAAG,CAAC,CAAD,IAAO,IAAIC,IAAJ,GAAWC,iBAAX,KAAiC,EAAxC,CAA3B,CAJsB,CAMtB;AACA;;AACA,MAAKC,MAAM,CAAEJ,QAAQ,CAACK,MAAX,CAAN,KAA8BJ,kBAAnC,EAAwD;AACvD,WAAO,IAAP;AACA;;AAED,QAAMK,YAAY,GAAGF,MAAM,CAAEJ,QAAQ,CAACK,MAAX,CAAN,IAA6B,CAA7B,GAAiC,GAAjC,GAAuC,EAA5D;AACA,QAAME,QAAQ,GACb,OAAOP,QAAQ,CAACQ,IAAhB,IAAwBC,KAAK,CAAEL,MAAM,CAAEJ,QAAQ,CAACQ,IAAX,CAAR,CAA7B,GACGR,QAAQ,CAACQ,IADZ,GAEI,MAAMF,YAAc,GAAGN,QAAQ,CAACK,MAAQ,EAH7C;AAKA,QAAMK,cAAc,GACnB,UAAUV,QAAQ,CAACW,MAAnB,GACG,cAAI,4BAAJ,CADH,GAEI,IAAIJ,QAAU,KAAKP,QAAQ,CAACW,MAAT,CAAgBC,OAAhB,CAAyB,GAAzB,EAA8B,GAA9B,CAAqC,EAH7D;AAKA,SACC,4BAAC,gBAAD;AAAS,IAAA,QAAQ,EAAC,YAAlB;AAA+B,IAAA,IAAI,EAAGF;AAAtC,KACC,4BAAC,gBAAD;AAAiB,IAAA,SAAS,EAAC;AAA3B,KACGH,QADH,CADD,CADD;AAOA,CA9BD;;eAgCeR,Q","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { getSettings as getDateSettings } from '@wordpress/date';\n\n/**\n * Internal dependencies\n */\nimport Tooltip from '../../tooltip';\nimport { TimeZone as StyledComponent } from './styles';\n\n/**\n * Displays timezone information when user timezone is different from site\n * timezone.\n */\nconst TimeZone = () => {\n\tconst { timezone } = getDateSettings();\n\n\t// Convert timezone offset to hours.\n\tconst userTimezoneOffset = -1 * ( new Date().getTimezoneOffset() / 60 );\n\n\t// System timezone and user timezone match, nothing needed.\n\t// Compare as numbers because it comes over as string.\n\tif ( Number( timezone.offset ) === userTimezoneOffset ) {\n\t\treturn null;\n\t}\n\n\tconst offsetSymbol = Number( timezone.offset ) >= 0 ? '+' : '';\n\tconst zoneAbbr =\n\t\t'' !== timezone.abbr && isNaN( Number( timezone.abbr ) )\n\t\t\t? timezone.abbr\n\t\t\t: `UTC${ offsetSymbol }${ timezone.offset }`;\n\n\tconst timezoneDetail =\n\t\t'UTC' === timezone.string\n\t\t\t? __( 'Coordinated Universal Time' )\n\t\t\t: `(${ zoneAbbr }) ${ timezone.string.replace( '_', ' ' ) }`;\n\n\treturn (\n\t\t<Tooltip position=\"top center\" text={ timezoneDetail }>\n\t\t\t<StyledComponent className=\"components-datetime__timezone\">\n\t\t\t\t{ zoneAbbr }\n\t\t\t</StyledComponent>\n\t\t</Tooltip>\n\t);\n};\n\nexport default TimeZone;\n"]}
|
package/build/disabled/index.js
CHANGED
|
@@ -11,12 +11,12 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
14
|
var _compose = require("@wordpress/compose");
|
|
17
15
|
|
|
18
16
|
var _disabledStyles = require("./styles/disabled-styles");
|
|
19
17
|
|
|
18
|
+
var _utils = require("../utils");
|
|
19
|
+
|
|
20
20
|
/**
|
|
21
21
|
* External dependencies
|
|
22
22
|
*/
|
|
@@ -32,7 +32,14 @@ const Context = (0, _element.createContext)(false);
|
|
|
32
32
|
const {
|
|
33
33
|
Consumer,
|
|
34
34
|
Provider
|
|
35
|
-
} = Context;
|
|
35
|
+
} = Context; // Extracting this ContentWrapper component in order to make it more explicit
|
|
36
|
+
// the same 'ContentWrapper' component is needed so that React can reconcile
|
|
37
|
+
// the dom correctly when switching between disabled/non-disabled (instead
|
|
38
|
+
// of thrashing the previous DOM and therefore losing the form fields values).
|
|
39
|
+
|
|
40
|
+
const ContentWrapper = (0, _element.forwardRef)((props, ref) => (0, _element.createElement)("div", (0, _extends2.default)({}, props, {
|
|
41
|
+
ref: ref
|
|
42
|
+
})));
|
|
36
43
|
/**
|
|
37
44
|
* `Disabled` is a component which disables descendant tabbable elements and prevents pointer interaction.
|
|
38
45
|
*
|
|
@@ -72,18 +79,19 @@ function Disabled(_ref) {
|
|
|
72
79
|
...props
|
|
73
80
|
} = _ref;
|
|
74
81
|
const ref = (0, _compose.useDisabled)();
|
|
82
|
+
const cx = (0, _utils.useCx)();
|
|
75
83
|
|
|
76
84
|
if (!isDisabled) {
|
|
77
85
|
return (0, _element.createElement)(Provider, {
|
|
78
86
|
value: false
|
|
79
|
-
}, children);
|
|
87
|
+
}, (0, _element.createElement)(ContentWrapper, null, children));
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
return (0, _element.createElement)(Provider, {
|
|
83
91
|
value: true
|
|
84
|
-
}, (0, _element.createElement)(
|
|
92
|
+
}, (0, _element.createElement)(ContentWrapper, (0, _extends2.default)({
|
|
85
93
|
ref: ref,
|
|
86
|
-
className: (
|
|
94
|
+
className: cx(_disabledStyles.disabledStyles, className, 'components-disabled')
|
|
87
95
|
}, props), children));
|
|
88
96
|
}
|
|
89
97
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/disabled/index.tsx"],"names":["Context","Consumer","Provider","Disabled","className","children","isDisabled","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/disabled/index.tsx"],"names":["Context","Consumer","Provider","ContentWrapper","props","ref","Disabled","className","children","isDisabled","cx","disabledStyles"],"mappings":";;;;;;;;;AASA;;;;AADA;;AAMA;;AAGA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAMA,MAAMA,OAAO,GAAG,4BAA0B,KAA1B,CAAhB;AACA,MAAM;AAAEC,EAAAA,QAAF;AAAYC,EAAAA;AAAZ,IAAyBF,OAA/B,C,CAEA;AACA;AACA;AACA;;AACA,MAAMG,cAAc,GAAG,yBAGpB,CAAEC,KAAF,EAASC,GAAT,KAAkB,8DAAUD,KAAV;AAAkB,EAAA,GAAG,EAAGC;AAAxB,GAHE,CAAvB;AAKA;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,SAASC,QAAT,OAKqD;AAAA,MALlC;AAClBC,IAAAA,SADkB;AAElBC,IAAAA,QAFkB;AAGlBC,IAAAA,UAAU,GAAG,IAHK;AAIlB,OAAGL;AAJe,GAKkC;AACpD,QAAMC,GAAG,GAAG,2BAAZ;AACA,QAAMK,EAAE,GAAG,mBAAX;;AACA,MAAK,CAAED,UAAP,EAAoB;AACnB,WACC,4BAAC,QAAD;AAAU,MAAA,KAAK,EAAG;AAAlB,OACC,4BAAC,cAAD,QAAkBD,QAAlB,CADD,CADD;AAKA;;AAED,SACC,4BAAC,QAAD;AAAU,IAAA,KAAK,EAAG;AAAlB,KACC,4BAAC,cAAD;AACC,IAAA,GAAG,EAAGH,GADP;AAEC,IAAA,SAAS,EAAGK,EAAE,CACbC,8BADa,EAEbJ,SAFa,EAGb,qBAHa;AAFf,KAOMH,KAPN,GASGI,QATH,CADD,CADD;AAeA;;AAEDF,QAAQ,CAACN,OAAT,GAAmBA,OAAnB;AACAM,QAAQ,CAACL,QAAT,GAAoBA,QAApB;eAEeK,Q","sourcesContent":["/**\n * External dependencies\n */\nimport type { HTMLProps } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useDisabled } from '@wordpress/compose';\nimport { createContext, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { disabledStyles } from './styles/disabled-styles';\nimport type { DisabledProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\nimport { useCx } from '../utils';\n\nconst Context = createContext< boolean >( false );\nconst { Consumer, Provider } = Context;\n\n// Extracting this ContentWrapper component in order to make it more explicit\n// the same 'ContentWrapper' component is needed so that React can reconcile\n// the dom correctly when switching between disabled/non-disabled (instead\n// of thrashing the previous DOM and therefore losing the form fields values).\nconst ContentWrapper = forwardRef<\n\tHTMLDivElement,\n\tHTMLProps< HTMLDivElement >\n>( ( props, ref ) => <div { ...props } ref={ ref } /> );\n\n/**\n * `Disabled` is a component which disables descendant tabbable elements and prevents pointer interaction.\n *\n * ```jsx\n * import { Button, Disabled, TextControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDisabled = () => {\n * \tconst [ isDisabled, setIsDisabled ] = useState( true );\n *\n * \tlet input = <TextControl label=\"Input\" onChange={ () => {} } />;\n * \tif ( isDisabled ) {\n * \t\tinput = <Disabled>{ input }</Disabled>;\n * \t}\n *\n * \tconst toggleDisabled = () => {\n * \t\tsetIsDisabled( ( state ) => ! state );\n * \t};\n *\n * \treturn (\n * \t\t<div>\n * \t\t\t{ input }\n * \t\t\t<Button variant=\"primary\" onClick={ toggleDisabled }>\n * \t\t\t\tToggle Disabled\n * \t\t\t</Button>\n * \t\t</div>\n * \t);\n * };\n * ```\n */\nfunction Disabled( {\n\tclassName,\n\tchildren,\n\tisDisabled = true,\n\t...props\n}: WordPressComponentProps< DisabledProps, 'div' > ) {\n\tconst ref = useDisabled();\n\tconst cx = useCx();\n\tif ( ! isDisabled ) {\n\t\treturn (\n\t\t\t<Provider value={ false }>\n\t\t\t\t<ContentWrapper>{ children }</ContentWrapper>\n\t\t\t</Provider>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Provider value={ true }>\n\t\t\t<ContentWrapper\n\t\t\t\tref={ ref }\n\t\t\t\tclassName={ cx(\n\t\t\t\t\tdisabledStyles,\n\t\t\t\t\tclassName,\n\t\t\t\t\t'components-disabled'\n\t\t\t\t) }\n\t\t\t\t{ ...props }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</ContentWrapper>\n\t\t</Provider>\n\t);\n}\n\nDisabled.Context = Context;\nDisabled.Consumer = Consumer;\n\nexport default Disabled;\n"]}
|
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports.
|
|
6
|
+
exports.disabledStyles = void 0;
|
|
9
7
|
|
|
10
|
-
var
|
|
8
|
+
var _react = require("@emotion/react");
|
|
11
9
|
|
|
12
10
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
* External dependencies
|
|
16
|
-
*/
|
|
17
|
-
const StyledWrapper = (0, _base.default)("div", process.env.NODE_ENV === "production" ? {
|
|
18
|
-
target: "e13jgla80"
|
|
19
|
-
} : {
|
|
20
|
-
target: "e13jgla80",
|
|
21
|
-
label: "StyledWrapper"
|
|
22
|
-
})(process.env.NODE_ENV === "production" ? {
|
|
12
|
+
const disabledStyles = process.env.NODE_ENV === "production" ? {
|
|
23
13
|
name: "u2jump",
|
|
24
14
|
styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}"
|
|
25
15
|
} : {
|
|
26
|
-
name: "
|
|
27
|
-
styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}",
|
|
28
|
-
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
16
|
+
name: "iqemdn-disabledStyles",
|
|
17
|
+
styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;};label:disabledStyles;",
|
|
18
|
+
map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGlzYWJsZWQvc3R5bGVzL2Rpc2FibGVkLXN0eWxlcy50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS2lDIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvZGlzYWJsZWQvc3R5bGVzL2Rpc2FibGVkLXN0eWxlcy50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBkaXNhYmxlZFN0eWxlcyA9IGNzc2Bcblx0cG9zaXRpb246IHJlbGF0aXZlO1xuXHRwb2ludGVyLWV2ZW50czogbm9uZTtcblxuXHQmOjphZnRlciB7XG5cdFx0Y29udGVudDogJyc7XG5cdFx0cG9zaXRpb246IGFic29sdXRlO1xuXHRcdHRvcDogMDtcblx0XHRyaWdodDogMDtcblx0XHRib3R0b206IDA7XG5cdFx0bGVmdDogMDtcblx0fVxuXG5cdC8vIEFsc28gbWFrZSBuZXN0ZWQgYmxvY2tzIHVuc2VsZWN0YWJsZS5cblx0KiB7XG5cdFx0cG9pbnRlci1ldmVudHM6IG5vbmU7XG5cdH1cbmA7XG4iXX0= */",
|
|
29
19
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
30
|
-
}
|
|
31
|
-
exports.
|
|
20
|
+
};
|
|
21
|
+
exports.disabledStyles = disabledStyles;
|
|
32
22
|
//# sourceMappingURL=disabled-styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/disabled/styles/disabled-styles.tsx"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/disabled/styles/disabled-styles.tsx"],"names":["disabledStyles"],"mappings":";;;;;;;AAGA;;;;AAEO,MAAMA,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAApB","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\nexport const disabledStyles = css`\n\tposition: relative;\n\tpointer-events: none;\n\n\t&::after {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t}\n\n\t// Also make nested blocks unselectable.\n\t* {\n\t\tpointer-events: none;\n\t}\n`;\n"]}
|
package/build/drop-zone/index.js
CHANGED
|
@@ -5,10 +5,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.DropZoneComponent = DropZoneComponent;
|
|
9
|
+
exports.default = void 0;
|
|
9
10
|
|
|
10
11
|
var _element = require("@wordpress/element");
|
|
11
12
|
|
|
13
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
|
+
|
|
12
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
16
|
|
|
14
17
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -32,21 +35,48 @@ var _animation = require("../animation");
|
|
|
32
35
|
/**
|
|
33
36
|
* Internal dependencies
|
|
34
37
|
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* `DropZone` is a component creating a drop zone area taking the full size of its parent element. It supports dropping files, HTML content or any other HTML drop event.
|
|
41
|
+
*
|
|
42
|
+
* ```jsx
|
|
43
|
+
* import { DropZone } from '@wordpress/components';
|
|
44
|
+
* import { useState } from '@wordpress/element';
|
|
45
|
+
*
|
|
46
|
+
* const MyDropZone = () => {
|
|
47
|
+
* const [ hasDropped, setHasDropped ] = useState( false );
|
|
48
|
+
*
|
|
49
|
+
* return (
|
|
50
|
+
* <div>
|
|
51
|
+
* { hasDropped ? 'Dropped!' : 'Drop something here' }
|
|
52
|
+
* <DropZone
|
|
53
|
+
* onFilesDrop={ () => setHasDropped( true ) }
|
|
54
|
+
* onHTMLDrop={ () => setHasDropped( true ) }
|
|
55
|
+
* onDrop={ () => setHasDropped( true ) }
|
|
56
|
+
* />
|
|
57
|
+
* </div>
|
|
58
|
+
* );
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
35
62
|
function DropZoneComponent(_ref) {
|
|
36
63
|
let {
|
|
37
64
|
className,
|
|
38
65
|
label,
|
|
39
66
|
onFilesDrop,
|
|
40
67
|
onHTMLDrop,
|
|
41
|
-
onDrop
|
|
68
|
+
onDrop,
|
|
69
|
+
...restProps
|
|
42
70
|
} = _ref;
|
|
43
71
|
const [isDraggingOverDocument, setIsDraggingOverDocument] = (0, _element.useState)();
|
|
44
72
|
const [isDraggingOverElement, setIsDraggingOverElement] = (0, _element.useState)();
|
|
45
73
|
const [type, setType] = (0, _element.useState)();
|
|
46
74
|
const ref = (0, _compose.__experimentalUseDropZone)({
|
|
47
75
|
onDrop(event) {
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
var _event$dataTransfer;
|
|
77
|
+
|
|
78
|
+
const files = event.dataTransfer ? (0, _dom.getFilesFromDataTransfer)(event.dataTransfer) : [];
|
|
79
|
+
const html = (_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.getData('text/html');
|
|
50
80
|
/**
|
|
51
81
|
* From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
|
|
52
82
|
* The order of the checks is important to recognise the HTML drop.
|
|
@@ -62,6 +92,8 @@ function DropZoneComponent(_ref) {
|
|
|
62
92
|
},
|
|
63
93
|
|
|
64
94
|
onDragStart(event) {
|
|
95
|
+
var _event$dataTransfer2, _event$dataTransfer3;
|
|
96
|
+
|
|
65
97
|
setIsDraggingOverDocument(true);
|
|
66
98
|
let _type = 'default';
|
|
67
99
|
/**
|
|
@@ -69,11 +101,11 @@ function DropZoneComponent(_ref) {
|
|
|
69
101
|
* The order of the checks is important to recognise the HTML drop.
|
|
70
102
|
*/
|
|
71
103
|
|
|
72
|
-
if (event.dataTransfer.types.includes('text/html')) {
|
|
104
|
+
if ((_event$dataTransfer2 = event.dataTransfer) !== null && _event$dataTransfer2 !== void 0 && _event$dataTransfer2.types.includes('text/html')) {
|
|
73
105
|
_type = 'html';
|
|
74
106
|
} else if ( // Check for the types because sometimes the files themselves
|
|
75
107
|
// are only available on drop.
|
|
76
|
-
event.dataTransfer.types.includes('Files') || (0, _dom.getFilesFromDataTransfer)(event.dataTransfer).length > 0) {
|
|
108
|
+
(_event$dataTransfer3 = event.dataTransfer) !== null && _event$dataTransfer3 !== void 0 && _event$dataTransfer3.types.includes('Files') || (event.dataTransfer ? (0, _dom.getFilesFromDataTransfer)(event.dataTransfer) : []).length > 0) {
|
|
77
109
|
_type = 'file';
|
|
78
110
|
}
|
|
79
111
|
|
|
@@ -82,7 +114,7 @@ function DropZoneComponent(_ref) {
|
|
|
82
114
|
|
|
83
115
|
onDragEnd() {
|
|
84
116
|
setIsDraggingOverDocument(false);
|
|
85
|
-
setType();
|
|
117
|
+
setType(undefined);
|
|
86
118
|
},
|
|
87
119
|
|
|
88
120
|
onDragEnter() {
|
|
@@ -158,9 +190,12 @@ function DropZoneComponent(_ref) {
|
|
|
158
190
|
'is-dragging-over-element': isDraggingOverElement,
|
|
159
191
|
[`is-dragging-${type}`]: !!type
|
|
160
192
|
});
|
|
161
|
-
return (0, _element.createElement)("div", {
|
|
193
|
+
return (0, _element.createElement)("div", (0, _extends2.default)({}, restProps, {
|
|
162
194
|
ref: ref,
|
|
163
195
|
className: classes
|
|
164
|
-
}, disableMotion ? children : (0, _element.createElement)(_animation.__unstableAnimatePresence, null, children));
|
|
196
|
+
}), disableMotion ? children : (0, _element.createElement)(_animation.__unstableAnimatePresence, null, children));
|
|
165
197
|
}
|
|
198
|
+
|
|
199
|
+
var _default = DropZoneComponent;
|
|
200
|
+
exports.default = _default;
|
|
166
201
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/drop-zone/index.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/drop-zone/index.tsx"],"names":["DropZoneComponent","className","label","onFilesDrop","onHTMLDrop","onDrop","restProps","isDraggingOverDocument","setIsDraggingOverDocument","isDraggingOverElement","setIsDraggingOverElement","type","setType","ref","event","files","dataTransfer","html","getData","length","onDragStart","_type","types","includes","onDragEnd","undefined","onDragEnter","onDragLeave","disableMotion","children","backdrop","hidden","scaleY","opacity","show","transition","duration","delay","delayChildren","exit","foreground","scale","upload","classes"],"mappings":";;;;;;;;;;AASA;;;;AANA;;AAKA;;AAEA;;AACA;;AACA;;AAQA;;AApBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAQA;AACA;AACA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,KAAG,eAAeE,IAAM,EAAxB,GAA6B,CAAC,CAAEA;AAR8B,GAA/C,CAAhB;AAWA,SACC,8DAAUL,SAAV;AAAsB,IAAA,GAAG,EAAGO,GAA5B;AAAkC,IAAA,SAAS,EAAG8B;AAA9C,MACGf,aAAa,GACdC,QADc,GAGd,4BAAC,oCAAD,QAAmBA,QAAnB,CAJF,CADD;AASA;;eAEc7B,iB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { upload, Icon } from '@wordpress/icons';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\nimport {\n\t__experimentalUseDropZone as useDropZone,\n\tuseReducedMotion,\n} from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n} from '../animation';\nimport type { DropType, DropZoneProps } from './types';\nimport type { WordPressComponentProps } from '../ui/context';\n\n/**\n * `DropZone` is a component creating a drop zone area taking the full size of its parent element. It supports dropping files, HTML content or any other HTML drop event.\n *\n * ```jsx\n * import { DropZone } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyDropZone = () => {\n * const [ hasDropped, setHasDropped ] = useState( false );\n *\n * return (\n * <div>\n * { hasDropped ? 'Dropped!' : 'Drop something here' }\n * <DropZone\n * onFilesDrop={ () => setHasDropped( true ) }\n * onHTMLDrop={ () => setHasDropped( true ) }\n * onDrop={ () => setHasDropped( true ) }\n * />\n * </div>\n * );\n * }\n * ```\n */\nexport function DropZoneComponent( {\n\tclassName,\n\tlabel,\n\tonFilesDrop,\n\tonHTMLDrop,\n\tonDrop,\n\t...restProps\n}: WordPressComponentProps< DropZoneProps, 'div', false > ) {\n\tconst [ isDraggingOverDocument, setIsDraggingOverDocument ] =\n\t\tuseState< boolean >();\n\tconst [ isDraggingOverElement, setIsDraggingOverElement ] =\n\t\tuseState< boolean >();\n\tconst [ type, setType ] = useState< DropType >();\n\tconst ref = useDropZone( {\n\t\tonDrop( event ) {\n\t\t\tconst files = event.dataTransfer\n\t\t\t\t? getFilesFromDataTransfer( event.dataTransfer )\n\t\t\t\t: [];\n\t\t\tconst html = event.dataTransfer?.getData( 'text/html' );\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t\t */\n\t\t\tif ( html && onHTMLDrop ) {\n\t\t\t\tonHTMLDrop( html );\n\t\t\t} else if ( files.length && onFilesDrop ) {\n\t\t\t\tonFilesDrop( files );\n\t\t\t} else if ( onDrop ) {\n\t\t\t\tonDrop( event );\n\t\t\t}\n\t\t},\n\t\tonDragStart( event ) {\n\t\t\tsetIsDraggingOverDocument( true );\n\n\t\t\tlet _type: DropType = 'default';\n\n\t\t\t/**\n\t\t\t * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.\n\t\t\t * The order of the checks is important to recognise the HTML drop.\n\t\t\t */\n\t\t\tif ( event.dataTransfer?.types.includes( 'text/html' ) ) {\n\t\t\t\t_type = 'html';\n\t\t\t} else if (\n\t\t\t\t// Check for the types because sometimes the files themselves\n\t\t\t\t// are only available on drop.\n\t\t\t\tevent.dataTransfer?.types.includes( 'Files' ) ||\n\t\t\t\t( event.dataTransfer\n\t\t\t\t\t? getFilesFromDataTransfer( event.dataTransfer )\n\t\t\t\t\t: []\n\t\t\t\t).length > 0\n\t\t\t) {\n\t\t\t\t_type = 'file';\n\t\t\t}\n\n\t\t\tsetType( _type );\n\t\t},\n\t\tonDragEnd() {\n\t\t\tsetIsDraggingOverDocument( false );\n\t\t\tsetType( undefined );\n\t\t},\n\t\tonDragEnter() {\n\t\t\tsetIsDraggingOverElement( true );\n\t\t},\n\t\tonDragLeave() {\n\t\t\tsetIsDraggingOverElement( false );\n\t\t},\n\t} );\n\tconst disableMotion = useReducedMotion();\n\n\tlet children;\n\n\tconst backdrop = {\n\t\thidden: { scaleY: 0, opacity: 0 },\n\t\tshow: {\n\t\t\tscaleY: 1,\n\t\t\topacity: 1,\n\t\t\ttransition: {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: 0.2,\n\t\t\t\tdelay: 0.1,\n\t\t\t\tdelayChildren: 0.2,\n\t\t\t},\n\t\t},\n\t\texit: {\n\t\t\tscaleY: 1,\n\t\t\topacity: 0,\n\t\t\ttransition: {\n\t\t\t\tduration: 0.3,\n\t\t\t\tdelayChildren: 0,\n\t\t\t},\n\t\t},\n\t};\n\n\tconst foreground = {\n\t\thidden: { opacity: 0, scale: 0.75 },\n\t\tshow: { opacity: 1, scale: 1 },\n\t\texit: { opacity: 0, scale: 0.9 },\n\t};\n\n\tif ( isDraggingOverElement ) {\n\t\tchildren = (\n\t\t\t<motion.div\n\t\t\t\tvariants={ backdrop }\n\t\t\t\tinitial={ disableMotion ? 'show' : 'hidden' }\n\t\t\t\tanimate=\"show\"\n\t\t\t\texit={ disableMotion ? 'show' : 'exit' }\n\t\t\t\tclassName=\"components-drop-zone__content\"\n\t\t\t>\n\t\t\t\t<motion.div variants={ foreground }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\tclassName=\"components-drop-zone__content-icon\"\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"components-drop-zone__content-text\">\n\t\t\t\t\t\t{ label ? label : __( 'Drop files to upload' ) }\n\t\t\t\t\t</span>\n\t\t\t\t</motion.div>\n\t\t\t</motion.div>\n\t\t);\n\t}\n\n\tconst classes = classnames( 'components-drop-zone', className, {\n\t\t'is-active':\n\t\t\t( isDraggingOverDocument || isDraggingOverElement ) &&\n\t\t\t( ( type === 'file' && onFilesDrop ) ||\n\t\t\t\t( type === 'html' && onHTMLDrop ) ||\n\t\t\t\t( type === 'default' && onDrop ) ),\n\t\t'is-dragging-over-document': isDraggingOverDocument,\n\t\t'is-dragging-over-element': isDraggingOverElement,\n\t\t[ `is-dragging-${ type }` ]: !! type,\n\t} );\n\n\treturn (\n\t\t<div { ...restProps } ref={ ref } className={ classes }>\n\t\t\t{ disableMotion ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t<AnimatePresence>{ children }</AnimatePresence>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default DropZoneComponent;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/drop-zone/provider.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/drop-zone/provider.ts"],"names":["DropZoneProvider","children","since","hint"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,gBAAT,OAIX;AAAA,MAJsC;AACzCC,IAAAA;AADyC,GAItC;AACH,2BAAY,gCAAZ,EAA8C;AAC7CC,IAAAA,KAAK,EAAE,KADsC;AAE7CC,IAAAA,IAAI,EAAE;AAFuC,GAA9C;AAIA,SAAOF,QAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\nexport default function DropZoneProvider( {\n\tchildren,\n}: {\n\tchildren: React.ReactNode;\n} ) {\n\tdeprecated( 'wp.components.DropZoneProvider', {\n\t\tsince: '5.8',\n\t\thint: 'wp.component.DropZone no longer needs a provider. wp.components.DropZoneProvider is safe to remove from your code.',\n\t} );\n\treturn children;\n}\n"]}
|