@dgshahr/ui-kit 1.0.2 → 1.0.4

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.
@@ -1,18 +1,18 @@
1
1
  "use client";
2
- import { jsxs as R, jsx as t, Fragment as S } from "react/jsx-runtime";
3
- import { c as i } from "./clsx-OuTLNxxd.js";
4
- import { createContext as D, useContext as O, useRef as A, useEffect as L, useState as p } from "react";
5
- import V from "./Drawer/index.mjs";
6
- import { u as _ } from "./useFlipPosition-BWxiBDQ_.js";
7
- import { I as j } from "./IconArrowDown2-7ddwV5IE.js";
8
- import { I as F } from "./index-Cj_9z9UD.js";
2
+ import { jsxs as D, jsx as i, Fragment as O } from "react/jsx-runtime";
3
+ import { c as t } from "./clsx-OuTLNxxd.js";
4
+ import { createContext as A, useContext as L, useRef as V, useEffect as _, useState as p } from "react";
5
+ import j from "./Drawer/index.mjs";
6
+ import { u as F } from "./useFlipPosition-BWxiBDQ_.js";
7
+ import { I as M } from "./IconArrowDown2-7ddwV5IE.js";
8
+ import { I as U } from "./index-Cj_9z9UD.js";
9
9
  import './assets/styles.css';/* empty css */
10
- const v = D({
10
+ const I = A({
11
11
  toggleWrapperVisibility: () => {
12
12
  }
13
- }), Q = () => O(v), M = (a) => {
14
- const e = A(null);
15
- return L(() => {
13
+ }), Y = () => L(I), z = (a) => {
14
+ const e = V(null);
15
+ return _(() => {
16
16
  const s = (o) => {
17
17
  e.current && !e.current.contains(o.target) && a();
18
18
  };
@@ -20,7 +20,7 @@ const v = D({
20
20
  document.removeEventListener("click", s, !0);
21
21
  };
22
22
  }, [e, a]), e;
23
- }, C = "dgsuikit:duration-300", x = 400, X = (a) => {
23
+ }, b = "dgsuikit:duration-300", x = 400, Z = (a) => {
24
24
  const {
25
25
  dropdownType: e = "popover",
26
26
  disabled: s,
@@ -29,100 +29,101 @@ const v = D({
29
29
  customInput: g,
30
30
  children: m,
31
31
  drawerProps: k,
32
- inputProps: I,
33
- popoverClassName: y
34
- } = a, [n, u] = p(!1), [f, l] = p(!1), [h, T] = p("bottom-left");
32
+ inputProps: y,
33
+ popoverClassName: P,
34
+ popoverPosition: T
35
+ } = a, f = T === "top" ? "top-left" : "bottom-left", [n, u] = p(!1), [h, l] = p(!1), [w, W] = p(f);
35
36
  let r;
36
- const { anchorRef: P, popperRef: W } = _({
37
- initialPosition: "bottom-left",
37
+ const { anchorRef: E, popperRef: R } = F({
38
+ initialPosition: f,
38
39
  minVisible: 180,
39
40
  onPositionChange(d) {
40
- T((b) => b === d ? b : d);
41
+ W((C) => C === d ? C : d);
41
42
  }
42
- }), E = M(() => {
43
+ }), S = z(() => {
43
44
  e === "popover" && n && (u(!1), r && clearTimeout(r), r = setTimeout(() => {
44
45
  l(!1);
45
46
  }, x));
46
47
  });
47
- function w() {
48
+ function v() {
48
49
  if (s || o) return;
49
- const d = !f;
50
+ const d = !h;
50
51
  r && clearTimeout(r), d ? (l(!0), r = setTimeout(() => {
51
52
  u(!0);
52
53
  }, 0)) : (u(!1), r = setTimeout(() => {
53
54
  l(!1);
54
55
  }, x));
55
56
  }
56
- const c = i({
57
+ const c = t({
57
58
  "dgsuikit:!cursor-not-allowed": s,
58
59
  "dgsuikit:!cursor-wait": o,
59
60
  "dgsuikit:!cursor-pointer": !o && !s
60
61
  });
61
- return /* @__PURE__ */ R(
62
+ return /* @__PURE__ */ D(
62
63
  "div",
63
64
  {
64
- ref: E,
65
- className: i("dgsuikit:relative", N),
65
+ ref: S,
66
+ className: t("dgsuikit:relative", N),
66
67
  children: [
67
- /* @__PURE__ */ t(
68
+ /* @__PURE__ */ i(
68
69
  "button",
69
70
  {
70
- ref: P,
71
+ ref: E,
71
72
  type: "button",
72
- className: i("dgsuikit:w-full", c),
73
- onClick: w,
74
- children: g ? g(n) : /* @__PURE__ */ t(
75
- F,
73
+ className: t("dgsuikit:w-full", c),
74
+ onClick: v,
75
+ children: g ? g(n) : /* @__PURE__ */ i(
76
+ U,
76
77
  {
77
- leftIcon: o ? /* @__PURE__ */ t("div", { className: "dot-flashing dgsuikit:mr-2" }) : /* @__PURE__ */ t(
78
- j,
78
+ leftIcon: o ? /* @__PURE__ */ i("div", { className: "dot-flashing dgsuikit:mr-2" }) : /* @__PURE__ */ i(
79
+ M,
79
80
  {
80
81
  width: 20,
81
82
  height: 20,
82
- className: i("dgsuikit:transition", C, {
83
+ className: t("dgsuikit:transition", b, {
83
84
  "dgsuikit:rotate-180": n
84
85
  })
85
86
  }
86
87
  ),
87
- containerClassName: i(c, {
88
+ containerClassName: t(c, {
88
89
  "dgsuikit:items-baseline": o
89
90
  }),
90
- className: i("dgsuikit:caret-transparent", c),
91
+ className: t("dgsuikit:caret-transparent", c),
91
92
  disabled: s,
92
- ...I
93
+ ...y
93
94
  }
94
95
  )
95
96
  }
96
97
  ),
97
- /* @__PURE__ */ t(
98
- v.Provider,
98
+ /* @__PURE__ */ i(
99
+ I.Provider,
99
100
  {
100
101
  value: {
101
- toggleWrapperVisibility: w
102
+ toggleWrapperVisibility: v
102
103
  },
103
- children: f && /* @__PURE__ */ t(S, { children: e === "popover" ? /* @__PURE__ */ t(
104
+ children: h && /* @__PURE__ */ i(O, { children: e === "popover" ? /* @__PURE__ */ i(
104
105
  "div",
105
106
  {
106
- ref: W,
107
- className: i(
107
+ ref: R,
108
+ className: t(
108
109
  "dgsuikit:absolute dgsuikit:min-w-[300px] dgsuikit:right-0 dgsuikit:overflow-y-auto dgsuikit:overflow-x-hidden dgsuikit:shadow-lg dgsuikit:w-full dgsuikit:max-h-[360px] dgsuikit:transition-all dgsuikit:bg-white dgsuikit:z-50 dgsuikit:rounded-lg dgsuikit:border dgsuikit:border-solid dgsuikit:border-gray-200 dgsuikit:pb-3",
109
- C,
110
+ b,
110
111
  n ? "dgsuikit:opacity-100" : "dgsuikit:opacity-0 dgsuikit:max-h-0 dgsuikit:overflow-y-hidden",
111
112
  {
112
- "dgsuikit:bottom-0 dgsuikit:translate-y-[calc(100%+8px)]": h.includes("bottom"),
113
- "dgsuikit:top-0 dgsuikit:translate-y-[calc(-100%-8px)]": h.includes("top")
113
+ "dgsuikit:bottom-0 dgsuikit:translate-y-[calc(100%+8px)]": w.includes("bottom"),
114
+ "dgsuikit:top-0 dgsuikit:translate-y-[calc(-100%-8px)]": w.includes("top")
114
115
  },
115
- y
116
+ P
116
117
  ),
117
118
  children: m
118
119
  }
119
- ) : /* @__PURE__ */ t(
120
- V,
120
+ ) : /* @__PURE__ */ i(
121
+ j,
121
122
  {
122
123
  ...k,
123
124
  open: n,
124
125
  onClose: () => u(!1),
125
- containerClassName: i(
126
+ containerClassName: t(
126
127
  "dgsuikit:!pb-3 dgsuikit:!px-0",
127
128
  k?.containerClassName
128
129
  ),
@@ -136,6 +137,6 @@ const v = D({
136
137
  );
137
138
  };
138
139
  export {
139
- X as P,
140
- Q as u
140
+ Z as P,
141
+ Y as u
141
142
  };
@@ -0,0 +1 @@
1
+ "use client";"use strict";require('./assets/styles.css');const t=require("react/jsx-runtime"),i=require("./clsx-C11secjj.cjs"),n=require("react"),S=require("./Drawer/index.cjs"),E=require("./useFlipPosition-CWhLgzoz.cjs"),D=require("./IconArrowDown2-C1dLVveG.cjs"),A=require("./index-BCqGGELs.cjs");;/* empty css */const I=n.createContext({toggleWrapperVisibility:()=>{}}),O=()=>n.useContext(I),F=a=>{const e=n.useRef(null);return n.useEffect(()=>{const s=o=>{e.current&&!e.current.contains(o.target)&&a()};return document.addEventListener("click",s,!0),()=>{document.removeEventListener("click",s,!0)}},[e,a]),e},v="dgsuikit:duration-300",b=400,L=a=>{const{dropdownType:e="popover",disabled:s,isLoading:o,wrapperClassName:N,customInput:g,children:k,drawerProps:m,inputProps:P,popoverClassName:y,popoverPosition:T}=a,f=T==="top"?"top-left":"bottom-left",[u,c]=n.useState(!1),[x,d]=n.useState(!1),[h,W]=n.useState(f);let r;const{anchorRef:j,popperRef:R}=E.useFlipPosition({initialPosition:f,minVisible:180,onPositionChange(l){W(C=>C===l?C:l)}}),q=F(()=>{e==="popover"&&u&&(c(!1),r&&clearTimeout(r),r=setTimeout(()=>{d(!1)},b))});function w(){if(s||o)return;const l=!x;r&&clearTimeout(r),l?(d(!0),r=setTimeout(()=>{c(!0)},0)):(c(!1),r=setTimeout(()=>{d(!1)},b))}const p=i.clsx({"dgsuikit:!cursor-not-allowed":s,"dgsuikit:!cursor-wait":o,"dgsuikit:!cursor-pointer":!o&&!s});return t.jsxs("div",{ref:q,className:i.clsx("dgsuikit:relative",N),children:[t.jsx("button",{ref:j,type:"button",className:i.clsx("dgsuikit:w-full",p),onClick:w,children:g?g(u):t.jsx(A.Input,{leftIcon:o?t.jsx("div",{className:"dot-flashing dgsuikit:mr-2"}):t.jsx(D.IconArrowDown2,{width:20,height:20,className:i.clsx("dgsuikit:transition",v,{"dgsuikit:rotate-180":u})}),containerClassName:i.clsx(p,{"dgsuikit:items-baseline":o}),className:i.clsx("dgsuikit:caret-transparent",p),disabled:s,...P})}),t.jsx(I.Provider,{value:{toggleWrapperVisibility:w},children:x&&t.jsx(t.Fragment,{children:e==="popover"?t.jsx("div",{ref:R,className:i.clsx("dgsuikit:absolute dgsuikit:min-w-[300px] dgsuikit:right-0 dgsuikit:overflow-y-auto dgsuikit:overflow-x-hidden dgsuikit:shadow-lg dgsuikit:w-full dgsuikit:max-h-[360px] dgsuikit:transition-all dgsuikit:bg-white dgsuikit:z-50 dgsuikit:rounded-lg dgsuikit:border dgsuikit:border-solid dgsuikit:border-gray-200 dgsuikit:pb-3",v,u?"dgsuikit:opacity-100":"dgsuikit:opacity-0 dgsuikit:max-h-0 dgsuikit:overflow-y-hidden",{"dgsuikit:bottom-0 dgsuikit:translate-y-[calc(100%+8px)]":h.includes("bottom"),"dgsuikit:top-0 dgsuikit:translate-y-[calc(-100%-8px)]":h.includes("top")},y),children:k}):t.jsx(S,{...m,open:u,onClose:()=>c(!1),containerClassName:i.clsx("dgsuikit:!pb-3 dgsuikit:!px-0",m?.containerClassName),children:k})})})]})};exports.PickerWrapper=L;exports.usePickerWrapperContext=O;
@@ -1 +1 @@
1
- "use strict";require('../assets/styles.css');const i=require("react/jsx-runtime"),o=require("../clsx-C11secjj.cjs");;/* empty css */const x=s=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...s,children:i.jsx("path",{fill:"currentColor",d:"M10.92 2.868a1.25 1.25 0 0 1 2.16 0l2.795 4.798 5.428 1.176a1.25 1.25 0 0 1 .667 2.054l-3.7 4.141.56 5.525a1.25 1.25 0 0 1-1.748 1.27L12 19.592l-5.082 2.24a1.25 1.25 0 0 1-1.748-1.27l.56-5.525-3.7-4.14a1.25 1.25 0 0 1 .667-2.055l5.428-1.176z"})}),k=s=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...s,children:i.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.08 2.868a1.25 1.25 0 0 0-2.16 0L8.126 7.665 2.697 8.842a1.25 1.25 0 0 0-.667 2.054l3.7 4.141-.56 5.525a1.25 1.25 0 0 0 1.748 1.27L12 19.592l5.082 2.24a1.25 1.25 0 0 0 1.748-1.27l-.56-5.525 3.7-4.14a1.25 1.25 0 0 0-.667-2.055l-5.428-1.176zM12 17.523c.172 0 .344.035.504.106l4.206 1.854-.463-4.573a1.25 1.25 0 0 1 .312-.959l3.062-3.427-4.492-.973a1.25 1.25 0 0 1-.816-.592L12 4.987z",clipRule:"evenodd"})}),h=s=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...s,children:i.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m13.103 3.67 1.828 3.652c.18.36.528.608.927.664l4.09.59a1.211 1.211 0 0 1 .682 2.071l-2.958 2.842c-.291.277-.424.68-.354 1.076l.7 4.012a1.228 1.228 0 0 1-1.788 1.28l-3.654-1.894a1.25 1.25 0 0 0-1.147 0l-3.656 1.895a1.228 1.228 0 0 1-1.787-1.28l.7-4.013a1.2 1.2 0 0 0-.354-1.075L3.37 10.648a1.211 1.211 0 0 1 .682-2.072l4.09-.589c.399-.056.746-.304.928-.664L10.9 3.67a1.24 1.24 0 0 1 2.202 0",clipRule:"evenodd"})}),d=s=>{const{size:e,state:t,onClick:a}=s;let r=h;return t==="fill"?r=x:t==="half-fill"&&(r=k),i.jsx(r,{className:o.clsx("dgsuikit:hover:scale-110 dgsuikit:transition-transform",{"dgsuikit:size-6":e==="large","dgsuikit:size-5":e==="small"},t==="empty"?"dgsuikit:text-gray-200":"dgsuikit:text-warning-500",typeof a=="function"&&"dgsuikit:cursor-pointer"),onClick:a})};function f(s,e){const t=Math.floor(e);return s<=t?"fill":s-1===t&&e%1>=.5?"half-fill":"empty"}const m=s=>{const{value:e,total:t,onChange:a,showRateNumber:r=!0,showStarsNumber:c,showTotalStars:g,size:l="large",className:u}=s;return i.jsxs("div",{className:o.clsx("dgsuikit:flex dgsuikit:items-center dgsuikit:gap-2",u),children:[g?i.jsx("div",{className:"dgsuikit:flex dgsuikit:flex-row-reverse dgsuikit:items-center dgsuikit:gap-1",children:Array(t).keys().map(n=>i.jsxs("div",{className:"dgsuikit:flex dgsuikit:flex-col dgsuikit:items-center dgsuikit:justify-center",children:[i.jsx(d,{size:l,state:f(n+1,e),onClick:()=>a&&a(n+1)}),c&&i.jsx("span",{className:"dgsuikit:mt-1 dgsuikit:font-caption-demibold dgsuikit:ss02 dgsuikit:text-gray-500",children:n+1})]},n))}):i.jsx(d,{size:l,state:"fill"}),r&&i.jsxs("div",{className:"dgsuikit:flex dgsuikit:items-center dgsuikit:ss02",children:[i.jsx("span",{className:o.clsx("dgsuikit:text-primary-400 dgsuikit:ml-1",{"dgsuikit:font-h2-bold":l==="large","dgsuikit:font-h5-bold":l==="small"}),children:e<=t?e:t}),i.jsxs("span",{className:o.clsx("dgsuikit:text-gray-400",{"dgsuikit:font-h5-bold":l==="large","dgsuikit:font-h6-bold":l==="small"}),children:["از ",t]})]})]})};module.exports=m;
1
+ "use strict";require('../assets/styles.css');const i=require("react/jsx-runtime"),d=require("../clsx-C11secjj.cjs");;/* empty css */const k=s=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...s,children:i.jsx("path",{fill:"currentColor",d:"M10.92 2.868a1.25 1.25 0 0 1 2.16 0l2.795 4.798 5.428 1.176a1.25 1.25 0 0 1 .667 2.054l-3.7 4.141.56 5.525a1.25 1.25 0 0 1-1.748 1.27L12 19.592l-5.082 2.24a1.25 1.25 0 0 1-1.748-1.27l.56-5.525-3.7-4.14a1.25 1.25 0 0 1 .667-2.055l5.428-1.176z"})}),x=s=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...s,children:i.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.08 2.868a1.25 1.25 0 0 0-2.16 0L8.126 7.665 2.697 8.842a1.25 1.25 0 0 0-.667 2.054l3.7 4.141-.56 5.525a1.25 1.25 0 0 0 1.748 1.27L12 19.592l5.082 2.24a1.25 1.25 0 0 0 1.748-1.27l-.56-5.525 3.7-4.14a1.25 1.25 0 0 0-.667-2.055l-5.428-1.176zM12 17.523c.172 0 .344.035.504.106l4.206 1.854-.463-4.573a1.25 1.25 0 0 1 .312-.959l3.062-3.427-4.492-.973a1.25 1.25 0 0 1-.816-.592L12 4.987z",clipRule:"evenodd"})}),h=s=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...s,children:i.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m13.103 3.67 1.828 3.652c.18.36.528.608.927.664l4.09.59a1.211 1.211 0 0 1 .682 2.071l-2.958 2.842c-.291.277-.424.68-.354 1.076l.7 4.012a1.228 1.228 0 0 1-1.788 1.28l-3.654-1.894a1.25 1.25 0 0 0-1.147 0l-3.656 1.895a1.228 1.228 0 0 1-1.787-1.28l.7-4.013a1.2 1.2 0 0 0-.354-1.075L3.37 10.648a1.211 1.211 0 0 1 .682-2.072l4.09-.589c.399-.056.746-.304.928-.664L10.9 3.67a1.24 1.24 0 0 1 2.202 0",clipRule:"evenodd"})}),c=s=>{const{size:e,state:t,onClick:a}=s;let r=h;return t==="fill"?r=k:t==="half-fill"&&(r=x),i.jsx(r,{className:d.clsx("dgsuikit:hover:scale-110 dgsuikit:transition-transform",{"dgsuikit:size-6":e==="large","dgsuikit:size-5":e==="small"},t==="empty"?"dgsuikit:text-gray-200":"dgsuikit:text-warning-500",typeof a=="function"&&"dgsuikit:cursor-pointer"),onClick:a})};function f(s,e){const t=Math.floor(e);return s<=t?"fill":s-1===t&&e%1>=.5?"half-fill":"empty"}const m=s=>{const{value:e,total:t,onChange:a,showRateNumber:r=!0,showStarsNumber:o,showTotalStars:g,size:l="large",className:u}=s;return i.jsxs("div",{className:d.clsx("dgsuikit:flex dgsuikit:gap-2",g&&o?"dgsuikit:items-start":"dgsuikit:items-center",u),children:[g?i.jsx("div",{className:"dgsuikit:flex dgsuikit:flex-row-reverse dgsuikit:items-center dgsuikit:gap-1",children:Array(t).keys().map(n=>i.jsxs("div",{className:"dgsuikit:flex dgsuikit:flex-col dgsuikit:items-center dgsuikit:justify-center",children:[i.jsx(c,{size:l,state:f(n+1,e),onClick:()=>a&&a(n+1)}),o&&i.jsx("span",{className:"dgsuikit:mt-0.5 dgsuikit:font-caption-regular dgsuikit:ss02 dgsuikit:text-gray-500",children:n+1})]},n))}):i.jsx(c,{size:l,state:"fill"}),r&&i.jsxs("div",{className:"dgsuikit:flex dgsuikit:items-center dgsuikit:ss02",children:[i.jsx("span",{className:d.clsx("dgsuikit:text-primary-400 dgsuikit:ml-1",{"dgsuikit:font-h2-bold dgsuikit:leading-7":l==="large","dgsuikit:font-h5-bold dgsuikit:leading-6":l==="small"}),children:e<=t?e:t}),i.jsxs("span",{className:d.clsx("dgsuikit:text-gray-400",{"dgsuikit:font-h5-bold":l==="large","dgsuikit:font-h6-bold":l==="small"}),children:["از ",t]})]})]})};module.exports=m;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Rate/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,kBAAkB,CAAC;AAU1B,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAgEvB,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Rate/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,kBAAkB,CAAC;AAU1B,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAsEvB,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,cAAc,SAAS,CAAC"}
@@ -58,8 +58,8 @@ const f = (i) => /* @__PURE__ */ t(
58
58
  }
59
59
  )
60
60
  }
61
- ), g = (i) => {
62
- const { size: l, state: e, onClick: a } = i;
61
+ ), c = (i) => {
62
+ const { size: s, state: e, onClick: a } = i;
63
63
  let r = m;
64
64
  return e === "fill" ? r = f : e === "half-fill" && (r = h), /* @__PURE__ */ t(
65
65
  r,
@@ -67,8 +67,8 @@ const f = (i) => /* @__PURE__ */ t(
67
67
  className: d(
68
68
  "dgsuikit:hover:scale-110 dgsuikit:transition-transform",
69
69
  {
70
- "dgsuikit:size-6": l === "large",
71
- "dgsuikit:size-5": l === "small"
70
+ "dgsuikit:size-6": s === "large",
71
+ "dgsuikit:size-5": s === "small"
72
72
  },
73
73
  e === "empty" ? "dgsuikit:text-gray-200" : "dgsuikit:text-warning-500",
74
74
  typeof a == "function" && "dgsuikit:cursor-pointer"
@@ -77,72 +77,82 @@ const f = (i) => /* @__PURE__ */ t(
77
77
  }
78
78
  );
79
79
  };
80
- function p(i, l) {
81
- const e = Math.floor(l);
82
- return i <= e ? "fill" : i - 1 === e && l % 1 >= 0.5 ? "half-fill" : "empty";
80
+ function p(i, s) {
81
+ const e = Math.floor(s);
82
+ return i <= e ? "fill" : i - 1 === e && s % 1 >= 0.5 ? "half-fill" : "empty";
83
83
  }
84
84
  const N = (i) => {
85
85
  const {
86
- value: l,
86
+ value: s,
87
87
  total: e,
88
88
  onChange: a,
89
89
  showRateNumber: r = !0,
90
- showStarsNumber: c,
90
+ showStarsNumber: g,
91
91
  showTotalStars: u,
92
- size: s = "large",
92
+ size: l = "large",
93
93
  className: k
94
94
  } = i;
95
- return /* @__PURE__ */ o("div", { className: d("dgsuikit:flex dgsuikit:items-center dgsuikit:gap-2", k), children: [
96
- u ? /* @__PURE__ */ t("div", { className: "dgsuikit:flex dgsuikit:flex-row-reverse dgsuikit:items-center dgsuikit:gap-1", children: Array(e).keys().map((n) => /* @__PURE__ */ o(
97
- "div",
98
- {
99
- className: "dgsuikit:flex dgsuikit:flex-col dgsuikit:items-center dgsuikit:justify-center",
100
- children: [
95
+ return /* @__PURE__ */ o(
96
+ "div",
97
+ {
98
+ className: d(
99
+ "dgsuikit:flex dgsuikit:gap-2",
100
+ u && g ? "dgsuikit:items-start" : "dgsuikit:items-center",
101
+ k
102
+ ),
103
+ children: [
104
+ u ? /* @__PURE__ */ t("div", { className: "dgsuikit:flex dgsuikit:flex-row-reverse dgsuikit:items-center dgsuikit:gap-1", children: Array(e).keys().map((n) => /* @__PURE__ */ o(
105
+ "div",
106
+ {
107
+ className: "dgsuikit:flex dgsuikit:flex-col dgsuikit:items-center dgsuikit:justify-center",
108
+ children: [
109
+ /* @__PURE__ */ t(
110
+ c,
111
+ {
112
+ size: l,
113
+ state: p(n + 1, s),
114
+ onClick: () => a && a(n + 1)
115
+ }
116
+ ),
117
+ g && /* @__PURE__ */ t("span", { className: "dgsuikit:mt-0.5 dgsuikit:font-caption-regular dgsuikit:ss02 dgsuikit:text-gray-500", children: n + 1 })
118
+ ]
119
+ },
120
+ n
121
+ )) }) : /* @__PURE__ */ t(
122
+ c,
123
+ {
124
+ size: l,
125
+ state: "fill"
126
+ }
127
+ ),
128
+ r && /* @__PURE__ */ o("div", { className: "dgsuikit:flex dgsuikit:items-center dgsuikit:ss02", children: [
101
129
  /* @__PURE__ */ t(
102
- g,
130
+ "span",
103
131
  {
104
- size: s,
105
- state: p(n + 1, l),
106
- onClick: () => a && a(n + 1)
132
+ className: d("dgsuikit:text-primary-400 dgsuikit:ml-1", {
133
+ "dgsuikit:font-h2-bold dgsuikit:leading-7": l === "large",
134
+ "dgsuikit:font-h5-bold dgsuikit:leading-6": l === "small"
135
+ }),
136
+ children: s <= e ? s : e
107
137
  }
108
138
  ),
109
- c && /* @__PURE__ */ t("span", { className: "dgsuikit:mt-1 dgsuikit:font-caption-demibold dgsuikit:ss02 dgsuikit:text-gray-500", children: n + 1 })
110
- ]
111
- },
112
- n
113
- )) }) : /* @__PURE__ */ t(
114
- g,
115
- {
116
- size: s,
117
- state: "fill"
118
- }
119
- ),
120
- r && /* @__PURE__ */ o("div", { className: "dgsuikit:flex dgsuikit:items-center dgsuikit:ss02", children: [
121
- /* @__PURE__ */ t(
122
- "span",
123
- {
124
- className: d("dgsuikit:text-primary-400 dgsuikit:ml-1", {
125
- "dgsuikit:font-h2-bold": s === "large",
126
- "dgsuikit:font-h5-bold": s === "small"
127
- }),
128
- children: l <= e ? l : e
129
- }
130
- ),
131
- /* @__PURE__ */ o(
132
- "span",
133
- {
134
- className: d("dgsuikit:text-gray-400", {
135
- "dgsuikit:font-h5-bold": s === "large",
136
- "dgsuikit:font-h6-bold": s === "small"
137
- }),
138
- children: [
139
- "از ",
140
- e
141
- ]
142
- }
143
- )
144
- ] })
145
- ] });
139
+ /* @__PURE__ */ o(
140
+ "span",
141
+ {
142
+ className: d("dgsuikit:text-gray-400", {
143
+ "dgsuikit:font-h5-bold": l === "large",
144
+ "dgsuikit:font-h6-bold": l === "small"
145
+ }),
146
+ children: [
147
+ "از ",
148
+ e
149
+ ]
150
+ }
151
+ )
152
+ ] })
153
+ ]
154
+ }
155
+ );
146
156
  };
147
157
  export {
148
158
  N as default