@ulu/frontend-vue 0.4.1 → 0.5.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.
@@ -5,14 +5,15 @@ type __VLS_WithTemplateSlots<T, S> = T & (new () => {
5
5
  });
6
6
  declare const __VLS_component: import('vue').DefineComponent<{}, {
7
7
  classes: Record<string, any>;
8
+ danger: boolean;
8
9
  small: boolean;
9
10
  labelHidden: boolean;
11
+ warning: boolean;
10
12
  amount: number;
11
13
  labelElement: string;
12
14
  total: number;
13
15
  deficit: number;
14
- positive: boolean;
15
- negative: boolean;
16
+ success: boolean;
16
17
  loader: boolean;
17
18
  rounded: boolean;
18
19
  indeterminate: boolean;
@@ -23,14 +24,15 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
23
24
  formatValue?: Function | undefined;
24
25
  $props: {
25
26
  readonly classes?: Record<string, any> | undefined;
27
+ readonly danger?: boolean | undefined;
26
28
  readonly small?: boolean | undefined;
27
29
  readonly labelHidden?: boolean | undefined;
30
+ readonly warning?: boolean | undefined;
28
31
  readonly amount?: number | undefined;
29
32
  readonly labelElement?: string | undefined;
30
33
  readonly total?: number | undefined;
31
34
  readonly deficit?: number | undefined;
32
- readonly positive?: boolean | undefined;
33
- readonly negative?: boolean | undefined;
35
+ readonly success?: boolean | undefined;
34
36
  readonly loader?: boolean | undefined;
35
37
  readonly rounded?: boolean | undefined;
36
38
  readonly indeterminate?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"UluProgressBar.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/visualizations/UluProgressBar.vue"],"names":[],"mappings":"AA4DA;wBA4cqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sPAQG"}
1
+ {"version":3,"file":"UluProgressBar.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/visualizations/UluProgressBar.vue"],"names":[],"mappings":"AA4DA;wBAsdqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAXjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sPAQG"}
@@ -1,21 +1,21 @@
1
- import { computed as m, createElementBlock as n, openBlock as s, normalizeClass as v, unref as B, createCommentVNode as r, createElementVNode as o, createBlock as h, resolveDynamicComponent as k, withCtx as V, renderSlot as i, createTextVNode as d, toDisplayString as u, normalizeStyle as b } from "vue";
1
+ import { computed as m, createElementBlock as o, openBlock as s, normalizeClass as b, unref as B, createCommentVNode as r, createElementVNode as n, createBlock as h, resolveDynamicComponent as k, withCtx as V, renderSlot as i, createTextVNode as d, toDisplayString as u, normalizeStyle as v } from "vue";
2
2
  import { useModifiers as $ } from "../../composables/useModifiers.js";
3
- const C = {
3
+ const w = {
4
4
  key: 0,
5
5
  class: "progress-bar__header"
6
- }, H = {
6
+ }, C = {
7
7
  key: 1,
8
8
  class: "progress-bar__value progress-bar__value--amount"
9
- }, N = {
9
+ }, H = {
10
10
  key: 2,
11
11
  class: "progress-bar__icon"
12
- }, S = { class: "progress-bar__track" }, A = {
12
+ }, N = { class: "progress-bar__track" }, S = {
13
13
  key: 1,
14
14
  class: "progress-bar__values"
15
- }, D = { class: "progress-bar__value progress-bar__value--amount" }, E = {
15
+ }, A = { class: "progress-bar__value progress-bar__value--amount" }, D = {
16
16
  key: 0,
17
17
  class: "progress-bar__value progress-bar__value--deficit"
18
- }, I = { class: "progress-bar__value progress-bar__value--total" }, M = {
18
+ }, E = { class: "progress-bar__value progress-bar__value--total" }, M = {
19
19
  __name: "UluProgressBar",
20
20
  props: {
21
21
  /**
@@ -66,13 +66,17 @@ const C = {
66
66
  */
67
67
  small: Boolean,
68
68
  /**
69
- * Applies the 'positive' style (e.g., green).
69
+ * Applies the 'success' style.
70
+ */
71
+ success: Boolean,
72
+ /**
73
+ * Applies the 'warning' style.
70
74
  */
71
- positive: Boolean,
75
+ warning: Boolean,
72
76
  /**
73
- * Applies the 'negative' style (e.g., red).
77
+ * Applies the 'danger' style.
74
78
  */
75
- negative: Boolean,
79
+ danger: Boolean,
76
80
  /**
77
81
  * Applies styles for use as a thin loader.
78
82
  */
@@ -107,28 +111,29 @@ const C = {
107
111
  modifiers: [String, Array]
108
112
  },
109
113
  setup(e) {
110
- const a = e, c = (t, l) => `${l === 0 ? 0 : t / l * 100}%`, f = m(() => a.indeterminate ? null : c(a.amount, a.total)), g = m(() => c(a.deficit, a.total)), { resolvedModifiers: y } = $({
114
+ const a = e, c = (t, l) => `${l === 0 ? 0 : t / l * 100}%`, g = m(() => a.indeterminate ? null : c(a.amount, a.total)), f = m(() => c(a.deficit, a.total)), { resolvedModifiers: y } = $({
111
115
  props: a,
112
116
  baseClass: "progress-bar",
113
117
  internal: m(() => ({
114
118
  small: a.small,
115
- positive: a.positive,
116
- negative: a.negative,
119
+ success: a.success,
120
+ warning: a.warning,
121
+ danger: a.danger,
117
122
  loader: a.loader,
118
123
  rounded: a.rounded,
119
124
  indeterminate: a.indeterminate
120
125
  }))
121
126
  });
122
- return (t, l) => (s(), n("div", {
123
- class: v(["progress-bar", [
127
+ return (t, l) => (s(), o("div", {
128
+ class: b(["progress-bar", [
124
129
  B(y),
125
130
  { "type-small": e.small }
126
131
  ]])
127
132
  }, [
128
- e.label || t.$slots.label || t.$slots.icon || e.amountInHeader ? (s(), n("div", C, [
133
+ e.label || t.$slots.label || t.$slots.icon || e.amountInHeader ? (s(), o("div", w, [
129
134
  e.label ? (s(), h(k(e.labelElement), {
130
135
  key: 0,
131
- class: v(["progress-bar__label", [e.classes.label, { "hidden-visually": e.labelHidden }]])
136
+ class: b(["progress-bar__label", [e.classes.label, { "hidden-visually": e.labelHidden }]])
132
137
  }, {
133
138
  default: V(() => [
134
139
  i(t.$slots, "label", {}, () => [
@@ -137,42 +142,42 @@ const C = {
137
142
  ]),
138
143
  _: 3
139
144
  }, 8, ["class"])) : r("", !0),
140
- e.amountInHeader ? (s(), n("div", H, [
141
- l[0] || (l[0] = o("strong", { class: "hidden-visually" }, "Amount:", -1)),
145
+ e.amountInHeader ? (s(), o("div", C, [
146
+ l[0] || (l[0] = n("strong", { class: "hidden-visually" }, "Amount:", -1)),
142
147
  i(t.$slots, "valueAmount", { value: e.amount }, () => [
143
148
  d(u(e.formatValue(e.amount, "amount")), 1)
144
149
  ])
145
150
  ])) : r("", !0),
146
- t.$slots.icon ? (s(), n("div", N, [
151
+ t.$slots.icon ? (s(), o("div", H, [
147
152
  i(t.$slots, "icon")
148
153
  ])) : r("", !0)
149
154
  ])) : r("", !0),
150
- o("div", S, [
151
- o("div", {
155
+ n("div", N, [
156
+ n("div", {
152
157
  class: "progress-bar__bar",
153
- style: b({ width: f.value })
158
+ style: v({ width: g.value })
154
159
  }, null, 4),
155
- e.deficit > 0 ? (s(), n("div", {
160
+ e.deficit > 0 ? (s(), o("div", {
156
161
  key: 0,
157
162
  class: "progress-bar__bar--deficit",
158
- style: b({ width: g.value })
163
+ style: v({ width: f.value })
159
164
  }, null, 4)) : r("", !0)
160
165
  ]),
161
- !e.noValues && !e.amountInHeader && !e.loader && !e.indeterminate ? (s(), n("div", A, [
162
- o("div", D, [
163
- l[1] || (l[1] = o("strong", { class: "hidden-visually" }, "Amount:", -1)),
166
+ !e.noValues && !e.amountInHeader && !e.loader && !e.indeterminate ? (s(), o("div", S, [
167
+ n("div", A, [
168
+ l[1] || (l[1] = n("strong", { class: "hidden-visually" }, "Amount:", -1)),
164
169
  i(t.$slots, "valueAmount", { value: e.amount }, () => [
165
170
  d(u(e.formatValue(e.amount, "amount")), 1)
166
171
  ])
167
172
  ]),
168
- e.deficit > 0 ? (s(), n("div", E, [
169
- l[2] || (l[2] = o("strong", { class: "hidden-visually" }, "Deficit: ", -1)),
173
+ e.deficit > 0 ? (s(), o("div", D, [
174
+ l[2] || (l[2] = n("strong", { class: "hidden-visually" }, "Deficit: ", -1)),
170
175
  i(t.$slots, "valueDeficit", { value: e.deficit }, () => [
171
176
  d("-" + u(e.formatValue(e.deficit, "deficit")), 1)
172
177
  ])
173
178
  ])) : r("", !0),
174
- o("div", I, [
175
- l[3] || (l[3] = o("strong", { class: "hidden-visually" }, "Total:", -1)),
179
+ n("div", E, [
180
+ l[3] || (l[3] = n("strong", { class: "hidden-visually" }, "Total:", -1)),
176
181
  i(t.$slots, "valueTotal", { value: e.total }, () => [
177
182
  d(u(e.formatValue(e.total, "total")), 1)
178
183
  ])
@@ -6,29 +6,35 @@ type __VLS_WithTemplateSlots<T, S> = T & (new () => {
6
6
  declare const __VLS_component: import('vue').DefineComponent<{}, {
7
7
  duration: number;
8
8
  easing: string;
9
+ danger: boolean;
9
10
  small: boolean;
10
11
  label: string;
12
+ warning: boolean;
13
+ success: boolean;
11
14
  formatValue: Function;
12
15
  percentage: number;
13
16
  noValue: boolean;
14
17
  outside: boolean;
15
18
  outsideBelow: boolean;
16
- status: string;
17
19
  pieStyle: boolean;
18
20
  noMask: boolean;
21
+ modifiers?: string | unknown[] | undefined;
19
22
  $props: {
20
23
  readonly duration?: number | undefined;
21
24
  readonly easing?: string | undefined;
25
+ readonly danger?: boolean | undefined;
22
26
  readonly small?: boolean | undefined;
23
27
  readonly label?: string | undefined;
28
+ readonly warning?: boolean | undefined;
29
+ readonly success?: boolean | undefined;
24
30
  readonly formatValue?: Function | undefined;
25
31
  readonly percentage?: number | undefined;
26
32
  readonly noValue?: boolean | undefined;
27
33
  readonly outside?: boolean | undefined;
28
34
  readonly outsideBelow?: boolean | undefined;
29
- readonly status?: string | undefined;
30
35
  readonly pieStyle?: boolean | undefined;
31
36
  readonly noMask?: boolean | undefined;
37
+ readonly modifiers?: string | unknown[] | undefined;
32
38
  };
33
39
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
34
40
  pie: SVGCircleElement;
@@ -1 +1 @@
1
- {"version":3,"file":"UluProgressCircle.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/visualizations/UluProgressCircle.vue"],"names":[],"mappings":"AAkCA;wBAqYqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAZjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBASG"}
1
+ {"version":3,"file":"UluProgressCircle.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/visualizations/UluProgressCircle.vue"],"names":[],"mappings":"AAkCA;wBA0ZqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAZjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBASG"}
@@ -1,14 +1,15 @@
1
- import { ref as h, watch as k, computed as i, onMounted as B, createElementBlock as o, openBlock as c, normalizeClass as V, createElementVNode as a, createCommentVNode as p, toDisplayString as u, normalizeStyle as w, renderSlot as y, createTextVNode as f } from "vue";
2
- const S = { class: "hidden-visually" }, _ = { class: "progress-circle__chart" }, x = {
1
+ import { ref as B, watch as h, computed as i, onMounted as k, createElementBlock as o, openBlock as n, normalizeClass as w, unref as V, createElementVNode as l, createCommentVNode as f, toDisplayString as u, normalizeStyle as S, renderSlot as y, createTextVNode as v } from "vue";
2
+ import { useModifiers as _ } from "../../composables/useModifiers.js";
3
+ const b = { class: "hidden-visually" }, x = { class: "progress-circle__chart" }, M = {
3
4
  class: "progress-circle__chart-svg",
4
5
  viewBox: "0 0 32 32"
5
- }, $ = {
6
+ }, N = {
6
7
  key: 0,
7
8
  class: "progress-circle__chart-value"
8
- }, b = {
9
+ }, $ = {
9
10
  key: 0,
10
11
  class: "progress-circle__value type-small-x"
11
- }, C = {
12
+ }, z = {
12
13
  __name: "UluProgressCircle",
13
14
  props: {
14
15
  /**
@@ -31,7 +32,7 @@ const S = { class: "hidden-visually" }, _ = { class: "progress-circle__chart" },
31
32
  */
32
33
  formatValue: {
33
34
  type: Function,
34
- default: (s) => `${s}%`
35
+ default: (a) => `${a}%`
35
36
  },
36
37
  /**
37
38
  * Hides the percentage value display.
@@ -50,12 +51,17 @@ const S = { class: "hidden-visually" }, _ = { class: "progress-circle__chart" },
50
51
  */
51
52
  outsideBelow: Boolean,
52
53
  /**
53
- * Sets the status color of the progress circle (e.g., 'low', 'incomplete', 'complete').
54
+ * Applies the 'danger' style.
54
55
  */
55
- status: {
56
- type: String,
57
- default: ""
58
- },
56
+ danger: Boolean,
57
+ /**
58
+ * Applies the 'warning' style.
59
+ */
60
+ warning: Boolean,
61
+ /**
62
+ * Applies the 'success' style.
63
+ */
64
+ success: Boolean,
59
65
  /**
60
66
  * Renders the component as a solid pie chart instead of a donut.
61
67
  */
@@ -79,71 +85,78 @@ const S = { class: "hidden-visually" }, _ = { class: "progress-circle__chart" },
79
85
  type: String,
80
86
  default: "ease-in"
81
87
  // Matches SCSS animation-timing
82
- }
88
+ },
89
+ /**
90
+ * Modifiers (to add any modifier classes based on base class)
91
+ */
92
+ modifiers: [String, Array]
83
93
  },
84
- setup(s) {
85
- const e = s, l = h(null), d = (r) => r === 100 ? 101 : r, g = (r = 0) => {
86
- if (!l.value || !l.value.animate) return;
87
- const t = { strokeDasharray: [`${r} 100`, m.value] };
88
- l.value.animate(t, { duration: e.duration, easing: e.easing, fill: "forwards" });
94
+ setup(a) {
95
+ const e = a, t = B(null), d = (s) => s === 100 ? 101 : s, g = (s = 0) => {
96
+ if (!t.value || !t.value.animate) return;
97
+ const r = { strokeDasharray: [`${s} 100`, m.value] };
98
+ t.value.animate(r, { duration: e.duration, easing: e.easing, fill: "forwards" });
89
99
  };
90
- k(() => e.percentage, (r, t) => {
91
- r !== t && g(d(t));
100
+ h(() => e.percentage, (s, r) => {
101
+ s !== r && g(d(r));
92
102
  });
93
- const m = i(() => `${d(e.percentage)} 100`), n = i(() => e.outside || e.outsideBelow || e.small), v = i(() => {
94
- const r = {
95
- "progress-circle": !0,
96
- "progress-circle--small": e.small,
97
- "progress-circle--pie": e.pieStyle,
98
- "progress-circle--outside": n.value,
99
- "progress-circle--outside-below": e.outsideBelow,
100
- "progress-circle--no-mask": e.noMask
101
- };
102
- return e.status && (r[`progress-circle--${e.status}`] = !0), r;
103
+ const m = i(() => `${d(e.percentage)} 100`), c = i(() => e.outside || e.outsideBelow || e.small), { resolvedModifiers: p } = _({
104
+ props: e,
105
+ baseClass: "progress-circle",
106
+ internal: i(() => ({
107
+ small: e.small,
108
+ pie: e.pieStyle,
109
+ outside: c.value,
110
+ "outside-below": e.outsideBelow,
111
+ "no-mask": e.noMask,
112
+ danger: e.danger,
113
+ warning: e.warning,
114
+ success: e.success
115
+ }))
103
116
  });
104
- return B(() => {
117
+ return k(() => {
105
118
  g();
106
- }), (r, t) => (c(), o("div", {
107
- class: V(v.value)
119
+ }), (s, r) => (n(), o("div", {
120
+ class: w(["progress-circle", V(p)])
108
121
  }, [
109
- a("strong", S, u(s.label), 1),
110
- a("div", _, [
111
- (c(), o("svg", x, [
112
- t[0] || (t[0] = a("circle", {
122
+ l("strong", b, u(a.label), 1),
123
+ l("div", x, [
124
+ (n(), o("svg", M, [
125
+ r[0] || (r[0] = l("circle", {
113
126
  class: "progress-circle__chart-track",
114
127
  r: "16",
115
128
  cx: "16",
116
129
  cy: "16"
117
130
  }, null, -1)),
118
- a("circle", {
131
+ l("circle", {
119
132
  class: "progress-circle__chart-pie",
120
133
  ref_key: "pie",
121
- ref: l,
134
+ ref: t,
122
135
  r: "16",
123
136
  cx: "16",
124
137
  cy: "16",
125
- style: w({ strokeDasharray: m.value })
138
+ style: S({ strokeDasharray: m.value })
126
139
  }, null, 4),
127
- t[1] || (t[1] = a("circle", {
140
+ r[1] || (r[1] = l("circle", {
128
141
  class: "progress-circle__chart-mask",
129
142
  cx: "16",
130
143
  cy: "16"
131
144
  }, null, -1))
132
145
  ])),
133
- !n.value && !s.noValue ? (c(), o("strong", $, [
134
- y(r.$slots, "value", { value: s.percentage }, () => [
135
- f(u(s.formatValue(s.percentage)), 1)
146
+ !c.value && !a.noValue ? (n(), o("strong", N, [
147
+ y(s.$slots, "value", { value: a.percentage }, () => [
148
+ v(u(a.formatValue(a.percentage)), 1)
136
149
  ])
137
- ])) : p("", !0)
150
+ ])) : f("", !0)
138
151
  ]),
139
- n.value && !s.noValue ? (c(), o("strong", b, [
140
- y(r.$slots, "value", { value: s.percentage }, () => [
141
- f(u(s.formatValue(s.percentage)), 1)
152
+ c.value && !a.noValue ? (n(), o("strong", $, [
153
+ y(s.$slots, "value", { value: a.percentage }, () => [
154
+ v(u(a.formatValue(a.percentage)), 1)
142
155
  ])
143
- ])) : p("", !0)
156
+ ])) : f("", !0)
144
157
  ], 2));
145
158
  }
146
159
  };
147
160
  export {
148
- C as default
161
+ z as default
149
162
  };
@@ -116,13 +116,17 @@
116
116
  */
117
117
  small: Boolean,
118
118
  /**
119
- * Applies the 'positive' style (e.g., green).
119
+ * Applies the 'success' style.
120
120
  */
121
- positive: Boolean,
121
+ success: Boolean,
122
122
  /**
123
- * Applies the 'negative' style (e.g., red).
123
+ * Applies the 'warning' style.
124
124
  */
125
- negative: Boolean,
125
+ warning: Boolean,
126
+ /**
127
+ * Applies the 'danger' style.
128
+ */
129
+ danger: Boolean,
126
130
  /**
127
131
  * Applies styles for use as a thin loader.
128
132
  */
@@ -174,8 +178,9 @@
174
178
  baseClass: "progress-bar",
175
179
  internal: computed(() => ({
176
180
  'small': props.small,
177
- 'positive': props.positive,
178
- 'negative': props.negative,
181
+ 'success': props.success,
182
+ 'warning': props.warning,
183
+ 'danger': props.danger,
179
184
  'loader': props.loader,
180
185
  'rounded': props.rounded,
181
186
  'indeterminate': props.indeterminate,
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div :class="componentClasses">
2
+ <div class="progress-circle" :class="resolvedModifiers">
3
3
  <strong class="hidden-visually">{{ label }}</strong>
4
4
  <div class="progress-circle__chart">
5
5
  <svg class="progress-circle__chart-svg" viewBox="0 0 32 32">
@@ -34,126 +34,136 @@
34
34
  </template>
35
35
 
36
36
  <script setup>
37
- import { ref, computed, watch, onMounted } from 'vue';
37
+ import { ref, computed, watch, onMounted } from 'vue';
38
+ import { useModifiers } from "../../composables/useModifiers.js";
38
39
 
39
- /**
40
- * A circular progress indicator component.
41
- * @slot value - The value display. Overrides the `formatValue` prop.
42
- */
43
- const props = defineProps({
44
40
  /**
45
- * The label for accessibility (visually hidden).
41
+ * A circular progress indicator component.
42
+ * @slot value - The value display. Overrides the `formatValue` prop.
46
43
  */
47
- label: {
48
- type: String,
49
- default: "Progress"
50
- },
51
- /**
52
- * The progress percentage (0-100).
53
- */
54
- percentage: {
55
- type: Number,
56
- default: 0
57
- },
58
- /**
59
- * A function to format the percentage value.
60
- * Takes the number as input and should return a string.
61
- */
62
- formatValue: {
63
- type: Function,
64
- default: (value) => `${ value }%`,
65
- },
66
- /**
67
- * Hides the percentage value display.
68
- */
69
- noValue: Boolean,
70
- /**
71
- * Renders a smaller version of the component.
72
- */
73
- small: Boolean,
74
- /**
75
- * Displays the percentage value outside (to the side) of the circle.
76
- */
77
- outside: Boolean,
78
- /**
79
- * Displays the percentage value below the circle.
80
- */
81
- outsideBelow: Boolean,
82
- /**
83
- * Sets the status color of the progress circle (e.g., 'low', 'incomplete', 'complete').
84
- */
85
- status: {
86
- type: String,
87
- default: ''
88
- },
89
- /**
90
- * Renders the component as a solid pie chart instead of a donut.
91
- */
92
- pieStyle: Boolean,
93
- /**
94
- * Removes the center mask, filling the entire circle.
95
- */
96
- noMask: Boolean,
97
- /**
98
- * The duration of the animation in milliseconds.
99
- */
100
- duration: {
101
- type: Number,
102
- default: 1000 // Matches SCSS animation-duration
103
- },
104
- /**
105
- * The easing function for the animation.
106
- */
107
- easing: {
108
- type: String,
109
- default: "ease-in" // Matches SCSS animation-timing
110
- }
111
- });
44
+ const props = defineProps({
45
+ /**
46
+ * The label for accessibility (visually hidden).
47
+ */
48
+ label: {
49
+ type: String,
50
+ default: "Progress"
51
+ },
52
+ /**
53
+ * The progress percentage (0-100).
54
+ */
55
+ percentage: {
56
+ type: Number,
57
+ default: 0
58
+ },
59
+ /**
60
+ * A function to format the percentage value.
61
+ * Takes the number as input and should return a string.
62
+ */
63
+ formatValue: {
64
+ type: Function,
65
+ default: (value) => `${ value }%`,
66
+ },
67
+ /**
68
+ * Hides the percentage value display.
69
+ */
70
+ noValue: Boolean,
71
+ /**
72
+ * Renders a smaller version of the component.
73
+ */
74
+ small: Boolean,
75
+ /**
76
+ * Displays the percentage value outside (to the side) of the circle.
77
+ */
78
+ outside: Boolean,
79
+ /**
80
+ * Displays the percentage value below the circle.
81
+ */
82
+ outsideBelow: Boolean,
83
+ /**
84
+ * Applies the 'danger' style.
85
+ */
86
+ danger: Boolean,
87
+ /**
88
+ * Applies the 'warning' style.
89
+ */
90
+ warning: Boolean,
91
+ /**
92
+ * Applies the 'success' style.
93
+ */
94
+ success: Boolean,
95
+ /**
96
+ * Renders the component as a solid pie chart instead of a donut.
97
+ */
98
+ pieStyle: Boolean,
99
+ /**
100
+ * Removes the center mask, filling the entire circle.
101
+ */
102
+ noMask: Boolean,
103
+ /**
104
+ * The duration of the animation in milliseconds.
105
+ */
106
+ duration: {
107
+ type: Number,
108
+ default: 1000 // Matches SCSS animation-duration
109
+ },
110
+ /**
111
+ * The easing function for the animation.
112
+ */
113
+ easing: {
114
+ type: String,
115
+ default: "ease-in" // Matches SCSS animation-timing
116
+ },
117
+ /**
118
+ * Modifiers (to add any modifier classes based on base class)
119
+ */
120
+ modifiers: [String, Array]
121
+ });
112
122
 
113
- const pie = ref(null);
123
+ const pie = ref(null);
114
124
 
115
- const normalize = (percentage) => {
116
- // Added the 1% extra to 100% because sometimes it renders with a tiny gap
117
- return percentage === 100 ? 101 : percentage;
118
- };
125
+ const normalize = (percentage) => {
126
+ // Added the 1% extra to 100% because sometimes it renders with a tiny gap
127
+ return percentage === 100 ? 101 : percentage;
128
+ };
119
129
 
120
- const animate = (from = 0) => {
121
- if (!pie.value || !pie.value.animate) return; // No Animation API or element not ready
122
-
123
- const keyframes = { strokeDasharray: [`${from} 100`, endDasharray.value] };
124
- pie.value.animate(keyframes, { duration: props.duration, easing: props.easing, fill: "forwards" });
125
- };
130
+ const animate = (from = 0) => {
131
+ if (!pie.value || !pie.value.animate) return; // No Animation API or element not ready
132
+
133
+ const keyframes = { strokeDasharray: [`${from} 100`, endDasharray.value] };
134
+ pie.value.animate(keyframes, { duration: props.duration, easing: props.easing, fill: "forwards" });
135
+ };
126
136
 
127
- watch(() => props.percentage, (newVal, oldVal) => {
128
- if (newVal !== oldVal) {
129
- animate(normalize(oldVal));
130
- }
131
- });
137
+ watch(() => props.percentage, (newVal, oldVal) => {
138
+ if (newVal !== oldVal) {
139
+ animate(normalize(oldVal));
140
+ }
141
+ });
132
142
 
133
- const endDasharray = computed(() => {
134
- return `${normalize(props.percentage)} 100`;
135
- });
143
+ const endDasharray = computed(() => {
144
+ return `${normalize(props.percentage)} 100`;
145
+ });
136
146
 
137
- const showValueOutside = computed(() => {
138
- return props.outside || props.outsideBelow || props.small;
139
- });
147
+ const showValueOutside = computed(() => {
148
+ return props.outside || props.outsideBelow || props.small;
149
+ });
140
150
 
141
- const componentClasses = computed(() => {
142
- const classes = {
143
- 'progress-circle': true,
144
- 'progress-circle--small': props.small,
145
- 'progress-circle--pie': props.pieStyle,
146
- 'progress-circle--outside': showValueOutside.value,
147
- 'progress-circle--outside-below': props.outsideBelow,
148
- 'progress-circle--no-mask': props.noMask,
149
- };
150
- if (props.status) {
151
- classes[`progress-circle--${props.status}`] = true;
152
- }
153
- return classes;
154
- });
151
+ const { resolvedModifiers } = useModifiers({
152
+ props,
153
+ baseClass: "progress-circle",
154
+ internal: computed(() => ({
155
+ 'small': props.small,
156
+ 'pie': props.pieStyle,
157
+ 'outside': showValueOutside.value,
158
+ 'outside-below': props.outsideBelow,
159
+ 'no-mask': props.noMask,
160
+ 'danger': props.danger,
161
+ 'warning': props.warning,
162
+ 'success': props.success,
163
+ }))
164
+ });
155
165
 
156
- onMounted(() => {
157
- animate();
158
- });
166
+ onMounted(() => {
167
+ animate();
168
+ });
159
169
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulu/frontend-vue",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "A modular, tree-shakeable Vue 3 component library for the Ulu Frontend theming system, plus general utilities for Vue development",
5
5
  "type": "module",
6
6
  "files": [
@@ -65,7 +65,7 @@
65
65
  "@fortawesome/vue-fontawesome": "^3.0.8",
66
66
  "@headlessui/vue": "^1.7.23",
67
67
  "@portabletext/vue": "^1.0.14",
68
- "@ulu/frontend": "^0.3.6",
68
+ "@ulu/frontend": "^0.4.0",
69
69
  "@ulu/utils": "^0.0.34",
70
70
  "@unhead/vue": "^2.0.11",
71
71
  "fuse.js": "^6.6.2",
@@ -87,7 +87,7 @@
87
87
  "@storybook/addon-essentials": "^9.0.0-alpha.12",
88
88
  "@storybook/addon-links": "^9.1.1",
89
89
  "@storybook/vue3-vite": "^9.1.1",
90
- "@ulu/frontend": "^0.3.6",
90
+ "@ulu/frontend": "^0.4.0",
91
91
  "@ulu/utils": "^0.0.34",
92
92
  "@unhead/vue": "^2.0.11",
93
93
  "@vitejs/plugin-vue": "^6.0.0",