@datum-cloud/datum-ui 0.6.1 → 0.8.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/README.md +10 -0
- package/dist/action-row-DnhBhMtt.mjs +22 -0
- package/dist/app-navigation/index.mjs +2 -2
- package/dist/{app-navigation-84ro28PU.mjs → app-navigation-rSOfo1KV.mjs} +169 -106
- package/dist/autocomplete/index.mjs +1 -1
- package/dist/autocomplete-DdbTQe6u.mjs +141 -0
- package/dist/autosearch/index.mjs +100 -92
- package/dist/avatar-stack/index.mjs +1 -1
- package/dist/{avatar-stack-oVr8tsU7.mjs → avatar-stack-CDhlA1Nm.mjs} +1 -1
- package/dist/calendar/index.mjs +1 -1
- package/dist/{calendar-DEkCw7I1.mjs → calendar-C-Hbf74r.mjs} +4 -4
- package/dist/{calendar-date-picker-CDT-8Ha8.mjs → calendar-date-picker-BaykEs6j.mjs} +324 -240
- package/dist/code-editor/index.mjs +1 -1
- package/dist/components/base/date-picker/index.d.ts +4 -0
- package/dist/components/base/date-picker/index.d.ts.map +1 -0
- package/dist/components/base/date-picker/types.d.ts +7 -0
- package/dist/components/base/date-picker/types.d.ts.map +1 -0
- package/dist/components/base/date-picker/use-date-constraints.d.ts +8 -0
- package/dist/components/base/date-picker/use-date-constraints.d.ts.map +1 -0
- package/dist/components/base/index.d.ts +3 -0
- package/dist/components/base/index.d.ts.map +1 -1
- package/dist/components/base/mobile-sheet/context.d.ts +13 -0
- package/dist/components/base/mobile-sheet/context.d.ts.map +1 -0
- package/dist/components/base/mobile-sheet/index.d.ts +3 -0
- package/dist/components/base/mobile-sheet/index.d.ts.map +1 -0
- package/dist/components/base/mobile-sheet/mobile-sheet.d.ts +14 -0
- package/dist/components/base/mobile-sheet/mobile-sheet.d.ts.map +1 -0
- package/dist/components/base/option-picker/index.d.ts +5 -0
- package/dist/components/base/option-picker/index.d.ts.map +1 -0
- package/dist/components/base/option-picker/option-list.d.ts +3 -0
- package/dist/components/base/option-picker/option-list.d.ts.map +1 -0
- package/dist/components/base/option-picker/types.d.ts +71 -0
- package/dist/components/base/option-picker/types.d.ts.map +1 -0
- package/dist/components/base/option-picker/use-option-picker.d.ts +4 -0
- package/dist/components/base/option-picker/use-option-picker.d.ts.map +1 -0
- package/dist/components/base/responsive-dropdown/index.d.ts +2 -0
- package/dist/components/base/responsive-dropdown/index.d.ts.map +1 -0
- package/dist/components/base/responsive-dropdown/responsive-dropdown.d.ts +25 -0
- package/dist/components/base/responsive-dropdown/responsive-dropdown.d.ts.map +1 -0
- package/dist/components/base/responsive-popover/index.d.ts +2 -0
- package/dist/components/base/responsive-popover/index.d.ts.map +1 -0
- package/dist/components/base/responsive-popover/responsive-popover.d.ts +46 -0
- package/dist/components/base/responsive-popover/responsive-popover.d.ts.map +1 -0
- package/dist/components/base/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/features/app-navigation/app-navigation.d.ts +5 -3
- package/dist/components/features/app-navigation/app-navigation.d.ts.map +1 -1
- package/dist/components/features/autocomplete/autocomplete.d.ts +2 -2
- package/dist/components/features/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/features/autocomplete/autocomplete.types.d.ts +7 -16
- package/dist/components/features/autocomplete/autocomplete.types.d.ts.map +1 -1
- package/dist/components/features/autocomplete/trigger.d.ts +20 -0
- package/dist/components/features/autocomplete/trigger.d.ts.map +1 -0
- package/dist/components/features/autosearch/autosearch.d.ts +1 -1
- package/dist/components/features/autosearch/autosearch.d.ts.map +1 -1
- package/dist/components/features/autosearch/autosearch.types.d.ts +4 -0
- package/dist/components/features/autosearch/autosearch.types.d.ts.map +1 -1
- package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts +3 -37
- package/dist/components/features/calendar-date-picker/calendar-date-picker.d.ts.map +1 -1
- package/dist/components/features/calendar-date-picker/calendar-header.d.ts +13 -0
- package/dist/components/features/calendar-date-picker/calendar-header.d.ts.map +1 -0
- package/dist/components/features/calendar-date-picker/calendar-presets.d.ts +9 -0
- package/dist/components/features/calendar-date-picker/calendar-presets.d.ts.map +1 -0
- package/dist/components/features/calendar-date-picker/date-trigger.d.ts +24 -0
- package/dist/components/features/calendar-date-picker/date-trigger.d.ts.map +1 -0
- package/dist/components/features/calendar-date-picker/index.d.ts +2 -1
- package/dist/components/features/calendar-date-picker/index.d.ts.map +1 -1
- package/dist/components/features/calendar-date-picker/types.d.ts +42 -0
- package/dist/components/features/calendar-date-picker/types.d.ts.map +1 -0
- package/dist/components/features/calendar-date-picker/use-calendar-date-picker.d.ts +48 -0
- package/dist/components/features/calendar-date-picker/use-calendar-date-picker.d.ts.map +1 -0
- package/dist/components/features/data-table/components/row-actions.d.ts +1 -1
- package/dist/components/features/data-table/components/row-actions.d.ts.map +1 -1
- package/dist/components/features/data-table/filters/checkbox-filter.d.ts +1 -1
- package/dist/components/features/data-table/filters/checkbox-filter.d.ts.map +1 -1
- package/dist/components/features/data-table/filters/select-filter.d.ts +1 -1
- package/dist/components/features/data-table/filters/select-filter.d.ts.map +1 -1
- package/dist/components/features/data-table/types.d.ts +11 -12
- package/dist/components/features/data-table/types.d.ts.map +1 -1
- package/dist/components/features/date-time-picker/date-time-picker.d.ts +1 -1
- package/dist/components/features/date-time-picker/date-time-picker.d.ts.map +1 -1
- package/dist/components/features/date-time-picker/types.d.ts +23 -0
- package/dist/components/features/date-time-picker/types.d.ts.map +1 -1
- package/dist/components/features/form/components/form-combobox.d.ts +7 -44
- package/dist/components/features/form/components/form-combobox.d.ts.map +1 -1
- package/dist/components/features/form/components/form-dialog.d.ts +2 -1
- package/dist/components/features/form/components/form-dialog.d.ts.map +1 -1
- package/dist/components/features/form/components/form-field.d.ts +1 -1
- package/dist/components/features/form/components/form-field.d.ts.map +1 -1
- package/dist/components/features/form/types/index.d.ts +4 -0
- package/dist/components/features/form/types/index.d.ts.map +1 -1
- package/dist/components/features/index.d.ts +2 -0
- package/dist/components/features/index.d.ts.map +1 -1
- package/dist/components/features/more-actions/action-row.d.ts +9 -0
- package/dist/components/features/more-actions/action-row.d.ts.map +1 -0
- package/dist/components/features/more-actions/index.d.ts +3 -1
- package/dist/components/features/more-actions/index.d.ts.map +1 -1
- package/dist/components/features/more-actions/more-actions.d.ts +8 -14
- package/dist/components/features/more-actions/more-actions.d.ts.map +1 -1
- package/dist/components/features/more-actions/types.d.ts +24 -0
- package/dist/components/features/more-actions/types.d.ts.map +1 -0
- package/dist/components/features/multi-select/index.d.ts +3 -0
- package/dist/components/features/multi-select/index.d.ts.map +1 -0
- package/dist/components/features/multi-select/multi-select.d.ts +147 -0
- package/dist/components/features/multi-select/multi-select.d.ts.map +1 -0
- package/dist/components/features/page-title/page-title.d.ts.map +1 -1
- package/dist/components/features/rich-text-editor/index.d.ts +4 -0
- package/dist/components/features/rich-text-editor/index.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/rich-text-content.d.ts +3 -0
- package/dist/components/features/rich-text-editor/rich-text-content.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/rich-text-editor.d.ts +28 -0
- package/dist/components/features/rich-text-editor/rich-text-editor.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/bold-toolbar.d.ts +2 -0
- package/dist/components/features/rich-text-editor/toolbar/bold-toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/italic-toolbar.d.ts +2 -0
- package/dist/components/features/rich-text-editor/toolbar/italic-toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/link-toolbar.d.ts +2 -0
- package/dist/components/features/rich-text-editor/toolbar/link-toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/strike-toolbar.d.ts +2 -0
- package/dist/components/features/rich-text-editor/toolbar/strike-toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/toolbar-button.d.ts +17 -0
- package/dist/components/features/rich-text-editor/toolbar/toolbar-button.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/toolbar.d.ts +6 -0
- package/dist/components/features/rich-text-editor/toolbar/toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/toolbar/underline-toolbar.d.ts +2 -0
- package/dist/components/features/rich-text-editor/toolbar/underline-toolbar.d.ts.map +1 -0
- package/dist/components/features/rich-text-editor/types.d.ts +20 -0
- package/dist/components/features/rich-text-editor/types.d.ts.map +1 -0
- package/dist/components/features/tag-input/tag-input.d.ts +12 -1
- package/dist/components/features/tag-input/tag-input.d.ts.map +1 -1
- package/dist/components/features/task-queue/core/task-queue-dropdown.d.ts.map +1 -1
- package/dist/components/features/time-picker/time-picker.d.ts +1 -17
- package/dist/components/features/time-picker/time-picker.d.ts.map +1 -1
- package/dist/components/features/time-picker/types.d.ts +20 -18
- package/dist/components/features/time-picker/types.d.ts.map +1 -1
- package/dist/components/features/time-picker/use-time-slots.d.ts +10 -0
- package/dist/components/features/time-picker/use-time-slots.d.ts.map +1 -0
- package/dist/components/features/time-range-picker/components/absolute-range-panel.d.ts.map +1 -1
- package/dist/components/features/time-range-picker/time-range-picker.d.ts.map +1 -1
- package/dist/data-table/index.mjs +60 -175
- package/dist/date-picker/index.mjs +2 -2
- package/dist/date-time-picker/index.mjs +1 -1
- package/dist/{date-time-picker-BomrW07W.mjs → date-time-picker-DKOxrhmc.mjs} +64 -49
- package/dist/dropdown/index.mjs +109 -1
- package/dist/dropzone/index.mjs +1 -1
- package/dist/empty-content/index.mjs +1 -1
- package/dist/form/adapters/conform/index.mjs +2 -2
- package/dist/form/adapters/rhf/index.mjs +2 -2
- package/dist/form/index.mjs +2 -2
- package/dist/form/stepper/index.mjs +3 -3
- package/dist/{form-B3rQ4CH9.mjs → form-CCNN9VtJ.mjs} +27 -30
- package/dist/grid/index.mjs +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.mjs +4 -3
- package/dist/hooks/use-breakpoint.d.ts +9 -0
- package/dist/hooks/use-breakpoint.d.ts.map +1 -0
- package/dist/index.mjs +49 -42
- package/dist/input-number/index.mjs +1 -1
- package/dist/loader-overlay/index.mjs +1 -1
- package/dist/map/index.mjs +1 -1
- package/dist/{map-CWIQ-eql.mjs → map-qo7bY_g_.mjs} +83 -4
- package/dist/mobile-sheet/index.mjs +2 -0
- package/dist/mobile-sheet-BxMvkzAj.mjs +61 -0
- package/dist/more-actions/index.mjs +3 -2
- package/dist/more-actions-Ca5qqd0H.mjs +49 -0
- package/dist/multi-select/index.mjs +2 -0
- package/dist/multi-select-DM_dxnSV.mjs +235 -0
- package/dist/page-title/index.mjs +1 -1
- package/dist/{page-title-ChsnpBiH.mjs → page-title-ChLiv6gB.mjs} +3 -2
- package/dist/popover/index.mjs +1 -1
- package/dist/radio-group/index.mjs +1 -1
- package/dist/responsive-dropdown/index.mjs +2 -0
- package/dist/responsive-dropdown-IFroDgKn.mjs +53 -0
- package/dist/responsive-popover/index.mjs +2 -0
- package/dist/responsive-popover-D-t9bxSN.mjs +61 -0
- package/dist/rich-text-editor/index.mjs +2 -0
- package/dist/rich-text-editor-CQH_U4T5.mjs +293 -0
- package/dist/select/index.mjs +1 -1
- package/dist/sheet/index.mjs +2 -2
- package/dist/{sheet-BzXksqYY.mjs → sheet-LhUgozvg.mjs} +1 -1
- package/dist/sidebar/index.mjs +1 -1
- package/dist/{sidebar-BnhnjvfO.mjs → sidebar-B8LQJiNI.mjs} +3 -3
- package/dist/skeleton/index.mjs +1 -1
- package/dist/{skeleton-D1MUhAVo.mjs → skeleton-D4HOEiOZ.mjs} +1 -1
- package/dist/spinner/index.mjs +1 -1
- package/dist/stepper/index.mjs +1 -1
- package/dist/styles/canela.css +23 -0
- package/dist/styles/fonts/CanelaText-Regular.ttf +0 -0
- package/dist/styles/tokens/figma-tokens.css +4 -0
- package/dist/switch/index.mjs +1 -1
- package/dist/table/index.mjs +1 -1
- package/dist/tag-input/index.mjs +1 -1
- package/dist/{tag-input-T9cUX9-G.mjs → tag-input-Bf4GMptp.mjs} +29 -14
- package/dist/task-queue/index.mjs +1 -1
- package/dist/{task-queue-dropdown-Wcbj-f0V.mjs → task-queue-dropdown-D-LncEWm.mjs} +39 -39
- package/dist/textarea/index.mjs +1 -1
- package/dist/theme/index.mjs +1 -1
- package/dist/time-picker/index.mjs +1 -1
- package/dist/time-picker-BZF5jbF6.mjs +99 -0
- package/dist/{to-api-format-Bh3c01gr.mjs → to-api-format-CgKcC9SK.mjs} +144 -119
- package/dist/toast/index.mjs +2 -2
- package/dist/{toast-DpxlFNNx.mjs → toast-DDdLgY53.mjs} +1 -1
- package/dist/tooltip/index.mjs +1 -1
- package/dist/{tooltip-Cruvl5F6.mjs → tooltip-a7NTDCWw.mjs} +74 -17
- package/dist/transfer/index.mjs +1 -1
- package/dist/{types-BZNk3q65.mjs → types-CKIe2WlV.mjs} +2 -2
- package/dist/typography/index.mjs +1 -1
- package/dist/use-breakpoint-DGcVmB3c.mjs +36 -0
- package/dist/{use-copy-to-clipboard-uNeeVHC4.mjs → use-copy-to-clipboard-D7KyLIAt.mjs} +1 -1
- package/dist/use-date-constraints-R3H4lIoT.mjs +41 -0
- package/dist/use-option-picker-BXQOfyrK.mjs +215 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.mjs +2 -1
- package/dist/utils/timezone.d.ts +19 -0
- package/dist/utils/timezone.d.ts.map +1 -0
- package/dist/utils-BwB1mIdZ.mjs +35 -0
- package/dist/visually-hidden/index.mjs +1 -1
- package/package.json +61 -6
- package/dist/autocomplete-CkYJueBL.mjs +0 -293
- package/dist/combobox/index.mjs +0 -2
- package/dist/combobox-B-C9lJeD.mjs +0 -97
- package/dist/components/features/combobox/combobox.d.ts +0 -27
- package/dist/components/features/combobox/combobox.d.ts.map +0 -1
- package/dist/components/features/combobox/index.d.ts +0 -3
- package/dist/components/features/combobox/index.d.ts.map +0 -1
- package/dist/components/features/combobox/types.d.ts +0 -84
- package/dist/components/features/combobox/types.d.ts.map +0 -1
- package/dist/dropdown-DZiAt-jS.mjs +0 -110
- package/dist/dropdown-menu-lALvDnab.mjs +0 -85
- package/dist/more-actions-ILnEZq_E.mjs +0 -52
- package/dist/time-picker-BoF7pZZ2.mjs +0 -43
- /package/dist/{adapter-context-rWveHhDd.mjs → adapter-context-NyGTDZYq.mjs} +0 -0
- /package/dist/{col-1T0Q3SlH.mjs → col-DISdGlqY.mjs} +0 -0
- /package/dist/{dropzone-ogtpQ4fy.mjs → dropzone-Bt0plEuw.mjs} +0 -0
- /package/dist/{empty-content-C63GPJ5d.mjs → empty-content-CBh5bbtJ.mjs} +0 -0
- /package/dist/{form-context-Ccxm-wqL.mjs → form-context-CeKyvO-A.mjs} +0 -0
- /package/dist/{hooks-D8r2M2U6.mjs → hooks-DQXVwbrs.mjs} +0 -0
- /package/dist/{input-number-a7uydAsw.mjs → input-number-Diu-C6d5.mjs} +0 -0
- /package/dist/{loader-overlay-BTFdkp7W.mjs → loader-overlay-C2WDla6V.mjs} +0 -0
- /package/dist/{map-leaflet-imports-CRSKA79m.mjs → map-leaflet-imports-yWwH4CHB.mjs} +0 -0
- /package/dist/{popover-FJAcbYoH.mjs → popover-JOuXJOZ2.mjs} +0 -0
- /package/dist/{radio-group-CiITR0LO.mjs → radio-group-70UjJBb5.mjs} +0 -0
- /package/dist/{select-CiLR_DiQ.mjs → select-zxwykvQn.mjs} +0 -0
- /package/dist/{sheet-Di3b-oPu.mjs → sheet-DVEToCVY.mjs} +0 -0
- /package/dist/{skeleton-BKl4mfJt.mjs → skeleton-D2xuJdE1.mjs} +0 -0
- /package/dist/{spinner-OyOf9-Yu.mjs → spinner-CgPI3DDi.mjs} +0 -0
- /package/dist/{stepper-DvIOp0hh.mjs → stepper-Beb-zbdL.mjs} +0 -0
- /package/dist/{switch-DQJQhPIQ.mjs → switch-DcSF42Kc.mjs} +0 -0
- /package/dist/{table-Cdsh-39-.mjs → table-DWGT4cqh.mjs} +0 -0
- /package/dist/{textarea-BwD-MmTV.mjs → textarea-BoChBcFz.mjs} +0 -0
- /package/dist/{themes-DG1md8FI.mjs → themes-CAiN4b6G.mjs} +0 -0
- /package/dist/{toast-BWnN5fax.mjs → toast-D5XD7goD.mjs} +0 -0
- /package/dist/{transfer-46C-rFFW.mjs → transfer-CoGPwOc6.mjs} +0 -0
- /package/dist/{typography-ClB8k55E.mjs → typography-TRKP_CLT.mjs} +0 -0
- /package/dist/{use-display-touched-I39aXEBD.mjs → use-display-touched-C-afz17j.mjs} +0 -0
- /package/dist/{visuallyhidden-BLUsJpYH.mjs → visuallyhidden-BHOPczmW.mjs} +0 -0
package/README.md
CHANGED
|
@@ -462,3 +462,13 @@ See the [Form README](./src/components/features/form/README.md) for detailed doc
|
|
|
462
462
|
## License
|
|
463
463
|
|
|
464
464
|
MIT
|
|
465
|
+
|
|
466
|
+
## Optional: Canela font
|
|
467
|
+
|
|
468
|
+
Datum-branded surfaces can opt into Canela Text for the `font-title` Tailwind utility:
|
|
469
|
+
|
|
470
|
+
```ts
|
|
471
|
+
import '@datum-cloud/datum-ui/styles/canela'
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
Consumers who do not import this file use the default system font stack declared in tokens — no visual degradation.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/features/more-actions/action-row.tsx
|
|
4
|
+
function ActionRow({ action, data, onSelect }) {
|
|
5
|
+
const isDisabled = typeof action.disabled === "function" ? action.disabled(data) : action.disabled ?? false;
|
|
6
|
+
const IconComponent = typeof action.icon === "function" ? action.icon : null;
|
|
7
|
+
const iconNode = IconComponent ? /* @__PURE__ */ jsx(IconComponent, { className: "size-4" }) : action.icon;
|
|
8
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
9
|
+
type: "button",
|
|
10
|
+
onClick: (e) => {
|
|
11
|
+
e.preventDefault();
|
|
12
|
+
e.stopPropagation();
|
|
13
|
+
action.onClick(data);
|
|
14
|
+
onSelect();
|
|
15
|
+
},
|
|
16
|
+
disabled: isDisabled,
|
|
17
|
+
className: cn("hover:bg-accent hover:text-accent-foreground flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left text-xs disabled:pointer-events-none disabled:opacity-50", "[&_svg]:size-4 [&_svg]:shrink-0", action.variant === "destructive" && "text-destructive [&_svg]:!text-destructive hover:!text-destructive hover:[&_svg]:!text-destructive", action.className),
|
|
18
|
+
children: [iconNode, /* @__PURE__ */ jsx("span", { children: action.label })]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ActionRow as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as SidebarTrigger, S as SidebarSeparator, _ as SidebarMenuSub, a as SidebarGroupAction, b as SidebarProvider, c as SidebarHeader, d as SidebarMenu, f as SidebarMenuAction, g as SidebarMenuSkeleton, h as SidebarMenuItem, i as SidebarGroup, l as SidebarInput, m as SidebarMenuButton, n as SidebarContent, o as SidebarGroupContent, p as SidebarMenuBadge, r as SidebarFooter, s as SidebarGroupLabel, t as Sidebar, u as SidebarInset, v as SidebarMenuSubButton, w as useSidebar, x as SidebarRail, y as SidebarMenuSubItem } from "../sidebar-
|
|
1
|
+
import { C as SidebarTrigger, S as SidebarSeparator, _ as SidebarMenuSub, a as SidebarGroupAction, b as SidebarProvider, c as SidebarHeader, d as SidebarMenu, f as SidebarMenuAction, g as SidebarMenuSkeleton, h as SidebarMenuItem, i as SidebarGroup, l as SidebarInput, m as SidebarMenuButton, n as SidebarContent, o as SidebarGroupContent, p as SidebarMenuBadge, r as SidebarFooter, s as SidebarGroupLabel, t as Sidebar, u as SidebarInset, v as SidebarMenuSubButton, w as useSidebar, x as SidebarRail, y as SidebarMenuSubItem } from "../sidebar-B8LQJiNI.mjs";
|
|
2
2
|
import "../sidebar/index.mjs";
|
|
3
|
-
import { n as NavMenu, t as AppNavigation } from "../app-navigation-
|
|
3
|
+
import { n as NavMenu, t as AppNavigation } from "../app-navigation-rSOfo1KV.mjs";
|
|
4
4
|
export { AppNavigation, NavMenu, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
2
|
import { t as Icon } from "./icon-wrapper-DuLp3RM1.mjs";
|
|
3
3
|
import { n as CollapsibleContent, r as CollapsibleTrigger, t as Collapsible } from "./collapsible-CUphkSBt.mjs";
|
|
4
|
-
import { C as SidebarTrigger, S as SidebarSeparator, _ as SidebarMenuSub, c as SidebarHeader, d as SidebarMenu, h as SidebarMenuItem, i as SidebarGroup, m as SidebarMenuButton, n as SidebarContent, o as SidebarGroupContent, r as SidebarFooter, s as SidebarGroupLabel, t as Sidebar, w as useSidebar } from "./sidebar-
|
|
4
|
+
import { C as SidebarTrigger, S as SidebarSeparator, _ as SidebarMenuSub, c as SidebarHeader, d as SidebarMenu, g as SidebarMenuSkeleton, h as SidebarMenuItem, i as SidebarGroup, m as SidebarMenuButton, n as SidebarContent, o as SidebarGroupContent, r as SidebarFooter, s as SidebarGroupLabel, t as Sidebar, w as useSidebar } from "./sidebar-B8LQJiNI.mjs";
|
|
5
5
|
import { ChevronRight, ExternalLinkIcon } from "lucide-react";
|
|
6
6
|
import { Fragment, useCallback, useEffect, useRef, useState } from "react";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -223,58 +223,61 @@ function NavMenu({ ref, className, items, currentPath, linkComponent: LinkComp =
|
|
|
223
223
|
}));
|
|
224
224
|
},
|
|
225
225
|
className: "group/collapsible",
|
|
226
|
-
children: /* @__PURE__ */ jsxs(SidebarMenuItem, {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
variants: {
|
|
248
|
-
hidden: { opacity: 0 },
|
|
249
|
-
visible: {
|
|
250
|
-
opacity: 1,
|
|
251
|
-
transition: {
|
|
252
|
-
staggerChildren: .05,
|
|
253
|
-
delayChildren: .1
|
|
254
|
-
}
|
|
255
|
-
}
|
|
226
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuItem, {
|
|
227
|
+
className: "[&>*:first-child]:w-full",
|
|
228
|
+
children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
229
|
+
asChild: true,
|
|
230
|
+
className: "w-full",
|
|
231
|
+
children: /* @__PURE__ */ jsxs(NavSidebarMenuButton, {
|
|
232
|
+
item,
|
|
233
|
+
isActive,
|
|
234
|
+
disableTooltip,
|
|
235
|
+
className: itemClassName,
|
|
236
|
+
children: [/* @__PURE__ */ jsx("span", { children: item.title }), /* @__PURE__ */ jsx(Icon, {
|
|
237
|
+
icon: ChevronRight,
|
|
238
|
+
className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"
|
|
239
|
+
})]
|
|
240
|
+
})
|
|
241
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
242
|
+
className: "data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up overflow-hidden",
|
|
243
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
244
|
+
style: {
|
|
245
|
+
minHeight: 0,
|
|
246
|
+
overflow: "hidden"
|
|
256
247
|
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
opacity: 1,
|
|
266
|
-
transition: {
|
|
267
|
-
duration: .2,
|
|
268
|
-
ease: "easeOut"
|
|
269
|
-
}
|
|
248
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
249
|
+
variants: {
|
|
250
|
+
hidden: { opacity: 0 },
|
|
251
|
+
visible: {
|
|
252
|
+
opacity: 1,
|
|
253
|
+
transition: {
|
|
254
|
+
staggerChildren: .05,
|
|
255
|
+
delayChildren: .1
|
|
270
256
|
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
initial: isInitialMount.current || previousOpenItems.current[item.href] === openItems[item.href] && previousState.current === state && previousPathname.current === pathname && !hasActiveChild ? "visible" : "hidden",
|
|
260
|
+
animate: isOpen ? "visible" : "hidden",
|
|
261
|
+
children: /* @__PURE__ */ jsx(SidebarMenuSub, {
|
|
262
|
+
className: cn(level >= 1 ? "mr-0 pr-[.1rem]" : "", level === 2 ? "pl-4" : "", level === 3 ? "pl-6" : "", "mr-0 gap-0.5 pr-0"),
|
|
263
|
+
children: item.children?.map((subItem, index) => /* @__PURE__ */ jsx(motion.div, {
|
|
264
|
+
variants: {
|
|
265
|
+
hidden: { opacity: 0 },
|
|
266
|
+
visible: {
|
|
267
|
+
opacity: 1,
|
|
268
|
+
transition: {
|
|
269
|
+
duration: .2,
|
|
270
|
+
ease: "easeOut"
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
children: renderNavItem(subItem, level + 1)
|
|
275
|
+
}, `${subItem.href}-${level}-${index}`))
|
|
276
|
+
})
|
|
277
|
+
}, `collapsible-${item.href}-${isOpen}`)
|
|
278
|
+
})
|
|
279
|
+
})]
|
|
280
|
+
})
|
|
278
281
|
}, `collapsed-item-drop-down-item-${item.title}-${level}`)
|
|
279
282
|
}),
|
|
280
283
|
item.showSeparatorBelow && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" })
|
|
@@ -292,32 +295,35 @@ function NavMenu({ ref, className, items, currentPath, linkComponent: LinkComp =
|
|
|
292
295
|
}));
|
|
293
296
|
},
|
|
294
297
|
className: "group/collapsible",
|
|
295
|
-
children: /* @__PURE__ */ jsxs(SidebarMenuItem, {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
className: "data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up overflow-hidden",
|
|
310
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
311
|
-
style: {
|
|
312
|
-
minHeight: 0,
|
|
313
|
-
overflow: "hidden"
|
|
314
|
-
},
|
|
315
|
-
children: /* @__PURE__ */ jsx(SidebarMenuSub, {
|
|
316
|
-
className: cn(currentLevel >= 1 ? "mr-0 pr-[.1rem]" : "", "gap-0.5"),
|
|
317
|
-
children: currentItem.children?.map((subItem) => renderNavItem(subItem, currentLevel + 1))
|
|
298
|
+
children: /* @__PURE__ */ jsxs(SidebarMenuItem, {
|
|
299
|
+
className: "[&>*:first-child]:w-full",
|
|
300
|
+
children: [/* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
301
|
+
asChild: true,
|
|
302
|
+
className: "w-full",
|
|
303
|
+
children: /* @__PURE__ */ jsxs(NavSidebarMenuButton, {
|
|
304
|
+
item: currentItem,
|
|
305
|
+
isActive: currentItemIsActive,
|
|
306
|
+
disableTooltip,
|
|
307
|
+
className: itemClassName,
|
|
308
|
+
children: [/* @__PURE__ */ jsx("span", { children: currentItem.title }), /* @__PURE__ */ jsx(Icon, {
|
|
309
|
+
icon: ChevronRight,
|
|
310
|
+
className: "ml-auto transition-transform duration-200 group-data-[state=open]/collapsible:rotate-90"
|
|
311
|
+
})]
|
|
318
312
|
})
|
|
319
|
-
})
|
|
320
|
-
|
|
313
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
314
|
+
className: "data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up overflow-hidden",
|
|
315
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
316
|
+
style: {
|
|
317
|
+
minHeight: 0,
|
|
318
|
+
overflow: "hidden"
|
|
319
|
+
},
|
|
320
|
+
children: /* @__PURE__ */ jsx(SidebarMenuSub, {
|
|
321
|
+
className: cn(currentLevel >= 1 ? "mr-0 pr-[.1rem]" : "", "gap-0.5"),
|
|
322
|
+
children: currentItem.children?.map((subItem) => renderNavItem(subItem, currentLevel + 1))
|
|
323
|
+
})
|
|
324
|
+
})
|
|
325
|
+
})]
|
|
326
|
+
}, `collapsible-sidebar-${currentItem.title}-${currentLevel}`)
|
|
321
327
|
}, `collapsed-item-drop-down-item-${currentItem.title}-${currentLevel}`);
|
|
322
328
|
};
|
|
323
329
|
if (level <= 2 && hasChildren) return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -332,38 +338,41 @@ function NavMenu({ ref, className, items, currentPath, linkComponent: LinkComp =
|
|
|
332
338
|
item.showSeparatorAbove && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" }),
|
|
333
339
|
/* @__PURE__ */ jsx(SidebarMenu, {
|
|
334
340
|
className: cn(`level_${level} px-2`),
|
|
335
|
-
children: /* @__PURE__ */ jsx(SidebarMenuItem, {
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
className: "flex items-center
|
|
341
|
+
children: /* @__PURE__ */ jsx(SidebarMenuItem, {
|
|
342
|
+
className: "[&>*:first-child]:w-full",
|
|
343
|
+
children: /* @__PURE__ */ jsx(NavSidebarMenuButton, {
|
|
344
|
+
asChild: true,
|
|
345
|
+
item,
|
|
346
|
+
isActive: isActive && !hasActiveChild,
|
|
347
|
+
disableTooltip,
|
|
348
|
+
onClick: () => hasChildren && toggleItem(item.href),
|
|
349
|
+
className: cn(level >= 1 && "h-6", itemClassName),
|
|
350
|
+
children: item.type === "externalLink" ? /* @__PURE__ */ jsxs("a", {
|
|
351
|
+
href: item.href || "",
|
|
352
|
+
target: "_blank",
|
|
353
|
+
rel: "noopener noreferrer",
|
|
354
|
+
className: "flex items-center justify-between",
|
|
355
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
356
|
+
className: "flex items-center gap-2",
|
|
357
|
+
children: [item?.icon && /* @__PURE__ */ jsx(Icon, {
|
|
358
|
+
icon: item.icon,
|
|
359
|
+
className: "size-4 transition-all duration-300"
|
|
360
|
+
}), /* @__PURE__ */ jsx("span", { children: item.title })]
|
|
361
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
362
|
+
icon: ExternalLinkIcon,
|
|
363
|
+
className: "ml-auto size-4"
|
|
364
|
+
})]
|
|
365
|
+
}) : /* @__PURE__ */ jsxs(LinkComp, {
|
|
366
|
+
...LinkComp === "a" ? { href: item.href || "" } : { to: item.href || "" },
|
|
367
|
+
onClick: handleNavigation,
|
|
368
|
+
onMouseEnter: () => item.onPrefetch?.(),
|
|
349
369
|
children: [item?.icon && /* @__PURE__ */ jsx(Icon, {
|
|
350
370
|
icon: item.icon,
|
|
351
|
-
className: "
|
|
371
|
+
className: "text-sidebar-primary transition-all duration-300"
|
|
352
372
|
}), /* @__PURE__ */ jsx("span", { children: item.title })]
|
|
353
|
-
})
|
|
354
|
-
icon: ExternalLinkIcon,
|
|
355
|
-
className: "ml-auto size-4"
|
|
356
|
-
})]
|
|
357
|
-
}) : /* @__PURE__ */ jsxs(LinkComp, {
|
|
358
|
-
...LinkComp === "a" ? { href: item.href || "" } : { to: item.href || "" },
|
|
359
|
-
onClick: handleNavigation,
|
|
360
|
-
onMouseEnter: () => item.onPrefetch?.(),
|
|
361
|
-
children: [item?.icon && /* @__PURE__ */ jsx(Icon, {
|
|
362
|
-
icon: item.icon,
|
|
363
|
-
className: "text-sidebar-primary transition-all duration-300"
|
|
364
|
-
}), /* @__PURE__ */ jsx("span", { children: item.title })]
|
|
373
|
+
})
|
|
365
374
|
})
|
|
366
|
-
})
|
|
375
|
+
})
|
|
367
376
|
}),
|
|
368
377
|
item.showSeparatorBelow && /* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" })
|
|
369
378
|
] }, itemKey);
|
|
@@ -379,7 +388,55 @@ function NavMenu({ ref, className, items, currentPath, linkComponent: LinkComp =
|
|
|
379
388
|
NavMenu.displayName = "NavMenu";
|
|
380
389
|
//#endregion
|
|
381
390
|
//#region src/components/features/app-navigation/app-navigation.tsx
|
|
382
|
-
|
|
391
|
+
/** Skeleton that mirrors the project nav layout: Home, separator, 6 items, separator, Project Settings */
|
|
392
|
+
function NavSkeleton() {
|
|
393
|
+
return /* @__PURE__ */ jsxs("ul", {
|
|
394
|
+
className: "flex h-full w-full min-w-0 flex-col gap-0.5 py-2",
|
|
395
|
+
"data-sidebar": "menu",
|
|
396
|
+
children: [
|
|
397
|
+
/* @__PURE__ */ jsx(SidebarMenu, {
|
|
398
|
+
className: "px-2",
|
|
399
|
+
children: /* @__PURE__ */ jsx(SidebarMenuItem, {
|
|
400
|
+
className: "[&>*:first-child]:w-full",
|
|
401
|
+
children: /* @__PURE__ */ jsx(SidebarMenuSkeleton, {
|
|
402
|
+
showIcon: true,
|
|
403
|
+
className: "bg-sidebar-accent/60 h-8 rounded-xl **:data-[sidebar=menu-skeleton-text]:max-w-12"
|
|
404
|
+
})
|
|
405
|
+
})
|
|
406
|
+
}),
|
|
407
|
+
/* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" }),
|
|
408
|
+
[
|
|
409
|
+
1,
|
|
410
|
+
2,
|
|
411
|
+
3,
|
|
412
|
+
4,
|
|
413
|
+
5,
|
|
414
|
+
6
|
|
415
|
+
].map((i) => /* @__PURE__ */ jsx(SidebarMenu, {
|
|
416
|
+
className: "px-2",
|
|
417
|
+
children: /* @__PURE__ */ jsx(SidebarMenuItem, {
|
|
418
|
+
className: "[&>*:first-child]:w-full",
|
|
419
|
+
children: /* @__PURE__ */ jsx(SidebarMenuSkeleton, {
|
|
420
|
+
showIcon: true,
|
|
421
|
+
className: "h-8 rounded-xl"
|
|
422
|
+
})
|
|
423
|
+
})
|
|
424
|
+
}, i)),
|
|
425
|
+
/* @__PURE__ */ jsx(SidebarSeparator, { className: "my-2" }),
|
|
426
|
+
/* @__PURE__ */ jsx(SidebarMenu, {
|
|
427
|
+
className: "px-2",
|
|
428
|
+
children: /* @__PURE__ */ jsx(SidebarMenuItem, {
|
|
429
|
+
className: "[&>*:first-child]:w-full",
|
|
430
|
+
children: /* @__PURE__ */ jsx(SidebarMenuSkeleton, {
|
|
431
|
+
showIcon: true,
|
|
432
|
+
className: "h-8 rounded-xl [&_[data-sidebar=menu-skeleton-text]]:max-w-28"
|
|
433
|
+
})
|
|
434
|
+
})
|
|
435
|
+
})
|
|
436
|
+
]
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
function AppNavigation({ navItems, title, closeOnNavigation, defaultOpen, currentPath, linkComponent, loading = false, ...props }) {
|
|
383
440
|
const { setOpen } = useSidebar();
|
|
384
441
|
useEffect(() => {
|
|
385
442
|
if (defaultOpen === false) setOpen(false);
|
|
@@ -394,7 +451,13 @@ function AppNavigation({ navItems, title, closeOnNavigation, defaultOpen, curren
|
|
|
394
451
|
className: "px-4 pt-4 pb-0",
|
|
395
452
|
children: title
|
|
396
453
|
}),
|
|
397
|
-
|
|
454
|
+
loading ? /* @__PURE__ */ jsx(SidebarGroup, {
|
|
455
|
+
className: "mb-2 p-0! px-0",
|
|
456
|
+
children: /* @__PURE__ */ jsx(SidebarGroupContent, {
|
|
457
|
+
className: "flex flex-col gap-0 py-0",
|
|
458
|
+
children: /* @__PURE__ */ jsx(NavSkeleton, {})
|
|
459
|
+
})
|
|
460
|
+
}) : navItems.length > 0 && /* @__PURE__ */ jsx(NavMenu, {
|
|
398
461
|
className: "h-fit py-2",
|
|
399
462
|
items: navItems,
|
|
400
463
|
currentPath,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as Autocomplete } from "../autocomplete-
|
|
1
|
+
import { t as Autocomplete } from "../autocomplete-DdbTQe6u.mjs";
|
|
2
2
|
export { Autocomplete };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { t as cn } from "./cn-D2KYQ917.mjs";
|
|
2
|
+
import { t as ResponsivePopover } from "./responsive-popover-D-t9bxSN.mjs";
|
|
3
|
+
import { t as LoaderOverlay } from "./loader-overlay-C2WDla6V.mjs";
|
|
4
|
+
import { n as OptionList, t as useOptionPicker } from "./use-option-picker-BXQOfyrK.mjs";
|
|
5
|
+
import { ChevronDown } from "lucide-react";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/components/features/autocomplete/trigger.tsx
|
|
9
|
+
function Trigger({ ref, selectedOption, renderValue, placeholder, loading, disabled, open, id, className, ...rest }) {
|
|
10
|
+
let displayContent;
|
|
11
|
+
if (!selectedOption) displayContent = /* @__PURE__ */ jsx("span", {
|
|
12
|
+
className: "text-muted-foreground",
|
|
13
|
+
children: placeholder
|
|
14
|
+
});
|
|
15
|
+
else if (renderValue) displayContent = renderValue(selectedOption);
|
|
16
|
+
else displayContent = /* @__PURE__ */ jsx("span", {
|
|
17
|
+
className: "truncate",
|
|
18
|
+
children: selectedOption.label
|
|
19
|
+
});
|
|
20
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
21
|
+
ref,
|
|
22
|
+
type: "button",
|
|
23
|
+
id,
|
|
24
|
+
role: "combobox",
|
|
25
|
+
"aria-expanded": open,
|
|
26
|
+
disabled: disabled || loading,
|
|
27
|
+
className: cn("text-input-foreground placeholder:text-input-placeholder", "border-input-border bg-input-background/50 relative flex h-10 w-full items-center justify-between rounded-lg border px-3 py-2 text-left text-sm transition-all", "focus-visible:border-input-focus-border focus-visible:shadow-(--input-focus-shadow)", "focus-visible:ring-0 focus-visible:ring-offset-0 focus-visible:outline-hidden", "aria-invalid:border-destructive", (disabled || loading) && "cursor-not-allowed opacity-50", className),
|
|
28
|
+
...rest,
|
|
29
|
+
children: [
|
|
30
|
+
loading && /* @__PURE__ */ jsx(LoaderOverlay, {}),
|
|
31
|
+
/* @__PURE__ */ jsx("div", {
|
|
32
|
+
className: "min-w-0 flex-1",
|
|
33
|
+
children: displayContent
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "text-muted-foreground ml-2 size-4 shrink-0" })
|
|
36
|
+
]
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
Trigger.displayName = "AutocompleteTrigger";
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/features/autocomplete/autocomplete.tsx
|
|
42
|
+
/**
|
|
43
|
+
* Autocomplete - A searchable select component
|
|
44
|
+
*
|
|
45
|
+
* Standalone, form-agnostic combobox built on ResponsivePopover + OptionList engine.
|
|
46
|
+
* Supports flat/grouped options, virtualization, custom rendering, and async search.
|
|
47
|
+
*
|
|
48
|
+
* @example Basic usage
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <Autocomplete
|
|
51
|
+
* value={country}
|
|
52
|
+
* onValueChange={setCountry}
|
|
53
|
+
* options={countries}
|
|
54
|
+
* placeholder="Select country..."
|
|
55
|
+
* />
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example Async search
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <Autocomplete
|
|
61
|
+
* value={userId}
|
|
62
|
+
* onValueChange={setUserId}
|
|
63
|
+
* options={users ?? []}
|
|
64
|
+
* onSearchChange={setSearch}
|
|
65
|
+
* loading={isLoading}
|
|
66
|
+
* placeholder="Search users..."
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
function Autocomplete({ options, value, onValueChange, onSearchChange, searchPlaceholder = "Search...", disableSearch = false, renderOption, renderValue, placeholder = "Select...", emptyContent = "No results found", footer, creatable = false, creatableLabel, virtualize = false, itemSize = 36, loading = false, modal = false, responsive = true, sheetTitle, disabled = false, name, id, className, triggerClassName, contentClassName, listClassName }) {
|
|
71
|
+
const [open, setOpen] = React$1.useState(false);
|
|
72
|
+
const picker = useOptionPicker({
|
|
73
|
+
multiple: false,
|
|
74
|
+
options,
|
|
75
|
+
value,
|
|
76
|
+
onValueChange,
|
|
77
|
+
onSearchChange,
|
|
78
|
+
creatable,
|
|
79
|
+
creatableLabel,
|
|
80
|
+
closeOnSelect: true,
|
|
81
|
+
open,
|
|
82
|
+
onOpenChange: setOpen
|
|
83
|
+
});
|
|
84
|
+
const flatOptions = React$1.useMemo(() => {
|
|
85
|
+
if (Array.isArray(options) && options.length > 0 && "options" in options[0]) return options.flatMap((g) => g.options);
|
|
86
|
+
return options;
|
|
87
|
+
}, [options]);
|
|
88
|
+
const displayOption = React$1.useMemo(() => {
|
|
89
|
+
const found = flatOptions.find((o) => o.value === value);
|
|
90
|
+
if (found) return found;
|
|
91
|
+
if (creatable && value) return {
|
|
92
|
+
value,
|
|
93
|
+
label: value
|
|
94
|
+
};
|
|
95
|
+
}, [
|
|
96
|
+
flatOptions,
|
|
97
|
+
value,
|
|
98
|
+
creatable
|
|
99
|
+
]);
|
|
100
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
101
|
+
className: cn("relative", className),
|
|
102
|
+
children: [/* @__PURE__ */ jsx(ResponsivePopover, {
|
|
103
|
+
open,
|
|
104
|
+
onOpenChange: setOpen,
|
|
105
|
+
modal,
|
|
106
|
+
responsive,
|
|
107
|
+
sheetTitle: sheetTitle ?? placeholder ?? "Search",
|
|
108
|
+
contentClassName: cn("popover-content-width-full", contentClassName),
|
|
109
|
+
align: "start",
|
|
110
|
+
trigger: /* @__PURE__ */ jsx(Trigger, {
|
|
111
|
+
selectedOption: displayOption,
|
|
112
|
+
renderValue,
|
|
113
|
+
placeholder,
|
|
114
|
+
loading,
|
|
115
|
+
disabled,
|
|
116
|
+
open,
|
|
117
|
+
id,
|
|
118
|
+
className: triggerClassName
|
|
119
|
+
}),
|
|
120
|
+
children: /* @__PURE__ */ jsx(OptionList, {
|
|
121
|
+
picker,
|
|
122
|
+
searchPlaceholder,
|
|
123
|
+
disableSearch,
|
|
124
|
+
emptyContent,
|
|
125
|
+
renderOption,
|
|
126
|
+
footer,
|
|
127
|
+
loading,
|
|
128
|
+
virtualize,
|
|
129
|
+
itemSize,
|
|
130
|
+
listClassName
|
|
131
|
+
})
|
|
132
|
+
}), name && /* @__PURE__ */ jsx("input", {
|
|
133
|
+
type: "hidden",
|
|
134
|
+
name,
|
|
135
|
+
value: value ?? ""
|
|
136
|
+
})]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
Autocomplete.displayName = "Autocomplete";
|
|
140
|
+
//#endregion
|
|
141
|
+
export { Autocomplete as t };
|