@@ -34,64 +35,67 @@ const MultiSortableSelectDropIndicator = ({ position }: { position: 'before' | '
export type SortableMultiSelectInputProps =
& {
- field: SugaredRelativeEntityList['field']
- sortableBy: SugaredRelativeSingleField['field']
- connectAt: SugaredRelativeSingleEntity['field']
- children: ReactNode
- options?: SugaredQualifiedEntityList['entities']
- placeholder?: ReactNode
- createNewForm?: ReactNode
- queryField?: DataViewUnionFilterFields
- }
+ field: SugaredRelativeEntityList['field']
+ sortableBy: SugaredRelativeSingleField['field']
+ connectAt: SugaredRelativeSingleEntity['field']
+ children: ReactNode
+ options?: SugaredQualifiedEntityList['entities']
+ placeholder?: ReactNode
+ createNewForm?: ReactNode
+ queryField?: DataViewUnionFilterFields
+}
export const SortableMultiSelectInput = Component
(({ field, queryField, options, children, sortableBy, connectAt, placeholder, createNewForm }) => {
+ const id = useFormFieldId()
return (
-
-
-
- {placeholder ?? }
-
+
+
+
+
+ {placeholder ?? }
+
-
-
-
-
-
-
-
-
-
- {children}
-
-
+
+
+
+
+
+
+
+
+
+ {children}
+
+
-
- e.stopPropagation()} />
-
-
-
-
-
-
-
+
+ e.stopPropagation()} />
+
+
+
+
+
+
+
-
-
-
- {children}
-
-
-
-
+
+
+
+ {children}
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
@@ -114,7 +118,7 @@ export const SortableMultiSelectInput = Component
)}
-)
+ )
}, ({ children, field, sortableBy, connectAt, options }) => {
return (
diff --git a/packages/playground/admin/lib/components/select/ui.tsx b/packages/playground/admin/lib/components/select/ui.tsx
index 2034bb49a..421987ed0 100644
--- a/packages/playground/admin/lib/components/select/ui.tsx
+++ b/packages/playground/admin/lib/components/select/ui.tsx
@@ -1,16 +1,35 @@
import { uic } from '../../../lib/utils/uic'
-import { InputLike } from '../ui/input'
import { Button } from '../ui/button'
import * as React from 'react'
+import { forwardRef } from 'react'
import { CheckIcon, PlusIcon, XIcon } from 'lucide-react'
import { PopoverContent } from '../ui/popover'
import { dict } from '../../../lib/dict'
-import { forwardRef } from 'react'
-export const SelectInputUI = uic(InputLike, {
- baseClass: 'cursor-pointer hover:border-gray-400 relative flex gap-2 flex-wrap py-1 pr-6',
+
+export const SelectInputWrapperUI = uic('div', {
+ baseClass: `
+ w-full max-w-md
+ relative
+ `,
})
-export const SelectInputActionsUI = uic('div', {
+
+export const SelectInputUI = uic('button', {
+ baseClass: `
+ flex gap-2 flex-wrap items-center
+ w-full min-h-10
+ p-2 py-1 pr-6
+ bg-background
+ rounded-md border border-input ring-offset-background
+ text-sm
+ cursor-pointer
+ hover:border-gray-400
+ placeholder:text-muted-foreground
+ focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2
+ disabled:cursor-not-allowed disabled:opacity-50
+ `,
+})
+export const SelectInputActionsUI = uic('span', {
baseClass: 'absolute right-2 top-1/2 -translate-y-1/2 flex gap-1 items-center',
})
@@ -25,22 +44,32 @@ export const SelectListItemUI = uic(Button, {
export const SelectDefaultPlaceholderUI = () => {dict.select.placeholder}
-export const MultiSelectItemUI = uic('div', {
+export const MultiSelectItemUI = uic('span', {
baseClass: 'flex items-stretch border rounded hover:shadow transition-all',
})
-export const MultiSelectItemContentUI = uic('div', {
+export const MultiSelectItemContentUI = uic('span', {
baseClass: 'rounded-l px-2 py-1 bg-white ',
})
-export const MultiSelectSortableItemContentUI = uic('div', {
+export const MultiSelectSortableItemContentUI = uic('span', {
baseClass: 'rounded-l px-2 py-1 bg-white hover:bg-gray-50 cursor-move transition-all',
})
-export const MultiSelectItemDragOverlayUI = uic('div', {
+export const MultiSelectItemDragOverlayUI = uic('span', {
baseClass: 'rounded px-2 py-1 bg-gray-100 inline-flex gap-2 items-center bg-opacity-20 backdrop-blur text-sm border shadow',
})
-export const MultiSelectItemRemoveButtonUI = uic('button', {
- baseClass: 'bg-gray-100 border-l py-1 px-2 rounded-r text-black flex-inline hover:bg-gray-300',
+export const MultiSelectItemRemoveButtonUI = uic('span', {
+ baseClass: 'bg-gray-100 border-l py-1 px-2 rounded-r text-black inline-flex items-center justify-center hover:bg-gray-300',
afterChildren: ,
+ defaultProps: {
+ tabIndex: 0,
+ role: 'button',
+ onKeyDown: e => {
+ if (e.key === 'Enter' || e.key === ' ') {
+ e.currentTarget.click()
+ e.preventDefault()
+ }
+ },
+ },
})
export const SelectPopoverContent = uic(PopoverContent, {