@pihanga2/shadcn 0.1.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 +114 -0
- package/cards/badge/badge.component.d.ts +14 -0
- package/cards/badge/badge.component.js +18 -0
- package/cards/badge/badge.component.js.map +1 -0
- package/cards/badge/badge.types.d.ts +37 -0
- package/cards/badge/badge.types.js +7 -0
- package/cards/badge/badge.types.js.map +1 -0
- package/cards/badge/index.d.ts +1 -0
- package/cards/badge/index.js +12 -0
- package/cards/badge/index.js.map +1 -0
- package/cards/box/box.component.d.ts +4 -0
- package/cards/box/box.component.js +24 -0
- package/cards/box/box.component.js.map +1 -0
- package/cards/box/box.types.d.ts +71 -0
- package/cards/box/box.types.js +7 -0
- package/cards/box/box.types.js.map +1 -0
- package/cards/box/index.d.ts +1 -0
- package/cards/box/index.js +12 -0
- package/cards/box/index.js.map +1 -0
- package/cards/button/button.component.d.ts +4 -0
- package/cards/button/button.component.js +71 -0
- package/cards/button/button.component.js.map +1 -0
- package/cards/button/button.types.d.ts +106 -0
- package/cards/button/button.types.js +7 -0
- package/cards/button/button.types.js.map +1 -0
- package/cards/button/index.d.ts +1 -0
- package/cards/button/index.js +13 -0
- package/cards/button/index.js.map +1 -0
- package/cards/checkbox/checkbox.component.d.ts +4 -0
- package/cards/checkbox/checkbox.component.js +36 -0
- package/cards/checkbox/checkbox.component.js.map +1 -0
- package/cards/checkbox/checkbox.types.d.ts +37 -0
- package/cards/checkbox/checkbox.types.js +7 -0
- package/cards/checkbox/checkbox.types.js.map +1 -0
- package/cards/checkbox/index.d.ts +1 -0
- package/cards/checkbox/index.js +13 -0
- package/cards/checkbox/index.js.map +1 -0
- package/cards/conditional/conditional.component.d.ts +11 -0
- package/cards/conditional/conditional.component.js +15 -0
- package/cards/conditional/conditional.component.js.map +1 -0
- package/cards/conditional/conditional.types.d.ts +29 -0
- package/cards/conditional/conditional.types.js +7 -0
- package/cards/conditional/conditional.types.js.map +1 -0
- package/cards/conditional/index.d.ts +1 -0
- package/cards/conditional/index.js +12 -0
- package/cards/conditional/index.js.map +1 -0
- package/cards/core-index.d.ts +30 -0
- package/cards/core-index.js +61 -0
- package/cards/dataTable/dataTable.component.d.ts +4 -0
- package/cards/dataTable/dataTable.component.js +209 -0
- package/cards/dataTable/dataTable.component.js.map +1 -0
- package/cards/dataTable/dataTable.types.d.ts +196 -0
- package/cards/dataTable/dataTable.types.js +13 -0
- package/cards/dataTable/dataTable.types.js.map +1 -0
- package/cards/dataTable/dataTableRowDetail.component.d.ts +26 -0
- package/cards/dataTable/dataTableRowDetail.component.js +47 -0
- package/cards/dataTable/dataTableRowDetail.component.js.map +1 -0
- package/cards/dataTable/index.d.ts +1 -0
- package/cards/dataTable/index.js +16 -0
- package/cards/dataTable/index.js.map +1 -0
- package/cards/dialog/dialog.component.d.ts +4 -0
- package/cards/dialog/dialog.component.js +89 -0
- package/cards/dialog/dialog.component.js.map +1 -0
- package/cards/dialog/dialog.types.d.ts +115 -0
- package/cards/dialog/dialog.types.js +11 -0
- package/cards/dialog/dialog.types.js.map +1 -0
- package/cards/dialog/index.d.ts +1 -0
- package/cards/dialog/index.js +13 -0
- package/cards/dialog/index.js.map +1 -0
- package/cards/dropDownMenu/drop-down.component.d.ts +4 -0
- package/cards/dropDownMenu/drop-down.component.js +205 -0
- package/cards/dropDownMenu/drop-down.component.js.map +1 -0
- package/cards/dropDownMenu/drop-down.types.d.ts +131 -0
- package/cards/dropDownMenu/drop-down.types.js +7 -0
- package/cards/dropDownMenu/drop-down.types.js.map +1 -0
- package/cards/dropDownMenu/dropdown-context.d.ts +7 -0
- package/cards/dropDownMenu/dropdown-context.js +7 -0
- package/cards/dropDownMenu/dropdown-context.js.map +1 -0
- package/cards/dropDownMenu/dropdown-menu.ui.d.ts +42 -0
- package/cards/dropDownMenu/dropdown-menu.ui.js +111 -0
- package/cards/dropDownMenu/dropdown-menu.ui.js.map +1 -0
- package/cards/dropDownMenu/index.d.ts +1 -0
- package/cards/dropDownMenu/index.js +13 -0
- package/cards/dropDownMenu/index.js.map +1 -0
- package/cards/emptyCard.d.ts +7 -0
- package/cards/field/field.component.d.ts +4 -0
- package/cards/field/field.component.js +38 -0
- package/cards/field/field.component.js.map +1 -0
- package/cards/field/field.types.d.ts +30 -0
- package/cards/field/field.types.js +7 -0
- package/cards/field/field.types.js.map +1 -0
- package/cards/field/index.d.ts +1 -0
- package/cards/field/index.js +12 -0
- package/cards/field/index.js.map +1 -0
- package/cards/flexGrid/flexGrid.component.d.ts +4 -0
- package/cards/flexGrid/flexGrid.component.js +40 -0
- package/cards/flexGrid/flexGrid.component.js.map +1 -0
- package/cards/flexGrid/flexGrid.types.d.ts +23 -0
- package/cards/flexGrid/flexGrid.types.js +7 -0
- package/cards/flexGrid/flexGrid.types.js.map +1 -0
- package/cards/flexGrid/index.d.ts +1 -0
- package/cards/flexGrid/index.js +12 -0
- package/cards/flexGrid/index.js.map +1 -0
- package/cards/form/form.component.d.ts +4 -0
- package/cards/form/form.component.js +64 -0
- package/cards/form/form.component.js.map +1 -0
- package/cards/form/form.context.d.ts +23 -0
- package/cards/form/form.context.js +13 -0
- package/cards/form/form.context.js.map +1 -0
- package/cards/form/form.types.d.ts +43 -0
- package/cards/form/form.types.js +7 -0
- package/cards/form/form.types.js.map +1 -0
- package/cards/form/index.d.ts +2 -0
- package/cards/form/index.js +14 -0
- package/cards/form/index.js.map +1 -0
- package/cards/framework/framework.component.d.ts +3 -0
- package/cards/framework/framework.component.js +21 -0
- package/cards/framework/framework.component.js.map +1 -0
- package/cards/framework/index.d.ts +2 -0
- package/cards/framework/index.js +12 -0
- package/cards/framework/index.js.map +1 -0
- package/cards/graphin/graphin.component.d.ts +4 -0
- package/cards/graphin/graphin.types.d.ts +18 -0
- package/cards/graphin/index.d.ts +2 -0
- package/cards/graphin/tooltip.component.d.ts +10 -0
- package/cards/icons.d.ts +15 -0
- package/cards/icons.js +15 -0
- package/cards/icons.js.map +1 -0
- package/cards/input/index.d.ts +1 -0
- package/cards/input/index.js +13 -0
- package/cards/input/index.js.map +1 -0
- package/cards/input/input.component.d.ts +4 -0
- package/cards/input/input.component.js +69 -0
- package/cards/input/input.component.js.map +1 -0
- package/cards/input/input.types.d.ts +80 -0
- package/cards/input/input.types.js +7 -0
- package/cards/input/input.types.js.map +1 -0
- package/cards/jsonViewer/index.d.ts +1 -0
- package/cards/jsonViewer/jsonViewer.component.d.ts +4 -0
- package/cards/jsonViewer/jsonViewer.types.d.ts +76 -0
- package/cards/list/index.d.ts +1 -0
- package/cards/list/index.js +13 -0
- package/cards/list/index.js.map +1 -0
- package/cards/list/list.component.d.ts +4 -0
- package/cards/list/list.component.js +102 -0
- package/cards/list/list.component.js.map +1 -0
- package/cards/list/list.types.d.ts +65 -0
- package/cards/list/list.types.js +7 -0
- package/cards/list/list.types.js.map +1 -0
- package/cards/loadingOverlay/index.d.ts +1 -0
- package/cards/loadingOverlay/index.js +12 -0
- package/cards/loadingOverlay/index.js.map +1 -0
- package/cards/loadingOverlay/loadingOverlay.component.d.ts +4 -0
- package/cards/loadingOverlay/loadingOverlay.component.js +31 -0
- package/cards/loadingOverlay/loadingOverlay.component.js.map +1 -0
- package/cards/loadingOverlay/loadingOverlay.types.d.ts +13 -0
- package/cards/loadingOverlay/loadingOverlay.types.js +7 -0
- package/cards/loadingOverlay/loadingOverlay.types.js.map +1 -0
- package/cards/loadingSkeleton/index.d.ts +1 -0
- package/cards/loadingSkeleton/index.js +12 -0
- package/cards/loadingSkeleton/index.js.map +1 -0
- package/cards/loadingSkeleton/loading-skeleton.component.d.ts +19 -0
- package/cards/loadingSkeleton/loading-skeleton.component.js +33 -0
- package/cards/loadingSkeleton/loading-skeleton.component.js.map +1 -0
- package/cards/loadingSkeleton/loading-skeleton.types.d.ts +94 -0
- package/cards/loadingSkeleton/loading-skeleton.types.js +7 -0
- package/cards/loadingSkeleton/loading-skeleton.types.js.map +1 -0
- package/cards/markdownViewer/index.d.ts +1 -0
- package/cards/markdownViewer/markdownViewer.component.d.ts +4 -0
- package/cards/markdownViewer/markdownViewer.types.d.ts +28 -0
- package/cards/menu/index.d.ts +1 -0
- package/cards/menu/index.js +13 -0
- package/cards/menu/index.js.map +1 -0
- package/cards/menu/menu.component.d.ts +4 -0
- package/cards/menu/menu.component.js +23 -0
- package/cards/menu/menu.component.js.map +1 -0
- package/cards/menu/menu.types.d.ts +53 -0
- package/cards/menu/menu.types.js +7 -0
- package/cards/menu/menu.types.js.map +1 -0
- package/cards/modeToggle/index.d.ts +1 -0
- package/cards/modeToggle/index.js +13 -0
- package/cards/modeToggle/index.js.map +1 -0
- package/cards/modeToggle/mode-toggle.component.d.ts +4 -0
- package/cards/modeToggle/mode-toggle.component.js +32 -0
- package/cards/modeToggle/mode-toggle.component.js.map +1 -0
- package/cards/modeToggle/mode-toggle.types.d.ts +20 -0
- package/cards/modeToggle/mode-toggle.types.js +7 -0
- package/cards/modeToggle/mode-toggle.types.js.map +1 -0
- package/cards/navbarSearch/index.d.ts +1 -0
- package/cards/navbarSearch/index.js +13 -0
- package/cards/navbarSearch/index.js.map +1 -0
- package/cards/navbarSearch/navbarSearch.component.d.ts +3 -0
- package/cards/navbarSearch/navbarSearch.component.js +88 -0
- package/cards/navbarSearch/navbarSearch.component.js.map +1 -0
- package/cards/navbarSearch/navbarSearch.type.d.ts +32 -0
- package/cards/navbarSearch/navbarSearch.type.js +11 -0
- package/cards/navbarSearch/navbarSearch.type.js.map +1 -0
- package/cards/pageWithNavbar/index.d.ts +2 -0
- package/cards/pageWithNavbar/index.js +14 -0
- package/cards/pageWithNavbar/index.js.map +1 -0
- package/cards/pageWithNavbar/pageWithNavbar.component.d.ts +12 -0
- package/cards/pageWithNavbar/pageWithNavbar.component.js +153 -0
- package/cards/pageWithNavbar/pageWithNavbar.component.js.map +1 -0
- package/cards/pageWithNavbar/pageWithNavbar.type.d.ts +81 -0
- package/cards/pageWithNavbar/pageWithNavbar.type.js +7 -0
- package/cards/pageWithNavbar/pageWithNavbar.type.js.map +1 -0
- package/cards/pasteTarget/index.d.ts +1 -0
- package/cards/pasteTarget/index.js +13 -0
- package/cards/pasteTarget/index.js.map +1 -0
- package/cards/pasteTarget/pasteTarget.component.d.ts +4 -0
- package/cards/pasteTarget/pasteTarget.component.js +158 -0
- package/cards/pasteTarget/pasteTarget.component.js.map +1 -0
- package/cards/pasteTarget/pasteTarget.types.d.ts +46 -0
- package/cards/pasteTarget/pasteTarget.types.js +11 -0
- package/cards/pasteTarget/pasteTarget.types.js.map +1 -0
- package/cards/resizable/index.d.ts +1 -0
- package/cards/resizable/resizable.component.d.ts +4 -0
- package/cards/resizable/resizable.types.d.ts +49 -0
- package/cards/select/index.d.ts +1 -0
- package/cards/select/index.js +13 -0
- package/cards/select/index.js.map +1 -0
- package/cards/select/select.component.d.ts +4 -0
- package/cards/select/select.component.js +41 -0
- package/cards/select/select.component.js.map +1 -0
- package/cards/select/select.types.d.ts +73 -0
- package/cards/select/select.types.js +11 -0
- package/cards/select/select.types.js.map +1 -0
- package/cards/stack/index.d.ts +1 -0
- package/cards/stack/index.js +12 -0
- package/cards/stack/index.js.map +1 -0
- package/cards/stack/stack.component.d.ts +7 -0
- package/cards/stack/stack.component.js +83 -0
- package/cards/stack/stack.component.js.map +1 -0
- package/cards/stack/stack.types.d.ts +47 -0
- package/cards/stack/stack.types.js +7 -0
- package/cards/stack/stack.types.js.map +1 -0
- package/cards/stepper/index.d.ts +1 -0
- package/cards/stepper/index.js +13 -0
- package/cards/stepper/index.js.map +1 -0
- package/cards/stepper/stepper.component.d.ts +4 -0
- package/cards/stepper/stepper.component.js +48 -0
- package/cards/stepper/stepper.component.js.map +1 -0
- package/cards/stepper/stepper.types.d.ts +96 -0
- package/cards/stepper/stepper.types.js +7 -0
- package/cards/stepper/stepper.types.js.map +1 -0
- package/cards/switch/index.d.ts +1 -0
- package/cards/switch/index.js +13 -0
- package/cards/switch/index.js.map +1 -0
- package/cards/switch/switch.component.d.ts +4 -0
- package/cards/switch/switch.component.js +34 -0
- package/cards/switch/switch.component.js.map +1 -0
- package/cards/switch/switch.types.d.ts +39 -0
- package/cards/switch/switch.types.js +7 -0
- package/cards/switch/switch.types.js.map +1 -0
- package/cards/tabs/index.d.ts +1 -0
- package/cards/tabs/index.js +13 -0
- package/cards/tabs/index.js.map +1 -0
- package/cards/tabs/tabs.component.d.ts +4 -0
- package/cards/tabs/tabs.component.js +42 -0
- package/cards/tabs/tabs.component.js.map +1 -0
- package/cards/tabs/tabs.types.d.ts +72 -0
- package/cards/tabs/tabs.types.js +7 -0
- package/cards/tabs/tabs.types.js.map +1 -0
- package/cards/textField/index.d.ts +1 -0
- package/cards/textField/index.js +13 -0
- package/cards/textField/index.js.map +1 -0
- package/cards/textField/textField.component.d.ts +4 -0
- package/cards/textField/textField.component.js +29 -0
- package/cards/textField/textField.component.js.map +1 -0
- package/cards/textField/textField.types.d.ts +36 -0
- package/cards/textField/textField.types.js +7 -0
- package/cards/textField/textField.types.js.map +1 -0
- package/cards/toast/index.d.ts +1 -0
- package/cards/toast/index.js +13 -0
- package/cards/toast/index.js.map +1 -0
- package/cards/toast/toast.component.d.ts +4 -0
- package/cards/toast/toast.component.js +76 -0
- package/cards/toast/toast.component.js.map +1 -0
- package/cards/toast/toast.types.d.ts +100 -0
- package/cards/toast/toast.types.js +12 -0
- package/cards/toast/toast.types.js.map +1 -0
- package/cards/toggleGroup/index.d.ts +1 -0
- package/cards/toggleGroup/index.js +13 -0
- package/cards/toggleGroup/index.js.map +1 -0
- package/cards/toggleGroup/toggleGroup.component.d.ts +4 -0
- package/cards/toggleGroup/toggleGroup.component.js +55 -0
- package/cards/toggleGroup/toggleGroup.component.js.map +1 -0
- package/cards/toggleGroup/toggleGroup.types.d.ts +96 -0
- package/cards/toggleGroup/toggleGroup.types.js +7 -0
- package/cards/toggleGroup/toggleGroup.types.js.map +1 -0
- package/cards/types.d.ts +72 -0
- package/cards/types.js +22 -0
- package/cards/types.js.map +1 -0
- package/cards/typography/index.d.ts +1 -0
- package/cards/typography/index.js +12 -0
- package/cards/typography/index.js.map +1 -0
- package/cards/typography/typography.component.d.ts +4 -0
- package/cards/typography/typography.component.js +44 -0
- package/cards/typography/typography.component.js.map +1 -0
- package/cards/typography/typography.types.d.ts +23 -0
- package/cards/typography/typography.types.js +7 -0
- package/cards/typography/typography.types.js.map +1 -0
- package/components/hooks/use-is-touch-device.d.ts +1 -0
- package/components/lib/utils.js +10 -0
- package/components/lib/utils.js.map +1 -0
- package/components/theme-provider/index.d.ts +4 -0
- package/components/theme-provider/index.js +12 -0
- package/components/theme-provider/index.js.map +1 -0
- package/components/theme-provider/theme-provider.component.d.ts +2 -0
- package/components/theme-provider/theme-provider.component.js +31 -0
- package/components/theme-provider/theme-provider.component.js.map +1 -0
- package/components/theme-provider/theme-provider.types.d.ts +12 -0
- package/components/theme-provider/theme-provider.types.js +9 -0
- package/components/theme-provider/theme-provider.types.js.map +1 -0
- package/components/ui/avatar.js +30 -0
- package/components/ui/avatar.js.map +1 -0
- package/components/ui/badge.js +26 -0
- package/components/ui/badge.js.map +1 -0
- package/components/ui/button.js +98 -0
- package/components/ui/button.js.map +1 -0
- package/components/ui/dialog.js +109 -0
- package/components/ui/dialog.js.map +1 -0
- package/components/ui/field.js +68 -0
- package/components/ui/field.js.map +1 -0
- package/components/ui/input.js +16 -0
- package/components/ui/input.js.map +1 -0
- package/components/ui/label.js +16 -0
- package/components/ui/label.js.map +1 -0
- package/components/ui/menubar.js +62 -0
- package/components/ui/menubar.js.map +1 -0
- package/components/ui/select.js +84 -0
- package/components/ui/select.js.map +1 -0
- package/components/ui/separator.js +5 -0
- package/components/ui/sheet.js +49 -0
- package/components/ui/sheet.js.map +1 -0
- package/components/ui/spinner.js +35 -0
- package/components/ui/spinner.js.map +1 -0
- package/components/ui/stepper.js +145 -0
- package/components/ui/stepper.js.map +1 -0
- package/components/ui/switch.js +20 -0
- package/components/ui/switch.js.map +1 -0
- package/components/ui/table.js +61 -0
- package/components/ui/table.js.map +1 -0
- package/components/ui/tabs.js +38 -0
- package/components/ui/tabs.js.map +1 -0
- package/components/ui/toggle-group.js +50 -0
- package/components/ui/toggle-group.js.map +1 -0
- package/components/ui/toggle.js +27 -0
- package/components/ui/toggle.js.map +1 -0
- package/components/ui/tooltip.js +38 -0
- package/components/ui/tooltip.js.map +1 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +10 -0
- package/lib/utils.js.map +1 -0
- package/mountain-snow.svg +4 -0
- package/package.json +203 -0
- package/pihanga-shadcn.css +2 -0
- package/r/badge.json +35 -0
- package/r/box.json +26 -0
- package/r/button.json +39 -0
- package/r/checkbox.json +31 -0
- package/r/conditional.json +30 -0
- package/r/dataTable.json +43 -0
- package/r/dialog.json +36 -0
- package/r/dropDownMenu.json +47 -0
- package/r/field.json +35 -0
- package/r/flexGrid.json +32 -0
- package/r/form.json +37 -0
- package/r/framework.json +28 -0
- package/r/graphin.json +42 -0
- package/r/input.json +35 -0
- package/r/jsonViewer.json +40 -0
- package/r/list.json +39 -0
- package/r/loadingOverlay.json +39 -0
- package/r/loadingSkeleton.json +30 -0
- package/r/markdownViewer.json +51 -0
- package/r/menu.json +34 -0
- package/r/modeToggle.json +36 -0
- package/r/navbarSearch.json +31 -0
- package/r/pageWithNavbar.json +46 -0
- package/r/pasteTarget.json +41 -0
- package/r/pihanga-base.json +11 -0
- package/r/pihanga-cards-icons.json +16 -0
- package/r/pihanga-cards-types.json +16 -0
- package/r/pihanga-hook-use-is-touch-device.json +15 -0
- package/r/pihanga-lib-utils.json +18 -0
- package/r/pihanga-theme-provider.json +25 -0
- package/r/pihanga-ui-extras.json +68 -0
- package/r/registry.json +171 -0
- package/r/resizable.json +35 -0
- package/r/select.json +35 -0
- package/r/stack.json +27 -0
- package/r/stepper.json +39 -0
- package/r/switch.json +36 -0
- package/r/tabs.json +33 -0
- package/r/textField.json +32 -0
- package/r/toast.json +32 -0
- package/r/toggleGroup.json +35 -0
- package/r/typography.json +31 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { DropdownOpenContext as e } from "./dropdown-context.js";
|
|
2
|
+
import { DropdownMenu as t, DropdownMenuCheckboxItem as n, DropdownMenuContent as r, DropdownMenuGroup as i, DropdownMenuItem as a, DropdownMenuLabel as o, DropdownMenuRadioGroup as s, DropdownMenuRadioItem as c, DropdownMenuSeparator as l, DropdownMenuShortcut as u, DropdownMenuSub as d, DropdownMenuSubContent as f, DropdownMenuSubTrigger as p, DropdownMenuTrigger as m } from "./dropdown-menu.ui.js";
|
|
3
|
+
import { Card as h } from "@pihanga2/core";
|
|
4
|
+
import g from "react";
|
|
5
|
+
import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
6
|
+
//#region src/cards/dropDownMenu/drop-down.component.tsx
|
|
7
|
+
var b = (b) => {
|
|
8
|
+
let { trigger: x, menuLabel: S, menuAlign: C, items: w, cardName: T, checkboxCloseDelayMs: E } = b, [D, O] = g.useState(!1), k = g.useRef(null), [A, j] = g.useState({}), M = g.useCallback((e, t) => [...e, t].join("::"), []), N = g.useCallback((e, t = []) => {
|
|
9
|
+
let n = {};
|
|
10
|
+
if (!e?.length) return n;
|
|
11
|
+
for (let r of e) if (!(!r || typeof r == "string")) {
|
|
12
|
+
if (r.type === "group") {
|
|
13
|
+
Object.assign(n, N(r.items, t));
|
|
14
|
+
continue;
|
|
15
|
+
}
|
|
16
|
+
if (r.type === "submenu") {
|
|
17
|
+
let e = B(r);
|
|
18
|
+
Object.assign(n, N(r.items, [...t, e]));
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (r.type === "checkbox") {
|
|
22
|
+
let e = !!(r.checked ?? r.defaultChecked ?? !1);
|
|
23
|
+
n[M(t, r.id)] = e;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return n;
|
|
27
|
+
}, [M]);
|
|
28
|
+
function P() {
|
|
29
|
+
k.current !== null && (window.clearTimeout(k.current), k.current = null);
|
|
30
|
+
}
|
|
31
|
+
function F() {
|
|
32
|
+
P(), O(!1);
|
|
33
|
+
}
|
|
34
|
+
function I(e) {
|
|
35
|
+
P(), k.current = window.setTimeout(() => {
|
|
36
|
+
k.current = null, O(!1);
|
|
37
|
+
}, e);
|
|
38
|
+
}
|
|
39
|
+
g.useEffect(() => () => {
|
|
40
|
+
P();
|
|
41
|
+
}, []), g.useEffect(() => {
|
|
42
|
+
D && j(N(w));
|
|
43
|
+
}, [
|
|
44
|
+
D,
|
|
45
|
+
w,
|
|
46
|
+
N
|
|
47
|
+
]);
|
|
48
|
+
function L() {
|
|
49
|
+
return /* @__PURE__ */ v("span", {
|
|
50
|
+
className: "inline-flex",
|
|
51
|
+
"data-pihanga-trigger-wrapper": !0,
|
|
52
|
+
children: /* @__PURE__ */ v(e.Provider, {
|
|
53
|
+
value: D,
|
|
54
|
+
children: /* @__PURE__ */ v(h, {
|
|
55
|
+
cardName: x,
|
|
56
|
+
parentCard: T
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function R() {
|
|
62
|
+
return S ? /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(o, { children: S }), /* @__PURE__ */ v(l, {})] }) : null;
|
|
63
|
+
}
|
|
64
|
+
function z(e) {
|
|
65
|
+
return typeof e == "string" ? e : /* @__PURE__ */ v(h, {
|
|
66
|
+
cardName: e,
|
|
67
|
+
parentCard: T
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function B(e) {
|
|
71
|
+
return e.id ? e.id : typeof e.label == "string" ? e.label : "submenu";
|
|
72
|
+
}
|
|
73
|
+
function V(e) {
|
|
74
|
+
b.onSelected(e);
|
|
75
|
+
}
|
|
76
|
+
function H(e) {
|
|
77
|
+
return e ? /* @__PURE__ */ v(u, { children: e }) : null;
|
|
78
|
+
}
|
|
79
|
+
function U(e, t = []) {
|
|
80
|
+
return e.map((e, r) => {
|
|
81
|
+
if (e === null) return /* @__PURE__ */ v(l, {}, `sep-${r}`);
|
|
82
|
+
if (typeof e == "string") return /* @__PURE__ */ v(a, {
|
|
83
|
+
onSelect: () => V({
|
|
84
|
+
type: "item",
|
|
85
|
+
id: e,
|
|
86
|
+
path: t
|
|
87
|
+
}),
|
|
88
|
+
children: e
|
|
89
|
+
}, `s-${r}`);
|
|
90
|
+
if (e.type === "separator") return /* @__PURE__ */ v(l, {}, `sepobj-${r}`);
|
|
91
|
+
if (e.type === "label") {
|
|
92
|
+
let t = e;
|
|
93
|
+
return /* @__PURE__ */ v(o, {
|
|
94
|
+
inset: t.inset,
|
|
95
|
+
children: z(t.label)
|
|
96
|
+
}, `label-${r}`);
|
|
97
|
+
}
|
|
98
|
+
if (e.type === "group") {
|
|
99
|
+
let n = e;
|
|
100
|
+
return /* @__PURE__ */ y(i, { children: [n.label && /* @__PURE__ */ v(o, {
|
|
101
|
+
inset: n.inset,
|
|
102
|
+
children: z(n.label)
|
|
103
|
+
}), U(n.items, t)] }, `group-${r}`);
|
|
104
|
+
}
|
|
105
|
+
if (e.type === "submenu") {
|
|
106
|
+
let n = e, i = B(n), a = [...t, i];
|
|
107
|
+
return /* @__PURE__ */ y(d, { children: [/* @__PURE__ */ y(p, {
|
|
108
|
+
inset: n.inset,
|
|
109
|
+
disabled: n.disabled,
|
|
110
|
+
children: [z(n.label), H(n.shortcut)]
|
|
111
|
+
}), /* @__PURE__ */ v(f, { children: U(n.items, a) })] }, `sub-${r}`);
|
|
112
|
+
}
|
|
113
|
+
if (e.type === "checkbox") {
|
|
114
|
+
let r = e, i = M(t, r.id);
|
|
115
|
+
return /* @__PURE__ */ y(n, {
|
|
116
|
+
checked: A[i] ?? !!(r.checked ?? r.defaultChecked ?? !1),
|
|
117
|
+
disabled: r.disabled,
|
|
118
|
+
onCheckedChange: (e) => {
|
|
119
|
+
let n = !!e;
|
|
120
|
+
j((e) => ({
|
|
121
|
+
...e,
|
|
122
|
+
[i]: n
|
|
123
|
+
})), V({
|
|
124
|
+
type: "checkbox",
|
|
125
|
+
id: r.id,
|
|
126
|
+
checked: n,
|
|
127
|
+
path: t
|
|
128
|
+
}), typeof E == "number" && (E > 0 ? I(E) : F());
|
|
129
|
+
},
|
|
130
|
+
onSelect: (e) => {
|
|
131
|
+
(r.keepOpen || typeof E == "number") && e.preventDefault();
|
|
132
|
+
},
|
|
133
|
+
children: [z(r.label), H(r.shortcut)]
|
|
134
|
+
}, `cb-${r.id}`);
|
|
135
|
+
}
|
|
136
|
+
if (e.type === "radio-group") {
|
|
137
|
+
let n = e;
|
|
138
|
+
return /* @__PURE__ */ y(s, {
|
|
139
|
+
value: n.value,
|
|
140
|
+
defaultValue: n.defaultValue,
|
|
141
|
+
onValueChange: (e) => {
|
|
142
|
+
V({
|
|
143
|
+
type: "radio",
|
|
144
|
+
id: n.id,
|
|
145
|
+
value: e,
|
|
146
|
+
path: t
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
children: [n.label && /* @__PURE__ */ v(o, {
|
|
150
|
+
inset: n.inset,
|
|
151
|
+
children: z(n.label)
|
|
152
|
+
}), n.items.map((e) => /* @__PURE__ */ y(c, {
|
|
153
|
+
value: e.value,
|
|
154
|
+
disabled: e.disabled,
|
|
155
|
+
className: e.inset ? "pl-8" : void 0,
|
|
156
|
+
hideIcon: e.hideIcon,
|
|
157
|
+
onSelect: (t) => {
|
|
158
|
+
e.keepOpen && t.preventDefault();
|
|
159
|
+
},
|
|
160
|
+
children: [z(e.label), H(e.shortcut)]
|
|
161
|
+
}, `${n.id}:${e.value}`))]
|
|
162
|
+
}, `rg-${n.id}`);
|
|
163
|
+
}
|
|
164
|
+
if (e.type === "item") {
|
|
165
|
+
let n = e;
|
|
166
|
+
return /* @__PURE__ */ y(a, {
|
|
167
|
+
disabled: n.disabled,
|
|
168
|
+
className: n.inset ? "pl-8" : void 0,
|
|
169
|
+
onSelect: (e) => {
|
|
170
|
+
n.keepOpen && e.preventDefault(), V({
|
|
171
|
+
type: "item",
|
|
172
|
+
id: n.id,
|
|
173
|
+
path: t
|
|
174
|
+
});
|
|
175
|
+
},
|
|
176
|
+
children: [z(n.label), H(n.shortcut)]
|
|
177
|
+
}, `it-${n.id}`);
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
let W = w;
|
|
183
|
+
return /* @__PURE__ */ y(t, {
|
|
184
|
+
"data-pihanga": T,
|
|
185
|
+
open: D,
|
|
186
|
+
onOpenChange: (e) => {
|
|
187
|
+
if (!e) {
|
|
188
|
+
F();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
P(), j(N(w)), O(!0);
|
|
192
|
+
},
|
|
193
|
+
children: [/* @__PURE__ */ v(m, {
|
|
194
|
+
asChild: !0,
|
|
195
|
+
children: L()
|
|
196
|
+
}), /* @__PURE__ */ y(r, {
|
|
197
|
+
align: C,
|
|
198
|
+
children: [R(), W?.length ? U(W) : null]
|
|
199
|
+
})]
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
//#endregion
|
|
203
|
+
export { b as Component };
|
|
204
|
+
|
|
205
|
+
//# sourceMappingURL=drop-down.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-down.component.js","names":[],"sources":["../../../src/cards/dropDownMenu/drop-down.component.tsx"],"sourcesContent":["import React from \"react\";\nimport {Card, type PiCardProps} from \"@pihanga2/core\";\n\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"./dropdown-menu.ui\";\n\nimport type {\n DropDownMenuEntry,\n DropDownMenuEvents,\n DropDownMenuProps,\n MenuContent,\n MenuLabelEntry,\n MenuSubMenuEntry,\n} from \"./drop-down.types\";\n\nimport {DropdownOpenContext} from \"./dropdown-context\";\n\nexport const Component = (\n props: PiCardProps<DropDownMenuProps, DropDownMenuEvents>,\n): React.ReactNode => {\n const {trigger, menuLabel, menuAlign, items, cardName, checkboxCloseDelayMs} =\n props;\n\n const [open, setOpen] = React.useState(false);\n const closeTimerRef = React.useRef<number | null>(null);\n\n const [localCheckboxChecked, setLocalCheckboxChecked] = React.useState<\n Record<string, boolean>\n >({});\n\n const checkboxKey = React.useCallback((path: string[], id: string) => {\n return [...path, id].join(\"::\");\n }, []);\n\n const buildCheckboxStateFromItems = React.useCallback(\n (\n entries: DropDownMenuEntry[] | undefined,\n path: string[] = [],\n ): Record<string, boolean> => {\n const state: Record<string, boolean> = {};\n if (!entries?.length) return state;\n\n for (const entry of entries) {\n if (!entry || typeof entry === \"string\") continue;\n if (entry.type === \"group\") {\n Object.assign(state, buildCheckboxStateFromItems(entry.items, path));\n continue;\n }\n if (entry.type === \"submenu\") {\n const subId = entryIdForPath(entry);\n Object.assign(\n state,\n buildCheckboxStateFromItems(entry.items, [...path, subId]),\n );\n continue;\n }\n if (entry.type === \"checkbox\") {\n const initial = Boolean(\n entry.checked ?? entry.defaultChecked ?? false,\n );\n state[checkboxKey(path, entry.id)] = initial;\n }\n }\n\n return state;\n },\n [checkboxKey],\n );\n\n function clearCloseTimer() {\n if (closeTimerRef.current !== null) {\n window.clearTimeout(closeTimerRef.current);\n closeTimerRef.current = null;\n }\n }\n\n function closeNow() {\n clearCloseTimer();\n setOpen(false);\n }\n\n function scheduleClose(delayMs: number) {\n clearCloseTimer();\n closeTimerRef.current = window.setTimeout(() => {\n closeTimerRef.current = null;\n setOpen(false);\n }, delayMs);\n }\n\n React.useEffect(() => {\n return () => {\n // cleanup on unmount\n clearCloseTimer();\n };\n }, []);\n\n // If the menu model changes while open, resync the local checkbox state.\n // This lets external state updates still win.\n React.useEffect(() => {\n if (!open) return;\n setLocalCheckboxChecked(buildCheckboxStateFromItems(items));\n }, [open, items, buildCheckboxStateFromItems]);\n\n function renderTrigger() {\n // IMPORTANT: Radix `DropdownMenuTrigger` with `asChild` requires its direct\n // child to accept/forward the props Radix injects (pointer handlers, aria\n // attributes, refs). `@pihanga2/core`'s <Card /> does not forward arbitrary\n // props to the underlying DOM element rendered by the referenced card.\n //\n // So we always provide a real DOM element as the trigger and render the\n // PiCard inside it. Events bubble, so clicking the inner PiButton still\n // toggles the menu.\n //\n // We provide the dropdown's open state via context so nested components\n // (like Button) can hide their tooltips when the dropdown is open.\n return (\n <span className=\"inline-flex\" data-pihanga-trigger-wrapper>\n <DropdownOpenContext.Provider value={open}>\n <Card cardName={trigger} parentCard={cardName} />\n </DropdownOpenContext.Provider>\n </span>\n );\n }\n\n function renderLabel() {\n if (!menuLabel) return null;\n return (\n <>\n <DropdownMenuLabel>{menuLabel}</DropdownMenuLabel>\n <DropdownMenuSeparator />\n </>\n );\n }\n\n function contentToNode(content: MenuContent): React.ReactNode {\n if (typeof content === \"string\") return content;\n return <Card cardName={content} parentCard={cardName} />;\n }\n\n function entryIdForPath(entry: MenuSubMenuEntry): string {\n if (entry.id) return entry.id;\n return typeof entry.label === \"string\" ? entry.label : \"submenu\";\n }\n\n function emitSelected(ev: {\n type: \"item\" | \"checkbox\" | \"radio\";\n id: string;\n value?: string;\n checked?: boolean;\n path?: string[];\n }) {\n props.onSelected(ev);\n }\n\n function renderShortcut(shortcut?: string) {\n if (!shortcut) return null;\n return <DropdownMenuShortcut>{shortcut}</DropdownMenuShortcut>;\n }\n\n function renderEntries(entries: DropDownMenuEntry[], path: string[] = []) {\n return entries.map((entry, idx) => {\n if (entry === null) {\n return <DropdownMenuSeparator key={`sep-${idx}`} />;\n }\n\n if (typeof entry === \"string\") {\n // legacy style within `items` (still supported)\n return (\n <DropdownMenuItem\n key={`s-${idx}`}\n onSelect={() => emitSelected({type: \"item\", id: entry, path})}\n >\n {entry}\n </DropdownMenuItem>\n );\n }\n\n if (entry.type === \"separator\") {\n return <DropdownMenuSeparator key={`sepobj-${idx}`} />;\n }\n\n if (entry.type === \"label\") {\n const e: MenuLabelEntry = entry;\n return (\n <DropdownMenuLabel key={`label-${idx}`} inset={e.inset}>\n {contentToNode(e.label)}\n </DropdownMenuLabel>\n );\n }\n\n if (entry.type === \"group\") {\n const e = entry;\n return (\n <DropdownMenuGroup key={`group-${idx}`}>\n {e.label && (\n <DropdownMenuLabel inset={e.inset}>\n {contentToNode(e.label)}\n </DropdownMenuLabel>\n )}\n {renderEntries(e.items, path)}\n </DropdownMenuGroup>\n );\n }\n\n if (entry.type === \"submenu\") {\n const e: MenuSubMenuEntry = entry;\n const subId = entryIdForPath(e);\n const nextPath = [...path, subId];\n return (\n <DropdownMenuSub key={`sub-${idx}`}>\n <DropdownMenuSubTrigger inset={e.inset} disabled={e.disabled}>\n {contentToNode(e.label)}\n {renderShortcut(e.shortcut)}\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent>\n {renderEntries(e.items, nextPath)}\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n }\n\n if (entry.type === \"checkbox\") {\n const e = entry;\n const key = checkboxKey(path, e.id);\n const checked =\n localCheckboxChecked[key] ??\n Boolean(e.checked ?? e.defaultChecked ?? false);\n return (\n <DropdownMenuCheckboxItem\n key={`cb-${e.id}`}\n checked={checked}\n disabled={e.disabled}\n onCheckedChange={(checked) => {\n const nextChecked = Boolean(checked);\n\n // Update local state immediately so the tick updates while menu is open.\n setLocalCheckboxChecked((prev) => ({\n ...prev,\n [key]: nextChecked,\n }));\n\n emitSelected({\n type: \"checkbox\",\n id: e.id,\n checked: nextChecked,\n path,\n });\n\n // If a delay is configured, keep menu open but schedule an auto-close.\n // Each checkbox selection resets the timer.\n if (typeof checkboxCloseDelayMs === \"number\") {\n if (checkboxCloseDelayMs > 0) {\n scheduleClose(checkboxCloseDelayMs);\n } else {\n // Treat 0ms as \"close immediately\".\n closeNow();\n }\n }\n }}\n onSelect={(evt) => {\n // keepOpen OR delayed-close mode should keep menu open after select.\n if (e.keepOpen || typeof checkboxCloseDelayMs === \"number\") {\n evt.preventDefault();\n }\n }}\n >\n {contentToNode(e.label)}\n {renderShortcut(e.shortcut)}\n </DropdownMenuCheckboxItem>\n );\n }\n\n if (entry.type === \"radio-group\") {\n const e = entry;\n return (\n <DropdownMenuRadioGroup\n key={`rg-${e.id}`}\n value={e.value}\n defaultValue={e.defaultValue}\n onValueChange={(value) => {\n emitSelected({type: \"radio\", id: e.id, value, path});\n }}\n >\n {e.label && (\n <DropdownMenuLabel inset={e.inset}>\n {contentToNode(e.label)}\n </DropdownMenuLabel>\n )}\n {e.items.map((ri) => (\n <DropdownMenuRadioItem\n key={`${e.id}:${ri.value}`}\n value={ri.value}\n disabled={ri.disabled}\n className={ri.inset ? \"pl-8\" : undefined}\n hideIcon={ri.hideIcon}\n onSelect={(evt) => {\n if (ri.keepOpen) evt.preventDefault();\n }}\n >\n {contentToNode(ri.label)}\n {renderShortcut(ri.shortcut)}\n </DropdownMenuRadioItem>\n ))}\n </DropdownMenuRadioGroup>\n );\n }\n\n if (entry.type === \"item\") {\n const e = entry;\n return (\n <DropdownMenuItem\n key={`it-${e.id}`}\n disabled={e.disabled}\n className={e.inset ? \"pl-8\" : undefined}\n onSelect={(evt) => {\n if (e.keepOpen) evt.preventDefault();\n emitSelected({type: \"item\", id: e.id, path});\n }}\n >\n {contentToNode(e.label)}\n {renderShortcut(e.shortcut)}\n </DropdownMenuItem>\n );\n }\n\n // Exhaustiveness guard (should never happen)\n return null;\n });\n }\n\n const effectiveItems = items;\n\n return (\n <DropdownMenu\n data-pihanga={cardName}\n open={open}\n onOpenChange={(nextOpen) => {\n // Any non-checkbox close reason (outside click, escape, blur, etc.)\n // should close immediately and cancel pending timers.\n if (!nextOpen) {\n closeNow();\n return;\n }\n\n clearCloseTimer();\n setLocalCheckboxChecked(buildCheckboxStateFromItems(items));\n setOpen(true);\n }}\n >\n <DropdownMenuTrigger asChild>{renderTrigger()}</DropdownMenuTrigger>\n <DropdownMenuContent align={menuAlign}>\n {renderLabel()}\n {effectiveItems?.length ? ren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B;CAEvB,OACE,kBAAC,GAAD;EACE,gBAAc;EACR;EACN,eAAe,MAAa;GAG1B,IAAI,CAAC,GAAU;IACb,EAAS;IACT;GACF;GAIA,AAFA,EAAgB,GAChB,EAAwB,EAA4B,CAAK,CAAC,GAC1D,EAAQ,EAAI;EACd;YAdF,CAgBE,kBAAC,GAAD;GAAqB,SAAA;aAAS,EAAc;EAAuB,CAAA,GACnE,kBAAC,GAAD;GAAqB,OAAO;aAA5B,CACG,EAAY,GACZ,GAAgB,SAAS,EAAc,CAAc,IAAI,IACvC;IACT;;AAElB"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { PiCardRef } from '@pihanga2/core';
|
|
2
|
+
export declare const DROP_DOWN_MENU_CARD = "pi/drop-down-menu";
|
|
3
|
+
export declare const DropDownMenu: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<DropDownMenuProps, S, DropDownMenuEvents>) => import('@pihanga2/core').PiCardDef;
|
|
4
|
+
export declare const DROP_DOWN_MENU_ACTION: {
|
|
5
|
+
SELECTED: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const onDropDownMenuClicked: <S extends import('@pihanga2/core').ReduxState>(register: import('@pihanga2/core').PiRegister, f: import('@pihanga2/core').ReduceF<S, import('@pihanga2/core').ReduxAction & {
|
|
8
|
+
cardID: string;
|
|
9
|
+
} & DropDownMenuSelectedEventAdvanced>) => void;
|
|
10
|
+
export type DropDownMenuProps = {
|
|
11
|
+
/**
|
|
12
|
+
* Dropdown trigger.
|
|
13
|
+
*
|
|
14
|
+
* - For a PiButton (or any custom) trigger, pass a `PiCardRef` and use the
|
|
15
|
+
* referenced card's props. For `PiButton` specifically:
|
|
16
|
+
* - `opts.iconName` + `opts.iconPlacement` to show an icon on the left/right.
|
|
17
|
+
* - `label: ""` for an icon-only button.
|
|
18
|
+
*
|
|
19
|
+
* Implementation note: the dropdown trigger is wrapped in a DOM element so
|
|
20
|
+
* Radix can attach trigger handlers even when the trigger is rendered via
|
|
21
|
+
* `@pihanga2/core`'s `<Card />`.
|
|
22
|
+
*/
|
|
23
|
+
trigger: PiCardRef;
|
|
24
|
+
menuAlign?: "center" | "end" | "start";
|
|
25
|
+
menuLabel?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Menu declaration (supports sub-menus, checkbox/radio items, groups, labels, separators, ...).
|
|
28
|
+
*
|
|
29
|
+
* Prefer this over `itemGroups`.
|
|
30
|
+
*/
|
|
31
|
+
items?: DropDownMenuEntry[];
|
|
32
|
+
/**
|
|
33
|
+
* When set (ms), selecting a checkbox item will keep the menu open and auto-close
|
|
34
|
+
* it after this delay. Each checkbox selection resets the timer.
|
|
35
|
+
*
|
|
36
|
+
* Blur / outside interactions still close immediately.
|
|
37
|
+
*/
|
|
38
|
+
checkboxCloseDelayMs?: number;
|
|
39
|
+
className?: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Menu content can either be plain text or an embedded PiCard.
|
|
43
|
+
*
|
|
44
|
+
* NOTE: we intentionally type this as `PiCardRef` (a string), not a card definition.
|
|
45
|
+
*/
|
|
46
|
+
export type MenuContent = string | PiCardRef;
|
|
47
|
+
export type MenuSeparatorEntry = null | {
|
|
48
|
+
type: "separator";
|
|
49
|
+
};
|
|
50
|
+
export type MenuLabelEntry = {
|
|
51
|
+
type: "label";
|
|
52
|
+
label: MenuContent;
|
|
53
|
+
inset?: boolean;
|
|
54
|
+
};
|
|
55
|
+
export type MenuActionItemEntry = {
|
|
56
|
+
type: "item";
|
|
57
|
+
id: string;
|
|
58
|
+
label: MenuContent;
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
inset?: boolean;
|
|
61
|
+
shortcut?: string;
|
|
62
|
+
/** Prevents the dropdown from closing when selected. */
|
|
63
|
+
keepOpen?: boolean;
|
|
64
|
+
};
|
|
65
|
+
export type MenuCheckboxItemEntry = {
|
|
66
|
+
type: "checkbox";
|
|
67
|
+
id: string;
|
|
68
|
+
label: MenuContent;
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
inset?: boolean;
|
|
71
|
+
shortcut?: string;
|
|
72
|
+
checked?: boolean;
|
|
73
|
+
defaultChecked?: boolean;
|
|
74
|
+
/** Prevents the dropdown from closing when selected. */
|
|
75
|
+
keepOpen?: boolean;
|
|
76
|
+
};
|
|
77
|
+
export type MenuRadioItemEntry = {
|
|
78
|
+
value: string;
|
|
79
|
+
label: MenuContent;
|
|
80
|
+
disabled?: boolean;
|
|
81
|
+
inset?: boolean;
|
|
82
|
+
shortcut?: string;
|
|
83
|
+
/** Prevents the dropdown from closing when selected. */
|
|
84
|
+
keepOpen?: boolean;
|
|
85
|
+
/** Only affects the icon rendering (registry/ui supports this). */
|
|
86
|
+
hideIcon?: boolean;
|
|
87
|
+
};
|
|
88
|
+
export type MenuRadioGroupEntry = {
|
|
89
|
+
type: "radio-group";
|
|
90
|
+
id: string;
|
|
91
|
+
label?: MenuContent;
|
|
92
|
+
/** Optional extra left padding for the label (matches shadcn dropdown label inset). */
|
|
93
|
+
inset?: boolean;
|
|
94
|
+
value?: string;
|
|
95
|
+
defaultValue?: string;
|
|
96
|
+
items: MenuRadioItemEntry[];
|
|
97
|
+
};
|
|
98
|
+
export type MenuGroupEntry = {
|
|
99
|
+
type: "group";
|
|
100
|
+
label?: MenuContent;
|
|
101
|
+
/** Optional extra left padding for the label (matches shadcn dropdown label inset). */
|
|
102
|
+
inset?: boolean;
|
|
103
|
+
items: DropDownMenuEntry[];
|
|
104
|
+
};
|
|
105
|
+
export type MenuSubMenuEntry = {
|
|
106
|
+
type: "submenu";
|
|
107
|
+
/** Optional id used for event `path` (falls back to label string if possible). */
|
|
108
|
+
id?: string;
|
|
109
|
+
label: MenuContent;
|
|
110
|
+
disabled?: boolean;
|
|
111
|
+
inset?: boolean;
|
|
112
|
+
shortcut?: string;
|
|
113
|
+
items: DropDownMenuEntry[];
|
|
114
|
+
};
|
|
115
|
+
export type DropDownMenuEntry = string | MenuSeparatorEntry | MenuLabelEntry | MenuActionItemEntry | MenuCheckboxItemEntry | MenuRadioGroupEntry | MenuGroupEntry | MenuSubMenuEntry;
|
|
116
|
+
export type DropDownMenuSelectedEventAdvanced = {
|
|
117
|
+
/** Discriminant for advanced menu items. */
|
|
118
|
+
type: "item" | "checkbox" | "radio";
|
|
119
|
+
/** The id of the selected menu entry (or the radio group id for `type: 'radio'`). */
|
|
120
|
+
id: string;
|
|
121
|
+
/** For radio items this is the selected value. */
|
|
122
|
+
value?: string;
|
|
123
|
+
/** For checkbox items this is the new checked state. */
|
|
124
|
+
checked?: boolean;
|
|
125
|
+
/** Hierarchical path of submenu ids leading to the item (if any). */
|
|
126
|
+
path?: string[];
|
|
127
|
+
};
|
|
128
|
+
export type DropDownMenuSelectedEvent = DropDownMenuSelectedEventAdvanced;
|
|
129
|
+
export type DropDownMenuEvents = {
|
|
130
|
+
onSelected: DropDownMenuSelectedEvent;
|
|
131
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createCardDeclaration as e, createOnAction as t, registerActions as n } from "@pihanga2/core";
|
|
2
|
+
//#region src/cards/dropDownMenu/drop-down.types.ts
|
|
3
|
+
var r = "pi/drop-down-menu", i = e(r), a = n(r, ["selected"]), o = t(a.SELECTED);
|
|
4
|
+
//#endregion
|
|
5
|
+
export { a as DROP_DOWN_MENU_ACTION, r as DROP_DOWN_MENU_CARD, i as DropDownMenu, o as onDropDownMenuClicked };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=drop-down.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-down.types.js","names":[],"sources":["../../../src/cards/dropDownMenu/drop-down.types.ts"],"sourcesContent":["import {\n createCardDeclaration,\n createOnAction,\n type PiCardRef,\n registerActions,\n} from \"@pihanga2/core\";\n\nexport const DROP_DOWN_MENU_CARD = \"pi/drop-down-menu\";\nexport const DropDownMenu = createCardDeclaration<\n DropDownMenuProps,\n DropDownMenuEvents\n>(DROP_DOWN_MENU_CARD);\n\nexport const DROP_DOWN_MENU_ACTION = registerActions(DROP_DOWN_MENU_CARD, [\n \"selected\",\n]);\n\nexport const onDropDownMenuClicked = createOnAction<DropDownMenuSelectedEvent>(\n DROP_DOWN_MENU_ACTION.SELECTED,\n);\n\nexport type DropDownMenuProps = {\n /**\n * Dropdown trigger.\n *\n * - For a PiButton (or any custom) trigger, pass a `PiCardRef` and use the\n * referenced card's props. For `PiButton` specifically:\n * - `opts.iconName` + `opts.iconPlacement` to show an icon on the left/right.\n * - `label: \"\"` for an icon-only button.\n *\n * Implementation note: the dropdown trigger is wrapped in a DOM element so\n * Radix can attach trigger handlers even when the trigger is rendered via\n * `@pihanga2/core`'s `<Card />`.\n */\n trigger: PiCardRef;\n menuAlign?: \"center\" | \"end\" | \"start\";\n menuLabel?: string;\n\n /**\n * Menu declaration (supports sub-menus, checkbox/radio items, groups, labels, separators, ...).\n *\n * Prefer this over `itemGroups`.\n */\n items?: DropDownMenuEntry[];\n\n /**\n * When set (ms), selecting a checkbox item will keep the menu open and auto-close\n * it after this delay. Each checkbox selection resets the timer.\n *\n * Blur / outside interactions still close immediately.\n */\n checkboxCloseDelayMs?: number;\n\n className?: string;\n};\n\n/**\n * Menu content can either be plain text or an embedded PiCard.\n *\n * NOTE: we intentionally type this as `PiCardRef` (a string), not a card definition.\n */\nexport type MenuContent = string | PiCardRef;\n\nexport type MenuSeparatorEntry = null | {type: \"separator\"};\n\nexport type MenuLabelEntry = {\n type: \"label\";\n label: MenuContent;\n inset?: boolean;\n};\n\nexport type MenuActionItemEntry = {\n type: \"item\";\n id: string;\n label: MenuContent;\n disabled?: boolean;\n inset?: boolean;\n shortcut?: string;\n /** Prevents the dropdown from closing when selected. */\n keepOpen?: boolean;\n};\n\nexport type MenuCheckboxItemEntry = {\n type: \"checkbox\";\n id: string;\n label: MenuContent;\n disabled?: boolean;\n inset?: boolean;\n shortcut?: string;\n checked?: boolean;\n defaultChecked?: boolean;\n /** Prevents the dropdown from closing when selected. */\n keepOpen?: boolean;\n};\n\nexport type MenuRadioItemEntry = {\n value: string;\n label: MenuContent;\n disabled?: boolean;\n inset?: boolean;\n shortcut?: string;\n /** Prevents the dropdown from closing when selected. */\n keepOpen?: boolean;\n /** Only affects the icon rendering (registry/ui supports this). */\n hideIcon?: boolean;\n};\n\nexport type MenuRadioGroupEntry = {\n type: \"radio-group\";\n id: string;\n label?: MenuContent;\n /** Optional extra left padding for the label (matches shadcn dropdown label inset). */\n inset?: boolean;\n value?: string;\n defaultValue?: string;\n items: MenuRadioItemEntry[];\n};\n\nexport type MenuGroupEntry = {\n type: \"group\";\n label?: MenuContent;\n /** Optional extra left padding for the label (matches shadcn dropdown label inset). */\n inset?: boolean;\n items: DropDownMenuEntry[];\n};\n\nexport type MenuSubMenuEntry = {\n type: \"submenu\";\n /** Optional id used for event `path` (falls back to label string if possible). */\n id?: string;\n label: MenuContent;\n disabled?: boolean;\n inset?: boolean;\n shortcut?: string;\n items: DropDownMenuEntry[];\n};\n\nexport type DropDownMenuEntry =\n | string\n | MenuSeparatorEntry\n | MenuLabelEntry\n | MenuActionItemEntry\n | MenuCheckboxItemEntry\n | MenuRadioGroupEntry\n | MenuGroupEntry\n | MenuSubMenuEntry;\n\nexport type DropDownMenuSelectedEventAdvanced = {\n /** Discriminant for advanced menu items. */\n type: \"item\" | \"checkbox\" | \"radio\";\n\n /** The id of the selected menu entry (or the radio group id for `type: 'radio'`). */\n id: string;\n\n /** For radio items this is the selected value. */\n value?: string;\n\n /** For checkbox items this is the new checked state. */\n checked?: boolean;\n\n /** Hierarchical path of submenu ids leading to the item (if any). */\n path?: string[];\n};\n\nexport type DropDownMenuSelectedEvent = DropDownMenuSelectedEventAdvanced;\n\nexport type DropDownMenuEvents = {\n onSelected: DropDownMenuSelectedEvent;\n};\n"],"mappings":";;AAOA,IAAa,IAAsB,qBACtB,IAAe,EAG1B,CAAmB,GAER,IAAwB,EAAgB,GAAqB,CACxE,UACF,CAAC,GAEY,IAAwB,EACnC,EAAsB,QACxB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Context to communicate dropdown menu state to nested components (e.g., Button triggers).
|
|
4
|
+
* This allows triggers to hide their tooltips when the dropdown is open.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DropdownOpenContext: React.Context<boolean>;
|
|
7
|
+
export declare const useDropdownOpen: () => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-context.js","names":[],"sources":["../../../src/cards/dropDownMenu/dropdown-context.tsx"],"sourcesContent":["import React from \"react\";\n\n/**\n * Context to communicate dropdown menu state to nested components (e.g., Button triggers).\n * This allows triggers to hide their tooltips when the dropdown is open.\n */\nexport const DropdownOpenContext = React.createContext<boolean>(false);\n\nexport const useDropdownOpen = () => React.useContext(DropdownOpenContext);\n"],"mappings":";;AAMA,IAAa,IAAsB,EAAM,cAAuB,EAAK,GAExD,UAAwB,EAAM,WAAW,CAAmB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
4
|
+
/**
|
|
5
|
+
* Pihanga-owned copy of the registry dropdown-menu primitives.
|
|
6
|
+
*
|
|
7
|
+
* Why this exists:
|
|
8
|
+
* - `src/registry/**` is upstream-managed and must remain read-only.
|
|
9
|
+
* - We needed menu width/shrink-to-fit fixes (`w-max`, avoid %/calc widths)
|
|
10
|
+
* for correct sizing with long labels.
|
|
11
|
+
*/
|
|
12
|
+
export declare const dropdownMenuItemVariants: (props?: ({
|
|
13
|
+
size?: "default" | "none" | null | undefined;
|
|
14
|
+
variant?: "default" | "none" | null | undefined;
|
|
15
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
16
|
+
export declare function DropdownMenu(props: DropdownMenuPrimitive.DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function DropdownMenuTrigger(props: DropdownMenuPrimitive.DropdownMenuTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function DropdownMenuGroup(props: DropdownMenuPrimitive.DropdownMenuGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function DropdownMenuPortal(props: DropdownMenuPrimitive.DropdownMenuPortalProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function DropdownMenuSub(props: DropdownMenuPrimitive.DropdownMenuSubProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function DropdownMenuRadioGroup(props: DropdownMenuPrimitive.DropdownMenuRadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare function DropdownMenuSubTrigger({ children, className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
23
|
+
inset?: boolean;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export declare function DropdownMenuContent({ className, portal, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content> & {
|
|
27
|
+
portal?: boolean;
|
|
28
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function DropdownMenuItem({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & VariantProps<typeof dropdownMenuItemVariants>): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function DropdownMenuCheckboxItem({ children, className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function DropdownMenuRadioItem({ children, className, hideIcon, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {
|
|
32
|
+
hideIcon?: boolean;
|
|
33
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
35
|
+
inset?: boolean;
|
|
36
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare function useOpenState(): {
|
|
40
|
+
open: boolean;
|
|
41
|
+
onOpenChange: (_value?: boolean) => void;
|
|
42
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { cva as t } from "class-variance-authority";
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
import { CheckIcon as i, ChevronRightIcon as a } from "lucide-react";
|
|
7
|
+
import * as o from "@radix-ui/react-dropdown-menu";
|
|
8
|
+
//#region src/cards/dropDownMenu/dropdown-menu.ui.tsx
|
|
9
|
+
var s = t(e("relative flex cursor-pointer items-center gap-2 rounded-md align-middle text-sm no-focus-ring transition-bg-ease select-none data-disabled:pointer-events-none data-disabled:opacity-50", "[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-subtle-foreground", "text-accent-foreground hover:bg-accent focus:bg-accent focus:text-accent-foreground"), {
|
|
10
|
+
defaultVariants: {
|
|
11
|
+
size: "default",
|
|
12
|
+
variant: "default"
|
|
13
|
+
},
|
|
14
|
+
variants: {
|
|
15
|
+
size: {
|
|
16
|
+
default: "mx-1 h-[28px] px-2.5",
|
|
17
|
+
none: ""
|
|
18
|
+
},
|
|
19
|
+
variant: {
|
|
20
|
+
default: "focus:bg-accent focus:text-accent-foreground",
|
|
21
|
+
none: ""
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}), c = t(e("mt-1.5 mb-2 cursor-default px-[14px] text-xs font-medium text-muted-foreground select-none"), { variants: { inset: { true: "pl-8" } } });
|
|
25
|
+
function l(e) {
|
|
26
|
+
return /* @__PURE__ */ n(o.Root, { ...e });
|
|
27
|
+
}
|
|
28
|
+
function u(e) {
|
|
29
|
+
return /* @__PURE__ */ n(o.Trigger, { ...e });
|
|
30
|
+
}
|
|
31
|
+
function d(e) {
|
|
32
|
+
return /* @__PURE__ */ n(o.Group, {
|
|
33
|
+
className: "py-1.5",
|
|
34
|
+
...e
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function f(e) {
|
|
38
|
+
return /* @__PURE__ */ n(o.Sub, { ...e });
|
|
39
|
+
}
|
|
40
|
+
function p(e) {
|
|
41
|
+
return /* @__PURE__ */ n(o.RadioGroup, { ...e });
|
|
42
|
+
}
|
|
43
|
+
function m({ children: t, className: i, inset: s, ...c }) {
|
|
44
|
+
return /* @__PURE__ */ r(o.SubTrigger, {
|
|
45
|
+
className: e("mx-1 flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent data-[state=open]:bg-accent", "no-focus-ring", "data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0", s && "pl-8", i),
|
|
46
|
+
...c,
|
|
47
|
+
children: [t, /* @__PURE__ */ n(a, { className: "ml-auto" })]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function h({ className: t, ...r }) {
|
|
51
|
+
return /* @__PURE__ */ n(o.SubContent, {
|
|
52
|
+
className: e("z-50 max-w-[100vw] min-w-32 w-max overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-floating data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", t),
|
|
53
|
+
...r
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function g({ className: t, portal: r, ...i }) {
|
|
57
|
+
let a = /* @__PURE__ */ n(o.Content, {
|
|
58
|
+
className: e("z-50 max-w-[100vw] min-w-32 w-max overflow-hidden rounded-lg bg-popover p-0 text-sm text-popover-foreground shadow-floating no-focus-ring", "data-[side=bottom]:origin-top data-[side=left]:origin-right data-[side=right]:origin-left data-[side=top]:origin-bottom data-[state=closed]:hidden data-[state=open]:animate-zoom", t),
|
|
59
|
+
sideOffset: 4,
|
|
60
|
+
...i
|
|
61
|
+
});
|
|
62
|
+
return r ? /* @__PURE__ */ n(o.Portal, { children: a }) : a;
|
|
63
|
+
}
|
|
64
|
+
function _({ className: t, ...r }) {
|
|
65
|
+
return /* @__PURE__ */ n(o.Item, {
|
|
66
|
+
className: e(s(), t),
|
|
67
|
+
...r
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function v({ children: t, className: a, ...s }) {
|
|
71
|
+
return /* @__PURE__ */ r(o.CheckboxItem, {
|
|
72
|
+
className: e("relative flex items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 no-focus-ring transition-bg-ease select-none focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:size-4", "mx-1 h-[28px] cursor-pointer data-[state=highlighted]:bg-accent data-[state=highlighted]:text-accent-foreground", a),
|
|
73
|
+
...s,
|
|
74
|
+
children: [/* @__PURE__ */ n("span", {
|
|
75
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
76
|
+
children: /* @__PURE__ */ n(o.ItemIndicator, { children: /* @__PURE__ */ n(i, {}) })
|
|
77
|
+
}), t]
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function y({ children: t, className: a, hideIcon: s, ...c }) {
|
|
81
|
+
return /* @__PURE__ */ r(o.RadioItem, {
|
|
82
|
+
className: e("relative flex items-center rounded-sm pr-2 pl-8 no-focus-ring transition-bg-ease select-none focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50", "mx-1 h-[28px] cursor-pointer gap-2 data-[state=highlighted]:bg-accent data-[state=highlighted]:text-accent-foreground [&_svg]:size-4", a),
|
|
83
|
+
...c,
|
|
84
|
+
children: [!s && /* @__PURE__ */ n("span", {
|
|
85
|
+
className: "absolute left-2 flex size-3.5 items-center justify-center",
|
|
86
|
+
children: /* @__PURE__ */ n(o.ItemIndicator, { children: /* @__PURE__ */ n(i, {}) })
|
|
87
|
+
}), t]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function b({ className: t, inset: r, ...i }) {
|
|
91
|
+
return /* @__PURE__ */ n(o.Label, {
|
|
92
|
+
className: e(c({ inset: r }), t),
|
|
93
|
+
...i
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function x({ className: t, ...r }) {
|
|
97
|
+
return /* @__PURE__ */ n(o.Separator, {
|
|
98
|
+
className: e("-mx-1 my-1 h-px bg-muted", t),
|
|
99
|
+
...r
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function S({ className: t, ...r }) {
|
|
103
|
+
return /* @__PURE__ */ n("span", {
|
|
104
|
+
className: e("ml-auto text-xs tracking-widest opacity-60", t),
|
|
105
|
+
...r
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { l as DropdownMenu, v as DropdownMenuCheckboxItem, g as DropdownMenuContent, d as DropdownMenuGroup, _ as DropdownMenuItem, b as DropdownMenuLabel, p as DropdownMenuRadioGroup, y as DropdownMenuRadioItem, x as DropdownMenuSeparator, S as DropdownMenuShortcut, f as DropdownMenuSub, h as DropdownMenuSubContent, m as DropdownMenuSubTrigger, u as DropdownMenuTrigger };
|
|
110
|
+
|
|
111
|
+
//# sourceMappingURL=dropdown-menu.ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu.ui.js","names":[],"sources":["../../../src/cards/dropDownMenu/dropdown-menu.ui.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport * as DropdownMenuPrimitive from \"@radix-ui/react-dropdown-menu\";\nimport {type VariantProps, cva} from \"class-variance-authority\";\nimport {CheckIcon, ChevronRightIcon} from \"lucide-react\";\n\nimport {cn} from \"@/lib/utils\";\n\n/**\n * Pihanga-owned copy of the registry dropdown-menu primitives.\n *\n * Why this exists:\n * - `src/registry/**` is upstream-managed and must remain read-only.\n * - We needed menu width/shrink-to-fit fixes (`w-max`, avoid %/calc widths)\n * for correct sizing with long labels.\n */\nexport const dropdownMenuItemVariants = cva(\n cn(\n \"relative flex cursor-pointer items-center gap-2 rounded-md align-middle text-sm no-focus-ring transition-bg-ease select-none data-disabled:pointer-events-none data-disabled:opacity-50\",\n \"[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 [&_svg]:text-subtle-foreground\",\n \"text-accent-foreground hover:bg-accent focus:bg-accent focus:text-accent-foreground\",\n ),\n {\n defaultVariants: {\n size: \"default\",\n variant: \"default\",\n },\n variants: {\n size: {\n // NOTE: Do NOT use %/calc-based widths here.\n // Radix positions the dropdown content with a shrink-to-fit layout.\n // If menu items have percentage widths, they don't contribute to the\n // intrinsic (max-content) sizing of the container.\n default: \"mx-1 h-[28px] px-2.5\",\n none: \"\",\n },\n variant: {\n default: \"focus:bg-accent focus:text-accent-foreground\",\n none: \"\",\n },\n },\n },\n);\n\nconst dropdownMenuLabelVariants = cva(\n cn(\n \"mt-1.5 mb-2 cursor-default px-[14px] text-xs font-medium text-muted-foreground select-none\",\n ),\n {\n variants: {\n inset: {\n true: \"pl-8\",\n },\n },\n },\n);\n\nexport function DropdownMenu(props: DropdownMenuPrimitive.DropdownMenuProps) {\n return <DropdownMenuPrimitive.Root {...props} />;\n}\n\nexport function DropdownMenuTrigger(\n props: DropdownMenuPrimitive.DropdownMenuTriggerProps,\n) {\n return <DropdownMenuPrimitive.Trigger {...props} />;\n}\n\nexport function DropdownMenuGroup(\n props: DropdownMenuPrimitive.DropdownMenuGroupProps,\n) {\n return <DropdownMenuPrimitive.Group className=\"py-1.5\" {...props} />;\n}\n\nexport function DropdownMenuPortal(\n props: DropdownMenuPrimitive.DropdownMenuPortalProps,\n) {\n return <DropdownMenuPrimitive.Portal {...props} />;\n}\n\nexport function DropdownMenuSub(\n props: DropdownMenuPrimitive.DropdownMenuSubProps,\n) {\n return <DropdownMenuPrimitive.Sub {...props} />;\n}\n\nexport function DropdownMenuRadioGroup(\n props: DropdownMenuPrimitive.DropdownMenuRadioGroupProps,\n) {\n return <DropdownMenuPrimitive.RadioGroup {...props} />;\n}\n\nexport function DropdownMenuSubTrigger({\n children,\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {\n inset?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.SubTrigger\n className={cn(\n \"mx-1 flex cursor-default items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent data-[state=open]:bg-accent\",\n \"no-focus-ring\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0\",\n inset && \"pl-8\",\n className,\n )}\n {...props}\n >\n {children}\n <ChevronRightIcon className=\"ml-auto\" />\n </DropdownMenuPrimitive.SubTrigger>\n );\n}\n\nexport function DropdownMenuSubContent({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {\n return (\n <DropdownMenuPrimitive.SubContent\n className={cn(\n // `w-max` ensures submenu width grows with its content (up to max-w)\n \"z-50 max-w-[100vw] min-w-32 w-max overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-floating data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95\",\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function DropdownMenuContent({\n className,\n portal,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Content> & {\n portal?: boolean;\n}) {\n const content = (\n <DropdownMenuPrimitive.Content\n className={cn(\n // `w-max` makes the menu container grow with its content (up to max-w)\n \"z-50 max-w-[100vw] min-w-32 w-max overflow-hidden rounded-lg bg-popover p-0 text-sm text-popover-foreground shadow-floating no-focus-ring\",\n \"data-[side=bottom]:origin-top data-[side=left]:origin-right data-[side=right]:origin-left data-[side=top]:origin-bottom data-[state=closed]:hidden data-[state=open]:animate-zoom\",\n className,\n )}\n sideOffset={4}\n {...props}\n />\n );\n\n if (portal) {\n return (\n <DropdownMenuPrimitive.Portal>{content}</DropdownMenuPrimitive.Portal>\n );\n }\n\n return content;\n}\n\nexport function DropdownMenuItem({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Item> &\n VariantProps<typeof dropdownMenuItemVariants>) {\n return (\n <DropdownMenuPrimitive.Item\n className={cn(dropdownMenuItemVariants(), className)}\n {...props}\n />\n );\n}\n\nexport function DropdownMenuCheckboxItem({\n children,\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {\n return (\n <DropdownMenuPrimitive.CheckboxItem\n className={cn(\n \"relative flex items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 no-focus-ring transition-bg-ease select-none focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:size-4\",\n // NOTE: Do NOT use %/calc-based widths here for the same reason as\n // dropdownMenuItemVariants: it prevents shrink-to-fit content sizing.\n // IMPORTANT: Don't use `px-*` here, it would override `pr-8` above and\n // cause the label to overlap the right-side check indicator.\n \"mx-1 h-[28px] cursor-pointer data-[state=highlighted]:bg-accent data-[state=highlighted]:text-accent-foreground\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n {children}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n}\n\nexport function DropdownMenuRadioItem({\n children,\n className,\n hideIcon,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem> & {\n hideIcon?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.RadioItem\n className={cn(\n \"relative flex items-center rounded-sm pr-2 pl-8 no-focus-ring transition-bg-ease select-none focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50\",\n // NOTE: Do NOT use %/calc-based widths here for the same reason as\n // dropdownMenuItemVariants: it prevents shrink-to-fit content sizing.\n // IMPORTANT: Don't use `px-*` here, it would override `pl-8` above and\n // misalign the radio indicator.\n \"mx-1 h-[28px] cursor-pointer gap-2 data-[state=highlighted]:bg-accent data-[state=highlighted]:text-accent-foreground [&_svg]:size-4\",\n className,\n )}\n {...props}\n >\n {!hideIcon && (\n <span className=\"absolute left-2 flex size-3.5 items-center justify-center\">\n <DropdownMenuPrimitive.ItemIndicator>\n <CheckIcon />\n </DropdownMenuPrimitive.ItemIndicator>\n </span>\n )}\n {children}\n </DropdownMenuPrimitive.RadioItem>\n );\n}\n\nexport function DropdownMenuLabel({\n className,\n inset,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {\n inset?: boolean;\n}) {\n return (\n <DropdownMenuPrimitive.Label\n className={cn(dropdownMenuLabelVariants({inset}), className)}\n {...props}\n />\n );\n}\n\nexport function DropdownMenuSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {\n return (\n <DropdownMenuPrimitive.Separator\n className={cn(\"-mx-1 my-1 h-px bg-muted\", className)}\n {...props}\n />\n );\n}\n\nexport function DropdownMenuShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n className={cn(\"ml-auto text-xs tracking-widest opacity-60\", className)}\n {...props}\n />\n );\n}\n\nexport function useOpenState() {\n const [open, setOpen] = React.useState(false);\n\n const onOpenChange = React.useCallback(\n (_value = !open) => {\n setOpen(_value);\n },\n [open],\n );\n\n return {\n open,\n onOpenChange,\n };\n}\n"],"mappings":";;;;;;;;AAkBA,IAAa,IAA2B,EACtC,EACE,2LACA,8FACA,qFACF,GACA;CACE,iBAAiB;EACf,MAAM;EACN,SAAS;CACX;CACA,UAAU;EACR,MAAM;GAKJ,SAAS;GACT,MAAM;EACR;EACA,SAAS;GACP,SAAS;GACT,MAAM;EACR;CACF;AACF,CACF,GAEM,IAA4B,EAChC,EACE,4FACF,GACA,EACE,UAAU,EACR,OAAO,EACL,MAAM,OACR,EACF,EACF,CACF;AAEA,SAAgB,EAAa,GAAgD;CAC3E,OAAO,kBAAC,EAAsB,MAAvB,EAA4B,GAAI,EAAQ,CAAA;AACjD;AAEA,SAAgB,EACd,GACA;CACA,OAAO,kBAAC,EAAsB,SAAvB,EAA+B,GAAI,EAAQ,CAAA;AACpD;AAEA,SAAgB,EACd,GACA;CACA,OAAO,kBAAC,EAAsB,OAAvB;EAA6B,WAAU;EAAS,GAAI;CAAQ,CAAA;AACrE;AAQA,SAAgB,EACd,GACA;CACA,OAAO,kBAAC,EAAsB,KAAvB,EAA2B,GAAI,EAAQ,CAAA;AAChD;AAEA,SAAgB,EACd,GACA;CACA,OAAO,kBAAC,EAAsB,YAAvB,EAAkC,GAAI,EAAQ,CAAA;AACvD;AAEA,SAAgB,EAAuB,EACrC,aACA,cACA,UACA,GAAG,KAGF;CACD,OACE,kBAAC,EAAsB,YAAvB;EACE,WAAW,EACT,qJACA,iBACA,0HACA,KAAS,QACT,CACF;EACA,GAAI;YARN,CAUG,GACD,kBAAC,GAAD,EAAkB,WAAU,UAAW,CAAA,CACP;;AAEtC;AAEA,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B,EACpC,cACA,GAAG,KAC4D;CAC/D,OACE,kBAAC,EAAsB,WAAvB;EACE,WAAW,EAAG,4BAA4B,CAAS;EACnD,GAAI;CACL,CAAA;AAEL;AAEA,SAAgB,EAAqB,EACnC,cACA,GAAG,KAC4B;CAC/B,OACE,kBAAC,QAAD;EACE,WAAW,EAAG,8CAA8C,CAAS;EACrE,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './drop-down.types';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DROP_DOWN_MENU_ACTION as e, DROP_DOWN_MENU_CARD as t, DropDownMenu as n, onDropDownMenuClicked as r } from "./drop-down.types.js";
|
|
2
|
+
import { Component as i } from "./drop-down.component.js";
|
|
3
|
+
import { actionTypesToEvents as a, registerCardComponent as o } from "@pihanga2/core";
|
|
4
|
+
//#region src/cards/dropDownMenu/index.ts
|
|
5
|
+
o({
|
|
6
|
+
name: t,
|
|
7
|
+
component: i,
|
|
8
|
+
events: a(e)
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { e as DROP_DOWN_MENU_ACTION, t as DROP_DOWN_MENU_CARD, n as DropDownMenu, r as onDropDownMenuClicked };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/cards/dropDownMenu/index.ts"],"sourcesContent":["import {actionTypesToEvents, registerCardComponent} from \"@pihanga2/core\";\n\nimport {DROP_DOWN_MENU_ACTION, DROP_DOWN_MENU_CARD} from \"./drop-down.types\";\nimport {Component} from \"./drop-down.component\";\n\nexport * from \"./drop-down.types\";\n\nregisterCardComponent({\n name: DROP_DOWN_MENU_CARD,\n component: Component,\n events: actionTypesToEvents(DROP_DOWN_MENU_ACTION),\n});\n"],"mappings":";;;;AAOA,EAAsB;CACpB,MAAM;CACN,WAAW;CACX,QAAQ,EAAoB,CAAqB;AACnD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PiCardProps } from '@pihanga2/core';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export declare const EmptyCard: <S extends import('@pihanga2/core').ReduxState>(p: import('@pihanga2/core').PiMapProps<EmptyProps, S, {}>) => import('@pihanga2/core').PiCardDef;
|
|
4
|
+
export type EmptyProps = {
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
};
|
|
7
|
+
export declare const EmptyComponent: (props: PiCardProps<EmptyProps>) => React.ReactNode;
|