@fayz-ai/ui 0.12.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ChartWidgetInner-GDE5PBTR.js → ChartWidgetInner-IOLIUYTB.js} +21 -8
- package/dist/ChartWidgetInner-IOLIUYTB.js.map +1 -0
- package/dist/analytics/AnalyticsCard.d.ts.map +1 -1
- package/dist/analytics/AnalyticsControls.d.ts +5 -1
- package/dist/analytics/AnalyticsControls.d.ts.map +1 -1
- package/dist/chunk-3OVZ5JJQ.js +540 -0
- package/dist/chunk-3OVZ5JJQ.js.map +1 -0
- package/dist/{chunk-22EVFMS3.js → chunk-4GK6IHOI.js} +17 -3
- package/dist/chunk-4GK6IHOI.js.map +1 -0
- package/dist/{chunk-7BMXN7MP.js → chunk-5KMAEQA3.js} +25 -24
- package/dist/chunk-5KMAEQA3.js.map +1 -0
- package/dist/chunk-AASANYXN.js +601 -0
- package/dist/chunk-AASANYXN.js.map +1 -0
- package/dist/chunk-FFJ2C5YH.js +92 -0
- package/dist/chunk-FFJ2C5YH.js.map +1 -0
- package/dist/chunk-J7F3Z52K.js +152 -0
- package/dist/chunk-J7F3Z52K.js.map +1 -0
- package/dist/{chunk-JGJNRNQW.js → chunk-KD2V3TAX.js} +290 -67
- package/dist/chunk-KD2V3TAX.js.map +1 -0
- package/dist/{chunk-ZDRHCKRK.js → chunk-NA3GE4H3.js} +746 -533
- package/dist/chunk-NA3GE4H3.js.map +1 -0
- package/dist/{chunk-7BHG3XGJ.js → chunk-SLWTKHNY.js} +296 -269
- package/dist/chunk-SLWTKHNY.js.map +1 -0
- package/dist/dashboard/ChartWidgetInner.d.ts.map +1 -1
- package/dist/dashboard/DashboardCanvas.d.ts.map +1 -1
- package/dist/dashboard/DashboardCustomizeMenu.d.ts.map +1 -1
- package/dist/dashboard/DashboardRange.d.ts +8 -2
- package/dist/dashboard/DashboardRange.d.ts.map +1 -1
- package/dist/dashboard/index.js +4 -4
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +86 -99
- package/dist/index.js.map +1 -1
- package/dist/layout/AppShell.d.ts +8 -2
- package/dist/layout/AppShell.d.ts.map +1 -1
- package/dist/layout/ModulePage.d.ts +24 -1
- package/dist/layout/ModulePage.d.ts.map +1 -1
- package/dist/layout/Sidebar.d.ts +27 -4
- package/dist/layout/Sidebar.d.ts.map +1 -1
- package/dist/layout/Topbar.d.ts +10 -3
- package/dist/layout/Topbar.d.ts.map +1 -1
- package/dist/layout/index.d.ts +2 -1
- package/dist/layout/index.d.ts.map +1 -1
- package/dist/layout/index.js +4 -4
- package/dist/layout/rail-flyout.d.ts +10 -0
- package/dist/layout/rail-flyout.d.ts.map +1 -1
- package/dist/primitives/SearchCombobox.d.ts +9 -1
- package/dist/primitives/SearchCombobox.d.ts.map +1 -1
- package/dist/primitives/bulk-action-bar.d.ts +3 -1
- package/dist/primitives/bulk-action-bar.d.ts.map +1 -1
- package/dist/primitives/color-palette.d.ts +24 -0
- package/dist/primitives/color-palette.d.ts.map +1 -0
- package/dist/primitives/header-tabs.d.ts +47 -7
- package/dist/primitives/header-tabs.d.ts.map +1 -1
- package/dist/primitives/image-drop.d.ts +28 -0
- package/dist/primitives/image-drop.d.ts.map +1 -0
- package/dist/primitives/index.d.ts +9 -3
- package/dist/primitives/index.d.ts.map +1 -1
- package/dist/primitives/index.js +6 -3
- package/dist/primitives/list-view.d.ts +9 -1
- package/dist/primitives/list-view.d.ts.map +1 -1
- package/dist/primitives/option-select.d.ts +46 -0
- package/dist/primitives/option-select.d.ts.map +1 -0
- package/dist/primitives/page-toolbar.d.ts +80 -0
- package/dist/primitives/page-toolbar.d.ts.map +1 -0
- package/dist/primitives/search-select.d.ts +3 -1
- package/dist/primitives/search-select.d.ts.map +1 -1
- package/dist/primitives/sheet.d.ts.map +1 -1
- package/dist/primitives/step-progress.d.ts +20 -0
- package/dist/primitives/step-progress.d.ts.map +1 -0
- package/dist/primitives/tabs.d.ts.map +1 -1
- package/dist/primitives/use-row-selection.d.ts +50 -0
- package/dist/primitives/use-row-selection.d.ts.map +1 -0
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.d.ts.map +1 -1
- package/dist/stores/page-header.store.d.ts +26 -2
- package/dist/stores/page-header.store.d.ts.map +1 -1
- package/dist/styles.css +74 -17
- package/dist/wizard/Wizard.d.ts +38 -0
- package/dist/wizard/Wizard.d.ts.map +1 -0
- package/dist/wizard/WizardField.d.ts +22 -0
- package/dist/wizard/WizardField.d.ts.map +1 -0
- package/dist/wizard/index.d.ts +6 -0
- package/dist/wizard/index.d.ts.map +1 -0
- package/dist/wizard/index.js +5 -0
- package/dist/wizard/index.js.map +1 -0
- package/dist/wizard/logic.d.ts +39 -0
- package/dist/wizard/logic.d.ts.map +1 -0
- package/dist/wizard/types.d.ts +95 -0
- package/dist/wizard/types.d.ts.map +1 -0
- package/dist/wizard/useWizard.d.ts +47 -0
- package/dist/wizard/useWizard.d.ts.map +1 -0
- package/package.json +14 -8
- package/dist/ChartWidgetInner-GDE5PBTR.js.map +0 -1
- package/dist/chunk-22EVFMS3.js.map +0 -1
- package/dist/chunk-7BHG3XGJ.js.map +0 -1
- package/dist/chunk-7BMXN7MP.js.map +0 -1
- package/dist/chunk-JGJNRNQW.js.map +0 -1
- package/dist/chunk-VAKWUUVC.js +0 -425
- package/dist/chunk-VAKWUUVC.js.map +0 -1
- package/dist/chunk-ZBQ772DU.js +0 -17
- package/dist/chunk-ZBQ772DU.js.map +0 -1
- package/dist/chunk-ZDRHCKRK.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { useSaveBarVisible, useCrossModuleBack, useBackHandler,
|
|
2
|
-
import { Dropdown, DropdownTrigger, DropdownContent, DropdownItem, Card, DataTable
|
|
1
|
+
import { useSaveBarVisible, useCrossModuleBack, useBackHandler, PageHeaderActions } from './chunk-NA3GE4H3.js';
|
|
2
|
+
import { Dropdown, DropdownTrigger, DropdownContent, DropdownItem, Card, DataTable } from './chunk-KD2V3TAX.js';
|
|
3
3
|
import { cn, Button } from './chunk-OKZ6WQB3.js';
|
|
4
4
|
import * as React14 from 'react';
|
|
5
5
|
import { useState, useRef, useEffect, useMemo, useCallback } from 'react';
|
|
6
6
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
8
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
9
|
-
import { X, ChevronDown, ChevronUp, Check, ArrowLeft, Search, ChevronLeft, ChevronRight, MoreHorizontal, ImageIcon, RefreshCw, Clock, Plus, Download, Calendar, Loader2
|
|
9
|
+
import { X, ChevronDown, ChevronUp, Check, ArrowLeft, Search, ChevronLeft, ChevronRight, MoreHorizontal, ImageIcon, RefreshCw, Clock, Plus, Download, Calendar, Loader2 } from 'lucide-react';
|
|
10
10
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
11
11
|
import { Toaster } from 'sonner';
|
|
12
12
|
export { toast } from 'sonner';
|
|
@@ -320,7 +320,9 @@ var TabsList = React14.forwardRef(({ className, ...props }, ref) => /* @__PURE__
|
|
|
320
320
|
{
|
|
321
321
|
ref,
|
|
322
322
|
className: cn(
|
|
323
|
-
|
|
323
|
+
// Theme radius, not a fixed one: the chip and its track are controls, and
|
|
324
|
+
// an app that states 12px corners had these two answering 6px.
|
|
325
|
+
"inline-flex h-10 items-center justify-center rounded-button bg-muted p-1 text-muted-foreground",
|
|
324
326
|
className
|
|
325
327
|
),
|
|
326
328
|
...props
|
|
@@ -332,7 +334,7 @@ var TabsTrigger = React14.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
332
334
|
{
|
|
333
335
|
ref,
|
|
334
336
|
className: cn(
|
|
335
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-
|
|
337
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-button px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-card data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
336
338
|
className
|
|
337
339
|
),
|
|
338
340
|
...props
|
|
@@ -531,6 +533,7 @@ function BulkActionBar({
|
|
|
531
533
|
onSelectAll,
|
|
532
534
|
onClear,
|
|
533
535
|
actions = [],
|
|
536
|
+
variant = "band",
|
|
534
537
|
className
|
|
535
538
|
}) {
|
|
536
539
|
const t = useTranslation();
|
|
@@ -541,7 +544,8 @@ function BulkActionBar({
|
|
|
541
544
|
"div",
|
|
542
545
|
{
|
|
543
546
|
className: cn(
|
|
544
|
-
"flex flex-wrap items-center justify-between gap-2
|
|
547
|
+
"flex flex-wrap items-center justify-between gap-2",
|
|
548
|
+
variant === "band" ? "rounded-lg border border-border bg-muted/30 px-3 py-2" : "w-full min-h-8",
|
|
545
549
|
className
|
|
546
550
|
),
|
|
547
551
|
role: "region",
|
|
@@ -737,65 +741,6 @@ function StatTiles({ tiles, loading, className }) {
|
|
|
737
741
|
] }, tile.id);
|
|
738
742
|
}) });
|
|
739
743
|
}
|
|
740
|
-
var TRACK = {
|
|
741
|
-
sm: "h-4 w-7",
|
|
742
|
-
md: "h-5 w-9"
|
|
743
|
-
};
|
|
744
|
-
var THUMB = {
|
|
745
|
-
sm: "h-3 w-3 data-[on=true]:translate-x-3",
|
|
746
|
-
md: "h-4 w-4 data-[on=true]:translate-x-4"
|
|
747
|
-
};
|
|
748
|
-
var Switch = React14.forwardRef(function Switch2({ checked, onCheckedChange, size = "sm", label, className, disabled, ...rest }, ref) {
|
|
749
|
-
const control = /* @__PURE__ */ jsx(
|
|
750
|
-
"button",
|
|
751
|
-
{
|
|
752
|
-
ref,
|
|
753
|
-
type: "button",
|
|
754
|
-
role: "switch",
|
|
755
|
-
"aria-checked": checked,
|
|
756
|
-
disabled,
|
|
757
|
-
onClick: (e) => {
|
|
758
|
-
e.stopPropagation();
|
|
759
|
-
rest.onClick?.(e);
|
|
760
|
-
if (!disabled) onCheckedChange(!checked);
|
|
761
|
-
},
|
|
762
|
-
className: cn(
|
|
763
|
-
"relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-colors",
|
|
764
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
765
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
766
|
-
TRACK[size],
|
|
767
|
-
checked ? "bg-primary" : "bg-muted-foreground/30",
|
|
768
|
-
className
|
|
769
|
-
),
|
|
770
|
-
...rest,
|
|
771
|
-
children: /* @__PURE__ */ jsx(
|
|
772
|
-
"span",
|
|
773
|
-
{
|
|
774
|
-
"data-on": checked,
|
|
775
|
-
className: cn(
|
|
776
|
-
"pointer-events-none ml-0.5 inline-block rounded-full bg-background shadow-sm transition-transform",
|
|
777
|
-
THUMB[size]
|
|
778
|
-
)
|
|
779
|
-
}
|
|
780
|
-
)
|
|
781
|
-
}
|
|
782
|
-
);
|
|
783
|
-
if (label == null) return control;
|
|
784
|
-
return /* @__PURE__ */ jsxs(
|
|
785
|
-
"label",
|
|
786
|
-
{
|
|
787
|
-
className: cn(
|
|
788
|
-
"inline-flex items-center gap-2 text-xs text-muted-foreground",
|
|
789
|
-
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
790
|
-
),
|
|
791
|
-
onClick: (e) => e.stopPropagation(),
|
|
792
|
-
children: [
|
|
793
|
-
control,
|
|
794
|
-
/* @__PURE__ */ jsx("span", { children: label })
|
|
795
|
-
]
|
|
796
|
-
}
|
|
797
|
-
);
|
|
798
|
-
});
|
|
799
744
|
var Hint = React14.forwardRef(function Hint2({ label, children, side = "top", delayDuration = 0, ...rest }, ref) {
|
|
800
745
|
if (!label) return React14.cloneElement(children, { ...rest, ref });
|
|
801
746
|
return /* @__PURE__ */ jsx(TooltipPrimitive.Provider, { delayDuration, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
@@ -880,7 +825,7 @@ function TimePicker({ value, onChange, interval = 15, min = "00:00", max = "23:4
|
|
|
880
825
|
onClick: () => !readOnly && setOpen((p) => !p),
|
|
881
826
|
onKeyDown: handleKeyDown,
|
|
882
827
|
disabled: readOnly,
|
|
883
|
-
className: `flex items-center gap-2 rounded-
|
|
828
|
+
className: `flex items-center gap-2 rounded-button border px-3 py-2 text-sm w-full text-left transition-colors ${readOnly ? "bg-muted/40 text-muted-foreground cursor-default" : "bg-background hover:bg-muted/30"}`,
|
|
884
829
|
children: [
|
|
885
830
|
/* @__PURE__ */ jsx(Clock, { className: "h-3.5 w-3.5 text-muted-foreground shrink-0" }),
|
|
886
831
|
/* @__PURE__ */ jsx("span", { children: displayValue || "--:--" })
|
|
@@ -918,7 +863,91 @@ function TimePicker({ value, onChange, interval = 15, min = "00:00", max = "23:4
|
|
|
918
863
|
)
|
|
919
864
|
] });
|
|
920
865
|
}
|
|
921
|
-
|
|
866
|
+
function useRowSelection({
|
|
867
|
+
rows,
|
|
868
|
+
actions,
|
|
869
|
+
getRowId,
|
|
870
|
+
enabled = true
|
|
871
|
+
}) {
|
|
872
|
+
const identify = React14.useCallback(
|
|
873
|
+
(row) => getRowId ? getRowId(row) : String(row?.id ?? ""),
|
|
874
|
+
[getRowId]
|
|
875
|
+
);
|
|
876
|
+
const visible = React14.useMemo(() => rows ?? [], [rows]);
|
|
877
|
+
const [rawSelection, setRawSelection] = React14.useState([]);
|
|
878
|
+
const visibleIds = React14.useMemo(() => new Set(visible.map(identify)), [visible, identify]);
|
|
879
|
+
const selectedIds = React14.useMemo(
|
|
880
|
+
() => rawSelection.filter((id) => visibleIds.has(id)),
|
|
881
|
+
[rawSelection, visibleIds]
|
|
882
|
+
);
|
|
883
|
+
const selectedRows = React14.useMemo(() => {
|
|
884
|
+
const picked = new Set(selectedIds);
|
|
885
|
+
return visible.filter((row) => picked.has(identify(row)));
|
|
886
|
+
}, [visible, selectedIds, identify]);
|
|
887
|
+
const clear = React14.useCallback(() => setRawSelection([]), []);
|
|
888
|
+
const selectAll = React14.useCallback(
|
|
889
|
+
() => setRawSelection(visible.map(identify)),
|
|
890
|
+
[visible, identify]
|
|
891
|
+
);
|
|
892
|
+
const barActions = React14.useMemo(
|
|
893
|
+
() => (actions ?? []).map((action) => ({
|
|
894
|
+
id: action.id,
|
|
895
|
+
label: action.label,
|
|
896
|
+
icon: action.icon,
|
|
897
|
+
destructive: action.destructive,
|
|
898
|
+
overflow: action.overflow,
|
|
899
|
+
disabled: action.disabled,
|
|
900
|
+
onSelect: () => action.onSelect(selectedRows)
|
|
901
|
+
})),
|
|
902
|
+
[actions, selectedRows]
|
|
903
|
+
);
|
|
904
|
+
const selectable = enabled && barActions.length > 0;
|
|
905
|
+
return {
|
|
906
|
+
selectedIds,
|
|
907
|
+
selectedRows,
|
|
908
|
+
setSelectedIds: setRawSelection,
|
|
909
|
+
clear,
|
|
910
|
+
selectAll,
|
|
911
|
+
barActions,
|
|
912
|
+
selectable,
|
|
913
|
+
hasSelection: selectable && selectedIds.length > 0,
|
|
914
|
+
getRowId: identify,
|
|
915
|
+
total: visible.length
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
function FilterChip({ allLabel, options, value, onChange, label, icon: Icon2, className }) {
|
|
919
|
+
const active = value != null && value !== "";
|
|
920
|
+
const current = options.find((o) => o.value === value);
|
|
921
|
+
return /* @__PURE__ */ jsxs(Dropdown, { children: [
|
|
922
|
+
/* @__PURE__ */ jsx(DropdownTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
923
|
+
"button",
|
|
924
|
+
{
|
|
925
|
+
type: "button",
|
|
926
|
+
"aria-label": label,
|
|
927
|
+
className: cn(
|
|
928
|
+
"inline-flex shrink-0 items-center gap-1 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors",
|
|
929
|
+
active ? "border-primary/30 bg-primary/10 text-primary hover:bg-primary/15" : "border-transparent bg-muted/70 text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
930
|
+
className
|
|
931
|
+
),
|
|
932
|
+
children: [
|
|
933
|
+
Icon2 && /* @__PURE__ */ jsx(Icon2, { className: "h-3 w-3 shrink-0 opacity-70" }),
|
|
934
|
+
/* @__PURE__ */ jsx("span", { className: "max-w-[12rem] truncate", children: current?.label ?? allLabel }),
|
|
935
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3 shrink-0 opacity-60" })
|
|
936
|
+
]
|
|
937
|
+
}
|
|
938
|
+
) }),
|
|
939
|
+
/* @__PURE__ */ jsxs(DropdownContent, { align: "start", children: [
|
|
940
|
+
/* @__PURE__ */ jsxs(DropdownItem, { onClick: () => onChange(void 0), children: [
|
|
941
|
+
allLabel,
|
|
942
|
+
!active && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3.5 w-3.5 shrink-0 pl-1" })
|
|
943
|
+
] }),
|
|
944
|
+
options.map((o) => /* @__PURE__ */ jsxs(DropdownItem, { onClick: () => onChange(o.value), children: [
|
|
945
|
+
o.label,
|
|
946
|
+
value === o.value && /* @__PURE__ */ jsx(Check, { className: "ml-auto h-3.5 w-3.5 shrink-0 pl-1" })
|
|
947
|
+
] }, o.value))
|
|
948
|
+
] })
|
|
949
|
+
] });
|
|
950
|
+
}
|
|
922
951
|
var ICON_BTN = "flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground";
|
|
923
952
|
function ListView({
|
|
924
953
|
columns,
|
|
@@ -930,11 +959,14 @@ function ListView({
|
|
|
930
959
|
searchDebounce = 300,
|
|
931
960
|
tags,
|
|
932
961
|
allTagLabel = "All",
|
|
962
|
+
tagsLabel,
|
|
933
963
|
activeTag,
|
|
934
964
|
onTagChange,
|
|
935
965
|
newLabel,
|
|
936
966
|
onNew,
|
|
937
967
|
onRowClick,
|
|
968
|
+
bulkActions,
|
|
969
|
+
getRowId,
|
|
938
970
|
emptyIcon: EmptyIcon,
|
|
939
971
|
emptyMessage = "No results found.",
|
|
940
972
|
emptyActionLabel,
|
|
@@ -971,8 +1003,17 @@ function ListView({
|
|
|
971
1003
|
const showPagination = onPageChange && totalItems > pageSize;
|
|
972
1004
|
const showSearch = !!onSearchChange;
|
|
973
1005
|
const showTags = tags && tags.length > 0 && onTagChange;
|
|
974
|
-
const
|
|
975
|
-
const
|
|
1006
|
+
const selection = useRowSelection({ rows: loading ? [] : data, actions: bulkActions, getRowId });
|
|
1007
|
+
const tagFilter = showTags ? /* @__PURE__ */ jsx(
|
|
1008
|
+
FilterChip,
|
|
1009
|
+
{
|
|
1010
|
+
label: tagsLabel,
|
|
1011
|
+
allLabel: allTagLabel,
|
|
1012
|
+
options: tags.map((t) => ({ value: t.value, label: t.label })),
|
|
1013
|
+
value: activeTag,
|
|
1014
|
+
onChange: (next) => onTagChange(next)
|
|
1015
|
+
}
|
|
1016
|
+
) : null;
|
|
976
1017
|
const emptyState = /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 py-6", children: [
|
|
977
1018
|
EmptyIcon && /* @__PURE__ */ jsx(EmptyIcon, { className: "mb-2 h-9 w-9 text-muted-foreground/40" }),
|
|
978
1019
|
/* @__PURE__ */ jsx("p", { className: "text-base font-semibold text-foreground", children: emptyMessage }),
|
|
@@ -982,26 +1023,26 @@ function ListView({
|
|
|
982
1023
|
] })
|
|
983
1024
|
] });
|
|
984
1025
|
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-4", className), children: [
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
{
|
|
989
|
-
|
|
990
|
-
value: activeTag ?? ALL_TAG,
|
|
991
|
-
onChange: (next) => onTagChange(next === ALL_TAG ? void 0 : next)
|
|
992
|
-
}
|
|
993
|
-
) : /* @__PURE__ */ jsx("div", {}),
|
|
994
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
995
|
-
headerActions,
|
|
996
|
-
onNew && newLabel && /* @__PURE__ */ jsxs(Button, { variant: "default", size: "default", onClick: onNew, className: "shrink-0", children: [
|
|
997
|
-
/* @__PURE__ */ jsx(Plus, { className: "h-3.5 w-3.5" }),
|
|
998
|
-
newLabel
|
|
999
|
-
] })
|
|
1026
|
+
(headerActions || onNew && newLabel) && /* @__PURE__ */ jsx(PageHeaderActions, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1027
|
+
headerActions,
|
|
1028
|
+
onNew && newLabel && /* @__PURE__ */ jsxs(Button, { variant: "default", size: "default", onClick: onNew, className: "shrink-0", children: [
|
|
1029
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-3.5 w-3.5" }),
|
|
1030
|
+
newLabel
|
|
1000
1031
|
] })
|
|
1001
|
-
] }),
|
|
1032
|
+
] }) }),
|
|
1002
1033
|
toolbar,
|
|
1003
1034
|
/* @__PURE__ */ jsxs(Card, { className: "overflow-hidden", children: [
|
|
1004
|
-
(showSearch || filters || onRefresh || onExport) && /* @__PURE__ */
|
|
1035
|
+
(showSearch || tagFilter || filters || onRefresh || onExport || selection.hasSelection) && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2 border-b border-border px-3 py-2", children: selection.hasSelection ? /* @__PURE__ */ jsx(
|
|
1036
|
+
BulkActionBar,
|
|
1037
|
+
{
|
|
1038
|
+
variant: "inline",
|
|
1039
|
+
count: selection.selectedIds.length,
|
|
1040
|
+
total: selection.total,
|
|
1041
|
+
onSelectAll: selection.selectAll,
|
|
1042
|
+
onClear: selection.clear,
|
|
1043
|
+
actions: selection.barActions
|
|
1044
|
+
}
|
|
1045
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1005
1046
|
showSearch && /* @__PURE__ */ jsxs("div", { className: "relative min-w-0 flex-1", children: [
|
|
1006
1047
|
/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
1007
1048
|
/* @__PURE__ */ jsx(
|
|
@@ -1015,12 +1056,13 @@ function ListView({
|
|
|
1015
1056
|
}
|
|
1016
1057
|
)
|
|
1017
1058
|
] }),
|
|
1018
|
-
(filters || onRefresh || onExport) && /* @__PURE__ */ jsxs("div", { className: "ml-auto flex flex-wrap items-center justify-end gap-2", children: [
|
|
1059
|
+
(tagFilter || filters || onRefresh || onExport) && /* @__PURE__ */ jsxs("div", { className: "ml-auto flex flex-wrap items-center justify-end gap-2", children: [
|
|
1060
|
+
tagFilter,
|
|
1019
1061
|
filters,
|
|
1020
1062
|
onRefresh && /* @__PURE__ */ jsx("button", { type: "button", "aria-label": refreshLabel, title: refreshLabel, onClick: onRefresh, className: ICON_BTN, children: /* @__PURE__ */ jsx(RefreshCw, { className: "h-4 w-4" }) }),
|
|
1021
1063
|
onExport && /* @__PURE__ */ jsx("button", { type: "button", "aria-label": exportLabel, title: exportLabel, onClick: onExport, className: ICON_BTN, children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" }) })
|
|
1022
1064
|
] })
|
|
1023
|
-
] }),
|
|
1065
|
+
] }) }),
|
|
1024
1066
|
/* @__PURE__ */ jsx(
|
|
1025
1067
|
DataTable,
|
|
1026
1068
|
{
|
|
@@ -1030,7 +1072,11 @@ function ListView({
|
|
|
1030
1072
|
loading,
|
|
1031
1073
|
skeletonRows: loading ? 3 : void 0,
|
|
1032
1074
|
emptyMessage: emptyState,
|
|
1033
|
-
onRowClick
|
|
1075
|
+
onRowClick,
|
|
1076
|
+
selectable: selection.selectable,
|
|
1077
|
+
selectedIds: selection.selectedIds,
|
|
1078
|
+
onSelectedIdsChange: selection.setSelectedIds,
|
|
1079
|
+
getRowId
|
|
1034
1080
|
}
|
|
1035
1081
|
)
|
|
1036
1082
|
] }),
|
|
@@ -1252,6 +1298,7 @@ function DatePicker({ value, onChange, className, variant = "input", defaultOpen
|
|
|
1252
1298
|
)
|
|
1253
1299
|
] });
|
|
1254
1300
|
}
|
|
1301
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React14.useLayoutEffect : React14.useEffect;
|
|
1255
1302
|
function SearchSelect({
|
|
1256
1303
|
value,
|
|
1257
1304
|
displayValue,
|
|
@@ -1266,12 +1313,14 @@ function SearchSelect({
|
|
|
1266
1313
|
searchingLabel = "Searching...",
|
|
1267
1314
|
allowCreate,
|
|
1268
1315
|
createLabel = "Add",
|
|
1316
|
+
clearLabel = "Clear",
|
|
1269
1317
|
onCreate,
|
|
1270
1318
|
renderOption,
|
|
1271
1319
|
loadOnOpen = true,
|
|
1272
1320
|
className,
|
|
1273
1321
|
disabled
|
|
1274
1322
|
}) {
|
|
1323
|
+
const canCreate = !!onCreate && allowCreate !== false;
|
|
1275
1324
|
const [open, setOpen] = React14.useState(false);
|
|
1276
1325
|
const [query, setQuery] = React14.useState("");
|
|
1277
1326
|
const [results, setResults] = React14.useState([]);
|
|
@@ -1281,11 +1330,14 @@ function SearchSelect({
|
|
|
1281
1330
|
const containerRef = React14.useRef(null);
|
|
1282
1331
|
const inputRef = React14.useRef(null);
|
|
1283
1332
|
const timerRef = React14.useRef();
|
|
1333
|
+
const [rect, setRect] = React14.useState(null);
|
|
1334
|
+
const dropdownRef = React14.useRef(null);
|
|
1284
1335
|
React14.useEffect(() => {
|
|
1285
1336
|
function handler(e) {
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1337
|
+
const target = e.target;
|
|
1338
|
+
if (containerRef.current?.contains(target)) return;
|
|
1339
|
+
if (dropdownRef.current?.contains(target)) return;
|
|
1340
|
+
setOpen(false);
|
|
1289
1341
|
}
|
|
1290
1342
|
document.addEventListener("mousedown", handler);
|
|
1291
1343
|
return () => document.removeEventListener("mousedown", handler);
|
|
@@ -1362,6 +1414,27 @@ function SearchSelect({
|
|
|
1362
1414
|
}, [results]);
|
|
1363
1415
|
const hasValue = !!value && !!selectedLabel;
|
|
1364
1416
|
const showDropdown = open && (query.length >= minChars || loadOnOpen);
|
|
1417
|
+
useIsomorphicLayoutEffect(() => {
|
|
1418
|
+
if (!showDropdown) {
|
|
1419
|
+
setRect(null);
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
const measure = () => {
|
|
1423
|
+
const el = containerRef.current;
|
|
1424
|
+
if (!el) return;
|
|
1425
|
+
const r = el.getBoundingClientRect();
|
|
1426
|
+
const below = window.innerHeight - r.bottom;
|
|
1427
|
+
const above = below < 240 && r.top > below;
|
|
1428
|
+
setRect({ left: r.left, top: above ? r.top : r.bottom, width: r.width, above });
|
|
1429
|
+
};
|
|
1430
|
+
measure();
|
|
1431
|
+
window.addEventListener("scroll", measure, true);
|
|
1432
|
+
window.addEventListener("resize", measure);
|
|
1433
|
+
return () => {
|
|
1434
|
+
window.removeEventListener("scroll", measure, true);
|
|
1435
|
+
window.removeEventListener("resize", measure);
|
|
1436
|
+
};
|
|
1437
|
+
}, [showDropdown]);
|
|
1365
1438
|
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: cn("relative", className), children: [
|
|
1366
1439
|
label && /* @__PURE__ */ jsxs("label", { className: "text-xs font-medium text-muted-foreground", children: [
|
|
1367
1440
|
label,
|
|
@@ -1408,65 +1481,72 @@ function SearchSelect({
|
|
|
1408
1481
|
]
|
|
1409
1482
|
}
|
|
1410
1483
|
),
|
|
1411
|
-
showDropdown &&
|
|
1412
|
-
/* @__PURE__ */
|
|
1413
|
-
|
|
1414
|
-
searchingLabel
|
|
1415
|
-
] }) : results.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "px-4 py-4 text-center", children: [
|
|
1416
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: noResultsLabel ?? (query ? `No results for "${query}"` : "No results") }),
|
|
1417
|
-
allowCreate && onCreate && /* @__PURE__ */ jsxs(
|
|
1418
|
-
"button",
|
|
1484
|
+
showDropdown && rect && createPortal(
|
|
1485
|
+
/* @__PURE__ */ jsxs(
|
|
1486
|
+
"div",
|
|
1419
1487
|
{
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
query,
|
|
1427
|
-
'"'
|
|
1428
|
-
]
|
|
1429
|
-
}
|
|
1430
|
-
)
|
|
1431
|
-
] }) : /* @__PURE__ */ jsxs("div", { className: "max-h-64 overflow-auto py-1", children: [
|
|
1432
|
-
[...groups.entries()].map(([group, options]) => /* @__PURE__ */ jsxs(React14.Fragment, { children: [
|
|
1433
|
-
group && /* @__PURE__ */ jsx("div", { className: "sticky top-0 bg-muted/50 px-3 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground", children: group }),
|
|
1434
|
-
options.map((opt) => /* @__PURE__ */ jsx(
|
|
1435
|
-
"button",
|
|
1436
|
-
{
|
|
1437
|
-
onClick: () => handleSelect(opt),
|
|
1438
|
-
disabled: opt.disabled,
|
|
1439
|
-
className: cn(
|
|
1440
|
-
"w-full text-left px-3 py-2 hover:bg-muted/50 transition-colors flex items-center gap-2.5",
|
|
1441
|
-
opt.disabled && "opacity-40 cursor-not-allowed",
|
|
1442
|
-
opt.id === value && "bg-muted/30"
|
|
1443
|
-
),
|
|
1444
|
-
children: renderOption ? renderOption(opt) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1445
|
-
opt.icon,
|
|
1446
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1447
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm truncate", children: opt.label }),
|
|
1448
|
-
opt.subtitle && /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground truncate", children: opt.subtitle })
|
|
1449
|
-
] })
|
|
1450
|
-
] })
|
|
1488
|
+
ref: dropdownRef,
|
|
1489
|
+
style: {
|
|
1490
|
+
position: "fixed",
|
|
1491
|
+
left: rect.left,
|
|
1492
|
+
width: rect.width,
|
|
1493
|
+
...rect.above ? { bottom: window.innerHeight - rect.top + 4 } : { top: rect.top + 4 }
|
|
1451
1494
|
},
|
|
1452
|
-
|
|
1453
|
-
))
|
|
1454
|
-
] }, group)),
|
|
1455
|
-
allowCreate && onCreate && /* @__PURE__ */ jsxs(
|
|
1456
|
-
"button",
|
|
1457
|
-
{
|
|
1458
|
-
onClick: () => handleCreate(query),
|
|
1459
|
-
className: "w-full text-left px-3 py-2 text-xs text-primary hover:bg-muted/50 transition-colors border-t",
|
|
1495
|
+
className: "fayz-glass-surface z-[60] overflow-hidden rounded-lg border bg-popover shadow-lg",
|
|
1460
1496
|
children: [
|
|
1461
|
-
"
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1497
|
+
loading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-2 px-4 py-6 text-xs text-muted-foreground", children: [
|
|
1498
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
1499
|
+
" ",
|
|
1500
|
+
searchingLabel
|
|
1501
|
+
] }) : results.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-4 py-4 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: noResultsLabel ?? (query ? `No results for "${query}"` : "No results") }) }) : /* @__PURE__ */ jsx("div", { className: "max-h-64 overflow-auto py-1", children: [...groups.entries()].map(([group, options]) => /* @__PURE__ */ jsxs(React14.Fragment, { children: [
|
|
1502
|
+
group && /* @__PURE__ */ jsx("div", { className: "sticky top-0 bg-muted/50 px-3 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground", children: group }),
|
|
1503
|
+
options.map((opt) => /* @__PURE__ */ jsx(
|
|
1504
|
+
"button",
|
|
1505
|
+
{
|
|
1506
|
+
onClick: () => handleSelect(opt),
|
|
1507
|
+
disabled: opt.disabled,
|
|
1508
|
+
className: cn(
|
|
1509
|
+
"w-full text-left px-3 py-2 hover:bg-muted/50 transition-colors flex items-center gap-2.5",
|
|
1510
|
+
opt.disabled && "opacity-40 cursor-not-allowed",
|
|
1511
|
+
opt.id === value && "bg-muted/30"
|
|
1512
|
+
),
|
|
1513
|
+
children: renderOption ? renderOption(opt) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1514
|
+
opt.icon,
|
|
1515
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1516
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm truncate", children: opt.label }),
|
|
1517
|
+
opt.subtitle && /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground truncate", children: opt.subtitle })
|
|
1518
|
+
] })
|
|
1519
|
+
] })
|
|
1520
|
+
},
|
|
1521
|
+
opt.id
|
|
1522
|
+
))
|
|
1523
|
+
] }, group)) }),
|
|
1524
|
+
(canCreate || hasValue || query.trim()) && !loading && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 border-t bg-muted/20 px-1.5 py-1", children: [
|
|
1525
|
+
hasValue || query.trim() ? /* @__PURE__ */ jsx(
|
|
1526
|
+
"button",
|
|
1527
|
+
{
|
|
1528
|
+
onClick: handleClear,
|
|
1529
|
+
className: "rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",
|
|
1530
|
+
children: clearLabel
|
|
1531
|
+
}
|
|
1532
|
+
) : /* @__PURE__ */ jsx("span", {}),
|
|
1533
|
+
canCreate && /* @__PURE__ */ jsxs(
|
|
1534
|
+
"button",
|
|
1535
|
+
{
|
|
1536
|
+
onClick: () => handleCreate(query),
|
|
1537
|
+
className: "inline-flex items-center gap-1 rounded-md px-2 py-1.5 text-xs font-medium text-primary transition-colors hover:bg-primary/10",
|
|
1538
|
+
children: [
|
|
1539
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-3 w-3" }),
|
|
1540
|
+
query.trim() ? `${createLabel} "${query.trim()}"` : createLabel
|
|
1541
|
+
]
|
|
1542
|
+
}
|
|
1543
|
+
)
|
|
1544
|
+
] })
|
|
1466
1545
|
]
|
|
1467
1546
|
}
|
|
1468
|
-
)
|
|
1469
|
-
|
|
1547
|
+
),
|
|
1548
|
+
document.body
|
|
1549
|
+
)
|
|
1470
1550
|
] });
|
|
1471
1551
|
}
|
|
1472
1552
|
function CurrencyInput({
|
|
@@ -1552,92 +1632,9 @@ function CurrencyInput({
|
|
|
1552
1632
|
)
|
|
1553
1633
|
] });
|
|
1554
1634
|
}
|
|
1555
|
-
var VARIANT_CONFIG = {
|
|
1556
|
-
default: {
|
|
1557
|
-
icon: Info,
|
|
1558
|
-
iconBg: "bg-info/10",
|
|
1559
|
-
iconColor: "text-info",
|
|
1560
|
-
buttonVariant: "default"
|
|
1561
|
-
},
|
|
1562
|
-
destructive: {
|
|
1563
|
-
icon: XCircle,
|
|
1564
|
-
iconBg: "bg-destructive/10",
|
|
1565
|
-
iconColor: "text-destructive",
|
|
1566
|
-
buttonVariant: "destructive"
|
|
1567
|
-
},
|
|
1568
|
-
warning: {
|
|
1569
|
-
icon: AlertTriangle,
|
|
1570
|
-
iconBg: "bg-warning/10",
|
|
1571
|
-
iconColor: "text-warning",
|
|
1572
|
-
buttonVariant: "destructive"
|
|
1573
|
-
},
|
|
1574
|
-
success: {
|
|
1575
|
-
icon: CheckCircle2,
|
|
1576
|
-
iconBg: "bg-success/10",
|
|
1577
|
-
iconColor: "text-success",
|
|
1578
|
-
buttonVariant: "default"
|
|
1579
|
-
}
|
|
1580
|
-
};
|
|
1581
|
-
function ConfirmDialog({
|
|
1582
|
-
open,
|
|
1583
|
-
onConfirm,
|
|
1584
|
-
onCancel,
|
|
1585
|
-
title,
|
|
1586
|
-
description,
|
|
1587
|
-
confirmLabel = "Confirm",
|
|
1588
|
-
cancelLabel = "Cancel",
|
|
1589
|
-
variant = "default",
|
|
1590
|
-
loading = false
|
|
1591
|
-
}) {
|
|
1592
|
-
const config = VARIANT_CONFIG[variant];
|
|
1593
|
-
const Icon2 = config.icon;
|
|
1594
|
-
React14.useEffect(() => {
|
|
1595
|
-
if (!open) return;
|
|
1596
|
-
function handleKey(e) {
|
|
1597
|
-
if (e.key === "Escape") onCancel();
|
|
1598
|
-
}
|
|
1599
|
-
document.addEventListener("keydown", handleKey);
|
|
1600
|
-
return () => document.removeEventListener("keydown", handleKey);
|
|
1601
|
-
}, [open, onCancel]);
|
|
1602
|
-
if (!open) return null;
|
|
1603
|
-
return createPortal(
|
|
1604
|
-
/* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-[60] flex items-center justify-center", children: [
|
|
1605
|
-
/* @__PURE__ */ jsx(
|
|
1606
|
-
"div",
|
|
1607
|
-
{
|
|
1608
|
-
className: "absolute inset-0 bg-black/50 backdrop-blur-[2px] animate-fade-in",
|
|
1609
|
-
onClick: onCancel
|
|
1610
|
-
}
|
|
1611
|
-
),
|
|
1612
|
-
/* @__PURE__ */ jsx(
|
|
1613
|
-
"div",
|
|
1614
|
-
{
|
|
1615
|
-
className: "relative z-10 w-full max-w-sm mx-4 rounded-modal border border-border bg-card shadow-lg animate-zoom-in",
|
|
1616
|
-
role: "alertdialog",
|
|
1617
|
-
"aria-modal": "true",
|
|
1618
|
-
"aria-labelledby": "confirm-title",
|
|
1619
|
-
"aria-describedby": description ? "confirm-desc" : void 0,
|
|
1620
|
-
children: /* @__PURE__ */ jsxs("div", { className: "p-6", children: [
|
|
1621
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
|
|
1622
|
-
/* @__PURE__ */ jsx("div", { className: cn("flex h-10 w-10 items-center justify-center rounded-full shrink-0", config.iconBg), children: /* @__PURE__ */ jsx(Icon2, { className: cn("h-5 w-5", config.iconColor) }) }),
|
|
1623
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 pt-0.5", children: [
|
|
1624
|
-
/* @__PURE__ */ jsx("h3", { id: "confirm-title", className: "text-sm font-semibold text-foreground", children: title }),
|
|
1625
|
-
description && /* @__PURE__ */ jsx("p", { id: "confirm-desc", className: "text-xs text-muted-foreground mt-1 leading-relaxed", children: description })
|
|
1626
|
-
] })
|
|
1627
|
-
] }),
|
|
1628
|
-
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2 mt-5", children: [
|
|
1629
|
-
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: onCancel, disabled: loading, children: cancelLabel }),
|
|
1630
|
-
/* @__PURE__ */ jsx(Button, { variant: config.buttonVariant, size: "sm", onClick: onConfirm, disabled: loading, children: loading ? "Processing..." : confirmLabel })
|
|
1631
|
-
] })
|
|
1632
|
-
] })
|
|
1633
|
-
}
|
|
1634
|
-
)
|
|
1635
|
-
] }),
|
|
1636
|
-
document.body
|
|
1637
|
-
);
|
|
1638
|
-
}
|
|
1639
1635
|
var Popover = PopoverPrimitive.Root;
|
|
1640
1636
|
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
1637
|
+
var PopoverAnchor = PopoverPrimitive.Anchor;
|
|
1641
1638
|
var PopoverContent = React14.forwardRef(({ className, align = "start", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
1642
1639
|
PopoverPrimitive.Content,
|
|
1643
1640
|
{
|
|
@@ -1653,38 +1650,50 @@ var PopoverContent = React14.forwardRef(({ className, align = "start", sideOffse
|
|
|
1653
1650
|
}
|
|
1654
1651
|
) }));
|
|
1655
1652
|
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1653
|
+
var SIZE = {
|
|
1654
|
+
sm: { container: "h-[26px]", segment: "px-2.5 text-xs" },
|
|
1655
|
+
md: { container: "h-[30px]", segment: "px-3 text-sm" }
|
|
1656
|
+
};
|
|
1657
|
+
function SegmentedControl({
|
|
1658
|
+
options,
|
|
1659
|
+
value,
|
|
1660
|
+
onChange,
|
|
1661
|
+
size = "sm",
|
|
1662
|
+
className,
|
|
1663
|
+
...rest
|
|
1664
|
+
}) {
|
|
1665
|
+
const items = options.map((o) => typeof o === "string" ? { value: o, label: o } : o);
|
|
1666
|
+
return /* @__PURE__ */ jsx(
|
|
1667
|
+
"div",
|
|
1668
|
+
{
|
|
1669
|
+
role: "tablist",
|
|
1670
|
+
"aria-label": rest["aria-label"],
|
|
1671
|
+
className: cn(
|
|
1672
|
+
"inline-flex items-center rounded-button border border-border bg-card p-0.5 shadow-button",
|
|
1673
|
+
SIZE[size].container,
|
|
1674
|
+
className
|
|
1675
|
+
),
|
|
1676
|
+
children: items.map((item) => {
|
|
1677
|
+
const active = item.value === value;
|
|
1678
|
+
return /* @__PURE__ */ jsx(
|
|
1679
|
+
"button",
|
|
1680
|
+
{
|
|
1681
|
+
type: "button",
|
|
1682
|
+
role: "tab",
|
|
1683
|
+
"aria-selected": active,
|
|
1684
|
+
onClick: () => onChange(item.value),
|
|
1685
|
+
className: cn(
|
|
1686
|
+
"flex h-full items-center rounded-button font-semibold transition-colors",
|
|
1687
|
+
SIZE[size].segment,
|
|
1688
|
+
active ? "bg-foreground text-background" : "text-muted-foreground hover:bg-muted/60"
|
|
1689
|
+
),
|
|
1690
|
+
children: item.label
|
|
1691
|
+
},
|
|
1692
|
+
item.value
|
|
1693
|
+
);
|
|
1694
|
+
})
|
|
1695
|
+
}
|
|
1696
|
+
);
|
|
1688
1697
|
}
|
|
1689
1698
|
var INLINE_TOKEN = /(\*\*[^*]+\*\*|\*[^*]+\*|`[^`]+`)/g;
|
|
1690
1699
|
function renderInline(text, keyPrefix) {
|
|
@@ -1853,7 +1862,9 @@ function SearchCombobox({
|
|
|
1853
1862
|
inlineLabel,
|
|
1854
1863
|
inlineIcon = "search",
|
|
1855
1864
|
loading,
|
|
1856
|
-
onFocus: onFocusProp
|
|
1865
|
+
onFocus: onFocusProp,
|
|
1866
|
+
chevron,
|
|
1867
|
+
required
|
|
1857
1868
|
}) {
|
|
1858
1869
|
const [open, setOpen] = useState(false);
|
|
1859
1870
|
const [activeIndex, setActiveIndex] = useState(-1);
|
|
@@ -1938,10 +1949,11 @@ function SearchCombobox({
|
|
|
1938
1949
|
setExpanded(true);
|
|
1939
1950
|
setTimeout(() => inputRef.current?.focus(), 50);
|
|
1940
1951
|
},
|
|
1941
|
-
className: `flex items-center gap-1.5 w-full text-left text-sm py-1.5 pl-2 transition-colors ${isPlus ? "text-primary hover:text-primary/80" : "text-muted-foreground hover:text-foreground"} ${className ?? ""}`,
|
|
1952
|
+
className: `flex items-center gap-1.5 w-full text-left text-sm py-1.5 pl-2 ${chevron ? "pr-2" : ""} transition-colors ${isPlus ? "text-primary hover:text-primary/80" : "text-muted-foreground hover:text-foreground"} ${className ?? ""}`,
|
|
1942
1953
|
children: [
|
|
1943
1954
|
isPlus && /* @__PURE__ */ jsx(Plus, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
1944
|
-
inlineLabel
|
|
1955
|
+
inlineLabel,
|
|
1956
|
+
chevron && /* @__PURE__ */ jsx(ChevronDown, { className: "ml-auto h-3 w-3 shrink-0 text-muted-foreground" })
|
|
1945
1957
|
]
|
|
1946
1958
|
}
|
|
1947
1959
|
);
|
|
@@ -1968,13 +1980,28 @@ function SearchCombobox({
|
|
|
1968
1980
|
onKeyDown: handleKeyDown,
|
|
1969
1981
|
placeholder,
|
|
1970
1982
|
autoFocus,
|
|
1971
|
-
className: minimal ?
|
|
1983
|
+
className: minimal ? `w-full bg-transparent pl-2 ${chevron ? "pr-7" : "pr-3"} py-1.5 text-sm placeholder:text-muted-foreground focus:outline-none border-b border-transparent hover:border-border focus:border-foreground transition-colors` : `w-full rounded-lg border bg-background pl-8 ${chevron ? "pr-8" : "pr-3"} py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring`,
|
|
1972
1984
|
role: "combobox",
|
|
1973
1985
|
"aria-expanded": hasDropdown,
|
|
1974
1986
|
"aria-autocomplete": "list",
|
|
1987
|
+
"aria-required": required || void 0,
|
|
1975
1988
|
"aria-activedescendant": activeIndex >= 0 ? `combobox-opt-${activeIndex}` : void 0
|
|
1976
1989
|
}
|
|
1977
1990
|
),
|
|
1991
|
+
chevron && /* @__PURE__ */ jsx(
|
|
1992
|
+
"button",
|
|
1993
|
+
{
|
|
1994
|
+
type: "button",
|
|
1995
|
+
tabIndex: -1,
|
|
1996
|
+
"aria-hidden": "true",
|
|
1997
|
+
onMouseDown: (e) => {
|
|
1998
|
+
e.preventDefault();
|
|
1999
|
+
inputRef.current?.focus();
|
|
2000
|
+
},
|
|
2001
|
+
className: `absolute ${minimal ? "right-2" : "right-2.5"} top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors`,
|
|
2002
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" })
|
|
2003
|
+
}
|
|
2004
|
+
),
|
|
1978
2005
|
hasDropdown && dropRect && createPortal(
|
|
1979
2006
|
/* @__PURE__ */ jsxs(
|
|
1980
2007
|
"div",
|
|
@@ -2047,6 +2074,6 @@ function SearchCombobox({
|
|
|
2047
2074
|
] });
|
|
2048
2075
|
}
|
|
2049
2076
|
|
|
2050
|
-
export { Badge, Breadcrumb, BulkActionBar, ChevronPager,
|
|
2051
|
-
//# sourceMappingURL=chunk-
|
|
2052
|
-
//# sourceMappingURL=chunk-
|
|
2077
|
+
export { Badge, Breadcrumb, BulkActionBar, ChevronPager, CurrencyInput, DatePicker, FilterChip, Hint, Input, ListView, Markdown, MarkdownEditor, Modal, ModalBody, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalTitle, ModalTrigger, PhoneField, PhoneLink, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, RefreshButton, SearchCombobox, SearchField, SearchSelect, SegmentedControl, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, StatTiles, Tabs, TabsContent, TabsList, TabsTrigger, Thumbnail, TimePicker, ToastProvider, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, formatPhone2 as formatPhone, normalizePhone, renderMarkdown, useRowSelection };
|
|
2078
|
+
//# sourceMappingURL=chunk-SLWTKHNY.js.map
|
|
2079
|
+
//# sourceMappingURL=chunk-SLWTKHNY.js.map
|