@korsolutions/ui 0.0.62 → 0.0.63

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.
Files changed (85) hide show
  1. package/dist/module/components/avatar/components/avatar-image.js.map +1 -1
  2. package/dist/module/components/badge/badge.js +30 -0
  3. package/dist/module/components/badge/badge.js.map +1 -0
  4. package/dist/module/components/badge/context.js.map +1 -1
  5. package/dist/module/components/badge/index.js +1 -6
  6. package/dist/module/components/badge/index.js.map +1 -1
  7. package/dist/module/components/badge/variants/default.js +17 -14
  8. package/dist/module/components/badge/variants/default.js.map +1 -1
  9. package/dist/module/components/badge/variants/secondary.js +17 -14
  10. package/dist/module/components/badge/variants/secondary.js.map +1 -1
  11. package/dist/module/components/input/input.js.map +1 -1
  12. package/dist/module/components/menu/components/menu-checkbox-item.js +4 -2
  13. package/dist/module/components/menu/components/menu-checkbox-item.js.map +1 -1
  14. package/dist/module/components/menu/components/menu-item.js +4 -2
  15. package/dist/module/components/menu/components/menu-item.js.map +1 -1
  16. package/dist/module/components/menu/components/menu-radio-item.js +4 -2
  17. package/dist/module/components/menu/components/menu-radio-item.js.map +1 -1
  18. package/dist/module/components/tabs/components/tabs-item.js +1 -1
  19. package/dist/module/components/tabs/components/tabs-item.js.map +1 -1
  20. package/dist/module/components/toast/components/toast-icon.js.map +1 -1
  21. package/dist/module/{components/tabs → hooks}/use-organized-children.js +2 -2
  22. package/dist/module/hooks/use-organized-children.js.map +1 -0
  23. package/dist/module/themes/provider.js.map +1 -1
  24. package/dist/typescript/src/components/avatar/components/avatar-image.d.ts.map +1 -1
  25. package/dist/typescript/src/components/badge/badge.d.ts +12 -0
  26. package/dist/typescript/src/components/badge/badge.d.ts.map +1 -0
  27. package/dist/typescript/src/components/badge/context.d.ts +1 -2
  28. package/dist/typescript/src/components/badge/context.d.ts.map +1 -1
  29. package/dist/typescript/src/components/badge/index.d.ts +1 -8
  30. package/dist/typescript/src/components/badge/index.d.ts.map +1 -1
  31. package/dist/typescript/src/components/badge/types.d.ts +6 -5
  32. package/dist/typescript/src/components/badge/types.d.ts.map +1 -1
  33. package/dist/typescript/src/components/badge/variants/default.d.ts.map +1 -1
  34. package/dist/typescript/src/components/badge/variants/secondary.d.ts.map +1 -1
  35. package/dist/typescript/src/components/input/input.d.ts +1 -1
  36. package/dist/typescript/src/components/input/input.d.ts.map +1 -1
  37. package/dist/typescript/src/components/menu/components/menu-checkbox-item.d.ts.map +1 -1
  38. package/dist/typescript/src/components/menu/components/menu-item.d.ts.map +1 -1
  39. package/dist/typescript/src/components/menu/components/menu-radio-item.d.ts.map +1 -1
  40. package/dist/typescript/src/components/menu/types.d.ts +2 -1
  41. package/dist/typescript/src/components/menu/types.d.ts.map +1 -1
  42. package/dist/typescript/src/components/toast/components/toast-icon.d.ts +1 -1
  43. package/dist/typescript/src/components/toast/components/toast-icon.d.ts.map +1 -1
  44. package/dist/typescript/src/hooks/use-organized-children.d.ts +5 -0
  45. package/dist/typescript/src/hooks/use-organized-children.d.ts.map +1 -0
  46. package/dist/typescript/src/themes/provider.d.ts +3 -3
  47. package/dist/typescript/src/themes/provider.d.ts.map +1 -1
  48. package/dist/typescript/src/types/props.types.d.ts +2 -1
  49. package/dist/typescript/src/types/props.types.d.ts.map +1 -1
  50. package/package.json +1 -1
  51. package/src/components/avatar/components/avatar-image.tsx +14 -2
  52. package/src/components/badge/badge.tsx +46 -0
  53. package/src/components/badge/context.ts +1 -2
  54. package/src/components/badge/index.ts +1 -10
  55. package/src/components/badge/types.ts +6 -6
  56. package/src/components/badge/variants/default.tsx +17 -14
  57. package/src/components/badge/variants/secondary.tsx +17 -14
  58. package/src/components/input/input.tsx +6 -2
  59. package/src/components/menu/components/menu-checkbox-item.tsx +9 -2
  60. package/src/components/menu/components/menu-item.tsx +9 -2
  61. package/src/components/menu/components/menu-radio-item.tsx +9 -2
  62. package/src/components/menu/types.ts +2 -1
  63. package/src/components/tabs/components/tabs-item.tsx +1 -1
  64. package/src/components/toast/components/toast-icon.tsx +1 -1
  65. package/src/{components/tabs → hooks}/use-organized-children.tsx +3 -3
  66. package/src/themes/provider.tsx +5 -3
  67. package/src/types/props.types.ts +2 -1
  68. package/dist/module/components/badge/components/badge-label.js +0 -17
  69. package/dist/module/components/badge/components/badge-label.js.map +0 -1
  70. package/dist/module/components/badge/components/badge-root.js +0 -27
  71. package/dist/module/components/badge/components/badge-root.js.map +0 -1
  72. package/dist/module/components/menu/use-organized-children.js +0 -39
  73. package/dist/module/components/menu/use-organized-children.js.map +0 -1
  74. package/dist/module/components/tabs/use-organized-children.js.map +0 -1
  75. package/dist/typescript/src/components/badge/components/badge-label.d.ts +0 -9
  76. package/dist/typescript/src/components/badge/components/badge-label.d.ts.map +0 -1
  77. package/dist/typescript/src/components/badge/components/badge-root.d.ts +0 -13
  78. package/dist/typescript/src/components/badge/components/badge-root.d.ts.map +0 -1
  79. package/dist/typescript/src/components/menu/use-organized-children.d.ts +0 -3
  80. package/dist/typescript/src/components/menu/use-organized-children.d.ts.map +0 -1
  81. package/dist/typescript/src/components/tabs/use-organized-children.d.ts +0 -5
  82. package/dist/typescript/src/components/tabs/use-organized-children.d.ts.map +0 -1
  83. package/src/components/badge/components/badge-label.tsx +0 -21
  84. package/src/components/badge/components/badge-root.tsx +0 -36
  85. package/src/components/menu/use-organized-children.tsx +0 -38
@@ -1,9 +1,10 @@
1
+ import type React from "react";
1
2
  import type { ColorValue, StyleProp, TextStyle, ViewStyle } from "react-native";
2
3
  export type PropsWithRender<P> = P & {
3
4
  render?: (props: P) => React.ReactNode;
4
5
  };
5
6
  export type PropsWithRequiredRender<P> = P & {
6
- render: (props: P) => React.ReactNode;
7
+ render: React.ComponentType<P>;
7
8
  };
8
9
  export type SvgProps = {
9
10
  size?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"props.types.d.ts","sourceRoot":"","sources":["../../../../src/types/props.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhF,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG;IACnC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,CAAC,GAAG;IAC3C,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;CAC1C,CAAC"}
1
+ {"version":3,"file":"props.types.d.ts","sourceRoot":"","sources":["../../../../src/types/props.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEhF,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG;IACnC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI,CAAC,GAAG;IAC3C,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;CAC1C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@korsolutions/ui",
3
- "version": "0.0.62",
3
+ "version": "0.0.63",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +1,10 @@
1
1
  import React from "react";
2
- import { Image, type ImageSource, type ImageStyle, type StyleProp } from "react-native";
2
+ import {
3
+ Image,
4
+ type ImageSource,
5
+ type ImageStyle,
6
+ type StyleProp,
7
+ } from "react-native";
3
8
  import { useAvatar } from "../context";
4
9
 
5
10
  export interface AvatarImageProps {
@@ -11,5 +16,12 @@ export function AvatarImage(props: AvatarImageProps) {
11
16
  const avatar = useAvatar();
12
17
  const composedStyles = [avatar.styles?.image, props.style];
13
18
 
14
- return <Image {...props} style={composedStyles} onLoad={() => avatar.setImageLoaded(true)} onError={() => avatar.setImageLoaded(false)} />;
19
+ return (
20
+ <Image
21
+ {...props}
22
+ style={composedStyles}
23
+ onLoad={() => avatar.setImageLoaded(true)}
24
+ onError={() => avatar.setImageLoaded(false)}
25
+ />
26
+ );
15
27
  }
@@ -0,0 +1,46 @@
1
+ import React from "react";
2
+ import { type StyleProp, StyleSheet, View, type ViewStyle } from "react-native";
3
+ import { useOrganizedChildren } from "../../hooks/use-organized-children";
4
+ import { BadgeContext } from "./context";
5
+ import { BadgeVariants } from "./variants";
6
+
7
+ export interface BadgeProps {
8
+ variant?: keyof typeof BadgeVariants;
9
+ color?: string;
10
+ children?: React.ReactNode;
11
+
12
+ render?: (props: BadgeProps) => React.ReactNode;
13
+
14
+ style?: StyleProp<ViewStyle>;
15
+ }
16
+
17
+ export function Badge(props: BadgeProps) {
18
+ const variantStyles = BadgeVariants[props.variant || "default"]();
19
+
20
+ const customStyle = props.color
21
+ ? { backgroundColor: props.color }
22
+ : undefined;
23
+
24
+ const composedStyle = StyleSheet.flatten([variantStyles.root, props.style]);
25
+
26
+ const textStyle = variantStyles.text;
27
+ const iconStyle = variantStyles.icon;
28
+ const organizedChildren = useOrganizedChildren(
29
+ props.children,
30
+ textStyle,
31
+ iconStyle,
32
+ );
33
+
34
+ const Component = props.render ?? View;
35
+ return (
36
+ <BadgeContext.Provider
37
+ value={{
38
+ styles: variantStyles,
39
+ }}
40
+ >
41
+ <Component {...props} style={[composedStyle, customStyle]}>
42
+ {organizedChildren}
43
+ </Component>
44
+ </BadgeContext.Provider>
45
+ );
46
+ }
@@ -1,8 +1,7 @@
1
1
  import { createContext, useContext } from "react";
2
- import type { BadgeState, BadgeStyles } from "./types";
2
+ import type { BadgeStyles } from "./types";
3
3
 
4
4
  export interface BadgeContext {
5
- state: BadgeState;
6
5
  styles?: BadgeStyles;
7
6
  }
8
7
 
@@ -1,11 +1,2 @@
1
- import { BadgeLabel } from "./components/badge-label";
2
- import { BadgeRoot } from "./components/badge-root";
3
-
4
- export const Badge = {
5
- Root: BadgeRoot,
6
- Label: BadgeLabel,
7
- };
8
-
9
- export type { BadgeLabelProps } from "./components/badge-label";
10
- export type { BadgeRootProps } from "./components/badge-root";
1
+ export { Badge, type BadgeProps } from "./badge";
11
2
  export type { BadgeStyles } from "./types";
@@ -1,9 +1,9 @@
1
- import type { BadgeLabelProps } from "./components/badge-label";
2
- import type { BadgeRootProps } from "./components/badge-root";
3
-
4
- export type BadgeState = "default";
1
+ import type { TextStyle } from "react-native";
2
+ import type { IconProps } from "../icon";
3
+ import type { BadgeProps } from "./badge";
5
4
 
6
5
  export interface BadgeStyles {
7
- root?: Partial<Record<BadgeState, BadgeRootProps["style"]>>;
8
- label?: Partial<Record<BadgeState, BadgeLabelProps["style"]>>;
6
+ root?: BadgeProps["style"];
7
+ text?: TextStyle;
8
+ icon?: IconProps;
9
9
  }
@@ -5,21 +5,24 @@ export const useBadgeVariantDefault = (): BadgeStyles => {
5
5
  return useThemedStyles(
6
6
  ({ colors, radius, fontFamily, fontSize }): BadgeStyles => ({
7
7
  root: {
8
- default: {
9
- backgroundColor: colors.primary,
10
- paddingVertical: 4,
11
- paddingHorizontal: 8,
12
- borderRadius: radius,
13
- alignSelf: "flex-start",
14
- },
8
+ flexDirection: "row",
9
+ gap: 4,
10
+ alignItems: "center",
11
+ alignSelf: "flex-start",
12
+ backgroundColor: colors.primary,
13
+ paddingVertical: 4,
14
+ paddingHorizontal: 8,
15
+ borderRadius: radius,
15
16
  },
16
- label: {
17
- default: {
18
- color: colors.primaryForeground,
19
- fontSize: fontSize * 0.75,
20
- fontWeight: "600",
21
- fontFamily,
22
- },
17
+ text: {
18
+ color: colors.primaryForeground,
19
+ fontSize: fontSize * 0.75,
20
+ fontWeight: "600",
21
+ fontFamily,
22
+ },
23
+ icon: {
24
+ color: colors.primaryForeground,
25
+ size: fontSize * 0.75,
23
26
  },
24
27
  }),
25
28
  );
@@ -5,21 +5,24 @@ export const useBadgeVariantSecondary = (): BadgeStyles => {
5
5
  return useThemedStyles(
6
6
  ({ colors, radius, fontFamily, fontSize }): BadgeStyles => ({
7
7
  root: {
8
- default: {
9
- backgroundColor: colors.secondary,
10
- paddingVertical: 4,
11
- paddingHorizontal: 8,
12
- borderRadius: radius,
13
- alignSelf: "flex-start",
14
- },
8
+ flexDirection: "row",
9
+ gap: 4,
10
+ alignItems: "center",
11
+ alignSelf: "flex-start",
12
+ backgroundColor: colors.secondary,
13
+ paddingVertical: 4,
14
+ paddingHorizontal: 8,
15
+ borderRadius: radius,
15
16
  },
16
- label: {
17
- default: {
18
- color: colors.secondaryForeground,
19
- fontSize: fontSize * 0.75,
20
- fontWeight: "600",
21
- fontFamily,
22
- },
17
+ text: {
18
+ color: colors.secondaryForeground,
19
+ fontSize: fontSize * 0.75,
20
+ fontWeight: "600",
21
+ fontFamily,
22
+ },
23
+ icon: {
24
+ color: colors.secondaryForeground,
25
+ size: fontSize * 0.75,
23
26
  },
24
27
  }),
25
28
  );
@@ -1,6 +1,6 @@
1
- import type { TextInputRef } from "../../types/element.types";
2
1
  import { forwardRef, useState } from "react";
3
2
  import { StyleSheet, TextInput, type TextInputProps } from "react-native";
3
+ import type { TextInputRef } from "../../types/element.types";
4
4
  import { useFieldOptional } from "../field/context";
5
5
  import type { InputState } from "./types";
6
6
  import { InputVariants } from "./variants";
@@ -29,7 +29,11 @@ export const Input = forwardRef<TextInputRef, InputProps>((props, ref) => {
29
29
  const state = calculateState(props, isFocused);
30
30
  const field = useFieldOptional();
31
31
 
32
- const composedStyles = StyleSheet.flatten([variantStyles.default?.style, variantStyles[state]?.style, props.style]);
32
+ const composedStyles = StyleSheet.flatten([
33
+ variantStyles.default?.style,
34
+ variantStyles[state]?.style,
35
+ props.style,
36
+ ]);
33
37
  const composedProps = {
34
38
  ...variantStyles.default,
35
39
  ...variantStyles[state],
@@ -1,8 +1,8 @@
1
1
  import React, { useState } from "react";
2
2
  import { Pressable, type StyleProp, type ViewStyle } from "react-native";
3
+ import { useOrganizedChildren } from "../../../hooks/use-organized-children";
3
4
  import { useMenu } from "../context";
4
5
  import type { MenuCheckboxItemState } from "../types";
5
- import { useOrganizedChildren } from "../use-organized-children";
6
6
  import { MenuSelectionIndicator } from "./menu-selection-indicator";
7
7
 
8
8
  export interface MenuCheckboxItemProps {
@@ -43,7 +43,14 @@ export function MenuCheckboxItem(props: MenuCheckboxItemProps) {
43
43
  }
44
44
  };
45
45
 
46
- const organizedChildren = useOrganizedChildren(props.children);
46
+ const textStyles = menu.styles?.itemText;
47
+ const iconStyles = menu.styles?.itemIcon;
48
+
49
+ const organizedChildren = useOrganizedChildren(
50
+ props.children,
51
+ textStyles,
52
+ iconStyles,
53
+ );
47
54
 
48
55
  if (props.render) {
49
56
  return (
@@ -1,8 +1,8 @@
1
1
  import React, { useState } from "react";
2
2
  import { Pressable, type StyleProp, type ViewStyle } from "react-native";
3
+ import { useOrganizedChildren } from "../../../hooks/use-organized-children";
3
4
  import { useMenu } from "../context";
4
5
  import type { MenuButtonState } from "../types";
5
- import { useOrganizedChildren } from "../use-organized-children";
6
6
 
7
7
  export interface MenuItemProps {
8
8
  children: React.ReactNode;
@@ -34,7 +34,14 @@ export function MenuItem(props: MenuItemProps) {
34
34
  menu.setIsOpen((prev) => !prev);
35
35
  };
36
36
 
37
- const organizedChildren = useOrganizedChildren(props.children);
37
+ const textStyles = menu.styles?.itemText;
38
+ const iconStyles = menu.styles?.itemIcon;
39
+
40
+ const organizedChildren = useOrganizedChildren(
41
+ props.children,
42
+ textStyles,
43
+ iconStyles,
44
+ );
38
45
 
39
46
  if (props.render) {
40
47
  return (
@@ -1,8 +1,8 @@
1
1
  import React, { useState } from "react";
2
2
  import { Pressable, type StyleProp, type ViewStyle } from "react-native";
3
+ import { useOrganizedChildren } from "../../../hooks/use-organized-children";
3
4
  import { useMenu, useMenuRadioGroup } from "../context";
4
5
  import type { MenuRadioItemState } from "../types";
5
- import { useOrganizedChildren } from "../use-organized-children";
6
6
  import { MenuSelectionIndicator } from "./menu-selection-indicator";
7
7
 
8
8
  export interface MenuRadioItemProps {
@@ -46,7 +46,14 @@ export function MenuRadioItem(props: MenuRadioItemProps) {
46
46
  }
47
47
  };
48
48
 
49
- const organizedChildren = useOrganizedChildren(props.children);
49
+ const textStyles = menu.styles?.itemText;
50
+ const iconStyles = menu.styles?.itemIcon;
51
+
52
+ const organizedChildren = useOrganizedChildren(
53
+ props.children,
54
+ textStyles,
55
+ iconStyles,
56
+ );
50
57
 
51
58
  if (props.render) {
52
59
  return (
@@ -1,5 +1,6 @@
1
1
  import type { StyleProp, TextStyle, ViewStyle } from "react-native";
2
2
  import type { SvgProps } from "../../types/props.types";
3
+ import type { IconProps } from "../icon";
3
4
  import type { MenuContentProps } from "./components/menu-content";
4
5
  import type { MenuOverlayProps } from "./components/menu-overlay";
5
6
 
@@ -15,7 +16,7 @@ export interface MenuStyles {
15
16
  content?: MenuContentProps["style"];
16
17
  item?: Partial<Record<MenuButtonState, StyleProp<ViewStyle>>>;
17
18
  itemText?: StyleProp<TextStyle>;
18
- itemIcon?: SvgProps;
19
+ itemIcon?: IconProps;
19
20
  overlay?: MenuOverlayProps["style"];
20
21
 
21
22
  group?: StyleProp<ViewStyle>;
@@ -6,9 +6,9 @@ import {
6
6
  type StyleProp,
7
7
  type ViewStyle,
8
8
  } from "react-native";
9
+ import { useOrganizedChildren } from "../../../hooks/use-organized-children";
9
10
  import { useTabsContext } from "../context";
10
11
  import type { TabsItemState } from "../types";
11
- import { useOrganizedChildren } from "../use-organized-children";
12
12
 
13
13
  export interface TabsItemProps extends PressableProps {
14
14
  children: React.ReactNode;
@@ -10,7 +10,7 @@ export type ToastIconProps = SvgProps;
10
10
  export function ToastIcon({
11
11
  render: Component,
12
12
  ...props
13
- }: PropsWithRequiredRender<ToastIconProps>) {
13
+ }: PropsWithRequiredRender<SvgProps>) {
14
14
  const toast = useToast();
15
15
 
16
16
  const composedProps = {
@@ -1,13 +1,13 @@
1
1
  import React, { useMemo } from "react";
2
2
  import { Text, type StyleProp, type TextStyle } from "react-native";
3
- import { getElementProp } from "../../utils/element-utils";
4
- import { Icon, type IconProps } from "../icon";
3
+ import { Icon, type IconProps } from "../components/icon";
4
+ import { getElementProp } from "../utils/element-utils";
5
5
 
6
6
  export function useOrganizedChildren(
7
7
  children: React.ReactNode,
8
8
  textStyle: StyleProp<TextStyle> | undefined,
9
9
  iconProps: IconProps | undefined,
10
- ) {
10
+ ): React.ReactNode {
11
11
  const organizedChildren = useMemo(() => {
12
12
  if (typeof children === "string") {
13
13
  return <Text style={textStyle}>{children}</Text>;
@@ -7,7 +7,7 @@ import {
7
7
  } from "react";
8
8
  import { useColorScheme } from "react-native";
9
9
  import type { ToastVariants } from "../components/toast/variants";
10
- import type { IconComponent } from "../types/element.types";
10
+ import type { SvgProps } from "../types/props.types";
11
11
  import type { DeepPartial } from "../types/util.types";
12
12
  import { defaultThemeAssets } from "./default";
13
13
  import type {
@@ -34,10 +34,12 @@ interface ThemeContext {
34
34
 
35
35
  export interface ComponentsConfig {
36
36
  toast?: {
37
- icons?: Partial<Record<keyof typeof ToastVariants, IconComponent>>;
37
+ icons?: Partial<
38
+ Record<keyof typeof ToastVariants, React.ComponentType<SvgProps>>
39
+ >;
38
40
  };
39
41
  menu?: {
40
- selectionIcon?: IconComponent;
42
+ selectionIcon?: React.ComponentType<SvgProps>;
41
43
  };
42
44
  }
43
45
 
@@ -1,3 +1,4 @@
1
+ import type React from "react";
1
2
  import type { ColorValue, StyleProp, TextStyle, ViewStyle } from "react-native";
2
3
 
3
4
  export type PropsWithRender<P> = P & {
@@ -5,7 +6,7 @@ export type PropsWithRender<P> = P & {
5
6
  };
6
7
 
7
8
  export type PropsWithRequiredRender<P> = P & {
8
- render: (props: P) => React.ReactNode;
9
+ render: React.ComponentType<P>;
9
10
  };
10
11
 
11
12
  export type SvgProps = {
@@ -1,17 +0,0 @@
1
- "use strict";
2
-
3
- import { calculateComposedStyles } from "../../../utils/calculate-styles.js";
4
- import React from "react";
5
- import { Text } from "react-native";
6
- import { useBadge } from "../context.js";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- export function BadgeLabel(props) {
9
- const badge = useBadge();
10
- const composedStyle = calculateComposedStyles(badge.styles, badge.state, "label", props.style);
11
- const Component = props.render ?? Text;
12
- return /*#__PURE__*/_jsx(Component, {
13
- ...props,
14
- style: composedStyle
15
- });
16
- }
17
- //# sourceMappingURL=badge-label.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["calculateComposedStyles","React","Text","useBadge","jsx","_jsx","BadgeLabel","props","badge","composedStyle","styles","state","style","Component","render"],"sourceRoot":"../../../../../src","sources":["components/badge/components/badge-label.tsx"],"mappings":";;AAAA,SAASA,uBAAuB,QAAQ,oCAAiC;AACzE,OAAOC,KAAK,MAAM,OAAO;AACzB,SAAyBC,IAAI,QAAwB,cAAc;AACnE,SAASC,QAAQ,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAUtC,OAAO,SAASC,UAAUA,CAACC,KAAsB,EAAE;EACjD,MAAMC,KAAK,GAAGL,QAAQ,CAAC,CAAC;EAExB,MAAMM,aAAa,GAAGT,uBAAuB,CAACQ,KAAK,CAACE,MAAM,EAAEF,KAAK,CAACG,KAAK,EAAE,OAAO,EAAEJ,KAAK,CAACK,KAAK,CAAC;EAE9F,MAAMC,SAAS,GAAGN,KAAK,CAACO,MAAM,IAAIZ,IAAI;EACtC,oBAAOG,IAAA,CAACQ,SAAS;IAAA,GAAKN,KAAK;IAAEK,KAAK,EAAEH;EAAc,CAAE,CAAC;AACvD","ignoreList":[]}
@@ -1,27 +0,0 @@
1
- "use strict";
2
-
3
- import { calculateComposedStyles } from "../../../utils/calculate-styles.js";
4
- import React from "react";
5
- import { View } from "react-native";
6
- import { BadgeContext } from "../context.js";
7
- import { BadgeVariants } from "../variants/index.js";
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- export function BadgeRoot(props) {
10
- const variantStyles = BadgeVariants[props.variant || "default"]();
11
- const customStyle = props.color ? {
12
- backgroundColor: props.color
13
- } : undefined;
14
- const composedStyle = calculateComposedStyles(variantStyles, "default", "root", props.style);
15
- const Component = props.render ?? View;
16
- return /*#__PURE__*/_jsx(BadgeContext.Provider, {
17
- value: {
18
- state: "default",
19
- styles: variantStyles
20
- },
21
- children: /*#__PURE__*/_jsx(Component, {
22
- ...props,
23
- style: [composedStyle, customStyle]
24
- })
25
- });
26
- }
27
- //# sourceMappingURL=badge-root.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["calculateComposedStyles","React","View","BadgeContext","BadgeVariants","jsx","_jsx","BadgeRoot","props","variantStyles","variant","customStyle","color","backgroundColor","undefined","composedStyle","style","Component","render","Provider","value","state","styles","children"],"sourceRoot":"../../../../../src","sources":["components/badge/components/badge-root.tsx"],"mappings":";;AACA,SAASA,uBAAuB,QAAQ,oCAAiC;AACzE,OAAOC,KAAK,MAAM,OAAO;AACzB,SAAyBC,IAAI,QAAwB,cAAc;AACnE,SAASC,YAAY,QAAQ,eAAY;AACzC,SAASC,aAAa,QAAQ,sBAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAY5C,OAAO,SAASC,SAASA,CAACC,KAAqB,EAAE;EAC/C,MAAMC,aAAa,GAAGL,aAAa,CAACI,KAAK,CAACE,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC;EAEjE,MAAMC,WAAW,GAAGH,KAAK,CAACI,KAAK,GAAG;IAAEC,eAAe,EAAEL,KAAK,CAACI;EAAM,CAAC,GAAGE,SAAS;EAE9E,MAAMC,aAAa,GAAGf,uBAAuB,CAACS,aAAa,EAAE,SAAS,EAAE,MAAM,EAAED,KAAK,CAACQ,KAAK,CAAC;EAE5F,MAAMC,SAAS,GAAGT,KAAK,CAACU,MAAM,IAAIhB,IAAI;EACtC,oBACEI,IAAA,CAACH,YAAY,CAACgB,QAAQ;IACpBC,KAAK,EAAE;MACLC,KAAK,EAAE,SAAS;MAChBC,MAAM,EAAEb;IACV,CAAE;IAAAc,QAAA,eAEFjB,IAAA,CAACW,SAAS;MAAA,GAAKT,KAAK;MAAEQ,KAAK,EAAE,CAACD,aAAa,EAAEJ,WAAW;IAAE,CAAE;EAAC,CACxC,CAAC;AAE5B","ignoreList":[]}
@@ -1,39 +0,0 @@
1
- "use strict";
2
-
3
- import React, { useMemo } from "react";
4
- import { Text } from "react-native";
5
- import { getElementProp } from "../../utils/element-utils.js";
6
- import { Icon } from "../icon/index.js";
7
- import { useMenu } from "./context.js";
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- export function useOrganizedChildren(children) {
10
- const menu = useMenu();
11
- const organizedChildren = useMemo(() => {
12
- if (typeof children === "string") {
13
- return /*#__PURE__*/_jsx(Text, {
14
- style: menu.styles?.itemText,
15
- children: children
16
- });
17
- }
18
- if (Array.isArray(children)) {
19
- return children.map((child, index) => {
20
- if (typeof child === "string") {
21
- return /*#__PURE__*/_jsx(Text, {
22
- style: menu.styles?.itemText,
23
- children: child
24
- }, index);
25
- } else if (/*#__PURE__*/React.isValidElement(child) && child.type === Icon) {
26
- return /*#__PURE__*/React.cloneElement(child, {
27
- key: child.key,
28
- ...menu.styles?.itemIcon,
29
- style: [menu.styles?.itemIcon?.style, getElementProp(child, "style")]
30
- });
31
- }
32
- return child;
33
- });
34
- }
35
- return children;
36
- }, [children, menu.styles?.itemIcon]);
37
- return organizedChildren;
38
- }
39
- //# sourceMappingURL=use-organized-children.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useMemo","Text","getElementProp","Icon","useMenu","jsx","_jsx","useOrganizedChildren","children","menu","organizedChildren","style","styles","itemText","Array","isArray","map","child","index","isValidElement","type","cloneElement","key","itemIcon"],"sourceRoot":"../../../../src","sources":["components/menu/use-organized-children.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,cAAc,QAAQ,8BAA2B;AAC1D,SAASC,IAAI,QAAQ,kBAAS;AAC9B,SAASC,OAAO,QAAQ,cAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpC,OAAO,SAASC,oBAAoBA,CAACC,QAAyB,EAAE;EAC9D,MAAMC,IAAI,GAAGL,OAAO,CAAC,CAAC;EAEtB,MAAMM,iBAAiB,GAAGV,OAAO,CAAC,MAAM;IACtC,IAAI,OAAOQ,QAAQ,KAAK,QAAQ,EAAE;MAChC,oBAAOF,IAAA,CAACL,IAAI;QAACU,KAAK,EAAEF,IAAI,CAACG,MAAM,EAAEC,QAAS;QAAAL,QAAA,EAAEA;MAAQ,CAAO,CAAC;IAC9D;IACA,IAAIM,KAAK,CAACC,OAAO,CAACP,QAAQ,CAAC,EAAE;MAC3B,OAAOA,QAAQ,CAACQ,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,KAAK;QACpC,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;UAC7B,oBACEX,IAAA,CAACL,IAAI;YAAaU,KAAK,EAAEF,IAAI,CAACG,MAAM,EAAEC,QAAS;YAAAL,QAAA,EAC5CS;UAAK,GADGC,KAEL,CAAC;QAEX,CAAC,MAAM,IAAI,aAAAnB,KAAK,CAACoB,cAAc,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,IAAI,KAAKjB,IAAI,EAAE;UAC7D,oBAAOJ,KAAK,CAACsB,YAAY,CAACJ,KAAK,EAA6B;YAC1DK,GAAG,EAAEL,KAAK,CAACK,GAAG;YACd,GAAGb,IAAI,CAACG,MAAM,EAAEW,QAAQ;YACxBZ,KAAK,EAAE,CACLF,IAAI,CAACG,MAAM,EAAEW,QAAQ,EAAEZ,KAAK,EAC5BT,cAAc,CAACe,KAAK,EAAE,OAAO,CAAC;UAElC,CAAC,CAAC;QACJ;QACA,OAAOA,KAAK;MACd,CAAC,CAAC;IACJ;IACA,OAAOT,QAAQ;EACjB,CAAC,EAAE,CAACA,QAAQ,EAAEC,IAAI,CAACG,MAAM,EAAEW,QAAQ,CAAC,CAAC;EACrC,OAAOb,iBAAiB;AAC1B","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useMemo","Text","getElementProp","Icon","jsx","_jsx","useOrganizedChildren","children","textStyle","iconProps","organizedChildren","style","Array","isArray","map","child","index","isValidElement","type","cloneElement","key"],"sourceRoot":"../../../../src","sources":["components/tabs/use-organized-children.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AACtC,SAASC,IAAI,QAAwC,cAAc;AACnE,SAASC,cAAc,QAAQ,8BAA2B;AAC1D,SAASC,IAAI,QAAwB,kBAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/C,OAAO,SAASC,oBAAoBA,CAClCC,QAAyB,EACzBC,SAA2C,EAC3CC,SAAgC,EAChC;EACA,MAAMC,iBAAiB,GAAGV,OAAO,CAAC,MAAM;IACtC,IAAI,OAAOO,QAAQ,KAAK,QAAQ,EAAE;MAChC,oBAAOF,IAAA,CAACJ,IAAI;QAACU,KAAK,EAAEH,SAAU;QAAAD,QAAA,EAAEA;MAAQ,CAAO,CAAC;IAClD;IACA,IAAIK,KAAK,CAACC,OAAO,CAACN,QAAQ,CAAC,EAAE;MAC3B,OAAOA,QAAQ,CAACO,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,KAAK;QACpC,IAAI,OAAOD,KAAK,KAAK,QAAQ,EAAE;UAC7B,oBACEV,IAAA,CAACJ,IAAI;YAAaU,KAAK,EAAEH,SAAU;YAAAD,QAAA,EAChCQ;UAAK,GADGC,KAEL,CAAC;QAEX,CAAC,MAAM,IAAI,aAAAjB,KAAK,CAACkB,cAAc,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,IAAI,KAAKf,IAAI,EAAE;UAC7D,oBAAOJ,KAAK,CAACoB,YAAY,CAACJ,KAAK,EAA6B;YAC1DK,GAAG,EAAEL,KAAK,CAACK,GAAG;YACd,GAAGX,SAAS;YACZE,KAAK,EAAE,CAACF,SAAS,EAAEE,KAAK,EAAET,cAAc,CAACa,KAAK,EAAE,OAAO,CAAC;UAC1D,CAAC,CAAC;QACJ;QACA,OAAOA,KAAK;MACd,CAAC,CAAC;IACJ;IACA,OAAOR,QAAQ;EACjB,CAAC,EAAE,CAACA,QAAQ,EAAEE,SAAS,EAAED,SAAS,CAAC,CAAC;EAEpC,OAAOE,iBAAiB;AAC1B","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import { type StyleProp, type TextStyle } from "react-native";
3
- export interface BadgeLabelProps {
4
- children?: string;
5
- render?: (props: BadgeLabelProps) => React.ReactNode;
6
- style?: StyleProp<TextStyle>;
7
- }
8
- export declare function BadgeLabel(props: BadgeLabelProps): React.JSX.Element;
9
- //# sourceMappingURL=badge-label.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"badge-label.d.ts","sourceRoot":"","sources":["../../../../../../src/components/badge/components/badge-label.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,SAAS,CAAC;IAErD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBAOhD"}
@@ -1,13 +0,0 @@
1
- import type { ElementChildren } from "../../../types/element.types";
2
- import React from "react";
3
- import { type StyleProp, type ViewStyle } from "react-native";
4
- import { BadgeVariants } from "../variants";
5
- export interface BadgeRootProps {
6
- variant?: keyof typeof BadgeVariants;
7
- color?: string;
8
- children?: ElementChildren;
9
- render?: (props: BadgeRootProps) => React.ReactNode;
10
- style?: StyleProp<ViewStyle>;
11
- }
12
- export declare function BadgeRoot(props: BadgeRootProps): React.JSX.Element;
13
- //# sourceMappingURL=badge-root.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"badge-root.d.ts","sourceRoot":"","sources":["../../../../../../src/components/badge/components/badge-root.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,SAAS,EAAQ,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,MAAM,OAAO,aAAa,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,eAAe,CAAC;IAE3B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,KAAK,CAAC,SAAS,CAAC;IAEpD,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qBAkB9C"}
@@ -1,3 +0,0 @@
1
- import React from "react";
2
- export declare function useOrganizedChildren(children: React.ReactNode): number | bigint | boolean | any[] | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
3
- //# sourceMappingURL=use-organized-children.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-organized-children.d.ts","sourceRoot":"","sources":["../../../../../src/components/menu/use-organized-children.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAMvC,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,kSA+B7D"}
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- import { type StyleProp, type TextStyle } from "react-native";
3
- import { type IconProps } from "../icon";
4
- export declare function useOrganizedChildren(children: React.ReactNode, textStyle: StyleProp<TextStyle> | undefined, iconProps: IconProps | undefined): number | bigint | boolean | any[] | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
5
- //# sourceMappingURL=use-organized-children.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-organized-children.d.ts","sourceRoot":"","sources":["../../../../../src/components/tabs/use-organized-children.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAE/C,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,EAC3C,SAAS,EAAE,SAAS,GAAG,SAAS,kSA4BjC"}
@@ -1,21 +0,0 @@
1
- import { calculateComposedStyles } from "../../../utils/calculate-styles";
2
- import React from "react";
3
- import { type StyleProp, Text, type TextStyle } from "react-native";
4
- import { useBadge } from "../context";
5
-
6
- export interface BadgeLabelProps {
7
- children?: string;
8
-
9
- render?: (props: BadgeLabelProps) => React.ReactNode;
10
-
11
- style?: StyleProp<TextStyle>;
12
- }
13
-
14
- export function BadgeLabel(props: BadgeLabelProps) {
15
- const badge = useBadge();
16
-
17
- const composedStyle = calculateComposedStyles(badge.styles, badge.state, "label", props.style);
18
-
19
- const Component = props.render ?? Text;
20
- return <Component {...props} style={composedStyle} />;
21
- }