@cdx-ui/components 0.0.1-beta.36 → 0.0.1-beta.38
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/lib/commonjs/components/Avatar/index.js +1 -1
- package/lib/commonjs/components/Avatar/styles.js +36 -29
- package/lib/commonjs/components/Avatar/styles.js.map +1 -1
- package/lib/commonjs/components/Chip/index.js +78 -9
- package/lib/commonjs/components/Chip/index.js.map +1 -1
- package/lib/commonjs/components/Chip/styles.js +207 -21
- package/lib/commonjs/components/Chip/styles.js.map +1 -1
- package/lib/commonjs/figma/Avatar.figma.js +54 -0
- package/lib/commonjs/figma/Avatar.figma.js.map +1 -0
- package/lib/commonjs/figma/Chip.figma.js +68 -0
- package/lib/commonjs/figma/Chip.figma.js.map +1 -0
- package/lib/module/components/Avatar/index.js +1 -1
- package/lib/module/components/Avatar/styles.js +36 -29
- package/lib/module/components/Avatar/styles.js.map +1 -1
- package/lib/module/components/Chip/index.js +82 -13
- package/lib/module/components/Chip/index.js.map +1 -1
- package/lib/module/components/Chip/styles.js +206 -20
- package/lib/module/components/Chip/styles.js.map +1 -1
- package/lib/module/figma/Avatar.figma.js +48 -0
- package/lib/module/figma/Avatar.figma.js.map +1 -0
- package/lib/module/figma/Chip.figma.js +62 -0
- package/lib/module/figma/Chip.figma.js.map +1 -0
- package/lib/typescript/components/Avatar/styles.d.ts +4 -4
- package/lib/typescript/components/Avatar/styles.d.ts.map +1 -1
- package/lib/typescript/components/Chip/index.d.ts +19 -6
- package/lib/typescript/components/Chip/index.d.ts.map +1 -1
- package/lib/typescript/components/Chip/styles.d.ts +13 -4
- package/lib/typescript/components/Chip/styles.d.ts.map +1 -1
- package/lib/typescript/components/Heading/styles.d.ts +1 -1
- package/lib/typescript/components/Stack/styles.d.ts +2 -2
- package/lib/typescript/components/Text/styles.d.ts +1 -1
- package/lib/typescript/figma/Avatar.figma.d.ts +8 -0
- package/lib/typescript/figma/Avatar.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Chip.figma.d.ts +8 -0
- package/lib/typescript/figma/Chip.figma.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/components/Avatar/index.tsx +1 -1
- package/src/components/Avatar/styles.ts +49 -34
- package/src/components/Chip/index.tsx +104 -27
- package/src/components/Chip/styles.ts +232 -18
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
-
import { COLOR_BG_MUTED, COLOR_TEXT_SECONDARY, RADIUS_FULL } from '../../styles/primitives';
|
|
3
2
|
|
|
4
3
|
// ── Root ─────────────────────────────────────────────────
|
|
5
4
|
|
|
6
5
|
export const avatarRootVariants = cva(
|
|
7
|
-
[
|
|
6
|
+
[
|
|
7
|
+
'rounded-[var(--border-radius-round)]',
|
|
8
|
+
'relative items-center justify-center',
|
|
9
|
+
'bg-surface-tertiary',
|
|
10
|
+
],
|
|
8
11
|
{
|
|
9
12
|
variants: {
|
|
10
13
|
size: {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
'2xs': 'w-3 h-3',
|
|
15
|
+
xs: 'w-[18px] h-[18px]',
|
|
16
|
+
sm: 'w-6 h-6',
|
|
17
|
+
md: 'w-8 h-8',
|
|
18
|
+
lg: 'w-10 h-10',
|
|
19
|
+
xl: 'w-12 h-12',
|
|
20
|
+
'2xl': 'w-14 h-14',
|
|
16
21
|
},
|
|
17
22
|
},
|
|
18
23
|
defaultVariants: {
|
|
19
|
-
size: '
|
|
24
|
+
size: 'md',
|
|
20
25
|
},
|
|
21
26
|
},
|
|
22
27
|
);
|
|
@@ -25,59 +30,69 @@ export const avatarRootVariants = cva(
|
|
|
25
30
|
|
|
26
31
|
export const avatarImageVariants = cva([
|
|
27
32
|
'absolute top-0 left-0 w-full h-full',
|
|
28
|
-
|
|
33
|
+
'rounded-[var(--border-radius-round)]',
|
|
29
34
|
'overflow-hidden',
|
|
35
|
+
'border border-stroke-secondary',
|
|
30
36
|
]);
|
|
31
37
|
|
|
32
38
|
// ── Text ─────────────────────────────────────────────────
|
|
33
39
|
|
|
34
|
-
export const avatarTextVariants = cva([
|
|
40
|
+
export const avatarTextVariants = cva(['text-content-primary', 'font-medium'], {
|
|
35
41
|
variants: {
|
|
36
42
|
size: {
|
|
43
|
+
'2xs': 'text-[6px]',
|
|
44
|
+
xs: 'text-[9px]',
|
|
37
45
|
sm: 'text-xs',
|
|
38
|
-
md: 'text-
|
|
39
|
-
lg: 'text-
|
|
40
|
-
xl: 'text-
|
|
41
|
-
'2xl': 'text-
|
|
46
|
+
md: 'text-base',
|
|
47
|
+
lg: 'text-xl',
|
|
48
|
+
xl: 'text-2xl',
|
|
49
|
+
'2xl': 'text-[28px]',
|
|
42
50
|
},
|
|
43
51
|
},
|
|
44
52
|
defaultVariants: {
|
|
45
|
-
size: '
|
|
53
|
+
size: 'md',
|
|
46
54
|
},
|
|
47
55
|
});
|
|
48
56
|
|
|
49
57
|
// ── Icon ─────────────────────────────────────────────────
|
|
50
58
|
|
|
51
|
-
export const avatarIconVariants = cva([
|
|
59
|
+
export const avatarIconVariants = cva(['text-content-primary'], {
|
|
52
60
|
variants: {
|
|
53
61
|
size: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
62
|
+
'2xs': 'size-1.5',
|
|
63
|
+
xs: 'size-[9px]',
|
|
64
|
+
sm: 'size-3',
|
|
65
|
+
md: 'size-4',
|
|
66
|
+
lg: 'size-5',
|
|
67
|
+
xl: 'size-6',
|
|
68
|
+
'2xl': 'size-7',
|
|
59
69
|
},
|
|
60
70
|
},
|
|
61
71
|
defaultVariants: {
|
|
62
|
-
size: '
|
|
72
|
+
size: 'md',
|
|
63
73
|
},
|
|
64
74
|
});
|
|
65
75
|
|
|
66
76
|
// ── Badge ────────────────────────────────────────────────
|
|
67
77
|
|
|
68
|
-
export const avatarBadgeVariants = cva(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
export const avatarBadgeVariants = cva(
|
|
79
|
+
['absolute border-white', 'rounded-[var(--border-radius-round)]', 'bottom-0 right-0'],
|
|
80
|
+
{
|
|
81
|
+
variants: {
|
|
82
|
+
size: {
|
|
83
|
+
'2xs': 'w-1.5 h-1.5 border translate-x-[21%] translate-y-[21%]',
|
|
84
|
+
xs: 'w-2 h-2 border translate-x-[17%] translate-y-[17%]',
|
|
85
|
+
sm: 'w-2.5 h-2.5 border-2 translate-x-[15%] translate-y-[15%]',
|
|
86
|
+
md: 'w-3 h-3 border-2 translate-x-[11%] translate-y-[11%]',
|
|
87
|
+
lg: 'w-3.5 h-3.5 border-2 translate-x-[8%] translate-y-[8%]',
|
|
88
|
+
xl: 'w-4 h-4 border-2 translate-x-[6%] translate-y-[6%]',
|
|
89
|
+
'2xl': 'w-5 h-5 border-2 translate-x-[9%] translate-y-[9%]',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
defaultVariants: {
|
|
93
|
+
size: 'md',
|
|
76
94
|
},
|
|
77
95
|
},
|
|
78
|
-
|
|
79
|
-
size: 'lg',
|
|
80
|
-
},
|
|
81
|
-
});
|
|
96
|
+
);
|
|
82
97
|
|
|
83
98
|
export type AvatarVariantProps = VariantProps<typeof avatarRootVariants>;
|
|
@@ -1,40 +1,92 @@
|
|
|
1
|
-
import { forwardRef, type ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { forwardRef, useMemo, type ReactNode } from 'react';
|
|
2
|
+
import { Pressable, Text as RNText, View, type TextProps } from 'react-native';
|
|
3
|
+
import { createChip, type IChipProps } from '@cdx-ui/primitives';
|
|
4
|
+
import {
|
|
5
|
+
cn,
|
|
6
|
+
ParentContext,
|
|
7
|
+
useParentContext,
|
|
8
|
+
useStyleContext,
|
|
9
|
+
withStyleContext,
|
|
10
|
+
type WithStyleContextProps,
|
|
11
|
+
} from '@cdx-ui/utils';
|
|
12
|
+
import { Avatar, type AvatarProps } from '../Avatar';
|
|
4
13
|
import { Icon, type IconProps } from '../Icon';
|
|
5
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
chipAvatarVariants,
|
|
16
|
+
chipIconVariants,
|
|
17
|
+
chipLabelVariants,
|
|
18
|
+
chipRootVariants,
|
|
19
|
+
type ChipVariantProps,
|
|
20
|
+
} from './styles';
|
|
6
21
|
|
|
7
22
|
const SCOPE = 'CHIP';
|
|
8
23
|
|
|
9
|
-
const
|
|
24
|
+
const RootView = withStyleContext(View, SCOPE);
|
|
25
|
+
const RootPressable = withStyleContext(Pressable, SCOPE);
|
|
10
26
|
|
|
11
|
-
const
|
|
27
|
+
const ChipPrimitive = createChip({
|
|
28
|
+
View: RootView,
|
|
29
|
+
Pressable: RootPressable,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const useChipStyleContext = () => useStyleContext(SCOPE) as ChipVariantProps;
|
|
12
33
|
|
|
13
34
|
// =============================================================================
|
|
14
|
-
//
|
|
35
|
+
// ROOT
|
|
15
36
|
// =============================================================================
|
|
16
37
|
|
|
17
|
-
export interface ChipProps extends
|
|
18
|
-
children?: ReactNode;
|
|
38
|
+
export interface ChipProps extends IChipProps, ChipVariantProps, WithStyleContextProps {
|
|
19
39
|
className?: string;
|
|
40
|
+
children?: ReactNode;
|
|
20
41
|
}
|
|
21
42
|
|
|
22
43
|
const ChipRoot = forwardRef<View, ChipProps>(
|
|
23
|
-
(
|
|
24
|
-
|
|
44
|
+
(
|
|
45
|
+
{
|
|
46
|
+
children,
|
|
47
|
+
variant = 'tint',
|
|
48
|
+
size = 'default',
|
|
49
|
+
color = 'default',
|
|
50
|
+
className,
|
|
51
|
+
style,
|
|
52
|
+
asChild,
|
|
53
|
+
...props
|
|
54
|
+
},
|
|
55
|
+
ref,
|
|
56
|
+
) => {
|
|
57
|
+
const parentContextValues = useParentContext();
|
|
58
|
+
const styleContextValues = useMemo(
|
|
59
|
+
() => ({ ...parentContextValues, [SCOPE]: { variant, size, color } }),
|
|
60
|
+
[parentContextValues, variant, size, color],
|
|
61
|
+
);
|
|
25
62
|
|
|
26
|
-
|
|
27
|
-
|
|
63
|
+
const computedClassName = cn(chipRootVariants({ variant, size, color }), className);
|
|
64
|
+
|
|
65
|
+
const root = (
|
|
66
|
+
<ChipPrimitive
|
|
67
|
+
ref={ref as never}
|
|
68
|
+
asChild={asChild}
|
|
69
|
+
className={computedClassName}
|
|
70
|
+
context={{ variant, size, color }}
|
|
71
|
+
style={style}
|
|
72
|
+
{...props}
|
|
73
|
+
>
|
|
28
74
|
{children}
|
|
29
|
-
</
|
|
75
|
+
</ChipPrimitive>
|
|
30
76
|
);
|
|
77
|
+
|
|
78
|
+
if (asChild) {
|
|
79
|
+
return <ParentContext.Provider value={styleContextValues}>{root}</ParentContext.Provider>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return root;
|
|
31
83
|
},
|
|
32
84
|
);
|
|
33
85
|
|
|
34
86
|
ChipRoot.displayName = 'Chip';
|
|
35
87
|
|
|
36
88
|
// =============================================================================
|
|
37
|
-
//
|
|
89
|
+
// LABEL
|
|
38
90
|
// =============================================================================
|
|
39
91
|
|
|
40
92
|
export interface ChipLabelProps extends TextProps {
|
|
@@ -44,9 +96,8 @@ export interface ChipLabelProps extends TextProps {
|
|
|
44
96
|
|
|
45
97
|
const ChipLabel = forwardRef<RNText, ChipLabelProps>(
|
|
46
98
|
({ className, children, style, ...props }, ref) => {
|
|
47
|
-
const { color } = useChipStyleContext();
|
|
48
|
-
|
|
49
|
-
const computedClassName = cn(chipLabelVariants({ color }), className);
|
|
99
|
+
const { size, variant, color } = useChipStyleContext();
|
|
100
|
+
const computedClassName = cn(chipLabelVariants({ size, variant, color }), className);
|
|
50
101
|
|
|
51
102
|
return (
|
|
52
103
|
<RNText ref={ref} className={computedClassName} style={style} {...props}>
|
|
@@ -59,33 +110,59 @@ const ChipLabel = forwardRef<RNText, ChipLabelProps>(
|
|
|
59
110
|
ChipLabel.displayName = 'Chip.Label';
|
|
60
111
|
|
|
61
112
|
// =============================================================================
|
|
62
|
-
//
|
|
113
|
+
// ICON
|
|
63
114
|
// =============================================================================
|
|
64
115
|
|
|
65
|
-
export interface ChipIconProps extends Omit<IconProps, 'children'> {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const computedClassName = cn(chipIconVariants({ color }), className);
|
|
116
|
+
export interface ChipIconProps extends Omit<IconProps, 'children'> {
|
|
117
|
+
/** Leading (default) or trailing slot — applies the correct negative margin offset. */
|
|
118
|
+
slot?: 'leading' | 'trailing';
|
|
119
|
+
className?: string;
|
|
120
|
+
}
|
|
71
121
|
|
|
122
|
+
const ChipIcon = ({ className, style, as, slot, ...props }: ChipIconProps) => {
|
|
123
|
+
const { size, color } = useChipStyleContext();
|
|
124
|
+
const computedClassName = cn(chipIconVariants({ size, color, slot }), className);
|
|
72
125
|
return <Icon as={as} className={computedClassName} style={style} {...props} />;
|
|
73
126
|
};
|
|
74
127
|
|
|
75
128
|
ChipIcon.displayName = 'Chip.Icon';
|
|
76
129
|
|
|
77
130
|
// =============================================================================
|
|
78
|
-
//
|
|
131
|
+
// AVATAR
|
|
132
|
+
// =============================================================================
|
|
133
|
+
|
|
134
|
+
export interface ChipAvatarProps extends Omit<AvatarProps, 'size'> {}
|
|
135
|
+
|
|
136
|
+
const ChipAvatar = ({ className, style, children, ...props }: ChipAvatarProps) => {
|
|
137
|
+
const { size } = useChipStyleContext();
|
|
138
|
+
// chipAvatarVariants sets w/h and the leading slot negative margin.
|
|
139
|
+
// Avatar renders with size="sm" (its smallest named size) but chipAvatarVariants
|
|
140
|
+
// overrides the w/h via tailwind-merge so the chip size wins.
|
|
141
|
+
const computedClassName = cn(chipAvatarVariants({ size }), className);
|
|
142
|
+
|
|
143
|
+
return (
|
|
144
|
+
<Avatar size="sm" className={computedClassName} style={style} {...props}>
|
|
145
|
+
{children}
|
|
146
|
+
</Avatar>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
ChipAvatar.displayName = 'Chip.Avatar';
|
|
151
|
+
|
|
152
|
+
// =============================================================================
|
|
153
|
+
// COMPOUND EXPORT
|
|
79
154
|
// =============================================================================
|
|
80
155
|
|
|
81
156
|
type ChipCompoundComponent = typeof ChipRoot & {
|
|
82
157
|
Label: typeof ChipLabel;
|
|
83
158
|
Icon: typeof ChipIcon;
|
|
159
|
+
Avatar: typeof ChipAvatar;
|
|
84
160
|
};
|
|
85
161
|
|
|
86
162
|
export const Chip = Object.assign(ChipRoot, {
|
|
87
163
|
Label: ChipLabel,
|
|
88
164
|
Icon: ChipIcon,
|
|
165
|
+
Avatar: ChipAvatar,
|
|
89
166
|
}) as ChipCompoundComponent;
|
|
90
167
|
|
|
91
|
-
export { type
|
|
168
|
+
export { type ChipVariantProps } from './styles';
|
|
@@ -1,52 +1,266 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
1
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
|
|
4
|
+
|
|
5
|
+
const chipInteractiveRoot = [
|
|
6
|
+
TRANSITION_COLORS,
|
|
7
|
+
'data-[disabled=true]:opacity-[var(--opacity-disabled)]',
|
|
8
|
+
DISABLED_CURSOR,
|
|
9
|
+
Platform.select({
|
|
10
|
+
web: [
|
|
11
|
+
'outline-none',
|
|
12
|
+
'web:data-[focus-visible=true]:ring-2 web:data-[focus-visible=true]:ring-[var(--color-stroke-focus)] web:data-[focus-visible=true]:ring-offset-1',
|
|
13
|
+
].join(' '),
|
|
14
|
+
default: '',
|
|
15
|
+
}),
|
|
16
|
+
];
|
|
2
17
|
|
|
3
18
|
export const chipRootVariants = cva(
|
|
4
|
-
['flex-row items-center justify-center
|
|
19
|
+
['flex-row items-center justify-center self-start overflow-hidden', ...chipInteractiveRoot],
|
|
5
20
|
{
|
|
6
21
|
variants: {
|
|
22
|
+
variant: {
|
|
23
|
+
tint: [],
|
|
24
|
+
outline: ['bg-transparent', 'border'],
|
|
25
|
+
},
|
|
7
26
|
color: {
|
|
8
|
-
default:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
27
|
+
default: [],
|
|
28
|
+
action: [],
|
|
29
|
+
danger: [],
|
|
30
|
+
warning: [],
|
|
31
|
+
success: [],
|
|
32
|
+
info: [],
|
|
33
|
+
},
|
|
34
|
+
size: {
|
|
35
|
+
default: 'h-8 max-h-8 min-h-8 gap-1.5 px-3 rounded-lg',
|
|
36
|
+
small: 'h-6 max-h-6 min-h-6 gap-1 px-1.5 rounded-md',
|
|
37
|
+
xsmall: 'h-4 max-h-4 min-h-4 gap-0.5 px-1 rounded-sm',
|
|
13
38
|
},
|
|
14
39
|
},
|
|
40
|
+
compoundVariants: [
|
|
41
|
+
// ── tint × color ────────────────────────────────────────────────────
|
|
42
|
+
{
|
|
43
|
+
variant: 'tint',
|
|
44
|
+
color: 'default',
|
|
45
|
+
className: [
|
|
46
|
+
'bg-surface-neutral-tint',
|
|
47
|
+
Platform.select({
|
|
48
|
+
default: 'data-[active=true]:bg-surface-neutral-tint-active',
|
|
49
|
+
web: 'data-[hover=true]:bg-surface-neutral-tint-hover data-[active=true]:data-[hover=true]:bg-surface-neutral-tint-active',
|
|
50
|
+
}),
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
variant: 'tint',
|
|
55
|
+
color: 'action',
|
|
56
|
+
className: [
|
|
57
|
+
'bg-surface-action-tint',
|
|
58
|
+
Platform.select({
|
|
59
|
+
default: 'data-[active=true]:bg-surface-action-tint-active',
|
|
60
|
+
web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active',
|
|
61
|
+
}),
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
variant: 'tint',
|
|
66
|
+
color: 'danger',
|
|
67
|
+
className: [
|
|
68
|
+
'bg-surface-danger-tint',
|
|
69
|
+
Platform.select({
|
|
70
|
+
default: 'data-[active=true]:bg-surface-danger-tint-active',
|
|
71
|
+
web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-tint-active',
|
|
72
|
+
}),
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
variant: 'tint',
|
|
77
|
+
color: 'warning',
|
|
78
|
+
className: [
|
|
79
|
+
'bg-surface-warning-tint',
|
|
80
|
+
Platform.select({
|
|
81
|
+
default: 'data-[active=true]:bg-surface-warning-tint-active',
|
|
82
|
+
web: 'data-[hover=true]:bg-surface-warning-tint-hover data-[active=true]:data-[hover=true]:bg-surface-warning-tint-active',
|
|
83
|
+
}),
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
variant: 'tint',
|
|
88
|
+
color: 'success',
|
|
89
|
+
className: [
|
|
90
|
+
'bg-surface-success-tint',
|
|
91
|
+
Platform.select({
|
|
92
|
+
default: 'data-[active=true]:bg-surface-success-tint-active',
|
|
93
|
+
web: 'data-[hover=true]:bg-surface-success-tint-hover data-[active=true]:data-[hover=true]:bg-surface-success-tint-active',
|
|
94
|
+
}),
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
variant: 'tint',
|
|
99
|
+
color: 'info',
|
|
100
|
+
className: [
|
|
101
|
+
'bg-surface-info-tint',
|
|
102
|
+
Platform.select({
|
|
103
|
+
default: 'data-[active=true]:bg-surface-info-tint-active',
|
|
104
|
+
web: 'data-[hover=true]:bg-surface-info-tint-hover data-[active=true]:data-[hover=true]:bg-surface-info-tint-active',
|
|
105
|
+
}),
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
// ── outline × color ───────────────────────────────────────────────────
|
|
110
|
+
{
|
|
111
|
+
variant: 'outline',
|
|
112
|
+
color: 'default',
|
|
113
|
+
className: [
|
|
114
|
+
'border-stroke-primary',
|
|
115
|
+
Platform.select({
|
|
116
|
+
default: 'data-[active=true]:bg-surface-neutral-tint',
|
|
117
|
+
web: 'data-[hover=true]:bg-surface-neutral-tint-hover data-[active=true]:data-[hover=true]:bg-surface-neutral-tint-active',
|
|
118
|
+
}),
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
variant: 'outline',
|
|
123
|
+
color: 'action',
|
|
124
|
+
className: [
|
|
125
|
+
'border-stroke-action',
|
|
126
|
+
Platform.select({
|
|
127
|
+
default: 'data-[active=true]:bg-surface-action-tint',
|
|
128
|
+
web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active',
|
|
129
|
+
}),
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
variant: 'outline',
|
|
134
|
+
color: 'danger',
|
|
135
|
+
className: [
|
|
136
|
+
'border-stroke-danger',
|
|
137
|
+
Platform.select({
|
|
138
|
+
default: 'data-[active=true]:bg-surface-danger-tint',
|
|
139
|
+
web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-tint-active',
|
|
140
|
+
}),
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
variant: 'outline',
|
|
145
|
+
color: 'warning',
|
|
146
|
+
className: [
|
|
147
|
+
'border-stroke-warning',
|
|
148
|
+
Platform.select({
|
|
149
|
+
default: 'data-[active=true]:bg-surface-warning-tint',
|
|
150
|
+
web: 'data-[hover=true]:bg-surface-warning-tint-hover data-[active=true]:data-[hover=true]:bg-surface-warning-tint-active',
|
|
151
|
+
}),
|
|
152
|
+
],
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
variant: 'outline',
|
|
156
|
+
color: 'success',
|
|
157
|
+
className: [
|
|
158
|
+
'border-stroke-success',
|
|
159
|
+
Platform.select({
|
|
160
|
+
default: 'data-[active=true]:bg-surface-success-tint',
|
|
161
|
+
web: 'data-[hover=true]:bg-surface-success-tint-hover data-[active=true]:data-[hover=true]:bg-surface-success-tint-active',
|
|
162
|
+
}),
|
|
163
|
+
],
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
variant: 'outline',
|
|
167
|
+
color: 'info',
|
|
168
|
+
className: [
|
|
169
|
+
'border-stroke-info',
|
|
170
|
+
Platform.select({
|
|
171
|
+
default: 'data-[active=true]:bg-surface-info-tint',
|
|
172
|
+
web: 'data-[hover=true]:bg-surface-info-tint-hover data-[active=true]:data-[hover=true]:bg-surface-info-tint-active',
|
|
173
|
+
}),
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
],
|
|
15
177
|
defaultVariants: {
|
|
178
|
+
variant: 'tint',
|
|
16
179
|
color: 'default',
|
|
180
|
+
size: 'default',
|
|
17
181
|
},
|
|
18
182
|
},
|
|
19
183
|
);
|
|
20
184
|
|
|
21
|
-
|
|
22
|
-
export const chipLabelVariants = cva(['label-sm font-mono-medium'], {
|
|
185
|
+
export const chipLabelVariants = cva(['font-medium'], {
|
|
23
186
|
variants: {
|
|
187
|
+
variant: {
|
|
188
|
+
tint: 'text-content-primary',
|
|
189
|
+
outline: 'text-content-primary',
|
|
190
|
+
},
|
|
24
191
|
color: {
|
|
25
|
-
default:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
192
|
+
default: [],
|
|
193
|
+
action: [],
|
|
194
|
+
danger: [],
|
|
195
|
+
warning: [],
|
|
196
|
+
success: [],
|
|
197
|
+
info: [],
|
|
198
|
+
},
|
|
199
|
+
size: {
|
|
200
|
+
default: 'body-md',
|
|
201
|
+
small: 'body-sm',
|
|
202
|
+
xsmall: 'body-xs',
|
|
30
203
|
},
|
|
31
204
|
},
|
|
205
|
+
compoundVariants: [
|
|
206
|
+
{ variant: 'outline', color: 'action', className: 'text-content-action' },
|
|
207
|
+
{ variant: 'outline', color: 'danger', className: 'text-content-danger' },
|
|
208
|
+
{ variant: 'outline', color: 'warning', className: 'text-content-warning' },
|
|
209
|
+
{ variant: 'outline', color: 'success', className: 'text-content-success' },
|
|
210
|
+
{ variant: 'outline', color: 'info', className: 'text-content-info' },
|
|
211
|
+
],
|
|
32
212
|
defaultVariants: {
|
|
213
|
+
variant: 'tint',
|
|
33
214
|
color: 'default',
|
|
215
|
+
size: 'default',
|
|
34
216
|
},
|
|
35
217
|
});
|
|
36
218
|
|
|
37
|
-
export const chipIconVariants = cva(['
|
|
219
|
+
export const chipIconVariants = cva(['shrink-0'], {
|
|
38
220
|
variants: {
|
|
221
|
+
size: {
|
|
222
|
+
default: 'size-5',
|
|
223
|
+
small: 'size-4',
|
|
224
|
+
xsmall: 'size-2.5',
|
|
225
|
+
},
|
|
39
226
|
color: {
|
|
40
227
|
default: 'text-content-primary',
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
success: 'text-content-success',
|
|
228
|
+
action: 'text-content-action',
|
|
229
|
+
danger: 'text-content-danger',
|
|
44
230
|
warning: 'text-content-warning',
|
|
231
|
+
success: 'text-content-success',
|
|
232
|
+
info: 'text-content-info',
|
|
233
|
+
},
|
|
234
|
+
slot: {
|
|
235
|
+
leading: '',
|
|
236
|
+
trailing: '',
|
|
45
237
|
},
|
|
46
238
|
},
|
|
239
|
+
compoundVariants: [
|
|
240
|
+
{ slot: 'leading', size: 'default', className: '-ml-1.5' },
|
|
241
|
+
{ slot: 'leading', size: 'small', className: '-ml-0.5' },
|
|
242
|
+
{ slot: 'leading', size: 'xsmall', className: '-ml-px' },
|
|
243
|
+
{ slot: 'trailing', size: 'default', className: '-mr-1.5' },
|
|
244
|
+
{ slot: 'trailing', size: 'small', className: '-mr-0.5' },
|
|
245
|
+
{ slot: 'trailing', size: 'xsmall', className: '-mr-px' },
|
|
246
|
+
],
|
|
47
247
|
defaultVariants: {
|
|
248
|
+
size: 'default',
|
|
48
249
|
color: 'default',
|
|
49
250
|
},
|
|
50
251
|
});
|
|
51
252
|
|
|
52
|
-
export
|
|
253
|
+
export const chipAvatarVariants = cva(['shrink-0 rounded-full overflow-hidden'], {
|
|
254
|
+
variants: {
|
|
255
|
+
size: {
|
|
256
|
+
default: 'size-5 -ml-1.5',
|
|
257
|
+
small: 'size-4 -ml-0.5',
|
|
258
|
+
xsmall: 'size-2.5 -ml-px',
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
defaultVariants: {
|
|
262
|
+
size: 'default',
|
|
263
|
+
},
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
export type ChipVariantProps = VariantProps<typeof chipRootVariants>;
|