@yenio-pld/blocks 1.2.0-rc.7 → 1.2.0-rc.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +289 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -71
- package/dist/index.d.ts +109 -71
- package/dist/index.js +208 -8
- package/dist/index.js.map +1 -1
- package/dist/ui/button.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var React2 = require('react');
|
|
5
5
|
var skeleton_js = require('./ui/skeleton.js');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var lucideReact = require('lucide-react');
|
|
@@ -44,11 +44,11 @@ function _interopNamespace(e) {
|
|
|
44
44
|
return Object.freeze(n);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
var
|
|
47
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
48
48
|
|
|
49
|
-
var LanguageContext =
|
|
49
|
+
var LanguageContext = React2.createContext(null);
|
|
50
50
|
function useLanguageContext() {
|
|
51
|
-
return
|
|
51
|
+
return React2.useContext(LanguageContext);
|
|
52
52
|
}
|
|
53
53
|
function PageTitle({
|
|
54
54
|
title,
|
|
@@ -278,8 +278,8 @@ function renderShellLink({
|
|
|
278
278
|
}
|
|
279
279
|
function DismissMobileSidebar({ pathname }) {
|
|
280
280
|
const { setOpenMobile } = sidebar_js.useSidebar();
|
|
281
|
-
const previous =
|
|
282
|
-
|
|
281
|
+
const previous = React2.useRef(pathname);
|
|
282
|
+
React2.useEffect(() => {
|
|
283
283
|
if (previous.current === pathname) return;
|
|
284
284
|
previous.current = pathname;
|
|
285
285
|
setOpenMobile(false);
|
|
@@ -397,7 +397,7 @@ function NavTabs({
|
|
|
397
397
|
"aria-current": active ? "page" : void 0,
|
|
398
398
|
children: tab.label
|
|
399
399
|
});
|
|
400
|
-
return
|
|
400
|
+
return React2.cloneElement(link, { key: tab.href });
|
|
401
401
|
})
|
|
402
402
|
}
|
|
403
403
|
);
|
|
@@ -703,15 +703,15 @@ function NavigationProgress({
|
|
|
703
703
|
ariaLabel = "Loading",
|
|
704
704
|
forceVisible = false
|
|
705
705
|
}) {
|
|
706
|
-
const [visible, setVisible] =
|
|
707
|
-
const [runId, setRunId] =
|
|
708
|
-
const startedAt =
|
|
709
|
-
const startedRoute =
|
|
710
|
-
const committedRoute =
|
|
711
|
-
|
|
706
|
+
const [visible, setVisible] = React2.useState(forceVisible);
|
|
707
|
+
const [runId, setRunId] = React2.useState(0);
|
|
708
|
+
const startedAt = React2.useRef(0);
|
|
709
|
+
const startedRoute = React2.useRef(null);
|
|
710
|
+
const committedRoute = React2.useRef(null);
|
|
711
|
+
React2.useEffect(() => {
|
|
712
712
|
committedRoute.current = routeKey(pathname, search);
|
|
713
713
|
}, [pathname, search]);
|
|
714
|
-
|
|
714
|
+
React2.useEffect(() => {
|
|
715
715
|
if (forceVisible) return;
|
|
716
716
|
function begin(route) {
|
|
717
717
|
if (navigationSuppressed) return;
|
|
@@ -748,12 +748,12 @@ function NavigationProgress({
|
|
|
748
748
|
window.removeEventListener("popstate", onPopState);
|
|
749
749
|
};
|
|
750
750
|
}, [forceVisible, pathname, search]);
|
|
751
|
-
|
|
751
|
+
React2.useEffect(() => {
|
|
752
752
|
if (forceVisible || !visible) return;
|
|
753
753
|
const safety = window.setTimeout(() => setVisible(false), SAFETY_MS);
|
|
754
754
|
return () => window.clearTimeout(safety);
|
|
755
755
|
}, [forceVisible, runId, visible]);
|
|
756
|
-
|
|
756
|
+
React2.useEffect(() => {
|
|
757
757
|
if (forceVisible || !visible) return;
|
|
758
758
|
const started = startedRoute.current;
|
|
759
759
|
if (!started) return;
|
|
@@ -1173,20 +1173,20 @@ function useEditableSection({
|
|
|
1173
1173
|
...DEFAULT_EDITABLE_SECTION_LABELS,
|
|
1174
1174
|
...labels
|
|
1175
1175
|
};
|
|
1176
|
-
const [mode, setMode] =
|
|
1177
|
-
const [status, setStatus] =
|
|
1178
|
-
const [confirmOpen, setConfirmOpen] =
|
|
1179
|
-
const [minHeightPx, setMinHeightPx] =
|
|
1180
|
-
const contentRef =
|
|
1181
|
-
const editButtonRef =
|
|
1182
|
-
const measuredHeightRef =
|
|
1183
|
-
const shouldFocusEditRef =
|
|
1184
|
-
const shouldFocusFirstFieldRef =
|
|
1185
|
-
const editButtonId =
|
|
1186
|
-
const contentFormId =
|
|
1176
|
+
const [mode, setMode] = React2.useState("reading");
|
|
1177
|
+
const [status, setStatus] = React2.useState(null);
|
|
1178
|
+
const [confirmOpen, setConfirmOpen] = React2.useState(false);
|
|
1179
|
+
const [minHeightPx, setMinHeightPx] = React2.useState(void 0);
|
|
1180
|
+
const contentRef = React2.useRef(null);
|
|
1181
|
+
const editButtonRef = React2.useRef(null);
|
|
1182
|
+
const measuredHeightRef = React2.useRef(0);
|
|
1183
|
+
const shouldFocusEditRef = React2.useRef(false);
|
|
1184
|
+
const shouldFocusFirstFieldRef = React2.useRef(false);
|
|
1185
|
+
const editButtonId = React2.useId();
|
|
1186
|
+
const contentFormId = React2.useId();
|
|
1187
1187
|
const isEditing = mode === "editing" || mode === "saving";
|
|
1188
1188
|
const isSaving = mode === "saving";
|
|
1189
|
-
|
|
1189
|
+
React2.useEffect(() => {
|
|
1190
1190
|
if (mode === "reading" && shouldFocusEditRef.current) {
|
|
1191
1191
|
shouldFocusEditRef.current = false;
|
|
1192
1192
|
editButtonRef.current?.focus();
|
|
@@ -1204,18 +1204,18 @@ function useEditableSection({
|
|
|
1204
1204
|
focusFirstField(contentRef.current);
|
|
1205
1205
|
}
|
|
1206
1206
|
}, [mode]);
|
|
1207
|
-
const exitToReading =
|
|
1207
|
+
const exitToReading = React2.useCallback(() => {
|
|
1208
1208
|
setConfirmOpen(false);
|
|
1209
1209
|
shouldFocusEditRef.current = true;
|
|
1210
1210
|
setMode("reading");
|
|
1211
1211
|
onDiscard?.();
|
|
1212
1212
|
}, [onDiscard]);
|
|
1213
|
-
const startEdit =
|
|
1213
|
+
const startEdit = React2.useCallback(() => {
|
|
1214
1214
|
setStatus(null);
|
|
1215
1215
|
shouldFocusFirstFieldRef.current = true;
|
|
1216
1216
|
setMode("editing");
|
|
1217
1217
|
}, []);
|
|
1218
|
-
const requestCancel =
|
|
1218
|
+
const requestCancel = React2.useCallback(() => {
|
|
1219
1219
|
if (isSaving) return;
|
|
1220
1220
|
if (isDirty) {
|
|
1221
1221
|
setConfirmOpen(true);
|
|
@@ -1223,7 +1223,7 @@ function useEditableSection({
|
|
|
1223
1223
|
}
|
|
1224
1224
|
exitToReading();
|
|
1225
1225
|
}, [exitToReading, isDirty, isSaving]);
|
|
1226
|
-
const handleSubmit =
|
|
1226
|
+
const handleSubmit = React2.useCallback(
|
|
1227
1227
|
(event) => {
|
|
1228
1228
|
event.preventDefault();
|
|
1229
1229
|
if (isSaving) return;
|
|
@@ -1243,7 +1243,7 @@ function useEditableSection({
|
|
|
1243
1243
|
},
|
|
1244
1244
|
[isSaving, onSave, resolvedLabels.saved]
|
|
1245
1245
|
);
|
|
1246
|
-
const handleFormKeyDown =
|
|
1246
|
+
const handleFormKeyDown = React2.useCallback(
|
|
1247
1247
|
(event) => {
|
|
1248
1248
|
if (event.key !== "Escape") return;
|
|
1249
1249
|
event.preventDefault();
|
|
@@ -1251,7 +1251,7 @@ function useEditableSection({
|
|
|
1251
1251
|
},
|
|
1252
1252
|
[requestCancel]
|
|
1253
1253
|
);
|
|
1254
|
-
|
|
1254
|
+
React2.useEffect(() => {
|
|
1255
1255
|
if (!stableHeight || !isEditing) return;
|
|
1256
1256
|
const el = contentRef.current;
|
|
1257
1257
|
if (!el) return;
|
|
@@ -1490,13 +1490,13 @@ function SafeImage({
|
|
|
1490
1490
|
onError,
|
|
1491
1491
|
...imgProps
|
|
1492
1492
|
}) {
|
|
1493
|
-
const [failed, setFailed] =
|
|
1494
|
-
const imgRef =
|
|
1493
|
+
const [failed, setFailed] = React2.useState(false);
|
|
1494
|
+
const imgRef = React2.useRef(null);
|
|
1495
1495
|
const resolvedSrc = typeof src === "string" && src.length > 0 ? src : null;
|
|
1496
|
-
|
|
1496
|
+
React2.useLayoutEffect(() => {
|
|
1497
1497
|
setFailed(false);
|
|
1498
1498
|
}, [resolvedSrc]);
|
|
1499
|
-
|
|
1499
|
+
React2.useLayoutEffect(() => {
|
|
1500
1500
|
const img = imgRef.current;
|
|
1501
1501
|
if (img && isBrokenImage(img)) {
|
|
1502
1502
|
setFailed(true);
|
|
@@ -1558,17 +1558,17 @@ function ThemeSwitcher({
|
|
|
1558
1558
|
labels: userLabels
|
|
1559
1559
|
}) {
|
|
1560
1560
|
const { theme, setTheme } = nextThemes.useTheme();
|
|
1561
|
-
const [mounted, setMounted] =
|
|
1561
|
+
const [mounted, setMounted] = React2.useState(false);
|
|
1562
1562
|
const sizes = sizeClasses[size];
|
|
1563
1563
|
const shapeClass = shapeClasses[shape];
|
|
1564
1564
|
const labels = { ...defaultLabels, ...userLabels };
|
|
1565
|
-
const handleThemeClick =
|
|
1565
|
+
const handleThemeClick = React2.useCallback(
|
|
1566
1566
|
(themeKey) => {
|
|
1567
1567
|
setTheme(themeKey);
|
|
1568
1568
|
},
|
|
1569
1569
|
[setTheme]
|
|
1570
1570
|
);
|
|
1571
|
-
|
|
1571
|
+
React2.useEffect(() => {
|
|
1572
1572
|
setMounted(true);
|
|
1573
1573
|
}, []);
|
|
1574
1574
|
if (!mounted) {
|
|
@@ -2817,8 +2817,8 @@ function CountryPicker({
|
|
|
2817
2817
|
"aria-invalid": ariaInvalid
|
|
2818
2818
|
}) {
|
|
2819
2819
|
const labels = { ...defaultLabels2(purpose, locale), ...labelsProp };
|
|
2820
|
-
const items =
|
|
2821
|
-
const selected =
|
|
2820
|
+
const items = React2__namespace.useMemo(() => countryPickerItems(locale), [locale]);
|
|
2821
|
+
const selected = React2__namespace.useMemo(() => findItem(items, value), [items, value]);
|
|
2822
2822
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2823
2823
|
name ? /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value: value.trim().toUpperCase() }) : null,
|
|
2824
2824
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2917,7 +2917,207 @@ function CountryPicker({
|
|
|
2917
2917
|
)
|
|
2918
2918
|
] });
|
|
2919
2919
|
}
|
|
2920
|
+
var INPUT_CLASS2 = "h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40";
|
|
2920
2921
|
var DEFAULT_LABELS = {
|
|
2922
|
+
placeholder: "Search\u2026",
|
|
2923
|
+
noResults: "No results",
|
|
2924
|
+
clear: "Clear",
|
|
2925
|
+
open: "Open list",
|
|
2926
|
+
loadMore: "Load more",
|
|
2927
|
+
loading: "Loading\u2026"
|
|
2928
|
+
};
|
|
2929
|
+
function resolveSelected(value, items, selectedItem) {
|
|
2930
|
+
const trimmed = value.trim();
|
|
2931
|
+
if (!trimmed) return null;
|
|
2932
|
+
if (selectedItem && selectedItem.value === trimmed) return selectedItem;
|
|
2933
|
+
return items.find((item) => item.value === trimmed) ?? selectedItem ?? null;
|
|
2934
|
+
}
|
|
2935
|
+
function PaginatedCombobox({
|
|
2936
|
+
value,
|
|
2937
|
+
onValueChange,
|
|
2938
|
+
items,
|
|
2939
|
+
selectedItem = null,
|
|
2940
|
+
onQueryChange,
|
|
2941
|
+
loading = false,
|
|
2942
|
+
loadingMore = false,
|
|
2943
|
+
nextCursor = null,
|
|
2944
|
+
onLoadMore,
|
|
2945
|
+
onOpenChange,
|
|
2946
|
+
debounceMs = 300,
|
|
2947
|
+
id,
|
|
2948
|
+
name,
|
|
2949
|
+
disabled,
|
|
2950
|
+
required,
|
|
2951
|
+
allowEmpty = true,
|
|
2952
|
+
className,
|
|
2953
|
+
labels: labelsProp,
|
|
2954
|
+
"aria-invalid": ariaInvalid
|
|
2955
|
+
}) {
|
|
2956
|
+
const labels = { ...DEFAULT_LABELS, ...labelsProp };
|
|
2957
|
+
const selected = React2__namespace.useMemo(
|
|
2958
|
+
() => resolveSelected(value, items, selectedItem),
|
|
2959
|
+
[value, items, selectedItem]
|
|
2960
|
+
);
|
|
2961
|
+
const listItems = React2__namespace.useMemo(() => {
|
|
2962
|
+
if (!selected) return items;
|
|
2963
|
+
if (items.some((item) => item.value === selected.value)) return items;
|
|
2964
|
+
return [selected, ...items];
|
|
2965
|
+
}, [items, selected]);
|
|
2966
|
+
const queryRef = React2__namespace.useRef("");
|
|
2967
|
+
const debounceRef = React2__namespace.useRef(null);
|
|
2968
|
+
React2__namespace.useEffect(() => {
|
|
2969
|
+
return () => {
|
|
2970
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2971
|
+
};
|
|
2972
|
+
}, []);
|
|
2973
|
+
function scheduleQuery(query) {
|
|
2974
|
+
queryRef.current = query;
|
|
2975
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
2976
|
+
debounceRef.current = setTimeout(() => {
|
|
2977
|
+
onQueryChange(queryRef.current);
|
|
2978
|
+
}, debounceMs);
|
|
2979
|
+
}
|
|
2980
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2981
|
+
name ? /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value }) : null,
|
|
2982
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2983
|
+
combobox_js.Combobox.Root,
|
|
2984
|
+
{
|
|
2985
|
+
items: listItems,
|
|
2986
|
+
value: selected,
|
|
2987
|
+
filter: null,
|
|
2988
|
+
autoComplete: "none",
|
|
2989
|
+
onValueChange: (item) => {
|
|
2990
|
+
onValueChange(item?.value ?? "", item ?? null);
|
|
2991
|
+
},
|
|
2992
|
+
onInputValueChange: (inputValue, details) => {
|
|
2993
|
+
if (details.reason === "item-press" || details.reason === "clear-press" || details.reason === "input-clear") {
|
|
2994
|
+
return;
|
|
2995
|
+
}
|
|
2996
|
+
if (value.length > 0 && inputValue !== selected?.label) {
|
|
2997
|
+
onValueChange("", null);
|
|
2998
|
+
}
|
|
2999
|
+
scheduleQuery(inputValue);
|
|
3000
|
+
},
|
|
3001
|
+
onOpenChange: (open) => {
|
|
3002
|
+
onOpenChange?.(open);
|
|
3003
|
+
if (open) {
|
|
3004
|
+
onQueryChange(queryRef.current);
|
|
3005
|
+
}
|
|
3006
|
+
},
|
|
3007
|
+
disabled,
|
|
3008
|
+
itemToStringLabel: (item) => item.label,
|
|
3009
|
+
itemToStringValue: (item) => item.value,
|
|
3010
|
+
isItemEqualToValue: (item, current) => item.value === current.value,
|
|
3011
|
+
children: [
|
|
3012
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3013
|
+
combobox_js.Combobox.InputGroup,
|
|
3014
|
+
{
|
|
3015
|
+
className: cn("relative flex w-full items-center", className),
|
|
3016
|
+
children: [
|
|
3017
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3018
|
+
combobox_js.Combobox.Input,
|
|
3019
|
+
{
|
|
3020
|
+
id,
|
|
3021
|
+
required,
|
|
3022
|
+
"aria-invalid": ariaInvalid,
|
|
3023
|
+
...labels.ariaLabel ? { "aria-label": labels.ariaLabel } : {},
|
|
3024
|
+
placeholder: labels.placeholder,
|
|
3025
|
+
className: cn(INPUT_CLASS2, "pr-16")
|
|
3026
|
+
}
|
|
3027
|
+
),
|
|
3028
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute inset-y-0 right-0 flex items-center gap-0.5 pr-1.5", children: [
|
|
3029
|
+
allowEmpty ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3030
|
+
combobox_js.Combobox.Clear,
|
|
3031
|
+
{
|
|
3032
|
+
className: "inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3033
|
+
"aria-label": labels.clear,
|
|
3034
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "size-4", "aria-hidden": true })
|
|
3035
|
+
}
|
|
3036
|
+
) : null,
|
|
3037
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3038
|
+
combobox_js.Combobox.Trigger,
|
|
3039
|
+
{
|
|
3040
|
+
className: "inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
3041
|
+
"aria-label": labels.open,
|
|
3042
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4", "aria-hidden": true })
|
|
3043
|
+
}
|
|
3044
|
+
)
|
|
3045
|
+
] })
|
|
3046
|
+
]
|
|
3047
|
+
}
|
|
3048
|
+
),
|
|
3049
|
+
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3050
|
+
combobox_js.Combobox.Positioner,
|
|
3051
|
+
{
|
|
3052
|
+
className: "pointer-events-auto isolate z-[60] outline-none",
|
|
3053
|
+
sideOffset: 4,
|
|
3054
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3055
|
+
combobox_js.Combobox.Popup,
|
|
3056
|
+
{
|
|
3057
|
+
className: cn(
|
|
3058
|
+
"pointer-events-auto z-[60] max-h-60 w-(--anchor-width) min-w-[16rem] overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10",
|
|
3059
|
+
"data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95"
|
|
3060
|
+
),
|
|
3061
|
+
children: [
|
|
3062
|
+
loading ? /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-2 px-3 py-2 text-sm text-muted-foreground", children: [
|
|
3063
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2Icon, { className: "size-4 animate-spin", "aria-hidden": true }),
|
|
3064
|
+
labels.loading
|
|
3065
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3066
|
+
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.Empty, { className: "px-3 py-2 text-sm text-muted-foreground", children: labels.noResults }),
|
|
3067
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3068
|
+
combobox_js.Combobox.List,
|
|
3069
|
+
{
|
|
3070
|
+
className: "max-h-60 overflow-y-auto p-1 outline-none",
|
|
3071
|
+
onWheel: (event) => event.stopPropagation(),
|
|
3072
|
+
children: (item) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3073
|
+
combobox_js.Combobox.Item,
|
|
3074
|
+
{
|
|
3075
|
+
value: item,
|
|
3076
|
+
className: cn(
|
|
3077
|
+
"relative flex cursor-default flex-col gap-0.5 rounded-md py-1.5 pr-2 pl-8 text-sm outline-none select-none",
|
|
3078
|
+
"data-highlighted:bg-accent data-highlighted:text-accent-foreground"
|
|
3079
|
+
),
|
|
3080
|
+
children: [
|
|
3081
|
+
/* @__PURE__ */ jsxRuntime.jsx(combobox_js.Combobox.ItemIndicator, { className: "absolute top-2 left-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4", "aria-hidden": true }) }),
|
|
3082
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: item.label }),
|
|
3083
|
+
item.secondary ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: item.secondary }) : null
|
|
3084
|
+
]
|
|
3085
|
+
},
|
|
3086
|
+
item.value
|
|
3087
|
+
)
|
|
3088
|
+
}
|
|
3089
|
+
)
|
|
3090
|
+
] }),
|
|
3091
|
+
nextCursor && onLoadMore ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t p-1", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3092
|
+
"button",
|
|
3093
|
+
{
|
|
3094
|
+
type: "button",
|
|
3095
|
+
disabled: loadingMore,
|
|
3096
|
+
className: "flex w-full items-center justify-center gap-2 rounded-md px-2 py-1.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50",
|
|
3097
|
+
onClick: () => onLoadMore(),
|
|
3098
|
+
children: [
|
|
3099
|
+
loadingMore ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3100
|
+
lucideReact.Loader2Icon,
|
|
3101
|
+
{
|
|
3102
|
+
className: "size-4 animate-spin",
|
|
3103
|
+
"aria-hidden": true
|
|
3104
|
+
}
|
|
3105
|
+
) : null,
|
|
3106
|
+
labels.loadMore
|
|
3107
|
+
]
|
|
3108
|
+
}
|
|
3109
|
+
) }) : null
|
|
3110
|
+
]
|
|
3111
|
+
}
|
|
3112
|
+
)
|
|
3113
|
+
}
|
|
3114
|
+
) })
|
|
3115
|
+
]
|
|
3116
|
+
}
|
|
3117
|
+
)
|
|
3118
|
+
] });
|
|
3119
|
+
}
|
|
3120
|
+
var DEFAULT_LABELS2 = {
|
|
2921
3121
|
uploadAria: "Upload image",
|
|
2922
3122
|
uploadHint: "Click to upload",
|
|
2923
3123
|
uploadFormats: "PNG, JPG up to 10MB",
|
|
@@ -2944,19 +3144,19 @@ function AvatarEditor({
|
|
|
2944
3144
|
controlSize = "default",
|
|
2945
3145
|
labels
|
|
2946
3146
|
}) {
|
|
2947
|
-
const t = { ...
|
|
2948
|
-
const canvasRef =
|
|
2949
|
-
const fileInputRef =
|
|
2950
|
-
const containerRef =
|
|
2951
|
-
const [image, setImage] =
|
|
2952
|
-
const [imageLoaded, setImageLoaded] =
|
|
2953
|
-
const [zoom, setZoom] =
|
|
2954
|
-
const [rotation, setRotation] =
|
|
2955
|
-
const [position, setPosition] =
|
|
2956
|
-
const [isDragging, setIsDragging] =
|
|
2957
|
-
const [dragStart, setDragStart] =
|
|
2958
|
-
const [showGrid, setShowGrid] =
|
|
2959
|
-
const generateOutput =
|
|
3147
|
+
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
3148
|
+
const canvasRef = React2.useRef(null);
|
|
3149
|
+
const fileInputRef = React2.useRef(null);
|
|
3150
|
+
const containerRef = React2.useRef(null);
|
|
3151
|
+
const [image, setImage] = React2.useState(null);
|
|
3152
|
+
const [imageLoaded, setImageLoaded] = React2.useState(false);
|
|
3153
|
+
const [zoom, setZoom] = React2.useState(1);
|
|
3154
|
+
const [rotation, setRotation] = React2.useState(0);
|
|
3155
|
+
const [position, setPosition] = React2.useState({ x: 0, y: 0 });
|
|
3156
|
+
const [isDragging, setIsDragging] = React2.useState(false);
|
|
3157
|
+
const [dragStart, setDragStart] = React2.useState({ x: 0, y: 0 });
|
|
3158
|
+
const [showGrid, setShowGrid] = React2.useState(initialShowGrid);
|
|
3159
|
+
const generateOutput = React2.useCallback(() => {
|
|
2960
3160
|
if (!canvasRef.current || !image) return null;
|
|
2961
3161
|
const outputCanvas = document.createElement("canvas");
|
|
2962
3162
|
outputCanvas.width = outputSize;
|
|
@@ -2967,7 +3167,7 @@ function AvatarEditor({
|
|
|
2967
3167
|
const mimeType = `image/${outputFormat}`;
|
|
2968
3168
|
return outputCanvas.toDataURL(mimeType, outputQuality);
|
|
2969
3169
|
}, [image, outputSize, outputFormat, outputQuality]);
|
|
2970
|
-
|
|
3170
|
+
React2.useEffect(() => {
|
|
2971
3171
|
if (!canvasRef.current || !image || !imageLoaded) return;
|
|
2972
3172
|
const canvas = canvasRef.current;
|
|
2973
3173
|
const ctx = canvas.getContext("2d");
|
|
@@ -3011,12 +3211,12 @@ function AvatarEditor({
|
|
|
3011
3211
|
generateOutput,
|
|
3012
3212
|
onChange
|
|
3013
3213
|
]);
|
|
3014
|
-
const resetTransforms =
|
|
3214
|
+
const resetTransforms = React2.useCallback(() => {
|
|
3015
3215
|
setZoom(1);
|
|
3016
3216
|
setRotation(0);
|
|
3017
3217
|
setPosition({ x: 0, y: 0 });
|
|
3018
3218
|
}, []);
|
|
3019
|
-
const handleFileSelect =
|
|
3219
|
+
const handleFileSelect = React2.useCallback(
|
|
3020
3220
|
(e) => {
|
|
3021
3221
|
const file = e.target.files?.[0];
|
|
3022
3222
|
if (!file) return;
|
|
@@ -3035,7 +3235,7 @@ function AvatarEditor({
|
|
|
3035
3235
|
},
|
|
3036
3236
|
[resetTransforms]
|
|
3037
3237
|
);
|
|
3038
|
-
const handleMouseDown =
|
|
3238
|
+
const handleMouseDown = React2.useCallback(
|
|
3039
3239
|
(e) => {
|
|
3040
3240
|
if (!imageLoaded) return;
|
|
3041
3241
|
setIsDragging(true);
|
|
@@ -3043,7 +3243,7 @@ function AvatarEditor({
|
|
|
3043
3243
|
},
|
|
3044
3244
|
[imageLoaded, position]
|
|
3045
3245
|
);
|
|
3046
|
-
const handleMouseMove =
|
|
3246
|
+
const handleMouseMove = React2.useCallback(
|
|
3047
3247
|
(e) => {
|
|
3048
3248
|
if (!isDragging) return;
|
|
3049
3249
|
setPosition({
|
|
@@ -3053,10 +3253,10 @@ function AvatarEditor({
|
|
|
3053
3253
|
},
|
|
3054
3254
|
[isDragging, dragStart]
|
|
3055
3255
|
);
|
|
3056
|
-
const handleMouseUp =
|
|
3256
|
+
const handleMouseUp = React2.useCallback(() => {
|
|
3057
3257
|
setIsDragging(false);
|
|
3058
3258
|
}, []);
|
|
3059
|
-
const handleTouchStart =
|
|
3259
|
+
const handleTouchStart = React2.useCallback(
|
|
3060
3260
|
(e) => {
|
|
3061
3261
|
if (!imageLoaded) return;
|
|
3062
3262
|
const touch = e.touches[0];
|
|
@@ -3068,7 +3268,7 @@ function AvatarEditor({
|
|
|
3068
3268
|
},
|
|
3069
3269
|
[imageLoaded, position]
|
|
3070
3270
|
);
|
|
3071
|
-
const handleTouchMove =
|
|
3271
|
+
const handleTouchMove = React2.useCallback(
|
|
3072
3272
|
(e) => {
|
|
3073
3273
|
if (!isDragging) return;
|
|
3074
3274
|
const touch = e.touches[0];
|
|
@@ -3079,7 +3279,7 @@ function AvatarEditor({
|
|
|
3079
3279
|
},
|
|
3080
3280
|
[isDragging, dragStart]
|
|
3081
3281
|
);
|
|
3082
|
-
const handleDiscard =
|
|
3282
|
+
const handleDiscard = React2.useCallback(() => {
|
|
3083
3283
|
setImage(null);
|
|
3084
3284
|
setImageLoaded(false);
|
|
3085
3285
|
resetTransforms();
|
|
@@ -3450,8 +3650,8 @@ function AvatarEditor({
|
|
|
3450
3650
|
);
|
|
3451
3651
|
}
|
|
3452
3652
|
function useMediaQuery(query) {
|
|
3453
|
-
const [matches, setMatches] =
|
|
3454
|
-
|
|
3653
|
+
const [matches, setMatches] = React2.useState(false);
|
|
3654
|
+
React2.useEffect(() => {
|
|
3455
3655
|
const media = window.matchMedia(query);
|
|
3456
3656
|
if (media.matches !== matches) {
|
|
3457
3657
|
setMatches(media.matches);
|
|
@@ -3481,17 +3681,17 @@ function AvatarEditorDialog({
|
|
|
3481
3681
|
className,
|
|
3482
3682
|
editorLabels
|
|
3483
3683
|
}) {
|
|
3484
|
-
const [isOpen, setIsOpen] =
|
|
3485
|
-
const [editedValue, setEditedValue] =
|
|
3486
|
-
const [displaySrc, setDisplaySrc] =
|
|
3487
|
-
const [isSaving, setIsSaving] =
|
|
3488
|
-
const [feedback, setFeedback] =
|
|
3489
|
-
|
|
3684
|
+
const [isOpen, setIsOpen] = React2.useState(false);
|
|
3685
|
+
const [editedValue, setEditedValue] = React2.useState(value ?? null);
|
|
3686
|
+
const [displaySrc, setDisplaySrc] = React2.useState(value ?? null);
|
|
3687
|
+
const [isSaving, setIsSaving] = React2.useState(false);
|
|
3688
|
+
const [feedback, setFeedback] = React2.useState(null);
|
|
3689
|
+
React2.useEffect(() => {
|
|
3490
3690
|
setDisplaySrc(value ?? null);
|
|
3491
3691
|
}, [value]);
|
|
3492
3692
|
const isMobile = useMediaQuery("(max-width: 640px)");
|
|
3493
3693
|
const caption = (placeholder ?? "").trim();
|
|
3494
|
-
const handleOpenChange =
|
|
3694
|
+
const handleOpenChange = React2.useCallback(
|
|
3495
3695
|
(open) => {
|
|
3496
3696
|
if (open) {
|
|
3497
3697
|
setEditedValue(value ?? null);
|
|
@@ -3501,7 +3701,7 @@ function AvatarEditorDialog({
|
|
|
3501
3701
|
},
|
|
3502
3702
|
[value]
|
|
3503
3703
|
);
|
|
3504
|
-
const handleAccept =
|
|
3704
|
+
const handleAccept = React2.useCallback(async () => {
|
|
3505
3705
|
if (!editedValue) return;
|
|
3506
3706
|
setIsSaving(true);
|
|
3507
3707
|
setFeedback(null);
|
|
@@ -3767,10 +3967,10 @@ function FileDropzone({
|
|
|
3767
3967
|
className
|
|
3768
3968
|
}) {
|
|
3769
3969
|
const labels = { ...DEFAULT_FILE_DROPZONE_LABELS, ...labelOverrides };
|
|
3770
|
-
const inputId =
|
|
3771
|
-
const inputRef =
|
|
3772
|
-
const [dragging, setDragging] =
|
|
3773
|
-
const [message, setMessage] =
|
|
3970
|
+
const inputId = React2.useId();
|
|
3971
|
+
const inputRef = React2.useRef(null);
|
|
3972
|
+
const [dragging, setDragging] = React2.useState(false);
|
|
3973
|
+
const [message, setMessage] = React2.useState(null);
|
|
3774
3974
|
function takeFile(file) {
|
|
3775
3975
|
if (!file || disabled) return;
|
|
3776
3976
|
if (!fileMatchesAccept(file, accept)) {
|
|
@@ -4018,7 +4218,7 @@ function FileUploadMenu({
|
|
|
4018
4218
|
}) {
|
|
4019
4219
|
const labels = { ...DEFAULT_FILE_UPLOAD_TRAY_LABELS, ...labelOverrides };
|
|
4020
4220
|
const visible = jobs.filter((job) => job.status !== "cancelled");
|
|
4021
|
-
const [uncontrolledOpen, setUncontrolledOpen] =
|
|
4221
|
+
const [uncontrolledOpen, setUncontrolledOpen] = React2.useState(false);
|
|
4022
4222
|
const isControlled = open !== void 0;
|
|
4023
4223
|
const resolvedOpen = isControlled ? open : uncontrolledOpen;
|
|
4024
4224
|
function setResolvedOpen(next) {
|
|
@@ -4275,8 +4475,8 @@ function createMultipartUploadController(options) {
|
|
|
4275
4475
|
};
|
|
4276
4476
|
}
|
|
4277
4477
|
function useMediaQuery2(query) {
|
|
4278
|
-
const [matches, setMatches] =
|
|
4279
|
-
|
|
4478
|
+
const [matches, setMatches] = React2.useState(false);
|
|
4479
|
+
React2.useEffect(() => {
|
|
4280
4480
|
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
4281
4481
|
const mql = window.matchMedia(query);
|
|
4282
4482
|
const onChange = () => setMatches(mql.matches);
|
|
@@ -4406,7 +4606,7 @@ function SparklineStat({
|
|
|
4406
4606
|
);
|
|
4407
4607
|
}
|
|
4408
4608
|
var TIME_RANGE_OPTIONS = ["day", "week", "month", "year"];
|
|
4409
|
-
var
|
|
4609
|
+
var DEFAULT_LABELS3 = {
|
|
4410
4610
|
day: "Day",
|
|
4411
4611
|
week: "Week",
|
|
4412
4612
|
month: "Month",
|
|
@@ -4418,7 +4618,7 @@ function TimeRangePicker({
|
|
|
4418
4618
|
labels,
|
|
4419
4619
|
className
|
|
4420
4620
|
}) {
|
|
4421
|
-
const copy = { ...
|
|
4621
|
+
const copy = { ...DEFAULT_LABELS3, ...labels };
|
|
4422
4622
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4423
4623
|
"div",
|
|
4424
4624
|
{
|
|
@@ -4641,10 +4841,10 @@ function CookieConsentBanner({
|
|
|
4641
4841
|
className
|
|
4642
4842
|
}) {
|
|
4643
4843
|
const copy = { ...DEFAULT_COOKIE_CONSENT_BANNER_LABELS, ...labels };
|
|
4644
|
-
const [consent, setConsent] =
|
|
4844
|
+
const [consent, setConsent] = React2.useState(
|
|
4645
4845
|
"pending"
|
|
4646
4846
|
);
|
|
4647
|
-
|
|
4847
|
+
React2.useEffect(() => {
|
|
4648
4848
|
if (variant === "embed" || isEmbeddedWindow()) {
|
|
4649
4849
|
setConsent("necessary");
|
|
4650
4850
|
return;
|
|
@@ -5222,8 +5422,8 @@ function MatchReview({
|
|
|
5222
5422
|
className
|
|
5223
5423
|
}) {
|
|
5224
5424
|
const copy = { ...DEFAULT_MATCH_REVIEW_LABELS, ...labels };
|
|
5225
|
-
const reasonId =
|
|
5226
|
-
const [reason, setReason] =
|
|
5425
|
+
const reasonId = React2.useId();
|
|
5426
|
+
const [reason, setReason] = React2.useState("");
|
|
5227
5427
|
const trimmed = reason.trim();
|
|
5228
5428
|
if (!hit) {
|
|
5229
5429
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5392,6 +5592,7 @@ exports.NotificationBell = NotificationBell;
|
|
|
5392
5592
|
exports.PageContainer = PageContainer;
|
|
5393
5593
|
exports.PageTitle = PageTitle;
|
|
5394
5594
|
exports.PageTitleSkeleton = PageTitleSkeleton;
|
|
5595
|
+
exports.PaginatedCombobox = PaginatedCombobox;
|
|
5395
5596
|
exports.RiskBadge = RiskBadge;
|
|
5396
5597
|
exports.RouteLoading = RouteLoading;
|
|
5397
5598
|
exports.SafeImage = SafeImage;
|