@flipdish/ui-library 0.35.2 → 0.36.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.
Files changed (35) hide show
  1. package/dist/components/atoms/Badge/Badge.styles.cjs +194 -0
  2. package/dist/components/atoms/Badge/Badge.styles.cjs.map +1 -0
  3. package/dist/components/atoms/Badge/Badge.styles.d.ts +236 -0
  4. package/dist/components/atoms/Badge/Badge.styles.d.ts.map +1 -0
  5. package/dist/components/atoms/Badge/Badge.styles.js +192 -0
  6. package/dist/components/atoms/Badge/Badge.styles.js.map +1 -0
  7. package/dist/components/atoms/Badge/badge.types.cjs.map +1 -1
  8. package/dist/components/atoms/Badge/badge.types.d.ts +0 -2
  9. package/dist/components/atoms/Badge/badge.types.d.ts.map +1 -1
  10. package/dist/components/atoms/Badge/badge.types.js.map +1 -1
  11. package/dist/components/atoms/Badge/badge.utils.d.ts +21 -0
  12. package/dist/components/atoms/Badge/badge.utils.d.ts.map +1 -0
  13. package/dist/components/atoms/Badge/index.cjs +15 -248
  14. package/dist/components/atoms/Badge/index.cjs.map +1 -1
  15. package/dist/components/atoms/Badge/index.d.ts +11 -50
  16. package/dist/components/atoms/Badge/index.d.ts.map +1 -1
  17. package/dist/components/atoms/Badge/index.js +15 -248
  18. package/dist/components/atoms/Badge/index.js.map +1 -1
  19. package/dist/native/components/atoms/Badge/Badge.styles.d.ts +236 -0
  20. package/dist/native/components/atoms/Badge/Badge.styles.d.ts.map +1 -0
  21. package/dist/native/components/atoms/Badge/Badge.styles.js +327 -0
  22. package/dist/native/components/atoms/Badge/Badge.styles.js.map +1 -0
  23. package/dist/native/components/atoms/Badge/badge.types.d.ts +21 -0
  24. package/dist/native/components/atoms/Badge/badge.types.d.ts.map +1 -0
  25. package/dist/native/components/atoms/Badge/badge.types.js +8 -0
  26. package/dist/native/components/atoms/Badge/badge.types.js.map +1 -0
  27. package/dist/native/components/atoms/Badge/badge.utils.d.ts +21 -0
  28. package/dist/native/components/atoms/Badge/badge.utils.d.ts.map +1 -0
  29. package/dist/native/components/atoms/Badge/badge.utils.js +32 -0
  30. package/dist/native/components/atoms/Badge/badge.utils.js.map +1 -0
  31. package/dist/native/components/atoms/Badge/index.d.ts +94 -8
  32. package/dist/native/components/atoms/Badge/index.d.ts.map +1 -0
  33. package/dist/native/components/atoms/Badge/index.js +66 -0
  34. package/dist/native/components/atoms/Badge/index.js.map +1 -0
  35. package/package.json +1 -1
@@ -0,0 +1,327 @@
1
+ import { badgeTypes } from './badge.types.js';
2
+
3
+ const filledColors = {
4
+ gray: {
5
+ root: 'bg-utility-neutral-50 text-utility-neutral-700 ring-utility-neutral-200',
6
+ addon: 'text-utility-neutral-500',
7
+ dotColor: 'utility-neutral-500',
8
+ addonButton: 'hover:bg-utility-neutral-100 text-utility-neutral-400 hover:text-utility-neutral-500',
9
+ },
10
+ brand: {
11
+ root: 'bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-200',
12
+ addon: 'text-utility-brand-500',
13
+ dotColor: 'utility-brand-500',
14
+ addonButton: 'hover:bg-utility-brand-100 text-utility-brand-400 hover:text-utility-brand-500',
15
+ },
16
+ error: {
17
+ root: 'bg-utility-red-50 text-utility-red-700 ring-utility-red-200',
18
+ addon: 'text-utility-red-500',
19
+ dotColor: 'utility-red-500',
20
+ addonButton: 'hover:bg-utility-red-100 text-utility-red-400 hover:text-utility-red-500',
21
+ },
22
+ warning: {
23
+ root: 'bg-utility-yellow-50 text-utility-yellow-700 ring-utility-yellow-200',
24
+ addon: 'text-utility-yellow-500',
25
+ dotColor: 'utility-yellow-500',
26
+ addonButton: 'hover:bg-utility-yellow-100 text-utility-yellow-400 hover:text-utility-yellow-500',
27
+ },
28
+ success: {
29
+ root: 'bg-utility-green-50 text-utility-green-700 ring-utility-green-200',
30
+ addon: 'text-utility-green-500',
31
+ dotColor: 'utility-green-500',
32
+ addonButton: 'hover:bg-utility-green-100 text-utility-green-400 hover:text-utility-green-500',
33
+ },
34
+ slate: {
35
+ root: 'bg-utility-slate-50 text-utility-slate-700 ring-utility-slate-200',
36
+ addon: 'text-utility-slate-500',
37
+ dotColor: 'utility-slate-500',
38
+ addonButton: 'hover:bg-utility-slate-100 text-utility-slate-400 hover:text-utility-slate-500',
39
+ },
40
+ sky: {
41
+ root: 'bg-utility-sky-50 text-utility-sky-700 ring-utility-sky-200',
42
+ addon: 'text-utility-sky-500',
43
+ dotColor: 'utility-sky-500',
44
+ addonButton: 'hover:bg-utility-sky-100 text-utility-sky-400 hover:text-utility-sky-500',
45
+ },
46
+ blue: {
47
+ root: 'bg-utility-blue-50 text-utility-blue-700 ring-utility-blue-200',
48
+ addon: 'text-utility-blue-500',
49
+ dotColor: 'utility-blue-500',
50
+ addonButton: 'hover:bg-utility-blue-100 text-utility-blue-400 hover:text-utility-blue-500',
51
+ },
52
+ indigo: {
53
+ root: 'bg-utility-indigo-50 text-utility-indigo-700 ring-utility-indigo-200',
54
+ addon: 'text-utility-indigo-500',
55
+ dotColor: 'utility-indigo-500',
56
+ addonButton: 'hover:bg-utility-indigo-100 text-utility-indigo-400 hover:text-utility-indigo-500',
57
+ },
58
+ purple: {
59
+ root: 'bg-utility-purple-50 text-utility-purple-700 ring-utility-purple-200',
60
+ addon: 'text-utility-purple-500',
61
+ dotColor: 'utility-purple-500',
62
+ addonButton: 'hover:bg-utility-purple-100 text-utility-purple-400 hover:text-utility-purple-500',
63
+ },
64
+ pink: {
65
+ root: 'bg-utility-pink-50 text-utility-pink-700 ring-utility-pink-200',
66
+ addon: 'text-utility-pink-500',
67
+ dotColor: 'utility-pink-500',
68
+ addonButton: 'hover:bg-utility-pink-100 text-utility-pink-400 hover:text-utility-pink-500',
69
+ },
70
+ orange: {
71
+ root: 'bg-utility-orange-50 text-utility-orange-700 ring-utility-orange-200',
72
+ addon: 'text-utility-orange-500',
73
+ dotColor: 'utility-orange-500',
74
+ addonButton: 'hover:bg-utility-orange-100 text-utility-orange-400 hover:text-utility-orange-500',
75
+ },
76
+ };
77
+ const addonOnlyColors = Object.fromEntries(Object.entries(filledColors).map(([key, value]) => [key, { root: '', addon: value.addon, dotColor: value.dotColor }]));
78
+ const shapeCommon = {
79
+ [badgeTypes.pillColor]: 'size-max flex items-center whitespace-nowrap rounded-full ring-1 ring-inset',
80
+ [badgeTypes.badgeColor]: 'size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset',
81
+ [badgeTypes.badgeModern]: 'size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset shadow-xs',
82
+ };
83
+ /** Pill sizes, and the square-cornered sizes the `color` and `modern` types share. */
84
+ const bySize = (pill, badge) => ({
85
+ [badgeTypes.pillColor]: pill,
86
+ [badgeTypes.badgeColor]: badge,
87
+ [badgeTypes.badgeModern]: badge,
88
+ });
89
+ /**
90
+ * Shared `Badge` style config, read by `index.tsx` (and by `index.native.tsx` once it exists).
91
+ *
92
+ * `types.standard` serves `Badge`, `BadgeWithFlag`, `BadgeWithImage`, `BadgeWithButton` and `BadgeIcon`:
93
+ * its `modern` type only offers `gray`, with the fill in `root`. `types.addon` serves `BadgeWithDot`
94
+ * and `BadgeWithIcon`: its `modern` type takes every colour, which tints only the dot or icon while
95
+ * the fill sits in `common`.
96
+ *
97
+ * Complete literal class names, never template literals — Tailwind scans source for whole candidates.
98
+ */
99
+ const styles = {
100
+ types: {
101
+ addon: {
102
+ [badgeTypes.pillColor]: { common: shapeCommon[badgeTypes.pillColor], styles: filledColors },
103
+ [badgeTypes.badgeColor]: { common: shapeCommon[badgeTypes.badgeColor], styles: filledColors },
104
+ [badgeTypes.badgeModern]: {
105
+ common: 'size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset bg-primary text-secondary ring-primary shadow-xs',
106
+ styles: addonOnlyColors,
107
+ },
108
+ },
109
+ },
110
+ sizes: {
111
+ label: bySize({
112
+ sm: 'py-0.5 px-2 text-xs font-medium',
113
+ md: 'py-0.5 px-2.5 text-sm font-medium',
114
+ lg: 'py-1 px-3 text-sm font-medium',
115
+ }, {
116
+ sm: 'py-0.5 px-1.5 text-xs font-medium',
117
+ md: 'py-0.5 px-2 text-sm font-medium',
118
+ lg: 'py-1 px-2.5 text-sm font-medium rounded-lg',
119
+ }),
120
+ dot: bySize({
121
+ sm: 'gap-1 py-0.5 pl-1.5 pr-2 text-xs font-medium',
122
+ md: 'gap-1.5 py-0.5 pl-2 pr-2.5 text-sm font-medium',
123
+ lg: 'gap-1.5 py-1 pl-2.5 pr-3 text-sm font-medium',
124
+ }, {
125
+ sm: 'gap-1 py-0.5 px-1.5 text-xs font-medium',
126
+ md: 'gap-1.5 py-0.5 px-2 text-sm font-medium',
127
+ lg: 'gap-1.5 py-1 px-2.5 text-sm font-medium rounded-lg',
128
+ }),
129
+ icon: bySize({
130
+ sm: {
131
+ trailing: 'gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-medium',
132
+ leading: 'gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-medium',
133
+ },
134
+ md: {
135
+ trailing: 'gap-1 py-0.5 pl-2.5 pr-2 text-sm font-medium',
136
+ leading: 'gap-1 py-0.5 pr-2.5 pl-2 text-sm font-medium',
137
+ },
138
+ lg: {
139
+ trailing: 'gap-1 py-1 pl-3 pr-2.5 text-sm font-medium',
140
+ leading: 'gap-1 py-1 pr-3 pl-2.5 text-sm font-medium',
141
+ },
142
+ }, {
143
+ sm: {
144
+ trailing: 'gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-medium',
145
+ leading: 'gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-medium',
146
+ },
147
+ md: {
148
+ trailing: 'gap-1 py-0.5 pl-2 pr-1.5 text-sm font-medium',
149
+ leading: 'gap-1 py-0.5 pr-2 pl-1.5 text-sm font-medium',
150
+ },
151
+ lg: {
152
+ trailing: 'gap-1 py-1 pl-2.5 pr-2 text-sm font-medium rounded-lg',
153
+ leading: 'gap-1 py-1 pr-2.5 pl-2 text-sm font-medium rounded-lg',
154
+ },
155
+ }),
156
+ /** Shared by `BadgeWithFlag` and `BadgeWithImage`, whose media sits flush to the leading edge. */
157
+ media: bySize({
158
+ sm: 'gap-1 py-0.5 pl-0.75 pr-2 text-xs font-medium',
159
+ md: 'gap-1.5 py-0.5 pl-1 pr-2.5 text-sm font-medium',
160
+ lg: 'gap-1.5 py-1 pl-1.5 pr-3 text-sm font-medium',
161
+ }, {
162
+ sm: 'gap-1 py-0.5 pl-1 pr-1.5 text-xs font-medium',
163
+ md: 'gap-1.5 py-0.5 pl-1.5 pr-2 text-sm font-medium',
164
+ lg: 'gap-1.5 py-1 pl-2 pr-2.5 text-sm font-medium rounded-lg',
165
+ }),
166
+ button: bySize({
167
+ sm: 'gap-0.5 py-0.5 pl-2 pr-0.75 text-xs font-medium',
168
+ md: 'gap-0.5 py-0.5 pl-2.5 pr-1 text-sm font-medium',
169
+ lg: 'gap-0.5 py-1 pl-3 pr-1.5 text-sm font-medium',
170
+ }, {
171
+ sm: 'gap-0.5 py-0.5 pl-1.5 pr-0.75 text-xs font-medium',
172
+ md: 'gap-0.5 py-0.5 pl-2 pr-1 text-sm font-medium',
173
+ lg: 'gap-0.5 py-1 pl-2.5 pr-1.5 text-sm font-medium rounded-lg',
174
+ }),
175
+ iconOnly: bySize({ sm: 'p-1.25', md: 'p-1.5', lg: 'p-2' }, { sm: 'p-1.25', md: 'p-1.5', lg: 'p-2 rounded-lg' }),
176
+ },
177
+ /**
178
+ * React Native only. Text and icon colours are light-mode hex rather than tokens: `Text` ignores
179
+ * `className` under the current `react-native-css` preview (see `Avatar/index.native.tsx`) and an icon
180
+ * has no `currentColor` to inherit, so both take an explicit value, as `Button` does. `text` mirrors
181
+ * web's `*-700`, `addon` its `*-500`, and `button`, `buttonPressed` and `buttonPressedBg` the dismiss button's resting tint and `hover:` state.
182
+ * `bg` and `border` are classes because a `View` resolves them. Primitive hex values are
183
+ * Tailwind's, so they match web in light mode only.
184
+ */
185
+ native: {
186
+ common: {
187
+ [badgeTypes.pillColor]: 'flex-row items-center self-start rounded-full',
188
+ [badgeTypes.badgeColor]: 'flex-row items-center self-start rounded-md',
189
+ [badgeTypes.badgeModern]: 'flex-row items-center self-start rounded-md shadow-xs',
190
+ },
191
+ colors: {
192
+ gray: {
193
+ bg: 'bg-utility-neutral-50',
194
+ border: 'border-utility-neutral-200',
195
+ text: '#404040',
196
+ addon: '#737373',
197
+ button: '#a3a3a3',
198
+ buttonPressed: '#737373',
199
+ buttonPressedBg: 'bg-utility-neutral-100',
200
+ },
201
+ brand: {
202
+ bg: 'bg-utility-brand-50',
203
+ border: 'border-utility-brand-200',
204
+ text: '#085eb1',
205
+ addon: '#1c8bf3',
206
+ button: '#4ea3f9',
207
+ buttonPressed: '#1c8bf3',
208
+ buttonPressedBg: 'bg-utility-brand-100',
209
+ },
210
+ error: {
211
+ bg: 'bg-utility-red-50',
212
+ border: 'border-utility-red-200',
213
+ text: '#b91c1c',
214
+ addon: '#ef4444',
215
+ button: '#f87171',
216
+ buttonPressed: '#ef4444',
217
+ buttonPressedBg: 'bg-utility-red-100',
218
+ },
219
+ warning: {
220
+ bg: 'bg-utility-yellow-50',
221
+ border: 'border-utility-yellow-200',
222
+ text: '#a16207',
223
+ addon: '#eab308',
224
+ button: '#facc15',
225
+ buttonPressed: '#eab308',
226
+ buttonPressedBg: 'bg-utility-yellow-100',
227
+ },
228
+ success: {
229
+ bg: 'bg-utility-green-50',
230
+ border: 'border-utility-green-200',
231
+ text: '#15803d',
232
+ addon: '#22c55e',
233
+ button: '#4ade80',
234
+ buttonPressed: '#22c55e',
235
+ buttonPressedBg: 'bg-utility-green-100',
236
+ },
237
+ slate: {
238
+ bg: 'bg-utility-slate-50',
239
+ border: 'border-utility-slate-200',
240
+ text: '#334155',
241
+ addon: '#64748b',
242
+ button: '#94a3b8',
243
+ buttonPressed: '#64748b',
244
+ buttonPressedBg: 'bg-utility-slate-100',
245
+ },
246
+ sky: {
247
+ bg: 'bg-utility-sky-50',
248
+ border: 'border-utility-sky-200',
249
+ text: '#0369a1',
250
+ addon: '#0ea5e9',
251
+ button: '#38bdf8',
252
+ buttonPressed: '#0ea5e9',
253
+ buttonPressedBg: 'bg-utility-sky-100',
254
+ },
255
+ blue: {
256
+ bg: 'bg-utility-blue-50',
257
+ border: 'border-utility-blue-200',
258
+ text: '#1d4ed8',
259
+ addon: '#3b82f6',
260
+ button: '#60a5fa',
261
+ buttonPressed: '#3b82f6',
262
+ buttonPressedBg: 'bg-utility-blue-100',
263
+ },
264
+ indigo: {
265
+ bg: 'bg-utility-indigo-50',
266
+ border: 'border-utility-indigo-200',
267
+ text: '#4338ca',
268
+ addon: '#6366f1',
269
+ button: '#818cf8',
270
+ buttonPressed: '#6366f1',
271
+ buttonPressedBg: 'bg-utility-indigo-100',
272
+ },
273
+ purple: {
274
+ bg: 'bg-utility-purple-50',
275
+ border: 'border-utility-purple-200',
276
+ text: '#7e22ce',
277
+ addon: '#a855f7',
278
+ button: '#c084fc',
279
+ buttonPressed: '#a855f7',
280
+ buttonPressedBg: 'bg-utility-purple-100',
281
+ },
282
+ pink: {
283
+ bg: 'bg-utility-pink-50',
284
+ border: 'border-utility-pink-200',
285
+ text: '#be185d',
286
+ addon: '#ec4899',
287
+ button: '#f472b6',
288
+ buttonPressed: '#ec4899',
289
+ buttonPressedBg: 'bg-utility-pink-100',
290
+ },
291
+ orange: {
292
+ bg: 'bg-utility-orange-50',
293
+ border: 'border-utility-orange-200',
294
+ text: '#c2410c',
295
+ addon: '#f97316',
296
+ button: '#fb923c',
297
+ buttonPressed: '#f97316',
298
+ buttonPressedBg: 'bg-utility-orange-100',
299
+ },
300
+ },
301
+ /** The neutral `modern` fill; `text` is `text-secondary` and `addon` is `fg-quaternary`. */
302
+ modern: {
303
+ bg: 'bg-primary',
304
+ border: 'border-primary',
305
+ text: '#404040',
306
+ addon: '#a3a3a3',
307
+ button: '#a3a3a3',
308
+ buttonPressed: '#737373',
309
+ buttonPressedBg: 'bg-utility-neutral-100',
310
+ },
311
+ /** Pixel size of the leading, trailing and dismiss icons — web's `size-3`. */
312
+ iconSize: 12,
313
+ /** Stroke width of those icons, in the 24px icon viewBox — web's `stroke-3`. */
314
+ iconStrokeWidth: 3,
315
+ /** Diameter of the image in `BadgeWithImage` — web's `size-4`. */
316
+ imageSize: 16,
317
+ /** Label type scale, web's `text-xs` for `sm` and `text-sm` otherwise. */
318
+ text: {
319
+ sm: { fontSize: 12, lineHeight: 16 },
320
+ md: { fontSize: 14, lineHeight: 20 },
321
+ lg: { fontSize: 14, lineHeight: 20 },
322
+ },
323
+ },
324
+ };
325
+
326
+ export { styles };
327
+ //# sourceMappingURL=Badge.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Badge.styles.js","sources":["../../../../../../src/components/atoms/Badge/Badge.styles.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAiBA,MAAM,YAAY,GAA0C;AAC1D,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,yEAAyE;AAC/E,QAAA,KAAK,EAAE,0BAA0B;AACjC,QAAA,QAAQ,EAAE,qBAAqB;AAC/B,QAAA,WAAW,EAAE,sFAAsF;AACpG,KAAA;AACD,IAAA,KAAK,EAAE;AACL,QAAA,IAAI,EAAE,mEAAmE;AACzE,QAAA,KAAK,EAAE,wBAAwB;AAC/B,QAAA,QAAQ,EAAE,mBAAmB;AAC7B,QAAA,WAAW,EAAE,gFAAgF;AAC9F,KAAA;AACD,IAAA,KAAK,EAAE;AACL,QAAA,IAAI,EAAE,6DAA6D;AACnE,QAAA,KAAK,EAAE,sBAAsB;AAC7B,QAAA,QAAQ,EAAE,iBAAiB;AAC3B,QAAA,WAAW,EAAE,0EAA0E;AACxF,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,sEAAsE;AAC5E,QAAA,KAAK,EAAE,yBAAyB;AAChC,QAAA,QAAQ,EAAE,oBAAoB;AAC9B,QAAA,WAAW,EAAE,mFAAmF;AACjG,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,IAAI,EAAE,mEAAmE;AAC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AACjB,gBAAA,aAAa,EAAE,SAAS;AACxB,gBAAA,eAAe,EAAE,qBAAqB;AACvC,aAAA;AACD,YAAA,MAAM,EAAE;AACN,gBAAA,EAAE,EAAE,sBAAsB;AAC1B,gBAAA,MAAM,EAAE,2BAA2B;AAEnC,gBAAA,IAAI,EAAE,SAAS;AACf,gBAAA,KAAK,EAAE,SAAS;AAChB,gBAAA,MAAM,EAAE,SAAS;AACjB,gBAAA,aAAa,EAAE,SAAS;AACxB,gBAAA,eAAe,EAAE,uBAAuB;AACzC,aAAA;AACwC,SAAA;;AAE3C,QAAA,MAAM,EAAE;AACN,YAAA,EAAE,EAAE,YAAY;AAChB,YAAA,MAAM,EAAE,gBAAgB;AAExB,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,KAAK,EAAE,SAAS;AAChB,YAAA,MAAM,EAAE,SAAS;AACjB,YAAA,aAAa,EAAE,SAAS;AACxB,YAAA,eAAe,EAAE,wBAAwB;AACrB,SAAA;;AAEtB,QAAA,QAAQ,EAAE,EAAE;;AAEZ,QAAA,eAAe,EAAE,CAAC;;AAElB,QAAA,SAAS,EAAE,EAAE;;AAEb,QAAA,IAAI,EAAE;YACJ,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACpC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;YACpC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;AAC6B,SAAA;AACpE,KAAA;;;"}
@@ -0,0 +1,21 @@
1
+ export type IconComponentType = React.FunctionComponent<{
2
+ className?: string;
3
+ strokeWidth?: string | number;
4
+ }>;
5
+ export type Sizes = 'sm' | 'md' | 'lg';
6
+ export type BadgeColors = 'gray' | 'brand' | 'error' | 'warning' | 'success' | 'slate' | 'sky' | 'blue' | 'indigo' | 'purple' | 'pink' | 'orange';
7
+ export type ExtractColorKeys<T> = T extends {
8
+ styles: infer C;
9
+ } ? keyof C : never;
10
+ export type ExtractBadgeKeys<T> = keyof T;
11
+ export type BadgeTypeToColorMap<T> = {
12
+ [K in ExtractBadgeKeys<T>]: ExtractColorKeys<T[K]>;
13
+ };
14
+ export type BadgeTypeColors<T> = ExtractColorKeys<T[keyof T]>;
15
+ export declare const badgeTypes: {
16
+ readonly pillColor: "pill-color";
17
+ readonly badgeColor: "color";
18
+ readonly badgeModern: "modern";
19
+ };
20
+ export type BadgeTypes = (typeof badgeTypes)[keyof typeof badgeTypes];
21
+ //# sourceMappingURL=badge.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/Badge/badge.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/G,MAAM,MAAM,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElJ,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC;AAClF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAC1C,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;KAClC,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACnD,CAAC;AACF,MAAM,MAAM,eAAe,CAAC,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAE9D,eAAO,MAAM,UAAU;;;;CAIb,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ const badgeTypes = {
2
+ pillColor: 'pill-color',
3
+ badgeColor: 'color',
4
+ badgeModern: 'modern',
5
+ };
6
+
7
+ export { badgeTypes };
8
+ //# sourceMappingURL=badge.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.types.js","sources":["../../../../../../src/components/atoms/Badge/badge.types.ts"],"sourcesContent":[null],"names":[],"mappings":"AAaO,MAAM,UAAU,GAAG;AACxB,IAAA,SAAS,EAAE,YAAY;AACvB,IAAA,UAAU,EAAE,OAAO;AACnB,IAAA,WAAW,EAAE,QAAQ;;;"}
@@ -0,0 +1,21 @@
1
+ import { type NativeTone } from './Badge.styles';
2
+ import type { BadgeColors, BadgeTypes } from './badge.types';
3
+ /**
4
+ * Drops the typography utilities from a shared size string, leaving the padding, gap and radius a
5
+ * React Native `View` can resolve. The label's size and weight reach `Text` through `style` instead.
6
+ *
7
+ * @param sizeClasses A size entry from `styles.sizes`, which mixes layout and `text-*`/`font-*` utilities.
8
+ * @returns The same classes without any `text-*` or `font-*` utility.
9
+ */
10
+ export declare const layoutClasses: (sizeClasses: string) => string;
11
+ /**
12
+ * Resolves the React Native colour set for a badge.
13
+ *
14
+ * @param kind `standard` for badges whose `modern` type is a fixed neutral fill, `addon` for those where
15
+ * `modern` keeps the neutral fill but tints the dot or icon with `color` (see `Badge.styles.ts`).
16
+ * @param type The badge shape; only `modern` changes the result.
17
+ * @param color The badge colour, honoured everywhere except the fill of a `modern` badge.
18
+ * @returns The classes and hex values to paint the fill, label and icons.
19
+ */
20
+ export declare const resolveNativeTone: (kind: "standard" | "addon", type: BadgeTypes, color: BadgeColors) => NativeTone;
21
+ //# sourceMappingURL=badge.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/Badge/badge.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAU,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,aAAa,MAAM,WAInC,CAAC;AAEf;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,UAAU,GAAG,OAAO,EAAE,MAAM,UAAU,EAAE,OAAO,WAAW,KAAG,UAIpG,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { styles } from './Badge.styles.js';
2
+
3
+ /**
4
+ * Drops the typography utilities from a shared size string, leaving the padding, gap and radius a
5
+ * React Native `View` can resolve. The label's size and weight reach `Text` through `style` instead.
6
+ *
7
+ * @param sizeClasses A size entry from `styles.sizes`, which mixes layout and `text-*`/`font-*` utilities.
8
+ * @returns The same classes without any `text-*` or `font-*` utility.
9
+ */
10
+ const layoutClasses = (sizeClasses) => sizeClasses
11
+ .split(' ')
12
+ .filter((token) => !token.startsWith('text-') && !token.startsWith('font-'))
13
+ .join(' ');
14
+ /**
15
+ * Resolves the React Native colour set for a badge.
16
+ *
17
+ * @param kind `standard` for badges whose `modern` type is a fixed neutral fill, `addon` for those where
18
+ * `modern` keeps the neutral fill but tints the dot or icon with `color` (see `Badge.styles.ts`).
19
+ * @param type The badge shape; only `modern` changes the result.
20
+ * @param color The badge colour, honoured everywhere except the fill of a `modern` badge.
21
+ * @returns The classes and hex values to paint the fill, label and icons.
22
+ */
23
+ const resolveNativeTone = (kind, type, color) => {
24
+ if (type !== 'modern')
25
+ return styles.native.colors[color];
26
+ if (kind === 'standard')
27
+ return styles.native.modern;
28
+ return { ...styles.native.modern, addon: styles.native.colors[color].addon };
29
+ };
30
+
31
+ export { layoutClasses, resolveNativeTone };
32
+ //# sourceMappingURL=badge.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.utils.js","sources":["../../../../../../src/components/atoms/Badge/badge.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;;;;;;AAMG;MACU,aAAa,GAAG,CAAC,WAAmB,KAC/C;KACG,KAAK,CAAC,GAAG;KACT,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC;KAC1E,IAAI,CAAC,GAAG;AAEb;;;;;;;;AAQG;AACI,MAAM,iBAAiB,GAAG,CAAC,IAA0B,EAAE,IAAgB,EAAE,KAAkB,KAAgB;IAChH,IAAI,IAAI,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;IACzD,IAAI,IAAI,KAAK,UAAU;AAAE,QAAA,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM;IACpD,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE;AAC9E;;"}
@@ -1,12 +1,98 @@
1
+ import { type FC, type ReactNode } from 'react';
2
+ import { type PressableProps } from 'react-native';
3
+ import { styles } from './Badge.styles';
4
+ import type { BadgeTypes, BadgeTypeToColorMap, Sizes } from './badge.types';
5
+ export type { BadgeColors } from './badge.types';
6
+ type IconComponent = FC<{
7
+ size?: number;
8
+ color?: string;
9
+ strokeWidth?: number;
10
+ }>;
11
+ /** The colours a badge accepts for a given `type`; `modern` is neutral, so it only takes `gray`. */
12
+ export type BadgeColor<T extends BadgeTypes> = BadgeTypeToColorMap<typeof styles.types.standard>[T];
13
+ export interface BadgeProps<T extends BadgeTypes> {
14
+ /** Selects the shape: a fully rounded `pill-color`, a square-cornered `color`, or a neutral `modern`. */
15
+ type?: T;
16
+ /** Sets the padding and text size. */
17
+ size?: Sizes;
18
+ /** Sets the fill, text and border colours; the options available depend on `type`. */
19
+ color?: BadgeColor<T>;
20
+ /** Label shown inside the badge. */
21
+ children: ReactNode;
22
+ /** Layout classes merged onto the root `View`, such as margins. Colour goes through `color`. */
23
+ className?: string;
24
+ /** Overrides the generated `testID` (defaults to `fd-badge`). */
25
+ 'data-testid'?: string;
26
+ }
1
27
  /**
2
- * `Badge` has no React Native implementation.
28
+ * React Native `Badge` — a compact label for statuses, categories, counts and tags, drawn as a
29
+ * `View` holding a `Text`. All variants and sizes match web.
3
30
  *
4
- * This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
5
- * that importing `@flipdish/ui-library/components/atoms/Badge` from React Native fails at
6
- * compile time rather than resolving to the web build's types. There is no
7
- * matching `index.js`, so Metro cannot bundle this module either.
31
+ * - The ring becomes a `border` on every variant, since `ring-inset` is unverified under `react-native-css`.
32
+ * - Label and icon colours are light-mode hex values, not tokens: `Text` ignores `className` under the
33
+ * current `react-native-css` preview and an icon has no `currentColor` to inherit (see `Badge.styles.ts`).
34
+ * - `BadgeWithFlag` is not available yet because `Flag` has no React Native implementation.
35
+ * - `className` accepts layout classes only; transitions have no equivalent.
8
36
  *
9
- * To make `Badge` available on React Native, add an `index.native.tsx` beside
10
- * its `index.tsx` — the build picks it up automatically and this stub disappears.
37
+ * @summary compact status, category, or count label (React Native)
11
38
  */
12
- export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
39
+ export declare const Badge: <T extends BadgeTypes>({ type, size, color, children, className, "data-testid": dataTestId, }: BadgeProps<T>) => import("react").JSX.Element;
40
+ interface BadgeWithDotProps<T extends BadgeTypes> {
41
+ type?: T;
42
+ size?: Sizes;
43
+ color?: BadgeTypeToColorMap<typeof styles.types.addon>[T];
44
+ className?: string;
45
+ children: ReactNode;
46
+ /** Overrides the generated `testID` (defaults to `fd-badge`); the `Dot` derives `--dot` from it. */
47
+ 'data-testid'?: string;
48
+ }
49
+ /** `Badge` variant with a coloured status dot before the label. */
50
+ export declare const BadgeWithDot: <T extends BadgeTypes>({ size, color, type, className, children, "data-testid": dataTestId, }: BadgeWithDotProps<T>) => import("react").JSX.Element;
51
+ interface BadgeWithIconProps<T extends BadgeTypes> {
52
+ type?: T;
53
+ size?: Sizes;
54
+ color?: BadgeTypeToColorMap<typeof styles.types.addon>[T];
55
+ iconLeading?: IconComponent;
56
+ iconTrailing?: IconComponent;
57
+ children: ReactNode;
58
+ className?: string;
59
+ /** Overrides the generated `testID` (defaults to `fd-badge`); the leading/trailing icon derives `--icon` from it. */
60
+ 'data-testid'?: string;
61
+ }
62
+ /** `Badge` variant with a leading or trailing icon beside the label. */
63
+ export declare const BadgeWithIcon: <T extends BadgeTypes>({ size, color, type, iconLeading: IconLeading, iconTrailing: IconTrailing, children, className, "data-testid": dataTestId, }: BadgeWithIconProps<T>) => import("react").JSX.Element;
64
+ interface BadgeWithImageProps<T extends BadgeTypes> {
65
+ type?: T;
66
+ size?: Sizes;
67
+ /** URL of the image shown before the label. */
68
+ imgSrc: string;
69
+ color?: BadgeColor<T>;
70
+ children: ReactNode;
71
+ }
72
+ /** `Badge` variant with a small round image before the label. */
73
+ export declare const BadgeWithImage: <T extends BadgeTypes>({ size, color, type, imgSrc, children, }: BadgeWithImageProps<T>) => import("react").JSX.Element;
74
+ interface BadgeWithButtonProps<T extends BadgeTypes> {
75
+ type?: T;
76
+ size?: Sizes;
77
+ /** Icon shown in the trailing button; defaults to a close `X`. */
78
+ icon?: IconComponent;
79
+ color?: BadgeColor<T>;
80
+ children: ReactNode;
81
+ /** The accessible name of the button. */
82
+ buttonLabel?: string;
83
+ /** Called when the trailing button is pressed. */
84
+ onButtonClick?: PressableProps['onPress'];
85
+ /** Overrides the generated `testID` (defaults to `fd-badge`); the dismiss button derives `--close-button` from it. */
86
+ 'data-testid'?: string;
87
+ }
88
+ /** `Badge` variant with a trailing icon button, typically to dismiss or remove the tag. */
89
+ export declare const BadgeWithButton: <T extends BadgeTypes>({ size, color, type, icon: Icon, buttonLabel, onButtonClick, children, "data-testid": dataTestId, }: BadgeWithButtonProps<T>) => import("react").JSX.Element;
90
+ interface BadgeIconProps<T extends BadgeTypes> {
91
+ type?: T;
92
+ size?: Sizes;
93
+ icon: IconComponent;
94
+ color?: BadgeColor<T>;
95
+ }
96
+ /** Icon-only `Badge` with no label text. */
97
+ export declare const BadgeIcon: <T extends BadgeTypes>({ size, color, type, icon: Icon, }: BadgeIconProps<T>) => import("react").JSX.Element;
98
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/Badge/index.native.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAoB,KAAK,cAAc,EAAc,MAAM,cAAc,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAG5E,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,KAAK,aAAa,GAAG,EAAE,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAEjF,oGAAoG;AACpG,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,mBAAmB,CAAC,OAAO,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AAEpG,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,UAAU;IAC9C,yGAAyG;IACzG,IAAI,CAAC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IACpB,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;CACvB;AAED,4CAA4C;AAC5C,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,UAAU,EAAE,oCAK7C,cAAc,CAAC,CAAC,CAAC,gCAQnB,CAAC"}
@@ -0,0 +1,66 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { X } from '@flipdish/ui-icons';
3
+ import { Dot } from '../Dot/index.js';
4
+ import { cx } from '../../../utilities/cx/index.js';
5
+ import { useResolvedTestId, joinTestId } from '../../../utilities/testIdUtils/index.js';
6
+ import { useState } from 'react';
7
+ import { View, Pressable, Image, Text } from 'react-native';
8
+ import { styles } from './Badge.styles.js';
9
+ import { layoutClasses, resolveNativeTone } from './badge.utils.js';
10
+
11
+ /** Root classes shared by every labelled variant: shape, fill, border and the layout half of the size. */
12
+ const rootClass = (type, sizeClasses, tone, className) => cx(styles.native.common[type], 'border', tone.bg, tone.border, layoutClasses(sizeClasses), className);
13
+ const Label = ({ size, color, children }) => (jsx(Text, { style: { color, fontWeight: '500', ...styles.native.text[size] }, children: children }));
14
+ /**
15
+ * React Native `Badge` — a compact label for statuses, categories, counts and tags, drawn as a
16
+ * `View` holding a `Text`. All variants and sizes match web.
17
+ *
18
+ * - The ring becomes a `border` on every variant, since `ring-inset` is unverified under `react-native-css`.
19
+ * - Label and icon colours are light-mode hex values, not tokens: `Text` ignores `className` under the
20
+ * current `react-native-css` preview and an icon has no `currentColor` to inherit (see `Badge.styles.ts`).
21
+ * - `BadgeWithFlag` is not available yet because `Flag` has no React Native implementation.
22
+ * - `className` accepts layout classes only; transitions have no equivalent.
23
+ *
24
+ * @summary compact status, category, or count label (React Native)
25
+ */
26
+ const Badge = ({ type = 'pill-color', size = 'md', color = 'gray', children, className, 'data-testid': dataTestId, }) => {
27
+ const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
28
+ const tone = resolveNativeTone('standard', type, color);
29
+ return (jsx(View, { testID: badgeTestId, className: rootClass(type, styles.sizes.label[type][size], tone, className), children: jsx(Label, { size: size, color: tone.text, children: children }) }));
30
+ };
31
+ /** `Badge` variant with a coloured status dot before the label. */
32
+ const BadgeWithDot = ({ size = 'md', color = 'gray', type = 'pill-color', className, children, 'data-testid': dataTestId, }) => {
33
+ const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
34
+ const tone = resolveNativeTone('addon', type, color);
35
+ const dotColor = styles.types.addon[type].styles[color].dotColor;
36
+ return (jsxs(View, { testID: badgeTestId, className: rootClass(type, styles.sizes.dot[type][size], tone, className), children: [jsx(Dot, { color: dotColor, size: "sm", "data-testid": joinTestId(badgeTestId, 'dot') }), jsx(Label, { size: size, color: tone.text, children: children })] }));
37
+ };
38
+ /** `Badge` variant with a leading or trailing icon beside the label. */
39
+ const BadgeWithIcon = ({ size = 'md', color = 'gray', type = 'pill-color', iconLeading: IconLeading, iconTrailing: IconTrailing, children, className, 'data-testid': dataTestId, }) => {
40
+ const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
41
+ const tone = resolveNativeTone('addon', type, color);
42
+ const placement = IconLeading ? 'leading' : 'trailing';
43
+ const iconProps = { size: styles.native.iconSize, color: tone.addon, strokeWidth: styles.native.iconStrokeWidth };
44
+ return (jsxs(View, { testID: badgeTestId, className: rootClass(type, styles.sizes.icon[type][size][placement], tone, className), children: [IconLeading && (jsx(View, { testID: joinTestId(badgeTestId, 'icon'), children: jsx(IconLeading, { ...iconProps }) })), jsx(Label, { size: size, color: tone.text, children: children }), IconTrailing && (jsx(View, { testID: joinTestId(badgeTestId, 'icon'), children: jsx(IconTrailing, { ...iconProps }) }))] }));
45
+ };
46
+ /** `Badge` variant with a small round image before the label. */
47
+ const BadgeWithImage = ({ size = 'md', color = 'gray', type = 'pill-color', imgSrc, children, }) => {
48
+ const tone = resolveNativeTone('standard', type, color);
49
+ const { imageSize } = styles.native;
50
+ return (jsxs(View, { className: rootClass(type, styles.sizes.media[type][size], tone), children: [jsx(Image, { source: { uri: imgSrc }, accessibilityLabel: "Badge image", style: { width: imageSize, height: imageSize, borderRadius: imageSize / 2 } }), jsx(Label, { size: size, color: tone.text, children: children })] }));
51
+ };
52
+ /** `Badge` variant with a trailing icon button, typically to dismiss or remove the tag. */
53
+ const BadgeWithButton = ({ size = 'md', color = 'gray', type = 'pill-color', icon: Icon = X, buttonLabel, onButtonClick, children, 'data-testid': dataTestId, }) => {
54
+ const badgeTestId = useResolvedTestId({ testId: dataTestId, segment: 'badge', rootName: 'badge' });
55
+ const [pressed, setPressed] = useState(false);
56
+ const tone = resolveNativeTone('standard', type, color);
57
+ return (jsxs(View, { testID: badgeTestId, className: rootClass(type, styles.sizes.button[type][size], tone), children: [jsx(Label, { size: size, color: tone.text, children: children }), jsx(Pressable, { testID: joinTestId(badgeTestId, 'close-button'), accessibilityRole: "button", accessibilityLabel: buttonLabel, onPress: onButtonClick, onPressIn: () => setPressed(true), onPressOut: () => setPressed(false), className: cx('items-center justify-center p-0.5', type === 'pill-color' ? 'rounded-full' : 'rounded-[3px]', pressed && tone.buttonPressedBg), children: jsx(Icon, { size: styles.native.iconSize, color: pressed ? tone.buttonPressed : tone.button, strokeWidth: styles.native.iconStrokeWidth }) })] }));
58
+ };
59
+ /** Icon-only `Badge` with no label text. */
60
+ const BadgeIcon = ({ size = 'md', color = 'gray', type = 'pill-color', icon: Icon, }) => {
61
+ const tone = resolveNativeTone('standard', type, color);
62
+ return (jsx(View, { className: cx(styles.native.common[type], 'border', tone.bg, tone.border, layoutClasses(styles.sizes.iconOnly[type][size])), children: jsx(Icon, { size: styles.native.iconSize, color: tone.addon, strokeWidth: styles.native.iconStrokeWidth }) }));
63
+ };
64
+
65
+ export { Badge, BadgeIcon, BadgeWithButton, BadgeWithDot, BadgeWithIcon, BadgeWithImage };
66
+ //# sourceMappingURL=index.js.map