@wordpress/primitives 3.3.0 → 3.5.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 +4 -0
- package/build/block-quotation/index.native.js +6 -4
- package/build/block-quotation/index.native.js.map +1 -1
- package/build-module/block-quotation/index.native.js +8 -6
- package/build-module/block-quotation/index.native.js.map +1 -1
- package/package.json +3 -3
- package/src/block-quotation/index.native.js +12 -6
- package/src/block-quotation/style.native.scss +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -26,14 +26,15 @@ var _style = _interopRequireDefault(require("./style.scss"));
|
|
|
26
26
|
/**
|
|
27
27
|
* Internal dependencies
|
|
28
28
|
*/
|
|
29
|
-
const BlockQuotation = (0,
|
|
29
|
+
const BlockQuotation = (0, _element.forwardRef)((_ref, ref) => {
|
|
30
|
+
let { ...props
|
|
31
|
+
} = _ref;
|
|
30
32
|
const {
|
|
31
|
-
getStylesFromColorScheme,
|
|
32
33
|
style
|
|
33
34
|
} = props;
|
|
34
|
-
const blockQuoteStyle = [
|
|
35
|
+
const blockQuoteStyle = [(0, _compose.usePreferredColorSchemeStyle)(_style.default.wpBlockQuoteLight, _style.default.wpBlockQuoteDark), (style === null || style === void 0 ? void 0 : style.color) && {
|
|
35
36
|
borderLeftColor: style.color
|
|
36
|
-
}];
|
|
37
|
+
}, style, (style === null || style === void 0 ? void 0 : style.backgroundColor) && _style.default.paddingWithBackground];
|
|
37
38
|
const colorStyle = style !== null && style !== void 0 && style.color ? {
|
|
38
39
|
color: style.color
|
|
39
40
|
} : {};
|
|
@@ -58,6 +59,7 @@ const BlockQuotation = (0, _compose.withPreferredColorScheme)(props => {
|
|
|
58
59
|
});
|
|
59
60
|
|
|
60
61
|
return (0, _element.createElement)(_reactNative.View, {
|
|
62
|
+
ref: ref,
|
|
61
63
|
style: blockQuoteStyle
|
|
62
64
|
}, newChildren);
|
|
63
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/primitives/src/block-quotation/index.native.js"],"names":["BlockQuotation","
|
|
1
|
+
{"version":3,"sources":["@wordpress/primitives/src/block-quotation/index.native.js"],"names":["BlockQuotation","ref","props","style","blockQuoteStyle","styles","wpBlockQuoteLight","wpBlockQuoteDark","color","borderLeftColor","backgroundColor","paddingWithBackground","colorStyle","newChildren","Children","map","children","child","identifier","wpBlockQuoteCitation","tagsToEliminate"],"mappings":";;;;;;;;;AAOA;;AAJA;;AAKA;;AAIA;;AAZA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AAGO,MAAMA,cAAc,GAAG,yBAAY,OAAgBC,GAAhB,KAAyB;AAAA,MAAvB,EAAE,GAAGC;AAAL,GAAuB;AAClE,QAAM;AAAEC,IAAAA;AAAF,MAAYD,KAAlB;AAEA,QAAME,eAAe,GAAG,CACvB,2CACCC,eAAOC,iBADR,EAECD,eAAOE,gBAFR,CADuB,EAKvB,CAAAJ,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEK,KAAP,KAAgB;AACfC,IAAAA,eAAe,EAAEN,KAAK,CAACK;AADR,GALO,EAQvBL,KARuB,EASvB,CAAAA,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEO,eAAP,KAA0BL,eAAOM,qBATV,CAAxB;AAWA,QAAMC,UAAU,GAAGT,KAAK,SAAL,IAAAA,KAAK,WAAL,IAAAA,KAAK,CAAEK,KAAP,GAAe;AAAEA,IAAAA,KAAK,EAAEL,KAAK,CAACK;AAAf,GAAf,GAAwC,EAA3D;;AAEA,QAAMK,WAAW,GAAGC,kBAASC,GAAT,CAAcb,KAAK,CAACc,QAApB,EAAgCC,KAAF,IAAa;AAC9D,QAAKA,KAAK,IAAIA,KAAK,CAACf,KAAN,CAAYgB,UAAZ,KAA2B,UAAzC,EAAsD;AACrD,aAAO,2BAAcD,KAAd,EAAqB;AAC3Bd,QAAAA,KAAK,EAAE,EACN,GAAGE,eAAOc,oBADJ;AAEN,aAAGP;AAFG;AADoB,OAArB,CAAP;AAMA;;AACD,QAAKK,KAAK,IAAIA,KAAK,CAACf,KAAN,CAAYgB,UAAZ,KAA2B,OAAzC,EAAmD;AAClD,aAAO,2BAAcD,KAAd,EAAqB;AAC3BG,QAAAA,eAAe,EAAE,CAAE,KAAF,CADU;AAE3BjB,QAAAA,KAAK,EAAES;AAFoB,OAArB,CAAP;AAIA;;AACD,WAAOK,KAAP;AACA,GAhBmB,CAApB;;AAiBA,SACC,4BAAC,iBAAD;AAAM,IAAA,GAAG,EAAGhB,GAAZ;AAAkB,IAAA,KAAK,EAAGG;AAA1B,KACGS,WADH,CADD;AAKA,CAtC6B,CAAvB","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, forwardRef } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nexport const BlockQuotation = forwardRef( ( { ...props }, ref ) => {\n\tconst { style } = props;\n\n\tconst blockQuoteStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.wpBlockQuoteLight,\n\t\t\tstyles.wpBlockQuoteDark\n\t\t),\n\t\tstyle?.color && {\n\t\t\tborderLeftColor: style.color,\n\t\t},\n\t\tstyle,\n\t\tstyle?.backgroundColor && styles.paddingWithBackground,\n\t];\n\tconst colorStyle = style?.color ? { color: style.color } : {};\n\n\tconst newChildren = Children.map( props.children, ( child ) => {\n\t\tif ( child && child.props.identifier === 'citation' ) {\n\t\t\treturn cloneElement( child, {\n\t\t\t\tstyle: {\n\t\t\t\t\t...styles.wpBlockQuoteCitation,\n\t\t\t\t\t...colorStyle,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t\tif ( child && child.props.identifier === 'value' ) {\n\t\t\treturn cloneElement( child, {\n\t\t\t\ttagsToEliminate: [ 'div' ],\n\t\t\t\tstyle: colorStyle,\n\t\t\t} );\n\t\t}\n\t\treturn child;\n\t} );\n\treturn (\n\t\t<View ref={ ref } style={ blockQuoteStyle }>\n\t\t\t{ newChildren }\n\t\t</View>\n\t);\n} );\n"]}
|
|
@@ -8,21 +8,22 @@ import { View } from 'react-native';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { Children, cloneElement } from '@wordpress/element';
|
|
12
|
-
import {
|
|
11
|
+
import { Children, cloneElement, forwardRef } from '@wordpress/element';
|
|
12
|
+
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import styles from './style.scss';
|
|
18
|
-
export const BlockQuotation =
|
|
18
|
+
export const BlockQuotation = forwardRef((_ref, ref) => {
|
|
19
|
+
let { ...props
|
|
20
|
+
} = _ref;
|
|
19
21
|
const {
|
|
20
|
-
getStylesFromColorScheme,
|
|
21
22
|
style
|
|
22
23
|
} = props;
|
|
23
|
-
const blockQuoteStyle = [
|
|
24
|
+
const blockQuoteStyle = [usePreferredColorSchemeStyle(styles.wpBlockQuoteLight, styles.wpBlockQuoteDark), (style === null || style === void 0 ? void 0 : style.color) && {
|
|
24
25
|
borderLeftColor: style.color
|
|
25
|
-
}];
|
|
26
|
+
}, style, (style === null || style === void 0 ? void 0 : style.backgroundColor) && styles.paddingWithBackground];
|
|
26
27
|
const colorStyle = style !== null && style !== void 0 && style.color ? {
|
|
27
28
|
color: style.color
|
|
28
29
|
} : {};
|
|
@@ -45,6 +46,7 @@ export const BlockQuotation = withPreferredColorScheme(props => {
|
|
|
45
46
|
return child;
|
|
46
47
|
});
|
|
47
48
|
return createElement(View, {
|
|
49
|
+
ref: ref,
|
|
48
50
|
style: blockQuoteStyle
|
|
49
51
|
}, newChildren);
|
|
50
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/primitives/src/block-quotation/index.native.js"],"names":["View","Children","cloneElement","
|
|
1
|
+
{"version":3,"sources":["@wordpress/primitives/src/block-quotation/index.native.js"],"names":["View","Children","cloneElement","forwardRef","usePreferredColorSchemeStyle","styles","BlockQuotation","ref","props","style","blockQuoteStyle","wpBlockQuoteLight","wpBlockQuoteDark","color","borderLeftColor","backgroundColor","paddingWithBackground","colorStyle","newChildren","map","children","child","identifier","wpBlockQuoteCitation","tagsToEliminate"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,cAArB;AACA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,YAAnB,EAAiCC,UAAjC,QAAmD,oBAAnD;AACA,SAASC,4BAAT,QAA6C,oBAA7C;AACA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AAEA,OAAO,MAAMC,cAAc,GAAGH,UAAU,CAAE,OAAgBI,GAAhB,KAAyB;AAAA,MAAvB,EAAE,GAAGC;AAAL,GAAuB;AAClE,QAAM;AAAEC,IAAAA;AAAF,MAAYD,KAAlB;AAEA,QAAME,eAAe,GAAG,CACvBN,4BAA4B,CAC3BC,MAAM,CAACM,iBADoB,EAE3BN,MAAM,CAACO,gBAFoB,CADL,EAKvB,CAAAH,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEI,KAAP,KAAgB;AACfC,IAAAA,eAAe,EAAEL,KAAK,CAACI;AADR,GALO,EAQvBJ,KARuB,EASvB,CAAAA,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEM,eAAP,KAA0BV,MAAM,CAACW,qBATV,CAAxB;AAWA,QAAMC,UAAU,GAAGR,KAAK,SAAL,IAAAA,KAAK,WAAL,IAAAA,KAAK,CAAEI,KAAP,GAAe;AAAEA,IAAAA,KAAK,EAAEJ,KAAK,CAACI;AAAf,GAAf,GAAwC,EAA3D;AAEA,QAAMK,WAAW,GAAGjB,QAAQ,CAACkB,GAAT,CAAcX,KAAK,CAACY,QAApB,EAAgCC,KAAF,IAAa;AAC9D,QAAKA,KAAK,IAAIA,KAAK,CAACb,KAAN,CAAYc,UAAZ,KAA2B,UAAzC,EAAsD;AACrD,aAAOpB,YAAY,CAAEmB,KAAF,EAAS;AAC3BZ,QAAAA,KAAK,EAAE,EACN,GAAGJ,MAAM,CAACkB,oBADJ;AAEN,aAAGN;AAFG;AADoB,OAAT,CAAnB;AAMA;;AACD,QAAKI,KAAK,IAAIA,KAAK,CAACb,KAAN,CAAYc,UAAZ,KAA2B,OAAzC,EAAmD;AAClD,aAAOpB,YAAY,CAAEmB,KAAF,EAAS;AAC3BG,QAAAA,eAAe,EAAE,CAAE,KAAF,CADU;AAE3Bf,QAAAA,KAAK,EAAEQ;AAFoB,OAAT,CAAnB;AAIA;;AACD,WAAOI,KAAP;AACA,GAhBmB,CAApB;AAiBA,SACC,cAAC,IAAD;AAAM,IAAA,GAAG,EAAGd,GAAZ;AAAkB,IAAA,KAAK,EAAGG;AAA1B,KACGQ,WADH,CADD;AAKA,CAtCuC,CAAjC","sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, forwardRef } from '@wordpress/element';\nimport { usePreferredColorSchemeStyle } from '@wordpress/compose';\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nexport const BlockQuotation = forwardRef( ( { ...props }, ref ) => {\n\tconst { style } = props;\n\n\tconst blockQuoteStyle = [\n\t\tusePreferredColorSchemeStyle(\n\t\t\tstyles.wpBlockQuoteLight,\n\t\t\tstyles.wpBlockQuoteDark\n\t\t),\n\t\tstyle?.color && {\n\t\t\tborderLeftColor: style.color,\n\t\t},\n\t\tstyle,\n\t\tstyle?.backgroundColor && styles.paddingWithBackground,\n\t];\n\tconst colorStyle = style?.color ? { color: style.color } : {};\n\n\tconst newChildren = Children.map( props.children, ( child ) => {\n\t\tif ( child && child.props.identifier === 'citation' ) {\n\t\t\treturn cloneElement( child, {\n\t\t\t\tstyle: {\n\t\t\t\t\t...styles.wpBlockQuoteCitation,\n\t\t\t\t\t...colorStyle,\n\t\t\t\t},\n\t\t\t} );\n\t\t}\n\t\tif ( child && child.props.identifier === 'value' ) {\n\t\t\treturn cloneElement( child, {\n\t\t\t\ttagsToEliminate: [ 'div' ],\n\t\t\t\tstyle: colorStyle,\n\t\t\t} );\n\t\t}\n\t\treturn child;\n\t} );\n\treturn (\n\t\t<View ref={ ref } style={ blockQuoteStyle }>\n\t\t\t{ newChildren }\n\t\t</View>\n\t);\n} );\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/primitives",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "WordPress cross-platform primitives.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"types": "build-types",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/element": "^4.
|
|
34
|
+
"@wordpress/element": "^4.5.0",
|
|
35
35
|
"classnames": "^2.3.1"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "1ba52312b56db563df2d8d4fba5b00613fb46d8c"
|
|
41
41
|
}
|
|
@@ -5,24 +5,26 @@ import { View } from 'react-native';
|
|
|
5
5
|
/**
|
|
6
6
|
* WordPress dependencies
|
|
7
7
|
*/
|
|
8
|
-
import { Children, cloneElement } from '@wordpress/element';
|
|
9
|
-
import {
|
|
8
|
+
import { Children, cloneElement, forwardRef } from '@wordpress/element';
|
|
9
|
+
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
10
10
|
/**
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import styles from './style.scss';
|
|
14
14
|
|
|
15
|
-
export const BlockQuotation =
|
|
16
|
-
const {
|
|
15
|
+
export const BlockQuotation = forwardRef( ( { ...props }, ref ) => {
|
|
16
|
+
const { style } = props;
|
|
17
17
|
|
|
18
18
|
const blockQuoteStyle = [
|
|
19
|
-
|
|
19
|
+
usePreferredColorSchemeStyle(
|
|
20
20
|
styles.wpBlockQuoteLight,
|
|
21
21
|
styles.wpBlockQuoteDark
|
|
22
22
|
),
|
|
23
23
|
style?.color && {
|
|
24
24
|
borderLeftColor: style.color,
|
|
25
25
|
},
|
|
26
|
+
style,
|
|
27
|
+
style?.backgroundColor && styles.paddingWithBackground,
|
|
26
28
|
];
|
|
27
29
|
const colorStyle = style?.color ? { color: style.color } : {};
|
|
28
30
|
|
|
@@ -43,5 +45,9 @@ export const BlockQuotation = withPreferredColorScheme( ( props ) => {
|
|
|
43
45
|
}
|
|
44
46
|
return child;
|
|
45
47
|
} );
|
|
46
|
-
return
|
|
48
|
+
return (
|
|
49
|
+
<View ref={ ref } style={ blockQuoteStyle }>
|
|
50
|
+
{ newChildren }
|
|
51
|
+
</View>
|
|
52
|
+
);
|
|
47
53
|
} );
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
%wpBlockQuote-shared {
|
|
2
2
|
border-left-width: 4px;
|
|
3
3
|
border-left-style: solid;
|
|
4
|
-
padding-left:
|
|
4
|
+
padding-left: $block-edge-to-content;
|
|
5
|
+
padding-top: $dashed-border-space;
|
|
5
6
|
margin-left: 0;
|
|
6
7
|
}
|
|
7
8
|
|
|
@@ -19,3 +20,7 @@
|
|
|
19
20
|
margin-top: 16px;
|
|
20
21
|
font-size: 14px;
|
|
21
22
|
}
|
|
23
|
+
|
|
24
|
+
.paddingWithBackground {
|
|
25
|
+
padding-top: $block-edge-to-content - $block-selected-margin;
|
|
26
|
+
}
|