@cck-ui/core 0.32.0 → 0.33.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/cjs/components/badge/badge.cjs +488 -0
- package/cjs/components/badge/badge.cjs.map +1 -0
- package/cjs/components/badge/badge.module.cjs +12 -0
- package/cjs/components/badge/badge.module.cjs.map +1 -0
- package/cjs/components/badge/badge.utils.cjs +27 -0
- package/cjs/components/badge/badge.utils.cjs.map +1 -0
- package/cjs/components/badge/index.cjs +14 -0
- package/cjs/components/badge/index.cjs.map +1 -0
- package/cjs/index.cjs +88 -85
- package/cjs/index.cjs.map +1 -1
- package/esm/components/badge/badge.mjs +488 -0
- package/esm/components/badge/badge.mjs.map +1 -0
- package/esm/components/badge/badge.module.mjs +12 -0
- package/esm/components/badge/badge.module.mjs.map +1 -0
- package/esm/components/badge/badge.utils.mjs +28 -0
- package/esm/components/badge/badge.utils.mjs.map +1 -0
- package/esm/components/badge/index.mjs +11 -0
- package/esm/components/badge/index.mjs.map +1 -0
- package/esm/index.mjs +3 -1
- package/esm/index.mjs.map +1 -1
- package/lib/components/badge/badge.types.d.ts +52 -0
- package/lib/components/badge/badge.utils.d.ts +8 -0
- package/lib/components/badge/index.d.ts +6 -0
- package/lib/components/index.d.ts +1 -0
- package/package.json +1 -1
- package/styles/badge.css +124 -0
- package/styles/badge.layer.css +125 -0
- package/styles.css +125 -0
- package/styles.layer.css +125 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_export_helper = require("../../_virtual/_/plugin-vue/export-helper.cjs");
|
|
3
|
+
const require_use_component_props = require("../../core/config-provider/use-component-props/use-component-props.cjs");
|
|
4
|
+
const require_index = require("../../core/box/index.cjs");
|
|
5
|
+
const require_use_styles = require("../../core/styles-api/use-styles/use-styles.cjs");
|
|
6
|
+
const require_badge_module = require("./badge.module.cjs");
|
|
7
|
+
const require_badge_utils = require("./badge.utils.cjs");
|
|
8
|
+
let vue = require("vue");
|
|
9
|
+
//#region packages/@cck-ui/core/src/components/badge/badge.vue
|
|
10
|
+
const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
11
|
+
name: "CBadge",
|
|
12
|
+
__name: "badge",
|
|
13
|
+
props: {
|
|
14
|
+
size: {
|
|
15
|
+
type: [String, Object],
|
|
16
|
+
required: false
|
|
17
|
+
},
|
|
18
|
+
circle: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
required: false
|
|
21
|
+
},
|
|
22
|
+
radius: {
|
|
23
|
+
type: null,
|
|
24
|
+
required: false
|
|
25
|
+
},
|
|
26
|
+
color: {
|
|
27
|
+
type: null,
|
|
28
|
+
required: false
|
|
29
|
+
},
|
|
30
|
+
gradient: {
|
|
31
|
+
type: Object,
|
|
32
|
+
required: false
|
|
33
|
+
},
|
|
34
|
+
leftSection: {
|
|
35
|
+
type: [String, Object],
|
|
36
|
+
required: false
|
|
37
|
+
},
|
|
38
|
+
rightSection: {
|
|
39
|
+
type: [String, Object],
|
|
40
|
+
required: false
|
|
41
|
+
},
|
|
42
|
+
fullWidth: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
required: false
|
|
45
|
+
},
|
|
46
|
+
autoContrast: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
required: false
|
|
49
|
+
},
|
|
50
|
+
className: {
|
|
51
|
+
type: String,
|
|
52
|
+
required: false
|
|
53
|
+
},
|
|
54
|
+
style: {
|
|
55
|
+
type: [
|
|
56
|
+
Object,
|
|
57
|
+
Function,
|
|
58
|
+
Array
|
|
59
|
+
],
|
|
60
|
+
required: false,
|
|
61
|
+
skipCheck: true
|
|
62
|
+
},
|
|
63
|
+
__vars: {
|
|
64
|
+
type: null,
|
|
65
|
+
required: false
|
|
66
|
+
},
|
|
67
|
+
__size: {
|
|
68
|
+
type: String,
|
|
69
|
+
required: false
|
|
70
|
+
},
|
|
71
|
+
hiddenFrom: {
|
|
72
|
+
type: null,
|
|
73
|
+
required: false
|
|
74
|
+
},
|
|
75
|
+
visibleFrom: {
|
|
76
|
+
type: null,
|
|
77
|
+
required: false
|
|
78
|
+
},
|
|
79
|
+
lightHidden: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
required: false
|
|
82
|
+
},
|
|
83
|
+
darkHidden: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
required: false
|
|
86
|
+
},
|
|
87
|
+
mod: {
|
|
88
|
+
type: [
|
|
89
|
+
Object,
|
|
90
|
+
String,
|
|
91
|
+
Array
|
|
92
|
+
],
|
|
93
|
+
required: false
|
|
94
|
+
},
|
|
95
|
+
m: {
|
|
96
|
+
type: null,
|
|
97
|
+
required: false
|
|
98
|
+
},
|
|
99
|
+
my: {
|
|
100
|
+
type: null,
|
|
101
|
+
required: false
|
|
102
|
+
},
|
|
103
|
+
mx: {
|
|
104
|
+
type: null,
|
|
105
|
+
required: false
|
|
106
|
+
},
|
|
107
|
+
mt: {
|
|
108
|
+
type: null,
|
|
109
|
+
required: false
|
|
110
|
+
},
|
|
111
|
+
mb: {
|
|
112
|
+
type: null,
|
|
113
|
+
required: false
|
|
114
|
+
},
|
|
115
|
+
ms: {
|
|
116
|
+
type: null,
|
|
117
|
+
required: false
|
|
118
|
+
},
|
|
119
|
+
me: {
|
|
120
|
+
type: null,
|
|
121
|
+
required: false
|
|
122
|
+
},
|
|
123
|
+
mis: {
|
|
124
|
+
type: null,
|
|
125
|
+
required: false
|
|
126
|
+
},
|
|
127
|
+
mie: {
|
|
128
|
+
type: null,
|
|
129
|
+
required: false
|
|
130
|
+
},
|
|
131
|
+
ml: {
|
|
132
|
+
type: null,
|
|
133
|
+
required: false
|
|
134
|
+
},
|
|
135
|
+
mr: {
|
|
136
|
+
type: null,
|
|
137
|
+
required: false
|
|
138
|
+
},
|
|
139
|
+
p: {
|
|
140
|
+
type: null,
|
|
141
|
+
required: false
|
|
142
|
+
},
|
|
143
|
+
py: {
|
|
144
|
+
type: null,
|
|
145
|
+
required: false
|
|
146
|
+
},
|
|
147
|
+
px: {
|
|
148
|
+
type: null,
|
|
149
|
+
required: false
|
|
150
|
+
},
|
|
151
|
+
pt: {
|
|
152
|
+
type: null,
|
|
153
|
+
required: false
|
|
154
|
+
},
|
|
155
|
+
pb: {
|
|
156
|
+
type: null,
|
|
157
|
+
required: false
|
|
158
|
+
},
|
|
159
|
+
ps: {
|
|
160
|
+
type: null,
|
|
161
|
+
required: false
|
|
162
|
+
},
|
|
163
|
+
pe: {
|
|
164
|
+
type: null,
|
|
165
|
+
required: false
|
|
166
|
+
},
|
|
167
|
+
pis: {
|
|
168
|
+
type: null,
|
|
169
|
+
required: false
|
|
170
|
+
},
|
|
171
|
+
pie: {
|
|
172
|
+
type: null,
|
|
173
|
+
required: false
|
|
174
|
+
},
|
|
175
|
+
pl: {
|
|
176
|
+
type: null,
|
|
177
|
+
required: false
|
|
178
|
+
},
|
|
179
|
+
pr: {
|
|
180
|
+
type: null,
|
|
181
|
+
required: false
|
|
182
|
+
},
|
|
183
|
+
bd: {
|
|
184
|
+
type: null,
|
|
185
|
+
required: false
|
|
186
|
+
},
|
|
187
|
+
bdrs: {
|
|
188
|
+
type: null,
|
|
189
|
+
required: false
|
|
190
|
+
},
|
|
191
|
+
bg: {
|
|
192
|
+
type: null,
|
|
193
|
+
required: false
|
|
194
|
+
},
|
|
195
|
+
c: {
|
|
196
|
+
type: null,
|
|
197
|
+
required: false
|
|
198
|
+
},
|
|
199
|
+
opacity: {
|
|
200
|
+
type: [
|
|
201
|
+
String,
|
|
202
|
+
Object,
|
|
203
|
+
Number
|
|
204
|
+
],
|
|
205
|
+
required: false
|
|
206
|
+
},
|
|
207
|
+
ff: {
|
|
208
|
+
type: [String, Object],
|
|
209
|
+
required: false
|
|
210
|
+
},
|
|
211
|
+
fz: {
|
|
212
|
+
type: null,
|
|
213
|
+
required: false
|
|
214
|
+
},
|
|
215
|
+
fw: {
|
|
216
|
+
type: null,
|
|
217
|
+
required: false
|
|
218
|
+
},
|
|
219
|
+
lts: {
|
|
220
|
+
type: null,
|
|
221
|
+
required: false
|
|
222
|
+
},
|
|
223
|
+
ta: {
|
|
224
|
+
type: [String, Object],
|
|
225
|
+
required: false
|
|
226
|
+
},
|
|
227
|
+
lh: {
|
|
228
|
+
type: null,
|
|
229
|
+
required: false
|
|
230
|
+
},
|
|
231
|
+
fs: {
|
|
232
|
+
type: null,
|
|
233
|
+
required: false
|
|
234
|
+
},
|
|
235
|
+
tt: {
|
|
236
|
+
type: [String, Object],
|
|
237
|
+
required: false
|
|
238
|
+
},
|
|
239
|
+
td: {
|
|
240
|
+
type: null,
|
|
241
|
+
required: false
|
|
242
|
+
},
|
|
243
|
+
w: {
|
|
244
|
+
type: null,
|
|
245
|
+
required: false
|
|
246
|
+
},
|
|
247
|
+
miw: {
|
|
248
|
+
type: null,
|
|
249
|
+
required: false
|
|
250
|
+
},
|
|
251
|
+
maw: {
|
|
252
|
+
type: null,
|
|
253
|
+
required: false
|
|
254
|
+
},
|
|
255
|
+
h: {
|
|
256
|
+
type: null,
|
|
257
|
+
required: false
|
|
258
|
+
},
|
|
259
|
+
mih: {
|
|
260
|
+
type: null,
|
|
261
|
+
required: false
|
|
262
|
+
},
|
|
263
|
+
mah: {
|
|
264
|
+
type: null,
|
|
265
|
+
required: false
|
|
266
|
+
},
|
|
267
|
+
bgsz: {
|
|
268
|
+
type: null,
|
|
269
|
+
required: false
|
|
270
|
+
},
|
|
271
|
+
bgp: {
|
|
272
|
+
type: null,
|
|
273
|
+
required: false
|
|
274
|
+
},
|
|
275
|
+
bgr: {
|
|
276
|
+
type: null,
|
|
277
|
+
required: false
|
|
278
|
+
},
|
|
279
|
+
bga: {
|
|
280
|
+
type: null,
|
|
281
|
+
required: false
|
|
282
|
+
},
|
|
283
|
+
pos: {
|
|
284
|
+
type: [String, Object],
|
|
285
|
+
required: false
|
|
286
|
+
},
|
|
287
|
+
top: {
|
|
288
|
+
type: null,
|
|
289
|
+
required: false
|
|
290
|
+
},
|
|
291
|
+
left: {
|
|
292
|
+
type: null,
|
|
293
|
+
required: false
|
|
294
|
+
},
|
|
295
|
+
bottom: {
|
|
296
|
+
type: null,
|
|
297
|
+
required: false
|
|
298
|
+
},
|
|
299
|
+
right: {
|
|
300
|
+
type: null,
|
|
301
|
+
required: false
|
|
302
|
+
},
|
|
303
|
+
inset: {
|
|
304
|
+
type: null,
|
|
305
|
+
required: false
|
|
306
|
+
},
|
|
307
|
+
display: {
|
|
308
|
+
type: null,
|
|
309
|
+
required: false
|
|
310
|
+
},
|
|
311
|
+
flex: {
|
|
312
|
+
type: null,
|
|
313
|
+
required: false
|
|
314
|
+
},
|
|
315
|
+
unstyled: {
|
|
316
|
+
type: Boolean,
|
|
317
|
+
required: false
|
|
318
|
+
},
|
|
319
|
+
variant: {
|
|
320
|
+
type: null,
|
|
321
|
+
required: false
|
|
322
|
+
},
|
|
323
|
+
classNames: {
|
|
324
|
+
type: null,
|
|
325
|
+
required: false
|
|
326
|
+
},
|
|
327
|
+
styles: {
|
|
328
|
+
type: null,
|
|
329
|
+
required: false
|
|
330
|
+
},
|
|
331
|
+
vars: {
|
|
332
|
+
type: Function,
|
|
333
|
+
required: false
|
|
334
|
+
},
|
|
335
|
+
attributes: {
|
|
336
|
+
type: null,
|
|
337
|
+
required: false
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
setup(__props, { expose: __expose }) {
|
|
341
|
+
const _root = (0, vue.ref)(null);
|
|
342
|
+
const _leftSection = (0, vue.ref)(null);
|
|
343
|
+
const _rightSection = (0, vue.ref)(null);
|
|
344
|
+
const _label = (0, vue.ref)(null);
|
|
345
|
+
const attrs = (0, vue.useAttrs)();
|
|
346
|
+
const slots = (0, vue.useSlots)();
|
|
347
|
+
const withLeftSection = (0, vue.computed)(() => !!slots["left-section"] || !!props.value.leftSection);
|
|
348
|
+
const withRightSection = (0, vue.computed)(() => !!slots["right-section"] || !!props.value.rightSection);
|
|
349
|
+
const rawProps = __props;
|
|
350
|
+
const props = require_use_component_props.useComponentProps({
|
|
351
|
+
component: "CBadge",
|
|
352
|
+
defaultProps: {},
|
|
353
|
+
props: rawProps
|
|
354
|
+
});
|
|
355
|
+
const knownProps = [
|
|
356
|
+
"classNames",
|
|
357
|
+
"className",
|
|
358
|
+
"style",
|
|
359
|
+
"styles",
|
|
360
|
+
"unstyled",
|
|
361
|
+
"vars",
|
|
362
|
+
"radius",
|
|
363
|
+
"color",
|
|
364
|
+
"gradient",
|
|
365
|
+
"leftSection",
|
|
366
|
+
"rightSection",
|
|
367
|
+
"variant",
|
|
368
|
+
"fullWidth",
|
|
369
|
+
"autoContrast",
|
|
370
|
+
"circle",
|
|
371
|
+
"mod",
|
|
372
|
+
"attributes"
|
|
373
|
+
];
|
|
374
|
+
const styleProps = (0, vue.computed)(() => ({
|
|
375
|
+
...props.value,
|
|
376
|
+
...attrs,
|
|
377
|
+
style: attrs.style ?? props.value.style
|
|
378
|
+
}));
|
|
379
|
+
const getStyles = require_use_styles.useStyles({
|
|
380
|
+
name: "Badge",
|
|
381
|
+
props: styleProps,
|
|
382
|
+
classes: require_badge_module.default,
|
|
383
|
+
className: () => props.value.className,
|
|
384
|
+
style: () => props.value.style,
|
|
385
|
+
classNames: props.value.classNames,
|
|
386
|
+
styles: props.value.styles,
|
|
387
|
+
unstyled: props.value.unstyled,
|
|
388
|
+
attributes: props.value.attributes,
|
|
389
|
+
vars: props.value.vars,
|
|
390
|
+
varsResolver: require_badge_utils.varsResolver
|
|
391
|
+
});
|
|
392
|
+
const modList = (0, vue.computed)(() => [
|
|
393
|
+
{ block: props.value.fullWidth },
|
|
394
|
+
{ circle: props.value.circle },
|
|
395
|
+
{ "with-left-section": withLeftSection.value },
|
|
396
|
+
{ "with-right-section": withRightSection.value }
|
|
397
|
+
]);
|
|
398
|
+
const rootAttrs = (0, vue.computed)(() => getStyles("root", { variant: props.value.variant }));
|
|
399
|
+
const mergedRootAttrs = (0, vue.computed)(() => {
|
|
400
|
+
const others = {};
|
|
401
|
+
const propsValue = props.value;
|
|
402
|
+
Object.keys(propsValue).forEach((key) => {
|
|
403
|
+
if (!knownProps.includes(key)) others[key] = propsValue[key];
|
|
404
|
+
});
|
|
405
|
+
const userMod = props.value.mod;
|
|
406
|
+
const mergedMod = [...Array.isArray(userMod) ? userMod : [userMod].filter(Boolean), ...modList.value || []];
|
|
407
|
+
return {
|
|
408
|
+
...others,
|
|
409
|
+
mod: mergedMod,
|
|
410
|
+
...rootAttrs.value
|
|
411
|
+
};
|
|
412
|
+
});
|
|
413
|
+
const sectionAttrs = (0, vue.computed)(() => getStyles("section"));
|
|
414
|
+
const labelAttrs = (0, vue.computed)(() => getStyles("label"));
|
|
415
|
+
__expose({
|
|
416
|
+
root: (0, vue.computed)(() => _root.value?.root ?? null),
|
|
417
|
+
leftSection: (0, vue.computed)(() => _leftSection.value?.root ?? null),
|
|
418
|
+
rightSection: (0, vue.computed)(() => _rightSection.value?.root ?? null),
|
|
419
|
+
label: (0, vue.computed)(() => _label.value?.root ?? null)
|
|
420
|
+
});
|
|
421
|
+
const __returned__ = {
|
|
422
|
+
_root,
|
|
423
|
+
_leftSection,
|
|
424
|
+
_rightSection,
|
|
425
|
+
_label,
|
|
426
|
+
attrs,
|
|
427
|
+
slots,
|
|
428
|
+
withLeftSection,
|
|
429
|
+
withRightSection,
|
|
430
|
+
rawProps,
|
|
431
|
+
props,
|
|
432
|
+
knownProps,
|
|
433
|
+
styleProps,
|
|
434
|
+
getStyles,
|
|
435
|
+
modList,
|
|
436
|
+
rootAttrs,
|
|
437
|
+
mergedRootAttrs,
|
|
438
|
+
sectionAttrs,
|
|
439
|
+
labelAttrs,
|
|
440
|
+
get CBox() {
|
|
441
|
+
return require_index.CBox;
|
|
442
|
+
}
|
|
443
|
+
};
|
|
444
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
445
|
+
enumerable: false,
|
|
446
|
+
value: true
|
|
447
|
+
});
|
|
448
|
+
return __returned__;
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
const _hoisted_1 = ["innerHTML"];
|
|
452
|
+
const _hoisted_2 = ["innerHTML"];
|
|
453
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
454
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.mergeProps)({ ref: "_root" }, $setup.mergedRootAttrs, { variant: $setup.props.variant }), {
|
|
455
|
+
default: (0, vue.withCtx)(() => [
|
|
456
|
+
$setup.withLeftSection ? ((0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.mergeProps)({ key: 0 }, $setup.sectionAttrs, {
|
|
457
|
+
tag: "span",
|
|
458
|
+
mod: { position: "left" }
|
|
459
|
+
}), {
|
|
460
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "left-section", {}, () => [typeof $props.leftSection === "string" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
461
|
+
key: 0,
|
|
462
|
+
innerHTML: $props.leftSection
|
|
463
|
+
}, null, 8, _hoisted_1)) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)($props.leftSection), { key: 1 }))])]),
|
|
464
|
+
_: 3
|
|
465
|
+
}, 16)) : (0, vue.createCommentVNode)("v-if", true),
|
|
466
|
+
(0, vue.createVNode)($setup["CBox"], (0, vue.mergeProps)({ ref: "_label" }, $setup.labelAttrs, { tag: "span" }), {
|
|
467
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
468
|
+
_: 3
|
|
469
|
+
}, 16),
|
|
470
|
+
$setup.withRightSection ? ((0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.mergeProps)({ key: 1 }, $setup.sectionAttrs, {
|
|
471
|
+
tag: "span",
|
|
472
|
+
mod: { position: "right" }
|
|
473
|
+
}), {
|
|
474
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "right-section", {}, () => [typeof $props.rightSection === "string" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
|
|
475
|
+
key: 0,
|
|
476
|
+
innerHTML: $props.rightSection
|
|
477
|
+
}, null, 8, _hoisted_2)) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)($props.rightSection), { key: 1 }))])]),
|
|
478
|
+
_: 3
|
|
479
|
+
}, 16)) : (0, vue.createCommentVNode)("v-if", true)
|
|
480
|
+
]),
|
|
481
|
+
_: 3
|
|
482
|
+
}, 16, ["variant"]);
|
|
483
|
+
}
|
|
484
|
+
var badge_default = /*#__PURE__*/ require_export_helper.default(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/cck-ui/cck-ui/packages/@cck-ui/core/src/components/badge/badge.vue"]]);
|
|
485
|
+
//#endregion
|
|
486
|
+
exports.default = badge_default;
|
|
487
|
+
|
|
488
|
+
//# sourceMappingURL=badge.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.cjs","names":[],"sources":["../../../src/components/badge/badge.vue"],"sourcesContent":["<template>\n <c-box ref=\"_root\" v-bind=\"mergedRootAttrs\" :variant=\"props.variant\">\n <c-box v-if=\"withLeftSection\" v-bind=\"sectionAttrs\" tag=\"span\" :mod=\"{ position: 'left' }\">\n <slot name=\"left-section\">\n <span v-html=\"leftSection\" v-if=\"typeof leftSection === 'string'\"></span>\n <component v-else :is=\"leftSection\" />\n </slot>\n </c-box>\n <c-box ref=\"_label\" v-bind=\"labelAttrs\" tag=\"span\">\n <slot />\n </c-box>\n <c-box v-if=\"withRightSection\" v-bind=\"sectionAttrs\" tag=\"span\" :mod=\"{ position: 'right' }\">\n <slot name=\"right-section\">\n <span v-html=\"rightSection\" v-if=\"typeof rightSection === 'string'\"></span>\n <component v-else :is=\"rightSection\" />\n </slot>\n </c-box>\n </c-box>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, useAttrs, useSlots } from 'vue'\nimport { CBox, CStyleProp, useComponentProps, useStyles } from '../../core'\nimport classes from './badge.module.css'\nimport { BadgeFactory, BadgeProps } from './badge.types'\nimport { varsResolver } from './badge.utils'\n\ndefineOptions({\n name: 'CBadge',\n})\n\nconst _root = ref<InstanceType<typeof CBox> | null>(null)\nconst _leftSection = ref<InstanceType<typeof CBox> | null>(null)\nconst _rightSection = ref<InstanceType<typeof CBox> | null>(null)\nconst _label = ref<InstanceType<typeof CBox> | null>(null)\n\nconst attrs = useAttrs()\nconst slots = useSlots()\n\nconst withLeftSection = computed(() => !!slots['left-section'] || !!props.value.leftSection)\nconst withRightSection = computed(() => !!slots['right-section'] || !!props.value.rightSection)\n\nconst rawProps = defineProps<BadgeProps>()\n\nconst props = useComponentProps({\n component: 'CBadge',\n defaultProps: {},\n props: rawProps,\n})\n\nconst knownProps = [\n 'classNames',\n 'className',\n 'style',\n 'styles',\n 'unstyled',\n 'vars',\n 'radius',\n 'color',\n 'gradient',\n 'leftSection',\n 'rightSection',\n 'variant',\n 'fullWidth',\n 'autoContrast',\n 'circle',\n 'mod',\n 'attributes',\n]\n\nconst styleProps = computed(() => ({\n ...props.value,\n ...attrs,\n style: (attrs.style ?? props.value.style) as CStyleProp,\n}))\n\nconst getStyles = useStyles<BadgeFactory>({\n name: 'Badge',\n props: styleProps,\n classes,\n className: () => props.value.className,\n style: () => props.value.style,\n classNames: props.value.classNames,\n styles: props.value.styles,\n unstyled: props.value.unstyled,\n attributes: props.value.attributes,\n vars: props.value.vars,\n varsResolver,\n})\n\nconst modList = computed(() => [\n { block: props.value.fullWidth },\n { circle: props.value.circle },\n { 'with-left-section': withLeftSection.value },\n { 'with-right-section': withRightSection.value },\n])\n\nconst rootAttrs = computed(() => getStyles('root', { variant: props.value.variant }))\n\nconst mergedRootAttrs = computed(() => {\n const others: Record<string, any> = {}\n const propsValue = props.value\n Object.keys(propsValue).forEach((key) => {\n if (!knownProps.includes(key)) {\n others[key] = propsValue[key as keyof typeof propsValue]\n }\n })\n const userMod = props.value.mod\n const mergedMod = [\n ...(Array.isArray(userMod) ? userMod : [userMod].filter(Boolean)),\n ...(modList.value || []),\n ]\n return { ...others, mod: mergedMod, ...rootAttrs.value }\n})\n\nconst sectionAttrs = computed(() => getStyles('section'))\nconst labelAttrs = computed(() => getStyles('label'))\n\ndefineExpose({\n root: computed(() => _root.value?.root ?? null),\n leftSection: computed(() => _leftSection.value?.root ?? null),\n rightSection: computed(() => _rightSection.value?.root ?? null),\n label: computed(() => _label.value?.root ?? null),\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BA,MAAM,SAAA,GAAA,IAAA,IAAA,CAA8C,IAAI;EACxD,MAAM,gBAAA,GAAA,IAAA,IAAA,CAAqD,IAAI;EAC/D,MAAM,iBAAA,GAAA,IAAA,IAAA,CAAsD,IAAI;EAChE,MAAM,UAAA,GAAA,IAAA,IAAA,CAA+C,IAAI;EAEzD,MAAM,SAAA,GAAA,IAAA,SAAA,CAAiB;EACvB,MAAM,SAAA,GAAA,IAAA,SAAA,CAAiB;EAEvB,MAAM,mBAAA,GAAA,IAAA,SAAA,OAAiC,CAAC,CAAC,MAAM,mBAAmB,CAAC,CAAC,MAAM,MAAM,WAAW;EAC3F,MAAM,oBAAA,GAAA,IAAA,SAAA,OAAkC,CAAC,CAAC,MAAM,oBAAoB,CAAC,CAAC,MAAM,MAAM,YAAY;EAE9F,MAAM,WAAW;EAEjB,MAAM,QAAQ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oCACxC,EAAA,GAAA,IAAA,WAAA,CAAA,KAAA,QAAA,SAAA,CAAA,CAAA;;;GAEG,OAAA,qBAAA,GAAA,IAAA,UAAA,CAAA,IAAA,GAAA,IAAA,YAAA,CAKL,OAAA,UAAA,GAAA,IAAA,WAAA,CAAA,EAAA,KAAA,EAAA,GAL+B,OAAA,cAAY;IAAE,KAAI;IAAQ,KAAK,EAAA,UAAA,QAAA;;oCAI7D,EAAA,GAAA,IAAA,WAAA,CAAA,KAAA,QAAA,iBAAA,CAAA,SAAA,CAAA,OAFoC,OAAA,iBAAY,aAAA,GAAA,IAAA,UAAA,CAAA,IAAA,GAAA,IAAA,mBAAA,CAAsB,QAAA;;KAArE,WAAQ,OAAA;4GACS,OAAA,YAAY,GAAA,EAAA,KAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region packages/@cck-ui/core/src/components/badge/badge.module.css
|
|
3
|
+
var badge_module_default = {
|
|
4
|
+
"root": "m_bdabd4cc",
|
|
5
|
+
"root--dot": "m_3745665d",
|
|
6
|
+
"label": "m_f773a84a",
|
|
7
|
+
"section": "m_625eaabb"
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.default = badge_module_default;
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=badge.module.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.module.cjs","names":[],"sources":["../../../src/components/badge/badge.module.css"],"sourcesContent":[".root {\n --badge-height-xs: 16px;\n --badge-height-sm: 18px;\n --badge-height-md: 20px;\n --badge-height-lg: 26px;\n --badge-height-xl: 32px;\n\n --badge-fz-xs: 9px;\n --badge-fz-sm: 10px;\n --badge-fz-md: 11px;\n --badge-fz-lg: 13px;\n --badge-fz-xl: 16px;\n\n --badge-padding-x-xs: 6px;\n --badge-padding-x-sm: 8px;\n --badge-padding-x-md: 10px;\n --badge-padding-x-lg: 12px;\n --badge-padding-x-xl: 16px;\n\n --badge-height: var(--badge-height-md);\n --badge-fz: var(--badge-fz-md);\n --badge-padding-x: var(--badge-padding-x-md);\n --badge-radius: 1000px;\n --badge-lh: calc(var(--badge-height) - rem(2px));\n --badge-border-width: rem(1px);\n\n -webkit-tap-highlight-color: transparent;\n font-size: var(--badge-fz);\n border-radius: var(--badge-radius);\n height: var(--badge-height);\n line-height: var(--badge-lh);\n text-decoration: none;\n padding: 0 var(--badge-padding-x);\n display: inline-grid;\n align-items: center;\n justify-content: center;\n width: fit-content;\n text-transform: uppercase;\n font-weight: var(--c-font-weight-bold);\n letter-spacing: 0.25px;\n cursor: default;\n text-overflow: ellipsis;\n overflow: hidden;\n color: var(--badge-color, var(--c-color-default-color));\n background: var(--badge-bg, var(--c-color-default));\n border: var(--badge-bd, var(--badge-border-width) solid var(--c-color-default-border));\n\n &:where([data-with-left-section], [data-variant='dot']) {\n grid-template-columns: auto 1fr;\n }\n\n &:where([data-with-right-section]) {\n grid-template-columns: 1fr auto;\n }\n\n &:where(\n [data-with-left-section][data-with-right-section],\n [data-variant='dot'][data-with-right-section]\n ) {\n grid-template-columns: auto 1fr auto;\n }\n\n &:where([data-block]) {\n display: flex;\n width: 100%;\n }\n\n &:where([data-circle]) {\n padding-inline: 2px;\n display: flex;\n width: var(--badge-height);\n }\n}\n\n.root--dot {\n --badge-dot-size: calc(var(--badge-height) / 3.4);\n\n @mixin where-light {\n background-color: var(--c-color-white);\n border-color: var(--c-color-gray-4);\n color: var(--c-color-black);\n }\n\n @mixin where-dark {\n background-color: var(--c-color-dark-5);\n border-color: var(--c-color-dark-5);\n color: var(--c-color-white);\n }\n\n &::before {\n content: '';\n display: block;\n width: var(--badge-dot-size);\n height: var(--badge-dot-size);\n border-radius: var(--badge-dot-size);\n background-color: var(--badge-dot-color);\n margin-inline-end: var(--badge-dot-size);\n }\n}\n\n.label {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n text-align: center;\n cursor: inherit;\n}\n\n.section {\n --badge-section-margin: calc(var(--c-spacing-xs) / 2);\n\n display: inline-flex;\n justify-content: center;\n align-items: center;\n max-height: calc(var(--badge-height) - var(--badge-border-width) * 2);\n\n &:where([data-position='left']) {\n margin-inline-end: var(--badge-section-margin);\n }\n\n &:where([data-position='right']) {\n margin-inline-start: var(--badge-section-margin);\n }\n}\n"],"mappings":";;AAAA,IAAA,uBAAe;CAAC,QAAO;CAAa,aAAY;CAAa,SAAQ;CAAa,WAAU;AAAY"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_get_size = require("../../core/utils/get-size/get-size.cjs");
|
|
3
|
+
const require_get_theme_color = require("../../core/config-provider/color-functions/get-theme-color/get-theme-color.cjs");
|
|
4
|
+
//#region packages/@cck-ui/core/src/components/badge/badge.utils.ts
|
|
5
|
+
const varsResolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs").createVarsResolver((theme, { radius, color, gradient, variant, size, autoContrast, circle }) => {
|
|
6
|
+
const colors = theme.variantColorResolver({
|
|
7
|
+
color: color || theme.primaryColor,
|
|
8
|
+
theme,
|
|
9
|
+
gradient,
|
|
10
|
+
variant: variant || "default",
|
|
11
|
+
autoContrast
|
|
12
|
+
});
|
|
13
|
+
return { root: {
|
|
14
|
+
"--badge-bd": color || variant ? colors.border : void 0,
|
|
15
|
+
"--badge-bg": color || variant ? colors.background : void 0,
|
|
16
|
+
"--badge-color": color || variant ? colors.color : void 0,
|
|
17
|
+
"--badge-dot-color": variant === "dot" ? require_get_theme_color.getThemeColor(color, theme) : void 0,
|
|
18
|
+
"--badge-fz": require_get_size.getSize(size, "badge-fz"),
|
|
19
|
+
"--badge-height": require_get_size.getSize(size, "badge-height"),
|
|
20
|
+
"--badge-padding-x": require_get_size.getSize(size, "badge-padding-x"),
|
|
21
|
+
"--badge-radius": circle || radius === void 0 ? void 0 : require_get_size.getRadius(radius)
|
|
22
|
+
} };
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.varsResolver = varsResolver;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=badge.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badge.utils.cjs","names":["createVarsResolver","getThemeColor","getSize","getRadius"],"sources":["../../../src/components/badge/badge.utils.ts"],"sourcesContent":["import { createVarsResolver, getRadius, getSize, getThemeColor } from '../../core'\nimport { BadgeFactory } from './badge.types'\n\nexport const varsResolver = createVarsResolver<BadgeFactory>(\n (theme, { radius, color, gradient, variant, size, autoContrast, circle }) => {\n const colors = theme.variantColorResolver({\n color: color || theme.primaryColor,\n theme,\n gradient,\n variant: variant || 'default',\n autoContrast,\n })\n return {\n root: {\n '--badge-bd': color || variant ? colors.border : undefined,\n '--badge-bg': color || variant ? colors.background : undefined,\n '--badge-color': color || variant ? colors.color : undefined,\n '--badge-dot-color': variant === 'dot' ? getThemeColor(color, theme) : undefined,\n '--badge-fz': getSize(size, 'badge-fz'),\n '--badge-height': getSize(size, 'badge-height'),\n '--badge-padding-x': getSize(size, 'badge-padding-x'),\n '--badge-radius': circle || radius === undefined ? undefined : getRadius(radius),\n },\n }\n }\n)\n"],"mappings":";;;;AAGA,MAAa,4FAAeA,CAAAA,CAAAA,oBACzB,OAAO,EAAE,QAAQ,OAAO,UAAU,SAAS,MAAM,cAAc,aAAa;CAC3E,MAAM,SAAS,MAAM,qBAAqB;EACxC,OAAO,SAAS,MAAM;EACtB;EACA;EACA,SAAS,WAAW;EACpB;CACF,CAAC;CACD,OAAO,EACL,MAAM;EACJ,cAAc,SAAS,UAAU,OAAO,SAAS,KAAA;EACjD,cAAc,SAAS,UAAU,OAAO,aAAa,KAAA;EACrD,iBAAiB,SAAS,UAAU,OAAO,QAAQ,KAAA;EACnD,qBAAqB,YAAY,QAAQC,wBAAAA,cAAc,OAAO,KAAK,IAAI,KAAA;EACvE,cAAcC,iBAAAA,QAAQ,MAAM,UAAU;EACtC,kBAAkBA,iBAAAA,QAAQ,MAAM,cAAc;EAC9C,qBAAqBA,iBAAAA,QAAQ,MAAM,iBAAiB;EACpD,kBAAkB,UAAU,WAAW,KAAA,IAAY,KAAA,IAAYC,iBAAAA,UAAU,MAAM;CACjF,EACF;AACF,CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_install = require("../../core/utils/vue/install.cjs");
|
|
3
|
+
const require_statics = require("../../core/utils/vue/statics.cjs");
|
|
4
|
+
const require_badge_module = require("./badge.module.cjs");
|
|
5
|
+
const require_badge_utils = require("./badge.utils.cjs");
|
|
6
|
+
const require_badge = require("./badge.cjs");
|
|
7
|
+
//#region packages/@cck-ui/core/src/components/badge/index.ts
|
|
8
|
+
const BadgeWithStatic = require_statics.withPropsFactory(require_statics.withExtend(require_statics.withVarsResolver(require_statics.withClasses(require_badge.default, require_badge_module.default), require_badge_utils.varsResolver)));
|
|
9
|
+
const CBadge = require_install.withInstall(BadgeWithStatic);
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.CBadge = CBadge;
|
|
12
|
+
exports.default = CBadge;
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["withPropsFactory","withExtend","withVarsResolver","withClasses","Badge","classes","varsResolver","withInstall"],"sources":["../../../src/components/badge/index.ts"],"sourcesContent":["import {\n SFCWithInstallAndClasses,\n withClasses,\n withExtend,\n withInstall,\n withPropsFactory,\n withVarsResolver,\n} from '../../core'\nimport classes from './badge.module.css'\nimport { varsResolver } from './badge.utils'\nimport Badge from './badge.vue'\n\nconst BadgeWithStatic = withPropsFactory(\n withExtend(withVarsResolver(withClasses(Badge, classes), varsResolver))\n)\n\nexport const CBadge: SFCWithInstallAndClasses<typeof Badge, typeof classes> =\n withInstall(BadgeWithStatic)\n\nexport default CBadge\n\nexport * from './badge.types'\n"],"mappings":";;;;;;;AAYA,MAAM,kBAAkBA,gBAAAA,iBACtBC,gBAAAA,WAAWC,gBAAAA,iBAAiBC,gBAAAA,YAAYC,cAAAA,SAAOC,qBAAAA,OAAO,GAAGC,oBAAAA,YAAY,CAAC,CACxE;AAEA,MAAa,SACXC,gBAAAA,YAAY,eAAe"}
|