@waveso/ui 0.0.2 → 0.0.3
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/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/accordion.d.ts +14 -0
- package/dist/accordion.js +81 -0
- package/dist/accordion.js.map +1 -0
- package/dist/alert.d.ts +8 -4
- package/dist/alert.js.map +1 -1
- package/dist/aspect-ratio.d.ts +10 -0
- package/dist/aspect-ratio.js +18 -0
- package/dist/aspect-ratio.js.map +1 -0
- package/dist/autocomplete.d.ts +48 -0
- package/dist/autocomplete.js +222 -0
- package/dist/autocomplete.js.map +1 -0
- package/dist/avatar.d.ts +13 -7
- package/dist/avatar.js.map +1 -1
- package/dist/badge.d.ts +3 -2
- package/dist/badge.js +1 -1
- package/dist/badge.js.map +1 -1
- package/dist/breadcrumb.d.ts +20 -0
- package/dist/breadcrumb.js +123 -0
- package/dist/breadcrumb.js.map +1 -0
- package/dist/button-group.d.ts +19 -0
- package/dist/button-group.js +81 -0
- package/dist/button-group.js.map +1 -0
- package/dist/button.d.ts +1 -1
- package/dist/card.d.ts +15 -8
- package/dist/card.js.map +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chunk-D5XPEJ6T.js +36 -0
- package/dist/chunk-D5XPEJ6T.js.map +1 -0
- package/dist/chunk-IQ7YQ5XA.js +141 -0
- package/dist/chunk-IQ7YQ5XA.js.map +1 -0
- package/dist/chunk-NCHHHWTB.js +85 -0
- package/dist/chunk-NCHHHWTB.js.map +1 -0
- package/dist/chunk-PGXELRT4.js +228 -0
- package/dist/chunk-PGXELRT4.js.map +1 -0
- package/dist/chunk-QFSEK4M6.js +22 -0
- package/dist/chunk-QFSEK4M6.js.map +1 -0
- package/dist/chunk-QRW37LRP.js +25 -0
- package/dist/chunk-QRW37LRP.js.map +1 -0
- package/dist/chunk-RPQHL6C5.js +26 -0
- package/dist/chunk-RPQHL6C5.js.map +1 -0
- package/dist/chunk-WJDWQFO3.js +99 -0
- package/dist/chunk-WJDWQFO3.js.map +1 -0
- package/dist/chunk-YTSQQTSF.js +44 -0
- package/dist/chunk-YTSQQTSF.js.map +1 -0
- package/dist/chunk-ZOKFCJWM.js +11 -0
- package/dist/chunk-ZOKFCJWM.js.map +1 -0
- package/dist/collapsible.d.ts +12 -0
- package/dist/collapsible.js +16 -0
- package/dist/collapsible.js.map +1 -0
- package/dist/combobox.d.ts +48 -0
- package/dist/combobox.js +281 -0
- package/dist/combobox.js.map +1 -0
- package/dist/context-menu.d.ts +47 -0
- package/dist/context-menu.js +193 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/dialog.js +1 -1
- package/dist/direction.d.ts +1 -0
- package/dist/direction.js +3 -0
- package/dist/direction.js.map +1 -0
- package/dist/drawer.d.ts +29 -0
- package/dist/drawer.js +143 -0
- package/dist/drawer.js.map +1 -0
- package/dist/encrypted-text.d.ts +16 -0
- package/dist/encrypted-text.js +141 -0
- package/dist/encrypted-text.js.map +1 -0
- package/dist/field.d.ts +22 -0
- package/dist/field.js +4 -0
- package/dist/field.js.map +1 -0
- package/dist/form.d.ts +80 -0
- package/dist/form.js +108 -0
- package/dist/form.js.map +1 -0
- package/dist/infinite-scroll.d.ts +19 -0
- package/dist/infinite-scroll.js +102 -0
- package/dist/infinite-scroll.js.map +1 -0
- package/dist/input-group.d.ts +29 -0
- package/dist/input-group.js +7 -0
- package/dist/input-group.js.map +1 -0
- package/dist/input-otp.d.ts +18 -0
- package/dist/input-otp.js +79 -0
- package/dist/input-otp.js.map +1 -0
- package/dist/input.d.ts +2 -1
- package/dist/input.js +2 -20
- package/dist/input.js.map +1 -1
- package/dist/item.d.ts +37 -0
- package/dist/item.js +181 -0
- package/dist/item.js.map +1 -0
- package/dist/kbd.d.ts +8 -0
- package/dist/kbd.js +30 -0
- package/dist/kbd.js.map +1 -0
- package/dist/label.d.ts +2 -1
- package/dist/label.js.map +1 -1
- package/dist/masonry.d.ts +17 -0
- package/dist/masonry.js +235 -0
- package/dist/masonry.js.map +1 -0
- package/dist/menu.d.ts +47 -0
- package/dist/menu.js +5 -0
- package/dist/menu.js.map +1 -0
- package/dist/menubar.d.ts +40 -0
- package/dist/menubar.js +84 -0
- package/dist/menubar.js.map +1 -0
- package/dist/pagination.d.ts +29 -0
- package/dist/pagination.js +120 -0
- package/dist/pagination.js.map +1 -0
- package/dist/popover.d.ts +24 -0
- package/dist/popover.js +105 -0
- package/dist/popover.js.map +1 -0
- package/dist/preview-card.d.ts +17 -0
- package/dist/preview-card.js +70 -0
- package/dist/preview-card.js.map +1 -0
- package/dist/radio-group.d.ts +12 -0
- package/dist/radio-group.js +28 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/radio.d.ts +10 -0
- package/dist/radio.js +4 -0
- package/dist/radio.js.map +1 -0
- package/dist/scroll-area.d.ts +10 -0
- package/dist/scroll-area.js +59 -0
- package/dist/scroll-area.js.map +1 -0
- package/dist/select.d.ts +36 -0
- package/dist/select.js +208 -0
- package/dist/select.js.map +1 -0
- package/dist/separator.js +2 -24
- package/dist/separator.js.map +1 -1
- package/dist/skeleton.d.ts +2 -1
- package/dist/skeleton.js.map +1 -1
- package/dist/slider.d.ts +10 -0
- package/dist/slider.js +70 -0
- package/dist/slider.js.map +1 -0
- package/dist/spinner.d.ts +2 -1
- package/dist/spinner.js +3 -9
- package/dist/spinner.js.map +1 -1
- package/dist/table.d.ts +21 -0
- package/dist/table.js +106 -0
- package/dist/table.js.map +1 -0
- package/dist/tabs.d.ts +20 -0
- package/dist/tabs.js +82 -0
- package/dist/tabs.js.map +1 -0
- package/dist/textarea.js +2 -23
- package/dist/textarea.js.map +1 -1
- package/dist/toast.d.ts +57 -0
- package/dist/toast.js +239 -0
- package/dist/toast.js.map +1 -0
- package/dist/toggle-group.d.ts +17 -0
- package/dist/toggle-group.js +78 -0
- package/dist/toggle-group.js.map +1 -0
- package/dist/toggle.d.ts +14 -0
- package/dist/toggle.js +4 -0
- package/dist/toggle.js.map +1 -0
- package/dist/tooltip.d.ts +21 -0
- package/dist/tooltip.js +66 -0
- package/dist/tooltip.js.map +1 -0
- package/package.json +5 -1
- package/dist/chunk-L3UIJEIQ.js +0 -41
- package/dist/chunk-L3UIJEIQ.js.map +0 -1
package/dist/masonry.js
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { StarIcon } from './chunk-WJDWQFO3.js';
|
|
2
|
+
import { cn } from './chunk-76UQO56T.js';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { AnimatePresence, motion } from 'motion/react';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var STAGGER_STEP = 0.05;
|
|
8
|
+
var MasonryStaggerContext = React.createContext(null);
|
|
9
|
+
function Masonry({
|
|
10
|
+
columns,
|
|
11
|
+
columnWidth,
|
|
12
|
+
gap = 4,
|
|
13
|
+
className,
|
|
14
|
+
children,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
17
|
+
const containerRef = React.useRef(null);
|
|
18
|
+
const rafRef = React.useRef(0);
|
|
19
|
+
const staggerCounterRef = React.useRef(0);
|
|
20
|
+
staggerCounterRef.current = 0;
|
|
21
|
+
const getStaggerIndex = React.useCallback(
|
|
22
|
+
() => staggerCounterRef.current++,
|
|
23
|
+
[]
|
|
24
|
+
);
|
|
25
|
+
React.useLayoutEffect(() => {
|
|
26
|
+
const container = containerRef.current;
|
|
27
|
+
if (!container) return;
|
|
28
|
+
const remPx = parseFloat(
|
|
29
|
+
getComputedStyle(document.documentElement).fontSize
|
|
30
|
+
);
|
|
31
|
+
const gapPx = gap * 0.25 * remPx;
|
|
32
|
+
function reflow() {
|
|
33
|
+
const allChildren = Array.from(container.children);
|
|
34
|
+
const items = allChildren.filter((el) => el.dataset.exiting == null);
|
|
35
|
+
if (items.length === 0) {
|
|
36
|
+
container.style.removeProperty("height");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const containerWidth = container.clientWidth;
|
|
40
|
+
if (containerWidth === 0) return;
|
|
41
|
+
let colCount;
|
|
42
|
+
if (columns != null) {
|
|
43
|
+
colCount = Math.max(1, columns);
|
|
44
|
+
} else if (columnWidth != null) {
|
|
45
|
+
colCount = Math.max(
|
|
46
|
+
1,
|
|
47
|
+
Math.floor((containerWidth + gapPx) / (columnWidth + gapPx))
|
|
48
|
+
);
|
|
49
|
+
} else {
|
|
50
|
+
colCount = Math.max(
|
|
51
|
+
1,
|
|
52
|
+
Math.floor((containerWidth + gapPx) / (240 + gapPx))
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
if (colCount <= 1) {
|
|
56
|
+
container.style.removeProperty("height");
|
|
57
|
+
container.style.display = "flex";
|
|
58
|
+
container.style.flexDirection = "column";
|
|
59
|
+
container.style.gap = `${gapPx}px`;
|
|
60
|
+
for (const item of items) {
|
|
61
|
+
item.style.removeProperty("position");
|
|
62
|
+
item.style.removeProperty("top");
|
|
63
|
+
item.style.removeProperty("left");
|
|
64
|
+
item.style.removeProperty("width");
|
|
65
|
+
}
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
container.style.removeProperty("display");
|
|
69
|
+
container.style.removeProperty("flex-direction");
|
|
70
|
+
container.style.removeProperty("gap");
|
|
71
|
+
const colWidth = (containerWidth - (colCount - 1) * gapPx) / colCount;
|
|
72
|
+
const columnBottoms = new Array(colCount).fill(0);
|
|
73
|
+
const topItems = [];
|
|
74
|
+
const regularItems = [];
|
|
75
|
+
for (const item of items) {
|
|
76
|
+
const raw = parseInt(item.dataset.span || "1", 10);
|
|
77
|
+
if (raw > 1) {
|
|
78
|
+
topItems.push({ el: item, span: Math.min(raw, colCount) });
|
|
79
|
+
} else {
|
|
80
|
+
regularItems.push(item);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
for (const { el, span } of topItems) {
|
|
84
|
+
el.style.position = "absolute";
|
|
85
|
+
el.style.width = `${span * colWidth + (span - 1) * gapPx}px`;
|
|
86
|
+
}
|
|
87
|
+
for (const item of regularItems) {
|
|
88
|
+
item.style.position = "absolute";
|
|
89
|
+
item.style.width = `${colWidth}px`;
|
|
90
|
+
}
|
|
91
|
+
const topHeights = [];
|
|
92
|
+
for (const { el } of topItems) {
|
|
93
|
+
topHeights.push(el.offsetHeight);
|
|
94
|
+
}
|
|
95
|
+
const regularHeights = [];
|
|
96
|
+
for (const item of regularItems) {
|
|
97
|
+
regularHeights.push(item.offsetHeight);
|
|
98
|
+
}
|
|
99
|
+
let nextCol = 0;
|
|
100
|
+
for (let i = 0; i < topItems.length; i++) {
|
|
101
|
+
const { el, span } = topItems[i];
|
|
102
|
+
const s = Math.min(span, colCount - nextCol);
|
|
103
|
+
const x = nextCol * (colWidth + gapPx);
|
|
104
|
+
el.style.top = "0px";
|
|
105
|
+
el.style.left = `${x}px`;
|
|
106
|
+
if (s !== span) {
|
|
107
|
+
el.style.width = `${s * colWidth + (s - 1) * gapPx}px`;
|
|
108
|
+
}
|
|
109
|
+
const bottom = topHeights[i] + gapPx;
|
|
110
|
+
for (let c = nextCol; c < nextCol + s; c++) {
|
|
111
|
+
columnBottoms[c] = bottom;
|
|
112
|
+
}
|
|
113
|
+
nextCol += s;
|
|
114
|
+
}
|
|
115
|
+
for (let i = 0; i < regularItems.length; i++) {
|
|
116
|
+
let shortestCol = 0;
|
|
117
|
+
for (let c = 1; c < colCount; c++) {
|
|
118
|
+
if (columnBottoms[c] < columnBottoms[shortestCol]) {
|
|
119
|
+
shortestCol = c;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const x = shortestCol * (colWidth + gapPx);
|
|
123
|
+
const y = columnBottoms[shortestCol];
|
|
124
|
+
regularItems[i].style.top = `${y}px`;
|
|
125
|
+
regularItems[i].style.left = `${x}px`;
|
|
126
|
+
columnBottoms[shortestCol] = y + regularHeights[i] + gapPx;
|
|
127
|
+
}
|
|
128
|
+
const maxBottom = Math.max(...columnBottoms) - gapPx;
|
|
129
|
+
container.style.height = `${Math.max(0, maxBottom)}px`;
|
|
130
|
+
}
|
|
131
|
+
function scheduleReflow() {
|
|
132
|
+
cancelAnimationFrame(rafRef.current);
|
|
133
|
+
rafRef.current = requestAnimationFrame(reflow);
|
|
134
|
+
}
|
|
135
|
+
reflow();
|
|
136
|
+
const ro = new ResizeObserver(scheduleReflow);
|
|
137
|
+
ro.observe(container);
|
|
138
|
+
const mo = new MutationObserver(scheduleReflow);
|
|
139
|
+
mo.observe(container, {
|
|
140
|
+
childList: true,
|
|
141
|
+
subtree: true,
|
|
142
|
+
attributes: true,
|
|
143
|
+
attributeFilter: ["data-exiting", "data-span"]
|
|
144
|
+
});
|
|
145
|
+
container.addEventListener("load", scheduleReflow, true);
|
|
146
|
+
return () => {
|
|
147
|
+
cancelAnimationFrame(rafRef.current);
|
|
148
|
+
ro.disconnect();
|
|
149
|
+
mo.disconnect();
|
|
150
|
+
container.removeEventListener("load", scheduleReflow, true);
|
|
151
|
+
container.style.removeProperty("height");
|
|
152
|
+
container.style.removeProperty("display");
|
|
153
|
+
container.style.removeProperty("flex-direction");
|
|
154
|
+
container.style.removeProperty("gap");
|
|
155
|
+
const items = Array.from(container.children);
|
|
156
|
+
for (const item of items) {
|
|
157
|
+
item.style.removeProperty("position");
|
|
158
|
+
item.style.removeProperty("top");
|
|
159
|
+
item.style.removeProperty("left");
|
|
160
|
+
item.style.removeProperty("width");
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
}, [columns, columnWidth, gap]);
|
|
164
|
+
return /* @__PURE__ */ jsx(MasonryStaggerContext.Provider, { value: getStaggerIndex, children: /* @__PURE__ */ jsx(
|
|
165
|
+
"div",
|
|
166
|
+
{
|
|
167
|
+
ref: containerRef,
|
|
168
|
+
"data-slot": "masonry",
|
|
169
|
+
className: cn("relative", className),
|
|
170
|
+
...props,
|
|
171
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, { children })
|
|
172
|
+
}
|
|
173
|
+
) });
|
|
174
|
+
}
|
|
175
|
+
function FeaturedBadge() {
|
|
176
|
+
return /* @__PURE__ */ jsx(
|
|
177
|
+
"span",
|
|
178
|
+
{
|
|
179
|
+
"data-slot": "masonry-badge",
|
|
180
|
+
className: "absolute top-2 right-2 z-10 flex size-5 items-center justify-center pointer-events-none",
|
|
181
|
+
"aria-label": "Featured",
|
|
182
|
+
children: /* @__PURE__ */ jsx(StarIcon, { width: 10, height: 10, fill: "currentColor", "aria-hidden": true })
|
|
183
|
+
}
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
function MasonryItem({
|
|
187
|
+
className,
|
|
188
|
+
span,
|
|
189
|
+
children,
|
|
190
|
+
...props
|
|
191
|
+
}) {
|
|
192
|
+
const isSpanned = span != null && span > 1;
|
|
193
|
+
const getStaggerIndex = React.useContext(MasonryStaggerContext);
|
|
194
|
+
const [staggerDelay] = React.useState(
|
|
195
|
+
() => getStaggerIndex ? getStaggerIndex() * STAGGER_STEP : 0
|
|
196
|
+
);
|
|
197
|
+
return /* @__PURE__ */ jsxs(
|
|
198
|
+
motion.div,
|
|
199
|
+
{
|
|
200
|
+
"data-slot": "masonry-item",
|
|
201
|
+
"data-span": isSpanned ? span : void 0,
|
|
202
|
+
className: cn("relative", className),
|
|
203
|
+
initial: {
|
|
204
|
+
opacity: 0,
|
|
205
|
+
y: 10,
|
|
206
|
+
filter: "blur(8px)"
|
|
207
|
+
},
|
|
208
|
+
animate: {
|
|
209
|
+
opacity: 1,
|
|
210
|
+
y: 0,
|
|
211
|
+
filter: "blur(0px)"
|
|
212
|
+
},
|
|
213
|
+
transition: {
|
|
214
|
+
type: "spring",
|
|
215
|
+
stiffness: 100,
|
|
216
|
+
damping: 10,
|
|
217
|
+
delay: staggerDelay
|
|
218
|
+
},
|
|
219
|
+
exit: {
|
|
220
|
+
opacity: 0,
|
|
221
|
+
scale: 1.2,
|
|
222
|
+
filter: "blur(8px)"
|
|
223
|
+
},
|
|
224
|
+
...props,
|
|
225
|
+
children: [
|
|
226
|
+
children,
|
|
227
|
+
isSpanned && /* @__PURE__ */ jsx(FeaturedBadge, {})
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export { Masonry, MasonryItem };
|
|
234
|
+
//# sourceMappingURL=masonry.js.map
|
|
235
|
+
//# sourceMappingURL=masonry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/masonry.tsx"],"names":[],"mappings":";;;;;;AASA,IAAM,YAAA,GAAe,IAAA;AAErB,IAAM,qBAAA,GAA8B,oBAAqC,IAAI,CAAA;AAa7E,SAAS,OAAA,CAAQ;AAAA,EACf,OAAA;AAAA,EACA,WAAA;AAAA,EACA,GAAA,GAAM,CAAA;AAAA,EACN,SAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL,CAAA,EAAiB;AACf,EAAA,MAAM,YAAA,GAAqB,aAAuB,IAAI,CAAA;AACtD,EAAA,MAAM,MAAA,GAAe,aAAe,CAAC,CAAA;AACrC,EAAA,MAAM,iBAAA,GAA0B,aAAO,CAAC,CAAA;AAGxC,EAAA,iBAAA,CAAkB,OAAA,GAAU,CAAA;AAE5B,EAAA,MAAM,eAAA,GAAwB,KAAA,CAAA,WAAA;AAAA,IAC5B,MAAM,iBAAA,CAAkB,OAAA,EAAA;AAAA,IACxB;AAAC,GACH;AAEA,EAAM,sBAAgB,MAAM;AAC1B,IAAA,MAAM,YAAY,YAAA,CAAa,OAAA;AAC/B,IAAA,IAAI,CAAC,SAAA,EAAW;AAEhB,IAAA,MAAM,KAAA,GAAQ,UAAA;AAAA,MACZ,gBAAA,CAAiB,QAAA,CAAS,eAAe,CAAA,CAAE;AAAA,KAC7C;AACA,IAAA,MAAM,KAAA,GAAQ,MAAM,IAAA,GAAO,KAAA;AAE3B,IAAA,SAAS,MAAA,GAAS;AAChB,MAAA,MAAM,WAAA,GAAc,KAAA,CAAM,IAAA,CAAK,SAAA,CAAW,QAAQ,CAAA;AAElD,MAAA,MAAM,KAAA,GAAQ,YAAY,MAAA,C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A;AAAA,IAAC,MAAA,CAAO,GAAA;AAAA,IAAP;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,WAAA,EAAW,YAAY,IAAA,GAAO,MAAA;AAAA,MAC9B,SAAA,EAAW,EAAA,CAAG,UAAA,EAAY,SAAS,CAAA;AAAA,MACnC,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,CAAA;AAAA,QACT,CAAA,EAAG,EAAA;AAAA,QACH,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,CAAA;AAAA,QACT,CAAA,EAAG,CAAA;AAAA,QACH,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,UAAA,EAAY;AAAA,QACV,IAAA,EAAM,QAAA;AAAA,QACN,SAAA,EAAW,GAAA;AAAA,QACX,OAAA,EAAS,EAAA;AAAA,QACT,KAAA,EAAO;AAAA,OACT;AAAA,MACA,IAAA,EAAM;AAAA,QACJ,OAAA,EAAS,CAAA;AAAA,QACT,KAAA,EAAO,GAAA;AAAA,QACP,MAAA,EAAQ;AAAA,OACV;AAAA,MACC,GAAG,KAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,QACA,SAAA,wBAAc,aAAA,EAAA,EAAc;AAAA;AAAA;AAAA,GAC/B;AAEJ","file":"masonry.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nimport { AnimatePresence, type HTMLMotionProps, motion } from \"motion/react\"\n\nimport { StarIcon } from \"./lib/internal-icons\"\nimport { cn } from \"./lib/utils\"\n\nconst STAGGER_STEP = 0.05 // 50ms between each item's enter animation\n\nconst MasonryStaggerContext = React.createContext<(() => number) | null>(null)\n\ntype MasonryProps = React.ComponentProps<\"div\"> & {\n columns?: number\n columnWidth?: number\n gap?: number\n}\n\ntype MasonryItemProps = Omit<HTMLMotionProps<\"div\">, \"children\"> & {\n span?: number\n children?: React.ReactNode\n}\n\nfunction Masonry({\n columns,\n columnWidth,\n gap = 4,\n className,\n children,\n ...props\n}: MasonryProps) {\n const containerRef = React.useRef<HTMLDivElement>(null)\n const rafRef = React.useRef<number>(0)\n const staggerCounterRef = React.useRef(0)\n\n // Reset counter each render so new items in a batch get fresh 0-based indices\n staggerCounterRef.current = 0\n\n const getStaggerIndex = React.useCallback(\n () => staggerCounterRef.current++,\n [],\n )\n\n React.useLayoutEffect(() => {\n const container = containerRef.current\n if (!container) return\n\n const remPx = parseFloat(\n getComputedStyle(document.documentElement).fontSize,\n )\n const gapPx = gap * 0.25 * remPx\n\n function reflow() {\n const allChildren = Array.from(container!.children) as HTMLElement[]\n // Skip exiting items — they keep their position during exit animation\n const items = allChildren.filter((el) => el.dataset.exiting == null)\n\n if (items.length === 0) {\n container!.style.removeProperty(\"height\")\n return\n }\n\n const containerWidth = container!.clientWidth\n if (containerWidth === 0) return\n\n let colCount: number\n if (columns != null) {\n colCount = Math.max(1, columns)\n } else if (columnWidth != null) {\n colCount = Math.max(\n 1,\n Math.floor((containerWidth + gapPx) / (columnWidth + gapPx)),\n )\n } else {\n colCount = Math.max(\n 1,\n Math.floor((containerWidth + gapPx) / (240 + gapPx)),\n )\n }\n\n // Single column: use normal flow with gap\n if (colCount <= 1) {\n container!.style.removeProperty(\"height\")\n container!.style.display = \"flex\"\n container!.style.flexDirection = \"column\"\n container!.style.gap = `${gapPx}px`\n for (const item of items) {\n item.style.removeProperty(\"position\")\n item.style.removeProperty(\"top\")\n item.style.removeProperty(\"left\")\n item.style.removeProperty(\"width\")\n }\n return\n }\n\n // Multi-column: clear single-column styles\n container!.style.removeProperty(\"display\")\n container!.style.removeProperty(\"flex-direction\")\n container!.style.removeProperty(\"gap\")\n\n const colWidth = (containerWidth - (colCount - 1) * gapPx) / colCount\n const columnBottoms = new Array<number>(colCount).fill(0)\n\n // Partition items: spanning (top-pinned) vs regular\n const topItems: { el: HTMLElement; span: number }[] = []\n const regularItems: HTMLElement[] = []\n for (const item of items) {\n const raw = parseInt(item.dataset.span || \"1\", 10)\n if (raw > 1) {\n topItems.push({ el: item, span: Math.min(raw, colCount) })\n } else {\n regularItems.push(item)\n }\n }\n\n // First pass: set width on all items for correct height measurement\n for (const { el, span } of topItems) {\n el.style.position = \"absolute\"\n el.style.width = `${span * colWidth + (span - 1) * gapPx}px`\n }\n for (const item of regularItems) {\n item.style.position = \"absolute\"\n item.style.width = `${colWidth}px`\n }\n\n // Second pass: batch-read heights\n const topHeights: number[] = []\n for (const { el } of topItems) {\n topHeights.push(el.offsetHeight)\n }\n const regularHeights: number[] = []\n for (const item of regularItems) {\n regularHeights.push(item.offsetHeight)\n }\n\n // Third pass: place top items at Y=0, left-to-right\n let nextCol = 0\n for (let i = 0; i < topItems.length; i++) {\n const { el, span } = topItems[i]!\n const s = Math.min(span, colCount - nextCol)\n\n const x = nextCol * (colWidth + gapPx)\n el.style.top = \"0px\"\n el.style.left = `${x}px`\n // Recalculate width if span was clamped\n if (s !== span) {\n el.style.width = `${s * colWidth + (s - 1) * gapPx}px`\n }\n\n const bottom = topHeights[i]! + gapPx\n for (let c = nextCol; c < nextCol + s; c++) {\n columnBottoms[c] = bottom\n }\n\n nextCol += s\n }\n\n // Fourth pass: place regular items in shortest column\n for (let i = 0; i < regularItems.length; i++) {\n let shortestCol = 0\n for (let c = 1; c < colCount; c++) {\n if (columnBottoms[c]! < columnBottoms[shortestCol]!) {\n shortestCol = c\n }\n }\n\n const x = shortestCol * (colWidth + gapPx)\n const y = columnBottoms[shortestCol]!\n\n regularItems[i]!.style.top = `${y}px`\n regularItems[i]!.style.left = `${x}px`\n\n columnBottoms[shortestCol] = y + regularHeights[i]! + gapPx\n }\n\n const maxBottom = Math.max(...columnBottoms) - gapPx\n container!.style.height = `${Math.max(0, maxBottom)}px`\n }\n\n function scheduleReflow() {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = requestAnimationFrame(reflow)\n }\n\n reflow()\n\n const ro = new ResizeObserver(scheduleReflow)\n ro.observe(container)\n\n const mo = new MutationObserver(scheduleReflow)\n mo.observe(container, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: [\"data-exiting\", \"data-span\"],\n })\n\n // Detect image/media loads that change item heights\n container.addEventListener(\"load\", scheduleReflow, true)\n\n return () => {\n cancelAnimationFrame(rafRef.current)\n ro.disconnect()\n mo.disconnect()\n container.removeEventListener(\"load\", scheduleReflow, true)\n container.style.removeProperty(\"height\")\n container.style.removeProperty(\"display\")\n container.style.removeProperty(\"flex-direction\")\n container.style.removeProperty(\"gap\")\n const items = Array.from(container.children) as HTMLElement[]\n for (const item of items) {\n item.style.removeProperty(\"position\")\n item.style.removeProperty(\"top\")\n item.style.removeProperty(\"left\")\n item.style.removeProperty(\"width\")\n }\n }\n }, [columns, columnWidth, gap])\n\n return (\n <MasonryStaggerContext.Provider value={getStaggerIndex}>\n <div\n ref={containerRef}\n data-slot=\"masonry\"\n className={cn(\"relative\", className)}\n {...props}\n >\n <AnimatePresence>\n {children}\n </AnimatePresence>\n </div>\n </MasonryStaggerContext.Provider>\n )\n}\n\nfunction FeaturedBadge() {\n return (\n <span\n data-slot=\"masonry-badge\"\n className=\"absolute top-2 right-2 z-10 flex size-5 items-center justify-center pointer-events-none\"\n aria-label=\"Featured\"\n >\n <StarIcon width={10} height={10} fill=\"currentColor\" aria-hidden />\n </span>\n )\n}\n\nfunction MasonryItem({\n className,\n span,\n children,\n ...props\n}: MasonryItemProps) {\n const isSpanned = span != null && span > 1\n const getStaggerIndex = React.useContext(MasonryStaggerContext)\n\n // Capture stagger index once on mount — useState initializer runs exactly once\n const [staggerDelay] = React.useState(() =>\n getStaggerIndex ? getStaggerIndex() * STAGGER_STEP : 0,\n )\n\n return (\n <motion.div\n data-slot=\"masonry-item\"\n data-span={isSpanned ? span : undefined}\n className={cn(\"relative\", className)}\n initial={{\n opacity: 0,\n y: 10,\n filter: \"blur(8px)\"\n }}\n animate={{\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\"\n }}\n transition={{\n type: \"spring\",\n stiffness: 100,\n damping: 10,\n delay: staggerDelay,\n }}\n exit={{\n opacity: 0,\n scale: 1.2,\n filter: \"blur(8px)\",\n }}\n {...props}\n >\n {children}\n {isSpanned && <FeaturedBadge />}\n </motion.div>\n )\n}\n\nexport { Masonry, MasonryItem }\n"]}
|
package/dist/menu.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Menu as Menu$1 } from '@base-ui/react/menu';
|
|
4
|
+
|
|
5
|
+
type MenuProps = React.ComponentProps<typeof Menu$1.Root>;
|
|
6
|
+
type MenuPortalProps = React.ComponentProps<typeof Menu$1.Portal>;
|
|
7
|
+
type MenuTriggerProps = React.ComponentProps<typeof Menu$1.Trigger>;
|
|
8
|
+
type MenuContentProps = React.ComponentProps<typeof Menu$1.Popup> & Pick<React.ComponentProps<typeof Menu$1.Positioner>, "align" | "alignOffset" | "side" | "sideOffset">;
|
|
9
|
+
type MenuGroupProps = React.ComponentProps<typeof Menu$1.Group>;
|
|
10
|
+
type MenuLabelProps = React.ComponentProps<typeof Menu$1.GroupLabel> & {
|
|
11
|
+
inset?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type MenuItemProps = React.ComponentProps<typeof Menu$1.Item> & {
|
|
14
|
+
inset?: boolean;
|
|
15
|
+
variant?: "default" | "destructive";
|
|
16
|
+
};
|
|
17
|
+
type MenuSubProps = React.ComponentProps<typeof Menu$1.SubmenuRoot>;
|
|
18
|
+
type MenuSubTriggerProps = React.ComponentProps<typeof Menu$1.SubmenuTrigger> & {
|
|
19
|
+
inset?: boolean;
|
|
20
|
+
};
|
|
21
|
+
type MenuSubContentProps = MenuContentProps;
|
|
22
|
+
type MenuCheckboxItemProps = React.ComponentProps<typeof Menu$1.CheckboxItem> & {
|
|
23
|
+
inset?: boolean;
|
|
24
|
+
};
|
|
25
|
+
type MenuRadioGroupProps = React.ComponentProps<typeof Menu$1.RadioGroup>;
|
|
26
|
+
type MenuRadioItemProps = React.ComponentProps<typeof Menu$1.RadioItem> & {
|
|
27
|
+
inset?: boolean;
|
|
28
|
+
};
|
|
29
|
+
type MenuSeparatorProps = React.ComponentProps<typeof Menu$1.Separator>;
|
|
30
|
+
type MenuShortcutProps = React.ComponentProps<"span">;
|
|
31
|
+
declare function Menu(props: MenuProps): react_jsx_runtime.JSX.Element;
|
|
32
|
+
declare function MenuPortal(props: MenuPortalProps): react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare function MenuTrigger(props: MenuTriggerProps): react_jsx_runtime.JSX.Element;
|
|
34
|
+
declare function MenuContent({ align, alignOffset, side, sideOffset, className, ...props }: MenuContentProps): react_jsx_runtime.JSX.Element;
|
|
35
|
+
declare function MenuGroup(props: MenuGroupProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare function MenuLabel({ className, inset, ...props }: MenuLabelProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function MenuItem({ className, inset, variant, ...props }: MenuItemProps): react_jsx_runtime.JSX.Element;
|
|
38
|
+
declare function MenuSub(props: MenuSubProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare function MenuSubTrigger({ className, inset, children, ...props }: MenuSubTriggerProps): react_jsx_runtime.JSX.Element;
|
|
40
|
+
declare function MenuSubContent({ align, alignOffset, side, sideOffset, className, ...props }: MenuSubContentProps): react_jsx_runtime.JSX.Element;
|
|
41
|
+
declare function MenuCheckboxItem({ className, children, checked, inset, ...props }: MenuCheckboxItemProps): react_jsx_runtime.JSX.Element;
|
|
42
|
+
declare function MenuRadioGroup(props: MenuRadioGroupProps): react_jsx_runtime.JSX.Element;
|
|
43
|
+
declare function MenuRadioItem({ className, children, inset, ...props }: MenuRadioItemProps): react_jsx_runtime.JSX.Element;
|
|
44
|
+
declare function MenuSeparator({ className, ...props }: MenuSeparatorProps): react_jsx_runtime.JSX.Element;
|
|
45
|
+
declare function MenuShortcut({ className, ...props }: MenuShortcutProps): react_jsx_runtime.JSX.Element;
|
|
46
|
+
|
|
47
|
+
export { Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuPortal, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger };
|
package/dist/menu.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuItem, MenuLabel, MenuPortal, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger } from './chunk-PGXELRT4.js';
|
|
2
|
+
import './chunk-WJDWQFO3.js';
|
|
3
|
+
import './chunk-76UQO56T.js';
|
|
4
|
+
//# sourceMappingURL=menu.js.map
|
|
5
|
+
//# sourceMappingURL=menu.js.map
|
package/dist/menu.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"menu.js"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Menubar as Menubar$1 } from '@base-ui/react/menubar';
|
|
4
|
+
import { MenuCheckboxItem, MenuContent, MenuGroup, MenuItem, MenuLabel, Menu, MenuPortal, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger } from './menu.js';
|
|
5
|
+
import '@base-ui/react/menu';
|
|
6
|
+
|
|
7
|
+
type MenubarProps = React.ComponentProps<typeof Menubar$1>;
|
|
8
|
+
type MenubarMenuProps = React.ComponentProps<typeof Menu>;
|
|
9
|
+
type MenubarGroupProps = React.ComponentProps<typeof MenuGroup>;
|
|
10
|
+
type MenubarPortalProps = React.ComponentProps<typeof MenuPortal>;
|
|
11
|
+
type MenubarTriggerProps = React.ComponentProps<typeof MenuTrigger>;
|
|
12
|
+
type MenubarContentProps = React.ComponentProps<typeof MenuContent>;
|
|
13
|
+
type MenubarItemProps = React.ComponentProps<typeof MenuItem>;
|
|
14
|
+
type MenubarCheckboxItemProps = React.ComponentProps<typeof MenuCheckboxItem>;
|
|
15
|
+
type MenubarRadioGroupProps = React.ComponentProps<typeof MenuRadioGroup>;
|
|
16
|
+
type MenubarRadioItemProps = React.ComponentProps<typeof MenuRadioItem>;
|
|
17
|
+
type MenubarLabelProps = React.ComponentProps<typeof MenuLabel>;
|
|
18
|
+
type MenubarSeparatorProps = React.ComponentProps<typeof MenuSeparator>;
|
|
19
|
+
type MenubarShortcutProps = React.ComponentProps<typeof MenuShortcut>;
|
|
20
|
+
type MenubarSubProps = React.ComponentProps<typeof MenuSub>;
|
|
21
|
+
type MenubarSubTriggerProps = React.ComponentProps<typeof MenuSubTrigger>;
|
|
22
|
+
type MenubarSubContentProps = React.ComponentProps<typeof MenuSubContent>;
|
|
23
|
+
declare function Menubar({ className, ...props }: MenubarProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare function MenubarMenu({ ...props }: MenubarMenuProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
declare function MenubarGroup({ ...props }: MenubarGroupProps): react_jsx_runtime.JSX.Element;
|
|
26
|
+
declare function MenubarPortal({ ...props }: MenubarPortalProps): react_jsx_runtime.JSX.Element;
|
|
27
|
+
declare function MenubarTrigger({ ...props }: MenubarTriggerProps): react_jsx_runtime.JSX.Element;
|
|
28
|
+
declare function MenubarContent({ align, alignOffset, sideOffset, className, ...props }: MenubarContentProps): react_jsx_runtime.JSX.Element;
|
|
29
|
+
declare function MenubarItem({ ...props }: MenubarItemProps): react_jsx_runtime.JSX.Element;
|
|
30
|
+
declare function MenubarCheckboxItem({ ...props }: MenubarCheckboxItemProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
declare function MenubarRadioGroup({ ...props }: MenubarRadioGroupProps): react_jsx_runtime.JSX.Element;
|
|
32
|
+
declare function MenubarRadioItem({ ...props }: MenubarRadioItemProps): react_jsx_runtime.JSX.Element;
|
|
33
|
+
declare function MenubarLabel({ ...props }: MenubarLabelProps): react_jsx_runtime.JSX.Element;
|
|
34
|
+
declare function MenubarSeparator({ ...props }: MenubarSeparatorProps): react_jsx_runtime.JSX.Element;
|
|
35
|
+
declare function MenubarShortcut({ ...props }: MenubarShortcutProps): react_jsx_runtime.JSX.Element;
|
|
36
|
+
declare function MenubarSub({ ...props }: MenubarSubProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function MenubarSubTrigger({ ...props }: MenubarSubTriggerProps): react_jsx_runtime.JSX.Element;
|
|
38
|
+
declare function MenubarSubContent({ ...props }: MenubarSubContentProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
|
|
40
|
+
export { Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger };
|
package/dist/menubar.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Menu, MenuGroup, MenuPortal, MenuTrigger, MenuContent, MenuItem, MenuCheckboxItem, MenuRadioGroup, MenuRadioItem, MenuLabel, MenuSeparator, MenuShortcut, MenuSub, MenuSubTrigger, MenuSubContent } from './chunk-PGXELRT4.js';
|
|
2
|
+
import './chunk-WJDWQFO3.js';
|
|
3
|
+
import { cn } from './chunk-76UQO56T.js';
|
|
4
|
+
import { Menubar as Menubar$1 } from '@base-ui/react/menubar';
|
|
5
|
+
import { jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function Menubar({ className, ...props }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
Menubar$1,
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "menubar",
|
|
12
|
+
className: cn(
|
|
13
|
+
"bg-background flex h-8 items-center gap-0.5 rounded-lg border p-[3px]",
|
|
14
|
+
className
|
|
15
|
+
),
|
|
16
|
+
...props
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function MenubarMenu({ ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(Menu, { "data-slot": "menubar-menu", ...props });
|
|
22
|
+
}
|
|
23
|
+
function MenubarGroup({ ...props }) {
|
|
24
|
+
return /* @__PURE__ */ jsx(MenuGroup, { "data-slot": "menubar-group", ...props });
|
|
25
|
+
}
|
|
26
|
+
function MenubarPortal({ ...props }) {
|
|
27
|
+
return /* @__PURE__ */ jsx(MenuPortal, { "data-slot": "menubar-portal", ...props });
|
|
28
|
+
}
|
|
29
|
+
function MenubarTrigger({ ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsx(MenuTrigger, { "data-slot": "menubar-trigger", ...props });
|
|
31
|
+
}
|
|
32
|
+
function MenubarContent({
|
|
33
|
+
align = "start",
|
|
34
|
+
alignOffset = -4,
|
|
35
|
+
sideOffset = 8,
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}) {
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
MenuContent,
|
|
41
|
+
{
|
|
42
|
+
"data-slot": "menubar-content",
|
|
43
|
+
className: cn("w-auto", className),
|
|
44
|
+
align,
|
|
45
|
+
alignOffset,
|
|
46
|
+
sideOffset,
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function MenubarItem({ ...props }) {
|
|
52
|
+
return /* @__PURE__ */ jsx(MenuItem, { "data-slot": "menubar-item", ...props });
|
|
53
|
+
}
|
|
54
|
+
function MenubarCheckboxItem({ ...props }) {
|
|
55
|
+
return /* @__PURE__ */ jsx(MenuCheckboxItem, { "data-slot": "menubar-checkbox-item", ...props });
|
|
56
|
+
}
|
|
57
|
+
function MenubarRadioGroup({ ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx(MenuRadioGroup, { "data-slot": "menubar-radio-group", ...props });
|
|
59
|
+
}
|
|
60
|
+
function MenubarRadioItem({ ...props }) {
|
|
61
|
+
return /* @__PURE__ */ jsx(MenuRadioItem, { "data-slot": "menubar-radio-item", ...props });
|
|
62
|
+
}
|
|
63
|
+
function MenubarLabel({ ...props }) {
|
|
64
|
+
return /* @__PURE__ */ jsx(MenuLabel, { "data-slot": "menubar-label", ...props });
|
|
65
|
+
}
|
|
66
|
+
function MenubarSeparator({ ...props }) {
|
|
67
|
+
return /* @__PURE__ */ jsx(MenuSeparator, { "data-slot": "menubar-separator", ...props });
|
|
68
|
+
}
|
|
69
|
+
function MenubarShortcut({ ...props }) {
|
|
70
|
+
return /* @__PURE__ */ jsx(MenuShortcut, { "data-slot": "menubar-shortcut", ...props });
|
|
71
|
+
}
|
|
72
|
+
function MenubarSub({ ...props }) {
|
|
73
|
+
return /* @__PURE__ */ jsx(MenuSub, { "data-slot": "menubar-sub", ...props });
|
|
74
|
+
}
|
|
75
|
+
function MenubarSubTrigger({ ...props }) {
|
|
76
|
+
return /* @__PURE__ */ jsx(MenuSubTrigger, { "data-slot": "menubar-sub-trigger", ...props });
|
|
77
|
+
}
|
|
78
|
+
function MenubarSubContent({ ...props }) {
|
|
79
|
+
return /* @__PURE__ */ jsx(MenuSubContent, { "data-slot": "menubar-sub-content", ...props });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export { Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger };
|
|
83
|
+
//# sourceMappingURL=menubar.js.map
|
|
84
|
+
//# sourceMappingURL=menubar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/menubar.tsx"],"names":["MenubarPrimitive"],"mappings":";;;;;;AA0CA,SAAS,OAAA,CAAQ,EAAE,SAAA,EAAW,GAAG,OAAM,EAAiB;AACtD,E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AAA,EAAA,EAAQ,WAAA,EAAU,aAAA,EAAe,GAAG,KAAA,EAAO,CAAA;AACrD;AAEA,SAAS,iBAAA,CAAkB,EAAE,GAAG,KAAA,EAAM,EAA2B;AAC/D,EAAA,uBAAO,GAAA,CAAC,cAAA,EAAA,EAAe,WAAA,EAAU,qBAAA,EAAuB,GAAG,KAAA,EAAO,CAAA;AACpE;AAEA,SAAS,iBAAA,CAAkB,EAAE,GAAG,KAAA,EAAM,EAA2B;AAC/D,EAAA,uBAAO,GAAA,CAAC,cAAA,EAAA,EAAe,WAAA,EAAU,qBAAA,EAAuB,GAAG,KAAA,EAAO,CAAA;AACpE","file":"menubar.js","sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Menubar as MenubarPrimitive } from \"@base-ui/react/menubar\"\n\nimport {\n Menu,\n MenuContent,\n MenuGroup,\n MenuItem,\n MenuLabel,\n MenuPortal,\n MenuRadioGroup,\n MenuSeparator,\n MenuShortcut,\n MenuSub,\n MenuSubContent,\n MenuSubTrigger,\n MenuTrigger,\n MenuCheckboxItem,\n MenuRadioItem,\n} from \"./menu\"\n\nimport { cn } from \"./lib/utils\"\n\ntype MenubarProps = React.ComponentProps<typeof MenubarPrimitive>\ntype MenubarMenuProps = React.ComponentProps<typeof Menu>\ntype MenubarGroupProps = React.ComponentProps<typeof MenuGroup>\ntype MenubarPortalProps = React.ComponentProps<typeof MenuPortal>\ntype MenubarTriggerProps = React.ComponentProps<typeof MenuTrigger>\ntype MenubarContentProps = React.ComponentProps<typeof MenuContent>\ntype MenubarItemProps = React.ComponentProps<typeof MenuItem>\ntype MenubarCheckboxItemProps = React.ComponentProps<typeof MenuCheckboxItem>\ntype MenubarRadioGroupProps = React.ComponentProps<typeof MenuRadioGroup>\ntype MenubarRadioItemProps = React.ComponentProps<typeof MenuRadioItem>\ntype MenubarLabelProps = React.ComponentProps<typeof MenuLabel>\ntype MenubarSeparatorProps = React.ComponentProps<typeof MenuSeparator>\ntype MenubarShortcutProps = React.ComponentProps<typeof MenuShortcut>\ntype MenubarSubProps = React.ComponentProps<typeof MenuSub>\ntype MenubarSubTriggerProps = React.ComponentProps<typeof MenuSubTrigger>\ntype MenubarSubContentProps = React.ComponentProps<typeof MenuSubContent>\n\nfunction Menubar({ className, ...props }: MenubarProps) {\n return (\n <MenubarPrimitive\n data-slot=\"menubar\"\n className={cn(\n \"bg-background flex h-8 items-center gap-0.5 rounded-lg border p-[3px]\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction MenubarMenu({ ...props }: MenubarMenuProps) {\n return <Menu data-slot=\"menubar-menu\" {...props} />\n}\n\nfunction MenubarGroup({ ...props }: MenubarGroupProps) {\n return <MenuGroup data-slot=\"menubar-group\" {...props} />\n}\n\nfunction MenubarPortal({ ...props }: MenubarPortalProps) {\n return <MenuPortal data-slot=\"menubar-portal\" {...props} />\n}\n\nfunction MenubarTrigger({ ...props }: MenubarTriggerProps) {\n return <MenuTrigger data-slot=\"menubar-trigger\" {...props} />\n}\n\nfunction MenubarContent({\n align = \"start\",\n alignOffset = -4,\n sideOffset = 8,\n className,\n ...props\n}: MenubarContentProps) {\n return (\n <MenuContent\n data-slot=\"menubar-content\"\n className={cn(\"w-auto\", className)}\n align={align}\n alignOffset={alignOffset}\n sideOffset={sideOffset}\n {...props}\n />\n )\n}\n\nfunction MenubarItem({ ...props }: MenubarItemProps) {\n return <MenuItem data-slot=\"menubar-item\" {...props} />\n}\n\nfunction MenubarCheckboxItem({ ...props }: MenubarCheckboxItemProps) {\n return <MenuCheckboxItem data-slot=\"menubar-checkbox-item\" {...props} />\n}\n\nfunction MenubarRadioGroup({ ...props }: MenubarRadioGroupProps) {\n return <MenuRadioGroup data-slot=\"menubar-radio-group\" {...props} />\n}\n\nfunction MenubarRadioItem({ ...props }: MenubarRadioItemProps) {\n return <MenuRadioItem data-slot=\"menubar-radio-item\" {...props} />\n}\n\nfunction MenubarLabel({ ...props }: MenubarLabelProps) {\n return <MenuLabel data-slot=\"menubar-label\" {...props} />\n}\n\nfunction MenubarSeparator({ ...props }: MenubarSeparatorProps) {\n return <MenuSeparator data-slot=\"menubar-separator\" {...props} />\n}\n\nfunction MenubarShortcut({ ...props }: MenubarShortcutProps) {\n return <MenuShortcut data-slot=\"menubar-shortcut\" {...props} />\n}\n\nfunction MenubarSub({ ...props }: MenubarSubProps) {\n return <MenuSub data-slot=\"menubar-sub\" {...props} />\n}\n\nfunction MenubarSubTrigger({ ...props }: MenubarSubTriggerProps) {\n return <MenuSubTrigger data-slot=\"menubar-sub-trigger\" {...props} />\n}\n\nfunction MenubarSubContent({ ...props }: MenubarSubContentProps) {\n return <MenuSubContent data-slot=\"menubar-sub-content\" {...props} />\n}\n\nexport {\n Menubar,\n MenubarPortal,\n MenubarMenu,\n MenubarTrigger,\n MenubarContent,\n MenubarGroup,\n MenubarSeparator,\n MenubarLabel,\n MenubarItem,\n MenubarShortcut,\n MenubarCheckboxItem,\n MenubarRadioGroup,\n MenubarRadioItem,\n MenubarSub,\n MenubarSubTrigger,\n MenubarSubContent,\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Button } from './button.js';
|
|
4
|
+
import 'class-variance-authority/types';
|
|
5
|
+
import '@base-ui/react/button';
|
|
6
|
+
import 'class-variance-authority';
|
|
7
|
+
|
|
8
|
+
type PaginationProps = React.ComponentProps<"nav">;
|
|
9
|
+
type PaginationContentProps = React.ComponentProps<"ul">;
|
|
10
|
+
type PaginationItemProps = React.ComponentProps<"li">;
|
|
11
|
+
type PaginationLinkProps = {
|
|
12
|
+
isActive?: boolean;
|
|
13
|
+
} & Pick<React.ComponentProps<typeof Button>, "size"> & React.ComponentProps<"a">;
|
|
14
|
+
type PaginationPreviousProps = PaginationLinkProps & {
|
|
15
|
+
text?: string;
|
|
16
|
+
};
|
|
17
|
+
type PaginationNextProps = PaginationLinkProps & {
|
|
18
|
+
text?: string;
|
|
19
|
+
};
|
|
20
|
+
type PaginationEllipsisProps = React.ComponentProps<"span">;
|
|
21
|
+
declare function Pagination({ className, ...props }: PaginationProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
declare function PaginationContent({ className, ...props }: PaginationContentProps): react_jsx_runtime.JSX.Element;
|
|
23
|
+
declare function PaginationItem(props: PaginationItemProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare function PaginationLink({ className, isActive, size, ...props }: PaginationLinkProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
declare function PaginationPrevious({ className, text, ...props }: PaginationPreviousProps): react_jsx_runtime.JSX.Element;
|
|
26
|
+
declare function PaginationNext({ className, text, ...props }: PaginationNextProps): react_jsx_runtime.JSX.Element;
|
|
27
|
+
declare function PaginationEllipsis({ className, ...props }: PaginationEllipsisProps): react_jsx_runtime.JSX.Element;
|
|
28
|
+
|
|
29
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Button } from './chunk-OUFYQLVN.js';
|
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon, EllipsisIcon } from './chunk-WJDWQFO3.js';
|
|
3
|
+
import { cn } from './chunk-76UQO56T.js';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function Pagination({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"nav",
|
|
9
|
+
{
|
|
10
|
+
role: "navigation",
|
|
11
|
+
"aria-label": "pagination",
|
|
12
|
+
"data-slot": "pagination",
|
|
13
|
+
className: cn(
|
|
14
|
+
"mx-auto flex w-full justify-center",
|
|
15
|
+
className
|
|
16
|
+
),
|
|
17
|
+
...props
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function PaginationContent({ className, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
"ul",
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "pagination-content",
|
|
26
|
+
className: cn(
|
|
27
|
+
"flex items-center gap-0.5",
|
|
28
|
+
className
|
|
29
|
+
),
|
|
30
|
+
...props
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
function PaginationItem(props) {
|
|
35
|
+
return /* @__PURE__ */ jsx("li", { "data-slot": "pagination-item", ...props });
|
|
36
|
+
}
|
|
37
|
+
function PaginationLink({
|
|
38
|
+
className,
|
|
39
|
+
isActive,
|
|
40
|
+
size = "icon",
|
|
41
|
+
...props
|
|
42
|
+
}) {
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
Button,
|
|
45
|
+
{
|
|
46
|
+
variant: isActive ? "outline" : "ghost",
|
|
47
|
+
size,
|
|
48
|
+
className,
|
|
49
|
+
render: /* @__PURE__ */ jsx(
|
|
50
|
+
"a",
|
|
51
|
+
{
|
|
52
|
+
"aria-current": isActive ? "page" : void 0,
|
|
53
|
+
"data-slot": "pagination-link",
|
|
54
|
+
"data-active": isActive || void 0,
|
|
55
|
+
...props
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
function PaginationPrevious({
|
|
62
|
+
className,
|
|
63
|
+
text = "Previous",
|
|
64
|
+
...props
|
|
65
|
+
}) {
|
|
66
|
+
return /* @__PURE__ */ jsxs(
|
|
67
|
+
PaginationLink,
|
|
68
|
+
{
|
|
69
|
+
"aria-label": "Go to previous page",
|
|
70
|
+
size: "default",
|
|
71
|
+
className: cn("pl-1.5!", className),
|
|
72
|
+
...props,
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx(ChevronLeftIcon, { "data-icon": "inline-start" }),
|
|
75
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:block", children: text })
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
function PaginationNext({
|
|
81
|
+
className,
|
|
82
|
+
text = "Next",
|
|
83
|
+
...props
|
|
84
|
+
}) {
|
|
85
|
+
return /* @__PURE__ */ jsxs(
|
|
86
|
+
PaginationLink,
|
|
87
|
+
{
|
|
88
|
+
"aria-label": "Go to next page",
|
|
89
|
+
size: "default",
|
|
90
|
+
className: cn("pr-1.5!", className),
|
|
91
|
+
...props,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsx("span", { className: "hidden sm:block", children: text }),
|
|
94
|
+
/* @__PURE__ */ jsx(ChevronRightIcon, { "data-icon": "inline-end" })
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
function PaginationEllipsis({ className, ...props }) {
|
|
100
|
+
return /* @__PURE__ */ jsxs(
|
|
101
|
+
"span",
|
|
102
|
+
{
|
|
103
|
+
"aria-hidden": true,
|
|
104
|
+
"data-slot": "pagination-ellipsis",
|
|
105
|
+
className: cn(
|
|
106
|
+
"flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4",
|
|
107
|
+
className
|
|
108
|
+
),
|
|
109
|
+
...props,
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ jsx(EllipsisIcon, {}),
|
|
112
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "More pages" })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious };
|
|
119
|
+
//# sourceMappingURL=pagination.js.map
|
|
120
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/pagination.tsx"],"names":[],"mappings":";;;;;AAgCA,SAAS,UAAA,CAAW,EAAE,SAAA,EAAW,GAAG,OAAM,EAAoB;AAC5D,EAAA,uBACE,GAAA;A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,wBAAA,GAAA,CAAC,YAAA,EAAA,EAAa,CAAA;AAAA,wBACd,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,SAAA,EAAU,QAAA,EAAA,YAAA,EAAU;AAAA;AAAA;AAAA,GACtC;AAEJ","file":"pagination.js","sourcesContent":["import * as React from \"react\"\n\nimport { Button } from \"./button\"\nimport {\n ChevronLeftIcon,\n ChevronRightIcon,\n EllipsisIcon,\n} from \"./lib/internal-icons\"\n\nimport { cn } from \"./lib/utils\"\n\ntype PaginationProps = React.ComponentProps<\"nav\">\n\ntype PaginationContentProps = React.ComponentProps<\"ul\">\n\ntype PaginationItemProps = React.ComponentProps<\"li\">\n\ntype PaginationLinkProps = {\n isActive?: boolean\n} & Pick<React.ComponentProps<typeof Button>, \"size\"> &\n React.ComponentProps<\"a\">\n\ntype PaginationPreviousProps = PaginationLinkProps & {\n text?: string\n}\n\ntype PaginationNextProps = PaginationLinkProps & {\n text?: string\n}\n\ntype PaginationEllipsisProps = React.ComponentProps<\"span\">\n\nfunction Pagination({ className, ...props }: PaginationProps) {\n return (\n <nav\n role=\"navigation\"\n aria-label=\"pagination\"\n data-slot=\"pagination\"\n className={cn(\n \"mx-auto flex w-full justify-center\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction PaginationContent({ className, ...props }: PaginationContentProps) {\n return (\n <ul\n data-slot=\"pagination-content\"\n className={cn(\n \"flex items-center gap-0.5\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction PaginationItem(props: PaginationItemProps) {\n return <li data-slot=\"pagination-item\" {...props} />\n}\n\nfunction PaginationLink({\n className,\n isActive,\n size = \"icon\",\n ...props\n}: PaginationLinkProps) {\n return (\n <Button\n variant={isActive ? \"outline\" : \"ghost\"}\n size={size}\n className={className}\n render={\n <a\n aria-current={isActive ? \"page\" : undefined}\n data-slot=\"pagination-link\"\n data-active={isActive || undefined}\n {...props}\n />\n }\n />\n )\n}\n\nfunction PaginationPrevious({\n className,\n text = \"Previous\",\n ...props\n}: PaginationPreviousProps) {\n return (\n <PaginationLink\n aria-label=\"Go to previous page\"\n size=\"default\"\n className={cn(\"pl-1.5!\", className)}\n {...props}\n >\n <ChevronLeftIcon data-icon=\"inline-start\" />\n <span className=\"hidden sm:block\">{text}</span>\n </PaginationLink>\n )\n}\n\nfunction PaginationNext({\n className,\n text = \"Next\",\n ...props\n}: PaginationNextProps) {\n return (\n <PaginationLink\n aria-label=\"Go to next page\"\n size=\"default\"\n className={cn(\"pr-1.5!\", className)}\n {...props}\n >\n <span className=\"hidden sm:block\">{text}</span>\n <ChevronRightIcon data-icon=\"inline-end\" />\n </PaginationLink>\n )\n}\n\nfunction PaginationEllipsis({ className, ...props }: PaginationEllipsisProps) {\n return (\n <span\n aria-hidden\n data-slot=\"pagination-ellipsis\"\n className={cn(\n \"flex size-8 items-center justify-center [&_svg:not([class*='size-'])]:size-4\",\n className,\n )}\n {...props}\n >\n <EllipsisIcon />\n <span className=\"sr-only\">More pages</span>\n </span>\n )\n}\n\nexport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious,\n}\n"]}
|