@bubo-squared/ui-framework 0.2.15 → 0.2.17
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.cjs +258 -277
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +257 -276
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -108,6 +108,9 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
|
108
108
|
"btn-secondary",
|
|
109
109
|
"focus-ring-secondary"
|
|
110
110
|
],
|
|
111
|
+
ghost: [
|
|
112
|
+
"btn-ghost"
|
|
113
|
+
],
|
|
111
114
|
outline: [
|
|
112
115
|
"btn-outline",
|
|
113
116
|
"focus-ring-outline"
|
|
@@ -118,10 +121,10 @@ var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
|
118
121
|
]
|
|
119
122
|
},
|
|
120
123
|
size: {
|
|
121
|
-
sm: ["px-
|
|
122
|
-
md: ["px-2", "py-1", "gap-
|
|
123
|
-
lg: ["px-2.5", "py-1", "gap-
|
|
124
|
-
xl: ["px-3", "py-0.5", "gap-
|
|
124
|
+
sm: ["px-2", "py-1", "gap-2", "h-9"],
|
|
125
|
+
md: ["px-2", "py-1", "gap-2", "h-10"],
|
|
126
|
+
lg: ["px-2.5", "py-1", "gap-2.5", "h-11"],
|
|
127
|
+
xl: ["px-3", "py-0.5", "gap-3", "h-12"]
|
|
125
128
|
}
|
|
126
129
|
},
|
|
127
130
|
defaultVariants: {
|
|
@@ -134,19 +137,19 @@ var buttonIconVariants = (0, import_class_variance_authority.cva)("relative", {
|
|
|
134
137
|
variants: {
|
|
135
138
|
size: {
|
|
136
139
|
sm: ["size-5", "*:size-5"],
|
|
137
|
-
md: ["size-
|
|
140
|
+
md: ["size-5", "*:size-5"],
|
|
138
141
|
lg: ["size-6", "*:size-6"],
|
|
139
|
-
xl: ["size-
|
|
142
|
+
xl: ["size-7", "*:size-7"]
|
|
140
143
|
}
|
|
141
144
|
}
|
|
142
145
|
});
|
|
143
146
|
var buttonTextVariants = (0, import_class_variance_authority.cva)("flex text-center justify-center font-normal", {
|
|
144
147
|
variants: {
|
|
145
148
|
size: {
|
|
146
|
-
sm: ["
|
|
147
|
-
md: ["
|
|
148
|
-
lg: ["
|
|
149
|
-
xl: ["
|
|
149
|
+
sm: ["paragraph-sm"],
|
|
150
|
+
md: ["paragraph-md"],
|
|
151
|
+
lg: ["paragraph-lg"],
|
|
152
|
+
xl: ["subtitle"]
|
|
150
153
|
}
|
|
151
154
|
}
|
|
152
155
|
});
|
|
@@ -220,7 +223,7 @@ var import_react_slot2 = require("@radix-ui/react-slot");
|
|
|
220
223
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
221
224
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
222
225
|
var iconButtonVariants = (0, import_class_variance_authority3.cva)(
|
|
223
|
-
"inline-flex items-center justify-center whitespace-nowrap
|
|
226
|
+
"inline-flex items-center justify-center whitespace-nowrap transition-colors disabled:pointer-events-none overflow-hidden p-2 cursor-pointer",
|
|
224
227
|
{
|
|
225
228
|
variants: {
|
|
226
229
|
variant: {
|
|
@@ -232,6 +235,9 @@ var iconButtonVariants = (0, import_class_variance_authority3.cva)(
|
|
|
232
235
|
"btn-secondary",
|
|
233
236
|
"focus-ring-secondary"
|
|
234
237
|
],
|
|
238
|
+
ghost: [
|
|
239
|
+
"btn-ghost"
|
|
240
|
+
],
|
|
235
241
|
outline: [
|
|
236
242
|
"btn-outline",
|
|
237
243
|
"focus-ring-outline"
|
|
@@ -262,13 +268,14 @@ var IconButton = React2.forwardRef(
|
|
|
262
268
|
size,
|
|
263
269
|
asChild = false,
|
|
264
270
|
icon,
|
|
271
|
+
round = false,
|
|
265
272
|
...rest
|
|
266
273
|
} = props;
|
|
267
274
|
const Comp = asChild ? import_react_slot2.Slot : "button";
|
|
268
275
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
269
276
|
Comp,
|
|
270
277
|
{
|
|
271
|
-
className: cn(iconButtonVariants({ variant, size }), className),
|
|
278
|
+
className: cn(iconButtonVariants({ variant, size }), round ? "rounded-full" : "rounded-4", className),
|
|
272
279
|
ref,
|
|
273
280
|
...rest,
|
|
274
281
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "buttonIcon flex items-center justify-center", children: icon })
|
|
@@ -1713,6 +1720,8 @@ var Autocomplete = (props) => {
|
|
|
1713
1720
|
inputValue,
|
|
1714
1721
|
defaultInputValue,
|
|
1715
1722
|
onInputChange,
|
|
1723
|
+
dropdownClassName,
|
|
1724
|
+
listboxClassName,
|
|
1716
1725
|
placeholder = "Search\u2026",
|
|
1717
1726
|
onKeyDown,
|
|
1718
1727
|
onFocus,
|
|
@@ -1873,7 +1882,8 @@ var Autocomplete = (props) => {
|
|
|
1873
1882
|
className: cn(
|
|
1874
1883
|
"absolute left-0 right-0 mt-1",
|
|
1875
1884
|
dropdownSurfaceClass,
|
|
1876
|
-
dropdownScrollClass
|
|
1885
|
+
dropdownScrollClass,
|
|
1886
|
+
dropdownClassName
|
|
1877
1887
|
),
|
|
1878
1888
|
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1879
1889
|
"div",
|
|
@@ -1889,23 +1899,31 @@ var Autocomplete = (props) => {
|
|
|
1889
1899
|
"aria-live": "polite",
|
|
1890
1900
|
children: noOptionsText
|
|
1891
1901
|
}
|
|
1892
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1893
|
-
"
|
|
1902
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1903
|
+
"ul",
|
|
1894
1904
|
{
|
|
1895
|
-
id:
|
|
1896
|
-
role: "
|
|
1897
|
-
"
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1905
|
+
id: listboxId,
|
|
1906
|
+
role: "listbox",
|
|
1907
|
+
className: cn("flex flex-col", listboxClassName),
|
|
1908
|
+
children: options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1909
|
+
"li",
|
|
1910
|
+
{
|
|
1911
|
+
id: `${inputId}-option-${index}`,
|
|
1912
|
+
role: "option",
|
|
1913
|
+
"aria-selected": index === activeIndex,
|
|
1914
|
+
className: cn(
|
|
1915
|
+
optionVariants({ size, active: index === activeIndex }),
|
|
1916
|
+
"px-(--space-8) pr-(--space-16) text-primary cursor-pointer"
|
|
1917
|
+
),
|
|
1918
|
+
onMouseDown: handleOptionMouseDown,
|
|
1919
|
+
onMouseEnter: () => setActiveIndex(index),
|
|
1920
|
+
onClick: () => handleOptionClick(option),
|
|
1921
|
+
children: option
|
|
1922
|
+
},
|
|
1923
|
+
`${option}-${index}`
|
|
1924
|
+
))
|
|
1925
|
+
}
|
|
1926
|
+
)
|
|
1909
1927
|
}
|
|
1910
1928
|
)
|
|
1911
1929
|
] }) });
|
|
@@ -3145,8 +3163,95 @@ var SearchInput = (props) => {
|
|
|
3145
3163
|
SearchInput.displayName = "SearchInput";
|
|
3146
3164
|
|
|
3147
3165
|
// src/components/Inputs/Slider.tsx
|
|
3148
|
-
var
|
|
3166
|
+
var React35 = __toESM(require("react"), 1);
|
|
3167
|
+
|
|
3168
|
+
// src/components/Feedback/Tooltip.tsx
|
|
3169
|
+
var React34 = require("react");
|
|
3170
|
+
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
3149
3171
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3172
|
+
var TooltipArrow = TooltipPrimitive.Arrow;
|
|
3173
|
+
var mapPlacementToSideAndAlign = (placement) => {
|
|
3174
|
+
switch (placement) {
|
|
3175
|
+
case "top":
|
|
3176
|
+
return { side: "top", align: "center" };
|
|
3177
|
+
case "topLeft":
|
|
3178
|
+
return { side: "top", align: "start" };
|
|
3179
|
+
case "topRight":
|
|
3180
|
+
return { side: "top", align: "end" };
|
|
3181
|
+
case "bottom":
|
|
3182
|
+
return { side: "bottom", align: "center" };
|
|
3183
|
+
case "bottomLeft":
|
|
3184
|
+
return { side: "bottom", align: "start" };
|
|
3185
|
+
case "bottomRight":
|
|
3186
|
+
return { side: "bottom", align: "end" };
|
|
3187
|
+
case "left":
|
|
3188
|
+
return { side: "left", align: "center" };
|
|
3189
|
+
case "leftTop":
|
|
3190
|
+
return { side: "left", align: "start" };
|
|
3191
|
+
case "leftBottom":
|
|
3192
|
+
return { side: "left", align: "end" };
|
|
3193
|
+
case "right":
|
|
3194
|
+
return { side: "right", align: "center" };
|
|
3195
|
+
case "rightTop":
|
|
3196
|
+
return { side: "right", align: "start" };
|
|
3197
|
+
case "rightBottom":
|
|
3198
|
+
return { side: "right", align: "end" };
|
|
3199
|
+
default:
|
|
3200
|
+
return { side: "top", align: "center" };
|
|
3201
|
+
}
|
|
3202
|
+
};
|
|
3203
|
+
var Tooltip = (props) => {
|
|
3204
|
+
const {
|
|
3205
|
+
strapline,
|
|
3206
|
+
title,
|
|
3207
|
+
description,
|
|
3208
|
+
showArrow = true,
|
|
3209
|
+
className,
|
|
3210
|
+
placement = "top",
|
|
3211
|
+
offset = 10,
|
|
3212
|
+
disableHoverableContent,
|
|
3213
|
+
open,
|
|
3214
|
+
defaultOpen,
|
|
3215
|
+
onOpenChange,
|
|
3216
|
+
children
|
|
3217
|
+
} = props;
|
|
3218
|
+
const { side, align } = mapPlacementToSideAndAlign(placement);
|
|
3219
|
+
const tooltipClasses = "group bg-(--background-tooltip) max-w-[calc(100vw-2rem)] shadow-card-md border-none rounded-4 p-4 [&>span]:scale-200 data-[state=delayed-open]:animate-in data-[state=instant-open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=delayed-open]:fade-in-0 data-[state=instant-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-[state=instant-open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";
|
|
3220
|
+
const tooltipArrowClasses = "relative fill-(--background-tooltip) transition-[filter,transform] group-data-[side=top]:top-[-2px] group-data-[side=top]:drop-shadow-[0px_1px_1px_color-mix(in_srgb,_var(--color-b-black-10)_66%,_transparent)] group-data-[side=bottom]:drop-shadow-[0px_1px_1px_color-mix(in_srgb,_var(--color-b-black-10)_66%,_transparent)] group-data-[side=left]:drop-shadow-[0px_2px_1px_color-mix(in_srgb,_var(--color-b-black-10)_66%,_transparent)] group-data-[side=right]:drop-shadow-[0px_2px_1px_color-mix(in_srgb,_var(--color-b-black-10)_66%,_transparent)]";
|
|
3221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
3222
|
+
TooltipPrimitive.Root,
|
|
3223
|
+
{
|
|
3224
|
+
open,
|
|
3225
|
+
defaultOpen,
|
|
3226
|
+
onOpenChange,
|
|
3227
|
+
disableHoverableContent,
|
|
3228
|
+
children: [
|
|
3229
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipPrimitive.Trigger, { asChild: true, children }),
|
|
3230
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
3231
|
+
TooltipPrimitive.Content,
|
|
3232
|
+
{
|
|
3233
|
+
side,
|
|
3234
|
+
align,
|
|
3235
|
+
sideOffset: offset,
|
|
3236
|
+
className: cn(tooltipClasses, className),
|
|
3237
|
+
children: [
|
|
3238
|
+
showArrow && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipArrow, { className: tooltipArrowClasses }),
|
|
3239
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "grid gap-2", children: [
|
|
3240
|
+
(strapline ?? "") !== "" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "caption text-secondary", children: strapline }),
|
|
3241
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h4", { className: "subtitle-medium text-primary", children: title }),
|
|
3242
|
+
(description ?? "") !== "" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("p", { className: "paragraph-sm text-primary", children: description })
|
|
3243
|
+
] })
|
|
3244
|
+
]
|
|
3245
|
+
}
|
|
3246
|
+
) })
|
|
3247
|
+
]
|
|
3248
|
+
}
|
|
3249
|
+
);
|
|
3250
|
+
};
|
|
3251
|
+
Tooltip.displayName = "Tooltip";
|
|
3252
|
+
|
|
3253
|
+
// src/components/Inputs/Slider.tsx
|
|
3254
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3150
3255
|
var wrapperBase = "flex flex-col gap-2 items-start";
|
|
3151
3256
|
var isRangeProps = (props) => {
|
|
3152
3257
|
return Array.isArray(props.value) || Array.isArray(props.defaultValue);
|
|
@@ -3173,7 +3278,7 @@ var Slider = (props) => {
|
|
|
3173
3278
|
const isRange = isRangeProps(props);
|
|
3174
3279
|
const isControlled = value !== void 0;
|
|
3175
3280
|
const expectedLength = isRange ? 2 : 1;
|
|
3176
|
-
const normalizeArray =
|
|
3281
|
+
const normalizeArray = React35.useCallback(
|
|
3177
3282
|
(arr, fallback) => {
|
|
3178
3283
|
if (!arr || arr.length === 0) return fallback;
|
|
3179
3284
|
if (arr.length === expectedLength) return arr;
|
|
@@ -3185,16 +3290,16 @@ var Slider = (props) => {
|
|
|
3185
3290
|
},
|
|
3186
3291
|
[expectedLength, max]
|
|
3187
3292
|
);
|
|
3188
|
-
const defaultInternal =
|
|
3293
|
+
const defaultInternal = React35.useMemo(() => {
|
|
3189
3294
|
const defaultValueArray = toArray(defaultValue);
|
|
3190
3295
|
if (defaultValueArray) return normalizeArray(defaultValueArray, []);
|
|
3191
3296
|
if (isRange) return [min, Math.min(min + (max - min) / 4, max)];
|
|
3192
3297
|
return [min + (max - min) / 3];
|
|
3193
3298
|
}, [defaultValue, min, max, isRange, normalizeArray]);
|
|
3194
|
-
const [internalValue, setInternalValue] =
|
|
3299
|
+
const [internalValue, setInternalValue] = React35.useState(
|
|
3195
3300
|
() => normalizeArray(isControlled ? toArray(value) : defaultInternal, defaultInternal)
|
|
3196
3301
|
);
|
|
3197
|
-
|
|
3302
|
+
React35.useEffect(() => {
|
|
3198
3303
|
if (isControlled) {
|
|
3199
3304
|
setInternalValue(
|
|
3200
3305
|
(current2) => normalizeArray(toArray(value), current2.length ? current2 : defaultInternal)
|
|
@@ -3202,15 +3307,16 @@ var Slider = (props) => {
|
|
|
3202
3307
|
}
|
|
3203
3308
|
}, [isControlled, value, normalizeArray, defaultInternal]);
|
|
3204
3309
|
const current = internalValue;
|
|
3205
|
-
const trackRef =
|
|
3206
|
-
const [draggingThumbIndex, setDraggingThumbIndex] =
|
|
3207
|
-
const [hoveredThumbIndex, setHoveredThumbIndex] =
|
|
3208
|
-
const
|
|
3310
|
+
const trackRef = React35.useRef(null);
|
|
3311
|
+
const [draggingThumbIndex, setDraggingThumbIndex] = React35.useState(null);
|
|
3312
|
+
const [hoveredThumbIndex, setHoveredThumbIndex] = React35.useState(null);
|
|
3313
|
+
const [focusedThumbIndex, setFocusedThumbIndex] = React35.useState(null);
|
|
3314
|
+
const clamp = React35.useCallback((val) => {
|
|
3209
3315
|
if (val < min) return min;
|
|
3210
3316
|
if (val > max) return max;
|
|
3211
3317
|
return val;
|
|
3212
3318
|
}, [min, max]);
|
|
3213
|
-
const enforceMinGap =
|
|
3319
|
+
const enforceMinGap = React35.useCallback((next, prev) => {
|
|
3214
3320
|
if (!isRange || next.length !== 2 || step <= 0) return next;
|
|
3215
3321
|
let [low, high] = next;
|
|
3216
3322
|
const [prevLow, prevHigh] = prev.length === 2 ? prev : next;
|
|
@@ -3234,7 +3340,7 @@ var Slider = (props) => {
|
|
|
3234
3340
|
}
|
|
3235
3341
|
return [low, high];
|
|
3236
3342
|
}, [isRange, step, clamp]);
|
|
3237
|
-
|
|
3343
|
+
React35.useEffect(() => {
|
|
3238
3344
|
if (!isControlled) {
|
|
3239
3345
|
setInternalValue((prev) => {
|
|
3240
3346
|
const clamped = prev.map((v) => clamp(v));
|
|
@@ -3368,7 +3474,6 @@ var Slider = (props) => {
|
|
|
3368
3474
|
const secondaryPercent = valueToPercent(secondary);
|
|
3369
3475
|
const showNumeric = display === "numeric";
|
|
3370
3476
|
const showTooltip = display === "tooltip";
|
|
3371
|
-
const isTooltipAbove = tooltipPlacement === "top";
|
|
3372
3477
|
const isDecimalDomain = !Number.isInteger(step) || !Number.isInteger(min) || !Number.isInteger(max);
|
|
3373
3478
|
const formatNumber = (num) => {
|
|
3374
3479
|
if (!isDecimalDomain) {
|
|
@@ -3403,55 +3508,11 @@ var Slider = (props) => {
|
|
|
3403
3508
|
const trackHeight = 32;
|
|
3404
3509
|
const thumbWidth = 18;
|
|
3405
3510
|
const thumbRadius = thumbWidth / 2;
|
|
3406
|
-
const renderTooltipBubble = (key, percent, labelText, isVisible) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3407
|
-
"div",
|
|
3408
|
-
{
|
|
3409
|
-
className: cn(
|
|
3410
|
-
"absolute -translate-x-1/2 flex flex-col items-center",
|
|
3411
|
-
"transition-[opacity,transform] duration-150",
|
|
3412
|
-
isVisible ? "opacity-100 scale-100 pointer-events-auto" : "opacity-0 scale-95 pointer-events-none"
|
|
3413
|
-
),
|
|
3414
|
-
style: {
|
|
3415
|
-
left: `${percent}%`,
|
|
3416
|
-
bottom: isTooltipAbove ? "100%" : void 0,
|
|
3417
|
-
top: isTooltipAbove ? void 0 : "100%",
|
|
3418
|
-
marginBottom: isTooltipAbove ? 8 : void 0,
|
|
3419
|
-
marginTop: isTooltipAbove ? void 0 : 8
|
|
3420
|
-
},
|
|
3421
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
3422
|
-
"div",
|
|
3423
|
-
{
|
|
3424
|
-
className: cn("relative rounded-4 shadow-card-md px-(--space-8) py-(--space-4) bg-(--background-tooltip)"),
|
|
3425
|
-
children: [
|
|
3426
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3427
|
-
"p",
|
|
3428
|
-
{
|
|
3429
|
-
className: cn(
|
|
3430
|
-
"paragraph-sm",
|
|
3431
|
-
disabled ? "text-secondary" : "text-primary"
|
|
3432
|
-
),
|
|
3433
|
-
children: labelText
|
|
3434
|
-
}
|
|
3435
|
-
),
|
|
3436
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3437
|
-
"div",
|
|
3438
|
-
{
|
|
3439
|
-
className: cn(
|
|
3440
|
-
"absolute left-1/2 -translate-x-1/2 w-2 h-2 rotate-45 bg-(--background-tooltip)",
|
|
3441
|
-
isTooltipAbove ? "-bottom-1" : "-top-1"
|
|
3442
|
-
)
|
|
3443
|
-
}
|
|
3444
|
-
)
|
|
3445
|
-
]
|
|
3446
|
-
}
|
|
3447
|
-
)
|
|
3448
|
-
},
|
|
3449
|
-
key
|
|
3450
|
-
);
|
|
3451
3511
|
const renderHandle = (index, percent, ariaValueText) => {
|
|
3452
3512
|
const val = index === 0 ? primary : secondary;
|
|
3453
3513
|
const isDragging = draggingThumbIndex === index;
|
|
3454
|
-
|
|
3514
|
+
const isTooltipVisible = showTooltip && (hoveredThumbIndex === index || draggingThumbIndex === index || focusedThumbIndex === index);
|
|
3515
|
+
const handle = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3455
3516
|
"button",
|
|
3456
3517
|
{
|
|
3457
3518
|
type: "button",
|
|
@@ -3472,7 +3533,7 @@ var Slider = (props) => {
|
|
|
3472
3533
|
style: {
|
|
3473
3534
|
left: `${percent}%`,
|
|
3474
3535
|
top: `calc(50% - ${trackHeight / 2}px)`,
|
|
3475
|
-
"--slider-halo-color": "color-mix(in srgb, var(--color-brand)
|
|
3536
|
+
"--slider-halo-color": "color-mix(in srgb, var(--color-brand) 15%, transparent)"
|
|
3476
3537
|
},
|
|
3477
3538
|
onPointerEnter: () => {
|
|
3478
3539
|
setHoveredThumbIndex(index);
|
|
@@ -3480,6 +3541,12 @@ var Slider = (props) => {
|
|
|
3480
3541
|
onPointerLeave: () => {
|
|
3481
3542
|
setHoveredThumbIndex((prev) => prev === index ? null : prev);
|
|
3482
3543
|
},
|
|
3544
|
+
onFocus: () => {
|
|
3545
|
+
setFocusedThumbIndex(index);
|
|
3546
|
+
},
|
|
3547
|
+
onBlur: () => {
|
|
3548
|
+
setFocusedThumbIndex((prev) => prev === index ? null : prev);
|
|
3549
|
+
},
|
|
3483
3550
|
onPointerDown: (event) => {
|
|
3484
3551
|
if (disabled) return;
|
|
3485
3552
|
if (event.button !== 0) return;
|
|
@@ -3490,15 +3557,28 @@ var Slider = (props) => {
|
|
|
3490
3557
|
},
|
|
3491
3558
|
index
|
|
3492
3559
|
);
|
|
3560
|
+
if (!showTooltip) return handle;
|
|
3561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3562
|
+
Tooltip,
|
|
3563
|
+
{
|
|
3564
|
+
title: ariaValueText,
|
|
3565
|
+
placement: tooltipPlacement === "top" ? "top" : "bottom",
|
|
3566
|
+
offset: 8,
|
|
3567
|
+
open: isTooltipVisible,
|
|
3568
|
+
disableHoverableContent: true,
|
|
3569
|
+
className: "z-50 pointer-events-none py-2",
|
|
3570
|
+
children: handle
|
|
3571
|
+
}
|
|
3572
|
+
);
|
|
3493
3573
|
};
|
|
3494
|
-
return /* @__PURE__ */ (0,
|
|
3574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
3495
3575
|
"div",
|
|
3496
3576
|
{
|
|
3497
3577
|
className: wrapperBase,
|
|
3498
3578
|
style: { marginInline: `${thumbRadius}px` },
|
|
3499
3579
|
children: [
|
|
3500
|
-
name && /* @__PURE__ */ (0,
|
|
3501
|
-
/* @__PURE__ */ (0,
|
|
3580
|
+
name && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
3581
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3502
3582
|
"input",
|
|
3503
3583
|
{
|
|
3504
3584
|
type: "hidden",
|
|
@@ -3507,7 +3587,7 @@ var Slider = (props) => {
|
|
|
3507
3587
|
disabled
|
|
3508
3588
|
}
|
|
3509
3589
|
),
|
|
3510
|
-
isRange && secondary !== void 0 && /* @__PURE__ */ (0,
|
|
3590
|
+
isRange && secondary !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3511
3591
|
"input",
|
|
3512
3592
|
{
|
|
3513
3593
|
type: "hidden",
|
|
@@ -3517,51 +3597,37 @@ var Slider = (props) => {
|
|
|
3517
3597
|
}
|
|
3518
3598
|
)
|
|
3519
3599
|
] }),
|
|
3520
|
-
/* @__PURE__ */ (0,
|
|
3521
|
-
/* @__PURE__ */ (0,
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
ref: trackRef,
|
|
3543
|
-
onPointerDown: handleTrackPointerDown,
|
|
3544
|
-
children: [
|
|
3545
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3546
|
-
"div",
|
|
3547
|
-
{
|
|
3548
|
-
className: cn(
|
|
3549
|
-
"absolute h-full rounded-4",
|
|
3550
|
-
disabled ? "bg-(--background-primary-disabled)" : "bg-(--background-secondary)"
|
|
3551
|
-
),
|
|
3552
|
-
style: {
|
|
3553
|
-
width: `calc(100% + ${thumbWidth}px)`,
|
|
3554
|
-
left: `-${thumbRadius}px`
|
|
3555
|
-
}
|
|
3600
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: cn("w-full flex flex-col gap-1", className), children: [
|
|
3601
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "relative w-full", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
3602
|
+
"div",
|
|
3603
|
+
{
|
|
3604
|
+
className: cn(
|
|
3605
|
+
"relative w-full flex items-center rounded-4",
|
|
3606
|
+
disabled ? "bg-(--background-slider-track-disabled) cursor-default" : "bg-(--background-slider-track) cursor-pointer"
|
|
3607
|
+
),
|
|
3608
|
+
style: { height: `${trackHeight}px` },
|
|
3609
|
+
ref: trackRef,
|
|
3610
|
+
onPointerDown: handleTrackPointerDown,
|
|
3611
|
+
children: [
|
|
3612
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3613
|
+
"div",
|
|
3614
|
+
{
|
|
3615
|
+
className: cn(
|
|
3616
|
+
"absolute h-full rounded-4",
|
|
3617
|
+
disabled ? "bg-(--background-slider-track-disabled)" : "bg-(--background-slider-track)"
|
|
3618
|
+
),
|
|
3619
|
+
style: {
|
|
3620
|
+
width: `calc(100% + ${thumbWidth}px)`,
|
|
3621
|
+
left: `-${thumbRadius}px`
|
|
3556
3622
|
}
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
showNumeric && /* @__PURE__ */ (0,
|
|
3623
|
+
}
|
|
3624
|
+
),
|
|
3625
|
+
renderHandle(0, primaryPercent, formatDisplayValue(primary)),
|
|
3626
|
+
isRange && secondary !== void 0 && renderHandle(1, secondaryPercent, formatDisplayValue(secondary))
|
|
3627
|
+
]
|
|
3628
|
+
}
|
|
3629
|
+
) }),
|
|
3630
|
+
showNumeric && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3565
3631
|
"p",
|
|
3566
3632
|
{
|
|
3567
3633
|
className: cn(
|
|
@@ -3579,9 +3645,9 @@ var Slider = (props) => {
|
|
|
3579
3645
|
Slider.displayName = "Slider";
|
|
3580
3646
|
|
|
3581
3647
|
// src/components/Inputs/TextArea.tsx
|
|
3582
|
-
var
|
|
3648
|
+
var React36 = __toESM(require("react"), 1);
|
|
3583
3649
|
var import_icons13 = require("@bubo-squared/icons");
|
|
3584
|
-
var
|
|
3650
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3585
3651
|
var TextArea = (props) => {
|
|
3586
3652
|
const {
|
|
3587
3653
|
label,
|
|
@@ -3601,7 +3667,7 @@ var TextArea = (props) => {
|
|
|
3601
3667
|
...textareaProps
|
|
3602
3668
|
} = props;
|
|
3603
3669
|
const isControlled = value !== void 0;
|
|
3604
|
-
const [internalValue, setInternalValue] =
|
|
3670
|
+
const [internalValue, setInternalValue] = React36.useState(
|
|
3605
3671
|
defaultValue ?? ""
|
|
3606
3672
|
);
|
|
3607
3673
|
const currentValue = (isControlled ? value : internalValue) ?? "";
|
|
@@ -3609,10 +3675,10 @@ var TextArea = (props) => {
|
|
|
3609
3675
|
const currentLength = currentValue.length;
|
|
3610
3676
|
const effectiveMaxLength = type === "character-limit" ? maxLength ?? 144 : void 0;
|
|
3611
3677
|
const showCharacterLimit = type === "character-limit" && typeof effectiveMaxLength === "number";
|
|
3612
|
-
const textareaRef =
|
|
3613
|
-
const containerRef =
|
|
3614
|
-
const [height, setHeight] =
|
|
3615
|
-
const [width, setWidth] =
|
|
3678
|
+
const textareaRef = React36.useRef(null);
|
|
3679
|
+
const containerRef = React36.useRef(null);
|
|
3680
|
+
const [height, setHeight] = React36.useState(void 0);
|
|
3681
|
+
const [width, setWidth] = React36.useState(void 0);
|
|
3616
3682
|
const minHeight = 80;
|
|
3617
3683
|
const minWidth = 240;
|
|
3618
3684
|
const handleContainerClick = () => {
|
|
@@ -3625,7 +3691,7 @@ var TextArea = (props) => {
|
|
|
3625
3691
|
}
|
|
3626
3692
|
onChange?.(event);
|
|
3627
3693
|
};
|
|
3628
|
-
const generatedId =
|
|
3694
|
+
const generatedId = React36.useId();
|
|
3629
3695
|
const textareaId = id ?? generatedId;
|
|
3630
3696
|
const statusBorderClass = {
|
|
3631
3697
|
default: "",
|
|
@@ -3662,7 +3728,7 @@ var TextArea = (props) => {
|
|
|
3662
3728
|
window.addEventListener("pointermove", handlePointerMove);
|
|
3663
3729
|
window.addEventListener("pointerup", handlePointerUp);
|
|
3664
3730
|
};
|
|
3665
|
-
return /* @__PURE__ */ (0,
|
|
3731
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3666
3732
|
Field,
|
|
3667
3733
|
{
|
|
3668
3734
|
className: "w-full",
|
|
@@ -3671,7 +3737,7 @@ var TextArea = (props) => {
|
|
|
3671
3737
|
hideHint,
|
|
3672
3738
|
status,
|
|
3673
3739
|
disabled,
|
|
3674
|
-
children: /* @__PURE__ */ (0,
|
|
3740
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
3675
3741
|
"div",
|
|
3676
3742
|
{
|
|
3677
3743
|
className: cn(
|
|
@@ -3690,7 +3756,7 @@ var TextArea = (props) => {
|
|
|
3690
3756
|
onClick: handleContainerClick,
|
|
3691
3757
|
"aria-disabled": disabled || void 0,
|
|
3692
3758
|
children: [
|
|
3693
|
-
/* @__PURE__ */ (0,
|
|
3759
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3694
3760
|
"textarea",
|
|
3695
3761
|
{
|
|
3696
3762
|
id: textareaId,
|
|
@@ -3710,7 +3776,7 @@ var TextArea = (props) => {
|
|
|
3710
3776
|
...textareaProps
|
|
3711
3777
|
}
|
|
3712
3778
|
),
|
|
3713
|
-
showCharacterLimit && /* @__PURE__ */ (0,
|
|
3779
|
+
showCharacterLimit && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
3714
3780
|
"span",
|
|
3715
3781
|
{
|
|
3716
3782
|
className: cn(
|
|
@@ -3724,19 +3790,19 @@ var TextArea = (props) => {
|
|
|
3724
3790
|
]
|
|
3725
3791
|
}
|
|
3726
3792
|
),
|
|
3727
|
-
type === "responsive" && /* @__PURE__ */ (0,
|
|
3793
|
+
type === "responsive" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3728
3794
|
"div",
|
|
3729
3795
|
{
|
|
3730
3796
|
className: "absolute bottom-1 right-1 h-3 w-3 " + (disabled ? "cursor-auto" : "cursor-nwse-resize"),
|
|
3731
3797
|
onPointerDown: disabled ? void 0 : handleResizePointerDown,
|
|
3732
|
-
children: /* @__PURE__ */ (0,
|
|
3798
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
3733
3799
|
"span",
|
|
3734
3800
|
{
|
|
3735
3801
|
className: cn(
|
|
3736
3802
|
"absolute bottom-0 right-0 flex h-4 w-4 items-center justify-center text-(--icon-primary)",
|
|
3737
3803
|
disabled && "text-(--icon-primary-disabled)"
|
|
3738
3804
|
),
|
|
3739
|
-
children: /* @__PURE__ */ (0,
|
|
3805
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_icons13.MaximizeIcon, {})
|
|
3740
3806
|
}
|
|
3741
3807
|
)
|
|
3742
3808
|
}
|
|
@@ -3750,9 +3816,9 @@ var TextArea = (props) => {
|
|
|
3750
3816
|
TextArea.displayName = "TextArea";
|
|
3751
3817
|
|
|
3752
3818
|
// src/components/Inputs/TextInput.tsx
|
|
3753
|
-
var
|
|
3819
|
+
var React37 = __toESM(require("react"), 1);
|
|
3754
3820
|
var import_class_variance_authority20 = require("class-variance-authority");
|
|
3755
|
-
var
|
|
3821
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3756
3822
|
var inputTextVariants3 = (0, import_class_variance_authority20.cva)("truncate", {
|
|
3757
3823
|
variants: {
|
|
3758
3824
|
size: {
|
|
@@ -3803,11 +3869,11 @@ var TextInput = (props) => {
|
|
|
3803
3869
|
...inputProps
|
|
3804
3870
|
} = props;
|
|
3805
3871
|
const isControlled = value !== void 0;
|
|
3806
|
-
const [internalValue, setInternalValue] =
|
|
3872
|
+
const [internalValue, setInternalValue] = React37.useState(
|
|
3807
3873
|
defaultValue ?? ""
|
|
3808
3874
|
);
|
|
3809
3875
|
const currentValue = (isControlled ? value : internalValue) ?? "";
|
|
3810
|
-
const inputRef =
|
|
3876
|
+
const inputRef = React37.useRef(null);
|
|
3811
3877
|
const handleContainerClick = () => {
|
|
3812
3878
|
if (disabled) return;
|
|
3813
3879
|
inputRef.current?.focus();
|
|
@@ -3820,7 +3886,7 @@ var TextInput = (props) => {
|
|
|
3820
3886
|
};
|
|
3821
3887
|
const showLeadingIcon = !!leadingIcon;
|
|
3822
3888
|
const showTrailingIcon = !!trailingIcon;
|
|
3823
|
-
return /* @__PURE__ */ (0,
|
|
3889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3824
3890
|
Field,
|
|
3825
3891
|
{
|
|
3826
3892
|
label,
|
|
@@ -3828,7 +3894,7 @@ var TextInput = (props) => {
|
|
|
3828
3894
|
hideHint,
|
|
3829
3895
|
status,
|
|
3830
3896
|
disabled,
|
|
3831
|
-
children: /* @__PURE__ */ (0,
|
|
3897
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
|
|
3832
3898
|
InputShell,
|
|
3833
3899
|
{
|
|
3834
3900
|
size,
|
|
@@ -3837,7 +3903,7 @@ var TextInput = (props) => {
|
|
|
3837
3903
|
className,
|
|
3838
3904
|
onClick: handleContainerClick,
|
|
3839
3905
|
children: [
|
|
3840
|
-
showLeadingIcon && /* @__PURE__ */ (0,
|
|
3906
|
+
showLeadingIcon && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3841
3907
|
"span",
|
|
3842
3908
|
{
|
|
3843
3909
|
className: cn(
|
|
@@ -3846,7 +3912,7 @@ var TextInput = (props) => {
|
|
|
3846
3912
|
children: leadingIcon
|
|
3847
3913
|
}
|
|
3848
3914
|
),
|
|
3849
|
-
/* @__PURE__ */ (0,
|
|
3915
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3850
3916
|
Input,
|
|
3851
3917
|
{
|
|
3852
3918
|
ref: inputRef,
|
|
@@ -3864,7 +3930,7 @@ var TextInput = (props) => {
|
|
|
3864
3930
|
...inputProps
|
|
3865
3931
|
}
|
|
3866
3932
|
),
|
|
3867
|
-
showTrailingIcon && /* @__PURE__ */ (0,
|
|
3933
|
+
showTrailingIcon && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3868
3934
|
"span",
|
|
3869
3935
|
{
|
|
3870
3936
|
className: cn(
|
|
@@ -3882,11 +3948,11 @@ var TextInput = (props) => {
|
|
|
3882
3948
|
TextInput.displayName = "TextInput";
|
|
3883
3949
|
|
|
3884
3950
|
// src/components/Inputs/Toggle.tsx
|
|
3885
|
-
var
|
|
3886
|
-
var
|
|
3951
|
+
var React38 = require("react");
|
|
3952
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3887
3953
|
var Toggle = (props) => {
|
|
3888
3954
|
const { label, className, disabled, ...inputProps } = props;
|
|
3889
|
-
return /* @__PURE__ */ (0,
|
|
3955
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
3890
3956
|
"label",
|
|
3891
3957
|
{
|
|
3892
3958
|
className: cn(
|
|
@@ -3894,8 +3960,8 @@ var Toggle = (props) => {
|
|
|
3894
3960
|
disabled ? "cursor-default" : "cursor-pointer"
|
|
3895
3961
|
),
|
|
3896
3962
|
children: [
|
|
3897
|
-
/* @__PURE__ */ (0,
|
|
3898
|
-
/* @__PURE__ */ (0,
|
|
3963
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("span", { className: "relative inline-flex items-center", children: [
|
|
3964
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3899
3965
|
"input",
|
|
3900
3966
|
{
|
|
3901
3967
|
type: "checkbox",
|
|
@@ -3904,7 +3970,7 @@ var Toggle = (props) => {
|
|
|
3904
3970
|
...inputProps
|
|
3905
3971
|
}
|
|
3906
3972
|
),
|
|
3907
|
-
/* @__PURE__ */ (0,
|
|
3973
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3908
3974
|
"span",
|
|
3909
3975
|
{
|
|
3910
3976
|
className: cn(
|
|
@@ -3944,7 +4010,7 @@ var Toggle = (props) => {
|
|
|
3944
4010
|
"peer-disabled:[&>.knob]:peer-checked:bg-(--background-primary-hover)",
|
|
3945
4011
|
className
|
|
3946
4012
|
),
|
|
3947
|
-
children: /* @__PURE__ */ (0,
|
|
4013
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3948
4014
|
"span",
|
|
3949
4015
|
{
|
|
3950
4016
|
className: cn(
|
|
@@ -3956,7 +4022,7 @@ var Toggle = (props) => {
|
|
|
3956
4022
|
}
|
|
3957
4023
|
)
|
|
3958
4024
|
] }),
|
|
3959
|
-
label && /* @__PURE__ */ (0,
|
|
4025
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
3960
4026
|
"span",
|
|
3961
4027
|
{
|
|
3962
4028
|
className: cn(
|
|
@@ -3973,8 +4039,8 @@ var Toggle = (props) => {
|
|
|
3973
4039
|
Toggle.displayName = "Toggle";
|
|
3974
4040
|
|
|
3975
4041
|
// src/components/Inputs/WebsiteInput.tsx
|
|
3976
|
-
var
|
|
3977
|
-
var
|
|
4042
|
+
var React39 = require("react");
|
|
4043
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3978
4044
|
var WebsiteInput = (props) => {
|
|
3979
4045
|
const {
|
|
3980
4046
|
hierarchy = "leading",
|
|
@@ -4011,15 +4077,15 @@ var WebsiteInput = (props) => {
|
|
|
4011
4077
|
size === "xl" ? "[&>svg]:w-6 [&>svg]:h-6" : size === "sm" ? "[&>svg]:w-4 [&>svg]:h-4" : "[&>svg]:w-5 [&>svg]:h-5",
|
|
4012
4078
|
disabled ? "text-(--icon-primary-disabled)" : "text-(--icon-primary) group-hover:text-(--icon-primary-hover) group-focus-within:text-(--icon-primary-focus)"
|
|
4013
4079
|
);
|
|
4014
|
-
const leadingAddon = /* @__PURE__ */ (0,
|
|
4015
|
-
/* @__PURE__ */ (0,
|
|
4016
|
-
icon != null && /* @__PURE__ */ (0,
|
|
4080
|
+
const leadingAddon = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: baseAddonClass, children: [
|
|
4081
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: addonTextClass, children: protocolLabel }),
|
|
4082
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: iconWrapperClass, children: icon })
|
|
4017
4083
|
] });
|
|
4018
|
-
const trailingAddon = /* @__PURE__ */ (0,
|
|
4019
|
-
icon != null && /* @__PURE__ */ (0,
|
|
4020
|
-
/* @__PURE__ */ (0,
|
|
4084
|
+
const trailingAddon = /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: baseAddonClass, children: [
|
|
4085
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: iconWrapperClass, children: icon }),
|
|
4086
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: addonTextClass, children: protocolLabel })
|
|
4021
4087
|
] });
|
|
4022
|
-
return /* @__PURE__ */ (0,
|
|
4088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4023
4089
|
TextInput,
|
|
4024
4090
|
{
|
|
4025
4091
|
...rest,
|
|
@@ -4034,9 +4100,9 @@ var WebsiteInput = (props) => {
|
|
|
4034
4100
|
WebsiteInput.displayName = "WebsiteInput";
|
|
4035
4101
|
|
|
4036
4102
|
// src/components/Feedback/Popover.tsx
|
|
4037
|
-
var
|
|
4103
|
+
var React40 = __toESM(require("react"), 1);
|
|
4038
4104
|
var PopoverPrimitive2 = __toESM(require("@radix-ui/react-popover"), 1);
|
|
4039
|
-
var
|
|
4105
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4040
4106
|
var PopoverArrow = PopoverPrimitive2.Arrow;
|
|
4041
4107
|
var Popover2 = (props) => {
|
|
4042
4108
|
const {
|
|
@@ -4053,7 +4119,7 @@ var Popover2 = (props) => {
|
|
|
4053
4119
|
offset = 10,
|
|
4054
4120
|
children
|
|
4055
4121
|
} = props;
|
|
4056
|
-
const [open, setOpen] =
|
|
4122
|
+
const [open, setOpen] = React40.useState(false);
|
|
4057
4123
|
const handleCancel = () => {
|
|
4058
4124
|
onCancel?.();
|
|
4059
4125
|
setOpen(false);
|
|
@@ -4095,9 +4161,9 @@ var Popover2 = (props) => {
|
|
|
4095
4161
|
}
|
|
4096
4162
|
};
|
|
4097
4163
|
const { side, align } = mapPlacementToSideAndAlign2(placement);
|
|
4098
|
-
return /* @__PURE__ */ (0,
|
|
4099
|
-
/* @__PURE__ */ (0,
|
|
4100
|
-
/* @__PURE__ */ (0,
|
|
4164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
4165
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PopoverTrigger, { asChild: true, children }),
|
|
4166
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4101
4167
|
PopoverContent,
|
|
4102
4168
|
{
|
|
4103
4169
|
side,
|
|
@@ -4105,16 +4171,16 @@ var Popover2 = (props) => {
|
|
|
4105
4171
|
sideOffset: offset,
|
|
4106
4172
|
className: cn(popoverClasses, className),
|
|
4107
4173
|
children: [
|
|
4108
|
-
showArrow && /* @__PURE__ */ (0,
|
|
4109
|
-
/* @__PURE__ */ (0,
|
|
4110
|
-
/* @__PURE__ */ (0,
|
|
4111
|
-
/* @__PURE__ */ (0,
|
|
4112
|
-
/* @__PURE__ */ (0,
|
|
4113
|
-
/* @__PURE__ */ (0,
|
|
4174
|
+
showArrow && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PopoverArrow, { className: popoverArrowClasses }),
|
|
4175
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "grid gap-4", children: [
|
|
4176
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "space-y-2", children: [
|
|
4177
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "caption text-secondary", children: strapline }),
|
|
4178
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h4", { className: "subtitle-medium text-primary", children: title }),
|
|
4179
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "paragraph-sm text-primary", children: description })
|
|
4114
4180
|
] }),
|
|
4115
|
-
/* @__PURE__ */ (0,
|
|
4116
|
-
/* @__PURE__ */ (0,
|
|
4117
|
-
/* @__PURE__ */ (0,
|
|
4181
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex justify-start items-center gap-4 flex-wrap", children: [
|
|
4182
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { size: "sm", variant: "secondary", onClick: handleCancel, children: cancelText || "Cancel" }),
|
|
4183
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Button, { size: "sm", variant: "primary", onClick: handleOk, children: okText || "Ok" })
|
|
4118
4184
|
] })
|
|
4119
4185
|
] })
|
|
4120
4186
|
]
|
|
@@ -4124,91 +4190,6 @@ var Popover2 = (props) => {
|
|
|
4124
4190
|
};
|
|
4125
4191
|
Popover2.displayName = "Popover";
|
|
4126
4192
|
|
|
4127
|
-
// src/components/Feedback/Tooltip.tsx
|
|
4128
|
-
var React40 = require("react");
|
|
4129
|
-
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
4130
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4131
|
-
var TooltipArrow = TooltipPrimitive.Arrow;
|
|
4132
|
-
var mapPlacementToSideAndAlign = (placement) => {
|
|
4133
|
-
switch (placement) {
|
|
4134
|
-
case "top":
|
|
4135
|
-
return { side: "top", align: "center" };
|
|
4136
|
-
case "topLeft":
|
|
4137
|
-
return { side: "top", align: "start" };
|
|
4138
|
-
case "topRight":
|
|
4139
|
-
return { side: "top", align: "end" };
|
|
4140
|
-
case "bottom":
|
|
4141
|
-
return { side: "bottom", align: "center" };
|
|
4142
|
-
case "bottomLeft":
|
|
4143
|
-
return { side: "bottom", align: "start" };
|
|
4144
|
-
case "bottomRight":
|
|
4145
|
-
return { side: "bottom", align: "end" };
|
|
4146
|
-
case "left":
|
|
4147
|
-
return { side: "left", align: "center" };
|
|
4148
|
-
case "leftTop":
|
|
4149
|
-
return { side: "left", align: "start" };
|
|
4150
|
-
case "leftBottom":
|
|
4151
|
-
return { side: "left", align: "end" };
|
|
4152
|
-
case "right":
|
|
4153
|
-
return { side: "right", align: "center" };
|
|
4154
|
-
case "rightTop":
|
|
4155
|
-
return { side: "right", align: "start" };
|
|
4156
|
-
case "rightBottom":
|
|
4157
|
-
return { side: "right", align: "end" };
|
|
4158
|
-
default:
|
|
4159
|
-
return { side: "top", align: "center" };
|
|
4160
|
-
}
|
|
4161
|
-
};
|
|
4162
|
-
var Tooltip = (props) => {
|
|
4163
|
-
const {
|
|
4164
|
-
strapline,
|
|
4165
|
-
title,
|
|
4166
|
-
description,
|
|
4167
|
-
showArrow = true,
|
|
4168
|
-
className,
|
|
4169
|
-
placement = "top",
|
|
4170
|
-
offset = 10,
|
|
4171
|
-
disableHoverableContent,
|
|
4172
|
-
open,
|
|
4173
|
-
defaultOpen,
|
|
4174
|
-
onOpenChange,
|
|
4175
|
-
children
|
|
4176
|
-
} = props;
|
|
4177
|
-
const { side, align } = mapPlacementToSideAndAlign(placement);
|
|
4178
|
-
const tooltipClasses = "group bg-(--background-popover) max-w-[calc(100vw-2rem)] shadow-card-md border-none rounded-4 p-4 [&>span]:scale-200 data-[state=delayed-open]:animate-in data-[state=instant-open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=delayed-open]:fade-in-0 data-[state=instant-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-[state=instant-open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";
|
|
4179
|
-
const tooltipArrowClasses = "relative fill-(--background-popover) transition-[filter,transform] group-data-[side=top]:top-[-2px] group-data-[side=top]:drop-shadow-[0px_1px_1px_color-mix(in_srgb,_var(--color-b-black-10)_66%,_transparent)] group-data-[side=bottom]:drop-shadow-[0px_1px_1px_color-mix(in_srgb,_var(--color-b-black-10)_66%,_transparent)] group-data-[side=left]:drop-shadow-[0px_2px_1px_color-mix(in_srgb,_var(--color-b-black-10)_66%,_transparent)] group-data-[side=right]:drop-shadow-[0px_2px_1px_color-mix(in_srgb,_var(--color-b-black-10)_66%,_transparent)]";
|
|
4180
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4181
|
-
TooltipPrimitive.Root,
|
|
4182
|
-
{
|
|
4183
|
-
open,
|
|
4184
|
-
defaultOpen,
|
|
4185
|
-
onOpenChange,
|
|
4186
|
-
disableHoverableContent,
|
|
4187
|
-
children: [
|
|
4188
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipPrimitive.Trigger, { asChild: true, children }),
|
|
4189
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
4190
|
-
TooltipPrimitive.Content,
|
|
4191
|
-
{
|
|
4192
|
-
side,
|
|
4193
|
-
align,
|
|
4194
|
-
sideOffset: offset,
|
|
4195
|
-
className: cn(tooltipClasses, className),
|
|
4196
|
-
children: [
|
|
4197
|
-
showArrow && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(TooltipArrow, { className: tooltipArrowClasses }),
|
|
4198
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "grid gap-2", children: [
|
|
4199
|
-
(strapline ?? "") !== "" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "caption text-secondary", children: strapline }),
|
|
4200
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h4", { className: "subtitle-medium text-primary", children: title }),
|
|
4201
|
-
(description ?? "") !== "" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "paragraph-sm text-primary", children: description })
|
|
4202
|
-
] })
|
|
4203
|
-
]
|
|
4204
|
-
}
|
|
4205
|
-
) })
|
|
4206
|
-
]
|
|
4207
|
-
}
|
|
4208
|
-
);
|
|
4209
|
-
};
|
|
4210
|
-
Tooltip.displayName = "Tooltip";
|
|
4211
|
-
|
|
4212
4193
|
// src/components/Feedback/TooltipProvider.tsx
|
|
4213
4194
|
var React41 = require("react");
|
|
4214
4195
|
var TooltipPrimitive2 = __toESM(require("@radix-ui/react-tooltip"), 1);
|