@mapples/ui 1.1.2 → 1.4.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/dist/components/form/SubmitButton/SubmitButton.d.ts +13 -26
- package/dist/components/form/SubmitButton/SubmitButton.d.ts.map +1 -1
- package/dist/components/form/SubmitButton/SubmitButton.js +12 -21
- package/dist/components/form/SubmitButton/SubmitButton.js.map +1 -1
- package/dist/components/inputs/Button/Button.d.ts +42 -5
- package/dist/components/inputs/Button/Button.d.ts.map +1 -1
- package/dist/components/inputs/Button/Button.js +151 -10
- package/dist/components/inputs/Button/Button.js.map +1 -1
- package/dist/components/inputs/IconButton/IconButton.d.ts +65 -23
- package/dist/components/inputs/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/inputs/IconButton/IconButton.js +185 -38
- package/dist/components/inputs/IconButton/IconButton.js.map +1 -1
- package/dist/components/inputs/TextInput/TextInput.d.ts +5 -0
- package/dist/components/inputs/TextInput/TextInput.d.ts.map +1 -1
- package/dist/components/inputs/TextInput/TextInput.js +15 -3
- package/dist/components/inputs/TextInput/TextInput.js.map +1 -1
- package/dist/components/media/BarCode/BarCode.d.ts.map +1 -1
- package/dist/components/media/BarCode/BarCode.js +32 -38
- package/dist/components/media/BarCode/BarCode.js.map +1 -1
- package/dist/components/media/BarCode/BarCodeEncoder.d.ts.map +1 -1
- package/dist/components/media/BarCode/BarCodeEncoder.js +22 -3
- package/dist/components/media/BarCode/BarCodeEncoder.js.map +1 -1
- package/dist/components/media/Icon/Icon.d.ts +43 -24
- package/dist/components/media/Icon/Icon.d.ts.map +1 -1
- package/dist/components/media/Icon/Icon.js +31 -33
- package/dist/components/media/Icon/Icon.js.map +1 -1
- package/dist/components/media/Icon/families.d.ts +66 -0
- package/dist/components/media/Icon/families.d.ts.map +1 -0
- package/dist/components/media/Icon/families.js +316 -0
- package/dist/components/media/Icon/families.js.map +1 -0
- package/dist/components/media/Icon/index.d.ts +2 -0
- package/dist/components/media/Icon/index.d.ts.map +1 -1
- package/dist/components/media/Icon/index.js +2 -0
- package/dist/components/media/Icon/index.js.map +1 -1
- package/dist/components/media/QRCode/QRCode.d.ts.map +1 -1
- package/dist/components/media/QRCode/QRCode.js +19 -2
- package/dist/components/media/QRCode/QRCode.js.map +1 -1
- package/dist/components/media/Vector/MockIcon.d.ts.map +1 -0
- package/dist/components/media/Vector/MockIcon.js.map +1 -0
- package/dist/components/media/Vector/Vector.d.ts +56 -0
- package/dist/components/media/Vector/Vector.d.ts.map +1 -0
- package/dist/components/media/Vector/Vector.js +59 -0
- package/dist/components/media/Vector/Vector.js.map +1 -0
- package/dist/components/media/Vector/index.d.ts +5 -0
- package/dist/components/media/Vector/index.d.ts.map +1 -0
- package/dist/components/media/Vector/index.js +5 -0
- package/dist/components/media/Vector/index.js.map +1 -0
- package/dist/components/media/Vector/schematics.d.ts +11 -0
- package/dist/components/media/Vector/schematics.d.ts.map +1 -0
- package/dist/components/media/Vector/schematics.js +14 -0
- package/dist/components/media/Vector/schematics.js.map +1 -0
- package/dist/components/media/Video/Video.d.ts +1 -1
- package/dist/components/media/Video/Video.d.ts.map +1 -1
- package/dist/components/media/Video/Video.js +26 -3
- package/dist/components/media/Video/Video.js.map +1 -1
- 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 +3 -3
- package/dist/components/media/schematics.d.ts.map +1 -1
- package/dist/components/media/schematics.js +5 -3
- package/dist/components/media/schematics.js.map +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/useTones.d.ts +54 -0
- package/dist/hooks/useTones.d.ts.map +1 -0
- package/dist/hooks/useTones.js +79 -0
- package/dist/hooks/useTones.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/tokens.d.ts +111 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +133 -0
- package/dist/tokens.js.map +1 -0
- package/package.json +76 -1
- package/dist/components/media/Icon/MockIcon.d.ts.map +0 -1
- package/dist/components/media/Icon/MockIcon.js.map +0 -1
- /package/dist/components/media/{Icon → Vector}/MockIcon.d.ts +0 -0
- /package/dist/components/media/{Icon → Vector}/MockIcon.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../src/components/media/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../../src/components/media/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EACL,UAAU,EACV,WAAW,EAGX,QAAQ,EAER,eAAe,EAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,UAAU,EAGV,IAAI,EACJ,SAAS,EACV,MAAM,cAAc,CAAC;AAItB,OAAO,EAAgB,aAAa,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,iBAAiB,CACvC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,GAAG;IAC3C,6DAA6D;IAC7D,MAAM,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG;QAChC,oDAAoD;QACpD,QAAQ,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;KACjC,CAAC;CACH,CACF,GAAG;IACF;;;;OAIG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,QAAA,MAAM,IAAI;IA3CN,6DAA6D;aACpD,WAAW,CAAC,SAAS,CAAC,GAAG;QAChC,oDAAoD;QACpD,QAAQ,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;KACjC;;;;IAGH;;;;OAIG;gBACS,aAAa;IACzB,4CAA4C;eACjC,MAAM;IACjB,sEAAsE;WAC/D,MAAM;IACb,yEAAyE;YACjE,UAAU;wCAqEnB,CAAC;AAGF,eAAe,IAAI,CAAC"}
|
|
@@ -1,52 +1,50 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const StyledSvgUri = makeStyled(SvgUri);
|
|
2
|
+
import { StyledView, Styler, useStyle, } from '@mapples/style';
|
|
3
|
+
import MockIcon from '../Vector/MockIcon';
|
|
4
|
+
import { IconFamilies } from './families';
|
|
6
5
|
/**
|
|
7
|
-
* Renders
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* optional.
|
|
6
|
+
* Renders a font glyph from one of the bundled `@react-native-vector-icons`
|
|
7
|
+
* families. The family comes from the project style config
|
|
8
|
+
* (`themeConfig.icons.family`) unless overridden per instance via `iconStyle`;
|
|
9
|
+
* the glyph is selected by `iconName`. Without a family or a name the
|
|
10
|
+
* `MockIcon` placeholder is shown; a family whose package is not installed
|
|
11
|
+
* (every pack is an optional peer) throws.
|
|
13
12
|
*
|
|
14
13
|
* @example
|
|
15
14
|
* ```tsx
|
|
16
|
-
* //
|
|
15
|
+
* // Canvas usage — family from the project style config
|
|
17
16
|
* <Icon
|
|
18
|
-
*
|
|
17
|
+
* iconName="star"
|
|
19
18
|
* styled={{ styleSvg: { width: 24, height: 24, color: '#333' } }}
|
|
20
19
|
* />
|
|
21
20
|
*
|
|
22
|
-
* //
|
|
23
|
-
*
|
|
24
|
-
* <Icon uri={MyIcon} styled={{ styleSvg: { width: 24, height: 24 } }} />
|
|
21
|
+
* // Direct usage — chrome/chat surfaces pin the family
|
|
22
|
+
* <Icon iconStyle="ionicons" iconName="close" size={14} color="theme.text.tertiary" />
|
|
25
23
|
* ```
|
|
26
24
|
*
|
|
27
25
|
* @public
|
|
28
26
|
*/
|
|
29
|
-
const Icon = forwardRef(({ styled,
|
|
27
|
+
const Icon = forwardRef(({ styled, iconStyle, iconName, size, color, ...props }, ref) => {
|
|
28
|
+
const { themeConfig } = useStyle();
|
|
30
29
|
const { styleSvg, ...styledViewProps } = styled || {};
|
|
31
30
|
const ejectStyle = Styler.flatten(styleSvg);
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
const familyKey = iconStyle ?? themeConfig.icons?.family;
|
|
32
|
+
const family = familyKey
|
|
33
|
+
? IconFamilies[familyKey]
|
|
34
|
+
: undefined;
|
|
35
|
+
if (family && !family.installed) {
|
|
36
|
+
// The project selected a family whose package isn't installed — a
|
|
37
|
+
// configuration error, not a missing glyph: surface it instead of
|
|
38
|
+
// drawing the placeholder.
|
|
39
|
+
throw new Error(`Icon family "${family.key}" is not installed: add ${family.npm} to ` +
|
|
40
|
+
'the project (Project settings → Packages) to render it.');
|
|
41
|
+
}
|
|
41
42
|
return (<StyledView ref={ref} styled={styledViewProps} {...props}>
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
style: styleSvg,
|
|
48
|
-
}}/>) : (getUriComponent(uri))}
|
|
49
|
-
</>) : (<MockIcon styled={{
|
|
43
|
+
{family && iconName ? (<family.Component name={iconName} styled={{
|
|
44
|
+
size: size ?? ejectStyle?.width,
|
|
45
|
+
color: color ?? ejectStyle?.color,
|
|
46
|
+
style: styleSvg,
|
|
47
|
+
}}/>) : (<MockIcon styled={{
|
|
50
48
|
width: ejectStyle?.width,
|
|
51
49
|
height: ejectStyle?.height,
|
|
52
50
|
color: ejectStyle?.color,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../src/components/media/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../src/components/media/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqB,MAAM,OAAO,CAAC;AAEtD,OAAO,EAGL,UAAU,EACV,MAAM,EAEN,QAAQ,GAET,MAAM,gBAAgB,CAAC;AASxB,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAiB,MAAM,YAAY,CAAC;AA8BzD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,IAAI,GAAG,UAAU,CACrB,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC9D,MAAM,EAAE,WAAW,EAAE,GAAG,QAAQ,EAAE,CAAC;IACnC,MAAM,EAAE,QAAQ,EAAE,GAAG,eAAe,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAEtD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,SAAS,IAAI,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC;IACzD,MAAM,MAAM,GAAG,SAAS;QACtB,CAAC,CAAC,YAAY,CAAC,SAA0B,CAAC;QAC1C,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QAChC,kEAAkE;QAClE,kEAAkE;QAClE,2BAA2B;QAC3B,MAAM,IAAI,KAAK,CACb,gBAAgB,MAAM,CAAC,GAAG,2BAA2B,MAAM,CAAC,GAAG,MAAM;YACnE,yDAAyD,CAC5D,CAAC;IACJ,CAAC;IAED,OAAO,CACL,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,IAAI,KAAK,CAAC,CACvD;QAAA,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CACpB,CAAC,MAAM,CAAC,SAAS,CACf,IAAI,CAAC,CAAC,QAAQ,CAAC,CACf,MAAM,CAAC,CAAC;gBACN,IAAI,EAAE,IAAI,IAAK,UAAU,EAAE,KAAgB;gBAC3C,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,KAAK;gBACjC,KAAK,EAAE,QAA4C;aACpD,CAAC,EACF,CACH,CAAC,CAAC,CAAC,CACF,CAAC,QAAQ,CACP,MAAM,CAAC,CAAC;gBACN,KAAK,EAAE,UAAU,EAAE,KAAwB;gBAC3C,MAAM,EAAE,UAAU,EAAE,MAAyB;gBAC7C,KAAK,EAAE,UAAU,EAAE,KAAK;gBACxB,KAAK,EAAE,QAAQ;aAChB,CAAC,EACF,CACH,CACH;MAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC,CACF,CAAC;AACF,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;AAE1B,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { WithStyledProps } from '@mapples/style';
|
|
3
|
+
import { ColorValue, StyleProp, TextStyle } from 'react-native';
|
|
4
|
+
/**
|
|
5
|
+
* Uniform props every icon-family glyph component accepts.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export interface IconGlyphProps {
|
|
10
|
+
/** Glyph name within the family */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Font size of the glyph */
|
|
13
|
+
size?: number;
|
|
14
|
+
/** Glyph color */
|
|
15
|
+
color?: ColorValue;
|
|
16
|
+
/** Additional text styling */
|
|
17
|
+
style?: StyleProp<TextStyle>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Map of glyph name to codepoint for one icon family.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export type IconGlyphMap = Record<string, number | string>;
|
|
25
|
+
/**
|
|
26
|
+
* Persisted identifier of an icon family. FontAwesome 5/6 expose one entry per
|
|
27
|
+
* variant so the `Icon` component API stays at exactly two props
|
|
28
|
+
* (`iconStyle` + `iconName`).
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export type IconFamilyKey = 'ant-design' | 'entypo' | 'evil-icons' | 'feather' | 'fontawesome' | 'fontawesome5-solid' | 'fontawesome5-regular' | 'fontawesome5-brands' | 'fontawesome6-solid' | 'fontawesome6-regular' | 'fontawesome6-brands' | 'fontisto' | 'foundation' | 'ionicons' | 'lucide' | 'material-design-icons' | 'material-icons' | 'octicons' | 'simple-line-icons' | 'zocial';
|
|
33
|
+
/**
|
|
34
|
+
* One registered icon family: its persisted key, human label, the npm package
|
|
35
|
+
* that ships the font, whether that package resolved, the styled()-wrapped
|
|
36
|
+
* glyph component, and the glyph map (used by editor pickers for name lists
|
|
37
|
+
* and previews — empty when the package is not installed).
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export interface IconFamily {
|
|
42
|
+
key: IconFamilyKey;
|
|
43
|
+
label: string;
|
|
44
|
+
/** The `@react-native-vector-icons/*` package that ships this family. */
|
|
45
|
+
npm: string;
|
|
46
|
+
/** Whether {@link IconFamily.npm} resolved when the bundle was built. */
|
|
47
|
+
installed: boolean;
|
|
48
|
+
Component: ComponentType<WithStyledProps<IconGlyphProps>>;
|
|
49
|
+
glyphMap: IconGlyphMap;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The npm package behind each icon family. FontAwesome 5/6 variants share one
|
|
53
|
+
* package each.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
export declare const ICON_FAMILY_NPM: Record<IconFamilyKey, string>;
|
|
58
|
+
/**
|
|
59
|
+
* Registry of every known icon family, keyed by the persisted
|
|
60
|
+
* {@link IconFamilyKey}. Every key is always present; check
|
|
61
|
+
* {@link IconFamily.installed} before relying on a family's glyphs.
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
export declare const IconFamilies: Record<IconFamilyKey, IconFamily>;
|
|
66
|
+
//# sourceMappingURL=families.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"families.d.ts","sourceRoot":"","sources":["../../../../src/components/media/Icon/families.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAU,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kBAAkB;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,QAAQ,GACR,YAAY,GACZ,SAAS,GACT,aAAa,GACb,oBAAoB,GACpB,sBAAsB,GACtB,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,qBAAqB,GACrB,UAAU,GACV,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,uBAAuB,GACvB,gBAAgB,GAChB,UAAU,GACV,mBAAmB,GACnB,QAAQ,CAAC;AAEb;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,aAAa,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,yEAAyE;IACzE,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,aAAa,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,CAAC;IAC1D,QAAQ,EAAE,YAAY,CAAC;CACxB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAqBzD,CAAC;AA0SF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,aAAa,EAAE,UAAU,CAqE1D,CAAC"}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { styled } from '@mapples/style';
|
|
2
|
+
/**
|
|
3
|
+
* The npm package behind each icon family. FontAwesome 5/6 variants share one
|
|
4
|
+
* package each.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export const ICON_FAMILY_NPM = {
|
|
9
|
+
'ant-design': '@react-native-vector-icons/ant-design',
|
|
10
|
+
entypo: '@react-native-vector-icons/entypo',
|
|
11
|
+
'evil-icons': '@react-native-vector-icons/evil-icons',
|
|
12
|
+
feather: '@react-native-vector-icons/feather',
|
|
13
|
+
fontawesome: '@react-native-vector-icons/fontawesome',
|
|
14
|
+
'fontawesome5-solid': '@react-native-vector-icons/fontawesome5',
|
|
15
|
+
'fontawesome5-regular': '@react-native-vector-icons/fontawesome5',
|
|
16
|
+
'fontawesome5-brands': '@react-native-vector-icons/fontawesome5',
|
|
17
|
+
'fontawesome6-solid': '@react-native-vector-icons/fontawesome6',
|
|
18
|
+
'fontawesome6-regular': '@react-native-vector-icons/fontawesome6',
|
|
19
|
+
'fontawesome6-brands': '@react-native-vector-icons/fontawesome6',
|
|
20
|
+
fontisto: '@react-native-vector-icons/fontisto',
|
|
21
|
+
foundation: '@react-native-vector-icons/foundation',
|
|
22
|
+
ionicons: '@react-native-vector-icons/ionicons',
|
|
23
|
+
lucide: '@react-native-vector-icons/lucide',
|
|
24
|
+
'material-design-icons': '@react-native-vector-icons/material-design-icons',
|
|
25
|
+
'material-icons': '@react-native-vector-icons/material-icons',
|
|
26
|
+
octicons: '@react-native-vector-icons/octicons',
|
|
27
|
+
'simple-line-icons': '@react-native-vector-icons/simple-line-icons',
|
|
28
|
+
zocial: '@react-native-vector-icons/zocial',
|
|
29
|
+
};
|
|
30
|
+
/* eslint-disable @typescript-eslint/no-require-imports -- optional peers are resolved lazily below */
|
|
31
|
+
/*
|
|
32
|
+
* Every `@react-native-vector-icons/*` package is an **optional peer
|
|
33
|
+
* dependency** of `@mapples/ui`: a project ships only the pack its style
|
|
34
|
+
* config selects (Project settings → Packages), so the others must not be
|
|
35
|
+
* required to build. Each pack is resolved lazily with a `require` that sits
|
|
36
|
+
* lexically inside `try` — Metro (with Expo's `allowOptionalDependencies`)
|
|
37
|
+
* then skips the module when it cannot be resolved instead of failing the
|
|
38
|
+
* bundle. A missing pack is not swallowed: its family is registered as
|
|
39
|
+
* `installed: false` and rendering a glyph from it throws (see
|
|
40
|
+
* {@link missingFamily}), naming the package to add.
|
|
41
|
+
*/
|
|
42
|
+
let antDesign = null;
|
|
43
|
+
try {
|
|
44
|
+
antDesign = {
|
|
45
|
+
Family: require('@react-native-vector-icons/ant-design').default,
|
|
46
|
+
glyphs: [
|
|
47
|
+
require('@react-native-vector-icons/ant-design/glyphmaps/AntDesign.json'),
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
antDesign = null;
|
|
53
|
+
}
|
|
54
|
+
let entypo = null;
|
|
55
|
+
try {
|
|
56
|
+
entypo = {
|
|
57
|
+
Family: require('@react-native-vector-icons/entypo').default,
|
|
58
|
+
glyphs: [
|
|
59
|
+
require('@react-native-vector-icons/entypo/glyphmaps/Entypo.json'),
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
entypo = null;
|
|
65
|
+
}
|
|
66
|
+
let evilIcons = null;
|
|
67
|
+
try {
|
|
68
|
+
evilIcons = {
|
|
69
|
+
Family: require('@react-native-vector-icons/evil-icons').default,
|
|
70
|
+
glyphs: [
|
|
71
|
+
require('@react-native-vector-icons/evil-icons/glyphmaps/EvilIcons.json'),
|
|
72
|
+
],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
evilIcons = null;
|
|
77
|
+
}
|
|
78
|
+
let feather = null;
|
|
79
|
+
try {
|
|
80
|
+
feather = {
|
|
81
|
+
Family: require('@react-native-vector-icons/feather').default,
|
|
82
|
+
glyphs: [
|
|
83
|
+
require('@react-native-vector-icons/feather/glyphmaps/Feather.json'),
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
feather = null;
|
|
89
|
+
}
|
|
90
|
+
let fontAwesome = null;
|
|
91
|
+
try {
|
|
92
|
+
fontAwesome = {
|
|
93
|
+
Family: require('@react-native-vector-icons/fontawesome').default,
|
|
94
|
+
glyphs: [
|
|
95
|
+
require('@react-native-vector-icons/fontawesome/glyphmaps/FontAwesome.json'),
|
|
96
|
+
],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
fontAwesome = null;
|
|
101
|
+
}
|
|
102
|
+
/** Glyph map order for FontAwesome 5/6 packs: solid, regular, brands. */
|
|
103
|
+
const FA_SOLID = 0;
|
|
104
|
+
const FA_REGULAR = 1;
|
|
105
|
+
const FA_BRANDS = 2;
|
|
106
|
+
let fontAwesome5 = null;
|
|
107
|
+
try {
|
|
108
|
+
fontAwesome5 = {
|
|
109
|
+
Family: require('@react-native-vector-icons/fontawesome5').default,
|
|
110
|
+
glyphs: [
|
|
111
|
+
require('@react-native-vector-icons/fontawesome5/glyphmaps/FontAwesome5_solid.json'),
|
|
112
|
+
require('@react-native-vector-icons/fontawesome5/glyphmaps/FontAwesome5_regular.json'),
|
|
113
|
+
require('@react-native-vector-icons/fontawesome5/glyphmaps/FontAwesome5_brand.json'),
|
|
114
|
+
],
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
catch {
|
|
118
|
+
fontAwesome5 = null;
|
|
119
|
+
}
|
|
120
|
+
let fontAwesome6 = null;
|
|
121
|
+
try {
|
|
122
|
+
fontAwesome6 = {
|
|
123
|
+
Family: require('@react-native-vector-icons/fontawesome6').default,
|
|
124
|
+
glyphs: [
|
|
125
|
+
require('@react-native-vector-icons/fontawesome6/glyphmaps/FontAwesome6_solid.json'),
|
|
126
|
+
require('@react-native-vector-icons/fontawesome6/glyphmaps/FontAwesome6_regular.json'),
|
|
127
|
+
require('@react-native-vector-icons/fontawesome6/glyphmaps/FontAwesome6_brand.json'),
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
fontAwesome6 = null;
|
|
133
|
+
}
|
|
134
|
+
let fontisto = null;
|
|
135
|
+
try {
|
|
136
|
+
fontisto = {
|
|
137
|
+
Family: require('@react-native-vector-icons/fontisto').default,
|
|
138
|
+
glyphs: [
|
|
139
|
+
require('@react-native-vector-icons/fontisto/glyphmaps/Fontisto.json'),
|
|
140
|
+
],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
fontisto = null;
|
|
145
|
+
}
|
|
146
|
+
let foundation = null;
|
|
147
|
+
try {
|
|
148
|
+
foundation = {
|
|
149
|
+
Family: require('@react-native-vector-icons/foundation').default,
|
|
150
|
+
glyphs: [
|
|
151
|
+
require('@react-native-vector-icons/foundation/glyphmaps/Foundation.json'),
|
|
152
|
+
],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
foundation = null;
|
|
157
|
+
}
|
|
158
|
+
let ionicons = null;
|
|
159
|
+
try {
|
|
160
|
+
ionicons = {
|
|
161
|
+
Family: require('@react-native-vector-icons/ionicons').default,
|
|
162
|
+
glyphs: [
|
|
163
|
+
require('@react-native-vector-icons/ionicons/glyphmaps/Ionicons.json'),
|
|
164
|
+
],
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
ionicons = null;
|
|
169
|
+
}
|
|
170
|
+
let lucide = null;
|
|
171
|
+
try {
|
|
172
|
+
lucide = {
|
|
173
|
+
Family: require('@react-native-vector-icons/lucide').default,
|
|
174
|
+
glyphs: [
|
|
175
|
+
require('@react-native-vector-icons/lucide/glyphmaps/Lucide.json'),
|
|
176
|
+
],
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
lucide = null;
|
|
181
|
+
}
|
|
182
|
+
let materialDesignIcons = null;
|
|
183
|
+
try {
|
|
184
|
+
materialDesignIcons = {
|
|
185
|
+
Family: require('@react-native-vector-icons/material-design-icons').default,
|
|
186
|
+
glyphs: [
|
|
187
|
+
require('@react-native-vector-icons/material-design-icons/glyphmaps/MaterialDesignIcons.json'),
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
materialDesignIcons = null;
|
|
193
|
+
}
|
|
194
|
+
let materialIcons = null;
|
|
195
|
+
try {
|
|
196
|
+
materialIcons = {
|
|
197
|
+
Family: require('@react-native-vector-icons/material-icons').default,
|
|
198
|
+
glyphs: [
|
|
199
|
+
require('@react-native-vector-icons/material-icons/glyphmaps/MaterialIcons.json'),
|
|
200
|
+
],
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
materialIcons = null;
|
|
205
|
+
}
|
|
206
|
+
let octicons = null;
|
|
207
|
+
try {
|
|
208
|
+
octicons = {
|
|
209
|
+
Family: require('@react-native-vector-icons/octicons').default,
|
|
210
|
+
glyphs: [
|
|
211
|
+
require('@react-native-vector-icons/octicons/glyphmaps/Octicons.json'),
|
|
212
|
+
],
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
octicons = null;
|
|
217
|
+
}
|
|
218
|
+
let simpleLineIcons = null;
|
|
219
|
+
try {
|
|
220
|
+
simpleLineIcons = {
|
|
221
|
+
Family: require('@react-native-vector-icons/simple-line-icons').default,
|
|
222
|
+
glyphs: [
|
|
223
|
+
require('@react-native-vector-icons/simple-line-icons/glyphmaps/SimpleLineIcons.json'),
|
|
224
|
+
],
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
catch {
|
|
228
|
+
simpleLineIcons = null;
|
|
229
|
+
}
|
|
230
|
+
let zocial = null;
|
|
231
|
+
try {
|
|
232
|
+
zocial = {
|
|
233
|
+
Family: require('@react-native-vector-icons/zocial').default,
|
|
234
|
+
glyphs: [
|
|
235
|
+
require('@react-native-vector-icons/zocial/glyphmaps/Zocial.json'),
|
|
236
|
+
],
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
zocial = null;
|
|
241
|
+
}
|
|
242
|
+
// Documents persist glyph names as plain strings, so the per-family literal
|
|
243
|
+
// name unions (~30k strings across all families) are erased here — this is the
|
|
244
|
+
// single place that cast lives.
|
|
245
|
+
const glyphComponent = (Family) => styled(Family);
|
|
246
|
+
/** FontAwesome 5/6 pick the variant via an `iconStyle` prop on one component. */
|
|
247
|
+
const fontAwesomeVariant = (Family, iconStyle, displayName) => {
|
|
248
|
+
const FontAwesome = Family;
|
|
249
|
+
const Variant = (props) => (<FontAwesome {...{ ...props, iconStyle }}/>);
|
|
250
|
+
Variant.displayName = `${displayName}.${iconStyle}`;
|
|
251
|
+
return styled(Variant);
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* The glyph component of a family whose package is not installed. Rendering
|
|
255
|
+
* it is a project-configuration error, so it throws with the fix instead of
|
|
256
|
+
* drawing a placeholder.
|
|
257
|
+
*/
|
|
258
|
+
const missingFamily = (key, npm) => {
|
|
259
|
+
const Missing = (_props) => {
|
|
260
|
+
throw new Error(`Icon family "${key}" is not installed: add ${npm} to the project ` +
|
|
261
|
+
'(Project settings → Packages) to render its glyphs.');
|
|
262
|
+
};
|
|
263
|
+
Missing.displayName = `MissingIconFamily.${key}`;
|
|
264
|
+
return styled(Missing);
|
|
265
|
+
};
|
|
266
|
+
const defineFamily = (key, label, pack, glyphIndex = 0, wrap = glyphComponent) => {
|
|
267
|
+
const npm = ICON_FAMILY_NPM[key];
|
|
268
|
+
if (!pack) {
|
|
269
|
+
return {
|
|
270
|
+
key,
|
|
271
|
+
label,
|
|
272
|
+
npm,
|
|
273
|
+
installed: false,
|
|
274
|
+
Component: missingFamily(key, npm),
|
|
275
|
+
glyphMap: {},
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
return {
|
|
279
|
+
key,
|
|
280
|
+
label,
|
|
281
|
+
npm,
|
|
282
|
+
installed: true,
|
|
283
|
+
Component: wrap(pack.Family),
|
|
284
|
+
glyphMap: pack.glyphs[glyphIndex],
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* Registry of every known icon family, keyed by the persisted
|
|
289
|
+
* {@link IconFamilyKey}. Every key is always present; check
|
|
290
|
+
* {@link IconFamily.installed} before relying on a family's glyphs.
|
|
291
|
+
*
|
|
292
|
+
* @public
|
|
293
|
+
*/
|
|
294
|
+
export const IconFamilies = {
|
|
295
|
+
'ant-design': defineFamily('ant-design', 'AntDesign', antDesign),
|
|
296
|
+
entypo: defineFamily('entypo', 'Entypo', entypo),
|
|
297
|
+
'evil-icons': defineFamily('evil-icons', 'EvilIcons', evilIcons),
|
|
298
|
+
feather: defineFamily('feather', 'Feather', feather),
|
|
299
|
+
fontawesome: defineFamily('fontawesome', 'FontAwesome', fontAwesome),
|
|
300
|
+
'fontawesome5-solid': defineFamily('fontawesome5-solid', 'FontAwesome 5 Solid', fontAwesome5, FA_SOLID, (Family) => fontAwesomeVariant(Family, 'solid', 'FontAwesome5')),
|
|
301
|
+
'fontawesome5-regular': defineFamily('fontawesome5-regular', 'FontAwesome 5 Regular', fontAwesome5, FA_REGULAR, (Family) => fontAwesomeVariant(Family, 'regular', 'FontAwesome5')),
|
|
302
|
+
'fontawesome5-brands': defineFamily('fontawesome5-brands', 'FontAwesome 5 Brands', fontAwesome5, FA_BRANDS, (Family) => fontAwesomeVariant(Family, 'brand', 'FontAwesome5')),
|
|
303
|
+
'fontawesome6-solid': defineFamily('fontawesome6-solid', 'FontAwesome 6 Solid', fontAwesome6, FA_SOLID, (Family) => fontAwesomeVariant(Family, 'solid', 'FontAwesome6')),
|
|
304
|
+
'fontawesome6-regular': defineFamily('fontawesome6-regular', 'FontAwesome 6 Regular', fontAwesome6, FA_REGULAR, (Family) => fontAwesomeVariant(Family, 'regular', 'FontAwesome6')),
|
|
305
|
+
'fontawesome6-brands': defineFamily('fontawesome6-brands', 'FontAwesome 6 Brands', fontAwesome6, FA_BRANDS, (Family) => fontAwesomeVariant(Family, 'brand', 'FontAwesome6')),
|
|
306
|
+
fontisto: defineFamily('fontisto', 'Fontisto', fontisto),
|
|
307
|
+
foundation: defineFamily('foundation', 'Foundation', foundation),
|
|
308
|
+
ionicons: defineFamily('ionicons', 'Ionicons', ionicons),
|
|
309
|
+
lucide: defineFamily('lucide', 'Lucide', lucide),
|
|
310
|
+
'material-design-icons': defineFamily('material-design-icons', 'Material Design Icons', materialDesignIcons),
|
|
311
|
+
'material-icons': defineFamily('material-icons', 'Material Icons', materialIcons),
|
|
312
|
+
octicons: defineFamily('octicons', 'Octicons', octicons),
|
|
313
|
+
'simple-line-icons': defineFamily('simple-line-icons', 'Simple Line Icons', simpleLineIcons),
|
|
314
|
+
zocial: defineFamily('zocial', 'Zocial', zocial),
|
|
315
|
+
};
|
|
316
|
+
//# sourceMappingURL=families.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"families.js","sourceRoot":"","sources":["../../../../src/components/media/Icon/families.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAmB,MAAM,gBAAgB,CAAC;AA0EzD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkC;IAC5D,YAAY,EAAE,uCAAuC;IACrD,MAAM,EAAE,mCAAmC;IAC3C,YAAY,EAAE,uCAAuC;IACrD,OAAO,EAAE,oCAAoC;IAC7C,WAAW,EAAE,wCAAwC;IACrD,oBAAoB,EAAE,yCAAyC;IAC/D,sBAAsB,EAAE,yCAAyC;IACjE,qBAAqB,EAAE,yCAAyC;IAChE,oBAAoB,EAAE,yCAAyC;IAC/D,sBAAsB,EAAE,yCAAyC;IACjE,qBAAqB,EAAE,yCAAyC;IAChE,QAAQ,EAAE,qCAAqC;IAC/C,UAAU,EAAE,uCAAuC;IACnD,QAAQ,EAAE,qCAAqC;IAC/C,MAAM,EAAE,mCAAmC;IAC3C,uBAAuB,EAAE,kDAAkD;IAC3E,gBAAgB,EAAE,2CAA2C;IAC7D,QAAQ,EAAE,qCAAqC;IAC/C,mBAAmB,EAAE,8CAA8C;IACnE,MAAM,EAAE,mCAAmC;CAC5C,CAAC;AAWF,sGAAsG;AAEtG;;;;;;;;;;GAUG;AAEH,IAAI,SAAS,GAAoB,IAAI,CAAC;AACtC,IAAI,CAAC;IACH,SAAS,GAAG;QACV,MAAM,EAAE,OAAO,CAAC,uCAAuC,CAAC,CAAC,OAAO;QAChE,MAAM,EAAE;YACN,OAAO,CAAC,gEAAgE,CAAC;SAC1E;KACF,CAAC;AACJ,CAAC;AAAC,MAAM,CAAC;IACP,SAAS,GAAG,IAAI,CAAC;AACnB,CAAC;AAED,IAAI,MAAM,GAAoB,IAAI,CAAC;AACnC,IAAI,CAAC;IACH,MAAM,G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,CACpB;IACD,gBAAgB,EAAE,YAAY,CAC5B,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,CACd;IACD,QAAQ,EAAE,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC;IACxD,mBAAmB,EAAE,YAAY,CAC/B,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,CAChB;IACD,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC;CACjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/media/Icon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/media/Icon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AAEvB,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/media/Icon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,cAAc,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/media/Icon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AAEvB,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRCode.d.ts","sourceRoot":"","sources":["../../../../src/components/media/QRCode/QRCode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,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;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,MAAM;IAhDR,8DAA8D;aACrD,WAAW,CAAC,SAAS,CAAC,GAAG;QAChC,2BAA2B;QAC3B,QAAQ,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;KACjC;IACD,uCAAuC;YAC/B,MAAM;IACd,6CAA6C;WACtC,MAAM;IACb,sCAAsC;sBACpB,MAAM;IACxB,sCAAsC;YAC9B,MAAM;IACd,6BAA6B;UACvB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG;IAC3B,mDAAmD;WAC5C,MAAM;IACb,uBAAuB;eACZ,MAAM;IACjB,gCAAgC;gBACpB,MAAM;;;wCAsErB,CAAC;AAGF,eAAe,MAAM,CAAC"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
2
|
import { StyledView, } from '@mapples/style';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* `react-native-qrcode-svg` is an **optional peer dependency** of `@mapples/ui`
|
|
5
|
+
* (Project settings → Packages → "QR code"): it's resolved lazily so apps that
|
|
6
|
+
* never render a QR code don't have to install it. When absent, rendering a
|
|
7
|
+
* QR code with a value throws — nothing is drawn in its place.
|
|
8
|
+
*/
|
|
9
|
+
let QRCodeSvg = null;
|
|
10
|
+
try {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
12
|
+
QRCodeSvg = require('react-native-qrcode-svg').default;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
QRCodeSvg = null;
|
|
16
|
+
}
|
|
4
17
|
/**
|
|
5
18
|
* A customizable QR code component with built-in styling support.
|
|
6
19
|
*
|
|
@@ -27,8 +40,12 @@ import QRCodeSvg from 'react-native-qrcode-svg';
|
|
|
27
40
|
*/
|
|
28
41
|
const QRCode = forwardRef(({ styled, value = '', size = 200, backgroundColor = '#FFFFFF', color = '#000000', ecl = 'M', logo, logoSize, quietZone, ...props }, ref) => {
|
|
29
42
|
const { styleSvg, ...styledProps } = styled || {};
|
|
43
|
+
if (value && !QRCodeSvg) {
|
|
44
|
+
throw new Error('QRCode needs react-native-qrcode-svg: enable the "QR code" package ' +
|
|
45
|
+
'in Project settings → Packages.');
|
|
46
|
+
}
|
|
30
47
|
return (<StyledView ref={ref} styled={styledProps} {...props}>
|
|
31
|
-
{value && (<QRCodeSvg value={value} size={size} color={color} backgroundColor={backgroundColor} ecl={ecl} logo={logo ? { uri: logo } : undefined} logoSize={logoSize} quietZone={quietZone}/>)}
|
|
48
|
+
{value && QRCodeSvg && (<QRCodeSvg value={value} size={size} color={color} backgroundColor={backgroundColor} ecl={ecl} logo={logo ? { uri: logo } : undefined} logoSize={logoSize} quietZone={quietZone}/>)}
|
|
32
49
|
</StyledView>);
|
|
33
50
|
});
|
|
34
51
|
QRCode.displayName = 'QRCode';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QRCode.js","sourceRoot":"","sources":["../../../../src/components/media/QRCode/QRCode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqB,MAAM,OAAO,CAAC;AAEtD,OAAO,EAGL,UAAU,GAEX,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"QRCode.js","sourceRoot":"","sources":["../../../../src/components/media/QRCode/QRCode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAqB,MAAM,OAAO,CAAC;AAEtD,OAAO,EAGL,UAAU,GAEX,MAAM,gBAAgB,CAAC;AAKxB;;;;;GAKG;AACH,IAAI,SAAS,GAAgC,IAAI,CAAC;AAClD,IAAI,CAAC;IACH,iEAAiE;IACjE,SAAS,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC,OAAO,CAAC;AACzD,CAAC;AAAC,MAAM,CAAC;IACP,SAAS,GAAG,IAAI,CAAC;AACnB,CAAC;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ts","sourceRoot":"","sources":["../../../../src/components/media/Vector/MockIcon.tsx"],"names":[],"mappings":"AAGA,OAAY,EAAE,QAAQ,EAAQ,MAAM,kBAAkB,CAAC;;;;AAmBvD,wBAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockIcon.js","sourceRoot":"","sources":["../../../../src/components/media/Vector/MockIcon.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,GAAG,EAAE,EAAY,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,QAAQ,GAAiB,CAAC,KAAK,EAAE,EAAE;IACvC,OAAO,CACL,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,CAAC,aAAa,CACnC;MAAA,CAAC,IAAI,CAAC,CAAC,CAAC,spBAAspB,CAAC,EAAE,IAAI,CACvqB;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC,QAAQ,CAAC,CAAC"}
|