@wordpress/components 29.1.1 → 29.3.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 +29 -6
- package/CONTRIBUTING.md +4 -4
- package/README.md +1 -1
- package/build/badge/index.js +26 -22
- package/build/badge/index.js.map +1 -1
- package/build/border-box-control/border-box-control-linked-button/component.js +8 -15
- package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build/box-control/index.js +6 -0
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/linked-button.js +7 -11
- package/build/box-control/linked-button.js.map +1 -1
- package/build/box-control/types.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +9 -7
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker.js +0 -1
- package/build/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build/color-palette/index.js +1 -6
- package/build/color-palette/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +1 -1
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/higher-order/with-focus-return/index.js +1 -1
- package/build/higher-order/with-focus-return/index.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +22 -22
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/menu/checkbox-item.js +6 -6
- package/build/menu/checkbox-item.js.map +1 -1
- package/build/menu/context.js +2 -2
- package/build/menu/context.js.map +1 -1
- package/build/menu/group-label.js +4 -4
- package/build/menu/group-label.js.map +1 -1
- package/build/menu/group.js +4 -4
- package/build/menu/group.js.map +1 -1
- package/build/menu/index.js +87 -14
- package/build/menu/index.js.map +1 -1
- package/build/menu/item-help-text.js +4 -4
- package/build/menu/item-help-text.js.map +1 -1
- package/build/menu/item-label.js +4 -4
- package/build/menu/item-label.js.map +1 -1
- package/build/menu/item.js +6 -6
- package/build/menu/item.js.map +1 -1
- package/build/menu/popover.js +5 -5
- package/build/menu/popover.js.map +1 -1
- package/build/menu/radio-item.js +6 -6
- package/build/menu/radio-item.js.map +1 -1
- package/build/menu/separator.js +4 -4
- package/build/menu/separator.js.map +1 -1
- package/build/menu/styles.js +41 -41
- package/build/menu/styles.js.map +1 -1
- package/build/menu/submenu-trigger-item.js +5 -5
- package/build/menu/submenu-trigger-item.js.map +1 -1
- package/build/menu/trigger-button.js +3 -3
- package/build/menu/trigger-button.js.map +1 -1
- package/build/menu/types.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build/notice/types.js.map +1 -1
- package/build/search-control/index.js +1 -1
- package/build/search-control/index.js.map +1 -1
- package/build/text/hook.js +8 -6
- package/build/text/hook.js.map +1 -1
- package/build/text/utils.js +1 -1
- package/build/text/utils.js.map +1 -1
- package/build-module/badge/index.js +28 -22
- package/build-module/badge/index.js.map +1 -1
- package/build-module/border-box-control/border-box-control-linked-button/component.js +8 -15
- package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
- package/build-module/box-control/index.js +6 -0
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/linked-button.js +7 -11
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/box-control/types.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +9 -7
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +0 -1
- package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build-module/color-palette/index.js +1 -6
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +1 -1
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/higher-order/with-focus-return/index.js +1 -1
- package/build-module/higher-order/with-focus-return/index.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +22 -22
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/menu/checkbox-item.js +6 -6
- package/build-module/menu/checkbox-item.js.map +1 -1
- package/build-module/menu/context.js +1 -1
- package/build-module/menu/context.js.map +1 -1
- package/build-module/menu/group-label.js +4 -4
- package/build-module/menu/group-label.js.map +1 -1
- package/build-module/menu/group.js +4 -4
- package/build-module/menu/group.js.map +1 -1
- package/build-module/menu/index.js +99 -26
- package/build-module/menu/index.js.map +1 -1
- package/build-module/menu/item-help-text.js +4 -4
- package/build-module/menu/item-help-text.js.map +1 -1
- package/build-module/menu/item-label.js +4 -4
- package/build-module/menu/item-label.js.map +1 -1
- package/build-module/menu/item.js +6 -6
- package/build-module/menu/item.js.map +1 -1
- package/build-module/menu/popover.js +5 -5
- package/build-module/menu/popover.js.map +1 -1
- package/build-module/menu/radio-item.js +6 -6
- package/build-module/menu/radio-item.js.map +1 -1
- package/build-module/menu/separator.js +4 -4
- package/build-module/menu/separator.js.map +1 -1
- package/build-module/menu/styles.js +40 -40
- package/build-module/menu/styles.js.map +1 -1
- package/build-module/menu/submenu-trigger-item.js +6 -6
- package/build-module/menu/submenu-trigger-item.js.map +1 -1
- package/build-module/menu/trigger-button.js +3 -3
- package/build-module/menu/trigger-button.js.map +1 -1
- package/build-module/menu/types.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build-module/notice/types.js.map +1 -1
- package/build-module/search-control/index.js +1 -1
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/text/hook.js +8 -6
- package/build-module/text/hook.js.map +1 -1
- package/build-module/text/utils.js +1 -1
- package/build-module/text/utils.js.map +1 -1
- package/build-style/style-rtl.css +89 -170
- package/build-style/style.css +89 -170
- package/build-types/badge/index.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
- package/build-types/box-control/index.d.ts.map +1 -1
- package/build-types/box-control/linked-button.d.ts.map +1 -1
- package/build-types/box-control/stories/index.story.d.ts +7 -2331
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/types.d.ts +15 -3
- package/build-types/box-control/types.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/higher-order/with-focus-return/index.d.ts +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/menu/checkbox-item.d.ts +2 -2
- package/build-types/menu/checkbox-item.d.ts.map +1 -1
- package/build-types/menu/context.d.ts +2 -2
- package/build-types/menu/context.d.ts.map +1 -1
- package/build-types/menu/group-label.d.ts +2 -2
- package/build-types/menu/group-label.d.ts.map +1 -1
- package/build-types/menu/group.d.ts +2 -2
- package/build-types/menu/group.d.ts.map +1 -1
- package/build-types/menu/index.d.ts +84 -12
- package/build-types/menu/index.d.ts.map +1 -1
- package/build-types/menu/item-help-text.d.ts +1 -1
- package/build-types/menu/item-help-text.d.ts.map +1 -1
- package/build-types/menu/item-label.d.ts +1 -1
- package/build-types/menu/item-label.d.ts.map +1 -1
- package/build-types/menu/item.d.ts +2 -2
- package/build-types/menu/item.d.ts.map +1 -1
- package/build-types/menu/popover.d.ts +2 -2
- package/build-types/menu/popover.d.ts.map +1 -1
- package/build-types/menu/radio-item.d.ts +2 -2
- package/build-types/menu/radio-item.d.ts.map +1 -1
- package/build-types/menu/separator.d.ts +2 -2
- package/build-types/menu/separator.d.ts.map +1 -1
- package/build-types/menu/styles.d.ts +15 -15
- package/build-types/menu/styles.d.ts.map +1 -1
- package/build-types/menu/submenu-trigger-item.d.ts +2 -2
- package/build-types/menu/submenu-trigger-item.d.ts.map +1 -1
- package/build-types/menu/trigger-button.d.ts +2 -2
- package/build-types/menu/trigger-button.d.ts.map +1 -1
- package/build-types/menu/types.d.ts +10 -10
- package/build-types/menu/types.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +1 -1
- package/build-types/notice/types.d.ts +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts +1 -1
- package/build-types/tabs/stories/index.story.d.ts +0 -3
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text/utils.d.ts +1 -1
- package/package.json +19 -19
- package/src/animate/style.scss +16 -12
- package/src/badge/index.tsx +28 -27
- package/src/border-box-control/border-box-control-linked-button/component.tsx +9 -14
- package/src/border-control/test/index.js +12 -4
- package/src/box-control/index.tsx +9 -0
- package/src/box-control/linked-button.tsx +8 -11
- package/src/box-control/test/index.tsx +9 -2
- package/src/box-control/types.ts +26 -11
- package/src/button/style.scss +15 -12
- package/src/checkbox-control/style.scss +4 -2
- package/src/circular-option-picker/README.md +1 -2
- package/src/circular-option-picker/circular-option-picker-option.tsx +17 -10
- package/src/circular-option-picker/circular-option-picker.tsx +0 -1
- package/src/circular-option-picker/stories/index.story.tsx +0 -1
- package/src/circular-option-picker/style.scss +10 -5
- package/src/color-palette/index.tsx +0 -7
- package/src/color-palette/test/index.tsx +2 -8
- package/src/combobox-control/test/index.tsx +1 -1
- package/src/drop-zone/style.scss +6 -9
- package/src/font-size-picker/index.native.js +1 -1
- package/src/form-toggle/style.scss +17 -10
- package/src/form-token-field/style.scss +9 -4
- package/src/higher-order/navigate-regions/style.scss +2 -2
- package/src/higher-order/with-focus-return/index.tsx +1 -1
- package/src/input-control/styles/input-control-styles.tsx +6 -0
- package/src/menu/README.md +421 -174
- package/src/menu/checkbox-item.tsx +12 -12
- package/src/menu/context.tsx +2 -4
- package/src/menu/docs-manifest.json +62 -0
- package/src/menu/group-label.tsx +7 -7
- package/src/menu/group.tsx +7 -11
- package/src/menu/index.tsx +101 -31
- package/src/menu/item-help-text.tsx +5 -7
- package/src/menu/item-label.tsx +5 -7
- package/src/menu/item.tsx +12 -12
- package/src/menu/popover.tsx +9 -9
- package/src/menu/radio-item.tsx +12 -12
- package/src/menu/separator.tsx +7 -7
- package/src/menu/stories/best-practices.mdx +38 -0
- package/src/menu/stories/index.story.tsx +8 -8
- package/src/menu/styles.ts +24 -24
- package/src/menu/submenu-trigger-item.tsx +9 -9
- package/src/menu/trigger-button.tsx +6 -6
- package/src/menu/types.ts +10 -10
- package/src/menu-group/stories/index.story.tsx +2 -2
- package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/src/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/src/modal/style.scss +4 -2
- package/src/modal/test/index.tsx +5 -4
- package/src/notice/README.md +3 -3
- package/src/notice/types.ts +1 -1
- package/src/palette-edit/test/index.tsx +1 -1
- package/src/panel/style.scss +14 -6
- package/src/placeholder/style.scss +5 -3
- package/src/progress-bar/stories/index.story.tsx +1 -1
- package/src/resizable-box/style.scss +14 -9
- package/src/search-control/index.tsx +1 -1
- package/src/tab-panel/style.scss +6 -4
- package/src/tabs/stories/index.story.tsx +0 -131
- package/src/text/README.md +1 -1
- package/src/text/hook.ts +3 -2
- package/src/text/stories/index.story.tsx +2 -2
- package/src/text/test/index.tsx +1 -1
- package/src/text/utils.ts +1 -1
- package/src/text-highlight/test/index.tsx +3 -3
- package/src/toolbar/toolbar/style.scss +4 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["css","Flex","FlexItem","Text","baseLabelTypography","COLORS","CONFIG","rtl","jsx","_jsx","Prefix","_styled","process","env","NODE_ENV","target","label","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","Suffix","backdropBorderColor","disabled","isBorderless","ui","borderDisabled","border","BackdropUI","paddingLeft","Root","radiusSmall","borderFocus","controlBoxShadowFocus","containerDisabledStyles","backgroundColor","backgroundDisabled","background","_ref","containerWidthStyles","__unstableInputWidth","labelPosition","flex","width","Container","disabledStyles","color","textDisabled","fontSizeStyles","inputSize","size","sizes","default","small","compact","fontSize","fontSizeMobile","getSizeConfig","__next40pxDefaultSize","height","lineHeight","minHeight","controlPaddingX","paddingRight","controlPaddingXSmall","sizeStyles","props","customPaddings","paddingInlineStart","paddingInlineEnd","dragStyles","isDragging","dragCursor","defaultArrowStyles","activeDragCursorStyles","Input","theme","foreground","BaseLabel","Label","as","LabelWrapper","prefixSuffixWrapperStyles","variant","isPrefix","padding","paddingProperty","display","PrefixSuffixWrapper"],"sources":["@wordpress/components/src/input-control/styles/input-control-styles.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { SerializedStyles } from '@emotion/react';\nimport { css } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport type { CSSProperties, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { Flex, FlexItem } from '../../flex';\nimport { Text } from '../../text';\nimport { baseLabelTypography, COLORS, CONFIG, rtl } from '../../utils';\nimport type { LabelPosition, Size, PrefixSuffixWrapperProps } from '../types';\n\ntype ContainerProps = {\n\tdisabled?: boolean;\n\thideLabel?: boolean;\n\t__unstableInputWidth?: CSSProperties[ 'width' ];\n\tlabelPosition?: LabelPosition;\n};\n\nexport const Prefix = styled.span`\n\tbox-sizing: border-box;\n\tdisplay: block;\n`;\n\nexport const Suffix = styled.span`\n\talign-items: center;\n\talign-self: stretch;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n`;\n\ntype BackdropProps = {\n\tdisabled?: boolean;\n\tisBorderless?: boolean;\n};\n\nconst backdropBorderColor = ( {\n\tdisabled,\n\tisBorderless,\n}: BackdropProps ): CSSProperties[ 'borderColor' ] => {\n\tif ( isBorderless ) {\n\t\treturn 'transparent';\n\t}\n\n\tif ( disabled ) {\n\t\treturn COLORS.ui.borderDisabled;\n\t}\n\n\treturn COLORS.ui.border;\n};\n\nexport const BackdropUI = styled.div< BackdropProps >`\n\t&&& {\n\t\tbox-sizing: border-box;\n\t\tborder-color: ${ backdropBorderColor };\n\t\tborder-radius: inherit;\n\t\tborder-style: solid;\n\t\tborder-width: 1px;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tpointer-events: none;\n\t\tposition: absolute;\n\t\tright: 0;\n\t\ttop: 0;\n\n\t\t${ rtl( { paddingLeft: 2 } ) }\n\t}\n`;\n\nexport const Root = styled( Flex )`\n\tbox-sizing: border-box;\n\tposition: relative;\n\tborder-radius: ${ CONFIG.radiusSmall };\n\tpadding-top: 0;\n\n\t// Focus within, excluding cases where auxiliary controls in prefix or suffix have focus.\n\t&:focus-within:not( :has( :is( ${ Prefix }, ${ Suffix } ):focus-within ) ) {\n\t\t${ BackdropUI } {\n\t\t\tborder-color: ${ COLORS.ui.borderFocus };\n\t\t\tbox-shadow: ${ CONFIG.controlBoxShadowFocus };\n\t\t\t// Windows High Contrast mode will show this outline, but not the box-shadow.\n\t\t\toutline: 2px solid transparent;\n\t\t\toutline-offset: -2px;\n\t\t}\n\t}\n`;\n\nconst containerDisabledStyles = ( { disabled }: ContainerProps ) => {\n\tconst backgroundColor = disabled\n\t\t? COLORS.ui.backgroundDisabled\n\t\t: COLORS.ui.background;\n\n\treturn css( { backgroundColor } );\n};\n\nconst containerWidthStyles = ( {\n\t__unstableInputWidth,\n\tlabelPosition,\n}: ContainerProps ) => {\n\tif ( ! __unstableInputWidth ) {\n\t\treturn css( { width: '100%' } );\n\t}\n\n\tif ( labelPosition === 'side' ) {\n\t\treturn '';\n\t}\n\n\tif ( labelPosition === 'edge' ) {\n\t\treturn css( {\n\t\t\tflex: `0 0 ${ __unstableInputWidth }`,\n\t\t} );\n\t}\n\n\treturn css( { width: __unstableInputWidth } );\n};\n\nexport const Container = styled.div< ContainerProps >`\n\talign-items: center;\n\tbox-sizing: border-box;\n\tborder-radius: inherit;\n\tdisplay: flex;\n\tflex: 1;\n\tposition: relative;\n\n\t${ containerDisabledStyles }\n\t${ containerWidthStyles }\n`;\n\ntype InputProps = {\n\t__next40pxDefaultSize?: boolean;\n\tdisabled?: boolean;\n\tinputSize?: Size;\n\tisDragging?: boolean;\n\tdragCursor?: CSSProperties[ 'cursor' ];\n\tpaddingInlineStart?: CSSProperties[ 'paddingInlineStart' ];\n\tpaddingInlineEnd?: CSSProperties[ 'paddingInlineEnd' ];\n};\n\nconst disabledStyles = ( { disabled }: InputProps ) => {\n\tif ( ! disabled ) {\n\t\treturn '';\n\t}\n\n\treturn css( {\n\t\tcolor: COLORS.ui.textDisabled,\n\t} );\n};\n\nexport const fontSizeStyles = ( { inputSize: size }: InputProps ) => {\n\tconst sizes = {\n\t\tdefault: '13px',\n\t\tsmall: '11px',\n\t\tcompact: '13px',\n\t\t'__unstable-large': '13px',\n\t};\n\n\tconst fontSize = sizes[ size as Size ] || sizes.default;\n\tconst fontSizeMobile = '16px';\n\n\tif ( ! fontSize ) {\n\t\treturn '';\n\t}\n\n\treturn css`\n\t\tfont-size: ${ fontSizeMobile };\n\n\t\t@media ( min-width: 600px ) {\n\t\t\tfont-size: ${ fontSize };\n\t\t}\n\t`;\n};\n\nexport const getSizeConfig = ( {\n\tinputSize: size,\n\t__next40pxDefaultSize,\n}: InputProps ) => {\n\t// Paddings may be overridden by the custom paddings props.\n\tconst sizes = {\n\t\tdefault: {\n\t\t\theight: 40,\n\t\t\tlineHeight: 1,\n\t\t\tminHeight: 40,\n\t\t\tpaddingLeft: CONFIG.controlPaddingX,\n\t\t\tpaddingRight: CONFIG.controlPaddingX,\n\t\t},\n\t\tsmall: {\n\t\t\theight: 24,\n\t\t\tlineHeight: 1,\n\t\t\tminHeight: 24,\n\t\t\tpaddingLeft: CONFIG.controlPaddingXSmall,\n\t\t\tpaddingRight: CONFIG.controlPaddingXSmall,\n\t\t},\n\t\tcompact: {\n\t\t\theight: 32,\n\t\t\tlineHeight: 1,\n\t\t\tminHeight: 32,\n\t\t\tpaddingLeft: CONFIG.controlPaddingXSmall,\n\t\t\tpaddingRight: CONFIG.controlPaddingXSmall,\n\t\t},\n\t\t'__unstable-large': {\n\t\t\theight: 40,\n\t\t\tlineHeight: 1,\n\t\t\tminHeight: 40,\n\t\t\tpaddingLeft: CONFIG.controlPaddingX,\n\t\t\tpaddingRight: CONFIG.controlPaddingX,\n\t\t},\n\t};\n\n\tif ( ! __next40pxDefaultSize ) {\n\t\tsizes.default = sizes.compact;\n\t}\n\n\treturn sizes[ size as Size ] || sizes.default;\n};\n\nconst sizeStyles = ( props: InputProps ) => {\n\treturn css( getSizeConfig( props ) );\n};\n\nconst customPaddings = ( {\n\tpaddingInlineStart,\n\tpaddingInlineEnd,\n}: InputProps ) => {\n\treturn css( { paddingInlineStart, paddingInlineEnd } );\n};\n\nconst dragStyles = ( { isDragging, dragCursor }: InputProps ) => {\n\tlet defaultArrowStyles: SerializedStyles | undefined;\n\tlet activeDragCursorStyles: SerializedStyles | undefined;\n\n\tif ( isDragging ) {\n\t\tdefaultArrowStyles = css`\n\t\t\tcursor: ${ dragCursor };\n\t\t\tuser-select: none;\n\n\t\t\t&::-webkit-outer-spin-button,\n\t\t\t&::-webkit-inner-spin-button {\n\t\t\t\t-webkit-appearance: none !important;\n\t\t\t\tmargin: 0 !important;\n\t\t\t}\n\t\t`;\n\t}\n\n\tif ( isDragging && dragCursor ) {\n\t\tactiveDragCursorStyles = css`\n\t\t\t&:active {\n\t\t\t\tcursor: ${ dragCursor };\n\t\t\t}\n\t\t`;\n\t}\n\n\treturn css`\n\t\t${ defaultArrowStyles }\n\t\t${ activeDragCursorStyles }\n\t`;\n};\n\n// TODO: Resolve need to use &&& to increase specificity\n// https://github.com/WordPress/gutenberg/issues/18483\n\nexport const Input = styled.input< InputProps >`\n\t&&& {\n\t\tbackground-color: transparent;\n\t\tbox-sizing: border-box;\n\t\tborder: none;\n\t\tbox-shadow: none !important;\n\t\tcolor: ${ COLORS.theme.foreground };\n\t\tdisplay: block;\n\t\tfont-family: inherit;\n\t\tmargin: 0;\n\t\toutline: none;\n\t\twidth: 100%;\n\n\t\t${ dragStyles }\n\t\t${ disabledStyles }\n\t\t${ fontSizeStyles }\n\t\t${ sizeStyles }\n\t\t${ customPaddings }\n\n\t\t&::-webkit-input-placeholder {\n\t\t\tline-height: normal;\n\t\t}\n\t}\n`;\n\nconst BaseLabel = styled( Text )< { labelPosition?: LabelPosition } >`\n\t&&& {\n\t\t${ baseLabelTypography };\n\n\t\tbox-sizing: border-box;\n\t\tdisplay: block;\n\t\tpadding-top: 0;\n\t\tpadding-bottom: 0;\n\t\tmax-width: 100%;\n\t\tz-index: 1;\n\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\twhite-space: nowrap;\n\t}\n`;\n\nexport const Label = (\n\tprops: WordPressComponentProps<\n\t\t{ labelPosition?: LabelPosition; children: ReactNode },\n\t\t'label',\n\t\tfalse\n\t>\n) => <BaseLabel { ...props } as=\"label\" />;\n\nexport const LabelWrapper = styled( FlexItem )`\n\tmax-width: calc( 100% - 10px );\n`;\n\nconst prefixSuffixWrapperStyles = ( {\n\tvariant = 'default',\n\tsize,\n\t__next40pxDefaultSize,\n\tisPrefix,\n}: PrefixSuffixWrapperProps & { isPrefix?: boolean } ) => {\n\tconst { paddingLeft: padding } = getSizeConfig( {\n\t\tinputSize: size,\n\t\t__next40pxDefaultSize,\n\t} );\n\n\tconst paddingProperty = isPrefix\n\t\t? 'paddingInlineStart'\n\t\t: 'paddingInlineEnd';\n\n\tif ( variant === 'default' ) {\n\t\treturn css( {\n\t\t\t[ paddingProperty ]: padding,\n\t\t} );\n\t}\n\n\t// If variant is 'icon' or 'control'\n\treturn css( {\n\t\tdisplay: 'flex',\n\t\t[ paddingProperty ]: padding - 4,\n\t} );\n};\n\nexport const PrefixSuffixWrapper = styled.div`\n\t${ prefixSuffixWrapperStyles }\n`;\n"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,GAAG,QAAQ,gBAA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AAC,EAAA1E,OAAA,CAAAC,GAAA,CAAAC,QAAA,8DAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,kjWAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAM2E,mBAAmB,gBAAA9E,OAAA,QAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,GAC5BmE,yBAAyB,SAAAvE,OAAA,CAAAC,GAAA,CAAAC,QAAA,ojWAC5B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["css","Flex","FlexItem","Text","baseLabelTypography","COLORS","CONFIG","rtl","jsx","_jsx","Prefix","_styled","process","env","NODE_ENV","target","label","name","styles","map","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","Suffix","backdropBorderColor","disabled","isBorderless","ui","borderDisabled","border","BackdropUI","paddingLeft","Root","radiusSmall","borderFocus","controlBoxShadowFocus","containerDisabledStyles","backgroundColor","backgroundDisabled","background","_ref","containerWidthStyles","__unstableInputWidth","labelPosition","flex","width","Container","disabledStyles","color","textDisabled","fontSizeStyles","inputSize","size","sizes","default","small","compact","fontSize","fontSizeMobile","getSizeConfig","__next40pxDefaultSize","height","lineHeight","minHeight","controlPaddingX","paddingRight","controlPaddingXSmall","sizeStyles","props","customPaddings","paddingInlineStart","paddingInlineEnd","dragStyles","isDragging","dragCursor","defaultArrowStyles","activeDragCursorStyles","Input","theme","foreground","BaseLabel","Label","as","LabelWrapper","prefixSuffixWrapperStyles","variant","isPrefix","padding","paddingProperty","display","PrefixSuffixWrapper"],"sources":["@wordpress/components/src/input-control/styles/input-control-styles.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport type { SerializedStyles } from '@emotion/react';\nimport { css } from '@emotion/react';\nimport styled from '@emotion/styled';\nimport type { CSSProperties, ReactNode } from 'react';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../../context';\nimport { Flex, FlexItem } from '../../flex';\nimport { Text } from '../../text';\nimport { baseLabelTypography, COLORS, CONFIG, rtl } from '../../utils';\nimport type { LabelPosition, Size, PrefixSuffixWrapperProps } from '../types';\n\ntype ContainerProps = {\n\tdisabled?: boolean;\n\thideLabel?: boolean;\n\t__unstableInputWidth?: CSSProperties[ 'width' ];\n\tlabelPosition?: LabelPosition;\n};\n\nexport const Prefix = styled.span`\n\tbox-sizing: border-box;\n\tdisplay: block;\n`;\n\nexport const Suffix = styled.span`\n\talign-items: center;\n\talign-self: stretch;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n`;\n\ntype BackdropProps = {\n\tdisabled?: boolean;\n\tisBorderless?: boolean;\n};\n\nconst backdropBorderColor = ( {\n\tdisabled,\n\tisBorderless,\n}: BackdropProps ): CSSProperties[ 'borderColor' ] => {\n\tif ( isBorderless ) {\n\t\treturn 'transparent';\n\t}\n\n\tif ( disabled ) {\n\t\treturn COLORS.ui.borderDisabled;\n\t}\n\n\treturn COLORS.ui.border;\n};\n\nexport const BackdropUI = styled.div< BackdropProps >`\n\t&&& {\n\t\tbox-sizing: border-box;\n\t\tborder-color: ${ backdropBorderColor };\n\t\tborder-radius: inherit;\n\t\tborder-style: solid;\n\t\tborder-width: 1px;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tpointer-events: none;\n\t\tposition: absolute;\n\t\tright: 0;\n\t\ttop: 0;\n\n\t\t${ rtl( { paddingLeft: 2 } ) }\n\t}\n`;\n\nexport const Root = styled( Flex )`\n\tbox-sizing: border-box;\n\tposition: relative;\n\tborder-radius: ${ CONFIG.radiusSmall };\n\tpadding-top: 0;\n\n\t// Focus within, excluding cases where auxiliary controls in prefix or suffix have focus.\n\t&:focus-within:not( :has( :is( ${ Prefix }, ${ Suffix } ):focus-within ) ) {\n\t\t${ BackdropUI } {\n\t\t\tborder-color: ${ COLORS.ui.borderFocus };\n\t\t\tbox-shadow: ${ CONFIG.controlBoxShadowFocus };\n\t\t\t// Windows High Contrast mode will show this outline, but not the box-shadow.\n\t\t\toutline: 2px solid transparent;\n\t\t\toutline-offset: -2px;\n\t\t}\n\t}\n`;\n\nconst containerDisabledStyles = ( { disabled }: ContainerProps ) => {\n\tconst backgroundColor = disabled\n\t\t? COLORS.ui.backgroundDisabled\n\t\t: COLORS.ui.background;\n\n\treturn css( { backgroundColor } );\n};\n\nconst containerWidthStyles = ( {\n\t__unstableInputWidth,\n\tlabelPosition,\n}: ContainerProps ) => {\n\tif ( ! __unstableInputWidth ) {\n\t\treturn css( { width: '100%' } );\n\t}\n\n\tif ( labelPosition === 'side' ) {\n\t\treturn '';\n\t}\n\n\tif ( labelPosition === 'edge' ) {\n\t\treturn css( {\n\t\t\tflex: `0 0 ${ __unstableInputWidth }`,\n\t\t} );\n\t}\n\n\treturn css( { width: __unstableInputWidth } );\n};\n\nexport const Container = styled.div< ContainerProps >`\n\talign-items: center;\n\tbox-sizing: border-box;\n\tborder-radius: inherit;\n\tdisplay: flex;\n\tflex: 1;\n\tposition: relative;\n\n\t${ containerDisabledStyles }\n\t${ containerWidthStyles }\n`;\n\ntype InputProps = {\n\t__next40pxDefaultSize?: boolean;\n\tdisabled?: boolean;\n\tinputSize?: Size;\n\tisDragging?: boolean;\n\tdragCursor?: CSSProperties[ 'cursor' ];\n\tpaddingInlineStart?: CSSProperties[ 'paddingInlineStart' ];\n\tpaddingInlineEnd?: CSSProperties[ 'paddingInlineEnd' ];\n};\n\nconst disabledStyles = ( { disabled }: InputProps ) => {\n\tif ( ! disabled ) {\n\t\treturn '';\n\t}\n\n\treturn css( {\n\t\tcolor: COLORS.ui.textDisabled,\n\t} );\n};\n\nexport const fontSizeStyles = ( { inputSize: size }: InputProps ) => {\n\tconst sizes = {\n\t\tdefault: '13px',\n\t\tsmall: '11px',\n\t\tcompact: '13px',\n\t\t'__unstable-large': '13px',\n\t};\n\n\tconst fontSize = sizes[ size as Size ] || sizes.default;\n\tconst fontSizeMobile = '16px';\n\n\tif ( ! fontSize ) {\n\t\treturn '';\n\t}\n\n\treturn css`\n\t\tfont-size: ${ fontSizeMobile };\n\n\t\t@media ( min-width: 600px ) {\n\t\t\tfont-size: ${ fontSize };\n\t\t}\n\t`;\n};\n\nexport const getSizeConfig = ( {\n\tinputSize: size,\n\t__next40pxDefaultSize,\n}: InputProps ) => {\n\t// Paddings may be overridden by the custom paddings props.\n\tconst sizes = {\n\t\tdefault: {\n\t\t\theight: 40,\n\t\t\tlineHeight: 1,\n\t\t\tminHeight: 40,\n\t\t\tpaddingLeft: CONFIG.controlPaddingX,\n\t\t\tpaddingRight: CONFIG.controlPaddingX,\n\t\t},\n\t\tsmall: {\n\t\t\theight: 24,\n\t\t\tlineHeight: 1,\n\t\t\tminHeight: 24,\n\t\t\tpaddingLeft: CONFIG.controlPaddingXSmall,\n\t\t\tpaddingRight: CONFIG.controlPaddingXSmall,\n\t\t},\n\t\tcompact: {\n\t\t\theight: 32,\n\t\t\tlineHeight: 1,\n\t\t\tminHeight: 32,\n\t\t\tpaddingLeft: CONFIG.controlPaddingXSmall,\n\t\t\tpaddingRight: CONFIG.controlPaddingXSmall,\n\t\t},\n\t\t'__unstable-large': {\n\t\t\theight: 40,\n\t\t\tlineHeight: 1,\n\t\t\tminHeight: 40,\n\t\t\tpaddingLeft: CONFIG.controlPaddingX,\n\t\t\tpaddingRight: CONFIG.controlPaddingX,\n\t\t},\n\t};\n\n\tif ( ! __next40pxDefaultSize ) {\n\t\tsizes.default = sizes.compact;\n\t}\n\n\treturn sizes[ size as Size ] || sizes.default;\n};\n\nconst sizeStyles = ( props: InputProps ) => {\n\treturn css( getSizeConfig( props ) );\n};\n\nconst customPaddings = ( {\n\tpaddingInlineStart,\n\tpaddingInlineEnd,\n}: InputProps ) => {\n\treturn css( { paddingInlineStart, paddingInlineEnd } );\n};\n\nconst dragStyles = ( { isDragging, dragCursor }: InputProps ) => {\n\tlet defaultArrowStyles: SerializedStyles | undefined;\n\tlet activeDragCursorStyles: SerializedStyles | undefined;\n\n\tif ( isDragging ) {\n\t\tdefaultArrowStyles = css`\n\t\t\tcursor: ${ dragCursor };\n\t\t\tuser-select: none;\n\n\t\t\t&::-webkit-outer-spin-button,\n\t\t\t&::-webkit-inner-spin-button {\n\t\t\t\t-webkit-appearance: none !important;\n\t\t\t\tmargin: 0 !important;\n\t\t\t}\n\t\t`;\n\t}\n\n\tif ( isDragging && dragCursor ) {\n\t\tactiveDragCursorStyles = css`\n\t\t\t&:active {\n\t\t\t\tcursor: ${ dragCursor };\n\t\t\t}\n\t\t`;\n\t}\n\n\treturn css`\n\t\t${ defaultArrowStyles }\n\t\t${ activeDragCursorStyles }\n\t`;\n};\n\n// TODO: Resolve need to use &&& to increase specificity\n// https://github.com/WordPress/gutenberg/issues/18483\n\nexport const Input = styled.input< InputProps >`\n\t&&& {\n\t\tbackground-color: transparent;\n\t\tbox-sizing: border-box;\n\t\tborder: none;\n\t\tbox-shadow: none !important;\n\t\tcolor: ${ COLORS.theme.foreground };\n\t\tdisplay: block;\n\t\tfont-family: inherit;\n\t\tmargin: 0;\n\t\toutline: none;\n\t\twidth: 100%;\n\n\t\t${ dragStyles }\n\t\t${ disabledStyles }\n\t\t${ fontSizeStyles }\n\t\t${ sizeStyles }\n\t\t${ customPaddings }\n\n\t\t&::-webkit-input-placeholder {\n\t\t\tline-height: normal;\n\t\t}\n\n\t\t&[type='email'],\n\t\t&[type='url'] {\n\t\t\t/* rtl:ignore */\n\t\t\tdirection: ltr;\n\t\t}\n\t}\n`;\n\nconst BaseLabel = styled( Text )< { labelPosition?: LabelPosition } >`\n\t&&& {\n\t\t${ baseLabelTypography };\n\n\t\tbox-sizing: border-box;\n\t\tdisplay: block;\n\t\tpadding-top: 0;\n\t\tpadding-bottom: 0;\n\t\tmax-width: 100%;\n\t\tz-index: 1;\n\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\twhite-space: nowrap;\n\t}\n`;\n\nexport const Label = (\n\tprops: WordPressComponentProps<\n\t\t{ labelPosition?: LabelPosition; children: ReactNode },\n\t\t'label',\n\t\tfalse\n\t>\n) => <BaseLabel { ...props } as=\"label\" />;\n\nexport const LabelWrapper = styled( FlexItem )`\n\tmax-width: calc( 100% - 10px );\n`;\n\nconst prefixSuffixWrapperStyles = ( {\n\tvariant = 'default',\n\tsize,\n\t__next40pxDefaultSize,\n\tisPrefix,\n}: PrefixSuffixWrapperProps & { isPrefix?: boolean } ) => {\n\tconst { paddingLeft: padding } = getSizeConfig( {\n\t\tinputSize: size,\n\t\t__next40pxDefaultSize,\n\t} );\n\n\tconst paddingProperty = isPrefix\n\t\t? 'paddingInlineStart'\n\t\t: 'paddingInlineEnd';\n\n\tif ( variant === 'default' ) {\n\t\treturn css( {\n\t\t\t[ paddingProperty ]: padding,\n\t\t} );\n\t}\n\n\t// If variant is 'icon' or 'control'\n\treturn css( {\n\t\tdisplay: 'flex',\n\t\t[ paddingProperty ]: padding - 4,\n\t} );\n};\n\nexport const PrefixSuffixWrapper = styled.div`\n\t${ prefixSuffixWrapperStyles }\n`;\n"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,GAAG,QAAQ,gBAAgB;AAIpC;AACA;AACA;;AAEA,SAASC,IAAI,EAAEC,QAAQ,QAAQ,YAAY;AAC3C,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,mBAAmB,EAAEC,MAAM,EAAEC,MAAM,EAAEC,GAAG,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAUvE,OAAO,MAAMC,MAAM,gBAAAC,OAAA,SAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,GAAAJ,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAG,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAC;AAAA,EAGlB;AAED,OAAO,MAAMC,MAAM,gBAAAX,OAAA,SAAAC,OAAA,CAAAC,GAAA,CAAAC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AAAC,MAAA;EAAAC,GAAA;EAAAC,QAAA,EAAAC;AAAA,EAE7C;AAED,MAAM8D,yBAAyB,GAAGA,CAAE;EACnCC,OAAO,GAAG,SAAS;EACnBjC,IAAI;EACJQ,qBAAqB;EACrB0B;AACkD,CAAC,KAAM;EACzD,MAAM;IAAEvD,WAAW,EAAEwD;EAAQ,CAAC,GAAG5B,aAAa,CAAE;IAC/CR,SAAS,EAAEC,IAAI;IACfQ;EACD,CAAE,CAAC;EAEH,MAAM4B,eAAe,GAAGF,QAAQ,GAC7B,oBAAoB,GACpB,kBAAkB;EAErB,IAAKD,OAAO,KAAK,SAAS,EAAG;IAC5B,oBAAOpF,GAAG,CAAE;MACX,CAAEuF,eAAe,GAAID;IACtB,CAAC,EAAA1E,OAAA,CAAAC,GAAA,CAAAC,QAAA,8DAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,srWAAC,CAAC;EACJ;;EAEA;EACA,oBAAOd,GAAG,CAAE;IACXwF,OAAO,EAAE,MAAM;IACf,CAAED,eAAe,GAAID,OAAO,GAAG;EAChC,CAAC,EAAA1E,OAAA,CAAAC,GAAA,CAAAC,QAAA,8DAAAF,OAAA,CAAAC,GAAA,CAAAC,QAAA,srWAAC,CAAC;AACJ,CAAC;AAED,OAAO,MAAM2E,mBAAmB,gBAAA9E,OAAA,QAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,GAC5BmE,yBAAyB,SAAAvE,OAAA,CAAAC,GAAA,CAAAC,QAAA,wrWAC5B","ignoreList":[]}
|
|
@@ -13,21 +13,21 @@ import { Icon, check } from '@wordpress/icons';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import { Context } from './context';
|
|
17
17
|
import * as Styled from './styles';
|
|
18
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
-
export const
|
|
19
|
+
export const CheckboxItem = forwardRef(function CheckboxItem({
|
|
20
20
|
suffix,
|
|
21
21
|
children,
|
|
22
22
|
disabled = false,
|
|
23
23
|
hideOnClick = false,
|
|
24
24
|
...props
|
|
25
25
|
}, ref) {
|
|
26
|
-
const menuContext = useContext(
|
|
26
|
+
const menuContext = useContext(Context);
|
|
27
27
|
if (!menuContext?.store) {
|
|
28
28
|
throw new Error('Menu.CheckboxItem can only be rendered inside a Menu component');
|
|
29
29
|
}
|
|
30
|
-
return /*#__PURE__*/_jsxs(Styled.
|
|
30
|
+
return /*#__PURE__*/_jsxs(Styled.CheckboxItem, {
|
|
31
31
|
ref: ref,
|
|
32
32
|
...props,
|
|
33
33
|
accessibleWhenDisabled: true,
|
|
@@ -47,8 +47,8 @@ export const MenuCheckboxItem = forwardRef(function MenuCheckboxItem({
|
|
|
47
47
|
icon: check,
|
|
48
48
|
size: 24
|
|
49
49
|
})
|
|
50
|
-
}), /*#__PURE__*/_jsxs(Styled.
|
|
51
|
-
children: [/*#__PURE__*/_jsx(Styled.
|
|
50
|
+
}), /*#__PURE__*/_jsxs(Styled.ItemContentWrapper, {
|
|
51
|
+
children: [/*#__PURE__*/_jsx(Styled.ItemChildrenWrapper, {
|
|
52
52
|
children: children
|
|
53
53
|
}), suffix && /*#__PURE__*/_jsx(Styled.ItemSuffixWrapper, {
|
|
54
54
|
children: suffix
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Ariakit","forwardRef","useContext","Icon","check","
|
|
1
|
+
{"version":3,"names":["Ariakit","forwardRef","useContext","Icon","check","Context","Styled","jsx","_jsx","jsxs","_jsxs","CheckboxItem","suffix","children","disabled","hideOnClick","props","ref","menuContext","store","Error","accessibleWhenDisabled","MenuItemCheck","render","ItemPrefixWrapper","style","width","height","icon","size","ItemContentWrapper","ItemChildrenWrapper","ItemSuffixWrapper"],"sources":["@wordpress/components/src/menu/checkbox-item.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\nimport { Icon, check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { Context } from './context';\nimport type { CheckboxItemProps } from './types';\nimport * as Styled from './styles';\n\nexport const CheckboxItem = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< CheckboxItemProps, 'div', false >\n>( function CheckboxItem(\n\t{ suffix, children, disabled = false, hideOnClick = false, ...props },\n\tref\n) {\n\tconst menuContext = useContext( Context );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.CheckboxItem can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.CheckboxItem\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ disabled }\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ menuContext.store }\n\t\t>\n\t\t\t<Ariakit.MenuItemCheck\n\t\t\t\tstore={ menuContext.store }\n\t\t\t\trender={ <Styled.ItemPrefixWrapper /> }\n\t\t\t\t// Override some ariakit inline styles\n\t\t\t\tstyle={ { width: 'auto', height: 'auto' } }\n\t\t\t>\n\t\t\t\t<Icon icon={ check } size={ 24 } />\n\t\t\t</Ariakit.MenuItemCheck>\n\n\t\t\t<Styled.ItemContentWrapper>\n\t\t\t\t<Styled.ItemChildrenWrapper>\n\t\t\t\t\t{ children }\n\t\t\t\t</Styled.ItemChildrenWrapper>\n\n\t\t\t\t{ suffix && (\n\t\t\t\t\t<Styled.ItemSuffixWrapper>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t</Styled.ItemSuffixWrapper>\n\t\t\t\t) }\n\t\t\t</Styled.ItemContentWrapper>\n\t\t</Styled.CheckboxItem>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AA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yB,mBAAmB;QAAAlB,QAAA,EACxBA;MAAQ,CACiB,CAAC,EAE3BD,MAAM,iBACPJ,IAAA,CAACF,MAAM,CAAC0B,iBAAiB;QAAAnB,QAAA,EACtBD;MAAM,CACiB,CAC1B;IAAA,CACyB,CAAC;EAAA,CACR,CAAC;AAExB,CAAE,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","
|
|
1
|
+
{"version":3,"names":["createContext","Context","undefined"],"sources":["@wordpress/components/src/menu/context.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ContextProps } from './types';\n\nexport const Context = createContext< ContextProps | undefined >( undefined );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;;AAElD;AACA;AACA;;AAGA,OAAO,MAAMC,OAAO,GAAGD,aAAa,CAA8BE,SAAU,CAAC","ignoreList":[]}
|
|
@@ -7,16 +7,16 @@ import { forwardRef, useContext } from '@wordpress/element';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { Context } from './context';
|
|
11
11
|
import { Text } from '../text';
|
|
12
12
|
import * as Styled from './styles';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
export const
|
|
15
|
-
const menuContext = useContext(
|
|
14
|
+
export const GroupLabel = forwardRef(function Group(props, ref) {
|
|
15
|
+
const menuContext = useContext(Context);
|
|
16
16
|
if (!menuContext?.store) {
|
|
17
17
|
throw new Error('Menu.GroupLabel can only be rendered inside a Menu component');
|
|
18
18
|
}
|
|
19
|
-
return /*#__PURE__*/_jsx(Styled.
|
|
19
|
+
return /*#__PURE__*/_jsx(Styled.GroupLabel, {
|
|
20
20
|
ref: ref,
|
|
21
21
|
render:
|
|
22
22
|
/*#__PURE__*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useContext","
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","Context","Text","Styled","jsx","_jsx","GroupLabel","Group","props","ref","menuContext","store","Error","render","upperCase","variant","size","weight","lineHeight"],"sources":["@wordpress/components/src/menu/group-label.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { Context } from './context';\nimport { Text } from '../text';\nimport type { GroupLabelProps } from './types';\nimport * as Styled from './styles';\n\nexport const GroupLabel = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< GroupLabelProps, 'div', false >\n>( function Group( props, ref ) {\n\tconst menuContext = useContext( Context );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.GroupLabel can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.GroupLabel\n\t\t\tref={ ref }\n\t\t\trender={\n\t\t\t\t// @ts-expect-error The `children` prop is passed\n\t\t\t\t<Text\n\t\t\t\t\tupperCase\n\t\t\t\t\tvariant=\"muted\"\n\t\t\t\t\tsize=\"11px\"\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tlineHeight=\"16px\"\n\t\t\t\t/>\n\t\t\t}\n\t\t\t{ ...props }\n\t\t\tstore={ menuContext.store }\n\t\t/>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAEA,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,IAAI,QAAQ,SAAS;AAE9B,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,UAAU,GAAGP,UAAU,CAGjC,SAASQ,KAAKA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EAC/B,MAAMC,WAAW,GAAGV,UAAU,CAAEC,OAAQ,CAAC;EAEzC,IAAK,CAAES,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,8DACD,CAAC;EACF;EAEA,oBACCP,IAAA,CAACF,MAAM,CAACG,UAAU;IACjBG,GAAG,EAAGA,GAAK;IACXI,MAAM;IAAA;IACL;IACAR,IAAA,CAACH,IAAI;MACJY,SAAS;MACTC,OAAO,EAAC,OAAO;MACfC,IAAI,EAAC,MAAM;MACXC,MAAM,EAAG,GAAK;MACdC,UAAU,EAAC;IAAM,CACjB,CACD;IAAA,GACIV,KAAK;IACVG,KAAK,EAAGD,WAAW,CAACC;EAAO,CAC3B,CAAC;AAEJ,CAAE,CAAC","ignoreList":[]}
|
|
@@ -7,15 +7,15 @@ import { forwardRef, useContext } from '@wordpress/element';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { Context } from './context';
|
|
11
11
|
import * as Styled from './styles';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
export const
|
|
14
|
-
const menuContext = useContext(
|
|
13
|
+
export const Group = forwardRef(function Group(props, ref) {
|
|
14
|
+
const menuContext = useContext(Context);
|
|
15
15
|
if (!menuContext?.store) {
|
|
16
16
|
throw new Error('Menu.Group can only be rendered inside a Menu component');
|
|
17
17
|
}
|
|
18
|
-
return /*#__PURE__*/_jsx(Styled.
|
|
18
|
+
return /*#__PURE__*/_jsx(Styled.Group, {
|
|
19
19
|
ref: ref,
|
|
20
20
|
...props,
|
|
21
21
|
store: menuContext.store
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useContext","
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","Context","Styled","jsx","_jsx","Group","props","ref","menuContext","store","Error"],"sources":["@wordpress/components/src/menu/group.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { Context } from './context';\nimport type { GroupProps } from './types';\nimport * as Styled from './styles';\n\nexport const Group = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< GroupProps, 'div', false >\n>( function Group( props, ref ) {\n\tconst menuContext = useContext( Context );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.Group can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn (\n\t\t<Styled.Group ref={ ref } { ...props } store={ menuContext.store } />\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAEA,SAASC,OAAO,QAAQ,WAAW;AAEnC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,KAAK,GAAGN,UAAU,CAG5B,SAASM,KAAKA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EAC/B,MAAMC,WAAW,GAAGR,UAAU,CAAEC,OAAQ,CAAC;EAEzC,IAAK,CAAEO,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,yDACD,CAAC;EACF;EAEA,oBACCN,IAAA,CAACF,MAAM,CAACG,KAAK;IAACE,GAAG,EAAGA,GAAK;IAAA,GAAMD,KAAK;IAAGG,KAAK,EAAGD,WAAW,CAACC;EAAO,CAAE,CAAC;AAEvE,CAAE,CAAC","ignoreList":[]}
|
|
@@ -13,18 +13,18 @@ import { isRTL as isRTLFn } from '@wordpress/i18n';
|
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import { useContextSystem, contextConnectWithoutRef } from '../context';
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
16
|
+
import { Context } from './context';
|
|
17
|
+
import { Item } from './item';
|
|
18
|
+
import { CheckboxItem } from './checkbox-item';
|
|
19
|
+
import { RadioItem } from './radio-item';
|
|
20
|
+
import { Group } from './group';
|
|
21
|
+
import { GroupLabel } from './group-label';
|
|
22
|
+
import { Separator } from './separator';
|
|
23
|
+
import { ItemLabel } from './item-label';
|
|
24
|
+
import { ItemHelpText } from './item-help-text';
|
|
25
|
+
import { TriggerButton } from './trigger-button';
|
|
26
|
+
import { SubmenuTriggerItem } from './submenu-trigger-item';
|
|
27
|
+
import { Popover } from './popover';
|
|
28
28
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
29
|
const UnconnectedMenu = props => {
|
|
30
30
|
const {
|
|
@@ -36,7 +36,7 @@ const UnconnectedMenu = props => {
|
|
|
36
36
|
// From internal components context
|
|
37
37
|
variant
|
|
38
38
|
} = useContextSystem(props, 'Menu');
|
|
39
|
-
const parentContext = useContext(
|
|
39
|
+
const parentContext = useContext(Context);
|
|
40
40
|
const rtl = isRTLFn();
|
|
41
41
|
|
|
42
42
|
// If an explicit value for the `placement` prop is not passed,
|
|
@@ -66,46 +66,119 @@ const UnconnectedMenu = props => {
|
|
|
66
66
|
store: menuStore,
|
|
67
67
|
variant
|
|
68
68
|
}), [menuStore, variant]);
|
|
69
|
-
return /*#__PURE__*/_jsx(
|
|
69
|
+
return /*#__PURE__*/_jsx(Context.Provider, {
|
|
70
70
|
value: contextValue,
|
|
71
71
|
children: children
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Menu is a collection of React components that combine to render
|
|
77
|
+
* ARIA-compliant [menu](https://www.w3.org/WAI/ARIA/apg/patterns/menu/) and
|
|
78
|
+
* [menu button](https://www.w3.org/WAI/ARIA/apg/patterns/menubutton/) patterns.
|
|
79
|
+
*
|
|
80
|
+
* `Menu` itself is a wrapper component and context provider.
|
|
81
|
+
* It is responsible for managing the state of the menu and its items, and for
|
|
82
|
+
* rendering the `Menu.TriggerButton` (or the `Menu.SubmenuTriggerItem`)
|
|
83
|
+
* component, and the `Menu.Popover` component.
|
|
84
|
+
*/
|
|
74
85
|
export const Menu = Object.assign(contextConnectWithoutRef(UnconnectedMenu, 'Menu'), {
|
|
75
|
-
Context: Object.assign(
|
|
86
|
+
Context: Object.assign(Context, {
|
|
76
87
|
displayName: 'Menu.Context'
|
|
77
88
|
}),
|
|
78
|
-
|
|
89
|
+
/**
|
|
90
|
+
* Renders a menu item inside the `Menu.Popover` or `Menu.Group` components.
|
|
91
|
+
*
|
|
92
|
+
* It can optionally contain one instance of the `Menu.ItemLabel` component
|
|
93
|
+
* and one instance of the `Menu.ItemHelpText` component.
|
|
94
|
+
*/
|
|
95
|
+
Item: Object.assign(Item, {
|
|
79
96
|
displayName: 'Menu.Item'
|
|
80
97
|
}),
|
|
81
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Renders a radio menu item inside the `Menu.Popover` or `Menu.Group`
|
|
100
|
+
* components.
|
|
101
|
+
*
|
|
102
|
+
* It can optionally contain one instance of the `Menu.ItemLabel` component
|
|
103
|
+
* and one instance of the `Menu.ItemHelpText` component.
|
|
104
|
+
*/
|
|
105
|
+
RadioItem: Object.assign(RadioItem, {
|
|
82
106
|
displayName: 'Menu.RadioItem'
|
|
83
107
|
}),
|
|
84
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Renders a checkbox menu item inside the `Menu.Popover` or `Menu.Group`
|
|
110
|
+
* components.
|
|
111
|
+
*
|
|
112
|
+
* It can optionally contain one instance of the `Menu.ItemLabel` component
|
|
113
|
+
* and one instance of the `Menu.ItemHelpText` component.
|
|
114
|
+
*/
|
|
115
|
+
CheckboxItem: Object.assign(CheckboxItem, {
|
|
85
116
|
displayName: 'Menu.CheckboxItem'
|
|
86
117
|
}),
|
|
87
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Renders a group for menu items.
|
|
120
|
+
*
|
|
121
|
+
* It should contain one instance of `Menu.GroupLabel` and one or more
|
|
122
|
+
* instances of `Menu.Item`, `Menu.RadioItem`, or `Menu.CheckboxItem`.
|
|
123
|
+
*/
|
|
124
|
+
Group: Object.assign(Group, {
|
|
88
125
|
displayName: 'Menu.Group'
|
|
89
126
|
}),
|
|
90
|
-
|
|
127
|
+
/**
|
|
128
|
+
* Renders a label in a menu group.
|
|
129
|
+
*
|
|
130
|
+
* This component should be wrapped with `Menu.Group` so the
|
|
131
|
+
* `aria-labelledby` is correctly set on the group element.
|
|
132
|
+
*/
|
|
133
|
+
GroupLabel: Object.assign(GroupLabel, {
|
|
91
134
|
displayName: 'Menu.GroupLabel'
|
|
92
135
|
}),
|
|
93
|
-
|
|
136
|
+
/**
|
|
137
|
+
* Renders a divider between menu items or menu groups.
|
|
138
|
+
*/
|
|
139
|
+
Separator: Object.assign(Separator, {
|
|
94
140
|
displayName: 'Menu.Separator'
|
|
95
141
|
}),
|
|
96
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Renders a menu item's label text. It should be wrapped with `Menu.Item`,
|
|
144
|
+
* `Menu.RadioItem`, or `Menu.CheckboxItem`.
|
|
145
|
+
*/
|
|
146
|
+
ItemLabel: Object.assign(ItemLabel, {
|
|
97
147
|
displayName: 'Menu.ItemLabel'
|
|
98
148
|
}),
|
|
99
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Renders a menu item's help text. It should be wrapped with `Menu.Item`,
|
|
151
|
+
* `Menu.RadioItem`, or `Menu.CheckboxItem`.
|
|
152
|
+
*/
|
|
153
|
+
ItemHelpText: Object.assign(ItemHelpText, {
|
|
100
154
|
displayName: 'Menu.ItemHelpText'
|
|
101
155
|
}),
|
|
102
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Renders a dropdown menu element that's controlled by a sibling
|
|
158
|
+
* `Menu.TriggerButton` component. It renders a popover and automatically
|
|
159
|
+
* focuses on items when the menu is shown.
|
|
160
|
+
*
|
|
161
|
+
* The only valid children of `Menu.Popover` are `Menu.Item`,
|
|
162
|
+
* `Menu.RadioItem`, `Menu.CheckboxItem`, `Menu.Group`, `Menu.Separator`,
|
|
163
|
+
* and `Menu` (for nested dropdown menus).
|
|
164
|
+
*/
|
|
165
|
+
Popover: Object.assign(Popover, {
|
|
103
166
|
displayName: 'Menu.Popover'
|
|
104
167
|
}),
|
|
105
|
-
|
|
168
|
+
/**
|
|
169
|
+
* Renders a menu button that toggles the visibility of a sibling
|
|
170
|
+
* `Menu.Popover` component when clicked or when using arrow keys.
|
|
171
|
+
*/
|
|
172
|
+
TriggerButton: Object.assign(TriggerButton, {
|
|
106
173
|
displayName: 'Menu.TriggerButton'
|
|
107
174
|
}),
|
|
108
|
-
|
|
175
|
+
/**
|
|
176
|
+
* Renders a menu item that toggles the visibility of a sibling
|
|
177
|
+
* `Menu.Popover` component when clicked or when using arrow keys.
|
|
178
|
+
*
|
|
179
|
+
* This component is used to create a nested dropdown menu.
|
|
180
|
+
*/
|
|
181
|
+
SubmenuTriggerItem: Object.assign(SubmenuTriggerItem, {
|
|
109
182
|
displayName: 'Menu.SubmenuTriggerItem'
|
|
110
183
|
})
|
|
111
184
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Ariakit","useContext","useMemo","isRTL","isRTLFn","useContextSystem","contextConnectWithoutRef","MenuContext","MenuItem","MenuCheckboxItem","MenuRadioItem","MenuGroup","MenuGroupLabel","MenuSeparator","MenuItemLabel","MenuItemHelpText","MenuTriggerButton","MenuSubmenuTriggerItem","MenuPopover","jsx","_jsx","UnconnectedMenu","props","children","defaultOpen","open","onOpenChange","placement","variant","parentContext","rtl","computedPlacement","store","test","replace","menuStore","useMenuStore","parent","focusLoop","setOpen","willBeOpen","contextValue","Provider","value","Menu","Object","assign","Context","displayName","Item","RadioItem","CheckboxItem","Group","GroupLabel","Separator","ItemLabel","ItemHelpText","Popover","TriggerButton","SubmenuTriggerItem"],"sources":["@wordpress/components/src/menu/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo } from '@wordpress/element';\nimport { isRTL as isRTLFn } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem, contextConnectWithoutRef } from '../context';\nimport type { MenuContext as MenuContextType, MenuProps } from './types';\nimport { MenuContext } from './context';\nimport { MenuItem } from './item';\nimport { MenuCheckboxItem } from './checkbox-item';\nimport { MenuRadioItem } from './radio-item';\nimport { MenuGroup } from './group';\nimport { MenuGroupLabel } from './group-label';\nimport { MenuSeparator } from './separator';\nimport { MenuItemLabel } from './item-label';\nimport { MenuItemHelpText } from './item-help-text';\nimport { MenuTriggerButton } from './trigger-button';\nimport { MenuSubmenuTriggerItem } from './submenu-trigger-item';\nimport { MenuPopover } from './popover';\n\nconst UnconnectedMenu = ( props: MenuProps ) => {\n\tconst {\n\t\tchildren,\n\t\tdefaultOpen = false,\n\t\topen,\n\t\tonOpenChange,\n\t\tplacement,\n\n\t\t// From internal components context\n\t\tvariant,\n\t} = useContextSystem<\n\t\t// @ts-expect-error TODO: missing 'className' in MenuProps\n\t\ttypeof props & Pick< MenuContextType, 'variant' >\n\t>( props, 'Menu' );\n\n\tconst parentContext = useContext( MenuContext );\n\n\tconst rtl = isRTLFn();\n\n\t// If an explicit value for the `placement` prop is not passed,\n\t// apply a default placement of `bottom-start` for the root menu popover,\n\t// and of `right-start` for nested menu popovers.\n\tlet computedPlacement =\n\t\tplacement ?? ( parentContext?.store ? 'right-start' : 'bottom-start' );\n\t// Swap left/right in case of RTL direction\n\tif ( rtl ) {\n\t\tif ( /right/.test( computedPlacement ) ) {\n\t\t\tcomputedPlacement = computedPlacement.replace(\n\t\t\t\t'right',\n\t\t\t\t'left'\n\t\t\t) as typeof computedPlacement;\n\t\t} else if ( /left/.test( computedPlacement ) ) {\n\t\t\tcomputedPlacement = computedPlacement.replace(\n\t\t\t\t'left',\n\t\t\t\t'right'\n\t\t\t) as typeof computedPlacement;\n\t\t}\n\t}\n\n\tconst menuStore = Ariakit.useMenuStore( {\n\t\tparent: parentContext?.store,\n\t\topen,\n\t\tdefaultOpen,\n\t\tplacement: computedPlacement,\n\t\tfocusLoop: true,\n\t\tsetOpen( willBeOpen ) {\n\t\t\tonOpenChange?.( willBeOpen );\n\t\t},\n\t\trtl,\n\t} );\n\n\tconst contextValue = useMemo(\n\t\t() => ( { store: menuStore, variant } ),\n\t\t[ menuStore, variant ]\n\t);\n\n\treturn (\n\t\t<MenuContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</MenuContext.Provider>\n\t);\n};\n\nexport const Menu = Object.assign(\n\tcontextConnectWithoutRef( UnconnectedMenu, 'Menu' ),\n\t{\n\t\tContext: Object.assign( MenuContext, {\n\t\t\tdisplayName: 'Menu.Context',\n\t\t} ),\n\t\tItem: Object.assign( MenuItem, {\n\t\t\tdisplayName: 'Menu.Item',\n\t\t} ),\n\t\tRadioItem: Object.assign( MenuRadioItem, {\n\t\t\tdisplayName: 'Menu.RadioItem',\n\t\t} ),\n\t\tCheckboxItem: Object.assign( MenuCheckboxItem, {\n\t\t\tdisplayName: 'Menu.CheckboxItem',\n\t\t} ),\n\t\tGroup: Object.assign( MenuGroup, {\n\t\t\tdisplayName: 'Menu.Group',\n\t\t} ),\n\t\tGroupLabel: Object.assign( MenuGroupLabel, {\n\t\t\tdisplayName: 'Menu.GroupLabel',\n\t\t} ),\n\t\tSeparator: Object.assign( MenuSeparator, {\n\t\t\tdisplayName: 'Menu.Separator',\n\t\t} ),\n\t\tItemLabel: Object.assign( MenuItemLabel, {\n\t\t\tdisplayName: 'Menu.ItemLabel',\n\t\t} ),\n\t\tItemHelpText: Object.assign( MenuItemHelpText, {\n\t\t\tdisplayName: 'Menu.ItemHelpText',\n\t\t} ),\n\t\tPopover: Object.assign( MenuPopover, {\n\t\t\tdisplayName: 'Menu.Popover',\n\t\t} ),\n\t\tTriggerButton: Object.assign( MenuTriggerButton, {\n\t\t\tdisplayName: 'Menu.TriggerButton',\n\t\t} ),\n\t\tSubmenuTriggerItem: Object.assign( MenuSubmenuTriggerItem, {\n\t\t\tdisplayName: 'Menu.SubmenuTriggerItem',\n\t\t} ),\n\t}\n);\n\nexport default Menu;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,SAASC,KAAK,IAAIC,OAAO,QAAQ,iBAAiB;;AAElD;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,wBAAwB,QAAQ,YAAY;AAEvE,SAASC,WAAW,QAAQ,WAAW;AACvC,SAASC,QAAQ,QAAQ,QAAQ;AACjC,SAASC,gBAAgB,QAAQ,iBAAiB;AAClD,SAASC,aAAa,QAAQ,cAAc;AAC5C,SAASC,SAAS,QAAQ,SAAS;AACnC,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,aAAa,QAAQ,cAAc;AAC5C,SAASC,gBAAgB,QAAQ,kBAAkB;AACnD,SAASC,iBAAiB,QAAQ,kBAAkB;AACpD,SAASC,sBAAsB,QAAQ,wBAAwB;AAC/D,SAASC,WAAW,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAExC,MAAMC,eAAe,GAAKC,KAAgB,IAAM;EAC/C,MAAM;IACLC,QAAQ;IACRC,WAAW,GAAG,KAAK;IACnBC,IAAI;IACJC,YAAY;IACZC,SAAS;IAET;IACAC;EACD,CAAC,GAAGvB,gBAAgB,CAGjBiB,KAAK,EAAE,MAAO,CAAC;EAElB,MAAMO,aAAa,GAAG5B,UAAU,CAAEM,WAAY,CAAC;EAE/C,MAAMuB,GAAG,GAAG1B,OAAO,CAAC,CAAC;;EAErB;EACA;EACA;EACA,IAAI2B,iBAAiB,GACpBJ,SAAS,aAATA,SAAS,cAATA,SAA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MAAM,CAACC,MAAM,CAAEpC,aAAa,EAAE;IACxCsC,WAAW,EAAE;EACd,CAAE,CAAC;EACHG,YAAY,EAAEN,MAAM,CAACC,MAAM,CAAErC,gBAAgB,EAAE;IAC9CuC,WAAW,EAAE;EACd,CAAE,CAAC;EACHI,KAAK,EAAEP,MAAM,CAACC,MAAM,CAAEnC,SAAS,EAAE;IAChCqC,WAAW,EAAE;EACd,CAAE,CAAC;EACHK,UAAU,EAAER,MAAM,CAACC,MAAM,CAAElC,cAAc,EAAE;IAC1CoC,WAAW,EAAE;EACd,CAAE,CAAC;EACHM,SAAS,EAAET,MAAM,CAACC,MAAM,CAAEjC,aAAa,EAAE;IACxCmC,WAAW,EAAE;EACd,CAAE,CAAC;EACHO,SAAS,EAAEV,MAAM,CAACC,MAAM,CAAEhC,aAAa,EAAE;IACxCkC,WAAW,EAAE;EACd,CAAE,CAAC;EACHQ,YAAY,EAAEX,MAAM,CAACC,MAAM,CAAE/B,gBAAgB,EAAE;IAC9CiC,WAAW,EAAE;EACd,CAAE,CAAC;EACHS,OAAO,EAAEZ,MAAM,CAACC,MAAM,CAAE5B,WAAW,EAAE;IACpC8B,WAAW,EAAE;EACd,CAAE,CAAC;EACHU,aAAa,EAAEb,MAAM,CAACC,MAAM,CAAE9B,iBAAiB,EAAE;IAChDgC,WAAW,EAAE;EACd,CAAE,CAAC;EACHW,kBAAkB,EAAEd,MAAM,CAACC,MAAM,CAAE7B,sBAAsB,EAAE;IAC1D+B,WAAW,EAAE;EACd,CAAE;AACH,CACD,CAAC;AAED,eAAeJ,IAAI","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Ariakit","useContext","useMemo","isRTL","isRTLFn","useContextSystem","contextConnectWithoutRef","Context","Item","CheckboxItem","RadioItem","Group","GroupLabel","Separator","ItemLabel","ItemHelpText","TriggerButton","SubmenuTriggerItem","Popover","jsx","_jsx","UnconnectedMenu","props","children","defaultOpen","open","onOpenChange","placement","variant","parentContext","rtl","computedPlacement","store","test","replace","menuStore","useMenuStore","parent","focusLoop","setOpen","willBeOpen","contextValue","Provider","value","Menu","Object","assign","displayName"],"sources":["@wordpress/components/src/menu/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, useMemo } from '@wordpress/element';\nimport { isRTL as isRTLFn } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useContextSystem, contextConnectWithoutRef } from '../context';\nimport type { ContextProps, Props } from './types';\nimport { Context } from './context';\nimport { Item } from './item';\nimport { CheckboxItem } from './checkbox-item';\nimport { RadioItem } from './radio-item';\nimport { Group } from './group';\nimport { GroupLabel } from './group-label';\nimport { Separator } from './separator';\nimport { ItemLabel } from './item-label';\nimport { ItemHelpText } from './item-help-text';\nimport { TriggerButton } from './trigger-button';\nimport { SubmenuTriggerItem } from './submenu-trigger-item';\nimport { Popover } from './popover';\n\nconst UnconnectedMenu = ( props: Props ) => {\n\tconst {\n\t\tchildren,\n\t\tdefaultOpen = false,\n\t\topen,\n\t\tonOpenChange,\n\t\tplacement,\n\n\t\t// From internal components context\n\t\tvariant,\n\t} = useContextSystem<\n\t\t// @ts-expect-error TODO: missing 'className' in MenuProps\n\t\ttypeof props & Pick< ContextProps, 'variant' >\n\t>( props, 'Menu' );\n\n\tconst parentContext = useContext( Context );\n\n\tconst rtl = isRTLFn();\n\n\t// If an explicit value for the `placement` prop is not passed,\n\t// apply a default placement of `bottom-start` for the root menu popover,\n\t// and of `right-start` for nested menu popovers.\n\tlet computedPlacement =\n\t\tplacement ?? ( parentContext?.store ? 'right-start' : 'bottom-start' );\n\t// Swap left/right in case of RTL direction\n\tif ( rtl ) {\n\t\tif ( /right/.test( computedPlacement ) ) {\n\t\t\tcomputedPlacement = computedPlacement.replace(\n\t\t\t\t'right',\n\t\t\t\t'left'\n\t\t\t) as typeof computedPlacement;\n\t\t} else if ( /left/.test( computedPlacement ) ) {\n\t\t\tcomputedPlacement = computedPlacement.replace(\n\t\t\t\t'left',\n\t\t\t\t'right'\n\t\t\t) as typeof computedPlacement;\n\t\t}\n\t}\n\n\tconst menuStore = Ariakit.useMenuStore( {\n\t\tparent: parentContext?.store,\n\t\topen,\n\t\tdefaultOpen,\n\t\tplacement: computedPlacement,\n\t\tfocusLoop: true,\n\t\tsetOpen( willBeOpen ) {\n\t\t\tonOpenChange?.( willBeOpen );\n\t\t},\n\t\trtl,\n\t} );\n\n\tconst contextValue = useMemo(\n\t\t() => ( { store: menuStore, variant } ),\n\t\t[ menuStore, variant ]\n\t);\n\n\treturn (\n\t\t<Context.Provider value={ contextValue }>{ children }</Context.Provider>\n\t);\n};\n\n/**\n * Menu is a collection of React components that combine to render\n * ARIA-compliant [menu](https://www.w3.org/WAI/ARIA/apg/patterns/menu/) and\n * [menu button](https://www.w3.org/WAI/ARIA/apg/patterns/menubutton/) patterns.\n *\n * `Menu` itself is a wrapper component and context provider.\n * It is responsible for managing the state of the menu and its items, and for\n * rendering the `Menu.TriggerButton` (or the `Menu.SubmenuTriggerItem`)\n * component, and the `Menu.Popover` component.\n */\nexport const Menu = Object.assign(\n\tcontextConnectWithoutRef( UnconnectedMenu, 'Menu' ),\n\t{\n\t\tContext: Object.assign( Context, {\n\t\t\tdisplayName: 'Menu.Context',\n\t\t} ),\n\t\t/**\n\t\t * Renders a menu item inside the `Menu.Popover` or `Menu.Group` components.\n\t\t *\n\t\t * It can optionally contain one instance of the `Menu.ItemLabel` component\n\t\t * and one instance of the `Menu.ItemHelpText` component.\n\t\t */\n\t\tItem: Object.assign( Item, {\n\t\t\tdisplayName: 'Menu.Item',\n\t\t} ),\n\t\t/**\n\t\t * Renders a radio menu item inside the `Menu.Popover` or `Menu.Group`\n\t\t * components.\n\t\t *\n\t\t * It can optionally contain one instance of the `Menu.ItemLabel` component\n\t\t * and one instance of the `Menu.ItemHelpText` component.\n\t\t */\n\t\tRadioItem: Object.assign( RadioItem, {\n\t\t\tdisplayName: 'Menu.RadioItem',\n\t\t} ),\n\t\t/**\n\t\t * Renders a checkbox menu item inside the `Menu.Popover` or `Menu.Group`\n\t\t * components.\n\t\t *\n\t\t * It can optionally contain one instance of the `Menu.ItemLabel` component\n\t\t * and one instance of the `Menu.ItemHelpText` component.\n\t\t */\n\t\tCheckboxItem: Object.assign( CheckboxItem, {\n\t\t\tdisplayName: 'Menu.CheckboxItem',\n\t\t} ),\n\t\t/**\n\t\t * Renders a group for menu items.\n\t\t *\n\t\t * It should contain one instance of `Menu.GroupLabel` and one or more\n\t\t * instances of `Menu.Item`, `Menu.RadioItem`, or `Menu.CheckboxItem`.\n\t\t */\n\t\tGroup: Object.assign( Group, {\n\t\t\tdisplayName: 'Menu.Group',\n\t\t} ),\n\t\t/**\n\t\t * Renders a label in a menu group.\n\t\t *\n\t\t * This component should be wrapped with `Menu.Group` so the\n\t\t * `aria-labelledby` is correctly set on the group element.\n\t\t */\n\t\tGroupLabel: Object.assign( GroupLabel, {\n\t\t\tdisplayName: 'Menu.GroupLabel',\n\t\t} ),\n\t\t/**\n\t\t * Renders a divider between menu items or menu groups.\n\t\t */\n\t\tSeparator: Object.assign( Separator, {\n\t\t\tdisplayName: 'Menu.Separator',\n\t\t} ),\n\t\t/**\n\t\t * Renders a menu item's label text. It should be wrapped with `Menu.Item`,\n\t\t * `Menu.RadioItem`, or `Menu.CheckboxItem`.\n\t\t */\n\t\tItemLabel: Object.assign( ItemLabel, {\n\t\t\tdisplayName: 'Menu.ItemLabel',\n\t\t} ),\n\t\t/**\n\t\t * Renders a menu item's help text. It should be wrapped with `Menu.Item`,\n\t\t * `Menu.RadioItem`, or `Menu.CheckboxItem`.\n\t\t */\n\t\tItemHelpText: Object.assign( ItemHelpText, {\n\t\t\tdisplayName: 'Menu.ItemHelpText',\n\t\t} ),\n\t\t/**\n\t\t * Renders a dropdown menu element that's controlled by a sibling\n\t\t * `Menu.TriggerButton` component. It renders a popover and automatically\n\t\t * focuses on items when the menu is shown.\n\t\t *\n\t\t * The only valid children of `Menu.Popover` are `Menu.Item`,\n\t\t * `Menu.RadioItem`, `Menu.CheckboxItem`, `Menu.Group`, `Menu.Separator`,\n\t\t * and `Menu` (for nested dropdown menus).\n\t\t */\n\t\tPopover: Object.assign( Popover, {\n\t\t\tdisplayName: 'Menu.Popover',\n\t\t} ),\n\t\t/**\n\t\t * Renders a menu button that toggles the visibility of a sibling\n\t\t * `Menu.Popover` component when clicked or when using arrow keys.\n\t\t */\n\t\tTriggerButton: Object.assign( TriggerButton, {\n\t\t\tdisplayName: 'Menu.TriggerButton',\n\t\t} ),\n\t\t/**\n\t\t * Renders a menu item that toggles the visibility of a sibling\n\t\t * `Menu.Popover` component when clicked or when using arrow keys.\n\t\t *\n\t\t * This component is used to create a nested dropdown menu.\n\t\t */\n\t\tSubmenuTriggerItem: Object.assign( SubmenuTriggerItem, {\n\t\t\tdisplayName: 'Menu.SubmenuTriggerItem',\n\t\t} ),\n\t}\n);\n\nexport default Menu;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,OAAO,MAAM,gBAAgB;;AAEzC;AACA;AACA;AACA,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,SAASC,KAAK,IAAIC,OAAO,QAAQ,iBAAiB;;AAElD;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,wBAAwB,QAAQ,YAAY;AAEvE,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,KAAK,QAAQ,SAAS;AAC/B,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,SAASC,OAAO,QAAQ,WAAW;AAAC,SAA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Y,EAAE8B,MAAM,CAACC,MAAM,CAAE/B,YAAY,EAAE;IAC1CgC,WAAW,EAAE;EACd,CAAE,CAAC;EACH;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE7B,OAAO,EAAE2B,MAAM,CAACC,MAAM,CAAE5B,OAAO,EAAE;IAChC6B,WAAW,EAAE;EACd,CAAE,CAAC;EACH;AACF;AACA;AACA;EACE/B,aAAa,EAAE6B,MAAM,CAACC,MAAM,CAAE9B,aAAa,EAAE;IAC5C+B,WAAW,EAAE;EACd,CAAE,CAAC;EACH;AACF;AACA;AACA;AACA;AACA;EACE9B,kBAAkB,EAAE4B,MAAM,CAACC,MAAM,CAAE7B,kBAAkB,EAAE;IACtD8B,WAAW,EAAE;EACd,CAAE;AACH,CACD,CAAC;AAED,eAAeH,IAAI","ignoreList":[]}
|
|
@@ -7,15 +7,15 @@ import { forwardRef, useContext } from '@wordpress/element';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { Context } from './context';
|
|
11
11
|
import * as Styled from './styles';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
export const
|
|
14
|
-
const menuContext = useContext(
|
|
13
|
+
export const ItemHelpText = forwardRef(function ItemHelpText(props, ref) {
|
|
14
|
+
const menuContext = useContext(Context);
|
|
15
15
|
if (!menuContext?.store) {
|
|
16
16
|
throw new Error('Menu.ItemHelpText can only be rendered inside a Menu component');
|
|
17
17
|
}
|
|
18
|
-
return /*#__PURE__*/_jsx(Styled.
|
|
18
|
+
return /*#__PURE__*/_jsx(Styled.ItemHelpText, {
|
|
19
19
|
numberOfLines: 2,
|
|
20
20
|
ref: ref,
|
|
21
21
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useContext","
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","Context","Styled","jsx","_jsx","ItemHelpText","props","ref","menuContext","store","Error","numberOfLines"],"sources":["@wordpress/components/src/menu/item-help-text.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { Context } from './context';\nimport * as Styled from './styles';\n\nexport const ItemHelpText = forwardRef<\n\tHTMLSpanElement,\n\tWordPressComponentProps< { children: React.ReactNode }, 'span', true >\n>( function ItemHelpText( props, ref ) {\n\tconst menuContext = useContext( Context );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.ItemHelpText can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn <Styled.ItemHelpText numberOfLines={ 2 } ref={ ref } { ...props } />;\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAEA,SAASC,OAAO,QAAQ,WAAW;AACnC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,YAAY,GAAGN,UAAU,CAGnC,SAASM,YAAYA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACtC,MAAMC,WAAW,GAAGR,UAAU,CAAEC,OAAQ,CAAC;EAEzC,IAAK,CAAEO,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,gEACD,CAAC;EACF;EAEA,oBAAON,IAAA,CAACF,MAAM,CAACG,YAAY;IAACM,aAAa,EAAG,CAAG;IAACJ,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AAC5E,CAAE,CAAC","ignoreList":[]}
|
|
@@ -7,15 +7,15 @@ import { forwardRef, useContext } from '@wordpress/element';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { Context } from './context';
|
|
11
11
|
import * as Styled from './styles';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
export const
|
|
14
|
-
const menuContext = useContext(
|
|
13
|
+
export const ItemLabel = forwardRef(function ItemLabel(props, ref) {
|
|
14
|
+
const menuContext = useContext(Context);
|
|
15
15
|
if (!menuContext?.store) {
|
|
16
16
|
throw new Error('Menu.ItemLabel can only be rendered inside a Menu component');
|
|
17
17
|
}
|
|
18
|
-
return /*#__PURE__*/_jsx(Styled.
|
|
18
|
+
return /*#__PURE__*/_jsx(Styled.ItemLabel, {
|
|
19
19
|
numberOfLines: 1,
|
|
20
20
|
ref: ref,
|
|
21
21
|
...props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useContext","
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","Context","Styled","jsx","_jsx","ItemLabel","props","ref","menuContext","store","Error","numberOfLines"],"sources":["@wordpress/components/src/menu/item-label.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport { Context } from './context';\nimport * as Styled from './styles';\n\nexport const ItemLabel = forwardRef<\n\tHTMLSpanElement,\n\tWordPressComponentProps< { children: React.ReactNode }, 'span', true >\n>( function ItemLabel( props, ref ) {\n\tconst menuContext = useContext( Context );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.ItemLabel can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\treturn <Styled.ItemLabel numberOfLines={ 1 } ref={ ref } { ...props } />;\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAEA,SAASC,OAAO,QAAQ,WAAW;AACnC,OAAO,KAAKC,MAAM,MAAM,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEnC,OAAO,MAAMC,SAAS,GAAGN,UAAU,CAGhC,SAASM,SAASA,CAAEC,KAAK,EAAEC,GAAG,EAAG;EACnC,MAAMC,WAAW,GAAGR,UAAU,CAAEC,OAAQ,CAAC;EAEzC,IAAK,CAAEO,WAAW,EAAEC,KAAK,EAAG;IAC3B,MAAM,IAAIC,KAAK,CACd,6DACD,CAAC;EACF;EAEA,oBAAON,IAAA,CAACF,MAAM,CAACG,SAAS;IAACM,aAAa,EAAG,CAAG;IAACJ,GAAG,EAAGA,GAAK;IAAA,GAAMD;EAAK,CAAI,CAAC;AACzE,CAAE,CAAC","ignoreList":[]}
|
|
@@ -8,9 +8,9 @@ import { forwardRef, useContext } from '@wordpress/element';
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import * as Styled from './styles';
|
|
11
|
-
import {
|
|
11
|
+
import { Context } from './context';
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
export const
|
|
13
|
+
export const Item = forwardRef(function Item({
|
|
14
14
|
prefix,
|
|
15
15
|
suffix,
|
|
16
16
|
children,
|
|
@@ -19,7 +19,7 @@ export const MenuItem = forwardRef(function MenuItem({
|
|
|
19
19
|
store,
|
|
20
20
|
...props
|
|
21
21
|
}, ref) {
|
|
22
|
-
const menuContext = useContext(
|
|
22
|
+
const menuContext = useContext(Context);
|
|
23
23
|
if (!menuContext?.store) {
|
|
24
24
|
throw new Error('Menu.Item can only be rendered inside a Menu component');
|
|
25
25
|
}
|
|
@@ -29,7 +29,7 @@ export const MenuItem = forwardRef(function MenuItem({
|
|
|
29
29
|
// `Menu.SubmenuTriggerItem`), the context store wouldn't be correct. This is
|
|
30
30
|
// why the component accepts a `store` prop to override the context store.
|
|
31
31
|
const computedStore = store !== null && store !== void 0 ? store : menuContext.store;
|
|
32
|
-
return /*#__PURE__*/_jsxs(Styled.
|
|
32
|
+
return /*#__PURE__*/_jsxs(Styled.Item, {
|
|
33
33
|
ref: ref,
|
|
34
34
|
...props,
|
|
35
35
|
accessibleWhenDisabled: true,
|
|
@@ -38,8 +38,8 @@ export const MenuItem = forwardRef(function MenuItem({
|
|
|
38
38
|
store: computedStore,
|
|
39
39
|
children: [/*#__PURE__*/_jsx(Styled.ItemPrefixWrapper, {
|
|
40
40
|
children: prefix
|
|
41
|
-
}), /*#__PURE__*/_jsxs(Styled.
|
|
42
|
-
children: [/*#__PURE__*/_jsx(Styled.
|
|
41
|
+
}), /*#__PURE__*/_jsxs(Styled.ItemContentWrapper, {
|
|
42
|
+
children: [/*#__PURE__*/_jsx(Styled.ItemChildrenWrapper, {
|
|
43
43
|
children: children
|
|
44
44
|
}), suffix && /*#__PURE__*/_jsx(Styled.ItemSuffixWrapper, {
|
|
45
45
|
children: suffix
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","useContext","Styled","
|
|
1
|
+
{"version":3,"names":["forwardRef","useContext","Styled","Context","jsx","_jsx","jsxs","_jsxs","Item","prefix","suffix","children","disabled","hideOnClick","store","props","ref","menuContext","Error","computedStore","accessibleWhenDisabled","ItemPrefixWrapper","ItemContentWrapper","ItemChildrenWrapper","ItemSuffixWrapper"],"sources":["@wordpress/components/src/menu/item.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../context';\nimport type { ItemProps } from './types';\nimport * as Styled from './styles';\nimport { Context } from './context';\n\nexport const Item = forwardRef<\n\tHTMLDivElement,\n\tWordPressComponentProps< ItemProps, 'div', false >\n>( function Item(\n\t{\n\t\tprefix,\n\t\tsuffix,\n\t\tchildren,\n\t\tdisabled = false,\n\t\thideOnClick = true,\n\t\tstore,\n\t\t...props\n\t},\n\tref\n) {\n\tconst menuContext = useContext( Context );\n\n\tif ( ! menuContext?.store ) {\n\t\tthrow new Error(\n\t\t\t'Menu.Item can only be rendered inside a Menu component'\n\t\t);\n\t}\n\n\t// In most cases, the menu store will be retrieved from context (ie. the store\n\t// created by the top-level menu component). But in rare cases (ie.\n\t// `Menu.SubmenuTriggerItem`), the context store wouldn't be correct. This is\n\t// why the component accepts a `store` prop to override the context store.\n\tconst computedStore = store ?? menuContext.store;\n\n\treturn (\n\t\t<Styled.Item\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\taccessibleWhenDisabled\n\t\t\tdisabled={ disabled }\n\t\t\thideOnClick={ hideOnClick }\n\t\t\tstore={ computedStore }\n\t\t>\n\t\t\t<Styled.ItemPrefixWrapper>{ prefix }</Styled.ItemPrefixWrapper>\n\n\t\t\t<Styled.ItemContentWrapper>\n\t\t\t\t<Styled.ItemChildrenWrapper>\n\t\t\t\t\t{ children }\n\t\t\t\t</Styled.ItemChildrenWrapper>\n\n\t\t\t\t{ suffix && (\n\t\t\t\t\t<Styled.ItemSuffixWrapper>\n\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t</Styled.ItemSuffixWrapper>\n\t\t\t\t) }\n\t\t\t</Styled.ItemContentWrapper>\n\t\t</Styled.Item>\n\t);\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;;AAE3D;AACA;AACA;;AAGA,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,OAAO,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEpC,OAAO,MAAMC,IAAI,GAAGR,UAAU,CAG3B,SAASQ,IAAIA,CACf;EACCC,MAAM;EACNC,MAAM;EACNC,QAAQ;EACRC,QAAQ,GAAG,KAAK;EAChBC,WAAW,GAAG,IAAI;EAClBC,KAAK;EACL,GAAGC;AACJ,CAAC,EACDC,GAAG,EACF;EACD,MAAMC,WAAW,GAAGhB,UAAU,CAAEE,OAAQ,CAAC;EAEzC,IAAK,CAAEc,WAAW,EAAEH,KAAK,EAAG;IAC3B,MAAM,IAAII,KAAK,CACd,wDACD,CAAC;EACF;;EAEA;EACA;EACA;EACA;EACA,MAAMC,aAAa,GAAGL,KAAK,aAALA,KAAK,cAALA,KAAK,GAAIG,WAAW,CAACH,KAAK;EAEhD,oBACCP,KAAA,CAACL,MAAM,CAACM,IAAI;IACXQ,GAAG,EAAGA,GAAK;IAAA,GACND,KAAK;IACVK,sBAAsB;IACtBR,QAAQ,EAAGA,QAAU;IACrBC,WAAW,EAAGA,WAAa;IAC3BC,KAAK,EAAGK,aAAe;IAAAR,QAAA,gBAEvBN,IAAA,CAACH,MAAM,CAACmB,iBAAiB;MAAAV,QAAA,EAAGF;IAAM,CAA4B,CAAC,eAE/DF,KAAA,CAACL,MAAM,CAACoB,kBAAkB;MAAAX,QAAA,gBACzBN,IAAA,CAACH,MAAM,CAACqB,mBAAmB;QAAAZ,QAAA,EACxBA;MAAQ,CACiB,CAAC,EAE3BD,MAAM,iBACPL,IAAA,CAACH,MAAM,CAACsB,iBAAiB;QAAAb,QAAA,EACtBD;MAAM,CACiB,CAC1B;IAAA,CACyB,CAAC;EAAA,CAChB,CAAC;AAEhB,CAAE,CAAC","ignoreList":[]}
|
|
@@ -13,16 +13,16 @@ import { useContext, useMemo, forwardRef, useCallback } from '@wordpress/element
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import * as Styled from './styles';
|
|
16
|
-
import {
|
|
16
|
+
import { Context } from './context';
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
-
export const
|
|
18
|
+
export const Popover = forwardRef(function Popover({
|
|
19
19
|
gutter,
|
|
20
20
|
children,
|
|
21
21
|
shift,
|
|
22
22
|
modal = true,
|
|
23
23
|
...otherProps
|
|
24
24
|
}, ref) {
|
|
25
|
-
const menuContext = useContext(
|
|
25
|
+
const menuContext = useContext(Context);
|
|
26
26
|
|
|
27
27
|
// Extract the side from the applied placement — useful for animations.
|
|
28
28
|
// Using `currentPlacement` instead of `placement` to make sure that we
|
|
@@ -69,9 +69,9 @@ export const MenuPopover = forwardRef(function MenuPopover({
|
|
|
69
69
|
// container scales with a different factor than its contents.
|
|
70
70
|
// The {...renderProps} are passed to the inner wrapper, so that the
|
|
71
71
|
// menu element is the direct parent of the menu item elements.
|
|
72
|
-
_jsx(Styled.
|
|
72
|
+
_jsx(Styled.PopoverOuterWrapper, {
|
|
73
73
|
variant: menuContext.variant,
|
|
74
|
-
children: /*#__PURE__*/_jsx(Styled.
|
|
74
|
+
children: /*#__PURE__*/_jsx(Styled.PopoverInnerWrapper, {
|
|
75
75
|
...renderProps
|
|
76
76
|
})
|
|
77
77
|
}),
|