@dimaan/ui 0.0.12 → 0.0.14
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 +452 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +388 -107
- package/dist/index.d.ts +388 -107
- package/dist/index.js +426 -85
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React10 from 'react';
|
|
2
|
-
import React10__default, { createContext, forwardRef, Children, isValidElement, cloneElement, useRef, useImperativeHandle, useLayoutEffect, useId,
|
|
2
|
+
import React10__default, { createContext, forwardRef, Children, isValidElement, cloneElement, useRef, useImperativeHandle, useLayoutEffect, useId, useState, useMemo, useCallback, createElement, useEffect, useContext } from 'react';
|
|
3
3
|
import * as ReactDOM from 'react-dom';
|
|
4
4
|
import { DirectionProvider } from '@radix-ui/react-direction';
|
|
5
5
|
import { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
8
|
-
import { Loader2, Check, Minus, ChevronDown, ChevronUp, ArrowLeft,
|
|
8
|
+
import { Loader2, Check, Minus, Calendar, X, ChevronLeft, ChevronRight, ChevronDown, ChevronUp, ArrowLeft, Menu, ChevronsUpDown, Search, RefreshCw, Inbox, SearchX } from 'lucide-react';
|
|
9
|
+
import * as RadixPopover from '@radix-ui/react-popover';
|
|
10
|
+
import { DayPicker } from 'react-day-picker';
|
|
9
11
|
import * as RadixDropdown from '@radix-ui/react-dropdown-menu';
|
|
10
12
|
import { useFormContext, Controller } from 'react-hook-form';
|
|
11
13
|
import * as RadixSelect from '@radix-ui/react-select';
|
|
@@ -16096,6 +16098,255 @@ var Checkbox = forwardRef(function Checkbox2({
|
|
|
16096
16098
|
] });
|
|
16097
16099
|
});
|
|
16098
16100
|
|
|
16101
|
+
// src/components/date-picker/datePickerVariants.ts
|
|
16102
|
+
var datePickerTriggerVariantClass = {
|
|
16103
|
+
default: "border border-input bg-background hover:border-ring",
|
|
16104
|
+
filled: "border border-transparent bg-muted hover:bg-muted/80",
|
|
16105
|
+
ghost: "border border-transparent bg-transparent hover:bg-accent"
|
|
16106
|
+
};
|
|
16107
|
+
var datePickerTriggerSizeClass = {
|
|
16108
|
+
sm: "h-8 rounded-md ps-2.5 pe-8 text-sm gap-1.5",
|
|
16109
|
+
md: "h-9 rounded-md ps-3 pe-9 text-sm gap-2",
|
|
16110
|
+
lg: "h-11 rounded-md ps-4 pe-10 text-base gap-2"
|
|
16111
|
+
};
|
|
16112
|
+
var datePickerTriggerBaseClass = "group/datepicker relative inline-flex w-full items-center text-foreground outline-none transition-[background-color,border-color,box-shadow] focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-visible:ring-destructive/40 disabled:pointer-events-none disabled:opacity-50 cursor-pointer";
|
|
16113
|
+
var datePickerPlaceholderClass = "truncate text-muted-foreground";
|
|
16114
|
+
var datePickerValueClass = "truncate text-foreground";
|
|
16115
|
+
var datePickerContentClass = "z-50 overflow-hidden rounded-md border border-border bg-popover p-3 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95";
|
|
16116
|
+
var datePickerCalendarClass = "text-sm";
|
|
16117
|
+
var datePickerCaptionClass = "flex items-center justify-between gap-2 pb-2 text-sm font-semibold";
|
|
16118
|
+
var datePickerNavButtonClass = "inline-flex h-7 w-7 items-center justify-center rounded-md border border-input bg-background text-foreground transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50";
|
|
16119
|
+
var datePickerDayWrapperClass = "p-0 text-center";
|
|
16120
|
+
var datePickerDayBaseClass = "inline-flex h-8 w-8 items-center justify-center rounded-md text-sm text-foreground font-normal transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40";
|
|
16121
|
+
var datePickerSelectedClass = "[&_button]:bg-primary [&_button]:text-primary-foreground [&_button]:hover:bg-primary [&_button]:hover:text-primary-foreground";
|
|
16122
|
+
var datePickerTodayClass = "[&_button]:font-semibold [&_button]:ring-1 [&_button]:ring-inset [&_button]:ring-ring/40";
|
|
16123
|
+
var datePickerOutsideClass = "[&_button]:text-muted-foreground [&_button]:opacity-60";
|
|
16124
|
+
var datePickerDisabledClass = "[&_button]:pointer-events-none [&_button]:opacity-40";
|
|
16125
|
+
var datePickerWeekdayClass = "h-8 w-8 text-center text-xs font-medium text-muted-foreground";
|
|
16126
|
+
var datePickerWeekClass = "flex w-full";
|
|
16127
|
+
var datePickerWeekdaysClass = "flex w-full";
|
|
16128
|
+
var datePickerMonthGridClass = "w-full border-collapse";
|
|
16129
|
+
var datePickerMonthsClass = "flex flex-col gap-3";
|
|
16130
|
+
var datePickerMonthClass = "flex flex-col gap-2";
|
|
16131
|
+
var datePickerNavClass = "flex items-center gap-1";
|
|
16132
|
+
var DEFAULT_FORMAT_OPTIONS = { dateStyle: "medium" };
|
|
16133
|
+
var ISO_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
16134
|
+
var DatePicker = forwardRef(function DatePicker2({
|
|
16135
|
+
variant = "default",
|
|
16136
|
+
inputSize = "md",
|
|
16137
|
+
value: controlledValue,
|
|
16138
|
+
defaultValue,
|
|
16139
|
+
onValueChange,
|
|
16140
|
+
onChange,
|
|
16141
|
+
onBlur,
|
|
16142
|
+
name,
|
|
16143
|
+
id,
|
|
16144
|
+
disabled,
|
|
16145
|
+
required,
|
|
16146
|
+
min,
|
|
16147
|
+
max,
|
|
16148
|
+
placeholder,
|
|
16149
|
+
clearable = true,
|
|
16150
|
+
clearLabel = "Clear date",
|
|
16151
|
+
locale,
|
|
16152
|
+
formatOptions = DEFAULT_FORMAT_OPTIONS,
|
|
16153
|
+
side = "bottom",
|
|
16154
|
+
align = "start",
|
|
16155
|
+
"aria-invalid": ariaInvalid,
|
|
16156
|
+
"aria-describedby": ariaDescribedBy,
|
|
16157
|
+
"aria-label": ariaLabel,
|
|
16158
|
+
className,
|
|
16159
|
+
contentClassName
|
|
16160
|
+
}, ref) {
|
|
16161
|
+
const generatedId = useId();
|
|
16162
|
+
const triggerId = id ?? generatedId;
|
|
16163
|
+
const dir = useDirection();
|
|
16164
|
+
const [open, setOpen] = useState(false);
|
|
16165
|
+
const [internalValue, setInternalValue] = useState(defaultValue ?? "");
|
|
16166
|
+
const isControlled = controlledValue !== void 0;
|
|
16167
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
16168
|
+
const selectedDate = useMemo(() => parseIsoDate(value), [value]);
|
|
16169
|
+
const minDate = useMemo(() => parseIsoDate(min), [min]);
|
|
16170
|
+
const maxDate = useMemo(() => parseIsoDate(max), [max]);
|
|
16171
|
+
const disabledMatcher = useMemo(() => {
|
|
16172
|
+
const matchers = [];
|
|
16173
|
+
if (minDate) matchers.push({ before: minDate });
|
|
16174
|
+
if (maxDate) matchers.push({ after: maxDate });
|
|
16175
|
+
return matchers.length > 0 ? matchers : void 0;
|
|
16176
|
+
}, [minDate, maxDate]);
|
|
16177
|
+
const localeForFormat = readDocumentLocale();
|
|
16178
|
+
const displayValue = useMemo(() => {
|
|
16179
|
+
if (!selectedDate) return null;
|
|
16180
|
+
try {
|
|
16181
|
+
return new Intl.DateTimeFormat(localeForFormat, formatOptions).format(selectedDate);
|
|
16182
|
+
} catch {
|
|
16183
|
+
return formatIsoDate(selectedDate);
|
|
16184
|
+
}
|
|
16185
|
+
}, [selectedDate, localeForFormat, formatOptions]);
|
|
16186
|
+
const emitChange = useCallback(
|
|
16187
|
+
(next) => {
|
|
16188
|
+
if (!isControlled) {
|
|
16189
|
+
setInternalValue(next);
|
|
16190
|
+
}
|
|
16191
|
+
onValueChange?.(next);
|
|
16192
|
+
if (onChange) {
|
|
16193
|
+
const synthetic = {
|
|
16194
|
+
target: { value: next, name },
|
|
16195
|
+
currentTarget: { value: next, name },
|
|
16196
|
+
type: "change"
|
|
16197
|
+
};
|
|
16198
|
+
onChange(synthetic);
|
|
16199
|
+
}
|
|
16200
|
+
},
|
|
16201
|
+
[isControlled, onValueChange, onChange, name]
|
|
16202
|
+
);
|
|
16203
|
+
const handleSelect = useCallback(
|
|
16204
|
+
(date) => {
|
|
16205
|
+
if (!date) {
|
|
16206
|
+
emitChange("");
|
|
16207
|
+
return;
|
|
16208
|
+
}
|
|
16209
|
+
emitChange(formatIsoDate(date));
|
|
16210
|
+
setOpen(false);
|
|
16211
|
+
},
|
|
16212
|
+
[emitChange]
|
|
16213
|
+
);
|
|
16214
|
+
const handleClear = useCallback(
|
|
16215
|
+
(event) => {
|
|
16216
|
+
event.preventDefault();
|
|
16217
|
+
event.stopPropagation();
|
|
16218
|
+
emitChange("");
|
|
16219
|
+
},
|
|
16220
|
+
[emitChange]
|
|
16221
|
+
);
|
|
16222
|
+
const showClear = clearable && !disabled && Boolean(value);
|
|
16223
|
+
const PrevIcon = dir === "rtl" ? ChevronRight : ChevronLeft;
|
|
16224
|
+
const NextIcon = dir === "rtl" ? ChevronLeft : ChevronRight;
|
|
16225
|
+
return /* @__PURE__ */ jsxs(RadixPopover.Root, { open, onOpenChange: setOpen, children: [
|
|
16226
|
+
/* @__PURE__ */ jsxs("div", { className: "relative inline-flex w-full", children: [
|
|
16227
|
+
/* @__PURE__ */ jsx(RadixPopover.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
16228
|
+
"button",
|
|
16229
|
+
{
|
|
16230
|
+
ref,
|
|
16231
|
+
id: triggerId,
|
|
16232
|
+
type: "button",
|
|
16233
|
+
disabled,
|
|
16234
|
+
"aria-label": ariaLabel,
|
|
16235
|
+
"aria-invalid": ariaInvalid,
|
|
16236
|
+
"aria-describedby": ariaDescribedBy,
|
|
16237
|
+
onBlur,
|
|
16238
|
+
"data-slot": "date-picker-trigger",
|
|
16239
|
+
"data-state": open ? "open" : "closed",
|
|
16240
|
+
"data-placeholder": value ? void 0 : "",
|
|
16241
|
+
className: cn(
|
|
16242
|
+
datePickerTriggerBaseClass,
|
|
16243
|
+
datePickerTriggerVariantClass[variant],
|
|
16244
|
+
datePickerTriggerSizeClass[inputSize],
|
|
16245
|
+
showClear && (inputSize === "lg" ? "pe-16" : "pe-14"),
|
|
16246
|
+
className
|
|
16247
|
+
),
|
|
16248
|
+
children: [
|
|
16249
|
+
/* @__PURE__ */ jsx("span", { className: displayValue ? datePickerValueClass : datePickerPlaceholderClass, children: displayValue ?? placeholder ?? "" }),
|
|
16250
|
+
/* @__PURE__ */ jsx(
|
|
16251
|
+
Calendar,
|
|
16252
|
+
{
|
|
16253
|
+
"aria-hidden": "true",
|
|
16254
|
+
className: "pointer-events-none absolute end-3 top-1/2 size-4 shrink-0 -translate-y-1/2 text-muted-foreground"
|
|
16255
|
+
}
|
|
16256
|
+
)
|
|
16257
|
+
]
|
|
16258
|
+
}
|
|
16259
|
+
) }),
|
|
16260
|
+
showClear ? /* @__PURE__ */ jsx(
|
|
16261
|
+
"button",
|
|
16262
|
+
{
|
|
16263
|
+
type: "button",
|
|
16264
|
+
tabIndex: -1,
|
|
16265
|
+
"aria-label": clearLabel,
|
|
16266
|
+
onClick: handleClear,
|
|
16267
|
+
"data-slot": "date-picker-clear",
|
|
16268
|
+
className: "absolute end-9 top-1/2 z-10 inline-flex size-5 -translate-y-1/2 items-center justify-center rounded-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",
|
|
16269
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true", className: "size-3.5" })
|
|
16270
|
+
}
|
|
16271
|
+
) : null,
|
|
16272
|
+
name ? /* @__PURE__ */ jsx("input", { type: "hidden", name, value, required, readOnly: true }) : null
|
|
16273
|
+
] }),
|
|
16274
|
+
/* @__PURE__ */ jsx(RadixPopover.Portal, { children: /* @__PURE__ */ jsx(
|
|
16275
|
+
RadixPopover.Content,
|
|
16276
|
+
{
|
|
16277
|
+
side,
|
|
16278
|
+
align,
|
|
16279
|
+
sideOffset: 4,
|
|
16280
|
+
"data-slot": "date-picker-content",
|
|
16281
|
+
className: cn(datePickerContentClass, contentClassName),
|
|
16282
|
+
onOpenAutoFocus: (autoFocusEvent) => {
|
|
16283
|
+
autoFocusEvent.preventDefault();
|
|
16284
|
+
},
|
|
16285
|
+
children: /* @__PURE__ */ jsx(
|
|
16286
|
+
DayPicker,
|
|
16287
|
+
{
|
|
16288
|
+
mode: "single",
|
|
16289
|
+
dir,
|
|
16290
|
+
selected: selectedDate ?? void 0,
|
|
16291
|
+
defaultMonth: selectedDate ?? void 0,
|
|
16292
|
+
onSelect: handleSelect,
|
|
16293
|
+
disabled: disabledMatcher,
|
|
16294
|
+
locale,
|
|
16295
|
+
showOutsideDays: true,
|
|
16296
|
+
className: datePickerCalendarClass,
|
|
16297
|
+
classNames: {
|
|
16298
|
+
months: datePickerMonthsClass,
|
|
16299
|
+
month: datePickerMonthClass,
|
|
16300
|
+
month_caption: datePickerCaptionClass,
|
|
16301
|
+
nav: datePickerNavClass,
|
|
16302
|
+
button_previous: datePickerNavButtonClass,
|
|
16303
|
+
button_next: datePickerNavButtonClass,
|
|
16304
|
+
month_grid: datePickerMonthGridClass,
|
|
16305
|
+
weekdays: datePickerWeekdaysClass,
|
|
16306
|
+
weekday: datePickerWeekdayClass,
|
|
16307
|
+
week: datePickerWeekClass,
|
|
16308
|
+
day: datePickerDayWrapperClass,
|
|
16309
|
+
day_button: datePickerDayBaseClass,
|
|
16310
|
+
selected: datePickerSelectedClass,
|
|
16311
|
+
today: datePickerTodayClass,
|
|
16312
|
+
outside: datePickerOutsideClass,
|
|
16313
|
+
disabled: datePickerDisabledClass
|
|
16314
|
+
},
|
|
16315
|
+
components: {
|
|
16316
|
+
Chevron: ({ orientation }) => {
|
|
16317
|
+
const Icon2 = orientation === "right" ? NextIcon : PrevIcon;
|
|
16318
|
+
return /* @__PURE__ */ jsx(Icon2, { "aria-hidden": "true", className: "size-4" });
|
|
16319
|
+
}
|
|
16320
|
+
}
|
|
16321
|
+
}
|
|
16322
|
+
)
|
|
16323
|
+
}
|
|
16324
|
+
) })
|
|
16325
|
+
] });
|
|
16326
|
+
});
|
|
16327
|
+
function parseIsoDate(value) {
|
|
16328
|
+
if (!value) return void 0;
|
|
16329
|
+
const match = value.match(ISO_DATE_PATTERN);
|
|
16330
|
+
if (!match) return void 0;
|
|
16331
|
+
const year = Number(match[1]);
|
|
16332
|
+
const month = Number(match[2]) - 1;
|
|
16333
|
+
const day = Number(match[3]);
|
|
16334
|
+
const date = new Date(year, month, day);
|
|
16335
|
+
if (Number.isNaN(date.getTime())) return void 0;
|
|
16336
|
+
return date;
|
|
16337
|
+
}
|
|
16338
|
+
function formatIsoDate(date) {
|
|
16339
|
+
const year = String(date.getFullYear()).padStart(4, "0");
|
|
16340
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
16341
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
16342
|
+
return `${year}-${month}-${day}`;
|
|
16343
|
+
}
|
|
16344
|
+
function readDocumentLocale() {
|
|
16345
|
+
if (typeof document === "undefined") return void 0;
|
|
16346
|
+
const lang = document.documentElement.getAttribute("lang");
|
|
16347
|
+
return lang || void 0;
|
|
16348
|
+
}
|
|
16349
|
+
|
|
16099
16350
|
// src/components/dropdown-menu/dropdownMenuVariants.ts
|
|
16100
16351
|
var dropdownMenuContentClass = "z-50 min-w-32 overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95";
|
|
16101
16352
|
var dropdownMenuItemBaseClass = "relative flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:size-4 [&_svg]:shrink-0";
|
|
@@ -16384,6 +16635,126 @@ function mergeRefs2(...refs) {
|
|
|
16384
16635
|
};
|
|
16385
16636
|
}
|
|
16386
16637
|
|
|
16638
|
+
// src/components/page-header/PageHeader.tsx
|
|
16639
|
+
var import_react_router_dom2 = __toESM(require_dist2());
|
|
16640
|
+
|
|
16641
|
+
// src/components/page-header/pageHeaderVariants.ts
|
|
16642
|
+
var pageHeaderBaseClass = "flex w-full flex-col gap-3";
|
|
16643
|
+
var pageHeaderBorderedClass = "border-b border-border pb-4";
|
|
16644
|
+
var pageHeaderTitleRowClass = "flex flex-wrap items-start justify-between gap-3 sm:gap-4";
|
|
16645
|
+
var pageHeaderTitleBlockClass = "min-w-0 flex-1 space-y-1";
|
|
16646
|
+
var pageHeaderTitleClass = "text-2xl font-semibold tracking-tight text-foreground";
|
|
16647
|
+
var pageHeaderDescriptionClass = "text-sm text-muted-foreground";
|
|
16648
|
+
var pageHeaderActionsClass = "flex shrink-0 flex-wrap items-center gap-2";
|
|
16649
|
+
var pageHeaderBackClass = "inline-flex items-center gap-1.5 self-start text-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-md";
|
|
16650
|
+
var pageHeaderBackIconClass = "size-4 shrink-0 rtl:rotate-180";
|
|
16651
|
+
var pageHeaderBreadcrumbsClass = "text-xs text-muted-foreground";
|
|
16652
|
+
var PageHeader = forwardRef(function PageHeader2({
|
|
16653
|
+
title,
|
|
16654
|
+
description,
|
|
16655
|
+
breadcrumbs,
|
|
16656
|
+
back,
|
|
16657
|
+
actions,
|
|
16658
|
+
as = "h1",
|
|
16659
|
+
bordered = false,
|
|
16660
|
+
className,
|
|
16661
|
+
...props
|
|
16662
|
+
}, ref) {
|
|
16663
|
+
return /* @__PURE__ */ jsxs(
|
|
16664
|
+
"header",
|
|
16665
|
+
{
|
|
16666
|
+
ref,
|
|
16667
|
+
"data-slot": "page-header",
|
|
16668
|
+
className: cn(pageHeaderBaseClass, bordered && pageHeaderBorderedClass, className),
|
|
16669
|
+
...props,
|
|
16670
|
+
children: [
|
|
16671
|
+
breadcrumbs ? /* @__PURE__ */ jsx("div", { "data-slot": "page-header-breadcrumbs", className: pageHeaderBreadcrumbsClass, children: breadcrumbs }) : null,
|
|
16672
|
+
back ? /* @__PURE__ */ jsx(PageHeaderBack, { ...back }) : null,
|
|
16673
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "page-header-row", className: pageHeaderTitleRowClass, children: [
|
|
16674
|
+
/* @__PURE__ */ jsxs("div", { className: pageHeaderTitleBlockClass, children: [
|
|
16675
|
+
createElement(
|
|
16676
|
+
as,
|
|
16677
|
+
{ "data-slot": "page-header-title", className: pageHeaderTitleClass },
|
|
16678
|
+
title
|
|
16679
|
+
),
|
|
16680
|
+
description ? /* @__PURE__ */ jsx("p", { "data-slot": "page-header-description", className: pageHeaderDescriptionClass, children: description }) : null
|
|
16681
|
+
] }),
|
|
16682
|
+
actions ? /* @__PURE__ */ jsx("div", { "data-slot": "page-header-actions", className: pageHeaderActionsClass, children: actions }) : null
|
|
16683
|
+
] })
|
|
16684
|
+
]
|
|
16685
|
+
}
|
|
16686
|
+
);
|
|
16687
|
+
});
|
|
16688
|
+
function PageHeaderBack({ label = "Back", to, onClick, render }) {
|
|
16689
|
+
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16690
|
+
/* @__PURE__ */ jsx(ArrowLeft, { className: pageHeaderBackIconClass, "aria-hidden": "true" }),
|
|
16691
|
+
/* @__PURE__ */ jsx("span", { children: label })
|
|
16692
|
+
] });
|
|
16693
|
+
if (render) {
|
|
16694
|
+
return render({
|
|
16695
|
+
to,
|
|
16696
|
+
onClick,
|
|
16697
|
+
className: pageHeaderBackClass,
|
|
16698
|
+
children: inner
|
|
16699
|
+
});
|
|
16700
|
+
}
|
|
16701
|
+
if (to) {
|
|
16702
|
+
return /* @__PURE__ */ jsx(import_react_router_dom2.Link, { to, onClick, className: pageHeaderBackClass, children: inner });
|
|
16703
|
+
}
|
|
16704
|
+
return /* @__PURE__ */ jsx("button", { type: "button", onClick, className: pageHeaderBackClass, children: inner });
|
|
16705
|
+
}
|
|
16706
|
+
|
|
16707
|
+
// src/components/form-page/formPageVariants.ts
|
|
16708
|
+
var formPageBaseClass = "flex w-full flex-col gap-6";
|
|
16709
|
+
var formPageBodyClass = "flex-1";
|
|
16710
|
+
var formPageActionsBarClass = "sticky bottom-0 -mx-6 -mb-6 mt-6 flex items-center justify-end gap-2 border-t border-border bg-background/95 px-6 py-3 backdrop-blur supports-[backdrop-filter]:bg-background/80";
|
|
16711
|
+
var formPageSkeletonRowClass = "h-10 w-full animate-pulse rounded-md bg-muted";
|
|
16712
|
+
var DEFAULT_SKELETON_ROW_COUNT = 6;
|
|
16713
|
+
function FormPage({
|
|
16714
|
+
title,
|
|
16715
|
+
description,
|
|
16716
|
+
back,
|
|
16717
|
+
bordered = true,
|
|
16718
|
+
onSubmit,
|
|
16719
|
+
isLoading = false,
|
|
16720
|
+
loadingRowCount = DEFAULT_SKELETON_ROW_COUNT,
|
|
16721
|
+
actions,
|
|
16722
|
+
children,
|
|
16723
|
+
className,
|
|
16724
|
+
formClassName,
|
|
16725
|
+
bodyClassName,
|
|
16726
|
+
actionsClassName
|
|
16727
|
+
}) {
|
|
16728
|
+
return /* @__PURE__ */ jsxs("div", { "data-slot": "form-page", className: cn(formPageBaseClass, className), children: [
|
|
16729
|
+
/* @__PURE__ */ jsx(PageHeader, { title, description, back, bordered }),
|
|
16730
|
+
/* @__PURE__ */ jsxs(
|
|
16731
|
+
"form",
|
|
16732
|
+
{
|
|
16733
|
+
onSubmit,
|
|
16734
|
+
"aria-busy": isLoading || void 0,
|
|
16735
|
+
noValidate: true,
|
|
16736
|
+
"data-slot": "form-page-form",
|
|
16737
|
+
className: cn("flex flex-1 flex-col gap-6", formClassName),
|
|
16738
|
+
children: [
|
|
16739
|
+
/* @__PURE__ */ jsx("div", { "data-slot": "form-page-body", className: cn(formPageBodyClass, bodyClassName), children: isLoading ? /* @__PURE__ */ jsx(FormPageSkeleton, { rowCount: loadingRowCount }) : children }),
|
|
16740
|
+
actions !== null && actions !== void 0 ? /* @__PURE__ */ jsx(
|
|
16741
|
+
"div",
|
|
16742
|
+
{
|
|
16743
|
+
"data-slot": "form-page-actions",
|
|
16744
|
+
className: cn(formPageActionsBarClass, actionsClassName),
|
|
16745
|
+
children: actions
|
|
16746
|
+
}
|
|
16747
|
+
) : null
|
|
16748
|
+
]
|
|
16749
|
+
}
|
|
16750
|
+
)
|
|
16751
|
+
] });
|
|
16752
|
+
}
|
|
16753
|
+
function FormPageSkeleton({ rowCount }) {
|
|
16754
|
+
const rows = Array.from({ length: Math.max(1, rowCount) }, (_, i) => `form-page-skeleton-${i}`);
|
|
16755
|
+
return /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", "aria-hidden": "true", children: rows.map((key) => /* @__PURE__ */ jsx("div", { "data-testid": "form-page-skeleton-row", className: formPageSkeletonRowClass }, key)) });
|
|
16756
|
+
}
|
|
16757
|
+
|
|
16387
16758
|
// src/components/input/inputVariants.ts
|
|
16388
16759
|
var inputVariantClass = {
|
|
16389
16760
|
default: "border border-input bg-background hover:border-ring",
|
|
@@ -16499,75 +16870,6 @@ function LanguageSwitcher({
|
|
|
16499
16870
|
);
|
|
16500
16871
|
}
|
|
16501
16872
|
|
|
16502
|
-
// src/components/page-header/PageHeader.tsx
|
|
16503
|
-
var import_react_router_dom2 = __toESM(require_dist2());
|
|
16504
|
-
|
|
16505
|
-
// src/components/page-header/pageHeaderVariants.ts
|
|
16506
|
-
var pageHeaderBaseClass = "flex w-full flex-col gap-3";
|
|
16507
|
-
var pageHeaderBorderedClass = "border-b border-border pb-4";
|
|
16508
|
-
var pageHeaderTitleRowClass = "flex flex-wrap items-start justify-between gap-3 sm:gap-4";
|
|
16509
|
-
var pageHeaderTitleBlockClass = "min-w-0 flex-1 space-y-1";
|
|
16510
|
-
var pageHeaderTitleClass = "text-2xl font-semibold tracking-tight text-foreground";
|
|
16511
|
-
var pageHeaderDescriptionClass = "text-sm text-muted-foreground";
|
|
16512
|
-
var pageHeaderActionsClass = "flex shrink-0 flex-wrap items-center gap-2";
|
|
16513
|
-
var pageHeaderBackClass = "inline-flex items-center gap-1.5 self-start text-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background rounded-md";
|
|
16514
|
-
var pageHeaderBackIconClass = "size-4 shrink-0 rtl:rotate-180";
|
|
16515
|
-
var pageHeaderBreadcrumbsClass = "text-xs text-muted-foreground";
|
|
16516
|
-
var PageHeader = forwardRef(function PageHeader2({
|
|
16517
|
-
title,
|
|
16518
|
-
description,
|
|
16519
|
-
breadcrumbs,
|
|
16520
|
-
back,
|
|
16521
|
-
actions,
|
|
16522
|
-
as = "h1",
|
|
16523
|
-
bordered = false,
|
|
16524
|
-
className,
|
|
16525
|
-
...props
|
|
16526
|
-
}, ref) {
|
|
16527
|
-
return /* @__PURE__ */ jsxs(
|
|
16528
|
-
"header",
|
|
16529
|
-
{
|
|
16530
|
-
ref,
|
|
16531
|
-
"data-slot": "page-header",
|
|
16532
|
-
className: cn(pageHeaderBaseClass, bordered && pageHeaderBorderedClass, className),
|
|
16533
|
-
...props,
|
|
16534
|
-
children: [
|
|
16535
|
-
breadcrumbs ? /* @__PURE__ */ jsx("div", { "data-slot": "page-header-breadcrumbs", className: pageHeaderBreadcrumbsClass, children: breadcrumbs }) : null,
|
|
16536
|
-
back ? /* @__PURE__ */ jsx(PageHeaderBack, { ...back }) : null,
|
|
16537
|
-
/* @__PURE__ */ jsxs("div", { "data-slot": "page-header-row", className: pageHeaderTitleRowClass, children: [
|
|
16538
|
-
/* @__PURE__ */ jsxs("div", { className: pageHeaderTitleBlockClass, children: [
|
|
16539
|
-
createElement(
|
|
16540
|
-
as,
|
|
16541
|
-
{ "data-slot": "page-header-title", className: pageHeaderTitleClass },
|
|
16542
|
-
title
|
|
16543
|
-
),
|
|
16544
|
-
description ? /* @__PURE__ */ jsx("p", { "data-slot": "page-header-description", className: pageHeaderDescriptionClass, children: description }) : null
|
|
16545
|
-
] }),
|
|
16546
|
-
actions ? /* @__PURE__ */ jsx("div", { "data-slot": "page-header-actions", className: pageHeaderActionsClass, children: actions }) : null
|
|
16547
|
-
] })
|
|
16548
|
-
]
|
|
16549
|
-
}
|
|
16550
|
-
);
|
|
16551
|
-
});
|
|
16552
|
-
function PageHeaderBack({ label = "Back", to, onClick, render }) {
|
|
16553
|
-
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16554
|
-
/* @__PURE__ */ jsx(ArrowLeft, { className: pageHeaderBackIconClass, "aria-hidden": "true" }),
|
|
16555
|
-
/* @__PURE__ */ jsx("span", { children: label })
|
|
16556
|
-
] });
|
|
16557
|
-
if (render) {
|
|
16558
|
-
return render({
|
|
16559
|
-
to,
|
|
16560
|
-
onClick,
|
|
16561
|
-
className: pageHeaderBackClass,
|
|
16562
|
-
children: inner
|
|
16563
|
-
});
|
|
16564
|
-
}
|
|
16565
|
-
if (to) {
|
|
16566
|
-
return /* @__PURE__ */ jsx(import_react_router_dom2.Link, { to, onClick, className: pageHeaderBackClass, children: inner });
|
|
16567
|
-
}
|
|
16568
|
-
return /* @__PURE__ */ jsx("button", { type: "button", onClick, className: pageHeaderBackClass, children: inner });
|
|
16569
|
-
}
|
|
16570
|
-
|
|
16571
16873
|
// src/components/select/selectVariants.ts
|
|
16572
16874
|
var selectVariantClass = {
|
|
16573
16875
|
default: "border border-input bg-background hover:border-ring",
|
|
@@ -17185,7 +17487,9 @@ var DEFAULT_LABELS = {
|
|
|
17185
17487
|
searchAriaLabel: "Search",
|
|
17186
17488
|
reset: "Reset filters",
|
|
17187
17489
|
emptyTitle: "No results",
|
|
17188
|
-
emptyDescription: "Try clearing the search or adjusting the filters."
|
|
17490
|
+
emptyDescription: "Try clearing the search or adjusting the filters.",
|
|
17491
|
+
noDataTitle: "No data yet",
|
|
17492
|
+
noDataDescription: "Nothing has been added here so far."
|
|
17189
17493
|
};
|
|
17190
17494
|
var FILTER_WIDTH_CLASS = {
|
|
17191
17495
|
narrow: "w-32",
|
|
@@ -17200,11 +17504,14 @@ function ListPage({
|
|
|
17200
17504
|
data: data2,
|
|
17201
17505
|
columns,
|
|
17202
17506
|
getRowId,
|
|
17507
|
+
isLoading = false,
|
|
17508
|
+
loadingRowCount,
|
|
17203
17509
|
searchKeys,
|
|
17204
17510
|
filters,
|
|
17205
17511
|
enableRowSelection,
|
|
17206
17512
|
bulkActions,
|
|
17207
17513
|
emptyState,
|
|
17514
|
+
noDataState,
|
|
17208
17515
|
labels: labelsProp,
|
|
17209
17516
|
className
|
|
17210
17517
|
}) {
|
|
@@ -17255,6 +17562,7 @@ function ListPage({
|
|
|
17255
17562
|
});
|
|
17256
17563
|
}, [data2, search, searchKeys, filters, filterValues]);
|
|
17257
17564
|
const showFilterBar = Boolean(searchKeys?.length) || Boolean(filters?.length);
|
|
17565
|
+
const tableMode = isLoading ? "loading" : data2.length === 0 && !hasActiveFilters ? "no-data" : filtered.length === 0 ? "no-results" : "rows";
|
|
17258
17566
|
return /* @__PURE__ */ jsxs("div", { "data-slot": "list-page", className: cn("space-y-6", className), children: [
|
|
17259
17567
|
/* @__PURE__ */ jsx(PageHeader, { title, description, bordered, actions }),
|
|
17260
17568
|
showFilterBar ? /* @__PURE__ */ jsxs("div", { "data-slot": "list-page-filter-bar", className: "flex flex-wrap items-center gap-3", children: [
|
|
@@ -17267,7 +17575,8 @@ function ListPage({
|
|
|
17267
17575
|
value: search,
|
|
17268
17576
|
onChange: (e) => setSearch(e.target.value),
|
|
17269
17577
|
leadingIcon: /* @__PURE__ */ jsx(Search, {}),
|
|
17270
|
-
wrapperClassName: "sm:max-w-xs"
|
|
17578
|
+
wrapperClassName: "sm:max-w-xs",
|
|
17579
|
+
disabled: isLoading
|
|
17271
17580
|
}
|
|
17272
17581
|
) : null,
|
|
17273
17582
|
filters?.map((f) => /* @__PURE__ */ jsx(
|
|
@@ -17277,16 +17586,17 @@ function ListPage({
|
|
|
17277
17586
|
value: filterValues[f.key],
|
|
17278
17587
|
onValueChange: (v) => setFilter(f.key, v),
|
|
17279
17588
|
options: f.options,
|
|
17280
|
-
className: FILTER_WIDTH_CLASS[f.width ?? "default"]
|
|
17589
|
+
className: FILTER_WIDTH_CLASS[f.width ?? "default"],
|
|
17590
|
+
disabled: isLoading
|
|
17281
17591
|
},
|
|
17282
17592
|
f.key
|
|
17283
17593
|
)),
|
|
17284
|
-
hasActiveFilters ? /* @__PURE__ */ jsxs(Button, { variant: "ghost", onClick: reset, children: [
|
|
17594
|
+
hasActiveFilters && !isLoading ? /* @__PURE__ */ jsxs(Button, { variant: "ghost", onClick: reset, children: [
|
|
17285
17595
|
/* @__PURE__ */ jsx(RefreshCw, {}),
|
|
17286
17596
|
labels.reset
|
|
17287
17597
|
] }) : null
|
|
17288
17598
|
] }) : null,
|
|
17289
|
-
|
|
17599
|
+
tableMode === "loading" || tableMode === "rows" ? /* @__PURE__ */ jsx(
|
|
17290
17600
|
Table,
|
|
17291
17601
|
{
|
|
17292
17602
|
"aria-label": typeof title === "string" ? title : void 0,
|
|
@@ -17294,17 +17604,48 @@ function ListPage({
|
|
|
17294
17604
|
columns,
|
|
17295
17605
|
getRowId,
|
|
17296
17606
|
enableRowSelection,
|
|
17297
|
-
bulkActions
|
|
17607
|
+
bulkActions,
|
|
17608
|
+
loading: isLoading,
|
|
17609
|
+
loadingRowCount
|
|
17298
17610
|
}
|
|
17299
|
-
) :
|
|
17300
|
-
|
|
17611
|
+
) : tableMode === "no-data" ? /* @__PURE__ */ jsx(
|
|
17612
|
+
"div",
|
|
17301
17613
|
{
|
|
17302
|
-
|
|
17303
|
-
|
|
17304
|
-
|
|
17305
|
-
|
|
17614
|
+
"data-slot": "list-page-empty",
|
|
17615
|
+
"data-state": "no-data",
|
|
17616
|
+
className: "rounded-md border border-border bg-card",
|
|
17617
|
+
children: /* @__PURE__ */ jsx(
|
|
17618
|
+
EmptyState,
|
|
17619
|
+
{
|
|
17620
|
+
size: "lg",
|
|
17621
|
+
icon: noDataState?.icon ?? /* @__PURE__ */ jsx(Inbox, {}),
|
|
17622
|
+
title: noDataState?.title ?? labels.noDataTitle,
|
|
17623
|
+
description: noDataState?.description ?? labels.noDataDescription,
|
|
17624
|
+
action: noDataState?.action !== void 0 ? noDataState.action : null
|
|
17625
|
+
}
|
|
17626
|
+
)
|
|
17306
17627
|
}
|
|
17307
|
-
)
|
|
17628
|
+
) : /* @__PURE__ */ jsx(
|
|
17629
|
+
"div",
|
|
17630
|
+
{
|
|
17631
|
+
"data-slot": "list-page-empty",
|
|
17632
|
+
"data-state": "no-results",
|
|
17633
|
+
className: "rounded-md border border-border bg-card",
|
|
17634
|
+
children: /* @__PURE__ */ jsx(
|
|
17635
|
+
EmptyState,
|
|
17636
|
+
{
|
|
17637
|
+
size: "lg",
|
|
17638
|
+
icon: emptyState?.icon ?? /* @__PURE__ */ jsx(SearchX, {}),
|
|
17639
|
+
title: emptyState?.title ?? labels.emptyTitle,
|
|
17640
|
+
description: emptyState?.description ?? labels.emptyDescription,
|
|
17641
|
+
action: emptyState?.action !== void 0 ? emptyState.action : /* @__PURE__ */ jsxs(Button, { variant: "outline", onClick: reset, children: [
|
|
17642
|
+
/* @__PURE__ */ jsx(RefreshCw, {}),
|
|
17643
|
+
labels.reset
|
|
17644
|
+
] })
|
|
17645
|
+
}
|
|
17646
|
+
)
|
|
17647
|
+
}
|
|
17648
|
+
)
|
|
17308
17649
|
] });
|
|
17309
17650
|
}
|
|
17310
17651
|
|
|
@@ -17603,6 +17944,6 @@ react-router-dom/dist/index.js:
|
|
|
17603
17944
|
*)
|
|
17604
17945
|
*/
|
|
17605
17946
|
|
|
17606
|
-
export { AppShell, Avatar, Badge, Button, Checkbox, DashboardContent, DashboardHeader, DashboardLayout, DashboardMain, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, EmptyState, Field, HeaderActions, HeaderCollapseTrigger, HeaderMobileTrigger, HeaderSearch, HeaderTitle, Input, LanguageSwitcher, ListPage, PageHeader, RadioGroup, RadioGroupItem, Select, Sidebar, SidebarFooter, SidebarGroup, SidebarHeader, SidebarNav, SidebarNavGroup, SidebarNavItem, Switch, Table, Textarea, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, inputBaseClass, inputSizeClass, inputVariantClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, useDashboardLayout, useDirection };
|
|
17947
|
+
export { AppShell, Avatar, Badge, Button, Checkbox, DashboardContent, DashboardHeader, DashboardLayout, DashboardMain, DatePicker, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger, EmptyState, Field, FormPage, HeaderActions, HeaderCollapseTrigger, HeaderMobileTrigger, HeaderSearch, HeaderTitle, Input, LanguageSwitcher, ListPage, PageHeader, RadioGroup, RadioGroupItem, Select, Sidebar, SidebarFooter, SidebarGroup, SidebarHeader, SidebarNav, SidebarNavGroup, SidebarNavItem, Switch, Table, Textarea, badgeBaseClass, badgeDotSizeClass, badgeSizeClass, badgeVariantClass, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, datePickerCalendarClass, datePickerCaptionClass, datePickerContentClass, datePickerDayBaseClass, datePickerDayWrapperClass, datePickerDisabledClass, datePickerMonthClass, datePickerMonthGridClass, datePickerMonthsClass, datePickerNavButtonClass, datePickerNavClass, datePickerOutsideClass, datePickerPlaceholderClass, datePickerSelectedClass, datePickerTodayClass, datePickerTriggerBaseClass, datePickerTriggerSizeClass, datePickerTriggerVariantClass, datePickerValueClass, datePickerWeekClass, datePickerWeekdayClass, datePickerWeekdaysClass, dropdownMenuContentClass, dropdownMenuItemBaseClass, dropdownMenuItemInsetClass, dropdownMenuItemVariantClass, dropdownMenuLabelClass, dropdownMenuSeparatorClass, dropdownMenuShortcutClass, emptyStateActionsSpacingClass, emptyStateBaseClass, emptyStateContainerSizeClass, emptyStateDescriptionSizeClass, emptyStateIconWrapperBaseClass, emptyStateIconWrapperSizeClass, emptyStateTitleSizeClass, formPageActionsBarClass, formPageBaseClass, formPageBodyClass, formPageSkeletonRowClass, inputBaseClass, inputSizeClass, inputVariantClass, pageHeaderActionsClass, pageHeaderBackClass, pageHeaderBackIconClass, pageHeaderBaseClass, pageHeaderBorderedClass, pageHeaderBreadcrumbsClass, pageHeaderDescriptionClass, pageHeaderTitleBlockClass, pageHeaderTitleClass, pageHeaderTitleRowClass, radioGroupBaseClass, radioGroupOrientationClass, radioIndicatorBaseClass, radioIndicatorDotClass, radioIndicatorSizeClass, radioItemBaseClass, radioItemSizeClass, radioLabelSizeClass, radioOptionRowClass, selectBaseClass, selectSizeClass, selectVariantClass, switchThumbBaseClass, switchThumbClass, switchTrackBaseClass, switchTrackClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, useDashboardLayout, useDirection };
|
|
17607
17948
|
//# sourceMappingURL=index.js.map
|
|
17608
17949
|
//# sourceMappingURL=index.js.map
|