@k2b/ui 0.63.0 → 0.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.css +6 -3
- package/dist/browser/actions/ContextMenu.js +3 -1
- package/dist/browser/actions/ContextMenu.js.map +1 -1
- package/dist/browser/actions/DragAndDrop.js +26 -5
- package/dist/browser/actions/DragAndDrop.js.map +1 -1
- package/dist/browser/actions/DropOverlay.js +76 -0
- package/dist/browser/actions/DropOverlay.js.map +1 -0
- package/dist/browser/actions/Dropdown.js +69 -15
- package/dist/browser/actions/Dropdown.js.map +1 -1
- package/dist/browser/actions/SortableList.js +338 -85
- package/dist/browser/actions/SortableList.js.map +1 -1
- package/dist/browser/actions/ViewTabs.js +9 -5
- package/dist/browser/actions/ViewTabs.js.map +1 -1
- package/dist/browser/actions/drag-and-drop-keyboard.js +211 -0
- package/dist/browser/actions/drag-and-drop-keyboard.js.map +1 -0
- package/dist/browser/actions/drag-and-drop-messages.js +21 -25
- package/dist/browser/actions/drag-and-drop-messages.js.map +1 -1
- package/dist/browser/actions/drag-and-drop.js +206 -184
- package/dist/browser/actions/drag-and-drop.js.map +1 -1
- package/dist/browser/actions/drop-overlay-pages.js +54 -0
- package/dist/browser/actions/drop-overlay-pages.js.map +1 -0
- package/dist/browser/actions/drop-overlay-view.js +318 -0
- package/dist/browser/actions/drop-overlay-view.js.map +1 -0
- package/dist/browser/actions/index.js +4 -2
- package/dist/browser/actions/index.js.map +1 -1
- package/dist/browser/actions/menu-sheet-messages.js +26 -0
- package/dist/browser/actions/menu-sheet-messages.js.map +1 -0
- package/dist/browser/actions/menu-sheet.js +80 -18
- package/dist/browser/actions/menu-sheet.js.map +1 -1
- package/dist/browser/actions/menu-submenu-panel.js +392 -0
- package/dist/browser/actions/menu-submenu-panel.js.map +1 -0
- package/dist/browser/actions/preload-when-idle.js +15 -0
- package/dist/browser/actions/preload-when-idle.js.map +1 -0
- package/dist/browser/actions/sortable-board.js +107 -0
- package/dist/browser/actions/sortable-board.js.map +1 -0
- package/dist/browser/actions/sortable-keyboard.js +202 -0
- package/dist/browser/actions/sortable-keyboard.js.map +1 -0
- package/dist/browser/actions/sortable-list-messages.js +23 -11
- package/dist/browser/actions/sortable-list-messages.js.map +1 -1
- package/dist/browser/actions/sortable-place.js +26 -0
- package/dist/browser/actions/sortable-place.js.map +1 -0
- package/dist/browser/chat/ChatDecision.js +499 -463
- package/dist/browser/chat/ChatDecision.js.map +1 -1
- package/dist/browser/chat/ChatDecisionField.js +311 -0
- package/dist/browser/chat/ChatDecisionField.js.map +1 -0
- package/dist/browser/chat/index.js +2 -0
- package/dist/browser/chat/index.js.map +1 -1
- package/dist/browser/chat/types.js.map +1 -1
- package/dist/browser/chat-decision-field.js +6 -0
- package/dist/browser/chat-decision-field.js.map +1 -0
- package/dist/browser/content/DataTable.js +326 -205
- package/dist/browser/content/DataTable.js.map +1 -1
- package/dist/browser/content/FileName.js +68 -0
- package/dist/browser/content/FileName.js.map +1 -0
- package/dist/browser/content/ProgressPath.js +30 -25
- package/dist/browser/content/ProgressPath.js.map +1 -1
- package/dist/browser/content/TaskRow.js +129 -0
- package/dist/browser/content/TaskRow.js.map +1 -0
- package/dist/browser/content/index.js +2 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/progress-path-messages.js +22 -0
- package/dist/browser/content/progress-path-messages.js.map +1 -0
- package/dist/browser/feedback/dialog-core.js +68 -11
- package/dist/browser/feedback/dialog-core.js.map +1 -1
- package/dist/browser/feedback/dialog-foot.js +45 -0
- package/dist/browser/feedback/dialog-foot.js.map +1 -0
- package/dist/browser/inputs/DatePicker.js +369 -716
- package/dist/browser/inputs/DatePicker.js.map +1 -1
- package/dist/browser/inputs/FileInputs.js +1 -1
- package/dist/browser/inputs/FileInputs.js.map +1 -1
- package/dist/browser/inputs/NumberInput.js +125 -46
- package/dist/browser/inputs/NumberInput.js.map +1 -1
- package/dist/browser/inputs/PeriodPicker.js +9 -4
- package/dist/browser/inputs/PeriodPicker.js.map +1 -1
- package/dist/browser/inputs/TextInput.js +3 -3
- package/dist/browser/inputs/TextInput.js.map +1 -1
- package/dist/browser/inputs/date-picker-panel.js +420 -0
- package/dist/browser/inputs/date-picker-panel.js.map +1 -0
- package/dist/browser/inputs/image-crop.js +1 -1
- package/dist/browser/inputs/image-crop.js.map +1 -1
- package/dist/browser/inputs/image-tools.js +4 -0
- package/dist/browser/inputs/image-tools.js.map +1 -0
- package/dist/browser/inputs/input-messages.js +8 -2
- package/dist/browser/inputs/input-messages.js.map +1 -1
- package/dist/browser/internal/field.js +2 -2
- package/dist/browser/internal/field.js.map +1 -1
- package/dist/browser/internal/renders-something.js +3 -0
- package/dist/browser/internal/renders-something.js.map +1 -0
- package/dist/browser/intl/messages.js +1 -1
- package/dist/browser/intl/messages.js.map +1 -1
- package/dist/browser/layout/AppWorkspace.js +16 -8
- package/dist/browser/layout/AppWorkspace.js.map +1 -1
- package/dist/browser/layout/Breadcrumbs.js +188 -42
- package/dist/browser/layout/Breadcrumbs.js.map +1 -1
- package/dist/browser/layout/DetailPanel.js +209 -205
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/FloatingPill.js +33 -0
- package/dist/browser/layout/FloatingPill.js.map +1 -0
- package/dist/browser/layout/PanelDialog.js +176 -88
- package/dist/browser/layout/PanelDialog.js.map +1 -1
- package/dist/browser/layout/StatusRow.js +174 -0
- package/dist/browser/layout/StatusRow.js.map +1 -0
- package/dist/browser/layout/app-workspace-controller.js +12 -5
- package/dist/browser/layout/app-workspace-controller.js.map +1 -1
- package/dist/browser/layout/app-workspace-state.js +2 -2
- package/dist/browser/layout/app-workspace-state.js.map +1 -1
- package/dist/browser/layout/index.js +2 -0
- package/dist/browser/layout/index.js.map +1 -1
- package/dist/browser/layout/panel-dialog-error.js +44 -0
- package/dist/browser/layout/panel-dialog-error.js.map +1 -0
- package/dist/browser/layout/panel-sheet-handle.js +86 -0
- package/dist/browser/layout/panel-sheet-handle.js.map +1 -0
- package/dist/browser/layout/workspace-messages.js +12 -2
- package/dist/browser/layout/workspace-messages.js.map +1 -1
- package/dist/browser/layout-check.js +232 -0
- package/dist/browser/layout-check.js.map +1 -0
- package/dist/browser/surfaces/Area.js +205 -0
- package/dist/browser/surfaces/Area.js.map +1 -0
- package/dist/browser/surfaces/FactGroup.js +148 -0
- package/dist/browser/surfaces/FactGroup.js.map +1 -0
- package/dist/browser/surfaces/FieldGrid.js +34 -0
- package/dist/browser/surfaces/FieldGrid.js.map +1 -0
- package/dist/browser/surfaces/NoticeCard.js +69 -57
- package/dist/browser/surfaces/NoticeCard.js.map +1 -1
- package/dist/browser/surfaces/Placeholder.js +17 -5
- package/dist/browser/surfaces/Placeholder.js.map +1 -1
- package/dist/browser/surfaces/RowGroup.js +82 -0
- package/dist/browser/surfaces/RowGroup.js.map +1 -0
- package/dist/browser/surfaces/Section.js +22 -7
- package/dist/browser/surfaces/Section.js.map +1 -1
- package/dist/browser/surfaces/StatusBadge.js +5 -1
- package/dist/browser/surfaces/StatusBadge.js.map +1 -1
- package/dist/browser/surfaces/flat-block-messages.js +37 -0
- package/dist/browser/surfaces/flat-block-messages.js.map +1 -0
- package/dist/browser/surfaces/index.js +4 -0
- package/dist/browser/surfaces/index.js.map +1 -1
- package/dist/ssr/actions/ContextMenu.js +3 -1
- package/dist/ssr/actions/ContextMenu.js.map +1 -1
- package/dist/ssr/actions/DragAndDrop.js +26 -5
- package/dist/ssr/actions/DragAndDrop.js.map +1 -1
- package/dist/ssr/actions/DropOverlay.js +69 -0
- package/dist/ssr/actions/DropOverlay.js.map +1 -0
- package/dist/ssr/actions/Dropdown.js +69 -15
- package/dist/ssr/actions/Dropdown.js.map +1 -1
- package/dist/ssr/actions/SortableList.js +293 -71
- package/dist/ssr/actions/SortableList.js.map +1 -1
- package/dist/ssr/actions/ViewTabs.js +9 -5
- package/dist/ssr/actions/ViewTabs.js.map +1 -1
- package/dist/ssr/actions/drag-and-drop-keyboard.js +211 -0
- package/dist/ssr/actions/drag-and-drop-keyboard.js.map +1 -0
- package/dist/ssr/actions/drag-and-drop-messages.js +21 -25
- package/dist/ssr/actions/drag-and-drop-messages.js.map +1 -1
- package/dist/ssr/actions/drag-and-drop.js +206 -184
- package/dist/ssr/actions/drag-and-drop.js.map +1 -1
- package/dist/ssr/actions/drop-overlay-pages.js +54 -0
- package/dist/ssr/actions/drop-overlay-pages.js.map +1 -0
- package/dist/ssr/actions/drop-overlay-view.js +225 -0
- package/dist/ssr/actions/drop-overlay-view.js.map +1 -0
- package/dist/ssr/actions/index.js +4 -2
- package/dist/ssr/actions/index.js.map +1 -1
- package/dist/ssr/actions/menu-sheet-messages.js +26 -0
- package/dist/ssr/actions/menu-sheet-messages.js.map +1 -0
- package/dist/ssr/actions/menu-sheet.js +62 -10
- package/dist/ssr/actions/menu-sheet.js.map +1 -1
- package/dist/ssr/actions/menu-submenu-panel.js +295 -0
- package/dist/ssr/actions/menu-submenu-panel.js.map +1 -0
- package/dist/ssr/actions/preload-when-idle.js +15 -0
- package/dist/ssr/actions/preload-when-idle.js.map +1 -0
- package/dist/ssr/actions/sortable-board.js +107 -0
- package/dist/ssr/actions/sortable-board.js.map +1 -0
- package/dist/ssr/actions/sortable-keyboard.js +202 -0
- package/dist/ssr/actions/sortable-keyboard.js.map +1 -0
- package/dist/ssr/actions/sortable-list-messages.js +23 -11
- package/dist/ssr/actions/sortable-list-messages.js.map +1 -1
- package/dist/ssr/actions/sortable-place.js +26 -0
- package/dist/ssr/actions/sortable-place.js.map +1 -0
- package/dist/ssr/chat/ChatDecision.js +256 -228
- package/dist/ssr/chat/ChatDecision.js.map +1 -1
- package/dist/ssr/chat/ChatDecisionField.js +206 -0
- package/dist/ssr/chat/ChatDecisionField.js.map +1 -0
- package/dist/ssr/chat/index.js +2 -0
- package/dist/ssr/chat/index.js.map +1 -1
- package/dist/ssr/chat/types.js.map +1 -1
- package/dist/ssr/chat-decision-field.js +6 -0
- package/dist/ssr/chat-decision-field.js.map +1 -0
- package/dist/ssr/content/DataTable.js +93 -50
- package/dist/ssr/content/DataTable.js.map +1 -1
- package/dist/ssr/content/FileName.js +46 -0
- package/dist/ssr/content/FileName.js.map +1 -0
- package/dist/ssr/content/ProgressPath.js +14 -8
- package/dist/ssr/content/ProgressPath.js.map +1 -1
- package/dist/ssr/content/TaskRow.js +95 -0
- package/dist/ssr/content/TaskRow.js.map +1 -0
- package/dist/ssr/content/index.js +2 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/progress-path-messages.js +22 -0
- package/dist/ssr/content/progress-path-messages.js.map +1 -0
- package/dist/ssr/feedback/dialog-core.js +68 -11
- package/dist/ssr/feedback/dialog-core.js.map +1 -1
- package/dist/ssr/feedback/dialog-foot.js +45 -0
- package/dist/ssr/feedback/dialog-foot.js.map +1 -0
- package/dist/ssr/inputs/DatePicker.js +94 -263
- package/dist/ssr/inputs/DatePicker.js.map +1 -1
- package/dist/ssr/inputs/FileInputs.js +1 -1
- package/dist/ssr/inputs/FileInputs.js.map +1 -1
- package/dist/ssr/inputs/NumberInput.js +114 -44
- package/dist/ssr/inputs/NumberInput.js.map +1 -1
- package/dist/ssr/inputs/PeriodPicker.js +9 -4
- package/dist/ssr/inputs/PeriodPicker.js.map +1 -1
- package/dist/ssr/inputs/TextInput.js +3 -3
- package/dist/ssr/inputs/TextInput.js.map +1 -1
- package/dist/ssr/inputs/date-picker-panel.js +233 -0
- package/dist/ssr/inputs/date-picker-panel.js.map +1 -0
- package/dist/ssr/inputs/image-crop.js +1 -1
- package/dist/ssr/inputs/image-crop.js.map +1 -1
- package/dist/ssr/inputs/image-tools.js +4 -0
- package/dist/ssr/inputs/image-tools.js.map +1 -0
- package/dist/ssr/inputs/input-messages.js +8 -2
- package/dist/ssr/inputs/input-messages.js.map +1 -1
- package/dist/ssr/internal/field.js +2 -2
- package/dist/ssr/internal/field.js.map +1 -1
- package/dist/ssr/internal/renders-something.js +3 -0
- package/dist/ssr/internal/renders-something.js.map +1 -0
- package/dist/ssr/intl/messages.js +1 -1
- package/dist/ssr/intl/messages.js.map +1 -1
- package/dist/ssr/layout/AppWorkspace.js +16 -8
- package/dist/ssr/layout/AppWorkspace.js.map +1 -1
- package/dist/ssr/layout/Breadcrumbs.js +140 -26
- package/dist/ssr/layout/Breadcrumbs.js.map +1 -1
- package/dist/ssr/layout/DetailPanel.js +70 -68
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/FloatingPill.js +16 -0
- package/dist/ssr/layout/FloatingPill.js.map +1 -0
- package/dist/ssr/layout/PanelDialog.js +82 -8
- package/dist/ssr/layout/PanelDialog.js.map +1 -1
- package/dist/ssr/layout/StatusRow.js +93 -0
- package/dist/ssr/layout/StatusRow.js.map +1 -0
- package/dist/ssr/layout/app-workspace-controller.js +12 -5
- package/dist/ssr/layout/app-workspace-controller.js.map +1 -1
- package/dist/ssr/layout/app-workspace-state.js +2 -2
- package/dist/ssr/layout/app-workspace-state.js.map +1 -1
- package/dist/ssr/layout/index.js +2 -0
- package/dist/ssr/layout/index.js.map +1 -1
- package/dist/ssr/layout/panel-dialog-error.js +28 -0
- package/dist/ssr/layout/panel-dialog-error.js.map +1 -0
- package/dist/ssr/layout/panel-sheet-handle.js +66 -0
- package/dist/ssr/layout/panel-sheet-handle.js.map +1 -0
- package/dist/ssr/layout/workspace-messages.js +12 -2
- package/dist/ssr/layout/workspace-messages.js.map +1 -1
- package/dist/ssr/layout-check.js +232 -0
- package/dist/ssr/layout-check.js.map +1 -0
- package/dist/ssr/surfaces/Area.js +147 -0
- package/dist/ssr/surfaces/Area.js.map +1 -0
- package/dist/ssr/surfaces/FactGroup.js +106 -0
- package/dist/ssr/surfaces/FactGroup.js.map +1 -0
- package/dist/ssr/surfaces/FieldGrid.js +22 -0
- package/dist/ssr/surfaces/FieldGrid.js.map +1 -0
- package/dist/ssr/surfaces/NoticeCard.js +7 -5
- package/dist/ssr/surfaces/NoticeCard.js.map +1 -1
- package/dist/ssr/surfaces/Placeholder.js +15 -4
- package/dist/ssr/surfaces/Placeholder.js.map +1 -1
- package/dist/ssr/surfaces/RowGroup.js +60 -0
- package/dist/ssr/surfaces/RowGroup.js.map +1 -0
- package/dist/ssr/surfaces/Section.js +7 -4
- package/dist/ssr/surfaces/Section.js.map +1 -1
- package/dist/ssr/surfaces/StatusBadge.js +5 -1
- package/dist/ssr/surfaces/StatusBadge.js.map +1 -1
- package/dist/ssr/surfaces/flat-block-messages.js +37 -0
- package/dist/ssr/surfaces/flat-block-messages.js.map +1 -0
- package/dist/ssr/surfaces/index.js +4 -0
- package/dist/ssr/surfaces/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/DragAndDrop.d.ts +17 -2
- package/dist/types/actions/DropOverlay.d.ts +46 -0
- package/dist/types/actions/Dropdown.d.ts +35 -1
- package/dist/types/actions/SortableList.d.ts +36 -6
- package/dist/types/actions/ViewTabs.d.ts +3 -2
- package/dist/types/actions/drag-and-drop-keyboard.d.ts +4 -0
- package/dist/types/actions/drag-and-drop-messages.d.ts +8 -10
- package/dist/types/actions/drag-and-drop.d.ts +62 -4
- package/dist/types/actions/drop-overlay-pages.d.ts +22 -0
- package/dist/types/actions/drop-overlay-view.d.ts +12 -0
- package/dist/types/actions/index.d.ts +9 -5
- package/dist/types/actions/menu-sheet-messages.d.ts +11 -0
- package/dist/types/actions/menu-sheet.d.ts +3 -1
- package/dist/types/actions/menu-submenu-panel.d.ts +27 -0
- package/dist/types/actions/preload-when-idle.d.ts +5 -0
- package/dist/types/actions/sortable-board.d.ts +69 -0
- package/dist/types/actions/sortable-keyboard.d.ts +7 -0
- package/dist/types/actions/sortable-list-messages.d.ts +10 -3
- package/dist/types/actions/sortable-place.d.ts +16 -0
- package/dist/types/chat/ChatDecision.d.ts +28 -4
- package/dist/types/chat/ChatDecisionField.d.ts +45 -0
- package/dist/types/chat/index.d.ts +1 -0
- package/dist/types/chat/types.d.ts +9 -0
- package/dist/types/chat-decision-field.d.ts +5 -0
- package/dist/types/content/DataTable.d.ts +19 -0
- package/dist/types/content/FileName.d.ts +23 -0
- package/dist/types/content/ProgressPath.d.ts +12 -6
- package/dist/types/content/TaskRow.d.ts +33 -0
- package/dist/types/content/index.d.ts +2 -0
- package/dist/types/content/progress-path-messages.d.ts +8 -0
- package/dist/types/feedback/dialog-core.d.ts +5 -0
- package/dist/types/feedback/dialog-foot.d.ts +9 -0
- package/dist/types/inputs/DatePicker.d.ts +3 -21
- package/dist/types/inputs/TextInput.d.ts +2 -0
- package/dist/types/inputs/date-picker-panel.d.ts +29 -0
- package/dist/types/inputs/image-tools.d.ts +1 -0
- package/dist/types/inputs/input-messages.d.ts +4 -1
- package/dist/types/internal/renders-something.d.ts +2 -0
- package/dist/types/layout/AppWorkspace.d.ts +10 -2
- package/dist/types/layout/Breadcrumbs.d.ts +10 -5
- package/dist/types/layout/FloatingPill.d.ts +20 -0
- package/dist/types/layout/PanelDialog.d.ts +19 -0
- package/dist/types/layout/StatusRow.d.ts +54 -0
- package/dist/types/layout/app-workspace-state.d.ts +2 -2
- package/dist/types/layout/index.d.ts +5 -1
- package/dist/types/layout/panel-dialog-error.d.ts +9 -0
- package/dist/types/layout/panel-sheet-handle.d.ts +8 -0
- package/dist/types/layout/workspace-messages.d.ts +5 -0
- package/dist/types/layout-check.d.ts +52 -0
- package/dist/types/surfaces/Area.d.ts +38 -0
- package/dist/types/surfaces/FactGroup.d.ts +33 -0
- package/dist/types/surfaces/FieldGrid.d.ts +14 -0
- package/dist/types/surfaces/NoticeCard.d.ts +6 -4
- package/dist/types/surfaces/Placeholder.d.ts +7 -0
- package/dist/types/surfaces/RowGroup.d.ts +20 -0
- package/dist/types/surfaces/Section.d.ts +8 -2
- package/dist/types/surfaces/StatusBadge.d.ts +2 -1
- package/dist/types/surfaces/flat-block-messages.d.ts +16 -0
- package/dist/types/surfaces/index.d.ts +9 -1
- package/package.json +13 -2
|
@@ -3,15 +3,17 @@ export { CommandMenu } from "./CommandMenu";
|
|
|
3
3
|
export { ContextMenu } from "./ContextMenu";
|
|
4
4
|
export { CopyButton } from "./CopyButton";
|
|
5
5
|
export { Disclosure } from "./Disclosure";
|
|
6
|
-
export { activeDrag, DragSource, DropTarget, useKeyboardDrag } from "./DragAndDrop";
|
|
6
|
+
export { activeDrag, DragSource, DropTarget, dragStatus, useKeyboardDrag } from "./DragAndDrop";
|
|
7
7
|
export { Dropdown, DropdownItem, dropdownPosition } from "./Dropdown";
|
|
8
|
+
export { DropOverlay } from "./DropOverlay";
|
|
9
|
+
export { dropOverlayPages } from "./drop-overlay-pages";
|
|
8
10
|
export { FilterChip, FilterToggle } from "./FilterChip";
|
|
9
11
|
export { GestureMenu } from "./GestureMenu";
|
|
10
12
|
export { RemoveButton } from "./RemoveButton";
|
|
11
13
|
export { SegmentedControl } from "./SegmentedControl";
|
|
12
14
|
export { SelectionAction } from "./SelectionAction";
|
|
13
15
|
export { SelectionToolbar } from "./SelectionToolbar";
|
|
14
|
-
export { SortableList } from "./SortableList";
|
|
16
|
+
export { SortableList, useSortableMoveMenu } from "./SortableList";
|
|
15
17
|
export { SplitButton } from "./SplitButton";
|
|
16
18
|
export { openSpotlightSearch, SpotlightButton } from "./SpotlightSearch";
|
|
17
19
|
export { Tabs } from "./Tabs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["actions/index.ts"],"sourcesContent":["export type { ButtonAlign, ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant, IconButtonLinkProps, IconButtonProps } from \"./Button\";\nexport { Button, ButtonLink, IconButton, IconButtonLink } from \"./Button\";\nexport type { CommandMenuProps } from \"./CommandMenu\";\nexport { CommandMenu } from \"./CommandMenu\";\nexport type { ContextMenuProps } from \"./ContextMenu\";\nexport { ContextMenu } from \"./ContextMenu\";\nexport type { CopyButtonProps, CopyButtonValue } from \"./CopyButton\";\nexport { CopyButton } from \"./CopyButton\";\nexport type { CommandContext, CommandItem, CommandSource, CommandStep } from \"./command-items\";\nexport type { DisclosureProps } from \"./Disclosure\";\nexport { Disclosure } from \"./Disclosure\";\nexport type { DragPayload, DragSourceProps, DropTargetProps } from \"./DragAndDrop\";\nexport { activeDrag, DragSource, DropTarget, useKeyboardDrag } from \"./DragAndDrop\";\nexport type {\n DropdownAction,\n DropdownActionBase,\n DropdownAnchor,\n DropdownChoice,\n DropdownItemProps,\n DropdownPosition,\n DropdownProps,\n DropdownReturnFocus,\n DropdownSearch,\n DropdownSection,\n DropdownTriggerProps,\n} from \"./Dropdown\";\nexport { Dropdown, DropdownItem, dropdownPosition } from \"./Dropdown\";\nexport type { FilterChipOption, FilterChipProps, FilterChipSection, FilterToggleProps } from \"./FilterChip\";\nexport { FilterChip, FilterToggle } from \"./FilterChip\";\nexport type { GestureKind, GestureMenuAction, GestureMenuItem, GestureMenuProps, GestureMenuSection } from \"./GestureMenu\";\nexport { GestureMenu } from \"./GestureMenu\";\nexport type { RemoveButtonProps } from \"./RemoveButton\";\nexport { RemoveButton } from \"./RemoveButton\";\nexport type { SegmentedControlProps, SegmentOption } from \"./SegmentedControl\";\nexport { SegmentedControl } from \"./SegmentedControl\";\nexport type { SelectionActionProps, SelectionActionSelection } from \"./SelectionAction\";\nexport { SelectionAction } from \"./SelectionAction\";\nexport type { SelectionToolbarProps } from \"./SelectionToolbar\";\nexport { SelectionToolbar } from \"./SelectionToolbar\";\nexport type { SortableListProps } from \"./SortableList\";\nexport { SortableList } from \"./SortableList\";\nexport type { SplitButtonProps } from \"./SplitButton\";\nexport { SplitButton } from \"./SplitButton\";\nexport type {\n SpotlightButtonProps,\n SpotlightButtonVariant,\n SpotlightSearchOptions,\n SpotlightSearchResolver,\n} from \"./SpotlightSearch\";\nexport {\n openSpotlightSearch,\n SpotlightButton,\n} from \"./SpotlightSearch\";\nexport type { TabOption, TabsItemProps, TabsProps } from \"./Tabs\";\nexport { Tabs } from \"./Tabs\";\nexport type {\n ToolbarActionProps,\n ToolbarDockProps,\n ToolbarGroupProps,\n ToolbarLabelProps,\n ToolbarProps,\n ToolbarSeparatorProps,\n} from \"./Toolbar\";\nexport { Toolbar, ToolbarDock } from \"./Toolbar\";\nexport type { ViewTab, ViewTabsProps } from \"./ViewTabs\";\nexport { ViewTabs } from \"./ViewTabs\";\n"],"mappings":"AACA,SAAS,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,QAAQ,UAAU;AAEzE,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,UAAU,QAAQ,cAAc;AAGzC,SAAS,UAAU,QAAQ,cAAc;AAEzC,SAAS,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,QAAQ,eAAe;
|
|
1
|
+
{"version":3,"names":[],"sources":["actions/index.ts"],"sourcesContent":["export type { ButtonAlign, ButtonLinkProps, ButtonProps, ButtonSize, ButtonVariant, IconButtonLinkProps, IconButtonProps } from \"./Button\";\nexport { Button, ButtonLink, IconButton, IconButtonLink } from \"./Button\";\nexport type { CommandMenuProps } from \"./CommandMenu\";\nexport { CommandMenu } from \"./CommandMenu\";\nexport type { ContextMenuProps } from \"./ContextMenu\";\nexport { ContextMenu } from \"./ContextMenu\";\nexport type { CopyButtonProps, CopyButtonValue } from \"./CopyButton\";\nexport { CopyButton } from \"./CopyButton\";\nexport type { CommandContext, CommandItem, CommandSource, CommandStep } from \"./command-items\";\nexport type { DisclosureProps } from \"./Disclosure\";\nexport { Disclosure } from \"./Disclosure\";\nexport type { DragPayload, DragSourceProps, DragStatus, DropTargetProps } from \"./DragAndDrop\";\nexport { activeDrag, DragSource, DropTarget, dragStatus, useKeyboardDrag } from \"./DragAndDrop\";\nexport type {\n DropdownAction,\n DropdownActionBase,\n DropdownAnchor,\n DropdownChoice,\n DropdownItemProps,\n DropdownPosition,\n DropdownProps,\n DropdownReturnFocus,\n DropdownSearch,\n DropdownSection,\n DropdownSubmenu,\n DropdownTriggerProps,\n} from \"./Dropdown\";\nexport { Dropdown, DropdownItem, dropdownPosition } from \"./Dropdown\";\nexport type { DropOverlayLevel, DropOverlayProps, DropOverlayTile } from \"./DropOverlay\";\nexport { DropOverlay } from \"./DropOverlay\";\nexport type { DropOverlayPageLabels } from \"./drop-overlay-pages\";\nexport { dropOverlayPages } from \"./drop-overlay-pages\";\nexport type { FilterChipOption, FilterChipProps, FilterChipSection, FilterToggleProps } from \"./FilterChip\";\nexport { FilterChip, FilterToggle } from \"./FilterChip\";\nexport type { GestureKind, GestureMenuAction, GestureMenuItem, GestureMenuProps, GestureMenuSection } from \"./GestureMenu\";\nexport { GestureMenu } from \"./GestureMenu\";\nexport type { RemoveButtonProps } from \"./RemoveButton\";\nexport { RemoveButton } from \"./RemoveButton\";\nexport type { SegmentedControlProps, SegmentOption } from \"./SegmentedControl\";\nexport { SegmentedControl } from \"./SegmentedControl\";\nexport type { SelectionActionProps, SelectionActionSelection } from \"./SelectionAction\";\nexport { SelectionAction } from \"./SelectionAction\";\nexport type { SelectionToolbarProps } from \"./SelectionToolbar\";\nexport { SelectionToolbar } from \"./SelectionToolbar\";\nexport type { SortableListProps, SortableMove } from \"./SortableList\";\nexport { SortableList, useSortableMoveMenu } from \"./SortableList\";\nexport type { SplitButtonProps } from \"./SplitButton\";\nexport { SplitButton } from \"./SplitButton\";\nexport type {\n SpotlightButtonProps,\n SpotlightButtonVariant,\n SpotlightSearchOptions,\n SpotlightSearchResolver,\n} from \"./SpotlightSearch\";\nexport {\n openSpotlightSearch,\n SpotlightButton,\n} from \"./SpotlightSearch\";\nexport type { TabOption, TabsItemProps, TabsProps } from \"./Tabs\";\nexport { Tabs } from \"./Tabs\";\nexport type {\n ToolbarActionProps,\n ToolbarDockProps,\n ToolbarGroupProps,\n ToolbarLabelProps,\n ToolbarProps,\n ToolbarSeparatorProps,\n} from \"./Toolbar\";\nexport { Toolbar, ToolbarDock } from \"./Toolbar\";\nexport type { ViewTab, ViewTabsProps } from \"./ViewTabs\";\nexport { ViewTabs } from \"./ViewTabs\";\n"],"mappings":"AACA,SAAS,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,QAAQ,UAAU;AAEzE,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,UAAU,QAAQ,cAAc;AAGzC,SAAS,UAAU,QAAQ,cAAc;AAEzC,SAAS,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,QAAQ,eAAe;AAe/F,SAAS,QAAQ,EAAE,YAAY,EAAE,gBAAgB,QAAQ,YAAY;AAErE,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,gBAAgB,QAAQ,sBAAsB;AAEvD,SAAS,UAAU,EAAE,YAAY,QAAQ,cAAc;AAEvD,SAAS,WAAW,QAAQ,eAAe;AAE3C,SAAS,YAAY,QAAQ,gBAAgB;AAE7C,SAAS,gBAAgB,QAAQ,oBAAoB;AAErD,SAAS,eAAe,QAAQ,mBAAmB;AAEnD,SAAS,gBAAgB,QAAQ,oBAAoB;AAErD,SAAS,YAAY,EAAE,mBAAmB,QAAQ,gBAAgB;AAElE,SAAS,WAAW,QAAQ,eAAe;AAO3C,SACE,mBAAmB,EACnB,eAAe,QACV,mBAAmB;AAE1B,SAAS,IAAI,QAAQ,QAAQ;AAS7B,SAAS,OAAO,EAAE,WAAW,QAAQ,WAAW;AAEhD,SAAS,QAAQ,QAAQ,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { i18n } from "@k2b/stdlib";
|
|
2
|
+
import { useLocale } from "../intl/locale";
|
|
3
|
+
|
|
4
|
+
/** The phone menu sheet's own words; they load with the sheet, so menus without one do not carry them. */
|
|
5
|
+
const menuSheetMessages = i18n.define({
|
|
6
|
+
baseLocale: "en",
|
|
7
|
+
messages: {
|
|
8
|
+
en: {
|
|
9
|
+
menuBack: ({
|
|
10
|
+
menu
|
|
11
|
+
}) => `Back from ${menu}`
|
|
12
|
+
},
|
|
13
|
+
de: {
|
|
14
|
+
menuBack: ({
|
|
15
|
+
menu
|
|
16
|
+
}) => `Zurück aus ${menu}`
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
/** Resolved from the inherited render locale. */
|
|
21
|
+
export const useMenuSheetMessages = () => {
|
|
22
|
+
const locale = useLocale();
|
|
23
|
+
return () => menuSheetMessages.resolve([locale()]).t;
|
|
24
|
+
};
|
|
25
|
+
export const checkMenuSheetMessages = () => menuSheetMessages.check();
|
|
26
|
+
//# sourceMappingURL=menu-sheet-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["actions/menu-sheet-messages.ts"],"sourcesContent":["import { i18n } from \"@k2b/stdlib\";\nimport { useLocale } from \"../intl/locale\";\n\n/** The phone menu sheet's own words; they load with the sheet, so menus without one do not carry them. */\nconst menuSheetMessages = i18n.define({\n baseLocale: \"en\",\n messages: {\n en: {\n menuBack: ({ menu }: { menu: string }) => `Back from ${menu}`,\n },\n de: {\n menuBack: ({ menu }: { menu: string }) => `Zurück aus ${menu}`,\n },\n },\n});\n\nexport type MenuSheetMessages = ReturnType<(typeof menuSheetMessages)[\"resolve\"]>[\"t\"];\n\n/** Resolved from the inherited render locale. */\nexport const useMenuSheetMessages = (): (() => MenuSheetMessages) => {\n const locale = useLocale();\n return () => menuSheetMessages.resolve([locale()]).t;\n};\n\nexport const checkMenuSheetMessages = () => menuSheetMessages.check();\n"],"mappings":"AAAA,SAAS,IAAI,QAAQ,aAAa;AAClC,SAAS,SAAS,QAAQ,gBAAgB;;AAE1C;AACA,MAAM,iBAAiB,GAAG,IAAI,CAAC,MAAM,CAAC;EACpC,UAAU,EAAE,IAAI;EAChB,QAAQ,EAAE;IACR,EAAE,EAAE;MACF,QAAQ,EAAE,CAAC;QAAE;MAAuB,CAAC,KAAK,aAAa,IAAI;IAC7D,CAAC;IACD,EAAE,EAAE;MACF,QAAQ,EAAE,CAAC;QAAE;MAAuB,CAAC,KAAK,cAAc,IAAI;IAC9D;EACF;AACF,CAAC,CAAC;AAIF;AACA,OAAO,MAAM,oBAAoB,GAAG,MAAiC;EACnE,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC;EAC1B,OAAO,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,OAAO,MAAM,sBAAsB,GAAG,MAAM,iBAAiB,CAAC,KAAK,CAAC,CAAC","ignoreList":[]}
|
|
@@ -3,14 +3,16 @@ import { createComponent as _$createComponent } from "solid-js/web";
|
|
|
3
3
|
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
4
4
|
import { escape as _$escape } from "solid-js/web";
|
|
5
5
|
var _tmpl$ = ["<div class=\"k2b-gesture-menu__sheet-menu\" role=\"menu\"", ">", "</div>"],
|
|
6
|
-
_tmpl$2 = ["<
|
|
7
|
-
_tmpl$3 = ["<
|
|
6
|
+
_tmpl$2 = ["<button type=\"button\" role=\"menuitem\" tabindex=\"-1\" class=\"k2b-dropdown__item k2b-dropdown__back\"", "><i class=\"ti ti-chevron-left\" aria-hidden=\"true\"></i><span class=\"k2b-dropdown__copy\"><span>", "</span></span></button>"],
|
|
7
|
+
_tmpl$3 = ["<div class=\"k2b-gesture-menu__sheet-menu\" role=\"dialog\"", " data-search", ">", "</div>"],
|
|
8
|
+
_tmpl$4 = ["<p class=\"k2b-dropdown__note\">", "</p>"];
|
|
8
9
|
import { createSignal, onCleanup, onMount, Show } from "solid-js";
|
|
9
10
|
import { dialogCore } from "../feedback/dialog-core";
|
|
10
11
|
import { LocaleProvider } from "../intl/locale";
|
|
11
12
|
import BottomSheet, { bottomSheetOptions } from "../layout/BottomSheet";
|
|
12
13
|
import { focusMenuRow, focusRowSegment } from "./menu-rows";
|
|
13
14
|
import { filterDropdownItems, MenuSearch } from "./menu-search";
|
|
15
|
+
import { useMenuSheetMessages } from "./menu-sheet-messages";
|
|
14
16
|
|
|
15
17
|
// Kept apart so a control can check for phones without loading the sheet and its dialog imports.
|
|
16
18
|
export { PHONE_SHEET_QUERY, prefersMenuSheet } from "./phone-sheet";
|
|
@@ -34,6 +36,11 @@ const followLink = href => {
|
|
|
34
36
|
*/
|
|
35
37
|
const afterClose = (items, run) => {
|
|
36
38
|
const entry = item => {
|
|
39
|
+
// A submenu's entries run after the sheet closed as well.
|
|
40
|
+
if ("submenu" in item) return {
|
|
41
|
+
...item,
|
|
42
|
+
submenu: afterClose(item.submenu, run)
|
|
43
|
+
};
|
|
37
44
|
// A plain link would navigate while the sheet's history entry is still being removed, and that Back could
|
|
38
45
|
// undo the navigation; a plain click instead follows it once the sheet is gone. Modified clicks and external
|
|
39
46
|
// links keep the browser's own behavior.
|
|
@@ -67,10 +74,34 @@ const menuItems = menu => Array.from(menu.querySelectorAll("[role^='menuitem']:n
|
|
|
67
74
|
*/
|
|
68
75
|
function SheetMenu(props) {
|
|
69
76
|
let menu;
|
|
77
|
+
const messages = useMenuSheetMessages();
|
|
78
|
+
// K16: on a phone a submenu takes the sheet's place, one level at a time, with Back at its top.
|
|
79
|
+
const [levels, setLevels] = createSignal([]);
|
|
80
|
+
const current = () => levels().at(-1);
|
|
81
|
+
const focusRow = index => queueMicrotask(() => menuItems(menu)[index]?.focus());
|
|
82
|
+
const drill = (item, row) => {
|
|
83
|
+
const index = menuItems(menu).indexOf(row);
|
|
84
|
+
setLevels(stack => [...stack, {
|
|
85
|
+
label: item.label,
|
|
86
|
+
items: item.submenu,
|
|
87
|
+
index
|
|
88
|
+
}]);
|
|
89
|
+
// The back row comes first; the level's first entry takes the focus.
|
|
90
|
+
focusRow(1);
|
|
91
|
+
};
|
|
92
|
+
const back = () => {
|
|
93
|
+
const left = current();
|
|
94
|
+
if (!left) return;
|
|
95
|
+
setLevels(stack => stack.slice(0, -1));
|
|
96
|
+
focusRow(left.index);
|
|
97
|
+
};
|
|
70
98
|
const onKeyDown = event => {
|
|
71
99
|
const items = menuItems(menu);
|
|
72
|
-
if (
|
|
73
|
-
event.
|
|
100
|
+
if (focusMenuRow(items, event.key) || focusRowSegment(items, event.key)) return void event.preventDefault();
|
|
101
|
+
if (current() && (event.key === "ArrowLeft" || event.key === "Backspace")) {
|
|
102
|
+
event.preventDefault();
|
|
103
|
+
back();
|
|
104
|
+
}
|
|
74
105
|
};
|
|
75
106
|
// Keys pressed on the sheet itself, while it is the top level of the shared dialog.
|
|
76
107
|
const onSheetKeyDown = event => {
|
|
@@ -80,18 +111,39 @@ function SheetMenu(props) {
|
|
|
80
111
|
props.dialog.addEventListener("keydown", onSheetKeyDown);
|
|
81
112
|
onCleanup(() => props.dialog.removeEventListener("keydown", onSheetKeyDown));
|
|
82
113
|
});
|
|
83
|
-
return _$ssr(_tmpl$, _$ssrAttribute("aria-label", _$escape(props.label, true), false) + _$ssrAttribute("data-icons", props.icons === "tile" ? "tile" : _$escape(undefined, true), false), _$escape(_$createComponent(
|
|
84
|
-
get
|
|
85
|
-
return
|
|
114
|
+
return _$ssr(_tmpl$, _$ssrAttribute("aria-label", _$escape(current()?.label ?? props.label, true), false) + _$ssrAttribute("data-icons", props.icons === "tile" ? "tile" : _$escape(undefined, true), false), _$escape(_$createComponent(Show, {
|
|
115
|
+
get when() {
|
|
116
|
+
return current();
|
|
86
117
|
},
|
|
87
|
-
|
|
118
|
+
keyed: true,
|
|
119
|
+
get fallback() {
|
|
120
|
+
return _$createComponent(props.Items, {
|
|
121
|
+
get items() {
|
|
122
|
+
return props.items;
|
|
123
|
+
},
|
|
124
|
+
close: () => props.close(),
|
|
125
|
+
drill: drill
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
children: level => [_$ssr(_tmpl$2, _$ssrAttribute("aria-label", _$escape(messages().menuBack({
|
|
129
|
+
menu: level.label
|
|
130
|
+
}), true), false), _$escape(level.label)), _$createComponent(props.Items, {
|
|
131
|
+
get items() {
|
|
132
|
+
return level.items;
|
|
133
|
+
},
|
|
134
|
+
close: () => props.close(),
|
|
135
|
+
drill: drill,
|
|
136
|
+
get depth() {
|
|
137
|
+
return levels().length + 1;
|
|
138
|
+
}
|
|
139
|
+
})]
|
|
88
140
|
})));
|
|
89
141
|
}
|
|
90
142
|
/** A searchable menu in the sheet: the sheet's first field, so it takes the focus as the sheet opens, as in the menu. */
|
|
91
143
|
function SheetSearch(props) {
|
|
92
144
|
const [query, setQuery] = createSignal("");
|
|
93
145
|
const filter = props.search.filter;
|
|
94
|
-
return _$ssr(_tmpl$
|
|
146
|
+
return _$ssr(_tmpl$3, _$ssrAttribute("aria-label", _$escape(props.label, true), false), _$ssrAttribute("data-icons", props.icons === "tile" ? "tile" : _$escape(undefined, true), false), _$escape(_$createComponent(MenuSearch, {
|
|
95
147
|
get Items() {
|
|
96
148
|
return props.Items;
|
|
97
149
|
},
|
|
@@ -183,7 +235,7 @@ export const openMenuSheet = options => {
|
|
|
183
235
|
return options.note;
|
|
184
236
|
},
|
|
185
237
|
get children() {
|
|
186
|
-
return _$ssr(_tmpl$
|
|
238
|
+
return _$ssr(_tmpl$4, _$escape(options.note));
|
|
187
239
|
}
|
|
188
240
|
})];
|
|
189
241
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["actions/menu-sheet.tsx"],"sourcesContent":["import { createSignal, type JSX, onCleanup, onMount, Show } from \"solid-js\";\nimport { dialogCore } from \"../feedback/dialog-core\";\nimport { LocaleProvider } from \"../intl/locale\";\nimport BottomSheet, { bottomSheetOptions } from \"../layout/BottomSheet\";\nimport type { DropdownAction, DropdownChoice, DropdownItem, DropdownSearch } from \"./Dropdown\";\nimport { focusMenuRow, focusRowSegment } from \"./menu-rows\";\nimport { filterDropdownItems, MenuSearch } from \"./menu-search\";\n\n// Kept apart so a control can check for phones without loading the sheet and its dialog imports.\nexport { PHONE_SHEET_QUERY, prefersMenuSheet } from \"./phone-sheet\";\n\ntype SheetEntry = DropdownAction | DropdownChoice;\ntype SheetItem = SheetEntry | { items: readonly SheetEntry[] };\n\n/**\n * Follows a link the way a click on it would, so a page's own link handling, such as progressive navigation, still\n * applies; it runs only after the sheet has left the history.\n */\nconst followLink = (href: string) => {\n const link = document.createElement(\"a\");\n link.href = href;\n link.hidden = true;\n document.body.append(link);\n link.click();\n link.remove();\n};\n\n/**\n * The sheet's items hand their action to `run` instead of running it while the sheet closes: `dialogCore` settles the\n * sheet after it left the history, and only then may an action navigate or open the next dialog.\n * A choice or action that keeps the menu open, or an `immediate` action, runs at once.\n */\nconst afterClose = <T extends DropdownItem>(items: readonly T[], run: (action: () => void) => void): T[] => {\n const entry = (item: SheetEntry): SheetEntry => {\n // A plain link would navigate while the sheet's history entry is still being removed, and that Back could\n // undo the navigation; a plain click instead follows it once the sheet is gone. Modified clicks and external\n // links keep the browser's own behavior.\n if (!item.action && \"href\" in item && item.href && !(\"external\" in item && item.external)) {\n const href = item.href;\n return { ...item, action: () => run(() => followLink(href)) } as SheetEntry;\n }\n const action = item.action;\n if (!action || (\"closeOnSelect\" in item && item.closeOnSelect === false) || (\"immediate\" in item && item.immediate)) return item;\n return { ...item, action: () => run(action) } as SheetEntry;\n };\n return items.map((item) => {\n const sheetItem = item as SheetItem;\n return (\"items\" in sheetItem ? { ...sheetItem, items: sheetItem.items.map(entry) } : entry(sheetItem)) as T;\n });\n};\n\nconst menuItems = (menu: HTMLElement): HTMLElement[] =>\n Array.from(menu.querySelectorAll<HTMLElement>(\"[role^='menuitem']:not([aria-disabled='true'])\"));\n\n/**\n * The menu inside the sheet: the same items, at touch size, with arrow keys for a connected keyboard. Focus starts on\n * the sheet itself, which shows no ring on a phone; the first arrow key moves it into the menu.\n */\nfunction SheetMenu(props: {\n Items: MenuSheetOptions[\"Items\"];\n items: readonly DropdownItem[];\n label: string;\n close: () => void;\n dialog: HTMLDialogElement;\n icons?: \"plain\" | \"tile\";\n}): JSX.Element {\n let menu!: HTMLDivElement;\n const onKeyDown = (event: KeyboardEvent) => {\n const items = menuItems(menu);\n if (!focusMenuRow(items, event.key) && !focusRowSegment(items, event.key)) return;\n event.preventDefault();\n };\n // Keys pressed on the sheet itself, while it is the top level of the shared dialog.\n const onSheetKeyDown = (event: KeyboardEvent) => {\n if (event.target === props.dialog && props.dialog.lastElementChild?.contains(menu)) onKeyDown(event);\n };\n onMount(() => {\n props.dialog.addEventListener(\"keydown\", onSheetKeyDown);\n onCleanup(() => props.dialog.removeEventListener(\"keydown\", onSheetKeyDown));\n });\n return (\n <div\n ref={menu}\n class=\"k2b-gesture-menu__sheet-menu\"\n role=\"menu\"\n aria-label={props.label}\n data-icons={props.icons === \"tile\" ? \"tile\" : undefined}\n onKeyDown={onKeyDown}\n >\n <props.Items items={props.items} close={() => props.close()} />\n </div>\n );\n}\n\nexport type MenuSheetOptions = {\n /** Renders the rows: the dropdown's own `DropdownItems`, passed in so this module does not import it back. */\n Items: (props: { items: readonly DropdownItem[]; close: (restoreFocus?: boolean) => void }) => JSX.Element;\n items: readonly DropdownItem[];\n /** Names the sheet and its menu. */\n label: string;\n /** The render locale of the opener; the sheet renders outside its tree. */\n locale: string;\n /** Shown above the menu, for example a row of quick reactions. `close` closes the sheet. */\n top?: (close: () => void) => JSX.Element;\n search?: DropdownSearch;\n icons?: \"plain\" | \"tile\";\n /** A quiet sentence below the entries. */\n note?: string;\n signal?: AbortSignal;\n};\n\n/** A searchable menu in the sheet: the sheet's first field, so it takes the focus as the sheet opens, as in the menu. */\nfunction SheetSearch(props: {\n Items: MenuSheetOptions[\"Items\"];\n items: readonly DropdownItem[];\n search: DropdownSearch;\n wrap: <T extends DropdownItem>(items: readonly T[]) => T[];\n label: string;\n locale: string;\n close: () => void;\n icons?: \"plain\" | \"tile\";\n}): JSX.Element {\n const [query, setQuery] = createSignal(\"\");\n const filter = props.search.filter;\n return (\n <div\n class=\"k2b-gesture-menu__sheet-menu\"\n role=\"dialog\"\n aria-label={props.label}\n data-search=\"\"\n data-icons={props.icons === \"tile\" ? \"tile\" : undefined}\n >\n <MenuSearch\n Items={props.Items}\n items={props.items}\n search={{\n ...props.search,\n // The sheet's own items are wrapped already; a host's filter returns its unwrapped entries.\n filter: (value) => (filter ? props.wrap(filter(value)) : filterDropdownItems(props.items, value, props.locale)),\n }}\n label={props.label}\n query={query}\n setQuery={setQuery}\n close={() => props.close()}\n />\n </div>\n );\n}\n\n/** Opens menu items as a bottom sheet; resolves after the sheet closed and the chosen action ran. */\nexport const openMenuSheet = (options: MenuSheetOptions): Promise<void> => {\n let chosen: (() => void) | undefined;\n const choose = (action: () => void) => {\n chosen = action;\n };\n return dialogCore\n .open<void>(\n (close, context) => (\n <LocaleProvider locale={options.locale}>\n <BottomSheet onDismiss={context.requestDismiss}>\n <BottomSheet.Body>\n {options.top?.(() => close())}\n <Show\n when={options.search}\n fallback={\n <SheetMenu\n Items={options.Items}\n items={afterClose(options.items, choose)}\n label={options.label}\n close={() => close()}\n dialog={context.dialog}\n icons={options.icons}\n />\n }\n >\n {(search) => (\n <SheetSearch\n Items={options.Items}\n items={afterClose(options.items, choose)}\n search={search()}\n wrap={(items) => afterClose(items, choose)}\n label={options.label}\n locale={options.locale}\n close={() => close()}\n icons={options.icons}\n />\n )}\n </Show>\n <Show when={options.note}>\n <p class=\"k2b-dropdown__note\">{options.note}</p>\n </Show>\n </BottomSheet.Body>\n </BottomSheet>\n </LocaleProvider>\n ),\n { ...bottomSheetOptions, ariaLabel: options.label, history: true, signal: options.signal },\n )\n .then(() => chosen?.());\n};\n"],"mappings":";;;;;;;AAAA,SAAS,YAAY,EAAY,SAAS,EAAE,OAAO,EAAE,IAAI,QAAQ,UAAU;AAC3E,SAAS,UAAU,QAAQ,yBAAyB;AACpD,SAAS,cAAc,QAAQ,gBAAgB;AAC/C,OAAO,WAAW,IAAI,kBAAkB,QAAQ,uBAAuB;AAEvE,SAAS,YAAY,EAAE,eAAe,QAAQ,aAAa;AAC3D,SAAS,mBAAmB,EAAE,UAAU,QAAQ,eAAe;;AAE/D;AACA,SAAS,iBAAiB,EAAE,gBAAgB,QAAQ,eAAe;AAKnE;AACA;AACA;AACA;AACA,MAAM,UAAU,GAAI,IAAY,IAAK;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AC;EAAO,CAC3F,CAAC,CACA,IAAI,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC;AAC3B,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["actions/menu-sheet.tsx"],"sourcesContent":["import { createSignal, type JSX, onCleanup, onMount, Show } from \"solid-js\";\nimport { dialogCore } from \"../feedback/dialog-core\";\nimport { LocaleProvider } from \"../intl/locale\";\nimport BottomSheet, { bottomSheetOptions } from \"../layout/BottomSheet\";\nimport type { DropdownAction, DropdownChoice, DropdownItem, DropdownSearch, DropdownSubmenu } from \"./Dropdown\";\nimport { focusMenuRow, focusRowSegment } from \"./menu-rows\";\nimport { filterDropdownItems, MenuSearch } from \"./menu-search\";\nimport { useMenuSheetMessages } from \"./menu-sheet-messages\";\n\n// Kept apart so a control can check for phones without loading the sheet and its dialog imports.\nexport { PHONE_SHEET_QUERY, prefersMenuSheet } from \"./phone-sheet\";\n\ntype SheetEntry = DropdownAction | DropdownChoice;\ntype SheetLevel = { label: string; items: readonly DropdownItem[]; index: number };\ntype SheetItem = SheetEntry | { items: readonly SheetEntry[] };\n\n/**\n * Follows a link the way a click on it would, so a page's own link handling, such as progressive navigation, still\n * applies; it runs only after the sheet has left the history.\n */\nconst followLink = (href: string) => {\n const link = document.createElement(\"a\");\n link.href = href;\n link.hidden = true;\n document.body.append(link);\n link.click();\n link.remove();\n};\n\n/**\n * The sheet's items hand their action to `run` instead of running it while the sheet closes: `dialogCore` settles the\n * sheet after it left the history, and only then may an action navigate or open the next dialog.\n * A choice or action that keeps the menu open, or an `immediate` action, runs at once.\n */\nconst afterClose = <T extends DropdownItem>(items: readonly T[], run: (action: () => void) => void): T[] => {\n const entry = (item: SheetEntry): SheetEntry => {\n // A submenu's entries run after the sheet closed as well.\n if (\"submenu\" in item) return { ...item, submenu: afterClose(item.submenu, run) };\n // A plain link would navigate while the sheet's history entry is still being removed, and that Back could\n // undo the navigation; a plain click instead follows it once the sheet is gone. Modified clicks and external\n // links keep the browser's own behavior.\n if (!item.action && \"href\" in item && item.href && !(\"external\" in item && item.external)) {\n const href = item.href;\n return { ...item, action: () => run(() => followLink(href)) } as SheetEntry;\n }\n const action = item.action;\n if (!action || (\"closeOnSelect\" in item && item.closeOnSelect === false) || (\"immediate\" in item && item.immediate)) return item;\n return { ...item, action: () => run(action) } as SheetEntry;\n };\n return items.map((item) => {\n const sheetItem = item as SheetItem;\n return (\"items\" in sheetItem ? { ...sheetItem, items: sheetItem.items.map(entry) } : entry(sheetItem)) as T;\n });\n};\n\nconst menuItems = (menu: HTMLElement): HTMLElement[] =>\n Array.from(menu.querySelectorAll<HTMLElement>(\"[role^='menuitem']:not([aria-disabled='true'])\"));\n\n/**\n * The menu inside the sheet: the same items, at touch size, with arrow keys for a connected keyboard. Focus starts on\n * the sheet itself, which shows no ring on a phone; the first arrow key moves it into the menu.\n */\nfunction SheetMenu(props: {\n Items: MenuSheetOptions[\"Items\"];\n items: readonly DropdownItem[];\n label: string;\n close: () => void;\n dialog: HTMLDialogElement;\n icons?: \"plain\" | \"tile\";\n}): JSX.Element {\n let menu!: HTMLDivElement;\n const messages = useMenuSheetMessages();\n // K16: on a phone a submenu takes the sheet's place, one level at a time, with Back at its top.\n const [levels, setLevels] = createSignal<readonly SheetLevel[]>([]);\n const current = () => levels().at(-1);\n const focusRow = (index: number) => queueMicrotask(() => menuItems(menu)[index]?.focus());\n const drill = (item: DropdownSubmenu, row: HTMLElement) => {\n const index = menuItems(menu).indexOf(row);\n setLevels((stack) => [...stack, { label: item.label, items: item.submenu, index }]);\n // The back row comes first; the level's first entry takes the focus.\n focusRow(1);\n };\n const back = () => {\n const left = current();\n if (!left) return;\n setLevels((stack) => stack.slice(0, -1));\n focusRow(left.index);\n };\n const onKeyDown = (event: KeyboardEvent) => {\n const items = menuItems(menu);\n if (focusMenuRow(items, event.key) || focusRowSegment(items, event.key)) return void event.preventDefault();\n if (current() && (event.key === \"ArrowLeft\" || event.key === \"Backspace\")) {\n event.preventDefault();\n back();\n }\n };\n // Keys pressed on the sheet itself, while it is the top level of the shared dialog.\n const onSheetKeyDown = (event: KeyboardEvent) => {\n if (event.target === props.dialog && props.dialog.lastElementChild?.contains(menu)) onKeyDown(event);\n };\n onMount(() => {\n props.dialog.addEventListener(\"keydown\", onSheetKeyDown);\n onCleanup(() => props.dialog.removeEventListener(\"keydown\", onSheetKeyDown));\n });\n return (\n <div\n ref={menu}\n class=\"k2b-gesture-menu__sheet-menu\"\n role=\"menu\"\n aria-label={current()?.label ?? props.label}\n data-icons={props.icons === \"tile\" ? \"tile\" : undefined}\n onKeyDown={onKeyDown}\n >\n <Show when={current()} keyed fallback={<props.Items items={props.items} close={() => props.close()} drill={drill} />}>\n {(level) => (\n <>\n <button\n type=\"button\"\n role=\"menuitem\"\n tabIndex={-1}\n class=\"k2b-dropdown__item k2b-dropdown__back\"\n aria-label={messages().menuBack({ menu: level.label })}\n onClick={back}\n >\n <i class=\"ti ti-chevron-left\" aria-hidden=\"true\" />\n <span class=\"k2b-dropdown__copy\">\n <span>{level.label}</span>\n </span>\n </button>\n <props.Items items={level.items} close={() => props.close()} drill={drill} depth={levels().length + 1} />\n </>\n )}\n </Show>\n </div>\n );\n}\n\nexport type MenuSheetOptions = {\n /** Renders the rows: the dropdown's own `DropdownItems`, passed in so this module does not import it back. */\n Items: (props: {\n items: readonly DropdownItem[];\n close: (restoreFocus?: boolean) => void;\n depth?: number;\n drill?: (item: DropdownSubmenu, row: HTMLElement) => void;\n }) => JSX.Element;\n items: readonly DropdownItem[];\n /** Names the sheet and its menu. */\n label: string;\n /** The render locale of the opener; the sheet renders outside its tree. */\n locale: string;\n /** Shown above the menu, for example a row of quick reactions. `close` closes the sheet. */\n top?: (close: () => void) => JSX.Element;\n search?: DropdownSearch;\n icons?: \"plain\" | \"tile\";\n /** A quiet sentence below the entries. */\n note?: string;\n signal?: AbortSignal;\n};\n\n/** A searchable menu in the sheet: the sheet's first field, so it takes the focus as the sheet opens, as in the menu. */\nfunction SheetSearch(props: {\n Items: MenuSheetOptions[\"Items\"];\n items: readonly DropdownItem[];\n search: DropdownSearch;\n wrap: <T extends DropdownItem>(items: readonly T[]) => T[];\n label: string;\n locale: string;\n close: () => void;\n icons?: \"plain\" | \"tile\";\n}): JSX.Element {\n const [query, setQuery] = createSignal(\"\");\n const filter = props.search.filter;\n return (\n <div\n class=\"k2b-gesture-menu__sheet-menu\"\n role=\"dialog\"\n aria-label={props.label}\n data-search=\"\"\n data-icons={props.icons === \"tile\" ? \"tile\" : undefined}\n >\n <MenuSearch\n Items={props.Items}\n items={props.items}\n search={{\n ...props.search,\n // The sheet's own items are wrapped already; a host's filter returns its unwrapped entries.\n filter: (value) => (filter ? props.wrap(filter(value)) : filterDropdownItems(props.items, value, props.locale)),\n }}\n label={props.label}\n query={query}\n setQuery={setQuery}\n close={() => props.close()}\n />\n </div>\n );\n}\n\n/** Opens menu items as a bottom sheet; resolves after the sheet closed and the chosen action ran. */\nexport const openMenuSheet = (options: MenuSheetOptions): Promise<void> => {\n let chosen: (() => void) | undefined;\n const choose = (action: () => void) => {\n chosen = action;\n };\n return dialogCore\n .open<void>(\n (close, context) => (\n <LocaleProvider locale={options.locale}>\n <BottomSheet onDismiss={context.requestDismiss}>\n <BottomSheet.Body>\n {options.top?.(() => close())}\n <Show\n when={options.search}\n fallback={\n <SheetMenu\n Items={options.Items}\n items={afterClose(options.items, choose)}\n label={options.label}\n close={() => close()}\n dialog={context.dialog}\n icons={options.icons}\n />\n }\n >\n {(search) => (\n <SheetSearch\n Items={options.Items}\n items={afterClose(options.items, choose)}\n search={search()}\n wrap={(items) => afterClose(items, choose)}\n label={options.label}\n locale={options.locale}\n close={() => close()}\n icons={options.icons}\n />\n )}\n </Show>\n <Show when={options.note}>\n <p class=\"k2b-dropdown__note\">{options.note}</p>\n </Show>\n </BottomSheet.Body>\n </BottomSheet>\n </LocaleProvider>\n ),\n { ...bottomSheetOptions, ariaLabel: options.label, history: true, signal: options.signal },\n )\n .then(() => chosen?.());\n};\n"],"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KAAK;oBAAA;oBACpB,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC;oBAAA,IACpB,MAAM;sBAAA,OAAE,OAAO,CAAC,MAAM;oBAAA;oBAAA,IACtB,KAAK;sBAAA,OAAE,OAAO,CAAC,KAAK;oBAAA;kBAAA;gBAAA;gBAAA,UAItB,MAAM,sBACL,WAAW;kBAAA,IACV,KAAK;oBAAA,OAAE,OAAO,CAAC,KAAK;kBAAA;kBAAA,IACpB,KAAK;oBAAA,OAAE,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC;kBAAA;kBAAA,IACxC,MAAM;oBAAA,OAAE,MAAM,CAAC,CAAC;kBAAA;kBAChB,IAAI,EAAG,KAAK,IAAK,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC;kBAAA,IAC1C,KAAK;oBAAA,OAAE,OAAO,CAAC,KAAK;kBAAA;kBAAA,IACpB,MAAM;oBAAA,OAAE,OAAO,CAAC,MAAM;kBAAA;kBACtB,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC;kBAAA,IACpB,KAAK;oBAAA,OAAE,OAAO,CAAC,KAAK;kBAAA;gBAAA;cAEvB,sBAEF,IAAI;gBAAA,IAAC,IAAI;kBAAA,OAAE,OAAO,CAAC,IAAI;gBAAA;gBAAA;kBAAA,+BACS,OAAO,CAAC,IAAI;gBAAA;cAAA;YAAA;UAAA;QAAA;MAAA;IAAA;EAAA,EAKpD,EACD;IAAE,GAAG,kBAAkB;IAAE,SAAS,EAAE,OAAO,CAAC,KAAK;IAAE,OAAO,EAAE,IAAI;IAAE,MAAM,EAAE,OAAO,CAAC;EAAO,CAC3F,CAAC,CACA,IAAI,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { memo as _$memo } from "solid-js/web";
|
|
2
|
+
import { ssr as _$ssr } from "solid-js/web";
|
|
3
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
4
|
+
import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
|
|
5
|
+
import { escape as _$escape } from "solid-js/web";
|
|
6
|
+
var _tmpl$ = ["<div id=\"", "\" popover=\"manual\" role=\"menu\"", " class=\"k2b-dropdown__menu k2b-dropdown__submenu\"", ">", "</div>"],
|
|
7
|
+
_tmpl$2 = ["<div role=\"none\" class=\"k2b-dropdown__subgroup\"><button", " type=\"button\"", " tabindex=\"-1\" class=\"", "\"", " aria-haspopup=\"menu\"", "", ">", "<i class=\"ti ti-chevron-right k2b-dropdown__more\" aria-hidden=\"true\"></i></button>", "</div>"];
|
|
8
|
+
import { createEffect, createRoot, createSignal, createUniqueId, on, onCleanup, onMount, Show } from "solid-js";
|
|
9
|
+
import { inheritUiScope } from "../internal/portal-scope";
|
|
10
|
+
import { focusMenuRow, focusRowSegment } from "./menu-rows";
|
|
11
|
+
|
|
12
|
+
/** How long the pointer rests on a row before its submenu opens, or another row's closes it (K16). */
|
|
13
|
+
const DELAY = 150;
|
|
14
|
+
/** How long a move towards an open submenu keeps it open while the pointer crosses other rows. */
|
|
15
|
+
const CORRIDOR_DELAY = 300;
|
|
16
|
+
/** A menu, its submenu, and one more: deeper entries are not offered (K16). */
|
|
17
|
+
const MAX_DEPTH = 3;
|
|
18
|
+
|
|
19
|
+
/** The least room a menu keeps from the viewport's edge, as every menu does. */
|
|
20
|
+
const EDGE = 8;
|
|
21
|
+
const GAP = 4;
|
|
22
|
+
/**
|
|
23
|
+
* Where a submenu stands: beside its row, its first row level with it, on the side that has room; without room on
|
|
24
|
+
* either side it keeps to the viewport. Too low, it rises until its last row is level with its row's bottom.
|
|
25
|
+
*/
|
|
26
|
+
export const placeSubmenu = (row, parent, menu, viewport, rtl = false) => {
|
|
27
|
+
// Two objects side by side, 4 px apart as a menu stands from its trigger: their edges never meet (one line, one owner).
|
|
28
|
+
const right = parent.right + GAP;
|
|
29
|
+
const left = parent.left - menu.width - GAP;
|
|
30
|
+
const fitsRight = right + menu.width <= viewport.width - EDGE;
|
|
31
|
+
const fitsLeft = left >= EDGE;
|
|
32
|
+
const side = rtl ? fitsLeft || !fitsRight ? "left" : "right" : fitsRight || !fitsLeft ? "right" : "left";
|
|
33
|
+
const x = side === "right" ? right : left;
|
|
34
|
+
// The menu's 1 px edge stands above the row, so its first row lines up with the row that opened it.
|
|
35
|
+
let top = row.top - 1;
|
|
36
|
+
if (top + menu.height > viewport.height - EDGE) top = row.bottom + 1 - menu.height;
|
|
37
|
+
return {
|
|
38
|
+
left: Math.max(EDGE, Math.min(x, viewport.width - menu.width - EDGE)),
|
|
39
|
+
top: Math.max(EDGE, Math.min(top, viewport.height - menu.height - EDGE)),
|
|
40
|
+
side
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const sign = (p, a, b) => (p.x - b.x) * (a.y - b.y) - (a.x - b.x) * (p.y - b.y);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Whether `to` lies in the corridor from `from` to the submenu: the triangle between the earlier pointer position and
|
|
47
|
+
* the submenu's near edge. A pointer moving through it is on its way to the submenu.
|
|
48
|
+
*/
|
|
49
|
+
const inCorridor = (from, to, menu) => {
|
|
50
|
+
const edge = from.x <= menu.left ? menu.left : from.x >= menu.right ? menu.right : undefined;
|
|
51
|
+
if (edge === undefined) return false;
|
|
52
|
+
const top = {
|
|
53
|
+
x: edge,
|
|
54
|
+
y: menu.top - EDGE
|
|
55
|
+
};
|
|
56
|
+
const bottom = {
|
|
57
|
+
x: edge,
|
|
58
|
+
y: menu.bottom + EDGE
|
|
59
|
+
};
|
|
60
|
+
const d1 = sign(to, from, top);
|
|
61
|
+
const d2 = sign(to, top, bottom);
|
|
62
|
+
const d3 = sign(to, bottom, from);
|
|
63
|
+
const negative = d1 < 0 || d2 < 0 || d3 < 0;
|
|
64
|
+
const positive = d1 > 0 || d2 > 0 || d3 > 0;
|
|
65
|
+
return !(negative && positive);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/** The actions and choices of a menu and its submenus, without sections or submenu rows. */
|
|
69
|
+
const flatEntries = items => items.flatMap(item => "items" in item ? flatEntries(item.items) : "submenu" in item ? flatEntries(item.submenu) : [item]);
|
|
70
|
+
|
|
71
|
+
/** The entries of the submenu `panel` that take focus, without those of a submenu open inside it. */
|
|
72
|
+
const ownEntries = panel => Array.from(panel.querySelectorAll(":is([role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio']):not([aria-disabled='true'])")).filter(entry => entry.closest(".k2b-dropdown__submenu") === panel);
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* One level of a menu: which of its rows has its submenu open. The pointer and the focus on the level's rows decide:
|
|
76
|
+
* after the pointer rests on a row, that row's submenu opens or the open one closes; a move towards the open submenu
|
|
77
|
+
* closes nothing; focus on another row closes it at once.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
const levels = new WeakMap();
|
|
81
|
+
|
|
82
|
+
/** The level of the rows under `menu`, created with its first submenu row; it listens on the element around them. */
|
|
83
|
+
const levelOf = (menu, row) => {
|
|
84
|
+
const known = levels.get(menu);
|
|
85
|
+
if (known) return known;
|
|
86
|
+
const [open, setOpen] = createRoot(() => createSignal());
|
|
87
|
+
let timer;
|
|
88
|
+
let last;
|
|
89
|
+
let before;
|
|
90
|
+
let hovered;
|
|
91
|
+
const clear = () => {
|
|
92
|
+
clearTimeout(timer);
|
|
93
|
+
timer = undefined;
|
|
94
|
+
};
|
|
95
|
+
// In the submenu, nothing pending changes it; back on any row of this level, that row counts again.
|
|
96
|
+
const hold = () => {
|
|
97
|
+
clear();
|
|
98
|
+
hovered = undefined;
|
|
99
|
+
};
|
|
100
|
+
const set = next => {
|
|
101
|
+
clear();
|
|
102
|
+
hovered = undefined;
|
|
103
|
+
setOpen(() => next);
|
|
104
|
+
};
|
|
105
|
+
const level = {
|
|
106
|
+
open,
|
|
107
|
+
set,
|
|
108
|
+
hold
|
|
109
|
+
};
|
|
110
|
+
levels.set(menu, level);
|
|
111
|
+
// The rows of this level, not those of a submenu inside it.
|
|
112
|
+
const host = row.parentElement?.closest(".k2b-dropdown__submenu, [role='menu'], [role='dialog'], [role='listbox']");
|
|
113
|
+
const own = host?.classList.contains("k2b-dropdown__submenu") ? host : null;
|
|
114
|
+
const rowOf = target => {
|
|
115
|
+
const entry = target instanceof Element ? target.closest("[role^='menuitem']") : null;
|
|
116
|
+
return entry && entry.closest(".k2b-dropdown__submenu") === own ? entry : undefined;
|
|
117
|
+
};
|
|
118
|
+
host?.addEventListener("pointermove", event => {
|
|
119
|
+
// The browser repeats a move when the layout changes under a resting pointer; only a real move counts, so a
|
|
120
|
+
// submenu closed with the keyboard does not open again under it.
|
|
121
|
+
if (last && last.x === event.clientX && last.y === event.clientY) return;
|
|
122
|
+
before = last;
|
|
123
|
+
last = {
|
|
124
|
+
x: event.clientX,
|
|
125
|
+
y: event.clientY
|
|
126
|
+
};
|
|
127
|
+
const entry = rowOf(event.target);
|
|
128
|
+
if (event.pointerType === "touch" || !entry || entry === hovered) return;
|
|
129
|
+
hovered = entry;
|
|
130
|
+
clear();
|
|
131
|
+
const current = open();
|
|
132
|
+
if (current === entry) return;
|
|
133
|
+
const panel = current ? document.getElementById(`${current.id}-menu`) : null;
|
|
134
|
+
const towards = Boolean(panel && before && inCorridor(before, last, panel.getBoundingClientRect()));
|
|
135
|
+
timer = setTimeout(() => setOpen(() => entry), towards ? CORRIDOR_DELAY : DELAY);
|
|
136
|
+
});
|
|
137
|
+
// Leaving the menu, or the menu closing, ends anything pending; a closed menu keeps no submenu open.
|
|
138
|
+
host?.addEventListener("pointerleave", () => {
|
|
139
|
+
clear();
|
|
140
|
+
hovered = undefined;
|
|
141
|
+
});
|
|
142
|
+
host?.addEventListener("toggle", event => {
|
|
143
|
+
if (event.newState === "closed") set(undefined);
|
|
144
|
+
});
|
|
145
|
+
host?.addEventListener("focusin", event => {
|
|
146
|
+
const entry = rowOf(event.target);
|
|
147
|
+
if (entry && open() && entry !== open()) set(undefined);
|
|
148
|
+
});
|
|
149
|
+
return level;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* An open submenu beside its row. It shows in the top layer, owns its keys, and closes with the menu around it, a
|
|
154
|
+
* change of the window's size, or a scroll outside it.
|
|
155
|
+
*/
|
|
156
|
+
function SubmenuPanel(props) {
|
|
157
|
+
let panel;
|
|
158
|
+
// Read once: `level` comes from the <Show> around the panel, whose value is gone by the time the panel cleans up.
|
|
159
|
+
const level = props.level;
|
|
160
|
+
const row = props.row;
|
|
161
|
+
const rtl = () => getComputedStyle(row).direction === "rtl";
|
|
162
|
+
const place = () => {
|
|
163
|
+
if (!panel.isConnected) return;
|
|
164
|
+
const host = row.closest("[role='menu'], [role='dialog'], [role='listbox']") ?? row;
|
|
165
|
+
const at = placeSubmenu(row.getBoundingClientRect(), host.getBoundingClientRect(), panel.getBoundingClientRect(), {
|
|
166
|
+
width: window.innerWidth,
|
|
167
|
+
height: window.innerHeight
|
|
168
|
+
}, rtl());
|
|
169
|
+
panel.style.left = `${at.left}px`;
|
|
170
|
+
panel.style.top = `${at.top}px`;
|
|
171
|
+
panel.dataset.side = at.side;
|
|
172
|
+
};
|
|
173
|
+
const onKey = event => {
|
|
174
|
+
const items = ownEntries(panel);
|
|
175
|
+
if (focusMenuRow(items, event.key) || focusRowSegment(items, event.key)) {
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
event.stopPropagation();
|
|
178
|
+
} else if (event.key === "Escape" || event.key === (rtl() ? "ArrowRight" : "ArrowLeft")) {
|
|
179
|
+
// Only this level closes; the menu around it stays, as the browser's own Escape would close it.
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
event.stopPropagation();
|
|
182
|
+
props.hide();
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
// The menu around it closing, the window changing size, or a scroll outside it closes it too: it would come loose
|
|
186
|
+
// from its row.
|
|
187
|
+
const host = row.parentElement?.closest("[popover]");
|
|
188
|
+
const closed = event => {
|
|
189
|
+
if (event.type === "scroll" && event.target instanceof Node && panel.contains(event.target)) return;
|
|
190
|
+
if (event.type !== "toggle" || event.newState === "closed") level.set(undefined);
|
|
191
|
+
};
|
|
192
|
+
host?.addEventListener("toggle", closed);
|
|
193
|
+
window.addEventListener("resize", closed);
|
|
194
|
+
window.addEventListener("scroll", closed, true);
|
|
195
|
+
onCleanup(() => {
|
|
196
|
+
host?.removeEventListener("toggle", closed);
|
|
197
|
+
window.removeEventListener("resize", closed);
|
|
198
|
+
window.removeEventListener("scroll", closed, true);
|
|
199
|
+
// Closed by the pointer resting elsewhere or by a resize, with the keyboard inside: the focus goes back to its row
|
|
200
|
+
// rather than to the page.
|
|
201
|
+
// Another row's submenu opening takes the focus to that row instead, so the move does not close it again.
|
|
202
|
+
if (panel.contains(document.activeElement)) (level.open() ?? row).focus();
|
|
203
|
+
});
|
|
204
|
+
return _$ssr(_tmpl$, `${_$escape(props.id, true)}-menu`, _$ssrAttribute("aria-label", _$escape(props.label, true), false), _$ssrAttribute("data-depth", _$escape(props.depth, true), false), _$escape(_$createComponent(props.Items, {
|
|
205
|
+
get items() {
|
|
206
|
+
return props.items;
|
|
207
|
+
},
|
|
208
|
+
get close() {
|
|
209
|
+
return props.close;
|
|
210
|
+
},
|
|
211
|
+
get depth() {
|
|
212
|
+
return props.depth;
|
|
213
|
+
}
|
|
214
|
+
})));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** A row with "▸" that opens its submenu beside it, or in a phone sheet in the sheet's place (K16). */
|
|
218
|
+
export function SubmenuRow(props) {
|
|
219
|
+
const menu = props.menu;
|
|
220
|
+
// A list box cannot open a menu: there the entries stand under the row's name, as a section's do.
|
|
221
|
+
if (menu.role === "option") return _$createComponent(props.Items, {
|
|
222
|
+
get items() {
|
|
223
|
+
return [{
|
|
224
|
+
sectionLabel: props.item.label,
|
|
225
|
+
items: flatEntries(props.item.submenu)
|
|
226
|
+
}];
|
|
227
|
+
},
|
|
228
|
+
get close() {
|
|
229
|
+
return menu.close;
|
|
230
|
+
},
|
|
231
|
+
role: "option"
|
|
232
|
+
});
|
|
233
|
+
const id = `k2b-submenu-${createUniqueId().replace(/[^a-zA-Z0-9_-]/g, "-")}`;
|
|
234
|
+
// A fourth level is not offered (K16): its row stays, but cannot open.
|
|
235
|
+
const disabled = () => Boolean(props.item.disabled) || menu.depth >= MAX_DEPTH;
|
|
236
|
+
const [level, setLevel] = createSignal();
|
|
237
|
+
let focusFirst = false;
|
|
238
|
+
const open = () => level()?.open() === row;
|
|
239
|
+
let row;
|
|
240
|
+
onMount(() => {
|
|
241
|
+
if (!menu.drill) setLevel(levelOf(menu, row));
|
|
242
|
+
});
|
|
243
|
+
const show = moveFocus => {
|
|
244
|
+
if (disabled()) return;
|
|
245
|
+
if (menu.drill) return menu.drill(props.item, row);
|
|
246
|
+
focusFirst = moveFocus;
|
|
247
|
+
// Already open: the keyboard goes into it now.
|
|
248
|
+
const panel = document.getElementById(`${id}-menu`);
|
|
249
|
+
if (panel && moveFocus) focusMenuRow(ownEntries(panel), "Home");
|
|
250
|
+
level()?.set(row);
|
|
251
|
+
};
|
|
252
|
+
const onRowKey = event => {
|
|
253
|
+
if (event.key !== (getComputedStyle(row).direction === "rtl" ? "ArrowLeft" : "ArrowRight")) return;
|
|
254
|
+
event.preventDefault();
|
|
255
|
+
event.stopPropagation();
|
|
256
|
+
show(true);
|
|
257
|
+
};
|
|
258
|
+
// The row and its submenu stand together in an element without a role, as a menu holds only its entries.
|
|
259
|
+
return _$ssr(_tmpl$2, _$ssrAttribute("id", _$escape(id, true), false), _$ssrAttribute("role", _$escape(menu.role, true), false), `k2b-dropdown__item k2b-dropdown__item--submenu ${_$escape(props.item.class ?? "", true)}`, _$ssrAttribute("aria-label", _$escape(props.item.ariaLabel, true), false), _$ssrAttribute("aria-expanded", _$escape(open(), true), false) + _$ssrAttribute("aria-controls", open() ? `${_$escape(id, true)}-menu` : _$escape(undefined, true), false) + _$ssrAttribute("aria-disabled", disabled() ? "true" : _$escape(undefined, true), false), _$ssrAttribute("disabled", disabled(), true) + _$ssrAttribute("data-open", open() ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-danger", props.item.variant === "danger" ? "true" : _$escape(undefined, true), false) + _$ssrAttribute("data-accent", props.item.variant === "accent" ? "true" : _$escape(undefined, true), false), _$escape(props.content({
|
|
260
|
+
...props.item,
|
|
261
|
+
children: props.item.label
|
|
262
|
+
})), _$escape(_$createComponent(Show, {
|
|
263
|
+
get when() {
|
|
264
|
+
return _$memo(() => !!open())() && level();
|
|
265
|
+
},
|
|
266
|
+
children: current => _$createComponent(SubmenuPanel, {
|
|
267
|
+
id: id,
|
|
268
|
+
row: row,
|
|
269
|
+
get label() {
|
|
270
|
+
return props.item.label;
|
|
271
|
+
},
|
|
272
|
+
get items() {
|
|
273
|
+
return props.item.submenu;
|
|
274
|
+
},
|
|
275
|
+
get depth() {
|
|
276
|
+
return menu.depth + 1;
|
|
277
|
+
},
|
|
278
|
+
get close() {
|
|
279
|
+
return menu.close;
|
|
280
|
+
},
|
|
281
|
+
get level() {
|
|
282
|
+
return current();
|
|
283
|
+
},
|
|
284
|
+
focusFirst: focusFirst,
|
|
285
|
+
get Items() {
|
|
286
|
+
return props.Items;
|
|
287
|
+
},
|
|
288
|
+
hide: () => {
|
|
289
|
+
current().set(undefined);
|
|
290
|
+
row.focus();
|
|
291
|
+
}
|
|
292
|
+
})
|
|
293
|
+
})));
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=menu-submenu-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["actions/menu-submenu-panel.tsx"],"sourcesContent":["import { type Accessor, createEffect, createRoot, createSignal, createUniqueId, type JSX, on, onCleanup, onMount, Show } from \"solid-js\";\nimport { inheritUiScope } from \"../internal/portal-scope\";\nimport type {\n DropdownAction,\n DropdownChoice,\n DropdownItem,\n DropdownItems,\n DropdownSubmenu,\n itemContent,\n MenuContextValue,\n} from \"./Dropdown\";\nimport { focusMenuRow, focusRowSegment } from \"./menu-rows\";\n\n/** How long the pointer rests on a row before its submenu opens, or another row's closes it (K16). */\nconst DELAY = 150;\n/** How long a move towards an open submenu keeps it open while the pointer crosses other rows. */\nconst CORRIDOR_DELAY = 300;\n/** A menu, its submenu, and one more: deeper entries are not offered (K16). */\nconst MAX_DEPTH = 3;\n\n/** The least room a menu keeps from the viewport's edge, as every menu does. */\nconst EDGE = 8;\nconst GAP = 4;\ntype Box = Pick<DOMRect, \"left\" | \"top\" | \"right\" | \"bottom\">;\n\n/**\n * Where a submenu stands: beside its row, its first row level with it, on the side that has room; without room on\n * either side it keeps to the viewport. Too low, it rises until its last row is level with its row's bottom.\n */\nexport const placeSubmenu = (\n row: Box,\n parent: Pick<DOMRect, \"left\" | \"right\">,\n menu: { width: number; height: number },\n viewport: { width: number; height: number },\n rtl = false,\n): { left: number; top: number; side: \"left\" | \"right\" } => {\n // Two objects side by side, 4 px apart as a menu stands from its trigger: their edges never meet (one line, one owner).\n const right = parent.right + GAP;\n const left = parent.left - menu.width - GAP;\n const fitsRight = right + menu.width <= viewport.width - EDGE;\n const fitsLeft = left >= EDGE;\n const side: \"left\" | \"right\" = rtl ? (fitsLeft || !fitsRight ? \"left\" : \"right\") : fitsRight || !fitsLeft ? \"right\" : \"left\";\n const x = side === \"right\" ? right : left;\n // The menu's 1 px edge stands above the row, so its first row lines up with the row that opened it.\n let top = row.top - 1;\n if (top + menu.height > viewport.height - EDGE) top = row.bottom + 1 - menu.height;\n return {\n left: Math.max(EDGE, Math.min(x, viewport.width - menu.width - EDGE)),\n top: Math.max(EDGE, Math.min(top, viewport.height - menu.height - EDGE)),\n side,\n };\n};\n\ntype Point = { x: number; y: number };\n\nconst sign = (p: Point, a: Point, b: Point) => (p.x - b.x) * (a.y - b.y) - (a.x - b.x) * (p.y - b.y);\n\n/**\n * Whether `to` lies in the corridor from `from` to the submenu: the triangle between the earlier pointer position and\n * the submenu's near edge. A pointer moving through it is on its way to the submenu.\n */\nconst inCorridor = (from: Point, to: Point, menu: Box): boolean => {\n const edge = from.x <= menu.left ? menu.left : from.x >= menu.right ? menu.right : undefined;\n if (edge === undefined) return false;\n const top = { x: edge, y: menu.top - EDGE };\n const bottom = { x: edge, y: menu.bottom + EDGE };\n const d1 = sign(to, from, top);\n const d2 = sign(to, top, bottom);\n const d3 = sign(to, bottom, from);\n const negative = d1 < 0 || d2 < 0 || d3 < 0;\n const positive = d1 > 0 || d2 > 0 || d3 > 0;\n return !(negative && positive);\n};\n\n/** The actions and choices of a menu and its submenus, without sections or submenu rows. */\nconst flatEntries = (items: readonly DropdownItem[]): (DropdownAction | DropdownChoice)[] =>\n items.flatMap((item) => (\"items\" in item ? flatEntries(item.items) : \"submenu\" in item ? flatEntries(item.submenu) : [item]));\n\n/** The entries of the submenu `panel` that take focus, without those of a submenu open inside it. */\nconst ownEntries = (panel: HTMLElement): HTMLElement[] =>\n Array.from(\n panel.querySelectorAll<HTMLElement>(\n \":is([role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio']):not([aria-disabled='true'])\",\n ),\n ).filter((entry) => entry.closest(\".k2b-dropdown__submenu\") === panel);\n\n/**\n * One level of a menu: which of its rows has its submenu open. The pointer and the focus on the level's rows decide:\n * after the pointer rests on a row, that row's submenu opens or the open one closes; a move towards the open submenu\n * closes nothing; focus on another row closes it at once.\n */\ntype MenuLevel = {\n open: Accessor<HTMLElement | undefined>;\n /** Opens a row's submenu, or closes the open one with `undefined`, at once. */\n set: (row: HTMLElement | undefined) => void;\n /** The pointer reached the open submenu: nothing pending changes it. */\n hold: () => void;\n};\n\nconst levels = new WeakMap<MenuContextValue, MenuLevel>();\n\n/** The level of the rows under `menu`, created with its first submenu row; it listens on the element around them. */\nconst levelOf = (menu: MenuContextValue, row: HTMLElement): MenuLevel => {\n const known = levels.get(menu);\n if (known) return known;\n const [open, setOpen] = createRoot(() => createSignal<HTMLElement>());\n let timer: ReturnType<typeof setTimeout> | undefined;\n let last: Point | undefined;\n let before: Point | undefined;\n let hovered: Element | undefined;\n const clear = () => {\n clearTimeout(timer);\n timer = undefined;\n };\n // In the submenu, nothing pending changes it; back on any row of this level, that row counts again.\n const hold = () => {\n clear();\n hovered = undefined;\n };\n const set = (next: HTMLElement | undefined) => {\n clear();\n hovered = undefined;\n setOpen(() => next);\n };\n const level: MenuLevel = { open, set, hold };\n levels.set(menu, level);\n // The rows of this level, not those of a submenu inside it.\n const host = row.parentElement?.closest<HTMLElement>(\".k2b-dropdown__submenu, [role='menu'], [role='dialog'], [role='listbox']\");\n const own = host?.classList.contains(\"k2b-dropdown__submenu\") ? host : null;\n const rowOf = (target: EventTarget | null) => {\n const entry = target instanceof Element ? target.closest(\"[role^='menuitem']\") : null;\n return entry && entry.closest(\".k2b-dropdown__submenu\") === own ? entry : undefined;\n };\n host?.addEventListener(\"pointermove\", (event) => {\n // The browser repeats a move when the layout changes under a resting pointer; only a real move counts, so a\n // submenu closed with the keyboard does not open again under it.\n if (last && last.x === event.clientX && last.y === event.clientY) return;\n before = last;\n last = { x: event.clientX, y: event.clientY };\n const entry = rowOf(event.target);\n if (event.pointerType === \"touch\" || !entry || entry === hovered) return;\n hovered = entry;\n clear();\n const current = open();\n if (current === entry) return;\n const panel = current ? document.getElementById(`${current.id}-menu`) : null;\n const towards = Boolean(panel && before && inCorridor(before, last, panel.getBoundingClientRect()));\n timer = setTimeout(() => setOpen(() => entry as HTMLElement), towards ? CORRIDOR_DELAY : DELAY);\n });\n // Leaving the menu, or the menu closing, ends anything pending; a closed menu keeps no submenu open.\n host?.addEventListener(\"pointerleave\", () => {\n clear();\n hovered = undefined;\n });\n host?.addEventListener(\"toggle\", (event) => {\n if ((event as ToggleEvent).newState === \"closed\") set(undefined);\n });\n host?.addEventListener(\"focusin\", (event) => {\n const entry = rowOf(event.target);\n if (entry && open() && entry !== open()) set(undefined);\n });\n return level;\n};\n\n/**\n * An open submenu beside its row. It shows in the top layer, owns its keys, and closes with the menu around it, a\n * change of the window's size, or a scroll outside it.\n */\nfunction SubmenuPanel(props: {\n id: string;\n row: HTMLButtonElement;\n label: string;\n items: readonly DropdownItem[];\n depth: number;\n close: (restoreFocus?: boolean) => void;\n level: MenuLevel;\n /** Whether the keyboard opened it, so its first entry takes the focus. */\n focusFirst: boolean;\n hide: () => void;\n Items: typeof DropdownItems;\n}): JSX.Element {\n let panel!: HTMLDivElement;\n // Read once: `level` comes from the <Show> around the panel, whose value is gone by the time the panel cleans up.\n const level = props.level;\n const row = props.row;\n const rtl = () => getComputedStyle(row).direction === \"rtl\";\n const place = () => {\n if (!panel.isConnected) return;\n const host = row.closest<HTMLElement>(\"[role='menu'], [role='dialog'], [role='listbox']\") ?? row;\n const at = placeSubmenu(\n row.getBoundingClientRect(),\n host.getBoundingClientRect(),\n panel.getBoundingClientRect(),\n { width: window.innerWidth, height: window.innerHeight },\n rtl(),\n );\n panel.style.left = `${at.left}px`;\n panel.style.top = `${at.top}px`;\n panel.dataset.side = at.side;\n };\n const onKey = (event: KeyboardEvent) => {\n const items = ownEntries(panel);\n if (focusMenuRow(items, event.key) || focusRowSegment(items, event.key)) {\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === \"Escape\" || event.key === (rtl() ? \"ArrowRight\" : \"ArrowLeft\")) {\n // Only this level closes; the menu around it stays, as the browser's own Escape would close it.\n event.preventDefault();\n event.stopPropagation();\n props.hide();\n }\n };\n // The menu around it closing, the window changing size, or a scroll outside it closes it too: it would come loose\n // from its row.\n const host = row.parentElement?.closest<HTMLElement>(\"[popover]\");\n const closed = (event: Event) => {\n if (event.type === \"scroll\" && event.target instanceof Node && panel.contains(event.target)) return;\n if (event.type !== \"toggle\" || (event as ToggleEvent).newState === \"closed\") level.set(undefined);\n };\n host?.addEventListener(\"toggle\", closed);\n window.addEventListener(\"resize\", closed);\n window.addEventListener(\"scroll\", closed, true);\n onCleanup(() => {\n host?.removeEventListener(\"toggle\", closed);\n window.removeEventListener(\"resize\", closed);\n window.removeEventListener(\"scroll\", closed, true);\n // Closed by the pointer resting elsewhere or by a resize, with the keyboard inside: the focus goes back to its row\n // rather than to the page.\n // Another row's submenu opening takes the focus to that row instead, so the move does not close it again.\n if (panel.contains(document.activeElement)) (level.open() ?? row).focus();\n });\n return (\n <div\n ref={(element) => {\n panel = element;\n inheritUiScope(element, row);\n queueMicrotask(() => {\n if (!element.isConnected) return;\n if (typeof element.showPopover === \"function\") element.showPopover();\n place();\n if (props.focusFirst) focusMenuRow(ownEntries(element), \"Home\");\n });\n }}\n id={`${props.id}-menu`}\n popover=\"manual\"\n role=\"menu\"\n aria-label={props.label}\n class=\"k2b-dropdown__menu k2b-dropdown__submenu\"\n data-depth={props.depth}\n on:keydown={onKey}\n onPointerEnter={() => level.hold()}\n onPointerDown={(event) => event.stopPropagation()}\n >\n <props.Items items={props.items} close={props.close} depth={props.depth} />\n </div>\n );\n}\n\n/** A row with \"▸\" that opens its submenu beside it, or in a phone sheet in the sheet's place (K16). */\nexport function SubmenuRow(props: {\n item: DropdownSubmenu;\n /** The level's menu: handed in, so this module needs nothing of the menu's code at run time. */\n menu: MenuContextValue;\n Items: typeof DropdownItems;\n content: typeof itemContent;\n}): JSX.Element {\n const menu = props.menu;\n // A list box cannot open a menu: there the entries stand under the row's name, as a section's do.\n if (menu.role === \"option\")\n return (\n <props.Items items={[{ sectionLabel: props.item.label, items: flatEntries(props.item.submenu) }]} close={menu.close} role=\"option\" />\n );\n const id = `k2b-submenu-${createUniqueId().replace(/[^a-zA-Z0-9_-]/g, \"-\")}`;\n // A fourth level is not offered (K16): its row stays, but cannot open.\n const disabled = () => Boolean(props.item.disabled) || menu.depth >= MAX_DEPTH;\n const [level, setLevel] = createSignal<MenuLevel>();\n let focusFirst = false;\n const open = () => level()?.open() === row;\n let row!: HTMLButtonElement;\n onMount(() => {\n if (!menu.drill) setLevel(levelOf(menu, row));\n });\n const show = (moveFocus: boolean) => {\n if (disabled()) return;\n if (menu.drill) return menu.drill(props.item, row);\n focusFirst = moveFocus;\n // Already open: the keyboard goes into it now.\n const panel = document.getElementById(`${id}-menu`);\n if (panel && moveFocus) focusMenuRow(ownEntries(panel), \"Home\");\n level()?.set(row);\n };\n const onRowKey = (event: KeyboardEvent) => {\n if (event.key !== (getComputedStyle(row).direction === \"rtl\" ? \"ArrowLeft\" : \"ArrowRight\")) return;\n event.preventDefault();\n event.stopPropagation();\n show(true);\n };\n // The row and its submenu stand together in an element without a role, as a menu holds only its entries.\n return (\n <div role=\"none\" class=\"k2b-dropdown__subgroup\">\n <button\n ref={row}\n id={id}\n type=\"button\"\n role={menu.role}\n tabIndex={-1}\n class={`k2b-dropdown__item k2b-dropdown__item--submenu ${props.item.class ?? \"\"}`}\n aria-label={props.item.ariaLabel}\n aria-haspopup=\"menu\"\n aria-expanded={open()}\n aria-controls={open() ? `${id}-menu` : undefined}\n aria-disabled={disabled() ? \"true\" : undefined}\n disabled={disabled()}\n data-open={open() ? \"true\" : undefined}\n data-danger={props.item.variant === \"danger\" ? \"true\" : undefined}\n data-accent={props.item.variant === \"accent\" ? \"true\" : undefined}\n on:keydown={onRowKey}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n // Enter and Space click with no pointer: the keyboard goes into the submenu, a pointer stays where it is.\n show(event.detail === 0);\n }}\n >\n {props.content({ ...props.item, children: props.item.label })}\n <i class=\"ti ti-chevron-right k2b-dropdown__more\" aria-hidden=\"true\" />\n </button>\n <Show when={open() && level()}>\n {(current) => (\n <SubmenuPanel\n id={id}\n row={row}\n label={props.item.label}\n items={props.item.submenu}\n depth={menu.depth + 1}\n close={menu.close}\n level={current()}\n focusFirst={focusFirst}\n Items={props.Items}\n hide={() => {\n current().set(undefined);\n row.focus();\n }}\n />\n )}\n </Show>\n </div>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAwB,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAY,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,QAAQ,UAAU;AACxI,SAAS,cAAc,QAAQ,0BAA0B;AAUzD,SAAS,YAAY,EAAE,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