@xjur-ui/react 1.0.6 → 2.1.0
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/.turbo/turbo-build.log +279 -68
- package/CHANGELOG.md +114 -0
- package/README.md +146 -0
- package/dist/chunk-2CM3SFOY.js +2 -0
- package/dist/chunk-2CM3SFOY.js.map +1 -0
- package/dist/chunk-2CTBH6VI.js +2 -0
- package/dist/chunk-2CTBH6VI.js.map +1 -0
- package/dist/chunk-4BGTC333.js +2 -0
- package/dist/chunk-4BGTC333.js.map +1 -0
- package/dist/chunk-5WLIDYZH.js +2 -0
- package/dist/chunk-5WLIDYZH.js.map +1 -0
- package/dist/chunk-6AD6O6II.js +2 -0
- package/dist/chunk-6AD6O6II.js.map +1 -0
- package/dist/chunk-AA6V5YEC.js +2 -0
- package/dist/chunk-AA6V5YEC.js.map +1 -0
- package/dist/chunk-BK6FP63A.js +2 -0
- package/dist/chunk-BK6FP63A.js.map +1 -0
- package/dist/chunk-BZDGWC5O.js +2 -0
- package/dist/chunk-BZDGWC5O.js.map +1 -0
- package/dist/chunk-CBFC4QME.js +2 -0
- package/dist/chunk-CBFC4QME.js.map +1 -0
- package/dist/chunk-CI3ZXWEX.js +2 -0
- package/dist/chunk-CI3ZXWEX.js.map +1 -0
- package/dist/chunk-DFXHNK5D.js +2 -0
- package/dist/chunk-DFXHNK5D.js.map +1 -0
- package/dist/chunk-EIG6CBTQ.js +2 -0
- package/dist/chunk-EIG6CBTQ.js.map +1 -0
- package/dist/chunk-EXC2XOL6.js +2 -0
- package/dist/chunk-EXC2XOL6.js.map +1 -0
- package/dist/chunk-F4DYKYWJ.js +2 -0
- package/dist/chunk-F4DYKYWJ.js.map +1 -0
- package/dist/chunk-F5ZLEQGN.js +2 -0
- package/dist/chunk-F5ZLEQGN.js.map +1 -0
- package/dist/chunk-IKL6PSXU.js +2 -0
- package/dist/chunk-IKL6PSXU.js.map +1 -0
- package/dist/chunk-IRHU7PDO.js +2 -0
- package/dist/chunk-IRHU7PDO.js.map +1 -0
- package/dist/chunk-J4X5RQTR.js +2 -0
- package/dist/chunk-J4X5RQTR.js.map +1 -0
- package/dist/chunk-KIFR5VIE.js +2 -0
- package/dist/chunk-KIFR5VIE.js.map +1 -0
- package/dist/chunk-KS6WGBHQ.js +2 -0
- package/dist/chunk-KS6WGBHQ.js.map +1 -0
- package/dist/chunk-L4ET6GIZ.js +2 -0
- package/dist/chunk-L4ET6GIZ.js.map +1 -0
- package/dist/chunk-MZSV4LNY.js +2 -0
- package/dist/chunk-MZSV4LNY.js.map +1 -0
- package/dist/chunk-NELCN6E2.js +2 -0
- package/dist/chunk-NELCN6E2.js.map +1 -0
- package/dist/chunk-OS53BV63.js +3 -0
- package/dist/chunk-OS53BV63.js.map +1 -0
- package/dist/chunk-PKCW37CJ.js +2 -0
- package/dist/chunk-PKCW37CJ.js.map +1 -0
- package/dist/chunk-RWMV7APX.js +2 -0
- package/dist/chunk-RWMV7APX.js.map +1 -0
- package/dist/chunk-SLAAEXWI.js +2 -0
- package/dist/chunk-SLAAEXWI.js.map +1 -0
- package/dist/chunk-SXGSWVMZ.js +2 -0
- package/dist/chunk-SXGSWVMZ.js.map +1 -0
- package/dist/chunk-TB6KI6CL.js +2 -0
- package/dist/chunk-TB6KI6CL.js.map +1 -0
- package/dist/chunk-TSVURBUY.js +2 -0
- package/dist/chunk-TSVURBUY.js.map +1 -0
- package/dist/chunk-UXIVZWLB.js +2 -0
- package/dist/chunk-UXIVZWLB.js.map +1 -0
- package/dist/chunk-WEBAXQID.js +2 -0
- package/dist/chunk-WEBAXQID.js.map +1 -0
- package/dist/chunk-WV7QV2PU.js +2 -0
- package/dist/chunk-WV7QV2PU.js.map +1 -0
- package/dist/chunk-Z47R2CIM.js +2 -0
- package/dist/chunk-Z47R2CIM.js.map +1 -0
- package/dist/chunk-ZVVPUP7V.js +2 -0
- package/dist/chunk-ZVVPUP7V.js.map +1 -0
- package/dist/components/avatar-group.js +2 -179
- package/dist/components/avatar-group.js.map +1 -0
- package/dist/components/avatar.js +2 -59
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.js +2 -111
- package/dist/components/badge.js.map +1 -0
- package/dist/components/breadcrumb.d.ts +20 -0
- package/dist/components/breadcrumb.js +2 -0
- package/dist/components/breadcrumb.js.map +1 -0
- package/dist/components/chip.d.ts +5 -2
- package/dist/components/chip.js +2 -256
- package/dist/components/chip.js.map +1 -0
- package/dist/components/collapsible.js +2 -41
- package/dist/components/collapsible.js.map +1 -0
- package/dist/components/dialog.d.ts +51 -0
- package/dist/components/dialog.js +2 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/divider.js +2 -29
- package/dist/components/divider.js.map +1 -0
- package/dist/components/drag-and-drop/drag-handle.d.ts +15 -0
- package/dist/components/drag-and-drop/drag-handle.js +2 -0
- package/dist/components/drag-and-drop/drag-handle.js.map +1 -0
- package/dist/components/drag-and-drop/drag-list-item.d.ts +14 -0
- package/dist/components/drag-and-drop/drag-list-item.js +2 -0
- package/dist/components/drag-and-drop/drag-list-item.js.map +1 -0
- package/dist/components/drag-and-drop/drag-list.d.ts +14 -0
- package/dist/components/drag-and-drop/drag-list.js +2 -0
- package/dist/components/drag-and-drop/drag-list.js.map +1 -0
- package/dist/components/drag-and-drop/drag-root.d.ts +6 -0
- package/dist/components/drag-and-drop/drag-root.js +2 -0
- package/dist/components/drag-and-drop/drag-root.js.map +1 -0
- package/dist/components/drag-and-drop/index.d.ts +10 -0
- package/dist/components/drag-and-drop/index.js +2 -0
- package/dist/components/drag-and-drop/index.js.map +1 -0
- package/dist/components/drag-and-drop/types/drag-item.d.ts +9 -0
- package/dist/components/drag-and-drop/types/drag-item.js +2 -0
- package/dist/components/drag-and-drop/types/drag-item.js.map +1 -0
- package/dist/components/dropdown-menu.js +2 -295
- package/dist/components/dropdown-menu.js.map +1 -0
- package/dist/components/form/button.js +2 -0
- package/dist/components/form/button.js.map +1 -0
- package/dist/components/form/calendar.js +2 -0
- package/dist/components/form/calendar.js.map +1 -0
- package/dist/components/form/checkbox.js +2 -0
- package/dist/components/form/checkbox.js.map +1 -0
- package/dist/components/form/context/field.context.d.ts +15 -0
- package/dist/components/form/context/field.context.js +2 -0
- package/dist/components/form/context/field.context.js.map +1 -0
- package/dist/components/form/date-picker.d.ts +84 -0
- package/dist/components/form/date-picker.js +2 -0
- package/dist/components/form/date-picker.js.map +1 -0
- package/dist/components/form/floating-label.d.ts +6 -0
- package/dist/components/form/floating-label.js +2 -0
- package/dist/components/form/floating-label.js.map +1 -0
- package/dist/components/form/input.d.ts +95 -0
- package/dist/components/form/input.js +2 -0
- package/dist/components/form/input.js.map +1 -0
- package/dist/components/form/otp-input.js +2 -0
- package/dist/components/form/otp-input.js.map +1 -0
- package/dist/components/form/radio.js +2 -0
- package/dist/components/form/radio.js.map +1 -0
- package/dist/components/{rich-editor.d.ts → form/rich-editor.d.ts} +2 -1
- package/dist/components/form/rich-editor.js +2 -0
- package/dist/components/form/rich-editor.js.map +1 -0
- package/dist/components/form/search-input.js +2 -0
- package/dist/components/form/search-input.js.map +1 -0
- package/dist/components/form/select.d.ts +94 -0
- package/dist/components/form/select.js +2 -0
- package/dist/components/form/select.js.map +1 -0
- package/dist/components/form/switch.js +2 -0
- package/dist/components/form/switch.js.map +1 -0
- package/dist/components/full-calendar/calendar-add-event.d.ts +9 -0
- package/dist/components/full-calendar/calendar-add-event.js +2 -0
- package/dist/components/full-calendar/calendar-add-event.js.map +1 -0
- package/dist/components/full-calendar/calendar-body.d.ts +6 -0
- package/dist/components/full-calendar/calendar-body.js +2 -0
- package/dist/components/full-calendar/calendar-body.js.map +1 -0
- package/dist/components/full-calendar/calendar-cell.d.ts +11 -0
- package/dist/components/full-calendar/calendar-cell.js +2 -0
- package/dist/components/full-calendar/calendar-cell.js.map +1 -0
- package/dist/components/full-calendar/calendar-day-view.d.ts +5 -0
- package/dist/components/full-calendar/calendar-day-view.js +2 -0
- package/dist/components/full-calendar/calendar-day-view.js.map +1 -0
- package/dist/components/full-calendar/calendar-event.d.ts +18 -0
- package/dist/components/full-calendar/calendar-event.js +2 -0
- package/dist/components/full-calendar/calendar-event.js.map +1 -0
- package/dist/components/full-calendar/calendar-header.d.ts +6 -0
- package/dist/components/full-calendar/calendar-header.js +2 -0
- package/dist/components/full-calendar/calendar-header.js.map +1 -0
- package/dist/components/full-calendar/calendar-month-view.d.ts +5 -0
- package/dist/components/full-calendar/calendar-month-view.js +2 -0
- package/dist/components/full-calendar/calendar-month-view.js.map +1 -0
- package/dist/components/full-calendar/calendar-more-events-dropdown.d.ts +9 -0
- package/dist/components/full-calendar/calendar-more-events-dropdown.js +2 -0
- package/dist/components/full-calendar/calendar-more-events-dropdown.js.map +1 -0
- package/dist/components/full-calendar/calendar-navigator.d.ts +5 -0
- package/dist/components/full-calendar/calendar-navigator.js +2 -0
- package/dist/components/full-calendar/calendar-navigator.js.map +1 -0
- package/dist/components/full-calendar/calendar-root.d.ts +30 -0
- package/dist/components/full-calendar/calendar-root.js +2 -0
- package/dist/components/full-calendar/calendar-root.js.map +1 -0
- package/dist/components/full-calendar/calendar-today-button.d.ts +9 -0
- package/dist/components/full-calendar/calendar-today-button.js +2 -0
- package/dist/components/full-calendar/calendar-today-button.js.map +1 -0
- package/dist/components/full-calendar/calendar-toggle-view.d.ts +5 -0
- package/dist/components/full-calendar/calendar-toggle-view.js +2 -0
- package/dist/components/full-calendar/calendar-toggle-view.js.map +1 -0
- package/dist/components/full-calendar/calendar-view-renderer.d.ts +5 -0
- package/dist/components/full-calendar/calendar-view-renderer.js +2 -0
- package/dist/components/full-calendar/calendar-view-renderer.js.map +1 -0
- package/dist/components/full-calendar/calendar-week-day.d.ts +10 -0
- package/dist/components/full-calendar/calendar-week-day.js +2 -0
- package/dist/components/full-calendar/calendar-week-day.js.map +1 -0
- package/dist/components/full-calendar/calendar-week-view.d.ts +5 -0
- package/dist/components/full-calendar/calendar-week-view.js +2 -0
- package/dist/components/full-calendar/calendar-week-view.js.map +1 -0
- package/dist/components/full-calendar/helpers/calendar.d.ts +25 -0
- package/dist/components/full-calendar/helpers/calendar.js +2 -0
- package/dist/components/full-calendar/helpers/calendar.js.map +1 -0
- package/dist/components/full-calendar/index.d.ts +18 -0
- package/dist/components/full-calendar/index.js +2 -0
- package/dist/components/full-calendar/index.js.map +1 -0
- package/dist/components/full-calendar/types/calendar-cell.d.ts +6 -0
- package/dist/components/full-calendar/types/calendar-cell.js +2 -0
- package/dist/components/full-calendar/types/calendar-cell.js.map +1 -0
- package/dist/components/full-calendar/types/calendar-event.d.ts +8 -0
- package/dist/components/full-calendar/types/calendar-event.js +2 -0
- package/dist/components/full-calendar/types/calendar-event.js.map +1 -0
- package/dist/components/full-calendar/types/calendar-view.d.ts +3 -0
- package/dist/components/full-calendar/types/calendar-view.js +2 -0
- package/dist/components/full-calendar/types/calendar-view.js.map +1 -0
- package/dist/components/full-calendar/types/calendar-week-hour.d.ts +6 -0
- package/dist/components/full-calendar/types/calendar-week-hour.js +2 -0
- package/dist/components/full-calendar/types/calendar-week-hour.js.map +1 -0
- package/dist/components/horizontal-scroll.d.ts +11 -0
- package/dist/components/horizontal-scroll.js +2 -0
- package/dist/components/horizontal-scroll.js.map +1 -0
- package/dist/components/icon.d.ts +3 -4
- package/dist/components/icon.js +2 -177
- package/dist/components/icon.js.map +1 -0
- package/dist/components/list.js +2 -179
- package/dist/components/list.js.map +1 -0
- package/dist/components/logo.js +2 -324
- package/dist/components/logo.js.map +1 -0
- package/dist/components/selection-bar.d.ts +57 -0
- package/dist/components/selection-bar.js +2 -0
- package/dist/components/selection-bar.js.map +1 -0
- package/dist/components/sheet.d.ts +8 -8
- package/dist/components/sheet.js +2 -251
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/skeleton.js +2 -16
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/status.js +2 -111
- package/dist/components/status.js.map +1 -0
- package/dist/components/table.js +2 -196
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +9 -6
- package/dist/components/tabs.js +2 -54
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tag.d.ts +5 -2
- package/dist/components/tag.js +2 -189
- package/dist/components/tag.js.map +1 -0
- package/dist/components/tooltip.js +2 -58
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/typography.js +2 -78
- package/dist/components/typography.js.map +1 -0
- package/dist/components/upload.d.ts +74 -0
- package/dist/components/upload.js +2 -0
- package/dist/components/upload.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/icons-CmDuL0gZ.d.ts +4 -0
- package/dist/index.css +2 -2322
- package/dist/index.css.map +1 -0
- package/dist/logo-PQRZORCS.js +3 -0
- package/dist/logo-PQRZORCS.js.map +1 -0
- package/package.json +60 -18
- package/src/components/breadcrumb.tsx +119 -0
- package/src/components/chip.tsx +11 -3
- package/src/components/dialog.tsx +242 -0
- package/src/components/drag-and-drop/drag-handle.tsx +46 -0
- package/src/components/drag-and-drop/drag-list-item.tsx +91 -0
- package/src/components/drag-and-drop/drag-list.tsx +47 -0
- package/src/components/drag-and-drop/drag-root.tsx +30 -0
- package/src/components/drag-and-drop/index.ts +39 -0
- package/src/components/drag-and-drop/types/drag-item.ts +7 -0
- package/src/components/{calendar.tsx → form/calendar.tsx} +9 -8
- package/src/components/{checkbox.tsx → form/checkbox.tsx} +2 -2
- package/src/components/form/context/field.context.ts +27 -0
- package/src/components/form/date-picker.tsx +199 -0
- package/src/components/form/floating-label.tsx +60 -0
- package/src/components/form/input.tsx +235 -0
- package/src/components/{radio.tsx → form/radio.tsx} +1 -1
- package/src/components/{rich-editor.tsx → form/rich-editor.tsx} +10 -9
- package/src/components/{search-input.tsx → form/search-input.tsx} +2 -2
- package/src/components/form/select.tsx +274 -0
- package/src/components/full-calendar/calendar-add-event.tsx +15 -0
- package/src/components/full-calendar/calendar-body.tsx +12 -0
- package/src/components/full-calendar/calendar-cell.tsx +120 -0
- package/src/components/full-calendar/calendar-day-view.tsx +76 -0
- package/src/components/full-calendar/calendar-event.tsx +178 -0
- package/src/components/full-calendar/calendar-header.tsx +14 -0
- package/src/components/full-calendar/calendar-month-view.tsx +69 -0
- package/src/components/full-calendar/calendar-more-events-dropdown.tsx +39 -0
- package/src/components/full-calendar/calendar-navigator.tsx +86 -0
- package/src/components/full-calendar/calendar-root.tsx +165 -0
- package/src/components/full-calendar/calendar-today-button.tsx +21 -0
- package/src/components/full-calendar/calendar-toggle-view.tsx +61 -0
- package/src/components/full-calendar/calendar-view-renderer.tsx +19 -0
- package/src/components/full-calendar/calendar-week-day.tsx +49 -0
- package/src/components/full-calendar/calendar-week-view.tsx +88 -0
- package/src/components/full-calendar/helpers/calendar.ts +158 -0
- package/src/components/full-calendar/index.ts +16 -0
- package/src/components/full-calendar/types/calendar-cell.ts +4 -0
- package/src/components/full-calendar/types/calendar-event.ts +7 -0
- package/src/components/full-calendar/types/calendar-view.ts +1 -0
- package/src/components/full-calendar/types/calendar-week-hour.ts +4 -0
- package/src/components/horizontal-scroll.tsx +159 -0
- package/src/components/icon.tsx +1 -1
- package/src/components/logo.tsx +25 -20
- package/src/components/selection-bar.tsx +273 -0
- package/src/components/sheet.tsx +2 -2
- package/src/components/tabs.tsx +56 -37
- package/src/components/tag.tsx +11 -3
- package/src/components/upload.tsx +647 -0
- package/src/index.css +2 -2
- package/src/resources/icons.ts +4 -1
- package/src/resources/logo/index.tsx +33 -0
- package/tsup.config.ts +23 -5
- package/dist/components/button.js +0 -98
- package/dist/components/calendar.js +0 -751
- package/dist/components/checkbox.js +0 -153
- package/dist/components/date-picker.d.ts +0 -20
- package/dist/components/date-picker.js +0 -232
- package/dist/components/input.d.ts +0 -32
- package/dist/components/input.js +0 -315
- package/dist/components/otp-input.js +0 -47
- package/dist/components/radio.js +0 -156
- package/dist/components/rich-editor.js +0 -723
- package/dist/components/search-input.js +0 -274
- package/dist/components/select.d.ts +0 -33
- package/dist/components/select.js +0 -550
- package/dist/components/switch.js +0 -36
- package/dist/components/test.d.ts +0 -5
- package/dist/components/test.js +0 -8
- package/dist/index.js +0 -0
- package/src/components/date-picker.tsx +0 -160
- package/src/components/input.tsx +0 -256
- package/src/components/select.tsx +0 -240
- package/src/components/test.tsx +0 -3
- package/src/index.ts +0 -1
- package/src/resources/logo/index.ts +0 -3
- /package/dist/components/{button.d.ts → form/button.d.ts} +0 -0
- /package/dist/components/{calendar.d.ts → form/calendar.d.ts} +0 -0
- /package/dist/components/{checkbox.d.ts → form/checkbox.d.ts} +0 -0
- /package/dist/components/{otp-input.d.ts → form/otp-input.d.ts} +0 -0
- /package/dist/components/{radio.d.ts → form/radio.d.ts} +0 -0
- /package/dist/components/{search-input.d.ts → form/search-input.d.ts} +0 -0
- /package/dist/components/{switch.d.ts → form/switch.d.ts} +0 -0
- /package/src/components/{button.tsx → form/button.tsx} +0 -0
- /package/src/components/{otp-input.tsx → form/otp-input.tsx} +0 -0
- /package/src/components/{switch.tsx → form/switch.tsx} +0 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot'
|
|
3
|
+
import { cx } from '@xjur-ui/util'
|
|
4
|
+
import { Icon } from './icon'
|
|
5
|
+
import { Typography, type TypographyProps } from './typography'
|
|
6
|
+
|
|
7
|
+
export function Breadcrumb({ ...props }: React.ComponentProps<'nav'>) {
|
|
8
|
+
return <nav aria-label="breadcrumb" data-slot="breadcrumb" {...props} />
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function BreadcrumbList({
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
14
|
+
}: React.ComponentProps<'ol'>) {
|
|
15
|
+
return (
|
|
16
|
+
<ol
|
|
17
|
+
className={cx(
|
|
18
|
+
'text-neutral-placeholder flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5',
|
|
19
|
+
className
|
|
20
|
+
)}
|
|
21
|
+
data-slot="breadcrumb-list"
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function BreadcrumbItem({
|
|
28
|
+
className,
|
|
29
|
+
...props
|
|
30
|
+
}: React.ComponentProps<'li'>) {
|
|
31
|
+
return (
|
|
32
|
+
<li
|
|
33
|
+
className={cx('inline-flex items-center gap-1.5', className)}
|
|
34
|
+
data-slot="breadcrumb-item"
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function BreadcrumbLink({
|
|
41
|
+
asChild,
|
|
42
|
+
className,
|
|
43
|
+
variant = 'headline',
|
|
44
|
+
size = 'sm',
|
|
45
|
+
...props
|
|
46
|
+
}: React.ComponentProps<'a'> & {
|
|
47
|
+
asChild?: boolean
|
|
48
|
+
href?: string
|
|
49
|
+
variant?: TypographyProps['variant']
|
|
50
|
+
size?: TypographyProps['size']
|
|
51
|
+
}) {
|
|
52
|
+
const Comp = asChild ? Slot : 'a'
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Typography asChild={true} size={size} variant={variant}>
|
|
56
|
+
<Comp
|
|
57
|
+
className={cx('hover:text-neutral-dark transition-colors', className)}
|
|
58
|
+
data-slot="breadcrumb-link"
|
|
59
|
+
{...props}
|
|
60
|
+
/>
|
|
61
|
+
</Typography>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function BreadcrumbPage({
|
|
66
|
+
variant = 'headline',
|
|
67
|
+
size = 'sm',
|
|
68
|
+
className,
|
|
69
|
+
...props
|
|
70
|
+
}: React.ComponentProps<typeof Typography>) {
|
|
71
|
+
return (
|
|
72
|
+
<Typography
|
|
73
|
+
aria-current="page"
|
|
74
|
+
aria-disabled="true"
|
|
75
|
+
className={cx('text-neutral-dark font-normal', className)}
|
|
76
|
+
data-slot="breadcrumb-page"
|
|
77
|
+
role="link"
|
|
78
|
+
size={size}
|
|
79
|
+
variant={variant}
|
|
80
|
+
{...props}
|
|
81
|
+
/>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function BreadcrumbSeparator({
|
|
86
|
+
children,
|
|
87
|
+
className,
|
|
88
|
+
...props
|
|
89
|
+
}: React.ComponentProps<'li'>) {
|
|
90
|
+
return (
|
|
91
|
+
<li
|
|
92
|
+
aria-hidden="true"
|
|
93
|
+
className={cx('[&>span]:text-size-title-lg', className)}
|
|
94
|
+
data-slot="breadcrumb-separator"
|
|
95
|
+
role="presentation"
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
{children ?? <Icon name="chevron_right" />}
|
|
99
|
+
</li>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function BreadcrumbEllipsis({
|
|
104
|
+
className,
|
|
105
|
+
...props
|
|
106
|
+
}: React.ComponentProps<'span'>) {
|
|
107
|
+
return (
|
|
108
|
+
<span
|
|
109
|
+
aria-hidden="true"
|
|
110
|
+
className={cx('flex size-9 items-center justify-center', className)}
|
|
111
|
+
data-slot="breadcrumb-ellipsis"
|
|
112
|
+
role="presentation"
|
|
113
|
+
{...props}
|
|
114
|
+
>
|
|
115
|
+
<Icon className="size-4" name="more_horiz" />
|
|
116
|
+
<span className="sr-only">More</span>
|
|
117
|
+
</span>
|
|
118
|
+
)
|
|
119
|
+
}
|
package/src/components/chip.tsx
CHANGED
|
@@ -28,9 +28,17 @@ const chipVariants = cva(
|
|
|
28
28
|
export function ChipRoot({
|
|
29
29
|
className,
|
|
30
30
|
variant = 'primary',
|
|
31
|
+
disabled = false,
|
|
31
32
|
...props
|
|
32
|
-
}: ComponentProps<'div'> &
|
|
33
|
-
|
|
33
|
+
}: ComponentProps<'div'> &
|
|
34
|
+
ClassVariantProps<typeof chipVariants> & { disabled?: boolean }) {
|
|
35
|
+
return (
|
|
36
|
+
<div
|
|
37
|
+
className={cx(chipVariants({ variant }), className)}
|
|
38
|
+
data-disabled={disabled}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
export function ChipText({
|
|
@@ -78,7 +86,7 @@ export function ChipClose({
|
|
|
78
86
|
className={cx(
|
|
79
87
|
className,
|
|
80
88
|
'cursor-pointer bg-inherit',
|
|
81
|
-
'invisible items-center justify-center group-hover/chip:visible',
|
|
89
|
+
'invisible items-center justify-center group-hover/chip:data-[disabled=false]:visible',
|
|
82
90
|
'absolute top-0 right-0',
|
|
83
91
|
'h-large-2x w-large-2x rounded-circle',
|
|
84
92
|
'transition-[visibility] duration-200'
|
|
@@ -0,0 +1,242 @@
|
|
|
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 './form/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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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'
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
DayPicker,
|
|
8
8
|
getDefaultClassNames
|
|
9
9
|
} from 'react-day-picker'
|
|
10
|
-
import { Icon, type IconType } from '
|
|
11
|
-
import { Button } from '
|
|
10
|
+
import { Icon, type IconType } from '../icon'
|
|
11
|
+
import { Button } from '../form/button'
|
|
12
12
|
|
|
13
13
|
function capitalize(str: string) {
|
|
14
14
|
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
@@ -43,20 +43,21 @@ export function Calendar({
|
|
|
43
43
|
),
|
|
44
44
|
outside: cx('text-neutral-placeholder', defaultClassNames.outside),
|
|
45
45
|
selected: cx(
|
|
46
|
-
'text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover
|
|
46
|
+
'text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover:!bg-primary-alt-active'
|
|
47
47
|
),
|
|
48
48
|
disabled: cx('opacity-60', defaultClassNames.disabled),
|
|
49
49
|
today: cx(
|
|
50
|
-
'
|
|
51
|
-
defaultClassNames.today
|
|
50
|
+
'text-neutral-dark font-medium bg-layer-2-active hover:!bg-layer-2-active'
|
|
52
51
|
),
|
|
53
52
|
range_start: cx(
|
|
54
|
-
'text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover
|
|
53
|
+
'rounded-r-none text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover:!bg-primary-alt-active'
|
|
55
54
|
),
|
|
56
55
|
range_end: cx(
|
|
57
|
-
'text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover
|
|
56
|
+
'rounded-l-none text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover:!bg-primary-alt-active'
|
|
58
57
|
),
|
|
59
|
-
range_middle: cx(
|
|
58
|
+
range_middle: cx(
|
|
59
|
+
'!bg-primary-alt-active !text-primary-label-active rounded-none hover:!bg-primary-alt-active'
|
|
60
|
+
)
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
return (
|