@avenue-ticketing/native 0.1.0
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 +9 -0
- package/dist/avatar.d.ts +75 -0
- package/dist/avatar.js +300 -0
- package/dist/avatar.js.map +1 -0
- package/dist/badge.d.ts +149 -0
- package/dist/badge.js +388 -0
- package/dist/badge.js.map +1 -0
- package/dist/button-group.d.ts +36 -0
- package/dist/button-group.js +186 -0
- package/dist/button-group.js.map +1 -0
- package/dist/button.d.ts +45 -0
- package/dist/button.js +357 -0
- package/dist/button.js.map +1 -0
- package/dist/checkbox.d.ts +31 -0
- package/dist/checkbox.js +212 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/date-picker.d.ts +50 -0
- package/dist/date-picker.js +755 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/dialog.d.ts +62 -0
- package/dist/dialog.js +325 -0
- package/dist/dialog.js.map +1 -0
- package/dist/dropdown.d.ts +85 -0
- package/dist/dropdown.js +977 -0
- package/dist/dropdown.js.map +1 -0
- package/dist/input-group-addon-context.d.ts +10 -0
- package/dist/input-group-addon-context.js +9 -0
- package/dist/input-group-addon-context.js.map +1 -0
- package/dist/input.d.ts +325 -0
- package/dist/input.js +7890 -0
- package/dist/input.js.map +1 -0
- package/dist/radio.d.ts +34 -0
- package/dist/radio.js +177 -0
- package/dist/radio.js.map +1 -0
- package/dist/sheet.d.ts +67 -0
- package/dist/sheet.js +277 -0
- package/dist/sheet.js.map +1 -0
- package/dist/slider.d.ts +22 -0
- package/dist/slider.js +197 -0
- package/dist/slider.js.map +1 -0
- package/dist/tabs.d.ts +69 -0
- package/dist/tabs.js +379 -0
- package/dist/tabs.js.map +1 -0
- package/dist/textarea.d.ts +23 -0
- package/dist/textarea.js +176 -0
- package/dist/textarea.js.map +1 -0
- package/dist/toast.d.ts +32 -0
- package/dist/toast.js +140 -0
- package/dist/toast.js.map +1 -0
- package/dist/toggle.d.ts +31 -0
- package/dist/toggle.js +205 -0
- package/dist/toggle.js.map +1 -0
- package/dist/tooltip.d.ts +44 -0
- package/dist/tooltip.js +293 -0
- package/dist/tooltip.js.map +1 -0
- package/package.json +93 -0
- package/theme-dark.css +362 -0
- package/theme.css +161 -0
package/dist/badge.js
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
import { Image } from 'react-native';
|
|
2
|
+
import { View, Pressable, Text } from 'react-native-css/components';
|
|
3
|
+
import Svg, { Circle } from 'react-native-svg';
|
|
4
|
+
import { XIcon } from 'phosphor-react-native/src/icons/X';
|
|
5
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
6
|
+
import { styled } from 'nativewind';
|
|
7
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
// ../../native/components/base/badges/badges.tsx
|
|
10
|
+
var twMerge = extendTailwindMerge({
|
|
11
|
+
extend: {
|
|
12
|
+
theme: {
|
|
13
|
+
text: ["display-xs", "display-sm", "display-md", "display-lg", "display-xl", "display-2xl"]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
var cx = twMerge;
|
|
18
|
+
function sortCx(classes) {
|
|
19
|
+
return classes;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// ../core/src/badge.ts
|
|
23
|
+
var BADGE_SIZES = ["sm", "md", "lg"];
|
|
24
|
+
var BADGE_COLORS = [
|
|
25
|
+
"gray",
|
|
26
|
+
"brand",
|
|
27
|
+
"error",
|
|
28
|
+
"warning",
|
|
29
|
+
"success",
|
|
30
|
+
"slate",
|
|
31
|
+
"sky",
|
|
32
|
+
"blue",
|
|
33
|
+
"indigo",
|
|
34
|
+
"purple",
|
|
35
|
+
"pink",
|
|
36
|
+
"orange"
|
|
37
|
+
];
|
|
38
|
+
var badgeTypes = {
|
|
39
|
+
pillColor: "pill-color",
|
|
40
|
+
badgeColor: "color",
|
|
41
|
+
badgeModern: "modern"
|
|
42
|
+
};
|
|
43
|
+
var badgeFilledColors = {
|
|
44
|
+
gray: {
|
|
45
|
+
root: "bg-utility-neutral-50 text-utility-neutral-700 ring-utility-neutral-200",
|
|
46
|
+
addon: "text-utility-neutral-500",
|
|
47
|
+
addonButton: "hover:bg-utility-neutral-100 text-utility-neutral-400 hover:text-utility-neutral-500"
|
|
48
|
+
},
|
|
49
|
+
brand: {
|
|
50
|
+
root: "bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-200",
|
|
51
|
+
addon: "text-utility-brand-500",
|
|
52
|
+
addonButton: "hover:bg-utility-brand-100 text-utility-brand-400 hover:text-utility-brand-500"
|
|
53
|
+
},
|
|
54
|
+
error: {
|
|
55
|
+
root: "bg-utility-red-50 text-utility-red-700 ring-utility-red-200",
|
|
56
|
+
addon: "text-utility-red-500",
|
|
57
|
+
addonButton: "hover:bg-utility-red-100 text-utility-red-400 hover:text-utility-red-500"
|
|
58
|
+
},
|
|
59
|
+
warning: {
|
|
60
|
+
root: "bg-utility-yellow-50 text-utility-yellow-700 ring-utility-yellow-200",
|
|
61
|
+
addon: "text-utility-yellow-500",
|
|
62
|
+
addonButton: "hover:bg-utility-yellow-100 text-utility-yellow-400 hover:text-utility-yellow-500"
|
|
63
|
+
},
|
|
64
|
+
success: {
|
|
65
|
+
root: "bg-utility-green-50 text-utility-green-700 ring-utility-green-200",
|
|
66
|
+
addon: "text-utility-green-500",
|
|
67
|
+
addonButton: "hover:bg-utility-green-100 text-utility-green-400 hover:text-utility-green-500"
|
|
68
|
+
},
|
|
69
|
+
slate: {
|
|
70
|
+
root: "bg-utility-slate-50 text-utility-slate-700 ring-utility-slate-200",
|
|
71
|
+
addon: "text-utility-slate-500",
|
|
72
|
+
addonButton: "hover:bg-utility-slate-100 text-utility-slate-400 hover:text-utility-slate-500"
|
|
73
|
+
},
|
|
74
|
+
sky: {
|
|
75
|
+
root: "bg-utility-sky-50 text-utility-sky-700 ring-utility-sky-200",
|
|
76
|
+
addon: "text-utility-sky-500",
|
|
77
|
+
addonButton: "hover:bg-utility-sky-100 text-utility-sky-400 hover:text-utility-sky-500"
|
|
78
|
+
},
|
|
79
|
+
blue: {
|
|
80
|
+
root: "bg-utility-blue-50 text-utility-blue-700 ring-utility-blue-200",
|
|
81
|
+
addon: "text-utility-blue-500",
|
|
82
|
+
addonButton: "hover:bg-utility-blue-100 text-utility-blue-400 hover:text-utility-blue-500"
|
|
83
|
+
},
|
|
84
|
+
indigo: {
|
|
85
|
+
root: "bg-utility-indigo-50 text-utility-indigo-700 ring-utility-indigo-200",
|
|
86
|
+
addon: "text-utility-indigo-500",
|
|
87
|
+
addonButton: "hover:bg-utility-indigo-100 text-utility-indigo-400 hover:text-utility-indigo-500"
|
|
88
|
+
},
|
|
89
|
+
purple: {
|
|
90
|
+
root: "bg-utility-purple-50 text-utility-purple-700 ring-utility-purple-200",
|
|
91
|
+
addon: "text-utility-purple-500",
|
|
92
|
+
addonButton: "hover:bg-utility-purple-100 text-utility-purple-400 hover:text-utility-purple-500"
|
|
93
|
+
},
|
|
94
|
+
pink: {
|
|
95
|
+
root: "bg-utility-pink-50 text-utility-pink-700 ring-utility-pink-200",
|
|
96
|
+
addon: "text-utility-pink-500",
|
|
97
|
+
addonButton: "hover:bg-utility-pink-100 text-utility-pink-400 hover:text-utility-pink-500"
|
|
98
|
+
},
|
|
99
|
+
orange: {
|
|
100
|
+
root: "bg-utility-orange-50 text-utility-orange-700 ring-utility-orange-200",
|
|
101
|
+
addon: "text-utility-orange-500",
|
|
102
|
+
addonButton: "hover:bg-utility-orange-100 text-utility-orange-400 hover:text-utility-orange-500"
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
var addonOnlyColors = Object.fromEntries(
|
|
106
|
+
Object.entries(badgeFilledColors).map(([key, value]) => [key, { root: "", addon: value.addon }])
|
|
107
|
+
);
|
|
108
|
+
var badgeWithPillTypes = {
|
|
109
|
+
[badgeTypes.pillColor]: {
|
|
110
|
+
common: "size-max flex-row items-center whitespace-nowrap rounded-full ring-1 ring-inset",
|
|
111
|
+
styles: badgeFilledColors
|
|
112
|
+
},
|
|
113
|
+
[badgeTypes.badgeColor]: {
|
|
114
|
+
common: "size-max flex-row items-center whitespace-nowrap rounded-md ring-1 ring-inset",
|
|
115
|
+
styles: badgeFilledColors
|
|
116
|
+
},
|
|
117
|
+
[badgeTypes.badgeModern]: {
|
|
118
|
+
common: "size-max flex-row items-center whitespace-nowrap rounded-full ring-1 ring-inset shadow-xs",
|
|
119
|
+
styles: {
|
|
120
|
+
gray: {
|
|
121
|
+
root: "bg-primary text-secondary ring-primary",
|
|
122
|
+
addon: "text-neutral-500",
|
|
123
|
+
addonButton: "hover:bg-utility-neutral-100 text-utility-neutral-400 hover:text-utility-neutral-500"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
var badgeWithBadgeTypes = {
|
|
129
|
+
[badgeTypes.pillColor]: {
|
|
130
|
+
common: "size-max flex-row items-center whitespace-nowrap rounded-full ring-1 ring-inset",
|
|
131
|
+
styles: badgeFilledColors
|
|
132
|
+
},
|
|
133
|
+
[badgeTypes.badgeColor]: {
|
|
134
|
+
common: "size-max flex-row items-center whitespace-nowrap rounded-md ring-1 ring-inset",
|
|
135
|
+
styles: badgeFilledColors
|
|
136
|
+
},
|
|
137
|
+
[badgeTypes.badgeModern]: {
|
|
138
|
+
common: "size-max flex-row items-center whitespace-nowrap rounded-full ring-1 ring-inset bg-primary text-secondary ring-primary shadow-xs",
|
|
139
|
+
styles: addonOnlyColors
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
var badgeStyles = sortCx({
|
|
143
|
+
pillSizes: {
|
|
144
|
+
sm: "py-0.5 px-2 text-xs font-semibold",
|
|
145
|
+
md: "py-0.5 px-2.5 text-sm font-semibold",
|
|
146
|
+
lg: "py-1 px-3 text-sm font-semibold"
|
|
147
|
+
},
|
|
148
|
+
badgeSizes: {
|
|
149
|
+
sm: "py-0.5 px-1.5 text-xs font-semibold",
|
|
150
|
+
md: "py-0.5 px-2 text-sm font-semibold",
|
|
151
|
+
lg: "py-1 px-2.5 text-sm font-semibold"
|
|
152
|
+
},
|
|
153
|
+
badgeColorSizes: {
|
|
154
|
+
sm: "py-0.5 px-1.5 text-xs font-semibold",
|
|
155
|
+
md: "py-0.5 px-2 text-sm font-semibold",
|
|
156
|
+
lg: "py-1 px-2.5 text-sm font-semibold rounded-lg"
|
|
157
|
+
},
|
|
158
|
+
pillDotSizes: {
|
|
159
|
+
sm: "gap-1 py-0.5 pl-1.5 pr-2 text-xs font-semibold",
|
|
160
|
+
md: "gap-1.5 py-0.5 pl-2 pr-2.5 text-sm font-semibold",
|
|
161
|
+
lg: "gap-1.5 py-1 pl-2.5 pr-3 text-sm font-semibold"
|
|
162
|
+
},
|
|
163
|
+
badgeDotSizes: {
|
|
164
|
+
sm: "gap-1 py-0.5 px-1.5 text-xs font-semibold",
|
|
165
|
+
md: "gap-1.5 py-0.5 px-2 text-sm font-semibold",
|
|
166
|
+
lg: "gap-1.5 py-1 px-2.5 text-sm font-semibold"
|
|
167
|
+
},
|
|
168
|
+
badgeColorDotSizes: {
|
|
169
|
+
sm: "gap-1 py-0.5 px-1.5 text-xs font-semibold",
|
|
170
|
+
md: "gap-1.5 py-0.5 px-2 text-sm font-semibold",
|
|
171
|
+
lg: "gap-1.5 py-1 px-2.5 text-sm font-semibold rounded-lg"
|
|
172
|
+
},
|
|
173
|
+
icon: "size-3"
|
|
174
|
+
});
|
|
175
|
+
function resolveBadgeSizeClass(type, size) {
|
|
176
|
+
if (type === badgeTypes.pillColor) return badgeStyles.pillSizes[size];
|
|
177
|
+
if (type === badgeTypes.badgeColor) return badgeStyles.badgeColorSizes[size];
|
|
178
|
+
return badgeStyles.badgeSizes[size];
|
|
179
|
+
}
|
|
180
|
+
function resolveBadgeDotSizeClass(type, size) {
|
|
181
|
+
if (type === badgeTypes.pillColor) return badgeStyles.pillDotSizes[size];
|
|
182
|
+
if (type === badgeTypes.badgeColor) return badgeStyles.badgeColorDotSizes[size];
|
|
183
|
+
return badgeStyles.badgeDotSizes[size];
|
|
184
|
+
}
|
|
185
|
+
var badgeIconSizeMaps = {
|
|
186
|
+
[badgeTypes.pillColor]: {
|
|
187
|
+
sm: { trailing: "gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-semibold", leading: "gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-semibold" },
|
|
188
|
+
md: { trailing: "gap-1 py-0.5 pl-2.5 pr-2 text-sm font-semibold", leading: "gap-1 py-0.5 pr-2.5 pl-2 text-sm font-semibold" },
|
|
189
|
+
lg: { trailing: "gap-1 py-1 pl-3 pr-2.5 text-sm font-semibold", leading: "gap-1 py-1 pr-3 pl-2.5 text-sm font-semibold" }
|
|
190
|
+
},
|
|
191
|
+
[badgeTypes.badgeColor]: {
|
|
192
|
+
sm: { trailing: "gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-semibold", leading: "gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-semibold" },
|
|
193
|
+
md: { trailing: "gap-1 py-0.5 pl-2 pr-1.5 text-sm font-semibold", leading: "gap-1 py-0.5 pr-2 pl-1.5 text-sm font-semibold" },
|
|
194
|
+
lg: {
|
|
195
|
+
trailing: "gap-1 py-1 pl-2.5 pr-2 text-sm font-semibold rounded-lg",
|
|
196
|
+
leading: "gap-1 py-1 pr-2.5 pl-2 text-sm font-semibold rounded-lg"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
[badgeTypes.badgeModern]: {
|
|
200
|
+
sm: { trailing: "gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-semibold", leading: "gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-semibold" },
|
|
201
|
+
md: { trailing: "gap-1 py-0.5 pl-2 pr-1.5 text-sm font-semibold", leading: "gap-1 py-0.5 pr-2 pl-1.5 text-sm font-semibold" },
|
|
202
|
+
lg: { trailing: "gap-1 py-1 pl-2.5 pr-2 text-sm font-semibold", leading: "gap-1 py-1 pr-2.5 pl-2 text-sm font-semibold" }
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
var badgeOnlyIconSizeMaps = {
|
|
206
|
+
[badgeTypes.pillColor]: { sm: "p-1.25", md: "p-1.5", lg: "p-2" },
|
|
207
|
+
[badgeTypes.badgeColor]: { sm: "p-1.25", md: "p-1.5", lg: "p-2 rounded-lg" },
|
|
208
|
+
[badgeTypes.badgeModern]: { sm: "p-1.25", md: "p-1.5", lg: "p-2" }
|
|
209
|
+
};
|
|
210
|
+
var badgeWithButtonSizeMaps = {
|
|
211
|
+
[badgeTypes.pillColor]: {
|
|
212
|
+
sm: "gap-0.5 py-0.5 pl-2 pr-0.75 text-xs font-semibold",
|
|
213
|
+
md: "gap-0.5 py-0.5 pl-2.5 pr-1 text-sm font-semibold",
|
|
214
|
+
lg: "gap-0.5 py-1 pl-3 pr-1.5 text-sm font-semibold"
|
|
215
|
+
},
|
|
216
|
+
[badgeTypes.badgeColor]: {
|
|
217
|
+
sm: "gap-0.5 py-0.5 pl-1.5 pr-0.75 text-xs font-semibold",
|
|
218
|
+
md: "gap-0.5 py-0.5 pl-2 pr-1 text-sm font-semibold",
|
|
219
|
+
lg: "gap-0.5 py-1 pl-2.5 pr-1.5 text-sm font-semibold rounded-lg"
|
|
220
|
+
},
|
|
221
|
+
[badgeTypes.badgeModern]: {
|
|
222
|
+
sm: "gap-0.5 py-0.5 pl-1.5 pr-0.75 text-xs font-semibold",
|
|
223
|
+
md: "gap-0.5 py-0.5 pl-2 pr-1 text-sm font-semibold",
|
|
224
|
+
lg: "gap-0.5 py-1 pl-2.5 pr-1.5 text-sm font-semibold"
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
var badgeWithMediaSizeMaps = {
|
|
228
|
+
[badgeTypes.pillColor]: {
|
|
229
|
+
sm: "gap-1 py-0.5 pl-0.75 pr-2 text-xs font-semibold",
|
|
230
|
+
md: "gap-1.5 py-0.5 pl-1 pr-2.5 text-sm font-semibold",
|
|
231
|
+
lg: "gap-1.5 py-1 pl-1.5 pr-3 text-sm font-semibold"
|
|
232
|
+
},
|
|
233
|
+
[badgeTypes.badgeColor]: {
|
|
234
|
+
sm: "gap-1 py-0.5 pl-1 pr-1.5 text-xs font-semibold",
|
|
235
|
+
md: "gap-1.5 py-0.5 pl-1.5 pr-2 text-sm font-semibold",
|
|
236
|
+
lg: "gap-1.5 py-1 pl-2 pr-2.5 text-sm font-semibold rounded-lg"
|
|
237
|
+
},
|
|
238
|
+
[badgeTypes.badgeModern]: {
|
|
239
|
+
sm: "gap-1 py-0.5 pl-1 pr-1.5 text-xs font-semibold",
|
|
240
|
+
md: "gap-1.5 py-0.5 pl-1.5 pr-2 text-sm font-semibold",
|
|
241
|
+
lg: "gap-1.5 py-1 pl-2 pr-2.5 text-sm font-semibold"
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
({
|
|
245
|
+
[badgeTypes.pillColor]: {
|
|
246
|
+
},
|
|
247
|
+
[badgeTypes.badgeColor]: {
|
|
248
|
+
},
|
|
249
|
+
[badgeTypes.badgeModern]: {
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
({
|
|
253
|
+
[badgeTypes.pillColor]: {
|
|
254
|
+
},
|
|
255
|
+
[badgeTypes.badgeColor]: {
|
|
256
|
+
},
|
|
257
|
+
[badgeTypes.badgeModern]: {
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
var badgeLabelTextSizes = {
|
|
261
|
+
sm: "text-xs font-semibold",
|
|
262
|
+
md: "text-sm font-semibold",
|
|
263
|
+
lg: "text-sm font-semibold"
|
|
264
|
+
};
|
|
265
|
+
var StyledSvg = styled(Svg);
|
|
266
|
+
var BadgeDot = ({ className }) => {
|
|
267
|
+
return /* @__PURE__ */ jsx(StyledSvg, { width: 8, height: 8, viewBox: "0 0 8 8", className, children: /* @__PURE__ */ jsx(Circle, { cx: 4, cy: 4, r: 2.5, fill: "currentColor", stroke: "currentColor" }) });
|
|
268
|
+
};
|
|
269
|
+
var BadgeLabel = ({
|
|
270
|
+
size,
|
|
271
|
+
colorClass,
|
|
272
|
+
children
|
|
273
|
+
}) => {
|
|
274
|
+
if (typeof children === "string" || typeof children === "number") {
|
|
275
|
+
return /* @__PURE__ */ jsx(Text, { className: cx(badgeLabelTextSizes[size], colorClass), children });
|
|
276
|
+
}
|
|
277
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
278
|
+
};
|
|
279
|
+
var Badge = ({
|
|
280
|
+
type = "pill-color",
|
|
281
|
+
size = "md",
|
|
282
|
+
color = "gray",
|
|
283
|
+
children,
|
|
284
|
+
className
|
|
285
|
+
}) => {
|
|
286
|
+
const colors = badgeWithPillTypes[type];
|
|
287
|
+
const colorRoot = colors.styles[color].root;
|
|
288
|
+
return /* @__PURE__ */ jsx(View, { className: cx(colors.common, resolveBadgeSizeClass(type, size), colorRoot, className), children: /* @__PURE__ */ jsx(BadgeLabel, { size, colorClass: colorRoot, children }) });
|
|
289
|
+
};
|
|
290
|
+
var BadgeWithDot = ({
|
|
291
|
+
size = "md",
|
|
292
|
+
color = "gray",
|
|
293
|
+
type = "pill-color",
|
|
294
|
+
className,
|
|
295
|
+
children
|
|
296
|
+
}) => {
|
|
297
|
+
const colors = badgeWithBadgeTypes[type];
|
|
298
|
+
const style = colors.styles[color];
|
|
299
|
+
return /* @__PURE__ */ jsxs(View, { className: cx(colors.common, resolveBadgeDotSizeClass(type, size), style.root, className), children: [
|
|
300
|
+
/* @__PURE__ */ jsx(BadgeDot, { className: style.addon }),
|
|
301
|
+
/* @__PURE__ */ jsx(BadgeLabel, { size, colorClass: style.root, children })
|
|
302
|
+
] });
|
|
303
|
+
};
|
|
304
|
+
var BadgeWithIcon = ({
|
|
305
|
+
size = "md",
|
|
306
|
+
color = "gray",
|
|
307
|
+
type = "pill-color",
|
|
308
|
+
iconLeading: IconLeading,
|
|
309
|
+
iconTrailing: IconTrailing,
|
|
310
|
+
children,
|
|
311
|
+
className
|
|
312
|
+
}) => {
|
|
313
|
+
const colors = badgeWithBadgeTypes[type];
|
|
314
|
+
const style = colors.styles[color];
|
|
315
|
+
const icon = IconLeading ? "leading" : "trailing";
|
|
316
|
+
return /* @__PURE__ */ jsxs(View, { className: cx(colors.common, badgeIconSizeMaps[type][size][icon], style.root, className), children: [
|
|
317
|
+
IconLeading && /* @__PURE__ */ jsx(IconLeading, { weight: "bold", className: cx(style.addon, badgeStyles.icon), size: 12 }),
|
|
318
|
+
/* @__PURE__ */ jsx(BadgeLabel, { size, colorClass: style.root, children }),
|
|
319
|
+
IconTrailing && /* @__PURE__ */ jsx(IconTrailing, { weight: "bold", className: cx(style.addon, badgeStyles.icon), size: 12 })
|
|
320
|
+
] });
|
|
321
|
+
};
|
|
322
|
+
var BadgeWithImage = ({
|
|
323
|
+
size = "md",
|
|
324
|
+
color = "gray",
|
|
325
|
+
type = "pill-color",
|
|
326
|
+
imgSrc,
|
|
327
|
+
children,
|
|
328
|
+
className
|
|
329
|
+
}) => {
|
|
330
|
+
const colors = badgeWithPillTypes[type];
|
|
331
|
+
const colorRoot = colors.styles[color].root;
|
|
332
|
+
return /* @__PURE__ */ jsxs(View, { className: cx(colors.common, badgeWithMediaSizeMaps[type][size], colorRoot, className), children: [
|
|
333
|
+
/* @__PURE__ */ jsx(
|
|
334
|
+
Image,
|
|
335
|
+
{
|
|
336
|
+
source: { uri: imgSrc },
|
|
337
|
+
accessibilityLabel: "Badge image",
|
|
338
|
+
style: { width: 16, height: 16, borderRadius: 999 }
|
|
339
|
+
}
|
|
340
|
+
),
|
|
341
|
+
/* @__PURE__ */ jsx(BadgeLabel, { size, colorClass: colorRoot, children })
|
|
342
|
+
] });
|
|
343
|
+
};
|
|
344
|
+
var BadgeWithButton = ({
|
|
345
|
+
size = "md",
|
|
346
|
+
color = "gray",
|
|
347
|
+
type = "pill-color",
|
|
348
|
+
icon: Icon = XIcon,
|
|
349
|
+
buttonLabel,
|
|
350
|
+
children,
|
|
351
|
+
onButtonPress,
|
|
352
|
+
className
|
|
353
|
+
}) => {
|
|
354
|
+
const colors = badgeWithPillTypes[type];
|
|
355
|
+
const style = colors.styles[color];
|
|
356
|
+
return /* @__PURE__ */ jsxs(View, { className: cx(colors.common, badgeWithButtonSizeMaps[type][size], style.root, className), children: [
|
|
357
|
+
/* @__PURE__ */ jsx(BadgeLabel, { size, colorClass: style.root, children }),
|
|
358
|
+
/* @__PURE__ */ jsx(
|
|
359
|
+
Pressable,
|
|
360
|
+
{
|
|
361
|
+
accessibilityRole: "button",
|
|
362
|
+
accessibilityLabel: buttonLabel,
|
|
363
|
+
onPress: onButtonPress,
|
|
364
|
+
className: cx(
|
|
365
|
+
"items-center justify-center p-0.5",
|
|
366
|
+
style.addonButton,
|
|
367
|
+
type === badgeTypes.pillColor || type === badgeTypes.badgeModern ? "rounded-full" : "rounded-[3px]"
|
|
368
|
+
),
|
|
369
|
+
children: /* @__PURE__ */ jsx(Icon, { weight: "bold", className: badgeStyles.icon, size: 12 })
|
|
370
|
+
}
|
|
371
|
+
)
|
|
372
|
+
] });
|
|
373
|
+
};
|
|
374
|
+
var BadgeIcon = ({
|
|
375
|
+
size = "md",
|
|
376
|
+
color = "gray",
|
|
377
|
+
type = "pill-color",
|
|
378
|
+
icon: Icon,
|
|
379
|
+
className
|
|
380
|
+
}) => {
|
|
381
|
+
const colors = badgeWithPillTypes[type];
|
|
382
|
+
const style = colors.styles[color];
|
|
383
|
+
return /* @__PURE__ */ jsx(View, { className: cx(colors.common, badgeOnlyIconSizeMaps[type][size], style.root, className), children: /* @__PURE__ */ jsx(Icon, { weight: "bold", className: cx(badgeStyles.icon, style.addon), size: 12 }) });
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
export { BADGE_COLORS, BADGE_SIZES, Badge, BadgeIcon, BadgeWithButton, BadgeWithDot, BadgeWithIcon, BadgeWithImage, badgeTypes, badgeFilledColors as filledColors };
|
|
387
|
+
//# sourceMappingURL=badge.js.map
|
|
388
|
+
//# sourceMappingURL=badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../core/src/cx.ts","../../core/src/badge.ts","../../../native/components/base/badges/badges.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,IAAM,UAAU,mBAAA,CAAoB;AAAA,EAChC,MAAA,EAAQ;AAAA,IACJ,KAAA,EAAO;AAAA,MACH,MAAM,CAAC,YAAA,EAAc,cAAc,YAAA,EAAc,YAAA,EAAc,cAAc,aAAa;AAAA;AAC9F;AAER,CAAC,CAAA;AAGM,IAAM,EAAA,GAAK,OAAA;AAGX,SAAS,OAAsH,OAAA,EAAe;AACjJ,EAAA,OAAO,OAAA;AACX;;;ACXO,IAAM,WAAA,GAAc,CAAC,IAAA,EAAM,IAAA,EAAM,IAAI;AAGrC,IAAM,YAAA,GAAe;AAAA,EACxB,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACJ;AAGO,IAAM,UAAA,GAAa;AAAA,EACtB,SAAA,EAAW,YAAA;AAAA,EACX,UAAA,EAAY,OAAA;AAAA,EACZ,WAAA,EAAa;AACjB;AAqBO,IAAM,iBAAA,GAGT;AAAA,EACA,IAAA,EAAM;AAAA,IACF,IAAA,EAAM,yEAAA;AAAA,IACN,KAAA,EAAO,0BAAA;AAAA,IACP,WAAA,EAAa;AAAA,GACjB;AAAA,EACA,KAAA,EAAO;AAAA,IACH,IAAA,EAAM,mEAAA;AAAA,IACN,KAAA,EAAO,wBAAA;AAAA,IACP,WAAA,EAAa;AAAA,GACjB;AAAA,EACA,KAAA,EAAO;AAAA,IACH,IAAA,EAAM,6DAAA;AAAA,IACN,KAAA,EAAO,sBAAA;AAAA,IACP,WAAA,EAAa;AAAA,GACjB;AAAA,EACA,OAAA,EAAS;AAAA,IACL,IAAA,EAAM,sEAAA;A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AAM,YAAY,CAAuB;AAAA,EAC5C,IAAA,GAAO,IAAA;AAAA,EACP,KAAA,GAAQ,MAAA;AAAA,EACR,IAAA,GAAO,YAAA;AAAA,EACP,IAAA,EAAM,IAAA;AAAA,EACN;AACJ,CAAA,KAAyB;AACrB,EAAA,MAAM,MAAA,GAAS,mBAAmB,IAAI,CAAA;AACtC,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,MAAA,CAAO,KAAmC,CAAA;AAE/D,EAAA,uBACI,GAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAW,EAAA,CAAG,MAAA,CAAO,MAAA,EAAQ,qBAAA,CAAsB,IAAI,CAAA,CAAE,IAAI,CAAA,EAAG,KAAA,CAAM,IAAA,EAAM,SAAS,CAAA,EACvF,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,MAAA,EAAO,MAAA,EAAO,SAAA,EAAW,EAAA,CAAG,WAAA,CAAY,IAAA,EAAM,KAAA,CAAM,KAAK,CAAA,EAAG,IAAA,EAAM,EAAA,EAAI,CAAA,EAChF,CAAA;AAER","file":"badge.js","sourcesContent":["import { extendTailwindMerge } from \"tailwind-merge\";\n\nconst twMerge = extendTailwindMerge({\n extend: {\n theme: {\n text: [\"display-xs\", \"display-sm\", \"display-md\", \"display-lg\", \"display-xl\", \"display-2xl\"],\n },\n },\n});\n\n/** Merge Tailwind / NativeWind class strings. */\nexport const cx = twMerge;\n\n/** Identity helper so Tailwind IntelliSense can sort style maps. */\nexport function sortCx<T extends Record<string, string | number | Record<string, string | number | Record<string, string | number>>>>(classes: T): T {\n return classes;\n}\n","import type { FC } from \"react\";\nimport { sortCx } from \"./cx\";\n\n//////////////////////////////////////////////// TYPES\n\nexport const BADGE_SIZES = [\"sm\", \"md\", \"lg\"] as const;\nexport type BadgeSize = (typeof BADGE_SIZES)[number];\n\nexport const BADGE_COLORS = [\n \"gray\",\n \"brand\",\n \"error\",\n \"warning\",\n \"success\",\n \"slate\",\n \"sky\",\n \"blue\",\n \"indigo\",\n \"purple\",\n \"pink\",\n \"orange\",\n] as const;\nexport type BadgeColorName = (typeof BADGE_COLORS)[number];\n\nexport const badgeTypes = {\n pillColor: \"pill-color\",\n badgeColor: \"color\",\n badgeModern: \"modern\",\n} as const;\n\nexport type BadgeTypes = (typeof badgeTypes)[keyof typeof badgeTypes];\n\nexport type ExtractColorKeys<T> = T extends { styles: infer C } ? keyof C : never;\nexport type ExtractBadgeKeys<T> = keyof T;\nexport type BadgeTypeToColorMap<T> = {\n [K in ExtractBadgeKeys<T>]: ExtractColorKeys<T[K]>;\n};\n\n/** Icon component contract for badge addons (web Phosphor / native Phosphor). */\nexport type BadgeIconComponent = FC<{\n className?: string;\n weight?: \"thin\" | \"light\" | \"regular\" | \"bold\" | \"fill\" | \"duotone\";\n size?: number;\n color?: string;\n}>;\n\n//////////////////////////////////////////////// SHARED STYLES\n// Visual contract for web + native. Web focus / hover stay in badgeWebStyles.\n\nexport const badgeFilledColors: Record<\n BadgeColorName,\n { root: string; addon: string; addonButton: string }\n> = {\n gray: {\n root: \"bg-utility-neutral-50 text-utility-neutral-700 ring-utility-neutral-200\",\n addon: \"text-utility-neutral-500\",\n addonButton: \"hover:bg-utility-neutral-100 text-utility-neutral-400 hover:text-utility-neutral-500\",\n },\n brand: {\n root: \"bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-200\",\n addon: \"text-utility-brand-500\",\n addonButton: \"hover:bg-utility-brand-100 text-utility-brand-400 hover:text-utility-brand-500\",\n },\n error: {\n root: \"bg-utility-red-50 text-utility-red-700 ring-utility-red-200\",\n addon: \"text-utility-red-500\",\n addonButton: \"hover:bg-utility-red-100 text-utility-red-400 hover:text-utility-red-500\",\n },\n warning: {\n root: \"bg-utility-yellow-50 text-utility-yellow-700 ring-utility-yellow-200\",\n addon: \"text-utility-yellow-500\",\n addonButton: \"hover:bg-utility-yellow-100 text-utility-yellow-400 hover:text-utility-yellow-500\",\n },\n success: {\n root: \"bg-utility-green-50 text-utility-green-700 ring-utility-green-200\",\n addon: \"text-utility-green-500\",\n addonButton: \"hover:bg-utility-green-100 text-utility-green-400 hover:text-utility-green-500\",\n },\n slate: {\n root: \"bg-utility-slate-50 text-utility-slate-700 ring-utility-slate-200\",\n addon: \"text-utility-slate-500\",\n addonButton: \"hover:bg-utility-slate-100 text-utility-slate-400 hover:text-utility-slate-500\",\n },\n sky: {\n root: \"bg-utility-sky-50 text-utility-sky-700 ring-utility-sky-200\",\n addon: \"text-utility-sky-500\",\n addonButton: \"hover:bg-utility-sky-100 text-utility-sky-400 hover:text-utility-sky-500\",\n },\n blue: {\n root: \"bg-utility-blue-50 text-utility-blue-700 ring-utility-blue-200\",\n addon: \"text-utility-blue-500\",\n addonButton: \"hover:bg-utility-blue-100 text-utility-blue-400 hover:text-utility-blue-500\",\n },\n indigo: {\n root: \"bg-utility-indigo-50 text-utility-indigo-700 ring-utility-indigo-200\",\n addon: \"text-utility-indigo-500\",\n addonButton: \"hover:bg-utility-indigo-100 text-utility-indigo-400 hover:text-utility-indigo-500\",\n },\n purple: {\n root: \"bg-utility-purple-50 text-utility-purple-700 ring-utility-purple-200\",\n addon: \"text-utility-purple-500\",\n addonButton: \"hover:bg-utility-purple-100 text-utility-purple-400 hover:text-utility-purple-500\",\n },\n pink: {\n root: \"bg-utility-pink-50 text-utility-pink-700 ring-utility-pink-200\",\n addon: \"text-utility-pink-500\",\n addonButton: \"hover:bg-utility-pink-100 text-utility-pink-400 hover:text-utility-pink-500\",\n },\n orange: {\n root: \"bg-utility-orange-50 text-utility-orange-700 ring-utility-orange-200\",\n addon: \"text-utility-orange-500\",\n addonButton: \"hover:bg-utility-orange-100 text-utility-orange-400 hover:text-utility-orange-500\",\n },\n};\n\nconst addonOnlyColors = Object.fromEntries(\n Object.entries(badgeFilledColors).map(([key, value]) => [key, { root: \"\", addon: value.addon }]),\n) as Record<BadgeColorName, { root: string; addon: string }>;\n\n/**\n * Shared layout chrome. Avoid bare `flex` (NativeWind). Web shells prepend `flex`.\n */\nexport const badgeWithPillTypes = {\n [badgeTypes.pillColor]: {\n common: \"size-max flex-row items-center whitespace-nowrap rounded-full ring-1 ring-inset\",\n styles: badgeFilledColors,\n },\n [badgeTypes.badgeColor]: {\n common: \"size-max flex-row items-center whitespace-nowrap rounded-md ring-1 ring-inset\",\n styles: badgeFilledColors,\n },\n [badgeTypes.badgeModern]: {\n common:\n \"size-max flex-row items-center whitespace-nowrap rounded-full ring-1 ring-inset shadow-xs\",\n styles: {\n gray: {\n root: \"bg-primary text-secondary ring-primary\",\n addon: \"text-neutral-500\",\n addonButton:\n \"hover:bg-utility-neutral-100 text-utility-neutral-400 hover:text-utility-neutral-500\",\n },\n },\n },\n} as const;\n\nexport const badgeWithBadgeTypes = {\n [badgeTypes.pillColor]: {\n common: \"size-max flex-row items-center whitespace-nowrap rounded-full ring-1 ring-inset\",\n styles: badgeFilledColors,\n },\n [badgeTypes.badgeColor]: {\n common: \"size-max flex-row items-center whitespace-nowrap rounded-md ring-1 ring-inset\",\n styles: badgeFilledColors,\n },\n [badgeTypes.badgeModern]: {\n common:\n \"size-max flex-row items-center whitespace-nowrap rounded-full ring-1 ring-inset bg-primary text-secondary ring-primary shadow-xs\",\n styles: addonOnlyColors,\n },\n} as const;\n\nexport type BadgeColor<T extends BadgeTypes> = BadgeTypeToColorMap<typeof badgeWithPillTypes>[T];\n\nexport const badgeStyles = sortCx({\n pillSizes: {\n sm: \"py-0.5 px-2 text-xs font-semibold\",\n md: \"py-0.5 px-2.5 text-sm font-semibold\",\n lg: \"py-1 px-3 text-sm font-semibold\",\n },\n badgeSizes: {\n sm: \"py-0.5 px-1.5 text-xs font-semibold\",\n md: \"py-0.5 px-2 text-sm font-semibold\",\n lg: \"py-1 px-2.5 text-sm font-semibold\",\n },\n badgeColorSizes: {\n sm: \"py-0.5 px-1.5 text-xs font-semibold\",\n md: \"py-0.5 px-2 text-sm font-semibold\",\n lg: \"py-1 px-2.5 text-sm font-semibold rounded-lg\",\n },\n pillDotSizes: {\n sm: \"gap-1 py-0.5 pl-1.5 pr-2 text-xs font-semibold\",\n md: \"gap-1.5 py-0.5 pl-2 pr-2.5 text-sm font-semibold\",\n lg: \"gap-1.5 py-1 pl-2.5 pr-3 text-sm font-semibold\",\n },\n badgeDotSizes: {\n sm: \"gap-1 py-0.5 px-1.5 text-xs font-semibold\",\n md: \"gap-1.5 py-0.5 px-2 text-sm font-semibold\",\n lg: \"gap-1.5 py-1 px-2.5 text-sm font-semibold\",\n },\n badgeColorDotSizes: {\n sm: \"gap-1 py-0.5 px-1.5 text-xs font-semibold\",\n md: \"gap-1.5 py-0.5 px-2 text-sm font-semibold\",\n lg: \"gap-1.5 py-1 px-2.5 text-sm font-semibold rounded-lg\",\n },\n icon: \"size-3\",\n});\n\n/** Resolve size class map for plain `Badge` / similar. */\nexport function resolveBadgeSizeClass(type: BadgeTypes, size: BadgeSize): string {\n if (type === badgeTypes.pillColor) return badgeStyles.pillSizes[size];\n if (type === badgeTypes.badgeColor) return badgeStyles.badgeColorSizes[size];\n return badgeStyles.badgeSizes[size];\n}\n\nexport function resolveBadgeDotSizeClass(type: BadgeTypes, size: BadgeSize): string {\n if (type === badgeTypes.pillColor) return badgeStyles.pillDotSizes[size];\n if (type === badgeTypes.badgeColor) return badgeStyles.badgeColorDotSizes[size];\n return badgeStyles.badgeDotSizes[size];\n}\n\nexport const badgeIconSizeMaps = {\n [badgeTypes.pillColor]: {\n sm: { trailing: \"gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-semibold\", leading: \"gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-semibold\" },\n md: { trailing: \"gap-1 py-0.5 pl-2.5 pr-2 text-sm font-semibold\", leading: \"gap-1 py-0.5 pr-2.5 pl-2 text-sm font-semibold\" },\n lg: { trailing: \"gap-1 py-1 pl-3 pr-2.5 text-sm font-semibold\", leading: \"gap-1 py-1 pr-3 pl-2.5 text-sm font-semibold\" },\n },\n [badgeTypes.badgeColor]: {\n sm: { trailing: \"gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-semibold\", leading: \"gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-semibold\" },\n md: { trailing: \"gap-1 py-0.5 pl-2 pr-1.5 text-sm font-semibold\", leading: \"gap-1 py-0.5 pr-2 pl-1.5 text-sm font-semibold\" },\n lg: {\n trailing: \"gap-1 py-1 pl-2.5 pr-2 text-sm font-semibold rounded-lg\",\n leading: \"gap-1 py-1 pr-2.5 pl-2 text-sm font-semibold rounded-lg\",\n },\n },\n [badgeTypes.badgeModern]: {\n sm: { trailing: \"gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-semibold\", leading: \"gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-semibold\" },\n md: { trailing: \"gap-1 py-0.5 pl-2 pr-1.5 text-sm font-semibold\", leading: \"gap-1 py-0.5 pr-2 pl-1.5 text-sm font-semibold\" },\n lg: { trailing: \"gap-1 py-1 pl-2.5 pr-2 text-sm font-semibold\", leading: \"gap-1 py-1 pr-2.5 pl-2 text-sm font-semibold\" },\n },\n} as const;\n\nexport const badgeOnlyIconSizeMaps = {\n [badgeTypes.pillColor]: { sm: \"p-1.25\", md: \"p-1.5\", lg: \"p-2\" },\n [badgeTypes.badgeColor]: { sm: \"p-1.25\", md: \"p-1.5\", lg: \"p-2 rounded-lg\" },\n [badgeTypes.badgeModern]: { sm: \"p-1.25\", md: \"p-1.5\", lg: \"p-2\" },\n} as const;\n\nexport const badgeWithButtonSizeMaps = {\n [badgeTypes.pillColor]: {\n sm: \"gap-0.5 py-0.5 pl-2 pr-0.75 text-xs font-semibold\",\n md: \"gap-0.5 py-0.5 pl-2.5 pr-1 text-sm font-semibold\",\n lg: \"gap-0.5 py-1 pl-3 pr-1.5 text-sm font-semibold\",\n },\n [badgeTypes.badgeColor]: {\n sm: \"gap-0.5 py-0.5 pl-1.5 pr-0.75 text-xs font-semibold\",\n md: \"gap-0.5 py-0.5 pl-2 pr-1 text-sm font-semibold\",\n lg: \"gap-0.5 py-1 pl-2.5 pr-1.5 text-sm font-semibold rounded-lg\",\n },\n [badgeTypes.badgeModern]: {\n sm: \"gap-0.5 py-0.5 pl-1.5 pr-0.75 text-xs font-semibold\",\n md: \"gap-0.5 py-0.5 pl-2 pr-1 text-sm font-semibold\",\n lg: \"gap-0.5 py-1 pl-2.5 pr-1.5 text-sm font-semibold\",\n },\n} as const;\n\nexport const badgeWithMediaSizeMaps = {\n [badgeTypes.pillColor]: {\n sm: \"gap-1 py-0.5 pl-0.75 pr-2 text-xs font-semibold\",\n md: \"gap-1.5 py-0.5 pl-1 pr-2.5 text-sm font-semibold\",\n lg: \"gap-1.5 py-1 pl-1.5 pr-3 text-sm font-semibold\",\n },\n [badgeTypes.badgeColor]: {\n sm: \"gap-1 py-0.5 pl-1 pr-1.5 text-xs font-semibold\",\n md: \"gap-1.5 py-0.5 pl-1.5 pr-2 text-sm font-semibold\",\n lg: \"gap-1.5 py-1 pl-2 pr-2.5 text-sm font-semibold rounded-lg\",\n },\n [badgeTypes.badgeModern]: {\n sm: \"gap-1 py-0.5 pl-1 pr-1.5 text-xs font-semibold\",\n md: \"gap-1.5 py-0.5 pl-1.5 pr-2 text-sm font-semibold\",\n lg: \"gap-1.5 py-1 pl-2 pr-2.5 text-sm font-semibold\",\n },\n} as const;\n\n//////////////////////////////////////////////// WEB-ONLY STYLES\n\n/** Plain focus — dismiss button on BadgeWithButton. */\nexport const badgeWebFocusShadowPlain =\n \"focus-visible:outline-none focus-visible:[box-shadow:0px_0px_0px_2px_var(--color-bg-primary),0px_0px_0px_4px_var(--color-focus-ring)]\";\n\n/** Web needs `display:flex`; shared maps use `flex-row` for NativeWind. */\nexport const badgeWebDisplayFlex = \"flex\";\n\n/**\n * Exact `common` strings from web `badges.tsx` (`flex`, not `flex-row`).\n * Size / color maps are shared (`badgeStyles`, `badgeFilledColors`, …).\n */\nexport const badgeWebWithPillTypes = {\n [badgeTypes.pillColor]: {\n common: \"size-max flex items-center whitespace-nowrap rounded-full ring-1 ring-inset\",\n styles: badgeFilledColors,\n },\n [badgeTypes.badgeColor]: {\n common: \"size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset\",\n styles: badgeFilledColors,\n },\n [badgeTypes.badgeModern]: {\n common: \"size-max flex items-center whitespace-nowrap rounded-full ring-1 ring-inset shadow-xs\",\n styles: {\n gray: {\n root: \"bg-primary text-secondary ring-primary\",\n addon: \"text-neutral-500\",\n addonButton: \"hover:bg-utility-neutral-100 text-utility-neutral-400 hover:text-utility-neutral-500\",\n },\n },\n },\n} as const;\n\nexport const badgeWebWithBadgeTypes = {\n [badgeTypes.pillColor]: {\n common: \"size-max flex items-center whitespace-nowrap rounded-full ring-1 ring-inset\",\n styles: badgeFilledColors,\n },\n [badgeTypes.badgeColor]: {\n common: \"size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset\",\n styles: badgeFilledColors,\n },\n [badgeTypes.badgeModern]: {\n common: \"size-max flex items-center whitespace-nowrap rounded-full ring-1 ring-inset bg-primary text-secondary ring-primary shadow-xs\",\n styles: addonOnlyColors,\n },\n} as const;\n\nexport const badgeWebButton =\n \"flex cursor-pointer items-center justify-center p-0.5 transition duration-100 ease-linear\";\nexport const badgeWebFlagImage = \"size-4 max-w-none rounded-full\";\n\n/** Typography for native `<Text>` label (size maps put these on the chrome). */\nexport const badgeLabelTextSizes: Record<BadgeSize, string> = {\n sm: \"text-xs font-semibold\",\n md: \"text-sm font-semibold\",\n lg: \"text-sm font-semibold\",\n};\n","import type { FC, ReactNode } from \"react\";\nimport { Image } from \"react-native\";\nimport { Pressable, Text, View } from \"react-native-css/components\";\nimport Svg, { Circle } from \"react-native-svg\";\nimport { XIcon } from \"phosphor-react-native/src/icons/X\";\nimport {\n BADGE_COLORS,\n BADGE_SIZES,\n badgeFilledColors,\n badgeIconSizeMaps,\n badgeLabelTextSizes,\n badgeOnlyIconSizeMaps,\n badgeStyles,\n badgeTypes,\n badgeWithBadgeTypes,\n badgeWithButtonSizeMaps,\n badgeWithMediaSizeMaps,\n badgeWithPillTypes,\n resolveBadgeDotSizeClass,\n resolveBadgeSizeClass,\n type BadgeColor,\n type BadgeColorName,\n type BadgeIconComponent,\n type BadgeSize,\n type BadgeTypeToColorMap,\n type BadgeTypes,\n} from \"@avenue-ticketing/core/badge\";\nimport { cx } from \"@avenue-ticketing/core/cx\";\nimport { styled } from \"nativewind\";\n\nexport type {\n BadgeColor,\n BadgeColorName,\n BadgeIconComponent,\n BadgeSize,\n BadgeTypes,\n};\n\nexport { BADGE_COLORS, BADGE_SIZES, badgeTypes, badgeFilledColors as filledColors };\n\n//////////////////////////////////////////////// TYPES\n\nexport interface BadgeProps<T extends BadgeTypes = BadgeTypes> {\n type?: T;\n size?: BadgeSize;\n color?: BadgeColor<T>;\n children: ReactNode;\n className?: string;\n}\n\nexport interface BadgeWithDotProps<T extends BadgeTypes = BadgeTypes> {\n type?: T;\n size?: BadgeSize;\n color?: BadgeTypeToColorMap<typeof badgeWithBadgeTypes>[T];\n className?: string;\n children: ReactNode;\n}\n\nexport interface BadgeWithIconProps<T extends BadgeTypes = BadgeTypes> {\n type?: T;\n size?: BadgeSize;\n color?: BadgeTypeToColorMap<typeof badgeWithBadgeTypes>[T];\n iconLeading?: BadgeIconComponent;\n iconTrailing?: BadgeIconComponent;\n children: ReactNode;\n className?: string;\n}\n\nexport interface BadgeWithImageProps<T extends BadgeTypes = BadgeTypes> {\n type?: T;\n size?: BadgeSize;\n imgSrc: string;\n color?: BadgeTypeToColorMap<typeof badgeWithPillTypes>[T];\n children: ReactNode;\n className?: string;\n}\n\nexport interface BadgeWithButtonProps<T extends BadgeTypes = BadgeTypes> {\n type?: T;\n size?: BadgeSize;\n icon?: BadgeIconComponent;\n color?: BadgeTypeToColorMap<typeof badgeWithPillTypes>[T];\n children: ReactNode;\n buttonLabel?: string;\n onButtonPress?: () => void;\n className?: string;\n}\n\nexport interface BadgeIconProps<T extends BadgeTypes = BadgeTypes> {\n type?: T;\n size?: BadgeSize;\n icon: BadgeIconComponent;\n color?: BadgeTypeToColorMap<typeof badgeWithPillTypes>[T];\n className?: string;\n}\n\n//////////////////////////////////////////////// HELPERS\n\n/** Lets Tailwind `text-*` set SVG `color` so `fill=\"currentColor\"` matches web. */\nconst StyledSvg = styled(Svg);\n\nconst BadgeDot: FC<{ className?: string }> = ({ className }) => {\n return (\n <StyledSvg width={8} height={8} viewBox=\"0 0 8 8\" className={className}>\n <Circle cx={4} cy={4} r={2.5} fill=\"currentColor\" stroke=\"currentColor\" />\n </StyledSvg>\n );\n};\n\nconst BadgeLabel: FC<{ size: BadgeSize; colorClass: string; children: ReactNode }> = ({\n size,\n colorClass,\n children,\n}) => {\n if (typeof children === \"string\" || typeof children === \"number\") {\n return <Text className={cx(badgeLabelTextSizes[size], colorClass)}>{children}</Text>;\n }\n return <>{children}</>;\n};\n\n//////////////////////////////////////////////// MAIN\n\n/**\n * NativeWind badge — shared Tailwind class maps from `@avenue-ticketing/core/badge`.\n */\nexport const Badge = <T extends BadgeTypes>({\n type = \"pill-color\" as T,\n size = \"md\",\n color = \"gray\" as BadgeColor<T>,\n children,\n className,\n}: BadgeProps<T>) => {\n const colors = badgeWithPillTypes[type];\n const colorRoot = colors.styles[color as keyof typeof colors.styles].root;\n\n return (\n <View className={cx(colors.common, resolveBadgeSizeClass(type, size), colorRoot, className)}>\n <BadgeLabel size={size} colorClass={colorRoot}>\n {children}\n </BadgeLabel>\n </View>\n );\n};\n\nexport const BadgeWithDot = <T extends BadgeTypes>({\n size = \"md\",\n color = \"gray\" as BadgeTypeToColorMap<typeof badgeWithBadgeTypes>[T],\n type = \"pill-color\" as T,\n className,\n children,\n}: BadgeWithDotProps<T>) => {\n const colors = badgeWithBadgeTypes[type];\n const style = colors.styles[color as keyof typeof colors.styles];\n\n return (\n <View className={cx(colors.common, resolveBadgeDotSizeClass(type, size), style.root, className)}>\n <BadgeDot className={style.addon} />\n <BadgeLabel size={size} colorClass={style.root}>\n {children}\n </BadgeLabel>\n </View>\n );\n};\n\nexport const BadgeWithIcon = <T extends BadgeTypes>({\n size = \"md\",\n color = \"gray\" as BadgeTypeToColorMap<typeof badgeWithBadgeTypes>[T],\n type = \"pill-color\" as T,\n iconLeading: IconLeading,\n iconTrailing: IconTrailing,\n children,\n className,\n}: BadgeWithIconProps<T>) => {\n const colors = badgeWithBadgeTypes[type];\n const style = colors.styles[color as keyof typeof colors.styles];\n const icon = IconLeading ? \"leading\" : \"trailing\";\n\n return (\n <View className={cx(colors.common, badgeIconSizeMaps[type][size][icon], style.root, className)}>\n {IconLeading && <IconLeading weight=\"bold\" className={cx(style.addon, badgeStyles.icon)} size={12} />}\n <BadgeLabel size={size} colorClass={style.root}>\n {children}\n </BadgeLabel>\n {IconTrailing && <IconTrailing weight=\"bold\" className={cx(style.addon, badgeStyles.icon)} size={12} />}\n </View>\n );\n};\n\nexport const BadgeWithImage = <T extends BadgeTypes>({\n size = \"md\",\n color = \"gray\" as BadgeTypeToColorMap<typeof badgeWithPillTypes>[T],\n type = \"pill-color\" as T,\n imgSrc,\n children,\n className,\n}: BadgeWithImageProps<T>) => {\n const colors = badgeWithPillTypes[type];\n const colorRoot = colors.styles[color as keyof typeof colors.styles].root;\n\n return (\n <View className={cx(colors.common, badgeWithMediaSizeMaps[type][size], colorRoot, className)}>\n <Image\n source={{ uri: imgSrc }}\n accessibilityLabel=\"Badge image\"\n style={{ width: 16, height: 16, borderRadius: 999 }}\n />\n <BadgeLabel size={size} colorClass={colorRoot}>\n {children}\n </BadgeLabel>\n </View>\n );\n};\n\nexport const BadgeWithButton = <T extends BadgeTypes>({\n size = \"md\",\n color = \"gray\" as BadgeTypeToColorMap<typeof badgeWithPillTypes>[T],\n type = \"pill-color\" as T,\n icon: Icon = XIcon,\n buttonLabel,\n children,\n onButtonPress,\n className,\n}: BadgeWithButtonProps<T>) => {\n const colors = badgeWithPillTypes[type];\n const style = colors.styles[color as keyof typeof colors.styles];\n\n return (\n <View className={cx(colors.common, badgeWithButtonSizeMaps[type][size], style.root, className)}>\n <BadgeLabel size={size} colorClass={style.root}>\n {children}\n </BadgeLabel>\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={buttonLabel}\n onPress={onButtonPress}\n className={cx(\n \"items-center justify-center p-0.5\",\n style.addonButton,\n type === badgeTypes.pillColor || type === badgeTypes.badgeModern ? \"rounded-full\" : \"rounded-[3px]\",\n )}\n >\n <Icon weight=\"bold\" className={badgeStyles.icon} size={12} />\n </Pressable>\n </View>\n );\n};\n\nexport const BadgeIcon = <T extends BadgeTypes>({\n size = \"md\",\n color = \"gray\" as BadgeTypeToColorMap<typeof badgeWithPillTypes>[T],\n type = \"pill-color\" as T,\n icon: Icon,\n className,\n}: BadgeIconProps<T>) => {\n const colors = badgeWithPillTypes[type];\n const style = colors.styles[color as keyof typeof colors.styles];\n\n return (\n <View className={cx(colors.common, badgeOnlyIconSizeMaps[type][size], style.root, className)}>\n <Icon weight=\"bold\" className={cx(badgeStyles.icon, style.addon)} size={12} />\n </View>\n );\n};\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactNode, FC } from 'react';
|
|
2
|
+
|
|
3
|
+
declare const BUTTON_GROUP_SIZES: readonly ["sm", "md", "lg"];
|
|
4
|
+
type ButtonGroupSize = (typeof BUTTON_GROUP_SIZES)[number];
|
|
5
|
+
|
|
6
|
+
type ButtonGroupIconProps = {
|
|
7
|
+
className?: string;
|
|
8
|
+
size?: number;
|
|
9
|
+
color?: string;
|
|
10
|
+
};
|
|
11
|
+
type SegmentPosition = "only" | "first" | "middle" | "last";
|
|
12
|
+
interface ButtonGroupItemProps {
|
|
13
|
+
id: string;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
iconLeading?: FC<ButtonGroupIconProps> | ReactNode;
|
|
16
|
+
iconTrailing?: FC<ButtonGroupIconProps> | ReactNode;
|
|
17
|
+
isDisabled?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
accessibilityLabel?: string;
|
|
20
|
+
/** Set by `ButtonGroup` so corners and the shared border line up. */
|
|
21
|
+
segmentPosition?: SegmentPosition;
|
|
22
|
+
}
|
|
23
|
+
interface ButtonGroupProps {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
size?: ButtonGroupSize;
|
|
26
|
+
className?: string;
|
|
27
|
+
isDisabled?: boolean;
|
|
28
|
+
selectionMode?: "single" | "multiple";
|
|
29
|
+
selectedKeys?: Iterable<string>;
|
|
30
|
+
defaultSelectedKeys?: Iterable<string>;
|
|
31
|
+
onSelectionChange?: (keys: string[]) => void;
|
|
32
|
+
}
|
|
33
|
+
declare const ButtonGroupItem: FC<ButtonGroupItemProps>;
|
|
34
|
+
declare const ButtonGroup: FC<ButtonGroupProps>;
|
|
35
|
+
|
|
36
|
+
export { ButtonGroup, type ButtonGroupIconProps, ButtonGroupItem, type ButtonGroupItemProps, type ButtonGroupProps, type ButtonGroupSize };
|