@sibipro/sprinkles-native 0.1.8
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/README.md +101 -0
- package/dist/components/Avatar.d.ts +9 -0
- package/dist/components/Avatar.d.ts.map +1 -0
- package/dist/components/Avatar.js +27 -0
- package/dist/components/Avatar.js.map +1 -0
- package/dist/components/Badge.d.ts +10 -0
- package/dist/components/Badge.d.ts.map +1 -0
- package/dist/components/Badge.js +26 -0
- package/dist/components/Badge.js.map +1 -0
- package/dist/components/Banner.d.ts +8 -0
- package/dist/components/Banner.d.ts.map +1 -0
- package/dist/components/Banner.js +13 -0
- package/dist/components/Banner.js.map +1 -0
- package/dist/components/Button.d.ts +12 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +43 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Card.d.ts +8 -0
- package/dist/components/Card.d.ts.map +1 -0
- package/dist/components/Card.js +11 -0
- package/dist/components/Card.js.map +1 -0
- package/dist/components/Checkbox.d.ts +9 -0
- package/dist/components/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox.js +10 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/Chip.d.ts +8 -0
- package/dist/components/Chip.d.ts.map +1 -0
- package/dist/components/Chip.js +8 -0
- package/dist/components/Chip.js.map +1 -0
- package/dist/components/EmptyState.d.ts +11 -0
- package/dist/components/EmptyState.d.ts.map +1 -0
- package/dist/components/EmptyState.js +8 -0
- package/dist/components/EmptyState.js.map +1 -0
- package/dist/components/Input.d.ts +25 -0
- package/dist/components/Input.d.ts.map +1 -0
- package/dist/components/Input.js +28 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/Label.d.ts +6 -0
- package/dist/components/Label.d.ts.map +1 -0
- package/dist/components/Label.js +7 -0
- package/dist/components/Label.js.map +1 -0
- package/dist/components/ProgressBar.d.ts +8 -0
- package/dist/components/ProgressBar.d.ts.map +1 -0
- package/dist/components/ProgressBar.js +8 -0
- package/dist/components/ProgressBar.js.map +1 -0
- package/dist/components/Separator.d.ts +7 -0
- package/dist/components/Separator.d.ts.map +1 -0
- package/dist/components/Separator.js +7 -0
- package/dist/components/Separator.js.map +1 -0
- package/dist/components/Skeleton.d.ts +6 -0
- package/dist/components/Skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton.js +25 -0
- package/dist/components/Skeleton.js.map +1 -0
- package/dist/components/Switch.d.ts +7 -0
- package/dist/components/Switch.d.ts.map +1 -0
- package/dist/components/Switch.js +10 -0
- package/dist/components/Switch.js.map +1 -0
- package/dist/components/Text.d.ts +12 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/Text.js +27 -0
- package/dist/components/Text.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/theming/color-palettes.d.ts +82 -0
- package/dist/theming/color-palettes.d.ts.map +1 -0
- package/dist/theming/color-palettes.js +82 -0
- package/dist/theming/color-palettes.js.map +1 -0
- package/dist/theming/types.d.ts +81 -0
- package/dist/theming/types.d.ts.map +1 -0
- package/dist/theming/types.js +2 -0
- package/dist/theming/types.js.map +1 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +6 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +51 -0
- package/src/components/Avatar.tsx +58 -0
- package/src/components/Badge.tsx +70 -0
- package/src/components/Banner.tsx +34 -0
- package/src/components/Button.tsx +96 -0
- package/src/components/Card.tsx +28 -0
- package/src/components/Checkbox.tsx +43 -0
- package/src/components/Chip.tsx +38 -0
- package/src/components/EmptyState.tsx +41 -0
- package/src/components/Input.tsx +123 -0
- package/src/components/Label.tsx +16 -0
- package/src/components/ProgressBar.tsx +32 -0
- package/src/components/Separator.tsx +25 -0
- package/src/components/Skeleton.tsx +38 -0
- package/src/components/Switch.tsx +32 -0
- package/src/components/Text.tsx +57 -0
- package/src/index.ts +52 -0
- package/src/styles/global.css +245 -0
- package/src/theming/color-palettes.ts +81 -0
- package/src/theming/types.ts +82 -0
- package/src/types/react-native.d.ts +31 -0
- package/src/utils/cn.ts +6 -0
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type SwitchProps as RNSwitchProps } from 'react-native';
|
|
2
|
+
export interface SwitchProps extends RNSwitchProps {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
onCheckedChange?: (value: boolean) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function Switch({ checked, onCheckedChange, value, onValueChange, ...props }: SwitchProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=Switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,WAAW,IAAI,aAAa,EAClC,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,eAAe,EACf,KAAK,EACL,aAAa,EACb,GAAG,KAAK,EACT,EAAE,WAAW,2CAab"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Switch as RNSwitch, } from 'react-native';
|
|
3
|
+
import { palettes } from '../theming/color-palettes';
|
|
4
|
+
export function Switch({ checked, onCheckedChange, value, onValueChange, ...props }) {
|
|
5
|
+
return (_jsx(RNSwitch, { value: checked ?? value, onValueChange: onCheckedChange ?? onValueChange, trackColor: {
|
|
6
|
+
false: palettes.neutral[300],
|
|
7
|
+
true: palettes.purple[500],
|
|
8
|
+
}, thumbColor: palettes.white, ...props }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=Switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.js","sourceRoot":"","sources":["../../src/components/Switch.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,MAAM,IAAI,QAAQ,GAEnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAOrD,MAAM,UAAU,MAAM,CAAC,EACrB,OAAO,EACP,eAAe,EACf,KAAK,EACL,aAAa,EACb,GAAG,KAAK,EACI;IACZ,OAAO,CACL,KAAC,QAAQ,IACP,KAAK,EAAE,OAAO,IAAI,KAAK,EACvB,aAAa,EAAE,eAAe,IAAI,aAAa,EAC/C,UAAU,EAAE;YACV,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC;YAC5B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC;SAC3B,EACD,UAAU,EAAE,QAAQ,CAAC,KAAK,KACtB,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type TextProps as RNTextProps } from 'react-native';
|
|
2
|
+
export type TextVariant = 'body' | 'caption' | 'label' | 'heading';
|
|
3
|
+
export type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
|
|
4
|
+
export type TextWeight = 'normal' | 'medium' | 'semibold' | 'bold';
|
|
5
|
+
export interface TextProps extends RNTextProps {
|
|
6
|
+
variant?: TextVariant;
|
|
7
|
+
size?: TextSize;
|
|
8
|
+
weight?: TextWeight;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function Text({ variant, size, weight, className, ...props }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAG7E,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AACnE,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAChE,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;AAyBnE,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC5C,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,IAAI,CAAC,EACnB,OAAgB,EAChB,IAAI,EACJ,MAAM,EACN,SAAS,EACT,GAAG,KAAK,EACT,EAAE,SAAS,2CAYX"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text as RNText } from 'react-native';
|
|
3
|
+
import { cn } from '../utils/cn';
|
|
4
|
+
const variantClasses = {
|
|
5
|
+
body: 'text-base text-foreground',
|
|
6
|
+
caption: 'text-xs text-foreground-label',
|
|
7
|
+
label: 'text-sm text-foreground-label',
|
|
8
|
+
heading: 'text-lg font-bold text-foreground-heading',
|
|
9
|
+
};
|
|
10
|
+
const sizeClasses = {
|
|
11
|
+
xs: 'text-xs',
|
|
12
|
+
sm: 'text-sm',
|
|
13
|
+
md: 'text-base',
|
|
14
|
+
lg: 'text-lg',
|
|
15
|
+
xl: 'text-xl',
|
|
16
|
+
'2xl': 'text-2xl',
|
|
17
|
+
};
|
|
18
|
+
const weightClasses = {
|
|
19
|
+
normal: 'font-normal',
|
|
20
|
+
medium: 'font-medium',
|
|
21
|
+
semibold: 'font-semibold',
|
|
22
|
+
bold: 'font-bold',
|
|
23
|
+
};
|
|
24
|
+
export function Text({ variant = 'body', size, weight, className, ...props }) {
|
|
25
|
+
return (_jsx(RNText, { className: cn(variantClasses[variant], size && sizeClasses[size], weight && weightClasses[weight], className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=Text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,IAAI,MAAM,EAAiC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAMjC,MAAM,cAAc,GAAgC;IAClD,IAAI,EAAE,2BAA2B;IACjC,OAAO,EAAE,+BAA+B;IACxC,KAAK,EAAE,+BAA+B;IACtC,OAAO,EAAE,2CAA2C;CACrD,CAAC;AAEF,MAAM,WAAW,GAA6B;IAC5C,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,KAAK,EAAE,UAAU;CAClB,CAAC;AAEF,MAAM,aAAa,GAA+B;IAChD,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,aAAa;IACrB,QAAQ,EAAE,eAAe;IACzB,IAAI,EAAE,WAAW;CAClB,CAAC;AASF,MAAM,UAAU,IAAI,CAAC,EACnB,OAAO,GAAG,MAAM,EAChB,IAAI,EACJ,MAAM,EACN,SAAS,EACT,GAAG,KAAK,EACE;IACV,OAAO,CACL,KAAC,MAAM,IACL,SAAS,EAAE,EAAE,CACX,cAAc,CAAC,OAAO,CAAC,EACvB,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,EACzB,MAAM,IAAI,aAAa,CAAC,MAAM,CAAC,EAC/B,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export { Text } from './components/Text';
|
|
2
|
+
export type { TextProps, TextVariant, TextSize, TextWeight } from './components/Text';
|
|
3
|
+
export { Badge } from './components/Badge';
|
|
4
|
+
export type { BadgeProps, BadgeVariant } from './components/Badge';
|
|
5
|
+
export { Button } from './components/Button';
|
|
6
|
+
export type { ButtonProps, ButtonVariant, ButtonSize } from './components/Button';
|
|
7
|
+
export { Input, InputWithExtras, InputWithLabel } from './components/Input';
|
|
8
|
+
export type { InputProps, InputWithExtrasProps, InputWithLabelProps, InputVariant, InputGirth } from './components/Input';
|
|
9
|
+
export { Card } from './components/Card';
|
|
10
|
+
export type { CardProps, CardVariant } from './components/Card';
|
|
11
|
+
export { Banner } from './components/Banner';
|
|
12
|
+
export type { BannerProps, BannerVariant } from './components/Banner';
|
|
13
|
+
export { Separator } from './components/Separator';
|
|
14
|
+
export type { SeparatorProps } from './components/Separator';
|
|
15
|
+
export { Skeleton } from './components/Skeleton';
|
|
16
|
+
export type { SkeletonProps } from './components/Skeleton';
|
|
17
|
+
export { ProgressBar } from './components/ProgressBar';
|
|
18
|
+
export type { ProgressBarProps } from './components/ProgressBar';
|
|
19
|
+
export { Chip } from './components/Chip';
|
|
20
|
+
export type { ChipProps } from './components/Chip';
|
|
21
|
+
export { EmptyState } from './components/EmptyState';
|
|
22
|
+
export type { EmptyStateProps } from './components/EmptyState';
|
|
23
|
+
export { Avatar } from './components/Avatar';
|
|
24
|
+
export type { AvatarProps, AvatarSize } from './components/Avatar';
|
|
25
|
+
export { Switch } from './components/Switch';
|
|
26
|
+
export type { SwitchProps } from './components/Switch';
|
|
27
|
+
export { Checkbox } from './components/Checkbox';
|
|
28
|
+
export type { CheckboxProps } from './components/Checkbox';
|
|
29
|
+
export { Label } from './components/Label';
|
|
30
|
+
export type { LabelProps } from './components/Label';
|
|
31
|
+
export { cn } from './utils/cn';
|
|
32
|
+
export { palettes } from './theming/color-palettes';
|
|
33
|
+
export type { SprinklesTheme, SprinklesColorPalette, Tone } from './theming/types';
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEtF,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElF,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC5E,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE1H,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGrD,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAGhC,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Components
|
|
2
|
+
export { Text } from './components/Text';
|
|
3
|
+
export { Badge } from './components/Badge';
|
|
4
|
+
export { Button } from './components/Button';
|
|
5
|
+
export { Input, InputWithExtras, InputWithLabel } from './components/Input';
|
|
6
|
+
export { Card } from './components/Card';
|
|
7
|
+
export { Banner } from './components/Banner';
|
|
8
|
+
export { Separator } from './components/Separator';
|
|
9
|
+
export { Skeleton } from './components/Skeleton';
|
|
10
|
+
export { ProgressBar } from './components/ProgressBar';
|
|
11
|
+
export { Chip } from './components/Chip';
|
|
12
|
+
export { EmptyState } from './components/EmptyState';
|
|
13
|
+
export { Avatar } from './components/Avatar';
|
|
14
|
+
export { Switch } from './components/Switch';
|
|
15
|
+
export { Checkbox } from './components/Checkbox';
|
|
16
|
+
export { Label } from './components/Label';
|
|
17
|
+
// Utilities
|
|
18
|
+
export { cn } from './utils/cn';
|
|
19
|
+
// Theming
|
|
20
|
+
export { palettes } from './theming/color-palettes';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG5E,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGnD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGzC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,YAAY;AACZ,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAEhC,UAAU;AACV,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export declare const palettes: {
|
|
2
|
+
white: string;
|
|
3
|
+
neutral: {
|
|
4
|
+
25: string;
|
|
5
|
+
50: string;
|
|
6
|
+
100: string;
|
|
7
|
+
200: string;
|
|
8
|
+
300: string;
|
|
9
|
+
400: string;
|
|
10
|
+
500: string;
|
|
11
|
+
600: string;
|
|
12
|
+
700: string;
|
|
13
|
+
800: string;
|
|
14
|
+
900: string;
|
|
15
|
+
};
|
|
16
|
+
purple: {
|
|
17
|
+
25: string;
|
|
18
|
+
50: string;
|
|
19
|
+
100: string;
|
|
20
|
+
200: string;
|
|
21
|
+
300: string;
|
|
22
|
+
400: string;
|
|
23
|
+
500: string;
|
|
24
|
+
600: string;
|
|
25
|
+
700: string;
|
|
26
|
+
800: string;
|
|
27
|
+
900: string;
|
|
28
|
+
};
|
|
29
|
+
magenta: {
|
|
30
|
+
25: string;
|
|
31
|
+
50: string;
|
|
32
|
+
100: string;
|
|
33
|
+
200: string;
|
|
34
|
+
300: string;
|
|
35
|
+
400: string;
|
|
36
|
+
500: string;
|
|
37
|
+
600: string;
|
|
38
|
+
700: string;
|
|
39
|
+
800: string;
|
|
40
|
+
900: string;
|
|
41
|
+
};
|
|
42
|
+
emerald: {
|
|
43
|
+
25: string;
|
|
44
|
+
50: string;
|
|
45
|
+
100: string;
|
|
46
|
+
200: string;
|
|
47
|
+
300: string;
|
|
48
|
+
400: string;
|
|
49
|
+
500: string;
|
|
50
|
+
600: string;
|
|
51
|
+
700: string;
|
|
52
|
+
800: string;
|
|
53
|
+
900: string;
|
|
54
|
+
};
|
|
55
|
+
amber: {
|
|
56
|
+
25: string;
|
|
57
|
+
50: string;
|
|
58
|
+
100: string;
|
|
59
|
+
200: string;
|
|
60
|
+
300: string;
|
|
61
|
+
400: string;
|
|
62
|
+
500: string;
|
|
63
|
+
600: string;
|
|
64
|
+
700: string;
|
|
65
|
+
800: string;
|
|
66
|
+
900: string;
|
|
67
|
+
};
|
|
68
|
+
blue: {
|
|
69
|
+
25: string;
|
|
70
|
+
50: string;
|
|
71
|
+
100: string;
|
|
72
|
+
200: string;
|
|
73
|
+
300: string;
|
|
74
|
+
400: string;
|
|
75
|
+
500: string;
|
|
76
|
+
600: string;
|
|
77
|
+
700: string;
|
|
78
|
+
800: string;
|
|
79
|
+
900: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=color-palettes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-palettes.d.ts","sourceRoot":"","sources":["../../src/theming/color-palettes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgFpB,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export const palettes = {
|
|
2
|
+
white: '#ffffff',
|
|
3
|
+
neutral: {
|
|
4
|
+
25: '#fcfcff',
|
|
5
|
+
50: '#f8f9ff',
|
|
6
|
+
100: '#f1f5f9',
|
|
7
|
+
200: '#e2e8f0',
|
|
8
|
+
300: '#cbd5e1',
|
|
9
|
+
400: '#a9b6c9',
|
|
10
|
+
500: '#64748b',
|
|
11
|
+
600: '#475569',
|
|
12
|
+
700: '#334155',
|
|
13
|
+
800: '#1e293b',
|
|
14
|
+
900: '#0f172a',
|
|
15
|
+
},
|
|
16
|
+
purple: {
|
|
17
|
+
25: '#f0f1fd',
|
|
18
|
+
50: '#dddff9',
|
|
19
|
+
100: '#c1c4ee',
|
|
20
|
+
200: '#a2a6e5',
|
|
21
|
+
300: '#8388dd',
|
|
22
|
+
400: '#646bd4',
|
|
23
|
+
500: '#454dcc',
|
|
24
|
+
600: '#3a40aa',
|
|
25
|
+
700: '#2e3388',
|
|
26
|
+
800: '#232766',
|
|
27
|
+
900: '#171a44',
|
|
28
|
+
},
|
|
29
|
+
magenta: {
|
|
30
|
+
25: '#ffe7f1',
|
|
31
|
+
50: '#fbd5e5',
|
|
32
|
+
100: '#f9b9d4',
|
|
33
|
+
200: '#f696be',
|
|
34
|
+
300: '#f374a9',
|
|
35
|
+
400: '#f05193',
|
|
36
|
+
500: '#ef3f89',
|
|
37
|
+
600: '#cf4880',
|
|
38
|
+
700: '#a1285b',
|
|
39
|
+
800: '#791e44',
|
|
40
|
+
900: '#51142d',
|
|
41
|
+
},
|
|
42
|
+
emerald: {
|
|
43
|
+
25: '#e4f9f2',
|
|
44
|
+
50: '#d3f4e9',
|
|
45
|
+
100: '#b5ecda',
|
|
46
|
+
200: '#90e2c7',
|
|
47
|
+
300: '#6bd9b4',
|
|
48
|
+
400: '#46d0a2',
|
|
49
|
+
500: '#21c68f',
|
|
50
|
+
600: '#1ca577',
|
|
51
|
+
700: '#16845f',
|
|
52
|
+
800: '#106347',
|
|
53
|
+
900: '#0b4230',
|
|
54
|
+
},
|
|
55
|
+
amber: {
|
|
56
|
+
25: '#fff7eb',
|
|
57
|
+
50: '#fef1db',
|
|
58
|
+
100: '#fee7c2',
|
|
59
|
+
200: '#ffe1b1',
|
|
60
|
+
300: '#ffd797',
|
|
61
|
+
400: '#ffcd7d',
|
|
62
|
+
500: '#ffc363',
|
|
63
|
+
600: '#D29D49',
|
|
64
|
+
700: '#806131',
|
|
65
|
+
800: '#6C4B15',
|
|
66
|
+
900: '#554121',
|
|
67
|
+
},
|
|
68
|
+
blue: {
|
|
69
|
+
25: '#ebf2ff',
|
|
70
|
+
50: '#d8e6fd',
|
|
71
|
+
100: '#bed5fc',
|
|
72
|
+
200: '#9dc0fb',
|
|
73
|
+
300: '#7cacf9',
|
|
74
|
+
400: '#5c97f8',
|
|
75
|
+
500: '#3b82f6',
|
|
76
|
+
600: '#316ccd',
|
|
77
|
+
700: '#2757a4',
|
|
78
|
+
800: '#1d417b',
|
|
79
|
+
900: '#142b52',
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=color-palettes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color-palettes.js","sourceRoot":"","sources":["../../src/theming/color-palettes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,EAAE,EAAE,SAAS;QACb,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;KACf;IACD,MAAM,EAAE;QACN,EAAE,EAAE,SAAS;QACb,EAAE,EAAE,SAAS;QACb,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;KACf;IACD,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,EAAE,EAAE,SAAS;QACb,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;KACf;IACD,OAAO,EAAE;QACP,EAAE,EAAE,SAAS;QACb,EAAE,EAAE,SAAS;QACb,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;KACf;IACD,KAAK,EAAE;QACL,EAAE,EAAE,SAAS;QACb,EAAE,EAAE,SAAS;QACb,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;KACf;IACD,IAAI,EAAE;QACJ,EAAE,EAAE,SAAS;QACb,EAAE,EAAE,SAAS;QACb,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,SAAS;KACf;CACF,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export interface SprinklesColorPalette {
|
|
2
|
+
DEFAULT: string;
|
|
3
|
+
background: {
|
|
4
|
+
DEFAULT: string;
|
|
5
|
+
hover: string;
|
|
6
|
+
alt: string;
|
|
7
|
+
};
|
|
8
|
+
foreground: {
|
|
9
|
+
DEFAULT: string;
|
|
10
|
+
heading: string;
|
|
11
|
+
label: string;
|
|
12
|
+
inverted: string;
|
|
13
|
+
};
|
|
14
|
+
outline: string;
|
|
15
|
+
}
|
|
16
|
+
export interface SprinklesTheme {
|
|
17
|
+
background: {
|
|
18
|
+
DEFAULT: string;
|
|
19
|
+
secondary: string;
|
|
20
|
+
tertiary: string;
|
|
21
|
+
quaternary: string;
|
|
22
|
+
};
|
|
23
|
+
foreground: {
|
|
24
|
+
DEFAULT: string;
|
|
25
|
+
heading: string;
|
|
26
|
+
label: string;
|
|
27
|
+
};
|
|
28
|
+
border: {
|
|
29
|
+
DEFAULT: string;
|
|
30
|
+
alt: string;
|
|
31
|
+
secondary: string;
|
|
32
|
+
tertiary: string;
|
|
33
|
+
};
|
|
34
|
+
popover: {
|
|
35
|
+
DEFAULT: string;
|
|
36
|
+
foreground: string;
|
|
37
|
+
};
|
|
38
|
+
tooltip: {
|
|
39
|
+
DEFAULT: string;
|
|
40
|
+
foreground: string;
|
|
41
|
+
};
|
|
42
|
+
toast: {
|
|
43
|
+
DEFAULT: string;
|
|
44
|
+
foreground: string;
|
|
45
|
+
danger: {
|
|
46
|
+
DEFAULT: string;
|
|
47
|
+
foreground: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
actionbar: {
|
|
51
|
+
DEFAULT: string;
|
|
52
|
+
foreground: string;
|
|
53
|
+
};
|
|
54
|
+
dialog: {
|
|
55
|
+
DEFAULT: string;
|
|
56
|
+
foreground: string;
|
|
57
|
+
backdrop: string;
|
|
58
|
+
};
|
|
59
|
+
ring: string;
|
|
60
|
+
shadow: string;
|
|
61
|
+
outline: string;
|
|
62
|
+
accent: {
|
|
63
|
+
DEFAULT: string;
|
|
64
|
+
foreground: string;
|
|
65
|
+
};
|
|
66
|
+
primary: SprinklesColorPalette;
|
|
67
|
+
brand: SprinklesColorPalette;
|
|
68
|
+
success: SprinklesColorPalette;
|
|
69
|
+
info: SprinklesColorPalette;
|
|
70
|
+
warn: SprinklesColorPalette;
|
|
71
|
+
danger: SprinklesColorPalette;
|
|
72
|
+
stock: {
|
|
73
|
+
available: string;
|
|
74
|
+
substitution: string;
|
|
75
|
+
unavailable: string;
|
|
76
|
+
unknown: string;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export declare const TONES: readonly [25, 50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
|
|
80
|
+
export type Tone = (typeof TONES)[number];
|
|
81
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/theming/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE;YACN,OAAO,EAAE,MAAM,CAAC;YAChB,UAAU,EAAE,MAAM,CAAC;SACpB,CAAC;KACH,CAAC;IACF,SAAS,EAAE;QACT,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE;QACN,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,OAAO,EAAE,qBAAqB,CAAC;IAC/B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAED,eAAO,MAAM,KAAK,gEAAiE,CAAC;AACpF,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/theming/types.ts"],"names":[],"mappings":"AAgFA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
|
package/dist/utils/cn.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sibipro/sprinkles-native",
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"description": "React Native UI component library with Tailwind theming",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"packageManager": "pnpm@10.6.2",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"src/styles",
|
|
13
|
+
"src/**/*.ts",
|
|
14
|
+
"src/**/*.tsx",
|
|
15
|
+
"!src/**/*.test.*"
|
|
16
|
+
],
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"source": "./src/index.ts"
|
|
22
|
+
},
|
|
23
|
+
"./styles.css": "./src/styles/global.css"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"preinstall": "npx only-allow pnpm",
|
|
27
|
+
"build": "tsc",
|
|
28
|
+
"test": "tsc --noEmit",
|
|
29
|
+
"clean": "rm -rf dist",
|
|
30
|
+
"release": "pnpm version patch --no-git-tag-version && git add package.json && git commit -m \"release: v$(node -p \"require('./package.json').version\")\" && git tag v$(node -p \"require('./package.json').version\") && git push && git push --tags"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"clsx": "^2.1.1",
|
|
34
|
+
"tailwind-merge": "^2.6.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/react": "^19.0.0",
|
|
38
|
+
"@types/react-native": "^0.73.0",
|
|
39
|
+
"typescript": "^5.7.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": ">=18.0.0",
|
|
43
|
+
"react-native": ">=0.74.0",
|
|
44
|
+
"uniwind": ">=1.0.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependenciesMeta": {
|
|
47
|
+
"uniwind": {
|
|
48
|
+
"optional": true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, type ViewProps } from 'react-native';
|
|
3
|
+
import { cn } from '../utils/cn';
|
|
4
|
+
import { Text } from './Text';
|
|
5
|
+
|
|
6
|
+
export type AvatarSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
7
|
+
|
|
8
|
+
const sizeClasses: Record<AvatarSize, string> = {
|
|
9
|
+
sm: 'h-8 w-8',
|
|
10
|
+
md: 'h-10 w-10',
|
|
11
|
+
lg: 'h-12 w-12',
|
|
12
|
+
xl: 'h-16 w-16',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const textSizeClasses: Record<AvatarSize, string> = {
|
|
16
|
+
sm: 'text-xs',
|
|
17
|
+
md: 'text-sm',
|
|
18
|
+
lg: 'text-base',
|
|
19
|
+
xl: 'text-xl',
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function getInitials(name: string): string {
|
|
23
|
+
const parts = name.trim().split(/\s+/);
|
|
24
|
+
if (parts.length === 1) return parts[0][0]?.toUpperCase() ?? '';
|
|
25
|
+
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AvatarProps extends ViewProps {
|
|
29
|
+
name: string;
|
|
30
|
+
size?: AvatarSize;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function Avatar({
|
|
35
|
+
name,
|
|
36
|
+
size = 'md',
|
|
37
|
+
className,
|
|
38
|
+
...props
|
|
39
|
+
}: AvatarProps) {
|
|
40
|
+
const initials = getInitials(name);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<View
|
|
44
|
+
className={cn(
|
|
45
|
+
'rounded-full bg-brand-100 items-center justify-center',
|
|
46
|
+
sizeClasses[size],
|
|
47
|
+
className,
|
|
48
|
+
)}
|
|
49
|
+
accessibilityRole="image"
|
|
50
|
+
accessibilityLabel={name}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
<Text weight="semibold" className={cn('text-brand-700', textSizeClasses[size])}>
|
|
54
|
+
{initials}
|
|
55
|
+
</Text>
|
|
56
|
+
</View>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, type ViewProps } from 'react-native';
|
|
3
|
+
import { cn } from '../utils/cn';
|
|
4
|
+
import { Text } from './Text';
|
|
5
|
+
|
|
6
|
+
export type BadgeVariant =
|
|
7
|
+
| 'default'
|
|
8
|
+
| 'brand'
|
|
9
|
+
| 'danger'
|
|
10
|
+
| 'success'
|
|
11
|
+
| 'warn'
|
|
12
|
+
| 'info'
|
|
13
|
+
| 'outline';
|
|
14
|
+
|
|
15
|
+
const variantClasses: Record<BadgeVariant, string> = {
|
|
16
|
+
default: 'bg-background-tertiary',
|
|
17
|
+
brand: 'bg-brand-50 dark:bg-brand-900',
|
|
18
|
+
danger: 'bg-danger-50 dark:bg-danger-900',
|
|
19
|
+
success: 'bg-success-50 dark:bg-success-900',
|
|
20
|
+
warn: 'bg-warn-50 dark:bg-warn-900',
|
|
21
|
+
info: 'bg-info-50 dark:bg-info-900',
|
|
22
|
+
outline: 'border border-border',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const textClasses: Record<BadgeVariant, string> = {
|
|
26
|
+
default: 'text-foreground',
|
|
27
|
+
brand: 'text-brand-700',
|
|
28
|
+
danger: 'text-danger-700',
|
|
29
|
+
success: 'text-success-700',
|
|
30
|
+
warn: 'text-warn-700',
|
|
31
|
+
info: 'text-info-700',
|
|
32
|
+
outline: 'text-foreground',
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export interface BadgeProps extends ViewProps {
|
|
36
|
+
variant?: BadgeVariant;
|
|
37
|
+
className?: string;
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function Badge({
|
|
42
|
+
variant = 'default',
|
|
43
|
+
className,
|
|
44
|
+
children,
|
|
45
|
+
...props
|
|
46
|
+
}: BadgeProps) {
|
|
47
|
+
return (
|
|
48
|
+
<View
|
|
49
|
+
className={cn(
|
|
50
|
+
'rounded-lg py-1.5 px-2.5 flex-row items-center gap-1.5',
|
|
51
|
+
variantClasses[variant],
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
{...props}
|
|
55
|
+
>
|
|
56
|
+
{typeof children === 'string' ? (
|
|
57
|
+
<Text
|
|
58
|
+
size="xs"
|
|
59
|
+
weight="semibold"
|
|
60
|
+
className={textClasses[variant]}
|
|
61
|
+
numberOfLines={1}
|
|
62
|
+
>
|
|
63
|
+
{children}
|
|
64
|
+
</Text>
|
|
65
|
+
) : (
|
|
66
|
+
children
|
|
67
|
+
)}
|
|
68
|
+
</View>
|
|
69
|
+
);
|
|
70
|
+
}
|