@wordpress/components 25.14.0 → 25.15.1-next.79a6196f.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/CONTRIBUTING.md +57 -115
- package/LICENSE.md +1 -1
- package/build/base-control/index.js +17 -13
- package/build/base-control/index.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/border-control/border-control-style-picker/component.js +1 -1
- package/build/border-control/border-control-style-picker/component.js.map +1 -1
- package/build/box-control/index.js +1 -1
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/linked-button.js +1 -1
- package/build/box-control/linked-button.js.map +1 -1
- package/build/button/index.js +1 -1
- package/build/button/index.js.map +1 -1
- package/build/color-palette/index.native.js +11 -7
- package/build/color-palette/index.native.js.map +1 -1
- package/build/color-picker/color-copy-button.js +1 -1
- package/build/color-picker/color-copy-button.js.map +1 -1
- package/build/context/wordpress-component.js.map +1 -1
- package/build/custom-select-control-v2/index.js +11 -10
- package/build/custom-select-control-v2/index.js.map +1 -1
- package/build/date-time/date/styles.js +8 -8
- package/build/date-time/date/styles.js.map +1 -1
- package/build/dropdown-menu-v2/index.js +205 -159
- package/build/dropdown-menu-v2/index.js.map +1 -1
- package/build/dropdown-menu-v2/styles.js +86 -77
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/dropdown-menu-v2/types.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +4 -3
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/font-size-picker/index.js +4 -2
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +6 -3
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/form-token-field/index.js +10 -5
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/token.js +1 -0
- package/build/form-token-field/token.js.map +1 -1
- package/build/gradient-picker/index.js +3 -2
- package/build/gradient-picker/index.js.map +1 -1
- package/build/index.native.js +20 -3
- package/build/index.native.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +32 -29
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/input-control/types.js.map +1 -1
- package/build/lock-unlock.js +18 -0
- package/build/lock-unlock.js.map +1 -0
- package/build/mobile/bottom-sheet/index.native.js +8 -0
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/color-settings/palette.screen.native.js +8 -4
- package/build/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +26 -13
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/image/constants.js +12 -0
- package/build/mobile/image/constants.js.map +1 -0
- package/build/mobile/image/index.native.js +26 -18
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js +40 -8
- package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +44 -68
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +39 -0
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js.map +1 -0
- package/build/mobile/keyboard-aware-flat-list/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +22 -29
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -0
- package/build/mobile/keyboard-aware-flat-list/use-scroll.native.js +93 -0
- package/build/mobile/keyboard-aware-flat-list/use-scroll.native.js.map +1 -0
- package/build/mobile/utils/get-px-from-css-unit.native.js +302 -0
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -0
- package/build/modal/index.js +18 -13
- package/build/modal/index.js.map +1 -1
- package/build/navigation/menu/menu-title.js +1 -1
- package/build/navigation/menu/menu-title.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +13 -15
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +23 -63
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/styles.js +52 -0
- package/build/navigator/styles.js.map +1 -0
- package/build/number-control/index.js +4 -8
- package/build/number-control/index.js.map +1 -1
- package/build/number-control/types.js.map +1 -1
- package/build/palette-edit/index.js +15 -54
- package/build/palette-edit/index.js.map +1 -1
- package/build/private-apis.js +11 -26
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +21 -0
- package/build/private-apis.native.js.map +1 -0
- package/build/radio-control/index.js +1 -0
- package/build/radio-control/index.js.map +1 -1
- package/build/range-control/index.js +1 -1
- package/build/range-control/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +15 -25
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/slot-fill/index.js +3 -2
- package/build/slot-fill/index.js.map +1 -1
- package/build/slot-fill/types.js.map +1 -1
- package/build/snackbar/types.js.map +1 -1
- package/build/tabs/styles.js +3 -3
- package/build/tabs/styles.js.map +1 -1
- package/build/tabs/tabpanel.js +9 -7
- package/build/tabs/tabpanel.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +4 -4
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +29 -15
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js +3 -1
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +9 -8
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/types.js.map +1 -1
- package/build/tooltip/index.js +34 -10
- package/build/tooltip/index.js.map +1 -1
- package/build/tooltip/types.js.map +1 -1
- package/build/truncate/hook.js +10 -4
- package/build/truncate/hook.js.map +1 -1
- package/build/truncate/types.js.map +1 -1
- package/build/unit-control/index.js +1 -1
- package/build/unit-control/index.js.map +1 -1
- package/build/utils/strings.js +34 -3
- package/build/utils/strings.js.map +1 -1
- package/build-module/base-control/index.js +16 -12
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/border-control/border-control-style-picker/component.js +1 -1
- package/build-module/border-control/border-control-style-picker/component.js.map +1 -1
- package/build-module/box-control/index.js +1 -1
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/linked-button.js +1 -1
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/button/index.js +1 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +11 -7
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/color-picker/color-copy-button.js +1 -1
- package/build-module/color-picker/color-copy-button.js.map +1 -1
- package/build-module/context/wordpress-component.js.map +1 -1
- package/build-module/custom-select-control-v2/index.js +11 -10
- package/build-module/custom-select-control-v2/index.js.map +1 -1
- package/build-module/date-time/date/styles.js +8 -8
- package/build-module/date-time/date/styles.js.map +1 -1
- package/build-module/dropdown-menu-v2/index.js +201 -154
- package/build-module/dropdown-menu-v2/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/styles.js +68 -61
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/dropdown-menu-v2/types.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +4 -3
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/font-size-picker/index.js +4 -2
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +5 -2
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/form-token-field/index.js +10 -5
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/token.js +1 -0
- package/build-module/form-token-field/token.js.map +1 -1
- package/build-module/gradient-picker/index.js +3 -2
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/index.native.js +6 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +31 -29
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/input-control/types.js.map +1 -1
- package/build-module/lock-unlock.js +9 -0
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/mobile/bottom-sheet/index.native.js +9 -1
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/color-settings/palette.screen.native.js +8 -4
- package/build-module/mobile/color-settings/palette.screen.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +25 -13
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/image/constants.js +5 -0
- package/build-module/mobile/image/constants.js.map +1 -0
- package/build-module/mobile/image/index.native.js +25 -16
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js +40 -6
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +46 -68
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +33 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js.map +1 -0
- package/build-module/mobile/keyboard-aware-flat-list/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +21 -27
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-section.native.js.map +1 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll.native.js +86 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll.native.js.map +1 -0
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +294 -0
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -0
- package/build-module/modal/index.js +18 -13
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title.js +1 -1
- package/build-module/navigation/menu/menu-title.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +3 -16
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +16 -70
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/styles.js +47 -0
- package/build-module/navigator/styles.js.map +1 -0
- package/build-module/number-control/index.js +4 -8
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/number-control/types.js.map +1 -1
- package/build-module/palette-edit/index.js +15 -51
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/private-apis.js +10 -23
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +14 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/radio-control/index.js +1 -0
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/range-control/index.js +1 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +15 -25
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/slot-fill/index.js +3 -2
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/slot-fill/types.js.map +1 -1
- package/build-module/snackbar/types.js.map +1 -1
- package/build-module/tabs/styles.js +3 -3
- package/build-module/tabs/styles.js.map +1 -1
- package/build-module/tabs/tabpanel.js +9 -7
- package/build-module/tabs/tabpanel.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +4 -4
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/styles.js +29 -15
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +3 -1
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +9 -8
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/types.js.map +1 -1
- package/build-module/tooltip/index.js +34 -12
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tooltip/types.js.map +1 -1
- package/build-module/truncate/hook.js +10 -4
- package/build-module/truncate/hook.js.map +1 -1
- package/build-module/truncate/types.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/utils/strings.js +32 -2
- package/build-module/utils/strings.js.map +1 -1
- package/build-style/style-rtl.css +29 -5
- package/build-style/style.css +29 -5
- package/build-types/base-control/index.d.ts +3 -27
- package/build-types/base-control/index.d.ts.map +1 -1
- package/build-types/base-control/stories/index.story.d.ts +4 -1
- package/build-types/base-control/stories/index.story.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +4 -4
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +6 -6
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +4 -4
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +4 -4
- package/build-types/border-box-control/stories/index.story.d.ts +1 -1
- package/build-types/border-control/border-control/hook.d.ts +4 -4
- package/build-types/border-control/border-control-dropdown/hook.d.ts +4 -4
- package/build-types/border-control/border-control-style-picker/hook.d.ts +4 -4
- package/build-types/border-control/stories/index.story.d.ts +6 -6
- package/build-types/box-control/stories/index.story.d.ts +42 -42
- package/build-types/box-control/styles/box-control-styles.d.ts +1 -1
- package/build-types/button/deprecated.d.ts +3 -3
- package/build-types/card/card/hook.d.ts +4 -4
- package/build-types/card/card-body/hook.d.ts +4 -4
- package/build-types/card/card-divider/hook.d.ts +4 -4
- package/build-types/card/card-footer/hook.d.ts +4 -4
- package/build-types/card/card-header/hook.d.ts +4 -4
- package/build-types/card/card-media/hook.d.ts +4 -4
- package/build-types/color-palette/styles.d.ts +2 -2
- package/build-types/color-picker/component.d.ts +2 -2
- package/build-types/color-picker/stories/index.story.d.ts +1 -1
- package/build-types/color-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +3 -3
- package/build-types/composite/test/index.d.ts.map +1 -0
- package/build-types/context/wordpress-component.d.ts +3 -3
- package/build-types/context/wordpress-component.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/index.d.ts +3 -2
- package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/index.story.d.ts +4 -3
- package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +3 -3
- package/build-types/date-time/date-time/styles.d.ts +1 -1
- package/build-types/date-time/time/styles.d.ts +4 -4
- package/build-types/dropdown/index.d.ts +1 -1
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/dropdown/stories/index.story.d.ts +3 -3
- package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu/index.d.ts +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/dropdown-menu/stories/index.story.d.ts +2 -2
- package/build-types/dropdown-menu/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/index.d.ts +18 -15
- package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts +7 -2
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/styles.d.ts +77 -23
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/types.d.ts +89 -173
- package/build-types/dropdown-menu-v2/types.d.ts.map +1 -1
- package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +4 -4
- package/build-types/flex/flex/hook.d.ts +4 -4
- package/build-types/flex/flex-block/hook.d.ts +4 -4
- package/build-types/flex/flex-item/hook.d.ts +4 -4
- package/build-types/focal-point-picker/stories/index.story.d.ts +4 -4
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/token.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +4 -4
- package/build-types/h-stack/hook.d.ts +4 -4
- package/build-types/heading/component.d.ts +1 -1
- package/build-types/heading/hook.d.ts +4 -4
- package/build-types/input-control/styles/input-control-styles.d.ts +11 -0
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +1 -1
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/item-group/item/hook.d.ts +4 -4
- package/build-types/item-group/item-group/hook.d.ts +4 -4
- package/build-types/lock-unlock.d.ts +3 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/menu-item/index.d.ts +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +4 -4
- package/build-types/mobile/image/constants.d.ts +5 -0
- package/build-types/mobile/image/constants.d.ts.map +1 -0
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts +3 -3
- package/build-types/navigator/navigator-back-button/hook.d.ts +6 -6
- package/build-types/navigator/navigator-button/hook.d.ts +6 -6
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +1 -7
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/styles.d.ts +9 -0
- package/build-types/navigator/styles.d.ts.map +1 -0
- package/build-types/number-control/index.d.ts +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/stories/index.story.d.ts +1 -1
- package/build-types/number-control/types.d.ts +1 -1
- package/build-types/palette-edit/index.d.ts +3 -8
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/palette-edit/styles.d.ts +3 -3
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
- package/build-types/private-apis.d.ts +0 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/radio-control/index.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +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/stories/index.story.d.ts +2 -2
- package/build-types/scrollable/hook.d.ts +4 -4
- package/build-types/search-control/index.d.ts +1 -1
- package/build-types/search-control/stories/index.story.d.ts +2 -2
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/slot-fill/index.d.ts +1 -1
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/slot-fill/types.d.ts +4 -0
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts +2 -2
- package/build-types/snackbar/stories/index.story.d.ts +0 -3
- package/build-types/snackbar/stories/index.story.d.ts.map +1 -1
- package/build-types/snackbar/types.d.ts +1 -1
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +4 -4
- package/build-types/surface/hook.d.ts +4 -4
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/tabs/tabpanel.d.ts +1 -1
- package/build-types/tabs/tabpanel.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +4 -4
- package/build-types/text-control/index.d.ts +1 -1
- package/build-types/textarea-control/index.d.ts +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts +3 -3
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +5 -4
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -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 +5 -4
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +4 -4
- package/build-types/tools-panel/types.d.ts +9 -0
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/tooltip/stories/index.story.d.ts +10 -1
- package/build-types/tooltip/stories/index.story.d.ts.map +1 -1
- package/build-types/tooltip/types.d.ts +3 -0
- package/build-types/tooltip/types.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +5 -5
- package/build-types/truncate/hook.d.ts.map +1 -1
- package/build-types/truncate/types.d.ts +4 -0
- package/build-types/truncate/types.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +1 -1
- package/build-types/utils/strings.d.ts +14 -2
- package/build-types/utils/strings.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +4 -4
- package/build-types/v-stack/stories/index.story.d.ts +1 -1
- package/package.json +20 -21
- package/src/alignment-matrix-control/test/index.tsx +10 -16
- package/src/base-control/index.tsx +21 -16
- package/src/border-box-control/border-box-control-linked-button/component.tsx +1 -1
- package/src/border-control/border-control-style-picker/component.tsx +1 -1
- package/src/box-control/index.tsx +1 -1
- package/src/box-control/linked-button.tsx +1 -1
- package/src/button/README.md +32 -6
- package/src/button/index.tsx +1 -1
- package/src/button-group/README.md +0 -6
- package/src/card/card/README.md +1 -1
- package/src/checkbox-control/README.md +1 -9
- package/src/color-palette/index.native.js +18 -7
- package/src/color-picker/color-copy-button.tsx +1 -1
- package/src/combobox-control/README.md +0 -6
- package/src/composite/test/index.tsx +576 -0
- package/src/context/wordpress-component.ts +11 -6
- package/src/custom-select-control/README.md +0 -6
- package/src/custom-select-control-v2/index.tsx +13 -12
- package/src/date-time/date/styles.ts +3 -3
- package/src/dropdown-menu/README.md +0 -5
- package/src/dropdown-menu-v2/README.md +75 -136
- package/src/dropdown-menu-v2/index.tsx +321 -231
- package/src/dropdown-menu-v2/stories/index.story.tsx +522 -126
- package/src/dropdown-menu-v2/styles.ts +226 -151
- package/src/dropdown-menu-v2/test/index.tsx +480 -188
- package/src/dropdown-menu-v2/types.ts +98 -184
- package/src/duotone-picker/duotone-picker.tsx +7 -3
- package/src/font-size-picker/index.native.js +8 -2
- package/src/font-size-picker/index.tsx +4 -2
- package/src/form-toggle/README.md +0 -6
- package/src/form-token-field/index.tsx +11 -7
- package/src/form-token-field/test/index.tsx +97 -0
- package/src/form-token-field/token.tsx +1 -0
- package/src/gradient-picker/index.tsx +2 -2
- package/src/index.native.js +6 -1
- package/src/input-control/styles/input-control-styles.tsx +10 -8
- package/src/input-control/types.ts +1 -1
- package/src/lock-unlock.js +10 -0
- package/src/menu-group/README.md +0 -8
- package/src/menu-items-choice/README.md +0 -7
- package/src/mobile/bottom-sheet/index.native.js +15 -1
- package/src/mobile/color-settings/palette.screen.native.js +7 -5
- package/src/mobile/global-styles-context/test/fixtures/theme.native.js +0 -20
- package/src/mobile/global-styles-context/utils.native.js +28 -19
- package/src/mobile/image/constants.js +1 -0
- package/src/mobile/image/index.native.js +55 -18
- package/src/mobile/image/style.native.scss +35 -9
- package/src/mobile/keyboard-aware-flat-list/index.android.js +50 -5
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +65 -91
- package/src/mobile/keyboard-aware-flat-list/test/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +27 -25
- package/src/mobile/keyboard-aware-flat-list/test/use-scroll.native.js +71 -0
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-element.native.js +41 -0
- package/src/mobile/keyboard-aware-flat-list/{use-scroll-to-text-input.native.js → use-scroll-to-section.native.js} +22 -27
- package/src/mobile/keyboard-aware-flat-list/use-scroll.native.js +100 -0
- package/src/mobile/utils/get-px-from-css-unit.native.js +329 -0
- package/src/mobile/utils/test/get-px-from-css-unit.native.js +172 -0
- package/src/modal/README.md +0 -6
- package/src/modal/index.tsx +18 -16
- package/src/modal/test/index.tsx +90 -1
- package/src/navigation/menu/menu-title.tsx +1 -1
- package/src/navigator/navigator-provider/component.tsx +3 -4
- package/src/navigator/navigator-screen/component.tsx +15 -93
- package/src/navigator/styles.ts +71 -0
- package/src/navigator/test/index.tsx +0 -64
- package/src/notice/README.md +0 -6
- package/src/number-control/README.md +2 -2
- package/src/number-control/index.tsx +4 -8
- package/src/number-control/types.ts +1 -1
- package/src/palette-edit/index.tsx +15 -58
- package/src/palette-edit/test/index.tsx +1 -75
- package/src/panel/README.md +0 -6
- package/src/private-apis.native.js +13 -0
- package/src/private-apis.ts +12 -37
- package/src/radio-control/README.md +0 -6
- package/src/radio-control/index.tsx +4 -1
- package/src/radio-control/style.scss +29 -2
- package/src/radio-group/README.md +0 -6
- package/src/range-control/README.md +1 -9
- package/src/range-control/index.tsx +1 -1
- package/src/search-control/README.md +0 -6
- package/src/select-control/README.md +0 -6
- package/src/select-control/styles/select-control-styles.ts +10 -28
- package/src/slot-fill/index.tsx +5 -2
- package/src/slot-fill/types.ts +5 -0
- package/src/snackbar/README.md +0 -6
- package/src/snackbar/stories/index.story.tsx +7 -5
- package/src/snackbar/style.scss +4 -3
- package/src/snackbar/types.ts +2 -1
- package/src/spacer/README.md +0 -2
- package/src/tab-panel/README.md +0 -5
- package/src/tab-panel/test/index.tsx +39 -56
- package/src/tabs/styles.ts +7 -1
- package/src/tabs/tabpanel.tsx +7 -6
- package/src/tabs/test/index.tsx +56 -0
- package/src/text-control/README.md +0 -6
- package/src/textarea-control/README.md +0 -6
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +12 -16
- package/src/toggle-group-control/test/index.tsx +58 -45
- package/src/toggle-group-control/toggle-group-control/component.tsx +5 -4
- package/src/toggle-group-control/toggle-group-control/styles.ts +13 -19
- package/src/toggle-group-control/toggle-group-control-option/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/README.md +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +3 -2
- package/src/toggle-group-control/toggle-group-control-option-icon/README.md +1 -1
- package/src/toolbar/toolbar/README.md +0 -6
- package/src/tools-panel/test/index.tsx +12 -20
- package/src/tools-panel/tools-panel/README.md +7 -0
- package/src/tools-panel/tools-panel/component.tsx +2 -0
- package/src/tools-panel/tools-panel-header/README.md +7 -0
- package/src/tools-panel/tools-panel-header/component.tsx +20 -13
- package/src/tools-panel/types.ts +9 -0
- package/src/tooltip/README.md +4 -0
- package/src/tooltip/index.tsx +48 -10
- package/src/tooltip/stories/index.story.tsx +18 -1
- package/src/tooltip/test/index.tsx +404 -254
- package/src/tooltip/types.ts +4 -0
- package/src/tree-grid/README.md +0 -4
- package/src/truncate/README.md +8 -0
- package/src/truncate/hook.ts +17 -10
- package/src/truncate/test/index.tsx +54 -27
- package/src/truncate/types.ts +4 -0
- package/src/unit-control/index.tsx +1 -1
- package/src/utils/strings.ts +30 -2
- package/src/utils/test/strings.js +96 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dropdown-menu-v2-ariakit/index.js +0 -256
- package/build/dropdown-menu-v2-ariakit/index.js.map +0 -1
- package/build/dropdown-menu-v2-ariakit/styles.js +0 -180
- package/build/dropdown-menu-v2-ariakit/styles.js.map +0 -1
- package/build/dropdown-menu-v2-ariakit/types.js +0 -6
- package/build/dropdown-menu-v2-ariakit/types.js.map +0 -1
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js.map +0 -1
- package/build-module/dropdown-menu-v2-ariakit/index.js +0 -237
- package/build-module/dropdown-menu-v2-ariakit/index.js.map +0 -1
- package/build-module/dropdown-menu-v2-ariakit/styles.js +0 -165
- package/build-module/dropdown-menu-v2-ariakit/styles.js.map +0 -1
- package/build-module/dropdown-menu-v2-ariakit/types.js +0 -2
- package/build-module/dropdown-menu-v2-ariakit/types.js.map +0 -1
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js.map +0 -1
- package/build-types/dropdown-menu-v2-ariakit/index.d.ts +0 -20
- package/build-types/dropdown-menu-v2-ariakit/index.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts +0 -16
- package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2-ariakit/styles.d.ts +0 -96
- package/build-types/dropdown-menu-v2-ariakit/styles.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2-ariakit/test/index.d.ts.map +0 -1
- package/build-types/dropdown-menu-v2-ariakit/types.d.ts +0 -168
- package/build-types/dropdown-menu-v2-ariakit/types.d.ts.map +0 -1
- package/src/dropdown-menu-v2-ariakit/README.md +0 -331
- package/src/dropdown-menu-v2-ariakit/index.tsx +0 -383
- package/src/dropdown-menu-v2-ariakit/stories/index.story.tsx +0 -617
- package/src/dropdown-menu-v2-ariakit/styles.ts +0 -345
- package/src/dropdown-menu-v2-ariakit/test/index.tsx +0 -1108
- package/src/dropdown-menu-v2-ariakit/types.ts +0 -179
- /package/build-types/{dropdown-menu-v2-ariakit → composite}/test/index.d.ts +0 -0
|
@@ -27,15 +27,21 @@ export default function useTruncate(props) {
|
|
|
27
27
|
...otherProps
|
|
28
28
|
} = useContextSystem(props, 'Truncate');
|
|
29
29
|
const cx = useCx();
|
|
30
|
-
|
|
30
|
+
let childrenAsText;
|
|
31
|
+
if (typeof children === 'string') {
|
|
32
|
+
childrenAsText = children;
|
|
33
|
+
} else if (typeof children === 'number') {
|
|
34
|
+
childrenAsText = children.toString();
|
|
35
|
+
}
|
|
36
|
+
const truncatedContent = childrenAsText ? truncateContent(childrenAsText, {
|
|
31
37
|
ellipsis,
|
|
32
38
|
ellipsizeMode,
|
|
33
39
|
limit,
|
|
34
40
|
numberOfLines
|
|
35
|
-
});
|
|
36
|
-
const shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;
|
|
41
|
+
}) : children;
|
|
42
|
+
const shouldTruncate = !!childrenAsText && ellipsizeMode === TRUNCATE_TYPE.auto;
|
|
37
43
|
const classes = useMemo(() => {
|
|
38
|
-
const truncateLines = /*#__PURE__*/css("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + (process.env.NODE_ENV === "production" ? "" : ";label:truncateLines;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
44
|
+
const truncateLines = /*#__PURE__*/css("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + (process.env.NODE_ENV === "production" ? "" : ";label:truncateLines;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUF1RDJCIiwiZmlsZSI6IkB3b3JkcHJlc3MvY29tcG9uZW50cy9zcmMvdHJ1bmNhdGUvaG9vay50cyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogRXh0ZXJuYWwgZGVwZW5kZW5jaWVzXG4gKi9cbmltcG9ydCB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UsXG5cdFx0XHRzaG91bGRUcnVuY2F0ZSAmJiAhISBudW1iZXJPZkxpbmVzICYmIHRydW5jYXRlTGluZXMsXG5cdFx0XHRjbGFzc05hbWVcblx0XHQpO1xuXHR9LCBbIGNsYXNzTmFtZSwgY3gsIG51bWJlck9mTGluZXMsIHNob3VsZFRydW5jYXRlIF0gKTtcblxuXHRyZXR1cm4geyAuLi5vdGhlclByb3BzLCBjbGFzc05hbWU6IGNsYXNzZXMsIGNoaWxkcmVuOiB0cnVuY2F0ZWRDb250ZW50IH07XG59XG4iXX0= */");
|
|
39
45
|
return cx(shouldTruncate && !numberOfLines && styles.Truncate, shouldTruncate && !!numberOfLines && truncateLines, className);
|
|
40
46
|
}, [className, cx, numberOfLines, shouldTruncate]);
|
|
41
47
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["css","useMemo","useContextSystem","styles","TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","truncateContent","useCx","useTruncate","props","className","children","ellipsis","ellipsizeMode","auto","limit","numberOfLines","otherProps","cx","truncatedContent","shouldTruncate","classes","truncateLines","process","env","NODE_ENV","Truncate"],"sources":["@wordpress/components/src/truncate/hook.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem } from '../context';\nimport * as styles from './styles';\nimport { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';\nimport { useCx } from '../utils/hooks/use-cx';\nimport type { TruncateProps } from './types';\n\nexport default function useTruncate(\n\tprops: WordPressComponentProps< TruncateProps, 'span' >\n) {\n\tconst {\n\t\tclassName,\n\t\tchildren,\n\t\tellipsis = TRUNCATE_ELLIPSIS,\n\t\tellipsizeMode = TRUNCATE_TYPE.auto,\n\t\tlimit = 0,\n\t\tnumberOfLines = 0,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Truncate' );\n\n\tconst cx = useCx();\n\n\
|
|
1
|
+
{"version":3,"names":["css","useMemo","useContextSystem","styles","TRUNCATE_ELLIPSIS","TRUNCATE_TYPE","truncateContent","useCx","useTruncate","props","className","children","ellipsis","ellipsizeMode","auto","limit","numberOfLines","otherProps","cx","childrenAsText","toString","truncatedContent","shouldTruncate","classes","truncateLines","process","env","NODE_ENV","Truncate"],"sources":["@wordpress/components/src/truncate/hook.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { useContextSystem } from '../context';\nimport * as styles from './styles';\nimport { TRUNCATE_ELLIPSIS, TRUNCATE_TYPE, truncateContent } from './utils';\nimport { useCx } from '../utils/hooks/use-cx';\nimport type { TruncateProps } from './types';\n\nexport default function useTruncate(\n\tprops: WordPressComponentProps< TruncateProps, 'span' >\n) {\n\tconst {\n\t\tclassName,\n\t\tchildren,\n\t\tellipsis = TRUNCATE_ELLIPSIS,\n\t\tellipsizeMode = TRUNCATE_TYPE.auto,\n\t\tlimit = 0,\n\t\tnumberOfLines = 0,\n\t\t...otherProps\n\t} = useContextSystem( props, 'Truncate' );\n\n\tconst cx = useCx();\n\n\tlet childrenAsText;\n\tif ( typeof children === 'string' ) {\n\t\tchildrenAsText = children;\n\t} else if ( typeof children === 'number' ) {\n\t\tchildrenAsText = children.toString();\n\t}\n\n\tconst truncatedContent = childrenAsText\n\t\t? truncateContent( childrenAsText, {\n\t\t\t\tellipsis,\n\t\t\t\tellipsizeMode,\n\t\t\t\tlimit,\n\t\t\t\tnumberOfLines,\n\t\t } )\n\t\t: children;\n\n\tconst shouldTruncate =\n\t\t!! childrenAsText && ellipsizeMode === TRUNCATE_TYPE.auto;\n\n\tconst classes = useMemo( () => {\n\t\tconst truncateLines = css`\n\t\t\t-webkit-box-orient: vertical;\n\t\t\t-webkit-line-clamp: ${ numberOfLines };\n\t\t\tdisplay: -webkit-box;\n\t\t\toverflow: hidden;\n\t\t`;\n\n\t\treturn cx(\n\t\t\tshouldTruncate && ! numberOfLines && styles.Truncate,\n\t\t\tshouldTruncate && !! numberOfLines && truncateLines,\n\t\t\tclassName\n\t\t);\n\t}, [ className, cx, numberOfLines, shouldTruncate ] );\n\n\treturn { ...otherProps, className: classes, children: truncatedContent };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAG,QAAQ,gBAAgB;;AAEpC;AACA;AACA;AACA,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;;AAEA,SAASC,gBAAgB,QAAQ,YAAY;AAC7C,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,iBAAiB,EAAEC,aAAa,EAAEC,eAAe,QAAQ,SAAS;AAC3E,SAASC,KAAK,QAAQ,uBAAuB;AAG7C,eAAe,SAASC,WAAWA,CAClCC,KAAuD,EACtD;EACD,MAAM;IACLC,SAAS;IACTC,QAAQ;IACRC,QAAQ,GAAGR,iBAAiB;IAC5BS,aAAa,GAAGR,aAAa,CAACS,IAAI;IAClCC,KAAK,GAAG,CAAC;IACTC,aAAa,GAAG,CAAC;IACjB,GAAGC;EACJ,CAAC,GAAGf,gBAAgB,CAAEO,KAAK,EAAE,UAAW,CAAC;EAEzC,MAAMS,EAAE,GAAGX,KAAK,CAAC,CAAC;EAElB,IAAIY,cAAc;EAClB,IAAK,OAAOR,QAAQ,KAAK,QAAQ,EAAG;IACnCQ,cAAc,GAAGR,QAAQ;EAC1B,CAAC,MAAM,IAAK,OAAOA,QAAQ,KAAK,QAAQ,EAAG;IAC1CQ,cAAc,GAAGR,QAAQ,CAACS,QAAQ,CAAC,CAAC;EACrC;EAEA,MAAMC,gBAAgB,GAAGF,cAAc,GACpCb,eAAe,CAAEa,cAAc,EAAE;IACjCP,QAAQ;IACRC,aAAa;IACbE,KAAK;IACLC;EACA,CAAE,CAAC,GACHL,QAAQ;EAEX,MAAMW,cAAc,GACnB,CAAC,CAAEH,cAAc,IAAIN,aAAa,KAAKR,aAAa,CAACS,IAAI;EAE1D,MAAMS,OAAO,GAAGtB,OAAO,CAAE,MAAM;IAC9B,MAAMuB,aAAa,gBAAGxB,GAAG,oDAEDgB,aAAa,6CAAAS,OAAA,CAAAC,GAAA,CAAAC,QAAA,mDAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,2wFAGpC;IAED,OAAOT,EAAE,CACRI,cAAc,IAAI,CAAEN,aAAa,IAAIb,MAAM,CAACyB,QAAQ,EACpDN,cAAc,IAAI,CAAC,CAAEN,aAAa,IAAIQ,aAAa,EACnDd,SACD,CAAC;EACF,CAAC,EAAE,CAAEA,SAAS,EAAEQ,EAAE,EAAEF,aAAa,EAAEM,cAAc,CAAG,CAAC;EAErD,OAAO;IAAE,GAAGL,UAAU;IAAEP,SAAS,EAAEa,OAAO;IAAEZ,QAAQ,EAAEU;EAAiB,CAAC;AACzE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["@wordpress/components/src/truncate/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\nexport type TruncateEllipsizeMode =\n\t| 'auto'\n\t| 'head'\n\t| 'tail'\n\t| 'middle'\n\t| 'none';\n\nexport type TruncateProps = {\n\t/**\n\t * The ellipsis string when truncating the text by the `limit` prop's value.\n\t *\n\t * @default '…'\n\t */\n\tellipsis?: string;\n\t/**\n\t * Determines where to truncate. For example, we can truncate text right in\n\t * the middle. To do this, we need to set `ellipsizeMode` to `middle` and a\n\t * text `limit`.\n\t *\n\t * * `auto`: Trims content at the end automatically without a `limit`.\n\t * * `head`: Trims content at the beginning. Requires a `limit`.\n\t * * `middle`: Trims content in the middle. Requires a `limit`.\n\t * * `tail`: Trims content at the end. Requires a `limit`.\n\t *\n\t * @default 'auto'\n\t */\n\tellipsizeMode?: TruncateEllipsizeMode;\n\t/**\n\t * Determines the max number of characters to be displayed before the rest\n\t * of the text gets truncated. Requires `ellipsizeMode` to assume values\n\t * different from `auto` and `none`.\n\t *\n\t * @default 0\n\t */\n\tlimit?: number;\n\t/**\n\t * Clamps the text content to the specified `numberOfLines`, adding an\n\t * ellipsis at the end. Note: this feature ignores the value of the\n\t * `ellipsis` prop and always displays the default `…` ellipsis.\n\t *\n\t * @default 0\n\t */\n\tnumberOfLines?: number;\n\t/**\n\t * The children elements.\n\t */\n\tchildren: ReactNode;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/components/src/truncate/types.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode } from 'react';\n\nexport type TruncateEllipsizeMode =\n\t| 'auto'\n\t| 'head'\n\t| 'tail'\n\t| 'middle'\n\t| 'none';\n\nexport type TruncateProps = {\n\t/**\n\t * The ellipsis string when truncating the text by the `limit` prop's value.\n\t *\n\t * @default '…'\n\t */\n\tellipsis?: string;\n\t/**\n\t * Determines where to truncate. For example, we can truncate text right in\n\t * the middle. To do this, we need to set `ellipsizeMode` to `middle` and a\n\t * text `limit`.\n\t *\n\t * * `auto`: Trims content at the end automatically without a `limit`.\n\t * * `head`: Trims content at the beginning. Requires a `limit`.\n\t * * `middle`: Trims content in the middle. Requires a `limit`.\n\t * * `tail`: Trims content at the end. Requires a `limit`.\n\t *\n\t * @default 'auto'\n\t */\n\tellipsizeMode?: TruncateEllipsizeMode;\n\t/**\n\t * Determines the max number of characters to be displayed before the rest\n\t * of the text gets truncated. Requires `ellipsizeMode` to assume values\n\t * different from `auto` and `none`.\n\t *\n\t * @default 0\n\t */\n\tlimit?: number;\n\t/**\n\t * Clamps the text content to the specified `numberOfLines`, adding an\n\t * ellipsis at the end. Note: this feature ignores the value of the\n\t * `ellipsis` prop and always displays the default `…` ellipsis.\n\t *\n\t * @default 0\n\t */\n\tnumberOfLines?: number;\n\t/**\n\t * The children elements.\n\t *\n\t * Note: text truncation will be attempted only if the `children` are either\n\t * of type `string` or `number`. In any other scenarios, the component will\n\t * not attempt to truncate the text, and will pass through the `children`.\n\t */\n\tchildren: ReactNode;\n};\n"],"mappings":""}
|
|
@@ -125,7 +125,7 @@ function UnforwardedUnitControl(unitControlProps, forwardedRef) {
|
|
|
125
125
|
disabled: disabled,
|
|
126
126
|
isUnitSelectTabbable: isUnitSelectTabbable,
|
|
127
127
|
onChange: handleOnUnitChange,
|
|
128
|
-
size:
|
|
128
|
+
size: ['small', 'compact'].includes(size) || size === 'default' && !props.__next40pxDefaultSize ? 'small' : 'default',
|
|
129
129
|
unit: unit,
|
|
130
130
|
units: units,
|
|
131
131
|
onFocus: onFocusProp,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","deprecated","forwardRef","useMemo","useRef","useEffect","__","ValueInput","UnitSelectControl","CSS_UNITS","getParsedQuantityAndUnit","getUnitsWithCurrentUnit","getValidParsedQuantityAndUnit","useControlledState","escapeRegExp","useDeprecated36pxDefaultSizeProp","UnforwardedUnitControl","unitControlProps","forwardedRef","__unstableStateReducer","autoComplete","children","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","onChangeProp","onUnitChange","size","unit","unitProp","units","unitsProp","value","valueProp","onFocus","onFocusProp","props","since","hint","version","nonNullValueProp","undefined","reFirstCharacterOfUnits","list","firstUnitValue","rest","firstCharacters","reduce","carry","first","substring","includes","RegExp","parsedQuantity","parsedUnit","setUnit","length","initial","fallback","classes","handleOnQuantityChange","nextQuantityValue","changeProps","onChangeValue","join","handleOnUnitChange","nextUnitValue","data","nextValue","default","handleOnKeyDown","event","onKeyDown","metaKey","test","key","refInputSuffix","current","focus","inputSuffix","createElement","ref","__next40pxDefaultSize","onBlur","step","_activeUnit$step","activeUnit","find","option","spinControls","suffix","type","UnitControl","parseQuantityAndUnitFromRawValue","useCustomUnits"],"sources":["@wordpress/components/src/unit-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { KeyboardEvent, ForwardedRef, SyntheticEvent } from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedQuantityAndUnit,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedQuantityAndUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport { escapeRegExp } from '../utils/strings';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\n\nfunction UnforwardedUnitControl(\n\tunitControlProps: WordPressComponentProps<\n\t\tUnitControlProps,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer,\n\t\tautoComplete = 'off',\n\t\t// @ts-expect-error Ensure that children is omitted from restProps\n\t\tchildren,\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tonUnitChange,\n\t\tsize = 'default',\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\tonFocus: onFocusProp,\n\t\t...props\n\t} = useDeprecated36pxDefaultSizeProp(\n\t\tunitControlProps,\n\t\t'wp.components.UnitControl',\n\t\t'6.4'\n\t);\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst [ units, reFirstCharacterOfUnits ] = useMemo( () => {\n\t\tconst list = getUnitsWithCurrentUnit(\n\t\t\tnonNullValueProp,\n\t\t\tunitProp,\n\t\t\tunitsProp\n\t\t);\n\t\tconst [ { value: firstUnitValue = '' } = {}, ...rest ] = list;\n\t\tconst firstCharacters = rest.reduce(\n\t\t\t( carry, { value } ) => {\n\t\t\t\tconst first = escapeRegExp( value?.substring( 0, 1 ) || '' );\n\t\t\t\treturn carry.includes( first )\n\t\t\t\t\t? carry\n\t\t\t\t\t: `${ carry }|${ first }`;\n\t\t\t},\n\t\t\tescapeRegExp( firstUnitValue.substring( 0, 1 ) )\n\t\t);\n\t\treturn [ list, new RegExp( `^(?:${ firstCharacters })$`, 'i' ) ];\n\t}, [ nonNullValueProp, unitProp, unitsProp ] );\n\tconst [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(\n\t\tnonNullValueProp,\n\t\tunitProp,\n\t\tunits\n\t);\n\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunits.length === 1 ? units[ 0 ].value : unitProp,\n\t\t{\n\t\t\tinitial: parsedUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( parsedUnit !== undefined ) {\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t}, [ parsedUnit, setUnit ] );\n\n\tconst classes = classnames(\n\t\t'components-unit-control',\n\t\t// This class is added for legacy purposes to maintain it on the outer\n\t\t// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139\n\t\t'components-unit-control-wrapper',\n\t\tclassName\n\t);\n\n\tconst handleOnQuantityChange = (\n\t\tnextQuantityValue: number | string | undefined,\n\t\tchangeProps: {\n\t\t\tevent: SyntheticEvent;\n\t\t}\n\t) => {\n\t\tif (\n\t\t\tnextQuantityValue === '' ||\n\t\t\ttypeof nextQuantityValue === 'undefined' ||\n\t\t\tnextQuantityValue === null\n\t\t) {\n\t\t\tonChangeProp?.( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tconst onChangeValue = getValidParsedQuantityAndUnit(\n\t\t\tnextQuantityValue,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t).join( '' );\n\n\t\tonChangeProp?.( onChangeValue, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnextUnitValue,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ nextUnitValue }`;\n\t\t}\n\n\t\tonChangeProp?.( nextValue, changeProps );\n\t\tonUnitChange?.( nextUnitValue, changeProps );\n\n\t\tsetUnit( nextUnitValue );\n\t};\n\n\tlet handleOnKeyDown;\n\tif ( ! disableUnits && isUnitSelectTabbable && units.length ) {\n\t\thandleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\t\tprops.onKeyDown?.( event );\n\t\t\t// Unless the meta key was pressed (to avoid interfering with\n\t\t\t// shortcuts, e.g. pastes), moves focus to the unit select if a key\n\t\t\t// matches the first character of a unit.\n\t\t\tif ( ! event.metaKey && reFirstCharacterOfUnits.test( event.key ) )\n\t\t\t\trefInputSuffix.current?.focus();\n\t\t};\n\t}\n\n\tconst refInputSuffix = useRef< HTMLSelectElement >( null );\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\tref={ refInputSuffix }\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={\n\t\t\t\tsize === 'small' ||\n\t\t\t\t( size === 'default' && ! props.__next40pxDefaultSize )\n\t\t\t\t\t? 'small'\n\t\t\t\t\t: 'default'\n\t\t\t}\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t\tonFocus={ onFocusProp }\n\t\t\tonBlur={ unitControlProps.onBlur }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<ValueInput\n\t\t\t{ ...props }\n\t\t\tautoComplete={ autoComplete }\n\t\t\tclassName={ classes }\n\t\t\tdisabled={ disabled }\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\tlabel={ label }\n\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\tonChange={ handleOnQuantityChange }\n\t\t\tref={ forwardedRef }\n\t\t\tsize={ size }\n\t\t\tsuffix={ inputSuffix }\n\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\tstep={ step }\n\t\t\tonFocus={ onFocusProp }\n\t\t\t__unstableStateReducer={ __unstableStateReducer }\n\t\t/>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).\n *\n *\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nexport const UnitControl = forwardRef( UnforwardedUnitControl );\n\nexport { parseQuantityAndUnitFromRawValue, useCust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A,cAAAA,gBAAA,GAAI,CAAC;EAC7B;EAEA,OACCL,aAAA,CAAC9E,UAAU;IAAA,GACLkC,KAAK;IACVrB,YAAY,EAAGA,YAAc;IAC7BE,SAAS,EAAG0C,OAAS;IACrBzC,QAAQ,EAAGA,QAAU;IACrBuE,YAAY,EAAC,MAAM;IACnBrE,oBAAoB,EAAGA,oBAAsB;IAC7CG,KAAK,EAAGA,KAAO;IACfiD,SAAS,EAAGF,eAAiB;IAC7B9C,QAAQ,EAAGoC,sBAAwB;IACnCqB,GAAG,EAAGpE,YAAc;IACpBc,IAAI,EAAGA,IAAM;IACb+D,MAAM,EAAGX,WAAa;IACtBY,IAAI,EAAGvE,oBAAoB,GAAG,MAAM,GAAG,QAAU;IACjDY,KAAK,EAAGqB,cAAc,aAAdA,cAAc,cAAdA,cAAc,GAAI,EAAI;IAC9B+B,IAAI,EAAGA,IAAM;IACblD,OAAO,EAAGC,WAAa;IACvBrB,sBAAsB,EAAGA;EAAwB,CACjD,CAAC;AAEJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM8E,WAAW,GAAG/F,UAAU,CAAEc,sBAAuB,CAAC;AAE/D,SAASkF,gCAAgC,EAAEC,cAAc,QAAQ,SAAS;AAC1E,eAAeF,WAAW"}
|
|
1
|
+
{"version":3,"names":["classnames","deprecated","forwardRef","useMemo","useRef","useEffect","__","ValueInput","UnitSelectControl","CSS_UNITS","getParsedQuantityAndUnit","getUnitsWithCurrentUnit","getValidParsedQuantityAndUnit","useControlledState","escapeRegExp","useDeprecated36pxDefaultSizeProp","UnforwardedUnitControl","unitControlProps","forwardedRef","__unstableStateReducer","autoComplete","children","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","onChangeProp","onUnitChange","size","unit","unitProp","units","unitsProp","value","valueProp","onFocus","onFocusProp","props","since","hint","version","nonNullValueProp","undefined","reFirstCharacterOfUnits","list","firstUnitValue","rest","firstCharacters","reduce","carry","first","substring","includes","RegExp","parsedQuantity","parsedUnit","setUnit","length","initial","fallback","classes","handleOnQuantityChange","nextQuantityValue","changeProps","onChangeValue","join","handleOnUnitChange","nextUnitValue","data","nextValue","default","handleOnKeyDown","event","onKeyDown","metaKey","test","key","refInputSuffix","current","focus","inputSuffix","createElement","ref","__next40pxDefaultSize","onBlur","step","_activeUnit$step","activeUnit","find","option","spinControls","suffix","type","UnitControl","parseQuantityAndUnitFromRawValue","useCustomUnits"],"sources":["@wordpress/components/src/unit-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { KeyboardEvent, ForwardedRef, SyntheticEvent } from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedQuantityAndUnit,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedQuantityAndUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport { escapeRegExp } from '../utils/strings';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\nimport { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';\n\nfunction UnforwardedUnitControl(\n\tunitControlProps: WordPressComponentProps<\n\t\tUnitControlProps,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer,\n\t\tautoComplete = 'off',\n\t\t// @ts-expect-error Ensure that children is omitted from restProps\n\t\tchildren,\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tonUnitChange,\n\t\tsize = 'default',\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\tonFocus: onFocusProp,\n\t\t...props\n\t} = useDeprecated36pxDefaultSizeProp(\n\t\tunitControlProps,\n\t\t'wp.components.UnitControl',\n\t\t'6.4'\n\t);\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst [ units, reFirstCharacterOfUnits ] = useMemo( () => {\n\t\tconst list = getUnitsWithCurrentUnit(\n\t\t\tnonNullValueProp,\n\t\t\tunitProp,\n\t\t\tunitsProp\n\t\t);\n\t\tconst [ { value: firstUnitValue = '' } = {}, ...rest ] = list;\n\t\tconst firstCharacters = rest.reduce(\n\t\t\t( carry, { value } ) => {\n\t\t\t\tconst first = escapeRegExp( value?.substring( 0, 1 ) || '' );\n\t\t\t\treturn carry.includes( first )\n\t\t\t\t\t? carry\n\t\t\t\t\t: `${ carry }|${ first }`;\n\t\t\t},\n\t\t\tescapeRegExp( firstUnitValue.substring( 0, 1 ) )\n\t\t);\n\t\treturn [ list, new RegExp( `^(?:${ firstCharacters })$`, 'i' ) ];\n\t}, [ nonNullValueProp, unitProp, unitsProp ] );\n\tconst [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(\n\t\tnonNullValueProp,\n\t\tunitProp,\n\t\tunits\n\t);\n\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunits.length === 1 ? units[ 0 ].value : unitProp,\n\t\t{\n\t\t\tinitial: parsedUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( parsedUnit !== undefined ) {\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t}, [ parsedUnit, setUnit ] );\n\n\tconst classes = classnames(\n\t\t'components-unit-control',\n\t\t// This class is added for legacy purposes to maintain it on the outer\n\t\t// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139\n\t\t'components-unit-control-wrapper',\n\t\tclassName\n\t);\n\n\tconst handleOnQuantityChange = (\n\t\tnextQuantityValue: number | string | undefined,\n\t\tchangeProps: {\n\t\t\tevent: SyntheticEvent;\n\t\t}\n\t) => {\n\t\tif (\n\t\t\tnextQuantityValue === '' ||\n\t\t\ttypeof nextQuantityValue === 'undefined' ||\n\t\t\tnextQuantityValue === null\n\t\t) {\n\t\t\tonChangeProp?.( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tconst onChangeValue = getValidParsedQuantityAndUnit(\n\t\t\tnextQuantityValue,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t).join( '' );\n\n\t\tonChangeProp?.( onChangeValue, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnextUnitValue,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ nextUnitValue }`;\n\t\t}\n\n\t\tonChangeProp?.( nextValue, changeProps );\n\t\tonUnitChange?.( nextUnitValue, changeProps );\n\n\t\tsetUnit( nextUnitValue );\n\t};\n\n\tlet handleOnKeyDown;\n\tif ( ! disableUnits && isUnitSelectTabbable && units.length ) {\n\t\thandleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\t\tprops.onKeyDown?.( event );\n\t\t\t// Unless the meta key was pressed (to avoid interfering with\n\t\t\t// shortcuts, e.g. pastes), moves focus to the unit select if a key\n\t\t\t// matches the first character of a unit.\n\t\t\tif ( ! event.metaKey && reFirstCharacterOfUnits.test( event.key ) )\n\t\t\t\trefInputSuffix.current?.focus();\n\t\t};\n\t}\n\n\tconst refInputSuffix = useRef< HTMLSelectElement >( null );\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\tref={ refInputSuffix }\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={\n\t\t\t\t[ 'small', 'compact' ].includes( size ) ||\n\t\t\t\t( size === 'default' && ! props.__next40pxDefaultSize )\n\t\t\t\t\t? 'small'\n\t\t\t\t\t: 'default'\n\t\t\t}\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t\tonFocus={ onFocusProp }\n\t\t\tonBlur={ unitControlProps.onBlur }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<ValueInput\n\t\t\t{ ...props }\n\t\t\tautoComplete={ autoComplete }\n\t\t\tclassName={ classes }\n\t\t\tdisabled={ disabled }\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\tlabel={ label }\n\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\tonChange={ handleOnQuantityChange }\n\t\t\tref={ forwardedRef }\n\t\t\tsize={ size }\n\t\t\tsuffix={ inputSuffix }\n\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\tstep={ step }\n\t\t\tonFocus={ onFocusProp }\n\t\t\t__unstableStateReducer={ __unstableStateReducer }\n\t\t/>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).\n *\n *\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nexport const UnitControl = forwardRef( UnforwardedUnitControl );\n\nexport { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';\nexport default UnitControl;\n"],"mappings":";AAAA;AACA;AACA;;AAEA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,SAASC,UAAU,EAAEC,OAAO,EAAEC,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AAC3E,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;;AAEA,SAASC,UAAU,QAAQ,8BAA8B;AACzD,OAAOC,iBAAiB,MAAM,uBAAuB;AACrD,SACCC,SAAS,EACTC,wBAAwB,EACxBC,uBAAuB,EACvBC,6BAA6B,QACvB,SAAS;AAChB,SAASC,kBAAkB,QAAQ,gBAAgB;AACnD,SAASC,YAAY,QAAQ,kBAAkB;AAE/C,SAASC,gCAAgC,QAAQ,+BAA+B;AAEhF,SAASC,sBAAsBA,CAC9BC,gBAIC,EACDC,YAAiC,EAChC;EACD,MAAM;IACLC,sBAAsB;IACtBC,YAAY,GAAG,KAAK;IACpB;IACAC,QAAQ;IACRC,SAAS;IACTC,QAAQ,GAAG,KAAK;IAChBC,YAAY,GAAG,KAAK;IACpBC,oBAAoB,GAAG,KAAK;IAC5BC,wBAAwB,GAAG,KAAK;IAChCC,oBAAoB,GAAG,IAAI;IAC3BC,KAAK;IACLC,QAAQ,EAA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gCAAgC,EAAEC,cAAc,QAAQ,SAAS;AAC1E,eAAeF,WAAW"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import removeAccents from 'remove-accents';
|
|
5
|
+
import { paramCase } from 'change-case';
|
|
5
6
|
const ALL_UNICODE_DASH_CHARACTERS = new RegExp(`[${[
|
|
6
7
|
// - (hyphen-minus)
|
|
7
8
|
'\u002d',
|
|
@@ -63,12 +64,41 @@ export const normalizeTextString = value => {
|
|
|
63
64
|
return removeAccents(value).toLocaleLowerCase().replace(ALL_UNICODE_DASH_CHARACTERS, '-');
|
|
64
65
|
};
|
|
65
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Converts any string to kebab case.
|
|
69
|
+
* Backwards compatible with Lodash's `_.kebabCase()`.
|
|
70
|
+
* Backwards compatible with `_wp_to_kebab_case()`.
|
|
71
|
+
*
|
|
72
|
+
* @see https://lodash.com/docs/4.17.15#kebabCase
|
|
73
|
+
* @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/
|
|
74
|
+
*
|
|
75
|
+
* @param str String to convert.
|
|
76
|
+
* @return Kebab-cased string
|
|
77
|
+
*/
|
|
78
|
+
export function kebabCase(str) {
|
|
79
|
+
var _str$toString;
|
|
80
|
+
let input = (_str$toString = str?.toString?.()) !== null && _str$toString !== void 0 ? _str$toString : '';
|
|
81
|
+
|
|
82
|
+
// See https://github.com/lodash/lodash/blob/b185fcee26b2133bd071f4aaca14b455c2ed1008/lodash.js#L4970
|
|
83
|
+
input = input.replace(/['\u2019]/, '');
|
|
84
|
+
return paramCase(input, {
|
|
85
|
+
splitRegexp: [/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g,
|
|
86
|
+
// fooBar => foo-bar, 3Bar => 3-bar
|
|
87
|
+
/(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g,
|
|
88
|
+
// 3bar => 3-bar
|
|
89
|
+
/([A-Za-z])([0-9])/g,
|
|
90
|
+
// Foo3 => foo-3, foo3 => foo-3
|
|
91
|
+
/([A-Z])([A-Z][a-z])/g // FOOBar => foo-bar
|
|
92
|
+
]
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
66
96
|
/**
|
|
67
97
|
* Escapes the RegExp special characters.
|
|
68
98
|
*
|
|
69
|
-
* @param
|
|
99
|
+
* @param string Input string.
|
|
70
100
|
*
|
|
71
|
-
* @return
|
|
101
|
+
* @return Regex-escaped string.
|
|
72
102
|
*/
|
|
73
103
|
export function escapeRegExp(string) {
|
|
74
104
|
return string.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["removeAccents","ALL_UNICODE_DASH_CHARACTERS","RegExp","join","normalizeTextString","value","toLocaleLowerCase","replace","escapeRegExp","string"],"sources":["@wordpress/components/src/utils/strings.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\n\nconst ALL_UNICODE_DASH_CHARACTERS = new RegExp(\n\t`[${ [\n\t\t// - (hyphen-minus)\n\t\t'\\u002d',\n\t\t// ~ (tilde)\n\t\t'\\u007e',\n\t\t// (soft hyphen)\n\t\t'\\u00ad',\n\t\t// ֊ (armenian hyphen)\n\t\t'\\u058a',\n\t\t// ־ (hebrew punctuation maqaf)\n\t\t'\\u05be',\n\t\t// ᐀ (canadian syllabics hyphen)\n\t\t'\\u1400',\n\t\t// ᠆ (mongolian todo soft hyphen)\n\t\t'\\u1806',\n\t\t// ‐ (hyphen)\n\t\t'\\u2010',\n\t\t// non-breaking hyphen)\n\t\t'\\u2011',\n\t\t// ‒ (figure dash)\n\t\t'\\u2012',\n\t\t// – (en dash)\n\t\t'\\u2013',\n\t\t// — (em dash)\n\t\t'\\u2014',\n\t\t// ― (horizontal bar)\n\t\t'\\u2015',\n\t\t// ⁓ (swung dash)\n\t\t'\\u2053',\n\t\t// superscript minus)\n\t\t'\\u207b',\n\t\t// subscript minus)\n\t\t'\\u208b',\n\t\t// − (minus sign)\n\t\t'\\u2212',\n\t\t// ⸗ (double oblique hyphen)\n\t\t'\\u2e17',\n\t\t// ⸺ (two-em dash)\n\t\t'\\u2e3a',\n\t\t// ⸻ (three-em dash)\n\t\t'\\u2e3b',\n\t\t// 〜 (wave dash)\n\t\t'\\u301c',\n\t\t// 〰 (wavy dash)\n\t\t'\\u3030',\n\t\t// ゠ (katakana-hiragana double hyphen)\n\t\t'\\u30a0',\n\t\t// ︱ (presentation form for vertical em dash)\n\t\t'\\ufe31',\n\t\t// ︲ (presentation form for vertical en dash)\n\t\t'\\ufe32',\n\t\t// ﹘ (small em dash)\n\t\t'\\ufe58',\n\t\t// ﹣ (small hyphen-minus)\n\t\t'\\ufe63',\n\t\t// - (fullwidth hyphen-minus)\n\t\t'\\uff0d',\n\t].join( '' ) }]`,\n\t'g'\n);\n\nexport const normalizeTextString = ( value: string ): string => {\n\treturn removeAccents( value )\n\t\t.toLocaleLowerCase()\n\t\t.replace( ALL_UNICODE_DASH_CHARACTERS, '-' );\n};\n\n/**\n * Escapes the RegExp special characters.\n *\n * @param
|
|
1
|
+
{"version":3,"names":["removeAccents","paramCase","ALL_UNICODE_DASH_CHARACTERS","RegExp","join","normalizeTextString","value","toLocaleLowerCase","replace","kebabCase","str","_str$toString","input","toString","splitRegexp","escapeRegExp","string"],"sources":["@wordpress/components/src/utils/strings.ts"],"sourcesContent":["/**\n * External dependencies\n */\nimport removeAccents from 'remove-accents';\nimport { paramCase } from 'change-case';\n\nconst ALL_UNICODE_DASH_CHARACTERS = new RegExp(\n\t`[${ [\n\t\t// - (hyphen-minus)\n\t\t'\\u002d',\n\t\t// ~ (tilde)\n\t\t'\\u007e',\n\t\t// (soft hyphen)\n\t\t'\\u00ad',\n\t\t// ֊ (armenian hyphen)\n\t\t'\\u058a',\n\t\t// ־ (hebrew punctuation maqaf)\n\t\t'\\u05be',\n\t\t// ᐀ (canadian syllabics hyphen)\n\t\t'\\u1400',\n\t\t// ᠆ (mongolian todo soft hyphen)\n\t\t'\\u1806',\n\t\t// ‐ (hyphen)\n\t\t'\\u2010',\n\t\t// non-breaking hyphen)\n\t\t'\\u2011',\n\t\t// ‒ (figure dash)\n\t\t'\\u2012',\n\t\t// – (en dash)\n\t\t'\\u2013',\n\t\t// — (em dash)\n\t\t'\\u2014',\n\t\t// ― (horizontal bar)\n\t\t'\\u2015',\n\t\t// ⁓ (swung dash)\n\t\t'\\u2053',\n\t\t// superscript minus)\n\t\t'\\u207b',\n\t\t// subscript minus)\n\t\t'\\u208b',\n\t\t// − (minus sign)\n\t\t'\\u2212',\n\t\t// ⸗ (double oblique hyphen)\n\t\t'\\u2e17',\n\t\t// ⸺ (two-em dash)\n\t\t'\\u2e3a',\n\t\t// ⸻ (three-em dash)\n\t\t'\\u2e3b',\n\t\t// 〜 (wave dash)\n\t\t'\\u301c',\n\t\t// 〰 (wavy dash)\n\t\t'\\u3030',\n\t\t// ゠ (katakana-hiragana double hyphen)\n\t\t'\\u30a0',\n\t\t// ︱ (presentation form for vertical em dash)\n\t\t'\\ufe31',\n\t\t// ︲ (presentation form for vertical en dash)\n\t\t'\\ufe32',\n\t\t// ﹘ (small em dash)\n\t\t'\\ufe58',\n\t\t// ﹣ (small hyphen-minus)\n\t\t'\\ufe63',\n\t\t// - (fullwidth hyphen-minus)\n\t\t'\\uff0d',\n\t].join( '' ) }]`,\n\t'g'\n);\n\nexport const normalizeTextString = ( value: string ): string => {\n\treturn removeAccents( value )\n\t\t.toLocaleLowerCase()\n\t\t.replace( ALL_UNICODE_DASH_CHARACTERS, '-' );\n};\n\n/**\n * Converts any string to kebab case.\n * Backwards compatible with Lodash's `_.kebabCase()`.\n * Backwards compatible with `_wp_to_kebab_case()`.\n *\n * @see https://lodash.com/docs/4.17.15#kebabCase\n * @see https://developer.wordpress.org/reference/functions/_wp_to_kebab_case/\n *\n * @param str String to convert.\n * @return Kebab-cased string\n */\nexport function kebabCase( str: unknown ) {\n\tlet input = str?.toString?.() ?? '';\n\n\t// See https://github.com/lodash/lodash/blob/b185fcee26b2133bd071f4aaca14b455c2ed1008/lodash.js#L4970\n\tinput = input.replace( /['\\u2019]/, '' );\n\n\treturn paramCase( input, {\n\t\tsplitRegexp: [\n\t\t\t/(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g, // fooBar => foo-bar, 3Bar => 3-bar\n\t\t\t/(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g, // 3bar => 3-bar\n\t\t\t/([A-Za-z])([0-9])/g, // Foo3 => foo-3, foo3 => foo-3\n\t\t\t/([A-Z])([A-Z][a-z])/g, // FOOBar => foo-bar\n\t\t],\n\t} );\n}\n\n/**\n * Escapes the RegExp special characters.\n *\n * @param string Input string.\n *\n * @return Regex-escaped string.\n */\nexport function escapeRegExp( string: string ): string {\n\treturn string.replace( /[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&' );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,gBAAgB;AAC1C,SAASC,SAAS,QAAQ,aAAa;AAEvC,MAAMC,2BAA2B,GAAG,IAAIC,MAAM,CAC5C,IAAI;AACJ;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA,QAAQ,CACR,CAACC,IAAI,CAAE,EAAG,CAAG,GAAE,EAChB,GACD,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAAKC,KAAa,IAAc;EAC/D,OAAON,aAAa,CAAEM,KAAM,CAAC,CAC3BC,iBAAiB,CAAC,CAAC,CACnBC,OAAO,CAAEN,2BAA2B,EAAE,GAAI,CAAC;AAC9C,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASO,SAASA,CAAEC,GAAY,EAAG;EAAA,IAAAC,aAAA;EACzC,IAAIC,KAAK,IAAAD,aAAA,GAAGD,GAAG,EAAEG,QAAQ,GAAG,CAAC,cAAAF,aAAA,cAAAA,aAAA,GAAI,EAAE;;EAEnC;EACAC,KAAK,GAAGA,KAAK,CAACJ,OAAO,CAAE,WAAW,EAAE,EAAG,CAAC;EAExC,OAAOP,SAAS,CAAEW,KAAK,EAAE;IACxBE,WAAW,EAAE,CACZ,wDAAwD;IAAE;IAC1D,qDAAqD;IAAE;IACvD,oBAAoB;IAAE;IACtB,sBAAsB,CAAE;IAAA;EAE1B,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,MAAc,EAAW;EACtD,OAAOA,MAAM,CAACR,OAAO,CAAE,qBAAqB,EAAE,MAAO,CAAC;AACvD"}
|
|
@@ -2582,6 +2582,11 @@ body.rtl .components-panel__body-toggle.components-button .dashicons-arrow-right
|
|
|
2582
2582
|
background-color: transparent;
|
|
2583
2583
|
}
|
|
2584
2584
|
|
|
2585
|
+
.components-radio-control__option {
|
|
2586
|
+
display: flex;
|
|
2587
|
+
align-items: center;
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2585
2590
|
.components-radio-control__input[type=radio] {
|
|
2586
2591
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
2587
2592
|
padding: 6px 8px;
|
|
@@ -2599,8 +2604,11 @@ body.rtl .components-panel__body-toggle.components-button .dashicons-arrow-right
|
|
|
2599
2604
|
border-radius: 50%;
|
|
2600
2605
|
width: 24px;
|
|
2601
2606
|
height: 24px;
|
|
2602
|
-
|
|
2603
|
-
margin
|
|
2607
|
+
display: inline-flex;
|
|
2608
|
+
margin: 0 0 0 6px;
|
|
2609
|
+
padding: 0;
|
|
2610
|
+
appearance: none;
|
|
2611
|
+
cursor: pointer;
|
|
2604
2612
|
}
|
|
2605
2613
|
@media (prefers-reduced-motion: reduce) {
|
|
2606
2614
|
.components-radio-control__input[type=radio] {
|
|
@@ -2658,6 +2666,21 @@ body.rtl .components-panel__body-toggle.components-button .dashicons-arrow-right
|
|
|
2658
2666
|
background: var(--wp-admin-theme-color);
|
|
2659
2667
|
border-color: var(--wp-admin-theme-color);
|
|
2660
2668
|
}
|
|
2669
|
+
.components-radio-control__input[type=radio]:focus {
|
|
2670
|
+
box-shadow: 0 0 0 2px var(--wp-components-color-background, #fff), 0 0 0 4px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
2671
|
+
}
|
|
2672
|
+
.components-radio-control__input[type=radio]:checked {
|
|
2673
|
+
background: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
2674
|
+
border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
2675
|
+
}
|
|
2676
|
+
.components-radio-control__input[type=radio]:checked::before {
|
|
2677
|
+
content: "";
|
|
2678
|
+
border-radius: 50%;
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
.components-radio-control__label {
|
|
2682
|
+
cursor: pointer;
|
|
2683
|
+
}
|
|
2661
2684
|
|
|
2662
2685
|
.components-resizable-box__handle {
|
|
2663
2686
|
display: none;
|
|
@@ -2987,12 +3010,13 @@ body.lockscroll {
|
|
|
2987
3010
|
cursor: default;
|
|
2988
3011
|
}
|
|
2989
3012
|
.components-snackbar .components-snackbar__content-with-icon {
|
|
2990
|
-
|
|
3013
|
+
position: relative;
|
|
3014
|
+
padding-right: 24px;
|
|
2991
3015
|
}
|
|
2992
3016
|
.components-snackbar .components-snackbar__icon {
|
|
2993
3017
|
position: absolute;
|
|
2994
|
-
|
|
2995
|
-
|
|
3018
|
+
right: -8px;
|
|
3019
|
+
top: calc((5.8px) / -2);
|
|
2996
3020
|
}
|
|
2997
3021
|
.components-snackbar .components-snackbar__dismiss-button {
|
|
2998
3022
|
margin-right: 24px;
|
package/build-style/style.css
CHANGED
|
@@ -2591,6 +2591,11 @@ body.rtl .components-panel__body-toggle.components-button .dashicons-arrow-right
|
|
|
2591
2591
|
background-color: transparent;
|
|
2592
2592
|
}
|
|
2593
2593
|
|
|
2594
|
+
.components-radio-control__option {
|
|
2595
|
+
display: flex;
|
|
2596
|
+
align-items: center;
|
|
2597
|
+
}
|
|
2598
|
+
|
|
2594
2599
|
.components-radio-control__input[type=radio] {
|
|
2595
2600
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
2596
2601
|
padding: 6px 8px;
|
|
@@ -2608,8 +2613,11 @@ body.rtl .components-panel__body-toggle.components-button .dashicons-arrow-right
|
|
|
2608
2613
|
border-radius: 50%;
|
|
2609
2614
|
width: 24px;
|
|
2610
2615
|
height: 24px;
|
|
2611
|
-
|
|
2612
|
-
margin
|
|
2616
|
+
display: inline-flex;
|
|
2617
|
+
margin: 0 6px 0 0;
|
|
2618
|
+
padding: 0;
|
|
2619
|
+
appearance: none;
|
|
2620
|
+
cursor: pointer;
|
|
2613
2621
|
}
|
|
2614
2622
|
@media (prefers-reduced-motion: reduce) {
|
|
2615
2623
|
.components-radio-control__input[type=radio] {
|
|
@@ -2667,6 +2675,21 @@ body.rtl .components-panel__body-toggle.components-button .dashicons-arrow-right
|
|
|
2667
2675
|
background: var(--wp-admin-theme-color);
|
|
2668
2676
|
border-color: var(--wp-admin-theme-color);
|
|
2669
2677
|
}
|
|
2678
|
+
.components-radio-control__input[type=radio]:focus {
|
|
2679
|
+
box-shadow: 0 0 0 2px var(--wp-components-color-background, #fff), 0 0 0 4px var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
2680
|
+
}
|
|
2681
|
+
.components-radio-control__input[type=radio]:checked {
|
|
2682
|
+
background: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
2683
|
+
border-color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
2684
|
+
}
|
|
2685
|
+
.components-radio-control__input[type=radio]:checked::before {
|
|
2686
|
+
content: "";
|
|
2687
|
+
border-radius: 50%;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
.components-radio-control__label {
|
|
2691
|
+
cursor: pointer;
|
|
2692
|
+
}
|
|
2670
2693
|
|
|
2671
2694
|
.components-resizable-box__handle {
|
|
2672
2695
|
display: none;
|
|
@@ -2999,12 +3022,13 @@ body.lockscroll {
|
|
|
2999
3022
|
cursor: default;
|
|
3000
3023
|
}
|
|
3001
3024
|
.components-snackbar .components-snackbar__content-with-icon {
|
|
3002
|
-
|
|
3025
|
+
position: relative;
|
|
3026
|
+
padding-left: 24px;
|
|
3003
3027
|
}
|
|
3004
3028
|
.components-snackbar .components-snackbar__icon {
|
|
3005
3029
|
position: absolute;
|
|
3006
|
-
|
|
3007
|
-
|
|
3030
|
+
left: -8px;
|
|
3031
|
+
top: calc((5.8px) / -2);
|
|
3008
3032
|
}
|
|
3009
3033
|
.components-snackbar .components-snackbar__dismiss-button {
|
|
3010
3034
|
margin-left: 24px;
|
|
@@ -2,33 +2,6 @@
|
|
|
2
2
|
import type { BaseControlProps, BaseControlVisualLabelProps } from './types';
|
|
3
3
|
import type { WordPressComponentProps } from '../context';
|
|
4
4
|
export { useBaseControlProps } from './hooks';
|
|
5
|
-
/**
|
|
6
|
-
* `BaseControl` is a component used to generate labels and help text for components handling user inputs.
|
|
7
|
-
*
|
|
8
|
-
* ```jsx
|
|
9
|
-
* import { BaseControl, useBaseControlProps } from '@wordpress/components';
|
|
10
|
-
*
|
|
11
|
-
* // Render a `BaseControl` for a textarea input
|
|
12
|
-
* const MyCustomTextareaControl = ({ children, ...baseProps }) => (
|
|
13
|
-
* // `useBaseControlProps` is a convenience hook to get the props for the `BaseControl`
|
|
14
|
-
* // and the inner control itself. Namely, it takes care of generating a unique `id`,
|
|
15
|
-
* // properly associating it with the `label` and `help` elements.
|
|
16
|
-
* const { baseControlProps, controlProps } = useBaseControlProps( baseProps );
|
|
17
|
-
*
|
|
18
|
-
* return (
|
|
19
|
-
* <BaseControl { ...baseControlProps } __nextHasNoMarginBottom={ true }>
|
|
20
|
-
* <textarea { ...controlProps }>
|
|
21
|
-
* { children }
|
|
22
|
-
* </textarea>
|
|
23
|
-
* </BaseControl>
|
|
24
|
-
* );
|
|
25
|
-
* );
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare const BaseControl: {
|
|
29
|
-
({ __nextHasNoMarginBottom, id, label, hideLabelFromVision, help, className, children, }: BaseControlProps): JSX.Element;
|
|
30
|
-
VisualLabel: ({ className, children, ...props }: WordPressComponentProps<BaseControlVisualLabelProps, 'span'>) => JSX.Element;
|
|
31
|
-
};
|
|
32
5
|
/**
|
|
33
6
|
* `BaseControl.VisualLabel` is used to render a purely visual label inside a `BaseControl` component.
|
|
34
7
|
*
|
|
@@ -47,5 +20,8 @@ export declare const BaseControl: {
|
|
|
47
20
|
* );
|
|
48
21
|
*/
|
|
49
22
|
export declare const VisualLabel: ({ className, children, ...props }: WordPressComponentProps<BaseControlVisualLabelProps, 'span'>) => JSX.Element;
|
|
23
|
+
export declare const BaseControl: import("../context").WordPressComponent<null, BaseControlProps, true> & {
|
|
24
|
+
VisualLabel: ({ className, children, ...props }: WordPressComponentProps<BaseControlVisualLabelProps, 'span'>) => JSX.Element;
|
|
25
|
+
};
|
|
50
26
|
export default BaseControl;
|
|
51
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base-control/index.tsx"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAQ7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base-control/index.tsx"],"names":[],"mappings":";AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAQ7E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAG1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAiF9C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,sCAIrB,wBAAyB,2BAA2B,EAAE,MAAM,CAAE,gBAYhE,CAAC;AAEF,eAAO,MAAM,WAAW;qDAdrB,wBAAyB,2BAA2B,EAAE,MAAM,CAAE;CAiBhE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
/**
|
|
2
3
|
* External dependencies
|
|
3
4
|
*/
|
|
@@ -9,7 +10,9 @@ import BaseControl from '..';
|
|
|
9
10
|
declare const meta: Meta<typeof BaseControl>;
|
|
10
11
|
export default meta;
|
|
11
12
|
export declare const Default: StoryFn<typeof BaseControl>;
|
|
12
|
-
export declare const WithHelpText: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("../types").BaseControlProps
|
|
13
|
+
export declare const WithHelpText: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, import("../types").BaseControlProps & {
|
|
14
|
+
as?: keyof JSX.IntrinsicElements | null | undefined;
|
|
15
|
+
}>;
|
|
13
16
|
/**
|
|
14
17
|
* `BaseControl.VisualLabel` is used to render a purely visual label inside a `BaseControl` component.
|
|
15
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/base-control/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,OAAO,WAAoC,MAAM,IAAI,CAAC;AAGtD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,WAAW,CAYnC,CAAC;AACF,eAAe,IAAI,CAAC;AAYpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,WAAW,CACd,CAAC;AAMpC,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/base-control/stories/index.story.tsx"],"names":[],"mappings":";AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,OAAO,WAAoC,MAAM,IAAI,CAAC;AAGtD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,WAAW,CAYnC,CAAC;AACF,eAAe,IAAI,CAAC;AAYpB,eAAO,MAAM,OAAO,EAAE,OAAO,CAAE,OAAO,WAAW,CACd,CAAC;AAMpC,eAAO,MAAM,YAAY;;EAAqC,CAAC;AAM/D;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,OAAO,CAAE,OAAO,WAAW,CAYxD,CAAC"}
|
|
@@ -37,14 +37,14 @@ export declare function useBorderBoxControl(props: WordPressComponentProps<Borde
|
|
|
37
37
|
tabIndex?: number | undefined;
|
|
38
38
|
'aria-activedescendant'?: string | undefined;
|
|
39
39
|
'aria-atomic'?: (boolean | "false" | "true") | undefined;
|
|
40
|
-
'aria-autocomplete'?: "inline" | "none" | "
|
|
40
|
+
'aria-autocomplete'?: "inline" | "none" | "both" | "list" | undefined;
|
|
41
41
|
'aria-busy'?: (boolean | "false" | "true") | undefined;
|
|
42
42
|
'aria-checked'?: boolean | "mixed" | "false" | "true" | undefined;
|
|
43
43
|
'aria-colcount'?: number | undefined;
|
|
44
44
|
'aria-colindex'?: number | undefined;
|
|
45
45
|
'aria-colspan'?: number | undefined;
|
|
46
46
|
'aria-controls'?: string | undefined;
|
|
47
|
-
'aria-current'?: boolean | "time" | "page" | "
|
|
47
|
+
'aria-current'?: boolean | "time" | "page" | "false" | "true" | "step" | "location" | "date" | undefined;
|
|
48
48
|
'aria-describedby'?: string | undefined;
|
|
49
49
|
'aria-details'?: string | undefined;
|
|
50
50
|
'aria-disabled'?: (boolean | "false" | "true") | undefined;
|
|
@@ -245,9 +245,9 @@ export declare function useBorderBoxControl(props: WordPressComponentProps<Borde
|
|
|
245
245
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
246
246
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
247
247
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
248
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
248
249
|
key?: import("react").Key | null | undefined;
|
|
249
250
|
defaultChecked?: boolean | undefined;
|
|
250
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
251
251
|
suppressContentEditableWarning?: boolean | undefined;
|
|
252
252
|
suppressHydrationWarning?: boolean | undefined;
|
|
253
253
|
accessKey?: string | undefined;
|
|
@@ -275,7 +275,7 @@ export declare function useBorderBoxControl(props: WordPressComponentProps<Borde
|
|
|
275
275
|
itemRef?: string | undefined;
|
|
276
276
|
results?: number | undefined;
|
|
277
277
|
security?: string | undefined;
|
|
278
|
-
unselectable?: "
|
|
278
|
+
unselectable?: "off" | "on" | undefined;
|
|
279
279
|
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
280
280
|
is?: string | undefined;
|
|
281
281
|
as?: keyof JSX.IntrinsicElements | undefined;
|
|
@@ -21,14 +21,14 @@ export declare function useBorderBoxControlLinkedButton(props: WordPressComponen
|
|
|
21
21
|
tabIndex?: number | undefined;
|
|
22
22
|
'aria-activedescendant'?: string | undefined;
|
|
23
23
|
'aria-atomic'?: (boolean | "false" | "true") | undefined;
|
|
24
|
-
'aria-autocomplete'?: "inline" | "none" | "
|
|
24
|
+
'aria-autocomplete'?: "inline" | "none" | "both" | "list" | undefined;
|
|
25
25
|
'aria-busy'?: (boolean | "false" | "true") | undefined;
|
|
26
26
|
'aria-checked'?: boolean | "mixed" | "false" | "true" | undefined;
|
|
27
27
|
'aria-colcount'?: number | undefined;
|
|
28
28
|
'aria-colindex'?: number | undefined;
|
|
29
29
|
'aria-colspan'?: number | undefined;
|
|
30
30
|
'aria-controls'?: string | undefined;
|
|
31
|
-
'aria-current'?: boolean | "time" | "page" | "
|
|
31
|
+
'aria-current'?: boolean | "time" | "page" | "false" | "true" | "step" | "location" | "date" | undefined;
|
|
32
32
|
'aria-describedby'?: string | undefined;
|
|
33
33
|
'aria-details'?: string | undefined;
|
|
34
34
|
'aria-disabled'?: (boolean | "false" | "true") | undefined;
|
|
@@ -229,11 +229,11 @@ export declare function useBorderBoxControlLinkedButton(props: WordPressComponen
|
|
|
229
229
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLButtonElement> | undefined;
|
|
230
230
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
231
231
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLButtonElement> | undefined;
|
|
232
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
233
|
+
value?: string | number | readonly string[] | undefined;
|
|
232
234
|
disabled?: boolean | undefined;
|
|
233
|
-
autoFocus?: boolean | undefined;
|
|
234
235
|
key?: import("react").Key | null | undefined;
|
|
235
236
|
defaultChecked?: boolean | undefined;
|
|
236
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
237
237
|
suppressContentEditableWarning?: boolean | undefined;
|
|
238
238
|
suppressHydrationWarning?: boolean | undefined;
|
|
239
239
|
accessKey?: string | undefined;
|
|
@@ -261,15 +261,15 @@ export declare function useBorderBoxControlLinkedButton(props: WordPressComponen
|
|
|
261
261
|
itemRef?: string | undefined;
|
|
262
262
|
results?: number | undefined;
|
|
263
263
|
security?: string | undefined;
|
|
264
|
-
unselectable?: "
|
|
264
|
+
unselectable?: "off" | "on" | undefined;
|
|
265
265
|
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
266
266
|
is?: string | undefined;
|
|
267
|
+
autoFocus?: boolean | undefined;
|
|
267
268
|
formAction?: string | undefined;
|
|
268
269
|
formEncType?: string | undefined;
|
|
269
270
|
formMethod?: string | undefined;
|
|
270
271
|
formNoValidate?: boolean | undefined;
|
|
271
272
|
formTarget?: string | undefined;
|
|
272
|
-
value?: string | number | readonly string[] | undefined;
|
|
273
273
|
as?: keyof JSX.IntrinsicElements | undefined;
|
|
274
274
|
};
|
|
275
275
|
//# sourceMappingURL=hook.d.ts.map
|
|
@@ -28,14 +28,14 @@ export declare function useBorderBoxControlSplitControls(props: WordPressCompone
|
|
|
28
28
|
tabIndex?: number | undefined;
|
|
29
29
|
'aria-activedescendant'?: string | undefined;
|
|
30
30
|
'aria-atomic'?: (boolean | "false" | "true") | undefined;
|
|
31
|
-
'aria-autocomplete'?: "inline" | "none" | "
|
|
31
|
+
'aria-autocomplete'?: "inline" | "none" | "both" | "list" | undefined;
|
|
32
32
|
'aria-busy'?: (boolean | "false" | "true") | undefined;
|
|
33
33
|
'aria-checked'?: boolean | "mixed" | "false" | "true" | undefined;
|
|
34
34
|
'aria-colcount'?: number | undefined;
|
|
35
35
|
'aria-colindex'?: number | undefined;
|
|
36
36
|
'aria-colspan'?: number | undefined;
|
|
37
37
|
'aria-controls'?: string | undefined;
|
|
38
|
-
'aria-current'?: boolean | "time" | "page" | "
|
|
38
|
+
'aria-current'?: boolean | "time" | "page" | "false" | "true" | "step" | "location" | "date" | undefined;
|
|
39
39
|
'aria-describedby'?: string | undefined;
|
|
40
40
|
'aria-details'?: string | undefined;
|
|
41
41
|
'aria-disabled'?: (boolean | "false" | "true") | undefined;
|
|
@@ -236,9 +236,9 @@ export declare function useBorderBoxControlSplitControls(props: WordPressCompone
|
|
|
236
236
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
237
237
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
238
238
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
239
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
239
240
|
key?: import("react").Key | null | undefined;
|
|
240
241
|
defaultChecked?: boolean | undefined;
|
|
241
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
242
242
|
suppressContentEditableWarning?: boolean | undefined;
|
|
243
243
|
suppressHydrationWarning?: boolean | undefined;
|
|
244
244
|
accessKey?: string | undefined;
|
|
@@ -266,7 +266,7 @@ export declare function useBorderBoxControlSplitControls(props: WordPressCompone
|
|
|
266
266
|
itemRef?: string | undefined;
|
|
267
267
|
results?: number | undefined;
|
|
268
268
|
security?: string | undefined;
|
|
269
|
-
unselectable?: "
|
|
269
|
+
unselectable?: "off" | "on" | undefined;
|
|
270
270
|
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
271
271
|
is?: string | undefined;
|
|
272
272
|
as?: keyof JSX.IntrinsicElements | undefined;
|
|
@@ -17,14 +17,14 @@ export declare function useBorderBoxControlVisualizer(props: WordPressComponentP
|
|
|
17
17
|
tabIndex?: number | undefined;
|
|
18
18
|
'aria-activedescendant'?: string | undefined;
|
|
19
19
|
'aria-atomic'?: (boolean | "false" | "true") | undefined;
|
|
20
|
-
'aria-autocomplete'?: "inline" | "none" | "
|
|
20
|
+
'aria-autocomplete'?: "inline" | "none" | "both" | "list" | undefined;
|
|
21
21
|
'aria-busy'?: (boolean | "false" | "true") | undefined;
|
|
22
22
|
'aria-checked'?: boolean | "mixed" | "false" | "true" | undefined;
|
|
23
23
|
'aria-colcount'?: number | undefined;
|
|
24
24
|
'aria-colindex'?: number | undefined;
|
|
25
25
|
'aria-colspan'?: number | undefined;
|
|
26
26
|
'aria-controls'?: string | undefined;
|
|
27
|
-
'aria-current'?: boolean | "time" | "page" | "
|
|
27
|
+
'aria-current'?: boolean | "time" | "page" | "false" | "true" | "step" | "location" | "date" | undefined;
|
|
28
28
|
'aria-describedby'?: string | undefined;
|
|
29
29
|
'aria-details'?: string | undefined;
|
|
30
30
|
'aria-disabled'?: (boolean | "false" | "true") | undefined;
|
|
@@ -226,9 +226,9 @@ export declare function useBorderBoxControlVisualizer(props: WordPressComponentP
|
|
|
226
226
|
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLDivElement> | undefined;
|
|
227
227
|
onTransitionEnd?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
228
228
|
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLDivElement> | undefined;
|
|
229
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
229
230
|
key?: import("react").Key | null | undefined;
|
|
230
231
|
defaultChecked?: boolean | undefined;
|
|
231
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
232
232
|
suppressContentEditableWarning?: boolean | undefined;
|
|
233
233
|
suppressHydrationWarning?: boolean | undefined;
|
|
234
234
|
accessKey?: string | undefined;
|
|
@@ -256,7 +256,7 @@ export declare function useBorderBoxControlVisualizer(props: WordPressComponentP
|
|
|
256
256
|
itemRef?: string | undefined;
|
|
257
257
|
results?: number | undefined;
|
|
258
258
|
security?: string | undefined;
|
|
259
|
-
unselectable?: "
|
|
259
|
+
unselectable?: "off" | "on" | undefined;
|
|
260
260
|
inputMode?: "search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
|
|
261
261
|
is?: string | undefined;
|
|
262
262
|
as?: keyof JSX.IntrinsicElements | undefined;
|
|
@@ -13,5 +13,5 @@ export declare const Default: import("@storybook/types").AnnotatedStoryFn<import
|
|
|
13
13
|
popoverPlacement?: (import("@floating-ui/utils").Placement | "overlay") | undefined;
|
|
14
14
|
popoverOffset?: number | undefined;
|
|
15
15
|
value: import("../types").AnyBorder;
|
|
16
|
-
} & import("react").RefAttributes<any> & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "children" | "onChange" | "size" | "
|
|
16
|
+
} & import("react").RefAttributes<any> & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>>, "children" | "onChange" | "size" | "value" | "as" | keyof import("react").RefAttributes<any> | "colors" | "enableAlpha" | "__experimentalIsRenderedInSidebar" | "disableCustomColors" | "enableStyle" | keyof import("../../border-control/types").LabelProps | "popoverPlacement" | "popoverOffset">>;
|
|
17
17
|
//# sourceMappingURL=index.story.d.ts.map
|