@idds/vue 1.4.17 → 1.4.18

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/index.es.js CHANGED
@@ -2784,9 +2784,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
2784
2784
  };
2785
2785
  }
2786
2786
  });
2787
- const _hoisted_1$w = ["width", "height", "viewBox"];
2788
- const _hoisted_2$t = ["cx", "cy", "r", "stroke", "stroke-width"];
2789
- const _hoisted_3$r = ["cx", "cy", "r", "stroke", "stroke-width", "stroke-dasharray", "stroke-dashoffset"];
2787
+ const _hoisted_1$w = ["viewBox"];
2788
+ const _hoisted_2$t = ["cx", "cy", "r", "stroke-width"];
2789
+ const _hoisted_3$r = ["cx", "cy", "r", "stroke-width", "stroke-dasharray", "stroke-dashoffset"];
2790
2790
  const _sfc_main$A = /* @__PURE__ */ defineComponent({
2791
2791
  __name: "CircleProgressBar",
2792
2792
  props: {
@@ -2799,66 +2799,58 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
2799
2799
  },
2800
2800
  setup(__props) {
2801
2801
  const props = __props;
2802
- const VARIANT_MAP = {
2803
- primary: "var(--ina-primary-500)",
2804
- secondary: "var(--ina-secondary-500)",
2805
- success: "var(--ina-success-500)",
2806
- warning: "var(--ina-warning-500)",
2807
- error: "var(--ina-error-500)"
2808
- };
2809
2802
  const normalizedProgress = computed(
2810
2803
  () => Math.min(100, Math.max(0, props.progress))
2811
2804
  );
2812
- const strokeColor = computed(() => {
2813
- const isHex = props.variant.startsWith("#");
2814
- return isHex ? props.variant : VARIANT_MAP[props.variant] || VARIANT_MAP.primary;
2815
- });
2816
2805
  const center = computed(() => props.diameter / 2);
2817
2806
  const radius = computed(() => (props.diameter - props.strokeWidth) / 2);
2818
2807
  const circumference = computed(() => 2 * Math.PI * radius.value);
2819
2808
  const strokeDashoffset = computed(
2820
2809
  () => circumference.value - normalizedProgress.value / 100 * circumference.value
2821
2810
  );
2811
+ const isCustomColor = computed(() => props.variant.startsWith("#"));
2822
2812
  const containerClasses = computed(() => {
2823
- return [
2824
- "ina-circle-progress-bar",
2825
- "inline-flex items-center justify-center",
2826
- props.className
2827
- ].filter(Boolean).join(" ");
2813
+ const variantClass = !isCustomColor.value ? `ina-circle-progress-bar--${props.variant}` : "";
2814
+ return ["ina-circle-progress-bar", variantClass, props.className].filter(Boolean).join(" ");
2815
+ });
2816
+ const containerStyle = computed(() => {
2817
+ const style = {
2818
+ "--ina-circle-progress-size": `${props.diameter}px`
2819
+ };
2820
+ if (props.trackColor) {
2821
+ style["--ina-circle-progress-track-color"] = props.trackColor;
2822
+ }
2823
+ if (isCustomColor.value) {
2824
+ style["--ina-circle-progress-color"] = props.variant;
2825
+ }
2826
+ return style;
2828
2827
  });
2829
- const containerStyle = computed(() => ({
2830
- width: `${props.diameter}px`,
2831
- height: `${props.diameter}px`
2832
- }));
2833
2828
  return (_ctx, _cache) => {
2834
2829
  return openBlock(), createElementBlock("div", {
2835
2830
  class: normalizeClass(containerClasses.value),
2836
2831
  style: normalizeStyle(containerStyle.value)
2837
2832
  }, [
2838
2833
  (openBlock(), createElementBlock("svg", {
2839
- width: __props.diameter,
2840
- height: __props.diameter,
2834
+ class: "ina-circle-progress-bar__svg",
2835
+ width: "100%",
2836
+ height: "100%",
2841
2837
  viewBox: `0 0 ${__props.diameter} ${__props.diameter}`,
2842
2838
  fill: "none",
2843
- xmlns: "http://www.w3.org/2000/svg",
2844
- style: { "transform": "rotate(-90deg)" }
2839
+ xmlns: "http://www.w3.org/2000/svg"
2845
2840
  }, [
2846
2841
  createElementVNode("circle", {
2842
+ class: "ina-circle-progress-bar__track",
2847
2843
  cx: center.value,
2848
2844
  cy: center.value,
2849
2845
  r: radius.value,
2850
- stroke: __props.trackColor,
2851
- "stroke-width": __props.strokeWidth,
2852
- fill: "none"
2846
+ "stroke-width": __props.strokeWidth
2853
2847
  }, null, 8, _hoisted_2$t),
2854
2848
  createElementVNode("circle", {
2849
+ class: "ina-circle-progress-bar__progress",
2855
2850
  cx: center.value,
2856
2851
  cy: center.value,
2857
2852
  r: radius.value,
2858
- stroke: strokeColor.value,
2859
2853
  "stroke-width": __props.strokeWidth,
2860
- fill: "none",
2861
- "stroke-linecap": "round",
2862
2854
  "stroke-dasharray": circumference.value,
2863
2855
  "stroke-dashoffset": strokeDashoffset.value
2864
2856
  }, null, 8, _hoisted_3$r)