@flipdish/ui-library 0.35.2 → 0.36.1
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/dist/components/atoms/Badge/Badge.styles.cjs +194 -0
- package/dist/components/atoms/Badge/Badge.styles.cjs.map +1 -0
- package/dist/components/atoms/Badge/Badge.styles.d.ts +236 -0
- package/dist/components/atoms/Badge/Badge.styles.d.ts.map +1 -0
- package/dist/components/atoms/Badge/Badge.styles.js +192 -0
- package/dist/components/atoms/Badge/Badge.styles.js.map +1 -0
- package/dist/components/atoms/Badge/badge.types.cjs.map +1 -1
- package/dist/components/atoms/Badge/badge.types.d.ts +0 -2
- package/dist/components/atoms/Badge/badge.types.d.ts.map +1 -1
- package/dist/components/atoms/Badge/badge.types.js.map +1 -1
- package/dist/components/atoms/Badge/badge.utils.d.ts +21 -0
- package/dist/components/atoms/Badge/badge.utils.d.ts.map +1 -0
- package/dist/components/atoms/Badge/index.cjs +15 -248
- package/dist/components/atoms/Badge/index.cjs.map +1 -1
- package/dist/components/atoms/Badge/index.d.ts +11 -50
- package/dist/components/atoms/Badge/index.d.ts.map +1 -1
- package/dist/components/atoms/Badge/index.js +15 -248
- package/dist/components/atoms/Badge/index.js.map +1 -1
- package/dist/components/molecules/Pagination/components/PaginationBase.cjs +2 -104
- package/dist/components/molecules/Pagination/components/PaginationBase.cjs.map +1 -1
- package/dist/components/molecules/Pagination/components/PaginationBase.d.ts +2 -14
- package/dist/components/molecules/Pagination/components/PaginationBase.d.ts.map +1 -1
- package/dist/components/molecules/Pagination/components/PaginationBase.js +3 -105
- package/dist/components/molecules/Pagination/components/PaginationBase.js.map +1 -1
- package/dist/components/molecules/Pagination/pagination.utils.cjs +89 -0
- package/dist/components/molecules/Pagination/pagination.utils.cjs.map +1 -0
- package/dist/components/molecules/Pagination/pagination.utils.d.ts +32 -0
- package/dist/components/molecules/Pagination/pagination.utils.d.ts.map +1 -0
- package/dist/components/molecules/Pagination/pagination.utils.js +87 -0
- package/dist/components/molecules/Pagination/pagination.utils.js.map +1 -0
- package/dist/native/components/atoms/Badge/Badge.styles.d.ts +236 -0
- package/dist/native/components/atoms/Badge/Badge.styles.d.ts.map +1 -0
- package/dist/native/components/atoms/Badge/Badge.styles.js +327 -0
- package/dist/native/components/atoms/Badge/Badge.styles.js.map +1 -0
- package/dist/native/components/atoms/Badge/badge.types.d.ts +21 -0
- package/dist/native/components/atoms/Badge/badge.types.d.ts.map +1 -0
- package/dist/native/components/atoms/Badge/badge.types.js +8 -0
- package/dist/native/components/atoms/Badge/badge.types.js.map +1 -0
- package/dist/native/components/atoms/Badge/badge.utils.d.ts +21 -0
- package/dist/native/components/atoms/Badge/badge.utils.d.ts.map +1 -0
- package/dist/native/components/atoms/Badge/badge.utils.js +32 -0
- package/dist/native/components/atoms/Badge/badge.utils.js.map +1 -0
- package/dist/native/components/atoms/Badge/index.d.ts +94 -8
- package/dist/native/components/atoms/Badge/index.d.ts.map +1 -0
- package/dist/native/components/atoms/Badge/index.js +66 -0
- package/dist/native/components/atoms/Badge/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var badge_types = require('./badge.types.cjs');
|
|
4
|
+
|
|
5
|
+
const filledColors = {
|
|
6
|
+
gray: {
|
|
7
|
+
root: 'bg-utility-neutral-50 text-utility-neutral-700 ring-utility-neutral-200',
|
|
8
|
+
addon: 'text-utility-neutral-500',
|
|
9
|
+
dotColor: 'utility-neutral-500',
|
|
10
|
+
addonButton: 'hover:bg-utility-neutral-100 text-utility-neutral-400 hover:text-utility-neutral-500',
|
|
11
|
+
},
|
|
12
|
+
brand: {
|
|
13
|
+
root: 'bg-utility-brand-50 text-utility-brand-700 ring-utility-brand-200',
|
|
14
|
+
addon: 'text-utility-brand-500',
|
|
15
|
+
dotColor: 'utility-brand-500',
|
|
16
|
+
addonButton: 'hover:bg-utility-brand-100 text-utility-brand-400 hover:text-utility-brand-500',
|
|
17
|
+
},
|
|
18
|
+
error: {
|
|
19
|
+
root: 'bg-utility-red-50 text-utility-red-700 ring-utility-red-200',
|
|
20
|
+
addon: 'text-utility-red-500',
|
|
21
|
+
dotColor: 'utility-red-500',
|
|
22
|
+
addonButton: 'hover:bg-utility-red-100 text-utility-red-400 hover:text-utility-red-500',
|
|
23
|
+
},
|
|
24
|
+
warning: {
|
|
25
|
+
root: 'bg-utility-yellow-50 text-utility-yellow-700 ring-utility-yellow-200',
|
|
26
|
+
addon: 'text-utility-yellow-500',
|
|
27
|
+
dotColor: 'utility-yellow-500',
|
|
28
|
+
addonButton: 'hover:bg-utility-yellow-100 text-utility-yellow-400 hover:text-utility-yellow-500',
|
|
29
|
+
},
|
|
30
|
+
success: {
|
|
31
|
+
root: 'bg-utility-green-50 text-utility-green-700 ring-utility-green-200',
|
|
32
|
+
addon: 'text-utility-green-500',
|
|
33
|
+
dotColor: 'utility-green-500',
|
|
34
|
+
addonButton: 'hover:bg-utility-green-100 text-utility-green-400 hover:text-utility-green-500',
|
|
35
|
+
},
|
|
36
|
+
slate: {
|
|
37
|
+
root: 'bg-utility-slate-50 text-utility-slate-700 ring-utility-slate-200',
|
|
38
|
+
addon: 'text-utility-slate-500',
|
|
39
|
+
dotColor: 'utility-slate-500',
|
|
40
|
+
addonButton: 'hover:bg-utility-slate-100 text-utility-slate-400 hover:text-utility-slate-500',
|
|
41
|
+
},
|
|
42
|
+
sky: {
|
|
43
|
+
root: 'bg-utility-sky-50 text-utility-sky-700 ring-utility-sky-200',
|
|
44
|
+
addon: 'text-utility-sky-500',
|
|
45
|
+
dotColor: 'utility-sky-500',
|
|
46
|
+
addonButton: 'hover:bg-utility-sky-100 text-utility-sky-400 hover:text-utility-sky-500',
|
|
47
|
+
},
|
|
48
|
+
blue: {
|
|
49
|
+
root: 'bg-utility-blue-50 text-utility-blue-700 ring-utility-blue-200',
|
|
50
|
+
addon: 'text-utility-blue-500',
|
|
51
|
+
dotColor: 'utility-blue-500',
|
|
52
|
+
addonButton: 'hover:bg-utility-blue-100 text-utility-blue-400 hover:text-utility-blue-500',
|
|
53
|
+
},
|
|
54
|
+
indigo: {
|
|
55
|
+
root: 'bg-utility-indigo-50 text-utility-indigo-700 ring-utility-indigo-200',
|
|
56
|
+
addon: 'text-utility-indigo-500',
|
|
57
|
+
dotColor: 'utility-indigo-500',
|
|
58
|
+
addonButton: 'hover:bg-utility-indigo-100 text-utility-indigo-400 hover:text-utility-indigo-500',
|
|
59
|
+
},
|
|
60
|
+
purple: {
|
|
61
|
+
root: 'bg-utility-purple-50 text-utility-purple-700 ring-utility-purple-200',
|
|
62
|
+
addon: 'text-utility-purple-500',
|
|
63
|
+
dotColor: 'utility-purple-500',
|
|
64
|
+
addonButton: 'hover:bg-utility-purple-100 text-utility-purple-400 hover:text-utility-purple-500',
|
|
65
|
+
},
|
|
66
|
+
pink: {
|
|
67
|
+
root: 'bg-utility-pink-50 text-utility-pink-700 ring-utility-pink-200',
|
|
68
|
+
addon: 'text-utility-pink-500',
|
|
69
|
+
dotColor: 'utility-pink-500',
|
|
70
|
+
addonButton: 'hover:bg-utility-pink-100 text-utility-pink-400 hover:text-utility-pink-500',
|
|
71
|
+
},
|
|
72
|
+
orange: {
|
|
73
|
+
root: 'bg-utility-orange-50 text-utility-orange-700 ring-utility-orange-200',
|
|
74
|
+
addon: 'text-utility-orange-500',
|
|
75
|
+
dotColor: 'utility-orange-500',
|
|
76
|
+
addonButton: 'hover:bg-utility-orange-100 text-utility-orange-400 hover:text-utility-orange-500',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
const addonOnlyColors = Object.fromEntries(Object.entries(filledColors).map(([key, value]) => [key, { root: '', addon: value.addon, dotColor: value.dotColor }]));
|
|
80
|
+
const modernGray = {
|
|
81
|
+
gray: {
|
|
82
|
+
root: 'bg-primary text-secondary ring-primary',
|
|
83
|
+
addon: 'text-fg-quaternary',
|
|
84
|
+
dotColor: 'fg-quaternary',
|
|
85
|
+
addonButton: 'hover:bg-utility-neutral-100 text-utility-neutral-400 hover:text-utility-neutral-500',
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
const shapeCommon = {
|
|
89
|
+
[badge_types.badgeTypes.pillColor]: 'size-max flex items-center whitespace-nowrap rounded-full ring-1 ring-inset',
|
|
90
|
+
[badge_types.badgeTypes.badgeColor]: 'size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset',
|
|
91
|
+
[badge_types.badgeTypes.badgeModern]: 'size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset shadow-xs',
|
|
92
|
+
};
|
|
93
|
+
/** Pill sizes, and the square-cornered sizes the `color` and `modern` types share. */
|
|
94
|
+
const bySize = (pill, badge) => ({
|
|
95
|
+
[badge_types.badgeTypes.pillColor]: pill,
|
|
96
|
+
[badge_types.badgeTypes.badgeColor]: badge,
|
|
97
|
+
[badge_types.badgeTypes.badgeModern]: badge,
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* Shared `Badge` style config, read by `index.tsx` (and by `index.native.tsx` once it exists).
|
|
101
|
+
*
|
|
102
|
+
* `types.standard` serves `Badge`, `BadgeWithFlag`, `BadgeWithImage`, `BadgeWithButton` and `BadgeIcon`:
|
|
103
|
+
* its `modern` type only offers `gray`, with the fill in `root`. `types.addon` serves `BadgeWithDot`
|
|
104
|
+
* and `BadgeWithIcon`: its `modern` type takes every colour, which tints only the dot or icon while
|
|
105
|
+
* the fill sits in `common`.
|
|
106
|
+
*
|
|
107
|
+
* Complete literal class names, never template literals — Tailwind scans source for whole candidates.
|
|
108
|
+
*/
|
|
109
|
+
const styles = {
|
|
110
|
+
types: {
|
|
111
|
+
standard: {
|
|
112
|
+
[badge_types.badgeTypes.pillColor]: { common: shapeCommon[badge_types.badgeTypes.pillColor], styles: filledColors },
|
|
113
|
+
[badge_types.badgeTypes.badgeColor]: { common: shapeCommon[badge_types.badgeTypes.badgeColor], styles: filledColors },
|
|
114
|
+
[badge_types.badgeTypes.badgeModern]: { common: shapeCommon[badge_types.badgeTypes.badgeModern], styles: modernGray },
|
|
115
|
+
},
|
|
116
|
+
addon: {
|
|
117
|
+
[badge_types.badgeTypes.pillColor]: { common: shapeCommon[badge_types.badgeTypes.pillColor], styles: filledColors },
|
|
118
|
+
[badge_types.badgeTypes.badgeColor]: { common: shapeCommon[badge_types.badgeTypes.badgeColor], styles: filledColors },
|
|
119
|
+
[badge_types.badgeTypes.badgeModern]: {
|
|
120
|
+
common: 'size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset bg-primary text-secondary ring-primary shadow-xs',
|
|
121
|
+
styles: addonOnlyColors,
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
sizes: {
|
|
126
|
+
label: bySize({
|
|
127
|
+
sm: 'py-0.5 px-2 text-xs font-medium',
|
|
128
|
+
md: 'py-0.5 px-2.5 text-sm font-medium',
|
|
129
|
+
lg: 'py-1 px-3 text-sm font-medium',
|
|
130
|
+
}, {
|
|
131
|
+
sm: 'py-0.5 px-1.5 text-xs font-medium',
|
|
132
|
+
md: 'py-0.5 px-2 text-sm font-medium',
|
|
133
|
+
lg: 'py-1 px-2.5 text-sm font-medium rounded-lg',
|
|
134
|
+
}),
|
|
135
|
+
dot: bySize({
|
|
136
|
+
sm: 'gap-1 py-0.5 pl-1.5 pr-2 text-xs font-medium',
|
|
137
|
+
md: 'gap-1.5 py-0.5 pl-2 pr-2.5 text-sm font-medium',
|
|
138
|
+
lg: 'gap-1.5 py-1 pl-2.5 pr-3 text-sm font-medium',
|
|
139
|
+
}, {
|
|
140
|
+
sm: 'gap-1 py-0.5 px-1.5 text-xs font-medium',
|
|
141
|
+
md: 'gap-1.5 py-0.5 px-2 text-sm font-medium',
|
|
142
|
+
lg: 'gap-1.5 py-1 px-2.5 text-sm font-medium rounded-lg',
|
|
143
|
+
}),
|
|
144
|
+
icon: bySize({
|
|
145
|
+
sm: {
|
|
146
|
+
trailing: 'gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-medium',
|
|
147
|
+
leading: 'gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-medium',
|
|
148
|
+
},
|
|
149
|
+
md: {
|
|
150
|
+
trailing: 'gap-1 py-0.5 pl-2.5 pr-2 text-sm font-medium',
|
|
151
|
+
leading: 'gap-1 py-0.5 pr-2.5 pl-2 text-sm font-medium',
|
|
152
|
+
},
|
|
153
|
+
lg: {
|
|
154
|
+
trailing: 'gap-1 py-1 pl-3 pr-2.5 text-sm font-medium',
|
|
155
|
+
leading: 'gap-1 py-1 pr-3 pl-2.5 text-sm font-medium',
|
|
156
|
+
},
|
|
157
|
+
}, {
|
|
158
|
+
sm: {
|
|
159
|
+
trailing: 'gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-medium',
|
|
160
|
+
leading: 'gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-medium',
|
|
161
|
+
},
|
|
162
|
+
md: {
|
|
163
|
+
trailing: 'gap-1 py-0.5 pl-2 pr-1.5 text-sm font-medium',
|
|
164
|
+
leading: 'gap-1 py-0.5 pr-2 pl-1.5 text-sm font-medium',
|
|
165
|
+
},
|
|
166
|
+
lg: {
|
|
167
|
+
trailing: 'gap-1 py-1 pl-2.5 pr-2 text-sm font-medium rounded-lg',
|
|
168
|
+
leading: 'gap-1 py-1 pr-2.5 pl-2 text-sm font-medium rounded-lg',
|
|
169
|
+
},
|
|
170
|
+
}),
|
|
171
|
+
/** Shared by `BadgeWithFlag` and `BadgeWithImage`, whose media sits flush to the leading edge. */
|
|
172
|
+
media: bySize({
|
|
173
|
+
sm: 'gap-1 py-0.5 pl-0.75 pr-2 text-xs font-medium',
|
|
174
|
+
md: 'gap-1.5 py-0.5 pl-1 pr-2.5 text-sm font-medium',
|
|
175
|
+
lg: 'gap-1.5 py-1 pl-1.5 pr-3 text-sm font-medium',
|
|
176
|
+
}, {
|
|
177
|
+
sm: 'gap-1 py-0.5 pl-1 pr-1.5 text-xs font-medium',
|
|
178
|
+
md: 'gap-1.5 py-0.5 pl-1.5 pr-2 text-sm font-medium',
|
|
179
|
+
lg: 'gap-1.5 py-1 pl-2 pr-2.5 text-sm font-medium rounded-lg',
|
|
180
|
+
}),
|
|
181
|
+
button: bySize({
|
|
182
|
+
sm: 'gap-0.5 py-0.5 pl-2 pr-0.75 text-xs font-medium',
|
|
183
|
+
md: 'gap-0.5 py-0.5 pl-2.5 pr-1 text-sm font-medium',
|
|
184
|
+
lg: 'gap-0.5 py-1 pl-3 pr-1.5 text-sm font-medium',
|
|
185
|
+
}, {
|
|
186
|
+
sm: 'gap-0.5 py-0.5 pl-1.5 pr-0.75 text-xs font-medium',
|
|
187
|
+
md: 'gap-0.5 py-0.5 pl-2 pr-1 text-sm font-medium',
|
|
188
|
+
lg: 'gap-0.5 py-1 pl-2.5 pr-1.5 text-sm font-medium rounded-lg',
|
|
189
|
+
}),
|
|
190
|
+
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' }),
|
|
191
|
+
}};
|
|
192
|
+
|
|
193
|
+
exports.styles = styles;
|
|
194
|
+
//# sourceMappingURL=Badge.styles.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.styles.cjs","sources":["../../../../src/components/atoms/Badge/Badge.styles.ts"],"sourcesContent":[null],"names":["badgeTypes"],"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,gFAA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D,CACF;QACD,MAAM,EAAE,MAAM,CACZ;AACE,YAAA,EAAE,EAAE,iDAAiD;AACrD,YAAA,EAAE,EAAE,gDAAgD;AACpD,YAAA,EAAE,EAAE,8CAA8C;SACnD,EACD;AACE,YAAA,EAAE,EAAE,mDAAmD;AACvD,YAAA,EAAE,EAAE,8CAA8C;AAClD,YAAA,EAAE,EAAE,2DAA2D;SAChE,CACF;AACD,QAAA,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC;AAChH;;"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { DotColor } from '@flipdish/ui-library/components/atoms/Dot';
|
|
2
|
+
import type { BadgeColors, BadgeTypes, Sizes } from './badge.types';
|
|
3
|
+
/** React Native colour set for one badge colour: `View` classes plus the hex values `Text` and icons need. */
|
|
4
|
+
export type NativeTone = {
|
|
5
|
+
bg: string;
|
|
6
|
+
border: string;
|
|
7
|
+
text: string;
|
|
8
|
+
addon: string;
|
|
9
|
+
button: string;
|
|
10
|
+
buttonPressed: string;
|
|
11
|
+
buttonPressedBg: string;
|
|
12
|
+
};
|
|
13
|
+
export type BadgeColorStyles = {
|
|
14
|
+
root: string;
|
|
15
|
+
addon: string;
|
|
16
|
+
dotColor: DotColor;
|
|
17
|
+
addonButton: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Shared `Badge` style config, read by `index.tsx` (and by `index.native.tsx` once it exists).
|
|
21
|
+
*
|
|
22
|
+
* `types.standard` serves `Badge`, `BadgeWithFlag`, `BadgeWithImage`, `BadgeWithButton` and `BadgeIcon`:
|
|
23
|
+
* its `modern` type only offers `gray`, with the fill in `root`. `types.addon` serves `BadgeWithDot`
|
|
24
|
+
* and `BadgeWithIcon`: its `modern` type takes every colour, which tints only the dot or icon while
|
|
25
|
+
* the fill sits in `common`.
|
|
26
|
+
*
|
|
27
|
+
* Complete literal class names, never template literals — Tailwind scans source for whole candidates.
|
|
28
|
+
*/
|
|
29
|
+
export declare const styles: {
|
|
30
|
+
types: {
|
|
31
|
+
standard: {
|
|
32
|
+
"pill-color": {
|
|
33
|
+
common: string;
|
|
34
|
+
styles: Record<BadgeColors, BadgeColorStyles>;
|
|
35
|
+
};
|
|
36
|
+
color: {
|
|
37
|
+
common: string;
|
|
38
|
+
styles: Record<BadgeColors, BadgeColorStyles>;
|
|
39
|
+
};
|
|
40
|
+
modern: {
|
|
41
|
+
common: string;
|
|
42
|
+
styles: {
|
|
43
|
+
gray: {
|
|
44
|
+
root: string;
|
|
45
|
+
addon: string;
|
|
46
|
+
dotColor: "fg-quaternary";
|
|
47
|
+
addonButton: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
addon: {
|
|
53
|
+
"pill-color": {
|
|
54
|
+
common: string;
|
|
55
|
+
styles: Record<BadgeColors, BadgeColorStyles>;
|
|
56
|
+
};
|
|
57
|
+
color: {
|
|
58
|
+
common: string;
|
|
59
|
+
styles: Record<BadgeColors, BadgeColorStyles>;
|
|
60
|
+
};
|
|
61
|
+
modern: {
|
|
62
|
+
common: string;
|
|
63
|
+
styles: Record<BadgeColors, Omit<BadgeColorStyles, "addonButton">>;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
sizes: {
|
|
68
|
+
label: Record<BadgeTypes, Record<Sizes, string>>;
|
|
69
|
+
dot: Record<BadgeTypes, Record<Sizes, string>>;
|
|
70
|
+
icon: Record<BadgeTypes, Record<Sizes, {
|
|
71
|
+
trailing: string;
|
|
72
|
+
leading: string;
|
|
73
|
+
}>>;
|
|
74
|
+
/** Shared by `BadgeWithFlag` and `BadgeWithImage`, whose media sits flush to the leading edge. */
|
|
75
|
+
media: Record<BadgeTypes, Record<Sizes, string>>;
|
|
76
|
+
button: Record<BadgeTypes, Record<Sizes, string>>;
|
|
77
|
+
iconOnly: Record<BadgeTypes, Record<Sizes, string>>;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* React Native only. Text and icon colours are light-mode hex rather than tokens: `Text` ignores
|
|
81
|
+
* `className` under the current `react-native-css` preview (see `Avatar/index.native.tsx`) and an icon
|
|
82
|
+
* has no `currentColor` to inherit, so both take an explicit value, as `Button` does. `text` mirrors
|
|
83
|
+
* web's `*-700`, `addon` its `*-500`, and `button`, `buttonPressed` and `buttonPressedBg` the dismiss button's resting tint and `hover:` state.
|
|
84
|
+
* `bg` and `border` are classes because a `View` resolves them. Primitive hex values are
|
|
85
|
+
* Tailwind's, so they match web in light mode only.
|
|
86
|
+
*/
|
|
87
|
+
native: {
|
|
88
|
+
common: {
|
|
89
|
+
"pill-color": string;
|
|
90
|
+
color: string;
|
|
91
|
+
modern: string;
|
|
92
|
+
};
|
|
93
|
+
colors: {
|
|
94
|
+
gray: {
|
|
95
|
+
bg: string;
|
|
96
|
+
border: string;
|
|
97
|
+
text: string;
|
|
98
|
+
addon: string;
|
|
99
|
+
button: string;
|
|
100
|
+
buttonPressed: string;
|
|
101
|
+
buttonPressedBg: string;
|
|
102
|
+
};
|
|
103
|
+
brand: {
|
|
104
|
+
bg: string;
|
|
105
|
+
border: string;
|
|
106
|
+
text: string;
|
|
107
|
+
addon: string;
|
|
108
|
+
button: string;
|
|
109
|
+
buttonPressed: string;
|
|
110
|
+
buttonPressedBg: string;
|
|
111
|
+
};
|
|
112
|
+
error: {
|
|
113
|
+
bg: string;
|
|
114
|
+
border: string;
|
|
115
|
+
text: string;
|
|
116
|
+
addon: string;
|
|
117
|
+
button: string;
|
|
118
|
+
buttonPressed: string;
|
|
119
|
+
buttonPressedBg: string;
|
|
120
|
+
};
|
|
121
|
+
warning: {
|
|
122
|
+
bg: string;
|
|
123
|
+
border: string;
|
|
124
|
+
text: string;
|
|
125
|
+
addon: string;
|
|
126
|
+
button: string;
|
|
127
|
+
buttonPressed: string;
|
|
128
|
+
buttonPressedBg: string;
|
|
129
|
+
};
|
|
130
|
+
success: {
|
|
131
|
+
bg: string;
|
|
132
|
+
border: string;
|
|
133
|
+
text: string;
|
|
134
|
+
addon: string;
|
|
135
|
+
button: string;
|
|
136
|
+
buttonPressed: string;
|
|
137
|
+
buttonPressedBg: string;
|
|
138
|
+
};
|
|
139
|
+
slate: {
|
|
140
|
+
bg: string;
|
|
141
|
+
border: string;
|
|
142
|
+
text: string;
|
|
143
|
+
addon: string;
|
|
144
|
+
button: string;
|
|
145
|
+
buttonPressed: string;
|
|
146
|
+
buttonPressedBg: string;
|
|
147
|
+
};
|
|
148
|
+
sky: {
|
|
149
|
+
bg: string;
|
|
150
|
+
border: string;
|
|
151
|
+
text: string;
|
|
152
|
+
addon: string;
|
|
153
|
+
button: string;
|
|
154
|
+
buttonPressed: string;
|
|
155
|
+
buttonPressedBg: string;
|
|
156
|
+
};
|
|
157
|
+
blue: {
|
|
158
|
+
bg: string;
|
|
159
|
+
border: string;
|
|
160
|
+
text: string;
|
|
161
|
+
addon: string;
|
|
162
|
+
button: string;
|
|
163
|
+
buttonPressed: string;
|
|
164
|
+
buttonPressedBg: string;
|
|
165
|
+
};
|
|
166
|
+
indigo: {
|
|
167
|
+
bg: string;
|
|
168
|
+
border: string;
|
|
169
|
+
text: string;
|
|
170
|
+
addon: string;
|
|
171
|
+
button: string;
|
|
172
|
+
buttonPressed: string;
|
|
173
|
+
buttonPressedBg: string;
|
|
174
|
+
};
|
|
175
|
+
purple: {
|
|
176
|
+
bg: string;
|
|
177
|
+
border: string;
|
|
178
|
+
text: string;
|
|
179
|
+
addon: string;
|
|
180
|
+
button: string;
|
|
181
|
+
buttonPressed: string;
|
|
182
|
+
buttonPressedBg: string;
|
|
183
|
+
};
|
|
184
|
+
pink: {
|
|
185
|
+
bg: string;
|
|
186
|
+
border: string;
|
|
187
|
+
text: string;
|
|
188
|
+
addon: string;
|
|
189
|
+
button: string;
|
|
190
|
+
buttonPressed: string;
|
|
191
|
+
buttonPressedBg: string;
|
|
192
|
+
};
|
|
193
|
+
orange: {
|
|
194
|
+
bg: string;
|
|
195
|
+
border: string;
|
|
196
|
+
text: string;
|
|
197
|
+
addon: string;
|
|
198
|
+
button: string;
|
|
199
|
+
buttonPressed: string;
|
|
200
|
+
buttonPressedBg: string;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
/** The neutral `modern` fill; `text` is `text-secondary` and `addon` is `fg-quaternary`. */
|
|
204
|
+
modern: {
|
|
205
|
+
bg: string;
|
|
206
|
+
border: string;
|
|
207
|
+
text: string;
|
|
208
|
+
addon: string;
|
|
209
|
+
button: string;
|
|
210
|
+
buttonPressed: string;
|
|
211
|
+
buttonPressedBg: string;
|
|
212
|
+
};
|
|
213
|
+
/** Pixel size of the leading, trailing and dismiss icons — web's `size-3`. */
|
|
214
|
+
iconSize: number;
|
|
215
|
+
/** Stroke width of those icons, in the 24px icon viewBox — web's `stroke-3`. */
|
|
216
|
+
iconStrokeWidth: number;
|
|
217
|
+
/** Diameter of the image in `BadgeWithImage` — web's `size-4`. */
|
|
218
|
+
imageSize: number;
|
|
219
|
+
/** Label type scale, web's `text-xs` for `sm` and `text-sm` otherwise. */
|
|
220
|
+
text: {
|
|
221
|
+
sm: {
|
|
222
|
+
fontSize: number;
|
|
223
|
+
lineHeight: number;
|
|
224
|
+
};
|
|
225
|
+
md: {
|
|
226
|
+
fontSize: number;
|
|
227
|
+
lineHeight: number;
|
|
228
|
+
};
|
|
229
|
+
lg: {
|
|
230
|
+
fontSize: number;
|
|
231
|
+
lineHeight: number;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
//# sourceMappingURL=Badge.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Badge.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Badge/Badge.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAGpE,8GAA8G;AAC9G,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAuGxG;;;;;;;;;GASG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAuEf,kGAAkG;;;;;IA2BpG;;;;;;;OAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAiID,4FAA4F;;;;;;;;;;QAW5F,8EAA8E;;QAE9E,gFAAgF;;QAEhF,kEAAkE;;QAElE,0EAA0E;;;;;;;;;;;;;;;;CAO7E,CAAC"}
|
|
@@ -0,0 +1,192 @@
|
|
|
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 modernGray = {
|
|
79
|
+
gray: {
|
|
80
|
+
root: 'bg-primary text-secondary ring-primary',
|
|
81
|
+
addon: 'text-fg-quaternary',
|
|
82
|
+
dotColor: 'fg-quaternary',
|
|
83
|
+
addonButton: 'hover:bg-utility-neutral-100 text-utility-neutral-400 hover:text-utility-neutral-500',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
const shapeCommon = {
|
|
87
|
+
[badgeTypes.pillColor]: 'size-max flex items-center whitespace-nowrap rounded-full ring-1 ring-inset',
|
|
88
|
+
[badgeTypes.badgeColor]: 'size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset',
|
|
89
|
+
[badgeTypes.badgeModern]: 'size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset shadow-xs',
|
|
90
|
+
};
|
|
91
|
+
/** Pill sizes, and the square-cornered sizes the `color` and `modern` types share. */
|
|
92
|
+
const bySize = (pill, badge) => ({
|
|
93
|
+
[badgeTypes.pillColor]: pill,
|
|
94
|
+
[badgeTypes.badgeColor]: badge,
|
|
95
|
+
[badgeTypes.badgeModern]: badge,
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Shared `Badge` style config, read by `index.tsx` (and by `index.native.tsx` once it exists).
|
|
99
|
+
*
|
|
100
|
+
* `types.standard` serves `Badge`, `BadgeWithFlag`, `BadgeWithImage`, `BadgeWithButton` and `BadgeIcon`:
|
|
101
|
+
* its `modern` type only offers `gray`, with the fill in `root`. `types.addon` serves `BadgeWithDot`
|
|
102
|
+
* and `BadgeWithIcon`: its `modern` type takes every colour, which tints only the dot or icon while
|
|
103
|
+
* the fill sits in `common`.
|
|
104
|
+
*
|
|
105
|
+
* Complete literal class names, never template literals — Tailwind scans source for whole candidates.
|
|
106
|
+
*/
|
|
107
|
+
const styles = {
|
|
108
|
+
types: {
|
|
109
|
+
standard: {
|
|
110
|
+
[badgeTypes.pillColor]: { common: shapeCommon[badgeTypes.pillColor], styles: filledColors },
|
|
111
|
+
[badgeTypes.badgeColor]: { common: shapeCommon[badgeTypes.badgeColor], styles: filledColors },
|
|
112
|
+
[badgeTypes.badgeModern]: { common: shapeCommon[badgeTypes.badgeModern], styles: modernGray },
|
|
113
|
+
},
|
|
114
|
+
addon: {
|
|
115
|
+
[badgeTypes.pillColor]: { common: shapeCommon[badgeTypes.pillColor], styles: filledColors },
|
|
116
|
+
[badgeTypes.badgeColor]: { common: shapeCommon[badgeTypes.badgeColor], styles: filledColors },
|
|
117
|
+
[badgeTypes.badgeModern]: {
|
|
118
|
+
common: 'size-max flex items-center whitespace-nowrap rounded-md ring-1 ring-inset bg-primary text-secondary ring-primary shadow-xs',
|
|
119
|
+
styles: addonOnlyColors,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
sizes: {
|
|
124
|
+
label: bySize({
|
|
125
|
+
sm: 'py-0.5 px-2 text-xs font-medium',
|
|
126
|
+
md: 'py-0.5 px-2.5 text-sm font-medium',
|
|
127
|
+
lg: 'py-1 px-3 text-sm font-medium',
|
|
128
|
+
}, {
|
|
129
|
+
sm: 'py-0.5 px-1.5 text-xs font-medium',
|
|
130
|
+
md: 'py-0.5 px-2 text-sm font-medium',
|
|
131
|
+
lg: 'py-1 px-2.5 text-sm font-medium rounded-lg',
|
|
132
|
+
}),
|
|
133
|
+
dot: bySize({
|
|
134
|
+
sm: 'gap-1 py-0.5 pl-1.5 pr-2 text-xs font-medium',
|
|
135
|
+
md: 'gap-1.5 py-0.5 pl-2 pr-2.5 text-sm font-medium',
|
|
136
|
+
lg: 'gap-1.5 py-1 pl-2.5 pr-3 text-sm font-medium',
|
|
137
|
+
}, {
|
|
138
|
+
sm: 'gap-1 py-0.5 px-1.5 text-xs font-medium',
|
|
139
|
+
md: 'gap-1.5 py-0.5 px-2 text-sm font-medium',
|
|
140
|
+
lg: 'gap-1.5 py-1 px-2.5 text-sm font-medium rounded-lg',
|
|
141
|
+
}),
|
|
142
|
+
icon: bySize({
|
|
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.5 pr-2 text-sm font-medium',
|
|
149
|
+
leading: 'gap-1 py-0.5 pr-2.5 pl-2 text-sm font-medium',
|
|
150
|
+
},
|
|
151
|
+
lg: {
|
|
152
|
+
trailing: 'gap-1 py-1 pl-3 pr-2.5 text-sm font-medium',
|
|
153
|
+
leading: 'gap-1 py-1 pr-3 pl-2.5 text-sm font-medium',
|
|
154
|
+
},
|
|
155
|
+
}, {
|
|
156
|
+
sm: {
|
|
157
|
+
trailing: 'gap-0.5 py-0.5 pl-2 pr-1.5 text-xs font-medium',
|
|
158
|
+
leading: 'gap-0.5 py-0.5 pr-2 pl-1.5 text-xs font-medium',
|
|
159
|
+
},
|
|
160
|
+
md: {
|
|
161
|
+
trailing: 'gap-1 py-0.5 pl-2 pr-1.5 text-sm font-medium',
|
|
162
|
+
leading: 'gap-1 py-0.5 pr-2 pl-1.5 text-sm font-medium',
|
|
163
|
+
},
|
|
164
|
+
lg: {
|
|
165
|
+
trailing: 'gap-1 py-1 pl-2.5 pr-2 text-sm font-medium rounded-lg',
|
|
166
|
+
leading: 'gap-1 py-1 pr-2.5 pl-2 text-sm font-medium rounded-lg',
|
|
167
|
+
},
|
|
168
|
+
}),
|
|
169
|
+
/** Shared by `BadgeWithFlag` and `BadgeWithImage`, whose media sits flush to the leading edge. */
|
|
170
|
+
media: bySize({
|
|
171
|
+
sm: 'gap-1 py-0.5 pl-0.75 pr-2 text-xs font-medium',
|
|
172
|
+
md: 'gap-1.5 py-0.5 pl-1 pr-2.5 text-sm font-medium',
|
|
173
|
+
lg: 'gap-1.5 py-1 pl-1.5 pr-3 text-sm font-medium',
|
|
174
|
+
}, {
|
|
175
|
+
sm: 'gap-1 py-0.5 pl-1 pr-1.5 text-xs font-medium',
|
|
176
|
+
md: 'gap-1.5 py-0.5 pl-1.5 pr-2 text-sm font-medium',
|
|
177
|
+
lg: 'gap-1.5 py-1 pl-2 pr-2.5 text-sm font-medium rounded-lg',
|
|
178
|
+
}),
|
|
179
|
+
button: bySize({
|
|
180
|
+
sm: 'gap-0.5 py-0.5 pl-2 pr-0.75 text-xs font-medium',
|
|
181
|
+
md: 'gap-0.5 py-0.5 pl-2.5 pr-1 text-sm font-medium',
|
|
182
|
+
lg: 'gap-0.5 py-1 pl-3 pr-1.5 text-sm font-medium',
|
|
183
|
+
}, {
|
|
184
|
+
sm: 'gap-0.5 py-0.5 pl-1.5 pr-0.75 text-xs font-medium',
|
|
185
|
+
md: 'gap-0.5 py-0.5 pl-2 pr-1 text-sm font-medium',
|
|
186
|
+
lg: 'gap-0.5 py-1 pl-2.5 pr-1.5 text-sm font-medium rounded-lg',
|
|
187
|
+
}),
|
|
188
|
+
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' }),
|
|
189
|
+
}};
|
|
190
|
+
|
|
191
|
+
export { styles };
|
|
192
|
+
//# 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,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AAA,EAAE,EAAE,8CAA8C;SACnD,EACD;AACE,YAAA,EAAE,EAAE,8CAA8C;AAClD,YAAA,EAAE,EAAE,gDAAgD;AACpD,YAAA,EAAE,EAAE,yDAAyD;SAC9D,CACF;QACD,MAAM,EAAE,MAAM,CACZ;AACE,YAAA,EAAE,EAAE,iDAAiD;AACrD,YAAA,EAAE,EAAE,gDAAgD;AACpD,YAAA,EAAE,EAAE,8CAA8C;SACnD,EACD;AACE,YAAA,EAAE,EAAE,mDAAmD;AACvD,YAAA,EAAE,EAAE,8CAA8C;AAClD,YAAA,EAAE,EAAE,2DAA2D;SAChE,CACF;AACD,QAAA,QAAQ,EAAE,MAAM,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC;AAChH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.types.cjs","sources":["../../../../src/components/atoms/Badge/badge.types.ts"],"sourcesContent":[null],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"badge.types.cjs","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;;;"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import type { CountryCode } from '@flipdish/ui-library/components/atoms/Flag';
|
|
2
1
|
export type IconComponentType = React.FunctionComponent<{
|
|
3
2
|
className?: string;
|
|
4
3
|
strokeWidth?: string | number;
|
|
5
4
|
}>;
|
|
6
5
|
export type Sizes = 'sm' | 'md' | 'lg';
|
|
7
6
|
export type BadgeColors = 'gray' | 'brand' | 'error' | 'warning' | 'success' | 'slate' | 'sky' | 'blue' | 'indigo' | 'purple' | 'pink' | 'orange';
|
|
8
|
-
export type FlagTypes = CountryCode;
|
|
9
7
|
export type ExtractColorKeys<T> = T extends {
|
|
10
8
|
styles: infer C;
|
|
11
9
|
} ? keyof C : never;
|