@youcan/celeste 0.6.32 → 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/celeste.css +96 -1
- package/dist/cjs/chunks/index.js +95 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/progress-bar.js +84 -0
- package/dist/cjs/progress-circle.js +92 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/progress/index.d.ts +4 -0
- package/dist/components/progress/progress-bar.d.ts +31 -0
- package/dist/components/progress/progress-circle.d.ts +27 -0
- package/dist/es/chunks/index.js +110 -15
- package/dist/es/index.js +6 -0
- package/dist/es/progress-bar.js +85 -0
- package/dist/es/progress-circle.js +93 -0
- package/dist/es/select-content.js +1 -1
- package/dist/es/select-item.js +1 -1
- package/dist/es/select-trigger.js +1 -1
- package/dist/es/select-value.js +1 -1
- package/dist/es/tooltip.js +1 -1
- package/package.json +3 -3
- package/src/components/dropdown-menu/dropdown-menu-content.vue +2 -1
- package/src/components/index.ts +1 -0
- package/src/components/progress/index.ts +5 -0
- package/src/components/progress/progress-bar.vue +167 -0
- package/src/components/progress/progress-circle.vue +126 -0
- package/src/components/progress/stories/progress-bar.stories.ts +328 -0
- package/src/components/progress/stories/progress-circular.stories.ts +152 -0
package/dist/celeste.css
CHANGED
|
@@ -174,6 +174,7 @@
|
|
|
174
174
|
--dropdown-width: 100%;
|
|
175
175
|
--dropdown-max-width: 350px;
|
|
176
176
|
display: flex;
|
|
177
|
+
z-index: 50;
|
|
177
178
|
box-sizing: border-box;
|
|
178
179
|
flex-direction: column;
|
|
179
180
|
width: var(--dropdown-width);
|
|
@@ -185,11 +186,11 @@
|
|
|
185
186
|
transition-property: display, transform, opacity;
|
|
186
187
|
transition-duration: var(--animation-fast);
|
|
187
188
|
transition-timing-function: ease-out;
|
|
188
|
-
transition-behavior: allow-discrete;
|
|
189
189
|
border: 1px solid var(--color-stroke-soft-200);
|
|
190
190
|
border-radius: var(--radius-16);
|
|
191
191
|
background-color: var(--color-bg-white-0);
|
|
192
192
|
box-shadow: var(--shadow-regular-md);
|
|
193
|
+
transition-behavior: allow-discrete;
|
|
193
194
|
gap: var(--spacing-4);
|
|
194
195
|
}
|
|
195
196
|
.celeste-dropdown-menu-content[data-state=closed] {
|
|
@@ -3615,6 +3616,100 @@ to {
|
|
|
3615
3616
|
width: -moz-fit-content;
|
|
3616
3617
|
width: fit-content;
|
|
3617
3618
|
cursor: pointer;
|
|
3619
|
+
}.celeste-progress-bar-wrapper[data-v-850aadb2] {
|
|
3620
|
+
--bar-height: 6px;
|
|
3621
|
+
display: flex;
|
|
3622
|
+
width: 100%;
|
|
3623
|
+
gap: var(--spacing-6);
|
|
3624
|
+
}
|
|
3625
|
+
.celeste-progress-bar-wrapper .celeste-progress-bar[data-v-850aadb2] {
|
|
3626
|
+
height: var(--bar-height);
|
|
3627
|
+
overflow: hidden;
|
|
3628
|
+
border-radius: var(--radius-full);
|
|
3629
|
+
background: var(--color-bg-soft-200);
|
|
3630
|
+
}
|
|
3631
|
+
.celeste-progress-bar-wrapper .celeste-progress-bar-indicator[data-v-850aadb2] {
|
|
3632
|
+
--progress: var(--6ba22aeb);
|
|
3633
|
+
width: 100%;
|
|
3634
|
+
height: 100%;
|
|
3635
|
+
transform: translateX(calc(var(--progress) * -1%));
|
|
3636
|
+
border-radius: var(--radius-full);
|
|
3637
|
+
background: var(--color-primary-base);
|
|
3638
|
+
}
|
|
3639
|
+
:dir(rtl) .celeste-progress-bar-wrapper .celeste-progress-bar-indicator[data-v-850aadb2] {
|
|
3640
|
+
transform: translateX(calc(var(--progress) * 1%));
|
|
3641
|
+
}
|
|
3642
|
+
.celeste-progress-bar-wrapper .celeste-progress-bar-indicator[data-color=orange][data-v-850aadb2] {
|
|
3643
|
+
background: var(--color-state-warning-base);
|
|
3644
|
+
}
|
|
3645
|
+
.celeste-progress-bar-wrapper .celeste-progress-bar-indicator[data-color=red][data-v-850aadb2] {
|
|
3646
|
+
background: var(--color-state-error-base);
|
|
3647
|
+
}
|
|
3648
|
+
.celeste-progress-bar-wrapper .celeste-progress-bar-indicator[data-color=blue][data-v-850aadb2] {
|
|
3649
|
+
background: var(--color-state-information-base);
|
|
3650
|
+
}
|
|
3651
|
+
.celeste-progress-bar-wrapper .celeste-progress-bar-indicator[data-color=green][data-v-850aadb2] {
|
|
3652
|
+
background: var(--color-state-success-base);
|
|
3653
|
+
}
|
|
3654
|
+
.celeste-progress-bar-wrapper .celeste-progress-bar-label[data-v-850aadb2] {
|
|
3655
|
+
display: flex;
|
|
3656
|
+
align-items: center;
|
|
3657
|
+
justify-content: space-between;
|
|
3658
|
+
gap: var(--spacing-6);
|
|
3659
|
+
color: var(--color-text-sub-600);
|
|
3660
|
+
font: var(--paragraph-sm);
|
|
3661
|
+
}
|
|
3662
|
+
.celeste-progress-bar-wrapper .celeste-progress-bar-label.celeste-progress-bar-title[data-v-850aadb2] {
|
|
3663
|
+
color: var(--color-text-strong-950);
|
|
3664
|
+
font: var(--label-sm);
|
|
3665
|
+
}
|
|
3666
|
+
.celeste-progress-bar-wrapper .celeste-progress-bar-description[data-v-850aadb2] {
|
|
3667
|
+
color: var(--color-text-sub-600);
|
|
3668
|
+
font: var(--paragraph-xs);
|
|
3669
|
+
}
|
|
3670
|
+
.celeste-progress-bar-wrapper[data-layout=default][data-v-850aadb2], .celeste-progress-bar-wrapper[data-layout=no-description][data-v-850aadb2] {
|
|
3671
|
+
flex-direction: column;
|
|
3672
|
+
}
|
|
3673
|
+
.celeste-progress-bar-wrapper[data-layout=default][data-v-850aadb2] .celeste-progress-bar, .celeste-progress-bar-wrapper[data-layout=no-description][data-v-850aadb2] .celeste-progress-bar {
|
|
3674
|
+
width: 100%;
|
|
3675
|
+
}
|
|
3676
|
+
.celeste-progress-bar-wrapper[data-layout=inline][data-v-850aadb2], .celeste-progress-bar-wrapper[data-layout=bare][data-v-850aadb2] {
|
|
3677
|
+
flex-direction: row-reverse;
|
|
3678
|
+
align-items: center;
|
|
3679
|
+
gap: var(--spacing-8);
|
|
3680
|
+
}
|
|
3681
|
+
.celeste-progress-bar-wrapper[data-layout=inline][data-v-850aadb2] .celeste-progress-bar, .celeste-progress-bar-wrapper[data-layout=bare][data-v-850aadb2] .celeste-progress-bar {
|
|
3682
|
+
flex: 1;
|
|
3683
|
+
}.celeste-progress-circle[data-v-f8ba36bb] {
|
|
3684
|
+
display: inline-flex;
|
|
3685
|
+
position: relative;
|
|
3686
|
+
align-items: center;
|
|
3687
|
+
justify-content: center;
|
|
3688
|
+
width: var(--433ff7ca);
|
|
3689
|
+
height: var(--433ff7ca);
|
|
3690
|
+
}
|
|
3691
|
+
.celeste-progress-circle-svg[data-v-f8ba36bb] {
|
|
3692
|
+
transform: rotate(-90deg);
|
|
3693
|
+
}
|
|
3694
|
+
.celeste-progress-circle-track[data-v-f8ba36bb] {
|
|
3695
|
+
stroke: var(--color-bg-soft-200);
|
|
3696
|
+
}
|
|
3697
|
+
.celeste-progress-circle-indicator[data-v-f8ba36bb] {
|
|
3698
|
+
transition: stroke-dashoffset 0.3s ease;
|
|
3699
|
+
stroke: var(--color-primary-base);
|
|
3700
|
+
}
|
|
3701
|
+
.celeste-progress-circle-label[data-v-f8ba36bb] {
|
|
3702
|
+
position: absolute;
|
|
3703
|
+
top: 50%;
|
|
3704
|
+
left: 50%;
|
|
3705
|
+
transform: translate(-50%, -50%);
|
|
3706
|
+
color: var(--color-text-strong-950);
|
|
3707
|
+
font: var(--label-sm);
|
|
3708
|
+
text-align: center;
|
|
3709
|
+
pointer-events: none;
|
|
3710
|
+
-webkit-user-select: none;
|
|
3711
|
+
-moz-user-select: none;
|
|
3712
|
+
user-select: none;
|
|
3618
3713
|
}[data-v-69b8512e] .celeste-select-content {
|
|
3619
3714
|
z-index: 50;
|
|
3620
3715
|
max-height: var(--radix-select-content-available-height);
|
package/dist/cjs/chunks/index.js
CHANGED
|
@@ -6423,6 +6423,99 @@ const [Nt, Xc] = Q("PopoverRoot"), ys = /* @__PURE__ */ Mo.defineComponent({
|
|
|
6423
6423
|
_: 3
|
|
6424
6424
|
}, 8, ["type", "as", "as-child"]));
|
|
6425
6425
|
}
|
|
6426
|
+
}), da = 100, [Qc, ef] = Q("ProgressRoot"), Po = (a2) => typeof a2 == "number";
|
|
6427
|
+
function tf(a2, t) {
|
|
6428
|
+
return vt(a2) || Po(a2) && !Number.isNaN(a2) && a2 <= t && a2 >= 0 ? a2 : (console.error(`Invalid prop \`value\` of value \`${a2}\` supplied to \`ProgressRoot\`. The \`value\` prop must be:
|
|
6429
|
+
- a positive number
|
|
6430
|
+
- less than the value passed to \`max\` (or ${da} if no \`max\` prop is set)
|
|
6431
|
+
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
6432
|
+
|
|
6433
|
+
Defaulting to \`null\`.`), null);
|
|
6434
|
+
}
|
|
6435
|
+
function af(a2) {
|
|
6436
|
+
return Po(a2) && !Number.isNaN(a2) && a2 > 0 ? a2 : (console.error(
|
|
6437
|
+
`Invalid prop \`max\` of value \`${a2}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${da}\`.`
|
|
6438
|
+
), da);
|
|
6439
|
+
}
|
|
6440
|
+
const By = /* @__PURE__ */ Mo.defineComponent({
|
|
6441
|
+
__name: "ProgressRoot",
|
|
6442
|
+
props: {
|
|
6443
|
+
modelValue: {},
|
|
6444
|
+
max: { default: da },
|
|
6445
|
+
getValueLabel: { type: Function, default: (a2, t) => `${Math.round(a2 / t * da)}%` },
|
|
6446
|
+
asChild: { type: Boolean },
|
|
6447
|
+
as: {}
|
|
6448
|
+
},
|
|
6449
|
+
emits: ["update:modelValue", "update:max"],
|
|
6450
|
+
setup(a2, { emit: t }) {
|
|
6451
|
+
const e = a2, n = t;
|
|
6452
|
+
R();
|
|
6453
|
+
const l = ne(e, "modelValue", n, {
|
|
6454
|
+
passive: e.modelValue === void 0
|
|
6455
|
+
}), s = ne(e, "max", n, {
|
|
6456
|
+
passive: e.max === void 0
|
|
6457
|
+
});
|
|
6458
|
+
Mo.watch(
|
|
6459
|
+
() => l.value,
|
|
6460
|
+
async (i) => {
|
|
6461
|
+
const u = tf(i, e.max);
|
|
6462
|
+
u !== i && (await Mo.nextTick(), l.value = u);
|
|
6463
|
+
},
|
|
6464
|
+
{ immediate: true }
|
|
6465
|
+
), Mo.watch(
|
|
6466
|
+
() => e.max,
|
|
6467
|
+
(i) => {
|
|
6468
|
+
const u = af(e.max);
|
|
6469
|
+
u !== i && (s.value = u);
|
|
6470
|
+
},
|
|
6471
|
+
{ immediate: true }
|
|
6472
|
+
);
|
|
6473
|
+
const r = Mo.computed(() => vt(l.value) ? "indeterminate" : l.value === s.value ? "complete" : "loading");
|
|
6474
|
+
return ef({
|
|
6475
|
+
modelValue: l,
|
|
6476
|
+
max: s,
|
|
6477
|
+
progressState: r
|
|
6478
|
+
}), (i, u) => (Mo.openBlock(), Mo.createBlock(Mo.unref(O), {
|
|
6479
|
+
"as-child": i.asChild,
|
|
6480
|
+
as: i.as,
|
|
6481
|
+
"aria-valuemax": Mo.unref(s),
|
|
6482
|
+
"aria-valuemin": 0,
|
|
6483
|
+
"aria-valuenow": Po(Mo.unref(l)) ? Mo.unref(l) : void 0,
|
|
6484
|
+
"aria-valuetext": i.getValueLabel(Mo.unref(l), Mo.unref(s)),
|
|
6485
|
+
"aria-label": i.getValueLabel(Mo.unref(l), Mo.unref(s)),
|
|
6486
|
+
role: "progressbar",
|
|
6487
|
+
"data-state": r.value,
|
|
6488
|
+
"data-value": Mo.unref(l) ?? void 0,
|
|
6489
|
+
"data-max": Mo.unref(s)
|
|
6490
|
+
}, {
|
|
6491
|
+
default: Mo.withCtx(() => [
|
|
6492
|
+
Mo.renderSlot(i.$slots, "default", { modelValue: Mo.unref(l) })
|
|
6493
|
+
]),
|
|
6494
|
+
_: 3
|
|
6495
|
+
}, 8, ["as-child", "as", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-label", "data-state", "data-value", "data-max"]));
|
|
6496
|
+
}
|
|
6497
|
+
}), Iy = /* @__PURE__ */ Mo.defineComponent({
|
|
6498
|
+
__name: "ProgressIndicator",
|
|
6499
|
+
props: {
|
|
6500
|
+
asChild: { type: Boolean },
|
|
6501
|
+
as: {}
|
|
6502
|
+
},
|
|
6503
|
+
setup(a2) {
|
|
6504
|
+
const t = a2, e = Qc();
|
|
6505
|
+
return R(), (n, l) => {
|
|
6506
|
+
var s;
|
|
6507
|
+
return Mo.openBlock(), Mo.createBlock(Mo.unref(O), Mo.mergeProps(t, {
|
|
6508
|
+
"data-state": Mo.unref(e).progressState.value,
|
|
6509
|
+
"data-value": ((s = Mo.unref(e).modelValue) == null ? void 0 : s.value) ?? void 0,
|
|
6510
|
+
"data-max": Mo.unref(e).max.value
|
|
6511
|
+
}), {
|
|
6512
|
+
default: Mo.withCtx(() => [
|
|
6513
|
+
Mo.renderSlot(n.$slots, "default")
|
|
6514
|
+
]),
|
|
6515
|
+
_: 3
|
|
6516
|
+
}, 16, ["data-state", "data-value", "data-max"]);
|
|
6517
|
+
};
|
|
6518
|
+
}
|
|
6426
6519
|
});
|
|
6427
6520
|
const [He, Pf] = Q("ScrollAreaRoot"), Oy = /* @__PURE__ */ Mo.defineComponent({
|
|
6428
6521
|
__name: "ScrollAreaRoot",
|
|
@@ -9210,6 +9303,7 @@ const av = /* @__PURE__ */ Mo.defineComponent({
|
|
|
9210
9303
|
}
|
|
9211
9304
|
});
|
|
9212
9305
|
exports.At = At;
|
|
9306
|
+
exports.By = By;
|
|
9213
9307
|
exports.Cg = Cg;
|
|
9214
9308
|
exports.Ch = Ch;
|
|
9215
9309
|
exports.Du = Du;
|
|
@@ -9220,6 +9314,7 @@ exports.Gl = Gl;
|
|
|
9220
9314
|
exports.Gy = Gy;
|
|
9221
9315
|
exports.Hg = Hg;
|
|
9222
9316
|
exports.Hv = Hv;
|
|
9317
|
+
exports.Iy = Iy;
|
|
9223
9318
|
exports.Jv = Jv;
|
|
9224
9319
|
exports.Kg = Kg;
|
|
9225
9320
|
exports.Kv = Kv;
|
package/dist/cjs/index.js
CHANGED
|
@@ -46,6 +46,8 @@ const modal_vue_vue_type_script_setup_true_lang = require("./chunks/modal.js");
|
|
|
46
46
|
const popoverContent = require("./popover-content.js");
|
|
47
47
|
const popoverTrigger = require("./popover-trigger.js");
|
|
48
48
|
const popover_vue_vue_type_script_setup_true_lang = require("./chunks/popover.js");
|
|
49
|
+
const progressBar = require("./progress-bar.js");
|
|
50
|
+
const progressCircle = require("./progress-circle.js");
|
|
49
51
|
const richEditor = require("./rich-editor.js");
|
|
50
52
|
const scrollArea_vue_vue_type_script_setup_true_lang = require("./chunks/scroll-area.js");
|
|
51
53
|
const segmentedControlItem = require("./segmented-control-item.js");
|
|
@@ -121,6 +123,8 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
121
123
|
Popover: popover_vue_vue_type_script_setup_true_lang._sfc_main,
|
|
122
124
|
PopoverContent: popoverContent,
|
|
123
125
|
PopoverTrigger: popoverTrigger,
|
|
126
|
+
ProgressBar: progressBar,
|
|
127
|
+
ProgressCircle: progressCircle,
|
|
124
128
|
RichEditor: richEditor,
|
|
125
129
|
ScrollArea: scrollArea_vue_vue_type_script_setup_true_lang._sfc_main,
|
|
126
130
|
SegmentedControl: segmentedControl,
|
|
@@ -252,6 +256,8 @@ exports.Modal = modal_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
|
252
256
|
exports.PopoverContent = popoverContent;
|
|
253
257
|
exports.PopoverTrigger = popoverTrigger;
|
|
254
258
|
exports.Popover = popover_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
259
|
+
exports.ProgressBar = progressBar;
|
|
260
|
+
exports.ProgressCircle = progressCircle;
|
|
255
261
|
exports.RichEditor = richEditor;
|
|
256
262
|
exports.ScrollArea = scrollArea_vue_vue_type_script_setup_true_lang._sfc_main;
|
|
257
263
|
exports.SegmentedControlItem = segmentedControlItem;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const Mo = require("vue");
|
|
3
|
+
const useDelegatedProps = require("./use-delegated-props.js");
|
|
4
|
+
const clsx = require("./chunks/clsx.js");
|
|
5
|
+
const index = require("./chunks/index.js");
|
|
6
|
+
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
7
|
+
const _hoisted_1 = ["data-layout"];
|
|
8
|
+
const _hoisted_2 = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "celeste-progress-bar-label"
|
|
11
|
+
};
|
|
12
|
+
const _hoisted_3 = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "celeste-progress-bar-label-title"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_4 = { class: "celeste-progress-bar-label" };
|
|
17
|
+
const _hoisted_5 = {
|
|
18
|
+
key: 1,
|
|
19
|
+
class: "celeste-progress-bar-description"
|
|
20
|
+
};
|
|
21
|
+
const _sfc_main = /* @__PURE__ */ Mo.defineComponent({
|
|
22
|
+
__name: "progress-bar",
|
|
23
|
+
props: {
|
|
24
|
+
modelValue: { default: 0 },
|
|
25
|
+
max: { default: 100 },
|
|
26
|
+
getValueLabel: {},
|
|
27
|
+
asChild: { type: Boolean },
|
|
28
|
+
as: {},
|
|
29
|
+
class: {},
|
|
30
|
+
color: { default: "primary" },
|
|
31
|
+
title: {},
|
|
32
|
+
layout: { default: "bare" }
|
|
33
|
+
},
|
|
34
|
+
setup(__props) {
|
|
35
|
+
Mo.useCssVars((_ctx) => ({
|
|
36
|
+
"6ba22aeb": progressIndicator.value
|
|
37
|
+
}));
|
|
38
|
+
const props = __props;
|
|
39
|
+
const delegatedProps = useDelegatedProps.useDelegatedProps(props, "class");
|
|
40
|
+
const progress = Mo.computed(() => {
|
|
41
|
+
if (props.max === 0)
|
|
42
|
+
return 0;
|
|
43
|
+
const value = Math.min(Math.max(props.modelValue ?? 0, 0), props.max);
|
|
44
|
+
return Math.round(value / props.max * 100);
|
|
45
|
+
});
|
|
46
|
+
const progressIndicator = Mo.computed(() => {
|
|
47
|
+
return 100 - (props.modelValue ?? 0) / props.max * 100;
|
|
48
|
+
});
|
|
49
|
+
return (_ctx, _cache) => {
|
|
50
|
+
return Mo.openBlock(), Mo.createElementBlock("div", {
|
|
51
|
+
class: "celeste-progress-bar-wrapper",
|
|
52
|
+
"data-layout": _ctx.layout
|
|
53
|
+
}, [
|
|
54
|
+
_ctx.layout !== "bare" ? (Mo.openBlock(), Mo.createElementBlock("div", _hoisted_2, [
|
|
55
|
+
props.title && _ctx.layout !== "inline" ? (Mo.openBlock(), Mo.createElementBlock("span", _hoisted_3, Mo.toDisplayString(_ctx.title), 1)) : Mo.createCommentVNode("", true),
|
|
56
|
+
Mo.createElementVNode("span", _hoisted_4, [
|
|
57
|
+
Mo.renderSlot(_ctx.$slots, "label", {}, () => [
|
|
58
|
+
Mo.createTextVNode(Mo.toDisplayString(progress.value) + "% ", 1)
|
|
59
|
+
], true)
|
|
60
|
+
])
|
|
61
|
+
])) : Mo.createCommentVNode("", true),
|
|
62
|
+
Mo.createVNode(Mo.unref(index.By), Mo.mergeProps(Mo.unref(delegatedProps), {
|
|
63
|
+
class: Mo.unref(clsx.clsx)(
|
|
64
|
+
"celeste-progress-bar",
|
|
65
|
+
props.class
|
|
66
|
+
)
|
|
67
|
+
}), {
|
|
68
|
+
default: Mo.withCtx(() => [
|
|
69
|
+
Mo.createVNode(Mo.unref(index.Iy), {
|
|
70
|
+
class: "celeste-progress-bar-indicator",
|
|
71
|
+
"data-color": _ctx.color
|
|
72
|
+
}, null, 8, ["data-color"])
|
|
73
|
+
]),
|
|
74
|
+
_: 1
|
|
75
|
+
}, 16, ["class"]),
|
|
76
|
+
_ctx.$slots.description && _ctx.layout === "default" ? (Mo.openBlock(), Mo.createElementBlock("div", _hoisted_5, [
|
|
77
|
+
Mo.renderSlot(_ctx.$slots, "description", {}, void 0, true)
|
|
78
|
+
])) : Mo.createCommentVNode("", true)
|
|
79
|
+
], 8, _hoisted_1);
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
const progressBar = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-850aadb2"]]);
|
|
84
|
+
module.exports = progressBar;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const Mo = require("vue");
|
|
3
|
+
const useDelegatedProps = require("./use-delegated-props.js");
|
|
4
|
+
const clsx = require("./chunks/clsx.js");
|
|
5
|
+
const index = require("./chunks/index.js");
|
|
6
|
+
const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
|
|
7
|
+
const _hoisted_1 = ["width", "height"];
|
|
8
|
+
const _hoisted_2 = ["cx", "cy", "r"];
|
|
9
|
+
const _hoisted_3 = ["cx", "cy", "r", "stroke-dasharray", "stroke-dashoffset"];
|
|
10
|
+
const _hoisted_4 = {
|
|
11
|
+
key: 0,
|
|
12
|
+
class: "celeste-progress-circle-label"
|
|
13
|
+
};
|
|
14
|
+
const STROKE_WIDTH = 6.4;
|
|
15
|
+
const _sfc_main = /* @__PURE__ */ Mo.defineComponent({
|
|
16
|
+
__name: "progress-circle",
|
|
17
|
+
props: {
|
|
18
|
+
modelValue: { default: 0 },
|
|
19
|
+
max: { default: 100 },
|
|
20
|
+
getValueLabel: {},
|
|
21
|
+
asChild: { type: Boolean },
|
|
22
|
+
as: {},
|
|
23
|
+
class: {},
|
|
24
|
+
size: { default: 80 }
|
|
25
|
+
},
|
|
26
|
+
setup(__props) {
|
|
27
|
+
Mo.useCssVars((_ctx) => ({
|
|
28
|
+
"433ff7ca": circleSize.value
|
|
29
|
+
}));
|
|
30
|
+
const props = __props;
|
|
31
|
+
const delegatedProps = useDelegatedProps.useDelegatedProps(props, "class");
|
|
32
|
+
const radius = Mo.computed(() => (props.size - STROKE_WIDTH) / 2);
|
|
33
|
+
const circumference = Mo.computed(() => 2 * Math.PI * radius.value);
|
|
34
|
+
const progress = Mo.computed(() => {
|
|
35
|
+
if (props.max === 0)
|
|
36
|
+
return 0;
|
|
37
|
+
const value = Math.min(Math.max(props.modelValue ?? 0, 0), props.max);
|
|
38
|
+
return Math.round(value / props.max * 100);
|
|
39
|
+
});
|
|
40
|
+
const offset = Mo.computed(() => {
|
|
41
|
+
return circumference.value * (1 - progress.value / 100);
|
|
42
|
+
});
|
|
43
|
+
const circleSize = Mo.computed(() => `${props.size}px`);
|
|
44
|
+
return (_ctx, _cache) => {
|
|
45
|
+
return Mo.openBlock(), Mo.createBlock(Mo.unref(index.By), Mo.mergeProps(Mo.unref(delegatedProps), {
|
|
46
|
+
value: props.modelValue,
|
|
47
|
+
class: Mo.unref(clsx.clsx)("celeste-progress-circle", props.class),
|
|
48
|
+
as: "div"
|
|
49
|
+
}), {
|
|
50
|
+
default: Mo.withCtx(() => [
|
|
51
|
+
Mo.createVNode(Mo.unref(index.Iy), { "as-child": "" }, {
|
|
52
|
+
default: Mo.withCtx(() => [
|
|
53
|
+
(Mo.openBlock(), Mo.createElementBlock("svg", {
|
|
54
|
+
class: "celeste-progress-circle-svg",
|
|
55
|
+
width: props.size,
|
|
56
|
+
height: props.size
|
|
57
|
+
}, [
|
|
58
|
+
Mo.createElementVNode("circle", {
|
|
59
|
+
class: "celeste-progress-circle-track",
|
|
60
|
+
cx: props.size / 2,
|
|
61
|
+
cy: props.size / 2,
|
|
62
|
+
r: radius.value,
|
|
63
|
+
"stroke-width": STROKE_WIDTH,
|
|
64
|
+
fill: "transparent"
|
|
65
|
+
}, null, 8, _hoisted_2),
|
|
66
|
+
Mo.createElementVNode("circle", {
|
|
67
|
+
class: "celeste-progress-circle-indicator",
|
|
68
|
+
cx: props.size / 2,
|
|
69
|
+
cy: props.size / 2,
|
|
70
|
+
r: radius.value,
|
|
71
|
+
"stroke-width": STROKE_WIDTH,
|
|
72
|
+
fill: "transparent",
|
|
73
|
+
"stroke-dasharray": circumference.value,
|
|
74
|
+
"stroke-dashoffset": offset.value
|
|
75
|
+
}, null, 8, _hoisted_3)
|
|
76
|
+
], 8, _hoisted_1))
|
|
77
|
+
]),
|
|
78
|
+
_: 1
|
|
79
|
+
}),
|
|
80
|
+
props.size !== 48 ? (Mo.openBlock(), Mo.createElementBlock("div", _hoisted_4, [
|
|
81
|
+
Mo.renderSlot(_ctx.$slots, "default", {}, () => [
|
|
82
|
+
Mo.createTextVNode(Mo.toDisplayString(progress.value) + "% ", 1)
|
|
83
|
+
], true)
|
|
84
|
+
])) : Mo.createCommentVNode("", true)
|
|
85
|
+
]),
|
|
86
|
+
_: 3
|
|
87
|
+
}, 16, ["value", "class"]);
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
const progressCircle = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["__scopeId", "data-v-f8ba36bb"]]);
|
|
92
|
+
module.exports = progressCircle;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ProgressRootProps } from 'radix-vue';
|
|
2
|
+
import { HTMLAttributes } from 'vue';
|
|
3
|
+
type __VLS_Props = ProgressRootProps & {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
5
|
+
color?: 'blue' | 'red' | 'orange' | 'green' | 'primary';
|
|
6
|
+
title?: string;
|
|
7
|
+
layout?: 'default' | 'no-description' | 'inline' | 'bare';
|
|
8
|
+
};
|
|
9
|
+
declare function __VLS_template(): {
|
|
10
|
+
attrs: Partial<{}>;
|
|
11
|
+
slots: {
|
|
12
|
+
label?(_: {}): any;
|
|
13
|
+
description?(_: {}): any;
|
|
14
|
+
};
|
|
15
|
+
refs: {};
|
|
16
|
+
rootEl: HTMLDivElement;
|
|
17
|
+
};
|
|
18
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
19
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
20
|
+
color: "blue" | "red" | "orange" | "green" | "primary";
|
|
21
|
+
modelValue: number | null;
|
|
22
|
+
max: number;
|
|
23
|
+
layout: "default" | "no-description" | "inline" | "bare";
|
|
24
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
25
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
28
|
+
new (): {
|
|
29
|
+
$slots: S;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'vue';
|
|
2
|
+
import { ProgressRootProps } from 'radix-vue';
|
|
3
|
+
type __VLS_Props = ProgressRootProps & {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
5
|
+
size?: 80 | 72 | 64 | 56 | 48;
|
|
6
|
+
};
|
|
7
|
+
declare function __VLS_template(): {
|
|
8
|
+
attrs: Partial<{}>;
|
|
9
|
+
slots: {
|
|
10
|
+
default?(_: {}): any;
|
|
11
|
+
};
|
|
12
|
+
refs: {};
|
|
13
|
+
rootEl: any;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
16
|
+
declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
17
|
+
size: 80 | 72 | 64 | 56 | 48;
|
|
18
|
+
modelValue: number | null;
|
|
19
|
+
max: number;
|
|
20
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
package/dist/es/chunks/index.js
CHANGED
|
@@ -6406,6 +6406,99 @@ const [Nt, Xc] = Q("PopoverRoot"), ys = /* @__PURE__ */ defineComponent({
|
|
|
6406
6406
|
_: 3
|
|
6407
6407
|
}, 8, ["type", "as", "as-child"]));
|
|
6408
6408
|
}
|
|
6409
|
+
}), da = 100, [Qc, ef] = Q("ProgressRoot"), Po = (a2) => typeof a2 == "number";
|
|
6410
|
+
function tf(a2, t) {
|
|
6411
|
+
return vt(a2) || Po(a2) && !Number.isNaN(a2) && a2 <= t && a2 >= 0 ? a2 : (console.error(`Invalid prop \`value\` of value \`${a2}\` supplied to \`ProgressRoot\`. The \`value\` prop must be:
|
|
6412
|
+
- a positive number
|
|
6413
|
+
- less than the value passed to \`max\` (or ${da} if no \`max\` prop is set)
|
|
6414
|
+
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
6415
|
+
|
|
6416
|
+
Defaulting to \`null\`.`), null);
|
|
6417
|
+
}
|
|
6418
|
+
function af(a2) {
|
|
6419
|
+
return Po(a2) && !Number.isNaN(a2) && a2 > 0 ? a2 : (console.error(
|
|
6420
|
+
`Invalid prop \`max\` of value \`${a2}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${da}\`.`
|
|
6421
|
+
), da);
|
|
6422
|
+
}
|
|
6423
|
+
const By = /* @__PURE__ */ defineComponent({
|
|
6424
|
+
__name: "ProgressRoot",
|
|
6425
|
+
props: {
|
|
6426
|
+
modelValue: {},
|
|
6427
|
+
max: { default: da },
|
|
6428
|
+
getValueLabel: { type: Function, default: (a2, t) => `${Math.round(a2 / t * da)}%` },
|
|
6429
|
+
asChild: { type: Boolean },
|
|
6430
|
+
as: {}
|
|
6431
|
+
},
|
|
6432
|
+
emits: ["update:modelValue", "update:max"],
|
|
6433
|
+
setup(a2, { emit: t }) {
|
|
6434
|
+
const e = a2, n = t;
|
|
6435
|
+
R();
|
|
6436
|
+
const l = ne(e, "modelValue", n, {
|
|
6437
|
+
passive: e.modelValue === void 0
|
|
6438
|
+
}), s = ne(e, "max", n, {
|
|
6439
|
+
passive: e.max === void 0
|
|
6440
|
+
});
|
|
6441
|
+
watch(
|
|
6442
|
+
() => l.value,
|
|
6443
|
+
async (i) => {
|
|
6444
|
+
const u = tf(i, e.max);
|
|
6445
|
+
u !== i && (await nextTick(), l.value = u);
|
|
6446
|
+
},
|
|
6447
|
+
{ immediate: true }
|
|
6448
|
+
), watch(
|
|
6449
|
+
() => e.max,
|
|
6450
|
+
(i) => {
|
|
6451
|
+
const u = af(e.max);
|
|
6452
|
+
u !== i && (s.value = u);
|
|
6453
|
+
},
|
|
6454
|
+
{ immediate: true }
|
|
6455
|
+
);
|
|
6456
|
+
const r = computed(() => vt(l.value) ? "indeterminate" : l.value === s.value ? "complete" : "loading");
|
|
6457
|
+
return ef({
|
|
6458
|
+
modelValue: l,
|
|
6459
|
+
max: s,
|
|
6460
|
+
progressState: r
|
|
6461
|
+
}), (i, u) => (openBlock(), createBlock(unref(O), {
|
|
6462
|
+
"as-child": i.asChild,
|
|
6463
|
+
as: i.as,
|
|
6464
|
+
"aria-valuemax": unref(s),
|
|
6465
|
+
"aria-valuemin": 0,
|
|
6466
|
+
"aria-valuenow": Po(unref(l)) ? unref(l) : void 0,
|
|
6467
|
+
"aria-valuetext": i.getValueLabel(unref(l), unref(s)),
|
|
6468
|
+
"aria-label": i.getValueLabel(unref(l), unref(s)),
|
|
6469
|
+
role: "progressbar",
|
|
6470
|
+
"data-state": r.value,
|
|
6471
|
+
"data-value": unref(l) ?? void 0,
|
|
6472
|
+
"data-max": unref(s)
|
|
6473
|
+
}, {
|
|
6474
|
+
default: withCtx(() => [
|
|
6475
|
+
renderSlot(i.$slots, "default", { modelValue: unref(l) })
|
|
6476
|
+
]),
|
|
6477
|
+
_: 3
|
|
6478
|
+
}, 8, ["as-child", "as", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-label", "data-state", "data-value", "data-max"]));
|
|
6479
|
+
}
|
|
6480
|
+
}), Iy = /* @__PURE__ */ defineComponent({
|
|
6481
|
+
__name: "ProgressIndicator",
|
|
6482
|
+
props: {
|
|
6483
|
+
asChild: { type: Boolean },
|
|
6484
|
+
as: {}
|
|
6485
|
+
},
|
|
6486
|
+
setup(a2) {
|
|
6487
|
+
const t = a2, e = Qc();
|
|
6488
|
+
return R(), (n, l) => {
|
|
6489
|
+
var s;
|
|
6490
|
+
return openBlock(), createBlock(unref(O), mergeProps(t, {
|
|
6491
|
+
"data-state": unref(e).progressState.value,
|
|
6492
|
+
"data-value": ((s = unref(e).modelValue) == null ? void 0 : s.value) ?? void 0,
|
|
6493
|
+
"data-max": unref(e).max.value
|
|
6494
|
+
}), {
|
|
6495
|
+
default: withCtx(() => [
|
|
6496
|
+
renderSlot(n.$slots, "default")
|
|
6497
|
+
]),
|
|
6498
|
+
_: 3
|
|
6499
|
+
}, 16, ["data-state", "data-value", "data-max"]);
|
|
6500
|
+
};
|
|
6501
|
+
}
|
|
6409
6502
|
});
|
|
6410
6503
|
const [He, Pf] = Q("ScrollAreaRoot"), Oy = /* @__PURE__ */ defineComponent({
|
|
6411
6504
|
__name: "ScrollAreaRoot",
|
|
@@ -9232,6 +9325,7 @@ export {
|
|
|
9232
9325
|
ph as a7,
|
|
9233
9326
|
rh as a8,
|
|
9234
9327
|
sh as a9,
|
|
9328
|
+
Wg as aA,
|
|
9235
9329
|
Dv as aa,
|
|
9236
9330
|
Eu as ab,
|
|
9237
9331
|
xu as ac,
|
|
@@ -9242,21 +9336,22 @@ export {
|
|
|
9242
9336
|
_s as ah,
|
|
9243
9337
|
xs as ai,
|
|
9244
9338
|
gs as aj,
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9339
|
+
By as ak,
|
|
9340
|
+
Iy as al,
|
|
9341
|
+
zy as am,
|
|
9342
|
+
Ky as an,
|
|
9343
|
+
Xy as ao,
|
|
9344
|
+
jy as ap,
|
|
9345
|
+
Yy as aq,
|
|
9346
|
+
Uy as ar,
|
|
9347
|
+
Ly as as,
|
|
9348
|
+
eg as at,
|
|
9349
|
+
Qy as au,
|
|
9350
|
+
Lg as av,
|
|
9351
|
+
zg as aw,
|
|
9352
|
+
Kg as ax,
|
|
9353
|
+
jg as ay,
|
|
9354
|
+
Hg as az,
|
|
9260
9355
|
bh as b,
|
|
9261
9356
|
tg as c,
|
|
9262
9357
|
ag as d,
|
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";
|
|
@@ -119,6 +121,8 @@ const components = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
119
121
|
Popover: _sfc_main$a,
|
|
120
122
|
PopoverContent,
|
|
121
123
|
PopoverTrigger,
|
|
124
|
+
ProgressBar: progressBar,
|
|
125
|
+
ProgressCircle: progressCircle,
|
|
122
126
|
RichEditor: richEditor,
|
|
123
127
|
ScrollArea: _sfc_main$b,
|
|
124
128
|
SegmentedControl: segmentedControl,
|
|
@@ -253,6 +257,8 @@ export {
|
|
|
253
257
|
_sfc_main$a as Popover,
|
|
254
258
|
PopoverContent,
|
|
255
259
|
PopoverTrigger,
|
|
260
|
+
progressBar as ProgressBar,
|
|
261
|
+
progressCircle as ProgressCircle,
|
|
256
262
|
richEditor as RichEditor,
|
|
257
263
|
_sfc_main$b as ScrollArea,
|
|
258
264
|
segmentedControl as SegmentedControl,
|