@cdx-ui/components 0.0.1-beta.37 → 0.0.1-beta.39
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/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/Chip.figma.js +68 -0
- package/lib/commonjs/figma/Chip.figma.js.map +1 -0
- 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/Chip.figma.js +62 -0
- package/lib/module/figma/Chip.figma.js.map +1 -0
- 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/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/Chip/index.tsx +104 -27
- package/src/components/Chip/styles.ts +232 -18
|
@@ -1,44 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { Pressable, Text as RNText, View } from 'react-native';
|
|
5
|
+
import { createChip } from '@cdx-ui/primitives';
|
|
6
|
+
import { cn, ParentContext, useParentContext, useStyleContext, withStyleContext } from '@cdx-ui/utils';
|
|
7
|
+
import { Avatar } from '../Avatar';
|
|
6
8
|
import { Icon } from '../Icon';
|
|
7
|
-
import {
|
|
9
|
+
import { chipAvatarVariants, chipIconVariants, chipLabelVariants, chipRootVariants } from './styles';
|
|
8
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
11
|
const SCOPE = 'CHIP';
|
|
10
|
-
const
|
|
12
|
+
const RootView = withStyleContext(View, SCOPE);
|
|
13
|
+
const RootPressable = withStyleContext(Pressable, SCOPE);
|
|
14
|
+
const ChipPrimitive = createChip({
|
|
15
|
+
View: RootView,
|
|
16
|
+
Pressable: RootPressable
|
|
17
|
+
});
|
|
11
18
|
const useChipStyleContext = () => useStyleContext(SCOPE);
|
|
12
19
|
|
|
13
20
|
// =============================================================================
|
|
14
|
-
//
|
|
21
|
+
// ROOT
|
|
15
22
|
// =============================================================================
|
|
16
23
|
|
|
17
24
|
const ChipRoot = /*#__PURE__*/forwardRef(({
|
|
18
25
|
children,
|
|
26
|
+
variant = 'tint',
|
|
27
|
+
size = 'default',
|
|
19
28
|
color = 'default',
|
|
20
29
|
className,
|
|
21
30
|
style,
|
|
31
|
+
asChild,
|
|
22
32
|
...props
|
|
23
33
|
}, ref) => {
|
|
34
|
+
const parentContextValues = useParentContext();
|
|
35
|
+
const styleContextValues = useMemo(() => ({
|
|
36
|
+
...parentContextValues,
|
|
37
|
+
[SCOPE]: {
|
|
38
|
+
variant,
|
|
39
|
+
size,
|
|
40
|
+
color
|
|
41
|
+
}
|
|
42
|
+
}), [parentContextValues, variant, size, color]);
|
|
24
43
|
const computedClassName = cn(chipRootVariants({
|
|
44
|
+
variant,
|
|
45
|
+
size,
|
|
25
46
|
color
|
|
26
47
|
}), className);
|
|
27
|
-
|
|
48
|
+
const root = /*#__PURE__*/_jsx(ChipPrimitive, {
|
|
28
49
|
ref: ref,
|
|
50
|
+
asChild: asChild,
|
|
29
51
|
className: computedClassName,
|
|
30
|
-
style: style,
|
|
31
52
|
context: {
|
|
53
|
+
variant,
|
|
54
|
+
size,
|
|
32
55
|
color
|
|
33
56
|
},
|
|
57
|
+
style: style,
|
|
34
58
|
...props,
|
|
35
59
|
children: children
|
|
36
60
|
});
|
|
61
|
+
if (asChild) {
|
|
62
|
+
return /*#__PURE__*/_jsx(ParentContext.Provider, {
|
|
63
|
+
value: styleContextValues,
|
|
64
|
+
children: root
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return root;
|
|
37
68
|
});
|
|
38
69
|
ChipRoot.displayName = 'Chip';
|
|
39
70
|
|
|
40
71
|
// =============================================================================
|
|
41
|
-
//
|
|
72
|
+
// LABEL
|
|
42
73
|
// =============================================================================
|
|
43
74
|
|
|
44
75
|
const ChipLabel = /*#__PURE__*/forwardRef(({
|
|
@@ -48,9 +79,13 @@ const ChipLabel = /*#__PURE__*/forwardRef(({
|
|
|
48
79
|
...props
|
|
49
80
|
}, ref) => {
|
|
50
81
|
const {
|
|
82
|
+
size,
|
|
83
|
+
variant,
|
|
51
84
|
color
|
|
52
85
|
} = useChipStyleContext();
|
|
53
86
|
const computedClassName = cn(chipLabelVariants({
|
|
87
|
+
size,
|
|
88
|
+
variant,
|
|
54
89
|
color
|
|
55
90
|
}), className);
|
|
56
91
|
return /*#__PURE__*/_jsx(RNText, {
|
|
@@ -64,20 +99,24 @@ const ChipLabel = /*#__PURE__*/forwardRef(({
|
|
|
64
99
|
ChipLabel.displayName = 'Chip.Label';
|
|
65
100
|
|
|
66
101
|
// =============================================================================
|
|
67
|
-
//
|
|
102
|
+
// ICON
|
|
68
103
|
// =============================================================================
|
|
69
104
|
|
|
70
105
|
const ChipIcon = ({
|
|
71
106
|
className,
|
|
72
107
|
style,
|
|
73
108
|
as,
|
|
109
|
+
slot,
|
|
74
110
|
...props
|
|
75
111
|
}) => {
|
|
76
112
|
const {
|
|
113
|
+
size,
|
|
77
114
|
color
|
|
78
115
|
} = useChipStyleContext();
|
|
79
116
|
const computedClassName = cn(chipIconVariants({
|
|
80
|
-
|
|
117
|
+
size,
|
|
118
|
+
color,
|
|
119
|
+
slot
|
|
81
120
|
}), className);
|
|
82
121
|
return /*#__PURE__*/_jsx(Icon, {
|
|
83
122
|
as: as,
|
|
@@ -89,11 +128,41 @@ const ChipIcon = ({
|
|
|
89
128
|
ChipIcon.displayName = 'Chip.Icon';
|
|
90
129
|
|
|
91
130
|
// =============================================================================
|
|
92
|
-
//
|
|
131
|
+
// AVATAR
|
|
132
|
+
// =============================================================================
|
|
133
|
+
|
|
134
|
+
const ChipAvatar = ({
|
|
135
|
+
className,
|
|
136
|
+
style,
|
|
137
|
+
children,
|
|
138
|
+
...props
|
|
139
|
+
}) => {
|
|
140
|
+
const {
|
|
141
|
+
size
|
|
142
|
+
} = useChipStyleContext();
|
|
143
|
+
// chipAvatarVariants sets w/h and the leading slot negative margin.
|
|
144
|
+
// Avatar renders with size="sm" (its smallest named size) but chipAvatarVariants
|
|
145
|
+
// overrides the w/h via tailwind-merge so the chip size wins.
|
|
146
|
+
const computedClassName = cn(chipAvatarVariants({
|
|
147
|
+
size
|
|
148
|
+
}), className);
|
|
149
|
+
return /*#__PURE__*/_jsx(Avatar, {
|
|
150
|
+
size: "sm",
|
|
151
|
+
className: computedClassName,
|
|
152
|
+
style: style,
|
|
153
|
+
...props,
|
|
154
|
+
children: children
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
ChipAvatar.displayName = 'Chip.Avatar';
|
|
158
|
+
|
|
159
|
+
// =============================================================================
|
|
160
|
+
// COMPOUND EXPORT
|
|
93
161
|
// =============================================================================
|
|
94
162
|
|
|
95
163
|
export const Chip = Object.assign(ChipRoot, {
|
|
96
164
|
Label: ChipLabel,
|
|
97
|
-
Icon: ChipIcon
|
|
165
|
+
Icon: ChipIcon,
|
|
166
|
+
Avatar: ChipAvatar
|
|
98
167
|
});
|
|
99
168
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["forwardRef","
|
|
1
|
+
{"version":3,"names":["forwardRef","useMemo","Pressable","Text","RNText","View","createChip","cn","ParentContext","useParentContext","useStyleContext","withStyleContext","Avatar","Icon","chipAvatarVariants","chipIconVariants","chipLabelVariants","chipRootVariants","jsx","_jsx","SCOPE","RootView","RootPressable","ChipPrimitive","useChipStyleContext","ChipRoot","children","variant","size","color","className","style","asChild","props","ref","parentContextValues","styleContextValues","computedClassName","root","context","Provider","value","displayName","ChipLabel","ChipIcon","as","slot","ChipAvatar","Chip","Object","assign","Label"],"sourceRoot":"../../../../src","sources":["components/Chip/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,OAAO,QAAwB,OAAO;AAC3D,SAASC,SAAS,EAAEC,IAAI,IAAIC,MAAM,EAAEC,IAAI,QAAwB,cAAc;AAC9E,SAASC,UAAU,QAAyB,oBAAoB;AAChE,SACEC,EAAE,EACFC,aAAa,EACbC,gBAAgB,EAChBC,eAAe,EACfC,gBAAgB,QAEX,eAAe;AACtB,SAASC,MAAM,QAA0B,WAAW;AACpD,SAASC,IAAI,QAAwB,SAAS;AAC9C,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,QAEX,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElB,MAAMC,KAAK,GAAG,MAAM;AAEpB,MAAMC,QAAQ,GAAGV,gBAAgB,CAACN,IAAI,EAAEe,KAAK,CAAC;AAC9C,MAAME,aAAa,GAAGX,gBAAgB,CAACT,SAAS,EAAEkB,KAAK,CAAC;AAExD,MAAMG,aAAa,GAAGjB,UAAU,CAAC;EAC/BD,IAAI,EAAEgB,QAAQ;EACdnB,SAAS,EAAEoB;AACb,CAAC,CAAC;AAEF,MAAME,mBAAmB,GAAGA,CAAA,KAAMd,eAAe,CAACU,KAAK,CAAqB;;AAE5E;AACA;AACA;;AAOA,MAAMK,QAAQ,gBAAGzB,UAAU,CACzB,CACE;EACE0B,QAAQ;EACRC,OAAO,GAAG,MAAM;EAChBC,IAAI,GAAG,SAAS;EAChBC,KAAK,GAAG,SAAS;EACjBC,SAAS;EACTC,KAAK;EACLC,OAAO;EACP,GAAGC;AACL,CAAC,EACDC,GAAG,KACA;EACH,MAAMC,mBAAmB,GAAG1B,gBAAgB,CAAC,CAAC;EAC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qB,UAAU,CAACL,WAAW,GAAG,aAAa;;AAEtC;AACA;AACA;;AAQA,OAAO,MAAMM,IAAI,GAAGC,MAAM,CAACC,MAAM,CAACzB,QAAQ,EAAE;EAC1C0B,KAAK,EAAER,SAAS;EAChB9B,IAAI,EAAE+B,QAAQ;EACdhC,MAAM,EAAEmC;AACV,CAAC,CAA0B","ignoreList":[]}
|
|
@@ -1,48 +1,234 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { Platform } from 'react-native';
|
|
3
4
|
import { cva } from 'class-variance-authority';
|
|
4
|
-
|
|
5
|
+
import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
|
|
6
|
+
const chipInteractiveRoot = [TRANSITION_COLORS, 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', DISABLED_CURSOR, Platform.select({
|
|
7
|
+
web: ['outline-none', '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'].join(' '),
|
|
8
|
+
default: ''
|
|
9
|
+
})];
|
|
10
|
+
export const chipRootVariants = cva(['flex-row items-center justify-center self-start overflow-hidden', ...chipInteractiveRoot], {
|
|
5
11
|
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
tint: [],
|
|
14
|
+
outline: ['bg-transparent', 'border']
|
|
15
|
+
},
|
|
6
16
|
color: {
|
|
7
|
-
default:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
default: [],
|
|
18
|
+
action: [],
|
|
19
|
+
danger: [],
|
|
20
|
+
warning: [],
|
|
21
|
+
success: [],
|
|
22
|
+
info: []
|
|
23
|
+
},
|
|
24
|
+
size: {
|
|
25
|
+
default: 'h-8 max-h-8 min-h-8 gap-1.5 px-3 rounded-lg',
|
|
26
|
+
small: 'h-6 max-h-6 min-h-6 gap-1 px-1.5 rounded-md',
|
|
27
|
+
xsmall: 'h-4 max-h-4 min-h-4 gap-0.5 px-1 rounded-sm'
|
|
12
28
|
}
|
|
13
29
|
},
|
|
30
|
+
compoundVariants: [
|
|
31
|
+
// ── tint × color ────────────────────────────────────────────────────
|
|
32
|
+
{
|
|
33
|
+
variant: 'tint',
|
|
34
|
+
color: 'default',
|
|
35
|
+
className: ['bg-surface-neutral-tint', Platform.select({
|
|
36
|
+
default: 'data-[active=true]:bg-surface-neutral-tint-active',
|
|
37
|
+
web: 'data-[hover=true]:bg-surface-neutral-tint-hover data-[active=true]:data-[hover=true]:bg-surface-neutral-tint-active'
|
|
38
|
+
})]
|
|
39
|
+
}, {
|
|
40
|
+
variant: 'tint',
|
|
41
|
+
color: 'action',
|
|
42
|
+
className: ['bg-surface-action-tint', Platform.select({
|
|
43
|
+
default: 'data-[active=true]:bg-surface-action-tint-active',
|
|
44
|
+
web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active'
|
|
45
|
+
})]
|
|
46
|
+
}, {
|
|
47
|
+
variant: 'tint',
|
|
48
|
+
color: 'danger',
|
|
49
|
+
className: ['bg-surface-danger-tint', Platform.select({
|
|
50
|
+
default: 'data-[active=true]:bg-surface-danger-tint-active',
|
|
51
|
+
web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-tint-active'
|
|
52
|
+
})]
|
|
53
|
+
}, {
|
|
54
|
+
variant: 'tint',
|
|
55
|
+
color: 'warning',
|
|
56
|
+
className: ['bg-surface-warning-tint', Platform.select({
|
|
57
|
+
default: 'data-[active=true]:bg-surface-warning-tint-active',
|
|
58
|
+
web: 'data-[hover=true]:bg-surface-warning-tint-hover data-[active=true]:data-[hover=true]:bg-surface-warning-tint-active'
|
|
59
|
+
})]
|
|
60
|
+
}, {
|
|
61
|
+
variant: 'tint',
|
|
62
|
+
color: 'success',
|
|
63
|
+
className: ['bg-surface-success-tint', Platform.select({
|
|
64
|
+
default: 'data-[active=true]:bg-surface-success-tint-active',
|
|
65
|
+
web: 'data-[hover=true]:bg-surface-success-tint-hover data-[active=true]:data-[hover=true]:bg-surface-success-tint-active'
|
|
66
|
+
})]
|
|
67
|
+
}, {
|
|
68
|
+
variant: 'tint',
|
|
69
|
+
color: 'info',
|
|
70
|
+
className: ['bg-surface-info-tint', Platform.select({
|
|
71
|
+
default: 'data-[active=true]:bg-surface-info-tint-active',
|
|
72
|
+
web: 'data-[hover=true]:bg-surface-info-tint-hover data-[active=true]:data-[hover=true]:bg-surface-info-tint-active'
|
|
73
|
+
})]
|
|
74
|
+
},
|
|
75
|
+
// ── outline × color ───────────────────────────────────────────────────
|
|
76
|
+
{
|
|
77
|
+
variant: 'outline',
|
|
78
|
+
color: 'default',
|
|
79
|
+
className: ['border-stroke-primary', Platform.select({
|
|
80
|
+
default: 'data-[active=true]:bg-surface-neutral-tint',
|
|
81
|
+
web: 'data-[hover=true]:bg-surface-neutral-tint-hover data-[active=true]:data-[hover=true]:bg-surface-neutral-tint-active'
|
|
82
|
+
})]
|
|
83
|
+
}, {
|
|
84
|
+
variant: 'outline',
|
|
85
|
+
color: 'action',
|
|
86
|
+
className: ['border-stroke-action', Platform.select({
|
|
87
|
+
default: 'data-[active=true]:bg-surface-action-tint',
|
|
88
|
+
web: 'data-[hover=true]:bg-surface-action-tint-hover data-[active=true]:data-[hover=true]:bg-surface-action-tint-active'
|
|
89
|
+
})]
|
|
90
|
+
}, {
|
|
91
|
+
variant: 'outline',
|
|
92
|
+
color: 'danger',
|
|
93
|
+
className: ['border-stroke-danger', Platform.select({
|
|
94
|
+
default: 'data-[active=true]:bg-surface-danger-tint',
|
|
95
|
+
web: 'data-[hover=true]:bg-surface-danger-tint-hover data-[active=true]:data-[hover=true]:bg-surface-danger-tint-active'
|
|
96
|
+
})]
|
|
97
|
+
}, {
|
|
98
|
+
variant: 'outline',
|
|
99
|
+
color: 'warning',
|
|
100
|
+
className: ['border-stroke-warning', Platform.select({
|
|
101
|
+
default: 'data-[active=true]:bg-surface-warning-tint',
|
|
102
|
+
web: 'data-[hover=true]:bg-surface-warning-tint-hover data-[active=true]:data-[hover=true]:bg-surface-warning-tint-active'
|
|
103
|
+
})]
|
|
104
|
+
}, {
|
|
105
|
+
variant: 'outline',
|
|
106
|
+
color: 'success',
|
|
107
|
+
className: ['border-stroke-success', Platform.select({
|
|
108
|
+
default: 'data-[active=true]:bg-surface-success-tint',
|
|
109
|
+
web: 'data-[hover=true]:bg-surface-success-tint-hover data-[active=true]:data-[hover=true]:bg-surface-success-tint-active'
|
|
110
|
+
})]
|
|
111
|
+
}, {
|
|
112
|
+
variant: 'outline',
|
|
113
|
+
color: 'info',
|
|
114
|
+
className: ['border-stroke-info', Platform.select({
|
|
115
|
+
default: 'data-[active=true]:bg-surface-info-tint',
|
|
116
|
+
web: 'data-[hover=true]:bg-surface-info-tint-hover data-[active=true]:data-[hover=true]:bg-surface-info-tint-active'
|
|
117
|
+
})]
|
|
118
|
+
}],
|
|
14
119
|
defaultVariants: {
|
|
15
|
-
|
|
120
|
+
variant: 'tint',
|
|
121
|
+
color: 'default',
|
|
122
|
+
size: 'default'
|
|
16
123
|
}
|
|
17
124
|
});
|
|
18
|
-
|
|
19
|
-
// TODO: letter-spacing values (tracking-wider) are not working on web, but the font-mono-medium is.
|
|
20
|
-
export const chipLabelVariants = cva(['label-sm font-mono-medium'], {
|
|
125
|
+
export const chipLabelVariants = cva(['font-medium'], {
|
|
21
126
|
variants: {
|
|
127
|
+
variant: {
|
|
128
|
+
tint: 'text-content-primary',
|
|
129
|
+
outline: 'text-content-primary'
|
|
130
|
+
},
|
|
22
131
|
color: {
|
|
23
|
-
default:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
132
|
+
default: [],
|
|
133
|
+
action: [],
|
|
134
|
+
danger: [],
|
|
135
|
+
warning: [],
|
|
136
|
+
success: [],
|
|
137
|
+
info: []
|
|
138
|
+
},
|
|
139
|
+
size: {
|
|
140
|
+
default: 'body-md',
|
|
141
|
+
small: 'body-sm',
|
|
142
|
+
xsmall: 'body-xs'
|
|
28
143
|
}
|
|
29
144
|
},
|
|
145
|
+
compoundVariants: [{
|
|
146
|
+
variant: 'outline',
|
|
147
|
+
color: 'action',
|
|
148
|
+
className: 'text-content-action'
|
|
149
|
+
}, {
|
|
150
|
+
variant: 'outline',
|
|
151
|
+
color: 'danger',
|
|
152
|
+
className: 'text-content-danger'
|
|
153
|
+
}, {
|
|
154
|
+
variant: 'outline',
|
|
155
|
+
color: 'warning',
|
|
156
|
+
className: 'text-content-warning'
|
|
157
|
+
}, {
|
|
158
|
+
variant: 'outline',
|
|
159
|
+
color: 'success',
|
|
160
|
+
className: 'text-content-success'
|
|
161
|
+
}, {
|
|
162
|
+
variant: 'outline',
|
|
163
|
+
color: 'info',
|
|
164
|
+
className: 'text-content-info'
|
|
165
|
+
}],
|
|
30
166
|
defaultVariants: {
|
|
31
|
-
|
|
167
|
+
variant: 'tint',
|
|
168
|
+
color: 'default',
|
|
169
|
+
size: 'default'
|
|
32
170
|
}
|
|
33
171
|
});
|
|
34
|
-
export const chipIconVariants = cva(['
|
|
172
|
+
export const chipIconVariants = cva(['shrink-0'], {
|
|
35
173
|
variants: {
|
|
174
|
+
size: {
|
|
175
|
+
default: 'size-5',
|
|
176
|
+
small: 'size-4',
|
|
177
|
+
xsmall: 'size-2.5'
|
|
178
|
+
},
|
|
36
179
|
color: {
|
|
37
180
|
default: 'text-content-primary',
|
|
38
|
-
|
|
39
|
-
|
|
181
|
+
action: 'text-content-action',
|
|
182
|
+
danger: 'text-content-danger',
|
|
183
|
+
warning: 'text-content-warning',
|
|
40
184
|
success: 'text-content-success',
|
|
41
|
-
|
|
185
|
+
info: 'text-content-info'
|
|
186
|
+
},
|
|
187
|
+
slot: {
|
|
188
|
+
leading: '',
|
|
189
|
+
trailing: ''
|
|
42
190
|
}
|
|
43
191
|
},
|
|
192
|
+
compoundVariants: [{
|
|
193
|
+
slot: 'leading',
|
|
194
|
+
size: 'default',
|
|
195
|
+
className: '-ml-1.5'
|
|
196
|
+
}, {
|
|
197
|
+
slot: 'leading',
|
|
198
|
+
size: 'small',
|
|
199
|
+
className: '-ml-0.5'
|
|
200
|
+
}, {
|
|
201
|
+
slot: 'leading',
|
|
202
|
+
size: 'xsmall',
|
|
203
|
+
className: '-ml-px'
|
|
204
|
+
}, {
|
|
205
|
+
slot: 'trailing',
|
|
206
|
+
size: 'default',
|
|
207
|
+
className: '-mr-1.5'
|
|
208
|
+
}, {
|
|
209
|
+
slot: 'trailing',
|
|
210
|
+
size: 'small',
|
|
211
|
+
className: '-mr-0.5'
|
|
212
|
+
}, {
|
|
213
|
+
slot: 'trailing',
|
|
214
|
+
size: 'xsmall',
|
|
215
|
+
className: '-mr-px'
|
|
216
|
+
}],
|
|
44
217
|
defaultVariants: {
|
|
218
|
+
size: 'default',
|
|
45
219
|
color: 'default'
|
|
46
220
|
}
|
|
47
221
|
});
|
|
222
|
+
export const chipAvatarVariants = cva(['shrink-0 rounded-full overflow-hidden'], {
|
|
223
|
+
variants: {
|
|
224
|
+
size: {
|
|
225
|
+
default: 'size-5 -ml-1.5',
|
|
226
|
+
small: 'size-4 -ml-0.5',
|
|
227
|
+
xsmall: 'size-2.5 -ml-px'
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
defaultVariants: {
|
|
231
|
+
size: 'default'
|
|
232
|
+
}
|
|
233
|
+
});
|
|
48
234
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cva","chipRootVariants","variants","color","
|
|
1
|
+
{"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","chipInteractiveRoot","select","web","join","default","chipRootVariants","variants","variant","tint","outline","color","action","danger","warning","success","info","size","small","xsmall","compoundVariants","className","defaultVariants","chipLabelVariants","chipIconVariants","slot","leading","trailing","chipAvatarVariants"],"sourceRoot":"../../../../src","sources":["components/Chip/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;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AEI,SAAS,EAAE;EAAU,CAAC,EACxD;IAAEI,IAAI,EAAE,SAAS;IAAER,IAAI,EAAE,QAAQ;IAAEI,SAAS,EAAE;EAAS,CAAC,EACxD;IAAEI,IAAI,EAAE,UAAU;IAAER,IAAI,EAAE,SAAS;IAAEI,SAAS,EAAE;EAAU,CAAC,EAC3D;IAAEI,IAAI,EAAE,UAAU;IAAER,IAAI,EAAE,OAAO;IAAEI,SAAS,EAAE;EAAU,CAAC,EACzD;IAAEI,IAAI,EAAE,UAAU;IAAER,IAAI,EAAE,QAAQ;IAAEI,SAAS,EAAE;EAAS,CAAC,CAC1D;EACDC,eAAe,EAAE;IACfL,IAAI,EAAE,SAAS;IACfN,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,OAAO,MAAMiB,kBAAkB,GAAG9B,GAAG,CAAC,CAAC,uCAAuC,CAAC,EAAE;EAC/ES,QAAQ,EAAE;IACRU,IAAI,EAAE;MACJZ,OAAO,EAAE,gBAAgB;MACzBa,KAAK,EAAE,gBAAgB;MACvBC,MAAM,EAAE;IACV;EACF,CAAC;EACDG,eAAe,EAAE;IACfL,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// url=https://www.figma.com/design/0lEVMVlLj8ZS4fgItr3pmd/%E2%AD%90-Forge-DS--React-Native-Components?node-id=444-13403
|
|
4
|
+
// source=packages/components/src/components/Chip/index.tsx
|
|
5
|
+
// component=Chip
|
|
6
|
+
import figma from 'figma';
|
|
7
|
+
const instance = figma.selectedInstance;
|
|
8
|
+
const variant = instance.getEnum('variant', {
|
|
9
|
+
tint: 'tint',
|
|
10
|
+
outline: 'outline'
|
|
11
|
+
});
|
|
12
|
+
const size = instance.getEnum('size', {
|
|
13
|
+
default: 'default',
|
|
14
|
+
small: 'small',
|
|
15
|
+
xsmall: 'xsmall'
|
|
16
|
+
});
|
|
17
|
+
const color = instance.getEnum('color', {
|
|
18
|
+
default: 'default',
|
|
19
|
+
action: 'action',
|
|
20
|
+
danger: 'danger',
|
|
21
|
+
warning: 'warning',
|
|
22
|
+
success: 'success',
|
|
23
|
+
info: 'info'
|
|
24
|
+
});
|
|
25
|
+
const isDisabled = instance.getEnum('isDisabled', {
|
|
26
|
+
true: true,
|
|
27
|
+
false: undefined
|
|
28
|
+
});
|
|
29
|
+
const disabledProp = figma.helpers.react.renderProp('disabled', isDisabled);
|
|
30
|
+
const showLeadingIcon = instance.getBoolean('Show Leading Icon?');
|
|
31
|
+
const showAvatar = instance.getBoolean('Show Avatar?');
|
|
32
|
+
const showTrailingIcon = instance.getBoolean('Show Trailing Icon?');
|
|
33
|
+
|
|
34
|
+
// INSTANCE_SWAP property names from Figma (Chip.LeadingIcon / Chip.TrailingIcon).
|
|
35
|
+
const leadingIconResult = showLeadingIcon && !showAvatar ? instance.getInstanceSwap('Chip.LeadingIcon')?.executeTemplate() : undefined;
|
|
36
|
+
const trailingIconResult = showTrailingIcon ? instance.getInstanceSwap('Chip.TrailingIcon')?.executeTemplate() : undefined;
|
|
37
|
+
const leadingIconName = leadingIconResult?.metadata?.props?.componentName;
|
|
38
|
+
const trailingIconName = trailingIconResult?.metadata?.props?.componentName;
|
|
39
|
+
const leadingIconSnippet = leadingIconName ?? leadingIconResult?.example;
|
|
40
|
+
const trailingIconSnippet = trailingIconName ?? trailingIconResult?.example;
|
|
41
|
+
const label = instance.findText('Chip.Label').textContent;
|
|
42
|
+
const iconImports = [];
|
|
43
|
+
if (showLeadingIcon && !showAvatar && leadingIconName) {
|
|
44
|
+
iconImports.push(`import { ${leadingIconName} } from '@cdx-ui/icons'`);
|
|
45
|
+
}
|
|
46
|
+
if (showTrailingIcon && trailingIconName) {
|
|
47
|
+
iconImports.push(`import { ${trailingIconName} } from '@cdx-ui/icons'`);
|
|
48
|
+
}
|
|
49
|
+
const avatarImport = showAvatar ? ["import { Avatar } from '@cdx-ui/components'"] : [];
|
|
50
|
+
export default {
|
|
51
|
+
id: 'chip',
|
|
52
|
+
imports: ["import { Chip } from '@cdx-ui/components'", ...avatarImport, ...iconImports],
|
|
53
|
+
example: figma.code`
|
|
54
|
+
<Chip variant="${variant}" size="${size}" color="${color}"${disabledProp}>
|
|
55
|
+
${showAvatar ? figma.code`<Chip.Avatar>
|
|
56
|
+
<Avatar.Image source={{ uri: '...' }} />
|
|
57
|
+
</Chip.Avatar>` : showLeadingIcon ? figma.code`<Chip.Icon as={${leadingIconSnippet}} slot="leading" />` : null}
|
|
58
|
+
<Chip.Label>${label}</Chip.Label>
|
|
59
|
+
${showTrailingIcon ? figma.code`<Chip.Icon as={${trailingIconSnippet}} slot="trailing" />` : null}
|
|
60
|
+
</Chip>`
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=Chip.figma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["figma","instance","selectedInstance","variant","getEnum","tint","outline","size","default","small","xsmall","color","action","danger","warning","success","info","isDisabled","true","false","undefined","disabledProp","helpers","react","renderProp","showLeadingIcon","getBoolean","showAvatar","showTrailingIcon","leadingIconResult","getInstanceSwap","executeTemplate","trailingIconResult","leadingIconName","metadata","props","componentName","trailingIconName","leadingIconSnippet","example","trailingIconSnippet","label","findText","textContent","iconImports","push","avatarImport","id","imports","code"],"sourceRoot":"../../../src","sources":["figma/Chip.figma.ts"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AAEzB,MAAMC,QAAQ,GAAGD,KAAK,CAACE,gBAAgB;AAEvC,MAAMC,OAAO,GAAGF,QAAQ,CAACG,OAAO,CAAC,SAAS,EAAE;EAC1CC,IAAI,EAAE,MAAM;EACZC,OAAO,EAAE;AACX,CAAC,CAAC;AACF,MAAMC,IAAI,GAAGN,QAAQ,CAACG,OAAO,CAAC,MAAM,EAAE;EACpCI,OAAO,EAAE,SAAS;EAClBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACV,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O,OAAO;AAE3E,MAAME,KAAK,GAAIxC,QAAQ,CAACyC,QAAQ,CAAC,YAAY,CAAC,CAAgCC,WAAW;AAEzF,MAAMC,WAAqB,GAAG,EAAE;AAChC,IAAInB,eAAe,IAAI,CAACE,UAAU,IAAIM,eAAe,EAAE;EACrDW,WAAW,CAACC,IAAI,CAAC,YAAYZ,eAAe,yBAAyB,CAAC;AACxE;AACA,IAAIL,gBAAgB,IAAIS,gBAAgB,EAAE;EACxCO,WAAW,CAACC,IAAI,CAAC,YAAYR,gBAAgB,yBAAyB,CAAC;AACzE;AACA,MAAMS,YAAY,GAAGnB,UAAU,GAAG,CAAC,6CAA6C,CAAC,GAAG,EAAE;AAEtF,eAAe;EACboB,EAAE,EAAE,MAAM;EACVC,OAAO,EAAE,CAAC,2CAA2C,EAAE,GAAGF,YAAY,EAAE,GAAGF,WAAW,CAAC;EACvFL,OAAO,EAAEvC,KAAK,CAACiD,IAAI;AACrB,iBAAiB9C,OAAO,WAAWI,IAAI,YAAYI,KAAK,IAAIU,YAAY;AACxE,IACIM,UAAU,GACN3B,KAAK,CAACiD,IAAI;AAClB;AACA,iBAAiB,GACTxB,eAAe,GACbzB,KAAK,CAACiD,IAAI,kBAAkBX,kBAAkB,qBAAqB,GACnE,IAAI;AACd,gBACgBG,KAAK;AACrB,IAAIb,gBAAgB,GAAG5B,KAAK,CAACiD,IAAI,kBAAkBT,mBAAmB,sBAAsB,GAAG,IAAI;AACnG;AACA,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Text as RNText, View, type TextProps } from 'react-native';
|
|
3
|
+
import { type IChipProps } from '@cdx-ui/primitives';
|
|
4
|
+
import { type WithStyleContextProps } from '@cdx-ui/utils';
|
|
5
|
+
import { type AvatarProps } from '../Avatar';
|
|
3
6
|
import { type IconProps } from '../Icon';
|
|
4
|
-
import {
|
|
5
|
-
export interface ChipProps extends
|
|
6
|
-
children?: ReactNode;
|
|
7
|
+
import { type ChipVariantProps } from './styles';
|
|
8
|
+
export interface ChipProps extends IChipProps, ChipVariantProps, WithStyleContextProps {
|
|
7
9
|
className?: string;
|
|
10
|
+
children?: ReactNode;
|
|
8
11
|
}
|
|
9
12
|
declare const ChipRoot: import("react").ForwardRefExoticComponent<ChipProps & import("react").RefAttributes<View>>;
|
|
10
13
|
export interface ChipLabelProps extends TextProps {
|
|
@@ -13,15 +16,25 @@ export interface ChipLabelProps extends TextProps {
|
|
|
13
16
|
}
|
|
14
17
|
declare const ChipLabel: import("react").ForwardRefExoticComponent<ChipLabelProps & import("react").RefAttributes<RNText>>;
|
|
15
18
|
export interface ChipIconProps extends Omit<IconProps, 'children'> {
|
|
19
|
+
/** Leading (default) or trailing slot — applies the correct negative margin offset. */
|
|
20
|
+
slot?: 'leading' | 'trailing';
|
|
21
|
+
className?: string;
|
|
16
22
|
}
|
|
17
23
|
declare const ChipIcon: {
|
|
18
|
-
({ className, style, as, ...props }: ChipIconProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
({ className, style, as, slot, ...props }: ChipIconProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
export interface ChipAvatarProps extends Omit<AvatarProps, 'size'> {
|
|
28
|
+
}
|
|
29
|
+
declare const ChipAvatar: {
|
|
30
|
+
({ className, style, children, ...props }: ChipAvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
19
31
|
displayName: string;
|
|
20
32
|
};
|
|
21
33
|
type ChipCompoundComponent = typeof ChipRoot & {
|
|
22
34
|
Label: typeof ChipLabel;
|
|
23
35
|
Icon: typeof ChipIcon;
|
|
36
|
+
Avatar: typeof ChipAvatar;
|
|
24
37
|
};
|
|
25
38
|
export declare const Chip: ChipCompoundComponent;
|
|
26
|
-
export { type
|
|
39
|
+
export { type ChipVariantProps } from './styles';
|
|
27
40
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EAAa,IAAI,IAAI,MAAM,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAML,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,UAAU,CAAC;AAkBlB,MAAM,WAAW,SAAU,SAAQ,UAAU,EAAE,gBAAgB,EAAE,qBAAqB;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,QAAA,MAAM,QAAQ,4FAyCb,CAAC;AAQF,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,QAAA,MAAM,SAAS,mGAWd,CAAC;AAQF,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAChE,uFAAuF;IACvF,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,QAAA,MAAM,QAAQ;+CAA8C,aAAa;;CAIxE,CAAC;AAQF,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC;CAAG;AAErE,QAAA,MAAM,UAAU;+CAA8C,eAAe;;CAY5E,CAAC;AAQF,KAAK,qBAAqB,GAAG,OAAO,QAAQ,GAAG;IAC7C,KAAK,EAAE,OAAO,SAAS,CAAC;IACxB,IAAI,EAAE,OAAO,QAAQ,CAAC;IACtB,MAAM,EAAE,OAAO,UAAU,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,IAAI,EAIX,qBAAqB,CAAC;AAE5B,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const chipRootVariants: (props?: ({
|
|
3
|
-
|
|
3
|
+
variant?: "outline" | "tint" | null | undefined;
|
|
4
|
+
color?: "action" | "danger" | "warning" | "success" | "info" | "default" | null | undefined;
|
|
5
|
+
size?: "small" | "default" | "xsmall" | null | undefined;
|
|
4
6
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
7
|
export declare const chipLabelVariants: (props?: ({
|
|
6
|
-
|
|
8
|
+
variant?: "outline" | "tint" | null | undefined;
|
|
9
|
+
color?: "action" | "danger" | "warning" | "success" | "info" | "default" | null | undefined;
|
|
10
|
+
size?: "small" | "default" | "xsmall" | null | undefined;
|
|
7
11
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
12
|
export declare const chipIconVariants: (props?: ({
|
|
9
|
-
|
|
13
|
+
size?: "small" | "default" | "xsmall" | null | undefined;
|
|
14
|
+
color?: "action" | "danger" | "warning" | "success" | "info" | "default" | null | undefined;
|
|
15
|
+
slot?: "leading" | "trailing" | null | undefined;
|
|
10
16
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
|
-
export
|
|
17
|
+
export declare const chipAvatarVariants: (props?: ({
|
|
18
|
+
size?: "small" | "default" | "xsmall" | null | undefined;
|
|
19
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
20
|
+
export type ChipVariantProps = VariantProps<typeof chipRootVariants>;
|
|
12
21
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip/styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Chip/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAgBlE,eAAO,MAAM,gBAAgB;;;;8EAqK5B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;;8EAgC5B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;8EAgC3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;8EAW7B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Chip.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAwD1B,wBAiBE"}
|