@proximus/lavender-texts-native 2.1.1-alpha.55 → 2.1.1-alpha.57

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.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Font families shipped with the Proximus design system.
3
+ *
4
+ * On Android the regular face is registered under its full PostScript name,
5
+ * while iOS exposes it through the family name.
6
+ */
7
+ export declare const Fonts: {
8
+ ProximusRegular: string;
9
+ ProximusRegularItalic: string;
10
+ ProximusBold: string;
11
+ ProximusBoldItalic: string;
12
+ ProximusExtraBold: string;
13
+ ProximusLight: string;
14
+ ProximusLightItalic: string;
15
+ ProximusIcons: string;
16
+ primary: string;
17
+ primaryBold: string;
18
+ primaryLight: string;
19
+ };
20
+ //# sourceMappingURL=Fonts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Fonts.d.ts","sourceRoot":"","sources":["../src/Fonts.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;CAYjB,CAAC"}
package/dist/Fonts.js ADDED
@@ -0,0 +1,20 @@
1
+ import { Platform } from 'react-native';
2
+ /**
3
+ * Font families shipped with the Proximus design system.
4
+ *
5
+ * On Android the regular face is registered under its full PostScript name,
6
+ * while iOS exposes it through the family name.
7
+ */
8
+ export const Fonts = {
9
+ ProximusRegular: Platform.OS === 'android' ? 'Proximus-Regular' : 'Proximus',
10
+ ProximusRegularItalic: 'Proximus-RegularItalic',
11
+ ProximusBold: 'Proximus-Bold',
12
+ ProximusBoldItalic: 'Proximus-BoldItalic',
13
+ ProximusExtraBold: 'Proximus-ExtraBold',
14
+ ProximusLight: 'Proximus-Light',
15
+ ProximusLightItalic: 'Proximus-LightItalic',
16
+ ProximusIcons: 'PxIcon',
17
+ primary: 'Proximus-Regular',
18
+ primaryBold: 'Proximus-ExtraBold',
19
+ primaryLight: 'Proximus-Light',
20
+ };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { TextProps } from 'react-native';
3
+ declare const LABEL_SCALES: readonly ["Xs", "S", "M", "L"];
4
+ export type LabelScale = (typeof LABEL_SCALES)[number];
5
+ export type LabelWeight = 'regular' | 'bold';
6
+ export type LabelSize = `${LabelScale}-${LabelWeight}`;
7
+ export interface ILabelProps extends TextProps {
8
+ size?: LabelSize;
9
+ dimmed?: boolean;
10
+ disabled?: boolean;
11
+ inverted?: boolean;
12
+ }
13
+ export declare function Label({ size, dimmed, disabled, inverted, style, children, ...props }: ILabelProps): React.JSX.Element;
14
+ export {};
15
+ //# sourceMappingURL=Label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../src/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAQ,SAAS,EAAa,MAAM,cAAc,CAAC;AAI1D,QAAA,MAAM,YAAY,gCAAiC,CAAC;AAEpD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AACvD,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AAC7C,MAAM,MAAM,SAAS,GAAG,GAAG,UAAU,IAAI,WAAW,EAAE,CAAC;AAqBvD,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,KAAK,CAAC,EACpB,IAAmB,EACnB,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,WAAW,qBAyBb"}
package/dist/Label.js ADDED
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { Text } from 'react-native';
3
+ import { useTheme } from '@proximus/lavender-styling-native';
4
+ import { Fonts } from './Fonts';
5
+ const LABEL_SCALES = ['Xs', 'S', 'M', 'L'];
6
+ const FONT_FAMILIES = {
7
+ regular: Fonts.ProximusRegular,
8
+ bold: Fonts.ProximusBold,
9
+ };
10
+ const DEFAULT_SIZE = 'S-regular';
11
+ function parseSize(size) {
12
+ const [scale, weight] = size.split('-');
13
+ return {
14
+ scale: LABEL_SCALES.includes(scale) ? scale : 'S',
15
+ weight: FONT_FAMILIES[weight] ? weight : 'regular',
16
+ };
17
+ }
18
+ export function Label({ size = DEFAULT_SIZE, dimmed, disabled, inverted, style, children, ...props }) {
19
+ const { theme } = useTheme();
20
+ const { scale, weight } = parseSize(size);
21
+ const invertedSuffix = inverted ? 'Inverted' : 'Default';
22
+ const color = disabled
23
+ ? theme.t(`ColorTextStateDisabled${invertedSuffix}`)
24
+ : theme.t(`ColorText${dimmed ? 'Dimmed' : 'Neutral'}${invertedSuffix}`);
25
+ const baseStyle = {
26
+ fontFamily: FONT_FAMILIES[weight],
27
+ fontSize: theme.t(`TextSizeLabel${scale}Mobile`).number,
28
+ lineHeight: theme.t(`TextLineHeightLabel${scale}Mobile`).number,
29
+ color,
30
+ };
31
+ return (React.createElement(Text, { ...props, style: [baseStyle, ...(Array.isArray(style) ? style : [style])] }, children));
32
+ }
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
+ export * from './Fonts';
1
2
  export * from './v8';
3
+ export * from './Label';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -1 +1,3 @@
1
+ export * from './Fonts';
1
2
  export * from './v8';
3
+ export * from './Label';
package/dist/v8.d.ts CHANGED
@@ -1,18 +1,5 @@
1
1
  import React from 'react';
2
2
  import { TextProps } from 'react-native';
3
- export declare const Fonts: {
4
- ProximusRegular: string;
5
- ProximusRegularItalic: string;
6
- ProximusBold: string;
7
- ProximusBoldItalic: string;
8
- ProximusExtraBold: string;
9
- ProximusLight: string;
10
- ProximusLightItalic: string;
11
- ProximusIcons: string;
12
- primary: string;
13
- primaryBold: string;
14
- primaryLight: string;
15
- };
16
3
  export declare function Header(props: TextProps & {
17
4
  disabled?: boolean;
18
5
  inverted?: boolean;
package/dist/v8.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"v8.d.ts","sourceRoot":"","sources":["../src/v8.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA6B,SAAS,EAAa,MAAM,cAAc,CAAC;AAQ/E,eAAO,MAAM,KAAK;;;;;;;;;;;;CAYjB,CAAC;AAiBF,wBAAgB,MAAM,CACpB,KAAK,EAAE,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,qBA2B9D;AAED,wBAAgB,IAAI,CAClB,KAAK,EAAE,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,qBAyB9D"}
1
+ {"version":3,"file":"v8.d.ts","sourceRoot":"","sources":["../src/v8.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAmB,SAAS,EAAa,MAAM,cAAc,CAAC;AAwBrE,wBAAgB,MAAM,CACpB,KAAK,EAAE,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,qBA2B9D;AAED,wBAAgB,IAAI,CAClB,KAAK,EAAE,SAAS,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,qBAyB9D"}
package/dist/v8.js CHANGED
@@ -1,23 +1,11 @@
1
1
  import React from 'react';
2
- import { Platform, Text } from 'react-native';
2
+ import { Text } from 'react-native';
3
3
  import { useTheme } from '@proximus/lavender-styling-native';
4
+ import { Fonts } from './Fonts';
4
5
  const DEFAULT_HEADER_FONT_SIZE = 27;
5
6
  const DEFAULT_BODY_FONT_SIZE = 16;
6
7
  const LINE_HEIGHT_HEADER_RATIO = 1.3;
7
8
  const LINE_HEIGHT_BODY_RATIO = 1.5;
8
- export const Fonts = {
9
- ProximusRegular: Platform.OS === 'android' ? 'Proximus-Regular' : 'Proximus',
10
- ProximusRegularItalic: 'Proximus-RegularItalic',
11
- ProximusBold: 'Proximus-Bold',
12
- ProximusBoldItalic: 'Proximus-BoldItalic',
13
- ProximusExtraBold: 'Proximus-ExtraBold',
14
- ProximusLight: 'Proximus-Light',
15
- ProximusLightItalic: 'Proximus-LightItalic',
16
- ProximusIcons: 'PxIcon',
17
- primary: 'Proximus-Regular',
18
- primaryBold: 'Proximus-ExtraBold',
19
- primaryLight: 'Proximus-Light',
20
- };
21
9
  function extractFontSize(style) {
22
10
  if (Array.isArray(style)) {
23
11
  for (const item of style) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-texts-native",
3
- "version": "2.1.1-alpha.55",
3
+ "version": "2.1.1-alpha.57",
4
4
  "description": "Lavender Text component",
5
5
  "main": "dist/index.js",
6
6
  "files": [