@wordpress/primitives 3.0.3 → 3.0.4
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/build/horizontal-rule/index.native.js +5 -4
- package/build/horizontal-rule/index.native.js.map +1 -1
- package/build/svg/index.js +7 -6
- package/build/svg/index.js.map +1 -1
- package/build/svg/index.native.js +20 -19
- package/build/svg/index.native.js.map +1 -1
- package/build-module/horizontal-rule/index.native.js +5 -4
- package/build-module/horizontal-rule/index.native.js.map +1 -1
- package/build-module/svg/index.js +6 -5
- package/build-module/svg/index.js.map +1 -1
- package/build-module/svg/index.native.js +7 -6
- package/build-module/svg/index.native.js.map +1 -1
- package/package.json +4 -4
|
@@ -28,10 +28,11 @@ var _styles = _interopRequireDefault(require("./styles.scss"));
|
|
|
28
28
|
/**
|
|
29
29
|
* Internal dependencies
|
|
30
30
|
*/
|
|
31
|
-
const HR =
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const HR = _ref => {
|
|
32
|
+
let {
|
|
33
|
+
getStylesFromColorScheme,
|
|
34
|
+
...props
|
|
35
|
+
} = _ref;
|
|
35
36
|
const lineStyle = getStylesFromColorScheme(_styles.default.line, _styles.default.lineDark);
|
|
36
37
|
return (0, _element.createElement)(_reactNativeHr.default, (0, _extends2.default)({}, props, {
|
|
37
38
|
lineStyle: [lineStyle, props.lineStyle],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/primitives/src/horizontal-rule/index.native.js"],"names":["HR","getStylesFromColorScheme","props","lineStyle","styles","line","lineDark","HorizontalRule"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AAKA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,EAAE,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/primitives/src/horizontal-rule/index.native.js"],"names":["HR","getStylesFromColorScheme","props","lineStyle","styles","line","lineDark","HorizontalRule"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AAKA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,EAAE,GAAG,QAA8C;AAAA,MAA5C;AAAEC,IAAAA,wBAAF;AAA4B,OAAGC;AAA/B,GAA4C;AACxD,QAAMC,SAAS,GAAGF,wBAAwB,CAAEG,gBAAOC,IAAT,EAAeD,gBAAOE,QAAtB,CAA1C;AAEA,SACC,4BAAC,sBAAD,6BACMJ,KADN;AAEC,IAAA,SAAS,EAAG,CAAEC,SAAF,EAAaD,KAAK,CAACC,SAAnB,CAFb;AAGC,IAAA,UAAU,EAAG,CAHd;AAIC,IAAA,WAAW,EAAG;AAJf,KADD;AAQA,CAXD;;AAaO,MAAMI,cAAc,GAAG,uCAA0BP,EAA1B,CAAvB","sourcesContent":["/**\n * External dependencies\n */\nimport Hr from 'react-native-hr';\n\n/**\n * WordPress dependencies\n */\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\n\nconst HR = ( { getStylesFromColorScheme, ...props } ) => {\n\tconst lineStyle = getStylesFromColorScheme( styles.line, styles.lineDark );\n\n\treturn (\n\t\t<Hr\n\t\t\t{ ...props }\n\t\t\tlineStyle={ [ lineStyle, props.lineStyle ] }\n\t\t\tmarginLeft={ 0 }\n\t\t\tmarginRight={ 0 }\n\t\t/>\n\t);\n};\n\nexport const HorizontalRule = withPreferredColorScheme( HR );\n"]}
|
package/build/svg/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.Stop = exports.SVG = exports.Rect = exports.RadialGradient = exports.Polygon = exports.Path = exports.LinearGradient = exports.G = exports.Defs = exports.Circle = void 0;
|
|
9
9
|
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
|
|
@@ -118,11 +118,12 @@ const Stop = props => (0, _element.createElement)('stop', props);
|
|
|
118
118
|
|
|
119
119
|
exports.Stop = Stop;
|
|
120
120
|
|
|
121
|
-
const SVG =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
const SVG = _ref => {
|
|
122
|
+
let {
|
|
123
|
+
className,
|
|
124
|
+
isPressed,
|
|
125
|
+
...props
|
|
126
|
+
} = _ref;
|
|
126
127
|
const appliedProps = { ...props,
|
|
127
128
|
className: (0, _classnames.default)(className, {
|
|
128
129
|
'is-pressed': isPressed
|
package/build/svg/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/primitives/src/svg/index.js"],"names":["Circle","props","G","Path","Polygon","Rect","Defs","RadialGradient","LinearGradient","Stop","SVG","className","isPressed","appliedProps","undefined","role","focusable"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMA,MAAM,GAAKC,KAAF,IAAa,4BAAe,QAAf,EAAyBA,KAAzB,CAA5B;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,CAAC,GAAKD,KAAF,IAAa,4BAAe,GAAf,EAAoBA,KAApB,CAAvB;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAME,IAAI,GAAKF,KAAF,IAAa,4BAAe,MAAf,EAAuBA,KAAvB,CAA1B;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMG,OAAO,GAAKH,KAAF,IAAa,4BAAe,SAAf,EAA0BA,KAA1B,CAA7B;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMI,IAAI,GAAKJ,KAAF,IAAa,4BAAe,MAAf,EAAuBA,KAAvB,CAA1B;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMK,IAAI,GAAKL,KAAF,IAAa,4BAAe,MAAf,EAAuBA,KAAvB,CAA1B;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMM,cAAc,GAAKN,KAAF,IAC7B,4BAAe,gBAAf,EAAiCA,KAAjC,CADM;AAGP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMO,cAAc,GAAKP,KAAF,IAC7B,4BAAe,gBAAf,EAAiCA,KAAjC,CADM;AAGP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMQ,IAAI,GAAKR,KAAF,IAAa,4BAAe,MAAf,EAAuBA,KAAvB,CAA1B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMS,GAAG,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/primitives/src/svg/index.js"],"names":["Circle","props","G","Path","Polygon","Rect","Defs","RadialGradient","LinearGradient","Stop","SVG","className","isPressed","appliedProps","undefined","role","focusable"],"mappings":";;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMA,MAAM,GAAKC,KAAF,IAAa,4BAAe,QAAf,EAAyBA,KAAzB,CAA5B;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,CAAC,GAAKD,KAAF,IAAa,4BAAe,GAAf,EAAoBA,KAApB,CAAvB;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAME,IAAI,GAAKF,KAAF,IAAa,4BAAe,MAAf,EAAuBA,KAAvB,CAA1B;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMG,OAAO,GAAKH,KAAF,IAAa,4BAAe,SAAf,EAA0BA,KAA1B,CAA7B;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMI,IAAI,GAAKJ,KAAF,IAAa,4BAAe,MAAf,EAAuBA,KAAvB,CAA1B;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMK,IAAI,GAAKL,KAAF,IAAa,4BAAe,MAAf,EAAuBA,KAAvB,CAA1B;AAEP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMM,cAAc,GAAKN,KAAF,IAC7B,4BAAe,gBAAf,EAAiCA,KAAjC,CADM;AAGP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMO,cAAc,GAAKP,KAAF,IAC7B,4BAAe,gBAAf,EAAiCA,KAAjC,CADM;AAGP;AACA;AACA;AACA;AACA;;;;;AACO,MAAMQ,IAAI,GAAKR,KAAF,IAAa,4BAAe,MAAf,EAAuBA,KAAvB,CAA1B;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMS,GAAG,GAAG,QAA0C;AAAA,MAAxC;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAb;AAAwB,OAAGX;AAA3B,GAAwC;AAC5D,QAAMY,YAAY,GAAG,EACpB,GAAGZ,KADiB;AAEpBU,IAAAA,SAAS,EACR,yBAAYA,SAAZ,EAAuB;AAAE,oBAAcC;AAAhB,KAAvB,KAAwDE,SAHrC;AAIpBC,IAAAA,IAAI,EAAE,KAJc;AAKpB,mBAAe,IALK;AAMpBC,IAAAA,SAAS,EAAE;AANS,GAArB,CAD4D,CAU5D;AACA;;AACA,SAAO,mCAAUH,YAAV,CAAP;AACA,CAbM","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createElement } from '@wordpress/element';\n\n/** @typedef {{isPressed?: boolean} & import('react').ComponentPropsWithoutRef<'svg'>} SVGProps */\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'circle'>} props\n *\n * @return {JSX.Element} Circle component\n */\nexport const Circle = ( props ) => createElement( 'circle', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'g'>} props\n *\n * @return {JSX.Element} G component\n */\nexport const G = ( props ) => createElement( 'g', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'path'>} props\n *\n * @return {JSX.Element} Path component\n */\nexport const Path = ( props ) => createElement( 'path', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'polygon'>} props\n *\n * @return {JSX.Element} Polygon component\n */\nexport const Polygon = ( props ) => createElement( 'polygon', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'rect'>} props\n *\n * @return {JSX.Element} Rect component\n */\nexport const Rect = ( props ) => createElement( 'rect', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'defs'>} props\n *\n * @return {JSX.Element} Defs component\n */\nexport const Defs = ( props ) => createElement( 'defs', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'radialGradient'>} props\n *\n * @return {JSX.Element} RadialGradient component\n */\nexport const RadialGradient = ( props ) =>\n\tcreateElement( 'radialGradient', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'linearGradient'>} props\n *\n * @return {JSX.Element} LinearGradient component\n */\nexport const LinearGradient = ( props ) =>\n\tcreateElement( 'linearGradient', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'stop'>} props\n *\n * @return {JSX.Element} Stop component\n */\nexport const Stop = ( props ) => createElement( 'stop', props );\n\n/**\n *\n * @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.\n * Other props will be passed through to svg component.\n *\n * @return {JSX.Element} Stop component\n */\nexport const SVG = ( { className, isPressed, ...props } ) => {\n\tconst appliedProps = {\n\t\t...props,\n\t\tclassName:\n\t\t\tclassnames( className, { 'is-pressed': isPressed } ) || undefined,\n\t\trole: 'img',\n\t\t'aria-hidden': true,\n\t\tfocusable: false,\n\t};\n\n\t// Disable reason: We need to have a way to render HTML tag for web.\n\t// eslint-disable-next-line react/forbid-elements\n\treturn <svg { ...appliedProps } />;\n};\n"]}
|
|
@@ -11,34 +11,34 @@ Object.defineProperty(exports, "Circle", {
|
|
|
11
11
|
return _reactNativeSvg.Circle;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
Object.defineProperty(exports, "
|
|
14
|
+
Object.defineProperty(exports, "Defs", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function () {
|
|
17
|
-
return _reactNativeSvg.
|
|
17
|
+
return _reactNativeSvg.Defs;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "G", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
get: function () {
|
|
23
|
-
return _reactNativeSvg.
|
|
23
|
+
return _reactNativeSvg.G;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "LinearGradient", {
|
|
27
27
|
enumerable: true,
|
|
28
28
|
get: function () {
|
|
29
|
-
return _reactNativeSvg.
|
|
29
|
+
return _reactNativeSvg.LinearGradient;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
Object.defineProperty(exports, "
|
|
32
|
+
Object.defineProperty(exports, "Path", {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function () {
|
|
35
|
-
return _reactNativeSvg.
|
|
35
|
+
return _reactNativeSvg.Path;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
Object.defineProperty(exports, "
|
|
38
|
+
Object.defineProperty(exports, "Polygon", {
|
|
39
39
|
enumerable: true,
|
|
40
40
|
get: function () {
|
|
41
|
-
return _reactNativeSvg.
|
|
41
|
+
return _reactNativeSvg.Polygon;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "RadialGradient", {
|
|
@@ -47,19 +47,19 @@ Object.defineProperty(exports, "RadialGradient", {
|
|
|
47
47
|
return _reactNativeSvg.RadialGradient;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
Object.defineProperty(exports, "
|
|
50
|
+
Object.defineProperty(exports, "Rect", {
|
|
51
51
|
enumerable: true,
|
|
52
52
|
get: function () {
|
|
53
|
-
return _reactNativeSvg.
|
|
53
|
+
return _reactNativeSvg.Rect;
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
+
exports.SVG = void 0;
|
|
56
57
|
Object.defineProperty(exports, "Stop", {
|
|
57
58
|
enumerable: true,
|
|
58
59
|
get: function () {
|
|
59
60
|
return _reactNativeSvg.Stop;
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
|
-
exports.SVG = void 0;
|
|
63
63
|
|
|
64
64
|
var _element = require("@wordpress/element");
|
|
65
65
|
|
|
@@ -86,12 +86,13 @@ const AnimatedSvg = _reactNative.Animated.createAnimatedComponent((0, _element.f
|
|
|
86
86
|
ref: ref
|
|
87
87
|
}, props))));
|
|
88
88
|
|
|
89
|
-
const SVG =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
const SVG = _ref => {
|
|
90
|
+
let {
|
|
91
|
+
className = '',
|
|
92
|
+
isPressed,
|
|
93
|
+
animated = false,
|
|
94
|
+
...props
|
|
95
|
+
} = _ref;
|
|
95
96
|
const colorScheme = props.colorScheme || 'light';
|
|
96
97
|
const stylesFromClasses = className.split(' ').map(element => _style.default[element]).filter(Boolean);
|
|
97
98
|
const defaultStyle = isPressed ? _style.default['is-pressed'] : _style.default['components-toolbar__control-' + colorScheme];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/primitives/src/svg/index.native.js"],"names":["AnimatedSvg","Animated","createAnimatedComponent","props","ref","SVG","className","isPressed","animated","colorScheme","stylesFromClasses","split","map","element","styles","filter","Boolean","defaultStyle","propStyle","Array","isArray","style","reduce","acc","el","styleValues","Object","assign","appliedProps","SvgWrapper","Svg","color"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;;;AANA;;AACA;;AAUA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AAeA,MAAMA,WAAW,GAAGC,sBAASC,uBAAT,CACnB,yBAAY,CAAEC,KAAF,EAASC,GAAT,KAAkB,4BAAC,mBAAD;AAAK,EAAA,GAAG,EAAGA;AAAX,GAAsBD,KAAtB,EAA9B,CADmB,CAApB;;AAIO,MAAME,GAAG,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/primitives/src/svg/index.native.js"],"names":["AnimatedSvg","Animated","createAnimatedComponent","props","ref","SVG","className","isPressed","animated","colorScheme","stylesFromClasses","split","map","element","styles","filter","Boolean","defaultStyle","propStyle","Array","isArray","style","reduce","acc","el","styleValues","Object","assign","appliedProps","SvgWrapper","Svg","color"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;;;;AANA;;AACA;;AAUA;;AAdA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACA;AACA;AAeA,MAAMA,WAAW,GAAGC,sBAASC,uBAAT,CACnB,yBAAY,CAAEC,KAAF,EAASC,GAAT,KAAkB,4BAAC,mBAAD;AAAK,EAAA,GAAG,EAAGA;AAAX,GAAsBD,KAAtB,EAA9B,CADmB,CAApB;;AAIO,MAAME,GAAG,GAAG,QAKZ;AAAA,MALc;AACpBC,IAAAA,SAAS,GAAG,EADQ;AAEpBC,IAAAA,SAFoB;AAGpBC,IAAAA,QAAQ,GAAG,KAHS;AAIpB,OAAGL;AAJiB,GAKd;AACN,QAAMM,WAAW,GAAGN,KAAK,CAACM,WAAN,IAAqB,OAAzC;AACA,QAAMC,iBAAiB,GAAGJ,SAAS,CACjCK,KADwB,CACjB,GADiB,EAExBC,GAFwB,CAEjBC,OAAF,IAAeC,eAAQD,OAAR,CAFI,EAGxBE,MAHwB,CAGhBC,OAHgB,CAA1B;AAIA,QAAMC,YAAY,GAAGV,SAAS,GAC3BO,eAAQ,YAAR,CAD2B,GAE3BA,eAAQ,iCAAiCL,WAAzC,CAFH;AAGA,QAAMS,SAAS,GAAGC,KAAK,CAACC,OAAN,CAAejB,KAAK,CAACkB,KAArB,IACflB,KAAK,CAACkB,KAAN,CAAYC,MAAZ,CAAoB,CAAEC,GAAF,EAAOC,EAAP,KAAe;AACnC,WAAO,EAAE,GAAGD,GAAL;AAAU,SAAGC;AAAb,KAAP;AACC,GAFD,EAEG,EAFH,CADe,GAIfrB,KAAK,CAACkB,KAJT;AAKA,QAAMI,WAAW,GAAGC,MAAM,CAACC,MAAP,CACnB,EADmB,EAEnBV,YAFmB,EAGnBC,SAHmB,EAInB,GAAGR,iBAJgB,CAApB;AAOA,QAAMkB,YAAY,GAAG,EAAE,GAAGzB,KAAL;AAAYkB,IAAAA,KAAK,EAAEI;AAAnB,GAArB;AAEA,QAAMI,UAAU,GAAGrB,QAAQ,GAAGR,WAAH,GAAiB8B,mBAA5C;AAEA,SACC,4BAAC,UAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAGF,YAAY,CAACP,KAAb,CAAmBU,KAF1B;AAGC,IAAA,MAAM,EAAC,MAHR;AAIC,IAAA,KAAK,EAAC;AAJP,KAKMH,YALN,EADD;AASA,CAvCM","sourcesContent":["/**\n * External dependencies\n */\nimport { Svg } from 'react-native-svg';\nimport { Animated } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nexport {\n\tCircle,\n\tG,\n\tPath,\n\tPolygon,\n\tRect,\n\tDefs,\n\tRadialGradient,\n\tLinearGradient,\n\tStop,\n} from 'react-native-svg';\n\nconst AnimatedSvg = Animated.createAnimatedComponent(\n\tforwardRef( ( props, ref ) => <Svg ref={ ref } { ...props } /> )\n);\n\nexport const SVG = ( {\n\tclassName = '',\n\tisPressed,\n\tanimated = false,\n\t...props\n} ) => {\n\tconst colorScheme = props.colorScheme || 'light';\n\tconst stylesFromClasses = className\n\t\t.split( ' ' )\n\t\t.map( ( element ) => styles[ element ] )\n\t\t.filter( Boolean );\n\tconst defaultStyle = isPressed\n\t\t? styles[ 'is-pressed' ]\n\t\t: styles[ 'components-toolbar__control-' + colorScheme ];\n\tconst propStyle = Array.isArray( props.style )\n\t\t? props.style.reduce( ( acc, el ) => {\n\t\t\t\treturn { ...acc, ...el };\n\t\t }, {} )\n\t\t: props.style;\n\tconst styleValues = Object.assign(\n\t\t{},\n\t\tdefaultStyle,\n\t\tpropStyle,\n\t\t...stylesFromClasses\n\t);\n\n\tconst appliedProps = { ...props, style: styleValues };\n\n\tconst SvgWrapper = animated ? AnimatedSvg : Svg;\n\n\treturn (\n\t\t<SvgWrapper\n\t\t\t//We want to re-render when style color is changed\n\t\t\tkey={ appliedProps.style.color }\n\t\t\theight=\"100%\"\n\t\t\twidth=\"100%\"\n\t\t\t{ ...appliedProps }\n\t\t/>\n\t);\n};\n"]}
|
|
@@ -16,10 +16,11 @@ import { withPreferredColorScheme } from '@wordpress/compose';
|
|
|
16
16
|
|
|
17
17
|
import styles from './styles.scss';
|
|
18
18
|
|
|
19
|
-
const HR =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const HR = _ref => {
|
|
20
|
+
let {
|
|
21
|
+
getStylesFromColorScheme,
|
|
22
|
+
...props
|
|
23
|
+
} = _ref;
|
|
23
24
|
const lineStyle = getStylesFromColorScheme(styles.line, styles.lineDark);
|
|
24
25
|
return createElement(Hr, _extends({}, props, {
|
|
25
26
|
lineStyle: [lineStyle, props.lineStyle],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/primitives/src/horizontal-rule/index.native.js"],"names":["Hr","withPreferredColorScheme","styles","HR","getStylesFromColorScheme","props","lineStyle","line","lineDark","HorizontalRule"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,EAAP,MAAe,iBAAf;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,eAAnB;;AAEA,MAAMC,EAAE,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/primitives/src/horizontal-rule/index.native.js"],"names":["Hr","withPreferredColorScheme","styles","HR","getStylesFromColorScheme","props","lineStyle","line","lineDark","HorizontalRule"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,EAAP,MAAe,iBAAf;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,oBAAzC;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,eAAnB;;AAEA,MAAMC,EAAE,GAAG,QAA8C;AAAA,MAA5C;AAAEC,IAAAA,wBAAF;AAA4B,OAAGC;AAA/B,GAA4C;AACxD,QAAMC,SAAS,GAAGF,wBAAwB,CAAEF,MAAM,CAACK,IAAT,EAAeL,MAAM,CAACM,QAAtB,CAA1C;AAEA,SACC,cAAC,EAAD,eACMH,KADN;AAEC,IAAA,SAAS,EAAG,CAAEC,SAAF,EAAaD,KAAK,CAACC,SAAnB,CAFb;AAGC,IAAA,UAAU,EAAG,CAHd;AAIC,IAAA,WAAW,EAAG;AAJf,KADD;AAQA,CAXD;;AAaA,OAAO,MAAMG,cAAc,GAAGR,wBAAwB,CAAEE,EAAF,CAA/C","sourcesContent":["/**\n * External dependencies\n */\nimport Hr from 'react-native-hr';\n\n/**\n * WordPress dependencies\n */\nimport { withPreferredColorScheme } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport styles from './styles.scss';\n\nconst HR = ( { getStylesFromColorScheme, ...props } ) => {\n\tconst lineStyle = getStylesFromColorScheme( styles.line, styles.lineDark );\n\n\treturn (\n\t\t<Hr\n\t\t\t{ ...props }\n\t\t\tlineStyle={ [ lineStyle, props.lineStyle ] }\n\t\t\tmarginLeft={ 0 }\n\t\t\tmarginRight={ 0 }\n\t\t/>\n\t);\n};\n\nexport const HorizontalRule = withPreferredColorScheme( HR );\n"]}
|
|
@@ -80,11 +80,12 @@ export const Stop = props => createElement('stop', props);
|
|
|
80
80
|
* @return {JSX.Element} Stop component
|
|
81
81
|
*/
|
|
82
82
|
|
|
83
|
-
export const SVG =
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
export const SVG = _ref => {
|
|
84
|
+
let {
|
|
85
|
+
className,
|
|
86
|
+
isPressed,
|
|
87
|
+
...props
|
|
88
|
+
} = _ref;
|
|
88
89
|
const appliedProps = { ...props,
|
|
89
90
|
className: classnames(className, {
|
|
90
91
|
'is-pressed': isPressed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/primitives/src/svg/index.js"],"names":["classnames","createElement","Circle","props","G","Path","Polygon","Rect","Defs","RadialGradient","LinearGradient","Stop","SVG","className","isPressed","appliedProps","undefined","role","focusable"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,MAAM,GAAKC,KAAF,IAAaF,aAAa,CAAE,QAAF,EAAYE,KAAZ,CAAzC;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,CAAC,GAAKD,KAAF,IAAaF,aAAa,CAAE,GAAF,EAAOE,KAAP,CAApC;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,IAAI,GAAKF,KAAF,IAAaF,aAAa,CAAE,MAAF,EAAUE,KAAV,CAAvC;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMG,OAAO,GAAKH,KAAF,IAAaF,aAAa,CAAE,SAAF,EAAaE,KAAb,CAA1C;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMI,IAAI,GAAKJ,KAAF,IAAaF,aAAa,CAAE,MAAF,EAAUE,KAAV,CAAvC;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMK,IAAI,GAAKL,KAAF,IAAaF,aAAa,CAAE,MAAF,EAAUE,KAAV,CAAvC;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMM,cAAc,GAAKN,KAAF,IAC7BF,aAAa,CAAE,gBAAF,EAAoBE,KAApB,CADP;AAGP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMO,cAAc,GAAKP,KAAF,IAC7BF,aAAa,CAAE,gBAAF,EAAoBE,KAApB,CADP;AAGP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMQ,IAAI,GAAKR,KAAF,IAAaF,aAAa,CAAE,MAAF,EAAUE,KAAV,CAAvC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMS,GAAG,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/primitives/src/svg/index.js"],"names":["classnames","createElement","Circle","props","G","Path","Polygon","Rect","Defs","RadialGradient","LinearGradient","Stop","SVG","className","isPressed","appliedProps","undefined","role","focusable"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,aAAT,QAA8B,oBAA9B;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,MAAM,GAAKC,KAAF,IAAaF,aAAa,CAAE,QAAF,EAAYE,KAAZ,CAAzC;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,CAAC,GAAKD,KAAF,IAAaF,aAAa,CAAE,GAAF,EAAOE,KAAP,CAApC;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAME,IAAI,GAAKF,KAAF,IAAaF,aAAa,CAAE,MAAF,EAAUE,KAAV,CAAvC;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMG,OAAO,GAAKH,KAAF,IAAaF,aAAa,CAAE,SAAF,EAAaE,KAAb,CAA1C;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMI,IAAI,GAAKJ,KAAF,IAAaF,aAAa,CAAE,MAAF,EAAUE,KAAV,CAAvC;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMK,IAAI,GAAKL,KAAF,IAAaF,aAAa,CAAE,MAAF,EAAUE,KAAV,CAAvC;AAEP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMM,cAAc,GAAKN,KAAF,IAC7BF,aAAa,CAAE,gBAAF,EAAoBE,KAApB,CADP;AAGP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMO,cAAc,GAAKP,KAAF,IAC7BF,aAAa,CAAE,gBAAF,EAAoBE,KAApB,CADP;AAGP;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMQ,IAAI,GAAKR,KAAF,IAAaF,aAAa,CAAE,MAAF,EAAUE,KAAV,CAAvC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMS,GAAG,GAAG,QAA0C;AAAA,MAAxC;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,SAAb;AAAwB,OAAGX;AAA3B,GAAwC;AAC5D,QAAMY,YAAY,GAAG,EACpB,GAAGZ,KADiB;AAEpBU,IAAAA,SAAS,EACRb,UAAU,CAAEa,SAAF,EAAa;AAAE,oBAAcC;AAAhB,KAAb,CAAV,IAAwDE,SAHrC;AAIpBC,IAAAA,IAAI,EAAE,KAJc;AAKpB,mBAAe,IALK;AAMpBC,IAAAA,SAAS,EAAE;AANS,GAArB,CAD4D,CAU5D;AACA;;AACA,SAAO,qBAAUH,YAAV,CAAP;AACA,CAbM","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { createElement } from '@wordpress/element';\n\n/** @typedef {{isPressed?: boolean} & import('react').ComponentPropsWithoutRef<'svg'>} SVGProps */\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'circle'>} props\n *\n * @return {JSX.Element} Circle component\n */\nexport const Circle = ( props ) => createElement( 'circle', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'g'>} props\n *\n * @return {JSX.Element} G component\n */\nexport const G = ( props ) => createElement( 'g', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'path'>} props\n *\n * @return {JSX.Element} Path component\n */\nexport const Path = ( props ) => createElement( 'path', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'polygon'>} props\n *\n * @return {JSX.Element} Polygon component\n */\nexport const Polygon = ( props ) => createElement( 'polygon', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'rect'>} props\n *\n * @return {JSX.Element} Rect component\n */\nexport const Rect = ( props ) => createElement( 'rect', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'defs'>} props\n *\n * @return {JSX.Element} Defs component\n */\nexport const Defs = ( props ) => createElement( 'defs', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'radialGradient'>} props\n *\n * @return {JSX.Element} RadialGradient component\n */\nexport const RadialGradient = ( props ) =>\n\tcreateElement( 'radialGradient', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'linearGradient'>} props\n *\n * @return {JSX.Element} LinearGradient component\n */\nexport const LinearGradient = ( props ) =>\n\tcreateElement( 'linearGradient', props );\n\n/**\n * @param {import('react').ComponentPropsWithoutRef<'stop'>} props\n *\n * @return {JSX.Element} Stop component\n */\nexport const Stop = ( props ) => createElement( 'stop', props );\n\n/**\n *\n * @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.\n * Other props will be passed through to svg component.\n *\n * @return {JSX.Element} Stop component\n */\nexport const SVG = ( { className, isPressed, ...props } ) => {\n\tconst appliedProps = {\n\t\t...props,\n\t\tclassName:\n\t\t\tclassnames( className, { 'is-pressed': isPressed } ) || undefined,\n\t\trole: 'img',\n\t\t'aria-hidden': true,\n\t\tfocusable: false,\n\t};\n\n\t// Disable reason: We need to have a way to render HTML tag for web.\n\t// eslint-disable-next-line react/forbid-elements\n\treturn <svg { ...appliedProps } />;\n};\n"]}
|
|
@@ -20,12 +20,13 @@ export { Circle, G, Path, Polygon, Rect, Defs, RadialGradient, LinearGradient, S
|
|
|
20
20
|
const AnimatedSvg = Animated.createAnimatedComponent(forwardRef((props, ref) => createElement(Svg, _extends({
|
|
21
21
|
ref: ref
|
|
22
22
|
}, props))));
|
|
23
|
-
export const SVG =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
export const SVG = _ref => {
|
|
24
|
+
let {
|
|
25
|
+
className = '',
|
|
26
|
+
isPressed,
|
|
27
|
+
animated = false,
|
|
28
|
+
...props
|
|
29
|
+
} = _ref;
|
|
29
30
|
const colorScheme = props.colorScheme || 'light';
|
|
30
31
|
const stylesFromClasses = className.split(' ').map(element => styles[element]).filter(Boolean);
|
|
31
32
|
const defaultStyle = isPressed ? styles['is-pressed'] : styles['components-toolbar__control-' + colorScheme];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/primitives/src/svg/index.native.js"],"names":["Svg","Animated","forwardRef","styles","Circle","G","Path","Polygon","Rect","Defs","RadialGradient","LinearGradient","Stop","AnimatedSvg","createAnimatedComponent","props","ref","SVG","className","isPressed","animated","colorScheme","stylesFromClasses","split","map","element","filter","Boolean","defaultStyle","propStyle","Array","isArray","style","reduce","acc","el","styleValues","Object","assign","appliedProps","SvgWrapper","color"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,kBAApB;AACA,SAASC,QAAT,QAAyB,cAAzB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AAEA,SACCC,MADD,EAECC,CAFD,EAGCC,IAHD,EAICC,OAJD,EAKCC,IALD,EAMCC,IAND,EAOCC,cAPD,EAQCC,cARD,EASCC,IATD,QAUO,kBAVP;AAYA,MAAMC,WAAW,GAAGZ,QAAQ,CAACa,uBAAT,CACnBZ,UAAU,CAAE,CAAEa,KAAF,EAASC,GAAT,KAAkB,cAAC,GAAD;AAAK,EAAA,GAAG,EAAGA;AAAX,GAAsBD,KAAtB,EAApB,CADS,CAApB;AAIA,OAAO,MAAME,GAAG,GAAG,
|
|
1
|
+
{"version":3,"sources":["@wordpress/primitives/src/svg/index.native.js"],"names":["Svg","Animated","forwardRef","styles","Circle","G","Path","Polygon","Rect","Defs","RadialGradient","LinearGradient","Stop","AnimatedSvg","createAnimatedComponent","props","ref","SVG","className","isPressed","animated","colorScheme","stylesFromClasses","split","map","element","filter","Boolean","defaultStyle","propStyle","Array","isArray","style","reduce","acc","el","styleValues","Object","assign","appliedProps","SvgWrapper","color"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,kBAApB;AACA,SAASC,QAAT,QAAyB,cAAzB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,MAAP,MAAmB,cAAnB;AAEA,SACCC,MADD,EAECC,CAFD,EAGCC,IAHD,EAICC,OAJD,EAKCC,IALD,EAMCC,IAND,EAOCC,cAPD,EAQCC,cARD,EASCC,IATD,QAUO,kBAVP;AAYA,MAAMC,WAAW,GAAGZ,QAAQ,CAACa,uBAAT,CACnBZ,UAAU,CAAE,CAAEa,KAAF,EAASC,GAAT,KAAkB,cAAC,GAAD;AAAK,EAAA,GAAG,EAAGA;AAAX,GAAsBD,KAAtB,EAApB,CADS,CAApB;AAIA,OAAO,MAAME,GAAG,GAAG,QAKZ;AAAA,MALc;AACpBC,IAAAA,SAAS,GAAG,EADQ;AAEpBC,IAAAA,SAFoB;AAGpBC,IAAAA,QAAQ,GAAG,KAHS;AAIpB,OAAGL;AAJiB,GAKd;AACN,QAAMM,WAAW,GAAGN,KAAK,CAACM,WAAN,IAAqB,OAAzC;AACA,QAAMC,iBAAiB,GAAGJ,SAAS,CACjCK,KADwB,CACjB,GADiB,EAExBC,GAFwB,CAEjBC,OAAF,IAAetB,MAAM,CAAEsB,OAAF,CAFF,EAGxBC,MAHwB,CAGhBC,OAHgB,CAA1B;AAIA,QAAMC,YAAY,GAAGT,SAAS,GAC3BhB,MAAM,CAAE,YAAF,CADqB,GAE3BA,MAAM,CAAE,iCAAiCkB,WAAnC,CAFT;AAGA,QAAMQ,SAAS,GAAGC,KAAK,CAACC,OAAN,CAAehB,KAAK,CAACiB,KAArB,IACfjB,KAAK,CAACiB,KAAN,CAAYC,MAAZ,CAAoB,CAAEC,GAAF,EAAOC,EAAP,KAAe;AACnC,WAAO,EAAE,GAAGD,GAAL;AAAU,SAAGC;AAAb,KAAP;AACC,GAFD,EAEG,EAFH,CADe,GAIfpB,KAAK,CAACiB,KAJT;AAKA,QAAMI,WAAW,GAAGC,MAAM,CAACC,MAAP,CACnB,EADmB,EAEnBV,YAFmB,EAGnBC,SAHmB,EAInB,GAAGP,iBAJgB,CAApB;AAOA,QAAMiB,YAAY,GAAG,EAAE,GAAGxB,KAAL;AAAYiB,IAAAA,KAAK,EAAEI;AAAnB,GAArB;AAEA,QAAMI,UAAU,GAAGpB,QAAQ,GAAGP,WAAH,GAAiBb,GAA5C;AAEA,SACC,cAAC,UAAD,CACC;AADD;AAEC,IAAA,GAAG,EAAGuC,YAAY,CAACP,KAAb,CAAmBS,KAF1B;AAGC,IAAA,MAAM,EAAC,MAHR;AAIC,IAAA,KAAK,EAAC;AAJP,KAKMF,YALN,EADD;AASA,CAvCM","sourcesContent":["/**\n * External dependencies\n */\nimport { Svg } from 'react-native-svg';\nimport { Animated } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nexport {\n\tCircle,\n\tG,\n\tPath,\n\tPolygon,\n\tRect,\n\tDefs,\n\tRadialGradient,\n\tLinearGradient,\n\tStop,\n} from 'react-native-svg';\n\nconst AnimatedSvg = Animated.createAnimatedComponent(\n\tforwardRef( ( props, ref ) => <Svg ref={ ref } { ...props } /> )\n);\n\nexport const SVG = ( {\n\tclassName = '',\n\tisPressed,\n\tanimated = false,\n\t...props\n} ) => {\n\tconst colorScheme = props.colorScheme || 'light';\n\tconst stylesFromClasses = className\n\t\t.split( ' ' )\n\t\t.map( ( element ) => styles[ element ] )\n\t\t.filter( Boolean );\n\tconst defaultStyle = isPressed\n\t\t? styles[ 'is-pressed' ]\n\t\t: styles[ 'components-toolbar__control-' + colorScheme ];\n\tconst propStyle = Array.isArray( props.style )\n\t\t? props.style.reduce( ( acc, el ) => {\n\t\t\t\treturn { ...acc, ...el };\n\t\t }, {} )\n\t\t: props.style;\n\tconst styleValues = Object.assign(\n\t\t{},\n\t\tdefaultStyle,\n\t\tpropStyle,\n\t\t...stylesFromClasses\n\t);\n\n\tconst appliedProps = { ...props, style: styleValues };\n\n\tconst SvgWrapper = animated ? AnimatedSvg : Svg;\n\n\treturn (\n\t\t<SvgWrapper\n\t\t\t//We want to re-render when style color is changed\n\t\t\tkey={ appliedProps.style.color }\n\t\t\theight=\"100%\"\n\t\t\twidth=\"100%\"\n\t\t\t{ ...appliedProps }\n\t\t/>\n\t);\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/primitives",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
4
4
|
"description": "WordPress cross-platform primitives.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
],
|
|
31
31
|
"types": "build-types",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@babel/runtime": "^7.
|
|
34
|
-
"@wordpress/element": "^4.0.
|
|
33
|
+
"@babel/runtime": "^7.16.0",
|
|
34
|
+
"@wordpress/element": "^4.0.4",
|
|
35
35
|
"classnames": "^2.3.1"
|
|
36
36
|
},
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "9a1dd3474d937468e4cf9caf9886ad61ef0a8f50"
|
|
41
41
|
}
|