@cdx-ui/components 0.0.1-alpha.1 → 0.0.1-alpha.11
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 +1 -1
- package/lib/commonjs/components/Button/styles.js +12 -12
- package/lib/commonjs/components/Button/styles.js.map +1 -1
- package/lib/commonjs/components/Checkbox/index.js +173 -0
- package/lib/commonjs/components/Checkbox/index.js.map +1 -0
- package/lib/commonjs/components/Checkbox/styles.js +67 -0
- package/lib/commonjs/components/Checkbox/styles.js.map +1 -0
- package/lib/commonjs/components/Heading/index.js +35 -0
- package/lib/commonjs/components/Heading/index.js.map +1 -0
- package/lib/commonjs/components/Heading/styles.js +23 -0
- package/lib/commonjs/components/Heading/styles.js.map +1 -0
- package/lib/commonjs/components/Stack/HStack.js +8 -21
- package/lib/commonjs/components/Stack/HStack.js.map +1 -1
- package/lib/commonjs/components/Stack/VStack.js +8 -21
- package/lib/commonjs/components/Stack/VStack.js.map +1 -1
- package/lib/commonjs/components/Stack/styles.js +51 -0
- package/lib/commonjs/components/Stack/styles.js.map +1 -0
- package/lib/commonjs/components/Switch/BaseSwitch.js +46 -0
- package/lib/commonjs/components/Switch/BaseSwitch.js.map +1 -0
- package/lib/commonjs/components/Switch/BaseSwitch.web.js +56 -0
- package/lib/commonjs/components/Switch/BaseSwitch.web.js.map +1 -0
- package/lib/commonjs/components/Switch/index.js +13 -0
- package/lib/commonjs/components/Switch/index.js.map +1 -0
- package/lib/commonjs/components/Switch/styles.js +128 -0
- package/lib/commonjs/components/Switch/styles.js.map +1 -0
- package/lib/commonjs/components/Text/index.js +18 -9
- package/lib/commonjs/components/Text/index.js.map +1 -1
- package/lib/commonjs/components/Text/styles.js +23 -0
- package/lib/commonjs/components/Text/styles.js.map +1 -0
- package/lib/commonjs/components/index.js +36 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/metro/withCdxMetroConfig.js +24 -0
- package/lib/commonjs/metro/withCdxMetroConfig.js.map +1 -0
- package/lib/module/components/Button/styles.js +12 -12
- package/lib/module/components/Button/styles.js.map +1 -1
- package/lib/module/components/Checkbox/index.js +169 -0
- package/lib/module/components/Checkbox/index.js.map +1 -0
- package/lib/module/components/Checkbox/styles.js +63 -0
- package/lib/module/components/Checkbox/styles.js.map +1 -0
- package/lib/module/components/Heading/index.js +31 -0
- package/lib/module/components/Heading/index.js.map +1 -0
- package/lib/module/components/Heading/styles.js +19 -0
- package/lib/module/components/Heading/styles.js.map +1 -0
- package/lib/module/components/Stack/HStack.js +8 -21
- package/lib/module/components/Stack/HStack.js.map +1 -1
- package/lib/module/components/Stack/VStack.js +8 -21
- package/lib/module/components/Stack/VStack.js.map +1 -1
- package/lib/module/components/Stack/styles.js +47 -0
- package/lib/module/components/Stack/styles.js.map +1 -0
- package/lib/module/components/Switch/BaseSwitch.js +42 -0
- package/lib/module/components/Switch/BaseSwitch.js.map +1 -0
- package/lib/module/components/Switch/BaseSwitch.web.js +52 -0
- package/lib/module/components/Switch/BaseSwitch.web.js.map +1 -0
- package/lib/module/components/Switch/index.js +9 -0
- package/lib/module/components/Switch/index.js.map +1 -0
- package/lib/module/components/Switch/styles.js +125 -0
- package/lib/module/components/Switch/styles.js.map +1 -0
- package/lib/module/components/Text/index.js +19 -1
- package/lib/module/components/Text/index.js.map +1 -1
- package/lib/module/components/Text/styles.js +19 -0
- package/lib/module/components/Text/styles.js.map +1 -0
- package/lib/module/components/index.js +3 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/metro/withCdxMetroConfig.js +20 -0
- package/lib/module/metro/withCdxMetroConfig.js.map +1 -0
- package/lib/typescript/components/Button/styles.d.ts +2 -2
- package/lib/typescript/components/Button/styles.d.ts.map +1 -1
- package/lib/typescript/components/Checkbox/index.d.ts +44 -0
- package/lib/typescript/components/Checkbox/index.d.ts.map +1 -0
- package/lib/typescript/components/Checkbox/styles.d.ts +18 -0
- package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -0
- package/lib/typescript/components/Heading/index.d.ts +6 -0
- package/lib/typescript/components/Heading/index.d.ts.map +1 -0
- package/lib/typescript/components/Heading/styles.d.ts +6 -0
- package/lib/typescript/components/Heading/styles.d.ts.map +1 -0
- package/lib/typescript/components/Input/styles.d.ts +4 -4
- package/lib/typescript/components/Select/styles.d.ts +5 -5
- package/lib/typescript/components/Stack/HStack.d.ts +1 -12
- package/lib/typescript/components/Stack/HStack.d.ts.map +1 -1
- package/lib/typescript/components/Stack/VStack.d.ts +1 -12
- package/lib/typescript/components/Stack/VStack.d.ts.map +1 -1
- package/lib/typescript/components/Stack/styles.d.ts +10 -0
- package/lib/typescript/components/Stack/styles.d.ts.map +1 -0
- package/lib/typescript/components/Switch/BaseSwitch.d.ts +9 -0
- package/lib/typescript/components/Switch/BaseSwitch.d.ts.map +1 -0
- package/lib/typescript/components/Switch/BaseSwitch.web.d.ts +15 -0
- package/lib/typescript/components/Switch/BaseSwitch.web.d.ts.map +1 -0
- package/lib/typescript/components/Switch/index.d.ts +8 -0
- package/lib/typescript/components/Switch/index.d.ts.map +1 -0
- package/lib/typescript/components/Switch/styles.d.ts +26 -0
- package/lib/typescript/components/Switch/styles.d.ts.map +1 -0
- package/lib/typescript/components/Text/index.d.ts +5 -1
- package/lib/typescript/components/Text/index.d.ts.map +1 -1
- package/lib/typescript/components/Text/styles.d.ts +6 -0
- package/lib/typescript/components/Text/styles.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +3 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/metro/withCdxMetroConfig.d.ts +19 -0
- package/lib/typescript/metro/withCdxMetroConfig.d.ts.map +1 -0
- package/package.json +18 -15
- package/src/components/Button/styles.ts +15 -10
- package/src/components/Checkbox/index.tsx +215 -0
- package/src/components/Checkbox/styles.ts +94 -0
- package/src/components/Heading/index.tsx +33 -0
- package/src/components/Heading/styles.tsx +25 -0
- package/src/components/Stack/HStack.tsx +8 -19
- package/src/components/Stack/VStack.tsx +8 -23
- package/src/components/Stack/styles.ts +49 -0
- package/src/components/Switch/BaseSwitch.tsx +38 -0
- package/src/components/Switch/BaseSwitch.web.tsx +69 -0
- package/src/components/Switch/index.tsx +13 -0
- package/src/components/Switch/styles.ts +120 -0
- package/src/components/Text/index.tsx +15 -0
- package/src/components/Text/styles.tsx +25 -0
- package/src/components/index.ts +3 -0
- package/src/metro/withCdxMetroConfig.ts +29 -0
- package/lib/commonjs/components/Text/Text.js +0 -30
- package/lib/commonjs/components/Text/Text.js.map +0 -1
- package/lib/module/components/Text/Text.js +0 -26
- package/lib/module/components/Text/Text.js.map +0 -1
- package/lib/typescript/components/Text/Text.d.ts +0 -11
- package/lib/typescript/components/Text/Text.d.ts.map +0 -1
- package/src/components/Text/Text.tsx +0 -58
- package/src/components/Text/index.ts +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Switch as RNSwitch, type SwitchProps } from 'react-native';
|
|
3
|
+
import { cn } from '@cdx-ui/utils';
|
|
4
|
+
import {
|
|
5
|
+
switchIosBgVariants,
|
|
6
|
+
switchThumbColorVariants,
|
|
7
|
+
switchTrackOffVariants,
|
|
8
|
+
switchTrackOnVariants,
|
|
9
|
+
} from './styles';
|
|
10
|
+
|
|
11
|
+
export interface BaseSwitchProps extends Omit<SwitchProps, 'className'> {
|
|
12
|
+
states?: Record<string, boolean | undefined>;
|
|
13
|
+
dataSet?: Record<string, string>;
|
|
14
|
+
className?: string;
|
|
15
|
+
size?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const BaseSwitch = forwardRef<RNSwitch, BaseSwitchProps>(
|
|
19
|
+
({ states, className, disabled, value, ...props }, ref) => {
|
|
20
|
+
const isChecked = value ?? states?.checked ?? false;
|
|
21
|
+
const isDisabled = disabled ?? states?.disabled ?? false;
|
|
22
|
+
const isInvalid = states?.invalid ?? false;
|
|
23
|
+
|
|
24
|
+
const uniwindProps: Record<string, string | undefined> = {
|
|
25
|
+
className,
|
|
26
|
+
thumbColorClassName: cn(switchThumbColorVariants({ isDisabled })),
|
|
27
|
+
trackColorOnClassName: cn(switchTrackOnVariants({ isInvalid })),
|
|
28
|
+
trackColorOffClassName: cn(switchTrackOffVariants({ isInvalid })),
|
|
29
|
+
ios_backgroundColorClassName: cn(switchIosBgVariants({ isInvalid })),
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<RNSwitch ref={ref} value={isChecked} disabled={isDisabled} {...uniwindProps} {...props} />
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
BaseSwitch.displayName = 'BaseSwitch';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Pressable, View } from 'react-native';
|
|
3
|
+
import { cn } from '@cdx-ui/utils';
|
|
4
|
+
import {
|
|
5
|
+
switchThumbVariants,
|
|
6
|
+
switchTrackVariants,
|
|
7
|
+
switchWebTrackColorVariants,
|
|
8
|
+
type SwitchVariantProps,
|
|
9
|
+
} from './styles';
|
|
10
|
+
|
|
11
|
+
export interface BaseSwitchProps {
|
|
12
|
+
value?: boolean;
|
|
13
|
+
onValueChange?: (value: boolean) => void;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
states?: Record<string, boolean | undefined>;
|
|
16
|
+
dataSet?: Record<string, string>;
|
|
17
|
+
className?: string;
|
|
18
|
+
size?: SwitchVariantProps['size'];
|
|
19
|
+
onFocus?: () => void;
|
|
20
|
+
onBlur?: () => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const BaseSwitch = forwardRef<View, BaseSwitchProps>(
|
|
24
|
+
(
|
|
25
|
+
{
|
|
26
|
+
value,
|
|
27
|
+
onValueChange,
|
|
28
|
+
disabled,
|
|
29
|
+
states,
|
|
30
|
+
dataSet,
|
|
31
|
+
className,
|
|
32
|
+
size = 'md',
|
|
33
|
+
onFocus,
|
|
34
|
+
onBlur,
|
|
35
|
+
...props
|
|
36
|
+
},
|
|
37
|
+
ref,
|
|
38
|
+
) => {
|
|
39
|
+
const isChecked = value ?? states?.checked ?? false;
|
|
40
|
+
const isDisabled = disabled ?? states?.disabled ?? false;
|
|
41
|
+
const isInvalid = states?.invalid ?? false;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Pressable
|
|
45
|
+
ref={ref}
|
|
46
|
+
role="switch"
|
|
47
|
+
aria-checked={isChecked}
|
|
48
|
+
aria-disabled={isDisabled}
|
|
49
|
+
disabled={isDisabled}
|
|
50
|
+
onPress={() => onValueChange?.(!isChecked)}
|
|
51
|
+
onFocus={onFocus}
|
|
52
|
+
onBlur={onBlur}
|
|
53
|
+
tabIndex={0}
|
|
54
|
+
className={cn(
|
|
55
|
+
switchTrackVariants({ size }),
|
|
56
|
+
switchWebTrackColorVariants({ isChecked, isInvalid }),
|
|
57
|
+
className,
|
|
58
|
+
)}
|
|
59
|
+
// @ts-expect-error dataSet is a RNW/Uniwind prop not in Pressable types
|
|
60
|
+
dataSet={dataSet}
|
|
61
|
+
{...props}
|
|
62
|
+
>
|
|
63
|
+
<View className={cn(switchThumbVariants({ size, isChecked }))} />
|
|
64
|
+
</Pressable>
|
|
65
|
+
);
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
BaseSwitch.displayName = 'BaseSwitch';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ISwitchProps, createSwitch } from '@cdx-ui/primitives';
|
|
2
|
+
import { BaseSwitch } from './BaseSwitch';
|
|
3
|
+
import type { SwitchVariantProps } from './styles';
|
|
4
|
+
|
|
5
|
+
const SwitchPrimitive = createSwitch({ Root: BaseSwitch });
|
|
6
|
+
|
|
7
|
+
export interface SwitchProps extends ISwitchProps, SwitchVariantProps {
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Switch = SwitchPrimitive;
|
|
12
|
+
|
|
13
|
+
export type { SwitchVariantProps };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// NATIVE — Uniwind className bindings for RN Switch
|
|
5
|
+
// =============================================================================
|
|
6
|
+
|
|
7
|
+
export const switchThumbColorVariants = cva(['accent-white'], {
|
|
8
|
+
variants: {
|
|
9
|
+
isDisabled: {
|
|
10
|
+
true: 'accent-gray-200',
|
|
11
|
+
false: '',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: { isDisabled: false },
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const switchTrackOnVariants = cva(['accent-blue-500'], {
|
|
18
|
+
variants: {
|
|
19
|
+
isInvalid: {
|
|
20
|
+
true: 'accent-red-500',
|
|
21
|
+
false: '',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
defaultVariants: { isInvalid: false },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export const switchTrackOffVariants = cva(['accent-gray-300'], {
|
|
28
|
+
variants: {
|
|
29
|
+
isInvalid: {
|
|
30
|
+
true: 'accent-red-300',
|
|
31
|
+
false: '',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
defaultVariants: { isInvalid: false },
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const switchIosBgVariants = cva(['accent-gray-300'], {
|
|
38
|
+
variants: {
|
|
39
|
+
isInvalid: {
|
|
40
|
+
true: 'accent-red-300',
|
|
41
|
+
false: '',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: { isInvalid: false },
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// =============================================================================
|
|
48
|
+
// WEB — Tailwind classes for custom Pressable toggle
|
|
49
|
+
// =============================================================================
|
|
50
|
+
|
|
51
|
+
export const switchTrackVariants = cva(
|
|
52
|
+
[
|
|
53
|
+
'flex-row items-center rounded-full cursor-pointer',
|
|
54
|
+
'transition-colors duration-200',
|
|
55
|
+
'data-[disabled=true]:opacity-50 data-[disabled=true]:cursor-not-allowed',
|
|
56
|
+
'web:data-[focus-visible=true]:ring-3 web:data-[focus-visible=true]:ring-blue-300/50',
|
|
57
|
+
'web:data-[invalid=true]:data-[focus-visible=true]:ring-red-300/50',
|
|
58
|
+
],
|
|
59
|
+
{
|
|
60
|
+
variants: {
|
|
61
|
+
size: {
|
|
62
|
+
sm: 'w-9 h-5 p-0.5',
|
|
63
|
+
md: 'w-11 h-6 p-0.5',
|
|
64
|
+
lg: 'w-14 h-8 p-1',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
defaultVariants: {
|
|
68
|
+
size: 'md',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
export const switchWebTrackColorVariants = cva([], {
|
|
74
|
+
variants: {
|
|
75
|
+
isChecked: {
|
|
76
|
+
true: 'bg-blue-500 data-[hover=true]:bg-blue-600',
|
|
77
|
+
false: 'bg-gray-300 data-[hover=true]:bg-gray-400',
|
|
78
|
+
},
|
|
79
|
+
isInvalid: {
|
|
80
|
+
true: '',
|
|
81
|
+
false: '',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
compoundVariants: [
|
|
85
|
+
{ isChecked: true, isInvalid: true, className: 'bg-red-500 data-[hover=true]:bg-red-600' },
|
|
86
|
+
{ isChecked: false, isInvalid: true, className: 'bg-red-300 data-[hover=true]:bg-red-400' },
|
|
87
|
+
],
|
|
88
|
+
defaultVariants: {
|
|
89
|
+
isChecked: false,
|
|
90
|
+
isInvalid: false,
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export const switchThumbVariants = cva(
|
|
95
|
+
['rounded-full bg-white shadow-sm', 'transition-transform duration-200'],
|
|
96
|
+
{
|
|
97
|
+
variants: {
|
|
98
|
+
size: {
|
|
99
|
+
sm: 'w-4 h-4',
|
|
100
|
+
md: 'w-5 h-5',
|
|
101
|
+
lg: 'w-6 h-6',
|
|
102
|
+
},
|
|
103
|
+
isChecked: {
|
|
104
|
+
true: '',
|
|
105
|
+
false: 'translate-x-0',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
compoundVariants: [
|
|
109
|
+
{ size: 'sm', isChecked: true, className: 'translate-x-4' },
|
|
110
|
+
{ size: 'md', isChecked: true, className: 'translate-x-5' },
|
|
111
|
+
{ size: 'lg', isChecked: true, className: 'translate-x-6' },
|
|
112
|
+
],
|
|
113
|
+
defaultVariants: {
|
|
114
|
+
size: 'md',
|
|
115
|
+
isChecked: false,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export type SwitchVariantProps = VariantProps<typeof switchTrackVariants>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { forwardRef, type ComponentPropsWithoutRef, type ComponentRef } from 'react';
|
|
2
|
+
import { Span } from '@expo/html-elements';
|
|
3
|
+
import { cn } from '@cdx-ui/utils';
|
|
4
|
+
import { textStyle, TextVariantProps } from './styles';
|
|
5
|
+
|
|
6
|
+
export type TextProps = TextVariantProps & ComponentPropsWithoutRef<typeof Span>;
|
|
7
|
+
|
|
8
|
+
export const Text = forwardRef<ComponentRef<typeof Span>, TextProps>(function Text(
|
|
9
|
+
{ className, size = 'md', ...props },
|
|
10
|
+
ref,
|
|
11
|
+
) {
|
|
12
|
+
return <Span className={cn(textStyle({ size }), className)} {...props} ref={ref} />;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
Text.displayName = 'Text';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
|
|
4
|
+
export const textStyle = cva(
|
|
5
|
+
[
|
|
6
|
+
'text-foreground font-body',
|
|
7
|
+
Platform.select({
|
|
8
|
+
web: 'font-sans tracking-sm my-0 bg-transparent border-0 box-border display-inline list-none margin-0 padding-0 position-relative text-start no-underline whitespace-pre-wrap word-wrap-break-word',
|
|
9
|
+
default: '',
|
|
10
|
+
}),
|
|
11
|
+
],
|
|
12
|
+
{
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
xl: 'text-xl',
|
|
16
|
+
lg: 'text-lg',
|
|
17
|
+
md: 'text-base',
|
|
18
|
+
sm: 'text-sm',
|
|
19
|
+
xs: 'text-xs',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export type TextVariantProps = VariantProps<typeof textStyle>;
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { MetroConfig } from 'metro-config';
|
|
2
|
+
import { withUniwindConfig } from 'uniwind/metro';
|
|
3
|
+
|
|
4
|
+
export interface CdxMetroConfigOptions {
|
|
5
|
+
/** Path to the CSS entry file (e.g., `'./global.css'`). */
|
|
6
|
+
cssEntryFile: string;
|
|
7
|
+
/** Path where generated Tailwind class type definitions are written. */
|
|
8
|
+
generatedTypesFile?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Metro config with CDX UI's styling-layer configuration.
|
|
13
|
+
*
|
|
14
|
+
* Today this delegates to Uniwind. If the styling layer is swapped (see
|
|
15
|
+
* `docs/research/uniwind-to-nativewind-contingency.md`), only the internals
|
|
16
|
+
* of this function change — consuming Metro configs stay the same.
|
|
17
|
+
*
|
|
18
|
+
* Must be the **outermost** Metro config wrapper (after any other wrappers
|
|
19
|
+
* like `withStorybook`).
|
|
20
|
+
*/
|
|
21
|
+
export function withCdxMetroConfig<T extends MetroConfig>(
|
|
22
|
+
config: T,
|
|
23
|
+
options: CdxMetroConfigOptions,
|
|
24
|
+
): T {
|
|
25
|
+
return withUniwindConfig(config, {
|
|
26
|
+
cssEntryFile: options.cssEntryFile,
|
|
27
|
+
dtsFile: options.generatedTypesFile,
|
|
28
|
+
}) as T;
|
|
29
|
+
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Text = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
const joinClassNames = (...parts) => parts.filter(Boolean).join(' ');
|
|
11
|
-
const buildTypographyClassName = variant => joinClassNames(`[font-family:var(--type-${variant}-family)]`, `[font-weight:var(--type-${variant}-weight)]`, `text-[var(--type-${variant}-size)]`, `leading-[var(--type-${variant}-lineHeight)]`, `tracking-[var(--type-${variant}-letterSpacing)]`, variant === 'overline' ? 'uppercase' : 'normal-case');
|
|
12
|
-
const Text = exports.Text = /*#__PURE__*/(0, _react.forwardRef)(({
|
|
13
|
-
variant,
|
|
14
|
-
children,
|
|
15
|
-
style,
|
|
16
|
-
className,
|
|
17
|
-
...restProps
|
|
18
|
-
}, ref) => {
|
|
19
|
-
const variantKey = variant ?? 'body1';
|
|
20
|
-
const variantClassName = buildTypographyClassName(variantKey);
|
|
21
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
22
|
-
ref: ref,
|
|
23
|
-
className: joinClassNames(variantClassName, className),
|
|
24
|
-
style: style,
|
|
25
|
-
...restProps,
|
|
26
|
-
children: children
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
Text.displayName = 'Text';
|
|
30
|
-
//# sourceMappingURL=Text.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNative","_jsxRuntime","joinClassNames","parts","filter","Boolean","join","buildTypographyClassName","variant","Text","exports","forwardRef","children","style","className","restProps","ref","variantKey","variantClassName","jsx","displayName"],"sourceRoot":"../../../../src","sources":["components/Text/Text.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAA6E,IAAAE,WAAA,GAAAF,OAAA;AA0B7E,MAAMG,cAAc,GAAGA,CAAC,GAAGC,KAAqC,KAC9DA,KAAK,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;AAEjC,MAAMC,wBAAwB,GAAIC,OAA0B,IAC1DN,cAAc,CACZ,2BAA2BM,OAAO,WAAW,EAC7C,2BAA2BA,OAAO,WAAW,EAC7C,oBAAoBA,OAAO,SAAS,EACpC,uBAAuBA,OAAO,eAAe,EAC7C,wBAAwBA,OAAO,kBAAkB,EACjDA,OAAO,KAAK,UAAU,GAAG,WAAW,GAAG,aACzC,CAAC;AAEI,MAAMC,IAAI,GAAAC,OAAA,CAAAD,IAAA,gBAAG,IAAAE,iBAAU,EAC5B,CAAC;EAAEH,OAAO;EAAEI,QAAQ;EAAEC,KAAK;EAAEC,SAAS;EAAE,GAAGC;AAAU,CAAC,EAAEC,GAAG,KAAK;EAC9D,MAAMC,UAAU,GAAGT,OAAO,IAAI,OAAO;EACrC,MAAMU,gBAAgB,GAAGX,wBAAwB,CAACU,UAAU,CAAC;EAC7D,oBACE,IAAAhB,WAAA,CAAAkB,GAAA,EAACnB,YAAA,CAAAS,IAAM;IACLO,GAAG,EAAEA,GAAI;IACTF,SAAS,EAAEZ,cAAc,CAACgB,gBAAgB,EAAEJ,SAAS,CAAE;IACvDD,KAAK,EAAEA,KAAM;IAAA,GACTE,SAAS;IAAAH,QAAA,EAEZA;EAAQ,CACH,CAAC;AAEb,CACF,CAAC;AAEDH,IAAI,CAACW,WAAW,GAAG,MAAM","ignoreList":[]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import { Text as RNText } from 'react-native';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
const joinClassNames = (...parts) => parts.filter(Boolean).join(' ');
|
|
7
|
-
const buildTypographyClassName = variant => joinClassNames(`[font-family:var(--type-${variant}-family)]`, `[font-weight:var(--type-${variant}-weight)]`, `text-[var(--type-${variant}-size)]`, `leading-[var(--type-${variant}-lineHeight)]`, `tracking-[var(--type-${variant}-letterSpacing)]`, variant === 'overline' ? 'uppercase' : 'normal-case');
|
|
8
|
-
export const Text = /*#__PURE__*/forwardRef(({
|
|
9
|
-
variant,
|
|
10
|
-
children,
|
|
11
|
-
style,
|
|
12
|
-
className,
|
|
13
|
-
...restProps
|
|
14
|
-
}, ref) => {
|
|
15
|
-
const variantKey = variant ?? 'body1';
|
|
16
|
-
const variantClassName = buildTypographyClassName(variantKey);
|
|
17
|
-
return /*#__PURE__*/_jsx(RNText, {
|
|
18
|
-
ref: ref,
|
|
19
|
-
className: joinClassNames(variantClassName, className),
|
|
20
|
-
style: style,
|
|
21
|
-
...restProps,
|
|
22
|
-
children: children
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
Text.displayName = 'Text';
|
|
26
|
-
//# sourceMappingURL=Text.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","Text","RNText","jsx","_jsx","joinClassNames","parts","filter","Boolean","join","buildTypographyClassName","variant","children","style","className","restProps","ref","variantKey","variantClassName","displayName"],"sourceRoot":"../../../../src","sources":["components/Text/Text.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,IAAI,IAAIC,MAAM,QAAuC,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA0B7E,MAAMC,cAAc,GAAGA,CAAC,GAAGC,KAAqC,KAC9DA,KAAK,CAACC,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;AAEjC,MAAMC,wBAAwB,GAAIC,OAA0B,IAC1DN,cAAc,CACZ,2BAA2BM,OAAO,WAAW,EAC7C,2BAA2BA,OAAO,WAAW,EAC7C,oBAAoBA,OAAO,SAAS,EACpC,uBAAuBA,OAAO,eAAe,EAC7C,wBAAwBA,OAAO,kBAAkB,EACjDA,OAAO,KAAK,UAAU,GAAG,WAAW,GAAG,aACzC,CAAC;AAEH,OAAO,MAAMV,IAAI,gBAAGD,UAAU,CAC5B,CAAC;EAAEW,OAAO;EAAEC,QAAQ;EAAEC,KAAK;EAAEC,SAAS;EAAE,GAAGC;AAAU,CAAC,EAAEC,GAAG,KAAK;EAC9D,MAAMC,UAAU,GAAGN,OAAO,IAAI,OAAO;EACrC,MAAMO,gBAAgB,GAAGR,wBAAwB,CAACO,UAAU,CAAC;EAC7D,oBACEb,IAAA,CAACF,MAAM;IACLc,GAAG,EAAEA,GAAI;IACTF,SAAS,EAAET,cAAc,CAACa,gBAAgB,EAAEJ,SAAS,CAAE;IACvDD,KAAK,EAAEA,KAAM;IAAA,GACTE,SAAS;IAAAH,QAAA,EAEZA;EAAQ,CACH,CAAC;AAEb,CACF,CAAC;AAEDX,IAAI,CAACkB,WAAW,GAAG,MAAM","ignoreList":[]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Text as RNText, type TextProps as RNTextProps } from 'react-native';
|
|
2
|
-
type TypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'caption' | 'button' | 'overline' | 'display1' | 'display2';
|
|
3
|
-
interface VariantProps {
|
|
4
|
-
variant?: TypographyVariant;
|
|
5
|
-
className?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface TextProps extends RNTextProps, VariantProps {
|
|
8
|
-
}
|
|
9
|
-
export declare const Text: import("react").ForwardRefExoticComponent<TextProps & import("react").RefAttributes<RNText>>;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../../src/components/Text/Text.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,KAAK,SAAS,IAAI,WAAW,EAAE,MAAM,cAAc,CAAC;AAE7E,KAAK,iBAAiB,GAClB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,WAAW,GACX,WAAW,GACX,OAAO,GACP,OAAO,GACP,SAAS,GACT,QAAQ,GACR,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AAEf,UAAU,YAAY;IACpB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAU,SAAQ,WAAW,EAAE,YAAY;CAAG;AAe/D,eAAO,MAAM,IAAI,8FAehB,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from 'react';
|
|
2
|
-
import { Text as RNText, type TextProps as RNTextProps } from 'react-native';
|
|
3
|
-
|
|
4
|
-
type TypographyVariant =
|
|
5
|
-
| 'h1'
|
|
6
|
-
| 'h2'
|
|
7
|
-
| 'h3'
|
|
8
|
-
| 'h4'
|
|
9
|
-
| 'h5'
|
|
10
|
-
| 'h6'
|
|
11
|
-
| 'subtitle1'
|
|
12
|
-
| 'subtitle2'
|
|
13
|
-
| 'body1'
|
|
14
|
-
| 'body2'
|
|
15
|
-
| 'caption'
|
|
16
|
-
| 'button'
|
|
17
|
-
| 'overline'
|
|
18
|
-
| 'display1'
|
|
19
|
-
| 'display2';
|
|
20
|
-
|
|
21
|
-
interface VariantProps {
|
|
22
|
-
variant?: TypographyVariant;
|
|
23
|
-
className?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface TextProps extends RNTextProps, VariantProps {}
|
|
27
|
-
|
|
28
|
-
const joinClassNames = (...parts: (string | undefined | false)[]) =>
|
|
29
|
-
parts.filter(Boolean).join(' ');
|
|
30
|
-
|
|
31
|
-
const buildTypographyClassName = (variant: TypographyVariant) =>
|
|
32
|
-
joinClassNames(
|
|
33
|
-
`[font-family:var(--type-${variant}-family)]`,
|
|
34
|
-
`[font-weight:var(--type-${variant}-weight)]`,
|
|
35
|
-
`text-[var(--type-${variant}-size)]`,
|
|
36
|
-
`leading-[var(--type-${variant}-lineHeight)]`,
|
|
37
|
-
`tracking-[var(--type-${variant}-letterSpacing)]`,
|
|
38
|
-
variant === 'overline' ? 'uppercase' : 'normal-case',
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
export const Text = forwardRef<RNText, TextProps>(
|
|
42
|
-
({ variant, children, style, className, ...restProps }, ref) => {
|
|
43
|
-
const variantKey = variant ?? 'body1';
|
|
44
|
-
const variantClassName = buildTypographyClassName(variantKey);
|
|
45
|
-
return (
|
|
46
|
-
<RNText
|
|
47
|
-
ref={ref}
|
|
48
|
-
className={joinClassNames(variantClassName, className)}
|
|
49
|
-
style={style}
|
|
50
|
-
{...restProps}
|
|
51
|
-
>
|
|
52
|
-
{children}
|
|
53
|
-
</RNText>
|
|
54
|
-
);
|
|
55
|
-
},
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
Text.displayName = 'Text';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Text';
|