@alfadocs/ui-kit 0.9.1 → 0.10.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.
@@ -6,7 +6,7 @@ import { I } from "./icon-button-C4CGcYuz.js";
6
6
  import { D as n } from "./dropdown-menu-dyV7gHh_.js";
7
7
  import { H as L, g as A, f as H, e as x, a as C, c as M, d as B } from "./header-D0ULgQl3.js";
8
8
  import { L as N } from "./logo-_Z-jLq80.js";
9
- import { S as T, a as _, h as O, j as P, k as W, i as j } from "./sidebar-CoLHtVrP.js";
9
+ import { S as T, a as _, h as O, j as P, k as W, i as j } from "./sidebar-D8Lq065m.js";
10
10
  import { T as z } from "./theme-root-CSKD5ZRm.js";
11
11
  import { a as R } from "./tooltip-DHik5yRI.js";
12
12
  import { u as D } from "./use-theme-B1cwAXJR.js";
@@ -185,4 +185,4 @@ V.displayName = "PatientShell";
185
185
  export {
186
186
  V as P
187
187
  };
188
- //# sourceMappingURL=patient-shell-BS2V6V1b.js.map
188
+ //# sourceMappingURL=patient-shell-CL20JnVJ.js.map
@@ -0,0 +1,171 @@
1
+ import { jsxs as x, jsx as l } from "react/jsx-runtime";
2
+ import { forwardRef as v, useMemo as o } from "react";
3
+ import { c as u } from "./index-D2ZczOXr.js";
4
+ import { useTranslation as M } from "react-i18next";
5
+ import { S as b } from "./star-vav0SJ9e.js";
6
+ const R = u(
7
+ [
8
+ "ds:inline-flex ds:items-center ds:align-middle",
9
+ "ds:gap-[var(--spacing-xs)]"
10
+ ].join(" "),
11
+ {
12
+ variants: {
13
+ size: {
14
+ sm: "",
15
+ md: "",
16
+ lg: ""
17
+ }
18
+ },
19
+ defaultVariants: { size: "md" }
20
+ }
21
+ ), S = u(
22
+ [
23
+ "ds:inline-flex ds:items-center ds:leading-none",
24
+ "ds:gap-[var(--spacing-xs)]"
25
+ ].join(" ")
26
+ ), F = u(
27
+ "ds:relative ds:inline-block ds:shrink-0 ds:leading-none",
28
+ {
29
+ variants: {
30
+ size: {
31
+ sm: "ds:size-3.5",
32
+ md: "ds:size-4",
33
+ lg: "ds:size-5"
34
+ }
35
+ },
36
+ defaultVariants: { size: "md" }
37
+ }
38
+ ), $ = u(
39
+ [
40
+ "ds:pointer-events-none ds:absolute ds:start-0 ds:[inset-block:0]",
41
+ "ds:overflow-hidden ds:text-warning"
42
+ ].join(" "),
43
+ {
44
+ variants: {
45
+ fill: {
46
+ none: "ds:hidden",
47
+ half: "ds:[inline-size:50%]",
48
+ full: "ds:[inline-size:100%]"
49
+ }
50
+ },
51
+ defaultVariants: { fill: "none" }
52
+ }
53
+ ), I = u("ds:text-muted-foreground ds:leading-none", {
54
+ variants: {
55
+ size: {
56
+ sm: "type-meta",
57
+ md: "type-body-sm",
58
+ lg: "type-body"
59
+ },
60
+ underlined: {
61
+ true: "ds:underline ds:underline-offset-2",
62
+ false: ""
63
+ }
64
+ },
65
+ defaultVariants: { size: "md", underlined: !1 }
66
+ });
67
+ function T(t, s) {
68
+ const r = Math.max(0, Math.min(t, s)), n = Math.round(r * 2) / 2, e = [];
69
+ let a = n;
70
+ for (let m = 0; m < s; m += 1)
71
+ a >= 1 ? (e.push("full"), a -= 1) : a >= 0.5 ? (e.push("half"), a -= 0.5) : e.push("none");
72
+ return e;
73
+ }
74
+ const W = v(
75
+ ({
76
+ value: t,
77
+ max: s = 5,
78
+ size: r = "md",
79
+ reviews: n,
80
+ underlined: e = !1,
81
+ decorative: a = !1,
82
+ className: m,
83
+ "aria-label": c,
84
+ ...z
85
+ }, y) => {
86
+ const { t: d, i18n: f } = M(), i = o(
87
+ () => new Intl.NumberFormat(f.language, {
88
+ maximumFractionDigits: 1
89
+ }).format(t),
90
+ [t, f.language]
91
+ ), g = o(
92
+ () => new Intl.NumberFormat(f.language).format(s),
93
+ [s, f.language]
94
+ ), N = o(() => {
95
+ if (!a)
96
+ return c || (n ? d("rating.reviews", {
97
+ count: n.count,
98
+ value: i
99
+ }) : d("rating.label", {
100
+ value: i,
101
+ max: g
102
+ }));
103
+ }, [a, c, n, d, i, g]), V = o(() => T(t, s), [t, s]), p = o(() => {
104
+ if (n)
105
+ return n.label ? `${i} · ${n.count} ${n.label}` : d("rating.reviews", {
106
+ count: n.count,
107
+ value: i
108
+ });
109
+ }, [n, i, d]), j = a ? { "aria-hidden": !0 } : { role: "img", "aria-label": N };
110
+ return /* @__PURE__ */ x(
111
+ "span",
112
+ {
113
+ ref: y,
114
+ "data-component": "rating",
115
+ className: R({ size: r, className: m }),
116
+ ...j,
117
+ ...z,
118
+ children: [
119
+ /* @__PURE__ */ l(
120
+ "span",
121
+ {
122
+ "aria-hidden": "true",
123
+ className: S(),
124
+ "data-testid": "rating-stars",
125
+ children: V.map((h, k) => /* @__PURE__ */ x(
126
+ "span",
127
+ {
128
+ className: F({ size: r }),
129
+ "data-fill": h,
130
+ children: [
131
+ /* @__PURE__ */ l(
132
+ b,
133
+ {
134
+ "aria-hidden": "true",
135
+ className: "ds:size-full ds:text-muted-foreground/30",
136
+ strokeWidth: 1.5
137
+ }
138
+ ),
139
+ /* @__PURE__ */ l("span", { className: $({ fill: h }), children: /* @__PURE__ */ l(
140
+ b,
141
+ {
142
+ "aria-hidden": "true",
143
+ className: "ds:size-full ds:text-warning ds:fill-current",
144
+ strokeWidth: 1.5
145
+ }
146
+ ) })
147
+ ]
148
+ },
149
+ k
150
+ ))
151
+ }
152
+ ),
153
+ p ? /* @__PURE__ */ l(
154
+ "span",
155
+ {
156
+ "aria-hidden": "true",
157
+ className: I({ size: r, underlined: e }),
158
+ "data-testid": "rating-summary",
159
+ children: p
160
+ }
161
+ ) : null
162
+ ]
163
+ }
164
+ );
165
+ }
166
+ );
167
+ W.displayName = "Rating";
168
+ export {
169
+ W as R
170
+ };
171
+ //# sourceMappingURL=rating-BRD7O74e.js.map