@bubo-squared/ui-framework 0.2.15 → 0.2.16
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 +251 -276
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +250 -275
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,10 +36,10 @@ var buttonVariants = cva(
|
|
|
36
36
|
]
|
|
37
37
|
},
|
|
38
38
|
size: {
|
|
39
|
-
sm: ["px-
|
|
40
|
-
md: ["px-2", "py-1", "gap-
|
|
41
|
-
lg: ["px-2.5", "py-1", "gap-
|
|
42
|
-
xl: ["px-3", "py-0.5", "gap-
|
|
39
|
+
sm: ["px-2", "py-1", "gap-2", "h-9"],
|
|
40
|
+
md: ["px-2", "py-1", "gap-2", "h-10"],
|
|
41
|
+
lg: ["px-2.5", "py-1", "gap-2.5", "h-11"],
|
|
42
|
+
xl: ["px-3", "py-0.5", "gap-3", "h-12"]
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
defaultVariants: {
|
|
@@ -52,19 +52,19 @@ var buttonIconVariants = cva("relative", {
|
|
|
52
52
|
variants: {
|
|
53
53
|
size: {
|
|
54
54
|
sm: ["size-5", "*:size-5"],
|
|
55
|
-
md: ["size-
|
|
55
|
+
md: ["size-5", "*:size-5"],
|
|
56
56
|
lg: ["size-6", "*:size-6"],
|
|
57
|
-
xl: ["size-
|
|
57
|
+
xl: ["size-7", "*:size-7"]
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
var buttonTextVariants = cva("flex text-center justify-center font-normal", {
|
|
62
62
|
variants: {
|
|
63
63
|
size: {
|
|
64
|
-
sm: ["
|
|
65
|
-
md: ["
|
|
66
|
-
lg: ["
|
|
67
|
-
xl: ["
|
|
64
|
+
sm: ["paragraph-sm"],
|
|
65
|
+
md: ["paragraph-md"],
|
|
66
|
+
lg: ["paragraph-lg"],
|
|
67
|
+
xl: ["subtitle"]
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
});
|
|
@@ -138,7 +138,7 @@ import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
|
138
138
|
import { cva as cva3 } from "class-variance-authority";
|
|
139
139
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
140
140
|
var iconButtonVariants = cva3(
|
|
141
|
-
"inline-flex items-center justify-center whitespace-nowrap
|
|
141
|
+
"inline-flex items-center justify-center whitespace-nowrap transition-colors disabled:pointer-events-none overflow-hidden p-1.5 cursor-pointer",
|
|
142
142
|
{
|
|
143
143
|
variants: {
|
|
144
144
|
variant: {
|
|
@@ -180,13 +180,14 @@ var IconButton = React2.forwardRef(
|
|
|
180
180
|
size,
|
|
181
181
|
asChild = false,
|
|
182
182
|
icon,
|
|
183
|
+
round = false,
|
|
183
184
|
...rest
|
|
184
185
|
} = props;
|
|
185
186
|
const Comp = asChild ? Slot2 : "button";
|
|
186
187
|
return /* @__PURE__ */ jsx4(
|
|
187
188
|
Comp,
|
|
188
189
|
{
|
|
189
|
-
className: cn(iconButtonVariants({ variant, size }), className),
|
|
190
|
+
className: cn(iconButtonVariants({ variant, size }), round ? "rounded-full" : "rounded-4", className),
|
|
190
191
|
ref,
|
|
191
192
|
...rest,
|
|
192
193
|
children: /* @__PURE__ */ jsx4("div", { className: "buttonIcon flex items-center justify-center", children: icon })
|
|
@@ -1637,6 +1638,8 @@ var Autocomplete = (props) => {
|
|
|
1637
1638
|
inputValue,
|
|
1638
1639
|
defaultInputValue,
|
|
1639
1640
|
onInputChange,
|
|
1641
|
+
dropdownClassName,
|
|
1642
|
+
listboxClassName,
|
|
1640
1643
|
placeholder = "Search\u2026",
|
|
1641
1644
|
onKeyDown,
|
|
1642
1645
|
onFocus,
|
|
@@ -1797,7 +1800,8 @@ var Autocomplete = (props) => {
|
|
|
1797
1800
|
className: cn(
|
|
1798
1801
|
"absolute left-0 right-0 mt-1",
|
|
1799
1802
|
dropdownSurfaceClass,
|
|
1800
|
-
dropdownScrollClass
|
|
1803
|
+
dropdownScrollClass,
|
|
1804
|
+
dropdownClassName
|
|
1801
1805
|
),
|
|
1802
1806
|
children: loading ? /* @__PURE__ */ jsx25(
|
|
1803
1807
|
"div",
|
|
@@ -1813,23 +1817,31 @@ var Autocomplete = (props) => {
|
|
|
1813
1817
|
"aria-live": "polite",
|
|
1814
1818
|
children: noOptionsText
|
|
1815
1819
|
}
|
|
1816
|
-
) : /* @__PURE__ */ jsx25(
|
|
1817
|
-
"
|
|
1820
|
+
) : /* @__PURE__ */ jsx25(
|
|
1821
|
+
"ul",
|
|
1818
1822
|
{
|
|
1819
|
-
id:
|
|
1820
|
-
role: "
|
|
1821
|
-
"
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1823
|
+
id: listboxId,
|
|
1824
|
+
role: "listbox",
|
|
1825
|
+
className: cn("flex flex-col", listboxClassName),
|
|
1826
|
+
children: options.map((option, index) => /* @__PURE__ */ jsx25(
|
|
1827
|
+
"li",
|
|
1828
|
+
{
|
|
1829
|
+
id: `${inputId}-option-${index}`,
|
|
1830
|
+
role: "option",
|
|
1831
|
+
"aria-selected": index === activeIndex,
|
|
1832
|
+
className: cn(
|
|
1833
|
+
optionVariants({ size, active: index === activeIndex }),
|
|
1834
|
+
"px-(--space-8) pr-(--space-16) text-primary cursor-pointer"
|
|
1835
|
+
),
|
|
1836
|
+
onMouseDown: handleOptionMouseDown,
|
|
1837
|
+
onMouseEnter: () => setActiveIndex(index),
|
|
1838
|
+
onClick: () => handleOptionClick(option),
|
|
1839
|
+
children: option
|
|
1840
|
+
},
|
|
1841
|
+
`${option}-${index}`
|
|
1842
|
+
))
|
|
1843
|
+
}
|
|
1844
|
+
)
|
|
1833
1845
|
}
|
|
1834
1846
|
)
|
|
1835
1847
|
] }) });
|
|
@@ -3069,8 +3081,95 @@ var SearchInput = (props) => {
|
|
|
3069
3081
|
SearchInput.displayName = "SearchInput";
|
|
3070
3082
|
|
|
3071
3083
|
// src/components/Inputs/Slider.tsx
|
|
3072
|
-
import * as
|
|
3073
|
-
|
|
3084
|
+
import * as React35 from "react";
|
|
3085
|
+
|
|
3086
|
+
// src/components/Feedback/Tooltip.tsx
|
|
3087
|
+
import "react";
|
|
3088
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
3089
|
+
import { jsx as jsx36, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3090
|
+
var TooltipArrow = TooltipPrimitive.Arrow;
|
|
3091
|
+
var mapPlacementToSideAndAlign = (placement) => {
|
|
3092
|
+
switch (placement) {
|
|
3093
|
+
case "top":
|
|
3094
|
+
return { side: "top", align: "center" };
|
|
3095
|
+
case "topLeft":
|
|
3096
|
+
return { side: "top", align: "start" };
|
|
3097
|
+
case "topRight":
|
|
3098
|
+
return { side: "top", align: "end" };
|
|
3099
|
+
case "bottom":
|
|
3100
|
+
return { side: "bottom", align: "center" };
|
|
3101
|
+
case "bottomLeft":
|
|
3102
|
+
return { side: "bottom", align: "start" };
|
|
3103
|
+
case "bottomRight":
|
|
3104
|
+
return { side: "bottom", align: "end" };
|
|
3105
|
+
case "left":
|
|
3106
|
+
return { side: "left", align: "center" };
|
|
3107
|
+
case "leftTop":
|
|
3108
|
+
return { side: "left", align: "start" };
|
|
3109
|
+
case "leftBottom":
|
|
3110
|
+
return { side: "left", align: "end" };
|
|
3111
|
+
case "right":
|
|
3112
|
+
return { side: "right", align: "center" };
|
|
3113
|
+
case "rightTop":
|
|
3114
|
+
return { side: "right", align: "start" };
|
|
3115
|
+
case "rightBottom":
|
|
3116
|
+
return { side: "right", align: "end" };
|
|
3117
|
+
default:
|
|
3118
|
+
return { side: "top", align: "center" };
|
|
3119
|
+
}
|
|
3120
|
+
};
|
|
3121
|
+
var Tooltip = (props) => {
|
|
3122
|
+
const {
|
|
3123
|
+
strapline,
|
|
3124
|
+
title,
|
|
3125
|
+
description,
|
|
3126
|
+
showArrow = true,
|
|
3127
|
+
className,
|
|
3128
|
+
placement = "top",
|
|
3129
|
+
offset = 10,
|
|
3130
|
+
disableHoverableContent,
|
|
3131
|
+
open,
|
|
3132
|
+
defaultOpen,
|
|
3133
|
+
onOpenChange,
|
|
3134
|
+
children
|
|
3135
|
+
} = props;
|
|
3136
|
+
const { side, align } = mapPlacementToSideAndAlign(placement);
|
|
3137
|
+
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";
|
|
3138
|
+
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)]";
|
|
3139
|
+
return /* @__PURE__ */ jsxs24(
|
|
3140
|
+
TooltipPrimitive.Root,
|
|
3141
|
+
{
|
|
3142
|
+
open,
|
|
3143
|
+
defaultOpen,
|
|
3144
|
+
onOpenChange,
|
|
3145
|
+
disableHoverableContent,
|
|
3146
|
+
children: [
|
|
3147
|
+
/* @__PURE__ */ jsx36(TooltipPrimitive.Trigger, { asChild: true, children }),
|
|
3148
|
+
/* @__PURE__ */ jsx36(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs24(
|
|
3149
|
+
TooltipPrimitive.Content,
|
|
3150
|
+
{
|
|
3151
|
+
side,
|
|
3152
|
+
align,
|
|
3153
|
+
sideOffset: offset,
|
|
3154
|
+
className: cn(tooltipClasses, className),
|
|
3155
|
+
children: [
|
|
3156
|
+
showArrow && /* @__PURE__ */ jsx36(TooltipArrow, { className: tooltipArrowClasses }),
|
|
3157
|
+
/* @__PURE__ */ jsxs24("div", { className: "grid gap-2", children: [
|
|
3158
|
+
(strapline ?? "") !== "" && /* @__PURE__ */ jsx36("span", { className: "caption text-secondary", children: strapline }),
|
|
3159
|
+
/* @__PURE__ */ jsx36("h4", { className: "subtitle-medium text-primary", children: title }),
|
|
3160
|
+
(description ?? "") !== "" && /* @__PURE__ */ jsx36("p", { className: "paragraph-sm text-primary", children: description })
|
|
3161
|
+
] })
|
|
3162
|
+
]
|
|
3163
|
+
}
|
|
3164
|
+
) })
|
|
3165
|
+
]
|
|
3166
|
+
}
|
|
3167
|
+
);
|
|
3168
|
+
};
|
|
3169
|
+
Tooltip.displayName = "Tooltip";
|
|
3170
|
+
|
|
3171
|
+
// src/components/Inputs/Slider.tsx
|
|
3172
|
+
import { Fragment as Fragment2, jsx as jsx37, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3074
3173
|
var wrapperBase = "flex flex-col gap-2 items-start";
|
|
3075
3174
|
var isRangeProps = (props) => {
|
|
3076
3175
|
return Array.isArray(props.value) || Array.isArray(props.defaultValue);
|
|
@@ -3097,7 +3196,7 @@ var Slider = (props) => {
|
|
|
3097
3196
|
const isRange = isRangeProps(props);
|
|
3098
3197
|
const isControlled = value !== void 0;
|
|
3099
3198
|
const expectedLength = isRange ? 2 : 1;
|
|
3100
|
-
const normalizeArray =
|
|
3199
|
+
const normalizeArray = React35.useCallback(
|
|
3101
3200
|
(arr, fallback) => {
|
|
3102
3201
|
if (!arr || arr.length === 0) return fallback;
|
|
3103
3202
|
if (arr.length === expectedLength) return arr;
|
|
@@ -3109,16 +3208,16 @@ var Slider = (props) => {
|
|
|
3109
3208
|
},
|
|
3110
3209
|
[expectedLength, max]
|
|
3111
3210
|
);
|
|
3112
|
-
const defaultInternal =
|
|
3211
|
+
const defaultInternal = React35.useMemo(() => {
|
|
3113
3212
|
const defaultValueArray = toArray(defaultValue);
|
|
3114
3213
|
if (defaultValueArray) return normalizeArray(defaultValueArray, []);
|
|
3115
3214
|
if (isRange) return [min, Math.min(min + (max - min) / 4, max)];
|
|
3116
3215
|
return [min + (max - min) / 3];
|
|
3117
3216
|
}, [defaultValue, min, max, isRange, normalizeArray]);
|
|
3118
|
-
const [internalValue, setInternalValue] =
|
|
3217
|
+
const [internalValue, setInternalValue] = React35.useState(
|
|
3119
3218
|
() => normalizeArray(isControlled ? toArray(value) : defaultInternal, defaultInternal)
|
|
3120
3219
|
);
|
|
3121
|
-
|
|
3220
|
+
React35.useEffect(() => {
|
|
3122
3221
|
if (isControlled) {
|
|
3123
3222
|
setInternalValue(
|
|
3124
3223
|
(current2) => normalizeArray(toArray(value), current2.length ? current2 : defaultInternal)
|
|
@@ -3126,15 +3225,16 @@ var Slider = (props) => {
|
|
|
3126
3225
|
}
|
|
3127
3226
|
}, [isControlled, value, normalizeArray, defaultInternal]);
|
|
3128
3227
|
const current = internalValue;
|
|
3129
|
-
const trackRef =
|
|
3130
|
-
const [draggingThumbIndex, setDraggingThumbIndex] =
|
|
3131
|
-
const [hoveredThumbIndex, setHoveredThumbIndex] =
|
|
3132
|
-
const
|
|
3228
|
+
const trackRef = React35.useRef(null);
|
|
3229
|
+
const [draggingThumbIndex, setDraggingThumbIndex] = React35.useState(null);
|
|
3230
|
+
const [hoveredThumbIndex, setHoveredThumbIndex] = React35.useState(null);
|
|
3231
|
+
const [focusedThumbIndex, setFocusedThumbIndex] = React35.useState(null);
|
|
3232
|
+
const clamp = React35.useCallback((val) => {
|
|
3133
3233
|
if (val < min) return min;
|
|
3134
3234
|
if (val > max) return max;
|
|
3135
3235
|
return val;
|
|
3136
3236
|
}, [min, max]);
|
|
3137
|
-
const enforceMinGap =
|
|
3237
|
+
const enforceMinGap = React35.useCallback((next, prev) => {
|
|
3138
3238
|
if (!isRange || next.length !== 2 || step <= 0) return next;
|
|
3139
3239
|
let [low, high] = next;
|
|
3140
3240
|
const [prevLow, prevHigh] = prev.length === 2 ? prev : next;
|
|
@@ -3158,7 +3258,7 @@ var Slider = (props) => {
|
|
|
3158
3258
|
}
|
|
3159
3259
|
return [low, high];
|
|
3160
3260
|
}, [isRange, step, clamp]);
|
|
3161
|
-
|
|
3261
|
+
React35.useEffect(() => {
|
|
3162
3262
|
if (!isControlled) {
|
|
3163
3263
|
setInternalValue((prev) => {
|
|
3164
3264
|
const clamped = prev.map((v) => clamp(v));
|
|
@@ -3292,7 +3392,6 @@ var Slider = (props) => {
|
|
|
3292
3392
|
const secondaryPercent = valueToPercent(secondary);
|
|
3293
3393
|
const showNumeric = display === "numeric";
|
|
3294
3394
|
const showTooltip = display === "tooltip";
|
|
3295
|
-
const isTooltipAbove = tooltipPlacement === "top";
|
|
3296
3395
|
const isDecimalDomain = !Number.isInteger(step) || !Number.isInteger(min) || !Number.isInteger(max);
|
|
3297
3396
|
const formatNumber = (num) => {
|
|
3298
3397
|
if (!isDecimalDomain) {
|
|
@@ -3327,55 +3426,11 @@ var Slider = (props) => {
|
|
|
3327
3426
|
const trackHeight = 32;
|
|
3328
3427
|
const thumbWidth = 18;
|
|
3329
3428
|
const thumbRadius = thumbWidth / 2;
|
|
3330
|
-
const renderTooltipBubble = (key, percent, labelText, isVisible) => /* @__PURE__ */ jsx36(
|
|
3331
|
-
"div",
|
|
3332
|
-
{
|
|
3333
|
-
className: cn(
|
|
3334
|
-
"absolute -translate-x-1/2 flex flex-col items-center",
|
|
3335
|
-
"transition-[opacity,transform] duration-150",
|
|
3336
|
-
isVisible ? "opacity-100 scale-100 pointer-events-auto" : "opacity-0 scale-95 pointer-events-none"
|
|
3337
|
-
),
|
|
3338
|
-
style: {
|
|
3339
|
-
left: `${percent}%`,
|
|
3340
|
-
bottom: isTooltipAbove ? "100%" : void 0,
|
|
3341
|
-
top: isTooltipAbove ? void 0 : "100%",
|
|
3342
|
-
marginBottom: isTooltipAbove ? 8 : void 0,
|
|
3343
|
-
marginTop: isTooltipAbove ? void 0 : 8
|
|
3344
|
-
},
|
|
3345
|
-
children: /* @__PURE__ */ jsxs24(
|
|
3346
|
-
"div",
|
|
3347
|
-
{
|
|
3348
|
-
className: cn("relative rounded-4 shadow-card-md px-(--space-8) py-(--space-4) bg-(--background-tooltip)"),
|
|
3349
|
-
children: [
|
|
3350
|
-
/* @__PURE__ */ jsx36(
|
|
3351
|
-
"p",
|
|
3352
|
-
{
|
|
3353
|
-
className: cn(
|
|
3354
|
-
"paragraph-sm",
|
|
3355
|
-
disabled ? "text-secondary" : "text-primary"
|
|
3356
|
-
),
|
|
3357
|
-
children: labelText
|
|
3358
|
-
}
|
|
3359
|
-
),
|
|
3360
|
-
/* @__PURE__ */ jsx36(
|
|
3361
|
-
"div",
|
|
3362
|
-
{
|
|
3363
|
-
className: cn(
|
|
3364
|
-
"absolute left-1/2 -translate-x-1/2 w-2 h-2 rotate-45 bg-(--background-tooltip)",
|
|
3365
|
-
isTooltipAbove ? "-bottom-1" : "-top-1"
|
|
3366
|
-
)
|
|
3367
|
-
}
|
|
3368
|
-
)
|
|
3369
|
-
]
|
|
3370
|
-
}
|
|
3371
|
-
)
|
|
3372
|
-
},
|
|
3373
|
-
key
|
|
3374
|
-
);
|
|
3375
3429
|
const renderHandle = (index, percent, ariaValueText) => {
|
|
3376
3430
|
const val = index === 0 ? primary : secondary;
|
|
3377
3431
|
const isDragging = draggingThumbIndex === index;
|
|
3378
|
-
|
|
3432
|
+
const isTooltipVisible = showTooltip && (hoveredThumbIndex === index || draggingThumbIndex === index || focusedThumbIndex === index);
|
|
3433
|
+
const handle = /* @__PURE__ */ jsx37(
|
|
3379
3434
|
"button",
|
|
3380
3435
|
{
|
|
3381
3436
|
type: "button",
|
|
@@ -3404,6 +3459,12 @@ var Slider = (props) => {
|
|
|
3404
3459
|
onPointerLeave: () => {
|
|
3405
3460
|
setHoveredThumbIndex((prev) => prev === index ? null : prev);
|
|
3406
3461
|
},
|
|
3462
|
+
onFocus: () => {
|
|
3463
|
+
setFocusedThumbIndex(index);
|
|
3464
|
+
},
|
|
3465
|
+
onBlur: () => {
|
|
3466
|
+
setFocusedThumbIndex((prev) => prev === index ? null : prev);
|
|
3467
|
+
},
|
|
3407
3468
|
onPointerDown: (event) => {
|
|
3408
3469
|
if (disabled) return;
|
|
3409
3470
|
if (event.button !== 0) return;
|
|
@@ -3414,15 +3475,28 @@ var Slider = (props) => {
|
|
|
3414
3475
|
},
|
|
3415
3476
|
index
|
|
3416
3477
|
);
|
|
3478
|
+
if (!showTooltip) return handle;
|
|
3479
|
+
return /* @__PURE__ */ jsx37(
|
|
3480
|
+
Tooltip,
|
|
3481
|
+
{
|
|
3482
|
+
title: ariaValueText,
|
|
3483
|
+
placement: tooltipPlacement === "top" ? "top" : "bottom",
|
|
3484
|
+
offset: 8,
|
|
3485
|
+
open: isTooltipVisible,
|
|
3486
|
+
disableHoverableContent: true,
|
|
3487
|
+
className: "z-50",
|
|
3488
|
+
children: handle
|
|
3489
|
+
}
|
|
3490
|
+
);
|
|
3417
3491
|
};
|
|
3418
|
-
return /* @__PURE__ */
|
|
3492
|
+
return /* @__PURE__ */ jsxs25(
|
|
3419
3493
|
"div",
|
|
3420
3494
|
{
|
|
3421
3495
|
className: wrapperBase,
|
|
3422
3496
|
style: { marginInline: `${thumbRadius}px` },
|
|
3423
3497
|
children: [
|
|
3424
|
-
name && /* @__PURE__ */
|
|
3425
|
-
/* @__PURE__ */
|
|
3498
|
+
name && /* @__PURE__ */ jsxs25(Fragment2, { children: [
|
|
3499
|
+
/* @__PURE__ */ jsx37(
|
|
3426
3500
|
"input",
|
|
3427
3501
|
{
|
|
3428
3502
|
type: "hidden",
|
|
@@ -3431,7 +3505,7 @@ var Slider = (props) => {
|
|
|
3431
3505
|
disabled
|
|
3432
3506
|
}
|
|
3433
3507
|
),
|
|
3434
|
-
isRange && secondary !== void 0 && /* @__PURE__ */
|
|
3508
|
+
isRange && secondary !== void 0 && /* @__PURE__ */ jsx37(
|
|
3435
3509
|
"input",
|
|
3436
3510
|
{
|
|
3437
3511
|
type: "hidden",
|
|
@@ -3441,51 +3515,37 @@ var Slider = (props) => {
|
|
|
3441
3515
|
}
|
|
3442
3516
|
)
|
|
3443
3517
|
] }),
|
|
3444
|
-
/* @__PURE__ */
|
|
3445
|
-
/* @__PURE__ */
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
ref: trackRef,
|
|
3467
|
-
onPointerDown: handleTrackPointerDown,
|
|
3468
|
-
children: [
|
|
3469
|
-
/* @__PURE__ */ jsx36(
|
|
3470
|
-
"div",
|
|
3471
|
-
{
|
|
3472
|
-
className: cn(
|
|
3473
|
-
"absolute h-full rounded-4",
|
|
3474
|
-
disabled ? "bg-(--background-primary-disabled)" : "bg-(--background-secondary)"
|
|
3475
|
-
),
|
|
3476
|
-
style: {
|
|
3477
|
-
width: `calc(100% + ${thumbWidth}px)`,
|
|
3478
|
-
left: `-${thumbRadius}px`
|
|
3479
|
-
}
|
|
3518
|
+
/* @__PURE__ */ jsxs25("div", { className: cn("w-full flex flex-col gap-1", className), children: [
|
|
3519
|
+
/* @__PURE__ */ jsx37("div", { className: "relative w-full", children: /* @__PURE__ */ jsxs25(
|
|
3520
|
+
"div",
|
|
3521
|
+
{
|
|
3522
|
+
className: cn(
|
|
3523
|
+
"relative w-full flex items-center rounded-4",
|
|
3524
|
+
disabled ? "bg-(--background-slider-track-disabled) cursor-default" : "bg-(--background-slider-track) cursor-pointer"
|
|
3525
|
+
),
|
|
3526
|
+
style: { height: `${trackHeight}px` },
|
|
3527
|
+
ref: trackRef,
|
|
3528
|
+
onPointerDown: handleTrackPointerDown,
|
|
3529
|
+
children: [
|
|
3530
|
+
/* @__PURE__ */ jsx37(
|
|
3531
|
+
"div",
|
|
3532
|
+
{
|
|
3533
|
+
className: cn(
|
|
3534
|
+
"absolute h-full rounded-4",
|
|
3535
|
+
disabled ? "bg-(--background-slider-track-disabled)" : "bg-(--background-slider-track)"
|
|
3536
|
+
),
|
|
3537
|
+
style: {
|
|
3538
|
+
width: `calc(100% + ${thumbWidth}px)`,
|
|
3539
|
+
left: `-${thumbRadius}px`
|
|
3480
3540
|
}
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
showNumeric && /* @__PURE__ */
|
|
3541
|
+
}
|
|
3542
|
+
),
|
|
3543
|
+
renderHandle(0, primaryPercent, formatDisplayValue(primary)),
|
|
3544
|
+
isRange && secondary !== void 0 && renderHandle(1, secondaryPercent, formatDisplayValue(secondary))
|
|
3545
|
+
]
|
|
3546
|
+
}
|
|
3547
|
+
) }),
|
|
3548
|
+
showNumeric && /* @__PURE__ */ jsx37(
|
|
3489
3549
|
"p",
|
|
3490
3550
|
{
|
|
3491
3551
|
className: cn(
|
|
@@ -3503,9 +3563,9 @@ var Slider = (props) => {
|
|
|
3503
3563
|
Slider.displayName = "Slider";
|
|
3504
3564
|
|
|
3505
3565
|
// src/components/Inputs/TextArea.tsx
|
|
3506
|
-
import * as
|
|
3566
|
+
import * as React36 from "react";
|
|
3507
3567
|
import { MaximizeIcon } from "@bubo-squared/icons";
|
|
3508
|
-
import { jsx as
|
|
3568
|
+
import { jsx as jsx38, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3509
3569
|
var TextArea = (props) => {
|
|
3510
3570
|
const {
|
|
3511
3571
|
label,
|
|
@@ -3525,7 +3585,7 @@ var TextArea = (props) => {
|
|
|
3525
3585
|
...textareaProps
|
|
3526
3586
|
} = props;
|
|
3527
3587
|
const isControlled = value !== void 0;
|
|
3528
|
-
const [internalValue, setInternalValue] =
|
|
3588
|
+
const [internalValue, setInternalValue] = React36.useState(
|
|
3529
3589
|
defaultValue ?? ""
|
|
3530
3590
|
);
|
|
3531
3591
|
const currentValue = (isControlled ? value : internalValue) ?? "";
|
|
@@ -3533,10 +3593,10 @@ var TextArea = (props) => {
|
|
|
3533
3593
|
const currentLength = currentValue.length;
|
|
3534
3594
|
const effectiveMaxLength = type === "character-limit" ? maxLength ?? 144 : void 0;
|
|
3535
3595
|
const showCharacterLimit = type === "character-limit" && typeof effectiveMaxLength === "number";
|
|
3536
|
-
const textareaRef =
|
|
3537
|
-
const containerRef =
|
|
3538
|
-
const [height, setHeight] =
|
|
3539
|
-
const [width, setWidth] =
|
|
3596
|
+
const textareaRef = React36.useRef(null);
|
|
3597
|
+
const containerRef = React36.useRef(null);
|
|
3598
|
+
const [height, setHeight] = React36.useState(void 0);
|
|
3599
|
+
const [width, setWidth] = React36.useState(void 0);
|
|
3540
3600
|
const minHeight = 80;
|
|
3541
3601
|
const minWidth = 240;
|
|
3542
3602
|
const handleContainerClick = () => {
|
|
@@ -3549,7 +3609,7 @@ var TextArea = (props) => {
|
|
|
3549
3609
|
}
|
|
3550
3610
|
onChange?.(event);
|
|
3551
3611
|
};
|
|
3552
|
-
const generatedId =
|
|
3612
|
+
const generatedId = React36.useId();
|
|
3553
3613
|
const textareaId = id ?? generatedId;
|
|
3554
3614
|
const statusBorderClass = {
|
|
3555
3615
|
default: "",
|
|
@@ -3586,7 +3646,7 @@ var TextArea = (props) => {
|
|
|
3586
3646
|
window.addEventListener("pointermove", handlePointerMove);
|
|
3587
3647
|
window.addEventListener("pointerup", handlePointerUp);
|
|
3588
3648
|
};
|
|
3589
|
-
return /* @__PURE__ */
|
|
3649
|
+
return /* @__PURE__ */ jsx38(
|
|
3590
3650
|
Field,
|
|
3591
3651
|
{
|
|
3592
3652
|
className: "w-full",
|
|
@@ -3595,7 +3655,7 @@ var TextArea = (props) => {
|
|
|
3595
3655
|
hideHint,
|
|
3596
3656
|
status,
|
|
3597
3657
|
disabled,
|
|
3598
|
-
children: /* @__PURE__ */
|
|
3658
|
+
children: /* @__PURE__ */ jsxs26(
|
|
3599
3659
|
"div",
|
|
3600
3660
|
{
|
|
3601
3661
|
className: cn(
|
|
@@ -3614,7 +3674,7 @@ var TextArea = (props) => {
|
|
|
3614
3674
|
onClick: handleContainerClick,
|
|
3615
3675
|
"aria-disabled": disabled || void 0,
|
|
3616
3676
|
children: [
|
|
3617
|
-
/* @__PURE__ */
|
|
3677
|
+
/* @__PURE__ */ jsx38(
|
|
3618
3678
|
"textarea",
|
|
3619
3679
|
{
|
|
3620
3680
|
id: textareaId,
|
|
@@ -3634,7 +3694,7 @@ var TextArea = (props) => {
|
|
|
3634
3694
|
...textareaProps
|
|
3635
3695
|
}
|
|
3636
3696
|
),
|
|
3637
|
-
showCharacterLimit && /* @__PURE__ */
|
|
3697
|
+
showCharacterLimit && /* @__PURE__ */ jsxs26(
|
|
3638
3698
|
"span",
|
|
3639
3699
|
{
|
|
3640
3700
|
className: cn(
|
|
@@ -3648,19 +3708,19 @@ var TextArea = (props) => {
|
|
|
3648
3708
|
]
|
|
3649
3709
|
}
|
|
3650
3710
|
),
|
|
3651
|
-
type === "responsive" && /* @__PURE__ */
|
|
3711
|
+
type === "responsive" && /* @__PURE__ */ jsx38(
|
|
3652
3712
|
"div",
|
|
3653
3713
|
{
|
|
3654
3714
|
className: "absolute bottom-1 right-1 h-3 w-3 " + (disabled ? "cursor-auto" : "cursor-nwse-resize"),
|
|
3655
3715
|
onPointerDown: disabled ? void 0 : handleResizePointerDown,
|
|
3656
|
-
children: /* @__PURE__ */
|
|
3716
|
+
children: /* @__PURE__ */ jsx38(
|
|
3657
3717
|
"span",
|
|
3658
3718
|
{
|
|
3659
3719
|
className: cn(
|
|
3660
3720
|
"absolute bottom-0 right-0 flex h-4 w-4 items-center justify-center text-(--icon-primary)",
|
|
3661
3721
|
disabled && "text-(--icon-primary-disabled)"
|
|
3662
3722
|
),
|
|
3663
|
-
children: /* @__PURE__ */
|
|
3723
|
+
children: /* @__PURE__ */ jsx38(MaximizeIcon, {})
|
|
3664
3724
|
}
|
|
3665
3725
|
)
|
|
3666
3726
|
}
|
|
@@ -3674,9 +3734,9 @@ var TextArea = (props) => {
|
|
|
3674
3734
|
TextArea.displayName = "TextArea";
|
|
3675
3735
|
|
|
3676
3736
|
// src/components/Inputs/TextInput.tsx
|
|
3677
|
-
import * as
|
|
3737
|
+
import * as React37 from "react";
|
|
3678
3738
|
import { cva as cva20 } from "class-variance-authority";
|
|
3679
|
-
import { jsx as
|
|
3739
|
+
import { jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3680
3740
|
var inputTextVariants3 = cva20("truncate", {
|
|
3681
3741
|
variants: {
|
|
3682
3742
|
size: {
|
|
@@ -3727,11 +3787,11 @@ var TextInput = (props) => {
|
|
|
3727
3787
|
...inputProps
|
|
3728
3788
|
} = props;
|
|
3729
3789
|
const isControlled = value !== void 0;
|
|
3730
|
-
const [internalValue, setInternalValue] =
|
|
3790
|
+
const [internalValue, setInternalValue] = React37.useState(
|
|
3731
3791
|
defaultValue ?? ""
|
|
3732
3792
|
);
|
|
3733
3793
|
const currentValue = (isControlled ? value : internalValue) ?? "";
|
|
3734
|
-
const inputRef =
|
|
3794
|
+
const inputRef = React37.useRef(null);
|
|
3735
3795
|
const handleContainerClick = () => {
|
|
3736
3796
|
if (disabled) return;
|
|
3737
3797
|
inputRef.current?.focus();
|
|
@@ -3744,7 +3804,7 @@ var TextInput = (props) => {
|
|
|
3744
3804
|
};
|
|
3745
3805
|
const showLeadingIcon = !!leadingIcon;
|
|
3746
3806
|
const showTrailingIcon = !!trailingIcon;
|
|
3747
|
-
return /* @__PURE__ */
|
|
3807
|
+
return /* @__PURE__ */ jsx39(
|
|
3748
3808
|
Field,
|
|
3749
3809
|
{
|
|
3750
3810
|
label,
|
|
@@ -3752,7 +3812,7 @@ var TextInput = (props) => {
|
|
|
3752
3812
|
hideHint,
|
|
3753
3813
|
status,
|
|
3754
3814
|
disabled,
|
|
3755
|
-
children: /* @__PURE__ */
|
|
3815
|
+
children: /* @__PURE__ */ jsxs27(
|
|
3756
3816
|
InputShell,
|
|
3757
3817
|
{
|
|
3758
3818
|
size,
|
|
@@ -3761,7 +3821,7 @@ var TextInput = (props) => {
|
|
|
3761
3821
|
className,
|
|
3762
3822
|
onClick: handleContainerClick,
|
|
3763
3823
|
children: [
|
|
3764
|
-
showLeadingIcon && /* @__PURE__ */
|
|
3824
|
+
showLeadingIcon && /* @__PURE__ */ jsx39(
|
|
3765
3825
|
"span",
|
|
3766
3826
|
{
|
|
3767
3827
|
className: cn(
|
|
@@ -3770,7 +3830,7 @@ var TextInput = (props) => {
|
|
|
3770
3830
|
children: leadingIcon
|
|
3771
3831
|
}
|
|
3772
3832
|
),
|
|
3773
|
-
/* @__PURE__ */
|
|
3833
|
+
/* @__PURE__ */ jsx39(
|
|
3774
3834
|
Input,
|
|
3775
3835
|
{
|
|
3776
3836
|
ref: inputRef,
|
|
@@ -3788,7 +3848,7 @@ var TextInput = (props) => {
|
|
|
3788
3848
|
...inputProps
|
|
3789
3849
|
}
|
|
3790
3850
|
),
|
|
3791
|
-
showTrailingIcon && /* @__PURE__ */
|
|
3851
|
+
showTrailingIcon && /* @__PURE__ */ jsx39(
|
|
3792
3852
|
"span",
|
|
3793
3853
|
{
|
|
3794
3854
|
className: cn(
|
|
@@ -3807,10 +3867,10 @@ TextInput.displayName = "TextInput";
|
|
|
3807
3867
|
|
|
3808
3868
|
// src/components/Inputs/Toggle.tsx
|
|
3809
3869
|
import "react";
|
|
3810
|
-
import { jsx as
|
|
3870
|
+
import { jsx as jsx40, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3811
3871
|
var Toggle = (props) => {
|
|
3812
3872
|
const { label, className, disabled, ...inputProps } = props;
|
|
3813
|
-
return /* @__PURE__ */
|
|
3873
|
+
return /* @__PURE__ */ jsxs28(
|
|
3814
3874
|
"label",
|
|
3815
3875
|
{
|
|
3816
3876
|
className: cn(
|
|
@@ -3818,8 +3878,8 @@ var Toggle = (props) => {
|
|
|
3818
3878
|
disabled ? "cursor-default" : "cursor-pointer"
|
|
3819
3879
|
),
|
|
3820
3880
|
children: [
|
|
3821
|
-
/* @__PURE__ */
|
|
3822
|
-
/* @__PURE__ */
|
|
3881
|
+
/* @__PURE__ */ jsxs28("span", { className: "relative inline-flex items-center", children: [
|
|
3882
|
+
/* @__PURE__ */ jsx40(
|
|
3823
3883
|
"input",
|
|
3824
3884
|
{
|
|
3825
3885
|
type: "checkbox",
|
|
@@ -3828,7 +3888,7 @@ var Toggle = (props) => {
|
|
|
3828
3888
|
...inputProps
|
|
3829
3889
|
}
|
|
3830
3890
|
),
|
|
3831
|
-
/* @__PURE__ */
|
|
3891
|
+
/* @__PURE__ */ jsx40(
|
|
3832
3892
|
"span",
|
|
3833
3893
|
{
|
|
3834
3894
|
className: cn(
|
|
@@ -3868,7 +3928,7 @@ var Toggle = (props) => {
|
|
|
3868
3928
|
"peer-disabled:[&>.knob]:peer-checked:bg-(--background-primary-hover)",
|
|
3869
3929
|
className
|
|
3870
3930
|
),
|
|
3871
|
-
children: /* @__PURE__ */
|
|
3931
|
+
children: /* @__PURE__ */ jsx40(
|
|
3872
3932
|
"span",
|
|
3873
3933
|
{
|
|
3874
3934
|
className: cn(
|
|
@@ -3880,7 +3940,7 @@ var Toggle = (props) => {
|
|
|
3880
3940
|
}
|
|
3881
3941
|
)
|
|
3882
3942
|
] }),
|
|
3883
|
-
label && /* @__PURE__ */
|
|
3943
|
+
label && /* @__PURE__ */ jsx40(
|
|
3884
3944
|
"span",
|
|
3885
3945
|
{
|
|
3886
3946
|
className: cn(
|
|
@@ -3898,7 +3958,7 @@ Toggle.displayName = "Toggle";
|
|
|
3898
3958
|
|
|
3899
3959
|
// src/components/Inputs/WebsiteInput.tsx
|
|
3900
3960
|
import "react";
|
|
3901
|
-
import { jsx as
|
|
3961
|
+
import { jsx as jsx41, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3902
3962
|
var WebsiteInput = (props) => {
|
|
3903
3963
|
const {
|
|
3904
3964
|
hierarchy = "leading",
|
|
@@ -3935,15 +3995,15 @@ var WebsiteInput = (props) => {
|
|
|
3935
3995
|
size === "xl" ? "[&>svg]:w-6 [&>svg]:h-6" : size === "sm" ? "[&>svg]:w-4 [&>svg]:h-4" : "[&>svg]:w-5 [&>svg]:h-5",
|
|
3936
3996
|
disabled ? "text-(--icon-primary-disabled)" : "text-(--icon-primary) group-hover:text-(--icon-primary-hover) group-focus-within:text-(--icon-primary-focus)"
|
|
3937
3997
|
);
|
|
3938
|
-
const leadingAddon = /* @__PURE__ */
|
|
3939
|
-
/* @__PURE__ */
|
|
3940
|
-
icon != null && /* @__PURE__ */
|
|
3998
|
+
const leadingAddon = /* @__PURE__ */ jsxs29("div", { className: baseAddonClass, children: [
|
|
3999
|
+
/* @__PURE__ */ jsx41("div", { className: addonTextClass, children: protocolLabel }),
|
|
4000
|
+
icon != null && /* @__PURE__ */ jsx41("span", { className: iconWrapperClass, children: icon })
|
|
3941
4001
|
] });
|
|
3942
|
-
const trailingAddon = /* @__PURE__ */
|
|
3943
|
-
icon != null && /* @__PURE__ */
|
|
3944
|
-
/* @__PURE__ */
|
|
4002
|
+
const trailingAddon = /* @__PURE__ */ jsxs29("div", { className: baseAddonClass, children: [
|
|
4003
|
+
icon != null && /* @__PURE__ */ jsx41("span", { className: iconWrapperClass, children: icon }),
|
|
4004
|
+
/* @__PURE__ */ jsx41("div", { className: addonTextClass, children: protocolLabel })
|
|
3945
4005
|
] });
|
|
3946
|
-
return /* @__PURE__ */
|
|
4006
|
+
return /* @__PURE__ */ jsx41(
|
|
3947
4007
|
TextInput,
|
|
3948
4008
|
{
|
|
3949
4009
|
...rest,
|
|
@@ -3958,9 +4018,9 @@ var WebsiteInput = (props) => {
|
|
|
3958
4018
|
WebsiteInput.displayName = "WebsiteInput";
|
|
3959
4019
|
|
|
3960
4020
|
// src/components/Feedback/Popover.tsx
|
|
3961
|
-
import * as
|
|
4021
|
+
import * as React40 from "react";
|
|
3962
4022
|
import * as PopoverPrimitive2 from "@radix-ui/react-popover";
|
|
3963
|
-
import { jsx as
|
|
4023
|
+
import { jsx as jsx42, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3964
4024
|
var PopoverArrow = PopoverPrimitive2.Arrow;
|
|
3965
4025
|
var Popover2 = (props) => {
|
|
3966
4026
|
const {
|
|
@@ -3977,7 +4037,7 @@ var Popover2 = (props) => {
|
|
|
3977
4037
|
offset = 10,
|
|
3978
4038
|
children
|
|
3979
4039
|
} = props;
|
|
3980
|
-
const [open, setOpen] =
|
|
4040
|
+
const [open, setOpen] = React40.useState(false);
|
|
3981
4041
|
const handleCancel = () => {
|
|
3982
4042
|
onCancel?.();
|
|
3983
4043
|
setOpen(false);
|
|
@@ -4019,9 +4079,9 @@ var Popover2 = (props) => {
|
|
|
4019
4079
|
}
|
|
4020
4080
|
};
|
|
4021
4081
|
const { side, align } = mapPlacementToSideAndAlign2(placement);
|
|
4022
|
-
return /* @__PURE__ */
|
|
4023
|
-
/* @__PURE__ */
|
|
4024
|
-
/* @__PURE__ */
|
|
4082
|
+
return /* @__PURE__ */ jsxs30(Popover, { open, onOpenChange: setOpen, children: [
|
|
4083
|
+
/* @__PURE__ */ jsx42(PopoverTrigger, { asChild: true, children }),
|
|
4084
|
+
/* @__PURE__ */ jsxs30(
|
|
4025
4085
|
PopoverContent,
|
|
4026
4086
|
{
|
|
4027
4087
|
side,
|
|
@@ -4029,16 +4089,16 @@ var Popover2 = (props) => {
|
|
|
4029
4089
|
sideOffset: offset,
|
|
4030
4090
|
className: cn(popoverClasses, className),
|
|
4031
4091
|
children: [
|
|
4032
|
-
showArrow && /* @__PURE__ */
|
|
4033
|
-
/* @__PURE__ */
|
|
4034
|
-
/* @__PURE__ */
|
|
4035
|
-
/* @__PURE__ */
|
|
4036
|
-
/* @__PURE__ */
|
|
4037
|
-
/* @__PURE__ */
|
|
4092
|
+
showArrow && /* @__PURE__ */ jsx42(PopoverArrow, { className: popoverArrowClasses }),
|
|
4093
|
+
/* @__PURE__ */ jsxs30("div", { className: "grid gap-4", children: [
|
|
4094
|
+
/* @__PURE__ */ jsxs30("div", { className: "space-y-2", children: [
|
|
4095
|
+
/* @__PURE__ */ jsx42("span", { className: "caption text-secondary", children: strapline }),
|
|
4096
|
+
/* @__PURE__ */ jsx42("h4", { className: "subtitle-medium text-primary", children: title }),
|
|
4097
|
+
/* @__PURE__ */ jsx42("p", { className: "paragraph-sm text-primary", children: description })
|
|
4038
4098
|
] }),
|
|
4039
|
-
/* @__PURE__ */
|
|
4040
|
-
/* @__PURE__ */
|
|
4041
|
-
/* @__PURE__ */
|
|
4099
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex justify-start items-center gap-4 flex-wrap", children: [
|
|
4100
|
+
/* @__PURE__ */ jsx42(Button, { size: "sm", variant: "secondary", onClick: handleCancel, children: cancelText || "Cancel" }),
|
|
4101
|
+
/* @__PURE__ */ jsx42(Button, { size: "sm", variant: "primary", onClick: handleOk, children: okText || "Ok" })
|
|
4042
4102
|
] })
|
|
4043
4103
|
] })
|
|
4044
4104
|
]
|
|
@@ -4048,91 +4108,6 @@ var Popover2 = (props) => {
|
|
|
4048
4108
|
};
|
|
4049
4109
|
Popover2.displayName = "Popover";
|
|
4050
4110
|
|
|
4051
|
-
// src/components/Feedback/Tooltip.tsx
|
|
4052
|
-
import "react";
|
|
4053
|
-
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
4054
|
-
import { jsx as jsx42, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
4055
|
-
var TooltipArrow = TooltipPrimitive.Arrow;
|
|
4056
|
-
var mapPlacementToSideAndAlign = (placement) => {
|
|
4057
|
-
switch (placement) {
|
|
4058
|
-
case "top":
|
|
4059
|
-
return { side: "top", align: "center" };
|
|
4060
|
-
case "topLeft":
|
|
4061
|
-
return { side: "top", align: "start" };
|
|
4062
|
-
case "topRight":
|
|
4063
|
-
return { side: "top", align: "end" };
|
|
4064
|
-
case "bottom":
|
|
4065
|
-
return { side: "bottom", align: "center" };
|
|
4066
|
-
case "bottomLeft":
|
|
4067
|
-
return { side: "bottom", align: "start" };
|
|
4068
|
-
case "bottomRight":
|
|
4069
|
-
return { side: "bottom", align: "end" };
|
|
4070
|
-
case "left":
|
|
4071
|
-
return { side: "left", align: "center" };
|
|
4072
|
-
case "leftTop":
|
|
4073
|
-
return { side: "left", align: "start" };
|
|
4074
|
-
case "leftBottom":
|
|
4075
|
-
return { side: "left", align: "end" };
|
|
4076
|
-
case "right":
|
|
4077
|
-
return { side: "right", align: "center" };
|
|
4078
|
-
case "rightTop":
|
|
4079
|
-
return { side: "right", align: "start" };
|
|
4080
|
-
case "rightBottom":
|
|
4081
|
-
return { side: "right", align: "end" };
|
|
4082
|
-
default:
|
|
4083
|
-
return { side: "top", align: "center" };
|
|
4084
|
-
}
|
|
4085
|
-
};
|
|
4086
|
-
var Tooltip = (props) => {
|
|
4087
|
-
const {
|
|
4088
|
-
strapline,
|
|
4089
|
-
title,
|
|
4090
|
-
description,
|
|
4091
|
-
showArrow = true,
|
|
4092
|
-
className,
|
|
4093
|
-
placement = "top",
|
|
4094
|
-
offset = 10,
|
|
4095
|
-
disableHoverableContent,
|
|
4096
|
-
open,
|
|
4097
|
-
defaultOpen,
|
|
4098
|
-
onOpenChange,
|
|
4099
|
-
children
|
|
4100
|
-
} = props;
|
|
4101
|
-
const { side, align } = mapPlacementToSideAndAlign(placement);
|
|
4102
|
-
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";
|
|
4103
|
-
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)]";
|
|
4104
|
-
return /* @__PURE__ */ jsxs30(
|
|
4105
|
-
TooltipPrimitive.Root,
|
|
4106
|
-
{
|
|
4107
|
-
open,
|
|
4108
|
-
defaultOpen,
|
|
4109
|
-
onOpenChange,
|
|
4110
|
-
disableHoverableContent,
|
|
4111
|
-
children: [
|
|
4112
|
-
/* @__PURE__ */ jsx42(TooltipPrimitive.Trigger, { asChild: true, children }),
|
|
4113
|
-
/* @__PURE__ */ jsx42(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs30(
|
|
4114
|
-
TooltipPrimitive.Content,
|
|
4115
|
-
{
|
|
4116
|
-
side,
|
|
4117
|
-
align,
|
|
4118
|
-
sideOffset: offset,
|
|
4119
|
-
className: cn(tooltipClasses, className),
|
|
4120
|
-
children: [
|
|
4121
|
-
showArrow && /* @__PURE__ */ jsx42(TooltipArrow, { className: tooltipArrowClasses }),
|
|
4122
|
-
/* @__PURE__ */ jsxs30("div", { className: "grid gap-2", children: [
|
|
4123
|
-
(strapline ?? "") !== "" && /* @__PURE__ */ jsx42("span", { className: "caption text-secondary", children: strapline }),
|
|
4124
|
-
/* @__PURE__ */ jsx42("h4", { className: "subtitle-medium text-primary", children: title }),
|
|
4125
|
-
(description ?? "") !== "" && /* @__PURE__ */ jsx42("p", { className: "paragraph-sm text-primary", children: description })
|
|
4126
|
-
] })
|
|
4127
|
-
]
|
|
4128
|
-
}
|
|
4129
|
-
) })
|
|
4130
|
-
]
|
|
4131
|
-
}
|
|
4132
|
-
);
|
|
4133
|
-
};
|
|
4134
|
-
Tooltip.displayName = "Tooltip";
|
|
4135
|
-
|
|
4136
4111
|
// src/components/Feedback/TooltipProvider.tsx
|
|
4137
4112
|
import "react";
|
|
4138
4113
|
import * as TooltipPrimitive2 from "@radix-ui/react-tooltip";
|