@youcan/celeste 0.6.31 → 0.6.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.js CHANGED
@@ -44,6 +44,8 @@ import { _ as _sfc_main$7 } from "./chunks/modal.js";
44
44
  import PopoverContent from "./popover-content.js";
45
45
  import PopoverTrigger from "./popover-trigger.js";
46
46
  import { _ as _sfc_main$a } from "./chunks/popover.js";
47
+ import progressBar from "./progress-bar.js";
48
+ import progressCircle from "./progress-circle.js";
47
49
  import richEditor from "./rich-editor.js";
48
50
  import { _ as _sfc_main$b } from "./chunks/scroll-area.js";
49
51
  import segmentedControlItem from "./segmented-control-item.js";
@@ -58,8 +60,8 @@ import SelectTrigger from "./select-trigger.js";
58
60
  import SelectValue from "./select-value.js";
59
61
  import { _ as _sfc_main$c } from "./chunks/select.js";
60
62
  import { _ as _sfc_main$e } from "./chunks/slider.vue_vue_type_style_index_0_lang.js";
61
- import sonnerAlert from "./sonner-alert.js";
62
- import { _ as _sfc_main$f } from "./chunks/sonner.js";
63
+ import SonnerAlert from "./sonner-alert.js";
64
+ import { _ as _sfc_main$f, t as toast$1 } from "./chunks/sonner.js";
63
65
  import { _ as _sfc_main$g } from "./chunks/switch.vue_vue_type_style_index_0_lang.js";
64
66
  import tabMenuContent from "./tab-menu-content.js";
65
67
  import tabMenuItem from "./tab-menu-item.js";
@@ -70,6 +72,9 @@ import TextInputButton from "./text-input-button.js";
70
72
  import TextInput from "./text-input.js";
71
73
  import textarea from "./textarea.js";
72
74
  import Tooltip from "./tooltip.js";
75
+ import { COLOR_NUMBER_VALIDATION_PATTERN, DEFAULT_SWATCH, HEX_VALIDATION_PATTERN, bumpColorValue, clamp, getAbsolutePosition, getColorConstraints, getFractionDigit, getPageXYFromEvent, getScrollXY, resolveArrowDirection, truncColorValue } from "./color.js";
76
+ import { uid } from "./crypto.js";
77
+ import { markRaw } from "vue";
73
78
  const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
74
79
  __proto__: null,
75
80
  Alert,
@@ -116,6 +121,8 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
116
121
  Popover: _sfc_main$a,
117
122
  PopoverContent,
118
123
  PopoverTrigger,
124
+ ProgressBar: progressBar,
125
+ ProgressCircle: progressCircle,
119
126
  RichEditor: richEditor,
120
127
  ScrollArea: _sfc_main$b,
121
128
  SegmentedControl: segmentedControl,
@@ -132,7 +139,7 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
132
139
  Slider: _sfc_main$e,
133
140
  SocialButton: socialButton,
134
141
  Sonner: _sfc_main$f,
135
- SonnerAlert: sonnerAlert,
142
+ SonnerAlert,
136
143
  StatusBadge: statusBadge,
137
144
  Switch: _sfc_main$g,
138
145
  TabMenu: tabMenu,
@@ -145,6 +152,55 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
145
152
  Textarea: textarea,
146
153
  Tooltip
147
154
  }, Symbol.toStringTag, { value: "Module" }));
155
+ function createToast(title, data) {
156
+ const {
157
+ state = "success",
158
+ variant = "stroke",
159
+ size = "lg",
160
+ dismissable = true,
161
+ ...externalToastProps
162
+ } = data || {};
163
+ let toastId;
164
+ const dismissToast = () => {
165
+ toast$1.dismiss(toastId);
166
+ };
167
+ toastId = toast$1.custom(markRaw(SonnerAlert), {
168
+ ...externalToastProps,
169
+ componentProps: {
170
+ title,
171
+ description: data == null ? void 0 : data.description,
172
+ state,
173
+ variant,
174
+ size,
175
+ dismissable,
176
+ onDismiss: dismissToast
177
+ }
178
+ });
179
+ return toastId;
180
+ }
181
+ const toast = Object.assign(createToast, {
182
+ success: (title, data) => {
183
+ return createToast(title, { ...data, state: "success" });
184
+ },
185
+ error: (title, data) => {
186
+ return createToast(title, { ...data, state: "error" });
187
+ },
188
+ warning: (title, data) => {
189
+ return createToast(title, { ...data, state: "warning" });
190
+ },
191
+ info: (title, data) => {
192
+ return createToast(title, { ...data, state: "information" });
193
+ },
194
+ feature: (title, data) => {
195
+ return createToast(title, { ...data, state: "feature" });
196
+ },
197
+ dismiss: (id) => {
198
+ toast$1.dismiss(id);
199
+ },
200
+ loading: (title, data) => {
201
+ return toast$1.loading(title, data);
202
+ }
203
+ });
148
204
  const Celeste = {
149
205
  install(vue) {
150
206
  Object.entries(components).forEach(([name, component]) => {
@@ -156,6 +212,7 @@ export {
156
212
  Alert,
157
213
  Badge,
158
214
  Button,
215
+ COLOR_NUMBER_VALIDATION_PATTERN,
159
216
  Celeste,
160
217
  _sfc_main as Checkbox,
161
218
  checkboxLabel as CheckboxLabel,
@@ -172,6 +229,7 @@ export {
172
229
  CompactButton,
173
230
  _sfc_main$2 as ContentDivider,
174
231
  contextMenuItem as ContextMenuItem,
232
+ DEFAULT_SWATCH,
175
233
  dropdown as Dropdown,
176
234
  DropdownItem,
177
235
  dropdownMenu as DropdownMenu,
@@ -185,6 +243,7 @@ export {
185
243
  _sfc_main$6 as DropdownMenuSubTrigger,
186
244
  dropdownMenuTrigger as DropdownMenuTrigger,
187
245
  fancyButton as FancyButton,
246
+ HEX_VALIDATION_PATTERN,
188
247
  hintText as HintText,
189
248
  Label,
190
249
  LinkButton,
@@ -198,6 +257,8 @@ export {
198
257
  _sfc_main$a as Popover,
199
258
  PopoverContent,
200
259
  PopoverTrigger,
260
+ progressBar as ProgressBar,
261
+ progressCircle as ProgressCircle,
201
262
  richEditor as RichEditor,
202
263
  _sfc_main$b as ScrollArea,
203
264
  segmentedControl as SegmentedControl,
@@ -214,7 +275,7 @@ export {
214
275
  _sfc_main$e as Slider,
215
276
  socialButton as SocialButton,
216
277
  _sfc_main$f as Sonner,
217
- sonnerAlert as SonnerAlert,
278
+ SonnerAlert,
218
279
  statusBadge as StatusBadge,
219
280
  _sfc_main$g as Switch,
220
281
  tabMenu as TabMenu,
@@ -225,5 +286,16 @@ export {
225
286
  TextInputAffix,
226
287
  TextInputButton,
227
288
  textarea as Textarea,
228
- Tooltip
289
+ Tooltip,
290
+ bumpColorValue,
291
+ clamp,
292
+ getAbsolutePosition,
293
+ getColorConstraints,
294
+ getFractionDigit,
295
+ getPageXYFromEvent,
296
+ getScrollXY,
297
+ resolveArrowDirection,
298
+ toast,
299
+ truncColorValue,
300
+ uid
229
301
  };
@@ -0,0 +1,85 @@
1
+ import { defineComponent, useCssVars, computed, openBlock, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, renderSlot, createTextVNode, createVNode, unref, mergeProps, withCtx } from "vue";
2
+ import { useDelegatedProps } from "./use-delegated-props.js";
3
+ import { c as clsx } from "./chunks/clsx.js";
4
+ import { ak as By, al as Iy } from "./chunks/index.js";
5
+ import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
6
+ const _hoisted_1 = ["data-layout"];
7
+ const _hoisted_2 = {
8
+ key: 0,
9
+ class: "celeste-progress-bar-label"
10
+ };
11
+ const _hoisted_3 = {
12
+ key: 0,
13
+ class: "celeste-progress-bar-label-title"
14
+ };
15
+ const _hoisted_4 = { class: "celeste-progress-bar-label" };
16
+ const _hoisted_5 = {
17
+ key: 1,
18
+ class: "celeste-progress-bar-description"
19
+ };
20
+ const _sfc_main = /* @__PURE__ */ defineComponent({
21
+ __name: "progress-bar",
22
+ props: {
23
+ modelValue: { default: 0 },
24
+ max: { default: 100 },
25
+ getValueLabel: {},
26
+ asChild: { type: Boolean },
27
+ as: {},
28
+ class: {},
29
+ color: { default: "primary" },
30
+ title: {},
31
+ layout: { default: "bare" }
32
+ },
33
+ setup(__props) {
34
+ useCssVars((_ctx) => ({
35
+ "6ba22aeb": progressIndicator.value
36
+ }));
37
+ const props = __props;
38
+ const delegatedProps = useDelegatedProps(props, "class");
39
+ const progress = computed(() => {
40
+ if (props.max === 0)
41
+ return 0;
42
+ const value = Math.min(Math.max(props.modelValue ?? 0, 0), props.max);
43
+ return Math.round(value / props.max * 100);
44
+ });
45
+ const progressIndicator = computed(() => {
46
+ return 100 - (props.modelValue ?? 0) / props.max * 100;
47
+ });
48
+ return (_ctx, _cache) => {
49
+ return openBlock(), createElementBlock("div", {
50
+ class: "celeste-progress-bar-wrapper",
51
+ "data-layout": _ctx.layout
52
+ }, [
53
+ _ctx.layout !== "bare" ? (openBlock(), createElementBlock("div", _hoisted_2, [
54
+ props.title && _ctx.layout !== "inline" ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(_ctx.title), 1)) : createCommentVNode("", true),
55
+ createElementVNode("span", _hoisted_4, [
56
+ renderSlot(_ctx.$slots, "label", {}, () => [
57
+ createTextVNode(toDisplayString(progress.value) + "% ", 1)
58
+ ], true)
59
+ ])
60
+ ])) : createCommentVNode("", true),
61
+ createVNode(unref(By), mergeProps(unref(delegatedProps), {
62
+ class: unref(clsx)(
63
+ "celeste-progress-bar",
64
+ props.class
65
+ )
66
+ }), {
67
+ default: withCtx(() => [
68
+ createVNode(unref(Iy), {
69
+ class: "celeste-progress-bar-indicator",
70
+ "data-color": _ctx.color
71
+ }, null, 8, ["data-color"])
72
+ ]),
73
+ _: 1
74
+ }, 16, ["class"]),
75
+ _ctx.$slots.description && _ctx.layout === "default" ? (openBlock(), createElementBlock("div", _hoisted_5, [
76
+ renderSlot(_ctx.$slots, "description", {}, void 0, true)
77
+ ])) : createCommentVNode("", true)
78
+ ], 8, _hoisted_1);
79
+ };
80
+ }
81
+ });
82
+ const progressBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-850aadb2"]]);
83
+ export {
84
+ progressBar as default
85
+ };
@@ -0,0 +1,93 @@
1
+ import { defineComponent, useCssVars, computed, openBlock, createBlock, unref, mergeProps, withCtx, createVNode, createElementBlock, createElementVNode, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from "vue";
2
+ import { useDelegatedProps } from "./use-delegated-props.js";
3
+ import { c as clsx } from "./chunks/clsx.js";
4
+ import { ak as By, al as Iy } from "./chunks/index.js";
5
+ import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
6
+ const _hoisted_1 = ["width", "height"];
7
+ const _hoisted_2 = ["cx", "cy", "r"];
8
+ const _hoisted_3 = ["cx", "cy", "r", "stroke-dasharray", "stroke-dashoffset"];
9
+ const _hoisted_4 = {
10
+ key: 0,
11
+ class: "celeste-progress-circle-label"
12
+ };
13
+ const STROKE_WIDTH = 6.4;
14
+ const _sfc_main = /* @__PURE__ */ defineComponent({
15
+ __name: "progress-circle",
16
+ props: {
17
+ modelValue: { default: 0 },
18
+ max: { default: 100 },
19
+ getValueLabel: {},
20
+ asChild: { type: Boolean },
21
+ as: {},
22
+ class: {},
23
+ size: { default: 80 }
24
+ },
25
+ setup(__props) {
26
+ useCssVars((_ctx) => ({
27
+ "433ff7ca": circleSize.value
28
+ }));
29
+ const props = __props;
30
+ const delegatedProps = useDelegatedProps(props, "class");
31
+ const radius = computed(() => (props.size - STROKE_WIDTH) / 2);
32
+ const circumference = computed(() => 2 * Math.PI * radius.value);
33
+ const progress = computed(() => {
34
+ if (props.max === 0)
35
+ return 0;
36
+ const value = Math.min(Math.max(props.modelValue ?? 0, 0), props.max);
37
+ return Math.round(value / props.max * 100);
38
+ });
39
+ const offset = computed(() => {
40
+ return circumference.value * (1 - progress.value / 100);
41
+ });
42
+ const circleSize = computed(() => `${props.size}px`);
43
+ return (_ctx, _cache) => {
44
+ return openBlock(), createBlock(unref(By), mergeProps(unref(delegatedProps), {
45
+ value: props.modelValue,
46
+ class: unref(clsx)("celeste-progress-circle", props.class),
47
+ as: "div"
48
+ }), {
49
+ default: withCtx(() => [
50
+ createVNode(unref(Iy), { "as-child": "" }, {
51
+ default: withCtx(() => [
52
+ (openBlock(), createElementBlock("svg", {
53
+ class: "celeste-progress-circle-svg",
54
+ width: props.size,
55
+ height: props.size
56
+ }, [
57
+ createElementVNode("circle", {
58
+ class: "celeste-progress-circle-track",
59
+ cx: props.size / 2,
60
+ cy: props.size / 2,
61
+ r: radius.value,
62
+ "stroke-width": STROKE_WIDTH,
63
+ fill: "transparent"
64
+ }, null, 8, _hoisted_2),
65
+ createElementVNode("circle", {
66
+ class: "celeste-progress-circle-indicator",
67
+ cx: props.size / 2,
68
+ cy: props.size / 2,
69
+ r: radius.value,
70
+ "stroke-width": STROKE_WIDTH,
71
+ fill: "transparent",
72
+ "stroke-dasharray": circumference.value,
73
+ "stroke-dashoffset": offset.value
74
+ }, null, 8, _hoisted_3)
75
+ ], 8, _hoisted_1))
76
+ ]),
77
+ _: 1
78
+ }),
79
+ props.size !== 48 ? (openBlock(), createElementBlock("div", _hoisted_4, [
80
+ renderSlot(_ctx.$slots, "default", {}, () => [
81
+ createTextVNode(toDisplayString(progress.value) + "% ", 1)
82
+ ], true)
83
+ ])) : createCommentVNode("", true)
84
+ ]),
85
+ _: 3
86
+ }, 16, ["value", "class"]);
87
+ };
88
+ }
89
+ });
90
+ const progressCircle = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f8ba36bb"]]);
91
+ export {
92
+ progressCircle as default
93
+ };
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode, mergeProps, renderSlot } from "vue";
2
2
  import { useDelegatedProps } from "./use-delegated-props.js";
3
3
  import { c as clsx } from "./chunks/clsx.js";
4
- import { x as xe, ak as zy, al as Ky, am as Xy } from "./chunks/index.js";
4
+ import { x as xe, am as zy, an as Ky, ao as Xy } from "./chunks/index.js";
5
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  __name: "select-content",
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, createVNode, renderSlot, createElementVNode } from "vue";
2
2
  import { useDelegatedProps } from "./use-delegated-props.js";
3
3
  import { c as clsx } from "./chunks/clsx.js";
4
- import { an as jy, ao as Yy, ap as Uy } from "./chunks/index.js";
4
+ import { ap as jy, aq as Yy, ar as Uy } from "./chunks/index.js";
5
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  __name: "select-item",
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot, createVNode, createElementVNode } from "vue";
2
2
  import { useDelegatedProps } from "./use-delegated-props.js";
3
3
  import { c as clsx } from "./chunks/clsx.js";
4
- import { aq as Ly, ar as eg } from "./chunks/index.js";
4
+ import { as as Ly, at as eg } from "./chunks/index.js";
5
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  __name: "select-trigger",
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, unref, mergeProps, withCtx, renderSlot } from "vue";
2
2
  import { useDelegatedProps } from "./use-delegated-props.js";
3
3
  import { c as clsx } from "./chunks/clsx.js";
4
- import { as as Qy } from "./chunks/index.js";
4
+ import { au as Qy } from "./chunks/index.js";
5
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
6
6
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  __name: "select-value",
@@ -36,7 +36,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
36
  };
37
37
  }
38
38
  });
39
- const sonnerAlert = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c8bb23e0"]]);
39
+ const SonnerAlert = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c8bb23e0"]]);
40
40
  export {
41
- sonnerAlert as default
41
+ SonnerAlert as default
42
42
  };
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, ref, openBlock, createBlock, unref, withCtx, createVNode, mergeProps, renderSlot, createElementBlock, normalizeClass, createCommentVNode, createElementVNode, toDisplayString } from "vue";
2
2
  import CompactButton from "./compact-button.js";
3
3
  import { c as clsx } from "./chunks/clsx.js";
4
- import { x as xe, at as Lg, au as zg, av as Kg, aw as jg, ax as Hg, ay as Wg } from "./chunks/index.js";
4
+ import { x as xe, av as Lg, aw as zg, ax as Kg, ay as jg, az as Hg, aA as Wg } from "./chunks/index.js";
5
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
6
6
  const _hoisted_1 = { class: "celeste-tooltip-content-box" };
7
7
  const _hoisted_2 = {
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export declare const Celeste: {
3
3
  install(vue: App): void;
4
4
  };
5
5
  export * from './components';
6
+ export * from './utils';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@youcan/celeste",
3
3
  "type": "module",
4
- "version": "0.6.31",
4
+ "version": "0.6.33",
5
5
  "author": "YouCan <tech@youcan.shop>",
6
6
  "keywords": [
7
7
  "youcan",
@@ -43,8 +43,8 @@
43
43
  "radix-vue": "^1.9.12",
44
44
  "tinycolor2": "^1.6.0",
45
45
  "vue-sonner": "^2.0.2",
46
- "@youcan/celeste-icons": "0.6.31",
47
- "@youcan/celeste-tokens": "0.6.31"
46
+ "@youcan/celeste-icons": "0.6.33",
47
+ "@youcan/celeste-tokens": "0.6.33"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@chromatic-com/storybook": "^4.0.0",
@@ -41,6 +41,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
41
41
  --dropdown-max-width: 350px;
42
42
 
43
43
  display: flex;
44
+ z-index: 50;
44
45
  box-sizing: border-box;
45
46
  flex-direction: column;
46
47
  width: var(--dropdown-width);
@@ -52,11 +53,11 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
52
53
  transition-property: display, transform, opacity;
53
54
  transition-duration: var(--animation-fast);
54
55
  transition-timing-function: ease-out;
55
- transition-behavior: allow-discrete;
56
56
  border: 1px solid var(--color-stroke-soft-200);
57
57
  border-radius: var(--radius-16);
58
58
  background-color: var(--color-bg-white-0);
59
59
  box-shadow: var(--shadow-regular-md);
60
+ transition-behavior: allow-discrete;
60
61
  gap: var(--spacing-4);
61
62
 
62
63
  &[data-state='closed'] {
@@ -10,6 +10,7 @@ export * from './hint-text';
10
10
  export * from './label';
11
11
  export * from './modal';
12
12
  export * from './popover';
13
+ export * from './progress';
13
14
  export * from './rich-editor';
14
15
  export * from './scroll-area';
15
16
  export * from './segmented-control';
@@ -0,0 +1,5 @@
1
+ export * from './progress-bar.vue';
2
+ export { default as ProgressBar } from './progress-bar.vue';
3
+
4
+ export * from './progress-circle.vue';
5
+ export { default as ProgressCircle } from './progress-circle.vue';
@@ -0,0 +1,167 @@
1
+ <script setup lang="ts">
2
+ import { useDelegatedProps } from '@/composables/use-delegated-props';
3
+ import clsx from 'clsx';
4
+ import {
5
+ ProgressIndicator,
6
+ ProgressRoot,
7
+ type ProgressRootProps,
8
+ } from 'radix-vue';
9
+ import { computed, type HTMLAttributes } from 'vue';
10
+
11
+ const props = withDefaults(
12
+ defineProps<
13
+ ProgressRootProps & {
14
+ class?: HTMLAttributes['class'];
15
+ color?: 'blue' | 'red' | 'orange' | 'green' | 'primary';
16
+ title?: string;
17
+ layout?: 'default' | 'no-description' | 'inline' | 'bare';
18
+ }
19
+ >(),
20
+ {
21
+ modelValue: 0,
22
+ color: 'primary',
23
+ layout: 'bare',
24
+ max: 100,
25
+ },
26
+ );
27
+
28
+ const delegatedProps = useDelegatedProps(props, 'class');
29
+
30
+ const progress = computed(() => {
31
+ if (props.max === 0)
32
+ return 0;
33
+
34
+ const value = Math.min(Math.max(props.modelValue ?? 0, 0), props.max);
35
+
36
+ return Math.round((value / props.max) * 100);
37
+ });
38
+
39
+ const progressIndicator = computed(() => {
40
+ return 100 - (props.modelValue ?? 0) / props.max * 100;
41
+ });
42
+ </script>
43
+
44
+ <template>
45
+ <div class="celeste-progress-bar-wrapper" :data-layout="layout">
46
+ <div v-if="layout !== 'bare'" class="celeste-progress-bar-label">
47
+ <span
48
+ v-if="props.title && layout !== 'inline'"
49
+ class="celeste-progress-bar-label-title"
50
+ >
51
+ {{ title }}
52
+ </span>
53
+ <span
54
+ class="celeste-progress-bar-label"
55
+ >
56
+ <slot name="label">
57
+ {{ progress }}%
58
+ </slot>
59
+ </span>
60
+ </div>
61
+
62
+ <ProgressRoot
63
+ v-bind="delegatedProps"
64
+ :class="
65
+ clsx(
66
+ 'celeste-progress-bar',
67
+ props.class,
68
+ )
69
+ "
70
+ >
71
+ <ProgressIndicator
72
+ class="celeste-progress-bar-indicator"
73
+ :data-color="color"
74
+ />
75
+ </ProgressRoot>
76
+
77
+ <div v-if="$slots.description && layout === 'default'" class="celeste-progress-bar-description">
78
+ <slot name="description" />
79
+ </div>
80
+ </div>
81
+ </template>
82
+
83
+ <style lang="scss" scoped>
84
+ .celeste-progress-bar-wrapper {
85
+ --bar-height: 6px;
86
+
87
+ display: flex;
88
+ width: 100%;
89
+ gap: var(--spacing-6);
90
+
91
+ .celeste-progress-bar {
92
+ height: var(--bar-height);
93
+ overflow: hidden;
94
+ border-radius: var(--radius-full);
95
+ background: var(--color-bg-soft-200);
96
+ }
97
+
98
+ .celeste-progress-bar-indicator {
99
+ --progress: v-bind('progressIndicator');
100
+
101
+ width: 100%;
102
+ height: 100%;
103
+ transform: translateX(calc(var(--progress) * -1%));
104
+ border-radius: var(--radius-full);
105
+ background: var(--color-primary-base);
106
+
107
+ :dir(rtl) & {
108
+ transform: translateX(calc(var(--progress) * 1%));
109
+ }
110
+
111
+ &[data-color='orange'] {
112
+ background: var(--color-state-warning-base);
113
+ }
114
+
115
+ &[data-color='red'] {
116
+ background: var(--color-state-error-base);
117
+ }
118
+
119
+ &[data-color='blue'] {
120
+ background: var(--color-state-information-base);
121
+ }
122
+
123
+ &[data-color='green'] {
124
+ background: var(--color-state-success-base);
125
+ }
126
+ }
127
+
128
+ .celeste-progress-bar-label {
129
+ display: flex;
130
+ align-items: center;
131
+ justify-content: space-between;
132
+ gap: var(--spacing-6);
133
+ color: var(--color-text-sub-600);
134
+ font: var(--paragraph-sm);
135
+
136
+ &.celeste-progress-bar-title {
137
+ color: var(--color-text-strong-950);
138
+ font: var(--label-sm);
139
+ }
140
+ }
141
+
142
+ .celeste-progress-bar-description {
143
+ color: var(--color-text-sub-600);
144
+ font: var(--paragraph-xs);
145
+ }
146
+
147
+ &[data-layout='default'],
148
+ &[data-layout='no-description'] {
149
+ flex-direction: column;
150
+
151
+ &:deep(.celeste-progress-bar) {
152
+ width: 100%;
153
+ }
154
+ }
155
+
156
+ &[data-layout='inline'],
157
+ &[data-layout='bare'] {
158
+ flex-direction: row-reverse;
159
+ align-items: center;
160
+ gap: var(--spacing-8);
161
+
162
+ &:deep(.celeste-progress-bar) {
163
+ flex: 1;
164
+ }
165
+ }
166
+ }
167
+ </style>