@ankhorage/zora 22.1.4 → 23.0.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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/GraphNodeOverlay.d.ts +2 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/GraphNodeOverlay.d.ts.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/GraphNodeOverlay.js +2 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/GraphNodeOverlay.js.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.d.ts.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.js +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.js.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.d.ts.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.js +12 -4
- package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.js.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.d.ts +2 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.d.ts.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js +3 -3
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js.map +1 -1
- package/dist/features/selection/adapters/inbound/SelectableItem.d.ts +1 -5
- package/dist/features/selection/adapters/inbound/SelectableItem.d.ts.map +1 -1
- package/dist/features/selection/adapters/inbound/SelectableItem.js +30 -54
- package/dist/features/selection/adapters/inbound/SelectableItem.js.map +1 -1
- package/dist/features/selection/adapters/inbound/SelectionProvider.d.ts +2 -6
- package/dist/features/selection/adapters/inbound/SelectionProvider.d.ts.map +1 -1
- package/dist/features/selection/adapters/inbound/SelectionProvider.js +36 -32
- package/dist/features/selection/adapters/inbound/SelectionProvider.js.map +1 -1
- package/dist/features/selection/application/resolveSelectionEventIntent.d.ts +5 -0
- package/dist/features/selection/application/resolveSelectionEventIntent.d.ts.map +1 -0
- package/dist/features/selection/application/resolveSelectionEventIntent.js +49 -0
- package/dist/features/selection/application/resolveSelectionEventIntent.js.map +1 -0
- package/dist/features/selection/public.d.ts +2 -0
- package/dist/features/selection/public.d.ts.map +1 -1
- package/dist/features/selection/public.js +1 -0
- package/dist/features/selection/public.js.map +1 -1
- package/dist/features/selection/utils/resolveSelectionNextIds.d.ts +4 -5
- package/dist/features/selection/utils/resolveSelectionNextIds.d.ts.map +1 -1
- package/dist/features/selection/utils/resolveSelectionNextIds.js +6 -13
- package/dist/features/selection/utils/resolveSelectionNextIds.js.map +1 -1
- package/dist/features/tree-view/adapters/inbound/TreeItem.d.ts +3 -2
- package/dist/features/tree-view/adapters/inbound/TreeItem.d.ts.map +1 -1
- package/dist/features/tree-view/adapters/inbound/TreeItem.js +11 -4
- package/dist/features/tree-view/adapters/inbound/TreeItem.js.map +1 -1
- package/dist/features/tree-view/adapters/inbound/TreeView.d.ts.map +1 -1
- package/dist/features/tree-view/adapters/inbound/TreeView.js +4 -5
- package/dist/features/tree-view/adapters/inbound/TreeView.js.map +1 -1
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeItemRow.d.ts +3 -2
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeItemRow.d.ts.map +1 -1
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeItemRow.js +17 -9
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeItemRow.js.map +1 -1
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeView.d.ts +4 -3
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeView.d.ts.map +1 -1
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeView.js +8 -8
- package/dist/features/tree-view/adapters/inbound/web-artifact/TreeView.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/graph-view.d.ts +2 -0
- package/dist/types/graph-view.d.ts.map +1 -1
- package/dist/types/graph-view.js.map +1 -1
- package/dist/types/selection.d.ts +3 -0
- package/dist/types/selection.d.ts.map +1 -1
- package/dist/types/selection.js.map +1 -1
- package/dist/types/tree-view.d.ts +3 -2
- package/dist/types/tree-view.d.ts.map +1 -1
- package/dist/types/tree-view.js.map +1 -1
- package/package.json +1 -1
- package/src/features/graph-view/adapters/inbound/web-artifact/GraphNodeOverlay.tsx +10 -2
- package/src/features/graph-view/adapters/inbound/web-artifact/GraphView.tsx +3 -1
- package/src/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.ts +22 -5
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.test.ts +21 -0
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.ts +10 -3
- package/src/features/selection/adapters/inbound/SelectableItem.tsx +33 -50
- package/src/features/selection/adapters/inbound/SelectionProvider.tsx +34 -35
- package/src/features/selection/application/resolveSelectionEventIntent.test.ts +35 -0
- package/src/features/selection/application/resolveSelectionEventIntent.ts +55 -0
- package/src/features/selection/public.ts +2 -0
- package/src/features/selection/utils/resolveSelectionNextIds.test.ts +1 -14
- package/src/features/selection/utils/resolveSelectionNextIds.ts +6 -28
- package/src/features/tree-view/adapters/inbound/TreeItem.tsx +25 -9
- package/src/features/tree-view/adapters/inbound/TreeView.tsx +4 -6
- package/src/features/tree-view/adapters/inbound/web-artifact/TreeItemRow.tsx +26 -8
- package/src/features/tree-view/adapters/inbound/web-artifact/TreeView.test.tsx +77 -7
- package/src/features/tree-view/adapters/inbound/web-artifact/TreeView.tsx +11 -9
- package/src/index.ts +1 -0
- package/src/types/graph-view.ts +2 -0
- package/src/types/selection.ts +3 -0
- package/src/types/tree-view.ts +3 -2
- package/web-dist/chunks/{Accordion-j2aw3d5b.js → Accordion-01e56hb5.js} +1 -1
- package/web-dist/chunks/{Accordion-emczc5rg.js → Accordion-09se459d.js} +4 -4
- package/web-dist/chunks/{Accordion-784f23tq.js → Accordion-14p7zanv.js} +1 -1
- package/web-dist/chunks/{Accordion-cecn51ry.js → Accordion-17pht8jd.js} +3 -3
- package/web-dist/chunks/Accordion-5df6cgyf.js +55 -0
- package/web-dist/chunks/{Accordion-sr353w95.js → Accordion-78mj69zp.js} +2 -2
- package/web-dist/chunks/{Accordion-mpnb4qqw.js → Accordion-83hfn3y4.js} +5 -5
- package/web-dist/chunks/{Accordion-07rdw2vh.js → Accordion-89q14src.js} +2 -2
- package/web-dist/chunks/{Accordion-ajydqhjp.js → Accordion-8xk2zmr5.js} +2 -2
- package/web-dist/chunks/{Accordion-qvt6qdqm.js → Accordion-b3ymabze.js} +4 -4
- package/web-dist/chunks/{Accordion-avmgvcef.js → Accordion-cn8tbdvk.js} +3 -3
- package/web-dist/chunks/{Accordion-8af800ts.js → Accordion-czmnsspb.js} +5 -5
- package/web-dist/chunks/{Accordion-nc5gnvnb.js → Accordion-dp638q63.js} +2 -2
- package/web-dist/chunks/{Accordion-2fm2tm5r.js → Accordion-e633pb7z.js} +1 -1
- package/web-dist/chunks/{Accordion-yz7b7njb.js → Accordion-f1t3rzgg.js} +4 -4
- package/web-dist/chunks/{Accordion-b3qy1trj.js → Accordion-fm3jxs1f.js} +8 -8
- package/web-dist/chunks/{Accordion-zf3kzvef.js → Accordion-gj63vb6b.js} +4 -4
- package/web-dist/chunks/{Accordion-mvfz28m8.js → Accordion-gkzhd3zk.js} +3 -3
- package/web-dist/chunks/{Accordion-jj3bg8c1.js → Accordion-k7wwyx5x.js} +4 -4
- package/web-dist/chunks/{Accordion-rkv7jyaj.js → Accordion-kemavggr.js} +1 -1
- package/web-dist/chunks/{Accordion-jhwsvx3g.js → Accordion-kpnwdpb5.js} +1 -1
- package/web-dist/chunks/{Accordion-yf6vseep.js → Accordion-q0st659f.js} +82 -89
- package/web-dist/chunks/{Accordion-555gnfmw.js → Accordion-q165k3az.js} +6 -6
- package/web-dist/chunks/{Accordion-9rnepkvk.js → Accordion-q3z741vt.js} +3 -3
- package/web-dist/chunks/{Accordion-z585n0mr.js → Accordion-rjgdrn7y.js} +1 -1
- package/web-dist/chunks/{Accordion-vmz8y01b.js → Accordion-rspy7gjb.js} +6 -6
- package/web-dist/chunks/{Accordion-ycmg06sq.js → Accordion-rx2gzadh.js} +1 -1
- package/web-dist/chunks/{Accordion-45ej9brb.js → Accordion-swys7qts.js} +3 -3
- package/web-dist/chunks/{Accordion-v1dtv6v0.js → Accordion-w0k7gnn9.js} +3 -3
- package/web-dist/chunks/{Accordion-pnvt10cv.js → Accordion-w1afjp87.js} +4 -4
- package/web-dist/chunks/{Accordion-tj61sa5s.js → Accordion-w7jv9y5t.js} +4 -4
- package/web-dist/chunks/{Accordion-s1jhv8gk.js → Accordion-x13vca75.js} +1 -1
- package/web-dist/chunks/{Accordion-73m7z73v.js → Accordion-x1dg1f47.js} +5 -5
- package/web-dist/chunks/{Accordion-1cgz6f8t.js → Accordion-x4rjd7yn.js} +1 -1
- package/web-dist/chunks/{Accordion-nn38n7q4.js → Accordion-xf8cj8z4.js} +3 -3
- package/web-dist/chunks/{Accordion-8hhvtcxp.js → Accordion-xzd0tx46.js} +1 -1
- package/web-dist/components/accordion/Accordion.js +5 -5
- package/web-dist/components/accordion-item/AccordionItem.js +5 -5
- package/web-dist/components/activity-indicator/ActivityIndicator.js +1 -1
- package/web-dist/components/app-bar/AppBar.js +7 -7
- package/web-dist/components/app-shell/AppShell.js +2 -2
- package/web-dist/components/avatar/Avatar.js +5 -5
- package/web-dist/components/avatar-group/AvatarGroup.js +5 -5
- package/web-dist/components/badge/Badge.js +2 -2
- package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +10 -10
- package/web-dist/components/bottom-sheet/BottomSheet.js +3 -3
- package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +3 -3
- package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +3 -3
- package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +3 -3
- package/web-dist/components/bottom-sheet-view/BottomSheetView.js +3 -3
- package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +3 -3
- package/web-dist/components/breadcrumbs/Breadcrumbs.js +5 -5
- package/web-dist/components/button/Button.js +3 -3
- package/web-dist/components/button-group/ButtonGroup.js +3 -3
- package/web-dist/components/camera-permission-view/CameraPermissionView.js +10 -10
- package/web-dist/components/card/Card.js +9 -9
- package/web-dist/components/card-back/CardBack.js +2 -2
- package/web-dist/components/card-hand/CardHand.js +2 -2
- package/web-dist/components/chat-list-item/ChatListItem.js +7 -7
- package/web-dist/components/checkbox/Checkbox.js +4 -4
- package/web-dist/components/checkbox-group/CheckboxGroup.js +4 -4
- package/web-dist/components/chess-board/ChessBoard.js +2 -2
- package/web-dist/components/chip/Chip.js +5 -5
- package/web-dist/components/chip-group/ChipGroup.js +5 -5
- package/web-dist/components/collection-editor/CollectionEditor.js +9 -9
- package/web-dist/components/content-rail/ContentRail.js +4 -4
- package/web-dist/components/data-table/DataTable.js +14 -14
- package/web-dist/components/date-picker/DatePicker.js +5 -5
- package/web-dist/components/dialog/Dialog.js +4 -4
- package/web-dist/components/divider/Divider.js +2 -2
- package/web-dist/components/empty-state/EmptyState.js +10 -10
- package/web-dist/components/field/Field.js +4 -4
- package/web-dist/components/flat-list/FlatList.js +5 -5
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +8 -8
- package/web-dist/components/form/Form.js +6 -6
- package/web-dist/components/form-actions/FormActions.js +6 -6
- package/web-dist/components/form-error/FormError.js +6 -6
- package/web-dist/components/game/Game.js +3 -3
- package/web-dist/components/game-entity/GameEntity.js +3 -3
- package/web-dist/components/game-field/GameField.js +3 -3
- package/web-dist/components/game-input-zone/GameInputZone.js +3 -3
- package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +3 -3
- package/web-dist/components/game-overlay/GameOverlay.js +3 -3
- package/web-dist/components/gradient/Gradient.js +3 -3
- package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +3 -3
- package/web-dist/components/graph-view/GraphView.js +20 -11
- package/web-dist/components/graph-view/GraphView.types-0.d.ts +2 -0
- package/web-dist/components/grid/Grid.js +2 -2
- package/web-dist/components/heading/Heading.js +2 -2
- package/web-dist/components/hero/Hero.js +9 -9
- package/web-dist/components/icon/Icon.js +2 -2
- package/web-dist/components/icon-button/IconButton.js +3 -3
- package/web-dist/components/image/Image.js +4 -4
- package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +1 -1
- package/web-dist/components/list/List.js +5 -5
- package/web-dist/components/list-item/ListItem.js +5 -5
- package/web-dist/components/list-section/ListSection.js +5 -5
- package/web-dist/components/media-card/MediaCard.js +9 -9
- package/web-dist/components/message-bubble/MessageBubble.js +7 -7
- package/web-dist/components/metric-card/MetricCard.js +9 -9
- package/web-dist/components/missing-element/MissingElement.js +4 -4
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +8 -8
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +8 -8
- package/web-dist/components/opening-book/OpeningBook.js +2 -2
- package/web-dist/components/otp-form/OtpForm.js +8 -8
- package/web-dist/components/pagination/Pagination.js +4 -4
- package/web-dist/components/palette-item/PaletteItem.js +9 -9
- package/web-dist/components/playing-card/PlayingCard.js +2 -2
- package/web-dist/components/poker-training-table/PokerTrainingTable.js +2 -2
- package/web-dist/components/popover-menu/PopoverMenu.js +4 -4
- package/web-dist/components/post-card/PostCard.js +9 -9
- package/web-dist/components/product-card/ProductCard.js +9 -9
- package/web-dist/components/progress/Progress.js +4 -4
- package/web-dist/components/progress-ring/ProgressRing.js +4 -4
- package/web-dist/components/radio/Radio.js +5 -5
- package/web-dist/components/radio-group/RadioGroup.js +5 -5
- package/web-dist/components/rating/Rating.js +3 -3
- package/web-dist/components/reader-surface/ReaderSurface.js +9 -9
- package/web-dist/components/scan-overlay/ScanOverlay.js +10 -10
- package/web-dist/components/screen/Screen.js +2 -2
- package/web-dist/components/screen-section/ScreenSection.js +4 -4
- package/web-dist/components/scroll-view/ScrollView.js +2 -2
- package/web-dist/components/search-input/SearchInput.js +4 -4
- package/web-dist/components/section-header/SectionHeader.js +4 -4
- package/web-dist/components/section-list/SectionList.js +5 -5
- package/web-dist/components/select/Select.js +4 -4
- package/web-dist/components/selectable-item/SelectableItem.js +1 -1
- package/web-dist/components/selection-provider/SelectionProvider.js +1 -1
- package/web-dist/components/sign-in-form/SignInForm.js +8 -8
- package/web-dist/components/sign-up-form/SignUpForm.js +8 -8
- package/web-dist/components/skeleton/Skeleton.js +12 -12
- package/web-dist/components/skeleton-card/SkeletonCard.js +12 -12
- package/web-dist/components/skeleton-list/SkeletonList.js +12 -12
- package/web-dist/components/skeleton-text/SkeletonText.js +12 -12
- package/web-dist/components/surface/Surface.js +2 -2
- package/web-dist/components/switch/Switch.js +1 -1
- package/web-dist/components/tab/Tab.js +2 -2
- package/web-dist/components/tab-list/TabList.js +2 -2
- package/web-dist/components/tab-panel/TabPanel.js +2 -2
- package/web-dist/components/tabletop-table/TabletopTable.js +2 -2
- package/web-dist/components/tabs/Tabs.js +2 -2
- package/web-dist/components/text/Text.js +2 -2
- package/web-dist/components/text-input/TextInput.js +4 -4
- package/web-dist/components/time-picker/TimePicker.js +5 -5
- package/web-dist/components/timeline/Timeline.js +4 -4
- package/web-dist/components/toast/Toast.js +2 -2
- package/web-dist/components/toast-provider/ToastProvider.js +2 -2
- package/web-dist/components/toolbar/Toolbar.js +9 -9
- package/web-dist/components/tree-item/TreeItem.js +41 -22
- package/web-dist/components/tree-view/TreeView.d.ts +4 -3
- package/web-dist/components/tree-view/TreeView.js +25 -12
- package/web-dist/components/uploader/Uploader.js +10 -10
- package/web-dist/components/view/View.js +2 -2
- package/web-dist/manifest.json +577 -568
- package/web-dist/runtime/ZoraProvider.js +3 -3
- /package/web-dist/chunks/{Accordion-k3bc4kad.js → Accordion-13y3zx87.js} +0 -0
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Pressable } from '@ankhorage/surface';
|
|
2
|
+
import type { SelectionIntent } from '@ankhorage/utility/selection';
|
|
1
3
|
import React from 'react';
|
|
4
|
+
import { Platform } from 'react-native';
|
|
2
5
|
|
|
3
6
|
import type { ZoraBaseProps } from '../../../../types/base';
|
|
4
7
|
import type { TreeItemNode, TreeItemRenderProps } from '../../../../types/tree-view';
|
|
@@ -6,15 +9,16 @@ import { IconButton } from '../../../button/public';
|
|
|
6
9
|
import { Icon } from '../../../icon/public';
|
|
7
10
|
import { View } from '../../../layout/public';
|
|
8
11
|
import { ListItem } from '../../../list/public';
|
|
12
|
+
import { resolveSelectionEventIntent } from '../../../selection/public';
|
|
9
13
|
import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
|
|
10
14
|
|
|
11
15
|
interface TreeItemProps<TId extends string = string> extends ZoraBaseProps {
|
|
12
16
|
node: TreeItemNode<TId>;
|
|
13
17
|
depth: number;
|
|
14
18
|
expansionIndicator: 'chevron' | 'folder';
|
|
15
|
-
|
|
19
|
+
selectedIds: readonly TId[];
|
|
16
20
|
expandedIds: readonly TId[];
|
|
17
|
-
onSelect?: (id: TId) => void;
|
|
21
|
+
onSelect?: (id: TId, intent: SelectionIntent) => void;
|
|
18
22
|
onToggleExpand: (id: TId) => void;
|
|
19
23
|
renderItem?: (props: TreeItemRenderProps<TId>) => React.ReactNode;
|
|
20
24
|
}
|
|
@@ -26,7 +30,7 @@ function TreeItemInner<TId extends string = string>({
|
|
|
26
30
|
node,
|
|
27
31
|
depth,
|
|
28
32
|
expansionIndicator,
|
|
29
|
-
|
|
33
|
+
selectedIds,
|
|
30
34
|
expandedIds,
|
|
31
35
|
onSelect,
|
|
32
36
|
onToggleExpand,
|
|
@@ -36,7 +40,7 @@ function TreeItemInner<TId extends string = string>({
|
|
|
36
40
|
}: TreeItemProps<TId>) {
|
|
37
41
|
const hasChildren = node.children !== undefined && node.children.length > 0;
|
|
38
42
|
const isExpanded = expandedIds.includes(node.id);
|
|
39
|
-
const isSelected =
|
|
43
|
+
const isSelected = selectedIds.includes(node.id);
|
|
40
44
|
|
|
41
45
|
/*** Compose custom content or the selectable row independently of the expansion control. */
|
|
42
46
|
const renderContent = () => {
|
|
@@ -62,10 +66,22 @@ function TreeItemInner<TId extends string = string>({
|
|
|
62
66
|
trailing: node.actions,
|
|
63
67
|
};
|
|
64
68
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
if (onSelect === undefined) return <ListItem {...listItemProps} />;
|
|
70
|
+
return (
|
|
71
|
+
<Pressable
|
|
72
|
+
accessibilityRole="button"
|
|
73
|
+
accessibilityState={{ disabled: node.disabled, selected: isSelected }}
|
|
74
|
+
disabled={node.disabled}
|
|
75
|
+
interactionPolicy={interactionPolicy}
|
|
76
|
+
onPress={(event) =>
|
|
77
|
+
onSelect(
|
|
78
|
+
node.id,
|
|
79
|
+
resolveSelectionEventIntent(event, Platform.OS === 'web' ? 'pointer' : 'touch'),
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
>
|
|
83
|
+
<ListItem {...listItemProps} />
|
|
84
|
+
</Pressable>
|
|
69
85
|
);
|
|
70
86
|
};
|
|
71
87
|
|
|
@@ -111,7 +127,7 @@ function TreeItemInner<TId extends string = string>({
|
|
|
111
127
|
onSelect={onSelect}
|
|
112
128
|
onToggleExpand={onToggleExpand}
|
|
113
129
|
renderItem={renderItem}
|
|
114
|
-
|
|
130
|
+
selectedIds={selectedIds}
|
|
115
131
|
/>
|
|
116
132
|
))}
|
|
117
133
|
</View>
|
|
@@ -6,12 +6,12 @@ import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThem
|
|
|
6
6
|
import { toggleExpandedIds } from '../../utils/toggleExpandedIds';
|
|
7
7
|
import { TreeItem } from './TreeItem';
|
|
8
8
|
|
|
9
|
-
/*** Render the themed TreeView while supporting controlled
|
|
9
|
+
/*** Render the themed TreeView while supporting controlled selection and expansion state. */
|
|
10
10
|
function TreeViewInner<TId extends string = string>({
|
|
11
11
|
themeId: _themeId,
|
|
12
12
|
mode: _mode,
|
|
13
13
|
nodes,
|
|
14
|
-
|
|
14
|
+
selectedIds = [],
|
|
15
15
|
expandedIds: controlledExpandedIds,
|
|
16
16
|
defaultExpandedIds,
|
|
17
17
|
onSelect,
|
|
@@ -32,9 +32,7 @@ function TreeViewInner<TId extends string = string>({
|
|
|
32
32
|
if (interactionPolicy === 'passive') return;
|
|
33
33
|
const nextExpandedIds = toggleExpandedIds(expandedIds, id);
|
|
34
34
|
|
|
35
|
-
if (!isControlled)
|
|
36
|
-
setInternalExpandedIds(nextExpandedIds);
|
|
37
|
-
}
|
|
35
|
+
if (!isControlled) setInternalExpandedIds(nextExpandedIds);
|
|
38
36
|
onExpandedChange?.(nextExpandedIds);
|
|
39
37
|
};
|
|
40
38
|
|
|
@@ -50,7 +48,7 @@ function TreeViewInner<TId extends string = string>({
|
|
|
50
48
|
onSelect={onSelect}
|
|
51
49
|
onToggleExpand={handleToggleExpand}
|
|
52
50
|
renderItem={renderItem}
|
|
53
|
-
|
|
51
|
+
selectedIds={selectedIds}
|
|
54
52
|
interactionPolicy={interactionPolicy}
|
|
55
53
|
/>
|
|
56
54
|
))}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { SelectionIntent } from '@ankhorage/utility/selection';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
4
|
+
import { resolveSelectionEventIntent } from '../../../../selection/application/resolveSelectionEventIntent';
|
|
3
5
|
import { TreeExpansionIndicator } from './TreeExpansionIndicator';
|
|
4
6
|
import type { TreeItemNode, TreeItemRenderProps } from './TreeView';
|
|
5
7
|
|
|
@@ -8,7 +10,7 @@ export function TreeItemRow<TId extends string>(props: TreeItemRowProps<TId>) {
|
|
|
8
10
|
const { node } = props;
|
|
9
11
|
const hasChildren = node.children !== undefined && node.children.length > 0;
|
|
10
12
|
const expanded = props.expandedIds.includes(node.id);
|
|
11
|
-
const selected = props.
|
|
13
|
+
const selected = props.selectedIds.includes(node.id);
|
|
12
14
|
const content = props.renderItem?.({
|
|
13
15
|
node,
|
|
14
16
|
depth: props.depth,
|
|
@@ -23,7 +25,8 @@ export function TreeItemRow<TId extends string>(props: TreeItemRowProps<TId>) {
|
|
|
23
25
|
aria-disabled={node.disabled === true ? true : undefined}
|
|
24
26
|
aria-expanded={hasChildren ? expanded : undefined}
|
|
25
27
|
aria-selected={selected}
|
|
26
|
-
|
|
28
|
+
onPointerUp={(event) => selectNode(event, props)}
|
|
29
|
+
onClick={(event) => selectNodeFromSyntheticClick(event, props)}
|
|
27
30
|
onKeyDown={(event) => selectNodeFromKeyboard(event, props)}
|
|
28
31
|
role="treeitem"
|
|
29
32
|
tabIndex={node.disabled || props.onSelect === undefined ? undefined : 0}
|
|
@@ -49,9 +52,9 @@ interface TreeItemRowProps<TId extends string> {
|
|
|
49
52
|
readonly node: TreeItemNode<TId>;
|
|
50
53
|
readonly depth: number;
|
|
51
54
|
readonly expansionIndicator: 'chevron' | 'folder';
|
|
52
|
-
readonly
|
|
55
|
+
readonly selectedIds: readonly TId[];
|
|
53
56
|
readonly expandedIds: readonly TId[];
|
|
54
|
-
readonly onSelect?: (id: TId) => void;
|
|
57
|
+
readonly onSelect?: (id: TId, intent: SelectionIntent) => void;
|
|
55
58
|
readonly onToggleExpand: (id: TId) => void;
|
|
56
59
|
readonly renderItem?: (props: TreeItemRenderProps<TId>) => React.ReactNode;
|
|
57
60
|
}
|
|
@@ -77,12 +80,13 @@ function TreeItemDefaultContent<TId extends string>({
|
|
|
77
80
|
);
|
|
78
81
|
}
|
|
79
82
|
|
|
80
|
-
/*** Isolate optional row actions so their pointer events do not select the tree item. */
|
|
83
|
+
/*** Isolate optional row actions so their pointer and keyboard events do not select the tree item. */
|
|
81
84
|
function TreeItemActions({ actions }: { readonly actions?: React.ReactNode }) {
|
|
82
85
|
if (actions === undefined) return null;
|
|
83
86
|
return (
|
|
84
87
|
<span
|
|
85
88
|
onClick={(event) => event.stopPropagation()}
|
|
89
|
+
onPointerUp={(event) => event.stopPropagation()}
|
|
86
90
|
onKeyDown={(event) => event.stopPropagation()}
|
|
87
91
|
style={INLINE_STYLE}
|
|
88
92
|
>
|
|
@@ -118,6 +122,7 @@ function TreeItemExpander<TId extends string>(props: {
|
|
|
118
122
|
aria-label={props.expanded ? 'Collapse' : 'Expand'}
|
|
119
123
|
disabled={props.disabled}
|
|
120
124
|
onKeyDown={(event) => event.stopPropagation()}
|
|
125
|
+
onPointerUp={(event) => event.stopPropagation()}
|
|
121
126
|
onClick={(event) => {
|
|
122
127
|
event.stopPropagation();
|
|
123
128
|
props.onToggleExpand(props.nodeId);
|
|
@@ -142,8 +147,21 @@ function TreeItemChildren<TId extends string>(props: TreeItemRowProps<TId>) {
|
|
|
142
147
|
}
|
|
143
148
|
|
|
144
149
|
/*** Select a row from pointer activation when it is interactive. */
|
|
145
|
-
function selectNode<TId extends string>(
|
|
146
|
-
|
|
150
|
+
function selectNode<TId extends string>(
|
|
151
|
+
event: React.PointerEvent<HTMLDivElement>,
|
|
152
|
+
props: TreeItemRowProps<TId>,
|
|
153
|
+
) {
|
|
154
|
+
if (props.node.disabled) return;
|
|
155
|
+
props.onSelect?.(props.node.id, resolveSelectionEventIntent(event, 'pointer'));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/*** Select a row from assistive or synthetic click activation without duplicating pointer clicks. */
|
|
159
|
+
function selectNodeFromSyntheticClick<TId extends string>(
|
|
160
|
+
event: React.MouseEvent<HTMLDivElement>,
|
|
161
|
+
props: TreeItemRowProps<TId>,
|
|
162
|
+
) {
|
|
163
|
+
if (event.detail !== 0 || props.node.disabled) return;
|
|
164
|
+
props.onSelect?.(props.node.id, resolveSelectionEventIntent(event, 'keyboard'));
|
|
147
165
|
}
|
|
148
166
|
|
|
149
167
|
/*** Select a row from keyboard activation while preserving native navigation keys. */
|
|
@@ -153,7 +171,7 @@ function selectNodeFromKeyboard<TId extends string>(
|
|
|
153
171
|
) {
|
|
154
172
|
if (props.node.disabled || (event.key !== 'Enter' && event.key !== ' ')) return;
|
|
155
173
|
event.preventDefault();
|
|
156
|
-
props.onSelect?.(props.node.id);
|
|
174
|
+
props.onSelect?.(props.node.id, resolveSelectionEventIntent(event, 'keyboard'));
|
|
157
175
|
}
|
|
158
176
|
|
|
159
177
|
/*** Resolve browser row presentation from the interaction state. */
|
|
@@ -21,7 +21,7 @@ test('expands from the leading control without selecting the row, including keyb
|
|
|
21
21
|
});
|
|
22
22
|
const host = document.createElement('div');
|
|
23
23
|
document.body.appendChild(host);
|
|
24
|
-
const selected: string[] = [];
|
|
24
|
+
const selected: (readonly [string, string])[] = [];
|
|
25
25
|
const expanded: (readonly string[])[] = [];
|
|
26
26
|
const root = createRoot(host);
|
|
27
27
|
const interactAsync = (action: () => void) => act(() => Promise.resolve().then(action));
|
|
@@ -30,7 +30,7 @@ test('expands from the leading control without selecting the row, including keyb
|
|
|
30
30
|
root.render(
|
|
31
31
|
<TreeView
|
|
32
32
|
nodes={[{ id: 'src', label: 'source', children: [{ id: 'leaf', label: 'leaf' }] }]}
|
|
33
|
-
onSelect={(id) => selected.push(id)}
|
|
33
|
+
onSelect={(id, intent) => selected.push([id, intent])}
|
|
34
34
|
onExpandedChange={(ids) => expanded.push(ids)}
|
|
35
35
|
/>,
|
|
36
36
|
),
|
|
@@ -49,9 +49,11 @@ test('expands from the leading control without selecting the row, including keyb
|
|
|
49
49
|
expect(expanded).toEqual([['src']]);
|
|
50
50
|
expect(host.querySelector('[role="group"]')?.textContent).toContain('leaf');
|
|
51
51
|
await interactAsync(() => {
|
|
52
|
-
row.dispatchEvent(
|
|
52
|
+
row.dispatchEvent(
|
|
53
|
+
new browserWindow.PointerEvent('pointerup', { bubbles: true, pointerType: 'mouse' }),
|
|
54
|
+
);
|
|
53
55
|
});
|
|
54
|
-
expect(selected).toEqual(['src']);
|
|
56
|
+
expect(selected).toEqual([['src', 'replace']]);
|
|
55
57
|
expect(expanded).toEqual([['src']]);
|
|
56
58
|
await interactAsync(() => button.click());
|
|
57
59
|
expect(expanded).toEqual([['src'], []]);
|
|
@@ -66,6 +68,74 @@ test('expands from the leading control without selecting the row, including keyb
|
|
|
66
68
|
}
|
|
67
69
|
});
|
|
68
70
|
|
|
71
|
+
test('reports toggle intent for desktop modifiers and touch pointer activation', async () => {
|
|
72
|
+
const browserWindow = new Window();
|
|
73
|
+
const keys = ['window', 'document', 'Node', 'navigator', 'IS_REACT_ACT_ENVIRONMENT'] as const;
|
|
74
|
+
const previous = keys.map(
|
|
75
|
+
(key) => [key, Object.getOwnPropertyDescriptor(globalThis, key)] as const,
|
|
76
|
+
);
|
|
77
|
+
Object.assign(globalThis, {
|
|
78
|
+
IS_REACT_ACT_ENVIRONMENT: true,
|
|
79
|
+
window: browserWindow,
|
|
80
|
+
document: browserWindow.document,
|
|
81
|
+
Node: browserWindow.Node,
|
|
82
|
+
navigator: browserWindow.navigator,
|
|
83
|
+
});
|
|
84
|
+
const host = document.createElement('div');
|
|
85
|
+
document.body.appendChild(host);
|
|
86
|
+
const selected: string[] = [];
|
|
87
|
+
const root = createRoot(host);
|
|
88
|
+
const interactAsync = (action: () => void) => act(() => Promise.resolve().then(action));
|
|
89
|
+
try {
|
|
90
|
+
await interactAsync(() =>
|
|
91
|
+
root.render(
|
|
92
|
+
<TreeView
|
|
93
|
+
nodes={[{ id: 'a', label: 'A' }]}
|
|
94
|
+
onSelect={(_id, intent) => selected.push(intent)}
|
|
95
|
+
/>,
|
|
96
|
+
),
|
|
97
|
+
);
|
|
98
|
+
const row = host.querySelector('[role="treeitem"]');
|
|
99
|
+
if (!row) throw new Error('Missing tree row');
|
|
100
|
+
|
|
101
|
+
await interactAsync(() =>
|
|
102
|
+
row.dispatchEvent(
|
|
103
|
+
new browserWindow.PointerEvent('pointerup', {
|
|
104
|
+
bubbles: true,
|
|
105
|
+
pointerType: 'mouse',
|
|
106
|
+
metaKey: true,
|
|
107
|
+
}),
|
|
108
|
+
),
|
|
109
|
+
);
|
|
110
|
+
await interactAsync(() =>
|
|
111
|
+
row.dispatchEvent(
|
|
112
|
+
new browserWindow.PointerEvent('pointerup', {
|
|
113
|
+
bubbles: true,
|
|
114
|
+
pointerType: 'mouse',
|
|
115
|
+
ctrlKey: true,
|
|
116
|
+
}),
|
|
117
|
+
),
|
|
118
|
+
);
|
|
119
|
+
await interactAsync(() =>
|
|
120
|
+
row.dispatchEvent(
|
|
121
|
+
new browserWindow.PointerEvent('pointerup', {
|
|
122
|
+
bubbles: true,
|
|
123
|
+
pointerType: 'touch',
|
|
124
|
+
}),
|
|
125
|
+
),
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
expect(selected).toEqual(['toggle', 'toggle', 'toggle']);
|
|
129
|
+
} finally {
|
|
130
|
+
await interactAsync(() => root.unmount());
|
|
131
|
+
browserWindow.close();
|
|
132
|
+
for (const [key, descriptor] of previous) {
|
|
133
|
+
if (descriptor) Object.defineProperty(globalThis, key, descriptor);
|
|
134
|
+
else Reflect.deleteProperty(globalThis, key);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
69
139
|
test('reveals a controlled selection when expansion makes the row renderable', async () => {
|
|
70
140
|
const browserWindow = new Window();
|
|
71
141
|
const keys = ['window', 'document', 'Node', 'navigator', 'IS_REACT_ACT_ENVIRONMENT'] as const;
|
|
@@ -88,12 +158,12 @@ test('reveals a controlled selection when expansion makes the row renderable', a
|
|
|
88
158
|
const nodes = [{ id: 'src', label: 'source', children: [{ id: 'leaf', label: 'leaf' }] }];
|
|
89
159
|
try {
|
|
90
160
|
await interactAsync(() =>
|
|
91
|
-
root.render(<TreeView expandedIds={[]} nodes={nodes}
|
|
161
|
+
root.render(<TreeView expandedIds={[]} nodes={nodes} selectedIds={['leaf']} />),
|
|
92
162
|
);
|
|
93
163
|
expect(reveals).toEqual([]);
|
|
94
164
|
|
|
95
165
|
await interactAsync(() =>
|
|
96
|
-
root.render(<TreeView expandedIds={['src']} nodes={nodes}
|
|
166
|
+
root.render(<TreeView expandedIds={['src']} nodes={nodes} selectedIds={['leaf']} />),
|
|
97
167
|
);
|
|
98
168
|
expect(reveals).toEqual([{ block: 'nearest', inline: 'nearest' }]);
|
|
99
169
|
} finally {
|
|
@@ -119,7 +189,7 @@ test('renders a standalone web tree without a ZORA or React Native provider', ()
|
|
|
119
189
|
children: [{ id: 'index', label: 'index.ts' }],
|
|
120
190
|
},
|
|
121
191
|
]}
|
|
122
|
-
|
|
192
|
+
selectedIds={['index']}
|
|
123
193
|
/>,
|
|
124
194
|
);
|
|
125
195
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SelectionIntent } from '@ankhorage/utility/selection';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
import { toggleExpandedIds } from '../../../utils/toggleExpandedIds';
|
|
@@ -23,10 +24,10 @@ export interface TreeItemRenderProps<TId extends string = string> {
|
|
|
23
24
|
|
|
24
25
|
export interface TreeViewProps<TId extends string = string> {
|
|
25
26
|
readonly nodes: readonly TreeItemNode<TId>[];
|
|
26
|
-
readonly
|
|
27
|
+
readonly selectedIds?: readonly TId[];
|
|
27
28
|
readonly expandedIds?: readonly TId[];
|
|
28
29
|
readonly defaultExpandedIds?: readonly TId[];
|
|
29
|
-
readonly onSelect?: (id: TId) => void;
|
|
30
|
+
readonly onSelect?: (id: TId, intent: SelectionIntent) => void;
|
|
30
31
|
readonly onExpandedChange?: (ids: readonly TId[]) => void;
|
|
31
32
|
readonly renderItem?: (props: TreeItemRenderProps<TId>) => React.ReactNode;
|
|
32
33
|
readonly expansionIndicator?: 'chevron' | 'folder';
|
|
@@ -42,7 +43,7 @@ export interface TreeViewProps<TId extends string = string> {
|
|
|
42
43
|
*/
|
|
43
44
|
export function TreeView<TId extends string = string>({
|
|
44
45
|
nodes,
|
|
45
|
-
|
|
46
|
+
selectedIds = [],
|
|
46
47
|
expandedIds: controlledExpandedIds,
|
|
47
48
|
defaultExpandedIds,
|
|
48
49
|
onSelect,
|
|
@@ -67,12 +68,13 @@ export function TreeView<TId extends string = string>({
|
|
|
67
68
|
},
|
|
68
69
|
[expandedIds, isControlled, onExpandedChange],
|
|
69
70
|
);
|
|
70
|
-
useSelectedTreeItemReveal(rootRef,
|
|
71
|
+
useSelectedTreeItemReveal(rootRef, selectedIds, expandedIds);
|
|
71
72
|
|
|
72
73
|
return (
|
|
73
74
|
<div
|
|
74
75
|
ref={rootRef}
|
|
75
76
|
aria-label={ariaLabel}
|
|
77
|
+
aria-multiselectable="true"
|
|
76
78
|
className={className}
|
|
77
79
|
role="tree"
|
|
78
80
|
style={{ ...TREE_STYLE, ...style }}
|
|
@@ -87,26 +89,26 @@ export function TreeView<TId extends string = string>({
|
|
|
87
89
|
onSelect={onSelect}
|
|
88
90
|
onToggleExpand={handleToggleExpand}
|
|
89
91
|
renderItem={renderItem}
|
|
90
|
-
|
|
92
|
+
selectedIds={selectedIds}
|
|
91
93
|
/>
|
|
92
94
|
))}
|
|
93
95
|
</div>
|
|
94
96
|
);
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
/*** Reveal
|
|
99
|
+
/*** Reveal the first controlled selection after it is rendered without changing expansion ownership. */
|
|
98
100
|
function useSelectedTreeItemReveal<TId extends string>(
|
|
99
101
|
rootRef: React.RefObject<HTMLDivElement | null>,
|
|
100
|
-
|
|
102
|
+
selectedIds: readonly TId[],
|
|
101
103
|
expandedIds: readonly TId[],
|
|
102
104
|
) {
|
|
103
105
|
React.useEffect(() => {
|
|
104
|
-
if (
|
|
106
|
+
if (selectedIds.length === 0) return;
|
|
105
107
|
const root = rootRef.current as unknown as TreeViewQueryableElement | null;
|
|
106
108
|
root
|
|
107
109
|
?.querySelector('[role="treeitem"][aria-selected="true"]')
|
|
108
110
|
?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
|
|
109
|
-
}, [expandedIds, rootRef,
|
|
111
|
+
}, [expandedIds, rootRef, selectedIds]);
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
const TREE_STYLE = {
|
package/src/index.ts
CHANGED
package/src/types/graph-view.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SelectionIntent } from '@ankhorage/utility/selection';
|
|
1
2
|
import type React from 'react';
|
|
2
3
|
|
|
3
4
|
export type GraphViewLayoutName = 'breadthfirst' | 'circle' | 'concentric' | 'elk' | 'grid';
|
|
@@ -79,6 +80,7 @@ export interface GraphViewFitOptions {
|
|
|
79
80
|
export interface GraphViewElementEvent {
|
|
80
81
|
readonly id: string;
|
|
81
82
|
readonly type: GraphViewElementEventType;
|
|
83
|
+
readonly selectionIntent?: SelectionIntent;
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
export interface GraphViewController {
|
package/src/types/selection.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { InteractionPolicy } from '@ankhorage/surface';
|
|
2
|
+
import type { SelectionIntent } from '@ankhorage/utility/selection';
|
|
2
3
|
import type React from 'react';
|
|
3
4
|
|
|
4
5
|
export type SelectionMode = 'single' | 'multi';
|
|
@@ -22,6 +23,7 @@ export interface UseSelectionResult {
|
|
|
22
23
|
selectedCount: number;
|
|
23
24
|
hasSelection: boolean;
|
|
24
25
|
isSelected: (id: string) => boolean;
|
|
26
|
+
activate: (id: string, intent: SelectionIntent) => void;
|
|
25
27
|
select: (id: string) => void;
|
|
26
28
|
toggle: (id: string) => void;
|
|
27
29
|
clear: () => void;
|
|
@@ -32,6 +34,7 @@ export interface SelectableItemState {
|
|
|
32
34
|
selected: boolean;
|
|
33
35
|
disabled: boolean;
|
|
34
36
|
mode: SelectionMode;
|
|
37
|
+
activate: (intent: SelectionIntent) => void;
|
|
35
38
|
select: () => void;
|
|
36
39
|
toggle: () => void;
|
|
37
40
|
clear: () => void;
|
package/src/types/tree-view.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ButtonIconSpec } from '@ankhorage/surface';
|
|
2
|
+
import type { SelectionIntent } from '@ankhorage/utility/selection';
|
|
2
3
|
import type { ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
import type { ZoraBaseProps } from './base';
|
|
@@ -23,10 +24,10 @@ export interface TreeItemRenderProps<TId extends string = string> {
|
|
|
23
24
|
|
|
24
25
|
export interface TreeViewProps<TId extends string = string> extends ZoraBaseProps {
|
|
25
26
|
nodes: readonly TreeItemNode<TId>[];
|
|
26
|
-
|
|
27
|
+
selectedIds?: readonly TId[];
|
|
27
28
|
expandedIds?: readonly TId[];
|
|
28
29
|
defaultExpandedIds?: readonly TId[];
|
|
29
|
-
onSelect?: (id: TId) => void;
|
|
30
|
+
onSelect?: (id: TId, intent: SelectionIntent) => void;
|
|
30
31
|
onExpandedChange?: (ids: readonly TId[]) => void;
|
|
31
32
|
renderItem?: (props: TreeItemRenderProps<TId>) => ReactNode;
|
|
32
33
|
expansionIndicator?: 'chevron' | 'folder';
|
|
@@ -17,16 +17,16 @@ import {
|
|
|
17
17
|
} from "./Accordion-bsy1jrak.js";
|
|
18
18
|
import {
|
|
19
19
|
withZoraThemeScope
|
|
20
|
-
} from "./Accordion-
|
|
20
|
+
} from "./Accordion-13y3zx87.js";
|
|
21
21
|
import {
|
|
22
22
|
View2
|
|
23
|
-
} from "./Accordion-
|
|
23
|
+
} from "./Accordion-01e56hb5.js";
|
|
24
24
|
import {
|
|
25
25
|
Text2
|
|
26
|
-
} from "./Accordion-
|
|
26
|
+
} from "./Accordion-rx2gzadh.js";
|
|
27
27
|
import {
|
|
28
28
|
Icon2
|
|
29
|
-
} from "./Accordion-
|
|
29
|
+
} from "./Accordion-x4rjd7yn.js";
|
|
30
30
|
import {
|
|
31
31
|
useZoraThemeRecipe,
|
|
32
32
|
ZORA_COLORS
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
} from "./Accordion-7hn324r1.js";
|
|
6
6
|
import {
|
|
7
7
|
withZoraThemeScope
|
|
8
|
-
} from "./Accordion-
|
|
8
|
+
} from "./Accordion-13y3zx87.js";
|
|
9
9
|
import {
|
|
10
10
|
Icon2
|
|
11
|
-
} from "./Accordion-
|
|
11
|
+
} from "./Accordion-x4rjd7yn.js";
|
|
12
12
|
import {
|
|
13
13
|
View2
|
|
14
|
-
} from "./Accordion-
|
|
14
|
+
} from "./Accordion-01e56hb5.js";
|
|
15
15
|
import {
|
|
16
16
|
useZoraTheme2
|
|
17
17
|
} from "./Accordion-7zfskq1s.js";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
isRecord
|
|
4
|
+
} from "./Accordion-59pa0677.js";
|
|
5
|
+
// node_modules/@ankhorage/utility/dist/interaction/resolveSelectionIntent.js
|
|
6
|
+
function resolveSelectionIntent(input) {
|
|
7
|
+
if (input.kind === "touch")
|
|
8
|
+
return "toggle";
|
|
9
|
+
return input.modifiers?.metaKey === true || input.modifiers?.ctrlKey === true ? "toggle" : "replace";
|
|
10
|
+
}
|
|
11
|
+
// src/features/selection/application/resolveSelectionEventIntent.ts
|
|
12
|
+
function resolveSelectionEventIntent(event, fallbackKind) {
|
|
13
|
+
const source = readEventSource(event);
|
|
14
|
+
const kind = isTouchActivation(source) ? "touch" : fallbackKind;
|
|
15
|
+
const sourceModifiers = readInteractionModifiers(source);
|
|
16
|
+
const wrapperModifiers = readInteractionModifiers(event);
|
|
17
|
+
const input = {
|
|
18
|
+
kind,
|
|
19
|
+
modifiers: {
|
|
20
|
+
altKey: sourceModifiers.altKey === true || wrapperModifiers.altKey === true,
|
|
21
|
+
ctrlKey: sourceModifiers.ctrlKey === true || wrapperModifiers.ctrlKey === true,
|
|
22
|
+
metaKey: sourceModifiers.metaKey === true || wrapperModifiers.metaKey === true,
|
|
23
|
+
shiftKey: sourceModifiers.shiftKey === true || wrapperModifiers.shiftKey === true
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return resolveSelectionIntent(input);
|
|
27
|
+
}
|
|
28
|
+
function readEventSource(event) {
|
|
29
|
+
if (!isRecord(event))
|
|
30
|
+
return {};
|
|
31
|
+
if (isRecord(event.originalEvent))
|
|
32
|
+
return event.originalEvent;
|
|
33
|
+
if (isRecord(event.nativeEvent))
|
|
34
|
+
return event.nativeEvent;
|
|
35
|
+
return event;
|
|
36
|
+
}
|
|
37
|
+
function isTouchActivation(source) {
|
|
38
|
+
if (source.pointerType === "touch")
|
|
39
|
+
return true;
|
|
40
|
+
if (typeof source.type === "string" && source.type.startsWith("touch"))
|
|
41
|
+
return true;
|
|
42
|
+
return "touches" in source || "changedTouches" in source;
|
|
43
|
+
}
|
|
44
|
+
function readInteractionModifiers(value) {
|
|
45
|
+
if (!isRecord(value))
|
|
46
|
+
return {};
|
|
47
|
+
return {
|
|
48
|
+
altKey: value.altKey === true,
|
|
49
|
+
ctrlKey: value.ctrlKey === true,
|
|
50
|
+
metaKey: value.metaKey === true,
|
|
51
|
+
shiftKey: value.shiftKey === true
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { resolveSelectionEventIntent };
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
} from "./Accordion-7hn324r1.js";
|
|
8
8
|
import {
|
|
9
9
|
withZoraThemeScope
|
|
10
|
-
} from "./Accordion-
|
|
10
|
+
} from "./Accordion-13y3zx87.js";
|
|
11
11
|
import {
|
|
12
12
|
View2
|
|
13
|
-
} from "./Accordion-
|
|
13
|
+
} from "./Accordion-01e56hb5.js";
|
|
14
14
|
import {
|
|
15
15
|
useZoraTheme2
|
|
16
16
|
} from "./Accordion-7zfskq1s.js";
|
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
} from "./Accordion-cdppbyad.js";
|
|
5
5
|
import {
|
|
6
6
|
withZoraThemeScope
|
|
7
|
-
} from "./Accordion-
|
|
7
|
+
} from "./Accordion-13y3zx87.js";
|
|
8
8
|
import {
|
|
9
9
|
View2
|
|
10
|
-
} from "./Accordion-
|
|
10
|
+
} from "./Accordion-01e56hb5.js";
|
|
11
11
|
import {
|
|
12
12
|
Text2
|
|
13
|
-
} from "./Accordion-
|
|
13
|
+
} from "./Accordion-rx2gzadh.js";
|
|
14
14
|
import {
|
|
15
15
|
Avatar2
|
|
16
|
-
} from "./Accordion-
|
|
16
|
+
} from "./Accordion-k7wwyx5x.js";
|
|
17
17
|
import {
|
|
18
18
|
Badge2
|
|
19
|
-
} from "./Accordion-
|
|
19
|
+
} from "./Accordion-x13vca75.js";
|
|
20
20
|
import {
|
|
21
21
|
useZoraTheme2
|
|
22
22
|
} from "./Accordion-7zfskq1s.js";
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
} from "./Accordion-vq462y0x.js";
|
|
9
9
|
import {
|
|
10
10
|
IconButton2
|
|
11
|
-
} from "./Accordion-
|
|
11
|
+
} from "./Accordion-dp638q63.js";
|
|
12
12
|
import {
|
|
13
13
|
withZoraThemeScope
|
|
14
|
-
} from "./Accordion-
|
|
14
|
+
} from "./Accordion-13y3zx87.js";
|
|
15
15
|
import {
|
|
16
16
|
resolveIconSize
|
|
17
17
|
} from "./Accordion-961ncx4e.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import {
|
|
3
3
|
withZoraThemeScope
|
|
4
|
-
} from "./Accordion-
|
|
4
|
+
} from "./Accordion-13y3zx87.js";
|
|
5
5
|
import {
|
|
6
6
|
View2
|
|
7
|
-
} from "./Accordion-
|
|
7
|
+
} from "./Accordion-01e56hb5.js";
|
|
8
8
|
|
|
9
9
|
// src/features/gradient/adapters/inbound/GradientRendererContext.tsx
|
|
10
10
|
import { createContext, use } from "react";
|