@wordpress/components 25.1.4 → 25.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 +20 -5
- package/build/guide/index.js +10 -11
- package/build/guide/index.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +2 -1
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/number-control/index.js.map +1 -1
- package/build/range-control/index.js +7 -1
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/input-range.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +35 -36
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/unit-control/index.js +4 -2
- package/build/unit-control/index.js.map +1 -1
- package/build-module/guide/index.js +10 -10
- package/build-module/guide/index.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +2 -1
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/number-control/index.js.map +1 -1
- package/build-module/range-control/index.js +6 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/input-range.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +35 -36
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/unit-control/index.js +3 -2
- package/build-module/unit-control/index.js.map +1 -1
- package/build-style/style-rtl.css +3 -7
- package/build-style/style.css +3 -7
- package/build-types/color-picker/styles.d.ts +2 -1
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/guide/index.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +15 -2
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/input-range.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +4 -2
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +6 -0
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/dropdown-menu/style.scss +9 -13
- package/src/guide/index.tsx +10 -13
- package/src/mobile/bottom-sheet/cell.native.js +1 -0
- package/src/number-control/index.tsx +0 -1
- package/src/range-control/index.tsx +14 -2
- package/src/range-control/input-range.tsx +0 -1
- package/src/range-control/styles/range-control-styles.ts +12 -3
- package/src/range-control/types.ts +6 -0
- package/src/unit-control/index.tsx +3 -2
- package/src/unit-control/test/index.tsx +5 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/range-control/styles/range-control-styles.ts"],"names":["css","NumberControl","COLORS","reduceMotion","rtl","space","rangeHeightValue","railHeight","rangeHeight","height","minHeight","thumbSize","Root","wrapperColor","color","ui","borderFocus","wrapperMargin","marks","__nextHasNoMarginBottom","marginBottom","undefined","Wrapper","BeforeIconWrapper","marginRight","AfterIconWrapper","marginLeft","railBackgroundColor","disabled","railColor","background","backgroundDisabled","Rail","gray","trackBackgroundColor","trackColor","Track","MarksWrapper","markFill","isFilled","backgroundColor","Mark","markLabelFill","MarkLabel","thumbColor","theme","ThumbWrapper","transform","thumbFocus","isFocused","Thumb","InputRange","tooltipShow","show","opacity","tooltipPosition","position","isBottom","Tooltip","InputNumber","ActionRightWrapper"],"mappings":";;;;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,gBAApB;;AAGA;AACA;AACA;AACA,OAAOC,aAAP,MAA0B,sBAA1B;AACA,SAASC,MAAT,EAAiBC,YAAjB,EAA+BC,GAA/B,QAA0C,aAA1C;AACA,SAASC,KAAT,QAAsB,sBAAtB;AAWA,MAAMC,gBAAgB,GAAG,EAAzB;AACA,MAAMC,UAAU,GAAG,CAAnB;;AACA,MAAMC,WAAW,GAAG,mBACnBR,GAAG,CAAE;AAAES,EAAAA,MAAM,EAAEH,gBAAV;AAA4BI,EAAAA,SAAS,EAAEJ;AAAvC,CAAF,ynTADJ;;AAEA,MAAMK,SAAS,GAAG,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ependencies\n */\nimport NumberControl from '../../number-control';\nimport { COLORS, reduceMotion, rtl } from '../../utils';\nimport { space } from '../../ui/utils/space';\n\nimport type {\n\tRangeMarkProps,\n\tRailProps,\n\tThumbProps,\n\tTooltipProps,\n\tTrackProps,\n\tWrapperProps,\n} from '../types';\n\nconst rangeHeightValue = 30;\nconst railHeight = 4;\nconst rangeHeight = () =>\n\tcss( { height: rangeHeightValue, minHeight: rangeHeightValue } );\nconst thumbSize = 12;\n\nexport const Root = styled.div`\n\t-webkit-tap-highlight-color: transparent;\n\talign-items: flex-start;\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\tpadding: 0;\n\tposition: relative;\n\ttouch-action: none;\n\twidth: 100%;\n`;\n\nconst wrapperColor = ( { color = COLORS.ui.borderFocus }: WrapperProps ) =>\n\tcss( { color } );\n\nconst wrapperMargin = ( { marks, __nextHasNoMarginBottom }: WrapperProps ) => {\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\treturn css( { marginBottom: marks ? 16 : undefined } );\n\t}\n\treturn '';\n};\n\nexport const Wrapper = styled.div< WrapperProps >`\n\tdisplay: block;\n\tflex: 1;\n\tposition: relative;\n\twidth: 100%;\n\n\t${ wrapperColor };\n\t${ rangeHeight };\n\t${ wrapperMargin };\n`;\n\nexport const BeforeIconWrapper = styled.span`\n\tdisplay: flex; // ensures the height isn't affected by line-height\n\tmargin-top: ${ railHeight }px;\n\n\t${ rtl( { marginRight: 6 } ) }\n`;\n\nexport const AfterIconWrapper = styled.span`\n\tdisplay: flex; // ensures the height isn't affected by line-height\n\tmargin-top: ${ railHeight }px;\n\n\t${ rtl( { marginLeft: 6 } ) }\n`;\n\nconst railBackgroundColor = ( { disabled, railColor }: RailProps ) => {\n\tlet background = railColor || '';\n\n\tif ( disabled ) {\n\t\tbackground = COLORS.ui.backgroundDisabled;\n\t}\n\n\treturn css( { background } );\n};\n\nexport const Rail = styled.span`\n\tbackground-color: ${ COLORS.gray[ 300 ] };\n\tleft: 0;\n\tpointer-events: none;\n\tright: 0;\n\tdisplay: block;\n\theight: ${ railHeight }px;\n\tposition: absolute;\n\tmargin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px;\n\ttop: 0;\n\tborder-radius: ${ railHeight }px;\n\n\t${ railBackgroundColor };\n`;\n\nconst trackBackgroundColor = ( { disabled, trackColor }: TrackProps ) => {\n\tlet background = trackColor || 'currentColor';\n\n\tif ( disabled ) {\n\t\tbackground = COLORS.gray[ 400 ];\n\t}\n\n\treturn css( { background } );\n};\n\nexport const Track = styled.span`\n\tbackground-color: currentColor;\n\tborder-radius: ${ railHeight }px;\n\theight: ${ railHeight }px;\n\tpointer-events: none;\n\tdisplay: block;\n\tposition: absolute;\n\tmargin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px;\n\ttop: 0;\n\n\t${ trackBackgroundColor };\n`;\n\nexport const MarksWrapper = styled.span`\n\tdisplay: block;\n\tpointer-events: none;\n\tposition: relative;\n\twidth: 100%;\n\tuser-select: none;\n`;\n\nconst markFill = ( { disabled, isFilled }: RangeMarkProps ) => {\n\tlet backgroundColor = isFilled ? 'currentColor' : COLORS.gray[ 300 ];\n\n\tif ( disabled ) {\n\t\tbackgroundColor = COLORS.gray[ 400 ];\n\t}\n\n\treturn css( {\n\t\tbackgroundColor,\n\t} );\n};\n\nexport const Mark = styled.span`\n\theight: ${ thumbSize }px;\n\tleft: 0;\n\tposition: absolute;\n\ttop: -4px;\n\twidth: 1px;\n\n\t${ markFill };\n`;\n\nconst markLabelFill = ( { isFilled }: RangeMarkProps ) => {\n\treturn css( {\n\t\tcolor: isFilled ? COLORS.gray[ 700 ] : COLORS.gray[ 300 ],\n\t} );\n};\n\nexport const MarkLabel = styled.span`\n\tcolor: ${ COLORS.gray[ 300 ] };\n\tleft: 0;\n\tfont-size: 11px;\n\tposition: absolute;\n\ttop: 12px;\n\ttransform: translateX( -50% );\n\twhite-space: nowrap;\n\n\t${ markLabelFill };\n`;\n\nconst thumbColor = ( { disabled }: ThumbProps ) =>\n\tdisabled\n\t\t? css`\n\t\t\t\tbackground-color: ${ COLORS.gray[ 400 ] };\n\t\t `\n\t\t: css`\n\t\t\t\tbackground-color: ${ COLORS.ui.theme };\n\t\t `;\n\nexport const ThumbWrapper = styled.span`\n\talign-items: center;\n\tdisplay: flex;\n\theight: ${ thumbSize }px;\n\tjustify-content: center;\n\tmargin-top: ${ ( rangeHeightValue - thumbSize ) / 2 }px;\n\toutline: 0;\n\tpointer-events: none;\n\tposition: absolute;\n\ttop: 0;\n\tuser-select: none;\n\twidth: ${ thumbSize }px;\n\tborder-radius: 50%;\n\n\t${ thumbColor };\n\t${ rtl( { marginLeft: -10 } ) };\n\t${ rtl(\n\t\t{ transform: 'translateX( 4.5px )' },\n\t\t{ transform: 'translateX( -4.5px )' }\n\t) };\n`;\n\nconst thumbFocus = ( { isFocused }: ThumbProps ) => {\n\treturn isFocused\n\t\t? css`\n\t\t\t\t&::before {\n\t\t\t\t\tcontent: ' ';\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tbackground-color: ${ COLORS.ui.theme };\n\t\t\t\t\topacity: 0.4;\n\t\t\t\t\tborder-radius: 50%;\n\t\t\t\t\theight: ${ thumbSize + 8 }px;\n\t\t\t\t\twidth: ${ thumbSize + 8 }px;\n\t\t\t\t\ttop: -4px;\n\t\t\t\t\tleft: -4px;\n\t\t\t\t}\n\t\t `\n\t\t: '';\n};\n\nexport const Thumb = styled.span< ThumbProps >`\n\talign-items: center;\n\tborder-radius: 50%;\n\theight: 100%;\n\toutline: 0;\n\tposition: absolute;\n\tuser-select: none;\n\twidth: 100%;\n\n\t${ thumbColor };\n\t${ thumbFocus };\n`;\n\nexport const InputRange = styled.input`\n\tbox-sizing: border-box;\n\tcursor: pointer;\n\tdisplay: block;\n\theight: 100%;\n\tleft: 0;\n\tmargin: 0 -${ thumbSize / 2 }px;\n\topacity: 0;\n\toutline: none;\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\twidth: calc( 100% + ${ thumbSize }px );\n`;\n\nconst tooltipShow = ( { show }: TooltipProps ) => {\n\treturn css( {\n\t\topacity: show ? 1 : 0,\n\t} );\n};\n\nconst tooltipPosition = ( { position }: TooltipProps ) => {\n\tconst isBottom = position === 'bottom';\n\n\tif ( isBottom ) {\n\t\treturn css`\n\t\t\tbottom: -80%;\n\t\t`;\n\t}\n\n\treturn css`\n\t\ttop: -80%;\n\t`;\n};\n\nexport const Tooltip = styled.span< TooltipProps >`\n\tbackground: rgba( 0, 0, 0, 0.8 );\n\tborder-radius: 2px;\n\tcolor: white;\n\tdisplay: inline-block;\n\tfont-size: 12px;\n\tmin-width: 32px;\n\topacity: 0;\n\tpadding: 4px 8px;\n\tpointer-events: none;\n\tposition: absolute;\n\ttext-align: center;\n\ttransition: opacity 120ms ease;\n\tuser-select: none;\n\tline-height: 1.4;\n\n\t${ tooltipShow };\n\t${ tooltipPosition };\n\t${ reduceMotion( 'transition' ) };\n\t${ rtl(\n\t\t{ transform: 'translateX(-50%)' },\n\t\t{ transform: 'translateX(50%)' }\n\t) }\n`;\n\n// @todo: Refactor RangeControl with latest HStack configuration\n// @wordpress/components/ui/hstack.\nexport const InputNumber = styled( NumberControl )`\n\tdisplay: inline-block;\n\tfont-size: 13px;\n\tmargin-top: 0;\n\twidth: ${ space( 16 ) } !important;\n\n\tinput[type='number']& {\n\t\t${ rangeHeight };\n\t}\n\n\t${ rtl( { marginLeft: `${ space( 4 ) } !important` } ) }\n`;\n\nexport const ActionRightWrapper = styled.span`\n\tdisplay: block;\n\tmargin-top: 0;\n\n\tbutton,\n\tbutton.is-small {\n\t\tmargin-left: 0;\n\t\t${ rangeHeight };\n\t}\n\n\t${ rtl( { marginLeft: 8 } ) }\n`;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/range-control/styles/range-control-styles.ts"],"names":["css","NumberControl","COLORS","reduceMotion","rtl","space","rangeHeightValue","railHeight","rangeHeight","height","minHeight","thumbSize","deprecatedHeight","__next40pxDefaultSize","Root","wrapperColor","color","ui","borderFocus","wrapperMargin","marks","__nextHasNoMarginBottom","marginBottom","undefined","Wrapper","BeforeIconWrapper","marginRight","AfterIconWrapper","marginLeft","railBackgroundColor","disabled","railColor","background","backgroundDisabled","Rail","gray","trackBackgroundColor","trackColor","Track","MarksWrapper","markFill","isFilled","backgroundColor","Mark","markLabelFill","MarkLabel","thumbColor","theme","ThumbWrapper","transform","thumbFocus","isFocused","Thumb","InputRange","tooltipShow","show","opacity","tooltipPosition","position","isBottom","Tooltip","InputNumber","ActionRightWrapper"],"mappings":";;;;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,gBAApB;;AAGA;AACA;AACA;AACA,OAAOC,aAAP,MAA0B,sBAA1B;AACA,SAASC,MAAT,EAAiBC,YAAjB,EAA+BC,GAA/B,QAA0C,aAA1C;AACA,SAASC,KAAT,QAAsB,sBAAtB;AAYA,MAAMC,gBAAgB,GAAG,EAAzB;AACA,MAAMC,UAAU,GAAG,CAAnB;;AACA,MAAMC,WAAW,GAAG,mBACnBR,GAAG,CAAE;AAAES,EAAAA,MAAM,EAAEH,gBAAV;AAA4BI,EAAAA,SAAS,EAAEJ;AAAvC,CAAF,imUADJ;;AAEA,MAAMK,SAAS,GAAG,EAAlB;;AAEA,MAAMC,gBAAgB,GAAG,CAAE;AAC1BC,EAAAA;AAD0B,CAAF,KAGxB,CAAEA,qBAAF,iBAA2Bb,GAAG,CAAE;AAAEU,EAAAA,SAAS,EAAEJ;AAAb,CAAF,smUAH/B;;AAMA,OAAO,MAAMQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,mLAWbF,gBAXa,qiUAAV;;AAcP,MAAMG,YAAY,GAAG,CAAE;AAAEC,EAAAA,KAAK,GAAGd,MAAM,CAACe,EAAP,CAAUC;AAApB,CAAF,kBACpBlB,GAAG,CAAE;AAAEgB,EAAAA;AAAF,CAAF,kmUADJ;;AAGA,MAAMG,aAAa,GAAG,CAAE;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAF,KA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,EAAAA;AAAF,CAAF,KAAkC;AACzD,QAAMC,QAAQ,GAAGD,QAAQ,KAAK,QAA9B;;AAEA,MAAKC,QAAL,EAAgB;AACf;AAGA;;AAED;AAGA,CAZD;;AAcA,OAAO,MAAMC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,yQAgBhBN,WAhBgB,OAiBhBG,eAjBgB,OAkBhBtD,YAAY,CAAE,YAAF,CAlBI,OAmBhBC,GAAG,CACL;AAAE6C,EAAAA,SAAS,EAAE;AAAb,CADK,EAEL;AAAEA,EAAAA,SAAS,EAAE;AAAb,CAFK,CAnBa,qiUAAb,C,CAyBP;AACA;;AACA,OAAO,MAAMY,WAAW,GAAG,qBAAQ5D,aAAR;AAAA;AAAA;AAAA;AAAA;AAAA,EAAH,4EAMnBO,WANmB,QASpBJ,GAAG,CAAE;AAAEwB,EAAAA,UAAU,EAAG,GAAGvB,KAAK,CAAE,CAAF,CAAO;AAA9B,CAAF,CATiB,qiUAAjB;AAYP,OAAO,MAAMyD,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,uEAO1BtD,WAP0B,QAU3BJ,GAAG,CAAE;AAAEwB,EAAAA,UAAU,EAAE;AAAd,CAAF,CAVwB,qiUAAxB","sourcesContent":["/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\nimport styled from '@emotion/styled';\n\n/**\n * Internal dependencies\n */\nimport NumberControl from '../../number-control';\nimport { COLORS, reduceMotion, rtl } from '../../utils';\nimport { space } from '../../ui/utils/space';\n\nimport type {\n\tRangeMarkProps,\n\tRailProps,\n\tThumbProps,\n\tTooltipProps,\n\tTrackProps,\n\tWrapperProps,\n\tRangeControlProps,\n} from '../types';\n\nconst rangeHeightValue = 30;\nconst railHeight = 4;\nconst rangeHeight = () =>\n\tcss( { height: rangeHeightValue, minHeight: rangeHeightValue } );\nconst thumbSize = 12;\n\nconst deprecatedHeight = ( {\n\t__next40pxDefaultSize,\n}: Pick< RangeControlProps, '__next40pxDefaultSize' > ) =>\n\t! __next40pxDefaultSize && css( { minHeight: rangeHeightValue } );\n\ntype RootProps = Pick< RangeControlProps, '__next40pxDefaultSize' >;\nexport const Root = styled.div< RootProps >`\n\t-webkit-tap-highlight-color: transparent;\n\talign-items: center;\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\tpadding: 0;\n\tposition: relative;\n\ttouch-action: none;\n\twidth: 100%;\n\tmin-height: 40px;\n\t/* TODO: remove after removing the __next40pxDefaultSize prop */\n\t${ deprecatedHeight };\n`;\n\nconst wrapperColor = ( { color = COLORS.ui.borderFocus }: WrapperProps ) =>\n\tcss( { color } );\n\nconst wrapperMargin = ( { marks, __nextHasNoMarginBottom }: WrapperProps ) => {\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\treturn css( { marginBottom: marks ? 16 : undefined } );\n\t}\n\treturn '';\n};\n\nexport const Wrapper = styled.div< WrapperProps >`\n\tdisplay: block;\n\tflex: 1;\n\tposition: relative;\n\twidth: 100%;\n\n\t${ wrapperColor };\n\t${ rangeHeight };\n\t${ wrapperMargin };\n`;\n\nexport const BeforeIconWrapper = styled.span`\n\tdisplay: flex; // ensures the height isn't affected by line-height\n\tmargin-top: ${ railHeight }px;\n\n\t${ rtl( { marginRight: 6 } ) }\n`;\n\nexport const AfterIconWrapper = styled.span`\n\tdisplay: flex; // ensures the height isn't affected by line-height\n\tmargin-top: ${ railHeight }px;\n\n\t${ rtl( { marginLeft: 6 } ) }\n`;\n\nconst railBackgroundColor = ( { disabled, railColor }: RailProps ) => {\n\tlet background = railColor || '';\n\n\tif ( disabled ) {\n\t\tbackground = COLORS.ui.backgroundDisabled;\n\t}\n\n\treturn css( { background } );\n};\n\nexport const Rail = styled.span`\n\tbackground-color: ${ COLORS.gray[ 300 ] };\n\tleft: 0;\n\tpointer-events: none;\n\tright: 0;\n\tdisplay: block;\n\theight: ${ railHeight }px;\n\tposition: absolute;\n\tmargin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px;\n\ttop: 0;\n\tborder-radius: ${ railHeight }px;\n\n\t${ railBackgroundColor };\n`;\n\nconst trackBackgroundColor = ( { disabled, trackColor }: TrackProps ) => {\n\tlet background = trackColor || 'currentColor';\n\n\tif ( disabled ) {\n\t\tbackground = COLORS.gray[ 400 ];\n\t}\n\n\treturn css( { background } );\n};\n\nexport const Track = styled.span`\n\tbackground-color: currentColor;\n\tborder-radius: ${ railHeight }px;\n\theight: ${ railHeight }px;\n\tpointer-events: none;\n\tdisplay: block;\n\tposition: absolute;\n\tmargin-top: ${ ( rangeHeightValue - railHeight ) / 2 }px;\n\ttop: 0;\n\n\t${ trackBackgroundColor };\n`;\n\nexport const MarksWrapper = styled.span`\n\tdisplay: block;\n\tpointer-events: none;\n\tposition: relative;\n\twidth: 100%;\n\tuser-select: none;\n`;\n\nconst markFill = ( { disabled, isFilled }: RangeMarkProps ) => {\n\tlet backgroundColor = isFilled ? 'currentColor' : COLORS.gray[ 300 ];\n\n\tif ( disabled ) {\n\t\tbackgroundColor = COLORS.gray[ 400 ];\n\t}\n\n\treturn css( {\n\t\tbackgroundColor,\n\t} );\n};\n\nexport const Mark = styled.span`\n\theight: ${ thumbSize }px;\n\tleft: 0;\n\tposition: absolute;\n\ttop: -4px;\n\twidth: 1px;\n\n\t${ markFill };\n`;\n\nconst markLabelFill = ( { isFilled }: RangeMarkProps ) => {\n\treturn css( {\n\t\tcolor: isFilled ? COLORS.gray[ 700 ] : COLORS.gray[ 300 ],\n\t} );\n};\n\nexport const MarkLabel = styled.span`\n\tcolor: ${ COLORS.gray[ 300 ] };\n\tleft: 0;\n\tfont-size: 11px;\n\tposition: absolute;\n\ttop: 12px;\n\ttransform: translateX( -50% );\n\twhite-space: nowrap;\n\n\t${ markLabelFill };\n`;\n\nconst thumbColor = ( { disabled }: ThumbProps ) =>\n\tdisabled\n\t\t? css`\n\t\t\t\tbackground-color: ${ COLORS.gray[ 400 ] };\n\t\t `\n\t\t: css`\n\t\t\t\tbackground-color: ${ COLORS.ui.theme };\n\t\t `;\n\nexport const ThumbWrapper = styled.span`\n\talign-items: center;\n\tdisplay: flex;\n\theight: ${ thumbSize }px;\n\tjustify-content: center;\n\tmargin-top: ${ ( rangeHeightValue - thumbSize ) / 2 }px;\n\toutline: 0;\n\tpointer-events: none;\n\tposition: absolute;\n\ttop: 0;\n\tuser-select: none;\n\twidth: ${ thumbSize }px;\n\tborder-radius: 50%;\n\n\t${ thumbColor };\n\t${ rtl( { marginLeft: -10 } ) };\n\t${ rtl(\n\t\t{ transform: 'translateX( 4.5px )' },\n\t\t{ transform: 'translateX( -4.5px )' }\n\t) };\n`;\n\nconst thumbFocus = ( { isFocused }: ThumbProps ) => {\n\treturn isFocused\n\t\t? css`\n\t\t\t\t&::before {\n\t\t\t\t\tcontent: ' ';\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tbackground-color: ${ COLORS.ui.theme };\n\t\t\t\t\topacity: 0.4;\n\t\t\t\t\tborder-radius: 50%;\n\t\t\t\t\theight: ${ thumbSize + 8 }px;\n\t\t\t\t\twidth: ${ thumbSize + 8 }px;\n\t\t\t\t\ttop: -4px;\n\t\t\t\t\tleft: -4px;\n\t\t\t\t}\n\t\t `\n\t\t: '';\n};\n\nexport const Thumb = styled.span< ThumbProps >`\n\talign-items: center;\n\tborder-radius: 50%;\n\theight: 100%;\n\toutline: 0;\n\tposition: absolute;\n\tuser-select: none;\n\twidth: 100%;\n\n\t${ thumbColor };\n\t${ thumbFocus };\n`;\n\nexport const InputRange = styled.input`\n\tbox-sizing: border-box;\n\tcursor: pointer;\n\tdisplay: block;\n\theight: 100%;\n\tleft: 0;\n\tmargin: 0 -${ thumbSize / 2 }px;\n\topacity: 0;\n\toutline: none;\n\tposition: absolute;\n\tright: 0;\n\ttop: 0;\n\twidth: calc( 100% + ${ thumbSize }px );\n`;\n\nconst tooltipShow = ( { show }: TooltipProps ) => {\n\treturn css( {\n\t\topacity: show ? 1 : 0,\n\t} );\n};\n\nconst tooltipPosition = ( { position }: TooltipProps ) => {\n\tconst isBottom = position === 'bottom';\n\n\tif ( isBottom ) {\n\t\treturn css`\n\t\t\tbottom: -80%;\n\t\t`;\n\t}\n\n\treturn css`\n\t\ttop: -80%;\n\t`;\n};\n\nexport const Tooltip = styled.span< TooltipProps >`\n\tbackground: rgba( 0, 0, 0, 0.8 );\n\tborder-radius: 2px;\n\tcolor: white;\n\tdisplay: inline-block;\n\tfont-size: 12px;\n\tmin-width: 32px;\n\topacity: 0;\n\tpadding: 4px 8px;\n\tpointer-events: none;\n\tposition: absolute;\n\ttext-align: center;\n\ttransition: opacity 120ms ease;\n\tuser-select: none;\n\tline-height: 1.4;\n\n\t${ tooltipShow };\n\t${ tooltipPosition };\n\t${ reduceMotion( 'transition' ) };\n\t${ rtl(\n\t\t{ transform: 'translateX(-50%)' },\n\t\t{ transform: 'translateX(50%)' }\n\t) }\n`;\n\n// @todo: Refactor RangeControl with latest HStack configuration\n// @wordpress/components/ui/hstack.\nexport const InputNumber = styled( NumberControl )`\n\tdisplay: inline-block;\n\tfont-size: 13px;\n\tmargin-top: 0;\n\n\tinput[type='number']& {\n\t\t${ rangeHeight };\n\t}\n\n\t${ rtl( { marginLeft: `${ space( 4 ) } !important` } ) }\n`;\n\nexport const ActionRightWrapper = styled.span`\n\tdisplay: block;\n\tmargin-top: 0;\n\n\tbutton,\n\tbutton.is-small {\n\t\tmargin-left: 0;\n\t\t${ rangeHeight };\n\t}\n\n\t${ rtl( { marginLeft: 8 } ) }\n`;\n"]}
|
|
@@ -19,6 +19,7 @@ import { ValueInput } from './styles/unit-control-styles';
|
|
|
19
19
|
import UnitSelectControl from './unit-select-control';
|
|
20
20
|
import { CSS_UNITS, getParsedQuantityAndUnit, getUnitsWithCurrentUnit, getValidParsedQuantityAndUnit } from './utils';
|
|
21
21
|
import { useControlledState } from '../utils/hooks';
|
|
22
|
+
import { escapeRegExp } from '../utils/strings';
|
|
22
23
|
|
|
23
24
|
function UnforwardedUnitControl(unitControlProps, forwardedRef) {
|
|
24
25
|
const {
|
|
@@ -63,9 +64,9 @@ function UnforwardedUnitControl(unitControlProps, forwardedRef) {
|
|
|
63
64
|
const firstCharacters = rest.reduce((carry, {
|
|
64
65
|
value
|
|
65
66
|
}) => {
|
|
66
|
-
const first = value?.substring(0, 1) || '';
|
|
67
|
+
const first = escapeRegExp(value?.substring(0, 1) || '');
|
|
67
68
|
return carry.includes(first) ? carry : `${carry}|${first}`;
|
|
68
|
-
}, firstUnitValue.substring(0, 1));
|
|
69
|
+
}, escapeRegExp(firstUnitValue.substring(0, 1)));
|
|
69
70
|
return [list, new RegExp(`^(?:${firstCharacters})$`, 'i')];
|
|
70
71
|
}, [nonNullValueProp, unitProp, unitsProp]);
|
|
71
72
|
const [parsedQuantity, parsedUnit] = getParsedQuantityAndUnit(nonNullValueProp, unitProp, units);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/unit-control/index.tsx"],"names":["classnames","deprecated","forwardRef","useMemo","useRef","useEffect","__","ValueInput","UnitSelectControl","CSS_UNITS","getParsedQuantityAndUnit","getUnitsWithCurrentUnit","getValidParsedQuantityAndUnit","useControlledState","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","onBlur","step","activeUnit","find","option","UnitControl","parseQuantityAndUnitFromRawValue","useCustomUnits"],"mappings":";;AAAA;AACA;AACA;AAEA,OAAOA,UAAP,MAAuB,YA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;AACA;;AAED,SACC,cAAC,UAAD,OACM7C,KADN;AAEC,IAAA,YAAY,EAAGrB,YAFhB;AAGC,IAAA,SAAS,EAAG4C,OAHb;AAIC,IAAA,QAAQ,EAAGzC,QAJZ;AAKC,IAAA,YAAY,EAAC,MALd;AAMC,IAAA,oBAAoB,EAAGE,oBANxB;AAOC,IAAA,KAAK,EAAGG,KAPT;AAQC,IAAA,SAAS,EAAG+C,eARb;AASC,IAAA,QAAQ,EAAGV,sBATZ;AAUC,IAAA,GAAG,EAAG/C,YAVP;AAWC,IAAA,IAAI,EAAGc,IAXR;AAYC,IAAA,MAAM,EAAGoD,WAZV;AAaC,IAAA,IAAI,EAAG3D,oBAAoB,GAAG,MAAH,GAAY,QAbxC;AAcC,IAAA,KAAK,EAAGiC,cAAH,aAAGA,cAAH,cAAGA,cAAH,GAAqB,EAd3B;AAeC,IAAA,IAAI,EAAG4B,IAfR;AAgBC,IAAA,OAAO,EAAG9C,WAhBX;AAiBC,IAAA,sBAAsB,EAAGrB;AAjB1B,IADD;AAqBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMuE,WAAW,GAAGtF,UAAU,CAAEY,sBAAF,CAA9B;AAEP,SAAS2E,gCAAT,EAA2CC,cAA3C,QAAiE,SAAjE;AACA,eAAeF,WAAf","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 '../ui/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 type { UnitControlProps, UnitControlOnChangeCallback } from './types';\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} = unitControlProps;\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst [ units, reFirstCharacterOfUnits ] = useMemo( () => {\n\t\tconst list = getUnitsWithCurrentUnit(\n\t\t\tnonNullValueProp,\n\t\t\tunitProp,\n\t\t\tunitsProp\n\t\t);\n\t\tconst [ { value: firstUnitValue = '' } = {}, ...rest ] = list;\n\t\tconst firstCharacters = rest.reduce( ( carry, { value } ) => {\n\t\t\tconst first = value?.substring( 0, 1 ) || '';\n\t\t\treturn carry.includes( first ) ? carry : `${ carry }|${ first }`;\n\t\t}, firstUnitValue.substring( 0, 1 ) );\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={ size }\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 * @example\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"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/unit-control/index.tsx"],"names":["classnames","deprecated","forwardRef","useMemo","useRef","useEffect","__","ValueInput","UnitSelectControl","CSS_UNITS","getParsedQuantityAndUnit","getUnitsWithCurrentUnit","getValidParsedQuantityAndUnit","useControlledState","escapeRegExp","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","onBlur","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B;AAAA;;AACtB,UAAMoD,UAAU,GAAGpD,KAAK,CAACqD,IAAN,CAAcC,MAAF,IAAcA,MAAM,CAACpD,KAAP,KAAiBJ,IAA3C,CAAnB;AACAqD,IAAAA,IAAI,uBAAGC,UAAU,EAAED,IAAf,+DAAuB,CAA3B;AACA;;AAED,SACC,cAAC,UAAD,OACM7C,KADN;AAEC,IAAA,YAAY,EAAGrB,YAFhB;AAGC,IAAA,SAAS,EAAG4C,OAHb;AAIC,IAAA,QAAQ,EAAGzC,QAJZ;AAKC,IAAA,YAAY,EAAC,MALd;AAMC,IAAA,oBAAoB,EAAGE,oBANxB;AAOC,IAAA,KAAK,EAAGG,KAPT;AAQC,IAAA,SAAS,EAAG+C,eARb;AASC,IAAA,QAAQ,EAAGV,sBATZ;AAUC,IAAA,GAAG,EAAG/C,YAVP;AAWC,IAAA,IAAI,EAAGc,IAXR;AAYC,IAAA,MAAM,EAAGoD,WAZV;AAaC,IAAA,IAAI,EAAG3D,oBAAoB,GAAG,MAAH,GAAY,QAbxC;AAcC,IAAA,KAAK,EAAGiC,cAAH,aAAGA,cAAH,cAAGA,cAAH,GAAqB,EAd3B;AAeC,IAAA,IAAI,EAAG4B,IAfR;AAgBC,IAAA,OAAO,EAAG9C,WAhBX;AAiBC,IAAA,sBAAsB,EAAGrB;AAjB1B,IADD;AAqBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,MAAMuE,WAAW,GAAGvF,UAAU,CAAEa,sBAAF,CAA9B;AAEP,SAAS2E,gCAAT,EAA2CC,cAA3C,QAAiE,SAAjE;AACA,eAAeF,WAAf","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 '../ui/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';\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} = unitControlProps;\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst [ units, reFirstCharacterOfUnits ] = useMemo( () => {\n\t\tconst list = getUnitsWithCurrentUnit(\n\t\t\tnonNullValueProp,\n\t\t\tunitProp,\n\t\t\tunitsProp\n\t\t);\n\t\tconst [ { value: firstUnitValue = '' } = {}, ...rest ] = list;\n\t\tconst firstCharacters = rest.reduce( ( carry, { value } ) => {\n\t\t\tconst first = escapeRegExp( value?.substring( 0, 1 ) || '' );\n\t\t\treturn carry.includes( first ) ? carry : `${ carry }|${ first }`;\n\t\t}, escapeRegExp( firstUnitValue.substring( 0, 1 ) ) );\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={ size }\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 * @example\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"]}
|
|
@@ -1221,18 +1221,14 @@ body.is-dragging-components-draggable {
|
|
|
1221
1221
|
height: 1px;
|
|
1222
1222
|
}
|
|
1223
1223
|
.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-active svg,
|
|
1224
|
-
.components-dropdown-menu__menu .components-
|
|
1224
|
+
.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-active .dashicon,
|
|
1225
|
+
.components-dropdown-menu__menu .components-menu-item.is-active svg,
|
|
1226
|
+
.components-dropdown-menu__menu .components-menu-item.is-active .dashicon {
|
|
1225
1227
|
color: #fff;
|
|
1226
1228
|
background: #1e1e1e;
|
|
1227
1229
|
box-shadow: 0 0 0 1px #1e1e1e;
|
|
1228
1230
|
border-radius: 1px;
|
|
1229
1231
|
}
|
|
1230
|
-
.components-dropdown-menu__menu .components-dropdown-menu__menu-item > svg,
|
|
1231
|
-
.components-dropdown-menu__menu .components-menu-item > svg {
|
|
1232
|
-
border-radius: 2px;
|
|
1233
|
-
width: 24px;
|
|
1234
|
-
height: 24px;
|
|
1235
|
-
}
|
|
1236
1232
|
.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-icon-only,
|
|
1237
1233
|
.components-dropdown-menu__menu .components-menu-item.is-icon-only {
|
|
1238
1234
|
width: auto;
|
package/build-style/style.css
CHANGED
|
@@ -1226,18 +1226,14 @@ body.is-dragging-components-draggable {
|
|
|
1226
1226
|
height: 1px;
|
|
1227
1227
|
}
|
|
1228
1228
|
.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-active svg,
|
|
1229
|
-
.components-dropdown-menu__menu .components-
|
|
1229
|
+
.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-active .dashicon,
|
|
1230
|
+
.components-dropdown-menu__menu .components-menu-item.is-active svg,
|
|
1231
|
+
.components-dropdown-menu__menu .components-menu-item.is-active .dashicon {
|
|
1230
1232
|
color: #fff;
|
|
1231
1233
|
background: #1e1e1e;
|
|
1232
1234
|
box-shadow: 0 0 0 1px #1e1e1e;
|
|
1233
1235
|
border-radius: 1px;
|
|
1234
1236
|
}
|
|
1235
|
-
.components-dropdown-menu__menu .components-dropdown-menu__menu-item > svg,
|
|
1236
|
-
.components-dropdown-menu__menu .components-menu-item > svg {
|
|
1237
|
-
border-radius: 2px;
|
|
1238
|
-
width: 24px;
|
|
1239
|
-
height: 24px;
|
|
1240
|
-
}
|
|
1241
1237
|
.components-dropdown-menu__menu .components-dropdown-menu__menu-item.is-icon-only,
|
|
1242
1238
|
.components-dropdown-menu__menu .components-menu-item.is-icon-only {
|
|
1243
1239
|
width: auto;
|
|
@@ -44,11 +44,12 @@ export declare const RangeControl: import("@emotion/styled").StyledComponent<Pic
|
|
|
44
44
|
resetFallbackValue?: number | undefined;
|
|
45
45
|
separatorType?: "none" | "fullWidth" | "topFullWidth" | undefined;
|
|
46
46
|
shiftStep?: number | undefined;
|
|
47
|
+
__next40pxDefaultSize?: boolean | undefined;
|
|
47
48
|
showTooltip?: boolean | undefined;
|
|
48
49
|
trackColor?: import("csstype").Property.Color | undefined;
|
|
49
50
|
type?: "stepper" | undefined;
|
|
50
51
|
withInputField?: boolean | undefined;
|
|
51
|
-
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof import("react").InputHTMLAttributes<HTMLInputElement>>, "onChange" | "color" | "help" | "icon" | "disabled" | "children" | "label" | "as" | "type" | "onFocus" | "onBlur" | "onMouseLeave" | "onMouseMove" | "step" | "showTooltip" | "hideLabelFromVision" | "__nextHasNoMarginBottom" | "isShiftStepEnabled" | "shiftStep" |
|
|
52
|
+
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof import("react").InputHTMLAttributes<HTMLInputElement>>, "onChange" | "color" | "help" | "icon" | "disabled" | "children" | "label" | "as" | "type" | "onFocus" | "onBlur" | "onMouseLeave" | "onMouseMove" | "step" | "__next40pxDefaultSize" | "showTooltip" | "hideLabelFromVision" | "__nextHasNoMarginBottom" | "isShiftStepEnabled" | "shiftStep" | keyof import("../range-control/types").NumericProps | "marks" | "afterIcon" | "allowReset" | "beforeIcon" | "currentInput" | "initialPosition" | "railColor" | "renderTooltipContent" | "resetFallbackValue" | "separatorType" | "trackColor" | "withInputField"> & import("react").RefAttributes<HTMLInputElement> & {
|
|
52
53
|
theme?: import("@emotion/react").Theme | undefined;
|
|
53
54
|
}, {}, {}>;
|
|
54
55
|
export declare const AuxiliaryColorArtefactWrapper: import("@emotion/styled").StyledComponent<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/color-picker/styles.ts"],"names":[],"mappings":";AAsBA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;UAIhC,CAAC;AAEF,eAAO,MAAM,aAAa;;UAWzB,CAAC;AAEF,eAAO,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/color-picker/styles.ts"],"names":[],"mappings":";AAsBA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;UAIhC,CAAC;AAEF,eAAO,MAAM,aAAa;;UAWzB,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAGxB,CAAC;AASF,eAAO,MAAM,6BAA6B;;;yGAKzC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;;;UAG9C,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;UAK7B,CAAC;AAEF,eAAO,MAAM,eAAe;;;yGA6C3B,CAAC;AAEF,eAAO,MAAM,UAAU;;UAStB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guide/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/guide/index.tsx"],"names":[],"mappings":";AAkBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,iBAAS,KAAK,CAAE,EACf,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,gBAAiC,EACjC,QAAQ,EACR,KAAU,GACV,EAAE,UAAU,sBAiHZ;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/number-control/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/number-control/index.tsx"],"names":[],"mappings":";AAiRA,eAAO,MAAM,aAAa;;;;;;;;;;;;m6KAAyC,CAAC;AAEpE,eAAe,aAAa,CAAC"}
|
|
@@ -43,15 +43,28 @@ export declare const RangeControl: import("react").ForwardRefExoticComponent<Pic
|
|
|
43
43
|
onFocus?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
|
|
44
44
|
onMouseLeave?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
|
|
45
45
|
onMouseMove?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
|
|
46
|
-
railColor?: import("csstype").Property.Color | undefined;
|
|
46
|
+
railColor?: import("csstype").Property.Color | undefined; /**
|
|
47
|
+
* Previously, this callback would always receive undefined as
|
|
48
|
+
* an argument. This behavior is unexpected, specifically
|
|
49
|
+
* when resetFallbackValue is defined.
|
|
50
|
+
*
|
|
51
|
+
* The value of undefined is not ideal. Passing it through
|
|
52
|
+
* to internal <input /> elements would change it from a
|
|
53
|
+
* controlled component to an uncontrolled component.
|
|
54
|
+
*
|
|
55
|
+
* For now, to minimize unexpected regressions, we're going to
|
|
56
|
+
* preserve the undefined callback argument, except when a
|
|
57
|
+
* resetFallbackValue is defined.
|
|
58
|
+
*/
|
|
47
59
|
renderTooltipContent?: ((value?: import("./types").ControlledRangeValue | undefined) => string | number | null | undefined) | undefined;
|
|
48
60
|
resetFallbackValue?: number | undefined;
|
|
49
61
|
separatorType?: "none" | "fullWidth" | "topFullWidth" | undefined;
|
|
50
62
|
shiftStep?: number | undefined;
|
|
63
|
+
__next40pxDefaultSize?: boolean | undefined;
|
|
51
64
|
showTooltip?: boolean | undefined;
|
|
52
65
|
trackColor?: import("csstype").Property.Color | undefined;
|
|
53
66
|
type?: "stepper" | undefined;
|
|
54
67
|
withInputField?: boolean | undefined;
|
|
55
|
-
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof import("react").InputHTMLAttributes<HTMLInputElement>>, "onChange" | "color" | "help" | "icon" | "disabled" | "children" | "label" | "as" | "type" | "onFocus" | "onBlur" | "onMouseLeave" | "onMouseMove" | "step" | "showTooltip" | "hideLabelFromVision" | "__nextHasNoMarginBottom" | "isShiftStepEnabled" | "shiftStep" |
|
|
68
|
+
} & Omit<Pick<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "key" | keyof import("react").InputHTMLAttributes<HTMLInputElement>>, "onChange" | "color" | "help" | "icon" | "disabled" | "children" | "label" | "as" | "type" | "onFocus" | "onBlur" | "onMouseLeave" | "onMouseMove" | "step" | "__next40pxDefaultSize" | "showTooltip" | "hideLabelFromVision" | "__nextHasNoMarginBottom" | "isShiftStepEnabled" | "shiftStep" | keyof import("./types").NumericProps | "marks" | "afterIcon" | "allowReset" | "beforeIcon" | "currentInput" | "initialPosition" | "railColor" | "renderTooltipContent" | "resetFallbackValue" | "separatorType" | "trackColor" | "withInputField"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
56
69
|
export default RangeControl;
|
|
57
70
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/range-control/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/range-control/index.tsx"],"names":[],"mappings":";AAsVA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;8DA1LvB;;;;;;;;;;;;OAYG;;;;;;;;;;swBA8K4D,CAAC;AAElE,eAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-range.d.ts","sourceRoot":"","sources":["../../src/range-control/input-range.tsx"],"names":[],"mappings":";AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"input-range.d.ts","sourceRoot":"","sources":["../../src/range-control/input-range.tsx"],"names":[],"mappings":";AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAsB/C,QAAA,MAAM,kBAAkB;;oDAA2B,CAAC;AAEpD,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { RangeMarkProps, ThumbProps, TooltipProps, TrackProps } from '../types';
|
|
2
|
+
import type { RangeMarkProps, ThumbProps, TooltipProps, TrackProps, RangeControlProps } from '../types';
|
|
3
|
+
type RootProps = Pick<RangeControlProps, '__next40pxDefaultSize'>;
|
|
3
4
|
export declare const Root: import("@emotion/styled").StyledComponent<{
|
|
4
5
|
theme?: import("@emotion/react").Theme | undefined;
|
|
5
6
|
as?: import("react").ElementType<any> | undefined;
|
|
6
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
7
|
+
} & RootProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
7
8
|
export declare const Wrapper: import("@emotion/styled").StyledComponent<{
|
|
8
9
|
theme?: import("@emotion/react").Theme | undefined;
|
|
9
10
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -83,4 +84,5 @@ export declare const ActionRightWrapper: import("@emotion/styled").StyledCompone
|
|
|
83
84
|
theme?: import("@emotion/react").Theme | undefined;
|
|
84
85
|
as?: import("react").ElementType<any> | undefined;
|
|
85
86
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
|
|
87
|
+
export {};
|
|
86
88
|
//# sourceMappingURL=range-control-styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"range-control-styles.d.ts","sourceRoot":"","sources":["../../../src/range-control/styles/range-control-styles.ts"],"names":[],"mappings":";AAaA,OAAO,KAAK,EACX,cAAc,EAEd,UAAU,EACV,YAAY,EACZ,UAAU,EAEV,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"range-control-styles.d.ts","sourceRoot":"","sources":["../../../src/range-control/styles/range-control-styles.ts"],"names":[],"mappings":";AAaA,OAAO,KAAK,EACX,cAAc,EAEd,UAAU,EACV,YAAY,EACZ,UAAU,EAEV,iBAAiB,EACjB,MAAM,UAAU,CAAC;AAalB,KAAK,SAAS,GAAG,IAAI,CAAE,iBAAiB,EAAE,uBAAuB,CAAE,CAAC;AACpE,eAAO,MAAM,IAAI;;;qHAYhB,CAAC;AAYF,eAAO,MAAM,OAAO;;;;;;yGASnB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;2GAK7B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;2GAK5B,CAAC;AAYF,eAAO,MAAM,IAAI;;;;;;;;;;;;2GAahB,CAAC;AAYF,eAAO,MAAM,KAAK;;;wHAWjB,CAAC;AAEF,eAAO,MAAM,YAAY;;;2GAMxB,CAAC;AAcF,eAAO,MAAM,IAAI;;;4HAQhB,CAAC;AAQF,eAAO,MAAM,SAAS;;;4HAUrB,CAAC;AAWF,eAAO,MAAM,YAAY;;;wHAoBxB,CAAC;AAoBF,eAAO,MAAM,KAAK;;;wHAWjB,CAAC;AAEF,eAAO,MAAM,UAAU;;;kHAatB,CAAC;AAsBF,eAAO,MAAM,OAAO;;;0HAuBnB,CAAC;AAIF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;UAUvB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;2GAW9B,CAAC"}
|
|
@@ -189,6 +189,12 @@ export type RangeControlProps = Pick<BaseControlProps, 'hideLabelFromVision' | '
|
|
|
189
189
|
* @default 10
|
|
190
190
|
*/
|
|
191
191
|
shiftStep?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Start opting into the larger default height that will become the default size in a future version.
|
|
194
|
+
*
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
__next40pxDefaultSize?: boolean;
|
|
192
198
|
/**
|
|
193
199
|
* Forcing the Tooltip UI to show or hide. This is overridden to `false`
|
|
194
200
|
* when `step` is set to the special string value `any`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/range-control/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,OAAO,CAAC;AAEf;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG;IAC1B;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAG1D,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,EAAE,CAAC;AAE/C,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG;IACvC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACtD;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CA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ClB,UAAU,EAAE,aAAa,CAAE,OAAO,CAAE,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACzC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG;IACzC,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/unit-control/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/unit-control/index.tsx"],"names":[],"mappings":";AA2BA,OAAO,KAAK,EAAoB,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAkM7E;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW;;;;;;;;y+KAAuC,CAAC;AAEhE,OAAO,EAAE,gCAAgC,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC3E,eAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "25.
|
|
3
|
+
"version": "25.3.0",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -41,23 +41,23 @@
|
|
|
41
41
|
"@floating-ui/react-dom": "1.0.0",
|
|
42
42
|
"@radix-ui/react-dropdown-menu": "^2.0.4",
|
|
43
43
|
"@use-gesture/react": "^10.2.24",
|
|
44
|
-
"@wordpress/a11y": "^3.
|
|
45
|
-
"@wordpress/compose": "^6.
|
|
46
|
-
"@wordpress/date": "^4.
|
|
47
|
-
"@wordpress/deprecated": "^3.
|
|
48
|
-
"@wordpress/dom": "^3.
|
|
49
|
-
"@wordpress/element": "^5.
|
|
50
|
-
"@wordpress/escape-html": "^2.
|
|
51
|
-
"@wordpress/hooks": "^3.
|
|
52
|
-
"@wordpress/html-entities": "^3.
|
|
53
|
-
"@wordpress/i18n": "^4.
|
|
54
|
-
"@wordpress/icons": "^9.
|
|
55
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
56
|
-
"@wordpress/keycodes": "^3.
|
|
57
|
-
"@wordpress/primitives": "^3.
|
|
58
|
-
"@wordpress/private-apis": "^0.
|
|
59
|
-
"@wordpress/rich-text": "^6.
|
|
60
|
-
"@wordpress/warning": "^2.
|
|
44
|
+
"@wordpress/a11y": "^3.37.0",
|
|
45
|
+
"@wordpress/compose": "^6.14.0",
|
|
46
|
+
"@wordpress/date": "^4.37.0",
|
|
47
|
+
"@wordpress/deprecated": "^3.37.0",
|
|
48
|
+
"@wordpress/dom": "^3.37.0",
|
|
49
|
+
"@wordpress/element": "^5.14.0",
|
|
50
|
+
"@wordpress/escape-html": "^2.37.0",
|
|
51
|
+
"@wordpress/hooks": "^3.37.0",
|
|
52
|
+
"@wordpress/html-entities": "^3.37.0",
|
|
53
|
+
"@wordpress/i18n": "^4.37.0",
|
|
54
|
+
"@wordpress/icons": "^9.28.0",
|
|
55
|
+
"@wordpress/is-shallow-equal": "^4.37.0",
|
|
56
|
+
"@wordpress/keycodes": "^3.37.0",
|
|
57
|
+
"@wordpress/primitives": "^3.35.0",
|
|
58
|
+
"@wordpress/private-apis": "^0.19.0",
|
|
59
|
+
"@wordpress/rich-text": "^6.14.0",
|
|
60
|
+
"@wordpress/warning": "^2.37.0",
|
|
61
61
|
"change-case": "^4.1.2",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"colord": "^2.7.0",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"publishConfig": {
|
|
88
88
|
"access": "public"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "bcd13d59b22553b3c9dc5869077bff1e864cf9f5"
|
|
91
91
|
}
|
|
@@ -30,19 +30,15 @@
|
|
|
30
30
|
height: 1px;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
&.is-active
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
> svg {
|
|
43
|
-
border-radius: $radius-block-ui;
|
|
44
|
-
width: $button-size-small;
|
|
45
|
-
height: $button-size-small;
|
|
33
|
+
&.is-active {
|
|
34
|
+
svg,
|
|
35
|
+
.dashicon {
|
|
36
|
+
// Block UI appearance.
|
|
37
|
+
color: $white;
|
|
38
|
+
background: $gray-900;
|
|
39
|
+
box-shadow: 0 0 0 $border-width $gray-900;
|
|
40
|
+
border-radius: $border-width;
|
|
41
|
+
}
|
|
46
42
|
}
|
|
47
43
|
|
|
48
44
|
// If menu items are icon-only, make them stretch only to the icon size.
|
package/src/guide/index.tsx
CHANGED
|
@@ -9,7 +9,6 @@ import classnames from 'classnames';
|
|
|
9
9
|
import { useState, useEffect, Children, useRef } from '@wordpress/element';
|
|
10
10
|
import deprecated from '@wordpress/deprecated';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
|
-
import { focus } from '@wordpress/dom';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* Internal dependencies
|
|
@@ -59,9 +58,17 @@ function Guide( {
|
|
|
59
58
|
onFinish,
|
|
60
59
|
pages = [],
|
|
61
60
|
}: GuideProps ) {
|
|
62
|
-
const
|
|
61
|
+
const ref = useRef< HTMLDivElement >( null );
|
|
63
62
|
const [ currentPage, setCurrentPage ] = useState( 0 );
|
|
64
63
|
|
|
64
|
+
useEffect( () => {
|
|
65
|
+
// Place focus at the top of the guide on mount and when the page changes.
|
|
66
|
+
const frame = ref.current?.querySelector( '.components-guide' );
|
|
67
|
+
if ( frame instanceof HTMLElement ) {
|
|
68
|
+
frame.focus();
|
|
69
|
+
}
|
|
70
|
+
}, [ currentPage ] );
|
|
71
|
+
|
|
65
72
|
useEffect( () => {
|
|
66
73
|
if ( Children.count( children ) ) {
|
|
67
74
|
deprecated( 'Passing children to <Guide>', {
|
|
@@ -71,16 +78,6 @@ function Guide( {
|
|
|
71
78
|
}
|
|
72
79
|
}, [ children ] );
|
|
73
80
|
|
|
74
|
-
useEffect( () => {
|
|
75
|
-
// Each time we change the current page, start from the first element of the page.
|
|
76
|
-
// This also solves any focus loss that can happen.
|
|
77
|
-
if ( guideContainer.current ) {
|
|
78
|
-
(
|
|
79
|
-
focus.tabbable.find( guideContainer.current ) as HTMLElement[]
|
|
80
|
-
)[ 0 ]?.focus();
|
|
81
|
-
}
|
|
82
|
-
}, [ currentPage ] );
|
|
83
|
-
|
|
84
81
|
if ( Children.count( children ) ) {
|
|
85
82
|
pages =
|
|
86
83
|
Children.map( children, ( child ) => ( {
|
|
@@ -124,7 +121,7 @@ function Guide( {
|
|
|
124
121
|
event.preventDefault();
|
|
125
122
|
}
|
|
126
123
|
} }
|
|
127
|
-
ref={
|
|
124
|
+
ref={ ref }
|
|
128
125
|
>
|
|
129
126
|
<div className="components-guide__container">
|
|
130
127
|
<div className="components-guide__page">
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
|
|
38
38
|
import type { RangeControlProps } from './types';
|
|
39
39
|
import type { WordPressComponentProps } from '../ui/context';
|
|
40
|
+
import { space } from '../ui/utils/space';
|
|
40
41
|
|
|
41
42
|
const noop = () => {};
|
|
42
43
|
|
|
@@ -69,6 +70,7 @@ function UnforwardedRangeControl(
|
|
|
69
70
|
railColor,
|
|
70
71
|
renderTooltipContent = ( v ) => v,
|
|
71
72
|
resetFallbackValue,
|
|
73
|
+
__next40pxDefaultSize = false,
|
|
72
74
|
shiftStep = 10,
|
|
73
75
|
showTooltip: showTooltipProp,
|
|
74
76
|
step = 1,
|
|
@@ -208,7 +210,6 @@ function UnforwardedRangeControl(
|
|
|
208
210
|
const offsetStyle = {
|
|
209
211
|
[ isRTL() ? 'right' : 'left' ]: fillValueOffset,
|
|
210
212
|
};
|
|
211
|
-
|
|
212
213
|
return (
|
|
213
214
|
<BaseControl
|
|
214
215
|
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
|
|
@@ -218,7 +219,10 @@ function UnforwardedRangeControl(
|
|
|
218
219
|
id={ `${ id }` }
|
|
219
220
|
help={ help }
|
|
220
221
|
>
|
|
221
|
-
<Root
|
|
222
|
+
<Root
|
|
223
|
+
className="components-range-control__root"
|
|
224
|
+
__next40pxDefaultSize={ __next40pxDefaultSize }
|
|
225
|
+
>
|
|
222
226
|
{ beforeIcon && (
|
|
223
227
|
<BeforeIconWrapper>
|
|
224
228
|
<Icon icon={ beforeIcon } />
|
|
@@ -305,6 +309,14 @@ function UnforwardedRangeControl(
|
|
|
305
309
|
onBlur={ handleOnInputNumberBlur }
|
|
306
310
|
onChange={ handleOnChange }
|
|
307
311
|
shiftStep={ shiftStep }
|
|
312
|
+
size={
|
|
313
|
+
__next40pxDefaultSize
|
|
314
|
+
? '__unstable-large'
|
|
315
|
+
: 'default'
|
|
316
|
+
}
|
|
317
|
+
__unstableInputWidth={
|
|
318
|
+
__next40pxDefaultSize ? space( 20 ) : space( 16 )
|
|
319
|
+
}
|
|
308
320
|
step={ step }
|
|
309
321
|
// @ts-expect-error TODO: Investigate if the `null` value is necessary
|
|
310
322
|
value={ inputSliderValue }
|
|
@@ -18,6 +18,7 @@ import type {
|
|
|
18
18
|
TooltipProps,
|
|
19
19
|
TrackProps,
|
|
20
20
|
WrapperProps,
|
|
21
|
+
RangeControlProps,
|
|
21
22
|
} from '../types';
|
|
22
23
|
|
|
23
24
|
const rangeHeightValue = 30;
|
|
@@ -26,15 +27,24 @@ const rangeHeight = () =>
|
|
|
26
27
|
css( { height: rangeHeightValue, minHeight: rangeHeightValue } );
|
|
27
28
|
const thumbSize = 12;
|
|
28
29
|
|
|
29
|
-
|
|
30
|
+
const deprecatedHeight = ( {
|
|
31
|
+
__next40pxDefaultSize,
|
|
32
|
+
}: Pick< RangeControlProps, '__next40pxDefaultSize' > ) =>
|
|
33
|
+
! __next40pxDefaultSize && css( { minHeight: rangeHeightValue } );
|
|
34
|
+
|
|
35
|
+
type RootProps = Pick< RangeControlProps, '__next40pxDefaultSize' >;
|
|
36
|
+
export const Root = styled.div< RootProps >`
|
|
30
37
|
-webkit-tap-highlight-color: transparent;
|
|
31
|
-
align-items:
|
|
38
|
+
align-items: center;
|
|
32
39
|
display: flex;
|
|
33
40
|
justify-content: flex-start;
|
|
34
41
|
padding: 0;
|
|
35
42
|
position: relative;
|
|
36
43
|
touch-action: none;
|
|
37
44
|
width: 100%;
|
|
45
|
+
min-height: 40px;
|
|
46
|
+
/* TODO: remove after removing the __next40pxDefaultSize prop */
|
|
47
|
+
${ deprecatedHeight };
|
|
38
48
|
`;
|
|
39
49
|
|
|
40
50
|
const wrapperColor = ( { color = COLORS.ui.borderFocus }: WrapperProps ) =>
|
|
@@ -296,7 +306,6 @@ export const InputNumber = styled( NumberControl )`
|
|
|
296
306
|
display: inline-block;
|
|
297
307
|
font-size: 13px;
|
|
298
308
|
margin-top: 0;
|
|
299
|
-
width: ${ space( 16 ) } !important;
|
|
300
309
|
|
|
301
310
|
input[type='number']& {
|
|
302
311
|
${ rangeHeight };
|