@cck-ui/core 0.36.0 → 0.37.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 (34) hide show
  1. package/cjs/components/indicator/get-position-variables/get-position-variables.cjs +47 -0
  2. package/cjs/components/indicator/get-position-variables/get-position-variables.cjs.map +1 -0
  3. package/cjs/components/indicator/index.cjs +14 -0
  4. package/cjs/components/indicator/index.cjs.map +1 -0
  5. package/cjs/components/indicator/indicator.cjs +496 -0
  6. package/cjs/components/indicator/indicator.cjs.map +1 -0
  7. package/cjs/components/indicator/indicator.module.cjs +11 -0
  8. package/cjs/components/indicator/indicator.module.cjs.map +1 -0
  9. package/cjs/components/indicator/indicator.utils.cjs +27 -0
  10. package/cjs/components/indicator/indicator.utils.cjs.map +1 -0
  11. package/cjs/index.cjs +32 -29
  12. package/cjs/index.cjs.map +1 -1
  13. package/esm/components/indicator/get-position-variables/get-position-variables.mjs +47 -0
  14. package/esm/components/indicator/get-position-variables/get-position-variables.mjs.map +1 -0
  15. package/esm/components/indicator/index.mjs +11 -0
  16. package/esm/components/indicator/index.mjs.map +1 -0
  17. package/esm/components/indicator/indicator.mjs +496 -0
  18. package/esm/components/indicator/indicator.mjs.map +1 -0
  19. package/esm/components/indicator/indicator.module.mjs +11 -0
  20. package/esm/components/indicator/indicator.module.mjs.map +1 -0
  21. package/esm/components/indicator/indicator.utils.mjs +27 -0
  22. package/esm/components/indicator/indicator.utils.mjs.map +1 -0
  23. package/esm/index.mjs +3 -1
  24. package/esm/index.mjs.map +1 -1
  25. package/lib/components/index.d.ts +1 -0
  26. package/lib/components/indicator/get-position-variables/get-position-variables.d.ts +5 -0
  27. package/lib/components/indicator/index.d.ts +6 -0
  28. package/lib/components/indicator/indicator.types.d.ts +82 -0
  29. package/lib/components/indicator/indicator.utils.d.ts +6 -0
  30. package/package.json +1 -1
  31. package/styles/indicator.css +64 -0
  32. package/styles/indicator.layer.css +65 -0
  33. package/styles.css +65 -0
  34. package/styles.layer.css +65 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indicator.mjs","names":[],"sources":["../../../src/components/indicator/indicator.vue"],"sourcesContent":["<template>\n <c-box ref=\"_root\" v-bind=\"mergedRootAttrs\">\n <c-box ref=\"_indicator\" v-bind=\"mergedIndicatorAttrs\" v-if=\"!props.disabled && !shouldHideZero\">\n <slot name=\"label\">\n <span v-html=\"formattedLabel\" v-if=\"formattedLabel != null\"></span>\n </slot>\n </c-box>\n <slot />\n </c-box>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, useAttrs, useSlots } from 'vue'\nimport { CBox, CStyleProp, isNumber, useComponentProps, useStyles } from '../../core'\nimport { IndicatorFactory, IndicatorProps } from './indicator.types'\nimport classes from './indicator.module.css'\nimport { varsResolver } from './indicator.utils'\n\ndefineOptions({\n name: 'CIndicator',\n})\n\nconst _root = ref<InstanceType<typeof CBox> | null>(null)\nconst _indicator = ref<InstanceType<typeof CBox> | null>(null)\n\nconst attrs = useAttrs()\nconst slots = useSlots()\n\nconst rawProps = defineProps<IndicatorProps>()\n\nconst defaultProps = {\n position: 'top-end',\n offset: 0,\n showZero: true,\n} satisfies Partial<IndicatorProps>\n\nconst props = useComponentProps({\n component: 'CIndicator',\n defaultProps,\n props: rawProps,\n})\n\nconst styleProps = computed(() => ({\n ...props.value,\n ...attrs,\n style: (attrs.style ?? props.value.style) as CStyleProp,\n}))\n\nconst knownProps = [\n 'style',\n 'className',\n 'styles',\n 'classNames',\n 'unstyled',\n 'vars',\n 'position',\n 'offset',\n 'inline',\n 'label',\n 'radius',\n 'color',\n 'withBorder',\n 'disabled',\n 'processing',\n 'zIndex',\n 'autoContrast',\n 'maxValue',\n 'showZero',\n 'mod',\n 'attributes',\n]\n\nconst getStyles = useStyles<IndicatorFactory>({\n name: 'Indicator',\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 modList = computed(() => [{ inline: props.value.inline }])\n\nconst rootAttrs = computed(() => getStyles('root'))\nconst mergedRootAttrs = computed(() => {\n const others: Record<string, any> = {}\n const propsValue = props.value\n for (const key in propsValue) {\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 = [...(Array.isArray(userMod) ? userMod : [userMod]), ...modList.value]\n return { ...others, mod: mergedMod, ...rootAttrs.value }\n})\n\nconst shouldHideZero = computed(() => !props.value.showZero && Number(props.value.label) === 0)\n\nconst formattedLabel = computed(() =>\n props.value.maxValue !== undefined &&\n isNumber(props.value.label) &&\n Number(props.value.label) > props.value.maxValue\n ? `${props.value.maxValue}+`\n : props.value.label\n)\n\nconst indicatorAttrs = computed(() => getStyles('indicator'))\nconst mergedIndicatorAttrs = computed(() => ({\n mod: [\n { 'with-label': !!props.value.label },\n { 'with-border': props.value.withBorder },\n { processing: props.value.processing },\n ],\n ...indicatorAttrs.value,\n}))\n\ndefineExpose({\n root: computed(() => _root.value?.root ?? null),\n indicator: computed(() => _indicator.value?.root ?? null),\n})\n</script>\n"],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ //#region packages/@cck-ui/core/src/components/indicator/indicator.module.css
3
+ var indicator_module_default = {
4
+ "root": "m_20df55e0",
5
+ "indicator": "m_2b5957d1",
6
+ "processing": "m_7c93cd91"
7
+ };
8
+ //#endregion
9
+ export { indicator_module_default as default };
10
+
11
+ //# sourceMappingURL=indicator.module.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indicator.module.mjs","names":[],"sources":["../../../src/components/indicator/indicator.module.css"],"sourcesContent":["@keyframes processing {\n 0% {\n opacity: 0.6;\n transform: scale(0);\n }\n\n 100% {\n opacity: 0;\n transform: scale(2.8);\n }\n}\n\n.root {\n --indicator-size: 10px;\n --indicator-color: var(--c-primary-color-filled);\n\n position: relative;\n display: block;\n\n &:where([data-inline]) {\n display: inline-block;\n }\n}\n\n.indicator {\n position: absolute;\n top: var(--indicator-top);\n left: var(--indicator-left);\n right: var(--indicator-right);\n bottom: var(--indicator-bottom);\n transform: translate(var(--indicator-translate-x), var(--indicator-translate-y));\n min-width: var(--indicator-size);\n height: var(--indicator-size);\n border-radius: var(--indicator-radius, 1000rem);\n z-index: var(--indicator-z-index, 200);\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: var(--c-font-size-xs);\n background-color: var(--indicator-color);\n color: var(--indicator-text-color, var(--c-color-white));\n white-space: nowrap;\n\n &::before {\n content: '';\n position: absolute;\n inset: 0;\n background-color: var(--indicator-color);\n border-radius: var(--indicator-radius, 1000rem);\n z-index: -1;\n }\n\n &:where([data-with-label]) {\n padding-inline: calc(var(--c-spacing-xs) / 2);\n }\n\n &:where([data-with-border]) {\n border: 2px solid var(--c-color-body);\n }\n\n &[data-processing] {\n &::before {\n animation: processing 1000ms linear infinite;\n }\n }\n}\n"],"mappings":";;AAAA,IAAA,2BAAe;CAAC,QAAO;CAAa,aAAY;CAAa,cAAa;AAAY"}
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { rem } from "../../core/utils/units-converters/rem.mjs";
3
+ import { getRadius } from "../../core/utils/get-size/get-size.mjs";
4
+ import { getThemeColor } from "../../core/config-provider/color-functions/get-theme-color/get-theme-color.mjs";
5
+ import { getContrastColor } from "../../core/config-provider/color-functions/get-contrast-color/get-contrast-color.mjs";
6
+ import { createVarsResolver } from "../../core/styles-api/create-vars-resolver/create-vars-resolver.mjs";
7
+ import { getPositionVariables } from "./get-position-variables/get-position-variables.mjs";
8
+ //#region packages/@cck-ui/core/src/components/indicator/indicator.utils.ts
9
+ const varsResolver = createVarsResolver((theme, { color, position, offset, size, radius, zIndex, autoContrast }) => {
10
+ const ac = typeof autoContrast === "boolean" ? autoContrast : theme.autoContrast;
11
+ return { root: {
12
+ "--indicator-color": color ? getThemeColor(color, theme) : void 0,
13
+ "--indicator-radius": radius === void 0 ? void 0 : getRadius(radius),
14
+ "--indicator-size": rem(size),
15
+ "--indicator-text-color": ac ? getContrastColor({
16
+ color,
17
+ theme,
18
+ autoContrast: ac
19
+ }) : void 0,
20
+ "--indicator-z-index": zIndex?.toString(),
21
+ ...getPositionVariables(position, offset)
22
+ } };
23
+ });
24
+ //#endregion
25
+ export { varsResolver };
26
+
27
+ //# sourceMappingURL=indicator.utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indicator.utils.mjs","names":[],"sources":["../../../src/components/indicator/indicator.utils.ts"],"sourcesContent":["import { createVarsResolver, getRadius, getThemeColor, rem } from '../../core'\nimport { getContrastColor } from '../../core/config-provider/color-functions/get-contrast-color/get-contrast-color'\nimport { getPositionVariables } from './get-position-variables/get-position-variables'\nimport { IndicatorFactory } from './indicator.types'\n\nexport const varsResolver = createVarsResolver<IndicatorFactory>(\n (theme, { color, position, offset, size, radius, zIndex, autoContrast }) => {\n const ac = typeof autoContrast === 'boolean' ? autoContrast : theme.autoContrast\n\n return {\n root: {\n '--indicator-color': color ? getThemeColor(color, theme) : undefined,\n '--indicator-radius': radius === undefined ? undefined : getRadius(radius),\n '--indicator-size': rem(size),\n '--indicator-text-color': ac\n ? getContrastColor({ color, theme, autoContrast: ac })\n : undefined,\n '--indicator-z-index': zIndex?.toString(),\n ...getPositionVariables(position, offset),\n },\n }\n }\n)\n"],"mappings":";;;;;;;;AAKA,MAAa,eAAe,oBACzB,OAAO,EAAE,OAAO,UAAU,QAAQ,MAAM,QAAQ,QAAQ,mBAAmB;CAC1E,MAAM,KAAK,OAAO,iBAAiB,YAAY,eAAe,MAAM;CAEpE,OAAO,EACL,MAAM;EACJ,qBAAqB,QAAQ,cAAc,OAAO,KAAK,IAAI,KAAA;EAC3D,sBAAsB,WAAW,KAAA,IAAY,KAAA,IAAY,UAAU,MAAM;EACzE,oBAAoB,IAAI,IAAI;EAC5B,0BAA0B,KACtB,iBAAiB;GAAE;GAAO;GAAO,cAAc;EAAG,CAAC,IACnD,KAAA;EACJ,uBAAuB,QAAQ,SAAS;EACxC,GAAG,qBAAqB,UAAU,MAAM;CAC1C,EACF;AACF,CACF"}
package/esm/index.mjs CHANGED
@@ -85,6 +85,7 @@ import { CFocusTrap } from "./components/focus-trap/index.mjs";
85
85
  import { CCol, CGrid } from "./components/grid/index.mjs";
86
86
  import { CGroup } from "./components/group/index.mjs";
87
87
  import { CImage } from "./components/image/index.mjs";
88
+ import { CIndicator } from "./components/indicator/index.mjs";
88
89
  import { CPaper } from "./components/paper/index.mjs";
89
90
  import { CSemiCircleProgress } from "./components/semi-circle-progress/index.mjs";
90
91
  import { CSimpleGrid } from "./components/simple-grid/index.mjs";
@@ -139,6 +140,7 @@ const components = [
139
140
  CGrid,
140
141
  CGroup,
141
142
  CImage,
143
+ CIndicator,
142
144
  CLoader,
143
145
  CPaper,
144
146
  CPortal,
@@ -163,6 +165,6 @@ const CckUI = { install(app) {
163
165
  });
164
166
  } };
165
167
  //#endregion
166
- export { CActionIcon, CActionIconGroup, CActionIconGroupSection, CAffix, CAlert, CAnchor, CAspectRatio, CAvatar, CAvatarGroup, CBackgroundImage, CBadge, CBox, CBreadcrumbs, CBurger, CButton, CButtonGroup, CButtonGroupSection, transitions as CCK_TRANSITIONS, CCard, CCardSection, CCenter, CCloseButton, CCol, CColorSwatch, CContainer, CCopyButton, CDataList, CDataListItem, CDataListItemLabel, CDataListItemValue, CDefaultLoaders, CDivider, CEmptyState, CEmptyStateActions, CEmptyStateDescription, CEmptyStateIndicator, CEmptyStateTitle, CFileButton, CFlex, CFocusTrap, CGrid, CGroup, CImage, CLoader, CONFIG_KEY, CPaper, CPortal, CSemiCircleProgress, CSimpleGrid, CSkeleton, CSpace, CSplitter, CSplitterPane, CStack, CText, CTransition, CTypography, CVisuallyHidden, CckConfigProvider, CckUI, CckUI as default, DEFAULT_THEME, FOCUS_CLASS_NAMES, STYLE_PROPS_DATA, THEME_KEY, UnstyledButton, alpha, camelToKebabCase, colorsTuple, createTheme, createVarsResolver, darken, deepMerge, defaultCssVariablesResolver, defaultVariantColorsResolver, em, extractStyleProps, filterFalsyChildren, filterProps, getBaseValue, getBreakpointValue, getCSSColorVariables, getComponentName, getDefaultZIndex, getFontSize, getGradient, getLineHeight, getPrimaryShade, getRadius, getShadow, getSize, getSortedBreakpoints, getSpacing, getThemeColor, getTransitionProps, hashStyleProps, isLightColor, isNumber, isNumberLike, isString, isStringNumber, isUndefined, isVirtualColor, keys, luminance, mergeThemeOverrides, normalizeNumberLikeStringProp, numberLikeStringToNumber, parseStyleProps, parseThemeColor, px, rem, resolveClassNames, resolveStyles, responsiveStyleManager, rgb, rgba, stylesToString, toRgba, useCckClassNamesPrefix, useCckColorScheme, useCckCssVariablesResolver, useCckEnv, useCckIsHeadless, useCckStyleNonce, useCckStylesTransform, useCckSxTransform, useCckTheme, useCckWithStaticClasses, useComponentProps, useConfigContext, useProviderColorScheme, useRandomClassName, useStyles, virtualColor, withClasses, withExtend, withInstall, withPropsDefaultSetter, withPropsFactory, withVarsResolver };
168
+ export { CActionIcon, CActionIconGroup, CActionIconGroupSection, CAffix, CAlert, CAnchor, CAspectRatio, CAvatar, CAvatarGroup, CBackgroundImage, CBadge, CBox, CBreadcrumbs, CBurger, CButton, CButtonGroup, CButtonGroupSection, transitions as CCK_TRANSITIONS, CCard, CCardSection, CCenter, CCloseButton, CCol, CColorSwatch, CContainer, CCopyButton, CDataList, CDataListItem, CDataListItemLabel, CDataListItemValue, CDefaultLoaders, CDivider, CEmptyState, CEmptyStateActions, CEmptyStateDescription, CEmptyStateIndicator, CEmptyStateTitle, CFileButton, CFlex, CFocusTrap, CGrid, CGroup, CImage, CIndicator, CLoader, CONFIG_KEY, CPaper, CPortal, CSemiCircleProgress, CSimpleGrid, CSkeleton, CSpace, CSplitter, CSplitterPane, CStack, CText, CTransition, CTypography, CVisuallyHidden, CckConfigProvider, CckUI, CckUI as default, DEFAULT_THEME, FOCUS_CLASS_NAMES, STYLE_PROPS_DATA, THEME_KEY, UnstyledButton, alpha, camelToKebabCase, colorsTuple, createTheme, createVarsResolver, darken, deepMerge, defaultCssVariablesResolver, defaultVariantColorsResolver, em, extractStyleProps, filterFalsyChildren, filterProps, getBaseValue, getBreakpointValue, getCSSColorVariables, getComponentName, getDefaultZIndex, getFontSize, getGradient, getLineHeight, getPrimaryShade, getRadius, getShadow, getSize, getSortedBreakpoints, getSpacing, getThemeColor, getTransitionProps, hashStyleProps, isLightColor, isNumber, isNumberLike, isString, isStringNumber, isUndefined, isVirtualColor, keys, luminance, mergeThemeOverrides, normalizeNumberLikeStringProp, numberLikeStringToNumber, parseStyleProps, parseThemeColor, px, rem, resolveClassNames, resolveStyles, responsiveStyleManager, rgb, rgba, stylesToString, toRgba, useCckClassNamesPrefix, useCckColorScheme, useCckCssVariablesResolver, useCckEnv, useCckIsHeadless, useCckStyleNonce, useCckStylesTransform, useCckSxTransform, useCckTheme, useCckWithStaticClasses, useComponentProps, useConfigContext, useProviderColorScheme, useRandomClassName, useStyles, virtualColor, withClasses, withExtend, withInstall, withPropsDefaultSetter, withPropsFactory, withVarsResolver };
167
169
 
168
170
  //# sourceMappingURL=index.mjs.map
package/esm/index.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\nimport {\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CLoader,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n} from './components'\nimport { CckConfigProvider, CBox } from './core'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nconst components = [\n CckConfigProvider,\n CBox,\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CLoader,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n]\n\nconst CckUI: Plugin = {\n install(app: App) {\n if ((app as any)[INSTALLED_KEY]) {\n return\n }\n ;(app as any)[INSTALLED_KEY] = true\n components.forEach((c) => {\n if (c.name) {\n app.component(c.name, c)\n }\n })\n },\n}\n\nexport default CckUI\nexport { CckUI }\n\nexport * from './components'\nexport * from './core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,gBAAgB,OAAO,eAAe;AAE5C,MAAM,aAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,QAAgB,EACpB,QAAQ,KAAU;CAChB,IAAK,IAAY,gBACf;CAED,IAAa,iBAAiB;CAC/B,WAAW,SAAS,MAAM;EACxB,IAAI,EAAE,MACJ,IAAI,UAAU,EAAE,MAAM,CAAC;CAE3B,CAAC;AACH,EACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\nimport {\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CIndicator,\n CLoader,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n} from './components'\nimport { CckConfigProvider, CBox } from './core'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nconst components = [\n CckConfigProvider,\n CBox,\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CIndicator,\n CLoader,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n]\n\nconst CckUI: Plugin = {\n install(app: App) {\n if ((app as any)[INSTALLED_KEY]) {\n return\n }\n ;(app as any)[INSTALLED_KEY] = true\n components.forEach((c) => {\n if (c.name) {\n app.component(c.name, c)\n }\n })\n },\n}\n\nexport default CckUI\nexport { CckUI }\n\nexport * from './components'\nexport * from './core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,gBAAgB,OAAO,eAAe;AAE5C,MAAM,aAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,QAAgB,EACpB,QAAQ,KAAU;CAChB,IAAK,IAAY,gBACf;CAED,IAAa,iBAAiB;CAC/B,WAAW,SAAS,MAAM;EACxB,IAAI,EAAE,MACJ,IAAI,UAAU,EAAE,MAAM,CAAC;CAE3B,CAAC;AACH,EACF"}
@@ -24,6 +24,7 @@ export * from './focus-trap';
24
24
  export * from './grid';
25
25
  export * from './group';
26
26
  export * from './image';
27
+ export * from './indicator';
27
28
  export * from './loader';
28
29
  export * from './paper';
29
30
  export * from './portal';
@@ -0,0 +1,5 @@
1
+ import type { IndicatorPosition, IndicatorPositionVariables } from '../indicator.types';
2
+ export declare function getPositionVariables(_position?: IndicatorPosition, offset?: number | {
3
+ x: number;
4
+ y: number;
5
+ }): Record<IndicatorPositionVariables, string | undefined>;
@@ -0,0 +1,6 @@
1
+ import { SFCWithInstallAndClasses } from '../../core';
2
+ import classes from './indicator.module.css';
3
+ import Indicator from './indicator.vue';
4
+ export declare const CIndicator: SFCWithInstallAndClasses<typeof Indicator, typeof classes>;
5
+ export default CIndicator;
6
+ export * from './indicator.types';
@@ -0,0 +1,82 @@
1
+ import { BoxProps, CColor, CRadius, ElementProps, Factory, StylesApiProps } from '../../core';
2
+ type Position = 'top' | 'middle' | 'bottom';
3
+ type Placement = 'start' | 'center' | 'end';
4
+ export type IndicatorPosition = `${Position}-${Placement}`;
5
+ export type IndicatorPositionVariables = '--indicator-top' | '--indicator-bottom' | '--indicator-left' | '--indicator-right' | '--indicator-translate-x' | '--indicator-translate-y';
6
+ export type IndicatorStylesNames = 'root' | 'indicator';
7
+ export type IndicatorCssVariables = {
8
+ root: '--indicator-color' | '--indicator-text-color' | '--indicator-size' | '--indicator-radius' | '--indicator-z-index' | IndicatorPositionVariables;
9
+ };
10
+ export interface IndicatorProps extends BoxProps, StylesApiProps<IndicatorFactory>, /* @vue-ignore */ ElementProps<'div'> {
11
+ /**
12
+ * Indicator position relative to the target element
13
+ * @default 'top-end'
14
+ */
15
+ position?: IndicatorPosition;
16
+ /**
17
+ * Distance in pixels to offset the indicator from its default position, useful for elements with border-radius.
18
+ * Can be a number for uniform offset or an object with `x` and `y` properties for separate horizontal and vertical offsets
19
+ * @default 0
20
+ */
21
+ offset?: number | {
22
+ x: number;
23
+ y: number;
24
+ };
25
+ /**
26
+ * Changes container display from block to inline-block, use when wrapping elements with fixed width
27
+ * @default false
28
+ */
29
+ inline?: boolean;
30
+ /**
31
+ * Indicator width and height
32
+ * @default 10
33
+ */
34
+ size?: number | string;
35
+ /** Label displayed inside the indicator, for example, notification count */
36
+ label?: string | number;
37
+ /**
38
+ * Key of `theme.radius` or any valid CSS value to set `border-radius`
39
+ * @default 100
40
+ */
41
+ radius?: CRadius;
42
+ /**
43
+ * Key of `theme.colors` or any valid CSS color value
44
+ * @default theme.primaryColor
45
+ */
46
+ color?: CColor;
47
+ /** Adds border to the root element */
48
+ withBorder?: boolean;
49
+ /** Hides the indicator when set */
50
+ disabled?: boolean;
51
+ /**
52
+ * If set, the indicator has processing animation
53
+ * @default false
54
+ */
55
+ processing?: boolean;
56
+ /**
57
+ * Indicator z-index
58
+ * @default 200
59
+ */
60
+ zIndex?: string;
61
+ /** If set, adjusts text color based on background color */
62
+ autoContrast?: boolean;
63
+ /**
64
+ * Maximum value to display.
65
+ * If label is a number greater than this value, it will be displayed as `${maxValue}+`.
66
+ * Only works when `label` prop is set as a valid number
67
+ */
68
+ maxValue?: number;
69
+ /**
70
+ * Determines whether indicator with label `0` should be displayed
71
+ * Only works when `label` prop is set as a valid number
72
+ * @default true
73
+ */
74
+ showZero?: boolean;
75
+ }
76
+ export type IndicatorFactory = Factory<{
77
+ props: IndicatorProps;
78
+ ref: HTMLDivElement;
79
+ stylesNames: IndicatorStylesNames;
80
+ vars: IndicatorCssVariables;
81
+ }>;
82
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const varsResolver: import("../..").VarsResolver<{
2
+ props: import("./indicator.types").IndicatorProps;
3
+ ref: HTMLDivElement;
4
+ stylesNames: import("./indicator.types").IndicatorStylesNames;
5
+ vars: import("./indicator.types").IndicatorCssVariables;
6
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cck-ui/core",
3
- "version": "0.36.0",
3
+ "version": "0.37.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,64 @@
1
+ @keyframes m_7c93cd91 {
2
+ 0% {
3
+ opacity: 0.6;
4
+ transform: scale(0);
5
+ }
6
+
7
+ 100% {
8
+ opacity: 0;
9
+ transform: scale(2.8);
10
+ }
11
+ }
12
+
13
+ .m_20df55e0 {
14
+ --indicator-size: calc(0.625rem * var(--c-scale));
15
+ --indicator-color: var(--c-primary-color-filled);
16
+
17
+ position: relative;
18
+ display: block;
19
+ }
20
+
21
+ .m_20df55e0:where([data-inline]) {
22
+ display: inline-block;
23
+ }
24
+
25
+ .m_2b5957d1 {
26
+ position: absolute;
27
+ top: var(--indicator-top);
28
+ left: var(--indicator-left);
29
+ right: var(--indicator-right);
30
+ bottom: var(--indicator-bottom);
31
+ transform: translate(var(--indicator-translate-x), var(--indicator-translate-y));
32
+ min-width: var(--indicator-size);
33
+ height: var(--indicator-size);
34
+ border-radius: var(--indicator-radius, 1000rem);
35
+ z-index: var(--indicator-z-index, 200);
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ font-size: var(--c-font-size-xs);
40
+ background-color: var(--indicator-color);
41
+ color: var(--indicator-text-color, var(--c-color-white));
42
+ white-space: nowrap;
43
+ }
44
+
45
+ .m_2b5957d1::before {
46
+ content: '';
47
+ position: absolute;
48
+ inset: 0;
49
+ background-color: var(--indicator-color);
50
+ border-radius: var(--indicator-radius, 1000rem);
51
+ z-index: -1;
52
+ }
53
+
54
+ .m_2b5957d1:where([data-with-label]) {
55
+ padding-inline: calc(var(--c-spacing-xs) / 2);
56
+ }
57
+
58
+ .m_2b5957d1:where([data-with-border]) {
59
+ border: 2px solid var(--c-color-body);
60
+ }
61
+
62
+ .m_2b5957d1[data-processing]::before {
63
+ animation: m_7c93cd91 1000ms linear infinite;
64
+ }
@@ -0,0 +1,65 @@
1
+ @layer cck {@keyframes m_7c93cd91 {
2
+ 0% {
3
+ opacity: 0.6;
4
+ transform: scale(0);
5
+ }
6
+
7
+ 100% {
8
+ opacity: 0;
9
+ transform: scale(2.8);
10
+ }
11
+ }
12
+
13
+ .m_20df55e0 {
14
+ --indicator-size: calc(0.625rem * var(--c-scale));
15
+ --indicator-color: var(--c-primary-color-filled);
16
+
17
+ position: relative;
18
+ display: block;
19
+ }
20
+
21
+ .m_20df55e0:where([data-inline]) {
22
+ display: inline-block;
23
+ }
24
+
25
+ .m_2b5957d1 {
26
+ position: absolute;
27
+ top: var(--indicator-top);
28
+ left: var(--indicator-left);
29
+ right: var(--indicator-right);
30
+ bottom: var(--indicator-bottom);
31
+ transform: translate(var(--indicator-translate-x), var(--indicator-translate-y));
32
+ min-width: var(--indicator-size);
33
+ height: var(--indicator-size);
34
+ border-radius: var(--indicator-radius, 1000rem);
35
+ z-index: var(--indicator-z-index, 200);
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ font-size: var(--c-font-size-xs);
40
+ background-color: var(--indicator-color);
41
+ color: var(--indicator-text-color, var(--c-color-white));
42
+ white-space: nowrap;
43
+ }
44
+
45
+ .m_2b5957d1::before {
46
+ content: '';
47
+ position: absolute;
48
+ inset: 0;
49
+ background-color: var(--indicator-color);
50
+ border-radius: var(--indicator-radius, 1000rem);
51
+ z-index: -1;
52
+ }
53
+
54
+ .m_2b5957d1:where([data-with-label]) {
55
+ padding-inline: calc(var(--c-spacing-xs) / 2);
56
+ }
57
+
58
+ .m_2b5957d1:where([data-with-border]) {
59
+ border: 2px solid var(--c-color-body);
60
+ }
61
+
62
+ .m_2b5957d1[data-processing]::before {
63
+ animation: m_7c93cd91 1000ms linear infinite;
64
+ }
65
+ }
package/styles.css CHANGED
@@ -2180,6 +2180,71 @@ fieldset:disabled .c-active:active {
2180
2180
  border-radius: var(--image-radius, 0);
2181
2181
  }
2182
2182
 
2183
+ @keyframes m_7c93cd91 {
2184
+ 0% {
2185
+ opacity: 0.6;
2186
+ transform: scale(0);
2187
+ }
2188
+
2189
+ 100% {
2190
+ opacity: 0;
2191
+ transform: scale(2.8);
2192
+ }
2193
+ }
2194
+
2195
+ .m_20df55e0 {
2196
+ --indicator-size: calc(0.625rem * var(--c-scale));
2197
+ --indicator-color: var(--c-primary-color-filled);
2198
+
2199
+ position: relative;
2200
+ display: block;
2201
+ }
2202
+
2203
+ .m_20df55e0:where([data-inline]) {
2204
+ display: inline-block;
2205
+ }
2206
+
2207
+ .m_2b5957d1 {
2208
+ position: absolute;
2209
+ top: var(--indicator-top);
2210
+ left: var(--indicator-left);
2211
+ right: var(--indicator-right);
2212
+ bottom: var(--indicator-bottom);
2213
+ transform: translate(var(--indicator-translate-x), var(--indicator-translate-y));
2214
+ min-width: var(--indicator-size);
2215
+ height: var(--indicator-size);
2216
+ border-radius: var(--indicator-radius, 1000rem);
2217
+ z-index: var(--indicator-z-index, 200);
2218
+ display: flex;
2219
+ align-items: center;
2220
+ justify-content: center;
2221
+ font-size: var(--c-font-size-xs);
2222
+ background-color: var(--indicator-color);
2223
+ color: var(--indicator-text-color, var(--c-color-white));
2224
+ white-space: nowrap;
2225
+ }
2226
+
2227
+ .m_2b5957d1::before {
2228
+ content: '';
2229
+ position: absolute;
2230
+ inset: 0;
2231
+ background-color: var(--indicator-color);
2232
+ border-radius: var(--indicator-radius, 1000rem);
2233
+ z-index: -1;
2234
+ }
2235
+
2236
+ .m_2b5957d1:where([data-with-label]) {
2237
+ padding-inline: calc(var(--c-spacing-xs) / 2);
2238
+ }
2239
+
2240
+ .m_2b5957d1:where([data-with-border]) {
2241
+ border: 2px solid var(--c-color-body);
2242
+ }
2243
+
2244
+ .m_2b5957d1[data-processing]::before {
2245
+ animation: m_7c93cd91 1000ms linear infinite;
2246
+ }
2247
+
2183
2248
  .m_a244865c {
2184
2249
  --loader-size-xs: calc(1.125rem * var(--c-scale));
2185
2250
  --loader-size-sm: calc(1.375rem * var(--c-scale));
package/styles.layer.css CHANGED
@@ -2180,6 +2180,71 @@ fieldset:disabled .c-active:active {
2180
2180
  border-radius: var(--image-radius, 0);
2181
2181
  }
2182
2182
 
2183
+ @keyframes m_7c93cd91 {
2184
+ 0% {
2185
+ opacity: 0.6;
2186
+ transform: scale(0);
2187
+ }
2188
+
2189
+ 100% {
2190
+ opacity: 0;
2191
+ transform: scale(2.8);
2192
+ }
2193
+ }
2194
+
2195
+ .m_20df55e0 {
2196
+ --indicator-size: calc(0.625rem * var(--c-scale));
2197
+ --indicator-color: var(--c-primary-color-filled);
2198
+
2199
+ position: relative;
2200
+ display: block;
2201
+ }
2202
+
2203
+ .m_20df55e0:where([data-inline]) {
2204
+ display: inline-block;
2205
+ }
2206
+
2207
+ .m_2b5957d1 {
2208
+ position: absolute;
2209
+ top: var(--indicator-top);
2210
+ left: var(--indicator-left);
2211
+ right: var(--indicator-right);
2212
+ bottom: var(--indicator-bottom);
2213
+ transform: translate(var(--indicator-translate-x), var(--indicator-translate-y));
2214
+ min-width: var(--indicator-size);
2215
+ height: var(--indicator-size);
2216
+ border-radius: var(--indicator-radius, 1000rem);
2217
+ z-index: var(--indicator-z-index, 200);
2218
+ display: flex;
2219
+ align-items: center;
2220
+ justify-content: center;
2221
+ font-size: var(--c-font-size-xs);
2222
+ background-color: var(--indicator-color);
2223
+ color: var(--indicator-text-color, var(--c-color-white));
2224
+ white-space: nowrap;
2225
+ }
2226
+
2227
+ .m_2b5957d1::before {
2228
+ content: '';
2229
+ position: absolute;
2230
+ inset: 0;
2231
+ background-color: var(--indicator-color);
2232
+ border-radius: var(--indicator-radius, 1000rem);
2233
+ z-index: -1;
2234
+ }
2235
+
2236
+ .m_2b5957d1:where([data-with-label]) {
2237
+ padding-inline: calc(var(--c-spacing-xs) / 2);
2238
+ }
2239
+
2240
+ .m_2b5957d1:where([data-with-border]) {
2241
+ border: 2px solid var(--c-color-body);
2242
+ }
2243
+
2244
+ .m_2b5957d1[data-processing]::before {
2245
+ animation: m_7c93cd91 1000ms linear infinite;
2246
+ }
2247
+
2183
2248
  .m_a244865c {
2184
2249
  --loader-size-xs: calc(1.125rem * var(--c-scale));
2185
2250
  --loader-size-sm: calc(1.375rem * var(--c-scale));