najm-kit 2.11.4 → 2.11.6
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/CHANGELOG.md +20 -1
- package/dist/adapters/app.mjs +2 -2
- package/dist/{chunk-ZXIVSNXV.mjs → chunk-A7BKZZJ4.mjs} +1 -1
- package/dist/index.d.ts +11 -17
- package/dist/index.mjs +168 -149
- package/dist/query.mjs +16 -7
- package/dist/theme.css +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
|
-
# Changelog
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.11.6 - 2026-08-15
|
|
4
|
+
|
|
5
|
+
- Fixed `FormInput` dropping React Hook Form's native field binding for text,
|
|
6
|
+
number, password, textarea, and time controls. These controls now forward
|
|
7
|
+
their field name, composed blur handler, and focus ref to the actual native
|
|
8
|
+
element, preserving browser form semantics, touched-state tracking, and
|
|
9
|
+
programmatic focus without changing composite-control contracts.
|
|
10
|
+
|
|
11
|
+
## 2.11.5 - 2026-08-14
|
|
12
|
+
|
|
13
|
+
- Fixed numbered lists staying on an invalid final page after a deletion or
|
|
14
|
+
another mutation reduced the server total. Paged lists now clamp before
|
|
15
|
+
slicing their row buffer, render the previous valid page immediately, and
|
|
16
|
+
reconcile the controlled pagination state without showing a false empty
|
|
17
|
+
state. A genuinely empty result still remains on page one.
|
|
18
|
+
- Fixed panel feedback states stretching their icon, copy, and action across
|
|
19
|
+
separate grid rows in tall table and dialog bodies. Panel content now stays
|
|
20
|
+
together in one centered vertical stack with consistent spacing.
|
|
2
21
|
|
|
3
22
|
## 2.11.4 - 2026-08-12
|
|
4
23
|
|
package/dist/adapters/app.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { FormDevToolsProvider, NBrandingStateProvider, NajmFormatProvider } from '../chunk-
|
|
3
|
-
export { NEmptyState, NErrorState, NForbiddenState, NLoadingState, NNotFoundState } from '../chunk-
|
|
2
|
+
import { FormDevToolsProvider, NBrandingStateProvider, NajmFormatProvider } from '../chunk-A7BKZZJ4.mjs';
|
|
3
|
+
export { NEmptyState, NErrorState, NForbiddenState, NLoadingState, NNotFoundState } from '../chunk-A7BKZZJ4.mjs';
|
|
4
4
|
import { NajmNextUIProvider } from '../chunk-T6RL7TSQ.mjs';
|
|
5
5
|
import '../chunk-6UDJNTJ6.mjs';
|
|
6
6
|
import '../chunk-ONE7GLIH.mjs';
|
|
@@ -184,7 +184,7 @@ var INLINE_PADDING = {
|
|
|
184
184
|
error: "py-8",
|
|
185
185
|
empty: "py-12"
|
|
186
186
|
};
|
|
187
|
-
var PANEL_BASE = "
|
|
187
|
+
var PANEL_BASE = "flex min-h-64 w-full flex-col items-center justify-center gap-3";
|
|
188
188
|
var PAGE_MIN = "min-h-[60vh]";
|
|
189
189
|
function NFeedbackStateFrame({
|
|
190
190
|
surface = "inline",
|
package/dist/index.d.ts
CHANGED
|
@@ -535,9 +535,9 @@ declare namespace NIndicator {
|
|
|
535
535
|
}
|
|
536
536
|
declare const Indicator: typeof NIndicator;
|
|
537
537
|
|
|
538
|
-
declare
|
|
538
|
+
declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
|
|
539
539
|
|
|
540
|
-
declare
|
|
540
|
+
declare const Textarea: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref"> & React$1.RefAttributes<HTMLTextAreaElement>>;
|
|
541
541
|
|
|
542
542
|
declare function Label({ className, ...props }: React$1.ComponentProps<typeof LabelPrimitive.Root>): react_jsx_runtime.JSX.Element;
|
|
543
543
|
|
|
@@ -2184,19 +2184,14 @@ interface SelectItemType {
|
|
|
2184
2184
|
className?: string;
|
|
2185
2185
|
}>;
|
|
2186
2186
|
}
|
|
2187
|
-
interface TextInputProps extends BaseProps {
|
|
2187
|
+
interface TextInputProps extends BaseProps, Omit<InputHTMLAttributes<HTMLInputElement>, "className" | "onChange" | "placeholder" | "type" | "value"> {
|
|
2188
2188
|
value: string;
|
|
2189
2189
|
onChange: (value: string) => void;
|
|
2190
2190
|
placeholder?: string;
|
|
2191
2191
|
icon?: InputIcon;
|
|
2192
2192
|
showIcon?: boolean;
|
|
2193
|
-
disabled?: boolean;
|
|
2194
|
-
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
2195
|
-
onKeyUp?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
2196
|
-
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
2197
|
-
onFocus?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
2198
2193
|
}
|
|
2199
|
-
interface NumberInputProps extends BaseProps {
|
|
2194
|
+
interface NumberInputProps extends BaseProps, Omit<InputHTMLAttributes<HTMLInputElement>, "className" | "onChange" | "placeholder" | "type" | "value"> {
|
|
2200
2195
|
value: string | number;
|
|
2201
2196
|
onChange: (value: number) => void;
|
|
2202
2197
|
placeholder?: string;
|
|
@@ -2210,7 +2205,7 @@ interface PasswordInputProps extends BaseProps, Omit<InputHTMLAttributes<HTMLInp
|
|
|
2210
2205
|
icon?: InputIcon;
|
|
2211
2206
|
showIcon?: boolean;
|
|
2212
2207
|
}
|
|
2213
|
-
interface TextAreaInputProps extends BaseProps {
|
|
2208
|
+
interface TextAreaInputProps extends BaseProps, Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "className" | "onChange" | "placeholder" | "value"> {
|
|
2214
2209
|
value: string;
|
|
2215
2210
|
onChange: (value: string) => void;
|
|
2216
2211
|
placeholder?: string;
|
|
@@ -2320,7 +2315,7 @@ interface ColorPickerInputProps extends ColorArrayInputProps {
|
|
|
2320
2315
|
output?: ColorFormat | "preserve";
|
|
2321
2316
|
hideSwatches?: boolean;
|
|
2322
2317
|
}
|
|
2323
|
-
interface TimeInputProps extends BaseProps {
|
|
2318
|
+
interface TimeInputProps extends BaseProps, Omit<InputHTMLAttributes<HTMLInputElement>, "className" | "onChange" | "placeholder" | "type" | "value"> {
|
|
2324
2319
|
value?: string;
|
|
2325
2320
|
onChange: (value: string) => void;
|
|
2326
2321
|
placeholder?: string;
|
|
@@ -2328,7 +2323,6 @@ interface TimeInputProps extends BaseProps {
|
|
|
2328
2323
|
showIcon?: boolean;
|
|
2329
2324
|
format24?: boolean;
|
|
2330
2325
|
showSeconds?: boolean;
|
|
2331
|
-
disabled?: boolean;
|
|
2332
2326
|
}
|
|
2333
2327
|
interface TimeZoneInputProps extends Omit<ComboboxInputProps, "items"> {
|
|
2334
2328
|
items?: SelectItemType[];
|
|
@@ -2458,16 +2452,16 @@ interface BaseInputProps extends React__default.HTMLAttributes<HTMLDivElement> {
|
|
|
2458
2452
|
}
|
|
2459
2453
|
declare const BaseInput: React__default.ForwardRefExoticComponent<BaseInputProps & React__default.RefAttributes<HTMLDivElement>>;
|
|
2460
2454
|
|
|
2461
|
-
declare const TextInput: React__default.
|
|
2455
|
+
declare const TextInput: React__default.ForwardRefExoticComponent<TextInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
2462
2456
|
|
|
2463
|
-
declare const NumberInput: React__default.
|
|
2457
|
+
declare const NumberInput: React__default.ForwardRefExoticComponent<NumberInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
2464
2458
|
|
|
2465
|
-
declare const PasswordInput: React__default.
|
|
2459
|
+
declare const PasswordInput: React__default.ForwardRefExoticComponent<PasswordInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
2466
2460
|
|
|
2467
2461
|
/** Accessible, controlled one-time-code input with keyboard and paste support. */
|
|
2468
2462
|
declare const OtpInput: React__default.ForwardRefExoticComponent<OtpInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
2469
2463
|
|
|
2470
|
-
declare const TextAreaInput: React__default.
|
|
2464
|
+
declare const TextAreaInput: React__default.ForwardRefExoticComponent<TextAreaInputProps & React__default.RefAttributes<HTMLTextAreaElement>>;
|
|
2471
2465
|
|
|
2472
2466
|
declare const SelectInput: React__default.FC<SelectInputProps>;
|
|
2473
2467
|
|
|
@@ -2540,7 +2534,7 @@ declare function PhoneInput({ value, onChange, defaultCountry, placeholder, disa
|
|
|
2540
2534
|
bordered?: boolean;
|
|
2541
2535
|
}): react_jsx_runtime.JSX.Element;
|
|
2542
2536
|
|
|
2543
|
-
declare const TimeInput: React__default.
|
|
2537
|
+
declare const TimeInput: React__default.ForwardRefExoticComponent<TimeInputProps & React__default.RefAttributes<HTMLInputElement>>;
|
|
2544
2538
|
|
|
2545
2539
|
declare const TimeZoneInput: React__default.FC<TimeZoneInputProps>;
|
|
2546
2540
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveAvatarSrc } from './chunk-BEGOH366.mjs';
|
|
2
2
|
export { isPlaceholderAvatar, resolveAvatarSrc } from './chunk-BEGOH366.mjs';
|
|
3
|
-
import { NLoadingState, NErrorState, NEmptyState, useResolvedFormDevTools, useNBranding } from './chunk-
|
|
4
|
-
export { FormDevToolsProvider, NBrandingProvider, NBrandingStateProvider, NEmptyState, NErrorState, NForbiddenState, NLoadingState, NNotFoundState, NPageLayout, NSpinner, NajmFormatProvider, buildFormFill, normalizeBranding, useNBranding, useNBrandingEditor, useNajmFormat, useNajmFormatContext } from './chunk-
|
|
3
|
+
import { NLoadingState, NErrorState, NEmptyState, useResolvedFormDevTools, useNBranding } from './chunk-A7BKZZJ4.mjs';
|
|
4
|
+
export { FormDevToolsProvider, NBrandingProvider, NBrandingStateProvider, NEmptyState, NErrorState, NForbiddenState, NLoadingState, NNotFoundState, NPageLayout, NSpinner, NajmFormatProvider, buildFormFill, normalizeBranding, useNBranding, useNBrandingEditor, useNajmFormat, useNajmFormatContext } from './chunk-A7BKZZJ4.mjs';
|
|
5
5
|
import { normalizeImageSources, useImageChain, useNBadgeDefaults, mergeBadgeMaps, resolveStatusColor, resolveBadgeStatusLabel, colorTextClass, useResolvedPaginationLabels } from './chunk-6UDJNTJ6.mjs';
|
|
6
6
|
export { DEFAULT_PAGINATION_KEY_PREFIX, DEFAULT_TIME_ZONE, EMPTY_DESIGN, NAJM_COLOR_TEXT_CLASSES, NAJM_STATUS_COLORS, NTableDefaultsProvider, NajmDesignEditorProvider, NajmPreferencesProvider, NajmUIProvider, buildPaginationLabels, colorTextClass, findStatusColor, normalizeStatusToken, resolveStatusColor, statusTextClass, useNTableDefaults, useNajmDesignEditor, useNajmPreferencesContext, useNajmTheme, useNajmTimeZone } from './chunk-6UDJNTJ6.mjs';
|
|
7
7
|
import { NajmScroll, useNajmScrollViewport, useTableStore, TableStoreContext, NTableJson } from './chunk-5JVFMOLI.mjs';
|
|
@@ -17,11 +17,11 @@ export { DEFAULT_PLACEHOLDER, formatCurrency, formatDate, formatDateTime, format
|
|
|
17
17
|
export { DEFAULT_MAX_PAGE_SIZE, DEFAULT_PAGE_SIZE, cleanQuery, createOffsetPagination, fetchOffsetPage, getPageIndex } from './chunk-2NX2VKS2.mjs';
|
|
18
18
|
import { resolveRadiusValue, resolveVariantAlias, parseNajmDesignConfig } from './chunk-TFHWLE7N.mjs';
|
|
19
19
|
export { NAJM_COMPONENT_NAMES, RADIUS_VALUE_MAP, defineNajmDesignConfig, defineNajmThemeConfig, parseNajmDesignConfig, parseNajmThemeConfig, resolveRadiusValue, resolveVariantAlias, stringifyNajmDesignConfig, stringifyNajmThemeConfig } from './chunk-TFHWLE7N.mjs';
|
|
20
|
-
import * as
|
|
21
|
-
import
|
|
20
|
+
import * as React66 from 'react';
|
|
21
|
+
import React66__default, { createContext, useState, useRef, useMemo, useEffect, useContext, useCallback, useLayoutEffect, isValidElement } from 'react';
|
|
22
22
|
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
23
23
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
24
|
-
import { ChevronDown, AlertTriangle, RefreshCw, X, XIcon, Menu, Search, SearchIcon, CheckIcon, ChevronUp, ChevronDownIcon, ChevronUpIcon,
|
|
24
|
+
import { Eye, EyeOff, Clock, ChevronDown, AlertTriangle, RefreshCw, X, XIcon, Menu, Search, SearchIcon, CheckIcon, ChevronUp, ChevronDownIcon, ChevronUpIcon, ChevronsUpDown, Check, CircleIcon, ChevronLeftIcon, ChevronRightIcon, Calendar as Calendar$1, FileUp, Folder, UploadCloud, CheckCircle2, AlertCircle, Camera, Star, Globe, Trash2, Plus, Upload, Download, RotateCcw, Table as Table$1, FileJson, ChevronRight, ArrowUpDown, Loader2, Copy, MoreVertical, Edit, ChevronsLeft, ChevronLeft, ChevronsRight, Pencil, Merge, PanelLeftOpen, PanelLeftClose, LogOut, Image, ArrowUp, ArrowDown, CheckSquare, FilePlus, FolderPlus, Share2, Move, ClipboardPaste, Scissors, ArrowUpRight, ArrowDownRight, SlidersHorizontal, Columns3, Settings, Filter, SearchX, Inbox, List, LayoutGrid, Code, FolderOpen } from 'lucide-react';
|
|
25
25
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
26
26
|
import { cva } from 'class-variance-authority';
|
|
27
27
|
import { HexColorPicker } from 'react-colorful';
|
|
@@ -275,7 +275,7 @@ function NTabs({
|
|
|
275
275
|
}
|
|
276
276
|
var PORTAL_LAYER_STYLE_ID = "najm-kit-portal-layer-styles";
|
|
277
277
|
function useNajmPortalLayerStyles() {
|
|
278
|
-
|
|
278
|
+
React66.useInsertionEffect(() => {
|
|
279
279
|
if (typeof document === "undefined") return;
|
|
280
280
|
if (document.getElementById(PORTAL_LAYER_STYLE_ID)) return;
|
|
281
281
|
const style = document.createElement("style");
|
|
@@ -306,7 +306,7 @@ var tooltipContentVariants = cva(
|
|
|
306
306
|
}
|
|
307
307
|
);
|
|
308
308
|
function TooltipContent({ className, sideOffset = 4, variant, children, ...props }) {
|
|
309
|
-
const container =
|
|
309
|
+
const container = React66.useContext(NajmThemeContainerCtx);
|
|
310
310
|
useNajmPortalLayerStyles();
|
|
311
311
|
return /* @__PURE__ */ jsx(TooltipPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
|
|
312
312
|
TooltipPrimitive.Content,
|
|
@@ -456,7 +456,7 @@ var ERROR_BORDER = "border !border-red-600";
|
|
|
456
456
|
var FOCUS_INTERACTIVE_BASE = "border focus-within:border-primary";
|
|
457
457
|
var HOVER_INTERACTIVE_BASE = "hover:border-primary";
|
|
458
458
|
var STATIC_BASE = "border";
|
|
459
|
-
var BaseInput =
|
|
459
|
+
var BaseInput = React66__default.forwardRef(
|
|
460
460
|
({ children, variant = "default", status = "default", bordered, borderColor, className, style, disabled = false, onHover, onClick, hasIcon, ...rest }, ref) => {
|
|
461
461
|
const recipe = useNajmComponentStyle("input");
|
|
462
462
|
const isGhost = variant === "ghost";
|
|
@@ -515,7 +515,7 @@ function PopoverAnchor({ ...props }) {
|
|
|
515
515
|
return /* @__PURE__ */ jsx(PopoverPrimitive.Anchor, { "data-slot": "popover-anchor", ...props });
|
|
516
516
|
}
|
|
517
517
|
function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
|
|
518
|
-
const container =
|
|
518
|
+
const container = React66.useContext(NajmThemeContainerCtx);
|
|
519
519
|
useNajmPortalLayerStyles();
|
|
520
520
|
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsx(
|
|
521
521
|
PopoverPrimitive.Content,
|
|
@@ -624,7 +624,7 @@ function SwatchesColorPicker({
|
|
|
624
624
|
hideSwatches = false
|
|
625
625
|
}) {
|
|
626
626
|
const inputRef = useRef(null);
|
|
627
|
-
const themeContainer =
|
|
627
|
+
const themeContainer = React66__default.useContext(NajmThemeContainerCtx);
|
|
628
628
|
const resolvedValue = resolvePickerColor(value, themeContainer);
|
|
629
629
|
return /* @__PURE__ */ jsxs(
|
|
630
630
|
BaseInput,
|
|
@@ -694,7 +694,7 @@ function PopoverColorPicker({
|
|
|
694
694
|
formats = DEFAULT_FORMATS,
|
|
695
695
|
output = "preserve"
|
|
696
696
|
}) {
|
|
697
|
-
const themeContainer =
|
|
697
|
+
const themeContainer = React66__default.useContext(NajmThemeContainerCtx);
|
|
698
698
|
const resolvedValue = resolvePickerColor(value, themeContainer);
|
|
699
699
|
const initialFormat = formats.includes(detectFormat(resolvedValue)) ? detectFormat(resolvedValue) : formats[0] ?? "hex";
|
|
700
700
|
const [activeFormat, setActiveFormat] = useState(initialFormat);
|
|
@@ -961,7 +961,7 @@ function SheetClose({ ...props }) {
|
|
|
961
961
|
return /* @__PURE__ */ jsx(SheetPrimitive.Close, { "data-slot": "sheet-close", ...props });
|
|
962
962
|
}
|
|
963
963
|
function SheetPortal({ ...props }) {
|
|
964
|
-
const container =
|
|
964
|
+
const container = React66.useContext(NajmThemeContainerCtx);
|
|
965
965
|
return /* @__PURE__ */ jsx(SheetPrimitive.Portal, { "data-slot": "sheet-portal", container: container ?? void 0, ...props });
|
|
966
966
|
}
|
|
967
967
|
function SheetOverlay({ className, ...props }) {
|
|
@@ -1110,7 +1110,7 @@ function DialogTrigger({ ...props }) {
|
|
|
1110
1110
|
return /* @__PURE__ */ jsx(SheetPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
1111
1111
|
}
|
|
1112
1112
|
function DialogPortal({ ...props }) {
|
|
1113
|
-
const container =
|
|
1113
|
+
const container = React66.useContext(NajmThemeContainerCtx);
|
|
1114
1114
|
return /* @__PURE__ */ jsx(SheetPrimitive.Portal, { "data-slot": "dialog-portal", container: container ?? void 0, ...props });
|
|
1115
1115
|
}
|
|
1116
1116
|
function DialogClose({ ...props }) {
|
|
@@ -1141,8 +1141,8 @@ function getDefaultPadding() {
|
|
|
1141
1141
|
return window.matchMedia(MOBILE_PADDING_QUERY).matches ? "sm" : "md";
|
|
1142
1142
|
}
|
|
1143
1143
|
function useResponsivePadding(value) {
|
|
1144
|
-
const [resolved, setResolved] =
|
|
1145
|
-
|
|
1144
|
+
const [resolved, setResolved] = React66.useState(() => value ?? getDefaultPadding());
|
|
1145
|
+
React66.useEffect(() => {
|
|
1146
1146
|
if (value) {
|
|
1147
1147
|
setResolved(value);
|
|
1148
1148
|
return;
|
|
@@ -1167,7 +1167,7 @@ function DialogContent({
|
|
|
1167
1167
|
}) {
|
|
1168
1168
|
const resolvedPadding = useResponsivePadding(padding);
|
|
1169
1169
|
const portalClassName = useNPortalScope();
|
|
1170
|
-
const openerRef =
|
|
1170
|
+
const openerRef = React66.useRef(null);
|
|
1171
1171
|
return /* @__PURE__ */ jsx(DialogPortal, { "data-slot": "dialog-portal", children: /* @__PURE__ */ jsxs("div", { className: portalClassName, children: [
|
|
1172
1172
|
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
1173
1173
|
/* @__PURE__ */ jsxs(
|
|
@@ -1231,7 +1231,7 @@ var sizeClasses2 = {
|
|
|
1231
1231
|
md: "h-8 w-8",
|
|
1232
1232
|
lg: "h-10 w-10"
|
|
1233
1233
|
};
|
|
1234
|
-
var IconButton =
|
|
1234
|
+
var IconButton = React66.forwardRef(
|
|
1235
1235
|
({
|
|
1236
1236
|
className,
|
|
1237
1237
|
variant = "ghost",
|
|
@@ -1313,10 +1313,10 @@ function NPageHeaderTop({ children, className }) {
|
|
|
1313
1313
|
}
|
|
1314
1314
|
NPageHeaderTop.displayName = "NPageHeaderTop";
|
|
1315
1315
|
function isPageHeaderSlot(child, slot) {
|
|
1316
|
-
return
|
|
1316
|
+
return React66__default.isValidElement(child) && child.type === slot;
|
|
1317
1317
|
}
|
|
1318
1318
|
function getSlotElements(children, slot) {
|
|
1319
|
-
const matches =
|
|
1319
|
+
const matches = React66__default.Children.toArray(children).filter((child) => isPageHeaderSlot(child, slot));
|
|
1320
1320
|
return matches.length > 0 ? matches : void 0;
|
|
1321
1321
|
}
|
|
1322
1322
|
var responsiveClasses = {
|
|
@@ -1729,8 +1729,8 @@ function NDialogSecondaryButton(_props) {
|
|
|
1729
1729
|
function parseDirectDialogSlots(children) {
|
|
1730
1730
|
const body = [];
|
|
1731
1731
|
const parsed = {};
|
|
1732
|
-
|
|
1733
|
-
if (!
|
|
1732
|
+
React66__default.Children.forEach(children, (child) => {
|
|
1733
|
+
if (!React66__default.isValidElement(child)) {
|
|
1734
1734
|
body.push(child);
|
|
1735
1735
|
return;
|
|
1736
1736
|
}
|
|
@@ -1803,15 +1803,15 @@ var dialogVariants = cva(
|
|
|
1803
1803
|
);
|
|
1804
1804
|
var CONTENT_ACTIONS_SELECTOR = '[data-najm-dialog-actions="content"], [data-najm-wizard-form="true"]';
|
|
1805
1805
|
function useContentOwnsActions() {
|
|
1806
|
-
const [contentElement, setContentElement] =
|
|
1807
|
-
const [contentOwnsActions, setContentOwnsActions] =
|
|
1808
|
-
const contentElementRef =
|
|
1809
|
-
const handleContentElementRef =
|
|
1806
|
+
const [contentElement, setContentElement] = React66__default.useState(null);
|
|
1807
|
+
const [contentOwnsActions, setContentOwnsActions] = React66__default.useState(false);
|
|
1808
|
+
const contentElementRef = React66__default.useRef(null);
|
|
1809
|
+
const handleContentElementRef = React66__default.useCallback((node) => {
|
|
1810
1810
|
if (contentElementRef.current === node) return;
|
|
1811
1811
|
contentElementRef.current = node;
|
|
1812
1812
|
setContentElement(node);
|
|
1813
1813
|
}, []);
|
|
1814
|
-
|
|
1814
|
+
React66__default.useLayoutEffect(() => {
|
|
1815
1815
|
if (!contentElement) {
|
|
1816
1816
|
setContentOwnsActions((current) => current ? false : current);
|
|
1817
1817
|
return;
|
|
@@ -2064,8 +2064,8 @@ function NDirectDialog({
|
|
|
2064
2064
|
const resolvedHeaderClassName = cn(slots.header?.className, headerClassName);
|
|
2065
2065
|
const resolvedTitleClassName = cn(slots.header?.titleClassName, titleClassName);
|
|
2066
2066
|
const resolvedDescriptionClassName = cn(slots.description?.className, descriptionClassName);
|
|
2067
|
-
const [internalOpen, setInternalOpen] =
|
|
2068
|
-
const [primaryLoading, setPrimaryLoading] =
|
|
2067
|
+
const [internalOpen, setInternalOpen] = React66__default.useState(defaultOpen);
|
|
2068
|
+
const [primaryLoading, setPrimaryLoading] = React66__default.useState(false);
|
|
2069
2069
|
const isControlled = open !== void 0;
|
|
2070
2070
|
const currentOpen = isControlled ? open : internalOpen;
|
|
2071
2071
|
const setOpen = (nextOpen) => {
|
|
@@ -2347,7 +2347,7 @@ function useDialog(store) {
|
|
|
2347
2347
|
description: options.description,
|
|
2348
2348
|
size: options.size || "sm",
|
|
2349
2349
|
className: options.className,
|
|
2350
|
-
render: ({ dialog, zIndex, confirm, cancel, onOpenChange }) =>
|
|
2350
|
+
render: ({ dialog, zIndex, confirm, cancel, onOpenChange }) => React66__default.createElement(NDeleteDialog, {
|
|
2351
2351
|
itemName: options.itemName,
|
|
2352
2352
|
itemType: options.itemType,
|
|
2353
2353
|
icon: options.icon,
|
|
@@ -2641,8 +2641,8 @@ function resolveIcon(icon) {
|
|
|
2641
2641
|
}
|
|
2642
2642
|
var MultiSelectInput = ({ ariaLabel, placeholder = "Select items...", value = [], onChange, icon, showIcon = true, iconColor, items, className = "", variant = "default", status = "default", bordered, borderColor, disabled = false, searchPlaceholder = "Search...", emptyMessage = "No items found.", maxDisplay = 3, showSearch = true }) => {
|
|
2643
2643
|
const [open, setOpen] = useState(false);
|
|
2644
|
-
const triggerRef =
|
|
2645
|
-
const pointerDismissedRef =
|
|
2644
|
+
const triggerRef = React66__default.useRef(null);
|
|
2645
|
+
const pointerDismissedRef = React66__default.useRef(false);
|
|
2646
2646
|
const shouldDisplayIcon = Boolean(icon) && showIcon && value.length === 0;
|
|
2647
2647
|
const iconProps = getIconColorProps(iconColor, "h-4 w-4");
|
|
2648
2648
|
const handleSelect = (itemValue) => {
|
|
@@ -2758,7 +2758,7 @@ function SelectScrollDownButton({ className, ...props }) {
|
|
|
2758
2758
|
return /* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, { "data-slot": "select-scroll-down-button", className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4" }) });
|
|
2759
2759
|
}
|
|
2760
2760
|
function SelectContent({ className, children, position = "popper", style, ...props }) {
|
|
2761
|
-
const container =
|
|
2761
|
+
const container = React66.useContext(NajmThemeContainerCtx);
|
|
2762
2762
|
const recipe = useNajmComponentStyle("select");
|
|
2763
2763
|
const contentSlot = recipe?.slots?.content;
|
|
2764
2764
|
const borderWidth = contentSlot?.borderWidth ?? recipe?.borderWidth;
|
|
@@ -2841,9 +2841,9 @@ var SelectInput = ({ placeholder = "", ariaLabel, value, onChange, icon, showIco
|
|
|
2841
2841
|
(item) => typeof item === "string" ? item === value : item.value === value
|
|
2842
2842
|
);
|
|
2843
2843
|
const displayLabel = typeof found === "string" ? found : found?.label ?? value;
|
|
2844
|
-
const [open, setOpen] =
|
|
2845
|
-
const triggerRef =
|
|
2846
|
-
const pointerDismissedRef =
|
|
2844
|
+
const [open, setOpen] = React66__default.useState(false);
|
|
2845
|
+
const triggerRef = React66__default.useRef(null);
|
|
2846
|
+
const pointerDismissedRef = React66__default.useRef(false);
|
|
2847
2847
|
return /* @__PURE__ */ jsxs("div", { className: cn("group relative", className), children: [
|
|
2848
2848
|
/* @__PURE__ */ jsxs(
|
|
2849
2849
|
BaseInput,
|
|
@@ -2901,10 +2901,11 @@ var SelectInput = ({ placeholder = "", ariaLabel, value, onChange, icon, showIco
|
|
|
2901
2901
|
)
|
|
2902
2902
|
] });
|
|
2903
2903
|
};
|
|
2904
|
-
|
|
2904
|
+
var Input = React66.forwardRef(function Input2({ className, type, ...props }, ref) {
|
|
2905
2905
|
return /* @__PURE__ */ jsx(
|
|
2906
2906
|
"input",
|
|
2907
2907
|
{
|
|
2908
|
+
ref,
|
|
2908
2909
|
type,
|
|
2909
2910
|
"data-slot": "input",
|
|
2910
2911
|
className: cn(
|
|
@@ -2916,7 +2917,7 @@ function Input({ className, type, ...props }) {
|
|
|
2916
2917
|
...props
|
|
2917
2918
|
}
|
|
2918
2919
|
);
|
|
2919
|
-
}
|
|
2920
|
+
});
|
|
2920
2921
|
var TRACK = {
|
|
2921
2922
|
xs: "h-3 w-5",
|
|
2922
2923
|
sm: "h-4 w-7",
|
|
@@ -3711,7 +3712,7 @@ function CollapsibleSection({
|
|
|
3711
3712
|
children,
|
|
3712
3713
|
disabled
|
|
3713
3714
|
}) {
|
|
3714
|
-
const [open, setOpen] =
|
|
3715
|
+
const [open, setOpen] = React66.useState(true);
|
|
3715
3716
|
const titleText = typeof title === "string" || typeof title === "number" ? String(title) : "Section";
|
|
3716
3717
|
return /* @__PURE__ */ jsxs(
|
|
3717
3718
|
Collapsible,
|
|
@@ -4030,7 +4031,7 @@ function TokenGroupSection({
|
|
|
4030
4031
|
disabled,
|
|
4031
4032
|
labels
|
|
4032
4033
|
}) {
|
|
4033
|
-
const [open, setOpen] =
|
|
4034
|
+
const [open, setOpen] = React66.useState(groupId === "surface" || groupId === "brand");
|
|
4034
4035
|
const labelText = typeof label === "string" || typeof label === "number" ? String(label) : "Group";
|
|
4035
4036
|
return /* @__PURE__ */ jsxs(
|
|
4036
4037
|
Collapsible,
|
|
@@ -4333,37 +4334,40 @@ function Label2({ className, ...props }) {
|
|
|
4333
4334
|
}
|
|
4334
4335
|
);
|
|
4335
4336
|
}
|
|
4336
|
-
var TextInput = ({ value, onChange, placeholder = "", icon, showIcon = true, iconColor, className = "", variant = "default", status = "default", bordered, borderColor, disabled = false, ...props }) => {
|
|
4337
|
+
var TextInput = React66__default.forwardRef(({ value, onChange, placeholder = "", icon, showIcon = true, iconColor, className = "", variant = "default", status = "default", bordered, borderColor, disabled = false, ...props }, ref) => {
|
|
4337
4338
|
const shouldDisplayIcon = Boolean(icon) && showIcon;
|
|
4338
4339
|
const iconProps = getIconColorProps(iconColor, "h-4 w-4");
|
|
4339
4340
|
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className: cn("gap-2", className), disabled, children: [
|
|
4340
4341
|
shouldDisplayIcon && /* @__PURE__ */ jsx("span", { className: iconProps.className, style: iconProps.style, children: resolveIcon(icon) }),
|
|
4341
|
-
/* @__PURE__ */ jsx(Input, { placeholder, value, onChange: (ev) => onChange(ev.target.value), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-foreground placeholder:text-muted-foreground", disabled, ...props })
|
|
4342
|
+
/* @__PURE__ */ jsx(Input, { ref, placeholder, value, onChange: (ev) => onChange(ev.target.value), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-foreground placeholder:text-muted-foreground", disabled, ...props })
|
|
4342
4343
|
] });
|
|
4343
|
-
};
|
|
4344
|
-
|
|
4344
|
+
});
|
|
4345
|
+
TextInput.displayName = "TextInput";
|
|
4346
|
+
var NumberInput = React66__default.forwardRef(({ value, onChange, placeholder = "", icon, showIcon = true, iconColor, className = "", variant = "default", status = "default", bordered, borderColor, disabled = false, ...props }, ref) => {
|
|
4345
4347
|
const shouldDisplayIcon = Boolean(icon) && showIcon;
|
|
4346
4348
|
const iconProps = getIconColorProps(iconColor, "h-4 w-4");
|
|
4347
4349
|
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className: cn("gap-2", className), children: [
|
|
4348
4350
|
shouldDisplayIcon && /* @__PURE__ */ jsx("span", { className: iconProps.className, style: iconProps.style, children: resolveIcon(icon) }),
|
|
4349
|
-
/* @__PURE__ */ jsx(Input, { type: "number", placeholder, value: value ?? "", onChange: (ev) => onChange(Number(ev.target.value)), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-foreground placeholder:text-muted-foreground" })
|
|
4351
|
+
/* @__PURE__ */ jsx(Input, { ref, type: "number", placeholder, value: value ?? "", onChange: (ev) => onChange(Number(ev.target.value)), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-foreground placeholder:text-muted-foreground", disabled, ...props })
|
|
4350
4352
|
] });
|
|
4351
|
-
};
|
|
4352
|
-
|
|
4353
|
+
});
|
|
4354
|
+
NumberInput.displayName = "NumberInput";
|
|
4355
|
+
var PasswordInput = React66__default.forwardRef(({ value, onChange, placeholder = "", icon, showIcon = true, iconColor, className = "", variant = "default", status = "default", bordered, borderColor, disabled = false, ...props }, ref) => {
|
|
4353
4356
|
const [showPassword, setShowPassword] = useState(false);
|
|
4354
4357
|
const shouldDisplayIcon = Boolean(icon) && showIcon;
|
|
4355
4358
|
const iconProps = getIconColorProps(iconColor, "h-4 w-4");
|
|
4356
4359
|
return /* @__PURE__ */ jsxs(BaseInput, { variant, status, bordered, borderColor, className: cn("gap-2", className), disabled, children: [
|
|
4357
4360
|
shouldDisplayIcon && /* @__PURE__ */ jsx("span", { className: iconProps.className, style: iconProps.style, children: resolveIcon(icon) }),
|
|
4358
|
-
/* @__PURE__ */ jsx(Input, { type: showPassword ? "text" : "password", placeholder, value, onChange: (ev) => onChange(ev.target.value), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-foreground placeholder:text-muted-foreground", disabled, ...props }),
|
|
4361
|
+
/* @__PURE__ */ jsx(Input, { ref, type: showPassword ? "text" : "password", placeholder, value, onChange: (ev) => onChange(ev.target.value), className: "p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 text-foreground placeholder:text-muted-foreground", disabled, ...props }),
|
|
4359
4362
|
showPassword ? /* @__PURE__ */ jsx(Eye, { className: "absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground cursor-pointer", onClick: () => setShowPassword(false) }) : /* @__PURE__ */ jsx(EyeOff, { className: "absolute right-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground cursor-pointer", onClick: () => setShowPassword(true) })
|
|
4360
4363
|
] });
|
|
4361
|
-
};
|
|
4364
|
+
});
|
|
4365
|
+
PasswordInput.displayName = "PasswordInput";
|
|
4362
4366
|
function normalizeCode(value, numeric, length) {
|
|
4363
4367
|
const normalized = numeric ? value.replace(/\D/g, "") : value.replace(/\s/g, "");
|
|
4364
4368
|
return normalized.slice(0, length);
|
|
4365
4369
|
}
|
|
4366
|
-
var OtpInput =
|
|
4370
|
+
var OtpInput = React66__default.forwardRef(
|
|
4367
4371
|
({
|
|
4368
4372
|
value,
|
|
4369
4373
|
onChange,
|
|
@@ -4502,10 +4506,11 @@ var OtpInput = React61__default.forwardRef(
|
|
|
4502
4506
|
}
|
|
4503
4507
|
);
|
|
4504
4508
|
OtpInput.displayName = "OtpInput";
|
|
4505
|
-
|
|
4509
|
+
var Textarea = React66.forwardRef(function Textarea2({ className, ...props }, ref) {
|
|
4506
4510
|
return /* @__PURE__ */ jsx(
|
|
4507
4511
|
"textarea",
|
|
4508
4512
|
{
|
|
4513
|
+
ref,
|
|
4509
4514
|
"data-slot": "textarea",
|
|
4510
4515
|
className: cn(
|
|
4511
4516
|
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base text-foreground shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
|
|
@@ -4514,11 +4519,11 @@ function Textarea({ className, ...props }) {
|
|
|
4514
4519
|
...props
|
|
4515
4520
|
}
|
|
4516
4521
|
);
|
|
4517
|
-
}
|
|
4522
|
+
});
|
|
4518
4523
|
var DEFAULT_ROWS = 3;
|
|
4519
4524
|
var MIN_ROWS = 2;
|
|
4520
4525
|
var REM_PER_ROW = 1.5;
|
|
4521
|
-
var TextAreaInput = ({ value, onChange, placeholder = "", className = "", variant = "default", status = "default", bordered, borderColor, rows }) => {
|
|
4526
|
+
var TextAreaInput = React66__default.forwardRef(({ value, onChange, placeholder = "", className = "", variant = "default", status = "default", bordered, borderColor, iconColor: _iconColor, rows, ...props }, ref) => {
|
|
4522
4527
|
const visibleRows = Math.max(rows ?? DEFAULT_ROWS, MIN_ROWS);
|
|
4523
4528
|
const textareaMinHeight = `${visibleRows * REM_PER_ROW}rem`;
|
|
4524
4529
|
return /* @__PURE__ */ jsx(
|
|
@@ -4532,21 +4537,24 @@ var TextAreaInput = ({ value, onChange, placeholder = "", className = "", varian
|
|
|
4532
4537
|
children: /* @__PURE__ */ jsx(
|
|
4533
4538
|
Textarea,
|
|
4534
4539
|
{
|
|
4540
|
+
ref,
|
|
4535
4541
|
rows: visibleRows,
|
|
4536
4542
|
placeholder,
|
|
4537
4543
|
value,
|
|
4538
4544
|
onChange: (ev) => onChange(ev.target.value),
|
|
4539
4545
|
style: { minHeight: textareaMinHeight },
|
|
4540
|
-
className: "h-auto min-h-0 resize-y border-0 bg-transparent p-0 text-foreground placeholder:text-muted-foreground shadow-none focus-visible:border-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 dark:bg-transparent"
|
|
4546
|
+
className: "h-auto min-h-0 resize-y border-0 bg-transparent p-0 text-foreground placeholder:text-muted-foreground shadow-none focus-visible:border-transparent focus-visible:ring-0 focus-visible:ring-transparent focus-visible:ring-offset-0 dark:bg-transparent",
|
|
4547
|
+
...props
|
|
4541
4548
|
}
|
|
4542
4549
|
)
|
|
4543
4550
|
}
|
|
4544
4551
|
);
|
|
4545
|
-
};
|
|
4552
|
+
});
|
|
4553
|
+
TextAreaInput.displayName = "TextAreaInput";
|
|
4546
4554
|
var ComboboxInput = ({ placeholder = "Select...", searchPlaceholder = "Search...", emptyMessage = "No results found.", loading = false, loadingMessage = "Loading...", onSearchChange, shouldFilter = true, value, onChange, icon, showIcon = true, iconColor, items = [], className = "", variant = "default", status = "default", bordered, borderColor, disabled = false, allowFreeText = false }) => {
|
|
4547
4555
|
const [open, setOpen] = useState(false);
|
|
4548
|
-
const triggerRef =
|
|
4549
|
-
const pointerDismissedRef =
|
|
4556
|
+
const triggerRef = React66__default.useRef(null);
|
|
4557
|
+
const pointerDismissedRef = React66__default.useRef(false);
|
|
4550
4558
|
const [query, setQuery] = useState("");
|
|
4551
4559
|
const normalizedItems = items.map((item) => typeof item === "string" ? { value: item, label: item } : item);
|
|
4552
4560
|
const selectedItem = normalizedItems.find((item) => item.value === value);
|
|
@@ -5933,7 +5941,7 @@ function DropdownMenuSubContent({ className, children, style, ...props }) {
|
|
|
5933
5941
|
);
|
|
5934
5942
|
}
|
|
5935
5943
|
function DropdownMenuContent({ className, children, sideOffset = 4, style, ...props }) {
|
|
5936
|
-
const container =
|
|
5944
|
+
const container = React66.useContext(NajmThemeContainerCtx);
|
|
5937
5945
|
const surface = useDropdownSurfaceRecipe("content");
|
|
5938
5946
|
const { hostRef, viewportRef } = useNajmScrollViewport();
|
|
5939
5947
|
useNajmPortalLayerStyles();
|
|
@@ -6138,7 +6146,7 @@ function PhoneInput({
|
|
|
6138
6146
|
}
|
|
6139
6147
|
) });
|
|
6140
6148
|
}
|
|
6141
|
-
var TimeInput = ({ value = "", onChange, placeholder = "", icon, showIcon = true, iconColor, className = "", variant = "default", status = "default", bordered, borderColor, format24 = true, showSeconds = false, disabled = false }) => {
|
|
6149
|
+
var TimeInput = React66__default.forwardRef(({ value = "", onChange, placeholder = "", icon, showIcon = true, iconColor, className = "", variant = "default", status = "default", bordered, borderColor, format24 = true, showSeconds = false, disabled = false, onBlur, ...props }, ref) => {
|
|
6142
6150
|
const [inputValue, setInputValue] = useState(value);
|
|
6143
6151
|
const [isValid, setIsValid] = useState(true);
|
|
6144
6152
|
useEffect(() => {
|
|
@@ -6172,7 +6180,7 @@ var TimeInput = ({ value = "", onChange, placeholder = "", icon, showIcon = true
|
|
|
6172
6180
|
if (valid || formatted === "") onChange(formatted);
|
|
6173
6181
|
}
|
|
6174
6182
|
};
|
|
6175
|
-
const handleBlur = () => {
|
|
6183
|
+
const handleBlur = (event) => {
|
|
6176
6184
|
if (inputValue) {
|
|
6177
6185
|
let completed = inputValue;
|
|
6178
6186
|
if (completed.length === 1) completed = "0" + completed + ":00";
|
|
@@ -6183,16 +6191,18 @@ var TimeInput = ({ value = "", onChange, placeholder = "", icon, showIcon = true
|
|
|
6183
6191
|
onChange(completed);
|
|
6184
6192
|
}
|
|
6185
6193
|
}
|
|
6194
|
+
onBlur?.(event);
|
|
6186
6195
|
};
|
|
6187
6196
|
const iconProps = getIconColorProps(iconColor, "h-4 w-4");
|
|
6188
6197
|
const currentStatus = !isValid ? "error" : status;
|
|
6189
6198
|
return /* @__PURE__ */ jsxs(BaseInput, { variant, status: currentStatus, bordered, borderColor, className: cn("gap-2", className), children: [
|
|
6190
6199
|
showIcon && (icon ? /* @__PURE__ */ jsx("span", { className: iconProps.className, style: iconProps.style, children: resolveIcon(icon) }) : /* @__PURE__ */ jsx(Clock, { className: iconProps.className, style: iconProps.style })),
|
|
6191
|
-
/* @__PURE__ */ jsx(Input, { type: "text", placeholder: placeholder || (showSeconds ? "HH:MM:SS" : "HH:MM"), value: inputValue, onChange: (e) => handleInputChange(e.target.value), onKeyDown: (e) => {
|
|
6200
|
+
/* @__PURE__ */ jsx(Input, { ref, type: "text", placeholder: placeholder || (showSeconds ? "HH:MM:SS" : "HH:MM"), value: inputValue, onChange: (e) => handleInputChange(e.target.value), onKeyDown: (e) => {
|
|
6192
6201
|
if (!/\d/.test(e.key) && !["Backspace", "Delete", "ArrowLeft", "ArrowRight", "Tab"].includes(e.key)) e.preventDefault();
|
|
6193
|
-
}, onBlur: handleBlur, disabled, className: cn("p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 placeholder:text-muted-foreground", !isValid ? "text-red-500" : "text-foreground") })
|
|
6202
|
+
}, onBlur: handleBlur, disabled, className: cn("p-0 border-0 shadow-none bg-transparent dark:bg-transparent focus-visible:ring-0 placeholder:text-muted-foreground", !isValid ? "text-red-500" : "text-foreground"), ...props })
|
|
6194
6203
|
] });
|
|
6195
|
-
};
|
|
6204
|
+
});
|
|
6205
|
+
TimeInput.displayName = "TimeInput";
|
|
6196
6206
|
var timeZoneValues = [
|
|
6197
6207
|
"UTC",
|
|
6198
6208
|
"Atlantic/Azores",
|
|
@@ -6337,8 +6347,8 @@ function NSlider({
|
|
|
6337
6347
|
return Array.isArray(v) ? [...v] : [v];
|
|
6338
6348
|
};
|
|
6339
6349
|
const initialRadix = toRadix(controlledValue ?? defaultValue);
|
|
6340
|
-
const [internalValues, setInternalValues] =
|
|
6341
|
-
const [active, setActive] =
|
|
6350
|
+
const [internalValues, setInternalValues] = React66.useState(initialRadix);
|
|
6351
|
+
const [active, setActive] = React66.useState(null);
|
|
6342
6352
|
const currentValues = controlledValue !== void 0 ? toRadix(controlledValue) : internalValues;
|
|
6343
6353
|
const handleRadix = (arr) => {
|
|
6344
6354
|
setInternalValues(arr);
|
|
@@ -6495,13 +6505,13 @@ function NThemePresets({
|
|
|
6495
6505
|
disabled = false,
|
|
6496
6506
|
className
|
|
6497
6507
|
}) {
|
|
6498
|
-
const [saveOpen, setSaveOpen] =
|
|
6499
|
-
const [name, setName] =
|
|
6500
|
-
const [pendingDelete, setPendingDelete] =
|
|
6508
|
+
const [saveOpen, setSaveOpen] = React66.useState(false);
|
|
6509
|
+
const [name, setName] = React66.useState("");
|
|
6510
|
+
const [pendingDelete, setPendingDelete] = React66.useState(
|
|
6501
6511
|
null
|
|
6502
6512
|
);
|
|
6503
|
-
const [busy, setBusy] =
|
|
6504
|
-
const rows =
|
|
6513
|
+
const [busy, setBusy] = React66.useState(false);
|
|
6514
|
+
const rows = React66.useMemo(
|
|
6505
6515
|
() => [
|
|
6506
6516
|
...savedDesign ? [
|
|
6507
6517
|
{
|
|
@@ -6753,12 +6763,12 @@ function NThemeCustomizer({
|
|
|
6753
6763
|
}) {
|
|
6754
6764
|
const inheritedMode = useNajmThemeMode();
|
|
6755
6765
|
const resolvedPreviewMode = previewMode ?? inheritedMode ?? value.theme.mode ?? "light";
|
|
6756
|
-
const visibleTabs =
|
|
6766
|
+
const visibleTabs = React66.useMemo(() => buildTabs(tabs), [tabs]);
|
|
6757
6767
|
const firstTab = visibleTabs[0] ?? "theme";
|
|
6758
|
-
const [activeTab, setActiveTab] =
|
|
6759
|
-
const [fileError, setFileError] =
|
|
6760
|
-
const fileInputRef =
|
|
6761
|
-
|
|
6768
|
+
const [activeTab, setActiveTab] = React66.useState(TAB_VALUE[firstTab]);
|
|
6769
|
+
const [fileError, setFileError] = React66.useState(false);
|
|
6770
|
+
const fileInputRef = React66.useRef(null);
|
|
6771
|
+
React66.useEffect(() => {
|
|
6762
6772
|
setActiveTab(TAB_VALUE[firstTab]);
|
|
6763
6773
|
}, [firstTab]);
|
|
6764
6774
|
const themeLabel = resolveLabel("themeTab", labels);
|
|
@@ -6770,7 +6780,7 @@ function NThemeCustomizer({
|
|
|
6770
6780
|
const invalidThemeFileLabel = resolveLabel("invalidThemeFile", labels);
|
|
6771
6781
|
const defaultOptionLabel = resolveLabel("defaultOption", labels);
|
|
6772
6782
|
const colorSwatchFallbackLabel = resolveLabel("colorSwatchFallback", labels);
|
|
6773
|
-
const tokenLabels =
|
|
6783
|
+
const tokenLabels = React66.useMemo(() => {
|
|
6774
6784
|
const out = {};
|
|
6775
6785
|
const knownTokens = [
|
|
6776
6786
|
"background",
|
|
@@ -7574,7 +7584,7 @@ function Alert({
|
|
|
7574
7584
|
);
|
|
7575
7585
|
}
|
|
7576
7586
|
var NAlert = Alert;
|
|
7577
|
-
var NativeSelect =
|
|
7587
|
+
var NativeSelect = React66.forwardRef(
|
|
7578
7588
|
({ className, options, placeholder, value, ...props }, ref) => {
|
|
7579
7589
|
const hasValue = value !== void 0 && value !== "";
|
|
7580
7590
|
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
@@ -7732,7 +7742,7 @@ function Avatar({
|
|
|
7732
7742
|
...props
|
|
7733
7743
|
}) {
|
|
7734
7744
|
const hasShortcut = src !== void 0 || fallback !== void 0;
|
|
7735
|
-
const hasChildren =
|
|
7745
|
+
const hasChildren = React66.Children.count(children) > 0;
|
|
7736
7746
|
return /* @__PURE__ */ jsxs(
|
|
7737
7747
|
AvatarPrimitive.Root,
|
|
7738
7748
|
{
|
|
@@ -7826,9 +7836,9 @@ function AvatarGroup({ ring = true, className, children, ...props }) {
|
|
|
7826
7836
|
"data-slot": "avatar-group",
|
|
7827
7837
|
className: cn("flex -space-x-2", className),
|
|
7828
7838
|
...props,
|
|
7829
|
-
children: ring ?
|
|
7830
|
-
if (
|
|
7831
|
-
return
|
|
7839
|
+
children: ring ? React66.Children.map(children, (child) => {
|
|
7840
|
+
if (React66.isValidElement(child) && child.type === Avatar) {
|
|
7841
|
+
return React66.cloneElement(child, { ring: true, ...child.props });
|
|
7832
7842
|
}
|
|
7833
7843
|
return child;
|
|
7834
7844
|
}) : children
|
|
@@ -7895,7 +7905,7 @@ function Swap({
|
|
|
7895
7905
|
className,
|
|
7896
7906
|
...props
|
|
7897
7907
|
}) {
|
|
7898
|
-
const [internalChecked, setInternalChecked] =
|
|
7908
|
+
const [internalChecked, setInternalChecked] = React66.useState(defaultChecked);
|
|
7899
7909
|
const isControlled = controlledChecked !== void 0 || controlledState !== void 0;
|
|
7900
7910
|
const currentState = getDerivedState(
|
|
7901
7911
|
isControlled ? controlledChecked ?? false : internalChecked,
|
|
@@ -7903,7 +7913,7 @@ function Swap({
|
|
|
7903
7913
|
);
|
|
7904
7914
|
const dataState = currentState === "indeterminate" ? "indeterminate" : currentState ? "on" : "off";
|
|
7905
7915
|
const ariaPressed = currentState === "indeterminate" ? "mixed" : currentState;
|
|
7906
|
-
const handleClick =
|
|
7916
|
+
const handleClick = React66.useCallback((event) => {
|
|
7907
7917
|
onClick?.(event);
|
|
7908
7918
|
if (event.defaultPrevented) return;
|
|
7909
7919
|
if (disabled) return;
|
|
@@ -8028,7 +8038,7 @@ var toneClasses = {
|
|
|
8028
8038
|
ring: "border-primary/30"
|
|
8029
8039
|
}
|
|
8030
8040
|
};
|
|
8031
|
-
var StatusPill =
|
|
8041
|
+
var StatusPill = React66.forwardRef(
|
|
8032
8042
|
({ className, tone = "neutral", pulse = false, label, ...props }, ref) => {
|
|
8033
8043
|
const c = toneClasses[tone];
|
|
8034
8044
|
return /* @__PURE__ */ jsxs(
|
|
@@ -8087,20 +8097,20 @@ function Toaster({ toastOptions, ...props }) {
|
|
|
8087
8097
|
);
|
|
8088
8098
|
}
|
|
8089
8099
|
var Form = FormProvider;
|
|
8090
|
-
var FormFieldContext =
|
|
8100
|
+
var FormFieldContext = React66.createContext({});
|
|
8091
8101
|
var FormField = ({ ...props }) => /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
8092
8102
|
var useFormField = () => {
|
|
8093
|
-
const fieldContext =
|
|
8094
|
-
const itemContext =
|
|
8103
|
+
const fieldContext = React66.useContext(FormFieldContext);
|
|
8104
|
+
const itemContext = React66.useContext(FormItemContext);
|
|
8095
8105
|
const { getFieldState, formState } = useFormContext();
|
|
8096
8106
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
8097
8107
|
if (!fieldContext) throw new Error("useFormField should be used within <FormField>");
|
|
8098
8108
|
const { id } = itemContext;
|
|
8099
8109
|
return { id, name: fieldContext.name, formItemId: `${id}-form-item`, formDescriptionId: `${id}-form-item-description`, formMessageId: `${id}-form-item-message`, ...fieldState };
|
|
8100
8110
|
};
|
|
8101
|
-
var FormItemContext =
|
|
8111
|
+
var FormItemContext = React66.createContext({});
|
|
8102
8112
|
function FormItem({ className, ...props }) {
|
|
8103
|
-
const id =
|
|
8113
|
+
const id = React66.useId();
|
|
8104
8114
|
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
8105
8115
|
}
|
|
8106
8116
|
function FormLabel({ className, ...props }) {
|
|
@@ -8145,7 +8155,7 @@ function TableCell({ className, ...props }) {
|
|
|
8145
8155
|
function TableCaption({ className, ...props }) {
|
|
8146
8156
|
return /* @__PURE__ */ jsx("caption", { "data-slot": "table-caption", className: cn("text-muted-foreground mt-4 text-sm", className), ...props });
|
|
8147
8157
|
}
|
|
8148
|
-
var NErrorBoundary = class extends
|
|
8158
|
+
var NErrorBoundary = class extends React66__default.Component {
|
|
8149
8159
|
constructor(props) {
|
|
8150
8160
|
super(props);
|
|
8151
8161
|
this.state = { hasError: false, error: null };
|
|
@@ -8326,9 +8336,9 @@ function NAvatar({
|
|
|
8326
8336
|
loading: imageLoading,
|
|
8327
8337
|
...restImageProps
|
|
8328
8338
|
} = imageProps ?? {};
|
|
8329
|
-
const imageRef =
|
|
8339
|
+
const imageRef = React66__default.useRef(null);
|
|
8330
8340
|
const { markLoaded } = chain;
|
|
8331
|
-
|
|
8341
|
+
React66__default.useEffect(() => {
|
|
8332
8342
|
const element = imageRef.current;
|
|
8333
8343
|
if (element?.complete && element.naturalWidth > 0) markLoaded();
|
|
8334
8344
|
}, [chain.src, markLoaded]);
|
|
@@ -8483,8 +8493,8 @@ function NCard({
|
|
|
8483
8493
|
let footerClassName;
|
|
8484
8494
|
let mediaSlot = null;
|
|
8485
8495
|
const mainChildren = [];
|
|
8486
|
-
|
|
8487
|
-
if (!
|
|
8496
|
+
React66__default.Children.forEach(children, (child) => {
|
|
8497
|
+
if (!React66__default.isValidElement(child)) {
|
|
8488
8498
|
mainChildren.push(child);
|
|
8489
8499
|
return;
|
|
8490
8500
|
}
|
|
@@ -8660,7 +8670,7 @@ function truncateByCharacters(text, maxCharacters, suffix = "...") {
|
|
|
8660
8670
|
const str = String(text);
|
|
8661
8671
|
return str.length <= maxCharacters ? str : str.slice(0, maxCharacters) + suffix;
|
|
8662
8672
|
}
|
|
8663
|
-
var CardDensityContext =
|
|
8673
|
+
var CardDensityContext = React66__default.createContext("default");
|
|
8664
8674
|
function NCardInfo({
|
|
8665
8675
|
icon: Icon2,
|
|
8666
8676
|
label,
|
|
@@ -8673,7 +8683,7 @@ function NCardInfo({
|
|
|
8673
8683
|
className,
|
|
8674
8684
|
...props
|
|
8675
8685
|
}) {
|
|
8676
|
-
const inheritedDensity =
|
|
8686
|
+
const inheritedDensity = React66__default.useContext(CardDensityContext);
|
|
8677
8687
|
const resolvedDensity = density ?? inheritedDensity;
|
|
8678
8688
|
const isTruncated = typeof value === "string" && value.length > maxChars;
|
|
8679
8689
|
const displayValue = isTruncated ? truncateByCharacters(value, maxChars) : value;
|
|
@@ -9922,7 +9932,7 @@ function NContextMenu({ x, y, items, onAction, onClose, className }) {
|
|
|
9922
9932
|
children: items.map((item) => {
|
|
9923
9933
|
const Icon2 = item.icon;
|
|
9924
9934
|
const hasSub = !!item.submenu?.length;
|
|
9925
|
-
return /* @__PURE__ */ jsxs(
|
|
9935
|
+
return /* @__PURE__ */ jsxs(React66__default.Fragment, { children: [
|
|
9926
9936
|
item.separatorBefore && /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border/60" }),
|
|
9927
9937
|
/* @__PURE__ */ jsxs(
|
|
9928
9938
|
"div",
|
|
@@ -10353,11 +10363,11 @@ function NCredentialsCard({
|
|
|
10353
10363
|
className,
|
|
10354
10364
|
classNames
|
|
10355
10365
|
}) {
|
|
10356
|
-
const [status, setStatus] =
|
|
10357
|
-
const revertTimer =
|
|
10358
|
-
const mountedRef =
|
|
10359
|
-
const requestTokenRef =
|
|
10360
|
-
|
|
10366
|
+
const [status, setStatus] = React66.useState("idle");
|
|
10367
|
+
const revertTimer = React66.useRef(null);
|
|
10368
|
+
const mountedRef = React66.useRef(true);
|
|
10369
|
+
const requestTokenRef = React66.useRef(0);
|
|
10370
|
+
React66.useEffect(() => {
|
|
10361
10371
|
mountedRef.current = true;
|
|
10362
10372
|
return () => {
|
|
10363
10373
|
mountedRef.current = false;
|
|
@@ -10365,14 +10375,14 @@ function NCredentialsCard({
|
|
|
10365
10375
|
revertTimer.current = null;
|
|
10366
10376
|
};
|
|
10367
10377
|
}, []);
|
|
10368
|
-
const scheduleRevert =
|
|
10378
|
+
const scheduleRevert = React66.useCallback(() => {
|
|
10369
10379
|
if (revertTimer.current) clearTimeout(revertTimer.current);
|
|
10370
10380
|
revertTimer.current = setTimeout(() => {
|
|
10371
10381
|
revertTimer.current = null;
|
|
10372
10382
|
if (mountedRef.current) setStatus("idle");
|
|
10373
10383
|
}, REVERT_MS);
|
|
10374
10384
|
}, []);
|
|
10375
|
-
const handleCopy =
|
|
10385
|
+
const handleCopy = React66.useCallback(() => {
|
|
10376
10386
|
if (status === "pending") return;
|
|
10377
10387
|
if (revertTimer.current) {
|
|
10378
10388
|
clearTimeout(revertTimer.current);
|
|
@@ -10612,19 +10622,19 @@ function Combobox({
|
|
|
10612
10622
|
allowFreeText = false,
|
|
10613
10623
|
disabled = false
|
|
10614
10624
|
}) {
|
|
10615
|
-
const [open, setOpen] =
|
|
10616
|
-
const [query, setQuery] =
|
|
10617
|
-
const [highlight, setHighlight] =
|
|
10618
|
-
const wrapperRef =
|
|
10619
|
-
const inputRef =
|
|
10620
|
-
const filtered =
|
|
10625
|
+
const [open, setOpen] = React66.useState(false);
|
|
10626
|
+
const [query, setQuery] = React66.useState("");
|
|
10627
|
+
const [highlight, setHighlight] = React66.useState(0);
|
|
10628
|
+
const wrapperRef = React66.useRef(null);
|
|
10629
|
+
const inputRef = React66.useRef(null);
|
|
10630
|
+
const filtered = React66.useMemo(() => {
|
|
10621
10631
|
const q = query.trim().toLowerCase();
|
|
10622
10632
|
if (!q) return options;
|
|
10623
10633
|
return options.filter(
|
|
10624
10634
|
(opt) => opt.label.toLowerCase().includes(q) || opt.value.toLowerCase().includes(q)
|
|
10625
10635
|
);
|
|
10626
10636
|
}, [options, query]);
|
|
10627
|
-
|
|
10637
|
+
React66.useEffect(() => {
|
|
10628
10638
|
if (!open) return;
|
|
10629
10639
|
const onClick = (e) => {
|
|
10630
10640
|
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
@@ -10635,7 +10645,7 @@ function Combobox({
|
|
|
10635
10645
|
document.addEventListener("mousedown", onClick);
|
|
10636
10646
|
return () => document.removeEventListener("mousedown", onClick);
|
|
10637
10647
|
}, [open]);
|
|
10638
|
-
|
|
10648
|
+
React66.useEffect(() => {
|
|
10639
10649
|
if (open) {
|
|
10640
10650
|
setHighlight(0);
|
|
10641
10651
|
requestAnimationFrame(() => inputRef.current?.focus());
|
|
@@ -10643,7 +10653,7 @@ function Combobox({
|
|
|
10643
10653
|
setQuery("");
|
|
10644
10654
|
}
|
|
10645
10655
|
}, [open]);
|
|
10646
|
-
const selectedLabel =
|
|
10656
|
+
const selectedLabel = React66.useMemo(() => {
|
|
10647
10657
|
const match = options.find((o) => o.value === value);
|
|
10648
10658
|
return match?.label ?? value;
|
|
10649
10659
|
}, [options, value]);
|
|
@@ -10868,10 +10878,11 @@ var Inputs = {
|
|
|
10868
10878
|
time: TimeInput,
|
|
10869
10879
|
slider: SliderInput
|
|
10870
10880
|
};
|
|
10881
|
+
var nativeFieldTypes = /* @__PURE__ */ new Set(["text", "number", "password", "textarea", "time"]);
|
|
10871
10882
|
var FormInput = ({ name, type, formLabel, formDescription, required = false, disabled = false, readOnly = false, hidden = false, icon, iconColor, classNames, background, ...rest }) => {
|
|
10872
10883
|
const InputComponent = Inputs[type];
|
|
10873
10884
|
const { control } = useFormContext();
|
|
10874
|
-
const { className, onChange: consumerOnChange, ...inputRest } = rest;
|
|
10885
|
+
const { className, onChange: consumerOnChange, onBlur: consumerOnBlur, ...inputRest } = rest;
|
|
10875
10886
|
const prefix = usePrefix();
|
|
10876
10887
|
const preset = useVariantPreset();
|
|
10877
10888
|
const contextBordered = useBordered();
|
|
@@ -10904,13 +10915,21 @@ var FormInput = ({ name, type, formLabel, formDescription, required = false, dis
|
|
|
10904
10915
|
field.onChange(val);
|
|
10905
10916
|
consumerOnChange?.(val);
|
|
10906
10917
|
};
|
|
10918
|
+
const nativeFieldBinding = nativeFieldTypes.has(type) ? {
|
|
10919
|
+
name: field.name,
|
|
10920
|
+
onBlur: (event) => {
|
|
10921
|
+
field.onBlur();
|
|
10922
|
+
consumerOnBlur?.(event);
|
|
10923
|
+
},
|
|
10924
|
+
ref: field.ref
|
|
10925
|
+
} : {};
|
|
10907
10926
|
return /* @__PURE__ */ jsxs(FormItem, { className: slot.item, children: [
|
|
10908
10927
|
formLabel && /* @__PURE__ */ jsxs(FormLabel, { className: slot.label, children: [
|
|
10909
10928
|
icon && /* @__PURE__ */ jsx(NIcon, { icon, size: 16, className: "shrink-0 text-muted-foreground" }),
|
|
10910
10929
|
formLabel,
|
|
10911
10930
|
required && !disabled && !readOnly && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
10912
10931
|
] }),
|
|
10913
|
-
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(InputComponent, { value: field.value ?? getDefaultValue(), onChange: handleChange, status: hasError && !isHidden ? "error" : "default", bordered: contextBordered, icon: formLabel ? void 0 : icon, iconColor: formLabel ? void 0 : iconColor, disabled, readOnly, ...inputRest, className: slot.input }) }),
|
|
10932
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(InputComponent, { value: field.value ?? getDefaultValue(), onChange: handleChange, status: hasError && !isHidden ? "error" : "default", bordered: contextBordered, icon: formLabel ? void 0 : icon, iconColor: formLabel ? void 0 : iconColor, disabled, readOnly, ...inputRest, ...nativeFieldBinding, className: slot.input }) }),
|
|
10914
10933
|
!hasError && !disabled && !readOnly && formDescription && /* @__PURE__ */ jsx(FormDescription, { className: slot.description, children: formDescription }),
|
|
10915
10934
|
!isHidden && /* @__PURE__ */ jsx(FormMessage, { className: slot.error })
|
|
10916
10935
|
] });
|
|
@@ -12039,8 +12058,8 @@ function useTable(effectiveViewModeOverride) {
|
|
|
12039
12058
|
...effectiveColumns,
|
|
12040
12059
|
{
|
|
12041
12060
|
id: "actions",
|
|
12042
|
-
header: () => isMenuActions ? null :
|
|
12043
|
-
cell: ({ row }) =>
|
|
12061
|
+
header: () => isMenuActions ? null : React66__default.createElement("div", { className: "flex w-full justify-start text-left" }, "Actions"),
|
|
12062
|
+
cell: ({ row }) => React66__default.createElement(TableActionCell, { row, onView, onEdit, onDelete, openRowMenu, menuButton, bordered }),
|
|
12044
12063
|
enableSorting: false,
|
|
12045
12064
|
enableHiding: false
|
|
12046
12065
|
}
|
|
@@ -12303,10 +12322,10 @@ function EditableCell({ cell, onCellEdit }) {
|
|
|
12303
12322
|
const columnId = cell.column.id;
|
|
12304
12323
|
const editor = meta.editor || "text";
|
|
12305
12324
|
const initial = cell.getValue();
|
|
12306
|
-
const [editing, setEditing] =
|
|
12307
|
-
const [value, setValue] =
|
|
12308
|
-
const [saving, setSaving] =
|
|
12309
|
-
|
|
12325
|
+
const [editing, setEditing] = React66__default.useState(false);
|
|
12326
|
+
const [value, setValue] = React66__default.useState(initial);
|
|
12327
|
+
const [saving, setSaving] = React66__default.useState(false);
|
|
12328
|
+
React66__default.useEffect(() => {
|
|
12310
12329
|
if (!editing) setValue(initial);
|
|
12311
12330
|
}, [initial, editing]);
|
|
12312
12331
|
const commit = async (next) => {
|
|
@@ -12480,7 +12499,7 @@ function NTableContent({ effectiveMode }) {
|
|
|
12480
12499
|
const isExpanded = canExpand && row.getIsExpanded();
|
|
12481
12500
|
const totalCols = row.getVisibleCells().length + (showCheckbox ? 1 : 0) + (hasExpansion ? 1 : 0);
|
|
12482
12501
|
const rowClassName = getRowClassName?.(row.original);
|
|
12483
|
-
return /* @__PURE__ */ jsxs(
|
|
12502
|
+
return /* @__PURE__ */ jsxs(React66__default.Fragment, { children: [
|
|
12484
12503
|
/* @__PURE__ */ jsxs(
|
|
12485
12504
|
TableRow,
|
|
12486
12505
|
{
|
|
@@ -12739,7 +12758,7 @@ function NTableCardSkeleton({ surface }) {
|
|
|
12739
12758
|
}
|
|
12740
12759
|
function NTableLoadingSkeleton({ rows }) {
|
|
12741
12760
|
const rawColumns = useTableStore.use.columns();
|
|
12742
|
-
const responsiveColumns =
|
|
12761
|
+
const responsiveColumns = React66__default.useMemo(() => filterResponsiveColumns(rawColumns), [rawColumns]);
|
|
12743
12762
|
const columns = responsiveColumns;
|
|
12744
12763
|
const showCheckbox = useTableStore.use.showCheckbox();
|
|
12745
12764
|
const headerClassName = useTableStore.use.headerClassName();
|
|
@@ -12862,19 +12881,19 @@ function useCardContinuation({
|
|
|
12862
12881
|
rowCount,
|
|
12863
12882
|
viewportRef
|
|
12864
12883
|
}) {
|
|
12865
|
-
const [internalPending, setInternalPending] =
|
|
12866
|
-
const [internalError, setInternalError] =
|
|
12867
|
-
const [announcement, setAnnouncement] =
|
|
12868
|
-
const [viewportReady, setViewportReady] =
|
|
12869
|
-
const pendingRef =
|
|
12870
|
-
const previousRowCountRef =
|
|
12871
|
-
const configRef =
|
|
12884
|
+
const [internalPending, setInternalPending] = React66__default.useState(false);
|
|
12885
|
+
const [internalError, setInternalError] = React66__default.useState(null);
|
|
12886
|
+
const [announcement, setAnnouncement] = React66__default.useState("");
|
|
12887
|
+
const [viewportReady, setViewportReady] = React66__default.useState(false);
|
|
12888
|
+
const pendingRef = React66__default.useRef(false);
|
|
12889
|
+
const previousRowCountRef = React66__default.useRef(rowCount);
|
|
12890
|
+
const configRef = React66__default.useRef(config);
|
|
12872
12891
|
configRef.current = config;
|
|
12873
12892
|
const enabled = Boolean(config);
|
|
12874
12893
|
const pending = Boolean(config?.loadingMore || internalPending);
|
|
12875
12894
|
const error = config?.loadMoreError ?? internalError;
|
|
12876
12895
|
const hasNextPage = Boolean(config?.hasNextPage);
|
|
12877
|
-
const load =
|
|
12896
|
+
const load = React66__default.useCallback(async () => {
|
|
12878
12897
|
const current = configRef.current;
|
|
12879
12898
|
if (!current) return;
|
|
12880
12899
|
if (pendingRef.current || current.loadingMore || !current.hasNextPage) return;
|
|
@@ -12899,13 +12918,13 @@ function useCardContinuation({
|
|
|
12899
12918
|
load,
|
|
12900
12919
|
{ rootMargin: config?.rootMargin ?? DEFAULT_ROOT_MARGIN }
|
|
12901
12920
|
);
|
|
12902
|
-
|
|
12921
|
+
React66__default.useLayoutEffect(() => {
|
|
12903
12922
|
const node = viewportRef.current ?? null;
|
|
12904
12923
|
scrollContainerRef.current = node;
|
|
12905
12924
|
const ready = Boolean(node);
|
|
12906
12925
|
setViewportReady((value) => value === ready ? value : ready);
|
|
12907
12926
|
});
|
|
12908
|
-
|
|
12927
|
+
React66__default.useEffect(() => {
|
|
12909
12928
|
const previous = previousRowCountRef.current;
|
|
12910
12929
|
previousRowCountRef.current = rowCount;
|
|
12911
12930
|
if (!configRef.current) return;
|
|
@@ -12915,10 +12934,10 @@ function useCardContinuation({
|
|
|
12915
12934
|
configRef.current.itemsLoadedLabel?.(appended) ?? `${appended} more ${appended === 1 ? "item" : "items"} loaded.`
|
|
12916
12935
|
);
|
|
12917
12936
|
}, [rowCount]);
|
|
12918
|
-
|
|
12937
|
+
React66__default.useEffect(() => {
|
|
12919
12938
|
if (!pending) doneLoading();
|
|
12920
12939
|
}, [pending, doneLoading]);
|
|
12921
|
-
|
|
12940
|
+
React66__default.useEffect(() => {
|
|
12922
12941
|
if (!enabled || !hasNextPage || error) return;
|
|
12923
12942
|
return observe();
|
|
12924
12943
|
}, [enabled, hasNextPage, error, observe, viewportReady, rowCount]);
|
|
@@ -12972,7 +12991,7 @@ function NTableCards({ effectiveMode }) {
|
|
|
12972
12991
|
const cardPagination = useTableStore.use.cardPagination();
|
|
12973
12992
|
const cardColumnCount = useTableStore.use.cardColumnCount();
|
|
12974
12993
|
const surface = useTableSurfaceAppearance(bordered, borderColor);
|
|
12975
|
-
const viewportRef =
|
|
12994
|
+
const viewportRef = React66__default.useRef(null);
|
|
12976
12995
|
const continuationConfig = cardPagination.mode === "infinite" ? cardPagination : null;
|
|
12977
12996
|
const continuation = useCardContinuation({
|
|
12978
12997
|
config: continuationConfig,
|
|
@@ -13193,17 +13212,17 @@ function CardLoadMorePagination({
|
|
|
13193
13212
|
bordered,
|
|
13194
13213
|
className
|
|
13195
13214
|
}) {
|
|
13196
|
-
const [internalPending, setInternalPending] =
|
|
13197
|
-
const [internalError, setInternalError] =
|
|
13198
|
-
const [announcement, setAnnouncement] =
|
|
13199
|
-
const buttonRef =
|
|
13200
|
-
const pendingRef =
|
|
13201
|
-
const restoreFocusRef =
|
|
13202
|
-
const previousRowCountRef =
|
|
13203
|
-
const errorId =
|
|
13215
|
+
const [internalPending, setInternalPending] = React66__default.useState(false);
|
|
13216
|
+
const [internalError, setInternalError] = React66__default.useState(null);
|
|
13217
|
+
const [announcement, setAnnouncement] = React66__default.useState("");
|
|
13218
|
+
const buttonRef = React66__default.useRef(null);
|
|
13219
|
+
const pendingRef = React66__default.useRef(false);
|
|
13220
|
+
const restoreFocusRef = React66__default.useRef(false);
|
|
13221
|
+
const previousRowCountRef = React66__default.useRef(rowCount);
|
|
13222
|
+
const errorId = React66__default.useId();
|
|
13204
13223
|
const pending = Boolean(config.loadingMore || internalPending);
|
|
13205
13224
|
const error = config.loadMoreError ?? internalError;
|
|
13206
|
-
|
|
13225
|
+
React66__default.useEffect(() => {
|
|
13207
13226
|
const previous = previousRowCountRef.current;
|
|
13208
13227
|
if (rowCount > previous) {
|
|
13209
13228
|
const appended = rowCount - previous;
|
|
@@ -13213,7 +13232,7 @@ function CardLoadMorePagination({
|
|
|
13213
13232
|
}
|
|
13214
13233
|
previousRowCountRef.current = rowCount;
|
|
13215
13234
|
}, [config.itemsLoadedLabel, rowCount]);
|
|
13216
|
-
|
|
13235
|
+
React66__default.useEffect(() => {
|
|
13217
13236
|
if (pending || !restoreFocusRef.current) return;
|
|
13218
13237
|
restoreFocusRef.current = false;
|
|
13219
13238
|
const frame = requestAnimationFrame(() => buttonRef.current?.focus());
|
|
@@ -13283,9 +13302,9 @@ function CardLoadMorePagination({
|
|
|
13283
13302
|
var navButtonClass = "h-8 w-8 p-0 text-foreground disabled:text-muted-foreground disabled:opacity-70";
|
|
13284
13303
|
var chevronClass = "h-4 w-4 rtl:-scale-x-100";
|
|
13285
13304
|
function useLowerBoundPageCountWarning(manualPagination, pageCount, pagination) {
|
|
13286
|
-
const previous =
|
|
13287
|
-
const warned =
|
|
13288
|
-
|
|
13305
|
+
const previous = React66__default.useRef(null);
|
|
13306
|
+
const warned = React66__default.useRef(false);
|
|
13307
|
+
React66__default.useEffect(() => {
|
|
13289
13308
|
if (typeof console === "undefined") return;
|
|
13290
13309
|
if (typeof process !== "undefined" && process.env?.NODE_ENV === "production") return;
|
|
13291
13310
|
if (!manualPagination || pageCount === void 0 || !pagination) {
|
|
@@ -15176,7 +15195,7 @@ function NNavbar({
|
|
|
15176
15195
|
(userMenuActions.length > 0 || onLogout) && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
15177
15196
|
userMenuActions.map((action) => {
|
|
15178
15197
|
const ActionIcon = action.icon;
|
|
15179
|
-
return /* @__PURE__ */ jsxs(
|
|
15198
|
+
return /* @__PURE__ */ jsxs(React66__default.Fragment, { children: [
|
|
15180
15199
|
action.separator && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
15181
15200
|
/* @__PURE__ */ jsxs(DropdownMenuItem, { onClick: action.onClick, className: "cursor-pointer", children: [
|
|
15182
15201
|
ActionIcon && /* @__PURE__ */ jsx(ActionIcon, { className: "h-4 w-4 mr-2" }),
|
package/dist/query.mjs
CHANGED
|
@@ -73,7 +73,13 @@ function useResponsiveOffsetList({
|
|
|
73
73
|
}
|
|
74
74
|
}, [allDowngraded, queryIdentity, maxLimit]);
|
|
75
75
|
const mode = wantsAll && !allDowngraded ? "all" : wantsInfinite || allDowngraded ? "infinite" : "paged";
|
|
76
|
-
const
|
|
76
|
+
const bufferedPages = Math.max(
|
|
77
|
+
1,
|
|
78
|
+
Math.ceil(rows.length / pagination.pageSize)
|
|
79
|
+
);
|
|
80
|
+
const pageCount = buffer.total !== null ? Math.max(1, Math.ceil(buffer.total / pagination.pageSize)) : buffer.hasNextPage ? bufferedPages + 1 : bufferedPages;
|
|
81
|
+
const pageIndex = mode === "paged" ? Math.min(pagination.pageIndex, pageCount - 1) : pagination.pageIndex;
|
|
82
|
+
const start = pageIndex * pagination.pageSize;
|
|
77
83
|
const data = mode === "paged" ? rows.slice(start, start + pagination.pageSize) : rows;
|
|
78
84
|
const { fetchNextPage, hasNextPage, isFetchingNextPage } = buffer;
|
|
79
85
|
useEffect(() => {
|
|
@@ -101,11 +107,14 @@ function useResponsiveOffsetList({
|
|
|
101
107
|
},
|
|
102
108
|
[queryIdentity]
|
|
103
109
|
);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (pagination.pageIndex === pageIndex) return;
|
|
112
|
+
setPagination((current) => ({
|
|
113
|
+
...current,
|
|
114
|
+
pageIndex: Math.min(current.pageIndex, pageCount - 1),
|
|
115
|
+
queryIdentity
|
|
116
|
+
}));
|
|
117
|
+
}, [pageCount, pageIndex, pagination.pageIndex, queryIdentity]);
|
|
109
118
|
return {
|
|
110
119
|
cardViewport,
|
|
111
120
|
mode,
|
|
@@ -123,7 +132,7 @@ function useResponsiveOffsetList({
|
|
|
123
132
|
onPaginationChange,
|
|
124
133
|
pageCount,
|
|
125
134
|
pagination: {
|
|
126
|
-
pageIndex
|
|
135
|
+
pageIndex,
|
|
127
136
|
pageSize: pagination.pageSize
|
|
128
137
|
},
|
|
129
138
|
refetch: buffer.refetch
|
package/dist/theme.css
CHANGED
|
@@ -307,10 +307,10 @@ input:autofill {
|
|
|
307
307
|
overflow-x: auto;
|
|
308
308
|
scrollbar-width: none;
|
|
309
309
|
}
|
|
310
|
-
.najm-overlay-scroll-x::-webkit-scrollbar {
|
|
311
|
-
display: none;
|
|
312
|
-
}
|
|
313
|
-
|
|
310
|
+
.najm-overlay-scroll-x::-webkit-scrollbar {
|
|
311
|
+
display: none;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
314
|
/* Responsive table actions stay discoverable on touch and tablet layouts.
|
|
315
315
|
Fine-pointer desktops may keep the quieter hover/focus reveal treatment. */
|
|
316
316
|
.ntable-card-action {
|
|
@@ -367,7 +367,7 @@ input:autofill {
|
|
|
367
367
|
.nimage-input-compact-overlay:focus-visible {
|
|
368
368
|
opacity: 1;
|
|
369
369
|
}
|
|
370
|
-
}
|
|
370
|
+
}
|
|
371
371
|
|
|
372
372
|
/* OverlayScrollbars theme used by the <NajmScroll> component — a thin,
|
|
373
373
|
translucent slate bar that floats over content with no reserved space.
|