@dxos/react-list 0.1.46-next.c3cc04c → 0.1.48-next.366bc83

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/List.tsx", "../../../src/ListItem.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { DndContext, DragEndEvent } from '@dnd-kit/core';\nimport { restrictToVerticalAxis } from '@dnd-kit/modifiers';\nimport { SortableContext, arrayMove } from '@dnd-kit/sortable';\nimport { createContextScope, Scope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport omit from 'lodash.omit';\nimport React, { ComponentPropsWithRef, forwardRef, ReactHTMLElement } from 'react';\n\n// TODO(thure): A lot of the accessible affordances for this kind of thing need to be implemented per https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\nconst LIST_NAME = 'List';\n\ntype ListScopedProps<P> = P & { __listScope?: Scope };\n\ntype ListVariant = 'ordered' | 'unordered' | 'ordered-draggable';\n\ntype SharedListProps = {\n selectable?: boolean;\n variant?: ListVariant;\n onDragEnd?: (event: DragEndEvent) => void;\n listItemIds?: string[];\n toggleOpenLabel?: string | Omit<ReactHTMLElement<HTMLElement>, 'ref'>;\n};\n\ntype DraggableListProps = Omit<SharedListProps, 'slots'> & {\n onDragEnd: Exclude<SharedListProps['onDragEnd'], undefined>;\n listItemIds: Exclude<SharedListProps['listItemIds'], undefined>;\n variant: 'ordered-draggable';\n};\n\ntype ListProps =\n | (Omit<ComponentPropsWithRef<typeof Primitive.ol>, 'onDragEnd'> & SharedListProps)\n | (Omit<ComponentPropsWithRef<typeof Primitive.ol>, 'onDragEnd'> & DraggableListProps);\n\n// LIST\n\nconst [createListContext, createListScope] = createContextScope(LIST_NAME, []);\n\ntype ListContextValue = Pick<ListProps, 'selectable' | 'variant' | 'toggleOpenLabel'>;\n\nconst [ListProvider, useListContext] = createListContext<ListContextValue>(LIST_NAME);\n\nconst List = forwardRef<HTMLOListElement, ListProps>((props: ListScopedProps<ListProps>, forwardedRef) => {\n const {\n __listScope,\n variant = 'ordered',\n selectable = false,\n toggleOpenLabel = 'Expand/collapse item',\n children,\n ...rootProps\n } = props;\n const ListRoot = variant === 'ordered' || variant === 'ordered-draggable' ? Primitive.ol : Primitive.ul;\n return (\n <ListRoot\n {...(selectable && { role: 'listbox', 'aria-multiselectable': true })}\n {...omit(rootProps, 'onDragEnd', 'listItemIds')}\n ref={forwardedRef}\n >\n <ListProvider\n {...{\n scope: __listScope,\n variant,\n selectable,\n toggleOpenLabel,\n }}\n >\n {variant === 'ordered-draggable' ? (\n <DndContext onDragEnd={(props as DraggableListProps).onDragEnd} modifiers={[restrictToVerticalAxis]}>\n <SortableContext items={(props as DraggableListProps).listItemIds}>{children}</SortableContext>\n </DndContext>\n ) : (\n <>{children}</>\n )}\n </ListProvider>\n </ListRoot>\n );\n});\n\nList.displayName = LIST_NAME;\n\nexport { List, createListScope, useListContext, LIST_NAME, arrayMove };\n\nexport type { ListProps, ListVariant, ListScopedProps, DragEndEvent };\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DraggableAttributes } from '@dnd-kit/core';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport type { CheckboxProps } from '@radix-ui/react-checkbox';\nimport { CollapsibleTriggerProps } from '@radix-ui/react-collapsible';\nimport * as Collapsible from '@radix-ui/react-collapsible';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope, Scope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { ComponentProps, ComponentPropsWithRef, Dispatch, forwardRef, SetStateAction } from 'react';\n\nimport { useId } from '@dxos/react-hooks';\n\nimport { LIST_NAME, ListScopedProps, useListContext } from './List';\n\nconst LIST_ITEM_NAME = 'ListItem';\n\ntype ListItemScopedProps<P> = P & { __listItemScope?: Scope };\n\ninterface ListItemData {\n id: string;\n selected?: CheckboxProps['checked'];\n open?: boolean;\n}\n\ntype ListItemProps = Omit<ListItemData, 'id'> & { collapsible?: boolean } & ComponentPropsWithRef<\n typeof Primitive.li\n > & {\n defaultOpen?: boolean;\n onOpenChange?: (nextOpen: boolean) => void;\n } & {\n onSelectedChange?: CheckboxProps['onCheckedChange'];\n defaultSelected?: CheckboxProps['defaultChecked'];\n };\n\ntype ListItemElement = React.ElementRef<typeof Primitive.li>;\n\nconst [createListItemContext, createListItemScope] = createContextScope(LIST_ITEM_NAME, []);\n\ntype DraggableListItemContextValue = {\n draggableAttributes: DraggableAttributes;\n draggableListeners: ReturnType<typeof useSortable>['listeners'];\n};\n\ntype ListItemContextValue = {\n headingId: string;\n open: boolean;\n selected: CheckboxProps['checked'];\n setSelected: Dispatch<SetStateAction<CheckboxProps['checked']>>;\n} & Partial<DraggableListItemContextValue>;\n\nconst [ListItemProvider, useListItemContext] = createListItemContext<ListItemContextValue>(LIST_ITEM_NAME);\n\ntype ListItemHeadingProps = ListItemScopedProps<Omit<ComponentPropsWithRef<typeof Primitive.p>, 'id'>> & {\n asChild?: boolean;\n};\n\nconst ListItemHeading = forwardRef<HTMLParagraphElement, ListItemHeadingProps>(\n ({ children, asChild, __listItemScope, ...props }, forwardedRef) => {\n const { headingId } = useListItemContext(LIST_ITEM_NAME, __listItemScope);\n const Root = asChild ? Slot : Primitive.p;\n return (\n <Root {...props} id={headingId} ref={forwardedRef}>\n {children}\n </Root>\n );\n },\n);\n\ntype ListItemDragHandleProps = ComponentPropsWithRef<typeof Primitive.div>;\n\nconst ListItemDragHandle = forwardRef<HTMLDivElement, ListItemScopedProps<ListItemDragHandleProps>>(\n ({ __listItemScope, children, ...props }, forwardedRef) => {\n const { draggableAttributes, draggableListeners } = useListItemContext(LIST_ITEM_NAME, __listItemScope);\n return (\n <div role='button' ref={forwardedRef} {...props} {...draggableAttributes} {...draggableListeners}>\n {children}\n </div>\n );\n },\n);\n\ntype ListItemOpenTriggerProps = ListItemScopedProps<CollapsibleTriggerProps>;\n\nconst ListItemOpenTrigger = Collapsible.Trigger;\n\ntype ListItemCollapsibleContentProps = ComponentProps<typeof Collapsible.Content>;\n\nconst ListItemCollapsibleContent = Collapsible.Content;\n\nconst PureListItem = forwardRef<\n ListItemElement,\n ListItemProps & { id: string } & Partial<DraggableListItemContextValue>\n>(\n (\n props: ListItemScopedProps<\n ListScopedProps<ListItemProps & { id: string } & Partial<DraggableListItemContextValue>>\n >,\n forwardedRef,\n ) => {\n const {\n __listScope,\n __listItemScope,\n children,\n selected: propsSelected,\n defaultSelected,\n onSelectedChange,\n open: propsOpen,\n defaultOpen,\n onOpenChange,\n collapsible,\n id,\n draggableAttributes,\n draggableListeners,\n ...listItemProps\n } = props;\n const { selectable } = useListContext(LIST_NAME, __listScope);\n\n const [selected = false, setSelected] = useControllableState({\n prop: propsSelected,\n defaultProp: defaultSelected,\n onChange: onSelectedChange,\n });\n\n const [open = false, setOpen] = useControllableState({\n prop: propsOpen,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const headingId = useId('listItem__heading');\n\n const listItem = (\n <Primitive.li\n {...listItemProps}\n id={id}\n ref={forwardedRef}\n aria-labelledby={headingId}\n {...(selectable && { role: 'option', 'aria-selected': !!selected })}\n >\n {children}\n </Primitive.li>\n );\n\n return (\n <ListItemProvider\n scope={__listItemScope}\n headingId={headingId}\n open={open}\n selected={selected}\n setSelected={setSelected}\n {...{ draggableAttributes, draggableListeners }}\n >\n {collapsible ? (\n <Collapsible.Root asChild open={open} onOpenChange={setOpen}>\n {listItem}\n </Collapsible.Root>\n ) : (\n listItem\n )}\n </ListItemProvider>\n );\n },\n);\n\nconst DraggableListItem = forwardRef<ListItemElement, ListItemProps & { id: string }>(\n (props: ListItemScopedProps<ListItemProps & { id: string }>, forwardedRef) => {\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({\n id: props.id,\n });\n const ref = useComposedRefs(forwardedRef, setNodeRef) as ComponentPropsWithRef<typeof Primitive.li>['ref'];\n\n return (\n <PureListItem\n {...props}\n style={{\n ...props.style,\n transform: CSS.Transform.toString(transform),\n transition,\n }}\n ref={ref}\n {...{\n draggableAttributes: attributes,\n draggableListeners: listeners,\n }}\n />\n );\n },\n);\n\nconst ListItem = forwardRef<ListItemElement, ListItemProps>((props: ListScopedProps<ListItemProps>, forwardedRef) => {\n const { variant } = useListContext(LIST_NAME, props.__listScope);\n const listItemId = useId('listItem', props.id);\n\n if (variant === 'ordered-draggable') {\n return <DraggableListItem {...props} ref={forwardedRef} id={listItemId} />;\n } else {\n return <PureListItem {...props} ref={forwardedRef} id={listItemId} />;\n }\n});\n\nListItem.displayName = LIST_ITEM_NAME;\n\nexport {\n ListItem,\n ListItemHeading,\n ListItemCollapsibleContent,\n ListItemDragHandle,\n ListItemOpenTrigger,\n createListItemScope,\n useListItemContext,\n LIST_ITEM_NAME,\n};\n\nexport type {\n ListItemProps,\n ListItemHeadingProps,\n ListItemCollapsibleContentProps,\n ListItemDragHandleProps,\n ListItemOpenTriggerProps,\n ListItemScopedProps,\n};\n"],
5
- "mappings": ";AAIA,SAASA,kBAAgC;AACzC,SAASC,8BAA8B;AACvC,SAASC,iBAAiBC,iBAAiB;AAC3C,SAASC,0BAAiC;AAC1C,SAASC,iBAAiB;AAC1B,OAAOC,UAAU;AACjB,OAAOC,SAAgCC,kBAAoC;AAN3E,SAAA,WAAA;;;;;;;;;;;;;;AAUA,IAAMC,YAAY;AA0BlB,IAAM,CAACC,mBAAmBC,eAAAA,IAAmBP,mBAAmBK,WAAW,CAAA,CAAE;AAI7E,IAAM,CAACG,cAAcC,cAAAA,IAAkBH,kBAAoCD,SAAAA;AAE3E,IAAMK,OAAON,2BAAwC,CAACO,OAAmCC,iBAAiB;AACxG,QAAM,EACJC,aACAC,UAAU,WACVC,aAAa,OACbC,kBAA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restrictToVerticalAxis } from '@dnd-kit/modifiers';\nimport { SortableContext, arrayMove } from '@dnd-kit/sortable';\nimport { createContextScope, Scope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport omit from 'lodash.omit';\nimport React, { ComponentPropsWithRef, forwardRef, ReactHTMLElement } from 'react';\n\n// TODO(thure): A lot of the accessible affordances for this kind of thing need to be implemented per https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\nconst LIST_NAME = 'List';\n\ntype ListScopedProps<P> = P & { __listScope?: Scope };\n\ntype ListVariant = 'ordered' | 'unordered' | 'ordered-draggable';\n\ntype SharedListProps = {\n selectable?: boolean;\n variant?: ListVariant;\n onDragEnd?: (event: DragEndEvent) => void;\n listItemIds?: string[];\n toggleOpenLabel?: string | Omit<ReactHTMLElement<HTMLElement>, 'ref'>;\n};\n\ntype DraggableListProps = Omit<SharedListProps, 'slots'> & {\n onDragEnd: Exclude<SharedListProps['onDragEnd'], undefined>;\n listItemIds: Exclude<SharedListProps['listItemIds'], undefined>;\n variant: 'ordered-draggable';\n};\n\ntype ListProps =\n | (Omit<ComponentPropsWithRef<typeof Primitive.ol>, 'onDragEnd'> & SharedListProps)\n | (Omit<ComponentPropsWithRef<typeof Primitive.ol>, 'onDragEnd'> & DraggableListProps);\n\n// LIST\n\nconst [createListContext, createListScope] = createContextScope(LIST_NAME, []);\n\ntype ListContextValue = Pick<ListProps, 'selectable' | 'variant' | 'toggleOpenLabel'>;\n\nconst [ListProvider, useListContext] = createListContext<ListContextValue>(LIST_NAME);\n\nconst List = forwardRef<HTMLOListElement, ListProps>((props: ListScopedProps<ListProps>, forwardedRef) => {\n const {\n __listScope,\n variant = 'ordered',\n selectable = false,\n toggleOpenLabel = 'Expand/collapse item',\n children,\n ...rootProps\n } = props;\n const ListRoot = variant === 'ordered' || variant === 'ordered-draggable' ? Primitive.ol : Primitive.ul;\n return (\n <ListRoot\n {...(selectable && { role: 'listbox', 'aria-multiselectable': true })}\n {...omit(rootProps, 'onDragEnd', 'listItemIds')}\n ref={forwardedRef}\n >\n <ListProvider\n {...{\n scope: __listScope,\n variant,\n selectable,\n toggleOpenLabel,\n }}\n >\n {variant === 'ordered-draggable' ? (\n <DndContext onDragEnd={(props as DraggableListProps).onDragEnd} modifiers={[restrictToVerticalAxis]}>\n <SortableContext items={(props as DraggableListProps).listItemIds}>{children}</SortableContext>\n </DndContext>\n ) : (\n <>{children}</>\n )}\n </ListProvider>\n </ListRoot>\n );\n});\n\nList.displayName = LIST_NAME;\n\nexport { List, createListScope, useListContext, LIST_NAME, arrayMove };\n\nexport type { ListProps, ListVariant, ListScopedProps, DragEndEvent };\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DraggableAttributes } from '@dnd-kit/core';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport type { CheckboxProps } from '@radix-ui/react-checkbox';\nimport { CollapsibleContentProps, CollapsibleTriggerProps } from '@radix-ui/react-collapsible';\nimport * as Collapsible from '@radix-ui/react-collapsible';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope, Scope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, {\n ComponentProps,\n ComponentPropsWithRef,\n Dispatch,\n forwardRef,\n ForwardRefExoticComponent,\n SetStateAction,\n} from 'react';\n\nimport { useId } from '@dxos/react-hooks';\n\nimport { LIST_NAME, ListScopedProps, useListContext } from './List';\n\nconst LIST_ITEM_NAME = 'ListItem';\n\ntype ListItemScopedProps<P> = P & { __listItemScope?: Scope };\n\ninterface ListItemData {\n id: string;\n selected?: CheckboxProps['checked'];\n open?: boolean;\n}\n\ntype ListItemProps = Omit<ListItemData, 'id'> & { collapsible?: boolean } & ComponentPropsWithRef<\n typeof Primitive.li\n > & {\n defaultOpen?: boolean;\n onOpenChange?: (nextOpen: boolean) => void;\n } & {\n onSelectedChange?: CheckboxProps['onCheckedChange'];\n defaultSelected?: CheckboxProps['defaultChecked'];\n };\n\ntype ListItemElement = React.ElementRef<typeof Primitive.li>;\n\nconst [createListItemContext, createListItemScope] = createContextScope(LIST_ITEM_NAME, []);\n\ntype DraggableListItemContextValue = {\n draggableAttributes: DraggableAttributes;\n draggableListeners: ReturnType<typeof useSortable>['listeners'];\n};\n\ntype ListItemContextValue = {\n headingId: string;\n open: boolean;\n selected: CheckboxProps['checked'];\n setSelected: Dispatch<SetStateAction<CheckboxProps['checked']>>;\n} & Partial<DraggableListItemContextValue>;\n\nconst [ListItemProvider, useListItemContext] = createListItemContext<ListItemContextValue>(LIST_ITEM_NAME);\n\ntype ListItemHeadingProps = ListItemScopedProps<Omit<ComponentPropsWithRef<typeof Primitive.p>, 'id'>> & {\n asChild?: boolean;\n};\n\nconst ListItemHeading = forwardRef<HTMLParagraphElement, ListItemHeadingProps>(\n ({ children, asChild, __listItemScope, ...props }, forwardedRef) => {\n const { headingId } = useListItemContext(LIST_ITEM_NAME, __listItemScope);\n const Root = asChild ? Slot : Primitive.p;\n return (\n <Root {...props} id={headingId} ref={forwardedRef}>\n {children}\n </Root>\n );\n },\n);\n\ntype ListItemDragHandleProps = ComponentPropsWithRef<typeof Primitive.div>;\n\nconst ListItemDragHandle = forwardRef<HTMLDivElement, ListItemScopedProps<ListItemDragHandleProps>>(\n ({ __listItemScope, children, ...props }, forwardedRef) => {\n const { draggableAttributes, draggableListeners } = useListItemContext(LIST_ITEM_NAME, __listItemScope);\n return (\n <div role='button' ref={forwardedRef} {...props} {...draggableAttributes} {...draggableListeners}>\n {children}\n </div>\n );\n },\n);\n\ntype ListItemOpenTriggerProps = ListItemScopedProps<CollapsibleTriggerProps>;\n\nconst ListItemOpenTrigger = Collapsible.Trigger;\n\ntype ListItemCollapsibleContentProps = ComponentProps<typeof Collapsible.Content>;\n\nconst ListItemCollapsibleContent: ForwardRefExoticComponent<CollapsibleContentProps> = Collapsible.Content;\n\nconst PureListItem = forwardRef<\n ListItemElement,\n ListItemProps & { id: string } & Partial<DraggableListItemContextValue>\n>(\n (\n props: ListItemScopedProps<\n ListScopedProps<ListItemProps & { id: string } & Partial<DraggableListItemContextValue>>\n >,\n forwardedRef,\n ) => {\n const {\n __listScope,\n __listItemScope,\n children,\n selected: propsSelected,\n defaultSelected,\n onSelectedChange,\n open: propsOpen,\n defaultOpen,\n onOpenChange,\n collapsible,\n id,\n draggableAttributes,\n draggableListeners,\n ...listItemProps\n } = props;\n const { selectable } = useListContext(LIST_NAME, __listScope);\n\n const [selected = false, setSelected] = useControllableState({\n prop: propsSelected,\n defaultProp: defaultSelected,\n onChange: onSelectedChange,\n });\n\n const [open = false, setOpen] = useControllableState({\n prop: propsOpen,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const headingId = useId('listItem__heading');\n\n const listItem = (\n <Primitive.li\n {...listItemProps}\n id={id}\n ref={forwardedRef}\n aria-labelledby={headingId}\n {...(selectable && { role: 'option', 'aria-selected': !!selected })}\n >\n {children}\n </Primitive.li>\n );\n\n return (\n <ListItemProvider\n scope={__listItemScope}\n headingId={headingId}\n open={open}\n selected={selected}\n setSelected={setSelected}\n {...{ draggableAttributes, draggableListeners }}\n >\n {collapsible ? (\n <Collapsible.Root asChild open={open} onOpenChange={setOpen}>\n {listItem}\n </Collapsible.Root>\n ) : (\n listItem\n )}\n </ListItemProvider>\n );\n },\n);\n\nconst DraggableListItem = forwardRef<ListItemElement, ListItemProps & { id: string }>(\n (props: ListItemScopedProps<ListItemProps & { id: string }>, forwardedRef) => {\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({\n id: props.id,\n });\n const ref = useComposedRefs(forwardedRef, setNodeRef) as ComponentPropsWithRef<typeof Primitive.li>['ref'];\n\n return (\n <PureListItem\n {...props}\n style={{\n ...props.style,\n transform: CSS.Transform.toString(transform),\n transition,\n }}\n ref={ref}\n {...{\n draggableAttributes: attributes,\n draggableListeners: listeners,\n }}\n />\n );\n },\n);\n\nconst ListItem = forwardRef<ListItemElement, ListItemProps>((props: ListScopedProps<ListItemProps>, forwardedRef) => {\n const { variant } = useListContext(LIST_NAME, props.__listScope);\n const listItemId = useId('listItem', props.id);\n\n if (variant === 'ordered-draggable') {\n return <DraggableListItem {...props} ref={forwardedRef} id={listItemId} />;\n } else {\n return <PureListItem {...props} ref={forwardedRef} id={listItemId} />;\n }\n});\n\nListItem.displayName = LIST_ITEM_NAME;\n\nexport {\n ListItem,\n ListItemHeading,\n ListItemCollapsibleContent,\n ListItemDragHandle,\n ListItemOpenTrigger,\n createListItemScope,\n useListItemContext,\n LIST_ITEM_NAME,\n};\n\nexport type {\n ListItemProps,\n ListItemHeadingProps,\n ListItemCollapsibleContentProps,\n ListItemDragHandleProps,\n ListItemOpenTriggerProps,\n ListItemScopedProps,\n};\n"],
5
+ "mappings": ";AAIA,SAASA,kBAAgC;AACzC,SAASC,8BAA8B;AACvC,SAASC,iBAAiBC,iBAAiB;AAC3C,SAASC,0BAAiC;AAC1C,SAASC,iBAAiB;AAC1B,OAAOC,UAAU;AACjB,OAAOC,SAAgCC,kBAAoC;AAN3E,SAAA,WAAA;;;;;;;;;;;;;;AAUA,IAAMC,YAAY;AA0BlB,IAAM,CAACC,mBAAmBC,eAAAA,IAAmBP,mBAAmBK,WAAW,CAAA,CAAE;AAI7E,IAAM,CAACG,cAAcC,cAAAA,IAAkBH,kBAAoCD,SAAAA;AAE3E,IAAMK,OAAON,2BAAwC,CAACO,OAAmCC,iBAAiB;AACxG,QAAM,EACJC,aACAC,UAAU,WACVC,aAAa,OACbC,kBAAkB,wBAClBC,UACA,GAAGC,UAAAA,IACDP;AACJ,QAAMQ,WAAWL,YAAY,aAAaA,YAAY,sBAAsBb,UAAUmB,KAAKnB,UAAUoB;AACrG,SACE,sBAAA,cAACF,UAAAA,SAAAA,CAAAA,GACMJ,cAAc;IAAEO,MAAM;IAAW,wBAAwB;EAAK,GAC/DpB,KAAKgB,W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GF,IAAMI,oBAAoBjD,gBAAAA,YACxB,CAACI,OAA4DC,iBAAiB;AAC5E,QAAM,EAAE6C,YAAYC,WAAWC,YAAYC,WAAWC,WAAU,IAAKC,YAAY;IAC/E3C,IAAIR,MAAMQ;EACZ,CAAA;AACA,QAAMC,MAAM2C,gBAAgBnD,cAAc+C,UAAAA;AAE1C,SACE,gBAAAzC,OAAA,cAACY,cAAAA,UAAAA,CAAAA,GACKnB,OAAAA;IACJqD,OAAO;MACL,GAAGrD,MAAMqD;MACTJ,WAAWK,IAAIC,UAAUC,SAASP,SAAAA;MAClCC;IACF;IACAzC;KACI;IACFE,qBAAqBmC;IACrBlC,oBAAoBmC;EACtB,CAAA,CAAA;AAGN,CAAA;AAGF,IAAMU,WAAW7D,gBAAAA,YAA2C,CAACI,OAAuCC,iBAAiB;AACnH,QAAM,EAAEyD,QAAO,IAAK1B,eAAeC,WAAWjC,MAAMoB,WAAW;AAC/D,QAAMuC,aAAanB,MAAM,YAAYxC,MAAMQ,EAAE;AAE7C,MAAIkD,YAAY,qBAAqB;AACnC,WAAO,gBAAAnD,OAAA,cAACsC,mBAAAA,UAAAA,CAAAA,GAAsB7C,OAAAA;MAAOS,KAAKR;MAAcO,IAAImD;;EAC9D,OAAO;AACL,WAAO,gBAAApD,OAAA,cAACY,cAAAA,UAAAA,CAAAA,GAAiBnB,OAAAA;MAAOS,KAAKR;MAAcO,IAAImD;;EACzD;AACF,CAAA;AAEAF,SAASG,cAAcvE;",
6
6
  "names": ["DndContext", "restrictToVerticalAxis", "SortableContext", "arrayMove", "createContextScope", "Primitive", "omit", "React", "forwardRef", "LIST_NAME", "createListContext", "createListScope", "ListProvider", "useListContext", "List", "props", "forwardedRef", "__listScope", "variant", "selectable", "toggleOpenLabel", "children", "rootProps", "ListRoot", "ol", "ul", "role", "ref", "scope", "onDragEnd", "modifiers", "items", "listItemIds", "displayName", "useSortable", "CSS", "Collapsible", "useComposedRefs", "createContextScope", "Primitive", "Slot", "useControllableState", "React", "forwardRef", "useId", "_extends", "LIST_ITEM_NAME", "createListItemContext", "createListItemScope", "createContextScope", "ListItemProvider", "useListItemContext", "ListItemHeading", "forwardRef", "children", "asChild", "__listItemScope", "props", "forwardedRef", "headingId", "Root", "Slot", "Primitive", "p", "React", "id", "ref", "ListItemDragHandle", "draggableAttributes", "draggableListeners", "div", "role", "ListItemOpenTrigger", "Trigger", "ListItemCollapsibleContent", "Content", "PureListItem", "__listScope", "selected", "propsSelected", "defaultSelected", "onSelectedChange", "open", "propsOpen", "defaultOpen", "onOpenChange", "collapsible", "listItemProps", "selectable", "useListContext", "LIST_NAME", "setSelected", "useControllableState", "prop", "defaultProp", "onChange", "setOpen", "useId", "listItem", "li", "aria-labelledby", "scope", "DraggableListItem", "attributes", "listeners", "setNodeRef", "transform", "transition", "useSortable", "useComposedRefs", "style", "CSS", "Transform", "toString", "ListItem", "variant", "listItemId", "displayName"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/ui/primitives/react-list/src/List.tsx":{"bytes":8588,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/modifiers","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}]},"packages/ui/primitives/react-list/src/ListItem.tsx":{"bytes":19554,"imports":[{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@dnd-kit/utilities","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"packages/ui/primitives/react-list/src/List.tsx","kind":"import-statement","original":"./List"}]},"packages/ui/primitives/react-list/src/index.ts":{"bytes":456,"imports":[{"path":"packages/ui/primitives/react-list/src/List.tsx","kind":"import-statement","original":"./List"},{"path":"packages/ui/primitives/react-list/src/ListItem.tsx","kind":"import-statement","original":"./ListItem"}]}},"outputs":{"packages/ui/primitives/react-list/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15425},"packages/ui/primitives/react-list/dist/lib/browser/index.mjs":{"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/modifiers","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@dnd-kit/utilities","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true}],"exports":["LIST_ITEM_NAME","LIST_NAME","List","ListItem","ListItemCollapsibleContent","ListItemDragHandle","ListItemHeading","ListItemOpenTrigger","arrayMove","createListItemScope","createListScope","useListContext","useListItemContext"],"entryPoint":"packages/ui/primitives/react-list/src/index.ts","inputs":{"packages/ui/primitives/react-list/src/List.tsx":{"bytesInOutput":1963},"packages/ui/primitives/react-list/src/index.ts":{"bytesInOutput":0},"packages/ui/primitives/react-list/src/ListItem.tsx":{"bytesInOutput":4536}},"bytes":6890}}}
1
+ {"inputs":{"packages/ui/primitives/react-list/src/List.tsx":{"bytes":8588,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/modifiers","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}]},"packages/ui/primitives/react-list/src/ListItem.tsx":{"bytes":19718,"imports":[{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@dnd-kit/utilities","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"packages/ui/primitives/react-list/src/List.tsx","kind":"import-statement","original":"./List"}]},"packages/ui/primitives/react-list/src/index.ts":{"bytes":456,"imports":[{"path":"packages/ui/primitives/react-list/src/List.tsx","kind":"import-statement","original":"./List"},{"path":"packages/ui/primitives/react-list/src/ListItem.tsx","kind":"import-statement","original":"./ListItem"}]}},"outputs":{"packages/ui/primitives/react-list/dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15547},"packages/ui/primitives/react-list/dist/lib/browser/index.mjs":{"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/modifiers","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@dnd-kit/utilities","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true}],"exports":["LIST_ITEM_NAME","LIST_NAME","List","ListItem","ListItemCollapsibleContent","ListItemDragHandle","ListItemHeading","ListItemOpenTrigger","arrayMove","createListItemScope","createListScope","useListContext","useListItemContext"],"entryPoint":"packages/ui/primitives/react-list/src/index.ts","inputs":{"packages/ui/primitives/react-list/src/List.tsx":{"bytesInOutput":1963},"packages/ui/primitives/react-list/src/index.ts":{"bytesInOutput":0},"packages/ui/primitives/react-list/src/ListItem.tsx":{"bytesInOutput":4536}},"bytes":6890}}}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/index.ts", "../../../src/List.tsx", "../../../src/ListItem.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nexport * from './List';\nexport * from './ListItem';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DndContext, DragEndEvent } from '@dnd-kit/core';\nimport { restrictToVerticalAxis } from '@dnd-kit/modifiers';\nimport { SortableContext, arrayMove } from '@dnd-kit/sortable';\nimport { createContextScope, Scope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport omit from 'lodash.omit';\nimport React, { ComponentPropsWithRef, forwardRef, ReactHTMLElement } from 'react';\n\n// TODO(thure): A lot of the accessible affordances for this kind of thing need to be implemented per https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\nconst LIST_NAME = 'List';\n\ntype ListScopedProps<P> = P & { __listScope?: Scope };\n\ntype ListVariant = 'ordered' | 'unordered' | 'ordered-draggable';\n\ntype SharedListProps = {\n selectable?: boolean;\n variant?: ListVariant;\n onDragEnd?: (event: DragEndEvent) => void;\n listItemIds?: string[];\n toggleOpenLabel?: string | Omit<ReactHTMLElement<HTMLElement>, 'ref'>;\n};\n\ntype DraggableListProps = Omit<SharedListProps, 'slots'> & {\n onDragEnd: Exclude<SharedListProps['onDragEnd'], undefined>;\n listItemIds: Exclude<SharedListProps['listItemIds'], undefined>;\n variant: 'ordered-draggable';\n};\n\ntype ListProps =\n | (Omit<ComponentPropsWithRef<typeof Primitive.ol>, 'onDragEnd'> & SharedListProps)\n | (Omit<ComponentPropsWithRef<typeof Primitive.ol>, 'onDragEnd'> & DraggableListProps);\n\n// LIST\n\nconst [createListContext, createListScope] = createContextScope(LIST_NAME, []);\n\ntype ListContextValue = Pick<ListProps, 'selectable' | 'variant' | 'toggleOpenLabel'>;\n\nconst [ListProvider, useListContext] = createListContext<ListContextValue>(LIST_NAME);\n\nconst List = forwardRef<HTMLOListElement, ListProps>((props: ListScopedProps<ListProps>, forwardedRef) => {\n const {\n __listScope,\n variant = 'ordered',\n selectable = false,\n toggleOpenLabel = 'Expand/collapse item',\n children,\n ...rootProps\n } = props;\n const ListRoot = variant === 'ordered' || variant === 'ordered-draggable' ? Primitive.ol : Primitive.ul;\n return (\n <ListRoot\n {...(selectable && { role: 'listbox', 'aria-multiselectable': true })}\n {...omit(rootProps, 'onDragEnd', 'listItemIds')}\n ref={forwardedRef}\n >\n <ListProvider\n {...{\n scope: __listScope,\n variant,\n selectable,\n toggleOpenLabel,\n }}\n >\n {variant === 'ordered-draggable' ? (\n <DndContext onDragEnd={(props as DraggableListProps).onDragEnd} modifiers={[restrictToVerticalAxis]}>\n <SortableContext items={(props as DraggableListProps).listItemIds}>{children}</SortableContext>\n </DndContext>\n ) : (\n <>{children}</>\n )}\n </ListProvider>\n </ListRoot>\n );\n});\n\nList.displayName = LIST_NAME;\n\nexport { List, createListScope, useListContext, LIST_NAME, arrayMove };\n\nexport type { ListProps, ListVariant, ListScopedProps, DragEndEvent };\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DraggableAttributes } from '@dnd-kit/core';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport type { CheckboxProps } from '@radix-ui/react-checkbox';\nimport { CollapsibleTriggerProps } from '@radix-ui/react-collapsible';\nimport * as Collapsible from '@radix-ui/react-collapsible';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope, Scope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, { ComponentProps, ComponentPropsWithRef, Dispatch, forwardRef, SetStateAction } from 'react';\n\nimport { useId } from '@dxos/react-hooks';\n\nimport { LIST_NAME, ListScopedProps, useListContext } from './List';\n\nconst LIST_ITEM_NAME = 'ListItem';\n\ntype ListItemScopedProps<P> = P & { __listItemScope?: Scope };\n\ninterface ListItemData {\n id: string;\n selected?: CheckboxProps['checked'];\n open?: boolean;\n}\n\ntype ListItemProps = Omit<ListItemData, 'id'> & { collapsible?: boolean } & ComponentPropsWithRef<\n typeof Primitive.li\n > & {\n defaultOpen?: boolean;\n onOpenChange?: (nextOpen: boolean) => void;\n } & {\n onSelectedChange?: CheckboxProps['onCheckedChange'];\n defaultSelected?: CheckboxProps['defaultChecked'];\n };\n\ntype ListItemElement = React.ElementRef<typeof Primitive.li>;\n\nconst [createListItemContext, createListItemScope] = createContextScope(LIST_ITEM_NAME, []);\n\ntype DraggableListItemContextValue = {\n draggableAttributes: DraggableAttributes;\n draggableListeners: ReturnType<typeof useSortable>['listeners'];\n};\n\ntype ListItemContextValue = {\n headingId: string;\n open: boolean;\n selected: CheckboxProps['checked'];\n setSelected: Dispatch<SetStateAction<CheckboxProps['checked']>>;\n} & Partial<DraggableListItemContextValue>;\n\nconst [ListItemProvider, useListItemContext] = createListItemContext<ListItemContextValue>(LIST_ITEM_NAME);\n\ntype ListItemHeadingProps = ListItemScopedProps<Omit<ComponentPropsWithRef<typeof Primitive.p>, 'id'>> & {\n asChild?: boolean;\n};\n\nconst ListItemHeading = forwardRef<HTMLParagraphElement, ListItemHeadingProps>(\n ({ children, asChild, __listItemScope, ...props }, forwardedRef) => {\n const { headingId } = useListItemContext(LIST_ITEM_NAME, __listItemScope);\n const Root = asChild ? Slot : Primitive.p;\n return (\n <Root {...props} id={headingId} ref={forwardedRef}>\n {children}\n </Root>\n );\n },\n);\n\ntype ListItemDragHandleProps = ComponentPropsWithRef<typeof Primitive.div>;\n\nconst ListItemDragHandle = forwardRef<HTMLDivElement, ListItemScopedProps<ListItemDragHandleProps>>(\n ({ __listItemScope, children, ...props }, forwardedRef) => {\n const { draggableAttributes, draggableListeners } = useListItemContext(LIST_ITEM_NAME, __listItemScope);\n return (\n <div role='button' ref={forwardedRef} {...props} {...draggableAttributes} {...draggableListeners}>\n {children}\n </div>\n );\n },\n);\n\ntype ListItemOpenTriggerProps = ListItemScopedProps<CollapsibleTriggerProps>;\n\nconst ListItemOpenTrigger = Collapsible.Trigger;\n\ntype ListItemCollapsibleContentProps = ComponentProps<typeof Collapsible.Content>;\n\nconst ListItemCollapsibleContent = Collapsible.Content;\n\nconst PureListItem = forwardRef<\n ListItemElement,\n ListItemProps & { id: string } & Partial<DraggableListItemContextValue>\n>(\n (\n props: ListItemScopedProps<\n ListScopedProps<ListItemProps & { id: string } & Partial<DraggableListItemContextValue>>\n >,\n forwardedRef,\n ) => {\n const {\n __listScope,\n __listItemScope,\n children,\n selected: propsSelected,\n defaultSelected,\n onSelectedChange,\n open: propsOpen,\n defaultOpen,\n onOpenChange,\n collapsible,\n id,\n draggableAttributes,\n draggableListeners,\n ...listItemProps\n } = props;\n const { selectable } = useListContext(LIST_NAME, __listScope);\n\n const [selected = false, setSelected] = useControllableState({\n prop: propsSelected,\n defaultProp: defaultSelected,\n onChange: onSelectedChange,\n });\n\n const [open = false, setOpen] = useControllableState({\n prop: propsOpen,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const headingId = useId('listItem__heading');\n\n const listItem = (\n <Primitive.li\n {...listItemProps}\n id={id}\n ref={forwardedRef}\n aria-labelledby={headingId}\n {...(selectable && { role: 'option', 'aria-selected': !!selected })}\n >\n {children}\n </Primitive.li>\n );\n\n return (\n <ListItemProvider\n scope={__listItemScope}\n headingId={headingId}\n open={open}\n selected={selected}\n setSelected={setSelected}\n {...{ draggableAttributes, draggableListeners }}\n >\n {collapsible ? (\n <Collapsible.Root asChild open={open} onOpenChange={setOpen}>\n {listItem}\n </Collapsible.Root>\n ) : (\n listItem\n )}\n </ListItemProvider>\n );\n },\n);\n\nconst DraggableListItem = forwardRef<ListItemElement, ListItemProps & { id: string }>(\n (props: ListItemScopedProps<ListItemProps & { id: string }>, forwardedRef) => {\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({\n id: props.id,\n });\n const ref = useComposedRefs(forwardedRef, setNodeRef) as ComponentPropsWithRef<typeof Primitive.li>['ref'];\n\n return (\n <PureListItem\n {...props}\n style={{\n ...props.style,\n transform: CSS.Transform.toString(transform),\n transition,\n }}\n ref={ref}\n {...{\n draggableAttributes: attributes,\n draggableListeners: listeners,\n }}\n />\n );\n },\n);\n\nconst ListItem = forwardRef<ListItemElement, ListItemProps>((props: ListScopedProps<ListItemProps>, forwardedRef) => {\n const { variant } = useListContext(LIST_NAME, props.__listScope);\n const listItemId = useId('listItem', props.id);\n\n if (variant === 'ordered-draggable') {\n return <DraggableListItem {...props} ref={forwardedRef} id={listItemId} />;\n } else {\n return <PureListItem {...props} ref={forwardedRef} id={listItemId} />;\n }\n});\n\nListItem.displayName = LIST_ITEM_NAME;\n\nexport {\n ListItem,\n ListItemHeading,\n ListItemCollapsibleContent,\n ListItemDragHandle,\n ListItemOpenTrigger,\n createListItemScope,\n useListItemContext,\n LIST_ITEM_NAME,\n};\n\nexport type {\n ListItemProps,\n ListItemHeadingProps,\n ListItemCollapsibleContentProps,\n ListItemDragHandleProps,\n ListItemOpenTriggerProps,\n ListItemScopedProps,\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;ACIA,kBAAyC;AACzC,uBAAuC;AACvC,sBAA2C;AAC3C,2BAA0C;AAC1C,6BAA0B;AAC1B,oBAAiB;AACjB,mBAA2E;AAN3E,SAAA,WAAA;;;;;;;;;;;;;;AAUA,IAAMA,YAAY;AA0BlB,IAAM,CAACC,mBAAmBC,eAAAA,QAAmBC,yCAAmBH,WAAW,CAAA,CAAE;AAI7E,IAAM,CAACI,cAAcC,cAAAA,IAAkBJ,kBAAoCD,SAAAA;AAE3E,IAAMM,OAAOC,6CAAwC,CAACC,OAAmCC,iBAAiB;AACxG,QAAM,EACJC,aACAC,UAAU,WACVC,aAAa,OACbC,kBAAkB,wBAClBC,UACA,GAAGC,UAAAA,IACDP;AACJ,QAAMQ,WAAWL,YAAY,aAAaA,YAAY,sBAAsBM,iCAAUC,KAAKD,iCAAUE;AACrG,SACE,6BAAAC,QAAA,cAACJ,UAAAA,SAAAA,CAAAA,GACMJ,cAAc;IAAES,MAAM;IAAW,wBAAwB;EAAK,OAC/DC,cAAAA,SAAKP,WAAW,aAAa,aAAA,GAAA;IACjCQ,KAAKd;MAEL,6BAAAW,QAAA,cAAChB,cAAAA,SAAAA,CAAAA,GACK;IACFoB,OAAOd;IACPC;IACAC;IACAC;EACF,CAAA,GAECF,YAAY,sBACX,6BAAAS,QAAA,cAACK,wBAAAA;IAAWC,WAAYlB,MAA6BkB;IAAWC,WAAW;MAACC;;KAC1E,6BAAAR,QAAA,cAACS,iCAAAA;IAAgBC,O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D;MACTJ,WAAWK,qBAAIC,UAAUC,SAASP,SAAAA;MAClCC;IACF;IACAzC;KACI;IACFE,qBAAqBmC;IACrBlC,oBAAoBmC;EACtB,CAAA,CAAA;AAGN,CAAA;AAGF,IAAMU,WAAW7D,8CAA2C,CAACI,OAAuCC,iBAAiB;AACnH,QAAM,EAAEyD,QAAO,IAAK1B,eAAeC,WAAWjC,MAAMoB,WAAW;AAC/D,QAAMuC,iBAAanB,0BAAM,YAAYxC,MAAMQ,EAAE;AAE7C,MAAIkD,YAAY,qBAAqB;AACnC,WAAO,8BAAAnD,QAAA,cAACsC,mBAAAA,UAAAA,CAAAA,GAAsB7C,OAAAA;MAAOS,KAAKR;MAAcO,IAAImD;;EAC9D,OAAO;AACL,WAAO,8BAAApD,QAAA,cAACY,cAAAA,UAAAA,CAAAA,GAAiBnB,OAAAA;MAAOS,KAAKR;MAAcO,IAAImD;;EACzD;AACF,CAAA;AAEAF,SAASG,cAAcvE;",
4
+ "sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nexport * from './List';\nexport * from './ListItem';\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DndContext, DragEndEvent } from '@dnd-kit/core';\nimport { restrictToVerticalAxis } from '@dnd-kit/modifiers';\nimport { SortableContext, arrayMove } from '@dnd-kit/sortable';\nimport { createContextScope, Scope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport omit from 'lodash.omit';\nimport React, { ComponentPropsWithRef, forwardRef, ReactHTMLElement } from 'react';\n\n// TODO(thure): A lot of the accessible affordances for this kind of thing need to be implemented per https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/listbox_role\n\nconst LIST_NAME = 'List';\n\ntype ListScopedProps<P> = P & { __listScope?: Scope };\n\ntype ListVariant = 'ordered' | 'unordered' | 'ordered-draggable';\n\ntype SharedListProps = {\n selectable?: boolean;\n variant?: ListVariant;\n onDragEnd?: (event: DragEndEvent) => void;\n listItemIds?: string[];\n toggleOpenLabel?: string | Omit<ReactHTMLElement<HTMLElement>, 'ref'>;\n};\n\ntype DraggableListProps = Omit<SharedListProps, 'slots'> & {\n onDragEnd: Exclude<SharedListProps['onDragEnd'], undefined>;\n listItemIds: Exclude<SharedListProps['listItemIds'], undefined>;\n variant: 'ordered-draggable';\n};\n\ntype ListProps =\n | (Omit<ComponentPropsWithRef<typeof Primitive.ol>, 'onDragEnd'> & SharedListProps)\n | (Omit<ComponentPropsWithRef<typeof Primitive.ol>, 'onDragEnd'> & DraggableListProps);\n\n// LIST\n\nconst [createListContext, createListScope] = createContextScope(LIST_NAME, []);\n\ntype ListContextValue = Pick<ListProps, 'selectable' | 'variant' | 'toggleOpenLabel'>;\n\nconst [ListProvider, useListContext] = createListContext<ListContextValue>(LIST_NAME);\n\nconst List = forwardRef<HTMLOListElement, ListProps>((props: ListScopedProps<ListProps>, forwardedRef) => {\n const {\n __listScope,\n variant = 'ordered',\n selectable = false,\n toggleOpenLabel = 'Expand/collapse item',\n children,\n ...rootProps\n } = props;\n const ListRoot = variant === 'ordered' || variant === 'ordered-draggable' ? Primitive.ol : Primitive.ul;\n return (\n <ListRoot\n {...(selectable && { role: 'listbox', 'aria-multiselectable': true })}\n {...omit(rootProps, 'onDragEnd', 'listItemIds')}\n ref={forwardedRef}\n >\n <ListProvider\n {...{\n scope: __listScope,\n variant,\n selectable,\n toggleOpenLabel,\n }}\n >\n {variant === 'ordered-draggable' ? (\n <DndContext onDragEnd={(props as DraggableListProps).onDragEnd} modifiers={[restrictToVerticalAxis]}>\n <SortableContext items={(props as DraggableListProps).listItemIds}>{children}</SortableContext>\n </DndContext>\n ) : (\n <>{children}</>\n )}\n </ListProvider>\n </ListRoot>\n );\n});\n\nList.displayName = LIST_NAME;\n\nexport { List, createListScope, useListContext, LIST_NAME, arrayMove };\n\nexport type { ListProps, ListVariant, ListScopedProps, DragEndEvent };\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { DraggableAttributes } from '@dnd-kit/core';\nimport { useSortable } from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport type { CheckboxProps } from '@radix-ui/react-checkbox';\nimport { CollapsibleContentProps, CollapsibleTriggerProps } from '@radix-ui/react-collapsible';\nimport * as Collapsible from '@radix-ui/react-collapsible';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope, Scope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { Slot } from '@radix-ui/react-slot';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport React, {\n ComponentProps,\n ComponentPropsWithRef,\n Dispatch,\n forwardRef,\n ForwardRefExoticComponent,\n SetStateAction,\n} from 'react';\n\nimport { useId } from '@dxos/react-hooks';\n\nimport { LIST_NAME, ListScopedProps, useListContext } from './List';\n\nconst LIST_ITEM_NAME = 'ListItem';\n\ntype ListItemScopedProps<P> = P & { __listItemScope?: Scope };\n\ninterface ListItemData {\n id: string;\n selected?: CheckboxProps['checked'];\n open?: boolean;\n}\n\ntype ListItemProps = Omit<ListItemData, 'id'> & { collapsible?: boolean } & ComponentPropsWithRef<\n typeof Primitive.li\n > & {\n defaultOpen?: boolean;\n onOpenChange?: (nextOpen: boolean) => void;\n } & {\n onSelectedChange?: CheckboxProps['onCheckedChange'];\n defaultSelected?: CheckboxProps['defaultChecked'];\n };\n\ntype ListItemElement = React.ElementRef<typeof Primitive.li>;\n\nconst [createListItemContext, createListItemScope] = createContextScope(LIST_ITEM_NAME, []);\n\ntype DraggableListItemContextValue = {\n draggableAttributes: DraggableAttributes;\n draggableListeners: ReturnType<typeof useSortable>['listeners'];\n};\n\ntype ListItemContextValue = {\n headingId: string;\n open: boolean;\n selected: CheckboxProps['checked'];\n setSelected: Dispatch<SetStateAction<CheckboxProps['checked']>>;\n} & Partial<DraggableListItemContextValue>;\n\nconst [ListItemProvider, useListItemContext] = createListItemContext<ListItemContextValue>(LIST_ITEM_NAME);\n\ntype ListItemHeadingProps = ListItemScopedProps<Omit<ComponentPropsWithRef<typeof Primitive.p>, 'id'>> & {\n asChild?: boolean;\n};\n\nconst ListItemHeading = forwardRef<HTMLParagraphElement, ListItemHeadingProps>(\n ({ children, asChild, __listItemScope, ...props }, forwardedRef) => {\n const { headingId } = useListItemContext(LIST_ITEM_NAME, __listItemScope);\n const Root = asChild ? Slot : Primitive.p;\n return (\n <Root {...props} id={headingId} ref={forwardedRef}>\n {children}\n </Root>\n );\n },\n);\n\ntype ListItemDragHandleProps = ComponentPropsWithRef<typeof Primitive.div>;\n\nconst ListItemDragHandle = forwardRef<HTMLDivElement, ListItemScopedProps<ListItemDragHandleProps>>(\n ({ __listItemScope, children, ...props }, forwardedRef) => {\n const { draggableAttributes, draggableListeners } = useListItemContext(LIST_ITEM_NAME, __listItemScope);\n return (\n <div role='button' ref={forwardedRef} {...props} {...draggableAttributes} {...draggableListeners}>\n {children}\n </div>\n );\n },\n);\n\ntype ListItemOpenTriggerProps = ListItemScopedProps<CollapsibleTriggerProps>;\n\nconst ListItemOpenTrigger = Collapsible.Trigger;\n\ntype ListItemCollapsibleContentProps = ComponentProps<typeof Collapsible.Content>;\n\nconst ListItemCollapsibleContent: ForwardRefExoticComponent<CollapsibleContentProps> = Collapsible.Content;\n\nconst PureListItem = forwardRef<\n ListItemElement,\n ListItemProps & { id: string } & Partial<DraggableListItemContextValue>\n>(\n (\n props: ListItemScopedProps<\n ListScopedProps<ListItemProps & { id: string } & Partial<DraggableListItemContextValue>>\n >,\n forwardedRef,\n ) => {\n const {\n __listScope,\n __listItemScope,\n children,\n selected: propsSelected,\n defaultSelected,\n onSelectedChange,\n open: propsOpen,\n defaultOpen,\n onOpenChange,\n collapsible,\n id,\n draggableAttributes,\n draggableListeners,\n ...listItemProps\n } = props;\n const { selectable } = useListContext(LIST_NAME, __listScope);\n\n const [selected = false, setSelected] = useControllableState({\n prop: propsSelected,\n defaultProp: defaultSelected,\n onChange: onSelectedChange,\n });\n\n const [open = false, setOpen] = useControllableState({\n prop: propsOpen,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const headingId = useId('listItem__heading');\n\n const listItem = (\n <Primitive.li\n {...listItemProps}\n id={id}\n ref={forwardedRef}\n aria-labelledby={headingId}\n {...(selectable && { role: 'option', 'aria-selected': !!selected })}\n >\n {children}\n </Primitive.li>\n );\n\n return (\n <ListItemProvider\n scope={__listItemScope}\n headingId={headingId}\n open={open}\n selected={selected}\n setSelected={setSelected}\n {...{ draggableAttributes, draggableListeners }}\n >\n {collapsible ? (\n <Collapsible.Root asChild open={open} onOpenChange={setOpen}>\n {listItem}\n </Collapsible.Root>\n ) : (\n listItem\n )}\n </ListItemProvider>\n );\n },\n);\n\nconst DraggableListItem = forwardRef<ListItemElement, ListItemProps & { id: string }>(\n (props: ListItemScopedProps<ListItemProps & { id: string }>, forwardedRef) => {\n const { attributes, listeners, setNodeRef, transform, transition } = useSortable({\n id: props.id,\n });\n const ref = useComposedRefs(forwardedRef, setNodeRef) as ComponentPropsWithRef<typeof Primitive.li>['ref'];\n\n return (\n <PureListItem\n {...props}\n style={{\n ...props.style,\n transform: CSS.Transform.toString(transform),\n transition,\n }}\n ref={ref}\n {...{\n draggableAttributes: attributes,\n draggableListeners: listeners,\n }}\n />\n );\n },\n);\n\nconst ListItem = forwardRef<ListItemElement, ListItemProps>((props: ListScopedProps<ListItemProps>, forwardedRef) => {\n const { variant } = useListContext(LIST_NAME, props.__listScope);\n const listItemId = useId('listItem', props.id);\n\n if (variant === 'ordered-draggable') {\n return <DraggableListItem {...props} ref={forwardedRef} id={listItemId} />;\n } else {\n return <PureListItem {...props} ref={forwardedRef} id={listItemId} />;\n }\n});\n\nListItem.displayName = LIST_ITEM_NAME;\n\nexport {\n ListItem,\n ListItemHeading,\n ListItemCollapsibleContent,\n ListItemDragHandle,\n ListItemOpenTrigger,\n createListItemScope,\n useListItemContext,\n LIST_ITEM_NAME,\n};\n\nexport type {\n ListItemProps,\n ListItemHeadingProps,\n ListItemCollapsibleContentProps,\n ListItemDragHandle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AEyD,QAAO,IAAK1B,eAAeC,WAAWjC,MAAMoB,WAAW;AAC/D,QAAMuC,iBAAanB,0BAAM,YAAYxC,MAAMQ,EAAE;AAE7C,MAAIkD,YAAY,qBAAqB;AACnC,WAAO,8BAAAnD,QAAA,cAACsC,mBAAAA,UAAAA,CAAAA,GAAsB7C,OAAAA;MAAOS,KAAKR;MAAcO,IAAImD;;EAC9D,OAAO;AACL,WAAO,8BAAApD,QAAA,cAACY,cAAAA,UAAAA,CAAAA,GAAiBnB,OAAAA;MAAOS,KAAKR;MAAcO,IAAImD;;EACzD;AACF,CAAA;AAEAF,SAASG,cAAcvE;",
6
6
  "names": ["LIST_NAME", "createListContext", "createListScope", "createContextScope", "ListProvider", "useListContext", "List", "forwardRef", "props", "forwardedRef", "__listScope", "variant", "selectable", "toggleOpenLabel", "children", "rootProps", "ListRoot", "Primitive", "ol", "ul", "React", "role", "omit", "ref", "scope", "DndContext", "onDragEnd", "modifiers", "restrictToVerticalAxis", "SortableContext", "items", "listItemIds", "displayName", "import_sortable", "import_react_context", "import_react_primitive", "import_react", "_extends", "LIST_ITEM_NAME", "createListItemContext", "createListItemScope", "createContextScope", "ListItemProvider", "useListItemContext", "ListItemHeading", "forwardRef", "children", "asChild", "__listItemScope", "props", "forwardedRef", "headingId", "Root", "Slot", "Primitive", "p", "React", "id", "ref", "ListItemDragHandle", "draggableAttributes", "draggableListeners", "div", "role", "ListItemOpenTrigger", "Trigger", "ListItemCollapsibleContent", "Content", "PureListItem", "__listScope", "selected", "propsSelected", "defaultSelected", "onSelectedChange", "open", "propsOpen", "defaultOpen", "onOpenChange", "collapsible", "listItemProps", "selectable", "useListContext", "LIST_NAME", "setSelected", "useControllableState", "prop", "defaultProp", "onChange", "setOpen", "useId", "listItem", "li", "aria-labelledby", "scope", "DraggableListItem", "attributes", "listeners", "setNodeRef", "transform", "transition", "useSortable", "useComposedRefs", "style", "CSS", "Transform", "toString", "ListItem", "variant", "listItemId", "displayName"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"packages/ui/primitives/react-list/src/List.tsx":{"bytes":8588,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/modifiers","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}]},"packages/ui/primitives/react-list/src/ListItem.tsx":{"bytes":19554,"imports":[{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@dnd-kit/utilities","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"packages/ui/primitives/react-list/src/List.tsx","kind":"import-statement","original":"./List"}]},"packages/ui/primitives/react-list/src/index.ts":{"bytes":456,"imports":[{"path":"packages/ui/primitives/react-list/src/List.tsx","kind":"import-statement","original":"./List"},{"path":"packages/ui/primitives/react-list/src/ListItem.tsx","kind":"import-statement","original":"./ListItem"}]}},"outputs":{"packages/ui/primitives/react-list/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15423},"packages/ui/primitives/react-list/dist/lib/node/index.cjs":{"imports":[{"path":"@dnd-kit/core","kind":"require-call","external":true},{"path":"@dnd-kit/modifiers","kind":"require-call","external":true},{"path":"@dnd-kit/sortable","kind":"require-call","external":true},{"path":"@radix-ui/react-context","kind":"require-call","external":true},{"path":"@radix-ui/react-primitive","kind":"require-call","external":true},{"path":"lodash.omit","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"@dnd-kit/sortable","kind":"require-call","external":true},{"path":"@dnd-kit/utilities","kind":"require-call","external":true},{"path":"@radix-ui/react-collapsible","kind":"require-call","external":true},{"path":"@radix-ui/react-compose-refs","kind":"require-call","external":true},{"path":"@radix-ui/react-context","kind":"require-call","external":true},{"path":"@radix-ui/react-primitive","kind":"require-call","external":true},{"path":"@radix-ui/react-slot","kind":"require-call","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"@dxos/react-hooks","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/ui/primitives/react-list/src/index.ts","inputs":{"packages/ui/primitives/react-list/src/index.ts":{"bytesInOutput":641},"packages/ui/primitives/react-list/src/List.tsx":{"bytesInOutput":2228},"packages/ui/primitives/react-list/src/ListItem.tsx":{"bytesInOutput":5072}},"bytes":9859}}}
1
+ {"inputs":{"packages/ui/primitives/react-list/src/List.tsx":{"bytes":8588,"imports":[{"path":"@dnd-kit/core","kind":"import-statement","external":true},{"path":"@dnd-kit/modifiers","kind":"import-statement","external":true},{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"lodash.omit","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true}]},"packages/ui/primitives/react-list/src/ListItem.tsx":{"bytes":19718,"imports":[{"path":"@dnd-kit/sortable","kind":"import-statement","external":true},{"path":"@dnd-kit/utilities","kind":"import-statement","external":true},{"path":"@radix-ui/react-collapsible","kind":"import-statement","external":true},{"path":"@radix-ui/react-compose-refs","kind":"import-statement","external":true},{"path":"@radix-ui/react-context","kind":"import-statement","external":true},{"path":"@radix-ui/react-primitive","kind":"import-statement","external":true},{"path":"@radix-ui/react-slot","kind":"import-statement","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"import-statement","external":true},{"path":"react","kind":"import-statement","external":true},{"path":"@dxos/react-hooks","kind":"import-statement","external":true},{"path":"packages/ui/primitives/react-list/src/List.tsx","kind":"import-statement","original":"./List"}]},"packages/ui/primitives/react-list/src/index.ts":{"bytes":456,"imports":[{"path":"packages/ui/primitives/react-list/src/List.tsx","kind":"import-statement","original":"./List"},{"path":"packages/ui/primitives/react-list/src/ListItem.tsx","kind":"import-statement","original":"./ListItem"}]}},"outputs":{"packages/ui/primitives/react-list/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15546},"packages/ui/primitives/react-list/dist/lib/node/index.cjs":{"imports":[{"path":"@dnd-kit/core","kind":"require-call","external":true},{"path":"@dnd-kit/modifiers","kind":"require-call","external":true},{"path":"@dnd-kit/sortable","kind":"require-call","external":true},{"path":"@radix-ui/react-context","kind":"require-call","external":true},{"path":"@radix-ui/react-primitive","kind":"require-call","external":true},{"path":"lodash.omit","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"@dnd-kit/sortable","kind":"require-call","external":true},{"path":"@dnd-kit/utilities","kind":"require-call","external":true},{"path":"@radix-ui/react-collapsible","kind":"require-call","external":true},{"path":"@radix-ui/react-compose-refs","kind":"require-call","external":true},{"path":"@radix-ui/react-context","kind":"require-call","external":true},{"path":"@radix-ui/react-primitive","kind":"require-call","external":true},{"path":"@radix-ui/react-slot","kind":"require-call","external":true},{"path":"@radix-ui/react-use-controllable-state","kind":"require-call","external":true},{"path":"react","kind":"require-call","external":true},{"path":"@dxos/react-hooks","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/ui/primitives/react-list/src/index.ts","inputs":{"packages/ui/primitives/react-list/src/index.ts":{"bytesInOutput":641},"packages/ui/primitives/react-list/src/List.tsx":{"bytesInOutput":2228},"packages/ui/primitives/react-list/src/ListItem.tsx":{"bytesInOutput":5072}},"bytes":9859}}}
@@ -1,11 +1,11 @@
1
1
  import { DraggableAttributes } from '@dnd-kit/core';
2
2
  import { useSortable } from '@dnd-kit/sortable';
3
3
  import type { CheckboxProps } from '@radix-ui/react-checkbox';
4
- import { CollapsibleTriggerProps } from '@radix-ui/react-collapsible';
4
+ import { CollapsibleContentProps, CollapsibleTriggerProps } from '@radix-ui/react-collapsible';
5
5
  import * as Collapsible from '@radix-ui/react-collapsible';
6
6
  import { Scope } from '@radix-ui/react-context';
7
7
  import { Primitive } from '@radix-ui/react-primitive';
8
- import React, { ComponentProps, ComponentPropsWithRef, Dispatch, SetStateAction } from 'react';
8
+ import React, { ComponentProps, ComponentPropsWithRef, Dispatch, ForwardRefExoticComponent, SetStateAction } from 'react';
9
9
  declare const LIST_ITEM_NAME = "ListItem";
10
10
  type ListItemScopedProps<P> = P & {
11
11
  __listItemScope?: Scope;
@@ -49,7 +49,7 @@ declare const ListItemDragHandle: React.ForwardRefExoticComponent<Pick<ListItemS
49
49
  type ListItemOpenTriggerProps = ListItemScopedProps<CollapsibleTriggerProps>;
50
50
  declare const ListItemOpenTrigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
51
51
  type ListItemCollapsibleContentProps = ComponentProps<typeof Collapsible.Content>;
52
- declare const ListItemCollapsibleContent: React.ForwardRefExoticComponent<Collapsible.CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
52
+ declare const ListItemCollapsibleContent: ForwardRefExoticComponent<CollapsibleContentProps>;
53
53
  declare const ListItem: React.ForwardRefExoticComponent<Pick<ListItemProps, "key" | "asChild" | "selected" | "open" | keyof React.LiHTMLAttributes<HTMLLIElement> | "collapsible" | "defaultOpen" | "onOpenChange" | "onSelectedChange" | "defaultSelected"> & React.RefAttributes<HTMLLIElement>>;
54
54
  export { ListItem, ListItemHeading, ListItemCollapsibleContent, ListItemDragHandle, ListItemOpenTrigger, createListItemScope, useListItemContext, LIST_ITEM_NAME, };
55
55
  export type { ListItemProps, ListItemHeadingProps, ListItemCollapsibleContentProps, ListItemDragHandleProps, ListItemOpenTriggerProps, ListItemScopedProps, };
@@ -1 +1 @@
1
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,4QASZ,CAAC;AAIH,OAAO,EACL,QAAQ,EACR,eAAe,EACf,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,GACf,CAAC;AAEF,YAAY,EACV,aAAa,EACb,oBAAoB,EACpB,+BAA+B,EAC/B,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,GACpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/react-list",
3
- "version": "0.1.46-next.c3cc04c",
3
+ "version": "0.1.48-next.366bc83",
4
4
  "description": "List primitive components for React.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -27,7 +27,7 @@
27
27
  "@radix-ui/react-slot": "^1.0.1",
28
28
  "@radix-ui/react-use-controllable-state": "^1.0.0",
29
29
  "lodash.omit": "^4.5.0",
30
- "@dxos/react-hooks": "0.1.46-next.c3cc04c"
30
+ "@dxos/react-hooks": "0.1.48-next.366bc83"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@radix-ui/react-checkbox": "^1.0.3",
package/src/ListItem.tsx CHANGED
@@ -6,14 +6,21 @@ import { DraggableAttributes } from '@dnd-kit/core';
6
6
  import { useSortable } from '@dnd-kit/sortable';
7
7
  import { CSS } from '@dnd-kit/utilities';
8
8
  import type { CheckboxProps } from '@radix-ui/react-checkbox';
9
- import { CollapsibleTriggerProps } from '@radix-ui/react-collapsible';
9
+ import { CollapsibleContentProps, CollapsibleTriggerProps } from '@radix-ui/react-collapsible';
10
10
  import * as Collapsible from '@radix-ui/react-collapsible';
11
11
  import { useComposedRefs } from '@radix-ui/react-compose-refs';
12
12
  import { createContextScope, Scope } from '@radix-ui/react-context';
13
13
  import { Primitive } from '@radix-ui/react-primitive';
14
14
  import { Slot } from '@radix-ui/react-slot';
15
15
  import { useControllableState } from '@radix-ui/react-use-controllable-state';
16
- import React, { ComponentProps, ComponentPropsWithRef, Dispatch, forwardRef, SetStateAction } from 'react';
16
+ import React, {
17
+ ComponentProps,
18
+ ComponentPropsWithRef,
19
+ Dispatch,
20
+ forwardRef,
21
+ ForwardRefExoticComponent,
22
+ SetStateAction,
23
+ } from 'react';
17
24
 
18
25
  import { useId } from '@dxos/react-hooks';
19
26
 
@@ -92,7 +99,7 @@ const ListItemOpenTrigger = Collapsible.Trigger;
92
99
 
93
100
  type ListItemCollapsibleContentProps = ComponentProps<typeof Collapsible.Content>;
94
101
 
95
- const ListItemCollapsibleContent = Collapsible.Content;
102
+ const ListItemCollapsibleContent: ForwardRefExoticComponent<CollapsibleContentProps> = Collapsible.Content;
96
103
 
97
104
  const PureListItem = forwardRef<
98
105
  ListItemElement,