@avenue-ticketing/ui 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/avatar.d.ts +42 -0
- package/dist/react/avatar.js +159 -0
- package/dist/react/avatar.js.map +1 -0
- package/dist/react/badge.d.ts +12 -0
- package/dist/react/badge.js +35 -1
- package/dist/react/badge.js.map +1 -1
- package/dist/react/button.d.ts +1 -1
- package/dist/react/button.js +3 -3
- package/dist/react/button.js.map +1 -1
- package/dist/react/calendar.d.ts +13 -0
- package/dist/react/calendar.js +4639 -0
- package/dist/react/calendar.js.map +1 -0
- package/dist/react/card.d.ts +11 -0
- package/dist/react/card.js +113 -0
- package/dist/react/card.js.map +1 -0
- package/dist/react/checkbox.d.ts +11 -0
- package/dist/react/checkbox.js +131 -0
- package/dist/react/checkbox.js.map +1 -0
- package/dist/react/datetime-picker.d.ts +21 -0
- package/dist/react/datetime-picker.js +6124 -0
- package/dist/react/datetime-picker.js.map +1 -0
- package/dist/react/dialog.d.ts +7 -0
- package/dist/react/dialog.js +211 -90
- package/dist/react/dialog.js.map +1 -1
- package/dist/react/dropdown.d.ts +126 -0
- package/dist/react/dropdown.js +1269 -0
- package/dist/react/dropdown.js.map +1 -0
- package/dist/react/input.d.ts +7 -0
- package/dist/react/input.js +15 -2
- package/dist/react/input.js.map +1 -1
- package/dist/react/pagination.d.ts +28 -0
- package/dist/react/pagination.js +262 -0
- package/dist/react/pagination.js.map +1 -0
- package/dist/react/popover.d.ts +76 -0
- package/dist/react/popover.js +564 -0
- package/dist/react/popover.js.map +1 -0
- package/dist/react/scroll-header.js +13 -1
- package/dist/react/scroll-header.js.map +1 -1
- package/dist/react/scroll-wheel.d.ts +45 -0
- package/dist/react/scroll-wheel.js +557 -0
- package/dist/react/scroll-wheel.js.map +1 -0
- package/dist/react/select.d.ts +62 -0
- package/dist/react/select.js +889 -0
- package/dist/react/select.js.map +1 -0
- package/dist/react/sheet.js +1 -1
- package/dist/react/sheet.js.map +1 -1
- package/dist/react/switch.d.ts +38 -0
- package/dist/react/switch.js +117 -0
- package/dist/react/switch.js.map +1 -0
- package/dist/react/table-pagination.d.ts +15 -0
- package/dist/react/table-pagination.js +1153 -0
- package/dist/react/table-pagination.js.map +1 -0
- package/dist/react/table-view/column-menu.d.ts +15 -0
- package/dist/react/table-view/column-menu.js +918 -0
- package/dist/react/table-view/column-menu.js.map +1 -0
- package/dist/react/table-view/index.d.ts +70 -0
- package/dist/react/table-view/index.js +2155 -0
- package/dist/react/table-view/index.js.map +1 -0
- package/dist/react/table.d.ts +86 -0
- package/dist/react/table.js +414 -0
- package/dist/react/table.js.map +1 -0
- package/dist/react/tabs.d.ts +9 -3
- package/dist/react/tabs.js +217 -57
- package/dist/react/tabs.js.map +1 -1
- package/dist/react/textarea.d.ts +6 -0
- package/dist/react/textarea.js +33 -0
- package/dist/react/textarea.js.map +1 -0
- package/dist/react/time-picker.d.ts +22 -0
- package/dist/react/time-picker.js +856 -0
- package/dist/react/time-picker.js.map +1 -0
- package/dist/react/tooltip.d.ts +45 -0
- package/dist/react/tooltip.js +540 -0
- package/dist/react/tooltip.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,918 @@
|
|
|
1
|
+
import { X, MoreVertical, ArrowLeft, ArrowRight, ChevronUp, ChevronDown, Pin, PinOff, EyeOff } from 'lucide-react';
|
|
2
|
+
import * as React2 from 'react';
|
|
3
|
+
import React2__default, { useCallback, forwardRef, useState, useImperativeHandle, memo, useRef, useMemo, useEffect, useLayoutEffect } from 'react';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
import { createPortal } from 'react-dom';
|
|
8
|
+
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return twMerge(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
var sizeClass = {
|
|
13
|
+
xs: "h-8 min-h-8 gap-2 px-4 text-sm has-[>svg]:px-3 [&_svg:not([class*='size-'])]:size-3",
|
|
14
|
+
default: "h-10 min-h-10 gap-2 px-5 text-sm has-[>svg]:px-4 [&_svg:not([class*='size-'])]:size-4",
|
|
15
|
+
lg: "h-11 min-h-11 gap-2 px-6 text-base has-[>svg]:px-5 [&_svg:not([class*='size-'])]:size-5"
|
|
16
|
+
};
|
|
17
|
+
var iconOnlySizeClass = {
|
|
18
|
+
xs: "size-8 min-h-8 min-w-8 gap-0 p-0 [&_svg:not([class*='size-'])]:size-3",
|
|
19
|
+
default: "size-10 min-h-10 min-w-10 gap-0 p-0 [&_svg:not([class*='size-'])]:size-4",
|
|
20
|
+
lg: "size-11 min-h-11 min-w-11 gap-0 p-0 [&_svg:not([class*='size-'])]:size-5"
|
|
21
|
+
};
|
|
22
|
+
var roundedClass = {
|
|
23
|
+
full: "rounded-full",
|
|
24
|
+
lg: "rounded-lg",
|
|
25
|
+
md: "rounded-md"
|
|
26
|
+
};
|
|
27
|
+
var variantClass = {
|
|
28
|
+
primary: "bg-primary text-background border border-transparent hover:bg-primary/90 active:bg-primary/85",
|
|
29
|
+
secondary: "bg-background text-primary border border-primary/10 hover:bg-primary/5",
|
|
30
|
+
destructive: "bg-background text-red-500 border border-red-500/25 hover:bg-red-500/5",
|
|
31
|
+
success: "bg-background text-green-500 border border-green-500/25 hover:bg-green-500/5"
|
|
32
|
+
};
|
|
33
|
+
var Button = React2.forwardRef(
|
|
34
|
+
({
|
|
35
|
+
className,
|
|
36
|
+
type = "button",
|
|
37
|
+
variant = "secondary",
|
|
38
|
+
rounded: roundedProp,
|
|
39
|
+
size = "default",
|
|
40
|
+
iconOnly = false,
|
|
41
|
+
disabled,
|
|
42
|
+
...props
|
|
43
|
+
}, ref) => {
|
|
44
|
+
const rounded = roundedProp ?? (iconOnly ? "md" : "full");
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
type,
|
|
49
|
+
disabled,
|
|
50
|
+
"data-slot": "button",
|
|
51
|
+
"data-icon-only": iconOnly ? "" : void 0,
|
|
52
|
+
className: cn(
|
|
53
|
+
"inline-flex shrink-0 cursor-pointer items-center justify-center whitespace-nowrap outline-none scale-100 transition-[color,background-color,box-shadow,transform] duration-150 ease-out active:scale-[0.98] active:duration-100 active:ease-linear [&_svg]:pointer-events-none [&_svg]:shrink-0",
|
|
54
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
55
|
+
"focus-visible:border-ring font-medium lg:tracking-wide focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
56
|
+
iconOnly ? iconOnlySizeClass[size] : sizeClass[size],
|
|
57
|
+
roundedClass[rounded],
|
|
58
|
+
variantClass[variant],
|
|
59
|
+
className
|
|
60
|
+
),
|
|
61
|
+
ref,
|
|
62
|
+
...props
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
Button.displayName = "Button";
|
|
68
|
+
var DROPDOWN_PANEL_OPEN_EASING = "cubic-bezier(0,0.55,0.45,1)";
|
|
69
|
+
var DROPDOWN_PANEL_CLOSE_EASING = "cubic-bezier(0.55,0,1,0.45)";
|
|
70
|
+
var DROPDOWN_MENU_MIN_WIDTH_PX = 192;
|
|
71
|
+
var DROPDOWN_MOBILE_SHEET_MAX_PX = 1024;
|
|
72
|
+
var DROPDOWN_MOBILE_SHEET_MOTION_MS = 175;
|
|
73
|
+
var DROPDOWN_MOBILE_SHEET_ENTRY_EASING = "cubic-bezier(0.85, 0, 0.15, 1)";
|
|
74
|
+
var DROPDOWN_MOBILE_SHEET_EXIT_EASING = "cubic-bezier(0.85, 0, 1, 0.15)";
|
|
75
|
+
var DROPDOWN_MOBILE_SHEET_SLIDE_ENTRANCE_OFFSET_DEFAULT_PX = 120;
|
|
76
|
+
function resolveDropdownMobileSheet(mobileOptions) {
|
|
77
|
+
return {
|
|
78
|
+
sheet: mobileOptions?.sheet ?? true,
|
|
79
|
+
title: mobileOptions?.title,
|
|
80
|
+
sheetExtraClassName: mobileOptions?.className,
|
|
81
|
+
contentClassName: mobileOptions?.contentClassName
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
var DROPDOWN_SUB_CONTENT_ATTR = "data-dropdown-sub-content";
|
|
85
|
+
var DROPDOWN_SHEET_MENU_TEXT = "max-[1024px]:text-base";
|
|
86
|
+
var DROPDOWN_SHEET_MENU_SHORTCUT = "max-[1024px]:text-sm";
|
|
87
|
+
var DROPDOWN_CONTENT_ORIGIN = {
|
|
88
|
+
bottom: "top center",
|
|
89
|
+
top: "bottom center",
|
|
90
|
+
left: "right center",
|
|
91
|
+
right: "left center"
|
|
92
|
+
};
|
|
93
|
+
var DROPDOWN_CONTENT_HIDDEN = {
|
|
94
|
+
bottom: "translateY(-4px) scale(0.97)",
|
|
95
|
+
top: "translateY(4px) scale(0.97)",
|
|
96
|
+
left: "translateX(4px) scale(0.97)",
|
|
97
|
+
right: "translateX(-4px) scale(0.97)"
|
|
98
|
+
};
|
|
99
|
+
function computePos(trigger, menu, side, align, offset, pad) {
|
|
100
|
+
const tr = trigger.getBoundingClientRect();
|
|
101
|
+
const mr = menu.getBoundingClientRect();
|
|
102
|
+
const vw = window.innerWidth;
|
|
103
|
+
const vh = window.innerHeight;
|
|
104
|
+
const sx = window.scrollX;
|
|
105
|
+
const sy = window.scrollY;
|
|
106
|
+
let top = 0;
|
|
107
|
+
let left = 0;
|
|
108
|
+
let effectiveSide = side;
|
|
109
|
+
const calc = (s) => {
|
|
110
|
+
switch (s) {
|
|
111
|
+
case "bottom":
|
|
112
|
+
top = tr.bottom + sy + offset;
|
|
113
|
+
if (align === "start") left = tr.left + sx;
|
|
114
|
+
else if (align === "end") left = tr.right + sx - mr.width;
|
|
115
|
+
else left = tr.left + sx + tr.width / 2 - mr.width / 2;
|
|
116
|
+
break;
|
|
117
|
+
case "top":
|
|
118
|
+
top = tr.top + sy - mr.height - offset;
|
|
119
|
+
if (align === "start") left = tr.left + sx;
|
|
120
|
+
else if (align === "end") left = tr.right + sx - mr.width;
|
|
121
|
+
else left = tr.left + sx + tr.width / 2 - mr.width / 2;
|
|
122
|
+
break;
|
|
123
|
+
case "right":
|
|
124
|
+
left = tr.right + sx + offset;
|
|
125
|
+
if (align === "start") top = tr.top + sy;
|
|
126
|
+
else if (align === "end") top = tr.bottom + sy - mr.height;
|
|
127
|
+
else top = tr.top + sy + tr.height / 2 - mr.height / 2;
|
|
128
|
+
break;
|
|
129
|
+
case "left":
|
|
130
|
+
left = tr.left + sx - mr.width - offset;
|
|
131
|
+
if (align === "start") top = tr.top + sy;
|
|
132
|
+
else if (align === "end") top = tr.bottom + sy - mr.height;
|
|
133
|
+
else top = tr.top + sy + tr.height / 2 - mr.height / 2;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
calc(side);
|
|
138
|
+
if (side === "bottom" && top + mr.height > vh + sy - pad) {
|
|
139
|
+
const ft = tr.top + sy - mr.height - offset;
|
|
140
|
+
if (ft >= sy + pad) {
|
|
141
|
+
effectiveSide = "top";
|
|
142
|
+
top = ft;
|
|
143
|
+
}
|
|
144
|
+
} else if (side === "top" && top < sy + pad) {
|
|
145
|
+
const ft = tr.bottom + sy + offset;
|
|
146
|
+
if (ft + mr.height <= vh + sy - pad) {
|
|
147
|
+
effectiveSide = "bottom";
|
|
148
|
+
top = ft;
|
|
149
|
+
}
|
|
150
|
+
} else if (side === "right" && left + mr.width > vw + sx - pad) {
|
|
151
|
+
const fl = tr.left + sx - mr.width - offset;
|
|
152
|
+
if (fl >= sx + pad) {
|
|
153
|
+
effectiveSide = "left";
|
|
154
|
+
left = fl;
|
|
155
|
+
}
|
|
156
|
+
} else if (side === "left" && left < sx + pad) {
|
|
157
|
+
const fl = tr.right + sx + offset;
|
|
158
|
+
if (fl + mr.width <= vw + sx - pad) {
|
|
159
|
+
effectiveSide = "right";
|
|
160
|
+
left = fl;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
left = Math.max(sx + pad, Math.min(left, vw + sx - mr.width - pad));
|
|
164
|
+
top = Math.max(sy + pad, Math.min(top, vh + sy - mr.height - pad));
|
|
165
|
+
return { top, left, side: effectiveSide };
|
|
166
|
+
}
|
|
167
|
+
function useIsMobile(breakpoint = 1025) {
|
|
168
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
169
|
+
useEffect(() => {
|
|
170
|
+
const mq = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
171
|
+
setIsMobile(mq.matches);
|
|
172
|
+
const handler = (e) => setIsMobile(e.matches);
|
|
173
|
+
mq.addEventListener("change", handler);
|
|
174
|
+
return () => mq.removeEventListener("change", handler);
|
|
175
|
+
}, [breakpoint]);
|
|
176
|
+
return isMobile;
|
|
177
|
+
}
|
|
178
|
+
var DropdownContext = React2__default.createContext(void 0);
|
|
179
|
+
function useDropdown() {
|
|
180
|
+
const ctx = React2__default.useContext(DropdownContext);
|
|
181
|
+
if (!ctx)
|
|
182
|
+
throw new Error("Dropdown components must be used within <Dropdown />");
|
|
183
|
+
return ctx;
|
|
184
|
+
}
|
|
185
|
+
React2__default.createContext(void 0);
|
|
186
|
+
var Dropdown = ({
|
|
187
|
+
children,
|
|
188
|
+
open: controlledOpen,
|
|
189
|
+
onOpenChange
|
|
190
|
+
}) => {
|
|
191
|
+
const [internalOpen, setInternalOpen] = useState(false);
|
|
192
|
+
const isControlled = controlledOpen !== void 0;
|
|
193
|
+
const open = isControlled ? controlledOpen : internalOpen;
|
|
194
|
+
const triggerRef = useRef(null);
|
|
195
|
+
const [radioValues, setRadioValues] = useState({});
|
|
196
|
+
const setOpen = useCallback(
|
|
197
|
+
(v) => {
|
|
198
|
+
if (!isControlled) setInternalOpen(v);
|
|
199
|
+
onOpenChange?.(v);
|
|
200
|
+
},
|
|
201
|
+
[isControlled, onOpenChange]
|
|
202
|
+
);
|
|
203
|
+
const setRadioValue = useCallback((group, value) => {
|
|
204
|
+
setRadioValues((prev) => ({ ...prev, [group]: value }));
|
|
205
|
+
}, []);
|
|
206
|
+
const ctx = useMemo(
|
|
207
|
+
() => ({ open, setOpen, triggerRef, radioValues, setRadioValue }),
|
|
208
|
+
[open, setOpen, radioValues, setRadioValue]
|
|
209
|
+
);
|
|
210
|
+
return /* @__PURE__ */ jsx(DropdownContext.Provider, { value: ctx, children });
|
|
211
|
+
};
|
|
212
|
+
function mergeTriggerRef(triggerRef, node, childRef) {
|
|
213
|
+
triggerRef.current = node;
|
|
214
|
+
if (typeof childRef === "function") childRef(node);
|
|
215
|
+
else if (childRef && typeof childRef === "object")
|
|
216
|
+
childRef.current = node;
|
|
217
|
+
}
|
|
218
|
+
var DropdownTrigger = React2__default.forwardRef(
|
|
219
|
+
({
|
|
220
|
+
children,
|
|
221
|
+
asChild,
|
|
222
|
+
className,
|
|
223
|
+
onClick: onClickProp,
|
|
224
|
+
disabled,
|
|
225
|
+
...buttonProps
|
|
226
|
+
}, ref) => {
|
|
227
|
+
const { open, setOpen, triggerRef } = useDropdown();
|
|
228
|
+
const handleClick = useCallback(
|
|
229
|
+
(e) => {
|
|
230
|
+
onClickProp?.(e);
|
|
231
|
+
e.stopPropagation();
|
|
232
|
+
if (disabled) return;
|
|
233
|
+
setOpen(!open);
|
|
234
|
+
},
|
|
235
|
+
[disabled, onClickProp, open, setOpen]
|
|
236
|
+
);
|
|
237
|
+
const setButtonRef = useCallback(
|
|
238
|
+
(el) => {
|
|
239
|
+
triggerRef.current = el;
|
|
240
|
+
if (typeof ref === "function") ref(el);
|
|
241
|
+
else if (ref) ref.current = el;
|
|
242
|
+
},
|
|
243
|
+
[ref, triggerRef]
|
|
244
|
+
);
|
|
245
|
+
if (asChild && React2__default.isValidElement(children)) {
|
|
246
|
+
const child = children;
|
|
247
|
+
return React2__default.cloneElement(child, {
|
|
248
|
+
ref: (node) => {
|
|
249
|
+
mergeTriggerRef(
|
|
250
|
+
triggerRef,
|
|
251
|
+
node,
|
|
252
|
+
child.ref
|
|
253
|
+
);
|
|
254
|
+
},
|
|
255
|
+
className: cn("group", child.props.className),
|
|
256
|
+
onClick: (e) => {
|
|
257
|
+
child.props.onClick?.(e);
|
|
258
|
+
handleClick(e);
|
|
259
|
+
},
|
|
260
|
+
"aria-expanded": open,
|
|
261
|
+
"aria-haspopup": "menu",
|
|
262
|
+
"data-state": open ? "open" : "closed",
|
|
263
|
+
...disabled !== void 0 ? {
|
|
264
|
+
disabled
|
|
265
|
+
} : {}
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
return /* @__PURE__ */ jsx(
|
|
269
|
+
Button,
|
|
270
|
+
{
|
|
271
|
+
ref: setButtonRef,
|
|
272
|
+
type: "button",
|
|
273
|
+
...buttonProps,
|
|
274
|
+
disabled,
|
|
275
|
+
className: cn("group", className),
|
|
276
|
+
"aria-expanded": open,
|
|
277
|
+
"aria-haspopup": "menu",
|
|
278
|
+
"data-state": open ? "open" : "closed",
|
|
279
|
+
onClick: handleClick,
|
|
280
|
+
children
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
DropdownTrigger.displayName = "DropdownTrigger";
|
|
286
|
+
var DropdownMobileClose = React2__default.forwardRef(({ className, type = "button", ...props }, ref) => {
|
|
287
|
+
return /* @__PURE__ */ jsxs(
|
|
288
|
+
"button",
|
|
289
|
+
{
|
|
290
|
+
ref,
|
|
291
|
+
type,
|
|
292
|
+
className: cn(
|
|
293
|
+
"z-100 flex size-12 shrink-0 cursor-pointer items-center justify-center rounded-full transition-all hover:bg-secondary-background active:scale-[0.96]",
|
|
294
|
+
className
|
|
295
|
+
),
|
|
296
|
+
...props,
|
|
297
|
+
children: [
|
|
298
|
+
/* @__PURE__ */ jsx(X, { className: "size-5.5" }),
|
|
299
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
});
|
|
304
|
+
DropdownMobileClose.displayName = "DropdownMobileClose";
|
|
305
|
+
function DropdownMobileBottomSheetPortal({
|
|
306
|
+
open,
|
|
307
|
+
isAnimating,
|
|
308
|
+
slideEntrance,
|
|
309
|
+
slideOffsetPx,
|
|
310
|
+
sheetTitle,
|
|
311
|
+
sheetExtraClassName,
|
|
312
|
+
contentClassName,
|
|
313
|
+
onRequestClose,
|
|
314
|
+
menuRef,
|
|
315
|
+
portalZClassName = "z-50",
|
|
316
|
+
children,
|
|
317
|
+
className,
|
|
318
|
+
style,
|
|
319
|
+
...panelProps
|
|
320
|
+
}) {
|
|
321
|
+
const sheetMotion = open ? DROPDOWN_MOBILE_SHEET_ENTRY_EASING : DROPDOWN_MOBILE_SHEET_EXIT_EASING;
|
|
322
|
+
const sheetHiddenTransform = slideEntrance ? `translateY(${slideOffsetPx}px)` : "translateY(100%)";
|
|
323
|
+
return createPortal(
|
|
324
|
+
/* @__PURE__ */ jsxs(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
className: cn(
|
|
328
|
+
"fixed inset-0 flex items-end justify-center p-0",
|
|
329
|
+
portalZClassName
|
|
330
|
+
),
|
|
331
|
+
children: [
|
|
332
|
+
/* @__PURE__ */ jsx(
|
|
333
|
+
"div",
|
|
334
|
+
{
|
|
335
|
+
className: cn(
|
|
336
|
+
"fixed inset-0 bg-black/40 dark:bg-black/60",
|
|
337
|
+
isAnimating ? "opacity-100" : "opacity-0"
|
|
338
|
+
),
|
|
339
|
+
style: {
|
|
340
|
+
transitionProperty: "opacity",
|
|
341
|
+
transitionDuration: `${DROPDOWN_MOBILE_SHEET_MOTION_MS}ms`,
|
|
342
|
+
transitionTimingFunction: sheetMotion
|
|
343
|
+
},
|
|
344
|
+
onClick: onRequestClose
|
|
345
|
+
}
|
|
346
|
+
),
|
|
347
|
+
/* @__PURE__ */ jsxs(
|
|
348
|
+
"div",
|
|
349
|
+
{
|
|
350
|
+
...panelProps,
|
|
351
|
+
ref: menuRef,
|
|
352
|
+
className: cn(
|
|
353
|
+
"bg-background border-primary/10 relative z-10 flex w-full max-h-[min(90dvh,calc(100dvh-env(safe-area-inset-bottom,0px)))] flex-col overflow-hidden shadow-2xl outline-none",
|
|
354
|
+
"rounded-t-2xl rounded-b-none border-x-0 border-b-0 border-t",
|
|
355
|
+
sheetExtraClassName,
|
|
356
|
+
className
|
|
357
|
+
),
|
|
358
|
+
style: {
|
|
359
|
+
transform: isAnimating ? "translateY(0)" : sheetHiddenTransform,
|
|
360
|
+
opacity: isAnimating ? 1 : 0,
|
|
361
|
+
transitionProperty: "transform, opacity",
|
|
362
|
+
transitionDuration: `${DROPDOWN_MOBILE_SHEET_MOTION_MS}ms`,
|
|
363
|
+
transitionTimingFunction: sheetMotion,
|
|
364
|
+
...style
|
|
365
|
+
},
|
|
366
|
+
children: [
|
|
367
|
+
/* @__PURE__ */ jsxs(
|
|
368
|
+
"div",
|
|
369
|
+
{
|
|
370
|
+
className: cn(
|
|
371
|
+
"flex w-full shrink-0 items-center py-2 pl-4 pr-2",
|
|
372
|
+
sheetTitle ? "justify-between gap-3" : "justify-end"
|
|
373
|
+
),
|
|
374
|
+
children: [
|
|
375
|
+
sheetTitle ? /* @__PURE__ */ jsx("p", { className: "text-foreground min-w-0 flex-1 truncate text-base font-semibold", children: sheetTitle }) : null,
|
|
376
|
+
/* @__PURE__ */ jsx(
|
|
377
|
+
DropdownMobileClose,
|
|
378
|
+
{
|
|
379
|
+
onClick: (e) => {
|
|
380
|
+
e.stopPropagation();
|
|
381
|
+
onRequestClose();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
)
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
),
|
|
388
|
+
/* @__PURE__ */ jsx(
|
|
389
|
+
"div",
|
|
390
|
+
{
|
|
391
|
+
className: cn(
|
|
392
|
+
"min-h-0 flex-1 overflow-y-auto pb-[calc(5rem+env(safe-area-inset-bottom,0px))]",
|
|
393
|
+
contentClassName
|
|
394
|
+
),
|
|
395
|
+
children
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
)
|
|
401
|
+
]
|
|
402
|
+
}
|
|
403
|
+
),
|
|
404
|
+
document.body
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
var DropdownContent = ({
|
|
408
|
+
children,
|
|
409
|
+
side = "bottom",
|
|
410
|
+
align = "start",
|
|
411
|
+
offset = 10,
|
|
412
|
+
duration = 80,
|
|
413
|
+
viewportPadding = 8,
|
|
414
|
+
closeOnEscape = true,
|
|
415
|
+
minWidth = "trigger",
|
|
416
|
+
loop = true,
|
|
417
|
+
mobileOptions,
|
|
418
|
+
slideEntrance = true,
|
|
419
|
+
slideEntranceOffsetPx: slideEntranceOffsetPxProp,
|
|
420
|
+
className,
|
|
421
|
+
style,
|
|
422
|
+
...props
|
|
423
|
+
}) => {
|
|
424
|
+
const isMobile = useIsMobile(DROPDOWN_MOBILE_SHEET_MAX_PX + 1);
|
|
425
|
+
const { open, setOpen, triggerRef } = useDropdown();
|
|
426
|
+
const [shouldRender, setShouldRender] = useState(false);
|
|
427
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
428
|
+
const [pos, setPos] = useState({ top: -9999, left: -9999, side });
|
|
429
|
+
const [triggerW, setTriggerW] = useState(0);
|
|
430
|
+
const menuRef = useRef(null);
|
|
431
|
+
const resolvedMobile = useMemo(
|
|
432
|
+
() => resolveDropdownMobileSheet(mobileOptions),
|
|
433
|
+
[mobileOptions]
|
|
434
|
+
);
|
|
435
|
+
const slideOffsetPx = useMemo(
|
|
436
|
+
() => slideEntranceOffsetPxProp ?? DROPDOWN_MOBILE_SHEET_SLIDE_ENTRANCE_OFFSET_DEFAULT_PX,
|
|
437
|
+
[slideEntranceOffsetPxProp]
|
|
438
|
+
);
|
|
439
|
+
const closeDuration = isMobile && resolvedMobile.sheet ? DROPDOWN_MOBILE_SHEET_MOTION_MS : duration;
|
|
440
|
+
const closeMenu = useCallback(() => setOpen(false), [setOpen]);
|
|
441
|
+
useEffect(() => {
|
|
442
|
+
if (open) {
|
|
443
|
+
setShouldRender(true);
|
|
444
|
+
} else {
|
|
445
|
+
setIsAnimating(false);
|
|
446
|
+
const timer = setTimeout(() => setShouldRender(false), closeDuration);
|
|
447
|
+
return () => clearTimeout(timer);
|
|
448
|
+
}
|
|
449
|
+
}, [open, closeDuration]);
|
|
450
|
+
useEffect(() => {
|
|
451
|
+
if (!shouldRender || !open) return;
|
|
452
|
+
let raf2 = 0;
|
|
453
|
+
const raf1 = requestAnimationFrame(() => {
|
|
454
|
+
raf2 = requestAnimationFrame(() => setIsAnimating(true));
|
|
455
|
+
});
|
|
456
|
+
return () => {
|
|
457
|
+
cancelAnimationFrame(raf1);
|
|
458
|
+
if (raf2) cancelAnimationFrame(raf2);
|
|
459
|
+
};
|
|
460
|
+
}, [shouldRender, open]);
|
|
461
|
+
useLayoutEffect(() => {
|
|
462
|
+
if (!shouldRender || !triggerRef.current || !menuRef.current) return;
|
|
463
|
+
const update = () => {
|
|
464
|
+
if (!triggerRef.current || !menuRef.current) return;
|
|
465
|
+
setTriggerW(triggerRef.current.getBoundingClientRect().width);
|
|
466
|
+
setPos(
|
|
467
|
+
computePos(
|
|
468
|
+
triggerRef.current,
|
|
469
|
+
menuRef.current,
|
|
470
|
+
side,
|
|
471
|
+
align,
|
|
472
|
+
offset,
|
|
473
|
+
viewportPadding
|
|
474
|
+
)
|
|
475
|
+
);
|
|
476
|
+
};
|
|
477
|
+
update();
|
|
478
|
+
window.addEventListener("resize", update);
|
|
479
|
+
window.addEventListener("scroll", update, true);
|
|
480
|
+
return () => {
|
|
481
|
+
window.removeEventListener("resize", update);
|
|
482
|
+
window.removeEventListener("scroll", update, true);
|
|
483
|
+
};
|
|
484
|
+
}, [shouldRender, side, align, offset, viewportPadding]);
|
|
485
|
+
useEffect(() => {
|
|
486
|
+
if (isAnimating && menuRef.current) {
|
|
487
|
+
menuRef.current.focus();
|
|
488
|
+
}
|
|
489
|
+
}, [isAnimating]);
|
|
490
|
+
useEffect(() => {
|
|
491
|
+
if (!open) return;
|
|
492
|
+
const handler = (e) => {
|
|
493
|
+
const t = e.target;
|
|
494
|
+
if (menuRef.current?.contains(t) || triggerRef.current?.contains(t))
|
|
495
|
+
return;
|
|
496
|
+
const el = e.target instanceof Element ? e.target : null;
|
|
497
|
+
if (el?.closest?.(`[${DROPDOWN_SUB_CONTENT_ATTR}]`)) return;
|
|
498
|
+
setOpen(false);
|
|
499
|
+
};
|
|
500
|
+
document.addEventListener("mousedown", handler);
|
|
501
|
+
return () => document.removeEventListener("mousedown", handler);
|
|
502
|
+
}, [open, setOpen, triggerRef]);
|
|
503
|
+
useEffect(() => {
|
|
504
|
+
if (!open) return;
|
|
505
|
+
const handler = (e) => {
|
|
506
|
+
const menu = menuRef.current;
|
|
507
|
+
if (!menu) return;
|
|
508
|
+
const focusedEl = document.activeElement;
|
|
509
|
+
if (focusedEl && !menu.contains(focusedEl)) return;
|
|
510
|
+
const items = getItems(menu);
|
|
511
|
+
const idx = items.indexOf(focusedEl);
|
|
512
|
+
switch (e.key) {
|
|
513
|
+
case "Escape":
|
|
514
|
+
if (closeOnEscape) {
|
|
515
|
+
e.preventDefault();
|
|
516
|
+
setOpen(false);
|
|
517
|
+
triggerRef.current?.focus();
|
|
518
|
+
}
|
|
519
|
+
break;
|
|
520
|
+
case "ArrowDown":
|
|
521
|
+
e.preventDefault();
|
|
522
|
+
if (items.length === 0) break;
|
|
523
|
+
if (idx === -1 || idx === items.length - 1 && loop)
|
|
524
|
+
items[0]?.focus();
|
|
525
|
+
else if (idx < items.length - 1) items[idx + 1]?.focus();
|
|
526
|
+
break;
|
|
527
|
+
case "ArrowUp":
|
|
528
|
+
e.preventDefault();
|
|
529
|
+
if (items.length === 0) break;
|
|
530
|
+
if (idx <= 0 && loop) items[items.length - 1]?.focus();
|
|
531
|
+
else if (idx > 0) items[idx - 1]?.focus();
|
|
532
|
+
break;
|
|
533
|
+
case "Home":
|
|
534
|
+
e.preventDefault();
|
|
535
|
+
items[0]?.focus();
|
|
536
|
+
break;
|
|
537
|
+
case "End":
|
|
538
|
+
e.preventDefault();
|
|
539
|
+
items[items.length - 1]?.focus();
|
|
540
|
+
break;
|
|
541
|
+
case "Tab":
|
|
542
|
+
setOpen(false);
|
|
543
|
+
break;
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
window.addEventListener("keydown", handler);
|
|
547
|
+
return () => window.removeEventListener("keydown", handler);
|
|
548
|
+
}, [open, closeOnEscape, loop, setOpen, triggerRef]);
|
|
549
|
+
useEffect(() => {
|
|
550
|
+
if (open && isMobile && resolvedMobile.sheet) {
|
|
551
|
+
document.body.style.overflow = "hidden";
|
|
552
|
+
}
|
|
553
|
+
return () => {
|
|
554
|
+
document.body.style.overflow = "";
|
|
555
|
+
};
|
|
556
|
+
}, [open, isMobile, resolvedMobile.sheet]);
|
|
557
|
+
if (!shouldRender || typeof document === "undefined") return null;
|
|
558
|
+
if (isMobile && resolvedMobile.sheet) {
|
|
559
|
+
return /* @__PURE__ */ jsx(
|
|
560
|
+
DropdownMobileBottomSheetPortal,
|
|
561
|
+
{
|
|
562
|
+
...props,
|
|
563
|
+
open,
|
|
564
|
+
isAnimating,
|
|
565
|
+
slideEntrance,
|
|
566
|
+
slideOffsetPx,
|
|
567
|
+
sheetTitle: resolvedMobile.title,
|
|
568
|
+
sheetExtraClassName: resolvedMobile.sheetExtraClassName,
|
|
569
|
+
contentClassName: resolvedMobile.contentClassName,
|
|
570
|
+
onRequestClose: closeMenu,
|
|
571
|
+
menuRef,
|
|
572
|
+
portalZClassName: "z-50",
|
|
573
|
+
className,
|
|
574
|
+
style,
|
|
575
|
+
role: "menu",
|
|
576
|
+
"aria-orientation": "vertical",
|
|
577
|
+
tabIndex: -1,
|
|
578
|
+
children
|
|
579
|
+
}
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
const resolvedMinW = minWidth === "trigger" ? Math.max(triggerW, DROPDOWN_MENU_MIN_WIDTH_PX) : minWidth;
|
|
583
|
+
return createPortal(
|
|
584
|
+
/* @__PURE__ */ jsx(
|
|
585
|
+
"div",
|
|
586
|
+
{
|
|
587
|
+
...props,
|
|
588
|
+
ref: menuRef,
|
|
589
|
+
role: "menu",
|
|
590
|
+
"aria-orientation": "vertical",
|
|
591
|
+
tabIndex: -1,
|
|
592
|
+
className: cn(
|
|
593
|
+
"bg-background border-primary/10 absolute z-50 overflow-hidden rounded-xl border py-1.5 shadow-xl outline-none",
|
|
594
|
+
className
|
|
595
|
+
),
|
|
596
|
+
style: {
|
|
597
|
+
position: "absolute",
|
|
598
|
+
top: pos.top,
|
|
599
|
+
left: pos.left,
|
|
600
|
+
minWidth: resolvedMinW,
|
|
601
|
+
transformOrigin: DROPDOWN_CONTENT_ORIGIN[pos.side],
|
|
602
|
+
transform: isAnimating ? "none" : DROPDOWN_CONTENT_HIDDEN[pos.side],
|
|
603
|
+
opacity: isAnimating ? 1 : 0,
|
|
604
|
+
transitionProperty: "opacity, transform",
|
|
605
|
+
transitionDuration: `${duration}ms`,
|
|
606
|
+
transitionTimingFunction: isAnimating ? DROPDOWN_PANEL_OPEN_EASING : DROPDOWN_PANEL_CLOSE_EASING,
|
|
607
|
+
...style
|
|
608
|
+
},
|
|
609
|
+
children
|
|
610
|
+
}
|
|
611
|
+
),
|
|
612
|
+
document.body
|
|
613
|
+
);
|
|
614
|
+
};
|
|
615
|
+
function getItems(menu) {
|
|
616
|
+
return Array.from(
|
|
617
|
+
menu.querySelectorAll(
|
|
618
|
+
'[role="menuitem"]:not([aria-disabled="true"]),[role="menuitemcheckbox"]:not([aria-disabled="true"]),[role="menuitemradio"]:not([aria-disabled="true"])'
|
|
619
|
+
)
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
var DropdownItem = ({
|
|
623
|
+
children,
|
|
624
|
+
disabled = false,
|
|
625
|
+
destructive = false,
|
|
626
|
+
icon,
|
|
627
|
+
shortcut,
|
|
628
|
+
closeOnSelect = true,
|
|
629
|
+
inset = false,
|
|
630
|
+
className,
|
|
631
|
+
onClick,
|
|
632
|
+
...props
|
|
633
|
+
}) => {
|
|
634
|
+
const { setOpen } = useDropdown();
|
|
635
|
+
const handleClick = (e) => {
|
|
636
|
+
if (disabled) return;
|
|
637
|
+
onClick?.(e);
|
|
638
|
+
if (closeOnSelect) setOpen(false);
|
|
639
|
+
};
|
|
640
|
+
const handleKeyDown = (e) => {
|
|
641
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
642
|
+
e.preventDefault();
|
|
643
|
+
handleClick(e);
|
|
644
|
+
}
|
|
645
|
+
};
|
|
646
|
+
return /* @__PURE__ */ jsxs(
|
|
647
|
+
"div",
|
|
648
|
+
{
|
|
649
|
+
...props,
|
|
650
|
+
role: "menuitem",
|
|
651
|
+
tabIndex: disabled ? void 0 : -1,
|
|
652
|
+
"aria-disabled": disabled,
|
|
653
|
+
onClick: handleClick,
|
|
654
|
+
onKeyDown: handleKeyDown,
|
|
655
|
+
className: cn(
|
|
656
|
+
"relative mx-1.5 flex items-center gap-2 rounded-md px-3 py-2 text-sm transition-colors duration-0 outline-none select-none",
|
|
657
|
+
DROPDOWN_SHEET_MENU_TEXT,
|
|
658
|
+
inset && "pl-9",
|
|
659
|
+
!disabled && "cursor-pointer",
|
|
660
|
+
disabled && "lg:cursor-not-allowed",
|
|
661
|
+
!disabled && !destructive && "text-foreground hover:bg-primary/8 focus-visible:bg-primary/8 dark:hover:bg-primary/4 dark:focus-visible:bg-primary/4",
|
|
662
|
+
!disabled && destructive && "text-destructive hover:bg-destructive/10 focus-visible:bg-destructive/10 dark:text-destructive-foreground dark:hover:bg-destructive-foreground/18 dark:focus-visible:bg-destructive-foreground/18",
|
|
663
|
+
disabled && !destructive && "text-foreground/45 dark:text-foreground/50",
|
|
664
|
+
disabled && destructive && "bg-destructive/5 text-destructive/75 dark:bg-destructive-foreground/12 dark:text-destructive-foreground/78",
|
|
665
|
+
className
|
|
666
|
+
),
|
|
667
|
+
children: [
|
|
668
|
+
icon && /* @__PURE__ */ jsx("span", { className: "flex size-4 shrink-0 items-center justify-center", children: icon }),
|
|
669
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1", children }),
|
|
670
|
+
shortcut ? /* @__PURE__ */ jsx(
|
|
671
|
+
"span",
|
|
672
|
+
{
|
|
673
|
+
className: cn(
|
|
674
|
+
"ml-auto text-xs tracking-widest",
|
|
675
|
+
DROPDOWN_SHEET_MENU_SHORTCUT,
|
|
676
|
+
destructive ? "text-destructive/70 dark:text-destructive-foreground/80" : "opacity-40"
|
|
677
|
+
),
|
|
678
|
+
children: shortcut
|
|
679
|
+
}
|
|
680
|
+
) : null
|
|
681
|
+
]
|
|
682
|
+
}
|
|
683
|
+
);
|
|
684
|
+
};
|
|
685
|
+
var DropdownSeparator = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
686
|
+
"div",
|
|
687
|
+
{
|
|
688
|
+
role: "separator",
|
|
689
|
+
className: cn("border-primary/10 my-1.5 border-t", className),
|
|
690
|
+
...props
|
|
691
|
+
}
|
|
692
|
+
);
|
|
693
|
+
React2__default.createContext(
|
|
694
|
+
void 0
|
|
695
|
+
);
|
|
696
|
+
|
|
697
|
+
// src/react/table-view/helpers.ts
|
|
698
|
+
function getTableLeafColumnOrderList(table) {
|
|
699
|
+
const o = table.getState().columnOrder;
|
|
700
|
+
if (o && o.length > 0) return [...o];
|
|
701
|
+
return table.getVisibleLeafColumns().map((c) => c.id);
|
|
702
|
+
}
|
|
703
|
+
function moveTableColumnOneStep(table, columnId, direction) {
|
|
704
|
+
const list = getTableLeafColumnOrderList(table);
|
|
705
|
+
const i = list.indexOf(columnId);
|
|
706
|
+
if (i < 0) return;
|
|
707
|
+
const next = [...list];
|
|
708
|
+
if (direction === "left" && i > 0) {
|
|
709
|
+
[next[i - 1], next[i]] = [next[i], next[i - 1]];
|
|
710
|
+
} else if (direction === "right" && i < next.length - 1) {
|
|
711
|
+
[next[i + 1], next[i]] = [next[i], next[i + 1]];
|
|
712
|
+
} else {
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
table.setColumnOrder(next);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
// src/react/table-view/meta.ts
|
|
719
|
+
function getTableViewColumnDisableReorder(column) {
|
|
720
|
+
return Boolean(column.columnDef.meta?.tableView?.disableColumnReorder);
|
|
721
|
+
}
|
|
722
|
+
var ColumnHeaderMenuInner = forwardRef(function ColumnHeaderMenuInner2({ table, header, columnSort, columnReorder }, ref) {
|
|
723
|
+
const [open, setOpen] = useState(false);
|
|
724
|
+
useImperativeHandle(
|
|
725
|
+
ref,
|
|
726
|
+
() => ({
|
|
727
|
+
open: () => {
|
|
728
|
+
setOpen(true);
|
|
729
|
+
}
|
|
730
|
+
}),
|
|
731
|
+
[]
|
|
732
|
+
);
|
|
733
|
+
const col = header.column;
|
|
734
|
+
const id = col.id;
|
|
735
|
+
const canPin = col.getCanPin();
|
|
736
|
+
const pin = col.getIsPinned();
|
|
737
|
+
const list = getTableLeafColumnOrderList(table);
|
|
738
|
+
const idx = list.indexOf(id);
|
|
739
|
+
const reorderLocked = getTableViewColumnDisableReorder(col);
|
|
740
|
+
const canMoveLeft = columnReorder && !reorderLocked && idx > 0;
|
|
741
|
+
const canMoveRight = columnReorder && !reorderLocked && idx >= 0 && idx < list.length - 1;
|
|
742
|
+
const canSort = columnSort && col.getCanSort();
|
|
743
|
+
const hasMoveSection = canMoveLeft || canMoveRight;
|
|
744
|
+
const hasSortSection = !!canSort;
|
|
745
|
+
const hasPinSection = canPin;
|
|
746
|
+
const hasHideSection = col.getCanHide();
|
|
747
|
+
if (!hasMoveSection && !hasSortSection && !hasPinSection && !hasHideSection) {
|
|
748
|
+
return null;
|
|
749
|
+
}
|
|
750
|
+
const showSepBeforeHide = hasHideSection && (hasMoveSection || hasSortSection || hasPinSection);
|
|
751
|
+
return /* @__PURE__ */ jsx(
|
|
752
|
+
"div",
|
|
753
|
+
{
|
|
754
|
+
className: cn(
|
|
755
|
+
"flex shrink-0 self-stretch items-center",
|
|
756
|
+
"opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100 has-[[data-state=open]]:opacity-100"
|
|
757
|
+
),
|
|
758
|
+
onClick: (e) => e.stopPropagation(),
|
|
759
|
+
children: /* @__PURE__ */ jsxs(Dropdown, { open, onOpenChange: setOpen, children: [
|
|
760
|
+
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
761
|
+
Button,
|
|
762
|
+
{
|
|
763
|
+
type: "button",
|
|
764
|
+
size: "xs",
|
|
765
|
+
iconOnly: true,
|
|
766
|
+
rounded: "full",
|
|
767
|
+
className: "touch-manipulation border-none bg-transparent shadow-none",
|
|
768
|
+
"aria-label": "Column options",
|
|
769
|
+
children: /* @__PURE__ */ jsx(MoreVertical, { className: "size-3.5", strokeWidth: 2.25, "aria-hidden": true })
|
|
770
|
+
}
|
|
771
|
+
) }),
|
|
772
|
+
/* @__PURE__ */ jsxs(DropdownContent, { align: "end", side: "bottom", offset: 4, children: [
|
|
773
|
+
hasMoveSection ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
774
|
+
/* @__PURE__ */ jsx(
|
|
775
|
+
DropdownItem,
|
|
776
|
+
{
|
|
777
|
+
disabled: !canMoveLeft,
|
|
778
|
+
icon: /* @__PURE__ */ jsx(
|
|
779
|
+
ArrowLeft,
|
|
780
|
+
{
|
|
781
|
+
className: "size-3.5",
|
|
782
|
+
strokeWidth: 2.25,
|
|
783
|
+
"aria-hidden": true
|
|
784
|
+
}
|
|
785
|
+
),
|
|
786
|
+
onClick: () => {
|
|
787
|
+
if (canMoveLeft) moveTableColumnOneStep(table, id, "left");
|
|
788
|
+
},
|
|
789
|
+
children: "Move to the left"
|
|
790
|
+
}
|
|
791
|
+
),
|
|
792
|
+
/* @__PURE__ */ jsx(
|
|
793
|
+
DropdownItem,
|
|
794
|
+
{
|
|
795
|
+
disabled: !canMoveRight,
|
|
796
|
+
icon: /* @__PURE__ */ jsx(
|
|
797
|
+
ArrowRight,
|
|
798
|
+
{
|
|
799
|
+
className: "size-3.5",
|
|
800
|
+
strokeWidth: 2.25,
|
|
801
|
+
"aria-hidden": true
|
|
802
|
+
}
|
|
803
|
+
),
|
|
804
|
+
onClick: () => {
|
|
805
|
+
if (canMoveRight) moveTableColumnOneStep(table, id, "right");
|
|
806
|
+
},
|
|
807
|
+
children: "Move to the right"
|
|
808
|
+
}
|
|
809
|
+
)
|
|
810
|
+
] }) : null,
|
|
811
|
+
hasMoveSection && (hasSortSection || hasPinSection) ? /* @__PURE__ */ jsx(DropdownSeparator, {}) : null,
|
|
812
|
+
hasSortSection ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
813
|
+
/* @__PURE__ */ jsx(
|
|
814
|
+
DropdownItem,
|
|
815
|
+
{
|
|
816
|
+
icon: /* @__PURE__ */ jsx(
|
|
817
|
+
ChevronUp,
|
|
818
|
+
{
|
|
819
|
+
className: "size-3.5",
|
|
820
|
+
strokeWidth: 2.25,
|
|
821
|
+
"aria-hidden": true
|
|
822
|
+
}
|
|
823
|
+
),
|
|
824
|
+
onClick: () => {
|
|
825
|
+
col.toggleSorting(false);
|
|
826
|
+
},
|
|
827
|
+
children: "Sort ascending"
|
|
828
|
+
}
|
|
829
|
+
),
|
|
830
|
+
/* @__PURE__ */ jsx(
|
|
831
|
+
DropdownItem,
|
|
832
|
+
{
|
|
833
|
+
icon: /* @__PURE__ */ jsx(
|
|
834
|
+
ChevronDown,
|
|
835
|
+
{
|
|
836
|
+
className: "size-3.5",
|
|
837
|
+
strokeWidth: 2.25,
|
|
838
|
+
"aria-hidden": true
|
|
839
|
+
}
|
|
840
|
+
),
|
|
841
|
+
onClick: () => {
|
|
842
|
+
col.toggleSorting(true);
|
|
843
|
+
},
|
|
844
|
+
children: "Sort descending"
|
|
845
|
+
}
|
|
846
|
+
)
|
|
847
|
+
] }) : null,
|
|
848
|
+
hasSortSection && hasPinSection ? /* @__PURE__ */ jsx(DropdownSeparator, {}) : null,
|
|
849
|
+
hasPinSection ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
850
|
+
pin !== "left" ? /* @__PURE__ */ jsx(
|
|
851
|
+
DropdownItem,
|
|
852
|
+
{
|
|
853
|
+
icon: /* @__PURE__ */ jsx(Pin, { className: "size-3.5", strokeWidth: 2.25, "aria-hidden": true }),
|
|
854
|
+
onClick: () => {
|
|
855
|
+
col.pin("left");
|
|
856
|
+
},
|
|
857
|
+
children: "Pin to the left"
|
|
858
|
+
}
|
|
859
|
+
) : null,
|
|
860
|
+
pin !== "right" ? /* @__PURE__ */ jsx(
|
|
861
|
+
DropdownItem,
|
|
862
|
+
{
|
|
863
|
+
icon: /* @__PURE__ */ jsx(
|
|
864
|
+
Pin,
|
|
865
|
+
{
|
|
866
|
+
className: "size-3.5 -scale-x-100",
|
|
867
|
+
strokeWidth: 2.25,
|
|
868
|
+
"aria-hidden": true
|
|
869
|
+
}
|
|
870
|
+
),
|
|
871
|
+
onClick: () => {
|
|
872
|
+
col.pin("right");
|
|
873
|
+
},
|
|
874
|
+
children: "Pin to the right"
|
|
875
|
+
}
|
|
876
|
+
) : null,
|
|
877
|
+
pin ? /* @__PURE__ */ jsx(
|
|
878
|
+
DropdownItem,
|
|
879
|
+
{
|
|
880
|
+
icon: /* @__PURE__ */ jsx(
|
|
881
|
+
PinOff,
|
|
882
|
+
{
|
|
883
|
+
className: "size-3.5",
|
|
884
|
+
strokeWidth: 2.25,
|
|
885
|
+
"aria-hidden": true
|
|
886
|
+
}
|
|
887
|
+
),
|
|
888
|
+
onClick: () => {
|
|
889
|
+
col.pin(false);
|
|
890
|
+
},
|
|
891
|
+
children: "Unpin column"
|
|
892
|
+
}
|
|
893
|
+
) : null
|
|
894
|
+
] }) : null,
|
|
895
|
+
showSepBeforeHide ? /* @__PURE__ */ jsx(DropdownSeparator, {}) : null,
|
|
896
|
+
hasHideSection ? /* @__PURE__ */ jsx(
|
|
897
|
+
DropdownItem,
|
|
898
|
+
{
|
|
899
|
+
icon: /* @__PURE__ */ jsx(EyeOff, { className: "size-3.5", strokeWidth: 2.25, "aria-hidden": true }),
|
|
900
|
+
onClick: () => {
|
|
901
|
+
col.toggleVisibility(false);
|
|
902
|
+
setOpen(false);
|
|
903
|
+
},
|
|
904
|
+
children: "Hide column"
|
|
905
|
+
}
|
|
906
|
+
) : null
|
|
907
|
+
] })
|
|
908
|
+
] })
|
|
909
|
+
}
|
|
910
|
+
);
|
|
911
|
+
});
|
|
912
|
+
ColumnHeaderMenuInner.displayName = "ColumnHeaderMenuInner";
|
|
913
|
+
var ColumnHeaderMenu = memo(ColumnHeaderMenuInner);
|
|
914
|
+
ColumnHeaderMenu.displayName = "ColumnHeaderMenu";
|
|
915
|
+
|
|
916
|
+
export { ColumnHeaderMenu };
|
|
917
|
+
//# sourceMappingURL=column-menu.js.map
|
|
918
|
+
//# sourceMappingURL=column-menu.js.map
|