@wecareu/icons 1.0.5 → 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/index.js CHANGED
@@ -323,13 +323,20 @@ var fontSizes = {
323
323
  display: 32
324
324
  };
325
325
  var lineHeights = {
326
- tight: 1.2,
327
- normal: 1.4,
328
- relaxed: 1.6,
329
- loose: 1.8,
330
- caption: 1.4,
331
- body: 1.5,
332
- heading: 1.2
326
+ displayLarge: 38,
327
+ displayMedium: 29,
328
+ headingLarge: 28,
329
+ headingMedium: 25,
330
+ headingSmall: 22,
331
+ bodyLarge: 29,
332
+ bodyMedium: 22,
333
+ bodySmall: 20,
334
+ labelLarge: 22,
335
+ labelMedium: 20,
336
+ labelSmall: 17,
337
+ buttonLarge: 22,
338
+ buttonMedium: 20,
339
+ caption: 17
333
340
  };
334
341
  var fontWeights = {
335
342
  regular: "400",
@@ -341,86 +348,86 @@ var textStyles = {
341
348
  displayLarge: {
342
349
  fontFamily: fontFamilies.bold,
343
350
  fontSize: fontSizes.huge,
344
- lineHeight: lineHeights.tight,
345
- fontWeight: fontWeights.bold
351
+ fontWeight: fontWeights.bold,
352
+ lineHeight: lineHeights.displayLarge
346
353
  },
347
354
  displayMedium: {
348
355
  fontFamily: fontFamilies.bold,
349
356
  fontSize: fontSizes.heading,
350
- lineHeight: lineHeights.tight,
351
- fontWeight: fontWeights.bold
357
+ fontWeight: fontWeights.bold,
358
+ lineHeight: lineHeights.displayMedium
352
359
  },
353
360
  headingLarge: {
354
361
  fontFamily: fontFamilies.bold,
355
362
  fontSize: fontSizes.title,
356
- lineHeight: lineHeights.normal,
357
- fontWeight: fontWeights.bold
363
+ fontWeight: fontWeights.bold,
364
+ lineHeight: lineHeights.headingLarge
358
365
  },
359
366
  headingMedium: {
360
367
  fontFamily: fontFamilies.semibold,
361
368
  fontSize: fontSizes.subtitle,
362
- lineHeight: lineHeights.normal,
363
- fontWeight: fontWeights.semibold
369
+ fontWeight: fontWeights.semibold,
370
+ lineHeight: lineHeights.headingMedium
364
371
  },
365
372
  headingSmall: {
366
373
  fontFamily: fontFamilies.semibold,
367
374
  fontSize: fontSizes.md,
368
- lineHeight: lineHeights.normal,
369
- fontWeight: fontWeights.semibold
375
+ fontWeight: fontWeights.semibold,
376
+ lineHeight: lineHeights.headingSmall
370
377
  },
371
378
  bodyLarge: {
372
379
  fontFamily: fontFamilies.regular,
373
380
  fontSize: fontSizes.lg,
374
- lineHeight: lineHeights.relaxed,
375
- fontWeight: fontWeights.regular
381
+ fontWeight: fontWeights.regular,
382
+ lineHeight: lineHeights.bodyLarge
376
383
  },
377
384
  bodyMedium: {
378
385
  fontFamily: fontFamilies.regular,
379
386
  fontSize: fontSizes.body,
380
- lineHeight: lineHeights.normal,
381
- fontWeight: fontWeights.regular
387
+ fontWeight: fontWeights.regular,
388
+ lineHeight: lineHeights.bodyMedium
382
389
  },
383
390
  bodySmall: {
384
391
  fontFamily: fontFamilies.regular,
385
392
  fontSize: fontSizes.sm,
386
- lineHeight: lineHeights.normal,
387
- fontWeight: fontWeights.regular
393
+ fontWeight: fontWeights.regular,
394
+ lineHeight: lineHeights.bodySmall
388
395
  },
389
396
  labelLarge: {
390
397
  fontFamily: fontFamilies.semibold,
391
398
  fontSize: fontSizes.md,
392
- lineHeight: lineHeights.normal,
393
- fontWeight: fontWeights.semibold
399
+ fontWeight: fontWeights.semibold,
400
+ lineHeight: lineHeights.labelLarge
394
401
  },
395
402
  labelMedium: {
396
403
  fontFamily: fontFamilies.semibold,
397
404
  fontSize: fontSizes.sm,
398
- lineHeight: lineHeights.normal,
399
- fontWeight: fontWeights.semibold
405
+ fontWeight: fontWeights.semibold,
406
+ lineHeight: lineHeights.labelMedium
400
407
  },
401
408
  labelSmall: {
402
409
  fontFamily: fontFamilies.regular,
403
410
  fontSize: fontSizes.xs,
404
- lineHeight: lineHeights.normal,
405
- fontWeight: fontWeights.regular
411
+ fontWeight: fontWeights.regular,
412
+ lineHeight: lineHeights.labelSmall
406
413
  },
407
414
  buttonLarge: {
408
415
  fontFamily: fontFamilies.semibold,
409
416
  fontSize: fontSizes.md,
410
- lineHeight: lineHeights.normal,
411
- fontWeight: fontWeights.semibold
417
+ fontWeight: fontWeights.semibold,
418
+ lineHeight: lineHeights.buttonLarge
412
419
  },
413
420
  buttonMedium: {
414
421
  fontFamily: fontFamilies.semibold,
415
422
  fontSize: fontSizes.sm,
416
- lineHeight: lineHeights.normal,
417
- fontWeight: fontWeights.semibold
423
+ fontWeight: fontWeights.semibold,
424
+ lineHeight: lineHeights.buttonMedium
418
425
  },
419
426
  caption: {
420
427
  fontFamily: fontFamilies.regular,
421
428
  fontSize: fontSizes.caption,
422
- lineHeight: lineHeights.caption,
423
- fontWeight: fontWeights.regular
429
+ fontWeight: fontWeights.regular,
430
+ lineHeight: lineHeights.caption
424
431
  }
425
432
  };
426
433
  var spacing = {
@@ -1238,16 +1245,24 @@ var import_jsx_runtime70 = require("react/jsx-runtime");
1238
1245
  var Icon = ({ name, size, color, testID = "icon", ...rest }) => {
1239
1246
  const theme = useTheme();
1240
1247
  const Cmp = ICONS[name];
1241
- const extra = {};
1248
+ const { fill: fillProp, stroke: strokeProp, ...svgRest } = rest;
1249
+ const iconColor = color || strokeProp || theme.colors.text.primary || "#000000";
1250
+ const dimensions = {};
1242
1251
  if (size != null) {
1243
- extra.width = size;
1244
- extra.height = size;
1252
+ dimensions.height = size;
1253
+ dimensions.width = size;
1245
1254
  }
1246
- const iconColor = color || theme.colors.text.primary || "#000000";
1247
- extra.color = iconColor;
1248
- extra.fill = iconColor;
1249
- extra.stroke = iconColor;
1250
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Cmp, { ...extra, testID, ...rest });
1255
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
1256
+ Cmp,
1257
+ {
1258
+ ...dimensions,
1259
+ color: iconColor,
1260
+ fill: fillProp ?? "none",
1261
+ stroke: strokeProp ?? iconColor,
1262
+ testID,
1263
+ ...svgRest
1264
+ }
1265
+ );
1251
1266
  };
1252
1267
 
1253
1268
  // src/assets/lottie/dots.json
package/dist/index.mjs CHANGED
@@ -287,13 +287,20 @@ var fontSizes = {
287
287
  display: 32
288
288
  };
289
289
  var lineHeights = {
290
- tight: 1.2,
291
- normal: 1.4,
292
- relaxed: 1.6,
293
- loose: 1.8,
294
- caption: 1.4,
295
- body: 1.5,
296
- heading: 1.2
290
+ displayLarge: 38,
291
+ displayMedium: 29,
292
+ headingLarge: 28,
293
+ headingMedium: 25,
294
+ headingSmall: 22,
295
+ bodyLarge: 29,
296
+ bodyMedium: 22,
297
+ bodySmall: 20,
298
+ labelLarge: 22,
299
+ labelMedium: 20,
300
+ labelSmall: 17,
301
+ buttonLarge: 22,
302
+ buttonMedium: 20,
303
+ caption: 17
297
304
  };
298
305
  var fontWeights = {
299
306
  regular: "400",
@@ -305,86 +312,86 @@ var textStyles = {
305
312
  displayLarge: {
306
313
  fontFamily: fontFamilies.bold,
307
314
  fontSize: fontSizes.huge,
308
- lineHeight: lineHeights.tight,
309
- fontWeight: fontWeights.bold
315
+ fontWeight: fontWeights.bold,
316
+ lineHeight: lineHeights.displayLarge
310
317
  },
311
318
  displayMedium: {
312
319
  fontFamily: fontFamilies.bold,
313
320
  fontSize: fontSizes.heading,
314
- lineHeight: lineHeights.tight,
315
- fontWeight: fontWeights.bold
321
+ fontWeight: fontWeights.bold,
322
+ lineHeight: lineHeights.displayMedium
316
323
  },
317
324
  headingLarge: {
318
325
  fontFamily: fontFamilies.bold,
319
326
  fontSize: fontSizes.title,
320
- lineHeight: lineHeights.normal,
321
- fontWeight: fontWeights.bold
327
+ fontWeight: fontWeights.bold,
328
+ lineHeight: lineHeights.headingLarge
322
329
  },
323
330
  headingMedium: {
324
331
  fontFamily: fontFamilies.semibold,
325
332
  fontSize: fontSizes.subtitle,
326
- lineHeight: lineHeights.normal,
327
- fontWeight: fontWeights.semibold
333
+ fontWeight: fontWeights.semibold,
334
+ lineHeight: lineHeights.headingMedium
328
335
  },
329
336
  headingSmall: {
330
337
  fontFamily: fontFamilies.semibold,
331
338
  fontSize: fontSizes.md,
332
- lineHeight: lineHeights.normal,
333
- fontWeight: fontWeights.semibold
339
+ fontWeight: fontWeights.semibold,
340
+ lineHeight: lineHeights.headingSmall
334
341
  },
335
342
  bodyLarge: {
336
343
  fontFamily: fontFamilies.regular,
337
344
  fontSize: fontSizes.lg,
338
- lineHeight: lineHeights.relaxed,
339
- fontWeight: fontWeights.regular
345
+ fontWeight: fontWeights.regular,
346
+ lineHeight: lineHeights.bodyLarge
340
347
  },
341
348
  bodyMedium: {
342
349
  fontFamily: fontFamilies.regular,
343
350
  fontSize: fontSizes.body,
344
- lineHeight: lineHeights.normal,
345
- fontWeight: fontWeights.regular
351
+ fontWeight: fontWeights.regular,
352
+ lineHeight: lineHeights.bodyMedium
346
353
  },
347
354
  bodySmall: {
348
355
  fontFamily: fontFamilies.regular,
349
356
  fontSize: fontSizes.sm,
350
- lineHeight: lineHeights.normal,
351
- fontWeight: fontWeights.regular
357
+ fontWeight: fontWeights.regular,
358
+ lineHeight: lineHeights.bodySmall
352
359
  },
353
360
  labelLarge: {
354
361
  fontFamily: fontFamilies.semibold,
355
362
  fontSize: fontSizes.md,
356
- lineHeight: lineHeights.normal,
357
- fontWeight: fontWeights.semibold
363
+ fontWeight: fontWeights.semibold,
364
+ lineHeight: lineHeights.labelLarge
358
365
  },
359
366
  labelMedium: {
360
367
  fontFamily: fontFamilies.semibold,
361
368
  fontSize: fontSizes.sm,
362
- lineHeight: lineHeights.normal,
363
- fontWeight: fontWeights.semibold
369
+ fontWeight: fontWeights.semibold,
370
+ lineHeight: lineHeights.labelMedium
364
371
  },
365
372
  labelSmall: {
366
373
  fontFamily: fontFamilies.regular,
367
374
  fontSize: fontSizes.xs,
368
- lineHeight: lineHeights.normal,
369
- fontWeight: fontWeights.regular
375
+ fontWeight: fontWeights.regular,
376
+ lineHeight: lineHeights.labelSmall
370
377
  },
371
378
  buttonLarge: {
372
379
  fontFamily: fontFamilies.semibold,
373
380
  fontSize: fontSizes.md,
374
- lineHeight: lineHeights.normal,
375
- fontWeight: fontWeights.semibold
381
+ fontWeight: fontWeights.semibold,
382
+ lineHeight: lineHeights.buttonLarge
376
383
  },
377
384
  buttonMedium: {
378
385
  fontFamily: fontFamilies.semibold,
379
386
  fontSize: fontSizes.sm,
380
- lineHeight: lineHeights.normal,
381
- fontWeight: fontWeights.semibold
387
+ fontWeight: fontWeights.semibold,
388
+ lineHeight: lineHeights.buttonMedium
382
389
  },
383
390
  caption: {
384
391
  fontFamily: fontFamilies.regular,
385
392
  fontSize: fontSizes.caption,
386
- lineHeight: lineHeights.caption,
387
- fontWeight: fontWeights.regular
393
+ fontWeight: fontWeights.regular,
394
+ lineHeight: lineHeights.caption
388
395
  }
389
396
  };
390
397
  var spacing = {
@@ -1202,16 +1209,24 @@ import { jsx as jsx70 } from "react/jsx-runtime";
1202
1209
  var Icon = ({ name, size, color, testID = "icon", ...rest }) => {
1203
1210
  const theme = useTheme();
1204
1211
  const Cmp = ICONS[name];
1205
- const extra = {};
1212
+ const { fill: fillProp, stroke: strokeProp, ...svgRest } = rest;
1213
+ const iconColor = color || strokeProp || theme.colors.text.primary || "#000000";
1214
+ const dimensions = {};
1206
1215
  if (size != null) {
1207
- extra.width = size;
1208
- extra.height = size;
1216
+ dimensions.height = size;
1217
+ dimensions.width = size;
1209
1218
  }
1210
- const iconColor = color || theme.colors.text.primary || "#000000";
1211
- extra.color = iconColor;
1212
- extra.fill = iconColor;
1213
- extra.stroke = iconColor;
1214
- return /* @__PURE__ */ jsx70(Cmp, { ...extra, testID, ...rest });
1219
+ return /* @__PURE__ */ jsx70(
1220
+ Cmp,
1221
+ {
1222
+ ...dimensions,
1223
+ color: iconColor,
1224
+ fill: fillProp ?? "none",
1225
+ stroke: strokeProp ?? iconColor,
1226
+ testID,
1227
+ ...svgRest
1228
+ }
1229
+ );
1215
1230
  };
1216
1231
 
1217
1232
  // src/index.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wecareu/icons",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Sistema de ícones SVG para WeCareU Design System",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -9,6 +9,18 @@
9
9
  "dist",
10
10
  "src"
11
11
  ],
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.mjs",
16
+ "require": "./dist/index.js"
17
+ },
18
+ "./lottie": {
19
+ "types": "./dist/lottie.d.ts",
20
+ "import": "./dist/lottie.mjs",
21
+ "require": "./dist/lottie.js"
22
+ }
23
+ },
12
24
  "sideEffects": false,
13
25
  "scripts": {
14
26
  "icons:gen": "node scripts/build-icons.mjs",
@@ -32,6 +44,7 @@
32
44
  "@types/react": "^18.2.0",
33
45
  "@types/react-native": "^0.72.0",
34
46
  "lottie-react-native": "^7.3.4",
47
+ "lottie-web": "^5.12.2",
35
48
  "react": "^18.2.0",
36
49
  "react-native": "^0.72.0",
37
50
  "react-native-svg": "^14.1.0",
package/src/Icon.tsx CHANGED
@@ -13,18 +13,26 @@ export const Icon: React.FC<Props> = ({ name, size, color, testID = 'icon', ...r
13
13
  const theme = useTheme();
14
14
  const Cmp = ICONS[name];
15
15
 
16
- const extra: SvgProps = {};
16
+ const { fill: fillProp, stroke: strokeProp, ...svgRest } = rest;
17
+
18
+ const iconColor = color || strokeProp || theme.colors.text.primary || '#000000';
19
+ const dimensions: Pick<SvgProps, 'height' | 'width'> = {};
20
+
17
21
  if (size != null) {
18
- extra.width = size;
19
- extra.height = size;
22
+ dimensions.height = size;
23
+ dimensions.width = size;
20
24
  }
21
25
 
22
- const iconColor = color || theme.colors.text.primary || '#000000';
23
- extra.color = iconColor;
24
- extra.fill = iconColor;
25
- extra.stroke = iconColor;
26
-
27
- return <Cmp {...extra} testID={testID} {...rest} />;
26
+ return (
27
+ <Cmp
28
+ {...dimensions}
29
+ color={iconColor}
30
+ fill={fillProp ?? 'none'}
31
+ stroke={strokeProp ?? iconColor}
32
+ testID={testID}
33
+ {...svgRest}
34
+ />
35
+ );
28
36
  };
29
37
 
30
38
  export type { IconName };
@@ -0,0 +1,69 @@
1
+ import lottie, { AnimationItem } from 'lottie-web';
2
+ import React, { useEffect, useRef } from 'react';
3
+ import type { ViewStyle } from 'react-native';
4
+ import { View } from 'react-native';
5
+
6
+ import { LOTTIE_ANIMATIONS, type LottieAnimationName } from './lottie-map';
7
+
8
+ interface LottieProps {
9
+ autoPlay?: boolean;
10
+ colorFilters?: { keypath: string; color: string }[];
11
+ loop?: boolean;
12
+ name: LottieAnimationName;
13
+ size?: number;
14
+ speed?: number;
15
+ style?: ViewStyle;
16
+ testID?: string;
17
+ }
18
+
19
+ export function Lottie({
20
+ name,
21
+ size,
22
+ style,
23
+ autoPlay = true,
24
+ loop = true,
25
+ speed = 1,
26
+ testID
27
+ }: LottieProps): JSX.Element {
28
+ const containerRef = useRef<HTMLDivElement>(null);
29
+ const animationRef = useRef<AnimationItem | null>(null);
30
+ const source = LOTTIE_ANIMATIONS[name];
31
+
32
+ useEffect(() => {
33
+ if (!containerRef.current) return;
34
+
35
+ animationRef.current = lottie.loadAnimation({
36
+ animationData: source,
37
+ autoplay: autoPlay,
38
+ container: containerRef.current,
39
+ loop,
40
+ renderer: 'svg'
41
+ });
42
+
43
+ if (speed !== 1) {
44
+ animationRef.current.setSpeed(speed);
45
+ }
46
+
47
+ return () => {
48
+ animationRef.current?.destroy();
49
+ };
50
+ }, [source, autoPlay, loop, speed]);
51
+
52
+ const sizeStyle = size != null ? { height: size, width: size } : {};
53
+
54
+ return (
55
+ <View style={[sizeStyle, style]} testID={testID}>
56
+ <div
57
+ ref={containerRef}
58
+ style={{
59
+ height: '100%',
60
+ width: '100%'
61
+ }}
62
+ />
63
+ </View>
64
+ );
65
+ }
66
+
67
+ export type { LottieAnimationName };
68
+ export { LOTTIE_ANIMATIONS };
69
+