@cck-ui/core 0.30.0 → 0.32.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 (84) hide show
  1. package/cjs/components/affix/affix.cjs +0 -3
  2. package/cjs/components/affix/affix.cjs.map +1 -1
  3. package/cjs/components/avatar/avatar-group/avatar-group.cjs +395 -0
  4. package/cjs/components/avatar/avatar-group/avatar-group.cjs.map +1 -0
  5. package/cjs/components/avatar/avatar-group/avatar-group.constant.cjs +7 -0
  6. package/cjs/components/avatar/avatar-group/avatar-group.constant.cjs.map +1 -0
  7. package/cjs/components/avatar/avatar-group/avatar-group.utils.cjs +8 -0
  8. package/cjs/components/avatar/avatar-group/avatar-group.utils.cjs.map +1 -0
  9. package/cjs/components/avatar/avatar-placeholder-icon.cjs +35 -0
  10. package/cjs/components/avatar/avatar-placeholder-icon.cjs.map +1 -0
  11. package/cjs/components/avatar/avatar.cjs +489 -0
  12. package/cjs/components/avatar/avatar.cjs.map +1 -0
  13. package/cjs/components/avatar/avatar.module.cjs +12 -0
  14. package/cjs/components/avatar/avatar.module.cjs.map +1 -0
  15. package/cjs/components/avatar/avatar.utils.cjs +26 -0
  16. package/cjs/components/avatar/avatar.utils.cjs.map +1 -0
  17. package/cjs/components/avatar/get-initials/get-initials.cjs +11 -0
  18. package/cjs/components/avatar/get-initials/get-initials.cjs.map +1 -0
  19. package/cjs/components/avatar/get-initials-color/get-initials-color.cjs +33 -0
  20. package/cjs/components/avatar/get-initials-color/get-initials-color.cjs.map +1 -0
  21. package/cjs/components/avatar/index.cjs +19 -0
  22. package/cjs/components/avatar/index.cjs.map +1 -0
  23. package/cjs/components/background-image/background-image.cjs +396 -0
  24. package/cjs/components/background-image/background-image.cjs.map +1 -0
  25. package/cjs/components/background-image/background-image.module.cjs +7 -0
  26. package/cjs/components/background-image/background-image.module.cjs.map +1 -0
  27. package/cjs/components/background-image/background-image.utils.cjs +8 -0
  28. package/cjs/components/background-image/background-image.utils.cjs.map +1 -0
  29. package/cjs/components/background-image/index.cjs +14 -0
  30. package/cjs/components/background-image/index.cjs.map +1 -0
  31. package/cjs/index.cjs +93 -85
  32. package/cjs/index.cjs.map +1 -1
  33. package/esm/components/affix/affix.mjs +0 -3
  34. package/esm/components/affix/affix.mjs.map +1 -1
  35. package/esm/components/avatar/avatar-group/avatar-group.constant.mjs +7 -0
  36. package/esm/components/avatar/avatar-group/avatar-group.constant.mjs.map +1 -0
  37. package/esm/components/avatar/avatar-group/avatar-group.mjs +395 -0
  38. package/esm/components/avatar/avatar-group/avatar-group.mjs.map +1 -0
  39. package/esm/components/avatar/avatar-group/avatar-group.utils.mjs +9 -0
  40. package/esm/components/avatar/avatar-group/avatar-group.utils.mjs.map +1 -0
  41. package/esm/components/avatar/avatar-placeholder-icon.mjs +35 -0
  42. package/esm/components/avatar/avatar-placeholder-icon.mjs.map +1 -0
  43. package/esm/components/avatar/avatar.mjs +489 -0
  44. package/esm/components/avatar/avatar.mjs.map +1 -0
  45. package/esm/components/avatar/avatar.module.mjs +12 -0
  46. package/esm/components/avatar/avatar.module.mjs.map +1 -0
  47. package/esm/components/avatar/avatar.utils.mjs +26 -0
  48. package/esm/components/avatar/avatar.utils.mjs.map +1 -0
  49. package/esm/components/avatar/get-initials/get-initials.mjs +11 -0
  50. package/esm/components/avatar/get-initials/get-initials.mjs.map +1 -0
  51. package/esm/components/avatar/get-initials-color/get-initials-color.mjs +33 -0
  52. package/esm/components/avatar/get-initials-color/get-initials-color.mjs.map +1 -0
  53. package/esm/components/avatar/index.mjs +17 -0
  54. package/esm/components/avatar/index.mjs.map +1 -0
  55. package/esm/components/background-image/background-image.mjs +396 -0
  56. package/esm/components/background-image/background-image.mjs.map +1 -0
  57. package/esm/components/background-image/background-image.module.mjs +7 -0
  58. package/esm/components/background-image/background-image.module.mjs.map +1 -0
  59. package/esm/components/background-image/background-image.utils.mjs +9 -0
  60. package/esm/components/background-image/background-image.utils.mjs.map +1 -0
  61. package/esm/components/background-image/index.mjs +11 -0
  62. package/esm/components/background-image/index.mjs.map +1 -0
  63. package/esm/index.mjs +6 -1
  64. package/esm/index.mjs.map +1 -1
  65. package/lib/components/avatar/avatar-group/avatar-group.constant.d.ts +3 -0
  66. package/lib/components/avatar/avatar-group/avatar-group.context.d.ts +3 -0
  67. package/lib/components/avatar/avatar-group/avatar-group.types.d.ts +18 -0
  68. package/lib/components/avatar/avatar-group/avatar-group.utils.d.ts +6 -0
  69. package/lib/components/avatar/avatar.types.d.ts +52 -0
  70. package/lib/components/avatar/avatar.utils.d.ts +11 -0
  71. package/lib/components/avatar/get-initials/get-initials.d.ts +1 -0
  72. package/lib/components/avatar/get-initials-color/get-initials-color.d.ts +2 -0
  73. package/lib/components/avatar/index.d.ts +11 -0
  74. package/lib/components/background-image/background-image.types.d.ts +21 -0
  75. package/lib/components/background-image/background-image.utils.d.ts +7 -0
  76. package/lib/components/background-image/index.d.ts +6 -0
  77. package/lib/components/index.d.ts +2 -0
  78. package/package.json +1 -1
  79. package/styles/avatar.css +67 -0
  80. package/styles/avatar.layer.css +68 -0
  81. package/styles/background-image.css +9 -0
  82. package/styles/background-image.layer.css +10 -0
  83. package/styles.css +78 -0
  84. package/styles.layer.css +78 -0
@@ -0,0 +1,489 @@
1
+ "use client";
2
+ import export_helper_default from "../../_virtual/_/plugin-vue/export-helper.mjs";
3
+ import { useComponentProps } from "../../core/config-provider/use-component-props/use-component-props.mjs";
4
+ import { CBox } from "../../core/box/index.mjs";
5
+ import { useStyles } from "../../core/styles-api/use-styles/use-styles.mjs";
6
+ import { AVATAR_GROUP_CONTEXT_KEY } from "./avatar-group/avatar-group.constant.mjs";
7
+ import avatar_module_default from "./avatar.module.mjs";
8
+ import { varsResolver } from "./avatar.utils.mjs";
9
+ import avatar_placeholder_icon_default from "./avatar-placeholder-icon.mjs";
10
+ import { getInitials } from "./get-initials/get-initials.mjs";
11
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, inject, mergeProps, openBlock, ref, renderSlot, toDisplayString, useAttrs, watch, withCtx } from "vue";
12
+ //#region packages/@cck-ui/core/src/components/avatar/avatar.vue
13
+ const _sfc_main = /*@__PURE__*/ defineComponent({
14
+ name: "CAvatar",
15
+ __name: "avatar",
16
+ props: {
17
+ size: {
18
+ type: [
19
+ String,
20
+ Object,
21
+ Number
22
+ ],
23
+ required: false
24
+ },
25
+ radius: {
26
+ type: null,
27
+ required: false
28
+ },
29
+ color: {
30
+ type: null,
31
+ required: false
32
+ },
33
+ gradient: {
34
+ type: Object,
35
+ required: false
36
+ },
37
+ src: {
38
+ type: String,
39
+ required: false
40
+ },
41
+ alt: {
42
+ type: String,
43
+ required: false
44
+ },
45
+ imageProps: {
46
+ type: Object,
47
+ required: false
48
+ },
49
+ autoContrast: {
50
+ type: Boolean,
51
+ required: false
52
+ },
53
+ name: {
54
+ type: String,
55
+ required: false
56
+ },
57
+ allowedInitialsColors: {
58
+ type: Array,
59
+ required: false
60
+ },
61
+ className: {
62
+ type: String,
63
+ required: false
64
+ },
65
+ style: {
66
+ type: [
67
+ Object,
68
+ Function,
69
+ Array
70
+ ],
71
+ required: false,
72
+ skipCheck: true
73
+ },
74
+ __vars: {
75
+ type: null,
76
+ required: false
77
+ },
78
+ __size: {
79
+ type: String,
80
+ required: false
81
+ },
82
+ hiddenFrom: {
83
+ type: null,
84
+ required: false
85
+ },
86
+ visibleFrom: {
87
+ type: null,
88
+ required: false
89
+ },
90
+ lightHidden: {
91
+ type: Boolean,
92
+ required: false
93
+ },
94
+ darkHidden: {
95
+ type: Boolean,
96
+ required: false
97
+ },
98
+ mod: {
99
+ type: [
100
+ Object,
101
+ String,
102
+ Array
103
+ ],
104
+ required: false
105
+ },
106
+ m: {
107
+ type: null,
108
+ required: false
109
+ },
110
+ my: {
111
+ type: null,
112
+ required: false
113
+ },
114
+ mx: {
115
+ type: null,
116
+ required: false
117
+ },
118
+ mt: {
119
+ type: null,
120
+ required: false
121
+ },
122
+ mb: {
123
+ type: null,
124
+ required: false
125
+ },
126
+ ms: {
127
+ type: null,
128
+ required: false
129
+ },
130
+ me: {
131
+ type: null,
132
+ required: false
133
+ },
134
+ mis: {
135
+ type: null,
136
+ required: false
137
+ },
138
+ mie: {
139
+ type: null,
140
+ required: false
141
+ },
142
+ ml: {
143
+ type: null,
144
+ required: false
145
+ },
146
+ mr: {
147
+ type: null,
148
+ required: false
149
+ },
150
+ p: {
151
+ type: null,
152
+ required: false
153
+ },
154
+ py: {
155
+ type: null,
156
+ required: false
157
+ },
158
+ px: {
159
+ type: null,
160
+ required: false
161
+ },
162
+ pt: {
163
+ type: null,
164
+ required: false
165
+ },
166
+ pb: {
167
+ type: null,
168
+ required: false
169
+ },
170
+ ps: {
171
+ type: null,
172
+ required: false
173
+ },
174
+ pe: {
175
+ type: null,
176
+ required: false
177
+ },
178
+ pis: {
179
+ type: null,
180
+ required: false
181
+ },
182
+ pie: {
183
+ type: null,
184
+ required: false
185
+ },
186
+ pl: {
187
+ type: null,
188
+ required: false
189
+ },
190
+ pr: {
191
+ type: null,
192
+ required: false
193
+ },
194
+ bd: {
195
+ type: null,
196
+ required: false
197
+ },
198
+ bdrs: {
199
+ type: null,
200
+ required: false
201
+ },
202
+ bg: {
203
+ type: null,
204
+ required: false
205
+ },
206
+ c: {
207
+ type: null,
208
+ required: false
209
+ },
210
+ opacity: {
211
+ type: [
212
+ String,
213
+ Object,
214
+ Number
215
+ ],
216
+ required: false
217
+ },
218
+ ff: {
219
+ type: [String, Object],
220
+ required: false
221
+ },
222
+ fz: {
223
+ type: null,
224
+ required: false
225
+ },
226
+ fw: {
227
+ type: null,
228
+ required: false
229
+ },
230
+ lts: {
231
+ type: null,
232
+ required: false
233
+ },
234
+ ta: {
235
+ type: [String, Object],
236
+ required: false
237
+ },
238
+ lh: {
239
+ type: null,
240
+ required: false
241
+ },
242
+ fs: {
243
+ type: null,
244
+ required: false
245
+ },
246
+ tt: {
247
+ type: [String, Object],
248
+ required: false
249
+ },
250
+ td: {
251
+ type: null,
252
+ required: false
253
+ },
254
+ w: {
255
+ type: null,
256
+ required: false
257
+ },
258
+ miw: {
259
+ type: null,
260
+ required: false
261
+ },
262
+ maw: {
263
+ type: null,
264
+ required: false
265
+ },
266
+ h: {
267
+ type: null,
268
+ required: false
269
+ },
270
+ mih: {
271
+ type: null,
272
+ required: false
273
+ },
274
+ mah: {
275
+ type: null,
276
+ required: false
277
+ },
278
+ bgsz: {
279
+ type: null,
280
+ required: false
281
+ },
282
+ bgp: {
283
+ type: null,
284
+ required: false
285
+ },
286
+ bgr: {
287
+ type: null,
288
+ required: false
289
+ },
290
+ bga: {
291
+ type: null,
292
+ required: false
293
+ },
294
+ pos: {
295
+ type: [String, Object],
296
+ required: false
297
+ },
298
+ top: {
299
+ type: null,
300
+ required: false
301
+ },
302
+ left: {
303
+ type: null,
304
+ required: false
305
+ },
306
+ bottom: {
307
+ type: null,
308
+ required: false
309
+ },
310
+ right: {
311
+ type: null,
312
+ required: false
313
+ },
314
+ inset: {
315
+ type: null,
316
+ required: false
317
+ },
318
+ display: {
319
+ type: null,
320
+ required: false
321
+ },
322
+ flex: {
323
+ type: null,
324
+ required: false
325
+ },
326
+ unstyled: {
327
+ type: Boolean,
328
+ required: false
329
+ },
330
+ variant: {
331
+ type: null,
332
+ required: false
333
+ },
334
+ classNames: {
335
+ type: null,
336
+ required: false
337
+ },
338
+ styles: {
339
+ type: null,
340
+ required: false
341
+ },
342
+ vars: {
343
+ type: Function,
344
+ required: false
345
+ },
346
+ attributes: {
347
+ type: null,
348
+ required: false
349
+ }
350
+ },
351
+ setup(__props, { expose: __expose }) {
352
+ const _root = ref(null);
353
+ const _image = ref(null);
354
+ const _placeholder = ref(null);
355
+ const error = ref(false);
356
+ const attrs = useAttrs();
357
+ const rawProps = __props;
358
+ const props = useComponentProps({
359
+ component: "CAvatar",
360
+ defaultProps: {},
361
+ props: rawProps
362
+ });
363
+ watch(() => props.value.src, (newVal) => {
364
+ error.value = !newVal;
365
+ });
366
+ const knownProps = [
367
+ "classNames",
368
+ "className",
369
+ "style",
370
+ "styles",
371
+ "unstyled",
372
+ "vars",
373
+ "src",
374
+ "alt",
375
+ "radius",
376
+ "color",
377
+ "gradient",
378
+ "imageProps",
379
+ "autoContrast",
380
+ "mod",
381
+ "name",
382
+ "allowedInitialsColors",
383
+ "attributes"
384
+ ];
385
+ const onError = (event) => {
386
+ error.value = true;
387
+ props.value.imageProps?.onError?.(event);
388
+ };
389
+ const styleProps = computed(() => ({
390
+ ...props.value,
391
+ ...attrs,
392
+ style: attrs.style ?? props.value.style
393
+ }));
394
+ const groupContext = inject(AVATAR_GROUP_CONTEXT_KEY, { withinGroup: false });
395
+ const modList = computed(() => [{ "within-group": groupContext.withinGroup }]);
396
+ const getStyles = useStyles({
397
+ name: "Avatar",
398
+ classes: avatar_module_default,
399
+ props: styleProps,
400
+ className: () => props.value.className,
401
+ style: () => props.value.style,
402
+ classNames: props.value.classNames,
403
+ styles: props.value.styles,
404
+ unstyled: props.value.unstyled,
405
+ attributes: props.value.attributes,
406
+ vars: props.value.vars,
407
+ varsResolver
408
+ });
409
+ const rootAttrs = computed(() => getStyles("root"));
410
+ const imageAttrs = computed(() => getStyles("image"));
411
+ const placeholderAttrs = computed(() => getStyles("placeholder"));
412
+ const mergedRootAttrs = computed(() => {
413
+ const others = {};
414
+ const propsValue = props.value;
415
+ Object.keys(propsValue).forEach((key) => {
416
+ if (!knownProps.includes(key)) others[key] = propsValue[key];
417
+ });
418
+ const userMod = props.value.mod;
419
+ const mergedMod = [...Array.isArray(userMod) ? userMod : [userMod].filter(Boolean), ...modList.value];
420
+ return {
421
+ ...others,
422
+ mod: mergedMod,
423
+ ...rootAttrs.value
424
+ };
425
+ });
426
+ const mergedImageAttrs = computed(() => ({
427
+ ...props.value.imageProps,
428
+ ...imageAttrs.value
429
+ }));
430
+ __expose({
431
+ root: computed(() => _root.value?.root ?? null),
432
+ image: computed(() => _image.value),
433
+ placeholder: computed(() => _placeholder.value)
434
+ });
435
+ const __returned__ = {
436
+ _root,
437
+ _image,
438
+ _placeholder,
439
+ error,
440
+ attrs,
441
+ rawProps,
442
+ props,
443
+ knownProps,
444
+ onError,
445
+ styleProps,
446
+ groupContext,
447
+ modList,
448
+ getStyles,
449
+ rootAttrs,
450
+ imageAttrs,
451
+ placeholderAttrs,
452
+ mergedRootAttrs,
453
+ mergedImageAttrs,
454
+ get CBox() {
455
+ return CBox;
456
+ },
457
+ AvatarPlaceholderIcon: avatar_placeholder_icon_default,
458
+ get getInitials() {
459
+ return getInitials;
460
+ }
461
+ };
462
+ Object.defineProperty(__returned__, "__isScriptSetup", {
463
+ enumerable: false,
464
+ value: true
465
+ });
466
+ return __returned__;
467
+ }
468
+ });
469
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
470
+ return openBlock(), createBlock($setup["CBox"], mergeProps({ ref: "_root" }, $setup.mergedRootAttrs), {
471
+ default: withCtx(() => [$setup.error || !$setup.props.src ? (openBlock(), createBlock($setup["CBox"], mergeProps({
472
+ key: 0,
473
+ tag: "span"
474
+ }, $setup.placeholderAttrs), {
475
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, () => [typeof $setup.props.name === "string" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString($setup.getInitials($setup.props.name)), 1)], 64)) : (openBlock(), createBlock($setup["AvatarPlaceholderIcon"], { key: 1 }))])]),
476
+ _: 3
477
+ }, 16)) : createCommentVNode("v-if", true), createVNode($setup["CBox"], mergeProps({ tag: "img" }, $setup.mergedImageAttrs, {
478
+ alt: $setup.props.alt,
479
+ src: $setup.props.src,
480
+ onError: $setup.onError
481
+ }), null, 16, ["alt", "src"])]),
482
+ _: 3
483
+ }, 16);
484
+ }
485
+ var avatar_default = /*#__PURE__*/ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/cck-ui/cck-ui/packages/@cck-ui/core/src/components/avatar/avatar.vue"]]);
486
+ //#endregion
487
+ export { avatar_default as default };
488
+
489
+ //# sourceMappingURL=avatar.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.mjs","names":[],"sources":["../../../src/components/avatar/avatar.vue"],"sourcesContent":["<template>\n <c-box ref=\"_root\" v-bind=\"mergedRootAttrs\">\n <c-box tag=\"span\" v-bind=\"placeholderAttrs\" v-if=\"error || !props.src\">\n <slot>\n <template v-if=\"typeof props.name === 'string'\">\n {{ getInitials(props.name) }}\n </template>\n <avatar-placeholder-icon v-else />\n </slot>\n </c-box>\n <c-box\n tag=\"img\"\n v-bind=\"mergedImageAttrs\"\n :alt=\"props.alt\"\n :src=\"props.src\"\n @error=\"onError\"\n ></c-box>\n </c-box>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, inject, ref, useAttrs, watch } from 'vue'\nimport { CBox, CStyleProp, useComponentProps, useStyles } from '../../core'\nimport { AvatarFactory, AvatarProps } from './avatar.types'\nimport { AVATAR_GROUP_CONTEXT_KEY } from './avatar-group/avatar-group.constant'\nimport { varsResolver } from './avatar.utils'\nimport AvatarPlaceholderIcon from './avatar-placeholder-icon.vue'\nimport { getInitials } from './get-initials/get-initials'\nimport classes from './avatar.module.css'\n\ndefineOptions({\n name: 'CAvatar',\n})\n\nconst _root = ref<InstanceType<typeof CBox> | null>(null)\nconst _image = ref<InstanceType<typeof CBox> | null>(null)\nconst _placeholder = ref<InstanceType<typeof CBox> | null>(null)\n\nconst error = ref<boolean>(false)\n\nconst attrs = useAttrs()\n\nconst rawProps = defineProps<AvatarProps>()\n\nconst props = useComponentProps({\n component: 'CAvatar',\n defaultProps: {},\n props: rawProps,\n})\n\nwatch(\n () => props.value.src,\n (newVal) => {\n error.value = !newVal\n }\n)\n\nconst knownProps = [\n 'classNames',\n 'className',\n 'style',\n 'styles',\n 'unstyled',\n 'vars',\n 'src',\n 'alt',\n 'radius',\n 'color',\n 'gradient',\n 'imageProps',\n 'autoContrast',\n 'mod',\n 'name',\n 'allowedInitialsColors',\n 'attributes',\n]\n\nconst onError = (event: Event) => {\n error.value = true\n props.value.imageProps?.onError?.(event)\n}\n\nconst styleProps = computed(() => ({\n ...props.value,\n ...attrs,\n style: (attrs.style ?? props.value.style) as CStyleProp,\n}))\n\nconst groupContext = inject(AVATAR_GROUP_CONTEXT_KEY, { withinGroup: false })\n\nconst modList = computed(() => [{ 'within-group': groupContext.withinGroup }])\n\nconst getStyles = useStyles<AvatarFactory>({\n name: 'Avatar',\n classes,\n props: styleProps,\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 rootAttrs = computed(() => getStyles('root'))\nconst imageAttrs = computed(() => getStyles('image'))\nconst placeholderAttrs = computed(() => getStyles('placeholder'))\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 mergedImageAttrs = computed(() => ({\n ...props.value.imageProps,\n ...imageAttrs.value,\n}))\n\ndefineExpose({\n root: computed(() => _root.value?.root ?? null),\n image: computed(() => _image.value),\n placeholder: computed(() => _placeholder.value),\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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T,WAMS,EALP,KAAI,MAAK,GACD,OAAA,kBAAgB;GACvB,KAAK,OAAA,MAAM;GACX,KAAK,OAAA,MAAM;GACX,SAAO,OAAA"}
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ //#region packages/@cck-ui/core/src/components/avatar/avatar.module.css
3
+ var avatar_module_default = {
4
+ "group": "m_813a50b",
5
+ "root": "m_94ecd0d6",
6
+ "image": "m_82d57e7",
7
+ "placeholder": "m_a2891aff"
8
+ };
9
+ //#endregion
10
+ export { avatar_module_default as default };
11
+
12
+ //# sourceMappingURL=avatar.module.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.module.mjs","names":[],"sources":["../../../src/components/avatar/avatar.module.css"],"sourcesContent":[".group {\n --ag-spacing: var(--c-spacing-sm);\n --ag-offset: calc(var(--ag-spacing) * -1);\n\n display: flex;\n padding-inline-start: var(--ag-spacing);\n}\n\n.root {\n --avatar-size-xs: 16px;\n --avatar-size-sm: 26px;\n --avatar-size-md: 38px;\n --avatar-size-lg: 56px;\n --avatar-size-xl: 84px;\n\n --avatar-size: var(--avatar-size-md);\n --avatar-radius: 1000px;\n --avatar-bg: var(--c-color-gray-light);\n --avatar-bd: 1px solid transparent;\n --avatar-color: var(--c-color-gray-light-color);\n --avatar-placeholder-fz: calc(var(--avatar-size) / 2.5);\n\n -webkit-tap-highlight-color: transparent;\n position: relative;\n display: block;\n user-select: none;\n overflow: hidden;\n border-radius: var(--avatar-radius);\n text-decoration: none;\n padding: 0;\n width: var(--avatar-size);\n height: var(--avatar-size);\n min-width: var(--avatar-size);\n\n &:where([data-within-group]) {\n margin-inline-start: var(--ag-offset);\n border: 2px solid var(--c-color-body);\n background: var(--c-color-body);\n }\n}\n\n.image {\n object-fit: cover;\n width: 100%;\n height: 100%;\n display: block;\n}\n\n.placeholder {\n font-weight: var(--c-font-weight-bold);\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n user-select: none;\n border-radius: var(--avatar-radius);\n font-size: var(--avatar-placeholder-fz);\n background: var(--avatar-bg);\n border: var(--avatar-bd);\n color: var(--avatar-color);\n\n & > [data-avatar-placeholder-icon] {\n width: 70%;\n height: 70%;\n }\n}\n"],"mappings":";;AAAA,IAAA,wBAAe;CAAC,SAAQ;CAAY,QAAO;CAAa,SAAQ;CAAY,eAAc;AAAY"}
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { getRadius, getSize } from "../../core/utils/get-size/get-size.mjs";
3
+ import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs";
4
+ import { getInitialsColor } from "./get-initials-color/get-initials-color.mjs";
5
+ //#region packages/@cck-ui/core/src/components/avatar/avatar.utils.ts
6
+ const varsResolver = createVarsResolver((theme, { size, radius, variant, gradient, color, autoContrast, name, allowedInitialsColors }) => {
7
+ const _color = color === "initials" && typeof name === "string" ? getInitialsColor(name, allowedInitialsColors) : color;
8
+ const colors = theme.variantColorResolver({
9
+ color: _color || "gray",
10
+ theme,
11
+ gradient,
12
+ variant: variant || "light",
13
+ autoContrast
14
+ });
15
+ return { root: {
16
+ "--avatar-bd": _color || variant ? colors.border : void 0,
17
+ "--avatar-bg": _color || variant ? colors.background : void 0,
18
+ "--avatar-color": _color || variant ? colors.color : void 0,
19
+ "--avatar-radius": radius === void 0 ? void 0 : getRadius(radius),
20
+ "--avatar-size": getSize(size, "avatar-size")
21
+ } };
22
+ });
23
+ //#endregion
24
+ export { varsResolver };
25
+
26
+ //# sourceMappingURL=avatar.utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.utils.mjs","names":[],"sources":["../../../src/components/avatar/avatar.utils.ts"],"sourcesContent":["import { createVarsResolver, getRadius, getSize } from '../../core'\nimport { AvatarFactory } from './avatar.types'\nimport { getInitialsColor } from './get-initials-color/get-initials-color'\n\nexport const varsResolver = createVarsResolver<AvatarFactory>(\n (\n theme,\n { size, radius, variant, gradient, color, autoContrast, name, allowedInitialsColors }\n ) => {\n const _color =\n color === 'initials' && typeof name === 'string'\n ? getInitialsColor(name, allowedInitialsColors)\n : color\n\n const colors = theme.variantColorResolver({\n color: _color || 'gray',\n theme,\n gradient,\n variant: variant || 'light',\n autoContrast,\n })\n\n return {\n root: {\n '--avatar-bd': _color || variant ? colors.border : undefined,\n '--avatar-bg': _color || variant ? colors.background : undefined,\n '--avatar-color': _color || variant ? colors.color : undefined,\n '--avatar-radius': radius === undefined ? undefined : getRadius(radius),\n '--avatar-size': getSize(size, 'avatar-size'),\n },\n }\n }\n)\n"],"mappings":";;;;;AAIA,MAAa,eAAe,oBAExB,OACA,EAAE,MAAM,QAAQ,SAAS,UAAU,OAAO,cAAc,MAAM,4BAC3D;CACH,MAAM,SACJ,UAAU,cAAc,OAAO,SAAS,WACpC,iBAAiB,MAAM,qBAAqB,IAC5C;CAEN,MAAM,SAAS,MAAM,qBAAqB;EACxC,OAAO,UAAU;EACjB;EACA;EACA,SAAS,WAAW;EACpB;CACF,CAAC;CAED,OAAO,EACL,MAAM;EACJ,eAAe,UAAU,UAAU,OAAO,SAAS,KAAA;EACnD,eAAe,UAAU,UAAU,OAAO,aAAa,KAAA;EACvD,kBAAkB,UAAU,UAAU,OAAO,QAAQ,KAAA;EACrD,mBAAmB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,MAAM;EACtE,iBAAiB,QAAQ,MAAM,aAAa;CAC9C,EACF;AACF,CACF"}
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ //#region packages/@cck-ui/core/src/components/avatar/get-initials/get-initials.ts
3
+ function getInitials(name, limit = 2) {
4
+ const splitted = name.split(" ");
5
+ if (splitted.length === 1) return name.slice(0, limit).toUpperCase();
6
+ return splitted.map((word) => word[0]).slice(0, limit).join("").toUpperCase();
7
+ }
8
+ //#endregion
9
+ export { getInitials };
10
+
11
+ //# sourceMappingURL=get-initials.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-initials.mjs","names":[],"sources":["../../../../src/components/avatar/get-initials/get-initials.ts"],"sourcesContent":["export function getInitials(name: string, limit = 2) {\n const splitted = name.split(' ')\n\n if (splitted.length === 1) {\n return name.slice(0, limit).toUpperCase()\n }\n\n return splitted\n .map((word) => word[0])\n .slice(0, limit)\n .join('')\n .toUpperCase()\n}\n"],"mappings":";;AAAA,SAAgB,YAAY,MAAc,QAAQ,GAAG;CACnD,MAAM,WAAW,KAAK,MAAM,GAAG;CAE/B,IAAI,SAAS,WAAW,GACtB,OAAO,KAAK,MAAM,GAAG,KAAK,CAAC,CAAC,YAAY;CAG1C,OAAO,SACJ,KAAK,SAAS,KAAK,EAAE,CAAC,CACtB,MAAM,GAAG,KAAK,CAAC,CACf,KAAK,EAAE,CAAC,CACR,YAAY;AACjB"}
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ //#region packages/@cck-ui/core/src/components/avatar/get-initials-color/get-initials-color.ts
3
+ function hashCode(input) {
4
+ let hash = 0;
5
+ for (let i = 0; i < input.length; i += 1) {
6
+ const char = input.charCodeAt(i);
7
+ hash = (hash << 5) - hash + char;
8
+ hash |= 0;
9
+ }
10
+ return hash;
11
+ }
12
+ const defaultColors = [
13
+ "blue",
14
+ "cyan",
15
+ "grape",
16
+ "green",
17
+ "indigo",
18
+ "lime",
19
+ "orange",
20
+ "pink",
21
+ "red",
22
+ "teal",
23
+ "violet",
24
+ "yellow"
25
+ ];
26
+ function getInitialsColor(name, colors = defaultColors) {
27
+ const hash = hashCode(name);
28
+ return colors[Math.abs(hash) % colors.length];
29
+ }
30
+ //#endregion
31
+ export { getInitialsColor };
32
+
33
+ //# sourceMappingURL=get-initials-color.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-initials-color.mjs","names":[],"sources":["../../../../src/components/avatar/get-initials-color/get-initials-color.ts"],"sourcesContent":["import { CColor } from '../../../core'\n\nfunction hashCode(input: string) {\n let hash = 0\n for (let i = 0; i < input.length; i += 1) {\n const char = input.charCodeAt(i)\n hash = (hash << 5) - hash + char\n hash |= 0\n }\n return hash\n}\n\nconst defaultColors: CColor[] = [\n 'blue',\n 'cyan',\n 'grape',\n 'green',\n 'indigo',\n 'lime',\n 'orange',\n 'pink',\n 'red',\n 'teal',\n 'violet',\n 'yellow',\n]\n\nexport function getInitialsColor(name: string, colors: CColor[] = defaultColors) {\n const hash = hashCode(name)\n const index = Math.abs(hash) % colors.length\n return colors[index]\n}\n"],"mappings":";;AAEA,SAAS,SAAS,OAAe;CAC/B,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,GAAG;EACxC,MAAM,OAAO,MAAM,WAAW,CAAC;EAC/B,QAAQ,QAAQ,KAAK,OAAO;EAC5B,QAAQ;CACV;CACA,OAAO;AACT;AAEA,MAAM,gBAA0B;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAgB,iBAAiB,MAAc,SAAmB,eAAe;CAC/E,MAAM,OAAO,SAAS,IAAI;CAE1B,OAAO,OADO,KAAK,IAAI,IAAI,IAAI,OAAO;AAExC"}
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { withInstall } from "../../core/utils/vue/install.mjs";
3
+ import { withClasses, withExtend, withPropsFactory, withVarsResolver } from "../../core/utils/vue/statics.mjs";
4
+ import avatar_module_default from "./avatar.module.mjs";
5
+ import { varsResolver } from "./avatar-group/avatar-group.utils.mjs";
6
+ import avatar_group_default from "./avatar-group/avatar-group.mjs";
7
+ import { varsResolver as varsResolver$1 } from "./avatar.utils.mjs";
8
+ import avatar_default from "./avatar.mjs";
9
+ //#region packages/@cck-ui/core/src/components/avatar/index.ts
10
+ const AvatarGroupWithStatic = withPropsFactory(withExtend(withVarsResolver(withClasses(avatar_group_default, avatar_module_default), varsResolver)));
11
+ const AvatarWithStatic = withPropsFactory(withExtend(withVarsResolver(withClasses(avatar_default, avatar_module_default), varsResolver$1)));
12
+ const CAvatarGroup = withInstall(AvatarGroupWithStatic);
13
+ const CAvatar = withInstall(AvatarWithStatic, { Group: avatar_group_default });
14
+ //#endregion
15
+ export { CAvatar, CAvatar as default, CAvatarGroup };
16
+
17
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["AvatarGroup","classes","groupVarsResolver","Avatar","varsResolver"],"sources":["../../../src/components/avatar/index.ts"],"sourcesContent":["import {\n SFCWithInstallAndClasses,\n withClasses,\n withExtend,\n withInstall,\n withPropsFactory,\n withVarsResolver,\n} from '../../core'\nimport AvatarGroup from './avatar-group/avatar-group.vue'\nimport { varsResolver as groupVarsResolver } from './avatar-group/avatar-group.utils'\nimport classes from './avatar.module.css'\nimport Avatar from './avatar.vue'\nimport { varsResolver } from './avatar.utils'\n\nconst AvatarGroupWithStatic = withPropsFactory(\n withExtend(withVarsResolver(withClasses(AvatarGroup, classes), groupVarsResolver))\n)\n\nconst AvatarWithStatic = withPropsFactory(\n withExtend(withVarsResolver(withClasses(Avatar, classes), varsResolver))\n)\n\nexport const CAvatarGroup: SFCWithInstallAndClasses<typeof AvatarGroup, typeof classes> =\n withInstall(AvatarGroupWithStatic)\nexport const CAvatar: SFCWithInstallAndClasses<typeof Avatar, typeof classes> & {\n Group: typeof AvatarGroup\n} = withInstall(AvatarWithStatic, { Group: AvatarGroup })\n\nexport default CAvatar\n\nexport * from './avatar.types'\nexport * from './avatar-group/avatar-group.types'\n"],"mappings":";;;;;;;;;AAcA,MAAM,wBAAwB,iBAC5B,WAAW,iBAAiB,YAAYA,sBAAaC,qBAAO,GAAGC,YAAiB,CAAC,CACnF;AAEA,MAAM,mBAAmB,iBACvB,WAAW,iBAAiB,YAAYC,gBAAQF,qBAAO,GAAGG,cAAY,CAAC,CACzE;AAEA,MAAa,eACX,YAAY,qBAAqB;AACnC,MAAa,UAET,YAAY,kBAAkB,EAAE,OAAOJ,qBAAY,CAAC"}