@xjur-ui/react 2.1.1 → 2.2.1

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.
Files changed (147) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/{chunk-DT44JTXB.js → chunk-4M3WR2KJ.js} +2 -2
  3. package/dist/{chunk-DT44JTXB.js.map → chunk-4M3WR2KJ.js.map} +1 -1
  4. package/dist/{chunk-7HG6Y3VV.js → chunk-BYXTOSM6.js} +2 -2
  5. package/dist/{chunk-7HG6Y3VV.js.map → chunk-BYXTOSM6.js.map} +1 -1
  6. package/dist/{chunk-4PTFZTVU.js → chunk-HLWHETF5.js} +2 -2
  7. package/dist/{chunk-4PTFZTVU.js.map → chunk-HLWHETF5.js.map} +1 -1
  8. package/dist/{chunk-ASZAHSU5.js → chunk-SLMHDBWO.js} +2 -2
  9. package/dist/{chunk-ASZAHSU5.js.map → chunk-SLMHDBWO.js.map} +1 -1
  10. package/dist/{chunk-MQ7YTZBI.js → chunk-TTKENFBF.js} +2 -2
  11. package/dist/{chunk-MQ7YTZBI.js.map → chunk-TTKENFBF.js.map} +1 -1
  12. package/dist/components/accordion.d.ts +54 -0
  13. package/dist/components/accordion.js +2 -0
  14. package/dist/components/accordion.js.map +1 -0
  15. package/dist/components/badge.d.ts +1 -1
  16. package/dist/components/controls/rating.d.ts +137 -0
  17. package/dist/components/controls/rating.js +2 -0
  18. package/dist/components/controls/rating.js.map +1 -0
  19. package/dist/components/controls/rich-editor.js +1 -1
  20. package/dist/components/controls/slider.d.ts +172 -0
  21. package/dist/components/controls/slider.js +2 -0
  22. package/dist/components/controls/slider.js.map +1 -0
  23. package/dist/components/custom/pessoa/index.js +1 -1
  24. package/dist/components/drag-and-drop/index.js +1 -1
  25. package/dist/components/full-calendar/calendar-cell.js +1 -1
  26. package/dist/components/full-calendar/calendar-day-view.js +1 -1
  27. package/dist/components/full-calendar/calendar-month-view.js +1 -1
  28. package/dist/components/full-calendar/calendar-view-renderer.js +1 -1
  29. package/dist/components/full-calendar/calendar-week-view.js +1 -1
  30. package/dist/components/full-calendar/index.js +1 -1
  31. package/dist/components/selection-bar.d.ts +1 -1
  32. package/dist/components/status.d.ts +1 -1
  33. package/dist/components/steps/index.js +1 -1
  34. package/dist/components/table/index.js +1 -1
  35. package/dist/components/toast.d.ts +27 -0
  36. package/dist/components/toast.js +2 -0
  37. package/dist/components/toast.js.map +1 -0
  38. package/dist/components/typography.d.ts +1 -1
  39. package/dist/components/upload.js +1 -1
  40. package/dist/index.css +1 -1
  41. package/dist/index.css.map +1 -1
  42. package/package.json +25 -16
  43. package/.turbo/turbo-build.log +0 -419
  44. package/eslint.config.js +0 -10
  45. package/postcss.config.js +0 -5
  46. package/prettier.config.js +0 -7
  47. package/src/components/avatar-group.tsx +0 -76
  48. package/src/components/avatar.tsx +0 -54
  49. package/src/components/badge.tsx +0 -40
  50. package/src/components/breadcrumb.tsx +0 -119
  51. package/src/components/chip.tsx +0 -117
  52. package/src/components/collapsible.tsx +0 -35
  53. package/src/components/controls/button.tsx +0 -107
  54. package/src/components/controls/calendar.tsx +0 -124
  55. package/src/components/controls/checkbox.tsx +0 -57
  56. package/src/components/controls/context/field.context.ts +0 -27
  57. package/src/components/controls/date-picker.tsx +0 -199
  58. package/src/components/controls/floating-label.tsx +0 -60
  59. package/src/components/controls/input.tsx +0 -237
  60. package/src/components/controls/otp-input.tsx +0 -45
  61. package/src/components/controls/radio.tsx +0 -74
  62. package/src/components/controls/rich-editor.tsx +0 -372
  63. package/src/components/controls/search-input.tsx +0 -154
  64. package/src/components/controls/search-selector.tsx +0 -98
  65. package/src/components/controls/select.tsx +0 -274
  66. package/src/components/controls/switch.tsx +0 -31
  67. package/src/components/custom/pessoa/index.ts +0 -9
  68. package/src/components/custom/pessoa/pessoa-add-button.tsx +0 -35
  69. package/src/components/custom/pessoa/pessoa-body.tsx +0 -22
  70. package/src/components/custom/pessoa/pessoa-close-button.tsx +0 -13
  71. package/src/components/custom/pessoa/pessoa-content.tsx +0 -25
  72. package/src/components/custom/pessoa/pessoa-footer.tsx +0 -15
  73. package/src/components/custom/pessoa/pessoa-header.tsx +0 -35
  74. package/src/components/custom/pessoa/pessoa-trigger.tsx +0 -25
  75. package/src/components/custom/pessoa/pessoa.context.tsx +0 -73
  76. package/src/components/custom/pessoa/pessoa.tsx +0 -35
  77. package/src/components/dialog.tsx +0 -242
  78. package/src/components/divider.tsx +0 -24
  79. package/src/components/drag-and-drop/drag-handle.tsx +0 -46
  80. package/src/components/drag-and-drop/drag-list-item.tsx +0 -91
  81. package/src/components/drag-and-drop/drag-list.tsx +0 -47
  82. package/src/components/drag-and-drop/drag-root.tsx +0 -30
  83. package/src/components/drag-and-drop/index.ts +0 -39
  84. package/src/components/drag-and-drop/types/drag-item.ts +0 -7
  85. package/src/components/dropdown-menu.tsx +0 -101
  86. package/src/components/full-calendar/calendar-add-event.tsx +0 -15
  87. package/src/components/full-calendar/calendar-body.tsx +0 -12
  88. package/src/components/full-calendar/calendar-cell.tsx +0 -120
  89. package/src/components/full-calendar/calendar-day-view.tsx +0 -76
  90. package/src/components/full-calendar/calendar-event.tsx +0 -178
  91. package/src/components/full-calendar/calendar-header.tsx +0 -14
  92. package/src/components/full-calendar/calendar-month-view.tsx +0 -69
  93. package/src/components/full-calendar/calendar-more-events-dropdown.tsx +0 -39
  94. package/src/components/full-calendar/calendar-navigator.tsx +0 -86
  95. package/src/components/full-calendar/calendar-root.tsx +0 -165
  96. package/src/components/full-calendar/calendar-today-button.tsx +0 -21
  97. package/src/components/full-calendar/calendar-toggle-view.tsx +0 -61
  98. package/src/components/full-calendar/calendar-view-renderer.tsx +0 -19
  99. package/src/components/full-calendar/calendar-week-day.tsx +0 -49
  100. package/src/components/full-calendar/calendar-week-view.tsx +0 -88
  101. package/src/components/full-calendar/helpers/calendar.ts +0 -158
  102. package/src/components/full-calendar/index.ts +0 -16
  103. package/src/components/full-calendar/types/calendar-cell.ts +0 -4
  104. package/src/components/full-calendar/types/calendar-event.ts +0 -7
  105. package/src/components/full-calendar/types/calendar-view.ts +0 -1
  106. package/src/components/full-calendar/types/calendar-week-hour.ts +0 -4
  107. package/src/components/horizontal-scroll.tsx +0 -159
  108. package/src/components/icon.tsx +0 -29
  109. package/src/components/list.tsx +0 -111
  110. package/src/components/logo.tsx +0 -44
  111. package/src/components/selection-bar.tsx +0 -273
  112. package/src/components/sheet.tsx +0 -150
  113. package/src/components/skeleton.tsx +0 -12
  114. package/src/components/status.tsx +0 -43
  115. package/src/components/steps/index.ts +0 -6
  116. package/src/components/steps/step.tsx +0 -23
  117. package/src/components/steps/steps-action.tsx +0 -65
  118. package/src/components/steps/steps-content.tsx +0 -12
  119. package/src/components/steps/steps-context.tsx +0 -121
  120. package/src/components/steps/steps-navigation.tsx +0 -80
  121. package/src/components/steps/steps-root.tsx +0 -9
  122. package/src/components/table/index.ts +0 -8
  123. package/src/components/table/table-body.tsx +0 -17
  124. package/src/components/table/table-cell.tsx +0 -14
  125. package/src/components/table/table-footer.tsx +0 -17
  126. package/src/components/table/table-head.tsx +0 -31
  127. package/src/components/table/table-header.tsx +0 -17
  128. package/src/components/table/table-row.tsx +0 -21
  129. package/src/components/table/table-sort.tsx +0 -34
  130. package/src/components/table/table.tsx +0 -16
  131. package/src/components/tabs.tsx +0 -72
  132. package/src/components/tag.tsx +0 -99
  133. package/src/components/tooltip.tsx +0 -63
  134. package/src/components/typography.tsx +0 -85
  135. package/src/components/upload.tsx +0 -647
  136. package/src/hooks/index.ts +0 -1
  137. package/src/hooks/use-os.ts +0 -32
  138. package/src/index.css +0 -5
  139. package/src/resources/icons.ts +0 -154
  140. package/src/resources/input-mask.ts +0 -91
  141. package/src/resources/logo/horizontal.tsx +0 -70
  142. package/src/resources/logo/icon.tsx +0 -54
  143. package/src/resources/logo/index.tsx +0 -33
  144. package/src/resources/logo/vertical.tsx +0 -70
  145. package/src/types.d.ts +0 -4
  146. package/tsconfig.json +0 -4
  147. package/tsup.config.ts +0 -30
@@ -1,242 +0,0 @@
1
- import * as DialogPrimitive from '@radix-ui/react-dialog'
2
- import { cva, cx, type ClassVariantProps } from '@xjur-ui/util'
3
- import { forwardRef, type ComponentProps } from 'react'
4
- import { Button } from './controls/button'
5
- import { Typography } from './typography'
6
- import { Icon } from './icon'
7
-
8
- const dialogOverlayVariants = cva([
9
- 'fixed inset-0 z-50 bg-black/50 backdrop-blur-sm',
10
- 'data-[state=open]:animate-in data-[state=closed]:animate-out',
11
- 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0'
12
- ])
13
-
14
- const dialogContentVariants = cva(
15
- [
16
- 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-layer-1-idle p-6 shadow-lg duration-200',
17
- 'data-[state=open]:animate-in data-[state=closed]:animate-out',
18
- 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
19
- 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
20
- 'data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]',
21
- 'data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]',
22
- 'sm:rounded-lg'
23
- ],
24
- {
25
- variants: {
26
- size: {
27
- sm: 'max-w-sm',
28
- md: 'max-w-lg',
29
- lg: 'max-w-2xl',
30
- xl: 'max-w-4xl'
31
- }
32
- },
33
- defaultVariants: {
34
- size: 'md'
35
- }
36
- }
37
- )
38
-
39
- const dialogHeaderVariants = cva([
40
- 'flex flex-col space-y-1.5 text-center sm:text-left'
41
- ])
42
-
43
- const dialogFooterVariants = cva([
44
- 'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2'
45
- ])
46
-
47
- const dialogTitleVariants = cva([
48
- 'text-lg font-semibold leading-none tracking-tight'
49
- ])
50
-
51
- const dialogDescriptionVariants = cva(['text-sm text-neutral-dark'])
52
-
53
- export const Dialog = DialogPrimitive.Root
54
-
55
- export const DialogTrigger = DialogPrimitive.Trigger
56
-
57
- export const DialogPortal = DialogPrimitive.Portal
58
-
59
- export const DialogClose = DialogPrimitive.Close
60
-
61
- export interface DialogOverlayProps
62
- extends ComponentProps<typeof DialogPrimitive.Overlay>,
63
- ClassVariantProps<typeof dialogOverlayVariants> {}
64
-
65
- export const DialogOverlay = forwardRef<
66
- React.ElementRef<typeof DialogPrimitive.Overlay>,
67
- DialogOverlayProps
68
- >(({ className, ...props }, ref) => (
69
- <DialogPrimitive.Overlay
70
- className={cx(dialogOverlayVariants(), className)}
71
- ref={ref}
72
- {...props}
73
- />
74
- ))
75
-
76
- DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
77
-
78
- export interface DialogContentProps
79
- extends ComponentProps<typeof DialogPrimitive.Content>,
80
- ClassVariantProps<typeof dialogContentVariants> {}
81
-
82
- export const DialogContent = forwardRef<
83
- React.ElementRef<typeof DialogPrimitive.Content>,
84
- DialogContentProps
85
- >(({ className, children, size, ...props }, ref) => (
86
- <DialogPortal>
87
- <DialogOverlay />
88
- <DialogPrimitive.Content
89
- className={cx(dialogContentVariants({ size }), className)}
90
- ref={ref}
91
- {...props}
92
- >
93
- {children}
94
- <DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none">
95
- <Icon className="h-4 w-4" name="close" />
96
- <span className="sr-only">Fechar</span>
97
- </DialogPrimitive.Close>
98
- </DialogPrimitive.Content>
99
- </DialogPortal>
100
- ))
101
-
102
- DialogContent.displayName = DialogPrimitive.Content.displayName
103
-
104
- export interface DialogHeaderProps
105
- extends ComponentProps<'div'>,
106
- ClassVariantProps<typeof dialogHeaderVariants> {}
107
-
108
- export const DialogHeader = forwardRef<HTMLDivElement, DialogHeaderProps>(
109
- ({ className, ...props }, ref) => (
110
- <div
111
- className={cx(dialogHeaderVariants(), className)}
112
- ref={ref}
113
- {...props}
114
- />
115
- )
116
- )
117
-
118
- DialogHeader.displayName = 'DialogHeader'
119
-
120
- export interface DialogFooterProps
121
- extends ComponentProps<'div'>,
122
- ClassVariantProps<typeof dialogFooterVariants> {}
123
-
124
- export const DialogFooter = forwardRef<HTMLDivElement, DialogFooterProps>(
125
- ({ className, ...props }, ref) => (
126
- <div
127
- className={cx(dialogFooterVariants(), className)}
128
- ref={ref}
129
- {...props}
130
- />
131
- )
132
- )
133
-
134
- DialogFooter.displayName = 'DialogFooter'
135
-
136
- export interface DialogTitleProps
137
- extends ComponentProps<typeof DialogPrimitive.Title>,
138
- ClassVariantProps<typeof dialogTitleVariants> {}
139
-
140
- export const DialogTitle = forwardRef<
141
- React.ElementRef<typeof DialogPrimitive.Title>,
142
- DialogTitleProps
143
- >(({ className, ...props }, ref) => (
144
- <DialogPrimitive.Title
145
- className={cx(dialogTitleVariants(), className)}
146
- ref={ref}
147
- {...props}
148
- />
149
- ))
150
-
151
- DialogTitle.displayName = DialogPrimitive.Title.displayName
152
-
153
- export interface DialogDescriptionProps
154
- extends ComponentProps<typeof DialogPrimitive.Description>,
155
- ClassVariantProps<typeof dialogDescriptionVariants> {}
156
-
157
- export const DialogDescription = forwardRef<
158
- React.ElementRef<typeof DialogPrimitive.Description>,
159
- DialogDescriptionProps
160
- >(({ className, ...props }, ref) => (
161
- <DialogPrimitive.Description
162
- className={cx(dialogDescriptionVariants(), className)}
163
- ref={ref}
164
- {...props}
165
- />
166
- ))
167
-
168
- DialogDescription.displayName = DialogPrimitive.Description.displayName
169
-
170
- export interface DeleteDialogProps {
171
- open?: boolean
172
- onOpenChange?: (open: boolean) => void
173
- title?: string
174
- description?: string
175
- onConfirm?: () => void
176
- onCancel?: () => void
177
- confirmText?: string
178
- cancelText?: string
179
- isLoading?: boolean
180
- }
181
-
182
- export function DeleteDialog({
183
- open,
184
- onOpenChange,
185
- title = 'Excluir documento',
186
- description = 'Você tem certeza que deseja excluir este documento permanentemente?',
187
- onConfirm,
188
- onCancel,
189
- confirmText = 'Excluir permanentemente',
190
- cancelText = 'Cancelar',
191
- isLoading = false
192
- }: DeleteDialogProps) {
193
- const handleCancel = () => {
194
- onCancel?.()
195
- onOpenChange?.(false)
196
- }
197
-
198
- const handleConfirm = () => {
199
- onConfirm?.()
200
- }
201
-
202
- const handleOpenChange = (newOpen: boolean) => {
203
- onOpenChange?.(newOpen)
204
- }
205
-
206
- return (
207
- <Dialog open={open} onOpenChange={handleOpenChange}>
208
- <DialogContent size="sm">
209
- <DialogHeader>
210
- <DialogTitle>
211
- <Typography size="md" variant="title" weight="semibold">
212
- {title}
213
- </Typography>
214
- </DialogTitle>
215
- <DialogDescription>
216
- <Typography size="md" variant="body">
217
- {description}
218
- </Typography>
219
- </DialogDescription>
220
- </DialogHeader>
221
- <DialogFooter>
222
- <Button
223
- appearance="ghost"
224
- disabled={isLoading}
225
- variant="tertiary"
226
- onClick={handleCancel}
227
- >
228
- {cancelText}
229
- </Button>
230
- <Button
231
- appearance="solid"
232
- disabled={isLoading}
233
- variant="destructive"
234
- onClick={handleConfirm}
235
- >
236
- {isLoading ? 'Excluindo...' : confirmText}
237
- </Button>
238
- </DialogFooter>
239
- </DialogContent>
240
- </Dialog>
241
- )
242
- }
@@ -1,24 +0,0 @@
1
- import * as React from 'react'
2
- import * as SeparatorPrimitive from '@radix-ui/react-separator'
3
- import { cx } from '@xjur-ui/util'
4
-
5
- export function Divider({
6
- className,
7
- orientation = 'horizontal',
8
- decorative = true,
9
- ...props
10
- }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
11
- return (
12
- <SeparatorPrimitive.Root
13
- className={cx(
14
- 'bg-border-layer-2 shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full',
15
- 'data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px',
16
- className
17
- )}
18
- data-slot="separator"
19
- decorative={decorative}
20
- orientation={orientation}
21
- {...props}
22
- />
23
- )
24
- }
@@ -1,46 +0,0 @@
1
- import { createContext, use, type ComponentProps } from 'react'
2
- import type { SyntheticListenerMap } from '@dnd-kit/core/dist/hooks/utilities'
3
- import { Slot } from '@radix-ui/react-slot'
4
- import { cx } from '@xjur-ui/util'
5
- import { useDndContext } from '@dnd-kit/core'
6
-
7
- interface DragHandleContextType {
8
- listeners?: SyntheticListenerMap
9
- setActivatorNodeRef: (el: HTMLElement | null) => void
10
- }
11
-
12
- export const DragHandlerContext = createContext<DragHandleContextType>(
13
- {} as DragHandleContextType
14
- )
15
-
16
- export function DragHandle({
17
- className,
18
- asChild,
19
- ...props
20
- }: ComponentProps<'button'> & {
21
- asChild?: boolean
22
- }) {
23
- const { active } = useDndContext()
24
- const context = use(DragHandlerContext)
25
-
26
- if (!context) {
27
- throw new Error('DragHandle must be used within a DragHandlerContext')
28
- }
29
-
30
- const { listeners, setActivatorNodeRef } = context
31
-
32
- const Comp = asChild ? Slot : 'button'
33
-
34
- return (
35
- <Comp
36
- className={cx(
37
- className,
38
- 'cursor-grab',
39
- active !== null && 'cursor-grabbing'
40
- )}
41
- {...props}
42
- {...listeners}
43
- ref={setActivatorNodeRef}
44
- />
45
- )
46
- }
@@ -1,91 +0,0 @@
1
- import type { UniqueIdentifier } from '@dnd-kit/core'
2
- import { useSortable } from '@dnd-kit/sortable'
3
- import { cx } from '@xjur-ui/util'
4
- import { type ComponentProps, type CSSProperties } from 'react'
5
- import { CSS } from '@dnd-kit/utilities'
6
- import type { DragItem } from './types/drag-item'
7
- import { DragHandlerContext } from './drag-handle'
8
-
9
- export function DragListItem({
10
- id,
11
- className,
12
- draggableClassName = '',
13
- data,
14
- useCustomDragHandle = false,
15
- hasOverlay = true,
16
- ...props
17
- }: Omit<ComponentProps<'li'>, 'id'> & {
18
- id: UniqueIdentifier
19
- draggableClassName?: string
20
- data: DragItem
21
- useCustomDragHandle?: boolean
22
- hasOverlay?: boolean
23
- }) {
24
- const {
25
- setNodeRef,
26
- setActivatorNodeRef,
27
- attributes,
28
- listeners,
29
- transition,
30
- transform,
31
- isDragging
32
- } = useSortable({
33
- id,
34
- data
35
- })
36
-
37
- const style: CSSProperties = {
38
- transition,
39
- transform: CSS.Transform.toString(transform),
40
- ...(isDragging && {
41
- boxShadow: 'none'
42
- })
43
- }
44
-
45
- const listClassNames = cx(
46
- 'list-none',
47
- useCustomDragHandle ? 'cursor-default' : 'cursor-grab',
48
- className
49
- )
50
-
51
- if (isDragging) {
52
- return (
53
- <li
54
- className={cx(
55
- 'data-[overlay=true]:border-border-layer-2 data-[overlay=true]:border-2 data-[overlay=true]:border-dashed data-[overlay=true]:bg-transparent data-[overlay=true]:opacity-60',
56
- draggableClassName,
57
- className
58
- )}
59
- data-overlay={hasOverlay}
60
- ref={setNodeRef}
61
- style={style}
62
- {...props}
63
- />
64
- )
65
- }
66
-
67
- if (useCustomDragHandle) {
68
- return (
69
- <DragHandlerContext.Provider value={{ listeners, setActivatorNodeRef }}>
70
- <li
71
- className={listClassNames}
72
- ref={setNodeRef}
73
- style={style}
74
- {...attributes}
75
- {...props}
76
- />
77
- </DragHandlerContext.Provider>
78
- )
79
- }
80
-
81
- return (
82
- <li
83
- className={listClassNames}
84
- ref={setNodeRef}
85
- style={style}
86
- {...attributes}
87
- {...listeners}
88
- {...props}
89
- />
90
- )
91
- }
@@ -1,47 +0,0 @@
1
- import { useDroppable, type UniqueIdentifier } from '@dnd-kit/core'
2
- import {
3
- type SortableContextProps,
4
- verticalListSortingStrategy,
5
- horizontalListSortingStrategy,
6
- SortableContext
7
- } from '@dnd-kit/sortable'
8
- import { cx } from '@xjur-ui/util'
9
- import type { DragItem } from './types/drag-item'
10
-
11
- export function DragList({
12
- items,
13
- orientation = 'vertical',
14
- children,
15
- className,
16
- id,
17
- data,
18
- ...props
19
- }: Omit<SortableContextProps, 'items' | 'id'> & {
20
- items: DragItem[]
21
- orientation?: 'vertical' | 'horizontal'
22
- className?: string
23
- id: UniqueIdentifier
24
- data?: DragItem
25
- }) {
26
- const strategy =
27
- orientation === 'vertical'
28
- ? verticalListSortingStrategy
29
- : horizontalListSortingStrategy
30
-
31
- const { setNodeRef } = useDroppable({
32
- id,
33
- data
34
- })
35
-
36
- return (
37
- <SortableContext
38
- items={items.map(item => item)}
39
- strategy={strategy}
40
- {...props}
41
- >
42
- <ul className={cx(className)} ref={setNodeRef}>
43
- {children}
44
- </ul>
45
- </SortableContext>
46
- )
47
- }
@@ -1,30 +0,0 @@
1
- import {
2
- closestCenter,
3
- useSensors,
4
- useSensor,
5
- PointerSensor,
6
- KeyboardSensor,
7
- DndContext,
8
- type DndContextProps
9
- } from '@dnd-kit/core'
10
- import { sortableKeyboardCoordinates } from '@dnd-kit/sortable'
11
-
12
- export function DragRoot({
13
- collisionDetection = closestCenter,
14
- ...props
15
- }: DndContextProps) {
16
- const sensors = useSensors(
17
- useSensor(PointerSensor),
18
- useSensor(KeyboardSensor, {
19
- coordinateGetter: sortableKeyboardCoordinates
20
- })
21
- )
22
-
23
- return (
24
- <DndContext
25
- collisionDetection={collisionDetection}
26
- sensors={props.sensors ?? sensors}
27
- {...props}
28
- />
29
- )
30
- }
@@ -1,39 +0,0 @@
1
- /* Dnd Kit Sortable helpers */
2
- export { arrayMove, useSortable } from '@dnd-kit/sortable'
3
-
4
- /* Dnd Kit Core helpers */
5
- export {
6
- closestCenter,
7
- closestCorners,
8
- pointerWithin,
9
- getFirstCollision,
10
- getClientRect,
11
- useDroppable,
12
- useDndContext,
13
- useDraggable,
14
- useSensor,
15
- useDndMonitor,
16
- useSensors
17
- } from '@dnd-kit/core'
18
-
19
- /* Dnd Kit Core Components */
20
- export { DragOverlay } from '@dnd-kit/core'
21
-
22
- /* Dnd Kit Core Types */
23
- export {
24
- type DragEndEvent,
25
- type DragStartEvent,
26
- type DragOverEvent,
27
- type DragAbortEvent,
28
- type DragCancelEvent,
29
- type DragMoveEvent,
30
- type DragPendingEvent,
31
- type UniqueIdentifier
32
- } from '@dnd-kit/core'
33
-
34
- /* Drag And Drop Components */
35
- export { DragRoot } from './drag-root'
36
- export { DragList } from './drag-list'
37
- export { DragListItem } from './drag-list-item'
38
- export { DragHandle } from './drag-handle'
39
- export type { DragItem } from './types/drag-item'
@@ -1,7 +0,0 @@
1
- import type { UniqueIdentifier } from '@dnd-kit/core'
2
-
3
- export interface DragItem<T = unknown> {
4
- id: UniqueIdentifier
5
- type: string
6
- data: T
7
- }
@@ -1,101 +0,0 @@
1
- import * as React from 'react'
2
- import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
3
- import { cx } from '@xjur-ui/util'
4
- import {
5
- ListContent,
6
- ListHeader,
7
- ListHeaderTitle,
8
- ListItem,
9
- ListRoot
10
- } from './list'
11
- import { Typography } from './typography'
12
- import { Divider } from './divider'
13
-
14
- export function DropdownMenuRoot({
15
- ...props
16
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
17
- return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
18
- }
19
-
20
- export function DropdownMenuPortal({
21
- ...props
22
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
23
- return (
24
- <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
25
- )
26
- }
27
-
28
- export function DropdownMenuTrigger({
29
- ...props
30
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
31
- return (
32
- <DropdownMenuPrimitive.Trigger
33
- data-slot="dropdown-menu-trigger"
34
- {...props}
35
- />
36
- )
37
- }
38
-
39
- export function DropdownMenuContent({
40
- className,
41
- sideOffset = 4,
42
- align = 'start',
43
- side = 'bottom',
44
- children,
45
- ...props
46
- }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
47
- return (
48
- <DropdownMenuPrimitive.Portal>
49
- <DropdownMenuPrimitive.Content
50
- align={align}
51
- className={cx(
52
- 'group z-1000 max-h-[var(--radix-popover-content-available-height)] max-w-[var(--radix-popover-trigger-width)] min-w-[var(--radix-popover-trigger-width)]',
53
- className
54
- )}
55
- data-slot="dropdown-menu-content"
56
- side={side}
57
- sideOffset={sideOffset}
58
- {...props}
59
- >
60
- <ListRoot>{children}</ListRoot>
61
- </DropdownMenuPrimitive.Content>
62
- </DropdownMenuPrimitive.Portal>
63
- )
64
- }
65
-
66
- export function DropdownMenuList({
67
- ...props
68
- }: React.ComponentProps<typeof ListContent>) {
69
- return <ListContent {...props} />
70
- }
71
-
72
- export function DropdownMenuHeader({
73
- ...props
74
- }: React.ComponentProps<typeof ListHeader>) {
75
- return <ListHeader {...props} />
76
- }
77
-
78
- export function DropdownMenuHeaderTitle({
79
- ...props
80
- }: React.ComponentProps<typeof ListHeaderTitle>) {
81
- return <ListHeaderTitle {...props} />
82
- }
83
-
84
- export function DropdownMenuItem({
85
- className,
86
- ...props
87
- }: React.ComponentProps<typeof ListItem>) {
88
- return <ListItem className={cx(className, 'cursor-pointer')} {...props} />
89
- }
90
-
91
- export function DropdownMenuItemText({
92
- ...props
93
- }: React.ComponentProps<typeof Typography>) {
94
- return <Typography {...props} />
95
- }
96
-
97
- export function DropdownMenuItemDivider({
98
- ...props
99
- }: React.ComponentProps<typeof Divider>) {
100
- return <Divider {...props} />
101
- }
@@ -1,15 +0,0 @@
1
- import { Button } from '../controls/button'
2
- import { Icon } from '../icon'
3
-
4
- interface CalendarAddEventProps {
5
- date: Date
6
- onAddEvent: (date: Date) => void
7
- }
8
-
9
- export function CalendarAddEvent({ date, onAddEvent }: CalendarAddEventProps) {
10
- return (
11
- <Button size="icon_sm" variant="outlined" onClick={() => onAddEvent(date)}>
12
- <Icon className="text-icon-neutral-3" name="add" />
13
- </Button>
14
- )
15
- }
@@ -1,12 +0,0 @@
1
- import { cx } from '@xjur-ui/util'
2
- import type { ComponentProps } from 'react'
3
-
4
- export function CalendarBody({ className, ...props }: ComponentProps<'div'>) {
5
- return (
6
- <div
7
- className={cx(className, 'gap-large-2x p-large flex flex-col')}
8
- data-slot="calendar-body"
9
- {...props}
10
- />
11
- )
12
- }