@wordpress/components 19.0.0 → 19.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/CONTRIBUTING.md +12 -12
- package/build/angle-picker-control/index.js +3 -1
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/base-control/index.js +1 -1
- package/build/base-control/index.js.map +1 -1
- package/build/color-edit/index.js +180 -199
- package/build/color-edit/index.js.map +1 -1
- package/build/color-edit/styles.js +112 -0
- package/build/color-edit/styles.js.map +1 -0
- package/build/color-list-picker/index.js +6 -1
- package/build/color-list-picker/index.js.map +1 -1
- package/build/color-palette/index.js +86 -21
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/styles.js +31 -0
- package/build/color-palette/styles.js.map +1 -0
- package/build/color-picker/component.js +7 -18
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/picker.js +3 -3
- package/build/color-picker/picker.js.map +1 -1
- package/build/duotone-picker/custom-duotone-bar.js +0 -1
- package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +1 -0
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/gradient-picker/index.js +69 -9
- package/build/gradient-picker/index.js.map +1 -1
- package/build/index.native.js +9 -0
- package/build/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/cell.native.js +4 -2
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/link-cell.native.js +3 -2
- package/build/mobile/bottom-sheet/link-cell.native.js.map +1 -1
- package/build/mobile/link-settings/image-link-destinations-screen.native.js +140 -0
- package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -0
- package/build/mobile/link-settings/index.native.js +3 -2
- package/build/mobile/link-settings/index.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-navigation.native.js +1 -0
- package/build/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build/mobile/link-settings/link-settings-screen.native.js +11 -5
- package/build/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build/mobile/picker/index.android.js +4 -2
- package/build/mobile/picker/index.android.js.map +1 -1
- package/build/modal/index.js +10 -3
- package/build/modal/index.js.map +1 -1
- package/build/navigation/group/index.js +1 -2
- package/build/navigation/group/index.js.map +1 -1
- package/build/navigation/menu/menu-title-search.js +8 -27
- package/build/navigation/menu/menu-title-search.js.map +1 -1
- package/build/navigation/menu/menu-title.js +2 -2
- package/build/navigation/menu/menu-title.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js +34 -29
- package/build/navigation/styles/navigation-styles.js.map +1 -1
- package/build/popover/index.js +4 -2
- package/build/popover/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +33 -29
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/search-control/index.js +37 -14
- package/build/search-control/index.js.map +1 -1
- package/build/text/styles.js +7 -7
- package/build/text/styles.js.map +1 -1
- package/build/tools-panel/styles.js +18 -23
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js +10 -7
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +3 -1
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +3 -0
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/utils/hooks/index.js +8 -0
- package/build/utils/hooks/index.js.map +1 -1
- package/build/utils/hooks/use-combined-ref.js +28 -0
- package/build/utils/hooks/use-combined-ref.js.map +1 -0
- package/build-module/angle-picker-control/index.js +3 -1
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/base-control/index.js +1 -1
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/color-edit/index.js +175 -201
- package/build-module/color-edit/index.js.map +1 -1
- package/build-module/color-edit/styles.js +90 -0
- package/build-module/color-edit/styles.js.map +1 -0
- package/build-module/color-list-picker/index.js +6 -1
- package/build-module/color-list-picker/index.js.map +1 -1
- package/build-module/color-palette/index.js +85 -22
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/styles.js +27 -0
- package/build-module/color-palette/styles.js.map +1 -0
- package/build-module/color-picker/component.js +7 -16
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/picker.js +4 -4
- package/build-module/color-picker/picker.js.map +1 -1
- package/build-module/duotone-picker/custom-duotone-bar.js +0 -1
- package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +1 -0
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/gradient-picker/index.js +67 -9
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/index.native.js +1 -0
- package/build-module/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js +4 -2
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/link-cell.native.js +3 -2
- package/build-module/mobile/bottom-sheet/link-cell.native.js.map +1 -1
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js +121 -0
- package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -0
- package/build-module/mobile/link-settings/index.native.js +3 -2
- package/build-module/mobile/link-settings/index.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-navigation.native.js +1 -0
- package/build-module/mobile/link-settings/link-settings-navigation.native.js.map +1 -1
- package/build-module/mobile/link-settings/link-settings-screen.native.js +11 -5
- package/build-module/mobile/link-settings/link-settings-screen.native.js.map +1 -1
- package/build-module/mobile/picker/index.android.js +4 -2
- package/build-module/mobile/picker/index.android.js.map +1 -1
- package/build-module/modal/index.js +10 -4
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigation/group/index.js +1 -2
- package/build-module/navigation/group/index.js.map +1 -1
- package/build-module/navigation/menu/menu-title-search.js +8 -24
- package/build-module/navigation/menu/menu-title-search.js.map +1 -1
- package/build-module/navigation/menu/menu-title.js +3 -3
- package/build-module/navigation/menu/menu-title.js.map +1 -1
- package/build-module/navigation/styles/navigation-styles.js +31 -27
- package/build-module/navigation/styles/navigation-styles.js.map +1 -1
- package/build-module/popover/index.js +4 -2
- package/build-module/popover/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +33 -29
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/search-control/index.js +36 -15
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/text/styles.js +7 -7
- package/build-module/text/styles.js.map +1 -1
- package/build-module/tools-panel/styles.js +16 -23
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +10 -6
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +2 -1
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +3 -0
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/utils/hooks/index.js +1 -0
- package/build-module/utils/hooks/index.js.map +1 -1
- package/build-module/utils/hooks/use-combined-ref.js +25 -0
- package/build-module/utils/hooks/use-combined-ref.js.map +1 -0
- package/build-style/style-rtl.css +39 -51
- package/build-style/style.css +39 -51
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/tools-panel/styles.d.ts +1 -1
- package/build-types/tools-panel/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
- package/build-types/utils/hooks/index.d.ts +1 -0
- package/build-types/utils/hooks/use-combined-ref.d.ts +8 -0
- package/build-types/utils/hooks/use-combined-ref.d.ts.map +1 -0
- package/package.json +6 -6
- package/src/angle-picker-control/index.js +3 -1
- package/src/angle-picker-control/styles/angle-picker-control-styles.js +2 -2
- package/src/base-control/index.js +1 -1
- package/src/circular-option-picker/style.scss +3 -5
- package/src/color-edit/index.js +248 -274
- package/src/color-edit/style.scss +4 -45
- package/src/color-edit/styles.js +97 -0
- package/src/color-list-picker/index.js +5 -0
- package/src/color-list-picker/style.scss +4 -0
- package/src/color-palette/index.js +90 -26
- package/src/color-palette/style.scss +18 -0
- package/src/color-palette/styles.js +19 -0
- package/src/color-palette/test/__snapshots__/index.js.snap +448 -414
- package/src/color-picker/component.tsx +6 -17
- package/src/color-picker/picker.tsx +6 -4
- package/src/color-picker/test/index.js +0 -15
- package/src/duotone-picker/custom-duotone-bar.js +0 -1
- package/src/duotone-picker/duotone-picker.js +1 -0
- package/src/gradient-picker/index.js +79 -11
- package/src/heading/test/__snapshots__/index.js.snap +1 -1
- package/src/index.native.js +1 -0
- package/src/mobile/bottom-sheet/cell.native.js +7 -2
- package/src/mobile/bottom-sheet/cellStyles.android.scss +5 -1
- package/src/mobile/bottom-sheet/cellStyles.ios.scss +5 -1
- package/src/mobile/bottom-sheet/link-cell.native.js +10 -3
- package/src/mobile/link-settings/image-link-destinations-screen.native.js +148 -0
- package/src/mobile/link-settings/index.native.js +3 -2
- package/src/mobile/link-settings/link-settings-navigation.native.js +1 -0
- package/src/mobile/link-settings/link-settings-screen.native.js +6 -2
- package/src/mobile/link-settings/style.native.scss +17 -0
- package/src/mobile/picker/index.android.js +2 -1
- package/src/modal/README.md +8 -0
- package/src/modal/index.js +60 -45
- package/src/modal/style.scss +5 -0
- package/src/navigation/group/index.js +1 -2
- package/src/navigation/menu/menu-title-search.js +11 -26
- package/src/navigation/menu/menu-title.js +4 -4
- package/src/navigation/styles/navigation-styles.js +29 -52
- package/src/popover/index.js +2 -2
- package/src/range-control/styles/range-control-styles.js +4 -1
- package/src/resizable-box/style.scss +5 -0
- package/src/search-control/index.js +47 -23
- package/src/style.scss +1 -0
- package/src/text/styles.js +1 -1
- package/src/text/test/__snapshots__/index.js.snap +2 -2
- package/src/tools-panel/stories/index.js +21 -19
- package/src/tools-panel/styles.ts +18 -26
- package/src/tools-panel/tools-panel/component.tsx +7 -4
- package/src/tools-panel/tools-panel/hook.ts +4 -1
- package/src/tools-panel/tools-panel-header/component.tsx +1 -0
- package/src/ui/control-label/test/__snapshots__/index.js.snap +3 -3
- package/src/ui/form-group/test/__snapshots__/index.js.snap +2 -2
- package/src/utils/hooks/index.js +1 -0
- package/src/utils/hooks/use-combined-ref.ts +29 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-picker/component.tsx"],"names":["namesPlugin","options","label","value","ColorPicker","props","forwardedRef","enableAlpha","color","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-picker/component.tsx"],"names":["namesPlugin","options","label","value","ColorPicker","props","forwardedRef","enableAlpha","color","onChange","defaultValue","copyFormat","divProps","safeColordColor","handleChange","nextValue","toHex","showInputs","setShowInputs","colorType","setColorType","nextColorType","settings","ConnectedColorPicker"],"mappings":";;;;;;;;;AAWA;;;;AAPA;;AACA;;AACA;;AAMA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAjCA;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAKA;AACA;AACA;AAoBA,oBAAQ,CAAEA,cAAF,CAAR;AAUA,MAAMC,OAAO,GAAG,CACf;AAAEC,EAAAA,KAAK,EAAE,KAAT;AAAgBC,EAAAA,KAAK,EAAE;AAAvB,CADe,EAEf;AAAED,EAAAA,KAAK,EAAE,KAAT;AAAgBC,EAAAA,KAAK,EAAE;AAAvB,CAFe,EAGf;AAAED,EAAAA,KAAK,EAAE,KAAT;AAAgBC,EAAAA,KAAK,EAAE;AAAvB,CAHe,CAAhB;;AAMA,MAAMC,WA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D;AACC,IAAA,KAAK,EAAGR,eADT;AAEC,IAAA,SAAS,EAAGF,UAAU,IAAIQ,SAF3B;AAGC,IAAA,WAAW,EAAGZ;AAHf,IAZF,EAkBC,4BAAC,4BAAD;AACC,IAAA,OAAO,MADR;AAEC,IAAA,OAAO,EAAG,MAAMW,aAAa,CAAE,CAAED,UAAJ,CAF9B;AAGC,IAAA,IAAI,EAAGK,eAHR;AAIC,IAAA,SAAS,EAAGL,UAJb;AAKC,IAAA,KAAK,EACJA,UAAU,GACP,cAAI,sBAAJ,CADO,GAEP,cAAI,sBAAJ;AARL,IAlBD,CADD,EA+BC,4BAAC,cAAD;AAAQ,IAAA,MAAM,EAAG;AAAjB,IA/BD,EAgCGA,UAAU,IACX,4BAAC,sBAAD;AACC,IAAA,SAAS,EAAGE,SADb;AAEC,IAAA,KAAK,EAAGN,eAFT;AAGC,IAAA,QAAQ,EAAGC,YAHZ;AAIC,IAAA,WAAW,EAAGP;AAJf,IAjCF,CAND,CADD;AAkDA,CAhFD;;AAkFA,MAAMgB,oBAAoB,GAAG,6BAAgBnB,WAAhB,EAA6B,aAA7B,CAA7B;eAEemB,oB","sourcesContent":["/**\n * External dependencies\n */\n// eslint-disable-next-line no-restricted-imports\nimport { Ref, useCallback } from 'react';\nimport { colord, extend, Colord } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\nimport { settings } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseContextSystem,\n\tcontextConnect,\n\tWordPressComponentProps,\n} from '../ui/context';\nimport { HStack } from '../h-stack';\nimport { Spacer } from '../spacer';\nimport {\n\tColorfulWrapper,\n\tSelectControl,\n\tAuxiliaryColorArtefactWrapper,\n\tDetailsControlButton,\n} from './styles';\nimport { ColorDisplay } from './color-display';\nimport { ColorInput } from './color-input';\nimport { Picker } from './picker';\n\nimport type { ColorType } from './types';\n\nextend( [ namesPlugin ] );\n\nexport interface ColorPickerProps {\n\tenableAlpha?: boolean;\n\tcolor?: string;\n\tonChange?: ( color: string ) => void;\n\tdefaultValue?: string;\n\tcopyFormat?: ColorType;\n}\n\nconst options = [\n\t{ label: 'RGB', value: 'rgb' as const },\n\t{ label: 'HSL', value: 'hsl' as const },\n\t{ label: 'Hex', value: 'hex' as const },\n];\n\nconst ColorPicker = (\n\tprops: WordPressComponentProps< ColorPickerProps, 'div', false >,\n\tforwardedRef: Ref< any >\n) => {\n\tconst {\n\t\tenableAlpha = false,\n\t\tcolor,\n\t\tonChange,\n\t\tdefaultValue = '#fff',\n\t\tcopyFormat,\n\t\t...divProps\n\t} = useContextSystem( props, 'ColorPicker' );\n\n\t// Use a safe default value for the color and remove the possibility of `undefined`.\n\tconst safeColordColor = useMemo( () => {\n\t\treturn color ? colord( color ) : colord( defaultValue );\n\t}, [ color, defaultValue ] );\n\n\tconst handleChange = useCallback(\n\t\t( nextValue: Colord ) => {\n\t\t\tonChange( nextValue.toHex() );\n\t\t},\n\t\t[ onChange ]\n\t);\n\n\tconst [ showInputs, setShowInputs ] = useState< boolean >( false );\n\tconst [ colorType, setColorType ] = useState< ColorType >(\n\t\tcopyFormat || 'hex'\n\t);\n\n\treturn (\n\t\t<ColorfulWrapper ref={ forwardedRef } { ...divProps }>\n\t\t\t<Picker\n\t\t\t\tonChange={ handleChange }\n\t\t\t\tcolor={ safeColordColor }\n\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t/>\n\t\t\t<AuxiliaryColorArtefactWrapper>\n\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t{ showInputs ? (\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ colorType }\n\t\t\t\t\t\t\tonChange={ ( nextColorType ) =>\n\t\t\t\t\t\t\t\tsetColorType( nextColorType as ColorType )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlabel={ __( 'Color format' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<ColorDisplay\n\t\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\t\tcolorType={ copyFormat || colorType }\n\t\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t<DetailsControlButton\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tonClick={ () => setShowInputs( ! showInputs ) }\n\t\t\t\t\t\ticon={ settings }\n\t\t\t\t\t\tisPressed={ showInputs }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tshowInputs\n\t\t\t\t\t\t\t\t? __( 'Hide detailed inputs' )\n\t\t\t\t\t\t\t\t: __( 'Show detailed inputs' )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t\t<Spacer margin={ 4 } />\n\t\t\t\t{ showInputs && (\n\t\t\t\t\t<ColorInput\n\t\t\t\t\t\tcolorType={ colorType }\n\t\t\t\t\t\tcolor={ safeColordColor }\n\t\t\t\t\t\tonChange={ handleChange }\n\t\t\t\t\t\tenableAlpha={ enableAlpha }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</AuxiliaryColorArtefactWrapper>\n\t\t</ColorfulWrapper>\n\t);\n};\n\nconst ConnectedColorPicker = contextConnect( ColorPicker, 'ColorPicker' );\n\nexport default ConnectedColorPicker;\n"]}
|
|
@@ -23,10 +23,10 @@ const Picker = ({
|
|
|
23
23
|
enableAlpha,
|
|
24
24
|
onChange
|
|
25
25
|
}) => {
|
|
26
|
-
const Component = enableAlpha ? _reactColorful.
|
|
27
|
-
const
|
|
26
|
+
const Component = enableAlpha ? _reactColorful.RgbaStringColorPicker : _reactColorful.RgbStringColorPicker;
|
|
27
|
+
const rgbColor = (0, _element.useMemo)(() => color.toRgbString(), [color]);
|
|
28
28
|
return (0, _element.createElement)(Component, {
|
|
29
|
-
color:
|
|
29
|
+
color: rgbColor,
|
|
30
30
|
onChange: nextColor => {
|
|
31
31
|
onChange((0, _colord.colord)(nextColor));
|
|
32
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/color-picker/picker.tsx"],"names":["Picker","color","enableAlpha","onChange","Component","
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/color-picker/picker.tsx"],"names":["Picker","color","enableAlpha","onChange","Component","RgbaStringColorPicker","RgbStringColorPicker","rgbColor","toRgbString","nextColor"],"mappings":";;;;;;;AASA;;AANA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AAQO,MAAMA,MAAM,GAAG,CAAE;AAAEC,EAAAA,KAAF;AAASC,EAAAA,WAAT;AAAsBC,EAAAA;AAAtB,CAAF,KAAqD;AAC1E,QAAMC,SAAS,GAAGF,WAAW,GAC1BG,oCAD0B,GAE1BC,mCAFH;AAGA,QAAMC,QAAQ,GAAG,sBAAS,MAAMN,KAAK,CAACO,WAAN,EAAf,EAAoC,CAAEP,KAAF,CAApC,CAAjB;AAEA,SACC,4BAAC,SAAD;AACC,IAAA,KAAK,EAAGM,QADT;AAEC,IAAA,QAAQ,EAAKE,SAAF,IAAiB;AAC3BN,MAAAA,QAAQ,CAAE,oBAAQM,SAAR,CAAF,CAAR;AACA;AAJF,IADD;AAQA,CAdM","sourcesContent":["/**\n * External dependencies\n */\nimport { RgbStringColorPicker, RgbaStringColorPicker } from 'react-colorful';\nimport { colord, Colord } from 'colord';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\ninterface PickerProps {\n\tcolor: Colord;\n\tenableAlpha: boolean;\n\tonChange: ( nextColor: Colord ) => void;\n}\n\nexport const Picker = ( { color, enableAlpha, onChange }: PickerProps ) => {\n\tconst Component = enableAlpha\n\t\t? RgbaStringColorPicker\n\t\t: RgbStringColorPicker;\n\tconst rgbColor = useMemo( () => color.toRgbString(), [ color ] );\n\n\treturn (\n\t\t<Component\n\t\t\tcolor={ rgbColor }\n\t\t\tonChange={ ( nextColor ) => {\n\t\t\t\tonChange( colord( nextColor ) );\n\t\t\t} }\n\t\t/>\n\t);\n};\n"]}
|
|
@@ -28,7 +28,6 @@ function CustomDuotoneBar({
|
|
|
28
28
|
const controlPoints = (0, _utils.getColorStopsFromColors)(values);
|
|
29
29
|
return (0, _element.createElement)(_customGradientBar.default, {
|
|
30
30
|
disableInserter: true,
|
|
31
|
-
disableAlpha: true,
|
|
32
31
|
background: background,
|
|
33
32
|
hasGradient: hasGradient,
|
|
34
33
|
value: controlPoints,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/duotone-picker/custom-duotone-bar.js"],"names":["PLACEHOLDER_VALUES","CustomDuotoneBar","value","onChange","hasGradient","values","background","controlPoints","newColorStops","newValue"],"mappings":";;;;;;;;;;;AAGA;;AAEA;;AALA;AACA;AACA;AASA,MAAMA,kBAAkB,GAAG,CAAE,MAAF,EAAU,MAAV,CAA3B;;AAEe,SAASC,gBAAT,CAA2B;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAA3B,EAAiD;AAC/D,QAAMC,WAAW,GAAG,CAAC,CAAEF,KAAvB;AACA,QAAMG,MAAM,GAAGD,WAAW,GAAGF,KAAH,GAAWF,kBAArC;AACA,QAAMM,UAAU,GAAG,qCAA0BD,MAA1B,CAAnB;AACA,QAAME,aAAa,GAAG,oCAAyBF,MAAzB,CAAtB;AACA,SACC,4BAAC,0BAAD;AACC,IAAA,eAAe,MADhB;AAEC,IAAA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/duotone-picker/custom-duotone-bar.js"],"names":["PLACEHOLDER_VALUES","CustomDuotoneBar","value","onChange","hasGradient","values","background","controlPoints","newColorStops","newValue"],"mappings":";;;;;;;;;;;AAGA;;AAEA;;AALA;AACA;AACA;AASA,MAAMA,kBAAkB,GAAG,CAAE,MAAF,EAAU,MAAV,CAA3B;;AAEe,SAASC,gBAAT,CAA2B;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAA3B,EAAiD;AAC/D,QAAMC,WAAW,GAAG,CAAC,CAAEF,KAAvB;AACA,QAAMG,MAAM,GAAGD,WAAW,GAAGF,KAAH,GAAWF,kBAArC;AACA,QAAMM,UAAU,GAAG,qCAA0BD,MAA1B,CAAnB;AACA,QAAME,aAAa,GAAG,oCAAyBF,MAAzB,CAAtB;AACA,SACC,4BAAC,0BAAD;AACC,IAAA,eAAe,MADhB;AAEC,IAAA,UAAU,EAAGC,UAFd;AAGC,IAAA,WAAW,EAAGF,WAHf;AAIC,IAAA,KAAK,EAAGG,aAJT;AAKC,IAAA,QAAQ,EAAKC,aAAF,IAAqB;AAC/B,YAAMC,QAAQ,GAAG,oCAAyBD,aAAzB,CAAjB;AACAL,MAAAA,QAAQ,CAAEM,QAAF,CAAR;AACA;AARF,IADD;AAYA","sourcesContent":["/**\n * Internal dependencies\n */\nimport CustomGradientBar from '../custom-gradient-bar';\n\nimport {\n\tgetColorStopsFromColors,\n\tgetGradientFromCSSColors,\n\tgetColorsFromColorStops,\n} from './utils';\n\nconst PLACEHOLDER_VALUES = [ '#333', '#CCC' ];\n\nexport default function CustomDuotoneBar( { value, onChange } ) {\n\tconst hasGradient = !! value;\n\tconst values = hasGradient ? value : PLACEHOLDER_VALUES;\n\tconst background = getGradientFromCSSColors( values );\n\tconst controlPoints = getColorStopsFromColors( values );\n\treturn (\n\t\t<CustomGradientBar\n\t\t\tdisableInserter\n\t\t\tbackground={ background }\n\t\t\thasGradient={ hasGradient }\n\t\t\tvalue={ controlPoints }\n\t\t\tonChange={ ( newColorStops ) => {\n\t\t\t\tconst newValue = getColorsFromColorStops( newColorStops );\n\t\t\t\tonChange( newValue );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/duotone-picker/duotone-picker.js"],"names":["DuotonePicker","colorPalette","duotonePalette","disableCustomColors","disableCustomDuotone","value","onChange","defaultDark","defaultLight","map","colors","slug","name","style","background","color","tooltipText","label","isSelected","undefined","newColors","newValue","length"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAKA;;AACA;;AAEA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAOA,SAASA,aAAT,CAAwB;AACvBC,EAAAA,YADuB;AAEvBC,EAAAA,cAFuB;AAGvBC,EAAAA,mBAHuB;AAIvBC,EAAAA,oBAJuB;AAKvBC,EAAAA,KALuB;AAMvBC,EAAAA;AANuB,CAAxB,EAOI;AACH,QAAM,CAAEC,WAAF,EAAeC,YAAf,IAAgC,sBACrC,MAAM,6BAAkBP,YAAlB,CAD+B,EAErC,CAAEA,YAAF,CAFqC,CAAtC;AAKA,SACC,4BAAC,6BAAD;AACC,IAAA,OAAO,EAAGC,cAAc,CAACO,GAAf,CAAoB,CAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,IAAV;AAAgBC,MAAAA;AAAhB,KAAF,KAA8B;AAC3D,YAAMC,KAAK,GAAG;AACbC,QAAAA,UAAU,EAAE,qCAA0BJ,MAA1B,EAAkC,QAAlC,CADC;AAEbK,QAAAA,KAAK,EAAE;AAFM,OAAd;AAIA,YAAMC,WAAW,GAChBJ,IADgB,aAChBA,IADgB,cAChBA,IADgB,GAEhB,oBACC;AACA,oBAAI,kBAAJ,CAFD,EAGCD,IAHD,CAFD;AAOA,YAAMM,KAAK,GAAGL,IAAI,GACf,oBACA;AACA,oBAAI,aAAJ,CAFA,EAGAA,IAHA,CADe,GAMfI,WANH;AAOA,YAAME,UAAU,GAAG,qBAASR,MAAT,EAAiBL,KAAjB,CAAnB;AAEA,aACC,4BAAC,6BAAD,CAAsB,MAAtB;AACC,QAAA,GAAG,EAAGM,IADP;AAEC,QAAA,KAAK,EAAGD,MAFT;AAGC,QAAA,UAAU,EAAGQ,UAHd;AAIC,sBAAaD,KAJd;AAKC,QAAA,WAAW,EAAGD,WALf;AAMC,QAAA,KAAK,EAAGH,KANT;AAOC,QAAA,OAAO,EAAG,MAAM;AACfP,UAAAA,QAAQ,CAAEY,UAAU,GAAGC,SAAH,GAAeT,MAA3B,CAAR;AACA;AATF,QADD;AAaA,KAlCS,CADX;AAoCC,IAAA,OAAO,EACN,4BAAC,6BAAD,CAAsB,YAAtB;AACC,MAAA,OAAO,EAAG,MAAMJ,QAAQ,CAAEa,SAAF;AADzB,OAGG,cAAI,OAAJ,CAHH;AArCF,KA4CG,CAAEhB,mBAAF,IAAyB,CAAEC,oBAA3B,IACD,4BAAC,yBAAD;AAAkB,IAAA,KAAK,EAAGC,KAA1B;AAAkC,IAAA,QAAQ,EAAGC;AAA7C,IA7CF,EA+CG,CAAEF,oBAAF,IACD,4BAAC,wBAAD;AACC,IAAA,MAAM,EAAG,CAAE,cAAI,SAAJ,CAAF,EAAmB,cAAI,YAAJ,CAAnB,CADV;AAEC,IAAA,MAAM,EAAGH,YAFV;AAGC,IAAA,KAAK,EAAGI,KAHT;AAIC,IAAA,mBAAmB,EAAGF,mBAJvB;AAKC,IAAA,QAAQ,EAAKiB,SAAF,IAAiB;AAC3B,UAAK,CAAEA,SAAS,CAAE,CAAF,CAAhB,EAAwB;AACvBA,QAAAA,SAAS,CAAE,CAAF,CAAT,GAAiBb,WAAjB;AACA;;AACD,UAAK,CAAEa,SAAS,CAAE,CAAF,CAAhB,EAAwB;AACvBA,QAAAA,SAAS,CAAE,CAAF,CAAT,GAAiBZ,YAAjB;AACA;;AACD,YAAMa,QAAQ,GACbD,SAAS,CAACE,MAAV,IAAoB,CAApB,GAAwBF,SAAxB,GAAoCD,SADrC;AAEAb,MAAAA,QAAQ,CAAEe,QAAF,CAAR;AACA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/duotone-picker/duotone-picker.js"],"names":["DuotonePicker","colorPalette","duotonePalette","disableCustomColors","disableCustomDuotone","value","onChange","defaultDark","defaultLight","map","colors","slug","name","style","background","color","tooltipText","label","isSelected","undefined","newColors","newValue","length"],"mappings":";;;;;;;;;AAQA;;AALA;;AAMA;;AAKA;;AACA;;AAEA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAOA,SAASA,aAAT,CAAwB;AACvBC,EAAAA,YADuB;AAEvBC,EAAAA,cAFuB;AAGvBC,EAAAA,mBAHuB;AAIvBC,EAAAA,oBAJuB;AAKvBC,EAAAA,KALuB;AAMvBC,EAAAA;AANuB,CAAxB,EAOI;AACH,QAAM,CAAEC,WAAF,EAAeC,YAAf,IAAgC,sBACrC,MAAM,6BAAkBP,YAAlB,CAD+B,EAErC,CAAEA,YAAF,CAFqC,CAAtC;AAKA,SACC,4BAAC,6BAAD;AACC,IAAA,OAAO,EAAGC,cAAc,CAACO,GAAf,CAAoB,CAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,IAAV;AAAgBC,MAAAA;AAAhB,KAAF,KAA8B;AAC3D,YAAMC,KAAK,GAAG;AACbC,QAAAA,UAAU,EAAE,qCAA0BJ,MAA1B,EAAkC,QAAlC,CADC;AAEbK,QAAAA,KAAK,EAAE;AAFM,OAAd;AAIA,YAAMC,WAAW,GAChBJ,IADgB,aAChBA,IADgB,cAChBA,IADgB,GAEhB,oBACC;AACA,oBAAI,kBAAJ,CAFD,EAGCD,IAHD,CAFD;AAOA,YAAMM,KAAK,GAAGL,IAAI,GACf,oBACA;AACA,oBAAI,aAAJ,CAFA,EAGAA,IAHA,CADe,GAMfI,WANH;AAOA,YAAME,UAAU,GAAG,qBAASR,MAAT,EAAiBL,KAAjB,CAAnB;AAEA,aACC,4BAAC,6BAAD,CAAsB,MAAtB;AACC,QAAA,GAAG,EAAGM,IADP;AAEC,QAAA,KAAK,EAAGD,MAFT;AAGC,QAAA,UAAU,EAAGQ,UAHd;AAIC,sBAAaD,KAJd;AAKC,QAAA,WAAW,EAAGD,WALf;AAMC,QAAA,KAAK,EAAGH,KANT;AAOC,QAAA,OAAO,EAAG,MAAM;AACfP,UAAAA,QAAQ,CAAEY,UAAU,GAAGC,SAAH,GAAeT,MAA3B,CAAR;AACA;AATF,QADD;AAaA,KAlCS,CADX;AAoCC,IAAA,OAAO,EACN,4BAAC,6BAAD,CAAsB,YAAtB;AACC,MAAA,OAAO,EAAG,MAAMJ,QAAQ,CAAEa,SAAF;AADzB,OAGG,cAAI,OAAJ,CAHH;AArCF,KA4CG,CAAEhB,mBAAF,IAAyB,CAAEC,oBAA3B,IACD,4BAAC,yBAAD;AAAkB,IAAA,KAAK,EAAGC,KAA1B;AAAkC,IAAA,QAAQ,EAAGC;AAA7C,IA7CF,EA+CG,CAAEF,oBAAF,IACD,4BAAC,wBAAD;AACC,IAAA,MAAM,EAAG,CAAE,cAAI,SAAJ,CAAF,EAAmB,cAAI,YAAJ,CAAnB,CADV;AAEC,IAAA,MAAM,EAAGH,YAFV;AAGC,IAAA,KAAK,EAAGI,KAHT;AAIC,IAAA,mBAAmB,EAAGF,mBAJvB;AAKC,IAAA,WAAW,MALZ;AAMC,IAAA,QAAQ,EAAKiB,SAAF,IAAiB;AAC3B,UAAK,CAAEA,SAAS,CAAE,CAAF,CAAhB,EAAwB;AACvBA,QAAAA,SAAS,CAAE,CAAF,CAAT,GAAiBb,WAAjB;AACA;;AACD,UAAK,CAAEa,SAAS,CAAE,CAAF,CAAhB,EAAwB;AACvBA,QAAAA,SAAS,CAAE,CAAF,CAAT,GAAiBZ,YAAjB;AACA;;AACD,YAAMa,QAAQ,GACbD,SAAS,CAACE,MAAV,IAAoB,CAApB,GAAwBF,SAAxB,GAAoCD,SADrC;AAEAb,MAAAA,QAAQ,CAAEe,QAAF,CAAR;AACA;AAhBF,IAhDF,CADD;AAsEA;;eAEcrB,a","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ColorListPicker from '../color-list-picker';\nimport CircularOptionPicker from '../circular-option-picker';\n\nimport CustomDuotoneBar from './custom-duotone-bar';\nimport { getDefaultColors, getGradientFromCSSColors } from './utils';\n\nfunction DuotonePicker( {\n\tcolorPalette,\n\tduotonePalette,\n\tdisableCustomColors,\n\tdisableCustomDuotone,\n\tvalue,\n\tonChange,\n} ) {\n\tconst [ defaultDark, defaultLight ] = useMemo(\n\t\t() => getDefaultColors( colorPalette ),\n\t\t[ colorPalette ]\n\t);\n\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\toptions={ duotonePalette.map( ( { colors, slug, name } ) => {\n\t\t\t\tconst style = {\n\t\t\t\t\tbackground: getGradientFromCSSColors( colors, '135deg' ),\n\t\t\t\t\tcolor: 'transparent',\n\t\t\t\t};\n\t\t\t\tconst tooltipText =\n\t\t\t\t\tname ??\n\t\t\t\t\tsprintf(\n\t\t\t\t\t\t// translators: %s: duotone code e.g: \"dark-grayscale\" or \"7f7f7f-ffffff\".\n\t\t\t\t\t\t__( 'Duotone code: %s' ),\n\t\t\t\t\t\tslug\n\t\t\t\t\t);\n\t\t\t\tconst label = name\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// translators: %s: The name of the option e.g: \"Dark grayscale\".\n\t\t\t\t\t\t\t__( 'Duotone: %s' ),\n\t\t\t\t\t\t\tname\n\t\t\t\t\t )\n\t\t\t\t\t: tooltipText;\n\t\t\t\tconst isSelected = isEqual( colors, value );\n\n\t\t\t\treturn (\n\t\t\t\t\t<CircularOptionPicker.Option\n\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\tvalue={ colors }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\taria-label={ label }\n\t\t\t\t\t\ttooltipText={ tooltipText }\n\t\t\t\t\t\tstyle={ style }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tonChange( isSelected ? undefined : colors );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\tactions={\n\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\tonClick={ () => onChange( undefined ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t}\n\t\t>\n\t\t\t{ ! disableCustomColors && ! disableCustomDuotone && (\n\t\t\t\t<CustomDuotoneBar value={ value } onChange={ onChange } />\n\t\t\t) }\n\t\t\t{ ! disableCustomDuotone && (\n\t\t\t\t<ColorListPicker\n\t\t\t\t\tlabels={ [ __( 'Shadows' ), __( 'Highlights' ) ] }\n\t\t\t\t\tcolors={ colorPalette }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tdisableCustomColors={ disableCustomColors }\n\t\t\t\t\tenableAlpha\n\t\t\t\t\tonChange={ ( newColors ) => {\n\t\t\t\t\t\tif ( ! newColors[ 0 ] ) {\n\t\t\t\t\t\t\tnewColors[ 0 ] = defaultDark;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( ! newColors[ 1 ] ) {\n\t\t\t\t\t\t\tnewColors[ 1 ] = defaultLight;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst newValue =\n\t\t\t\t\t\t\tnewColors.length >= 2 ? newColors : undefined;\n\t\t\t\t\t\tonChange( newValue );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</CircularOptionPicker>\n\t);\n}\n\nexport default DuotonePicker;\n"]}
|
|
@@ -9,6 +9,8 @@ exports.default = GradientPicker;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
12
14
|
var _lodash = require("lodash");
|
|
13
15
|
|
|
14
16
|
var _i18n = require("@wordpress/i18n");
|
|
@@ -17,6 +19,10 @@ var _circularOptionPicker = _interopRequireDefault(require("../circular-option-p
|
|
|
17
19
|
|
|
18
20
|
var _customGradientPicker = _interopRequireDefault(require("../custom-gradient-picker"));
|
|
19
21
|
|
|
22
|
+
var _vStack = require("../v-stack");
|
|
23
|
+
|
|
24
|
+
var _styles = require("../color-palette/styles");
|
|
25
|
+
|
|
20
26
|
/**
|
|
21
27
|
* External dependencies
|
|
22
28
|
*/
|
|
@@ -28,15 +34,15 @@ var _customGradientPicker = _interopRequireDefault(require("../custom-gradient-p
|
|
|
28
34
|
/**
|
|
29
35
|
* Internal dependencies
|
|
30
36
|
*/
|
|
31
|
-
function
|
|
37
|
+
function SingleOrigin({
|
|
32
38
|
className,
|
|
39
|
+
clearGradient,
|
|
33
40
|
gradients,
|
|
34
41
|
onChange,
|
|
35
42
|
value,
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
actions,
|
|
44
|
+
content
|
|
38
45
|
}) {
|
|
39
|
-
const clearGradient = (0, _element.useCallback)(() => onChange(undefined), [onChange]);
|
|
40
46
|
const gradientOptions = (0, _element.useMemo)(() => {
|
|
41
47
|
return (0, _lodash.map)(gradients, ({
|
|
42
48
|
gradient,
|
|
@@ -60,12 +66,66 @@ function GradientPicker({
|
|
|
60
66
|
return (0, _element.createElement)(_circularOptionPicker.default, {
|
|
61
67
|
className: className,
|
|
62
68
|
options: gradientOptions,
|
|
69
|
+
actions: actions
|
|
70
|
+
}, content);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function MultipleOrigin({
|
|
74
|
+
className,
|
|
75
|
+
clearGradient,
|
|
76
|
+
gradients,
|
|
77
|
+
onChange,
|
|
78
|
+
value,
|
|
79
|
+
actions,
|
|
80
|
+
content
|
|
81
|
+
}) {
|
|
82
|
+
return (0, _element.createElement)(_vStack.VStack, {
|
|
83
|
+
spacing: 3,
|
|
84
|
+
className: className
|
|
85
|
+
}, gradients.map(({
|
|
86
|
+
name,
|
|
87
|
+
gradients: gradientSet
|
|
88
|
+
}, index) => {
|
|
89
|
+
return (0, _element.createElement)(_vStack.VStack, {
|
|
90
|
+
spacing: 2,
|
|
91
|
+
key: index
|
|
92
|
+
}, (0, _element.createElement)(_styles.ColorHeading, null, name), (0, _element.createElement)(SingleOrigin, (0, _extends2.default)({
|
|
93
|
+
clearGradient: clearGradient,
|
|
94
|
+
gradients: gradientSet,
|
|
95
|
+
onChange: onChange,
|
|
96
|
+
value: value
|
|
97
|
+
}, gradients.length === index + 1 ? {
|
|
98
|
+
actions,
|
|
99
|
+
content
|
|
100
|
+
} : {})));
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function GradientPicker({
|
|
105
|
+
className,
|
|
106
|
+
gradients,
|
|
107
|
+
onChange,
|
|
108
|
+
value,
|
|
109
|
+
clearable = true,
|
|
110
|
+
disableCustomGradients = false,
|
|
111
|
+
__experimentalHasMultipleOrigins
|
|
112
|
+
}) {
|
|
113
|
+
const clearGradient = (0, _element.useCallback)(() => onChange(undefined), [onChange]);
|
|
114
|
+
const Component = __experimentalHasMultipleOrigins ? MultipleOrigin : SingleOrigin;
|
|
115
|
+
return (0, _element.createElement)(Component, {
|
|
116
|
+
className: className,
|
|
117
|
+
clearable: clearable,
|
|
118
|
+
clearGradient: clearGradient,
|
|
119
|
+
gradients: gradients,
|
|
120
|
+
onChange: onChange,
|
|
121
|
+
value: value,
|
|
63
122
|
actions: clearable && (0, _element.createElement)(_circularOptionPicker.default.ButtonAction, {
|
|
64
123
|
onClick: clearGradient
|
|
65
|
-
}, (0, _i18n.__)('Clear'))
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
124
|
+
}, (0, _i18n.__)('Clear')),
|
|
125
|
+
content: !disableCustomGradients && (0, _element.createElement)(_customGradientPicker.default, {
|
|
126
|
+
value: value,
|
|
127
|
+
onChange: onChange
|
|
128
|
+
})
|
|
129
|
+
});
|
|
70
130
|
}
|
|
71
131
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/gradient-picker/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/gradient-picker/index.js"],"names":["SingleOrigin","className","clearGradient","gradients","onChange","value","actions","content","gradientOptions","gradient","name","color","background","MultipleOrigin","map","gradientSet","index","length","GradientPicker","clearable","disableCustomGradients","__experimentalHasMultipleOrigins","undefined","Component"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAKA;;AAMA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAMA,SAASA,YAAT,CAAuB;AACtBC,EAAAA,SADsB;AAEtBC,EAAAA,aAFsB;AAGtBC,EAAAA,SAHsB;AAItBC,EAAAA,QAJsB;AAKtBC,EAAAA,KALsB;AAMtBC,EAAAA,OANsB;AAOtBC,EAAAA;AAPsB,CAAvB,EAQI;AACH,QAAMC,eAAe,GAAG,sBAAS,MAAM;AACtC,WAAO,iBAAKL,SAAL,EAAgB,CAAE;AAAEM,MAAAA,QAAF;AAAYC,MAAAA;AAAZ,KAAF,KACtB,4BAAC,6BAAD,CAAsB,MAAtB;AACC,MAAA,GAAG,EAAGD,QADP;AAEC,MAAA,KAAK,EAAGA,QAFT;AAGC,MAAA,UAAU,EAAGJ,KAAK,KAAKI,QAHxB;AAIC,MAAA,WAAW,EACVC,IAAI,IACJ;AACA,yBAAS,cAAI,mBAAJ,CAAT,EAAoCD,QAApC,CAPF;AASC,MAAA,KAAK,EAAG;AAAEE,QAAAA,KAAK,EAAE,iBAAT;AAA4BC,QAAAA,UAAU,EAAEH;AAAxC,OATT;AAUC,MAAA,OAAO,EACNJ,KAAK,KAAKI,QAAV,GACGP,aADH,GAEG,MAAME,QAAQ,CAAEK,QAAF,CAbnB;AAeC,oBACCC,IAAI,GACD;AACA,yBAAS,cAAI,cAAJ,CAAT,EAA+BA,IAA/B,CAFC,GAGD;AACA,yBAAS,cAAI,mBAAJ,CAAT,EAAoCD,QAApC;AApBL,MADM,CAAP;AAyBA,GA1BuB,EA0B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AG,KANc;AAOvCC,EAAAA;AAPuC,CAAzB,EAQX;AACH,QAAMnB,aAAa,GAAG,0BAAa,MAAME,QAAQ,CAAEkB,SAAF,CAA3B,EAA0C,CAC/DlB,QAD+D,CAA1C,CAAtB;AAGA,QAAMmB,SAAS,GAAGF,gCAAgC,GAC/CR,cAD+C,GAE/Cb,YAFH;AAGA,SACC,4BAAC,SAAD;AACC,IAAA,SAAS,EAAGC,SADb;AAEC,IAAA,SAAS,EAAGkB,SAFb;AAGC,IAAA,aAAa,EAAGjB,aAHjB;AAIC,IAAA,SAAS,EAAGC,SAJb;AAKC,IAAA,QAAQ,EAAGC,QALZ;AAMC,IAAA,KAAK,EAAGC,KANT;AAOC,IAAA,OAAO,EACNc,SAAS,IACR,4BAAC,6BAAD,CAAsB,YAAtB;AACC,MAAA,OAAO,EAAGjB;AADX,OAGG,cAAI,OAAJ,CAHH,CATH;AAgBC,IAAA,OAAO,EACN,CAAEkB,sBAAF,IACC,4BAAC,6BAAD;AACC,MAAA,KAAK,EAAGf,KADT;AAEC,MAAA,QAAQ,EAAGD;AAFZ;AAlBH,IADD;AA2BA","sourcesContent":["/**\n * External dependencies\n */\nimport { map } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport CircularOptionPicker from '../circular-option-picker';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { VStack } from '../v-stack';\nimport { ColorHeading } from '../color-palette/styles';\n\nfunction SingleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\tactions,\n\tcontent,\n} ) {\n\tconst gradientOptions = useMemo( () => {\n\t\treturn map( gradients, ( { gradient, name } ) => (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ gradient }\n\t\t\t\tvalue={ gradient }\n\t\t\t\tisSelected={ value === gradient }\n\t\t\t\ttooltipText={\n\t\t\t\t\tname ||\n\t\t\t\t\t// translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\tsprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t\tstyle={ { color: 'rgba( 0,0,0,0 )', background: gradient } }\n\t\t\t\tonClick={\n\t\t\t\t\tvalue === gradient\n\t\t\t\t\t\t? clearGradient\n\t\t\t\t\t\t: () => onChange( gradient )\n\t\t\t\t}\n\t\t\t\taria-label={\n\t\t\t\t\tname\n\t\t\t\t\t\t? // translators: %s: The name of the gradient e.g: \"Angular red to blue\".\n\t\t\t\t\t\t sprintf( __( 'Gradient: %s' ), name )\n\t\t\t\t\t\t: // translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\t\t sprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t/>\n\t\t) );\n\t}, [ gradients, value, onChange, clearGradient ] );\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\tclassName={ className }\n\t\t\toptions={ gradientOptions }\n\t\t\tactions={ actions }\n\t\t>\n\t\t\t{ content }\n\t\t</CircularOptionPicker>\n\t);\n}\n\nfunction MultipleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\tactions,\n\tcontent,\n} ) {\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ gradients.map( ( { name, gradients: gradientSet }, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading>{ name }</ColorHeading>\n\t\t\t\t\t\t<SingleOrigin\n\t\t\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\t\t\tgradients={ gradientSet }\n\t\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t{ ...( gradients.length === index + 1\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tactions,\n\t\t\t\t\t\t\t\t\t\tcontent,\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: {} ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport default function GradientPicker( {\n\tclassName,\n\tgradients,\n\tonChange,\n\tvalue,\n\tclearable = true,\n\tdisableCustomGradients = false,\n\t__experimentalHasMultipleOrigins,\n} ) {\n\tconst clearGradient = useCallback( () => onChange( undefined ), [\n\t\tonChange,\n\t] );\n\tconst Component = __experimentalHasMultipleOrigins\n\t\t? MultipleOrigin\n\t\t: SingleOrigin;\n\treturn (\n\t\t<Component\n\t\t\tclassName={ className }\n\t\t\tclearable={ clearable }\n\t\t\tclearGradient={ clearGradient }\n\t\t\tgradients={ gradients }\n\t\t\tonChange={ onChange }\n\t\t\tvalue={ value }\n\t\t\tactions={\n\t\t\t\tclearable && (\n\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\tonClick={ clearGradient }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t! disableCustomGradients && (\n\t\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
package/build/index.native.js
CHANGED
|
@@ -96,6 +96,7 @@ var _exportNames = {
|
|
|
96
96
|
LinkSettings: true,
|
|
97
97
|
LinkSettingsScreen: true,
|
|
98
98
|
LinkSettingsNavigation: true,
|
|
99
|
+
ImageLinkDestinationsScreen: true,
|
|
99
100
|
Image: true,
|
|
100
101
|
IMAGE_DEFAULT_FOCAL_POINT: true,
|
|
101
102
|
ImageEditingButton: true,
|
|
@@ -646,6 +647,12 @@ Object.defineProperty(exports, "LinkSettingsNavigation", {
|
|
|
646
647
|
return _linkSettingsNavigation.default;
|
|
647
648
|
}
|
|
648
649
|
});
|
|
650
|
+
Object.defineProperty(exports, "ImageLinkDestinationsScreen", {
|
|
651
|
+
enumerable: true,
|
|
652
|
+
get: function () {
|
|
653
|
+
return _imageLinkDestinationsScreen.default;
|
|
654
|
+
}
|
|
655
|
+
});
|
|
649
656
|
Object.defineProperty(exports, "Image", {
|
|
650
657
|
enumerable: true,
|
|
651
658
|
get: function () {
|
|
@@ -929,6 +936,8 @@ var _linkSettingsScreen = _interopRequireDefault(require("./mobile/link-settings
|
|
|
929
936
|
|
|
930
937
|
var _linkSettingsNavigation = _interopRequireDefault(require("./mobile/link-settings/link-settings-navigation"));
|
|
931
938
|
|
|
939
|
+
var _imageLinkDestinationsScreen = _interopRequireDefault(require("./mobile/link-settings/image-link-destinations-screen"));
|
|
940
|
+
|
|
932
941
|
var _image = _interopRequireWildcard(require("./mobile/image"));
|
|
933
942
|
|
|
934
943
|
var _imageEditingButton = _interopRequireDefault(require("./mobile/image/image-editing-button"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/index.native.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/index.native.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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n\tPolygon,\n\tRect,\n\tG,\n\tHorizontalRule,\n\tBlockQuotation,\n} from '@wordpress/primitives';\nexport { default as ColorIndicator } from './color-indicator';\nexport { default as ColorPalette } from './color-palette';\nexport { ColorPicker } from './color-picker';\nexport { default as Dashicon } from './dashicon';\nexport { default as Dropdown } from './dropdown';\nexport { default as DropdownMenu } from './dropdown-menu';\nexport { default as FocalPointPicker } from './focal-point-picker';\nexport { default as Toolbar } from './toolbar';\nexport { default as ToolbarButton } from './toolbar-button';\nexport { default as __experimentalToolbarContext } from './toolbar-context';\nexport { default as ToolbarGroup } from './toolbar-group';\nexport { default as ToolbarItem } from './toolbar-item';\nexport { default as ToolbarDropdownMenu } from './toolbar-dropdown-menu';\nexport { default as Tooltip } from './tooltip';\nexport { default as Icon } from './icon';\nexport { default as Spinner } from './spinner';\nexport {\n\tcreateSlotFill,\n\tSlot,\n\tFill,\n\tProvider as SlotFillProvider,\n} from './slot-fill';\n\nexport { default as __experimentalStyleProvider } from './style-provider';\nexport { default as BaseControl } from './base-control';\nexport { default as TextareaControl } from './textarea-control';\nexport { default as PanelBody } from './panel/body';\nexport { default as PanelActions } from './panel/actions';\nexport { default as Button } from './button';\nexport { default as __experimentalText } from './text';\nexport { default as ExternalLink } from './external-link';\nexport { default as TextControl } from './text-control';\nexport { default as ToggleControl } from './toggle-control';\nexport { default as SandBox } from './sandbox';\nexport { default as SearchControl } from './search-control';\nexport { default as SelectControl } from './select-control';\nexport { default as RangeControl } from './range-control';\nexport { default as ResizableBox } from './resizable-box';\nexport { default as FooterMessageControl } from './footer-message-control';\nexport { default as ColorControl } from './color-control';\nexport { default as QueryControls } from './query-controls';\nexport { default as Notice } from './notice';\nexport { default as NoticeList } from './notice/list';\nexport { default as RadioControl } from './radio-control';\nexport {\n\tdefault as UnitControl,\n\tuseCustomUnits as __experimentalUseCustomUnits,\n} from './unit-control';\nexport {\n\tCSS_UNITS as CSS_UNITS,\n\tfilterUnitsWithSettings as filterUnitsWithSettings,\n} from './unit-control/utils';\nexport { default as Disabled } from './disabled';\n\n// Higher-Order Components\nexport { default as withConstrainedTabbing } from './higher-order/with-constrained-tabbing';\nexport { default as withFallbackStyles } from './higher-order/with-fallback-styles';\nexport { default as withFilters } from './higher-order/with-filters';\nexport { default as FontSizePicker } from './font-size-picker'; // Intentionally called after slot-fill and withFilters.\nexport { default as withFocusOutside } from './higher-order/with-focus-outside';\nexport { default as withFocusReturn } from './higher-order/with-focus-return';\nexport { default as withNotices } from './higher-order/with-notices';\nexport { default as withSpokenMessages } from './higher-order/with-spoken-messages';\nexport * from './text';\n\n// Mobile Components\nexport {\n\t__unstableAutocompletionItemsFill,\n\t__unstableAutocompletionItemsSlot,\n} from './mobile/autocompletion-items';\nexport { default as Autocomplete } from './autocomplete';\nexport { default as BottomSheet } from './mobile/bottom-sheet';\nexport {\n\tBottomSheetConsumer,\n\tBottomSheetProvider,\n\tBottomSheetContext,\n} from './mobile/bottom-sheet/bottom-sheet-context';\nexport { default as BottomSheetSelectControl } from './mobile/bottom-sheet-select-control';\nexport { default as HTMLTextInput } from './mobile/html-text-input';\nexport { default as KeyboardAvoidingView } from './mobile/keyboard-avoiding-view';\nexport { default as KeyboardAwareFlatList } from './mobile/keyboard-aware-flat-list';\nexport { default as Picker } from './mobile/picker';\nexport { default as ReadableContentView } from './mobile/readable-content-view';\nexport { default as CycleSelectControl } from './mobile/cycle-select-control';\nexport { default as Gradient } from './mobile/gradient';\nexport { default as ColorSettings } from './mobile/color-settings';\nexport { default as SegmentedControls } from './mobile/segmented-control';\nexport { default as FocalPointSettingsPanel } from './mobile/focal-point-settings-panel';\nexport { default as BottomSheetTextControl } from './mobile/bottom-sheet-text-control';\nexport { default as FooterMessageLink } from './mobile/bottom-sheet/footer-message-link/footer-message-link';\nexport { LinkPicker } from './mobile/link-picker';\nexport { default as LinkPickerScreen } from './mobile/link-picker/link-picker-screen';\nexport { default as LinkSettings } from './mobile/link-settings';\nexport { default as LinkSettingsScreen } from './mobile/link-settings/link-settings-screen';\nexport { default as LinkSettingsNavigation } from './mobile/link-settings/link-settings-navigation';\nexport { default as ImageLinkDestinationsScreen } from './mobile/link-settings/image-link-destinations-screen';\nexport { default as SegmentedControl } from './mobile/segmented-control';\nexport { default as Image, IMAGE_DEFAULT_FOCAL_POINT } from './mobile/image';\nexport { default as ImageEditingButton } from './mobile/image/image-editing-button';\nexport { default as InserterButton } from './mobile/inserter-button';\nexport { setClipboard, getClipboard } from './mobile/clipboard';\nexport { default as AudioPlayer } from './mobile/audio-player';\nexport { default as Badge } from './mobile/badge';\nexport { default as Gridicons } from './mobile/gridicons';\n\n// Utils\nexport { colorsUtils } from './mobile/color-settings/utils';\nexport {\n\tWIDE_ALIGNMENTS,\n\tALIGNMENT_BREAKPOINTS,\n\talignmentHelpers,\n} from './mobile/utils/alignments';\n\n// Hooks\nexport {\n\tconvertUnitToMobile,\n\tuseConvertUnitToMobile,\n\tgetValueAndUnit,\n} from './mobile/utils/use-unit-converter-to-mobile';\n\nexport {\n\tdefault as GlobalStylesContext,\n\tuseGlobalStyles,\n\twithGlobalStyles,\n\tgetMergedGlobalStyles,\n} from './mobile/global-styles-context';\nexport { getGlobalStyles } from './mobile/global-styles-context/utils';\n"]}
|
|
@@ -115,6 +115,7 @@ class BottomSheetCell extends _element.Component {
|
|
|
115
115
|
valuePlaceholder = '',
|
|
116
116
|
icon,
|
|
117
117
|
leftAlign,
|
|
118
|
+
iconStyle = {},
|
|
118
119
|
labelStyle = {},
|
|
119
120
|
valueStyle = {},
|
|
120
121
|
cellContainerStyle = {},
|
|
@@ -259,7 +260,7 @@ class BottomSheetCell extends _element.Component {
|
|
|
259
260
|
(0, _i18n._x)('%1$s, %2$s, %3$s', 'inline textinput cell'), label, value, help);
|
|
260
261
|
};
|
|
261
262
|
|
|
262
|
-
const
|
|
263
|
+
const iconStyleBase = getStylesFromColorScheme(_styles.default.icon, _styles.default.iconDark);
|
|
263
264
|
const resetButtonStyle = getStylesFromColorScheme(_styles.default.resetButton, _styles.default.resetButtonDark);
|
|
264
265
|
const cellHelpStyle = [_styles.default.cellHelpLabel, isIOS && _styles.default.cellHelpLabelIOS];
|
|
265
266
|
const containerPointerEvents = this.state.isScreenReaderEnabled && accessible ? 'none' : 'auto';
|
|
@@ -295,7 +296,8 @@ class BottomSheetCell extends _element.Component {
|
|
|
295
296
|
}, (0, _element.createElement)(_components.Icon, {
|
|
296
297
|
icon: icon,
|
|
297
298
|
size: 24,
|
|
298
|
-
fill: iconStyle.color,
|
|
299
|
+
fill: iconStyle.color || iconStyleBase.color,
|
|
300
|
+
style: iconStyle,
|
|
299
301
|
isPressed: false
|
|
300
302
|
}), (0, _element.createElement)(_reactNative.View, {
|
|
301
303
|
style: _cellStyles.default.labelIconSeparator
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/cell.native.js"],"names":["isIOS","Platform","OS","BottomSheetCell","Component","constructor","props","arguments","state","isEditingValue","autoFocus","isScreenReaderEnabled","handleScreenReaderToggled","bind","isCurrent","componentDidUpdate","prevProps","prevState","_valueTextInput","focus","componentDidMount","AccessibilityInfo","addEventListener","then","setState","componentWillUnmount","removeEventListener","typeToKeyboardType","type","step","keyboardType","Math","abs","render","accessible","accessibilityLabel","accessibilityHint","accessibilityRole","disabled","activeOpacity","onPress","onLongPress","label","subLabel","value","valuePlaceholder","icon","leftAlign","labelStyle","valueStyle","cellContainerStyle","cellRowContainerStyle","onChangeValue","onSubmit","children","editable","isSelected","separatorType","style","getStylesFromColorScheme","customActionButton","borderless","help","valueProps","showValue","undefined","isValueEditable","cellLabelStyle","styles","cellLabel","cellTextDark","cellLabelCenteredStyle","cellLabelCentered","cellLabelLeftAlignNoIconStyle","cellLabelLeftAlignNoIcon","defaultMissingIconAndValue","defaultLabelStyle","defaultSubLabelStyleText","cellSubLabelText","cellSubLabelTextDark","drawSeparator","separatorStyle","drawTopSeparator","cellContainerStyles","cellContainer","rowContainerStyles","cellRowContainer","isInteractive","onCellPress","startEditing","finishEditing","defaultSeparatorStyle","separator","separatorDark","cellSeparatorStyle","cellSeparator","cellSeparatorDark","leftMarginStyle","platformStyles","separatorMarginLeft","getValueComponent","styleRTL","I18nManager","isRTL","cellValueRTL","cellValueStyle","cellValue","finalStyle","shouldShowPlaceholder","c","getAccessibilityLabel","iconStyle","iconDark","resetButtonStyle","resetButton","resetButtonDark","cellHelpStyle","cellHelpLabel","cellHelpLabelIOS","containerPointerEvents","title","handler","opacity","clipToBounds","color","labelIconSeparator","check","placeholderColor"],"mappings":";;;;;;;;;AAmBA;;;;AAhBA;;AASA;;AAKA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAYA;AACA;AACA;;AAOA;AACA;AACA;AAKA,MAAMA,KAAK,GAAGC,sBAASC,EAAT,KAAgB,KAA9B;;AACA,MAAMC,eAAN,SAA8BC,kBAA9B,CAAwC;AACvCC,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAO,GAAGC,SAAV;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,cAAc,EAAEH,KAAK,CAACI,SAAN,IAAmB,KADvB;AAEZC,MAAAA,qBAAqB,EAAE;AAFX,KAAb;AAKA,SAAKC,yBAAL,GAAiC,KAAKA,yBAAL,CAA+BC,IAA/B,CAChC,IADgC,CAAjC;AAIA,SAAKC,SAAL,GAAiB,KAAjB;AACA;;AAEDC,EAAAA,kBAAkB,CAAEC,SAAF,EAAaC,SAAb,EAAyB;AAC1C,QAAK,CAAEA,SAAS,CAACR,cAAZ,IAA8B,KAAKD,KAAL,CAAWC,cAA9C,EAA+D;AAC9D,WAAKS,eAAL,CAAqBC,KAArB;AACA;AACD;;AAEDC,EAAAA,iBAAiB,GAAG;AACnB,SAAKN,SAAL,GAAiB,IAAjB;;AACAO,mCAAkBC,gBAAlB,CACC,qBADD,EAEC,KAAKV,yBAFN;;AAKAS,mCAAkBV,qBAAlB,GAA0CY,IAA1C,CACGZ,qBAAF,IAA6B;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,UAFO;AADT,OAMGN,KANH,CADD,EASC,4BAAC,iBAAD;AAAM,MAAA,KAAK,EAAGmC;AAAd,OACGlC,QADH,CATD,CAjBF,EA+BG,CAAEA,QAAF,IAAcD,KAAd,IACD,4BAAC,iBAAD;AACC,MAAA,KAAK,EAAG,CAAEkC,iBAAF,EAAqB5B,UAArB;AADT,OAGGN,KAHH,CAhCF,CADD,EAwCGkB,kBAAkB,IACnB,4BAAC,6BAAD;AACC,MAAA,OAAO,EAAG6D,OADX;AAEC,MAAA,iBAAiB,EAAG;AAFrB,OAIC,4BAAC,iBAAD;AAAM,MAAA,KAAK,EAAGR;AAAd,OACGO,KADH,CAJD,CAzCF,CAJD,EAuDGhE,UAAU,IACX,4BAAC,gBAAD;AACC,MAAA,IAAI,EAAGsE,YADR;AAEC,MAAA,IAAI,EAAG5B,oBAAe1C,UAAf,CAA0BoE;AAFlC,MAxDF,EA6DG5D,SAAS,IAAIoC,iBAAiB,EA7DjC,EA8DG9C,QA9DH,CAtBD,EAsFGQ,IAAI,IACL,4BAAC,iBAAD;AAAM,MAAA,KAAK,EAAG,CAAEsD,aAAF,EAAiBhD,gBAAO2D,gBAAxB;AAAd,OACGjE,IADH,CAvFF,EA2FG,CAAEoB,gBAAF,IAAsB,4BAAC,iBAAD;AAAM,MAAA,KAAK,EAAGD,cAAc;AAA5B,MA3FzB,CADD;AA+FA;;AA1YsC;;eA6YzB,uCAA0B9E,eAA1B,C","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tTouchableOpacity,\n\tText,\n\tView,\n\tTextInput,\n\tI18nManager,\n\tAccessibilityInfo,\n\tPlatform,\n} from 'react-native';\nimport { isEmpty, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { check } from '@wordpress/icons';\nimport { Component } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport platformStyles from './cellStyles.scss';\nimport TouchableRipple from './ripple';\n\nconst isIOS = Platform.OS === 'ios';\nclass BottomSheetCell extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\tisEditingValue: props.autoFocus || false,\n\t\t\tisScreenReaderEnabled: false,\n\t\t};\n\n\t\tthis.handleScreenReaderToggled = this.handleScreenReaderToggled.bind(\n\t\t\tthis\n\t\t);\n\n\t\tthis.isCurrent = false;\n\t}\n\n\tcomponentDidUpdate( prevProps, prevState ) {\n\t\tif ( ! prevState.isEditingValue && this.state.isEditingValue ) {\n\t\t\tthis._valueTextInput.focus();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.isCurrent = true;\n\t\tAccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\tthis.handleScreenReaderToggled\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then(\n\t\t\t( isScreenReaderEnabled ) => {\n\t\t\t\tif ( this.isCurrent ) {\n\t\t\t\t\tthis.setState( { isScreenReaderEnabled } );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.isCurrent = false;\n\t\tAccessibilityInfo.removeEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\tthis.handleScreenReaderToggled\n\t\t);\n\t}\n\n\thandleScreenReaderToggled( isScreenReaderEnabled ) {\n\t\tthis.setState( { isScreenReaderEnabled } );\n\t}\n\n\ttypeToKeyboardType( type, step ) {\n\t\tlet keyboardType = `default`;\n\t\tif ( type === `number` ) {\n\t\t\tif ( step && Math.abs( step ) < 1 ) {\n\t\t\t\tkeyboardType = `decimal-pad`;\n\t\t\t} else {\n\t\t\t\tkeyboardType = `number-pad`;\n\t\t\t}\n\t\t}\n\t\treturn keyboardType;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\taccessible,\n\t\t\taccessibilityLabel,\n\t\t\taccessibilityHint,\n\t\t\taccessibilityRole,\n\t\t\tdisabled = false,\n\t\t\tactiveOpacity,\n\t\t\tonPress,\n\t\t\tonLongPress,\n\t\t\tlabel,\n\t\t\tsubLabel,\n\t\t\tvalue,\n\t\t\tvaluePlaceholder = '',\n\t\t\ticon,\n\t\t\tleftAlign,\n\t\t\tlabelStyle = {},\n\t\t\tvalueStyle = {},\n\t\t\tcellContainerStyle = {},\n\t\t\tcellRowContainerStyle = {},\n\t\t\tonChangeValue,\n\t\t\tonSubmit,\n\t\t\tchildren,\n\t\t\teditable = true,\n\t\t\tisSelected = false,\n\t\t\tseparatorType,\n\t\t\tstyle = {},\n\t\t\tgetStylesFromColorScheme,\n\t\t\tcustomActionButton,\n\t\t\ttype,\n\t\t\tstep,\n\t\t\tborderless,\n\t\t\thelp,\n\t\t\t...valueProps\n\t\t} = this.props;\n\n\t\tconst showValue = value !== undefined;\n\t\tconst isValueEditable = editable && onChangeValue !== undefined;\n\t\tconst cellLabelStyle = getStylesFromColorScheme(\n\t\t\tstyles.cellLabel,\n\t\t\tstyles.cellTextDark\n\t\t);\n\t\tconst cellLabelCenteredStyle = getStylesFromColorScheme(\n\t\t\tstyles.cellLabelCentered,\n\t\t\tstyles.cellTextDark\n\t\t);\n\t\tconst cellLabelLeftAlignNoIconStyle = getStylesFromColorScheme(\n\t\t\tstyles.cellLabelLeftAlignNoIcon,\n\t\t\tstyles.cellTextDark\n\t\t);\n\t\tconst defaultMissingIconAndValue = leftAlign\n\t\t\t? cellLabelLeftAlignNoIconStyle\n\t\t\t: cellLabelCenteredStyle;\n\t\tconst defaultLabelStyle =\n\t\t\tshowValue || customActionButton || icon\n\t\t\t\t? cellLabelStyle\n\t\t\t\t: defaultMissingIconAndValue;\n\n\t\tconst defaultSubLabelStyleText = getStylesFromColorScheme(\n\t\t\tstyles.cellSubLabelText,\n\t\t\tstyles.cellSubLabelTextDark\n\t\t);\n\n\t\tconst drawSeparator =\n\t\t\t( separatorType && separatorType !== 'none' ) ||\n\t\t\tseparatorStyle === undefined;\n\t\tconst drawTopSeparator =\n\t\t\tdrawSeparator && separatorType === 'topFullWidth';\n\n\t\tconst cellContainerStyles = [\n\t\t\tstyles.cellContainer,\n\t\t\tcellContainerStyle,\n\t\t];\n\t\tconst rowContainerStyles = [\n\t\t\tstyles.cellRowContainer,\n\t\t\tcellRowContainerStyle,\n\t\t];\n\n\t\tconst isInteractive =\n\t\t\tisValueEditable ||\n\t\t\tonPress !== undefined ||\n\t\t\tonLongPress !== undefined;\n\n\t\tconst onCellPress = () => {\n\t\t\tif ( isValueEditable ) {\n\t\t\t\tstartEditing();\n\t\t\t} else if ( onPress !== undefined ) {\n\t\t\t\tonPress();\n\t\t\t}\n\t\t};\n\n\t\tconst finishEditing = () => {\n\t\t\tthis.setState( { isEditingValue: false } );\n\t\t};\n\n\t\tconst startEditing = () => {\n\t\t\tif ( this.state.isEditingValue === false ) {\n\t\t\t\tthis.setState( { isEditingValue: true } );\n\t\t\t}\n\t\t};\n\n\t\tconst separatorStyle = () => {\n\t\t\t//eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\t\tconst defaultSeparatorStyle = this.props.getStylesFromColorScheme(\n\t\t\t\tstyles.separator,\n\t\t\t\tstyles.separatorDark\n\t\t\t);\n\t\t\tconst cellSeparatorStyle = this.props.getStylesFromColorScheme(\n\t\t\t\tstyles.cellSeparator,\n\t\t\t\tstyles.cellSeparatorDark\n\t\t\t);\n\t\t\tconst leftMarginStyle = {\n\t\t\t\t...cellSeparatorStyle,\n\t\t\t\t...platformStyles.separatorMarginLeft,\n\t\t\t};\n\t\t\tswitch ( separatorType ) {\n\t\t\t\tcase 'leftMargin':\n\t\t\t\t\treturn leftMarginStyle;\n\t\t\t\tcase 'fullWidth':\n\t\t\t\tcase 'topFullWidth':\n\t\t\t\t\treturn defaultSeparatorStyle;\n\t\t\t\tcase 'none':\n\t\t\t\t\treturn undefined;\n\t\t\t\tcase undefined:\n\t\t\t\t\tif ( showValue && icon ) {\n\t\t\t\t\t\treturn leftMarginStyle;\n\t\t\t\t\t}\n\t\t\t\t\treturn defaultSeparatorStyle;\n\t\t\t}\n\t\t};\n\n\t\tconst getValueComponent = () => {\n\t\t\tconst styleRTL = I18nManager.isRTL && styles.cellValueRTL;\n\t\t\tconst cellValueStyle = this.props.getStylesFromColorScheme(\n\t\t\t\tstyles.cellValue,\n\t\t\t\tstyles.cellTextDark\n\t\t\t);\n\t\t\tconst finalStyle = {\n\t\t\t\t...cellValueStyle,\n\t\t\t\t...valueStyle,\n\t\t\t\t...styleRTL,\n\t\t\t};\n\n\t\t\t// To be able to show the `middle` ellipsizeMode on editable cells\n\t\t\t// we show the TextInput just when the user wants to edit the value,\n\t\t\t// and the Text component to display it.\n\t\t\t// We also show the TextInput to display placeholder.\n\t\t\tconst shouldShowPlaceholder = isValueEditable && value === '';\n\t\t\treturn this.state.isEditingValue || shouldShowPlaceholder ? (\n\t\t\t\t<TextInput\n\t\t\t\t\tref={ ( c ) => ( this._valueTextInput = c ) }\n\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\tstyle={ finalStyle }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tplaceholder={ valuePlaceholder }\n\t\t\t\t\tplaceholderTextColor={ '#87a6bc' }\n\t\t\t\t\tonChangeText={ onChangeValue }\n\t\t\t\t\teditable={ isValueEditable }\n\t\t\t\t\tpointerEvents={\n\t\t\t\t\t\tthis.state.isEditingValue ? 'auto' : 'none'\n\t\t\t\t\t}\n\t\t\t\t\tonFocus={ startEditing }\n\t\t\t\t\tonBlur={ finishEditing }\n\t\t\t\t\tonSubmitEditing={ onSubmit }\n\t\t\t\t\tkeyboardType={ this.typeToKeyboardType( type, step ) }\n\t\t\t\t\t{ ...valueProps }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Text\n\t\t\t\t\tstyle={ { ...cellValueStyle, ...valueStyle } }\n\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\tellipsizeMode={ 'middle' }\n\t\t\t\t>\n\t\t\t\t\t{ value }\n\t\t\t\t</Text>\n\t\t\t);\n\t\t};\n\n\t\tconst getAccessibilityLabel = () => {\n\t\t\tif ( accessible === false ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( accessibilityLabel || ! showValue ) {\n\t\t\t\treturn accessibilityLabel || label;\n\t\t\t}\n\n\t\t\tif ( isEmpty( value ) ) {\n\t\t\t\treturn isEmpty( help )\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: accessibility text. Empty state of a inline textinput cell. %s: The cell's title */\n\t\t\t\t\t\t\t_x( '%s. Empty', 'inline textinput cell' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: // Separating by ',' is necessary to make a pause on urls (non-capitalized text)\n\t\t\t\t\t sprintf(\n\t\t\t\t\t\t\t/* translators: accessibility text. Empty state of a inline textinput cell. %1: Cell title, %2: cell help. */\n\t\t\t\t\t\t\t_x( '%1$s, %2$s. Empty', 'inline textinput cell' ),\n\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\thelp\n\t\t\t\t\t );\n\t\t\t}\n\t\t\treturn isEmpty( help )\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. Inline textinput title and value.%1: Cell title, %2: cell value. */\n\t\t\t\t\t\t_x( '%1$s, %2$s', 'inline textinput cell' ),\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tvalue\n\t\t\t\t ) // Separating by ',' is necessary to make a pause on urls (non-capitalized text)\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. Inline textinput title, value and help text.%1: Cell title, %2: cell value, , %3: cell help. */\n\t\t\t\t\t\t_x( '%1$s, %2$s, %3$s', 'inline textinput cell' ),\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\thelp\n\t\t\t\t );\n\t\t};\n\n\t\tconst iconStyle = getStylesFromColorScheme(\n\t\t\tstyles.icon,\n\t\t\tstyles.iconDark\n\t\t);\n\t\tconst resetButtonStyle = getStylesFromColorScheme(\n\t\t\tstyles.resetButton,\n\t\t\tstyles.resetButtonDark\n\t\t);\n\t\tconst cellHelpStyle = [\n\t\t\tstyles.cellHelpLabel,\n\t\t\tisIOS && styles.cellHelpLabelIOS,\n\t\t];\n\t\tconst containerPointerEvents =\n\t\t\tthis.state.isScreenReaderEnabled && accessible ? 'none' : 'auto';\n\t\tconst { title, handler } = customActionButton || {};\n\n\t\tconst opacity =\n\t\t\tactiveOpacity !== undefined\n\t\t\t\t? activeOpacity\n\t\t\t\t: get( platformStyles, 'activeOpacity.opacity' );\n\n\t\treturn (\n\t\t\t<TouchableRipple\n\t\t\t\taccessible={\n\t\t\t\t\taccessible !== undefined\n\t\t\t\t\t\t? accessible\n\t\t\t\t\t\t: ! this.state.isEditingValue\n\t\t\t\t}\n\t\t\t\taccessibilityLabel={ getAccessibilityLabel() }\n\t\t\t\taccessibilityRole={ accessibilityRole || 'button' }\n\t\t\t\taccessibilityHint={\n\t\t\t\t\tisValueEditable\n\t\t\t\t\t\t? /* translators: accessibility text */\n\t\t\t\t\t\t __( 'Double tap to edit this value' )\n\t\t\t\t\t\t: accessibilityHint\n\t\t\t\t}\n\t\t\t\tdisabled={ disabled || ! isInteractive }\n\t\t\t\tactiveOpacity={ opacity }\n\t\t\t\tonPress={ onCellPress }\n\t\t\t\tonLongPress={ onLongPress }\n\t\t\t\tstyle={ [ styles.clipToBounds, style ] }\n\t\t\t\tborderless={ borderless }\n\t\t\t>\n\t\t\t\t{ drawTopSeparator && <View style={ separatorStyle() } /> }\n\t\t\t\t<View\n\t\t\t\t\tstyle={ cellContainerStyles }\n\t\t\t\t\tpointerEvents={ containerPointerEvents }\n\t\t\t\t>\n\t\t\t\t\t<View style={ rowContainerStyles }>\n\t\t\t\t\t\t<View style={ styles.cellRowContainer }>\n\t\t\t\t\t\t\t{ icon && (\n\t\t\t\t\t\t\t\t<View style={ styles.cellRowContainer }>\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\t\t\tfill={ iconStyle.color }\n\t\t\t\t\t\t\t\t\t\tisPressed={ false }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\t\tplatformStyles.labelIconSeparator\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ subLabel && label && (\n\t\t\t\t\t\t\t\t<View>\n\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\t\tdefaultLabelStyle,\n\t\t\t\t\t\t\t\t\t\t\tlabelStyle,\n\t\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t<Text style={ defaultSubLabelStyleText }>\n\t\t\t\t\t\t\t\t\t\t{ subLabel }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ! subLabel && label && (\n\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\tstyle={ [ defaultLabelStyle, labelStyle ] }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t\t{ customActionButton && (\n\t\t\t\t\t\t\t<TouchableOpacity\n\t\t\t\t\t\t\t\tonPress={ handler }\n\t\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Text style={ resetButtonStyle }>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</View>\n\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ check }\n\t\t\t\t\t\t\tfill={ platformStyles.isSelected.color }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showValue && getValueComponent() }\n\t\t\t\t\t{ children }\n\t\t\t\t</View>\n\t\t\t\t{ help && (\n\t\t\t\t\t<Text style={ [ cellHelpStyle, styles.placeholderColor ] }>\n\t\t\t\t\t\t{ help }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t\t{ ! drawTopSeparator && <View style={ separatorStyle() } /> }\n\t\t\t</TouchableRipple>\n\t\t);\n\t}\n}\n\nexport default withPreferredColorScheme( BottomSheetCell );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/cell.native.js"],"names":["isIOS","Platform","OS","BottomSheetCell","Component","constructor","props","arguments","state","isEditingValue","autoFocus","isScreenReaderEnabled","handleScreenReaderToggled","bind","isCurrent","componentDidUpdate","prevProps","prevState","_valueTextInput","focus","componentDidMount","AccessibilityInfo","addEventListener","then","setState","componentWillUnmount","removeEventListener","typeToKeyboardType","type","step","keyboardType","Math","abs","render","accessible","accessibilityLabel","accessibilityHint","accessibilityRole","disabled","activeOpacity","onPress","onLongPress","label","subLabel","value","valuePlaceholder","icon","leftAlign","iconStyle","labelStyle","valueStyle","cellContainerStyle","cellRowContainerStyle","onChangeValue","onSubmit","children","editable","isSelected","separatorType","style","getStylesFromColorScheme","customActionButton","borderless","help","valueProps","showValue","undefined","isValueEditable","cellLabelStyle","styles","cellLabel","cellTextDark","cellLabelCenteredStyle","cellLabelCentered","cellLabelLeftAlignNoIconStyle","cellLabelLeftAlignNoIcon","defaultMissingIconAndValue","defaultLabelStyle","defaultSubLabelStyleText","cellSubLabelText","cellSubLabelTextDark","drawSeparator","separatorStyle","drawTopSeparator","cellContainerStyles","cellContainer","rowContainerStyles","cellRowContainer","isInteractive","onCellPress","startEditing","finishEditing","defaultSeparatorStyle","separator","separatorDark","cellSeparatorStyle","cellSeparator","cellSeparatorDark","leftMarginStyle","platformStyles","separatorMarginLeft","getValueComponent","styleRTL","I18nManager","isRTL","cellValueRTL","cellValueStyle","cellValue","finalStyle","shouldShowPlaceholder","c","getAccessibilityLabel","iconStyleBase","iconDark","resetButtonStyle","resetButton","resetButtonDark","cellHelpStyle","cellHelpLabel","cellHelpLabelIOS","containerPointerEvents","title","handler","opacity","clipToBounds","color","labelIconSeparator","check","placeholderColor"],"mappings":";;;;;;;;;AAmBA;;;;AAhBA;;AASA;;AAKA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAYA;AACA;AACA;;AAOA;AACA;AACA;AAKA,MAAMA,KAAK,GAAGC,sBAASC,EAAT,KAAgB,KAA9B;;AACA,MAAMC,eAAN,SAA8BC,kBAA9B,CAAwC;AACvCC,EAAAA,WAAW,CAAEC,KAAF,EAAU;AACpB,UAAO,GAAGC,SAAV;AACA,SAAKC,KAAL,GAAa;AACZC,MAAAA,cAAc,EAAEH,KAAK,CAACI,SAAN,IAAmB,KADvB;AAEZC,MAAAA,qBAAqB,EAAE;AAFX,KAAb;AAKA,SAAKC,yBAAL,GAAiC,KAAKA,yBAAL,CAA+BC,IAA/B,CAChC,IADgC,CAAjC;AAIA,SAAKC,SAAL,GAAiB,KAAjB;AACA;;AAEDC,EAAAA,kBAAkB,CAAEC,SAAF,EAAaC,SAAb,EAAyB;AAC1C,QAAK,CAAEA,SAAS,CAACR,cAAZ,IAA8B,KAAKD,KAAL,CAAWC,cAA9C,EAA+D;AAC9D,WAAKS,eAAL,CAAqBC,KAArB;AACA;AACD;;AAEDC,EAAAA,i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\n\tAccessibilityInfo,\n\tPlatform,\n} from 'react-native';\nimport { isEmpty, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { check } from '@wordpress/icons';\nimport { Component } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\nimport platformStyles from './cellStyles.scss';\nimport TouchableRipple from './ripple';\n\nconst isIOS = Platform.OS === 'ios';\nclass BottomSheetCell extends Component {\n\tconstructor( props ) {\n\t\tsuper( ...arguments );\n\t\tthis.state = {\n\t\t\tisEditingValue: props.autoFocus || false,\n\t\t\tisScreenReaderEnabled: false,\n\t\t};\n\n\t\tthis.handleScreenReaderToggled = this.handleScreenReaderToggled.bind(\n\t\t\tthis\n\t\t);\n\n\t\tthis.isCurrent = false;\n\t}\n\n\tcomponentDidUpdate( prevProps, prevState ) {\n\t\tif ( ! prevState.isEditingValue && this.state.isEditingValue ) {\n\t\t\tthis._valueTextInput.focus();\n\t\t}\n\t}\n\n\tcomponentDidMount() {\n\t\tthis.isCurrent = true;\n\t\tAccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\tthis.handleScreenReaderToggled\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then(\n\t\t\t( isScreenReaderEnabled ) => {\n\t\t\t\tif ( this.isCurrent ) {\n\t\t\t\t\tthis.setState( { isScreenReaderEnabled } );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\tcomponentWillUnmount() {\n\t\tthis.isCurrent = false;\n\t\tAccessibilityInfo.removeEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\tthis.handleScreenReaderToggled\n\t\t);\n\t}\n\n\thandleScreenReaderToggled( isScreenReaderEnabled ) {\n\t\tthis.setState( { isScreenReaderEnabled } );\n\t}\n\n\ttypeToKeyboardType( type, step ) {\n\t\tlet keyboardType = `default`;\n\t\tif ( type === `number` ) {\n\t\t\tif ( step && Math.abs( step ) < 1 ) {\n\t\t\t\tkeyboardType = `decimal-pad`;\n\t\t\t} else {\n\t\t\t\tkeyboardType = `number-pad`;\n\t\t\t}\n\t\t}\n\t\treturn keyboardType;\n\t}\n\n\trender() {\n\t\tconst {\n\t\t\taccessible,\n\t\t\taccessibilityLabel,\n\t\t\taccessibilityHint,\n\t\t\taccessibilityRole,\n\t\t\tdisabled = false,\n\t\t\tactiveOpacity,\n\t\t\tonPress,\n\t\t\tonLongPress,\n\t\t\tlabel,\n\t\t\tsubLabel,\n\t\t\tvalue,\n\t\t\tvaluePlaceholder = '',\n\t\t\ticon,\n\t\t\tleftAlign,\n\t\t\ticonStyle = {},\n\t\t\tlabelStyle = {},\n\t\t\tvalueStyle = {},\n\t\t\tcellContainerStyle = {},\n\t\t\tcellRowContainerStyle = {},\n\t\t\tonChangeValue,\n\t\t\tonSubmit,\n\t\t\tchildren,\n\t\t\teditable = true,\n\t\t\tisSelected = false,\n\t\t\tseparatorType,\n\t\t\tstyle = {},\n\t\t\tgetStylesFromColorScheme,\n\t\t\tcustomActionButton,\n\t\t\ttype,\n\t\t\tstep,\n\t\t\tborderless,\n\t\t\thelp,\n\t\t\t...valueProps\n\t\t} = this.props;\n\n\t\tconst showValue = value !== undefined;\n\t\tconst isValueEditable = editable && onChangeValue !== undefined;\n\t\tconst cellLabelStyle = getStylesFromColorScheme(\n\t\t\tstyles.cellLabel,\n\t\t\tstyles.cellTextDark\n\t\t);\n\t\tconst cellLabelCenteredStyle = getStylesFromColorScheme(\n\t\t\tstyles.cellLabelCentered,\n\t\t\tstyles.cellTextDark\n\t\t);\n\t\tconst cellLabelLeftAlignNoIconStyle = getStylesFromColorScheme(\n\t\t\tstyles.cellLabelLeftAlignNoIcon,\n\t\t\tstyles.cellTextDark\n\t\t);\n\t\tconst defaultMissingIconAndValue = leftAlign\n\t\t\t? cellLabelLeftAlignNoIconStyle\n\t\t\t: cellLabelCenteredStyle;\n\t\tconst defaultLabelStyle =\n\t\t\tshowValue || customActionButton || icon\n\t\t\t\t? cellLabelStyle\n\t\t\t\t: defaultMissingIconAndValue;\n\n\t\tconst defaultSubLabelStyleText = getStylesFromColorScheme(\n\t\t\tstyles.cellSubLabelText,\n\t\t\tstyles.cellSubLabelTextDark\n\t\t);\n\n\t\tconst drawSeparator =\n\t\t\t( separatorType && separatorType !== 'none' ) ||\n\t\t\tseparatorStyle === undefined;\n\t\tconst drawTopSeparator =\n\t\t\tdrawSeparator && separatorType === 'topFullWidth';\n\n\t\tconst cellContainerStyles = [\n\t\t\tstyles.cellContainer,\n\t\t\tcellContainerStyle,\n\t\t];\n\t\tconst rowContainerStyles = [\n\t\t\tstyles.cellRowContainer,\n\t\t\tcellRowContainerStyle,\n\t\t];\n\n\t\tconst isInteractive =\n\t\t\tisValueEditable ||\n\t\t\tonPress !== undefined ||\n\t\t\tonLongPress !== undefined;\n\n\t\tconst onCellPress = () => {\n\t\t\tif ( isValueEditable ) {\n\t\t\t\tstartEditing();\n\t\t\t} else if ( onPress !== undefined ) {\n\t\t\t\tonPress();\n\t\t\t}\n\t\t};\n\n\t\tconst finishEditing = () => {\n\t\t\tthis.setState( { isEditingValue: false } );\n\t\t};\n\n\t\tconst startEditing = () => {\n\t\t\tif ( this.state.isEditingValue === false ) {\n\t\t\t\tthis.setState( { isEditingValue: true } );\n\t\t\t}\n\t\t};\n\n\t\tconst separatorStyle = () => {\n\t\t\t//eslint-disable-next-line @wordpress/no-unused-vars-before-return\n\t\t\tconst defaultSeparatorStyle = this.props.getStylesFromColorScheme(\n\t\t\t\tstyles.separator,\n\t\t\t\tstyles.separatorDark\n\t\t\t);\n\t\t\tconst cellSeparatorStyle = this.props.getStylesFromColorScheme(\n\t\t\t\tstyles.cellSeparator,\n\t\t\t\tstyles.cellSeparatorDark\n\t\t\t);\n\t\t\tconst leftMarginStyle = {\n\t\t\t\t...cellSeparatorStyle,\n\t\t\t\t...platformStyles.separatorMarginLeft,\n\t\t\t};\n\t\t\tswitch ( separatorType ) {\n\t\t\t\tcase 'leftMargin':\n\t\t\t\t\treturn leftMarginStyle;\n\t\t\t\tcase 'fullWidth':\n\t\t\t\tcase 'topFullWidth':\n\t\t\t\t\treturn defaultSeparatorStyle;\n\t\t\t\tcase 'none':\n\t\t\t\t\treturn undefined;\n\t\t\t\tcase undefined:\n\t\t\t\t\tif ( showValue && icon ) {\n\t\t\t\t\t\treturn leftMarginStyle;\n\t\t\t\t\t}\n\t\t\t\t\treturn defaultSeparatorStyle;\n\t\t\t}\n\t\t};\n\n\t\tconst getValueComponent = () => {\n\t\t\tconst styleRTL = I18nManager.isRTL && styles.cellValueRTL;\n\t\t\tconst cellValueStyle = this.props.getStylesFromColorScheme(\n\t\t\t\tstyles.cellValue,\n\t\t\t\tstyles.cellTextDark\n\t\t\t);\n\t\t\tconst finalStyle = {\n\t\t\t\t...cellValueStyle,\n\t\t\t\t...valueStyle,\n\t\t\t\t...styleRTL,\n\t\t\t};\n\n\t\t\t// To be able to show the `middle` ellipsizeMode on editable cells\n\t\t\t// we show the TextInput just when the user wants to edit the value,\n\t\t\t// and the Text component to display it.\n\t\t\t// We also show the TextInput to display placeholder.\n\t\t\tconst shouldShowPlaceholder = isValueEditable && value === '';\n\t\t\treturn this.state.isEditingValue || shouldShowPlaceholder ? (\n\t\t\t\t<TextInput\n\t\t\t\t\tref={ ( c ) => ( this._valueTextInput = c ) }\n\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\tstyle={ finalStyle }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tplaceholder={ valuePlaceholder }\n\t\t\t\t\tplaceholderTextColor={ '#87a6bc' }\n\t\t\t\t\tonChangeText={ onChangeValue }\n\t\t\t\t\teditable={ isValueEditable }\n\t\t\t\t\tpointerEvents={\n\t\t\t\t\t\tthis.state.isEditingValue ? 'auto' : 'none'\n\t\t\t\t\t}\n\t\t\t\t\tonFocus={ startEditing }\n\t\t\t\t\tonBlur={ finishEditing }\n\t\t\t\t\tonSubmitEditing={ onSubmit }\n\t\t\t\t\tkeyboardType={ this.typeToKeyboardType( type, step ) }\n\t\t\t\t\t{ ...valueProps }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Text\n\t\t\t\t\tstyle={ { ...cellValueStyle, ...valueStyle } }\n\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\tellipsizeMode={ 'middle' }\n\t\t\t\t>\n\t\t\t\t\t{ value }\n\t\t\t\t</Text>\n\t\t\t);\n\t\t};\n\n\t\tconst getAccessibilityLabel = () => {\n\t\t\tif ( accessible === false ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( accessibilityLabel || ! showValue ) {\n\t\t\t\treturn accessibilityLabel || label;\n\t\t\t}\n\n\t\t\tif ( isEmpty( value ) ) {\n\t\t\t\treturn isEmpty( help )\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t/* translators: accessibility text. Empty state of a inline textinput cell. %s: The cell's title */\n\t\t\t\t\t\t\t_x( '%s. Empty', 'inline textinput cell' ),\n\t\t\t\t\t\t\tlabel\n\t\t\t\t\t )\n\t\t\t\t\t: // Separating by ',' is necessary to make a pause on urls (non-capitalized text)\n\t\t\t\t\t sprintf(\n\t\t\t\t\t\t\t/* translators: accessibility text. Empty state of a inline textinput cell. %1: Cell title, %2: cell help. */\n\t\t\t\t\t\t\t_x( '%1$s, %2$s. Empty', 'inline textinput cell' ),\n\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\thelp\n\t\t\t\t\t );\n\t\t\t}\n\t\t\treturn isEmpty( help )\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. Inline textinput title and value.%1: Cell title, %2: cell value. */\n\t\t\t\t\t\t_x( '%1$s, %2$s', 'inline textinput cell' ),\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tvalue\n\t\t\t\t ) // Separating by ',' is necessary to make a pause on urls (non-capitalized text)\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: accessibility text. Inline textinput title, value and help text.%1: Cell title, %2: cell value, , %3: cell help. */\n\t\t\t\t\t\t_x( '%1$s, %2$s, %3$s', 'inline textinput cell' ),\n\t\t\t\t\t\tlabel,\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t\thelp\n\t\t\t\t );\n\t\t};\n\n\t\tconst iconStyleBase = getStylesFromColorScheme(\n\t\t\tstyles.icon,\n\t\t\tstyles.iconDark\n\t\t);\n\t\tconst resetButtonStyle = getStylesFromColorScheme(\n\t\t\tstyles.resetButton,\n\t\t\tstyles.resetButtonDark\n\t\t);\n\t\tconst cellHelpStyle = [\n\t\t\tstyles.cellHelpLabel,\n\t\t\tisIOS && styles.cellHelpLabelIOS,\n\t\t];\n\t\tconst containerPointerEvents =\n\t\t\tthis.state.isScreenReaderEnabled && accessible ? 'none' : 'auto';\n\t\tconst { title, handler } = customActionButton || {};\n\n\t\tconst opacity =\n\t\t\tactiveOpacity !== undefined\n\t\t\t\t? activeOpacity\n\t\t\t\t: get( platformStyles, 'activeOpacity.opacity' );\n\n\t\treturn (\n\t\t\t<TouchableRipple\n\t\t\t\taccessible={\n\t\t\t\t\taccessible !== undefined\n\t\t\t\t\t\t? accessible\n\t\t\t\t\t\t: ! this.state.isEditingValue\n\t\t\t\t}\n\t\t\t\taccessibilityLabel={ getAccessibilityLabel() }\n\t\t\t\taccessibilityRole={ accessibilityRole || 'button' }\n\t\t\t\taccessibilityHint={\n\t\t\t\t\tisValueEditable\n\t\t\t\t\t\t? /* translators: accessibility text */\n\t\t\t\t\t\t __( 'Double tap to edit this value' )\n\t\t\t\t\t\t: accessibilityHint\n\t\t\t\t}\n\t\t\t\tdisabled={ disabled || ! isInteractive }\n\t\t\t\tactiveOpacity={ opacity }\n\t\t\t\tonPress={ onCellPress }\n\t\t\t\tonLongPress={ onLongPress }\n\t\t\t\tstyle={ [ styles.clipToBounds, style ] }\n\t\t\t\tborderless={ borderless }\n\t\t\t>\n\t\t\t\t{ drawTopSeparator && <View style={ separatorStyle() } /> }\n\t\t\t\t<View\n\t\t\t\t\tstyle={ cellContainerStyles }\n\t\t\t\t\tpointerEvents={ containerPointerEvents }\n\t\t\t\t>\n\t\t\t\t\t<View style={ rowContainerStyles }>\n\t\t\t\t\t\t<View style={ styles.cellRowContainer }>\n\t\t\t\t\t\t\t{ icon && (\n\t\t\t\t\t\t\t\t<View style={ styles.cellRowContainer }>\n\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t\t\t\t\t\tfill={\n\t\t\t\t\t\t\t\t\t\t\ticonStyle.color ||\n\t\t\t\t\t\t\t\t\t\t\ticonStyleBase.color\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tstyle={ iconStyle }\n\t\t\t\t\t\t\t\t\t\tisPressed={ false }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<View\n\t\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\t\tplatformStyles.labelIconSeparator\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ subLabel && label && (\n\t\t\t\t\t\t\t\t<View>\n\t\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\t\tstyle={ [\n\t\t\t\t\t\t\t\t\t\t\tdefaultLabelStyle,\n\t\t\t\t\t\t\t\t\t\t\tlabelStyle,\n\t\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t\t<Text style={ defaultSubLabelStyleText }>\n\t\t\t\t\t\t\t\t\t\t{ subLabel }\n\t\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t\t</View>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ! subLabel && label && (\n\t\t\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\t\t\tstyle={ [ defaultLabelStyle, labelStyle ] }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</View>\n\t\t\t\t\t\t{ customActionButton && (\n\t\t\t\t\t\t\t<TouchableOpacity\n\t\t\t\t\t\t\t\tonPress={ handler }\n\t\t\t\t\t\t\t\taccessibilityRole={ 'button' }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Text style={ resetButtonStyle }>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t\t</TouchableOpacity>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</View>\n\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\ticon={ check }\n\t\t\t\t\t\t\tfill={ platformStyles.isSelected.color }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showValue && getValueComponent() }\n\t\t\t\t\t{ children }\n\t\t\t\t</View>\n\t\t\t\t{ help && (\n\t\t\t\t\t<Text style={ [ cellHelpStyle, styles.placeholderColor ] }>\n\t\t\t\t\t\t{ help }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t\t{ ! drawTopSeparator && <View style={ separatorStyle() } /> }\n\t\t\t</TouchableRipple>\n\t\t);\n\t}\n}\n\nexport default withPreferredColorScheme( BottomSheetCell );\n"]}
|
|
@@ -30,6 +30,7 @@ const {
|
|
|
30
30
|
|
|
31
31
|
function LinkCell({
|
|
32
32
|
value,
|
|
33
|
+
valueMask,
|
|
33
34
|
onPress,
|
|
34
35
|
showIcon = true
|
|
35
36
|
}) {
|
|
@@ -37,8 +38,8 @@ function LinkCell({
|
|
|
37
38
|
icon: showIcon && _icons.link,
|
|
38
39
|
label: (0, _i18n.__)('Link to') // since this is not actually editable, we treat value as a placeholder
|
|
39
40
|
,
|
|
40
|
-
value: value || (0, _i18n.__)('Search or type URL'),
|
|
41
|
-
valueStyle: !!value ? undefined : placeholderColor,
|
|
41
|
+
value: valueMask || value || (0, _i18n.__)('Search or type URL'),
|
|
42
|
+
valueStyle: !!(value || valueMask) ? undefined : placeholderColor,
|
|
42
43
|
onPress: onPress
|
|
43
44
|
}, (0, _element.createElement)(_icons.Icon, {
|
|
44
45
|
icon: _icons.chevronRight
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/link-cell.native.js"],"names":["placeholderColor","styles","LinkCell","value","onPress","showIcon","link","undefined","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAuBC,eAA7B;;AAEe,SAASC,QAAT,CAAmB;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/mobile/bottom-sheet/link-cell.native.js"],"names":["placeholderColor","styles","LinkCell","value","valueMask","onPress","showIcon","link","undefined","chevronRight"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AAVA;AACA;AACA;;AAIA;AACA;AACA;AAIA,MAAM;AAAEA,EAAAA;AAAF,IAAuBC,eAA7B;;AAEe,SAASC,QAAT,CAAmB;AACjCC,EAAAA,KADiC;AAEjCC,EAAAA,SAFiC;AAGjCC,EAAAA,OAHiC;AAIjCC,EAAAA,QAAQ,GAAG;AAJsB,CAAnB,EAKX;AACH,SACC,4BAAC,aAAD;AACC,IAAA,IAAI,EAAGA,QAAQ,IAAIC,WADpB;AAEC,IAAA,KAAK,EAAG,cAAI,SAAJ,CAFT,CAGC;AAHD;AAIC,IAAA,KAAK,EAAGH,SAAS,IAAID,KAAb,IAAsB,cAAI,oBAAJ,CAJ/B;AAKC,IAAA,UAAU,EACT,CAAC,EAAIA,KAAK,IAAIC,SAAb,CAAD,GAA4BI,SAA5B,GAAwCR,gBAN1C;AAQC,IAAA,OAAO,EAAGK;AARX,KAUC,4BAAC,WAAD;AAAM,IAAA,IAAI,EAAGI;AAAb,IAVD,CADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { link, Icon, chevronRight } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport styles from './styles.scss';\n\nconst { placeholderColor } = styles;\n\nexport default function LinkCell( {\n\tvalue,\n\tvalueMask,\n\tonPress,\n\tshowIcon = true,\n} ) {\n\treturn (\n\t\t<Cell\n\t\t\ticon={ showIcon && link }\n\t\t\tlabel={ __( 'Link to' ) }\n\t\t\t// since this is not actually editable, we treat value as a placeholder\n\t\t\tvalue={ valueMask || value || __( 'Search or type URL' ) }\n\t\t\tvalueStyle={\n\t\t\t\t!! ( value || valueMask ) ? undefined : placeholderColor\n\t\t\t}\n\t\t\tonPress={ onPress }\n\t\t>\n\t\t\t<Icon icon={ chevronRight }></Icon>\n\t\t</Cell>\n\t);\n}\n"]}
|