@dxos/react-ui-stack 0.6.13 → 0.6.14-main.1366248
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/lib/browser/index.mjs +9 -8
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +1 -100
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node/index.cjs +7 -6
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +2 -104
- package/dist/lib/node/testing/index.cjs.map +4 -4
- package/dist/lib/node-esm/index.mjs +378 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/testing/index.mjs +62 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/components/CaretDownUp.d.ts.map +1 -1
- package/dist/types/src/components/Deck.stories.d.ts.map +1 -1
- package/dist/types/src/components/Section.d.ts +2 -3
- package/dist/types/src/components/Section.d.ts.map +1 -1
- package/dist/types/src/components/Stack.d.ts +2 -2
- package/dist/types/src/components/Stack.d.ts.map +1 -1
- package/dist/types/src/next/Stack.d.ts +9 -0
- package/dist/types/src/next/Stack.d.ts.map +1 -0
- package/dist/types/src/next/Stack.stories.d.ts +8 -0
- package/dist/types/src/next/Stack.stories.d.ts.map +1 -0
- package/dist/types/src/next/StackItem.d.ts +14 -0
- package/dist/types/src/next/StackItem.d.ts.map +1 -0
- package/dist/types/src/next/index.d.ts +2 -0
- package/dist/types/src/next/index.d.ts.map +1 -0
- package/dist/types/src/playwright/playwright.config.d.ts +2 -2
- package/dist/types/src/playwright/playwright.config.d.ts.map +1 -1
- package/dist/types/src/testing/TableContent.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +2 -2
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +0 -1
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/package.json +33 -26
- package/src/components/CaretDownUp.tsx +1 -0
- package/src/components/ContentTypes.stories.tsx +1 -1
- package/src/components/Deck.stories.tsx +14 -27
- package/src/components/Section.stories.tsx +1 -1
- package/src/components/Section.tsx +9 -18
- package/src/components/Stack.stories.tsx +2 -2
- package/src/components/Stack.tsx +2 -2
- package/src/next/Stack.stories.tsx +148 -0
- package/src/next/Stack.tsx +30 -0
- package/src/next/StackItem.tsx +78 -0
- package/src/next/index.ts +5 -0
- package/src/playwright/playwright.config.ts +13 -2
- package/src/playwright/smoke.spec.ts +11 -19
- package/src/testing/TableContent.tsx +1 -0
- package/src/testing/generator.ts +4 -4
- package/src/testing/index.ts +2 -1
|
@@ -8,11 +8,11 @@ import { dropRingInner } from "@dxos/react-ui-theme";
|
|
|
8
8
|
|
|
9
9
|
// packages/ui/react-ui-stack/src/components/Section.tsx
|
|
10
10
|
import { useFocusableGroup, useTabsterAttributes } from "@fluentui/react-tabster";
|
|
11
|
-
import { ArrowLineDown, ArrowLineUp, ArrowSquareOut, CaretUpDown,
|
|
11
|
+
import { ArrowLineDown, ArrowLineUp, ArrowSquareOut, CaretUpDown, Trash } from "@phosphor-icons/react";
|
|
12
12
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
13
13
|
import React2, { forwardRef, useState } from "react";
|
|
14
|
-
import { Button, DropdownMenu, List, ListItem, ScrollArea, Toolbar, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
15
|
-
import {
|
|
14
|
+
import { Button, DropdownMenu, Icon, List, ListItem, ScrollArea, Toolbar, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
15
|
+
import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
16
16
|
import { DropDownMenuDragHandleTrigger, resizeHandle, resizeHandleHorizontal } from "@dxos/react-ui-deck";
|
|
17
17
|
import { useMosaic } from "@dxos/react-ui-mosaic";
|
|
18
18
|
import { focusRing, getSize, hoverableControlItem, hoverableControls, hoverableFocusedWithinControls, mx } from "@dxos/react-ui-theme";
|
|
@@ -70,7 +70,7 @@ var translations_default = [
|
|
|
70
70
|
// packages/ui/react-ui-stack/src/components/Section.tsx
|
|
71
71
|
var sectionActionDimensions = "p-1 shrink-0 min-bs-0 is-[--rail-action] bs-min";
|
|
72
72
|
var resizeHandleStyles = mx(resizeHandle, resizeHandleHorizontal, "is-full bs-[--rail-action] col-start-2");
|
|
73
|
-
var Section = /* @__PURE__ */ forwardRef(({ id, title, icon
|
|
73
|
+
var Section = /* @__PURE__ */ forwardRef(({ id, title, icon = "ph--placeholder--regular", size = "intrinsic", collapsed, active, isResizable, draggableProps, draggableStyle, onDelete, onNavigate, onAddBefore, onAddAfter, onCollapseSection, children }, forwardedRef) => {
|
|
74
74
|
const { t } = useTranslation(translationKey);
|
|
75
75
|
const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);
|
|
76
76
|
const sectionActionsToolbar = useTabsterAttributes({
|
|
@@ -83,8 +83,7 @@ var Section = /* @__PURE__ */ forwardRef(({ id, title, icon: Icon = DotsNine, si
|
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
const sectionContentGroup = useFocusableGroup({});
|
|
86
|
-
const attendableAttrs =
|
|
87
|
-
const hasAttention = useHasAttention(id);
|
|
86
|
+
const attendableAttrs = useAttendableAttributes(id);
|
|
88
87
|
return /* @__PURE__ */ React2.createElement(CollapsiblePrimitive.Root, {
|
|
89
88
|
asChild: true,
|
|
90
89
|
open: !collapsed,
|
|
@@ -100,7 +99,7 @@ var Section = /* @__PURE__ */ forwardRef(({ id, title, icon: Icon = DotsNine, si
|
|
|
100
99
|
style: draggableStyle
|
|
101
100
|
}, /* @__PURE__ */ React2.createElement("div", {
|
|
102
101
|
role: "none",
|
|
103
|
-
className: mx("grid col-span-2 grid-cols-subgrid", "bg-base
|
|
102
|
+
className: mx("grid col-span-2 grid-cols-subgrid", "bg-base attention-surface", hoverableControls, hoverableFocusedWithinControls, (active === "origin" || active === "rearrange" || active === "destination") && "opacity-0")
|
|
104
103
|
}, /* @__PURE__ */ React2.createElement("div", {
|
|
105
104
|
role: "toolbar",
|
|
106
105
|
"aria-orientation": "vertical",
|
|
@@ -122,7 +121,9 @@ var Section = /* @__PURE__ */ forwardRef(({ id, title, icon: Icon = DotsNine, si
|
|
|
122
121
|
classNames: "m-0",
|
|
123
122
|
...draggableProps
|
|
124
123
|
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
125
|
-
|
|
124
|
+
icon,
|
|
125
|
+
size: 5,
|
|
126
|
+
classNames: "transition-opacity"
|
|
126
127
|
})), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, collapsed ? /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
127
128
|
onClick: onNavigate,
|
|
128
129
|
"data-testid": "section.navigate-to"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Stack.tsx", "../../../src/components/Section.tsx", "../../../src/components/CaretDownUp.tsx", "../../../src/components/style-fragments.ts", "../../../src/translations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useArrowNavigationGroup, useFocusableGroup } from '@fluentui/react-tabster';\nimport React, { forwardRef, useCallback } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { List, useTranslation } from '@dxos/react-ui';\nimport {\n type MosaicContainerProps,\n type MosaicTileComponent,\n Mosaic,\n Path,\n useContainer,\n useItemsWithPreview,\n useMosaic,\n} from '@dxos/react-ui-mosaic';\nimport { dropRingInner } from '@dxos/react-ui-theme';\n\nimport {\n type CollapsedSections,\n type AddSectionPosition,\n SectionTile,\n type StackContextValue,\n type StackItem,\n type StackSectionContent,\n type StackSectionItem,\n} from './Section';\nimport { stackColumns } from './style-fragments';\nimport { translationKey } from '../translations';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type { CollapsedSections, AddSectionPosition };\n\nexport const DEFAULT_TYPE = 'stack-section';\n\nexport type StackProps<TData extends StackSectionContent = StackSectionContent> = Omit<\n MosaicContainerProps<TData, number>,\n 'debug' | 'Component'\n> &\n Omit<StackContextValue<TData>, 'setCollapsedSections'> & {\n items?: StackSectionItem[];\n separation?: boolean; // TODO(burdon): Style.\n onCollapseSection?: (id: string, collapsed: boolean) => void;\n emptyComponent?: React.ReactNode;\n };\n\nexport const Stack = ({\n id,\n type = DEFAULT_TYPE,\n SectionContent,\n items = [],\n separation = true,\n transform,\n onOver,\n onDrop,\n onAddSection,\n onDeleteSection,\n onNavigateToSection,\n onCollapseSection,\n ...props\n}: StackProps) => {\n const { ref: containerRef, width = 0 } = useResizeDetector<HTMLDivElement>({ refreshRate: 200 });\n const { operation, overItem } = useMosaic();\n const itemsWithPreview = useItemsWithPreview({ path: id, items });\n\n const getOverlayStyle = useCallback(() => ({ width }), [width]);\n const getOverlayProps = useCallback(\n () => ({ itemContext: { transform, SectionContent } }),\n [transform, SectionContent],\n );\n\n // TODO(thure): The root cause of the discrepancy between `activeNodeRect.top` and `overlayNodeRect.top` in Composer\n // in particular is not yet known, so this solution may may backfire in unforeseeable cases.\n const stackModifier = useCallback<Exclude<MosaicContainerProps['modifier'], undefined>>(\n (_activeItem, { transform, activeNodeRect, overlayNodeRect }) => {\n if (activeNodeRect && overlayNodeRect) {\n transform.y += activeNodeRect?.top - overlayNodeRect?.top;\n }\n return transform;\n },\n [],\n );\n\n return (\n <Mosaic.Container\n {...{\n id,\n type,\n Component: SectionTile as MosaicTileComponent<StackSectionItem, HTMLDivElement>,\n getOverlayStyle,\n getOverlayProps,\n onOver,\n onDrop,\n modifier: stackModifier,\n }}\n >\n <Mosaic.DroppableTile\n path={id}\n type={type}\n item={{ id, items: itemsWithPreview }}\n // TODO(wittjosiah): Should this actually be a context?\n itemContext={{\n separation,\n transform,\n onDeleteSection,\n onNavigateToSection,\n onAddSection,\n onCollapseSection,\n SectionContent,\n }}\n isOver={\n overItem &&\n !!overItem.path &&\n Path.hasRoot(overItem.path, id) &&\n (operation === 'copy' || operation === 'transfer')\n }\n Component={StackTile}\n {...props}\n ref={containerRef}\n />\n </Mosaic.Container>\n );\n};\n\nconst StackTile: MosaicTileComponent<StackItem, HTMLOListElement, Pick<StackProps, 'emptyComponent'>> = forwardRef(\n ({ classNames, path, isOver, item: { items }, itemContext, type: _type, emptyComponent, ...props }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n const { Component, type } = useContainer();\n const domAttributes = useArrowNavigationGroup({ axis: 'grid' });\n const { activeItem } = useMosaic();\n\n // NOTE(thure): Ensure “groupper” is available, but no need to use it here.\n const _group = useFocusableGroup();\n\n // NOTE: Keep outer padding the same as MarkdownMain.\n return (\n <List\n ref={forwardedRef}\n classNames={['grid relative', stackColumns, isOver && dropRingInner, classNames]}\n {...(!activeItem && domAttributes)}\n {...props}\n >\n {items.length > 0 ? (\n <Mosaic.SortableContext items={items} direction='vertical'>\n {items.map((item, index) => (\n <Mosaic.SortableTile\n key={item.id}\n item={item}\n itemContext={itemContext}\n path={path}\n type={type}\n position={index}\n Component={Component}\n />\n ))}\n </Mosaic.SortableContext>\n ) : emptyComponent !== undefined ? (\n <>{emptyComponent}</>\n ) : (\n <p\n className='grid col-span-2 text-center p-4 border border-dashed border-neutral-500/50 rounded'\n data-testid='stack.empty'\n >\n {t('empty stack message')}\n </p>\n )}\n </List>\n );\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useFocusableGroup, useTabsterAttributes } from '@fluentui/react-tabster';\nimport {\n ArrowLineDown,\n ArrowLineUp,\n ArrowSquareOut,\n CaretUpDown,\n DotsNine,\n type IconProps,\n Trash,\n} from '@phosphor-icons/react';\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\nimport React, {\n forwardRef,\n useState,\n type ForwardRefExoticComponent,\n type RefAttributes,\n type FC,\n type PropsWithChildren,\n type ComponentPropsWithRef,\n} from 'react';\n\nimport {\n Button,\n DropdownMenu,\n type Label,\n List,\n ListItem,\n ScrollArea,\n type ThemedClassName,\n Toolbar,\n toLocalizedString,\n useTranslation,\n} from '@dxos/react-ui';\nimport { createAttendableAttributes, useHasAttention } from '@dxos/react-ui-attention';\nimport { DropDownMenuDragHandleTrigger, resizeHandle, resizeHandleHorizontal } from '@dxos/react-ui-deck';\nimport {\n type MosaicActiveType,\n type MosaicDataItem,\n type MosaicTileComponent,\n type MosaicTileProps,\n useMosaic,\n} from '@dxos/react-ui-mosaic';\nimport {\n focusRing,\n getSize,\n hoverableControlItem,\n hoverableControls,\n hoverableFocusedWithinControls,\n mx,\n} from '@dxos/react-ui-theme';\n\nimport { CaretDownUp } from './CaretDownUp';\nimport { stackColumns } from './style-fragments';\nimport { translationKey } from '../translations';\n\nconst sectionActionDimensions = 'p-1 shrink-0 min-bs-0 is-[--rail-action] bs-min';\n\nexport type StackSectionContent = MosaicDataItem;\n\nexport type CollapsedSections = Record<string, boolean>;\n\nexport type AddSectionPosition = 'before' | 'after' | 'beforeAll' | 'afterAll';\n\nexport type StackContextValue<TData extends StackSectionContent = StackSectionContent> = {\n SectionContent: FC<{ data: TData }>;\n separation?: boolean;\n isResizable?: boolean;\n transform?: (item: MosaicDataItem, type?: string) => StackSectionItem;\n onDeleteSection?: (path: string) => void;\n onAddSection?: (path: string, position: AddSectionPosition) => void;\n onNavigateToSection?: (object: MosaicDataItem) => void;\n onCollapseSection?: (id: string, collapsed: boolean) => void;\n};\n\nexport type StackItem = MosaicDataItem & {\n items: StackSectionItem[];\n};\n\nexport type StackSectionItem = MosaicDataItem & {\n object: StackSectionContent;\n // TODO(wittjosiah): Use effect schema? Share schema with echo.\n view?: {\n title?: string;\n size?: SectionSize;\n height?: number;\n collapsed?: boolean;\n custom?: Record<string, any>;\n };\n // TODO(wittjosiah): Common type? Factor out?\n metadata?: {\n icon?: FC<IconProps>;\n placeholder?: Label;\n viewActions?: (item: StackSectionItem) => StackAction;\n };\n};\n\nexport type StackAction = {\n icon: FC<IconProps>;\n label: Label;\n onClick: () => void;\n};\n\nexport type SectionSize = 'intrinsic' | 'extrinsic';\n\nexport type SectionProps = PropsWithChildren<\n {\n // Data props.\n id: string;\n title: string;\n\n // Tile props.\n active?: MosaicActiveType;\n } & Pick<\n MosaicTileProps,\n 'draggableProps' | 'draggableStyle' | 'onDelete' | 'onNavigate' | 'onAddAfter' | 'onAddBefore'\n > &\n Pick<StackContextValue, 'separation' | 'isResizable' | 'onCollapseSection'> &\n Pick<Required<StackSectionItem>['view'], 'collapsed' | 'size'> &\n Pick<Required<StackSectionItem>['metadata'], 'icon'>\n>;\n\nconst resizeHandleStyles = mx(resizeHandle, resizeHandleHorizontal, 'is-full bs-[--rail-action] col-start-2');\n\nexport const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTMLLIElement>> = forwardRef<\n HTMLLIElement,\n SectionProps\n>(\n (\n {\n id,\n title,\n icon: Icon = DotsNine,\n size = 'intrinsic',\n collapsed,\n active,\n isResizable,\n draggableProps,\n draggableStyle,\n onDelete,\n onNavigate,\n onAddBefore,\n onAddAfter,\n onCollapseSection,\n children,\n },\n forwardedRef,\n ) => {\n const { t } = useTranslation(translationKey);\n const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);\n const sectionActionsToolbar = useTabsterAttributes({\n groupper: {},\n focusable: {},\n mover: { cyclic: true, direction: 1, memorizeCurrent: false },\n });\n const sectionContentGroup = useFocusableGroup({});\n const attendableAttrs = createAttendableAttributes(id);\n const hasAttention = useHasAttention(id);\n\n return (\n <CollapsiblePrimitive.Root\n asChild\n open={!collapsed}\n onOpenChange={(nextOpen) => onCollapseSection?.(id, !nextOpen)}\n >\n <ListItem.Root\n ref={forwardedRef}\n id={id}\n {...attendableAttrs}\n classNames={[\n 'grid col-span-2 group/section',\n active === 'overlay' ? stackColumns : 'grid-cols-subgrid snap-start',\n ]}\n style={draggableStyle}\n >\n <div\n role='none'\n className={mx(\n 'grid col-span-2 grid-cols-subgrid',\n 'bg-base focus-within:border-separator focus-within:attention-within',\n hoverableControls,\n hoverableFocusedWithinControls,\n (active || hasAttention) && 'attention-surface border-separator',\n (active === 'origin' || active === 'rearrange' || active === 'destination') && 'opacity-0',\n )}\n >\n <div\n role='toolbar'\n aria-orientation='vertical'\n aria-label={t('section controls label')}\n {...(!active && { tabIndex: 0 })}\n {...(!active && sectionActionsToolbar)}\n className={mx(\n 'grid grid-cols-subgrid ch-focus-ring rounded-sm grid-rows-[min-content_min-content_1fr] m-1',\n 'group-has-[[role=toolbar][aria-orientation=horizontal]]/section:pbs-[--rail-action]',\n )}\n >\n <div role='none' className='sticky -block-start-px bg-[--sticky-bg]'>\n <DropdownMenu.Root\n {...{\n open: optionsMenuOpen,\n onOpenChange: setOptionsMenuOpen,\n }}\n >\n <DropDownMenuDragHandleTrigger active={!!active} variant='ghost' classNames='m-0' {...draggableProps}>\n <Icon className={mx(getSize(5), 'transition-opacity')} />\n </DropDownMenuDragHandleTrigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content>\n <DropdownMenu.Viewport>\n {collapsed ? (\n <DropdownMenu.Item onClick={onNavigate} data-testid='section.navigate-to'>\n <ArrowSquareOut className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('navigate to section label')}</span>\n </DropdownMenu.Item>\n ) : (\n <CollapsiblePrimitive.Trigger asChild>\n <DropdownMenu.Item>\n <CaretDownUp className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('collapse label')}</span>\n </DropdownMenu.Item>\n </CollapsiblePrimitive.Trigger>\n )}\n <DropdownMenu.Item onClick={onAddBefore} data-testid='section.add-before'>\n <ArrowLineUp className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('add section before label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={onAddAfter} data-testid='section.add-after'>\n <ArrowLineDown className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('add section after label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onDelete?.()} data-testid='section.remove'>\n <Trash className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('remove section label')}</span>\n </DropdownMenu.Item>\n </DropdownMenu.Viewport>\n <DropdownMenu.Arrow />\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n {collapsed ? (\n <CollapsiblePrimitive.Trigger asChild>\n <Button variant='ghost' classNames={sectionActionDimensions}>\n <span className='sr-only'>{t('expand label')}</span>\n <CaretUpDown className={getSize(4)} />\n </Button>\n </CollapsiblePrimitive.Trigger>\n ) : (\n <Button\n variant='ghost'\n classNames={sectionActionDimensions}\n onClick={onNavigate}\n data-testid='section.navigate-to'\n >\n <ArrowSquareOut className={mx(getSize(4))} />\n <span className='sr-only'>{t('navigate to section label')}</span>\n </Button>\n )}\n </div>\n </div>\n\n {/* Main content */}\n\n <ListItem.Heading\n classNames={collapsed ? ['grid grid-rows-subgrid grid-cols-subgrid items-center', focusRing] : 'sr-only'}\n {...(collapsed && { ...sectionContentGroup, tabIndex: 0 })}\n >\n {/*\n TODO(thure): This needs to be made extensible; Markdown document titles especially are difficult.\n Using `Surface` in a UI package like this would be unprecedented and needs motivation.\n Refactoring to use subcomponents is complicated by sections being a sortable Mosaic Tile.\n Reevaluate when work on collections (Folders, Stacks, etc) settles.\n */}\n <span className='truncate'>{title}</span>\n </ListItem.Heading>\n {size === 'intrinsic' ? (\n <CollapsiblePrimitive.Content\n {...(!collapsed && {\n ...sectionContentGroup,\n tabIndex: 0,\n })}\n // TODO(burdon): Add margin to fragment?\n className={mx(focusRing, 'm-[2px]')}\n >\n {children}\n </CollapsiblePrimitive.Content>\n ) : (\n <CollapsiblePrimitive.Content asChild>\n <ScrollArea.Root\n type='always'\n {...(!collapsed && { ...sectionContentGroup, tabIndex: 0 })}\n classNames={mx(focusRing, 'is-full has-[[data-radix-scroll-area-viewport]]:pbe-4')}\n >\n <ScrollArea.Viewport>{children}</ScrollArea.Viewport>\n <ScrollArea.Scrollbar\n orientation='horizontal'\n variant='coarse'\n classNames='hidden has-[div]:flex !inline-end-[max(.25rem,var(--radix-scroll-area-corner-width))]'\n >\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n <ScrollArea.Scrollbar orientation='vertical' variant='coarse' classNames='hidden has-[div]:flex'>\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n <ScrollArea.Corner />\n </ScrollArea.Root>\n </CollapsiblePrimitive.Content>\n )}\n </div>\n {isResizable && !collapsed && (\n <button className={resizeHandleStyles}>\n <span className='sr-only'>{t('resize section label')}</span>\n </button>\n )}\n </ListItem.Root>\n </CollapsiblePrimitive.Root>\n );\n },\n);\n\nexport type SectionToolbarProps = ThemedClassName<ComponentPropsWithRef<'div'>>;\n\n// TODO(burdon): block-start\nexport const sectionToolbarLayout =\n 'bs-[--rail-action] bg-[--sticky-bg] sticky block-start-0 __-block-start-px transition-opacity';\n\nexport const SectionToolbar = ({ children, classNames }: SectionToolbarProps) => {\n return (\n <Toolbar.Root orientation='horizontal' classNames={[sectionToolbarLayout, hoverableControlItem, classNames]}>\n {children}\n </Toolbar.Root>\n );\n};\n\nexport const SectionTile: MosaicTileComponent<\n StackSectionItem,\n HTMLLIElement\n // TODO(wittjosiah): If props is specified there is a type error with Mosaic.Container.\n // { itemContext: StackContextValue }\n> = forwardRef(({ path, type, active, draggableStyle, draggableProps, item, itemContext }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n const { activeItem } = useMosaic();\n\n const separation = !!itemContext?.separation;\n const isResizable = !!itemContext?.isResizable;\n const { transform, onDeleteSection, onNavigateToSection, onAddSection, onCollapseSection, SectionContent } =\n itemContext as StackContextValue;\n\n const transformedItem = transform\n ? transform(\n item,\n // TODO(wittjosiah): `active` doesn't always seem to be accurate here.\n activeItem?.item.id === item.id ? activeItem?.type : type,\n )\n : item;\n\n const placeholder = transformedItem.metadata?.placeholder ?? ['untitled section title', { ns: translationKey }];\n const title = transformedItem.view?.title ?? toLocalizedString(placeholder, t);\n\n const section = (\n <Section\n ref={forwardedRef}\n title={title}\n id={transformedItem.id}\n size={transformedItem.view?.size}\n icon={transformedItem.metadata?.icon}\n collapsed={transformedItem.view?.collapsed}\n separation={separation}\n active={active}\n draggableProps={draggableProps}\n draggableStyle={draggableStyle}\n onCollapseSection={onCollapseSection}\n isResizable={isResizable}\n onDelete={() => onDeleteSection?.(path)}\n onNavigate={() => onNavigateToSection?.(transformedItem)}\n onAddAfter={() => onAddSection?.(path, 'after')}\n onAddBefore={() => onAddSection?.(path, 'before')}\n >\n {SectionContent && <SectionContent data={transformedItem.object} />}\n </Section>\n );\n\n return active === 'overlay' ? <List>{section}</List> : section;\n});\n", "//\n// Copyright 2024 DXOS.org\n//\nimport { type IconProps } from '@phosphor-icons/react';\nimport React from 'react';\n\nexport const CaretDownUp = ({ children, weight, ...props }: IconProps) => {\n return (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' {...props}>\n <rect width='256' height='256' fill='none' />\n <polyline\n points='80 224 128 176 176 224'\n fill='none'\n stroke='currentColor'\n strokeLinecap='round'\n strokeLinejoin='round'\n strokeWidth='16'\n />\n <polyline\n points='80 32 128 80 176 32'\n fill='none'\n stroke='currentColor'\n strokeLinecap='round'\n strokeLinejoin='round'\n strokeWidth='16'\n />\n {children}\n </svg>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nexport const stackColumns = 'grid-cols-[var(--rail-size)_calc(100%-var(--rail-size))]';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const translationKey = 'stack';\n\nexport default [\n {\n 'en-US': {\n [translationKey]: {\n 'empty stack message': 'Drag items into the stack.',\n 'remove section label': 'Delete',\n 'navigate to section label': 'Navigate to item',\n 'untitled section title': 'Untitled section',\n 'add section before label': 'Add before',\n 'add section after label': 'Add after',\n 'expand label': 'Expand',\n 'collapse label': 'Collapse',\n },\n },\n },\n];\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,yBAAyBC,qBAAAA,0BAAyB;AAC3D,OAAOC,
|
|
6
|
-
"names": ["useArrowNavigationGroup", "useFocusableGroup", "React", "forwardRef", "useCallback", "useResizeDetector", "List", "useTranslation", "Mosaic", "Path", "useContainer", "useItemsWithPreview", "useMosaic", "dropRingInner", "useFocusableGroup", "useTabsterAttributes", "ArrowLineDown", "ArrowLineUp", "ArrowSquareOut", "CaretUpDown", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useArrowNavigationGroup, useFocusableGroup } from '@fluentui/react-tabster';\nimport React, { type ReactNode, forwardRef, useCallback } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { List, useTranslation } from '@dxos/react-ui';\nimport {\n type MosaicContainerProps,\n type MosaicTileComponent,\n Mosaic,\n Path,\n useContainer,\n useItemsWithPreview,\n useMosaic,\n} from '@dxos/react-ui-mosaic';\nimport { dropRingInner } from '@dxos/react-ui-theme';\n\nimport {\n type CollapsedSections,\n type AddSectionPosition,\n SectionTile,\n type StackContextValue,\n type StackItem,\n type StackSectionContent,\n type StackSectionItem,\n} from './Section';\nimport { stackColumns } from './style-fragments';\nimport { translationKey } from '../translations';\n\nexport type Direction = 'horizontal' | 'vertical';\n\nexport type { CollapsedSections, AddSectionPosition };\n\nexport const DEFAULT_TYPE = 'stack-section';\n\nexport type StackProps<TData extends StackSectionContent = StackSectionContent> = Omit<\n MosaicContainerProps<TData, number>,\n 'debug' | 'Component'\n> &\n Omit<StackContextValue<TData>, 'setCollapsedSections'> & {\n items?: StackSectionItem[];\n separation?: boolean; // TODO(burdon): Style.\n onCollapseSection?: (id: string, collapsed: boolean) => void;\n emptyComponent?: ReactNode;\n };\n\nexport const Stack = ({\n id,\n type = DEFAULT_TYPE,\n SectionContent,\n items = [],\n separation = true,\n transform,\n onOver,\n onDrop,\n onAddSection,\n onDeleteSection,\n onNavigateToSection,\n onCollapseSection,\n ...props\n}: StackProps) => {\n const { ref: containerRef, width = 0 } = useResizeDetector<HTMLDivElement>({ refreshRate: 200 });\n const { operation, overItem } = useMosaic();\n const itemsWithPreview = useItemsWithPreview({ path: id, items });\n\n const getOverlayStyle = useCallback(() => ({ width }), [width]);\n const getOverlayProps = useCallback(\n () => ({ itemContext: { transform, SectionContent } }),\n [transform, SectionContent],\n );\n\n // TODO(thure): The root cause of the discrepancy between `activeNodeRect.top` and `overlayNodeRect.top` in Composer\n // in particular is not yet known, so this solution may may backfire in unforeseeable cases.\n const stackModifier = useCallback<Exclude<MosaicContainerProps['modifier'], undefined>>(\n (_activeItem, { transform, activeNodeRect, overlayNodeRect }) => {\n if (activeNodeRect && overlayNodeRect) {\n transform.y += activeNodeRect?.top - overlayNodeRect?.top;\n }\n return transform;\n },\n [],\n );\n\n return (\n <Mosaic.Container\n {...{\n id,\n type,\n Component: SectionTile as MosaicTileComponent<StackSectionItem, HTMLDivElement>,\n getOverlayStyle,\n getOverlayProps,\n onOver,\n onDrop,\n modifier: stackModifier,\n }}\n >\n <Mosaic.DroppableTile\n path={id}\n type={type}\n item={{ id, items: itemsWithPreview }}\n // TODO(wittjosiah): Should this actually be a context?\n itemContext={{\n separation,\n transform,\n onDeleteSection,\n onNavigateToSection,\n onAddSection,\n onCollapseSection,\n SectionContent,\n }}\n isOver={\n overItem &&\n !!overItem.path &&\n Path.hasRoot(overItem.path, id) &&\n (operation === 'copy' || operation === 'transfer')\n }\n Component={StackTile}\n {...props}\n ref={containerRef}\n />\n </Mosaic.Container>\n );\n};\n\nconst StackTile: MosaicTileComponent<StackItem, HTMLOListElement, Pick<StackProps, 'emptyComponent'>> = forwardRef(\n ({ classNames, path, isOver, item: { items }, itemContext, type: _type, emptyComponent, ...props }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n const { Component, type } = useContainer();\n const domAttributes = useArrowNavigationGroup({ axis: 'grid' });\n const { activeItem } = useMosaic();\n\n // NOTE(thure): Ensure “groupper” is available, but no need to use it here.\n const _group = useFocusableGroup();\n\n // NOTE: Keep outer padding the same as MarkdownMain.\n return (\n <List\n ref={forwardedRef}\n classNames={['grid relative', stackColumns, isOver && dropRingInner, classNames]}\n {...(!activeItem && domAttributes)}\n {...props}\n >\n {items.length > 0 ? (\n <Mosaic.SortableContext items={items} direction='vertical'>\n {items.map((item, index) => (\n <Mosaic.SortableTile\n key={item.id}\n item={item}\n itemContext={itemContext}\n path={path}\n type={type}\n position={index}\n Component={Component}\n />\n ))}\n </Mosaic.SortableContext>\n ) : emptyComponent !== undefined ? (\n <>{emptyComponent}</>\n ) : (\n <p\n className='grid col-span-2 text-center p-4 border border-dashed border-neutral-500/50 rounded'\n data-testid='stack.empty'\n >\n {t('empty stack message')}\n </p>\n )}\n </List>\n );\n },\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { useFocusableGroup, useTabsterAttributes } from '@fluentui/react-tabster';\nimport { ArrowLineDown, ArrowLineUp, ArrowSquareOut, CaretUpDown, Trash } from '@phosphor-icons/react';\nimport * as CollapsiblePrimitive from '@radix-ui/react-collapsible';\nimport React, {\n forwardRef,\n useState,\n type ForwardRefExoticComponent,\n type RefAttributes,\n type FC,\n type PropsWithChildren,\n type ComponentPropsWithRef,\n} from 'react';\n\nimport {\n Button,\n DropdownMenu,\n Icon,\n type Label,\n List,\n ListItem,\n ScrollArea,\n type ThemedClassName,\n Toolbar,\n toLocalizedString,\n useTranslation,\n} from '@dxos/react-ui';\nimport { useAttendableAttributes } from '@dxos/react-ui-attention';\nimport { DropDownMenuDragHandleTrigger, resizeHandle, resizeHandleHorizontal } from '@dxos/react-ui-deck';\nimport {\n type MosaicActiveType,\n type MosaicDataItem,\n type MosaicTileComponent,\n type MosaicTileProps,\n useMosaic,\n} from '@dxos/react-ui-mosaic';\nimport {\n focusRing,\n getSize,\n hoverableControlItem,\n hoverableControls,\n hoverableFocusedWithinControls,\n mx,\n} from '@dxos/react-ui-theme';\n\nimport { CaretDownUp } from './CaretDownUp';\nimport { stackColumns } from './style-fragments';\nimport { translationKey } from '../translations';\n\nconst sectionActionDimensions = 'p-1 shrink-0 min-bs-0 is-[--rail-action] bs-min';\n\nexport type StackSectionContent = MosaicDataItem;\n\nexport type CollapsedSections = Record<string, boolean>;\n\nexport type AddSectionPosition = 'before' | 'after' | 'beforeAll' | 'afterAll';\n\nexport type StackContextValue<TData extends StackSectionContent = StackSectionContent> = {\n SectionContent: FC<{ data: TData }>;\n separation?: boolean;\n isResizable?: boolean;\n transform?: (item: MosaicDataItem, type?: string) => StackSectionItem;\n onDeleteSection?: (path: string) => void;\n onAddSection?: (path: string, position: AddSectionPosition) => void;\n onNavigateToSection?: (object: MosaicDataItem) => void;\n onCollapseSection?: (id: string, collapsed: boolean) => void;\n};\n\nexport type StackItem = MosaicDataItem & {\n items: StackSectionItem[];\n};\n\nexport type StackSectionItem = MosaicDataItem & {\n object: StackSectionContent;\n // TODO(wittjosiah): Use effect schema? Share schema with echo.\n view?: {\n title?: string;\n size?: SectionSize;\n height?: number;\n collapsed?: boolean;\n custom?: Record<string, any>;\n };\n // TODO(wittjosiah): Common type? Factor out?\n metadata?: {\n icon?: string;\n placeholder?: Label;\n viewActions?: (item: StackSectionItem) => StackAction;\n };\n};\n\nexport type StackAction = {\n icon: string;\n label: Label;\n onClick: () => void;\n};\n\nexport type SectionSize = 'intrinsic' | 'extrinsic';\n\nexport type SectionProps = PropsWithChildren<\n {\n // Data props.\n id: string;\n title: string;\n\n // Tile props.\n active?: MosaicActiveType;\n } & Pick<\n MosaicTileProps,\n 'draggableProps' | 'draggableStyle' | 'onDelete' | 'onNavigate' | 'onAddAfter' | 'onAddBefore'\n > &\n Pick<StackContextValue, 'separation' | 'isResizable' | 'onCollapseSection'> &\n Pick<Required<StackSectionItem>['view'], 'collapsed' | 'size'> &\n Pick<Required<StackSectionItem>['metadata'], 'icon'>\n>;\n\nconst resizeHandleStyles = mx(resizeHandle, resizeHandleHorizontal, 'is-full bs-[--rail-action] col-start-2');\n\nexport const Section: ForwardRefExoticComponent<SectionProps & RefAttributes<HTMLLIElement>> = forwardRef<\n HTMLLIElement,\n SectionProps\n>(\n (\n {\n id,\n title,\n icon = 'ph--placeholder--regular',\n size = 'intrinsic',\n collapsed,\n active,\n isResizable,\n draggableProps,\n draggableStyle,\n onDelete,\n onNavigate,\n onAddBefore,\n onAddAfter,\n onCollapseSection,\n children,\n },\n forwardedRef,\n ) => {\n const { t } = useTranslation(translationKey);\n const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);\n const sectionActionsToolbar = useTabsterAttributes({\n groupper: {},\n focusable: {},\n mover: { cyclic: true, direction: 1, memorizeCurrent: false },\n });\n const sectionContentGroup = useFocusableGroup({});\n const attendableAttrs = useAttendableAttributes(id);\n\n return (\n <CollapsiblePrimitive.Root\n asChild\n open={!collapsed}\n onOpenChange={(nextOpen) => onCollapseSection?.(id, !nextOpen)}\n >\n <ListItem.Root\n ref={forwardedRef}\n id={id}\n {...attendableAttrs}\n classNames={[\n 'grid col-span-2 group/section',\n active === 'overlay' ? stackColumns : 'grid-cols-subgrid snap-start',\n ]}\n style={draggableStyle}\n >\n <div\n role='none'\n className={mx(\n 'grid col-span-2 grid-cols-subgrid',\n 'bg-base attention-surface',\n hoverableControls,\n hoverableFocusedWithinControls,\n (active === 'origin' || active === 'rearrange' || active === 'destination') && 'opacity-0',\n )}\n >\n <div\n role='toolbar'\n aria-orientation='vertical'\n aria-label={t('section controls label')}\n {...(!active && { tabIndex: 0 })}\n {...(!active && sectionActionsToolbar)}\n className={mx(\n 'grid grid-cols-subgrid ch-focus-ring rounded-sm grid-rows-[min-content_min-content_1fr] m-1',\n 'group-has-[[role=toolbar][aria-orientation=horizontal]]/section:pbs-[--rail-action]',\n )}\n >\n <div role='none' className='sticky -block-start-px bg-[--sticky-bg]'>\n <DropdownMenu.Root\n {...{\n open: optionsMenuOpen,\n onOpenChange: setOptionsMenuOpen,\n }}\n >\n <DropDownMenuDragHandleTrigger active={!!active} variant='ghost' classNames='m-0' {...draggableProps}>\n <Icon icon={icon} size={5} classNames='transition-opacity' />\n </DropDownMenuDragHandleTrigger>\n <DropdownMenu.Portal>\n <DropdownMenu.Content>\n <DropdownMenu.Viewport>\n {collapsed ? (\n <DropdownMenu.Item onClick={onNavigate} data-testid='section.navigate-to'>\n <ArrowSquareOut className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('navigate to section label')}</span>\n </DropdownMenu.Item>\n ) : (\n <CollapsiblePrimitive.Trigger asChild>\n <DropdownMenu.Item>\n <CaretDownUp className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('collapse label')}</span>\n </DropdownMenu.Item>\n </CollapsiblePrimitive.Trigger>\n )}\n <DropdownMenu.Item onClick={onAddBefore} data-testid='section.add-before'>\n <ArrowLineUp className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('add section before label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={onAddAfter} data-testid='section.add-after'>\n <ArrowLineDown className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('add section after label')}</span>\n </DropdownMenu.Item>\n <DropdownMenu.Item onClick={() => onDelete?.()} data-testid='section.remove'>\n <Trash className={mx(getSize(5), 'mr-2')} />\n <span className='grow'>{t('remove section label')}</span>\n </DropdownMenu.Item>\n </DropdownMenu.Viewport>\n <DropdownMenu.Arrow />\n </DropdownMenu.Content>\n </DropdownMenu.Portal>\n </DropdownMenu.Root>\n {collapsed ? (\n <CollapsiblePrimitive.Trigger asChild>\n <Button variant='ghost' classNames={sectionActionDimensions}>\n <span className='sr-only'>{t('expand label')}</span>\n <CaretUpDown className={getSize(4)} />\n </Button>\n </CollapsiblePrimitive.Trigger>\n ) : (\n <Button\n variant='ghost'\n classNames={sectionActionDimensions}\n onClick={onNavigate}\n data-testid='section.navigate-to'\n >\n <ArrowSquareOut className={mx(getSize(4))} />\n <span className='sr-only'>{t('navigate to section label')}</span>\n </Button>\n )}\n </div>\n </div>\n\n {/* Main content */}\n\n <ListItem.Heading\n classNames={collapsed ? ['grid grid-rows-subgrid grid-cols-subgrid items-center', focusRing] : 'sr-only'}\n {...(collapsed && { ...sectionContentGroup, tabIndex: 0 })}\n >\n {/*\n TODO(thure): This needs to be made extensible; Markdown document titles especially are difficult.\n Using `Surface` in a UI package like this would be unprecedented and needs motivation.\n Refactoring to use subcomponents is complicated by sections being a sortable Mosaic Tile.\n Reevaluate when work on collections (Folders, Stacks, etc) settles.\n */}\n <span className='truncate'>{title}</span>\n </ListItem.Heading>\n {size === 'intrinsic' ? (\n <CollapsiblePrimitive.Content\n {...(!collapsed && {\n ...sectionContentGroup,\n tabIndex: 0,\n })}\n // TODO(burdon): Add margin to fragment?\n className={mx(focusRing, 'm-[2px]')}\n >\n {children}\n </CollapsiblePrimitive.Content>\n ) : (\n <CollapsiblePrimitive.Content asChild>\n <ScrollArea.Root\n type='always'\n {...(!collapsed && { ...sectionContentGroup, tabIndex: 0 })}\n classNames={mx(focusRing, 'is-full has-[[data-radix-scroll-area-viewport]]:pbe-4')}\n >\n <ScrollArea.Viewport>{children}</ScrollArea.Viewport>\n <ScrollArea.Scrollbar\n orientation='horizontal'\n variant='coarse'\n classNames='hidden has-[div]:flex !inline-end-[max(.25rem,var(--radix-scroll-area-corner-width))]'\n >\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n <ScrollArea.Scrollbar orientation='vertical' variant='coarse' classNames='hidden has-[div]:flex'>\n <ScrollArea.Thumb />\n </ScrollArea.Scrollbar>\n <ScrollArea.Corner />\n </ScrollArea.Root>\n </CollapsiblePrimitive.Content>\n )}\n </div>\n {isResizable && !collapsed && (\n <button className={resizeHandleStyles}>\n <span className='sr-only'>{t('resize section label')}</span>\n </button>\n )}\n </ListItem.Root>\n </CollapsiblePrimitive.Root>\n );\n },\n);\n\nexport type SectionToolbarProps = ThemedClassName<ComponentPropsWithRef<'div'>>;\n\n// TODO(burdon): block-start\nexport const sectionToolbarLayout =\n 'bs-[--rail-action] bg-[--sticky-bg] sticky block-start-0 __-block-start-px transition-opacity';\n\nexport const SectionToolbar = ({ children, classNames }: SectionToolbarProps) => {\n return (\n <Toolbar.Root orientation='horizontal' classNames={[sectionToolbarLayout, hoverableControlItem, classNames]}>\n {children}\n </Toolbar.Root>\n );\n};\n\nexport const SectionTile: MosaicTileComponent<\n StackSectionItem,\n HTMLLIElement\n // TODO(wittjosiah): If props is specified there is a type error with Mosaic.Container.\n // { itemContext: StackContextValue }\n> = forwardRef(({ path, type, active, draggableStyle, draggableProps, item, itemContext }, forwardedRef) => {\n const { t } = useTranslation(translationKey);\n const { activeItem } = useMosaic();\n\n const separation = !!itemContext?.separation;\n const isResizable = !!itemContext?.isResizable;\n const { transform, onDeleteSection, onNavigateToSection, onAddSection, onCollapseSection, SectionContent } =\n itemContext as StackContextValue;\n\n const transformedItem = transform\n ? transform(\n item,\n // TODO(wittjosiah): `active` doesn't always seem to be accurate here.\n activeItem?.item.id === item.id ? activeItem?.type : type,\n )\n : item;\n\n const placeholder = transformedItem.metadata?.placeholder ?? ['untitled section title', { ns: translationKey }];\n const title = transformedItem.view?.title ?? toLocalizedString(placeholder, t);\n\n const section = (\n <Section\n ref={forwardedRef}\n title={title}\n id={transformedItem.id}\n size={transformedItem.view?.size}\n icon={transformedItem.metadata?.icon}\n collapsed={transformedItem.view?.collapsed}\n separation={separation}\n active={active}\n draggableProps={draggableProps}\n draggableStyle={draggableStyle}\n onCollapseSection={onCollapseSection}\n isResizable={isResizable}\n onDelete={() => onDeleteSection?.(path)}\n onNavigate={() => onNavigateToSection?.(transformedItem)}\n onAddAfter={() => onAddSection?.(path, 'after')}\n onAddBefore={() => onAddSection?.(path, 'before')}\n >\n {SectionContent && <SectionContent data={transformedItem.object} />}\n </Section>\n );\n\n return active === 'overlay' ? <List>{section}</List> : section;\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type IconProps } from '@phosphor-icons/react';\nimport React from 'react';\n\nexport const CaretDownUp = ({ children, weight, ...props }: IconProps) => {\n return (\n <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' {...props}>\n <rect width='256' height='256' fill='none' />\n <polyline\n points='80 224 128 176 176 224'\n fill='none'\n stroke='currentColor'\n strokeLinecap='round'\n strokeLinejoin='round'\n strokeWidth='16'\n />\n <polyline\n points='80 32 128 80 176 32'\n fill='none'\n stroke='currentColor'\n strokeLinecap='round'\n strokeLinejoin='round'\n strokeWidth='16'\n />\n {children}\n </svg>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nexport const stackColumns = 'grid-cols-[var(--rail-size)_calc(100%-var(--rail-size))]';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nexport const translationKey = 'stack';\n\nexport default [\n {\n 'en-US': {\n [translationKey]: {\n 'empty stack message': 'Drag items into the stack.',\n 'remove section label': 'Delete',\n 'navigate to section label': 'Navigate to item',\n 'untitled section title': 'Untitled section',\n 'add section before label': 'Add before',\n 'add section after label': 'Add after',\n 'expand label': 'Expand',\n 'collapse label': 'Collapse',\n },\n },\n },\n];\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,yBAAyBC,qBAAAA,0BAAyB;AAC3D,OAAOC,UAAyBC,cAAAA,aAAYC,mBAAmB;AAC/D,SAASC,yBAAyB;AAElC,SAASC,QAAAA,OAAMC,kBAAAA,uBAAsB;AACrC,SAGEC,QACAC,MACAC,cACAC,qBACAC,aAAAA,kBACK;AACP,SAASC,qBAAqB;;;ACd9B,SAASC,mBAAmBC,4BAA4B;AACxD,SAASC,eAAeC,aAAaC,gBAAgBC,aAAaC,aAAa;AAC/E,YAAYC,0BAA0B;AACtC,OAAOC,UACLC,YACAC,gBAMK;AAEP,SACEC,QACAC,cACAC,MAEAC,MACAC,UACAC,YAEAC,SACAC,mBACAC,sBACK;AACP,SAASC,+BAA+B;AACxC,SAASC,+BAA+BC,cAAcC,8BAA8B;AACpF,SAKEC,iBACK;AACP,SACEC,WACAC,SACAC,sBACAC,mBACAC,gCACAC,UACK;;;ACzCP,OAAOC,WAAW;AAEX,IAAMC,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AAc+D,WAAU;KAC7C/D,MAAMgE,IAAI,CAAC1B,MAAM2B,UAChB,gBAAAlC,OAAA,cAACC,OAAOkC,cAAY;IAClBC,KAAK7B,KAAKzC;IACVyC;IACAd;IACAJ;IACAtB;IACAsE,UAAUH;IACV/B;SAIJY,mBAAmBuB,SACrB,gBAAAtC,OAAA,cAAAA,OAAA,UAAA,MAAGe,cAAAA,IAEH,gBAAAf,OAAA,cAACuC,KAAAA;IACCC,WAAU;IACVC,eAAY;KAEXxB,EAAE,qBAAA,CAAA,CAAA;AAKb,CAAA;",
|
|
6
|
+
"names": ["useArrowNavigationGroup", "useFocusableGroup", "React", "forwardRef", "useCallback", "useResizeDetector", "List", "useTranslation", "Mosaic", "Path", "useContainer", "useItemsWithPreview", "useMosaic", "dropRingInner", "useFocusableGroup", "useTabsterAttributes", "ArrowLineDown", "ArrowLineUp", "ArrowSquareOut", "CaretUpDown", "Trash", "CollapsiblePrimitive", "React", "forwardRef", "useState", "Button", "DropdownMenu", "Icon", "List", "ListItem", "ScrollArea", "Toolbar", "toLocalizedString", "useTranslation", "useAttendableAttributes", "DropDownMenuDragHandleTrigger", "resizeHandle", "resizeHandleHorizontal", "useMosaic", "focusRing", "getSize", "hoverableControlItem", "hoverableControls", "hoverableFocusedWithinControls", "mx", "React", "CaretDownUp", "children", "weight", "props", "svg", "xmlns", "viewBox", "rect", "width", "height", "fill", "polyline", "points", "stroke", "strokeLinecap", "strokeLinejoin", "strokeWidth", "stackColumns", "translationKey", "sectionActionDimensions", "resizeHandleStyles", "mx", "resizeHandle", "resizeHandleHorizontal", "Section", "forwardRef", "id", "title", "icon", "size", "collapsed", "active", "isResizable", "draggableProps", "draggableStyle", "onDelete", "onNavigate", "onAddBefore", "onAddAfter", "onCollapseSection", "children", "forwardedRef", "t", "useTranslation", "translationKey", "optionsMenuOpen", "setOptionsMenuOpen", "useState", "sectionActionsToolbar", "useTabsterAttributes", "groupper", "focusable", "mover", "cyclic", "direction", "memorizeCurrent", "sectionContentGroup", "useFocusableGroup", "attendableAttrs", "useAttendableAttributes", "React", "Root", "asChild", "open", "onOpenChange", "nextOpen", "ListItem", "ref", "classNames", "stackColumns", "style", "div", "role", "className", "hoverableControls", "hoverableFocusedWithinControls", "aria-orientation", "aria-label", "tabIndex", "DropdownMenu", "DropDownMenuDragHandleTrigger", "variant", "Icon", "Portal", "Content", "Viewport", "Item", "onClick", "data-testid", "ArrowSquareOut", "getSize", "span", "Trigger", "CaretDownUp", "ArrowLineUp", "ArrowLineDown", "Trash", "Arrow", "Button", "CaretUpDown", "Heading", "focusRing", "ScrollArea", "type", "Scrollbar", "orientation", "Thumb", "Corner", "button", "sectionToolbarLayout", "SectionToolbar", "Toolbar", "hoverableControlItem", "SectionTile", "path", "item", "itemContext", "activeItem", "useMosaic", "separation", "transform", "onDeleteSection", "onNavigateToSection", "onAddSection", "SectionContent", "transformedItem", "placeholder", "metadata", "ns", "view", "toLocalizedString", "section", "data", "object", "List", "DEFAULT_TYPE", "Stack", "id", "type", "SectionContent", "items", "separation", "transform", "onOver", "onDrop", "onAddSection", "onDeleteSection", "onNavigateToSection", "onCollapseSection", "props", "ref", "containerRef", "width", "useResizeDetector", "refreshRate", "operation", "overItem", "useMosaic", "itemsWithPreview", "useItemsWithPreview", "path", "getOverlayStyle", "useCallback", "getOverlayProps", "itemContext", "stackModifier", "_activeItem", "activeNodeRect", "overlayNodeRect", "y", "top", "React", "Mosaic", "Container", "Component", "SectionTile", "modifier", "DroppableTile", "item", "isOver", "Path", "hasRoot", "StackTile", "forwardRef", "classNames", "_type", "emptyComponent", "forwardedRef", "t", "useTranslation", "translationKey", "useContainer", "domAttributes", "useArrowNavigationGroup", "axis", "activeItem", "_group", "useFocusableGroup", "List", "stackColumns", "dropRingInner", "length", "SortableContext", "direction", "map", "index", "SortableTile", "key", "position", "undefined", "p", "className", "data-testid"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/ui/react-ui-stack/src/components/CaretDownUp.tsx":{"bytes":3080,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-stack/src/components/style-fragments.ts":{"bytes":707,"imports":[],"format":"esm"},"packages/ui/react-ui-stack/src/translations.ts":{"bytes":2050,"imports":[],"format":"esm"},"packages/ui/react-ui-stack/src/components/Section.tsx":{"bytes":
|
|
1
|
+
{"inputs":{"packages/ui/react-ui-stack/src/components/CaretDownUp.tsx":{"bytes":3080,"imports":[{"path":"react","kind":"import-statement","external":true}],"format":"esm"},"packages/ui/react-ui-stack/src/components/style-fragments.ts":{"bytes":707,"imports":[],"format":"esm"},"packages/ui/react-ui-stack/src/translations.ts":{"bytes":2050,"imports":[],"format":"esm"},"packages/ui/react-ui-stack/src/components/Section.tsx":{"bytes":39706,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/react-ui-deck","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-stack/src/components/CaretDownUp.tsx","kind":"import-statement","original":"./CaretDownUp"},{"path":"packages/ui/react-ui-stack/src/components/style-fragments.ts","kind":"import-statement","original":"./style-fragments"},{"path":"packages/ui/react-ui-stack/src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"packages/ui/react-ui-stack/src/components/Stack.tsx":{"bytes":16642,"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"packages/ui/react-ui-stack/src/components/Section.tsx","kind":"import-statement","original":"./Section"},{"path":"packages/ui/react-ui-stack/src/components/style-fragments.ts","kind":"import-statement","original":"./style-fragments"},{"path":"packages/ui/react-ui-stack/src/translations.ts","kind":"import-statement","original":"../translations"}],"format":"esm"},"packages/ui/react-ui-stack/src/components/index.ts":{"bytes":832,"imports":[{"path":"packages/ui/react-ui-stack/src/components/Stack.tsx","kind":"import-statement","original":"./Stack"},{"path":"packages/ui/react-ui-stack/src/components/Section.tsx","kind":"import-statement","original":"./Section"}],"format":"esm"},"packages/ui/react-ui-stack/src/index.ts":{"bytes":718,"imports":[{"path":"packages/ui/react-ui-stack/src/components/index.ts","kind":"import-statement","original":"./components"},{"path":"packages/ui/react-ui-stack/src/translations.ts","kind":"import-statement","original":"./translations"}],"format":"esm"},"packages/ui/react-ui-stack/src/testing/stack-manager.ts":{"bytes":7412,"imports":[],"format":"esm"},"packages/ui/react-ui-stack/src/testing/index.ts":{"bytes":711,"imports":[{"path":"packages/ui/react-ui-stack/src/testing/stack-manager.ts","kind":"import-statement","original":"./stack-manager"}],"format":"esm"}},"outputs":{"packages/ui/react-ui-stack/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":33628},"packages/ui/react-ui-stack/dist/lib/browser/index.mjs":{"imports":[{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"react-resize-detector","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"@fluentui/react-tabster","kind":"import-statement","external":true},{"path":"@phosphor-icons/react","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-ui","kind":"import-statement","external":true},{"path":"@dxos/react-ui-attention","kind":"import-statement","external":true},{"path":"@dxos/react-ui-deck","kind":"import-statement","external":true},{"path":"@dxos/react-ui-mosaic","kind":"import-statement","external":true},{"path":"@dxos/react-ui-theme","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}],"exports":["DEFAULT_TYPE","SectionToolbar","Stack","sectionToolbarLayout","translations"],"entryPoint":"packages/ui/react-ui-stack/src/index.ts","inputs":{"packages/ui/react-ui-stack/src/components/Stack.tsx":{"bytesInOutput":3542},"packages/ui/react-ui-stack/src/components/Section.tsx":{"bytesInOutput":10044},"packages/ui/react-ui-stack/src/components/CaretDownUp.tsx":{"bytesInOutput":779},"packages/ui/react-ui-stack/src/components/style-fragments.ts":{"bytesInOutput":79},"packages/ui/react-ui-stack/src/translations.ts":{"bytesInOutput":508},"packages/ui/react-ui-stack/src/components/index.ts":{"bytesInOutput":0},"packages/ui/react-ui-stack/src/index.ts":{"bytesInOutput":0}},"bytes":15510},"packages/ui/react-ui-stack/dist/lib/browser/testing/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":3713},"packages/ui/react-ui-stack/dist/lib/browser/testing/index.mjs":{"imports":[],"exports":["SectionManager","StackManager"],"entryPoint":"packages/ui/react-ui-stack/src/testing/index.ts","inputs":{"packages/ui/react-ui-stack/src/testing/stack-manager.ts":{"bytesInOutput":1569},"packages/ui/react-ui-stack/src/testing/index.ts":{"bytesInOutput":0}},"bytes":1708}}}
|
|
@@ -1,97 +1,3 @@
|
|
|
1
|
-
// packages/ui/react-ui-stack/src/testing/generator.ts
|
|
2
|
-
import { S, create } from "@dxos/echo-schema";
|
|
3
|
-
import { faker } from "@dxos/random";
|
|
4
|
-
var range = (fn, length) => Array.from({
|
|
5
|
-
length
|
|
6
|
-
}).map((_, i) => fn(i)).filter(Boolean);
|
|
7
|
-
var createFactory = ({ createSchema, createData }) => {
|
|
8
|
-
const schema = createSchema?.();
|
|
9
|
-
return {
|
|
10
|
-
schema,
|
|
11
|
-
createObject: () => schema ? create(schema, createData()) : create(createData())
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
var Status = [
|
|
15
|
-
"pending",
|
|
16
|
-
"active",
|
|
17
|
-
"done"
|
|
18
|
-
];
|
|
19
|
-
var Priority = [
|
|
20
|
-
1,
|
|
21
|
-
2,
|
|
22
|
-
3,
|
|
23
|
-
4,
|
|
24
|
-
5
|
|
25
|
-
];
|
|
26
|
-
var defaultGenerators = {
|
|
27
|
-
document: {
|
|
28
|
-
createData: () => ({
|
|
29
|
-
title: faker.lorem.sentence(3),
|
|
30
|
-
body: faker.lorem.sentences({
|
|
31
|
-
min: 1,
|
|
32
|
-
max: faker.number.int({
|
|
33
|
-
min: 1,
|
|
34
|
-
max: 3
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
},
|
|
39
|
-
image: {
|
|
40
|
-
createData: () => ({
|
|
41
|
-
title: faker.lorem.sentence(3),
|
|
42
|
-
image: faker.helpers.arrayElement(data.images),
|
|
43
|
-
body: faker.datatype.boolean() ? faker.lorem.sentences() : void 0
|
|
44
|
-
})
|
|
45
|
-
},
|
|
46
|
-
project: {
|
|
47
|
-
createSchema: () => S.Struct({
|
|
48
|
-
title: S.String,
|
|
49
|
-
repo: S.String,
|
|
50
|
-
status: S.String,
|
|
51
|
-
priority: S.Number
|
|
52
|
-
}),
|
|
53
|
-
createData: () => ({
|
|
54
|
-
title: faker.commerce.productName(),
|
|
55
|
-
repo: faker.datatype.boolean({
|
|
56
|
-
probability: 0.3
|
|
57
|
-
}) ? faker.internet.url() : void 0,
|
|
58
|
-
status: faker.helpers.arrayElement(Status),
|
|
59
|
-
priority: faker.helpers.arrayElement(Priority)
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
var TestObjectGenerator = class {
|
|
64
|
-
constructor({ types, factories } = {}) {
|
|
65
|
-
this.factories = factories ?? (types ?? Object.keys(defaultGenerators)).reduce((acc, type) => {
|
|
66
|
-
acc[type] = createFactory(defaultGenerators[type]);
|
|
67
|
-
return acc;
|
|
68
|
-
}, {});
|
|
69
|
-
}
|
|
70
|
-
get schema() {
|
|
71
|
-
return Object.values(this.factories).map((f) => f.schema);
|
|
72
|
-
}
|
|
73
|
-
createObject({ types } = {}) {
|
|
74
|
-
const type = faker.helpers.arrayElement(types ?? Object.keys(this.factories));
|
|
75
|
-
const factory = this.factories[type];
|
|
76
|
-
return factory?.createObject();
|
|
77
|
-
}
|
|
78
|
-
createObjects({ types, length }) {
|
|
79
|
-
return range(() => this.createObject({
|
|
80
|
-
types
|
|
81
|
-
}), length);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
var data = {
|
|
85
|
-
images: [
|
|
86
|
-
"/images/image-1.png",
|
|
87
|
-
"/images/image-2.png",
|
|
88
|
-
"/images/image-3.png",
|
|
89
|
-
"/images/image-4.png",
|
|
90
|
-
"/images/image-5.png",
|
|
91
|
-
"/images/image-6.png"
|
|
92
|
-
]
|
|
93
|
-
};
|
|
94
|
-
|
|
95
1
|
// packages/ui/react-ui-stack/src/testing/stack-manager.ts
|
|
96
2
|
var StackManager = class {
|
|
97
3
|
constructor(locator) {
|
|
@@ -148,12 +54,7 @@ var SectionManager = class {
|
|
|
148
54
|
}
|
|
149
55
|
};
|
|
150
56
|
export {
|
|
151
|
-
Priority,
|
|
152
57
|
SectionManager,
|
|
153
|
-
StackManager
|
|
154
|
-
Status,
|
|
155
|
-
TestObjectGenerator,
|
|
156
|
-
defaultGenerators,
|
|
157
|
-
range
|
|
58
|
+
StackManager
|
|
158
59
|
};
|
|
159
60
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/testing/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\
|
|
5
|
-
"mappings": ";
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../../src/testing/stack-manager.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Locator, Page } from '@playwright/test';\n\nexport class StackManager {\n private readonly _page: Page;\n\n constructor(readonly locator: Locator) {\n this._page = locator.page();\n }\n\n empty() {\n return this.locator.getByTestId('stack.empty');\n }\n\n sections() {\n return this.locator.locator('li');\n }\n\n order() {\n return this.locator.locator('li').evaluateAll((els) => els.map((el) => el.getAttribute('id')));\n }\n\n section(index: number) {\n return new SectionManager(this.locator.locator('li').nth(index));\n }\n}\n\nexport class SectionManager {\n private readonly _page: Page;\n\n constructor(readonly locator: Locator) {\n this._page = locator.page();\n }\n\n async id() {\n return this.locator.getAttribute('id');\n }\n\n async remove() {\n await this.locator.getByTestId('section.drag-handle-menu-trigger').click();\n await this._page.getByTestId('section.remove').click();\n }\n\n async navigateTo() {\n await this.locator.getByTestId('section.drag-handle-menu-trigger').click();\n await this._page.getByTestId('section.navigate-to').click();\n }\n\n async dragTo(target: Locator, offset: { x: number; y: number } = { x: 0, y: 0 }) {\n const active = this.locator.getByTestId('section.drag-handle-menu-trigger');\n const box = await target.boundingBox();\n if (box) {\n await active.hover();\n await this._page.mouse.down();\n // Timeouts are for input discretization in WebKit\n await this._page.waitForTimeout(100);\n await this._page.pause();\n await this._page.mouse.move(offset.x + box.x + box.width / 2, offset.y + box.y + box.height / 2, { steps: 4 });\n await this._page.pause();\n await this._page.waitForTimeout(100);\n await this._page.mouse.up();\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,eAAN,MAAMA;EAGXC,YAAqBC,SAAkB;SAAlBA,UAAAA;AACnB,SAAKC,QAAQD,QAAQE,KAAI;EAC3B;EAEAC,QAAQ;AACN,WAAO,KAAKH,QAAQI,YAAY,aAAA;EAClC;EAEAC,WAAW;AACT,WAAO,KAAKL,QAAQA,QAAQ,IAAA;EAC9B;EAEAM,QAAQ;AACN,WAAO,KAAKN,QAAQA,QAAQ,IAAA,EAAMO,YAAY,CAACC,QAAQA,IAA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IAC3B;EACF;AACF;",
|
|
6
|
+
"names": ["StackManager", "constructor", "locator", "_page", "page", "empty", "getByTestId", "sections", "order", "evaluateAll", "els", "map", "el", "getAttribute", "section", "index", "SectionManager", "nth", "id", "remove", "click", "navigateTo", "dragTo", "target", "offset", "x", "y", "active", "box", "boundingBox", "hover", "mouse", "down", "waitForTimeout", "pause", "move", "width", "height", "steps", "up"]
|
|
7
7
|
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -96,7 +96,7 @@ var translations_default = [
|
|
|
96
96
|
];
|
|
97
97
|
var sectionActionDimensions = "p-1 shrink-0 min-bs-0 is-[--rail-action] bs-min";
|
|
98
98
|
var resizeHandleStyles = (0, import_react_ui_theme2.mx)(import_react_ui_deck.resizeHandle, import_react_ui_deck.resizeHandleHorizontal, "is-full bs-[--rail-action] col-start-2");
|
|
99
|
-
var Section = /* @__PURE__ */ (0, import_react3.forwardRef)(({ id, title, icon
|
|
99
|
+
var Section = /* @__PURE__ */ (0, import_react3.forwardRef)(({ id, title, icon = "ph--placeholder--regular", size = "intrinsic", collapsed, active, isResizable, draggableProps, draggableStyle, onDelete, onNavigate, onAddBefore, onAddAfter, onCollapseSection, children }, forwardedRef) => {
|
|
100
100
|
const { t } = (0, import_react_ui2.useTranslation)(translationKey);
|
|
101
101
|
const [optionsMenuOpen, setOptionsMenuOpen] = (0, import_react3.useState)(false);
|
|
102
102
|
const sectionActionsToolbar = (0, import_react_tabster2.useTabsterAttributes)({
|
|
@@ -109,8 +109,7 @@ var Section = /* @__PURE__ */ (0, import_react3.forwardRef)(({ id, title, icon:
|
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
111
|
const sectionContentGroup = (0, import_react_tabster2.useFocusableGroup)({});
|
|
112
|
-
const attendableAttrs = (0, import_react_ui_attention.
|
|
113
|
-
const hasAttention = (0, import_react_ui_attention.useHasAttention)(id);
|
|
112
|
+
const attendableAttrs = (0, import_react_ui_attention.useAttendableAttributes)(id);
|
|
114
113
|
return /* @__PURE__ */ import_react3.default.createElement(CollapsiblePrimitive.Root, {
|
|
115
114
|
asChild: true,
|
|
116
115
|
open: !collapsed,
|
|
@@ -126,7 +125,7 @@ var Section = /* @__PURE__ */ (0, import_react3.forwardRef)(({ id, title, icon:
|
|
|
126
125
|
style: draggableStyle
|
|
127
126
|
}, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
128
127
|
role: "none",
|
|
129
|
-
className: (0, import_react_ui_theme2.mx)("grid col-span-2 grid-cols-subgrid", "bg-base
|
|
128
|
+
className: (0, import_react_ui_theme2.mx)("grid col-span-2 grid-cols-subgrid", "bg-base attention-surface", import_react_ui_theme2.hoverableControls, import_react_ui_theme2.hoverableFocusedWithinControls, (active === "origin" || active === "rearrange" || active === "destination") && "opacity-0")
|
|
130
129
|
}, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
131
130
|
role: "toolbar",
|
|
132
131
|
"aria-orientation": "vertical",
|
|
@@ -147,8 +146,10 @@ var Section = /* @__PURE__ */ (0, import_react3.forwardRef)(({ id, title, icon:
|
|
|
147
146
|
variant: "ghost",
|
|
148
147
|
classNames: "m-0",
|
|
149
148
|
...draggableProps
|
|
150
|
-
}, /* @__PURE__ */ import_react3.default.createElement(Icon, {
|
|
151
|
-
|
|
149
|
+
}, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.Icon, {
|
|
150
|
+
icon,
|
|
151
|
+
size: 5,
|
|
152
|
+
classNames: "transition-opacity"
|
|
152
153
|
})), /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Portal, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Content, null, /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Viewport, null, collapsed ? /* @__PURE__ */ import_react3.default.createElement(import_react_ui2.DropdownMenu.Item, {
|
|
153
154
|
onClick: onNavigate,
|
|
154
155
|
"data-testid": "section.navigate-to"
|