@rehagro/ui 0.1.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.
- package/dist/index.d.mts +361 -0
- package/dist/index.d.ts +361 -0
- package/dist/index.js +1710 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1684 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +3 -0
- package/package.json +63 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1710 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React8 = require('react');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var React8__default = /*#__PURE__*/_interopDefault(React8);
|
|
9
|
+
|
|
10
|
+
// src/provider/RehagroProvider.tsx
|
|
11
|
+
|
|
12
|
+
// src/provider/theme.ts
|
|
13
|
+
var TOKEN_MAP = {
|
|
14
|
+
primary: { var: "--rh-primary", isColor: true },
|
|
15
|
+
primaryHover: { var: "--rh-primary-hover", isColor: true },
|
|
16
|
+
secondary: { var: "--rh-secondary", isColor: true },
|
|
17
|
+
secondaryHover: { var: "--rh-secondary-hover", isColor: true },
|
|
18
|
+
danger: { var: "--rh-danger", isColor: true },
|
|
19
|
+
dangerHover: { var: "--rh-danger-hover", isColor: true },
|
|
20
|
+
warning: { var: "--rh-warning", isColor: true },
|
|
21
|
+
success: { var: "--rh-success", isColor: true },
|
|
22
|
+
text: { var: "--rh-text", isColor: true },
|
|
23
|
+
textMuted: { var: "--rh-text-muted", isColor: true },
|
|
24
|
+
surface: { var: "--rh-surface", isColor: true },
|
|
25
|
+
background: { var: "--rh-background", isColor: true },
|
|
26
|
+
border: { var: "--rh-border", isColor: true },
|
|
27
|
+
ring: { var: "--rh-ring", isColor: true },
|
|
28
|
+
radiusXxs: { var: "--rh-radius-xxs", isColor: false },
|
|
29
|
+
radiusXs: { var: "--rh-radius-xs", isColor: false },
|
|
30
|
+
radiusSm: { var: "--rh-radius-sm", isColor: false },
|
|
31
|
+
radiusMd: { var: "--rh-radius-md", isColor: false },
|
|
32
|
+
radiusLg: { var: "--rh-radius-lg", isColor: false },
|
|
33
|
+
radiusXl: { var: "--rh-radius-xl", isColor: false },
|
|
34
|
+
borderWidthSm: { var: "--rh-border-width-sm", isColor: false },
|
|
35
|
+
borderWidthMd: { var: "--rh-border-width-md", isColor: false },
|
|
36
|
+
borderWidthLg: { var: "--rh-border-width-lg", isColor: false },
|
|
37
|
+
inputHeightSm: { var: "--rh-input-height-sm", isColor: false },
|
|
38
|
+
inputHeightMd: { var: "--rh-input-height-md", isColor: false },
|
|
39
|
+
inputHeightLg: { var: "--rh-input-height-lg", isColor: false },
|
|
40
|
+
inputPxSm: { var: "--rh-input-px-sm", isColor: false },
|
|
41
|
+
inputPxMd: { var: "--rh-input-px-md", isColor: false },
|
|
42
|
+
inputPxLg: { var: "--rh-input-px-lg", isColor: false }
|
|
43
|
+
};
|
|
44
|
+
var DeleteIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
45
|
+
"svg",
|
|
46
|
+
{
|
|
47
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
48
|
+
width: "1em",
|
|
49
|
+
height: "1em",
|
|
50
|
+
viewBox: "0 0 24 24",
|
|
51
|
+
fill: "none",
|
|
52
|
+
stroke: "currentColor",
|
|
53
|
+
strokeWidth: "2",
|
|
54
|
+
strokeLinecap: "round",
|
|
55
|
+
strokeLinejoin: "round",
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
...props,
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 6h18" }),
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
61
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" })
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
var EditIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
+
"svg",
|
|
67
|
+
{
|
|
68
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
69
|
+
width: "1em",
|
|
70
|
+
height: "1em",
|
|
71
|
+
viewBox: "0 0 24 24",
|
|
72
|
+
fill: "none",
|
|
73
|
+
stroke: "currentColor",
|
|
74
|
+
strokeWidth: "2",
|
|
75
|
+
strokeLinecap: "round",
|
|
76
|
+
strokeLinejoin: "round",
|
|
77
|
+
"aria-hidden": "true",
|
|
78
|
+
...props,
|
|
79
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z" })
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
var SearchIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
83
|
+
"svg",
|
|
84
|
+
{
|
|
85
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
86
|
+
width: "1em",
|
|
87
|
+
height: "1em",
|
|
88
|
+
viewBox: "0 0 24 24",
|
|
89
|
+
fill: "none",
|
|
90
|
+
stroke: "currentColor",
|
|
91
|
+
strokeWidth: "2",
|
|
92
|
+
strokeLinecap: "round",
|
|
93
|
+
strokeLinejoin: "round",
|
|
94
|
+
"aria-hidden": "true",
|
|
95
|
+
...props,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "8" }),
|
|
98
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "m21 21-4.3-4.3" })
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
var PlusIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
103
|
+
"svg",
|
|
104
|
+
{
|
|
105
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
106
|
+
width: "1em",
|
|
107
|
+
height: "1em",
|
|
108
|
+
viewBox: "0 0 24 24",
|
|
109
|
+
fill: "none",
|
|
110
|
+
stroke: "currentColor",
|
|
111
|
+
strokeWidth: "2",
|
|
112
|
+
strokeLinecap: "round",
|
|
113
|
+
strokeLinejoin: "round",
|
|
114
|
+
"aria-hidden": "true",
|
|
115
|
+
...props,
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 12h14" }),
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 5v14" })
|
|
119
|
+
]
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
var InfoIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
123
|
+
"svg",
|
|
124
|
+
{
|
|
125
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
126
|
+
width: "1em",
|
|
127
|
+
height: "1em",
|
|
128
|
+
viewBox: "0 0 20 20",
|
|
129
|
+
fill: "currentColor",
|
|
130
|
+
"aria-hidden": "true",
|
|
131
|
+
...props,
|
|
132
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
133
|
+
"path",
|
|
134
|
+
{
|
|
135
|
+
fillRule: "evenodd",
|
|
136
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
137
|
+
clipRule: "evenodd"
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
var WarningIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
143
|
+
"svg",
|
|
144
|
+
{
|
|
145
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
146
|
+
width: "1em",
|
|
147
|
+
height: "1em",
|
|
148
|
+
viewBox: "0 0 20 20",
|
|
149
|
+
fill: "currentColor",
|
|
150
|
+
"aria-hidden": "true",
|
|
151
|
+
...props,
|
|
152
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
153
|
+
"path",
|
|
154
|
+
{
|
|
155
|
+
fillRule: "evenodd",
|
|
156
|
+
d: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z",
|
|
157
|
+
clipRule: "evenodd"
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
var SuccessIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
163
|
+
"svg",
|
|
164
|
+
{
|
|
165
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
166
|
+
width: "1em",
|
|
167
|
+
height: "1em",
|
|
168
|
+
viewBox: "0 0 20 20",
|
|
169
|
+
fill: "currentColor",
|
|
170
|
+
"aria-hidden": "true",
|
|
171
|
+
...props,
|
|
172
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
173
|
+
"path",
|
|
174
|
+
{
|
|
175
|
+
fillRule: "evenodd",
|
|
176
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
177
|
+
clipRule: "evenodd"
|
|
178
|
+
}
|
|
179
|
+
)
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
var ErrorIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
183
|
+
"svg",
|
|
184
|
+
{
|
|
185
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
186
|
+
width: "1em",
|
|
187
|
+
height: "1em",
|
|
188
|
+
viewBox: "0 0 20 20",
|
|
189
|
+
fill: "currentColor",
|
|
190
|
+
"aria-hidden": "true",
|
|
191
|
+
...props,
|
|
192
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
193
|
+
"path",
|
|
194
|
+
{
|
|
195
|
+
fillRule: "evenodd",
|
|
196
|
+
d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z",
|
|
197
|
+
clipRule: "evenodd"
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
var NeutralIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
203
|
+
"svg",
|
|
204
|
+
{
|
|
205
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
206
|
+
width: "1em",
|
|
207
|
+
height: "1em",
|
|
208
|
+
viewBox: "0 0 20 20",
|
|
209
|
+
fill: "currentColor",
|
|
210
|
+
"aria-hidden": "true",
|
|
211
|
+
...props,
|
|
212
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
213
|
+
"path",
|
|
214
|
+
{
|
|
215
|
+
fillRule: "evenodd",
|
|
216
|
+
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3.75a.75.75 0 000 1.5h.01a.75.75 0 000-1.5H10zm-.75 3a.75.75 0 01.75-.75h.01a.75.75 0 01.75.75v3a.75.75 0 01-.75.75H10a.75.75 0 01-.75-.75v-3z",
|
|
217
|
+
clipRule: "evenodd"
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
var CloseIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
223
|
+
"svg",
|
|
224
|
+
{
|
|
225
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
226
|
+
width: "1em",
|
|
227
|
+
height: "1em",
|
|
228
|
+
viewBox: "0 0 20 20",
|
|
229
|
+
fill: "currentColor",
|
|
230
|
+
"aria-hidden": "true",
|
|
231
|
+
...props,
|
|
232
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" })
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
var variantIconMap = {
|
|
236
|
+
info: InfoIcon,
|
|
237
|
+
warning: WarningIcon,
|
|
238
|
+
success: SuccessIcon,
|
|
239
|
+
error: ErrorIcon,
|
|
240
|
+
neutral: NeutralIcon
|
|
241
|
+
};
|
|
242
|
+
var containerStyles = {
|
|
243
|
+
"info-solid": "rh-bg-blue-600 rh-text-white rh-border-transparent",
|
|
244
|
+
"info-light": "rh-bg-blue-50 rh-text-blue-900 rh-border-blue-200",
|
|
245
|
+
"info-outline": "rh-bg-surface rh-text-text rh-border-border",
|
|
246
|
+
"warning-solid": "rh-bg-yellow-500 rh-text-white rh-border-transparent",
|
|
247
|
+
"warning-light": "rh-bg-yellow-50 rh-text-yellow-900 rh-border-yellow-200",
|
|
248
|
+
"warning-outline": "rh-bg-surface rh-text-text rh-border-border",
|
|
249
|
+
"success-solid": "rh-bg-[rgb(var(--rh-success))] rh-text-white rh-border-transparent",
|
|
250
|
+
"success-light": "rh-bg-green-50 rh-text-green-900 rh-border-green-200",
|
|
251
|
+
"success-outline": "rh-bg-surface rh-text-text rh-border-border",
|
|
252
|
+
"error-solid": "rh-bg-[rgb(var(--rh-danger))] rh-text-white rh-border-transparent",
|
|
253
|
+
"error-light": "rh-bg-red-50 rh-text-red-900 rh-border-red-200",
|
|
254
|
+
"error-outline": "rh-bg-surface rh-text-text rh-border-border",
|
|
255
|
+
"neutral-solid": "rh-bg-gray-900 rh-text-white rh-border-transparent",
|
|
256
|
+
"neutral-light": "rh-bg-gray-100 rh-text-gray-900 rh-border-gray-200",
|
|
257
|
+
"neutral-outline": "rh-bg-surface rh-text-text rh-border-border"
|
|
258
|
+
};
|
|
259
|
+
var iconStyles = {
|
|
260
|
+
"info-solid": "rh-text-white",
|
|
261
|
+
"info-light": "rh-text-blue-600",
|
|
262
|
+
"info-outline": "rh-text-blue-600",
|
|
263
|
+
"warning-solid": "rh-text-white",
|
|
264
|
+
"warning-light": "rh-text-yellow-600",
|
|
265
|
+
"warning-outline": "rh-text-yellow-600",
|
|
266
|
+
"success-solid": "rh-text-white",
|
|
267
|
+
"success-light": "rh-text-green-600",
|
|
268
|
+
"success-outline": "rh-text-green-600",
|
|
269
|
+
"error-solid": "rh-text-white",
|
|
270
|
+
"error-light": "rh-text-red-600",
|
|
271
|
+
"error-outline": "rh-text-red-600",
|
|
272
|
+
"neutral-solid": "rh-text-white",
|
|
273
|
+
"neutral-light": "rh-text-gray-600",
|
|
274
|
+
"neutral-outline": "rh-text-gray-600"
|
|
275
|
+
};
|
|
276
|
+
var descriptionStyles = {
|
|
277
|
+
"info-solid": "rh-text-white/80",
|
|
278
|
+
"info-light": "rh-text-blue-700",
|
|
279
|
+
"info-outline": "rh-text-text-muted",
|
|
280
|
+
"warning-solid": "rh-text-white/80",
|
|
281
|
+
"warning-light": "rh-text-yellow-700",
|
|
282
|
+
"warning-outline": "rh-text-text-muted",
|
|
283
|
+
"success-solid": "rh-text-white/80",
|
|
284
|
+
"success-light": "rh-text-green-700",
|
|
285
|
+
"success-outline": "rh-text-text-muted",
|
|
286
|
+
"error-solid": "rh-text-white/80",
|
|
287
|
+
"error-light": "rh-text-red-700",
|
|
288
|
+
"error-outline": "rh-text-text-muted",
|
|
289
|
+
"neutral-solid": "rh-text-white/80",
|
|
290
|
+
"neutral-light": "rh-text-gray-700",
|
|
291
|
+
"neutral-outline": "rh-text-text-muted"
|
|
292
|
+
};
|
|
293
|
+
var linkStyles = {
|
|
294
|
+
"info-solid": "rh-text-white rh-underline hover:rh-text-white/80",
|
|
295
|
+
"info-light": "rh-text-blue-700 rh-underline hover:rh-text-blue-900",
|
|
296
|
+
"info-outline": "rh-text-blue-600 rh-underline hover:rh-text-blue-800",
|
|
297
|
+
"warning-solid": "rh-text-white rh-underline hover:rh-text-white/80",
|
|
298
|
+
"warning-light": "rh-text-yellow-700 rh-underline hover:rh-text-yellow-900",
|
|
299
|
+
"warning-outline": "rh-text-yellow-600 rh-underline hover:rh-text-yellow-800",
|
|
300
|
+
"success-solid": "rh-text-white rh-underline hover:rh-text-white/80",
|
|
301
|
+
"success-light": "rh-text-green-700 rh-underline hover:rh-text-green-900",
|
|
302
|
+
"success-outline": "rh-text-green-600 rh-underline hover:rh-text-green-800",
|
|
303
|
+
"error-solid": "rh-text-white rh-underline hover:rh-text-white/80",
|
|
304
|
+
"error-light": "rh-text-red-700 rh-underline hover:rh-text-red-900",
|
|
305
|
+
"error-outline": "rh-text-red-600 rh-underline hover:rh-text-red-800",
|
|
306
|
+
"neutral-solid": "rh-text-white rh-underline hover:rh-text-white/80",
|
|
307
|
+
"neutral-light": "rh-text-gray-700 rh-underline hover:rh-text-gray-900",
|
|
308
|
+
"neutral-outline": "rh-text-gray-600 rh-underline hover:rh-text-gray-800"
|
|
309
|
+
};
|
|
310
|
+
var closeStyles = {
|
|
311
|
+
"info-solid": "rh-text-white/80 hover:rh-text-white",
|
|
312
|
+
"info-light": "rh-text-blue-500 hover:rh-text-blue-800",
|
|
313
|
+
"info-outline": "rh-text-text-muted hover:rh-text-text",
|
|
314
|
+
"warning-solid": "rh-text-white/80 hover:rh-text-white",
|
|
315
|
+
"warning-light": "rh-text-yellow-500 hover:rh-text-yellow-800",
|
|
316
|
+
"warning-outline": "rh-text-text-muted hover:rh-text-text",
|
|
317
|
+
"success-solid": "rh-text-white/80 hover:rh-text-white",
|
|
318
|
+
"success-light": "rh-text-green-500 hover:rh-text-green-800",
|
|
319
|
+
"success-outline": "rh-text-text-muted hover:rh-text-text",
|
|
320
|
+
"error-solid": "rh-text-white/80 hover:rh-text-white",
|
|
321
|
+
"error-light": "rh-text-red-500 hover:rh-text-red-800",
|
|
322
|
+
"error-outline": "rh-text-text-muted hover:rh-text-text",
|
|
323
|
+
"neutral-solid": "rh-text-white/80 hover:rh-text-white",
|
|
324
|
+
"neutral-light": "rh-text-gray-500 hover:rh-text-gray-800",
|
|
325
|
+
"neutral-outline": "rh-text-text-muted hover:rh-text-text"
|
|
326
|
+
};
|
|
327
|
+
var Toast = React8.forwardRef(function Toast2({
|
|
328
|
+
title,
|
|
329
|
+
description,
|
|
330
|
+
link,
|
|
331
|
+
variant = "info",
|
|
332
|
+
appearance = "light",
|
|
333
|
+
onClose,
|
|
334
|
+
className = "",
|
|
335
|
+
...rest
|
|
336
|
+
}, ref) {
|
|
337
|
+
const styleKey = `${variant}-${appearance}`;
|
|
338
|
+
const Icon = variantIconMap[variant];
|
|
339
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
340
|
+
"div",
|
|
341
|
+
{
|
|
342
|
+
ref,
|
|
343
|
+
role: "alert",
|
|
344
|
+
"aria-live": "assertive",
|
|
345
|
+
"aria-atomic": "true",
|
|
346
|
+
className: [
|
|
347
|
+
"rh-flex rh-items-start rh-gap-3",
|
|
348
|
+
"rh-w-80 rh-rounded-sm rh-border rh-p-4",
|
|
349
|
+
"rh-shadow-md rh-font-sans",
|
|
350
|
+
containerStyles[styleKey],
|
|
351
|
+
className
|
|
352
|
+
].filter(Boolean).join(" "),
|
|
353
|
+
...rest,
|
|
354
|
+
children: [
|
|
355
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-flex-shrink-0 rh-mt-0.5", "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
356
|
+
Icon,
|
|
357
|
+
{
|
|
358
|
+
className: ["rh-w-5 rh-h-5", iconStyles[styleKey]].filter(Boolean).join(" ")
|
|
359
|
+
}
|
|
360
|
+
) }),
|
|
361
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex-1 rh-min-w-0", children: [
|
|
362
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "rh-text-sm rh-font-semibold rh-leading-tight", children: title }),
|
|
363
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
364
|
+
"p",
|
|
365
|
+
{
|
|
366
|
+
className: [
|
|
367
|
+
"rh-mt-1 rh-text-sm rh-leading-normal",
|
|
368
|
+
descriptionStyles[styleKey]
|
|
369
|
+
].filter(Boolean).join(" "),
|
|
370
|
+
children: description
|
|
371
|
+
}
|
|
372
|
+
),
|
|
373
|
+
link && /* @__PURE__ */ jsxRuntime.jsx(
|
|
374
|
+
"a",
|
|
375
|
+
{
|
|
376
|
+
href: link.href,
|
|
377
|
+
onClick: link.onClick,
|
|
378
|
+
className: [
|
|
379
|
+
"rh-mt-1 rh-inline-block rh-text-sm rh-font-medium",
|
|
380
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring focus-visible:rh-ring-offset-1 rh-rounded-xxs",
|
|
381
|
+
linkStyles[styleKey]
|
|
382
|
+
].filter(Boolean).join(" "),
|
|
383
|
+
children: link.label
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
] }),
|
|
387
|
+
onClose && /* @__PURE__ */ jsxRuntime.jsx(
|
|
388
|
+
"button",
|
|
389
|
+
{
|
|
390
|
+
type: "button",
|
|
391
|
+
"aria-label": "Close notification",
|
|
392
|
+
onClick: onClose,
|
|
393
|
+
className: [
|
|
394
|
+
"rh-flex-shrink-0 rh-p-0.5 rh-rounded-xxs",
|
|
395
|
+
"rh-transition-colors rh-duration-150",
|
|
396
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring focus-visible:rh-ring-offset-1",
|
|
397
|
+
closeStyles[styleKey]
|
|
398
|
+
].filter(Boolean).join(" "),
|
|
399
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, { className: "rh-w-4 rh-h-4" })
|
|
400
|
+
}
|
|
401
|
+
)
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
);
|
|
405
|
+
});
|
|
406
|
+
var positionAnimDir = {
|
|
407
|
+
"top-right": "right",
|
|
408
|
+
"bottom-right": "right",
|
|
409
|
+
"top-left": "left",
|
|
410
|
+
"bottom-left": "left",
|
|
411
|
+
"top-center": "top",
|
|
412
|
+
"bottom-center": "bottom"
|
|
413
|
+
};
|
|
414
|
+
var enterClass = {
|
|
415
|
+
right: "rh-animate-toast-in-right",
|
|
416
|
+
left: "rh-animate-toast-in-left",
|
|
417
|
+
top: "rh-animate-toast-in-top",
|
|
418
|
+
bottom: "rh-animate-toast-in-bottom"
|
|
419
|
+
};
|
|
420
|
+
var leaveClass = {
|
|
421
|
+
right: "rh-animate-toast-out-right",
|
|
422
|
+
left: "rh-animate-toast-out-left",
|
|
423
|
+
top: "rh-animate-toast-out-top",
|
|
424
|
+
bottom: "rh-animate-toast-out-bottom"
|
|
425
|
+
};
|
|
426
|
+
var positionClasses = {
|
|
427
|
+
"top-right": "rh-top-4 rh-right-4 rh-items-end",
|
|
428
|
+
"top-left": "rh-top-4 rh-left-4 rh-items-start",
|
|
429
|
+
"top-center": "rh-top-4 rh-left-1/2 rh--translate-x-1/2 rh-items-center",
|
|
430
|
+
"bottom-right": "rh-bottom-4 rh-right-4 rh-items-end",
|
|
431
|
+
"bottom-left": "rh-bottom-4 rh-left-4 rh-items-start",
|
|
432
|
+
"bottom-center": "rh-bottom-4 rh-left-1/2 rh--translate-x-1/2 rh-items-center"
|
|
433
|
+
};
|
|
434
|
+
var LEAVE_DURATION_MS = 200;
|
|
435
|
+
function AnimatedToastItem({
|
|
436
|
+
id,
|
|
437
|
+
animDir,
|
|
438
|
+
isDismissing,
|
|
439
|
+
onRemove,
|
|
440
|
+
onRequestDismiss,
|
|
441
|
+
children
|
|
442
|
+
}) {
|
|
443
|
+
const [entered, setEntered] = React8.useState(false);
|
|
444
|
+
const leaveTimerRef = React8.useRef(null);
|
|
445
|
+
React8.useEffect(() => {
|
|
446
|
+
if (!isDismissing) return;
|
|
447
|
+
leaveTimerRef.current = setTimeout(() => {
|
|
448
|
+
onRemove(id);
|
|
449
|
+
}, LEAVE_DURATION_MS);
|
|
450
|
+
return () => {
|
|
451
|
+
if (leaveTimerRef.current) clearTimeout(leaveTimerRef.current);
|
|
452
|
+
};
|
|
453
|
+
}, [id, isDismissing, onRemove]);
|
|
454
|
+
const handleAnimationEnd = React8.useCallback(() => {
|
|
455
|
+
if (!entered) setEntered(true);
|
|
456
|
+
}, [entered]);
|
|
457
|
+
const handleClose = React8.useCallback(() => {
|
|
458
|
+
onRequestDismiss(id);
|
|
459
|
+
}, [id, onRequestDismiss]);
|
|
460
|
+
const animClass = isDismissing ? leaveClass[animDir] : entered ? "" : enterClass[animDir];
|
|
461
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: animClass, onAnimationEnd: handleAnimationEnd, children: children(handleClose) });
|
|
462
|
+
}
|
|
463
|
+
function ToastContainer() {
|
|
464
|
+
const { toasts, dismissingIds, position, requestDismiss, remove } = useToastContext();
|
|
465
|
+
const animDir = positionAnimDir[position];
|
|
466
|
+
if (toasts.length === 0) return null;
|
|
467
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
468
|
+
"div",
|
|
469
|
+
{
|
|
470
|
+
"aria-label": "Notifications",
|
|
471
|
+
"aria-live": "polite",
|
|
472
|
+
className: [
|
|
473
|
+
"rh-fixed rh-z-[9999]",
|
|
474
|
+
"rh-flex rh-flex-col rh-gap-3",
|
|
475
|
+
"rh-pointer-events-none",
|
|
476
|
+
positionClasses[position]
|
|
477
|
+
].filter(Boolean).join(" "),
|
|
478
|
+
children: toasts.map((toast) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
479
|
+
AnimatedToastItem,
|
|
480
|
+
{
|
|
481
|
+
id: toast.id,
|
|
482
|
+
animDir,
|
|
483
|
+
isDismissing: dismissingIds.has(toast.id),
|
|
484
|
+
onRemove: remove,
|
|
485
|
+
onRequestDismiss: requestDismiss,
|
|
486
|
+
children: (onClose) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-pointer-events-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
487
|
+
Toast,
|
|
488
|
+
{
|
|
489
|
+
title: toast.title,
|
|
490
|
+
description: toast.description,
|
|
491
|
+
link: toast.link,
|
|
492
|
+
variant: toast.variant,
|
|
493
|
+
appearance: toast.appearance,
|
|
494
|
+
onClose
|
|
495
|
+
}
|
|
496
|
+
) })
|
|
497
|
+
},
|
|
498
|
+
toast.id
|
|
499
|
+
))
|
|
500
|
+
}
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
var ToastContext = React8.createContext(null);
|
|
504
|
+
function ToastProvider({
|
|
505
|
+
children,
|
|
506
|
+
position = "top-right"
|
|
507
|
+
}) {
|
|
508
|
+
const [toasts, setToasts] = React8.useState([]);
|
|
509
|
+
const [dismissingIds, setDismissingIds] = React8.useState(/* @__PURE__ */ new Set());
|
|
510
|
+
const counterRef = React8.useRef(0);
|
|
511
|
+
const remove = React8.useCallback((id) => {
|
|
512
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
513
|
+
setDismissingIds((prev) => {
|
|
514
|
+
const next = new Set(prev);
|
|
515
|
+
next.delete(id);
|
|
516
|
+
return next;
|
|
517
|
+
});
|
|
518
|
+
}, []);
|
|
519
|
+
const requestDismiss = React8.useCallback((id) => {
|
|
520
|
+
setDismissingIds((prev) => new Set(prev).add(id));
|
|
521
|
+
}, []);
|
|
522
|
+
const add = React8.useCallback(
|
|
523
|
+
(item) => {
|
|
524
|
+
const id = `rh-toast-${++counterRef.current}`;
|
|
525
|
+
const toast = { ...item, id };
|
|
526
|
+
setToasts((prev) => [...prev, toast]);
|
|
527
|
+
if (toast.duration > 0) {
|
|
528
|
+
setTimeout(() => requestDismiss(id), toast.duration);
|
|
529
|
+
}
|
|
530
|
+
return id;
|
|
531
|
+
},
|
|
532
|
+
[requestDismiss]
|
|
533
|
+
);
|
|
534
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ToastContext.Provider, { value: { toasts, dismissingIds, position, add, requestDismiss, remove }, children: [
|
|
535
|
+
children,
|
|
536
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToastContainer, {})
|
|
537
|
+
] });
|
|
538
|
+
}
|
|
539
|
+
function useToastContext() {
|
|
540
|
+
const ctx = React8.useContext(ToastContext);
|
|
541
|
+
if (!ctx) {
|
|
542
|
+
throw new Error("useToastContext must be used inside ToastProvider");
|
|
543
|
+
}
|
|
544
|
+
return ctx;
|
|
545
|
+
}
|
|
546
|
+
function useToast() {
|
|
547
|
+
const { add, requestDismiss } = useToastContext();
|
|
548
|
+
const createToast = React8.useCallback(
|
|
549
|
+
(variant) => (title, options = {}) => {
|
|
550
|
+
return add({
|
|
551
|
+
title,
|
|
552
|
+
variant,
|
|
553
|
+
description: options.description,
|
|
554
|
+
link: options.link,
|
|
555
|
+
appearance: options.appearance ?? "light",
|
|
556
|
+
duration: options.duration ?? 5e3
|
|
557
|
+
});
|
|
558
|
+
},
|
|
559
|
+
[add]
|
|
560
|
+
);
|
|
561
|
+
const toast = React8.useCallback(
|
|
562
|
+
(title, options = {}) => {
|
|
563
|
+
return add({
|
|
564
|
+
title,
|
|
565
|
+
variant: options.variant ?? "info",
|
|
566
|
+
description: options.description,
|
|
567
|
+
link: options.link,
|
|
568
|
+
appearance: options.appearance ?? "light",
|
|
569
|
+
duration: options.duration ?? 5e3
|
|
570
|
+
});
|
|
571
|
+
},
|
|
572
|
+
[add]
|
|
573
|
+
);
|
|
574
|
+
toast.info = createToast("info");
|
|
575
|
+
toast.warning = createToast("warning");
|
|
576
|
+
toast.success = createToast("success");
|
|
577
|
+
toast.error = createToast("error");
|
|
578
|
+
toast.neutral = createToast("neutral");
|
|
579
|
+
toast.dismiss = requestDismiss;
|
|
580
|
+
return { toast };
|
|
581
|
+
}
|
|
582
|
+
function hexToRgbTriplet(hex) {
|
|
583
|
+
const h = hex.replace("#", "").trim();
|
|
584
|
+
if (![3, 6].includes(h.length)) return null;
|
|
585
|
+
const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
|
|
586
|
+
const r = parseInt(full.slice(0, 2), 16);
|
|
587
|
+
const g = parseInt(full.slice(2, 4), 16);
|
|
588
|
+
const b = parseInt(full.slice(4, 6), 16);
|
|
589
|
+
if ([r, g, b].some(Number.isNaN)) return null;
|
|
590
|
+
return `${r} ${g} ${b}`;
|
|
591
|
+
}
|
|
592
|
+
function toRgbTriplet(value) {
|
|
593
|
+
if (!value) return void 0;
|
|
594
|
+
if (value.startsWith("#")) return hexToRgbTriplet(value) ?? void 0;
|
|
595
|
+
const m = value.match(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i);
|
|
596
|
+
if (m) return `${m[1]} ${m[2]} ${m[3]}`;
|
|
597
|
+
const parts = value.trim().split(/\s+/);
|
|
598
|
+
if (parts.length === 3 && parts.every((p) => !Number.isNaN(Number(p)))) {
|
|
599
|
+
return value.trim();
|
|
600
|
+
}
|
|
601
|
+
return void 0;
|
|
602
|
+
}
|
|
603
|
+
function RehagroProvider({ theme, toastPosition, children }) {
|
|
604
|
+
const style = React8.useMemo(() => {
|
|
605
|
+
if (!theme) return void 0;
|
|
606
|
+
const vars = {};
|
|
607
|
+
for (const [key, config] of Object.entries(TOKEN_MAP)) {
|
|
608
|
+
const value = theme[key];
|
|
609
|
+
if (!value) continue;
|
|
610
|
+
if (config.isColor) {
|
|
611
|
+
const triplet = toRgbTriplet(value);
|
|
612
|
+
if (triplet) vars[config.var] = triplet;
|
|
613
|
+
} else {
|
|
614
|
+
vars[config.var] = value;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return vars;
|
|
618
|
+
}, [theme]);
|
|
619
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rh-root", style, children: /* @__PURE__ */ jsxRuntime.jsx(ToastProvider, { position: toastPosition, children }) });
|
|
620
|
+
}
|
|
621
|
+
var variantClasses = {
|
|
622
|
+
solid: "rh-bg-primary rh-text-surface rh-border-primary hover:rh-bg-primary-hover hover:rh-border-primary-hover",
|
|
623
|
+
outline: "rh-bg-transparent rh-text-primary rh-border-primary hover:rh-bg-primary hover:rh-text-surface",
|
|
624
|
+
ghost: "rh-bg-transparent rh-text-primary rh-border-transparent hover:rh-bg-primary/10"
|
|
625
|
+
};
|
|
626
|
+
var sizeClasses = {
|
|
627
|
+
sm: "rh-text-sm rh-px-3 rh-py-1.5",
|
|
628
|
+
md: "rh-text-sm rh-px-4 rh-py-2",
|
|
629
|
+
lg: "rh-text-base rh-px-5 rh-py-2.5"
|
|
630
|
+
};
|
|
631
|
+
var radiusClasses = {
|
|
632
|
+
none: "rh-rounded-none",
|
|
633
|
+
xxs: "rh-rounded-xxs",
|
|
634
|
+
xs: "rh-rounded-xs",
|
|
635
|
+
sm: "rh-rounded-sm",
|
|
636
|
+
md: "rh-rounded-md",
|
|
637
|
+
lg: "rh-rounded-lg",
|
|
638
|
+
xl: "rh-rounded-xl",
|
|
639
|
+
full: "rh-rounded-full"
|
|
640
|
+
};
|
|
641
|
+
var Button = React8.forwardRef(function Button2({
|
|
642
|
+
variant = "solid",
|
|
643
|
+
size = "md",
|
|
644
|
+
radius = "sm",
|
|
645
|
+
loading = false,
|
|
646
|
+
disabled,
|
|
647
|
+
leftIcon,
|
|
648
|
+
rightIcon,
|
|
649
|
+
className = "",
|
|
650
|
+
children,
|
|
651
|
+
...rest
|
|
652
|
+
}, ref) {
|
|
653
|
+
const isDisabled = React8__default.default.useMemo(() => disabled || loading, [disabled, loading]);
|
|
654
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
655
|
+
"button",
|
|
656
|
+
{
|
|
657
|
+
ref,
|
|
658
|
+
disabled: isDisabled,
|
|
659
|
+
"aria-busy": loading || void 0,
|
|
660
|
+
className: [
|
|
661
|
+
"rh-inline-flex rh-items-center rh-justify-center rh-gap-2",
|
|
662
|
+
"rh-border rh-font-sans rh-font-medium",
|
|
663
|
+
"rh-transition-colors rh-duration-150",
|
|
664
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring focus-visible:rh-ring-offset-2",
|
|
665
|
+
variantClasses[variant],
|
|
666
|
+
sizeClasses[size],
|
|
667
|
+
radiusClasses[radius],
|
|
668
|
+
isDisabled ? "rh-opacity-50 rh-cursor-not-allowed rh-pointer-events-none" : "",
|
|
669
|
+
className
|
|
670
|
+
].filter(Boolean).join(" "),
|
|
671
|
+
...rest,
|
|
672
|
+
children: [
|
|
673
|
+
loading && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
674
|
+
"svg",
|
|
675
|
+
{
|
|
676
|
+
className: "rh-animate-spin rh-h-4 rh-w-4",
|
|
677
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
678
|
+
fill: "none",
|
|
679
|
+
viewBox: "0 0 24 24",
|
|
680
|
+
"aria-hidden": "true",
|
|
681
|
+
children: [
|
|
682
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
683
|
+
"circle",
|
|
684
|
+
{
|
|
685
|
+
className: "rh-opacity-25",
|
|
686
|
+
cx: "12",
|
|
687
|
+
cy: "12",
|
|
688
|
+
r: "10",
|
|
689
|
+
stroke: "currentColor",
|
|
690
|
+
strokeWidth: "4"
|
|
691
|
+
}
|
|
692
|
+
),
|
|
693
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
694
|
+
"path",
|
|
695
|
+
{
|
|
696
|
+
className: "rh-opacity-75",
|
|
697
|
+
fill: "currentColor",
|
|
698
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
699
|
+
}
|
|
700
|
+
)
|
|
701
|
+
]
|
|
702
|
+
}
|
|
703
|
+
),
|
|
704
|
+
!loading && leftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-inline-flex rh-shrink-0", "aria-hidden": "true", children: leftIcon }),
|
|
705
|
+
children,
|
|
706
|
+
!loading && rightIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-inline-flex rh-shrink-0", "aria-hidden": "true", children: rightIcon })
|
|
707
|
+
]
|
|
708
|
+
}
|
|
709
|
+
);
|
|
710
|
+
});
|
|
711
|
+
var variantColorClasses = {
|
|
712
|
+
solid: {
|
|
713
|
+
primary: "rh-bg-primary rh-text-surface rh-border-primary hover:rh-bg-primary-hover hover:rh-border-primary-hover",
|
|
714
|
+
danger: "rh-bg-danger rh-text-surface rh-border-danger hover:rh-bg-danger-hover hover:rh-border-danger-hover",
|
|
715
|
+
warning: "rh-bg-warning rh-text-surface rh-border-warning hover:rh-bg-warning-hover hover:rh-border-warning-hover",
|
|
716
|
+
success: "rh-bg-success rh-text-surface rh-border-success hover:rh-bg-success-hover hover:rh-border-success-hover",
|
|
717
|
+
secondary: "rh-bg-secondary rh-text-surface rh-border-secondary hover:rh-bg-secondary-hover hover:rh-border-secondary-hover"
|
|
718
|
+
},
|
|
719
|
+
outline: {
|
|
720
|
+
primary: "rh-bg-transparent rh-text-primary rh-border-primary hover:rh-bg-primary hover:rh-text-surface",
|
|
721
|
+
danger: "rh-bg-transparent rh-text-danger rh-border-danger hover:rh-bg-danger hover:rh-text-surface",
|
|
722
|
+
warning: "rh-bg-transparent rh-text-warning rh-border-warning hover:rh-bg-warning hover:rh-text-surface",
|
|
723
|
+
success: "rh-bg-transparent rh-text-success rh-border-success hover:rh-bg-success hover:rh-text-surface",
|
|
724
|
+
secondary: "rh-bg-transparent rh-text-secondary rh-border-secondary hover:rh-bg-secondary hover:rh-text-surface"
|
|
725
|
+
},
|
|
726
|
+
ghost: {
|
|
727
|
+
primary: "rh-bg-transparent rh-text-primary rh-border-transparent hover:rh-bg-primary/10",
|
|
728
|
+
danger: "rh-bg-transparent rh-text-danger rh-border-transparent hover:rh-bg-danger/10",
|
|
729
|
+
warning: "rh-bg-transparent rh-text-warning rh-border-transparent hover:rh-bg-warning/10",
|
|
730
|
+
success: "rh-bg-transparent rh-text-success rh-border-transparent hover:rh-bg-success/10",
|
|
731
|
+
secondary: "rh-bg-transparent rh-text-secondary rh-border-transparent hover:rh-bg-secondary/10"
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
var sizeClasses2 = {
|
|
735
|
+
sm: "rh-h-8 rh-w-8 rh-text-sm",
|
|
736
|
+
md: "rh-h-10 rh-w-10 rh-text-base",
|
|
737
|
+
lg: "rh-h-12 rh-w-12 rh-text-lg"
|
|
738
|
+
};
|
|
739
|
+
var radiusClasses2 = {
|
|
740
|
+
none: "rh-rounded-none",
|
|
741
|
+
xxs: "rh-rounded-xxs",
|
|
742
|
+
xs: "rh-rounded-xs",
|
|
743
|
+
sm: "rh-rounded-sm",
|
|
744
|
+
md: "rh-rounded-md",
|
|
745
|
+
lg: "rh-rounded-lg",
|
|
746
|
+
xl: "rh-rounded-xl",
|
|
747
|
+
full: "rh-rounded-full"
|
|
748
|
+
};
|
|
749
|
+
var IconButton = React8.forwardRef(function IconButton2({
|
|
750
|
+
variant = "ghost",
|
|
751
|
+
size = "md",
|
|
752
|
+
radius = "full",
|
|
753
|
+
color = "primary",
|
|
754
|
+
loading = false,
|
|
755
|
+
disabled,
|
|
756
|
+
className = "",
|
|
757
|
+
children,
|
|
758
|
+
...rest
|
|
759
|
+
}, ref) {
|
|
760
|
+
const isDisabled = disabled || loading;
|
|
761
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
762
|
+
"button",
|
|
763
|
+
{
|
|
764
|
+
ref,
|
|
765
|
+
disabled: isDisabled,
|
|
766
|
+
"aria-busy": loading || void 0,
|
|
767
|
+
className: [
|
|
768
|
+
"rh-inline-flex rh-items-center rh-justify-center",
|
|
769
|
+
"rh-border rh-font-sans",
|
|
770
|
+
"rh-transition-colors rh-duration-150",
|
|
771
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring focus-visible:rh-ring-offset-2",
|
|
772
|
+
variantColorClasses[variant][color],
|
|
773
|
+
sizeClasses2[size],
|
|
774
|
+
radiusClasses2[radius],
|
|
775
|
+
isDisabled ? "rh-opacity-50 rh-cursor-not-allowed rh-pointer-events-none" : "",
|
|
776
|
+
className
|
|
777
|
+
].filter(Boolean).join(" "),
|
|
778
|
+
...rest,
|
|
779
|
+
children: loading ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
780
|
+
"svg",
|
|
781
|
+
{
|
|
782
|
+
className: "rh-animate-spin rh-h-4 rh-w-4",
|
|
783
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
784
|
+
fill: "none",
|
|
785
|
+
viewBox: "0 0 24 24",
|
|
786
|
+
"aria-hidden": "true",
|
|
787
|
+
children: [
|
|
788
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
789
|
+
"circle",
|
|
790
|
+
{
|
|
791
|
+
className: "rh-opacity-25",
|
|
792
|
+
cx: "12",
|
|
793
|
+
cy: "12",
|
|
794
|
+
r: "10",
|
|
795
|
+
stroke: "currentColor",
|
|
796
|
+
strokeWidth: "4"
|
|
797
|
+
}
|
|
798
|
+
),
|
|
799
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
800
|
+
"path",
|
|
801
|
+
{
|
|
802
|
+
className: "rh-opacity-75",
|
|
803
|
+
fill: "currentColor",
|
|
804
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
805
|
+
}
|
|
806
|
+
)
|
|
807
|
+
]
|
|
808
|
+
}
|
|
809
|
+
) : children
|
|
810
|
+
}
|
|
811
|
+
);
|
|
812
|
+
});
|
|
813
|
+
var statusClasses = {
|
|
814
|
+
default: "rh-border-border focus-within:rh-ring-2 focus-within:rh-ring-ring focus-within:rh-ring-offset-2",
|
|
815
|
+
error: "rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-danger focus-within:rh-ring-offset-2"
|
|
816
|
+
};
|
|
817
|
+
var sizeClasses3 = {
|
|
818
|
+
sm: "rh-h-input-sm rh-text-sm rh-px-input-x-sm",
|
|
819
|
+
md: "rh-h-input-md rh-text-sm rh-px-input-x-md",
|
|
820
|
+
lg: "rh-h-input-lg rh-text-base rh-px-input-x-lg"
|
|
821
|
+
};
|
|
822
|
+
var radiusClasses3 = {
|
|
823
|
+
none: "rh-rounded-none",
|
|
824
|
+
xxs: "rh-rounded-xxs",
|
|
825
|
+
xs: "rh-rounded-xs",
|
|
826
|
+
sm: "rh-rounded-sm",
|
|
827
|
+
md: "rh-rounded-md",
|
|
828
|
+
lg: "rh-rounded-lg",
|
|
829
|
+
xl: "rh-rounded-xl",
|
|
830
|
+
full: "rh-rounded-full"
|
|
831
|
+
};
|
|
832
|
+
var iconSizeClasses = {
|
|
833
|
+
sm: "rh-w-4 rh-h-4",
|
|
834
|
+
md: "rh-w-5 rh-h-5",
|
|
835
|
+
lg: "rh-w-5 rh-h-5"
|
|
836
|
+
};
|
|
837
|
+
var helperStatusClasses = {
|
|
838
|
+
default: "rh-text-text-muted",
|
|
839
|
+
error: "rh-text-danger"
|
|
840
|
+
};
|
|
841
|
+
var TextInput = React8.forwardRef(
|
|
842
|
+
function TextInput2({
|
|
843
|
+
label,
|
|
844
|
+
subtitle,
|
|
845
|
+
status = "default",
|
|
846
|
+
size = "md",
|
|
847
|
+
radius = "xs",
|
|
848
|
+
leftIcon,
|
|
849
|
+
rightIcon,
|
|
850
|
+
helperText,
|
|
851
|
+
disabled,
|
|
852
|
+
className = "",
|
|
853
|
+
wrapperClassName = "",
|
|
854
|
+
id,
|
|
855
|
+
...rest
|
|
856
|
+
}, ref) {
|
|
857
|
+
const inputId = id || React8__default.default.useId();
|
|
858
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
859
|
+
"div",
|
|
860
|
+
{
|
|
861
|
+
className: [
|
|
862
|
+
"rh-flex rh-flex-col rh-gap-1 rh-font-sans",
|
|
863
|
+
wrapperClassName
|
|
864
|
+
].filter(Boolean).join(" "),
|
|
865
|
+
children: [
|
|
866
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
867
|
+
"label",
|
|
868
|
+
{
|
|
869
|
+
htmlFor: inputId,
|
|
870
|
+
className: "rh-flex rh-items-baseline rh-gap-1",
|
|
871
|
+
children: [
|
|
872
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: label }),
|
|
873
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-text-text-muted", children: subtitle })
|
|
874
|
+
]
|
|
875
|
+
}
|
|
876
|
+
),
|
|
877
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
878
|
+
"div",
|
|
879
|
+
{
|
|
880
|
+
className: [
|
|
881
|
+
"rh-flex rh-items-center rh-gap-2",
|
|
882
|
+
"rh-border rh-bg-surface rh-font-sans",
|
|
883
|
+
"rh-transition-colors rh-duration-150",
|
|
884
|
+
statusClasses[status],
|
|
885
|
+
radiusClasses3[radius],
|
|
886
|
+
sizeClasses3[size],
|
|
887
|
+
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "",
|
|
888
|
+
className
|
|
889
|
+
].filter(Boolean).join(" "),
|
|
890
|
+
children: [
|
|
891
|
+
leftIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
892
|
+
"span",
|
|
893
|
+
{
|
|
894
|
+
className: [
|
|
895
|
+
"rh-inline-flex rh-shrink-0 rh-text-text-muted",
|
|
896
|
+
iconSizeClasses[size]
|
|
897
|
+
].join(" "),
|
|
898
|
+
"aria-hidden": "true",
|
|
899
|
+
children: leftIcon
|
|
900
|
+
}
|
|
901
|
+
),
|
|
902
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
903
|
+
"input",
|
|
904
|
+
{
|
|
905
|
+
ref,
|
|
906
|
+
id: inputId,
|
|
907
|
+
disabled,
|
|
908
|
+
"aria-invalid": status === "error" || void 0,
|
|
909
|
+
"aria-describedby": helperText ? `${inputId}-helper` : void 0,
|
|
910
|
+
className: [
|
|
911
|
+
"rh-flex-1 rh-bg-transparent rh-outline-none",
|
|
912
|
+
"rh-text-text placeholder:rh-text-text-muted",
|
|
913
|
+
disabled ? "rh-cursor-not-allowed" : ""
|
|
914
|
+
].filter(Boolean).join(" "),
|
|
915
|
+
...rest
|
|
916
|
+
}
|
|
917
|
+
),
|
|
918
|
+
rightIcon && /* @__PURE__ */ jsxRuntime.jsx(
|
|
919
|
+
"span",
|
|
920
|
+
{
|
|
921
|
+
className: [
|
|
922
|
+
"rh-inline-flex rh-shrink-0 rh-text-text-muted",
|
|
923
|
+
iconSizeClasses[size]
|
|
924
|
+
].join(" "),
|
|
925
|
+
"aria-hidden": "true",
|
|
926
|
+
children: rightIcon
|
|
927
|
+
}
|
|
928
|
+
)
|
|
929
|
+
]
|
|
930
|
+
}
|
|
931
|
+
),
|
|
932
|
+
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
933
|
+
"span",
|
|
934
|
+
{
|
|
935
|
+
id: `${inputId}-helper`,
|
|
936
|
+
className: [
|
|
937
|
+
"rh-flex rh-items-center rh-gap-1 rh-text-xs",
|
|
938
|
+
helperStatusClasses[status]
|
|
939
|
+
].join(" "),
|
|
940
|
+
children: helperText
|
|
941
|
+
}
|
|
942
|
+
)
|
|
943
|
+
]
|
|
944
|
+
}
|
|
945
|
+
);
|
|
946
|
+
}
|
|
947
|
+
);
|
|
948
|
+
var sizeClasses4 = {
|
|
949
|
+
sm: "rh-h-4 rh-w-4",
|
|
950
|
+
md: "rh-h-5 rh-w-5",
|
|
951
|
+
lg: "rh-h-6 rh-w-6"
|
|
952
|
+
};
|
|
953
|
+
var iconSizeClasses2 = {
|
|
954
|
+
sm: "rh-h-3 rh-w-3",
|
|
955
|
+
md: "rh-h-3.5 rh-w-3.5",
|
|
956
|
+
lg: "rh-h-4 rh-w-4"
|
|
957
|
+
};
|
|
958
|
+
var labelSizeClasses = {
|
|
959
|
+
sm: "rh-text-sm",
|
|
960
|
+
md: "rh-text-sm",
|
|
961
|
+
lg: "rh-text-base"
|
|
962
|
+
};
|
|
963
|
+
var CheckIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
964
|
+
"svg",
|
|
965
|
+
{
|
|
966
|
+
className,
|
|
967
|
+
viewBox: "0 0 12 10",
|
|
968
|
+
fill: "none",
|
|
969
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
970
|
+
"aria-hidden": "true",
|
|
971
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
972
|
+
"path",
|
|
973
|
+
{
|
|
974
|
+
d: "M1 5.5L4 8.5L11 1.5",
|
|
975
|
+
stroke: "currentColor",
|
|
976
|
+
strokeWidth: "2",
|
|
977
|
+
strokeLinecap: "round",
|
|
978
|
+
strokeLinejoin: "round"
|
|
979
|
+
}
|
|
980
|
+
)
|
|
981
|
+
}
|
|
982
|
+
);
|
|
983
|
+
var MinusIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
984
|
+
"svg",
|
|
985
|
+
{
|
|
986
|
+
className,
|
|
987
|
+
viewBox: "0 0 10 2",
|
|
988
|
+
fill: "none",
|
|
989
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
990
|
+
"aria-hidden": "true",
|
|
991
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
992
|
+
"path",
|
|
993
|
+
{
|
|
994
|
+
d: "M1 1H9",
|
|
995
|
+
stroke: "currentColor",
|
|
996
|
+
strokeWidth: "2",
|
|
997
|
+
strokeLinecap: "round"
|
|
998
|
+
}
|
|
999
|
+
)
|
|
1000
|
+
}
|
|
1001
|
+
);
|
|
1002
|
+
var Checkbox = React8.forwardRef(
|
|
1003
|
+
function Checkbox2({
|
|
1004
|
+
size = "md",
|
|
1005
|
+
label,
|
|
1006
|
+
indeterminate = false,
|
|
1007
|
+
disabled,
|
|
1008
|
+
checked,
|
|
1009
|
+
defaultChecked,
|
|
1010
|
+
className = "",
|
|
1011
|
+
id,
|
|
1012
|
+
onChange,
|
|
1013
|
+
...rest
|
|
1014
|
+
}, ref) {
|
|
1015
|
+
const innerRef = React8__default.default.useRef(null);
|
|
1016
|
+
const inputId = id || React8__default.default.useId();
|
|
1017
|
+
React8__default.default.useImperativeHandle(ref, () => innerRef.current);
|
|
1018
|
+
React8__default.default.useEffect(() => {
|
|
1019
|
+
if (innerRef.current) {
|
|
1020
|
+
innerRef.current.indeterminate = indeterminate;
|
|
1021
|
+
}
|
|
1022
|
+
}, [indeterminate]);
|
|
1023
|
+
const isChecked = checked ?? innerRef.current?.checked ?? defaultChecked ?? false;
|
|
1024
|
+
const isActive = isChecked || indeterminate;
|
|
1025
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1026
|
+
"label",
|
|
1027
|
+
{
|
|
1028
|
+
htmlFor: inputId,
|
|
1029
|
+
className: [
|
|
1030
|
+
"rh-inline-flex rh-items-center rh-gap-2 rh-font-sans rh-select-none",
|
|
1031
|
+
disabled ? "rh-cursor-not-allowed rh-opacity-50" : "rh-cursor-pointer",
|
|
1032
|
+
className
|
|
1033
|
+
].filter(Boolean).join(" "),
|
|
1034
|
+
children: [
|
|
1035
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "rh-relative rh-inline-flex rh-items-center rh-justify-center", children: [
|
|
1036
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1037
|
+
"input",
|
|
1038
|
+
{
|
|
1039
|
+
ref: innerRef,
|
|
1040
|
+
id: inputId,
|
|
1041
|
+
type: "checkbox",
|
|
1042
|
+
disabled,
|
|
1043
|
+
checked,
|
|
1044
|
+
defaultChecked,
|
|
1045
|
+
"aria-checked": indeterminate ? "mixed" : void 0,
|
|
1046
|
+
onChange,
|
|
1047
|
+
className: "rh-peer rh-sr-only",
|
|
1048
|
+
...rest
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1052
|
+
"span",
|
|
1053
|
+
{
|
|
1054
|
+
className: [
|
|
1055
|
+
"rh-inline-flex rh-items-center rh-justify-center",
|
|
1056
|
+
"rh-border rh-border-border rh-rounded-xxs",
|
|
1057
|
+
"rh-transition-colors rh-duration-150",
|
|
1058
|
+
sizeClasses4[size],
|
|
1059
|
+
isActive ? "rh-bg-primary rh-border-primary rh-text-surface" : "rh-bg-surface rh-text-transparent",
|
|
1060
|
+
!disabled && !isActive ? "hover:rh-border-primary" : "",
|
|
1061
|
+
"peer-focus-visible:rh-ring-2 peer-focus-visible:rh-ring-ring peer-focus-visible:rh-ring-offset-2"
|
|
1062
|
+
].filter(Boolean).join(" "),
|
|
1063
|
+
"aria-hidden": "true",
|
|
1064
|
+
children: indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(MinusIcon, { className: iconSizeClasses2[size] }) : isChecked ? /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, { className: iconSizeClasses2[size] }) : null
|
|
1065
|
+
}
|
|
1066
|
+
)
|
|
1067
|
+
] }),
|
|
1068
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1069
|
+
"span",
|
|
1070
|
+
{
|
|
1071
|
+
className: [
|
|
1072
|
+
"rh-text-text",
|
|
1073
|
+
labelSizeClasses[size]
|
|
1074
|
+
].join(" "),
|
|
1075
|
+
children: label
|
|
1076
|
+
}
|
|
1077
|
+
)
|
|
1078
|
+
]
|
|
1079
|
+
}
|
|
1080
|
+
);
|
|
1081
|
+
}
|
|
1082
|
+
);
|
|
1083
|
+
var statusClasses2 = {
|
|
1084
|
+
default: "rh-border-border focus-within:rh-ring-2 focus-within:rh-ring-ring focus-within:rh-ring-offset-2",
|
|
1085
|
+
error: "rh-border-danger focus-within:rh-ring-2 focus-within:rh-ring-danger focus-within:rh-ring-offset-2"
|
|
1086
|
+
};
|
|
1087
|
+
var sizeClasses5 = {
|
|
1088
|
+
sm: "rh-min-h-[32px] rh-text-sm rh-px-input-x-sm",
|
|
1089
|
+
md: "rh-min-h-[40px] rh-text-sm rh-px-input-x-md",
|
|
1090
|
+
lg: "rh-min-h-[48px] rh-text-base rh-px-input-x-lg"
|
|
1091
|
+
};
|
|
1092
|
+
var radiusClasses4 = {
|
|
1093
|
+
none: "rh-rounded-none",
|
|
1094
|
+
xxs: "rh-rounded-xxs",
|
|
1095
|
+
xs: "rh-rounded-xs",
|
|
1096
|
+
sm: "rh-rounded-sm",
|
|
1097
|
+
md: "rh-rounded-md",
|
|
1098
|
+
lg: "rh-rounded-lg",
|
|
1099
|
+
xl: "rh-rounded-xl",
|
|
1100
|
+
full: "rh-rounded-full"
|
|
1101
|
+
};
|
|
1102
|
+
var dropdownRadiusClasses = {
|
|
1103
|
+
none: "rh-rounded-none",
|
|
1104
|
+
xxs: "rh-rounded-xxs",
|
|
1105
|
+
xs: "rh-rounded-xs",
|
|
1106
|
+
sm: "rh-rounded-xs",
|
|
1107
|
+
md: "rh-rounded-xs",
|
|
1108
|
+
lg: "rh-rounded-xs",
|
|
1109
|
+
xl: "rh-rounded-xs",
|
|
1110
|
+
full: "rh-rounded-xs"
|
|
1111
|
+
};
|
|
1112
|
+
var helperStatusClasses2 = {
|
|
1113
|
+
default: "rh-text-text-muted",
|
|
1114
|
+
error: "rh-text-danger"
|
|
1115
|
+
};
|
|
1116
|
+
var optionSizeClasses = {
|
|
1117
|
+
sm: "rh-px-input-x-sm rh-py-1.5 rh-text-sm",
|
|
1118
|
+
md: "rh-px-input-x-md rh-py-2 rh-text-sm",
|
|
1119
|
+
lg: "rh-px-input-x-lg rh-py-2.5 rh-text-base"
|
|
1120
|
+
};
|
|
1121
|
+
var ChevronIcon = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1122
|
+
"svg",
|
|
1123
|
+
{
|
|
1124
|
+
className,
|
|
1125
|
+
viewBox: "0 0 20 20",
|
|
1126
|
+
fill: "currentColor",
|
|
1127
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1128
|
+
"aria-hidden": "true",
|
|
1129
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1130
|
+
"path",
|
|
1131
|
+
{
|
|
1132
|
+
fillRule: "evenodd",
|
|
1133
|
+
d: "M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",
|
|
1134
|
+
clipRule: "evenodd"
|
|
1135
|
+
}
|
|
1136
|
+
)
|
|
1137
|
+
}
|
|
1138
|
+
);
|
|
1139
|
+
var CheckIcon2 = ({ className }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1140
|
+
"svg",
|
|
1141
|
+
{
|
|
1142
|
+
className,
|
|
1143
|
+
viewBox: "0 0 12 10",
|
|
1144
|
+
fill: "none",
|
|
1145
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1146
|
+
"aria-hidden": "true",
|
|
1147
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1148
|
+
"path",
|
|
1149
|
+
{
|
|
1150
|
+
d: "M1 5.5L4 8.5L11 1.5",
|
|
1151
|
+
stroke: "currentColor",
|
|
1152
|
+
strokeWidth: "2",
|
|
1153
|
+
strokeLinecap: "round",
|
|
1154
|
+
strokeLinejoin: "round"
|
|
1155
|
+
}
|
|
1156
|
+
)
|
|
1157
|
+
}
|
|
1158
|
+
);
|
|
1159
|
+
var Select = React8.forwardRef(
|
|
1160
|
+
function Select2(props, ref) {
|
|
1161
|
+
const {
|
|
1162
|
+
options,
|
|
1163
|
+
label,
|
|
1164
|
+
subtitle,
|
|
1165
|
+
placeholder = "Select",
|
|
1166
|
+
status = "default",
|
|
1167
|
+
size = "md",
|
|
1168
|
+
radius = "xs",
|
|
1169
|
+
helperText,
|
|
1170
|
+
disabled = false,
|
|
1171
|
+
className = "",
|
|
1172
|
+
wrapperClassName = "",
|
|
1173
|
+
multiple = false
|
|
1174
|
+
} = props;
|
|
1175
|
+
const triggerId = React8__default.default.useId();
|
|
1176
|
+
const listboxId = React8__default.default.useId();
|
|
1177
|
+
const helperId = React8__default.default.useId();
|
|
1178
|
+
const [isOpen, setIsOpen] = React8__default.default.useState(false);
|
|
1179
|
+
const [activeIndex, setActiveIndex] = React8__default.default.useState(-1);
|
|
1180
|
+
const wrapperRef = React8__default.default.useRef(null);
|
|
1181
|
+
const innerRef = React8__default.default.useRef(null);
|
|
1182
|
+
const listboxRef = React8__default.default.useRef(null);
|
|
1183
|
+
React8__default.default.useImperativeHandle(ref, () => innerRef.current);
|
|
1184
|
+
const [internalValue, setInternalValue] = React8__default.default.useState(() => {
|
|
1185
|
+
if (props.defaultValue !== void 0) {
|
|
1186
|
+
return Array.isArray(props.defaultValue) ? props.defaultValue : [props.defaultValue];
|
|
1187
|
+
}
|
|
1188
|
+
return [];
|
|
1189
|
+
});
|
|
1190
|
+
const isControlled = props.value !== void 0;
|
|
1191
|
+
const selectedValues = isControlled ? Array.isArray(props.value) ? props.value : props.value !== void 0 ? [props.value] : [] : internalValue;
|
|
1192
|
+
const enabledOptions = options.filter((o) => !o.disabled);
|
|
1193
|
+
const handleSelect = (optionValue) => {
|
|
1194
|
+
if (multiple) {
|
|
1195
|
+
const next = selectedValues.includes(optionValue) ? selectedValues.filter((v) => v !== optionValue) : [...selectedValues, optionValue];
|
|
1196
|
+
if (!isControlled) setInternalValue(next);
|
|
1197
|
+
props.onChange?.(next);
|
|
1198
|
+
} else {
|
|
1199
|
+
const next = [optionValue];
|
|
1200
|
+
if (!isControlled) setInternalValue(next);
|
|
1201
|
+
props.onChange?.(optionValue);
|
|
1202
|
+
setIsOpen(false);
|
|
1203
|
+
innerRef.current?.focus();
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1206
|
+
const displayText = React8__default.default.useMemo(() => {
|
|
1207
|
+
if (selectedValues.length === 0) return null;
|
|
1208
|
+
if (!multiple) {
|
|
1209
|
+
return options.find((o) => o.value === selectedValues[0])?.label ?? null;
|
|
1210
|
+
}
|
|
1211
|
+
const selectedLabels = selectedValues.map((v) => options.find((o) => o.value === v)?.label).filter(Boolean);
|
|
1212
|
+
if (selectedLabels.length === 0) return null;
|
|
1213
|
+
if (selectedLabels.length === 1) return selectedLabels[0];
|
|
1214
|
+
return `${selectedLabels.length} selected`;
|
|
1215
|
+
}, [selectedValues, options, multiple]);
|
|
1216
|
+
React8__default.default.useEffect(() => {
|
|
1217
|
+
if (!isOpen) return;
|
|
1218
|
+
const handleClickOutside = (e) => {
|
|
1219
|
+
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
1220
|
+
setIsOpen(false);
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1224
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1225
|
+
}, [isOpen]);
|
|
1226
|
+
React8__default.default.useEffect(() => {
|
|
1227
|
+
if (!isOpen) return;
|
|
1228
|
+
const handleEscape = (e) => {
|
|
1229
|
+
if (e.key === "Escape") {
|
|
1230
|
+
setIsOpen(false);
|
|
1231
|
+
innerRef.current?.focus();
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
document.addEventListener("keydown", handleEscape);
|
|
1235
|
+
return () => document.removeEventListener("keydown", handleEscape);
|
|
1236
|
+
}, [isOpen]);
|
|
1237
|
+
React8__default.default.useEffect(() => {
|
|
1238
|
+
if (!isOpen || activeIndex < 0) return;
|
|
1239
|
+
const listbox = listboxRef.current;
|
|
1240
|
+
if (!listbox) return;
|
|
1241
|
+
const activeEl = listbox.children[activeIndex];
|
|
1242
|
+
if (typeof activeEl?.scrollIntoView === "function") {
|
|
1243
|
+
activeEl.scrollIntoView({ block: "nearest" });
|
|
1244
|
+
}
|
|
1245
|
+
}, [activeIndex, isOpen]);
|
|
1246
|
+
React8__default.default.useEffect(() => {
|
|
1247
|
+
if (isOpen) {
|
|
1248
|
+
const firstSelectedIdx = options.findIndex(
|
|
1249
|
+
(o) => !o.disabled && selectedValues.includes(o.value)
|
|
1250
|
+
);
|
|
1251
|
+
setActiveIndex(firstSelectedIdx >= 0 ? firstSelectedIdx : 0);
|
|
1252
|
+
} else {
|
|
1253
|
+
setActiveIndex(-1);
|
|
1254
|
+
}
|
|
1255
|
+
}, [isOpen]);
|
|
1256
|
+
const handleKeyDown = (e) => {
|
|
1257
|
+
if (disabled) return;
|
|
1258
|
+
switch (e.key) {
|
|
1259
|
+
case "ArrowDown":
|
|
1260
|
+
case "Down": {
|
|
1261
|
+
e.preventDefault();
|
|
1262
|
+
if (!isOpen) {
|
|
1263
|
+
setIsOpen(true);
|
|
1264
|
+
return;
|
|
1265
|
+
}
|
|
1266
|
+
setActiveIndex((prev) => {
|
|
1267
|
+
for (let i = prev + 1; i < options.length; i++) {
|
|
1268
|
+
if (!options[i].disabled) return i;
|
|
1269
|
+
}
|
|
1270
|
+
return prev;
|
|
1271
|
+
});
|
|
1272
|
+
break;
|
|
1273
|
+
}
|
|
1274
|
+
case "ArrowUp":
|
|
1275
|
+
case "Up": {
|
|
1276
|
+
e.preventDefault();
|
|
1277
|
+
if (!isOpen) {
|
|
1278
|
+
setIsOpen(true);
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
1281
|
+
setActiveIndex((prev) => {
|
|
1282
|
+
for (let i = prev - 1; i >= 0; i--) {
|
|
1283
|
+
if (!options[i].disabled) return i;
|
|
1284
|
+
}
|
|
1285
|
+
return prev;
|
|
1286
|
+
});
|
|
1287
|
+
break;
|
|
1288
|
+
}
|
|
1289
|
+
case "Enter":
|
|
1290
|
+
case " ": {
|
|
1291
|
+
e.preventDefault();
|
|
1292
|
+
if (!isOpen) {
|
|
1293
|
+
setIsOpen(true);
|
|
1294
|
+
} else if (activeIndex >= 0 && !options[activeIndex].disabled) {
|
|
1295
|
+
handleSelect(options[activeIndex].value);
|
|
1296
|
+
}
|
|
1297
|
+
break;
|
|
1298
|
+
}
|
|
1299
|
+
case "Home": {
|
|
1300
|
+
e.preventDefault();
|
|
1301
|
+
if (isOpen) {
|
|
1302
|
+
const idx = enabledOptions.length > 0 ? options.indexOf(enabledOptions[0]) : 0;
|
|
1303
|
+
setActiveIndex(idx);
|
|
1304
|
+
}
|
|
1305
|
+
break;
|
|
1306
|
+
}
|
|
1307
|
+
case "End": {
|
|
1308
|
+
e.preventDefault();
|
|
1309
|
+
if (isOpen) {
|
|
1310
|
+
const idx = enabledOptions.length > 0 ? options.indexOf(enabledOptions[enabledOptions.length - 1]) : options.length - 1;
|
|
1311
|
+
setActiveIndex(idx);
|
|
1312
|
+
}
|
|
1313
|
+
break;
|
|
1314
|
+
}
|
|
1315
|
+
case "Tab": {
|
|
1316
|
+
if (isOpen) setIsOpen(false);
|
|
1317
|
+
break;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1322
|
+
"div",
|
|
1323
|
+
{
|
|
1324
|
+
ref: wrapperRef,
|
|
1325
|
+
className: [
|
|
1326
|
+
"rh-relative rh-flex rh-flex-col rh-gap-1 rh-font-sans",
|
|
1327
|
+
wrapperClassName
|
|
1328
|
+
].filter(Boolean).join(" "),
|
|
1329
|
+
children: [
|
|
1330
|
+
label && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1331
|
+
"label",
|
|
1332
|
+
{
|
|
1333
|
+
id: `${triggerId}-label`,
|
|
1334
|
+
className: "rh-flex rh-items-baseline rh-gap-1",
|
|
1335
|
+
children: [
|
|
1336
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-font-medium rh-text-text", children: label }),
|
|
1337
|
+
subtitle && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-text-sm rh-text-text-muted", children: subtitle })
|
|
1338
|
+
]
|
|
1339
|
+
}
|
|
1340
|
+
),
|
|
1341
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1342
|
+
"button",
|
|
1343
|
+
{
|
|
1344
|
+
ref: innerRef,
|
|
1345
|
+
id: triggerId,
|
|
1346
|
+
type: "button",
|
|
1347
|
+
role: "combobox",
|
|
1348
|
+
"aria-expanded": isOpen,
|
|
1349
|
+
"aria-haspopup": "listbox",
|
|
1350
|
+
"aria-controls": listboxId,
|
|
1351
|
+
"aria-labelledby": label ? `${triggerId}-label` : void 0,
|
|
1352
|
+
"aria-describedby": helperText ? helperId : void 0,
|
|
1353
|
+
"aria-invalid": status === "error" || void 0,
|
|
1354
|
+
"aria-disabled": disabled || void 0,
|
|
1355
|
+
disabled,
|
|
1356
|
+
onClick: () => !disabled && setIsOpen((o) => !o),
|
|
1357
|
+
onKeyDown: handleKeyDown,
|
|
1358
|
+
className: [
|
|
1359
|
+
"rh-flex rh-items-center rh-justify-between rh-gap-2",
|
|
1360
|
+
"rh-border rh-bg-surface rh-font-sans",
|
|
1361
|
+
"rh-transition-colors rh-duration-150",
|
|
1362
|
+
"rh-text-left rh-w-full",
|
|
1363
|
+
statusClasses2[status],
|
|
1364
|
+
radiusClasses4[radius],
|
|
1365
|
+
sizeClasses5[size],
|
|
1366
|
+
disabled ? "rh-opacity-50 rh-cursor-not-allowed rh-bg-background" : "rh-cursor-pointer",
|
|
1367
|
+
className
|
|
1368
|
+
].filter(Boolean).join(" "),
|
|
1369
|
+
children: [
|
|
1370
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1371
|
+
"span",
|
|
1372
|
+
{
|
|
1373
|
+
className: [
|
|
1374
|
+
"rh-flex-1 rh-truncate",
|
|
1375
|
+
displayText ? "rh-text-text" : "rh-text-text-muted"
|
|
1376
|
+
].join(" "),
|
|
1377
|
+
children: displayText ?? placeholder
|
|
1378
|
+
}
|
|
1379
|
+
),
|
|
1380
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1381
|
+
ChevronIcon,
|
|
1382
|
+
{
|
|
1383
|
+
className: [
|
|
1384
|
+
"rh-w-5 rh-h-5 rh-shrink-0 rh-text-text-muted rh-transition-transform rh-duration-150",
|
|
1385
|
+
isOpen ? "rh-rotate-180" : ""
|
|
1386
|
+
].filter(Boolean).join(" ")
|
|
1387
|
+
}
|
|
1388
|
+
)
|
|
1389
|
+
]
|
|
1390
|
+
}
|
|
1391
|
+
),
|
|
1392
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1393
|
+
"ul",
|
|
1394
|
+
{
|
|
1395
|
+
ref: listboxRef,
|
|
1396
|
+
id: listboxId,
|
|
1397
|
+
role: "listbox",
|
|
1398
|
+
"aria-labelledby": label ? `${triggerId}-label` : triggerId,
|
|
1399
|
+
"aria-multiselectable": multiple || void 0,
|
|
1400
|
+
tabIndex: -1,
|
|
1401
|
+
className: [
|
|
1402
|
+
"rh-absolute rh-z-50 rh-w-full rh-mt-1",
|
|
1403
|
+
"rh-border rh-border-border rh-bg-surface",
|
|
1404
|
+
"rh-shadow-md rh-overflow-auto rh-max-h-60",
|
|
1405
|
+
"rh-py-1",
|
|
1406
|
+
dropdownRadiusClasses[radius]
|
|
1407
|
+
].filter(Boolean).join(" "),
|
|
1408
|
+
style: { top: "100%" },
|
|
1409
|
+
children: options.map((option, index) => {
|
|
1410
|
+
const isSelected = selectedValues.includes(option.value);
|
|
1411
|
+
const isActive = index === activeIndex;
|
|
1412
|
+
const isDisabled = option.disabled;
|
|
1413
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1414
|
+
"li",
|
|
1415
|
+
{
|
|
1416
|
+
id: `${listboxId}-option-${index}`,
|
|
1417
|
+
role: "option",
|
|
1418
|
+
"aria-selected": isSelected,
|
|
1419
|
+
"aria-disabled": isDisabled || void 0,
|
|
1420
|
+
onClick: () => {
|
|
1421
|
+
if (!isDisabled) handleSelect(option.value);
|
|
1422
|
+
},
|
|
1423
|
+
onMouseEnter: () => {
|
|
1424
|
+
if (!isDisabled) setActiveIndex(index);
|
|
1425
|
+
},
|
|
1426
|
+
className: [
|
|
1427
|
+
"rh-flex rh-items-center rh-justify-between rh-gap-2",
|
|
1428
|
+
"rh-transition-colors rh-duration-150",
|
|
1429
|
+
optionSizeClasses[size],
|
|
1430
|
+
isDisabled ? "rh-opacity-50 rh-cursor-not-allowed" : "rh-cursor-pointer",
|
|
1431
|
+
isActive && !isDisabled ? "rh-bg-background" : "",
|
|
1432
|
+
isSelected && !isActive ? "rh-bg-primary/5" : ""
|
|
1433
|
+
].filter(Boolean).join(" "),
|
|
1434
|
+
children: [
|
|
1435
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-flex-1 rh-truncate rh-text-text", children: option.label }),
|
|
1436
|
+
multiple ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1437
|
+
"span",
|
|
1438
|
+
{
|
|
1439
|
+
className: [
|
|
1440
|
+
"rh-inline-flex rh-items-center rh-justify-center",
|
|
1441
|
+
"rh-w-5 rh-h-5 rh-shrink-0",
|
|
1442
|
+
"rh-border rh-rounded-xxs rh-transition-colors rh-duration-150",
|
|
1443
|
+
isSelected ? "rh-bg-primary rh-border-primary rh-text-surface" : "rh-border-border rh-bg-surface"
|
|
1444
|
+
].filter(Boolean).join(" "),
|
|
1445
|
+
"aria-hidden": "true",
|
|
1446
|
+
children: isSelected && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon2, { className: "rh-w-3 rh-h-3" })
|
|
1447
|
+
}
|
|
1448
|
+
) : isSelected && /* @__PURE__ */ jsxRuntime.jsx(CheckIcon2, { className: "rh-w-3.5 rh-h-3.5 rh-shrink-0 rh-text-primary" })
|
|
1449
|
+
]
|
|
1450
|
+
},
|
|
1451
|
+
option.value
|
|
1452
|
+
);
|
|
1453
|
+
})
|
|
1454
|
+
}
|
|
1455
|
+
),
|
|
1456
|
+
helperText && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1457
|
+
"span",
|
|
1458
|
+
{
|
|
1459
|
+
id: helperId,
|
|
1460
|
+
className: [
|
|
1461
|
+
"rh-flex rh-items-center rh-gap-1 rh-text-xs",
|
|
1462
|
+
helperStatusClasses2[status]
|
|
1463
|
+
].join(" "),
|
|
1464
|
+
children: helperText
|
|
1465
|
+
}
|
|
1466
|
+
)
|
|
1467
|
+
]
|
|
1468
|
+
}
|
|
1469
|
+
);
|
|
1470
|
+
}
|
|
1471
|
+
);
|
|
1472
|
+
var variantClasses2 = {
|
|
1473
|
+
light: "rh-bg-surface rh-text-text rh-border rh-border-border rh-shadow-md",
|
|
1474
|
+
default: "rh-bg-primary/10 rh-text-text rh-border rh-border-primary/20 rh-shadow-md",
|
|
1475
|
+
dark: "rh-bg-primary rh-text-surface rh-shadow-md"
|
|
1476
|
+
};
|
|
1477
|
+
var arrowVariantClasses = {
|
|
1478
|
+
light: "rh-border-border rh-bg-surface",
|
|
1479
|
+
default: "rh-border-primary/20 rh-bg-primary/10",
|
|
1480
|
+
dark: "rh-bg-primary"
|
|
1481
|
+
};
|
|
1482
|
+
var sizeClasses6 = {
|
|
1483
|
+
sm: "rh-px-3 rh-py-1.5 rh-text-xs",
|
|
1484
|
+
md: "rh-px-4 rh-py-3 rh-text-sm"
|
|
1485
|
+
};
|
|
1486
|
+
var tooltipPlacementClasses = {
|
|
1487
|
+
top: "rh-bottom-full rh-left-1/2 rh--translate-x-1/2 rh-mb-2",
|
|
1488
|
+
"top-start": "rh-bottom-full rh-left-0 rh-mb-2",
|
|
1489
|
+
"top-end": "rh-bottom-full rh-right-0 rh-mb-2",
|
|
1490
|
+
bottom: "rh-top-full rh-left-1/2 rh--translate-x-1/2 rh-mt-2",
|
|
1491
|
+
"bottom-start": "rh-top-full rh-left-0 rh-mt-2",
|
|
1492
|
+
"bottom-end": "rh-top-full rh-right-0 rh-mt-2",
|
|
1493
|
+
left: "rh-right-full rh-top-1/2 rh--translate-y-1/2 rh-mr-2",
|
|
1494
|
+
"left-start": "rh-right-full rh-top-0 rh-mr-2",
|
|
1495
|
+
"left-end": "rh-right-full rh-bottom-0 rh-mr-2",
|
|
1496
|
+
right: "rh-left-full rh-top-1/2 rh--translate-y-1/2 rh-ml-2",
|
|
1497
|
+
"right-start": "rh-left-full rh-top-0 rh-ml-2",
|
|
1498
|
+
"right-end": "rh-left-full rh-bottom-0 rh-ml-2"
|
|
1499
|
+
};
|
|
1500
|
+
var arrowPlacementClasses = {
|
|
1501
|
+
top: "rh-bottom-0 rh-left-1/2 rh--translate-x-1/2 rh-translate-y-1/2 rh-rotate-45",
|
|
1502
|
+
"top-start": "rh-bottom-0 rh-left-4 rh-translate-y-1/2 rh-rotate-45",
|
|
1503
|
+
"top-end": "rh-bottom-0 rh-right-4 rh-translate-y-1/2 rh-rotate-45",
|
|
1504
|
+
bottom: "rh-top-0 rh-left-1/2 rh--translate-x-1/2 rh--translate-y-1/2 rh-rotate-45",
|
|
1505
|
+
"bottom-start": "rh-top-0 rh-left-4 rh--translate-y-1/2 rh-rotate-45",
|
|
1506
|
+
"bottom-end": "rh-top-0 rh-right-4 rh--translate-y-1/2 rh-rotate-45",
|
|
1507
|
+
left: "rh-right-0 rh-top-1/2 rh--translate-y-1/2 rh-translate-x-1/2 rh-rotate-45",
|
|
1508
|
+
"left-start": "rh-right-0 rh-top-3 rh-translate-x-1/2 rh-rotate-45",
|
|
1509
|
+
"left-end": "rh-right-0 rh-bottom-3 rh-translate-x-1/2 rh-rotate-45",
|
|
1510
|
+
right: "rh-left-0 rh-top-1/2 rh--translate-y-1/2 rh--translate-x-1/2 rh-rotate-45",
|
|
1511
|
+
"right-start": "rh-left-0 rh-top-3 rh--translate-x-1/2 rh-rotate-45",
|
|
1512
|
+
"right-end": "rh-left-0 rh-bottom-3 rh--translate-x-1/2 rh-rotate-45"
|
|
1513
|
+
};
|
|
1514
|
+
var Tooltip = React8.forwardRef(
|
|
1515
|
+
function Tooltip2({
|
|
1516
|
+
title,
|
|
1517
|
+
description,
|
|
1518
|
+
variant = "light",
|
|
1519
|
+
size = "sm",
|
|
1520
|
+
placement = "top",
|
|
1521
|
+
closable = false,
|
|
1522
|
+
icon,
|
|
1523
|
+
open: controlledOpen,
|
|
1524
|
+
onOpenChange,
|
|
1525
|
+
enterDelay = 100,
|
|
1526
|
+
leaveDelay = 150,
|
|
1527
|
+
children,
|
|
1528
|
+
className = ""
|
|
1529
|
+
}, ref) {
|
|
1530
|
+
const [internalOpen, setInternalOpen] = React8.useState(false);
|
|
1531
|
+
const enterTimerRef = React8.useRef(null);
|
|
1532
|
+
const leaveTimerRef = React8.useRef(null);
|
|
1533
|
+
const isControlled = controlledOpen !== void 0;
|
|
1534
|
+
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
1535
|
+
const setOpen = React8.useCallback(
|
|
1536
|
+
(value) => {
|
|
1537
|
+
if (!isControlled) {
|
|
1538
|
+
setInternalOpen(value);
|
|
1539
|
+
}
|
|
1540
|
+
onOpenChange?.(value);
|
|
1541
|
+
},
|
|
1542
|
+
[isControlled, onOpenChange]
|
|
1543
|
+
);
|
|
1544
|
+
const clearTimers = React8.useCallback(() => {
|
|
1545
|
+
if (enterTimerRef.current) {
|
|
1546
|
+
clearTimeout(enterTimerRef.current);
|
|
1547
|
+
enterTimerRef.current = null;
|
|
1548
|
+
}
|
|
1549
|
+
if (leaveTimerRef.current) {
|
|
1550
|
+
clearTimeout(leaveTimerRef.current);
|
|
1551
|
+
leaveTimerRef.current = null;
|
|
1552
|
+
}
|
|
1553
|
+
}, []);
|
|
1554
|
+
const handleEnter = React8.useCallback(() => {
|
|
1555
|
+
clearTimers();
|
|
1556
|
+
enterTimerRef.current = setTimeout(() => {
|
|
1557
|
+
setOpen(true);
|
|
1558
|
+
}, enterDelay);
|
|
1559
|
+
}, [clearTimers, enterDelay, setOpen]);
|
|
1560
|
+
const handleLeave = React8.useCallback(() => {
|
|
1561
|
+
clearTimers();
|
|
1562
|
+
leaveTimerRef.current = setTimeout(() => {
|
|
1563
|
+
setOpen(false);
|
|
1564
|
+
}, leaveDelay);
|
|
1565
|
+
}, [clearTimers, leaveDelay, setOpen]);
|
|
1566
|
+
const handleClose = React8.useCallback(() => {
|
|
1567
|
+
clearTimers();
|
|
1568
|
+
setOpen(false);
|
|
1569
|
+
}, [clearTimers, setOpen]);
|
|
1570
|
+
React8.useEffect(() => {
|
|
1571
|
+
return () => clearTimers();
|
|
1572
|
+
}, [clearTimers]);
|
|
1573
|
+
const triggerChild = React8__default.default.Children.only(children);
|
|
1574
|
+
const triggerElement = React8__default.default.cloneElement(triggerChild, {
|
|
1575
|
+
onMouseEnter: (e) => {
|
|
1576
|
+
handleEnter();
|
|
1577
|
+
triggerChild.props.onMouseEnter?.(e);
|
|
1578
|
+
},
|
|
1579
|
+
onMouseLeave: (e) => {
|
|
1580
|
+
handleLeave();
|
|
1581
|
+
triggerChild.props.onMouseLeave?.(e);
|
|
1582
|
+
},
|
|
1583
|
+
onFocus: (e) => {
|
|
1584
|
+
handleEnter();
|
|
1585
|
+
triggerChild.props.onFocus?.(e);
|
|
1586
|
+
},
|
|
1587
|
+
onBlur: (e) => {
|
|
1588
|
+
handleLeave();
|
|
1589
|
+
triggerChild.props.onBlur?.(e);
|
|
1590
|
+
},
|
|
1591
|
+
"aria-describedby": isOpen ? "rh-tooltip" : void 0
|
|
1592
|
+
});
|
|
1593
|
+
const showCloseButton = closable && size === "md" && description;
|
|
1594
|
+
const arrowBorderClass = variant === "dark" ? "" : "rh-border-b rh-border-r";
|
|
1595
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1596
|
+
"div",
|
|
1597
|
+
{
|
|
1598
|
+
className: "rh-relative rh-inline-flex",
|
|
1599
|
+
onMouseEnter: handleEnter,
|
|
1600
|
+
onMouseLeave: handleLeave,
|
|
1601
|
+
children: [
|
|
1602
|
+
triggerElement,
|
|
1603
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1604
|
+
"div",
|
|
1605
|
+
{
|
|
1606
|
+
ref,
|
|
1607
|
+
id: "rh-tooltip",
|
|
1608
|
+
role: "tooltip",
|
|
1609
|
+
className: [
|
|
1610
|
+
"rh-absolute rh-z-50 rh-w-max rh-max-w-xs rh-rounded-xs",
|
|
1611
|
+
tooltipPlacementClasses[placement],
|
|
1612
|
+
variantClasses2[variant],
|
|
1613
|
+
sizeClasses6[size],
|
|
1614
|
+
className
|
|
1615
|
+
].filter(Boolean).join(" "),
|
|
1616
|
+
children: [
|
|
1617
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1618
|
+
"span",
|
|
1619
|
+
{
|
|
1620
|
+
"aria-hidden": "true",
|
|
1621
|
+
className: [
|
|
1622
|
+
"rh-absolute rh-w-2.5 rh-h-2.5",
|
|
1623
|
+
arrowBorderClass,
|
|
1624
|
+
arrowVariantClasses[variant],
|
|
1625
|
+
arrowPlacementClasses[placement]
|
|
1626
|
+
].filter(Boolean).join(" ")
|
|
1627
|
+
}
|
|
1628
|
+
),
|
|
1629
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-relative rh-flex rh-items-start rh-gap-2", children: [
|
|
1630
|
+
icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rh-flex-shrink-0 rh-mt-0.5", "aria-hidden": "true", children: icon }),
|
|
1631
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rh-flex-1 rh-min-w-0", children: [
|
|
1632
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1633
|
+
"p",
|
|
1634
|
+
{
|
|
1635
|
+
className: [
|
|
1636
|
+
"rh-font-semibold rh-leading-tight",
|
|
1637
|
+
size === "sm" ? "rh-text-xs" : "rh-text-sm"
|
|
1638
|
+
].filter(Boolean).join(" "),
|
|
1639
|
+
children: title
|
|
1640
|
+
}
|
|
1641
|
+
),
|
|
1642
|
+
description && size === "md" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1643
|
+
"p",
|
|
1644
|
+
{
|
|
1645
|
+
className: [
|
|
1646
|
+
"rh-mt-1 rh-text-xs rh-leading-normal",
|
|
1647
|
+
variant === "dark" ? "rh-text-surface/80" : "rh-text-text-muted"
|
|
1648
|
+
].filter(Boolean).join(" "),
|
|
1649
|
+
children: description
|
|
1650
|
+
}
|
|
1651
|
+
)
|
|
1652
|
+
] }),
|
|
1653
|
+
showCloseButton && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1654
|
+
"button",
|
|
1655
|
+
{
|
|
1656
|
+
type: "button",
|
|
1657
|
+
"aria-label": "Close tooltip",
|
|
1658
|
+
onClick: handleClose,
|
|
1659
|
+
className: [
|
|
1660
|
+
"rh-flex-shrink-0 rh-ml-1 rh-p-0.5 rh-rounded-xxs",
|
|
1661
|
+
"rh-transition-colors rh-duration-150",
|
|
1662
|
+
"focus-visible:rh-outline-none focus-visible:rh-ring-2 focus-visible:rh-ring-ring",
|
|
1663
|
+
variant === "dark" ? "rh-text-surface/80 hover:rh-text-surface" : "rh-text-text-muted hover:rh-text-text"
|
|
1664
|
+
].filter(Boolean).join(" "),
|
|
1665
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1666
|
+
"svg",
|
|
1667
|
+
{
|
|
1668
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1669
|
+
viewBox: "0 0 20 20",
|
|
1670
|
+
fill: "currentColor",
|
|
1671
|
+
className: "rh-w-4 rh-h-4",
|
|
1672
|
+
"aria-hidden": "true",
|
|
1673
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" })
|
|
1674
|
+
}
|
|
1675
|
+
)
|
|
1676
|
+
}
|
|
1677
|
+
)
|
|
1678
|
+
] })
|
|
1679
|
+
]
|
|
1680
|
+
}
|
|
1681
|
+
)
|
|
1682
|
+
]
|
|
1683
|
+
}
|
|
1684
|
+
);
|
|
1685
|
+
}
|
|
1686
|
+
);
|
|
1687
|
+
|
|
1688
|
+
exports.Button = Button;
|
|
1689
|
+
exports.Checkbox = Checkbox;
|
|
1690
|
+
exports.CloseIcon = CloseIcon;
|
|
1691
|
+
exports.DeleteIcon = DeleteIcon;
|
|
1692
|
+
exports.EditIcon = EditIcon;
|
|
1693
|
+
exports.ErrorIcon = ErrorIcon;
|
|
1694
|
+
exports.IconButton = IconButton;
|
|
1695
|
+
exports.InfoIcon = InfoIcon;
|
|
1696
|
+
exports.NeutralIcon = NeutralIcon;
|
|
1697
|
+
exports.PlusIcon = PlusIcon;
|
|
1698
|
+
exports.RehagroProvider = RehagroProvider;
|
|
1699
|
+
exports.SearchIcon = SearchIcon;
|
|
1700
|
+
exports.Select = Select;
|
|
1701
|
+
exports.SuccessIcon = SuccessIcon;
|
|
1702
|
+
exports.TextInput = TextInput;
|
|
1703
|
+
exports.Toast = Toast;
|
|
1704
|
+
exports.ToastContainer = ToastContainer;
|
|
1705
|
+
exports.ToastProvider = ToastProvider;
|
|
1706
|
+
exports.Tooltip = Tooltip;
|
|
1707
|
+
exports.WarningIcon = WarningIcon;
|
|
1708
|
+
exports.useToast = useToast;
|
|
1709
|
+
//# sourceMappingURL=index.js.map
|
|
1710
|
+
//# sourceMappingURL=index.js.map
|