@salemcobalt/ui 0.2.0-rc.8 → 0.2.0-rc.9
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/README.md +27 -24
- package/dist/index.d.ts +165 -28
- package/dist/index.js +426 -9
- package/dist/index.js.map +1 -1
- package/dist/styles.css +557 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -14,6 +14,8 @@ function Button({
|
|
|
14
14
|
iconEnd,
|
|
15
15
|
loading = false,
|
|
16
16
|
fullWidth = false,
|
|
17
|
+
shortcut,
|
|
18
|
+
iconOnly = false,
|
|
17
19
|
type = "button",
|
|
18
20
|
className,
|
|
19
21
|
children,
|
|
@@ -36,6 +38,7 @@ function Button({
|
|
|
36
38
|
"data-size": size,
|
|
37
39
|
"data-loading": loading || void 0,
|
|
38
40
|
"data-full-width": fullWidth || void 0,
|
|
41
|
+
"data-icon-only": iconOnly || void 0,
|
|
39
42
|
"aria-busy": loading || void 0,
|
|
40
43
|
onClick: handleClick,
|
|
41
44
|
...rest,
|
|
@@ -43,6 +46,7 @@ function Button({
|
|
|
43
46
|
iconStart ? /* @__PURE__ */ jsx("span", { className: "sc-button__icon", "aria-hidden": "true", children: iconStart }) : null,
|
|
44
47
|
/* @__PURE__ */ jsx("span", { className: "sc-button__label", children }),
|
|
45
48
|
iconEnd ? /* @__PURE__ */ jsx("span", { className: "sc-button__icon", "aria-hidden": "true", children: iconEnd }) : null,
|
|
49
|
+
shortcut ? /* @__PURE__ */ jsx("span", { className: "sc-button__shortcut", "aria-hidden": "true", children: shortcut }) : null,
|
|
46
50
|
loading ? /* @__PURE__ */ jsx("span", { className: "sc-button__spinner", "aria-hidden": "true" }) : null
|
|
47
51
|
]
|
|
48
52
|
}
|
|
@@ -596,6 +600,7 @@ function IconButton({
|
|
|
596
600
|
tooltipSide = "top",
|
|
597
601
|
round = false,
|
|
598
602
|
loading = false,
|
|
603
|
+
dot,
|
|
599
604
|
type,
|
|
600
605
|
className,
|
|
601
606
|
onClick,
|
|
@@ -628,7 +633,8 @@ function IconButton({
|
|
|
628
633
|
...rest,
|
|
629
634
|
children: /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
630
635
|
/* @__PURE__ */ jsx8("span", { className: "sc-button__icon", "aria-hidden": "true", children }),
|
|
631
|
-
loading ? /* @__PURE__ */ jsx8("span", { className: "sc-button__spinner", "aria-hidden": "true" }) : null
|
|
636
|
+
loading ? /* @__PURE__ */ jsx8("span", { className: "sc-button__spinner", "aria-hidden": "true" }) : null,
|
|
637
|
+
dot ? /* @__PURE__ */ jsx8("span", { className: "sc-icon-button__dot", "data-tone": dot, "aria-hidden": "true" }) : null
|
|
632
638
|
] })
|
|
633
639
|
}
|
|
634
640
|
});
|
|
@@ -1119,11 +1125,20 @@ function Root3({ className, onValueChange, ...rest }) {
|
|
|
1119
1125
|
}
|
|
1120
1126
|
);
|
|
1121
1127
|
}
|
|
1122
|
-
function List({ fill = false, className, children, ...rest }) {
|
|
1123
|
-
return /* @__PURE__ */ jsxs14(
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1128
|
+
function List({ fill = false, variant = "line", className, children, ...rest }) {
|
|
1129
|
+
return /* @__PURE__ */ jsxs14(
|
|
1130
|
+
BaseTabs.List,
|
|
1131
|
+
{
|
|
1132
|
+
className: cx("sc-tabs__list", className),
|
|
1133
|
+
"data-fill": fill || void 0,
|
|
1134
|
+
"data-variant": variant,
|
|
1135
|
+
...rest,
|
|
1136
|
+
children: [
|
|
1137
|
+
children,
|
|
1138
|
+
/* @__PURE__ */ jsx16(BaseTabs.Indicator, { className: "sc-tabs__indicator" })
|
|
1139
|
+
]
|
|
1140
|
+
}
|
|
1141
|
+
);
|
|
1127
1142
|
}
|
|
1128
1143
|
function Tab({ icon, count, className, children, ...rest }) {
|
|
1129
1144
|
return /* @__PURE__ */ jsxs14(BaseTabs.Tab, { className: cx("sc-tabs__tab", className), ...rest, children: [
|
|
@@ -1342,16 +1357,16 @@ function Text({
|
|
|
1342
1357
|
style,
|
|
1343
1358
|
...rest
|
|
1344
1359
|
}) {
|
|
1345
|
-
const
|
|
1360
|
+
const clamp2 = typeof truncate === "number" ? truncate : void 0;
|
|
1346
1361
|
return createElement4(as, {
|
|
1347
1362
|
className: cx("sc-text", className),
|
|
1348
1363
|
"data-size": size,
|
|
1349
1364
|
"data-tone": tone,
|
|
1350
1365
|
"data-weight": weight,
|
|
1351
1366
|
"data-align": align,
|
|
1352
|
-
"data-truncate": truncate === true ? "" :
|
|
1367
|
+
"data-truncate": truncate === true ? "" : clamp2 !== void 0 ? "clamp" : void 0,
|
|
1353
1368
|
"data-numeric": numeric || void 0,
|
|
1354
|
-
style:
|
|
1369
|
+
style: clamp2 !== void 0 ? { ...style, "--sc-text-lines": clamp2 } : style,
|
|
1355
1370
|
...rest
|
|
1356
1371
|
});
|
|
1357
1372
|
}
|
|
@@ -2119,6 +2134,405 @@ function FileInput({
|
|
|
2119
2134
|
);
|
|
2120
2135
|
}
|
|
2121
2136
|
|
|
2137
|
+
// src/components/PriorityNav/PriorityNav.tsx
|
|
2138
|
+
import {
|
|
2139
|
+
useEffect as useEffect3,
|
|
2140
|
+
useId as useId4,
|
|
2141
|
+
useLayoutEffect,
|
|
2142
|
+
useRef as useRef3,
|
|
2143
|
+
useState as useState5
|
|
2144
|
+
} from "react";
|
|
2145
|
+
|
|
2146
|
+
// src/components/PriorityNav/fit.ts
|
|
2147
|
+
var EPSILON = 0.5;
|
|
2148
|
+
function rowWidth(widths, gap) {
|
|
2149
|
+
let total = 0;
|
|
2150
|
+
for (const w of widths) total += w;
|
|
2151
|
+
return widths.length > 1 ? total + gap * (widths.length - 1) : total;
|
|
2152
|
+
}
|
|
2153
|
+
function fitCount({ widths, current, available, more, gap }) {
|
|
2154
|
+
const n = widths.length;
|
|
2155
|
+
const hasCurrent = current >= 0 && current < n;
|
|
2156
|
+
const others = hasCurrent ? n - 1 : n;
|
|
2157
|
+
if (rowWidth(widths, gap) <= available + EPSILON) return others;
|
|
2158
|
+
let used = more + (hasCurrent ? widths[current] + gap : 0);
|
|
2159
|
+
let count = 0;
|
|
2160
|
+
for (let i = 0; i < n; i++) {
|
|
2161
|
+
if (i === current) continue;
|
|
2162
|
+
const next = used + widths[i] + gap;
|
|
2163
|
+
if (next > available + EPSILON) break;
|
|
2164
|
+
used = next;
|
|
2165
|
+
count++;
|
|
2166
|
+
}
|
|
2167
|
+
return count;
|
|
2168
|
+
}
|
|
2169
|
+
function inlineFlags(length, current, count) {
|
|
2170
|
+
const flags = [];
|
|
2171
|
+
let seen = 0;
|
|
2172
|
+
for (let i = 0; i < length; i++) {
|
|
2173
|
+
if (i === current) flags.push(true);
|
|
2174
|
+
else flags.push(seen++ < count);
|
|
2175
|
+
}
|
|
2176
|
+
return flags;
|
|
2177
|
+
}
|
|
2178
|
+
function isOverflowing({ widths, gap, available, was, hysteresis }) {
|
|
2179
|
+
const total = rowWidth(widths, gap);
|
|
2180
|
+
return was ? total + Math.max(0, hysteresis) > available + EPSILON : total > available + EPSILON;
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
// src/components/PriorityNav/place.ts
|
|
2184
|
+
var clamp = (value, min, max) => Math.max(min, Math.min(value, max));
|
|
2185
|
+
function placePanel({ anchor, panel, viewport, gutter, offset, rtl = false }) {
|
|
2186
|
+
const endAligned = rtl ? anchor.left : anchor.right - panel.width;
|
|
2187
|
+
const startAligned = rtl ? anchor.right - panel.width : anchor.left;
|
|
2188
|
+
const fitsX = (x2) => x2 >= gutter && x2 + panel.width <= viewport.width - gutter;
|
|
2189
|
+
const x = fitsX(endAligned) ? endAligned : fitsX(startAligned) ? startAligned : endAligned;
|
|
2190
|
+
const left = clamp(x, gutter, Math.max(gutter, viewport.width - gutter - panel.width));
|
|
2191
|
+
const below = anchor.bottom + offset;
|
|
2192
|
+
const above = anchor.top - offset - panel.height;
|
|
2193
|
+
const fitsBelow = below + panel.height <= viewport.height - gutter;
|
|
2194
|
+
const top = fitsBelow || above < gutter ? below : above;
|
|
2195
|
+
return { left, top };
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
// src/components/PriorityNav/PriorityNav.tsx
|
|
2199
|
+
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2200
|
+
var defaultCountLabel = (n) => n === 1 ? "1 link" : `${n} links`;
|
|
2201
|
+
var defaultLink = ({ children, ...props }) => /* @__PURE__ */ jsx28("a", { ...props, children });
|
|
2202
|
+
var keyOf = (item) => item.id ?? item.href;
|
|
2203
|
+
var supportsAnchor = () => typeof CSS !== "undefined" && typeof CSS.supports === "function" && CSS.supports("anchor-name: --a");
|
|
2204
|
+
var supportsPopover = (el) => typeof el.showPopover === "function";
|
|
2205
|
+
function signatureOf(items) {
|
|
2206
|
+
return items.map((item) => {
|
|
2207
|
+
const text = typeof item.label === "string" || typeof item.label === "number" ? item.label : "";
|
|
2208
|
+
return `${keyOf(item)}${text}`;
|
|
2209
|
+
}).join("");
|
|
2210
|
+
}
|
|
2211
|
+
function PriorityNav({
|
|
2212
|
+
items,
|
|
2213
|
+
moreLabel = "More",
|
|
2214
|
+
moreCountLabel = defaultCountLabel,
|
|
2215
|
+
renderLink = defaultLink,
|
|
2216
|
+
onOverflowChange,
|
|
2217
|
+
overflowHysteresis = 0,
|
|
2218
|
+
className,
|
|
2219
|
+
style,
|
|
2220
|
+
...rest
|
|
2221
|
+
}) {
|
|
2222
|
+
const signature = signatureOf(items);
|
|
2223
|
+
const current = items.findIndex((item) => item.current);
|
|
2224
|
+
const [fit, setFit] = useState5({ signature: null, current: -1, count: 0, overflowing: false });
|
|
2225
|
+
const [open, setOpen] = useState5(false);
|
|
2226
|
+
const panelId = useId4();
|
|
2227
|
+
const listRef = useRef3(null);
|
|
2228
|
+
const moreRef = useRef3(null);
|
|
2229
|
+
const toggleRef = useRef3(null);
|
|
2230
|
+
const panelRef = useRef3(null);
|
|
2231
|
+
const measured = useRef3(null);
|
|
2232
|
+
const currentRef = useRef3(current);
|
|
2233
|
+
const fitRef = useRef3(fit);
|
|
2234
|
+
const hysteresisRef = useRef3(overflowHysteresis);
|
|
2235
|
+
const onOverflowRef = useRef3(onOverflowChange);
|
|
2236
|
+
const solve = (m, cur, was) => ({
|
|
2237
|
+
count: fitCount({ ...m, current: cur }),
|
|
2238
|
+
overflowing: isOverflowing({ ...m, was, hysteresis: hysteresisRef.current })
|
|
2239
|
+
});
|
|
2240
|
+
const measuring = fit.signature !== signature;
|
|
2241
|
+
useLayoutEffect(() => {
|
|
2242
|
+
currentRef.current = current;
|
|
2243
|
+
fitRef.current = fit;
|
|
2244
|
+
hysteresisRef.current = overflowHysteresis;
|
|
2245
|
+
onOverflowRef.current = onOverflowChange;
|
|
2246
|
+
});
|
|
2247
|
+
useLayoutEffect(() => {
|
|
2248
|
+
const list = listRef.current;
|
|
2249
|
+
const more = moreRef.current;
|
|
2250
|
+
if (!list || !more) return;
|
|
2251
|
+
if (measuring) {
|
|
2252
|
+
const widths = Array.from(
|
|
2253
|
+
list.querySelectorAll(":scope > .sc-priority-nav__item"),
|
|
2254
|
+
(el) => el.getBoundingClientRect().width
|
|
2255
|
+
);
|
|
2256
|
+
measured.current = {
|
|
2257
|
+
widths,
|
|
2258
|
+
more: more.getBoundingClientRect().width,
|
|
2259
|
+
gap: parseFloat(getComputedStyle(list).columnGap) || 0,
|
|
2260
|
+
available: list.clientWidth
|
|
2261
|
+
};
|
|
2262
|
+
} else if (fit.current === current) return;
|
|
2263
|
+
const m = measured.current;
|
|
2264
|
+
if (!m) return;
|
|
2265
|
+
setFit({ signature, current, ...solve(m, current, fit.overflowing) });
|
|
2266
|
+
}, [measuring, signature, current, fit]);
|
|
2267
|
+
useEffect3(() => {
|
|
2268
|
+
const list = listRef.current;
|
|
2269
|
+
const more = moreRef.current;
|
|
2270
|
+
if (!list || !more || typeof ResizeObserver === "undefined") return;
|
|
2271
|
+
const observer = new ResizeObserver((entries) => {
|
|
2272
|
+
const m = measured.current;
|
|
2273
|
+
if (!m) return;
|
|
2274
|
+
for (const entry of entries) {
|
|
2275
|
+
if (entry.target === list)
|
|
2276
|
+
m.available = entry.contentBoxSize?.[0]?.inlineSize ?? entry.contentRect.width;
|
|
2277
|
+
else {
|
|
2278
|
+
const width = entry.borderBoxSize?.[0]?.inlineSize ?? 0;
|
|
2279
|
+
if (width > 0) m.more = width;
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
const prev = fitRef.current;
|
|
2283
|
+
if (prev.signature === null) return;
|
|
2284
|
+
const next = solve(m, currentRef.current, prev.overflowing);
|
|
2285
|
+
if (prev.count !== next.count || prev.overflowing !== next.overflowing) setFit({ ...prev, ...next });
|
|
2286
|
+
});
|
|
2287
|
+
observer.observe(list);
|
|
2288
|
+
observer.observe(more);
|
|
2289
|
+
return () => observer.disconnect();
|
|
2290
|
+
}, []);
|
|
2291
|
+
const reported = useRef3(false);
|
|
2292
|
+
useEffect3(() => {
|
|
2293
|
+
if (reported.current === fit.overflowing) return;
|
|
2294
|
+
reported.current = fit.overflowing;
|
|
2295
|
+
onOverflowRef.current?.(fit.overflowing);
|
|
2296
|
+
}, [fit.overflowing]);
|
|
2297
|
+
useEffect3(() => {
|
|
2298
|
+
const fonts = typeof document === "undefined" ? void 0 : document.fonts;
|
|
2299
|
+
if (!fonts || fonts.status === "loaded") return;
|
|
2300
|
+
let live = true;
|
|
2301
|
+
void fonts.ready.then(() => {
|
|
2302
|
+
if (live) setFit((prev) => ({ ...prev, signature: null }));
|
|
2303
|
+
});
|
|
2304
|
+
return () => {
|
|
2305
|
+
live = false;
|
|
2306
|
+
};
|
|
2307
|
+
}, []);
|
|
2308
|
+
const flags = measuring ? null : inlineFlags(items.length, current, fit.count);
|
|
2309
|
+
const overflow = flags ? items.filter((_, i) => !flags[i]) : [];
|
|
2310
|
+
const expanded = open && overflow.length > 0;
|
|
2311
|
+
useLayoutEffect(() => {
|
|
2312
|
+
const panel = panelRef.current;
|
|
2313
|
+
if (!panel || !supportsPopover(panel)) return;
|
|
2314
|
+
if (!panel.hasAttribute("popover")) panel.setAttribute("popover", "manual");
|
|
2315
|
+
const shown = panel.matches(":popover-open");
|
|
2316
|
+
if (expanded && !shown) panel.showPopover();
|
|
2317
|
+
else if (!expanded && shown) panel.hidePopover();
|
|
2318
|
+
}, [expanded]);
|
|
2319
|
+
useLayoutEffect(() => {
|
|
2320
|
+
const panel = panelRef.current;
|
|
2321
|
+
const toggle = toggleRef.current;
|
|
2322
|
+
if (!expanded || !panel || !toggle || supportsAnchor()) return;
|
|
2323
|
+
const place = () => {
|
|
2324
|
+
const anchor = toggle.getBoundingClientRect();
|
|
2325
|
+
const box = panel.getBoundingClientRect();
|
|
2326
|
+
const css = getComputedStyle(panel);
|
|
2327
|
+
const { left, top } = placePanel({
|
|
2328
|
+
anchor,
|
|
2329
|
+
panel: { width: box.width, height: box.height },
|
|
2330
|
+
viewport: { width: document.documentElement.clientWidth, height: window.innerHeight },
|
|
2331
|
+
gutter: parseFloat(css.getPropertyValue("--sc-spacing-md")) || 16,
|
|
2332
|
+
offset: parseFloat(css.getPropertyValue("--sc-spacing-2xs")) || 4,
|
|
2333
|
+
rtl: css.direction === "rtl"
|
|
2334
|
+
});
|
|
2335
|
+
panel.style.left = `${left}px`;
|
|
2336
|
+
panel.style.top = `${top}px`;
|
|
2337
|
+
};
|
|
2338
|
+
place();
|
|
2339
|
+
window.addEventListener("resize", place, { passive: true });
|
|
2340
|
+
window.addEventListener("scroll", place, { passive: true, capture: true });
|
|
2341
|
+
return () => {
|
|
2342
|
+
window.removeEventListener("resize", place);
|
|
2343
|
+
window.removeEventListener("scroll", place, { capture: true });
|
|
2344
|
+
panel.style.left = "";
|
|
2345
|
+
panel.style.top = "";
|
|
2346
|
+
};
|
|
2347
|
+
}, [expanded]);
|
|
2348
|
+
useEffect3(() => {
|
|
2349
|
+
if (!expanded) return;
|
|
2350
|
+
const onPointerDown = (event) => {
|
|
2351
|
+
if (!moreRef.current?.contains(event.target)) setOpen(false);
|
|
2352
|
+
};
|
|
2353
|
+
const onKeyDown = (event) => {
|
|
2354
|
+
if (event.key !== "Escape") return;
|
|
2355
|
+
const active = document.activeElement;
|
|
2356
|
+
setOpen(false);
|
|
2357
|
+
if (!active || active === document.body || moreRef.current?.contains(active))
|
|
2358
|
+
toggleRef.current?.focus();
|
|
2359
|
+
};
|
|
2360
|
+
document.addEventListener("pointerdown", onPointerDown);
|
|
2361
|
+
document.addEventListener("keydown", onKeyDown);
|
|
2362
|
+
return () => {
|
|
2363
|
+
document.removeEventListener("pointerdown", onPointerDown);
|
|
2364
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
2365
|
+
};
|
|
2366
|
+
}, [expanded]);
|
|
2367
|
+
const onBlur = (event) => {
|
|
2368
|
+
if (!event.currentTarget.contains(event.relatedTarget)) setOpen(false);
|
|
2369
|
+
};
|
|
2370
|
+
const link = (item, inPanel) => renderLink(
|
|
2371
|
+
{
|
|
2372
|
+
href: item.href,
|
|
2373
|
+
className: "sc-priority-nav__link",
|
|
2374
|
+
"aria-current": item.current ? "page" : void 0,
|
|
2375
|
+
onClick: inPanel ? () => setOpen(false) : void 0,
|
|
2376
|
+
children: /* @__PURE__ */ jsx28("span", { className: "sc-priority-nav__label", children: item.label })
|
|
2377
|
+
},
|
|
2378
|
+
item
|
|
2379
|
+
);
|
|
2380
|
+
return /* @__PURE__ */ jsx28(
|
|
2381
|
+
"nav",
|
|
2382
|
+
{
|
|
2383
|
+
className: cx("sc-priority-nav", className),
|
|
2384
|
+
"data-measuring": measuring || void 0,
|
|
2385
|
+
"data-overflowing": fit.overflowing || void 0,
|
|
2386
|
+
style: { ...style, "--_anchor": `--sc-priority-nav${panelId.replace(/[^\w-]/g, "")}` },
|
|
2387
|
+
...rest,
|
|
2388
|
+
children: /* @__PURE__ */ jsxs23("ul", { ref: listRef, className: "sc-priority-nav__list", children: [
|
|
2389
|
+
items.map(
|
|
2390
|
+
(item, i) => flags && !flags[i] ? null : /* @__PURE__ */ jsx28("li", { className: "sc-priority-nav__item", "data-current": item.current || void 0, children: link(item, false) }, keyOf(item))
|
|
2391
|
+
),
|
|
2392
|
+
/* @__PURE__ */ jsxs23(
|
|
2393
|
+
"li",
|
|
2394
|
+
{
|
|
2395
|
+
ref: moreRef,
|
|
2396
|
+
className: "sc-priority-nav__more",
|
|
2397
|
+
hidden: measuring || overflow.length === 0,
|
|
2398
|
+
onBlur,
|
|
2399
|
+
children: [
|
|
2400
|
+
/* @__PURE__ */ jsxs23(
|
|
2401
|
+
"button",
|
|
2402
|
+
{
|
|
2403
|
+
ref: toggleRef,
|
|
2404
|
+
type: "button",
|
|
2405
|
+
className: "sc-priority-nav__toggle",
|
|
2406
|
+
"aria-expanded": expanded,
|
|
2407
|
+
"aria-controls": panelId,
|
|
2408
|
+
onClick: () => setOpen((o) => !o),
|
|
2409
|
+
children: [
|
|
2410
|
+
/* @__PURE__ */ jsx28(MoreHorizontalIcon, { className: "sc-priority-nav__ellipsis" }),
|
|
2411
|
+
/* @__PURE__ */ jsx28("span", { className: "sc-priority-nav__toggle-label", children: moreLabel }),
|
|
2412
|
+
/* @__PURE__ */ jsxs23("span", { className: "sc-visually-hidden", children: [
|
|
2413
|
+
", ",
|
|
2414
|
+
moreCountLabel(overflow.length)
|
|
2415
|
+
] }),
|
|
2416
|
+
/* @__PURE__ */ jsx28(ChevronDownIcon, { size: "sm", className: "sc-priority-nav__chevron" })
|
|
2417
|
+
]
|
|
2418
|
+
}
|
|
2419
|
+
),
|
|
2420
|
+
/* @__PURE__ */ jsx28("ul", { ref: panelRef, id: panelId, className: "sc-priority-nav__panel", hidden: !expanded, children: overflow.map((item) => /* @__PURE__ */ jsx28("li", { children: link(item, true) }, keyOf(item))) })
|
|
2421
|
+
]
|
|
2422
|
+
}
|
|
2423
|
+
)
|
|
2424
|
+
] })
|
|
2425
|
+
}
|
|
2426
|
+
);
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
// src/components/Popover/Popover.tsx
|
|
2430
|
+
import { Popover as BasePopover } from "@base-ui/react/popover";
|
|
2431
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2432
|
+
function Root6({ open, defaultOpen, onOpenChange, modal = false, children }) {
|
|
2433
|
+
return /* @__PURE__ */ jsx29(
|
|
2434
|
+
BasePopover.Root,
|
|
2435
|
+
{
|
|
2436
|
+
open,
|
|
2437
|
+
defaultOpen,
|
|
2438
|
+
onOpenChange: onOpenChange ? (next) => onOpenChange(next) : void 0,
|
|
2439
|
+
modal,
|
|
2440
|
+
children
|
|
2441
|
+
}
|
|
2442
|
+
);
|
|
2443
|
+
}
|
|
2444
|
+
function Trigger3({ render, className, children, ...rest }) {
|
|
2445
|
+
return /* @__PURE__ */ jsx29(
|
|
2446
|
+
BasePopover.Trigger,
|
|
2447
|
+
{
|
|
2448
|
+
render: render ?? /* @__PURE__ */ jsx29(Button, { variant: "secondary", className }),
|
|
2449
|
+
className: render ? className : void 0,
|
|
2450
|
+
...rest,
|
|
2451
|
+
children
|
|
2452
|
+
}
|
|
2453
|
+
);
|
|
2454
|
+
}
|
|
2455
|
+
function Content3({
|
|
2456
|
+
side = "bottom",
|
|
2457
|
+
align = "center",
|
|
2458
|
+
sideOffset,
|
|
2459
|
+
arrow = false,
|
|
2460
|
+
className,
|
|
2461
|
+
children,
|
|
2462
|
+
...rest
|
|
2463
|
+
}) {
|
|
2464
|
+
return /* @__PURE__ */ jsx29(BasePopover.Portal, { children: /* @__PURE__ */ jsx29(
|
|
2465
|
+
BasePopover.Positioner,
|
|
2466
|
+
{
|
|
2467
|
+
side,
|
|
2468
|
+
align,
|
|
2469
|
+
sideOffset: sideOffset ?? (arrow ? 8 : 4),
|
|
2470
|
+
className: "sc-popover__positioner",
|
|
2471
|
+
children: /* @__PURE__ */ jsxs24(BasePopover.Popup, { className: cx("sc-popover", className), ...rest, children: [
|
|
2472
|
+
arrow ? /* @__PURE__ */ jsx29(BasePopover.Arrow, { className: "sc-popover__arrow" }) : null,
|
|
2473
|
+
children
|
|
2474
|
+
] })
|
|
2475
|
+
}
|
|
2476
|
+
) });
|
|
2477
|
+
}
|
|
2478
|
+
function Title2({ className, ...rest }) {
|
|
2479
|
+
return /* @__PURE__ */ jsx29(BasePopover.Title, { className: cx("sc-popover__title", className), ...rest });
|
|
2480
|
+
}
|
|
2481
|
+
function Description2({ className, ...rest }) {
|
|
2482
|
+
return /* @__PURE__ */ jsx29(BasePopover.Description, { className: cx("sc-popover__description", className), ...rest });
|
|
2483
|
+
}
|
|
2484
|
+
function Close2({ className, children, render, ...rest }) {
|
|
2485
|
+
if (children === void 0 && render === void 0) {
|
|
2486
|
+
return /* @__PURE__ */ jsx29(BasePopover.Close, { className: cx("sc-popover__close", className), "aria-label": "Close", ...rest, children: /* @__PURE__ */ jsx29(XIcon, {}) });
|
|
2487
|
+
}
|
|
2488
|
+
return /* @__PURE__ */ jsx29(BasePopover.Close, { className, render, ...rest, children });
|
|
2489
|
+
}
|
|
2490
|
+
var Popover = { Root: Root6, Trigger: Trigger3, Content: Content3, Title: Title2, Description: Description2, Close: Close2 };
|
|
2491
|
+
|
|
2492
|
+
// src/components/BroomIcon/BroomIcon.tsx
|
|
2493
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2494
|
+
function BroomIcon({ sweeping = false, size = "lg", title, className, ...rest }) {
|
|
2495
|
+
return /* @__PURE__ */ jsxs25(
|
|
2496
|
+
"svg",
|
|
2497
|
+
{
|
|
2498
|
+
className: cx("sc-icon", "sc-broom", className),
|
|
2499
|
+
"data-size": size,
|
|
2500
|
+
"data-sweeping": sweeping || void 0,
|
|
2501
|
+
viewBox: "0 0 24 24",
|
|
2502
|
+
fill: "none",
|
|
2503
|
+
focusable: "false",
|
|
2504
|
+
"aria-hidden": title ? void 0 : true,
|
|
2505
|
+
role: title ? "img" : void 0,
|
|
2506
|
+
"aria-label": title,
|
|
2507
|
+
...rest,
|
|
2508
|
+
children: [
|
|
2509
|
+
/* @__PURE__ */ jsxs25(
|
|
2510
|
+
"g",
|
|
2511
|
+
{
|
|
2512
|
+
className: "sc-broom__body",
|
|
2513
|
+
fill: "none",
|
|
2514
|
+
stroke: "currentColor",
|
|
2515
|
+
strokeLinecap: "round",
|
|
2516
|
+
strokeLinejoin: "round",
|
|
2517
|
+
children: [
|
|
2518
|
+
/* @__PURE__ */ jsx30("path", { d: "M16.1 10.48 L19.36 1.86 A0.87 0.87 0 0 1 20.98 2.47 L17.84 10.78" }),
|
|
2519
|
+
/* @__PURE__ */ jsx30("path", { d: "M13.33 12 C14.23 10.67 16.73 9.87 18.17 11 C19.07 12.67 18.93 18.33 18.4 21.4 C16.07 22.4 11.07 22.07 6.4 18.07 C9.07 16.67 11.8 15 13.33 12 Z" }),
|
|
2520
|
+
/* @__PURE__ */ jsx30("path", { className: "sc-broom__band", d: "M13.47 12.13 L18.4 13.5 L18.33 14.1 L13.27 12.77 Z" }),
|
|
2521
|
+
/* @__PURE__ */ jsx30("path", { d: "M12.87 13.73 L14.4 14.47 M16.2 15.27 L18.47 15.87" }),
|
|
2522
|
+
/* @__PURE__ */ jsx30("path", { d: "M12.8 16.87 C11.86 18.24 10.75 19.38 9.57 20.23 M15.6 17.4 C15.22 18.96 14.6 20.44 13.77 21.71" })
|
|
2523
|
+
]
|
|
2524
|
+
}
|
|
2525
|
+
),
|
|
2526
|
+
/* @__PURE__ */ jsxs25("g", { className: "sc-broom__dust", fill: "none", stroke: "currentColor", children: [
|
|
2527
|
+
/* @__PURE__ */ jsx30("circle", { cx: "4.77", cy: "13.53", r: "0.5" }),
|
|
2528
|
+
/* @__PURE__ */ jsx30("circle", { cx: "2.7", cy: "15.53", r: "0.87" }),
|
|
2529
|
+
/* @__PURE__ */ jsx30("circle", { cx: "4.1", cy: "18.27", r: "0.5" })
|
|
2530
|
+
] })
|
|
2531
|
+
]
|
|
2532
|
+
}
|
|
2533
|
+
);
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2122
2536
|
// src/index.ts
|
|
2123
2537
|
var version = "0.1.1";
|
|
2124
2538
|
export {
|
|
@@ -2131,6 +2545,7 @@ export {
|
|
|
2131
2545
|
Banner,
|
|
2132
2546
|
BellIcon,
|
|
2133
2547
|
BriefcaseIcon,
|
|
2548
|
+
BroomIcon,
|
|
2134
2549
|
Button,
|
|
2135
2550
|
CalendarIcon,
|
|
2136
2551
|
Card,
|
|
@@ -2176,6 +2591,8 @@ export {
|
|
|
2176
2591
|
PauseIcon,
|
|
2177
2592
|
PlayIcon,
|
|
2178
2593
|
PlusIcon,
|
|
2594
|
+
Popover,
|
|
2595
|
+
PriorityNav,
|
|
2179
2596
|
Progress,
|
|
2180
2597
|
RefreshIcon,
|
|
2181
2598
|
SearchIcon,
|