@cck-ui/core 0.30.0 → 0.31.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 (63) 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/index.cjs +90 -85
  24. package/cjs/index.cjs.map +1 -1
  25. package/esm/components/affix/affix.mjs +0 -3
  26. package/esm/components/affix/affix.mjs.map +1 -1
  27. package/esm/components/avatar/avatar-group/avatar-group.constant.mjs +7 -0
  28. package/esm/components/avatar/avatar-group/avatar-group.constant.mjs.map +1 -0
  29. package/esm/components/avatar/avatar-group/avatar-group.mjs +395 -0
  30. package/esm/components/avatar/avatar-group/avatar-group.mjs.map +1 -0
  31. package/esm/components/avatar/avatar-group/avatar-group.utils.mjs +9 -0
  32. package/esm/components/avatar/avatar-group/avatar-group.utils.mjs.map +1 -0
  33. package/esm/components/avatar/avatar-placeholder-icon.mjs +35 -0
  34. package/esm/components/avatar/avatar-placeholder-icon.mjs.map +1 -0
  35. package/esm/components/avatar/avatar.mjs +489 -0
  36. package/esm/components/avatar/avatar.mjs.map +1 -0
  37. package/esm/components/avatar/avatar.module.mjs +12 -0
  38. package/esm/components/avatar/avatar.module.mjs.map +1 -0
  39. package/esm/components/avatar/avatar.utils.mjs +26 -0
  40. package/esm/components/avatar/avatar.utils.mjs.map +1 -0
  41. package/esm/components/avatar/get-initials/get-initials.mjs +11 -0
  42. package/esm/components/avatar/get-initials/get-initials.mjs.map +1 -0
  43. package/esm/components/avatar/get-initials-color/get-initials-color.mjs +33 -0
  44. package/esm/components/avatar/get-initials-color/get-initials-color.mjs.map +1 -0
  45. package/esm/components/avatar/index.mjs +17 -0
  46. package/esm/components/avatar/index.mjs.map +1 -0
  47. package/esm/index.mjs +4 -1
  48. package/esm/index.mjs.map +1 -1
  49. package/lib/components/avatar/avatar-group/avatar-group.constant.d.ts +3 -0
  50. package/lib/components/avatar/avatar-group/avatar-group.context.d.ts +3 -0
  51. package/lib/components/avatar/avatar-group/avatar-group.types.d.ts +18 -0
  52. package/lib/components/avatar/avatar-group/avatar-group.utils.d.ts +6 -0
  53. package/lib/components/avatar/avatar.types.d.ts +52 -0
  54. package/lib/components/avatar/avatar.utils.d.ts +11 -0
  55. package/lib/components/avatar/get-initials/get-initials.d.ts +1 -0
  56. package/lib/components/avatar/get-initials-color/get-initials-color.d.ts +2 -0
  57. package/lib/components/avatar/index.d.ts +11 -0
  58. package/lib/components/index.d.ts +1 -0
  59. package/package.json +1 -1
  60. package/styles/avatar.css +67 -0
  61. package/styles/avatar.layer.css +68 -0
  62. package/styles.css +68 -0
  63. package/styles.layer.css +68 -0
@@ -0,0 +1,3 @@
1
+ export interface AvatarGroupContextValue {
2
+ withinGroup: boolean;
3
+ }
@@ -0,0 +1,18 @@
1
+ import { BoxProps, CSpacing, ElementProps, Factory, StylesApiProps } from '../../../core';
2
+ export type AvatarGroupStylesNames = 'group';
3
+ export type AvatarGroupCssVariables = {
4
+ group: '--ag-spacing';
5
+ };
6
+ export interface AvatarGroupProps extends BoxProps, StylesApiProps<AvatarGroupFactory>, /* @vue-ignore */ ElementProps<'div'> {
7
+ /**
8
+ * Negative space between Avatar components
9
+ * @default 'sm'
10
+ */
11
+ spacing?: CSpacing;
12
+ }
13
+ export type AvatarGroupFactory = Factory<{
14
+ props: AvatarGroupProps;
15
+ ref: HTMLDivElement;
16
+ stylesNames: AvatarGroupStylesNames;
17
+ vars: AvatarGroupCssVariables;
18
+ }>;
@@ -0,0 +1,6 @@
1
+ export declare const varsResolver: import("../../..").VarsResolver<{
2
+ props: import("./avatar-group.types").AvatarGroupProps;
3
+ ref: HTMLDivElement;
4
+ stylesNames: import("./avatar-group.types").AvatarGroupStylesNames;
5
+ vars: import("./avatar-group.types").AvatarGroupCssVariables;
6
+ }>;
@@ -0,0 +1,52 @@
1
+ import { BoxProps, CColor, CGradient, CRadius, CSize, ElementProps, PolymorphicFactory, StylesApiProps } from '../../core';
2
+ import AvatarGroup from './avatar-group/avatar-group.vue';
3
+ export type AvatarStylesNames = 'root' | 'placeholder' | 'image';
4
+ export type AvatarVariant = 'default' | 'filled' | 'light' | 'gradient' | 'outline' | 'dashed' | 'transparent' | 'white';
5
+ export type AvatarCssVariables = {
6
+ root: '--avatar-size' | '--avatar-radius' | '--avatar-bg' | '--avatar-color' | '--avatar-bd';
7
+ };
8
+ export interface AvatarProps extends BoxProps, StylesApiProps<AvatarFactory> {
9
+ /**
10
+ * Width and height of the avatar, numbers are converted to rem
11
+ * @default 'md'
12
+ */
13
+ size?: CSize | (string | {}) | number;
14
+ /**
15
+ * Key of `theme.radius` or any valid CSS value to set border-radius
16
+ * @default '1000px'
17
+ */
18
+ radius?: CRadius;
19
+ /**
20
+ * Key of `theme.colors` or any valid CSS color
21
+ * @default 'gray'
22
+ */
23
+ color?: CColor | 'initials';
24
+ /**
25
+ * Gradient configuration for `variant="gradient"`
26
+ * @default theme.defaultGradient
27
+ */
28
+ gradient?: CGradient;
29
+ /** Image url, if the image connot be loaded, then placeholder is displayed instead */
30
+ src?: string;
31
+ /** Image `alt` attribute, also used as `title` attribute for placeholder */
32
+ alt?: string;
33
+ /** Attributes passed down to `img` element */
34
+ imageProps?: ElementProps<'img'>;
35
+ /** If set, adjusts text color based on background color for `filled` variant */
36
+ autoContrast?: boolean;
37
+ /** Name of the user. When `src` is not set, used to display initials and to generate color when `color="initials"` is set. */
38
+ name?: string;
39
+ /** A list of colors that is used for autogenerated initials. By default, all default CCK UI colors can be used except gray and dark */
40
+ allowedInitialsColors?: CColor[];
41
+ }
42
+ export type AvatarFactory = PolymorphicFactory<{
43
+ props: AvatarProps;
44
+ defaultRef: HTMLDivElement;
45
+ defaultComponent: 'div';
46
+ stylesNames: AvatarStylesNames;
47
+ vars: AvatarCssVariables;
48
+ variant: AvatarVariant;
49
+ staticComponents: {
50
+ Group: typeof AvatarGroup;
51
+ };
52
+ }>;
@@ -0,0 +1,11 @@
1
+ export declare const varsResolver: import("../..").VarsResolver<{
2
+ props: import("./avatar.types").AvatarProps;
3
+ defaultRef: HTMLDivElement;
4
+ defaultComponent: "div";
5
+ stylesNames: import("./avatar.types").AvatarStylesNames;
6
+ vars: import("./avatar.types").AvatarCssVariables;
7
+ variant: import("./avatar.types").AvatarVariant;
8
+ staticComponents: {
9
+ Group: typeof import("*.vue");
10
+ };
11
+ }>;
@@ -0,0 +1 @@
1
+ export declare function getInitials(name: string, limit?: number): string;
@@ -0,0 +1,2 @@
1
+ import { CColor } from '../../../core';
2
+ export declare function getInitialsColor(name: string, colors?: CColor[]): import("../../..").DefaultCColor;
@@ -0,0 +1,11 @@
1
+ import { SFCWithInstallAndClasses } from '../../core';
2
+ import AvatarGroup from './avatar-group/avatar-group.vue';
3
+ import classes from './avatar.module.css';
4
+ import Avatar from './avatar.vue';
5
+ export declare const CAvatarGroup: SFCWithInstallAndClasses<typeof AvatarGroup, typeof classes>;
6
+ export declare const CAvatar: SFCWithInstallAndClasses<typeof Avatar, typeof classes> & {
7
+ Group: typeof AvatarGroup;
8
+ };
9
+ export default CAvatar;
10
+ export * from './avatar.types';
11
+ export * from './avatar-group/avatar-group.types';
@@ -3,6 +3,7 @@ export * from './affix';
3
3
  export * from './alert';
4
4
  export * from './anchor';
5
5
  export * from './aspect-ratio';
6
+ export * from './avatar';
6
7
  export * from './breadcrumbs';
7
8
  export * from './burger';
8
9
  export * from './button';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cck-ui/core",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "Vue component library focused on usability, accessibility and developer experience",
5
5
  "homepage": "https://cck-ui.jackatlas.xyz",
6
6
  "license": "ISC",
@@ -0,0 +1,67 @@
1
+ .m_813a50b {
2
+ --ag-spacing: var(--c-spacing-sm);
3
+ --ag-offset: calc(var(--ag-spacing) * -1);
4
+
5
+ display: flex;
6
+ padding-inline-start: var(--ag-spacing);
7
+ }
8
+
9
+ .m_94ecd0d6 {
10
+ --avatar-size-xs: calc(1rem * var(--c-scale));
11
+ --avatar-size-sm: calc(1.625rem * var(--c-scale));
12
+ --avatar-size-md: calc(2.375rem * var(--c-scale));
13
+ --avatar-size-lg: calc(3.5rem * var(--c-scale));
14
+ --avatar-size-xl: calc(5.25rem * var(--c-scale));
15
+
16
+ --avatar-size: var(--avatar-size-md);
17
+ --avatar-radius: calc(62.5rem * var(--c-scale));
18
+ --avatar-bg: var(--c-color-gray-light);
19
+ --avatar-bd: calc(0.0625rem * var(--c-scale)) solid transparent;
20
+ --avatar-color: var(--c-color-gray-light-color);
21
+ --avatar-placeholder-fz: calc(var(--avatar-size) / 2.5);
22
+
23
+ -webkit-tap-highlight-color: transparent;
24
+ position: relative;
25
+ display: block;
26
+ user-select: none;
27
+ overflow: hidden;
28
+ border-radius: var(--avatar-radius);
29
+ text-decoration: none;
30
+ padding: 0;
31
+ width: var(--avatar-size);
32
+ height: var(--avatar-size);
33
+ min-width: var(--avatar-size);
34
+ }
35
+
36
+ .m_94ecd0d6:where([data-within-group]) {
37
+ margin-inline-start: var(--ag-offset);
38
+ border: 2px solid var(--c-color-body);
39
+ background: var(--c-color-body);
40
+ }
41
+
42
+ .m_82d57e7 {
43
+ object-fit: cover;
44
+ width: 100%;
45
+ height: 100%;
46
+ display: block;
47
+ }
48
+
49
+ .m_a2891aff {
50
+ font-weight: var(--c-font-weight-bold);
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+ width: 100%;
55
+ height: 100%;
56
+ user-select: none;
57
+ border-radius: var(--avatar-radius);
58
+ font-size: var(--avatar-placeholder-fz);
59
+ background: var(--avatar-bg);
60
+ border: var(--avatar-bd);
61
+ color: var(--avatar-color);
62
+ }
63
+
64
+ .m_a2891aff > [data-avatar-placeholder-icon] {
65
+ width: 70%;
66
+ height: 70%;
67
+ }
@@ -0,0 +1,68 @@
1
+ @layer cck {.m_813a50b {
2
+ --ag-spacing: var(--c-spacing-sm);
3
+ --ag-offset: calc(var(--ag-spacing) * -1);
4
+
5
+ display: flex;
6
+ padding-inline-start: var(--ag-spacing);
7
+ }
8
+
9
+ .m_94ecd0d6 {
10
+ --avatar-size-xs: calc(1rem * var(--c-scale));
11
+ --avatar-size-sm: calc(1.625rem * var(--c-scale));
12
+ --avatar-size-md: calc(2.375rem * var(--c-scale));
13
+ --avatar-size-lg: calc(3.5rem * var(--c-scale));
14
+ --avatar-size-xl: calc(5.25rem * var(--c-scale));
15
+
16
+ --avatar-size: var(--avatar-size-md);
17
+ --avatar-radius: calc(62.5rem * var(--c-scale));
18
+ --avatar-bg: var(--c-color-gray-light);
19
+ --avatar-bd: calc(0.0625rem * var(--c-scale)) solid transparent;
20
+ --avatar-color: var(--c-color-gray-light-color);
21
+ --avatar-placeholder-fz: calc(var(--avatar-size) / 2.5);
22
+
23
+ -webkit-tap-highlight-color: transparent;
24
+ position: relative;
25
+ display: block;
26
+ user-select: none;
27
+ overflow: hidden;
28
+ border-radius: var(--avatar-radius);
29
+ text-decoration: none;
30
+ padding: 0;
31
+ width: var(--avatar-size);
32
+ height: var(--avatar-size);
33
+ min-width: var(--avatar-size);
34
+ }
35
+
36
+ .m_94ecd0d6:where([data-within-group]) {
37
+ margin-inline-start: var(--ag-offset);
38
+ border: 2px solid var(--c-color-body);
39
+ background: var(--c-color-body);
40
+ }
41
+
42
+ .m_82d57e7 {
43
+ object-fit: cover;
44
+ width: 100%;
45
+ height: 100%;
46
+ display: block;
47
+ }
48
+
49
+ .m_a2891aff {
50
+ font-weight: var(--c-font-weight-bold);
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: center;
54
+ width: 100%;
55
+ height: 100%;
56
+ user-select: none;
57
+ border-radius: var(--avatar-radius);
58
+ font-size: var(--avatar-placeholder-fz);
59
+ background: var(--avatar-bg);
60
+ border: var(--avatar-bd);
61
+ color: var(--avatar-color);
62
+ }
63
+
64
+ .m_a2891aff > [data-avatar-placeholder-icon] {
65
+ width: 70%;
66
+ height: 70%;
67
+ }
68
+ }
package/styles.css CHANGED
@@ -1287,6 +1287,74 @@ fieldset:disabled .c-active:active {
1287
1287
  object-fit: cover;
1288
1288
  }
1289
1289
 
1290
+ .m_813a50b {
1291
+ --ag-spacing: var(--c-spacing-sm);
1292
+ --ag-offset: calc(var(--ag-spacing) * -1);
1293
+
1294
+ display: flex;
1295
+ padding-inline-start: var(--ag-spacing);
1296
+ }
1297
+
1298
+ .m_94ecd0d6 {
1299
+ --avatar-size-xs: calc(1rem * var(--c-scale));
1300
+ --avatar-size-sm: calc(1.625rem * var(--c-scale));
1301
+ --avatar-size-md: calc(2.375rem * var(--c-scale));
1302
+ --avatar-size-lg: calc(3.5rem * var(--c-scale));
1303
+ --avatar-size-xl: calc(5.25rem * var(--c-scale));
1304
+
1305
+ --avatar-size: var(--avatar-size-md);
1306
+ --avatar-radius: calc(62.5rem * var(--c-scale));
1307
+ --avatar-bg: var(--c-color-gray-light);
1308
+ --avatar-bd: calc(0.0625rem * var(--c-scale)) solid transparent;
1309
+ --avatar-color: var(--c-color-gray-light-color);
1310
+ --avatar-placeholder-fz: calc(var(--avatar-size) / 2.5);
1311
+
1312
+ -webkit-tap-highlight-color: transparent;
1313
+ position: relative;
1314
+ display: block;
1315
+ user-select: none;
1316
+ overflow: hidden;
1317
+ border-radius: var(--avatar-radius);
1318
+ text-decoration: none;
1319
+ padding: 0;
1320
+ width: var(--avatar-size);
1321
+ height: var(--avatar-size);
1322
+ min-width: var(--avatar-size);
1323
+ }
1324
+
1325
+ .m_94ecd0d6:where([data-within-group]) {
1326
+ margin-inline-start: var(--ag-offset);
1327
+ border: 2px solid var(--c-color-body);
1328
+ background: var(--c-color-body);
1329
+ }
1330
+
1331
+ .m_82d57e7 {
1332
+ object-fit: cover;
1333
+ width: 100%;
1334
+ height: 100%;
1335
+ display: block;
1336
+ }
1337
+
1338
+ .m_a2891aff {
1339
+ font-weight: var(--c-font-weight-bold);
1340
+ display: flex;
1341
+ align-items: center;
1342
+ justify-content: center;
1343
+ width: 100%;
1344
+ height: 100%;
1345
+ user-select: none;
1346
+ border-radius: var(--avatar-radius);
1347
+ font-size: var(--avatar-placeholder-fz);
1348
+ background: var(--avatar-bg);
1349
+ border: var(--avatar-bd);
1350
+ color: var(--avatar-color);
1351
+ }
1352
+
1353
+ .m_a2891aff > [data-avatar-placeholder-icon] {
1354
+ width: 70%;
1355
+ height: 70%;
1356
+ }
1357
+
1290
1358
  .m_bd72d3bf {
1291
1359
  display: flex;
1292
1360
  align-items: center;
package/styles.layer.css CHANGED
@@ -1287,6 +1287,74 @@ fieldset:disabled .c-active:active {
1287
1287
  object-fit: cover;
1288
1288
  }
1289
1289
 
1290
+ .m_813a50b {
1291
+ --ag-spacing: var(--c-spacing-sm);
1292
+ --ag-offset: calc(var(--ag-spacing) * -1);
1293
+
1294
+ display: flex;
1295
+ padding-inline-start: var(--ag-spacing);
1296
+ }
1297
+
1298
+ .m_94ecd0d6 {
1299
+ --avatar-size-xs: calc(1rem * var(--c-scale));
1300
+ --avatar-size-sm: calc(1.625rem * var(--c-scale));
1301
+ --avatar-size-md: calc(2.375rem * var(--c-scale));
1302
+ --avatar-size-lg: calc(3.5rem * var(--c-scale));
1303
+ --avatar-size-xl: calc(5.25rem * var(--c-scale));
1304
+
1305
+ --avatar-size: var(--avatar-size-md);
1306
+ --avatar-radius: calc(62.5rem * var(--c-scale));
1307
+ --avatar-bg: var(--c-color-gray-light);
1308
+ --avatar-bd: calc(0.0625rem * var(--c-scale)) solid transparent;
1309
+ --avatar-color: var(--c-color-gray-light-color);
1310
+ --avatar-placeholder-fz: calc(var(--avatar-size) / 2.5);
1311
+
1312
+ -webkit-tap-highlight-color: transparent;
1313
+ position: relative;
1314
+ display: block;
1315
+ user-select: none;
1316
+ overflow: hidden;
1317
+ border-radius: var(--avatar-radius);
1318
+ text-decoration: none;
1319
+ padding: 0;
1320
+ width: var(--avatar-size);
1321
+ height: var(--avatar-size);
1322
+ min-width: var(--avatar-size);
1323
+ }
1324
+
1325
+ .m_94ecd0d6:where([data-within-group]) {
1326
+ margin-inline-start: var(--ag-offset);
1327
+ border: 2px solid var(--c-color-body);
1328
+ background: var(--c-color-body);
1329
+ }
1330
+
1331
+ .m_82d57e7 {
1332
+ object-fit: cover;
1333
+ width: 100%;
1334
+ height: 100%;
1335
+ display: block;
1336
+ }
1337
+
1338
+ .m_a2891aff {
1339
+ font-weight: var(--c-font-weight-bold);
1340
+ display: flex;
1341
+ align-items: center;
1342
+ justify-content: center;
1343
+ width: 100%;
1344
+ height: 100%;
1345
+ user-select: none;
1346
+ border-radius: var(--avatar-radius);
1347
+ font-size: var(--avatar-placeholder-fz);
1348
+ background: var(--avatar-bg);
1349
+ border: var(--avatar-bd);
1350
+ color: var(--avatar-color);
1351
+ }
1352
+
1353
+ .m_a2891aff > [data-avatar-placeholder-icon] {
1354
+ width: 70%;
1355
+ height: 70%;
1356
+ }
1357
+
1290
1358
  .m_bd72d3bf {
1291
1359
  display: flex;
1292
1360
  align-items: center;