@mapples/ui 1.0.6 → 1.0.7
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/dist/components/media/Svg/Svg.d.ts +44 -0
- package/dist/components/media/Svg/Svg.d.ts.map +1 -0
- package/dist/components/media/Svg/Svg.js +41 -0
- package/dist/components/media/Svg/Svg.js.map +1 -0
- package/dist/components/media/Svg/index.d.ts +4 -0
- package/dist/components/media/Svg/index.d.ts.map +1 -0
- package/dist/components/media/Svg/index.js +3 -0
- package/dist/components/media/Svg/index.js.map +1 -0
- package/dist/components/media/Svg/schematics.d.ts +3 -0
- package/dist/components/media/Svg/schematics.d.ts.map +1 -0
- package/dist/components/media/Svg/schematics.js +6 -0
- package/dist/components/media/Svg/schematics.js.map +1 -0
- package/dist/components/media/index.d.ts +2 -0
- package/dist/components/media/index.d.ts.map +1 -1
- package/dist/components/media/index.js +2 -0
- package/dist/components/media/index.js.map +1 -1
- package/dist/components/media/schematics.d.ts.map +1 -1
- package/dist/components/media/schematics.js +2 -0
- package/dist/components/media/schematics.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { StyledProp, StyledProps, WithStyledProps } from '@mapples/style';
|
|
2
|
+
import { View, ViewProps } from 'react-native';
|
|
3
|
+
import { SvgProps as RnsSvgProps } from 'react-native-svg';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the Svg component.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export type SvgProps = WithStyledProps<ViewProps> & {
|
|
10
|
+
/** Styling configuration for the container and SVG */
|
|
11
|
+
styled?: StyledProps<ViewProps> & {
|
|
12
|
+
/** SVG-specific styling (width, height, color) */
|
|
13
|
+
styleSvg?: StyledProp<RnsSvgProps>;
|
|
14
|
+
};
|
|
15
|
+
/** SVG markup string (e.g. from Figma vector group conversion) */
|
|
16
|
+
content?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Renders inline SVG from a string (e.g. from @mapplesorg/figmafile GROUP→Svg conversion).
|
|
20
|
+
* Uses a data URI so react-native-svg's SvgUri can display it.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <Svg
|
|
25
|
+
* content='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect x="0" y="0" width="100" height="100" fill="#333"/></svg>'
|
|
26
|
+
* styled={{ style: { width: 100, height: 100 }, styleSvg: { width: 100, height: 100 } }}
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
declare const Svg: import("react").ForwardRefExoticComponent<{
|
|
33
|
+
styled?: StyledProps<Partial<ViewProps>> | undefined;
|
|
34
|
+
} & ViewProps & {
|
|
35
|
+
/** Styling configuration for the container and SVG */
|
|
36
|
+
styled?: StyledProps<ViewProps> & {
|
|
37
|
+
/** SVG-specific styling (width, height, color) */
|
|
38
|
+
styleSvg?: StyledProp<RnsSvgProps>;
|
|
39
|
+
};
|
|
40
|
+
/** SVG markup string (e.g. from Figma vector group conversion) */
|
|
41
|
+
content?: string;
|
|
42
|
+
} & import("react").RefAttributes<View>>;
|
|
43
|
+
export default Svg;
|
|
44
|
+
//# sourceMappingURL=Svg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Svg.d.ts","sourceRoot":"","sources":["../../../../src/components/media/Svg/Svg.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,UAAU,EACV,WAAW,EAGX,eAAe,EAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAa,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAU,MAAM,kBAAkB,CAAC;AAInE;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,GAAG;IAClD,sDAAsD;IACtD,MAAM,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG;QAChC,kDAAkD;QAClD,QAAQ,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;KACpC,CAAC;IACF,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,GAAG;;;IAvBP,sDAAsD;aAC7C,WAAW,CAAC,SAAS,CAAC,GAAG;QAChC,kDAAkD;QAClD,QAAQ,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;KACpC;IACD,kEAAkE;cACxD,MAAM;wCAuChB,CAAC;AAcH,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { styled, StyledView, Styler, } from '@mapples/style';
|
|
3
|
+
import { SvgUri } from 'react-native-svg';
|
|
4
|
+
const StyledSvgUri = styled(SvgUri);
|
|
5
|
+
/**
|
|
6
|
+
* Renders inline SVG from a string (e.g. from @mapplesorg/figmafile GROUP→Svg conversion).
|
|
7
|
+
* Uses a data URI so react-native-svg's SvgUri can display it.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <Svg
|
|
12
|
+
* content='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect x="0" y="0" width="100" height="100" fill="#333"/></svg>'
|
|
13
|
+
* styled={{ style: { width: 100, height: 100 }, styleSvg: { width: 100, height: 100 } }}
|
|
14
|
+
* />
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
const Svg = forwardRef(({ styled, content, ...props }, ref) => {
|
|
20
|
+
const { styleSvg, style, ...styledProps } = styled || {};
|
|
21
|
+
const uri = content && content.trim().length > 0
|
|
22
|
+
? `data:image/svg+xml;charset=utf-8,${encodeURIComponent(content.trim())}`
|
|
23
|
+
: undefined;
|
|
24
|
+
const svgStyle = styleSvg ?? style;
|
|
25
|
+
return (<StyledView ref={ref} styled={{ style, ...styledProps }} {...props}>
|
|
26
|
+
{uri ? (<StyledSvgUri uri={uri} styled={{ style: svgStyle }}/>) : (<StyledView styled={{ style: styler.placeholder }}/>)}
|
|
27
|
+
</StyledView>);
|
|
28
|
+
});
|
|
29
|
+
Svg.displayName = 'Svg';
|
|
30
|
+
const styler = Styler.create({
|
|
31
|
+
placeholder: {
|
|
32
|
+
width: '100%',
|
|
33
|
+
height: '100%',
|
|
34
|
+
minHeight: 48,
|
|
35
|
+
backgroundColor: '#f0f0f0',
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
export default Svg;
|
|
41
|
+
//# sourceMappingURL=Svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Svg.js","sourceRoot":"","sources":["../../../../src/components/media/Svg/Svg.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EACL,MAAM,EAGN,UAAU,EACV,MAAM,GAEP,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAA2B,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAEnE,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAiBpC;;;;;;;;;;;;;GAaG;AACH,MAAM,GAAG,GAAG,UAAU,CAAiB,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC5E,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAEzD,MAAM,GAAG,GACP,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAClC,CAAC,CAAC,oCAAoC,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,EAAE;QAC1E,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,QAAQ,GAAG,QAAQ,IAAI,KAAK,CAAC;IAEnC,OAAO,CACL,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,CACjE;MAAA,CAAC,GAAG,CAAC,CAAC,CAAC,CACL,CAAC,YAAY,CACX,GAAG,CAAC,CAAC,GAAG,CAAC,CACT,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,QAAiC,EAAE,CAAC,EACrD,CACH,CAAC,CAAC,CAAC,CACF,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,EAAG,CACtD,CACH;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC;AAExB,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3B,WAAW,EAAE;QACX,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,EAAE;QACb,eAAe,EAAE,SAAS;QAC1B,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KACzB;CACF,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/media/Svg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/media/Svg/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schematics.d.ts","sourceRoot":"","sources":["../../../../src/components/media/Svg/schematics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIrD,eAAO,MAAM,YAAY,EAAE,mBAG1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schematics.js","sourceRoot":"","sources":["../../../../src/components/media/Svg/schematics.ts"],"names":[],"mappings":"AAEA,OAAO,GAAG,MAAM,OAAO,CAAC;AAExB,MAAM,CAAC,MAAM,YAAY,GAAwB;IAC/C,IAAI,EAAE,KAAK;IACX,SAAS,EAAE,GAAG;CACf,CAAC"}
|
|
@@ -8,5 +8,7 @@ export { default as BarCode } from './BarCode';
|
|
|
8
8
|
export * from './BarCode';
|
|
9
9
|
export { default as QRCode } from './QRCode';
|
|
10
10
|
export * from './QRCode';
|
|
11
|
+
export { default as Svg } from './Svg';
|
|
12
|
+
export * from './Svg';
|
|
11
13
|
export * from './schematics';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,cAAc,UAAU,CAAC;AAEzB,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,cAAc,OAAO,CAAC;AAEtB,cAAc,cAAc,CAAC"}
|
|
@@ -8,5 +8,7 @@ export { default as BarCode } from './BarCode';
|
|
|
8
8
|
export * from './BarCode';
|
|
9
9
|
export { default as QRCode } from './QRCode';
|
|
10
10
|
export * from './QRCode';
|
|
11
|
+
export { default as Svg } from './Svg';
|
|
12
|
+
export * from './Svg';
|
|
11
13
|
export * from './schematics';
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/media/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,cAAc,UAAU,CAAC;AAEzB,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/media/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,cAAc,QAAQ,CAAC;AAEvB,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,cAAc,WAAW,CAAC;AAE1B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,cAAc,OAAO,CAAC;AAEtB,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schematics.d.ts","sourceRoot":"","sources":["../../../src/components/media/schematics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"schematics.d.ts","sourceRoot":"","sources":["../../../src/components/media/schematics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAStD,eAAO,MAAM,eAAe,EAAE,oBAO7B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { BarCodeSchematic } from './BarCode';
|
|
|
2
2
|
import { IconSchematics } from './Icon';
|
|
3
3
|
import { ImageSchematic } from './Image';
|
|
4
4
|
import { QRCodeSchematic } from './QRCode';
|
|
5
|
+
import { SvgSchematic } from './Svg';
|
|
5
6
|
import { VideoSchematic } from './Video';
|
|
6
7
|
export const MediaSchematics = {
|
|
7
8
|
[VideoSchematic.type]: VideoSchematic,
|
|
@@ -9,5 +10,6 @@ export const MediaSchematics = {
|
|
|
9
10
|
[IconSchematics.type]: IconSchematics,
|
|
10
11
|
[BarCodeSchematic.type]: BarCodeSchematic,
|
|
11
12
|
[QRCodeSchematic.type]: QRCodeSchematic,
|
|
13
|
+
[SvgSchematic.type]: SvgSchematic,
|
|
12
14
|
};
|
|
13
15
|
//# sourceMappingURL=schematics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schematics.js","sourceRoot":"","sources":["../../../src/components/media/schematics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAyB;IACnD,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc;IACrC,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc;IACrC,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc;IACrC,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,gBAAgB;IACzC,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,eAAe;
|
|
1
|
+
{"version":3,"file":"schematics.js","sourceRoot":"","sources":["../../../src/components/media/schematics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAyB;IACnD,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc;IACrC,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc;IACrC,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc;IACrC,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,gBAAgB;IACzC,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,eAAe;IACvC,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,YAAY;CAClC,CAAC"}
|