@dxos/react-list 0.1.23 → 0.1.45-next.45667d4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -22
- package/dist/lib/browser/index.mjs +147 -493
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +229 -0
- package/dist/lib/node/index.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -0
- package/dist/types/src/List.d.ts +42 -0
- package/dist/types/src/List.d.ts.map +1 -0
- package/dist/types/src/ListItem.d.ts +56 -0
- package/dist/types/src/ListItem.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/package.json +24 -18
- package/src/List.tsx +87 -0
- package/src/ListItem.tsx +228 -0
- package/src/index.ts +2 -2
- package/dist/types/src/components/List/List.d.ts +0 -8
- package/dist/types/src/components/List/List.d.ts.map +0 -1
- package/dist/types/src/components/List/List.stories.d.ts +0 -17
- package/dist/types/src/components/List/List.stories.d.ts.map +0 -1
- package/dist/types/src/components/List/index.d.ts +0 -2
- package/dist/types/src/components/List/index.d.ts.map +0 -1
- package/dist/types/src/components/ListPrimitive/ListPrimitive.d.ts +0 -55
- package/dist/types/src/components/ListPrimitive/ListPrimitive.d.ts.map +0 -1
- package/dist/types/src/components/ListPrimitive/ListPrimitive.stories.d.ts +0 -31
- package/dist/types/src/components/ListPrimitive/ListPrimitive.stories.d.ts.map +0 -1
- package/dist/types/src/components/ListPrimitive/index.d.ts +0 -2
- package/dist/types/src/components/ListPrimitive/index.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/dist/types/src/hooks/index.d.ts +0 -2
- package/dist/types/src/hooks/index.d.ts.map +0 -1
- package/dist/types/src/hooks/usePropStatefully.d.ts +0 -6
- package/dist/types/src/hooks/usePropStatefully.d.ts.map +0 -1
- package/dist/types/src/model.d.ts +0 -3
- package/dist/types/src/model.d.ts.map +0 -1
- package/src/components/List/List.stories.tsx +0 -123
- package/src/components/List/List.tsx +0 -111
- package/src/components/List/index.ts +0 -5
- package/src/components/ListPrimitive/ListPrimitive.stories.tsx +0 -41
- package/src/components/ListPrimitive/ListPrimitive.tsx +0 -474
- package/src/components/ListPrimitive/index.ts +0 -5
- package/src/components/index.ts +0 -5
- package/src/hooks/index.ts +0 -5
- package/src/hooks/usePropStatefully.ts +0 -33
- package/src/model.ts +0 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2022 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { Item, PublicKey, Space } from '@dxos/client';\nimport { ObjectModel } from '@dxos/object-model';\nimport { useSelection, useSpace } from '@dxos/react-client';\nimport { Loading, useTranslation } from '@dxos/react-components';\n\nimport { LIST_ITEM_TYPE } from '../../model';\nimport {\n ListPrimitive,\n ListAction,\n ListItems,\n isListItemChangedAction,\n isListItemDeletedAction,\n isListItemCreatedAction,\n ListItemProps,\n ListPrimitiveProps\n} from '../ListPrimitive';\n\ninterface ListLoadedProps {\n space: Space;\n list: Item<ObjectModel>;\n listItems: Item<ObjectModel>[];\n}\n\nexport interface ListProps {\n spaceKey: PublicKey;\n itemId: Item<ObjectModel>['id'];\n}\n\nconst ListLoaded = ({ space, list, listItems: propsListItems }: ListLoadedProps) => {\n const listItems = useSelection(list?.select().children().filter({ type: LIST_ITEM_TYPE })) ?? propsListItems;\n\n const onAction = useCallback(\n async (action: ListAction) => {\n if (isListItemDeletedAction(action)) {\n const subject = space.database.getItem(action.deleted.id);\n // TODO(thure): use Echo’s native deletion\n return subject?.model.set('annotations.deleted', true);\n } else if (isListItemCreatedAction(action)) {\n // do nothing?\n } else if (isListItemChangedAction(action)) {\n const subject = space.database.getItem(action.listItemId);\n return Promise.all(\n (Object.keys(action.next) as (keyof ListItemProps)[]).map((prop) => {\n return subject?.model.set(prop, action.next[prop]);\n })\n );\n } else {\n return Promise.all(\n (Object.keys(action.next) as (keyof ListPrimitiveProps)[]).map((prop) => {\n return list?.model.set(prop, action.next[prop]);\n })\n );\n }\n },\n [list, listItems]\n );\n\n const createListItemId = useCallback(async () => {\n const listItem = await space?.database.createItem({\n model: ObjectModel,\n type: LIST_ITEM_TYPE,\n parent: list.id\n });\n return listItem.id;\n }, [space]);\n\n return (\n <ListPrimitive\n {...{\n id: list.id,\n title: list.model.get('title') ?? '',\n description: list.model.get('description') ?? '',\n items: (listItems ?? [])\n // TODO(thure): use Echo’s native deletion\n .filter((item) => !item.model.get('annotations.deleted'))\n .reduce((acc: ListItems, item) => {\n acc[item.id] = {\n title: item.model.get('title'),\n description: item.model.get('description'),\n annotations: item.model.get('annotations')\n };\n return acc;\n }, {}),\n onChangePeriod: 640,\n onAction,\n createListItemId\n }}\n />\n );\n};\n\nexport const List = ({ spaceKey, itemId }: ListProps) => {\n const { t } = useTranslation('appkit');\n\n const space = useSpace(spaceKey);\n const list = (useSelection(space?.database.select({ id: itemId })) ?? [])[0];\n const listItems = useSelection(list?.select().children().filter({ type: LIST_ITEM_TYPE }));\n\n // TODO(thure): this should become `Suspense` when the above hooks support it\n return space && list && listItems ? (\n <ListLoaded {...{ space, list, listItems }} />\n ) : (\n <Loading label={t('generic loading label')} />\n );\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nexport const LIST_TYPE = 'dxos:type/list';\nexport const LIST_ITEM_TYPE = 'dxos:type/list-item';\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport debounce from 'lodash.debounce';\nimport { Minus, Plus } from 'phosphor-react';\nimport React, { ComponentProps, useCallback, useMemo, useState, KeyboardEvent } from 'react';\n\nimport {\n defaultFocus,\n Input,\n useTranslation,\n getSize,\n Button,\n randomString,\n defaultGroup,\n defaultHover,\n mx\n} from '@dxos/react-components';\n\nimport { usePropStatefully } from '../../hooks';\n\ntype ListId = string;\ntype ListItemId = string;\n\nexport interface ListItemProps {\n id: ListItemId;\n title?: string;\n description?: string;\n annotations?: Record<string, string | boolean>;\n}\n\nexport type ListItems = Record<ListItemId, Omit<ListItemProps, 'id'>>;\n\ninterface SharedListActionProps {\n listId: ListId;\n}\n\ninterface SharedListItemActionProps extends SharedListActionProps {\n listItemId: ListItemId;\n}\n\nexport interface ListItemChangedAction extends SharedListItemActionProps {\n next: Partial<ListItemProps>;\n}\n\nexport interface ListChangedAction extends SharedListActionProps {\n next: Partial<ListPrimitiveProps>;\n}\n\nexport interface ListItemCreatedAction extends SharedListActionProps {\n created: Pick<ListItemProps, 'id'> & Partial<Omit<ListItemProps, 'id'>>;\n}\n\nexport interface ListItemDeletedAction extends SharedListActionProps {\n deleted: Pick<ListItemProps, 'id'> & Partial<Omit<ListItemProps, 'id'>>;\n}\n\nexport type ListAction = ListItemChangedAction | ListChangedAction | ListItemCreatedAction | ListItemDeletedAction;\n\nexport const isListItemChangedAction = (o: any): o is ListItemChangedAction => 'listItemId' in o;\nexport const isListItemCreatedAction = (o: any): o is ListItemCreatedAction => 'created' in o;\nexport const isListItemDeletedAction = (o: any): o is ListItemDeletedAction => 'deleted' in o;\n\nexport interface ListPrimitiveProps {\n id: ListId;\n title?: string;\n description?: string;\n}\n\nexport interface ListPrimitiveComponentProps extends ListPrimitiveProps, Omit<ComponentProps<'div'>, 'id'> {\n items: ListItems;\n onAction?: (action: ListAction) => void;\n createListItemId?: () => Promise<ListItemId>;\n onChangePeriod?: number;\n}\n\nexport interface ListItemPrimitiveComponentProps extends ListItemProps, Omit<ComponentProps<'li'>, 'id' | 'title'> {\n updateItem: (item: ListItemProps) => void;\n updateOrder: (id: ListItemId, delta: number) => void;\n deleteItem: (id: ListItemId) => void;\n createItem: () => void;\n orderIndex: number;\n isLast?: boolean;\n autoFocus?: boolean;\n}\n\nconst defaultCreateListItemId = async () => randomString(8);\n\nconst ListItemPrimitive = ({\n id,\n title: propsTitle,\n description: propsDescription,\n annotations: propsAnnotations,\n updateItem,\n deleteItem,\n createItem,\n updateOrder,\n orderIndex,\n isLast,\n autoFocus\n}: ListItemPrimitiveComponentProps) => {\n const checkId = `${id}__checkbox`;\n const labelId = `${id}__title`;\n const descriptionId = `${id}__description`;\n\n const { t } = useTranslation('appkit');\n\n const rejectTextUpdatesWhenFocused = useCallback(\n (a: string, b: string) => {\n return document.activeElement?.getAttribute('data-itemid') === id ? true : a === b;\n },\n [id]\n );\n\n const [title, setTitle, titleSession] = usePropStatefully<string>(propsTitle ?? '', rejectTextUpdatesWhenFocused);\n\n const [description, _setDescription, _descriptionSession] = usePropStatefully<string>(\n propsDescription ?? '',\n rejectTextUpdatesWhenFocused\n );\n\n const [annotations, setAnnotations] = useState(propsAnnotations ?? {});\n const isDone = annotations?.state === 'done';\n\n const onChangeTitle = useCallback((nextValue: string) => {\n setTitle(nextValue);\n updateItem({ id, title: nextValue });\n }, []);\n\n const _onChangeDescription = useCallback((nextValue: string) => {\n _setDescription(nextValue);\n updateItem({ id, description: nextValue });\n }, []);\n\n const _onClickMoveUp = useCallback(() => {\n updateOrder(id, -1);\n }, [updateOrder, id]);\n const _onClickMoveDown = useCallback(() => {\n updateOrder(id, 1);\n }, [updateOrder, id]);\n\n const onChangeCheckbox = useCallback(() => {\n const nextAnnotations = { ...annotations, state: isDone ? 'init' : 'done' };\n setAnnotations(nextAnnotations);\n updateItem({ id, annotations: nextAnnotations });\n }, [annotations, isDone]);\n\n const onClickDelete = useCallback(() => {\n deleteItem(id);\n }, [deleteItem, id]);\n\n const onKeyUp = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n switch (e.key) {\n case 'Enter':\n if (!e.shiftKey) {\n if (isLast) {\n createItem();\n } else {\n (\n document.querySelector(`input[data-orderindex=\"${orderIndex + 1}\"]`) as HTMLElement | undefined\n )?.focus();\n }\n }\n break;\n case 'PageDown':\n (document.querySelector(`input[data-orderindex=\"${orderIndex + 1}\"]`) as HTMLElement | undefined)?.focus();\n break;\n case 'PageUp':\n (document.querySelector(`input[data-orderindex=\"${orderIndex - 1}\"]`) as HTMLElement | undefined)?.focus();\n break;\n }\n },\n [orderIndex, isLast]\n );\n\n const inputSlots = useMemo(\n () => ({\n root: { className: 'm-0' },\n input: {\n className: 'border-0 rounded',\n autoFocus: true,\n 'data-orderindex': orderIndex,\n 'data-itemid': id,\n onKeyUp\n }\n }),\n [orderIndex, id, onKeyUp]\n );\n\n return (\n <li\n key={id}\n className='flex items-center gap-2 pli-4 mbe-2'\n aria-labelledby={labelId}\n {...(description && { 'aria-describedby': descriptionId })}\n >\n <input\n {...{\n type: 'checkbox',\n id: checkId,\n ...(description && {\n 'aria-describedby': descriptionId\n }),\n className: mx(\n getSize(5),\n 'text-primary-600 bg-neutral-50 rounded-full border-neutral-300 dark:bg-neutral-800 dark:border-neutral-600 cursor-pointer',\n defaultFocus,\n defaultHover({})\n ),\n onChange: onChangeCheckbox,\n checked: isDone\n }}\n />\n <label htmlFor={checkId} id={labelId} className='sr-only'>\n {title}\n </label>\n <span id={descriptionId} className='sr-only'>\n {description}\n </span>\n <div role='none' className='grow'>\n <Input\n key={titleSession}\n label={t('list item title label')}\n placeholder={t('list item title placeholder')}\n labelVisuallyHidden\n initialValue={title}\n onChange={onChangeTitle}\n slots={inputSlots}\n />\n {/* TODO(thure): Re-enable this when descriptions become relevant */}\n {/* <Input */}\n {/* key={descriptionSession} */}\n {/* label={t('list item description label')} */}\n {/* placeholder={t('list item description placeholder')} */}\n {/* labelVisuallyHidden */}\n {/* initialValue={description} */}\n {/* onChange={onChangeDescription} */}\n {/* data-itemid={id} */}\n {/* /> */}\n </div>\n {/* TODO(thure): Restore these, or implement drag & drop, when how best to change order in Echo is clarified. */}\n {/* <ButtonGroup className='flex flex-col items-stretch'> */}\n {/* <Button compact rounding='rounded-bs-md border-be-0' disabled={isFirst} onClick={onClickMoveUp}> */}\n {/* <CaretUp /> */}\n {/* <span className='sr-only'>{t('move list item up label')}</span> */}\n {/* </Button> */}\n {/* <Button compact rounding='rounded-be-md' disabled={isLast} onClick={onClickMoveDown}> */}\n {/* <CaretDown /> */}\n {/* <span className='sr-only'>{t('move list item down label')}</span> */}\n {/* </Button> */}\n {/* </ButtonGroup> */}\n <Button onClick={onClickDelete} variant='ghost' className='p-1 self-stretch'>\n <Minus className={getSize(4)} />\n <span className='sr-only'>{t('delete list item label')}</span>\n </Button>\n </li>\n );\n};\n\nconst itemsEquivalent = (a: ListItems, b: ListItems) => {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n for (let i = 0; i < aKeys.length; i++) {\n const key = aKeys[i];\n if (key !== bKeys[i] || a[key].title !== b[key].title || a[key].annotations?.state !== b[key].annotations?.state) {\n return false;\n }\n }\n return true;\n};\n\nexport const ListPrimitive = ({\n id: listId,\n title: propsTitle,\n description: propsDescription,\n items: propsItems,\n onAction,\n createListItemId = defaultCreateListItemId,\n onChangePeriod = 0,\n ...divProps\n}: ListPrimitiveComponentProps) => {\n const { t } = useTranslation('appkit');\n\n const [creating, setCreating] = useState(false);\n const [autoFocus, setAutofocus] = useState<string | null>(null);\n\n const rejectTextUpdatesWhenFocused = useCallback(\n (a: string, b: string) => {\n return document.activeElement?.getAttribute('data-itemid') === listId ? true : a === b;\n },\n [listId]\n );\n\n // Title\n\n const titleId = `${listId}__title`;\n const [title, setTitle, titleSession] = usePropStatefully(propsTitle ?? '', rejectTextUpdatesWhenFocused);\n const propagateTitle = useCallback(\n (nextValue: string) => {\n return onAction?.({ listId, next: { title: nextValue } });\n },\n [onAction]\n );\n const debouncedPropagateTitle = useMemo(() => debounce(propagateTitle, onChangePeriod), [propagateTitle]);\n const onChangeTitle = useCallback(\n (nextValue: string) => {\n setTitle(nextValue);\n debouncedPropagateTitle(nextValue);\n },\n [onAction, listId]\n );\n\n // Description\n\n const descriptionId = `${listId}__description`;\n const [description, setDescription, _descriptionSession] = usePropStatefully(\n propsDescription ?? '',\n rejectTextUpdatesWhenFocused\n );\n const propagateDescription = useCallback(\n (nextValue: string) => onAction?.({ listId, next: { description: nextValue } }),\n [onAction]\n );\n const debouncedPropagateDescription = useMemo(\n () => debounce(propagateDescription, onChangePeriod),\n [propagateDescription]\n );\n const _onChangeDescription = useCallback(\n (nextValue: string) => {\n setDescription(nextValue);\n debouncedPropagateDescription(nextValue);\n },\n [onAction, listId]\n );\n\n // Items & order\n\n const [items, setItems, itemsSession] = usePropStatefully(propsItems ?? {}, itemsEquivalent);\n const order = Object.keys(items);\n\n const propagateItem = useCallback(\n ({ id, ...next }: Pick<ListItemProps, 'id'> & Partial<Omit<ListItemProps, 'id'>>) => {\n return onAction?.({ listId, listItemId: id, next });\n },\n [listId, onAction]\n );\n const debouncedPropagateItem = useMemo(() => debounce(propagateItem, onChangePeriod), [propagateItem]);\n const updateItem = useCallback(\n ({ id, ...next }: Pick<ListItemProps, 'id'> & Partial<Omit<ListItemProps, 'id'>>) => {\n setItems(Object.assign(items, { [id]: { ...items[id], ...next } }));\n 'title' in next && debouncedPropagateItem({ id, title: next.title });\n 'description' in next && debouncedPropagateItem({ id, description: next.description });\n 'annotations' in next && onAction?.({ listId, listItemId: id, next: { annotations: next.annotations } });\n },\n [items, listId, onAction]\n );\n\n const updateOrder = useCallback(\n (id: ListItemId, delta: number) => {\n const fromIndex = order.indexOf(id);\n const toIndex = fromIndex + delta;\n const nextOrder = Array.from(order);\n nextOrder.splice(fromIndex, 1);\n nextOrder.splice(toIndex, 0, id);\n const nextItems = nextOrder.reduce((acc: ListItems, listItemId) => {\n acc[listItemId] = items[listItemId];\n return acc;\n }, {});\n setItems(nextItems);\n onAction?.({ listId, next: {} });\n },\n [items, onAction]\n );\n\n const deleteItem = useCallback(\n (id: ListItemId) => {\n if (items[id]) {\n const { [id]: deletedItem, ...nextItems } = items;\n setItems(nextItems);\n onAction?.({ listId, next: {}, deleted: { id, ...deletedItem } });\n }\n },\n [items, onAction]\n );\n\n const createItem = useCallback(() => {\n setCreating(true);\n return createListItemId()\n .then((id) => {\n const next = {\n items: { ...items, [id]: {} }\n };\n const created = { id };\n setItems(next.items);\n setAutofocus(id);\n onAction?.({ listId, next: {}, created });\n })\n .finally(() => setCreating(false));\n }, [items, createListItemId, onAction]);\n\n // Render\n\n const inputSlots = useMemo(\n () => ({\n root: { className: 'mli-2 mbs-0 mbe-2' },\n input: {\n className: 'border-0 rounded text-xl font-display font-semibold',\n 'data-itemid': listId\n }\n }),\n [listId]\n );\n\n return (\n <div\n role='group'\n {...divProps}\n className={mx(defaultGroup({ elevation: 3, spacing: 'pbs-2 pbe-1' }), divProps.className)}\n aria-labelledby={titleId}\n {...(description && { 'aria-describedby': descriptionId })}\n >\n <span id={titleId} className='sr-only'>\n {title}\n </span>\n {description && (\n <span id={descriptionId} className='sr-only'>\n {description}\n </span>\n )}\n <Input\n key={titleSession}\n label={t('list title label')}\n placeholder={t('list title placeholder')}\n labelVisuallyHidden\n initialValue={title}\n onChange={onChangeTitle}\n slots={inputSlots}\n />\n {/* TODO(thure): Re-enable this when relevant */}\n {/* <Input */}\n {/* key={descriptionSession} */}\n {/* label={t('list description label')} */}\n {/* placeholder={t('list description placeholder')} */}\n {/* labelVisuallyHidden */}\n {/* initialValue={description} */}\n {/* onChange={onChangeDescription} */}\n {/* className='mli-4' */}\n {/* data-itemid={listId} */}\n {/* /> */}\n <ol className='contents'>\n {order.map((listItemId, index) => {\n return (\n <ListItemPrimitive\n key={`${itemsSession}__${listItemId}`}\n orderIndex={index}\n isLast={index === order.length - 1}\n {...{ id: listItemId, updateItem, updateOrder, deleteItem, createItem }}\n {...items[listItemId]}\n autoFocus={listItemId === autoFocus}\n />\n );\n })}\n </ol>\n <div role='none' className='mli-4 mlb-4'>\n <Button className='is-full' onClick={createItem} disabled={creating}>\n <Plus className={getSize(5)} />\n <span className='sr-only'>{t('add list item label')}</span>\n </Button>\n </div>\n </div>\n );\n};\n", "//\n// Copyright 2022 DXOS.org\n//\n\nimport { useEffect, useRef, useState, Dispatch, SetStateAction } from 'react';\n\nimport { randomString } from '@dxos/react-components';\n\nconst isEqual = <T>(a: T, b: T) => a === b;\n\n/**\n * @deprecated\n */\nexport const usePropStatefully = <T>(\n propsValue: T,\n equivalentPredicate?: (a: T, b: T) => boolean\n): [T, Dispatch<SetStateAction<T>>, string] => {\n const [value, setValue] = useState<T>(propsValue);\n const [valueSession, setValueSession] = useState(randomString());\n const mounted = useRef(false);\n const predicate = equivalentPredicate ?? isEqual<T>;\n\n useEffect(() => {\n if (mounted.current && !predicate(propsValue, value)) {\n setValue(propsValue);\n setValueSession(randomString());\n } else {\n mounted.current = true;\n }\n }, [propsValue]);\n\n return [value, setValue, valueSession];\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,OAAOA,UAASC,eAAAA,oBAAmB;AAGnC,SAASC,mBAAmB;AAC5B,SAASC,cAAcC,gBAAgB;AACvC,SAASC,SAASC,kBAAAA,uBAAsB;;;ACLjC,IAAMC,YAAY;AAClB,IAAMC,iBAAiB;;;ACD9B,OAAOC,cAAc;AACrB,SAASC,OAAOC,YAAY;AAC5B,OAAOC,SAAyBC,aAAaC,SAASC,YAAAA,iBAA+B;AAErF,SACEC,cACAC,OACAC,gBACAC,SACAC,QACAC,gBAAAA,eACAC,cACAC,cACAC,UACK;;;ACdP,SAASC,WAAWC,QAAQC,gBAA0C;AAEtE,SAASC,oBAAoB;AAE7B,IAAMC,UAAU,CAAIC,GAAMC,MAASD,MAAMC;AAKlC,IAAMC,oBAAoB,CAC/BC,YACAC,wBAC6C;AAC7C,QAAM,CAACC,OAAOC,QAAAA,IAAYT,SAAYM,UAAAA;AACtC,QAAM,CAACI,cAAcC,eAAAA,IAAmBX,SAASC,aAAAA,CAAAA;AACjD,QAAMW,UAAUb,OAAO,KAAK;AAC5B,QAAMc,YAAYN,oDAAuBL;AAEzCJ,YAAU,MAAM;AACd,QAAIc,QAAQE,WAAW,CAACD,UAAUP,YAAYE,KAAAA,GAAQ;AACpDC,eAASH,UAAAA;AACTK,sBAAgBV,aAAAA,CAAAA;IAClB,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MoB,IAAI,OAAA,MAAftC,YAA2B;IAClCuC,cAAavC,UAAKkB,MAAMoB,IAAI,aAAA,MAAftC,YAAiC;IAC9CwC,QAAQvC,gCAAa,CAAA,GAEpBK,OAAO,CAACmC,SAAS,CAACA,KAAKvB,MAAMoB,IAAI,qBAAA,CAAA,EACjCI,OAAO,CAACC,KAAgBF,SAAS;AAChCE,UAAIF,KAAKxB,EAAE,IAAI;QACboB,OAAOI,KAAKvB,MAAMoB,IAAI,OAAA;QACtBC,aAAaE,KAAKvB,MAAMoB,IAAI,aAAA;QAC5BM,aAAaH,KAAKvB,MAAMoB,IAAI,aAAA;MAC9B;AACA,aAAOK;IACT,GAAG,CAAC,CAAA;IACNE,gBAAgB;IAChBpC;IACAqB;EACF,CAAA,CAAA;AAGF;AAEG,IAAMgB,OAAO,CAAC,EAAEC,UAAUC,OAAM,MAAkB;AAjGvD;AAkGA,QAAM,EAAEC,EAAC,IAAKC,gBAAe,QAAA;AAE7B,QAAMnD,QAAQoD,SAASJ,QAAAA;AACvB,QAAM/C,SAAQG,kBAAaJ,+BAAOe,SAASV,OAAO;IAAEa,IAAI+B;EAAO,EAAA,MAAjD7C,YAAwD,CAAA,GAAI,CAAA;AAC1E,QAAMF,YAAYE,aAAaH,6BAAMI,SAASC,WAAWC,OAAO;IAAEC,MAAMC;EAAe,EAAA;AAGvF,SAAOT,SAASC,QAAQC,YACtB,gBAAAkC,OAAA,cAACrC,YAAAA,UAAAA,CAAAA,GAAe;IAAEC;IAAOC;IAAMC;EAAU,CAAA,CAAA,IAEzC,gBAAAkC,OAAA,cAACiB,SAAAA;IAAQC,OAAOJ,EAAE,uBAAA;;AAElB;",
|
|
6
|
-
"names": ["
|
|
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,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,WAAW,aAAa,aAAA,GAAA;IACjCK,KAAKX;MAEL,sBAAA,cAACJ,cAAAA,SAAAA,CAAAA,GACK;IACFgB,OAAOX;IACPC;I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,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
|
+
"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/
|
|
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}}}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/ui/primitives/react-list/src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
LIST_ITEM_NAME: () => LIST_ITEM_NAME,
|
|
34
|
+
LIST_NAME: () => LIST_NAME,
|
|
35
|
+
List: () => List,
|
|
36
|
+
ListItem: () => ListItem,
|
|
37
|
+
ListItemCollapsibleContent: () => ListItemCollapsibleContent,
|
|
38
|
+
ListItemDragHandle: () => ListItemDragHandle,
|
|
39
|
+
ListItemHeading: () => ListItemHeading,
|
|
40
|
+
ListItemOpenTrigger: () => ListItemOpenTrigger,
|
|
41
|
+
arrayMove: () => import_sortable.arrayMove,
|
|
42
|
+
createListItemScope: () => createListItemScope,
|
|
43
|
+
createListScope: () => createListScope,
|
|
44
|
+
useListContext: () => useListContext,
|
|
45
|
+
useListItemContext: () => useListItemContext
|
|
46
|
+
});
|
|
47
|
+
module.exports = __toCommonJS(src_exports);
|
|
48
|
+
|
|
49
|
+
// packages/ui/primitives/react-list/src/List.tsx
|
|
50
|
+
var import_core = require("@dnd-kit/core");
|
|
51
|
+
var import_modifiers = require("@dnd-kit/modifiers");
|
|
52
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
53
|
+
var import_react_context = require("@radix-ui/react-context");
|
|
54
|
+
var import_react_primitive = require("@radix-ui/react-primitive");
|
|
55
|
+
var import_lodash = __toESM(require("lodash.omit"));
|
|
56
|
+
var import_react = __toESM(require("react"));
|
|
57
|
+
function _extends() {
|
|
58
|
+
_extends = Object.assign || function(target) {
|
|
59
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
60
|
+
var source = arguments[i];
|
|
61
|
+
for (var key in source) {
|
|
62
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
63
|
+
target[key] = source[key];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return target;
|
|
68
|
+
};
|
|
69
|
+
return _extends.apply(this, arguments);
|
|
70
|
+
}
|
|
71
|
+
var LIST_NAME = "List";
|
|
72
|
+
var [createListContext, createListScope] = (0, import_react_context.createContextScope)(LIST_NAME, []);
|
|
73
|
+
var [ListProvider, useListContext] = createListContext(LIST_NAME);
|
|
74
|
+
var List = /* @__PURE__ */ (0, import_react.forwardRef)((props, forwardedRef) => {
|
|
75
|
+
const { __listScope, variant = "ordered", selectable = false, toggleOpenLabel = "Expand/collapse item", children, ...rootProps } = props;
|
|
76
|
+
const ListRoot = variant === "ordered" || variant === "ordered-draggable" ? import_react_primitive.Primitive.ol : import_react_primitive.Primitive.ul;
|
|
77
|
+
return /* @__PURE__ */ import_react.default.createElement(ListRoot, _extends({}, selectable && {
|
|
78
|
+
role: "listbox",
|
|
79
|
+
"aria-multiselectable": true
|
|
80
|
+
}, (0, import_lodash.default)(rootProps, "onDragEnd", "listItemIds"), {
|
|
81
|
+
ref: forwardedRef
|
|
82
|
+
}), /* @__PURE__ */ import_react.default.createElement(ListProvider, _extends({}, {
|
|
83
|
+
scope: __listScope,
|
|
84
|
+
variant,
|
|
85
|
+
selectable,
|
|
86
|
+
toggleOpenLabel
|
|
87
|
+
}), variant === "ordered-draggable" ? /* @__PURE__ */ import_react.default.createElement(import_core.DndContext, {
|
|
88
|
+
onDragEnd: props.onDragEnd,
|
|
89
|
+
modifiers: [
|
|
90
|
+
import_modifiers.restrictToVerticalAxis
|
|
91
|
+
]
|
|
92
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_sortable.SortableContext, {
|
|
93
|
+
items: props.listItemIds
|
|
94
|
+
}, children)) : /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, children)));
|
|
95
|
+
});
|
|
96
|
+
List.displayName = LIST_NAME;
|
|
97
|
+
|
|
98
|
+
// packages/ui/primitives/react-list/src/ListItem.tsx
|
|
99
|
+
var import_sortable2 = require("@dnd-kit/sortable");
|
|
100
|
+
var import_utilities = require("@dnd-kit/utilities");
|
|
101
|
+
var Collapsible = __toESM(require("@radix-ui/react-collapsible"));
|
|
102
|
+
var import_react_compose_refs = require("@radix-ui/react-compose-refs");
|
|
103
|
+
var import_react_context2 = require("@radix-ui/react-context");
|
|
104
|
+
var import_react_primitive2 = require("@radix-ui/react-primitive");
|
|
105
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
106
|
+
var import_react_use_controllable_state = require("@radix-ui/react-use-controllable-state");
|
|
107
|
+
var import_react2 = __toESM(require("react"));
|
|
108
|
+
var import_react_hooks = require("@dxos/react-hooks");
|
|
109
|
+
function _extends2() {
|
|
110
|
+
_extends2 = Object.assign || function(target) {
|
|
111
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
112
|
+
var source = arguments[i];
|
|
113
|
+
for (var key in source) {
|
|
114
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
115
|
+
target[key] = source[key];
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return target;
|
|
120
|
+
};
|
|
121
|
+
return _extends2.apply(this, arguments);
|
|
122
|
+
}
|
|
123
|
+
var LIST_ITEM_NAME = "ListItem";
|
|
124
|
+
var [createListItemContext, createListItemScope] = (0, import_react_context2.createContextScope)(LIST_ITEM_NAME, []);
|
|
125
|
+
var [ListItemProvider, useListItemContext] = createListItemContext(LIST_ITEM_NAME);
|
|
126
|
+
var ListItemHeading = /* @__PURE__ */ (0, import_react2.forwardRef)(({ children, asChild, __listItemScope, ...props }, forwardedRef) => {
|
|
127
|
+
const { headingId } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
128
|
+
const Root2 = asChild ? import_react_slot.Slot : import_react_primitive2.Primitive.p;
|
|
129
|
+
return /* @__PURE__ */ import_react2.default.createElement(Root2, _extends2({}, props, {
|
|
130
|
+
id: headingId,
|
|
131
|
+
ref: forwardedRef
|
|
132
|
+
}), children);
|
|
133
|
+
});
|
|
134
|
+
var ListItemDragHandle = /* @__PURE__ */ (0, import_react2.forwardRef)(({ __listItemScope, children, ...props }, forwardedRef) => {
|
|
135
|
+
const { draggableAttributes, draggableListeners } = useListItemContext(LIST_ITEM_NAME, __listItemScope);
|
|
136
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", _extends2({
|
|
137
|
+
role: "button",
|
|
138
|
+
ref: forwardedRef
|
|
139
|
+
}, props, draggableAttributes, draggableListeners), children);
|
|
140
|
+
});
|
|
141
|
+
var ListItemOpenTrigger = Collapsible.Trigger;
|
|
142
|
+
var ListItemCollapsibleContent = Collapsible.Content;
|
|
143
|
+
var PureListItem = /* @__PURE__ */ (0, import_react2.forwardRef)((props, forwardedRef) => {
|
|
144
|
+
const { __listScope, __listItemScope, children, selected: propsSelected, defaultSelected, onSelectedChange, open: propsOpen, defaultOpen, onOpenChange, collapsible, id, draggableAttributes, draggableListeners, ...listItemProps } = props;
|
|
145
|
+
const { selectable } = useListContext(LIST_NAME, __listScope);
|
|
146
|
+
const [selected = false, setSelected] = (0, import_react_use_controllable_state.useControllableState)({
|
|
147
|
+
prop: propsSelected,
|
|
148
|
+
defaultProp: defaultSelected,
|
|
149
|
+
onChange: onSelectedChange
|
|
150
|
+
});
|
|
151
|
+
const [open = false, setOpen] = (0, import_react_use_controllable_state.useControllableState)({
|
|
152
|
+
prop: propsOpen,
|
|
153
|
+
defaultProp: defaultOpen,
|
|
154
|
+
onChange: onOpenChange
|
|
155
|
+
});
|
|
156
|
+
const headingId = (0, import_react_hooks.useId)("listItem__heading");
|
|
157
|
+
const listItem = /* @__PURE__ */ import_react2.default.createElement(import_react_primitive2.Primitive.li, _extends2({}, listItemProps, {
|
|
158
|
+
id,
|
|
159
|
+
ref: forwardedRef,
|
|
160
|
+
"aria-labelledby": headingId
|
|
161
|
+
}, selectable && {
|
|
162
|
+
role: "option",
|
|
163
|
+
"aria-selected": !!selected
|
|
164
|
+
}), children);
|
|
165
|
+
return /* @__PURE__ */ import_react2.default.createElement(ListItemProvider, _extends2({
|
|
166
|
+
scope: __listItemScope,
|
|
167
|
+
headingId,
|
|
168
|
+
open,
|
|
169
|
+
selected,
|
|
170
|
+
setSelected
|
|
171
|
+
}, {
|
|
172
|
+
draggableAttributes,
|
|
173
|
+
draggableListeners
|
|
174
|
+
}), collapsible ? /* @__PURE__ */ import_react2.default.createElement(Collapsible.Root, {
|
|
175
|
+
asChild: true,
|
|
176
|
+
open,
|
|
177
|
+
onOpenChange: setOpen
|
|
178
|
+
}, listItem) : listItem);
|
|
179
|
+
});
|
|
180
|
+
var DraggableListItem = /* @__PURE__ */ (0, import_react2.forwardRef)((props, forwardedRef) => {
|
|
181
|
+
const { attributes, listeners, setNodeRef, transform, transition } = (0, import_sortable2.useSortable)({
|
|
182
|
+
id: props.id
|
|
183
|
+
});
|
|
184
|
+
const ref = (0, import_react_compose_refs.useComposedRefs)(forwardedRef, setNodeRef);
|
|
185
|
+
return /* @__PURE__ */ import_react2.default.createElement(PureListItem, _extends2({}, props, {
|
|
186
|
+
style: {
|
|
187
|
+
...props.style,
|
|
188
|
+
transform: import_utilities.CSS.Transform.toString(transform),
|
|
189
|
+
transition
|
|
190
|
+
},
|
|
191
|
+
ref
|
|
192
|
+
}, {
|
|
193
|
+
draggableAttributes: attributes,
|
|
194
|
+
draggableListeners: listeners
|
|
195
|
+
}));
|
|
196
|
+
});
|
|
197
|
+
var ListItem = /* @__PURE__ */ (0, import_react2.forwardRef)((props, forwardedRef) => {
|
|
198
|
+
const { variant } = useListContext(LIST_NAME, props.__listScope);
|
|
199
|
+
const listItemId = (0, import_react_hooks.useId)("listItem", props.id);
|
|
200
|
+
if (variant === "ordered-draggable") {
|
|
201
|
+
return /* @__PURE__ */ import_react2.default.createElement(DraggableListItem, _extends2({}, props, {
|
|
202
|
+
ref: forwardedRef,
|
|
203
|
+
id: listItemId
|
|
204
|
+
}));
|
|
205
|
+
} else {
|
|
206
|
+
return /* @__PURE__ */ import_react2.default.createElement(PureListItem, _extends2({}, props, {
|
|
207
|
+
ref: forwardedRef,
|
|
208
|
+
id: listItemId
|
|
209
|
+
}));
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
ListItem.displayName = LIST_ITEM_NAME;
|
|
213
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
214
|
+
0 && (module.exports = {
|
|
215
|
+
LIST_ITEM_NAME,
|
|
216
|
+
LIST_NAME,
|
|
217
|
+
List,
|
|
218
|
+
ListItem,
|
|
219
|
+
ListItemCollapsibleContent,
|
|
220
|
+
ListItemDragHandle,
|
|
221
|
+
ListItemHeading,
|
|
222
|
+
ListItemOpenTrigger,
|
|
223
|
+
arrayMove,
|
|
224
|
+
createListItemScope,
|
|
225
|
+
createListScope,
|
|
226
|
+
useListContext,
|
|
227
|
+
useListItemContext
|
|
228
|
+
});
|
|
229
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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,WA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AC9D,OAAO;AACL,WAAO,8BAAApD,QAAA,cAACY,cAAAA,UAAAA,CAAAA,GAAiBnB,OAAAA;MAAOS,KAAKR;MAAcO,IAAImD;;EACzD;AACF,CAAA;AAEAF,SAASG,cAAcvE;",
|
|
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
|
+
}
|
|
@@ -0,0 +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}}}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DragEndEvent } from '@dnd-kit/core';
|
|
2
|
+
import { arrayMove } from '@dnd-kit/sortable';
|
|
3
|
+
import { Scope } from '@radix-ui/react-context';
|
|
4
|
+
import { Primitive } from '@radix-ui/react-primitive';
|
|
5
|
+
import React, { ComponentPropsWithRef, ReactHTMLElement } from 'react';
|
|
6
|
+
declare const LIST_NAME = "List";
|
|
7
|
+
type ListScopedProps<P> = P & {
|
|
8
|
+
__listScope?: Scope;
|
|
9
|
+
};
|
|
10
|
+
type ListVariant = 'ordered' | 'unordered' | 'ordered-draggable';
|
|
11
|
+
type SharedListProps = {
|
|
12
|
+
selectable?: boolean;
|
|
13
|
+
variant?: ListVariant;
|
|
14
|
+
onDragEnd?: (event: DragEndEvent) => void;
|
|
15
|
+
listItemIds?: string[];
|
|
16
|
+
toggleOpenLabel?: string | Omit<ReactHTMLElement<HTMLElement>, 'ref'>;
|
|
17
|
+
};
|
|
18
|
+
type DraggableListProps = Omit<SharedListProps, 'slots'> & {
|
|
19
|
+
onDragEnd: Exclude<SharedListProps['onDragEnd'], undefined>;
|
|
20
|
+
listItemIds: Exclude<SharedListProps['listItemIds'], undefined>;
|
|
21
|
+
variant: 'ordered-draggable';
|
|
22
|
+
};
|
|
23
|
+
type ListProps = (Omit<ComponentPropsWithRef<typeof Primitive.ol>, 'onDragEnd'> & SharedListProps) | (Omit<ComponentPropsWithRef<typeof Primitive.ol>, 'onDragEnd'> & DraggableListProps);
|
|
24
|
+
declare const createListScope: import("@radix-ui/react-context").CreateScope;
|
|
25
|
+
type ListContextValue = Pick<ListProps, 'selectable' | 'variant' | 'toggleOpenLabel'>;
|
|
26
|
+
declare const useListContext: (consumerName: string, scope: Scope<ListContextValue | undefined>) => ListContextValue;
|
|
27
|
+
declare const List: React.ForwardRefExoticComponent<(Pick<Omit<Pick<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "key" | keyof React.OlHTMLAttributes<HTMLOListElement>> & {
|
|
28
|
+
ref?: ((instance: HTMLOListElement | null) => void) | React.RefObject<HTMLOListElement> | null | undefined;
|
|
29
|
+
} & {
|
|
30
|
+
asChild?: boolean | undefined;
|
|
31
|
+
}, "onDragEnd"> & SharedListProps, "type" | "key" | keyof SharedListProps | "slot" | "style" | "title" | "reversed" | "start" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "asChild"> | Pick<Omit<Pick<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "key" | keyof React.OlHTMLAttributes<HTMLOListElement>> & {
|
|
32
|
+
ref?: ((instance: HTMLOListElement | null) => void) | React.RefObject<HTMLOListElement> | null | undefined;
|
|
33
|
+
} & {
|
|
34
|
+
asChild?: boolean | undefined;
|
|
35
|
+
}, "onDragEnd"> & Omit<SharedListProps, "slots"> & {
|
|
36
|
+
onDragEnd: Exclude<SharedListProps['onDragEnd'], undefined>;
|
|
37
|
+
listItemIds: Exclude<SharedListProps['listItemIds'], undefined>;
|
|
38
|
+
variant: 'ordered-draggable';
|
|
39
|
+
}, "type" | "key" | keyof SharedListProps | "slot" | "style" | "title" | "reversed" | "start" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "asChild">) & React.RefAttributes<HTMLOListElement>>;
|
|
40
|
+
export { List, createListScope, useListContext, LIST_NAME, arrayMove };
|
|
41
|
+
export type { ListProps, ListVariant, ListScopedProps, DragEndEvent };
|
|
42
|
+
//# sourceMappingURL=List.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.d.ts","sourceRoot":"","sources":["../../../src/List.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAc,YAAY,EAAE,MAAM,eAAe,CAAC;AAEzD,OAAO,EAAmB,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAsB,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,KAAK,EAAE,EAAE,qBAAqB,EAAc,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAInF,QAAA,MAAM,SAAS,SAAS,CAAC;AAEzB,KAAK,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;A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