@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.cjs
CHANGED
|
@@ -7,6 +7,8 @@ var clsx = require('clsx');
|
|
|
7
7
|
var tailwindMerge = require('tailwind-merge');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
var lucideReact = require('lucide-react');
|
|
10
|
+
var RadixPopover = require('@radix-ui/react-popover');
|
|
11
|
+
var reactDayPicker = require('react-day-picker');
|
|
10
12
|
var RadixDropdown = require('@radix-ui/react-dropdown-menu');
|
|
11
13
|
var reactHookForm = require('react-hook-form');
|
|
12
14
|
var RadixSelect = require('@radix-ui/react-select');
|
|
@@ -33,6 +35,7 @@ function _interopNamespace(e) {
|
|
|
33
35
|
|
|
34
36
|
var React10__namespace = /*#__PURE__*/_interopNamespace(React10);
|
|
35
37
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
38
|
+
var RadixPopover__namespace = /*#__PURE__*/_interopNamespace(RadixPopover);
|
|
36
39
|
var RadixDropdown__namespace = /*#__PURE__*/_interopNamespace(RadixDropdown);
|
|
37
40
|
var RadixSelect__namespace = /*#__PURE__*/_interopNamespace(RadixSelect);
|
|
38
41
|
var RadixRadioGroup__namespace = /*#__PURE__*/_interopNamespace(RadixRadioGroup);
|
|
@@ -16122,6 +16125,255 @@ var Checkbox = React10.forwardRef(function Checkbox2({
|
|
|
16122
16125
|
] });
|
|
16123
16126
|
});
|
|
16124
16127
|
|
|
16128
|
+
// src/components/date-picker/datePickerVariants.ts
|
|
16129
|
+
var datePickerTriggerVariantClass = {
|
|
16130
|
+
default: "border border-input bg-background hover:border-ring",
|
|
16131
|
+
filled: "border border-transparent bg-muted hover:bg-muted/80",
|
|
16132
|
+
ghost: "border border-transparent bg-transparent hover:bg-accent"
|
|
16133
|
+
};
|
|
16134
|
+
var datePickerTriggerSizeClass = {
|
|
16135
|
+
sm: "h-8 rounded-md ps-2.5 pe-8 text-sm gap-1.5",
|
|
16136
|
+
md: "h-9 rounded-md ps-3 pe-9 text-sm gap-2",
|
|
16137
|
+
lg: "h-11 rounded-md ps-4 pe-10 text-base gap-2"
|
|
16138
|
+
};
|
|
16139
|
+
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";
|
|
16140
|
+
var datePickerPlaceholderClass = "truncate text-muted-foreground";
|
|
16141
|
+
var datePickerValueClass = "truncate text-foreground";
|
|
16142
|
+
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";
|
|
16143
|
+
var datePickerCalendarClass = "text-sm";
|
|
16144
|
+
var datePickerCaptionClass = "flex items-center justify-between gap-2 pb-2 text-sm font-semibold";
|
|
16145
|
+
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";
|
|
16146
|
+
var datePickerDayWrapperClass = "p-0 text-center";
|
|
16147
|
+
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";
|
|
16148
|
+
var datePickerSelectedClass = "[&_button]:bg-primary [&_button]:text-primary-foreground [&_button]:hover:bg-primary [&_button]:hover:text-primary-foreground";
|
|
16149
|
+
var datePickerTodayClass = "[&_button]:font-semibold [&_button]:ring-1 [&_button]:ring-inset [&_button]:ring-ring/40";
|
|
16150
|
+
var datePickerOutsideClass = "[&_button]:text-muted-foreground [&_button]:opacity-60";
|
|
16151
|
+
var datePickerDisabledClass = "[&_button]:pointer-events-none [&_button]:opacity-40";
|
|
16152
|
+
var datePickerWeekdayClass = "h-8 w-8 text-center text-xs font-medium text-muted-foreground";
|
|
16153
|
+
var datePickerWeekClass = "flex w-full";
|
|
16154
|
+
var datePickerWeekdaysClass = "flex w-full";
|
|
16155
|
+
var datePickerMonthGridClass = "w-full border-collapse";
|
|
16156
|
+
var datePickerMonthsClass = "flex flex-col gap-3";
|
|
16157
|
+
var datePickerMonthClass = "flex flex-col gap-2";
|
|
16158
|
+
var datePickerNavClass = "flex items-center gap-1";
|
|
16159
|
+
var DEFAULT_FORMAT_OPTIONS = { dateStyle: "medium" };
|
|
16160
|
+
var ISO_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
16161
|
+
var DatePicker = React10.forwardRef(function DatePicker2({
|
|
16162
|
+
variant = "default",
|
|
16163
|
+
inputSize = "md",
|
|
16164
|
+
value: controlledValue,
|
|
16165
|
+
defaultValue,
|
|
16166
|
+
onValueChange,
|
|
16167
|
+
onChange,
|
|
16168
|
+
onBlur,
|
|
16169
|
+
name,
|
|
16170
|
+
id,
|
|
16171
|
+
disabled,
|
|
16172
|
+
required,
|
|
16173
|
+
min,
|
|
16174
|
+
max,
|
|
16175
|
+
placeholder,
|
|
16176
|
+
clearable = true,
|
|
16177
|
+
clearLabel = "Clear date",
|
|
16178
|
+
locale,
|
|
16179
|
+
formatOptions = DEFAULT_FORMAT_OPTIONS,
|
|
16180
|
+
side = "bottom",
|
|
16181
|
+
align = "start",
|
|
16182
|
+
"aria-invalid": ariaInvalid,
|
|
16183
|
+
"aria-describedby": ariaDescribedBy,
|
|
16184
|
+
"aria-label": ariaLabel,
|
|
16185
|
+
className,
|
|
16186
|
+
contentClassName
|
|
16187
|
+
}, ref) {
|
|
16188
|
+
const generatedId = React10.useId();
|
|
16189
|
+
const triggerId = id ?? generatedId;
|
|
16190
|
+
const dir = useDirection();
|
|
16191
|
+
const [open, setOpen] = React10.useState(false);
|
|
16192
|
+
const [internalValue, setInternalValue] = React10.useState(defaultValue ?? "");
|
|
16193
|
+
const isControlled = controlledValue !== void 0;
|
|
16194
|
+
const value = isControlled ? controlledValue : internalValue;
|
|
16195
|
+
const selectedDate = React10.useMemo(() => parseIsoDate(value), [value]);
|
|
16196
|
+
const minDate = React10.useMemo(() => parseIsoDate(min), [min]);
|
|
16197
|
+
const maxDate = React10.useMemo(() => parseIsoDate(max), [max]);
|
|
16198
|
+
const disabledMatcher = React10.useMemo(() => {
|
|
16199
|
+
const matchers = [];
|
|
16200
|
+
if (minDate) matchers.push({ before: minDate });
|
|
16201
|
+
if (maxDate) matchers.push({ after: maxDate });
|
|
16202
|
+
return matchers.length > 0 ? matchers : void 0;
|
|
16203
|
+
}, [minDate, maxDate]);
|
|
16204
|
+
const localeForFormat = readDocumentLocale();
|
|
16205
|
+
const displayValue = React10.useMemo(() => {
|
|
16206
|
+
if (!selectedDate) return null;
|
|
16207
|
+
try {
|
|
16208
|
+
return new Intl.DateTimeFormat(localeForFormat, formatOptions).format(selectedDate);
|
|
16209
|
+
} catch {
|
|
16210
|
+
return formatIsoDate(selectedDate);
|
|
16211
|
+
}
|
|
16212
|
+
}, [selectedDate, localeForFormat, formatOptions]);
|
|
16213
|
+
const emitChange = React10.useCallback(
|
|
16214
|
+
(next) => {
|
|
16215
|
+
if (!isControlled) {
|
|
16216
|
+
setInternalValue(next);
|
|
16217
|
+
}
|
|
16218
|
+
onValueChange?.(next);
|
|
16219
|
+
if (onChange) {
|
|
16220
|
+
const synthetic = {
|
|
16221
|
+
target: { value: next, name },
|
|
16222
|
+
currentTarget: { value: next, name },
|
|
16223
|
+
type: "change"
|
|
16224
|
+
};
|
|
16225
|
+
onChange(synthetic);
|
|
16226
|
+
}
|
|
16227
|
+
},
|
|
16228
|
+
[isControlled, onValueChange, onChange, name]
|
|
16229
|
+
);
|
|
16230
|
+
const handleSelect = React10.useCallback(
|
|
16231
|
+
(date) => {
|
|
16232
|
+
if (!date) {
|
|
16233
|
+
emitChange("");
|
|
16234
|
+
return;
|
|
16235
|
+
}
|
|
16236
|
+
emitChange(formatIsoDate(date));
|
|
16237
|
+
setOpen(false);
|
|
16238
|
+
},
|
|
16239
|
+
[emitChange]
|
|
16240
|
+
);
|
|
16241
|
+
const handleClear = React10.useCallback(
|
|
16242
|
+
(event) => {
|
|
16243
|
+
event.preventDefault();
|
|
16244
|
+
event.stopPropagation();
|
|
16245
|
+
emitChange("");
|
|
16246
|
+
},
|
|
16247
|
+
[emitChange]
|
|
16248
|
+
);
|
|
16249
|
+
const showClear = clearable && !disabled && Boolean(value);
|
|
16250
|
+
const PrevIcon = dir === "rtl" ? lucideReact.ChevronRight : lucideReact.ChevronLeft;
|
|
16251
|
+
const NextIcon = dir === "rtl" ? lucideReact.ChevronLeft : lucideReact.ChevronRight;
|
|
16252
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(RadixPopover__namespace.Root, { open, onOpenChange: setOpen, children: [
|
|
16253
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative inline-flex w-full", children: [
|
|
16254
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16255
|
+
"button",
|
|
16256
|
+
{
|
|
16257
|
+
ref,
|
|
16258
|
+
id: triggerId,
|
|
16259
|
+
type: "button",
|
|
16260
|
+
disabled,
|
|
16261
|
+
"aria-label": ariaLabel,
|
|
16262
|
+
"aria-invalid": ariaInvalid,
|
|
16263
|
+
"aria-describedby": ariaDescribedBy,
|
|
16264
|
+
onBlur,
|
|
16265
|
+
"data-slot": "date-picker-trigger",
|
|
16266
|
+
"data-state": open ? "open" : "closed",
|
|
16267
|
+
"data-placeholder": value ? void 0 : "",
|
|
16268
|
+
className: cn(
|
|
16269
|
+
datePickerTriggerBaseClass,
|
|
16270
|
+
datePickerTriggerVariantClass[variant],
|
|
16271
|
+
datePickerTriggerSizeClass[inputSize],
|
|
16272
|
+
showClear && (inputSize === "lg" ? "pe-16" : "pe-14"),
|
|
16273
|
+
className
|
|
16274
|
+
),
|
|
16275
|
+
children: [
|
|
16276
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: displayValue ? datePickerValueClass : datePickerPlaceholderClass, children: displayValue ?? placeholder ?? "" }),
|
|
16277
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16278
|
+
lucideReact.Calendar,
|
|
16279
|
+
{
|
|
16280
|
+
"aria-hidden": "true",
|
|
16281
|
+
className: "pointer-events-none absolute end-3 top-1/2 size-4 shrink-0 -translate-y-1/2 text-muted-foreground"
|
|
16282
|
+
}
|
|
16283
|
+
)
|
|
16284
|
+
]
|
|
16285
|
+
}
|
|
16286
|
+
) }),
|
|
16287
|
+
showClear ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
16288
|
+
"button",
|
|
16289
|
+
{
|
|
16290
|
+
type: "button",
|
|
16291
|
+
tabIndex: -1,
|
|
16292
|
+
"aria-label": clearLabel,
|
|
16293
|
+
onClick: handleClear,
|
|
16294
|
+
"data-slot": "date-picker-clear",
|
|
16295
|
+
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",
|
|
16296
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { "aria-hidden": "true", className: "size-3.5" })
|
|
16297
|
+
}
|
|
16298
|
+
) : null,
|
|
16299
|
+
name ? /* @__PURE__ */ jsxRuntime.jsx("input", { type: "hidden", name, value, required, readOnly: true }) : null
|
|
16300
|
+
] }),
|
|
16301
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadixPopover__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16302
|
+
RadixPopover__namespace.Content,
|
|
16303
|
+
{
|
|
16304
|
+
side,
|
|
16305
|
+
align,
|
|
16306
|
+
sideOffset: 4,
|
|
16307
|
+
"data-slot": "date-picker-content",
|
|
16308
|
+
className: cn(datePickerContentClass, contentClassName),
|
|
16309
|
+
onOpenAutoFocus: (autoFocusEvent) => {
|
|
16310
|
+
autoFocusEvent.preventDefault();
|
|
16311
|
+
},
|
|
16312
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16313
|
+
reactDayPicker.DayPicker,
|
|
16314
|
+
{
|
|
16315
|
+
mode: "single",
|
|
16316
|
+
dir,
|
|
16317
|
+
selected: selectedDate ?? void 0,
|
|
16318
|
+
defaultMonth: selectedDate ?? void 0,
|
|
16319
|
+
onSelect: handleSelect,
|
|
16320
|
+
disabled: disabledMatcher,
|
|
16321
|
+
locale,
|
|
16322
|
+
showOutsideDays: true,
|
|
16323
|
+
className: datePickerCalendarClass,
|
|
16324
|
+
classNames: {
|
|
16325
|
+
months: datePickerMonthsClass,
|
|
16326
|
+
month: datePickerMonthClass,
|
|
16327
|
+
month_caption: datePickerCaptionClass,
|
|
16328
|
+
nav: datePickerNavClass,
|
|
16329
|
+
button_previous: datePickerNavButtonClass,
|
|
16330
|
+
button_next: datePickerNavButtonClass,
|
|
16331
|
+
month_grid: datePickerMonthGridClass,
|
|
16332
|
+
weekdays: datePickerWeekdaysClass,
|
|
16333
|
+
weekday: datePickerWeekdayClass,
|
|
16334
|
+
week: datePickerWeekClass,
|
|
16335
|
+
day: datePickerDayWrapperClass,
|
|
16336
|
+
day_button: datePickerDayBaseClass,
|
|
16337
|
+
selected: datePickerSelectedClass,
|
|
16338
|
+
today: datePickerTodayClass,
|
|
16339
|
+
outside: datePickerOutsideClass,
|
|
16340
|
+
disabled: datePickerDisabledClass
|
|
16341
|
+
},
|
|
16342
|
+
components: {
|
|
16343
|
+
Chevron: ({ orientation }) => {
|
|
16344
|
+
const Icon2 = orientation === "right" ? NextIcon : PrevIcon;
|
|
16345
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon2, { "aria-hidden": "true", className: "size-4" });
|
|
16346
|
+
}
|
|
16347
|
+
}
|
|
16348
|
+
}
|
|
16349
|
+
)
|
|
16350
|
+
}
|
|
16351
|
+
) })
|
|
16352
|
+
] });
|
|
16353
|
+
});
|
|
16354
|
+
function parseIsoDate(value) {
|
|
16355
|
+
if (!value) return void 0;
|
|
16356
|
+
const match = value.match(ISO_DATE_PATTERN);
|
|
16357
|
+
if (!match) return void 0;
|
|
16358
|
+
const year = Number(match[1]);
|
|
16359
|
+
const month = Number(match[2]) - 1;
|
|
16360
|
+
const day = Number(match[3]);
|
|
16361
|
+
const date = new Date(year, month, day);
|
|
16362
|
+
if (Number.isNaN(date.getTime())) return void 0;
|
|
16363
|
+
return date;
|
|
16364
|
+
}
|
|
16365
|
+
function formatIsoDate(date) {
|
|
16366
|
+
const year = String(date.getFullYear()).padStart(4, "0");
|
|
16367
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
16368
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
16369
|
+
return `${year}-${month}-${day}`;
|
|
16370
|
+
}
|
|
16371
|
+
function readDocumentLocale() {
|
|
16372
|
+
if (typeof document === "undefined") return void 0;
|
|
16373
|
+
const lang = document.documentElement.getAttribute("lang");
|
|
16374
|
+
return lang || void 0;
|
|
16375
|
+
}
|
|
16376
|
+
|
|
16125
16377
|
// src/components/dropdown-menu/dropdownMenuVariants.ts
|
|
16126
16378
|
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";
|
|
16127
16379
|
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";
|
|
@@ -16410,6 +16662,126 @@ function mergeRefs2(...refs) {
|
|
|
16410
16662
|
};
|
|
16411
16663
|
}
|
|
16412
16664
|
|
|
16665
|
+
// src/components/page-header/PageHeader.tsx
|
|
16666
|
+
var import_react_router_dom2 = __toESM(require_dist2());
|
|
16667
|
+
|
|
16668
|
+
// src/components/page-header/pageHeaderVariants.ts
|
|
16669
|
+
var pageHeaderBaseClass = "flex w-full flex-col gap-3";
|
|
16670
|
+
var pageHeaderBorderedClass = "border-b border-border pb-4";
|
|
16671
|
+
var pageHeaderTitleRowClass = "flex flex-wrap items-start justify-between gap-3 sm:gap-4";
|
|
16672
|
+
var pageHeaderTitleBlockClass = "min-w-0 flex-1 space-y-1";
|
|
16673
|
+
var pageHeaderTitleClass = "text-2xl font-semibold tracking-tight text-foreground";
|
|
16674
|
+
var pageHeaderDescriptionClass = "text-sm text-muted-foreground";
|
|
16675
|
+
var pageHeaderActionsClass = "flex shrink-0 flex-wrap items-center gap-2";
|
|
16676
|
+
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";
|
|
16677
|
+
var pageHeaderBackIconClass = "size-4 shrink-0 rtl:rotate-180";
|
|
16678
|
+
var pageHeaderBreadcrumbsClass = "text-xs text-muted-foreground";
|
|
16679
|
+
var PageHeader = React10.forwardRef(function PageHeader2({
|
|
16680
|
+
title,
|
|
16681
|
+
description,
|
|
16682
|
+
breadcrumbs,
|
|
16683
|
+
back,
|
|
16684
|
+
actions,
|
|
16685
|
+
as = "h1",
|
|
16686
|
+
bordered = false,
|
|
16687
|
+
className,
|
|
16688
|
+
...props
|
|
16689
|
+
}, ref) {
|
|
16690
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16691
|
+
"header",
|
|
16692
|
+
{
|
|
16693
|
+
ref,
|
|
16694
|
+
"data-slot": "page-header",
|
|
16695
|
+
className: cn(pageHeaderBaseClass, bordered && pageHeaderBorderedClass, className),
|
|
16696
|
+
...props,
|
|
16697
|
+
children: [
|
|
16698
|
+
breadcrumbs ? /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "page-header-breadcrumbs", className: pageHeaderBreadcrumbsClass, children: breadcrumbs }) : null,
|
|
16699
|
+
back ? /* @__PURE__ */ jsxRuntime.jsx(PageHeaderBack, { ...back }) : null,
|
|
16700
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "page-header-row", className: pageHeaderTitleRowClass, children: [
|
|
16701
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: pageHeaderTitleBlockClass, children: [
|
|
16702
|
+
React10.createElement(
|
|
16703
|
+
as,
|
|
16704
|
+
{ "data-slot": "page-header-title", className: pageHeaderTitleClass },
|
|
16705
|
+
title
|
|
16706
|
+
),
|
|
16707
|
+
description ? /* @__PURE__ */ jsxRuntime.jsx("p", { "data-slot": "page-header-description", className: pageHeaderDescriptionClass, children: description }) : null
|
|
16708
|
+
] }),
|
|
16709
|
+
actions ? /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "page-header-actions", className: pageHeaderActionsClass, children: actions }) : null
|
|
16710
|
+
] })
|
|
16711
|
+
]
|
|
16712
|
+
}
|
|
16713
|
+
);
|
|
16714
|
+
});
|
|
16715
|
+
function PageHeaderBack({ label = "Back", to, onClick, render }) {
|
|
16716
|
+
const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16717
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, { className: pageHeaderBackIconClass, "aria-hidden": "true" }),
|
|
16718
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label })
|
|
16719
|
+
] });
|
|
16720
|
+
if (render) {
|
|
16721
|
+
return render({
|
|
16722
|
+
to,
|
|
16723
|
+
onClick,
|
|
16724
|
+
className: pageHeaderBackClass,
|
|
16725
|
+
children: inner
|
|
16726
|
+
});
|
|
16727
|
+
}
|
|
16728
|
+
if (to) {
|
|
16729
|
+
return /* @__PURE__ */ jsxRuntime.jsx(import_react_router_dom2.Link, { to, onClick, className: pageHeaderBackClass, children: inner });
|
|
16730
|
+
}
|
|
16731
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick, className: pageHeaderBackClass, children: inner });
|
|
16732
|
+
}
|
|
16733
|
+
|
|
16734
|
+
// src/components/form-page/formPageVariants.ts
|
|
16735
|
+
var formPageBaseClass = "flex w-full flex-col gap-6";
|
|
16736
|
+
var formPageBodyClass = "flex-1";
|
|
16737
|
+
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";
|
|
16738
|
+
var formPageSkeletonRowClass = "h-10 w-full animate-pulse rounded-md bg-muted";
|
|
16739
|
+
var DEFAULT_SKELETON_ROW_COUNT = 6;
|
|
16740
|
+
function FormPage({
|
|
16741
|
+
title,
|
|
16742
|
+
description,
|
|
16743
|
+
back,
|
|
16744
|
+
bordered = true,
|
|
16745
|
+
onSubmit,
|
|
16746
|
+
isLoading = false,
|
|
16747
|
+
loadingRowCount = DEFAULT_SKELETON_ROW_COUNT,
|
|
16748
|
+
actions,
|
|
16749
|
+
children,
|
|
16750
|
+
className,
|
|
16751
|
+
formClassName,
|
|
16752
|
+
bodyClassName,
|
|
16753
|
+
actionsClassName
|
|
16754
|
+
}) {
|
|
16755
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "form-page", className: cn(formPageBaseClass, className), children: [
|
|
16756
|
+
/* @__PURE__ */ jsxRuntime.jsx(PageHeader, { title, description, back, bordered }),
|
|
16757
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
16758
|
+
"form",
|
|
16759
|
+
{
|
|
16760
|
+
onSubmit,
|
|
16761
|
+
"aria-busy": isLoading || void 0,
|
|
16762
|
+
noValidate: true,
|
|
16763
|
+
"data-slot": "form-page-form",
|
|
16764
|
+
className: cn("flex flex-1 flex-col gap-6", formClassName),
|
|
16765
|
+
children: [
|
|
16766
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-page-body", className: cn(formPageBodyClass, bodyClassName), children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx(FormPageSkeleton, { rowCount: loadingRowCount }) : children }),
|
|
16767
|
+
actions !== null && actions !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
16768
|
+
"div",
|
|
16769
|
+
{
|
|
16770
|
+
"data-slot": "form-page-actions",
|
|
16771
|
+
className: cn(formPageActionsBarClass, actionsClassName),
|
|
16772
|
+
children: actions
|
|
16773
|
+
}
|
|
16774
|
+
) : null
|
|
16775
|
+
]
|
|
16776
|
+
}
|
|
16777
|
+
)
|
|
16778
|
+
] });
|
|
16779
|
+
}
|
|
16780
|
+
function FormPageSkeleton({ rowCount }) {
|
|
16781
|
+
const rows = Array.from({ length: Math.max(1, rowCount) }, (_, i) => `form-page-skeleton-${i}`);
|
|
16782
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", "aria-hidden": "true", children: rows.map((key) => /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "form-page-skeleton-row", className: formPageSkeletonRowClass }, key)) });
|
|
16783
|
+
}
|
|
16784
|
+
|
|
16413
16785
|
// src/components/input/inputVariants.ts
|
|
16414
16786
|
var inputVariantClass = {
|
|
16415
16787
|
default: "border border-input bg-background hover:border-ring",
|
|
@@ -16525,75 +16897,6 @@ function LanguageSwitcher({
|
|
|
16525
16897
|
);
|
|
16526
16898
|
}
|
|
16527
16899
|
|
|
16528
|
-
// src/components/page-header/PageHeader.tsx
|
|
16529
|
-
var import_react_router_dom2 = __toESM(require_dist2());
|
|
16530
|
-
|
|
16531
|
-
// src/components/page-header/pageHeaderVariants.ts
|
|
16532
|
-
var pageHeaderBaseClass = "flex w-full flex-col gap-3";
|
|
16533
|
-
var pageHeaderBorderedClass = "border-b border-border pb-4";
|
|
16534
|
-
var pageHeaderTitleRowClass = "flex flex-wrap items-start justify-between gap-3 sm:gap-4";
|
|
16535
|
-
var pageHeaderTitleBlockClass = "min-w-0 flex-1 space-y-1";
|
|
16536
|
-
var pageHeaderTitleClass = "text-2xl font-semibold tracking-tight text-foreground";
|
|
16537
|
-
var pageHeaderDescriptionClass = "text-sm text-muted-foreground";
|
|
16538
|
-
var pageHeaderActionsClass = "flex shrink-0 flex-wrap items-center gap-2";
|
|
16539
|
-
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";
|
|
16540
|
-
var pageHeaderBackIconClass = "size-4 shrink-0 rtl:rotate-180";
|
|
16541
|
-
var pageHeaderBreadcrumbsClass = "text-xs text-muted-foreground";
|
|
16542
|
-
var PageHeader = React10.forwardRef(function PageHeader2({
|
|
16543
|
-
title,
|
|
16544
|
-
description,
|
|
16545
|
-
breadcrumbs,
|
|
16546
|
-
back,
|
|
16547
|
-
actions,
|
|
16548
|
-
as = "h1",
|
|
16549
|
-
bordered = false,
|
|
16550
|
-
className,
|
|
16551
|
-
...props
|
|
16552
|
-
}, ref) {
|
|
16553
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16554
|
-
"header",
|
|
16555
|
-
{
|
|
16556
|
-
ref,
|
|
16557
|
-
"data-slot": "page-header",
|
|
16558
|
-
className: cn(pageHeaderBaseClass, bordered && pageHeaderBorderedClass, className),
|
|
16559
|
-
...props,
|
|
16560
|
-
children: [
|
|
16561
|
-
breadcrumbs ? /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "page-header-breadcrumbs", className: pageHeaderBreadcrumbsClass, children: breadcrumbs }) : null,
|
|
16562
|
-
back ? /* @__PURE__ */ jsxRuntime.jsx(PageHeaderBack, { ...back }) : null,
|
|
16563
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "page-header-row", className: pageHeaderTitleRowClass, children: [
|
|
16564
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: pageHeaderTitleBlockClass, children: [
|
|
16565
|
-
React10.createElement(
|
|
16566
|
-
as,
|
|
16567
|
-
{ "data-slot": "page-header-title", className: pageHeaderTitleClass },
|
|
16568
|
-
title
|
|
16569
|
-
),
|
|
16570
|
-
description ? /* @__PURE__ */ jsxRuntime.jsx("p", { "data-slot": "page-header-description", className: pageHeaderDescriptionClass, children: description }) : null
|
|
16571
|
-
] }),
|
|
16572
|
-
actions ? /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "page-header-actions", className: pageHeaderActionsClass, children: actions }) : null
|
|
16573
|
-
] })
|
|
16574
|
-
]
|
|
16575
|
-
}
|
|
16576
|
-
);
|
|
16577
|
-
});
|
|
16578
|
-
function PageHeaderBack({ label = "Back", to, onClick, render }) {
|
|
16579
|
-
const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16580
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, { className: pageHeaderBackIconClass, "aria-hidden": "true" }),
|
|
16581
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: label })
|
|
16582
|
-
] });
|
|
16583
|
-
if (render) {
|
|
16584
|
-
return render({
|
|
16585
|
-
to,
|
|
16586
|
-
onClick,
|
|
16587
|
-
className: pageHeaderBackClass,
|
|
16588
|
-
children: inner
|
|
16589
|
-
});
|
|
16590
|
-
}
|
|
16591
|
-
if (to) {
|
|
16592
|
-
return /* @__PURE__ */ jsxRuntime.jsx(import_react_router_dom2.Link, { to, onClick, className: pageHeaderBackClass, children: inner });
|
|
16593
|
-
}
|
|
16594
|
-
return /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick, className: pageHeaderBackClass, children: inner });
|
|
16595
|
-
}
|
|
16596
|
-
|
|
16597
16900
|
// src/components/select/selectVariants.ts
|
|
16598
16901
|
var selectVariantClass = {
|
|
16599
16902
|
default: "border border-input bg-background hover:border-ring",
|
|
@@ -17211,7 +17514,9 @@ var DEFAULT_LABELS = {
|
|
|
17211
17514
|
searchAriaLabel: "Search",
|
|
17212
17515
|
reset: "Reset filters",
|
|
17213
17516
|
emptyTitle: "No results",
|
|
17214
|
-
emptyDescription: "Try clearing the search or adjusting the filters."
|
|
17517
|
+
emptyDescription: "Try clearing the search or adjusting the filters.",
|
|
17518
|
+
noDataTitle: "No data yet",
|
|
17519
|
+
noDataDescription: "Nothing has been added here so far."
|
|
17215
17520
|
};
|
|
17216
17521
|
var FILTER_WIDTH_CLASS = {
|
|
17217
17522
|
narrow: "w-32",
|
|
@@ -17226,11 +17531,14 @@ function ListPage({
|
|
|
17226
17531
|
data: data2,
|
|
17227
17532
|
columns,
|
|
17228
17533
|
getRowId,
|
|
17534
|
+
isLoading = false,
|
|
17535
|
+
loadingRowCount,
|
|
17229
17536
|
searchKeys,
|
|
17230
17537
|
filters,
|
|
17231
17538
|
enableRowSelection,
|
|
17232
17539
|
bulkActions,
|
|
17233
17540
|
emptyState,
|
|
17541
|
+
noDataState,
|
|
17234
17542
|
labels: labelsProp,
|
|
17235
17543
|
className
|
|
17236
17544
|
}) {
|
|
@@ -17281,6 +17589,7 @@ function ListPage({
|
|
|
17281
17589
|
});
|
|
17282
17590
|
}, [data2, search, searchKeys, filters, filterValues]);
|
|
17283
17591
|
const showFilterBar = Boolean(searchKeys?.length) || Boolean(filters?.length);
|
|
17592
|
+
const tableMode = isLoading ? "loading" : data2.length === 0 && !hasActiveFilters ? "no-data" : filtered.length === 0 ? "no-results" : "rows";
|
|
17284
17593
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "list-page", className: cn("space-y-6", className), children: [
|
|
17285
17594
|
/* @__PURE__ */ jsxRuntime.jsx(PageHeader, { title, description, bordered, actions }),
|
|
17286
17595
|
showFilterBar ? /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-slot": "list-page-filter-bar", className: "flex flex-wrap items-center gap-3", children: [
|
|
@@ -17293,7 +17602,8 @@ function ListPage({
|
|
|
17293
17602
|
value: search,
|
|
17294
17603
|
onChange: (e) => setSearch(e.target.value),
|
|
17295
17604
|
leadingIcon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, {}),
|
|
17296
|
-
wrapperClassName: "sm:max-w-xs"
|
|
17605
|
+
wrapperClassName: "sm:max-w-xs",
|
|
17606
|
+
disabled: isLoading
|
|
17297
17607
|
}
|
|
17298
17608
|
) : null,
|
|
17299
17609
|
filters?.map((f) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -17303,16 +17613,17 @@ function ListPage({
|
|
|
17303
17613
|
value: filterValues[f.key],
|
|
17304
17614
|
onValueChange: (v) => setFilter(f.key, v),
|
|
17305
17615
|
options: f.options,
|
|
17306
|
-
className: FILTER_WIDTH_CLASS[f.width ?? "default"]
|
|
17616
|
+
className: FILTER_WIDTH_CLASS[f.width ?? "default"],
|
|
17617
|
+
disabled: isLoading
|
|
17307
17618
|
},
|
|
17308
17619
|
f.key
|
|
17309
17620
|
)),
|
|
17310
|
-
hasActiveFilters ? /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", onClick: reset, children: [
|
|
17621
|
+
hasActiveFilters && !isLoading ? /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", onClick: reset, children: [
|
|
17311
17622
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, {}),
|
|
17312
17623
|
labels.reset
|
|
17313
17624
|
] }) : null
|
|
17314
17625
|
] }) : null,
|
|
17315
|
-
|
|
17626
|
+
tableMode === "loading" || tableMode === "rows" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
17316
17627
|
Table,
|
|
17317
17628
|
{
|
|
17318
17629
|
"aria-label": typeof title === "string" ? title : void 0,
|
|
@@ -17320,17 +17631,48 @@ function ListPage({
|
|
|
17320
17631
|
columns,
|
|
17321
17632
|
getRowId,
|
|
17322
17633
|
enableRowSelection,
|
|
17323
|
-
bulkActions
|
|
17634
|
+
bulkActions,
|
|
17635
|
+
loading: isLoading,
|
|
17636
|
+
loadingRowCount
|
|
17324
17637
|
}
|
|
17325
|
-
) :
|
|
17326
|
-
|
|
17638
|
+
) : tableMode === "no-data" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
17639
|
+
"div",
|
|
17327
17640
|
{
|
|
17328
|
-
|
|
17329
|
-
|
|
17330
|
-
|
|
17331
|
-
|
|
17641
|
+
"data-slot": "list-page-empty",
|
|
17642
|
+
"data-state": "no-data",
|
|
17643
|
+
className: "rounded-md border border-border bg-card",
|
|
17644
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17645
|
+
EmptyState,
|
|
17646
|
+
{
|
|
17647
|
+
size: "lg",
|
|
17648
|
+
icon: noDataState?.icon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Inbox, {}),
|
|
17649
|
+
title: noDataState?.title ?? labels.noDataTitle,
|
|
17650
|
+
description: noDataState?.description ?? labels.noDataDescription,
|
|
17651
|
+
action: noDataState?.action !== void 0 ? noDataState.action : null
|
|
17652
|
+
}
|
|
17653
|
+
)
|
|
17332
17654
|
}
|
|
17333
|
-
)
|
|
17655
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
17656
|
+
"div",
|
|
17657
|
+
{
|
|
17658
|
+
"data-slot": "list-page-empty",
|
|
17659
|
+
"data-state": "no-results",
|
|
17660
|
+
className: "rounded-md border border-border bg-card",
|
|
17661
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
17662
|
+
EmptyState,
|
|
17663
|
+
{
|
|
17664
|
+
size: "lg",
|
|
17665
|
+
icon: emptyState?.icon ?? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.SearchX, {}),
|
|
17666
|
+
title: emptyState?.title ?? labels.emptyTitle,
|
|
17667
|
+
description: emptyState?.description ?? labels.emptyDescription,
|
|
17668
|
+
action: emptyState?.action !== void 0 ? emptyState.action : /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "outline", onClick: reset, children: [
|
|
17669
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, {}),
|
|
17670
|
+
labels.reset
|
|
17671
|
+
] })
|
|
17672
|
+
}
|
|
17673
|
+
)
|
|
17674
|
+
}
|
|
17675
|
+
)
|
|
17334
17676
|
] });
|
|
17335
17677
|
}
|
|
17336
17678
|
|
|
@@ -17638,6 +17980,7 @@ exports.DashboardContent = DashboardContent;
|
|
|
17638
17980
|
exports.DashboardHeader = DashboardHeader;
|
|
17639
17981
|
exports.DashboardLayout = DashboardLayout;
|
|
17640
17982
|
exports.DashboardMain = DashboardMain;
|
|
17983
|
+
exports.DatePicker = DatePicker;
|
|
17641
17984
|
exports.DropdownMenu = DropdownMenu;
|
|
17642
17985
|
exports.DropdownMenuContent = DropdownMenuContent;
|
|
17643
17986
|
exports.DropdownMenuGroup = DropdownMenuGroup;
|
|
@@ -17649,6 +17992,7 @@ exports.DropdownMenuShortcut = DropdownMenuShortcut;
|
|
|
17649
17992
|
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
17650
17993
|
exports.EmptyState = EmptyState;
|
|
17651
17994
|
exports.Field = Field;
|
|
17995
|
+
exports.FormPage = FormPage;
|
|
17652
17996
|
exports.HeaderActions = HeaderActions;
|
|
17653
17997
|
exports.HeaderCollapseTrigger = HeaderCollapseTrigger;
|
|
17654
17998
|
exports.HeaderMobileTrigger = HeaderMobileTrigger;
|
|
@@ -17679,6 +18023,28 @@ exports.buttonBaseClass = buttonBaseClass;
|
|
|
17679
18023
|
exports.buttonSizeClass = buttonSizeClass;
|
|
17680
18024
|
exports.buttonVariantClass = buttonVariantClass;
|
|
17681
18025
|
exports.cn = cn;
|
|
18026
|
+
exports.datePickerCalendarClass = datePickerCalendarClass;
|
|
18027
|
+
exports.datePickerCaptionClass = datePickerCaptionClass;
|
|
18028
|
+
exports.datePickerContentClass = datePickerContentClass;
|
|
18029
|
+
exports.datePickerDayBaseClass = datePickerDayBaseClass;
|
|
18030
|
+
exports.datePickerDayWrapperClass = datePickerDayWrapperClass;
|
|
18031
|
+
exports.datePickerDisabledClass = datePickerDisabledClass;
|
|
18032
|
+
exports.datePickerMonthClass = datePickerMonthClass;
|
|
18033
|
+
exports.datePickerMonthGridClass = datePickerMonthGridClass;
|
|
18034
|
+
exports.datePickerMonthsClass = datePickerMonthsClass;
|
|
18035
|
+
exports.datePickerNavButtonClass = datePickerNavButtonClass;
|
|
18036
|
+
exports.datePickerNavClass = datePickerNavClass;
|
|
18037
|
+
exports.datePickerOutsideClass = datePickerOutsideClass;
|
|
18038
|
+
exports.datePickerPlaceholderClass = datePickerPlaceholderClass;
|
|
18039
|
+
exports.datePickerSelectedClass = datePickerSelectedClass;
|
|
18040
|
+
exports.datePickerTodayClass = datePickerTodayClass;
|
|
18041
|
+
exports.datePickerTriggerBaseClass = datePickerTriggerBaseClass;
|
|
18042
|
+
exports.datePickerTriggerSizeClass = datePickerTriggerSizeClass;
|
|
18043
|
+
exports.datePickerTriggerVariantClass = datePickerTriggerVariantClass;
|
|
18044
|
+
exports.datePickerValueClass = datePickerValueClass;
|
|
18045
|
+
exports.datePickerWeekClass = datePickerWeekClass;
|
|
18046
|
+
exports.datePickerWeekdayClass = datePickerWeekdayClass;
|
|
18047
|
+
exports.datePickerWeekdaysClass = datePickerWeekdaysClass;
|
|
17682
18048
|
exports.dropdownMenuContentClass = dropdownMenuContentClass;
|
|
17683
18049
|
exports.dropdownMenuItemBaseClass = dropdownMenuItemBaseClass;
|
|
17684
18050
|
exports.dropdownMenuItemInsetClass = dropdownMenuItemInsetClass;
|
|
@@ -17693,6 +18059,10 @@ exports.emptyStateDescriptionSizeClass = emptyStateDescriptionSizeClass;
|
|
|
17693
18059
|
exports.emptyStateIconWrapperBaseClass = emptyStateIconWrapperBaseClass;
|
|
17694
18060
|
exports.emptyStateIconWrapperSizeClass = emptyStateIconWrapperSizeClass;
|
|
17695
18061
|
exports.emptyStateTitleSizeClass = emptyStateTitleSizeClass;
|
|
18062
|
+
exports.formPageActionsBarClass = formPageActionsBarClass;
|
|
18063
|
+
exports.formPageBaseClass = formPageBaseClass;
|
|
18064
|
+
exports.formPageBodyClass = formPageBodyClass;
|
|
18065
|
+
exports.formPageSkeletonRowClass = formPageSkeletonRowClass;
|
|
17696
18066
|
exports.inputBaseClass = inputBaseClass;
|
|
17697
18067
|
exports.inputSizeClass = inputSizeClass;
|
|
17698
18068
|
exports.inputVariantClass = inputVariantClass;
|