@xjur-ui/react 2.1.1 → 2.2.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/CHANGELOG.md +12 -0
- package/dist/components/steps/index.js +1 -1
- package/package.json +7 -4
- package/.turbo/turbo-build.log +0 -419
- package/eslint.config.js +0 -10
- package/postcss.config.js +0 -5
- package/prettier.config.js +0 -7
- package/src/components/avatar-group.tsx +0 -76
- package/src/components/avatar.tsx +0 -54
- package/src/components/badge.tsx +0 -40
- package/src/components/breadcrumb.tsx +0 -119
- package/src/components/chip.tsx +0 -117
- package/src/components/collapsible.tsx +0 -35
- package/src/components/controls/button.tsx +0 -107
- package/src/components/controls/calendar.tsx +0 -124
- package/src/components/controls/checkbox.tsx +0 -57
- package/src/components/controls/context/field.context.ts +0 -27
- package/src/components/controls/date-picker.tsx +0 -199
- package/src/components/controls/floating-label.tsx +0 -60
- package/src/components/controls/input.tsx +0 -237
- package/src/components/controls/otp-input.tsx +0 -45
- package/src/components/controls/radio.tsx +0 -74
- package/src/components/controls/rich-editor.tsx +0 -372
- package/src/components/controls/search-input.tsx +0 -154
- package/src/components/controls/search-selector.tsx +0 -98
- package/src/components/controls/select.tsx +0 -274
- package/src/components/controls/switch.tsx +0 -31
- package/src/components/custom/pessoa/index.ts +0 -9
- package/src/components/custom/pessoa/pessoa-add-button.tsx +0 -35
- package/src/components/custom/pessoa/pessoa-body.tsx +0 -22
- package/src/components/custom/pessoa/pessoa-close-button.tsx +0 -13
- package/src/components/custom/pessoa/pessoa-content.tsx +0 -25
- package/src/components/custom/pessoa/pessoa-footer.tsx +0 -15
- package/src/components/custom/pessoa/pessoa-header.tsx +0 -35
- package/src/components/custom/pessoa/pessoa-trigger.tsx +0 -25
- package/src/components/custom/pessoa/pessoa.context.tsx +0 -73
- package/src/components/custom/pessoa/pessoa.tsx +0 -35
- package/src/components/dialog.tsx +0 -242
- package/src/components/divider.tsx +0 -24
- package/src/components/drag-and-drop/drag-handle.tsx +0 -46
- package/src/components/drag-and-drop/drag-list-item.tsx +0 -91
- package/src/components/drag-and-drop/drag-list.tsx +0 -47
- package/src/components/drag-and-drop/drag-root.tsx +0 -30
- package/src/components/drag-and-drop/index.ts +0 -39
- package/src/components/drag-and-drop/types/drag-item.ts +0 -7
- package/src/components/dropdown-menu.tsx +0 -101
- package/src/components/full-calendar/calendar-add-event.tsx +0 -15
- package/src/components/full-calendar/calendar-body.tsx +0 -12
- package/src/components/full-calendar/calendar-cell.tsx +0 -120
- package/src/components/full-calendar/calendar-day-view.tsx +0 -76
- package/src/components/full-calendar/calendar-event.tsx +0 -178
- package/src/components/full-calendar/calendar-header.tsx +0 -14
- package/src/components/full-calendar/calendar-month-view.tsx +0 -69
- package/src/components/full-calendar/calendar-more-events-dropdown.tsx +0 -39
- package/src/components/full-calendar/calendar-navigator.tsx +0 -86
- package/src/components/full-calendar/calendar-root.tsx +0 -165
- package/src/components/full-calendar/calendar-today-button.tsx +0 -21
- package/src/components/full-calendar/calendar-toggle-view.tsx +0 -61
- package/src/components/full-calendar/calendar-view-renderer.tsx +0 -19
- package/src/components/full-calendar/calendar-week-day.tsx +0 -49
- package/src/components/full-calendar/calendar-week-view.tsx +0 -88
- package/src/components/full-calendar/helpers/calendar.ts +0 -158
- package/src/components/full-calendar/index.ts +0 -16
- package/src/components/full-calendar/types/calendar-cell.ts +0 -4
- package/src/components/full-calendar/types/calendar-event.ts +0 -7
- package/src/components/full-calendar/types/calendar-view.ts +0 -1
- package/src/components/full-calendar/types/calendar-week-hour.ts +0 -4
- package/src/components/horizontal-scroll.tsx +0 -159
- package/src/components/icon.tsx +0 -29
- package/src/components/list.tsx +0 -111
- package/src/components/logo.tsx +0 -44
- package/src/components/selection-bar.tsx +0 -273
- package/src/components/sheet.tsx +0 -150
- package/src/components/skeleton.tsx +0 -12
- package/src/components/status.tsx +0 -43
- package/src/components/steps/index.ts +0 -6
- package/src/components/steps/step.tsx +0 -23
- package/src/components/steps/steps-action.tsx +0 -65
- package/src/components/steps/steps-content.tsx +0 -12
- package/src/components/steps/steps-context.tsx +0 -121
- package/src/components/steps/steps-navigation.tsx +0 -80
- package/src/components/steps/steps-root.tsx +0 -9
- package/src/components/table/index.ts +0 -8
- package/src/components/table/table-body.tsx +0 -17
- package/src/components/table/table-cell.tsx +0 -14
- package/src/components/table/table-footer.tsx +0 -17
- package/src/components/table/table-head.tsx +0 -31
- package/src/components/table/table-header.tsx +0 -17
- package/src/components/table/table-row.tsx +0 -21
- package/src/components/table/table-sort.tsx +0 -34
- package/src/components/table/table.tsx +0 -16
- package/src/components/tabs.tsx +0 -72
- package/src/components/tag.tsx +0 -99
- package/src/components/tooltip.tsx +0 -63
- package/src/components/typography.tsx +0 -85
- package/src/components/upload.tsx +0 -647
- package/src/hooks/index.ts +0 -1
- package/src/hooks/use-os.ts +0 -32
- package/src/index.css +0 -5
- package/src/resources/icons.ts +0 -154
- package/src/resources/input-mask.ts +0 -91
- package/src/resources/logo/horizontal.tsx +0 -70
- package/src/resources/logo/icon.tsx +0 -54
- package/src/resources/logo/index.tsx +0 -33
- package/src/resources/logo/vertical.tsx +0 -70
- package/src/types.d.ts +0 -4
- package/tsconfig.json +0 -4
- package/tsup.config.ts +0 -30
package/src/components/badge.tsx
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { cva, type ClassVariantProps, cx } from '@xjur-ui/util'
|
|
2
|
-
import { Typography } from './typography'
|
|
3
|
-
|
|
4
|
-
const badgeVariants = cva(
|
|
5
|
-
[
|
|
6
|
-
'flex items-center justify-center size-large p-small-2x text-neutral-label rounded-circle'
|
|
7
|
-
],
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
primary: 'bg-primary-idle',
|
|
12
|
-
secondary: 'bg-secondary-idle',
|
|
13
|
-
neutral: 'bg-alt-2-idle',
|
|
14
|
-
success: 'bg-success-idle',
|
|
15
|
-
warning: 'bg-warning-idle',
|
|
16
|
-
danger: 'bg-danger-idle'
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
defaultVariants: {
|
|
20
|
-
variant: 'neutral'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
export function Badge({
|
|
26
|
-
variant = 'neutral',
|
|
27
|
-
children,
|
|
28
|
-
className
|
|
29
|
-
}: ClassVariantProps<typeof badgeVariants> & {
|
|
30
|
-
children: string
|
|
31
|
-
className?: string
|
|
32
|
-
}) {
|
|
33
|
-
return (
|
|
34
|
-
<span className={cx(badgeVariants({ variant }), className)}>
|
|
35
|
-
<Typography className="text-inherit" size="sm-2x" variant="label">
|
|
36
|
-
{children}
|
|
37
|
-
</Typography>
|
|
38
|
-
</span>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { cva, cx, type ClassVariantProps } from '@xjur-ui/util'
|
|
2
|
-
import { type ComponentProps } from 'react'
|
|
3
|
-
import { Typography } from './typography'
|
|
4
|
-
import { Icon, type IconType } from './icon'
|
|
5
|
-
import { AvatarFallback, AvatarImage, AvatarRoot } from './avatar'
|
|
6
|
-
|
|
7
|
-
const chipVariants = cva(
|
|
8
|
-
[
|
|
9
|
-
'group/chip relative h-large-2x w-fit rounded-circle px-small py-none flex items-center gap-small_1x-alt',
|
|
10
|
-
'transition-all duration-200'
|
|
11
|
-
],
|
|
12
|
-
{
|
|
13
|
-
variants: {
|
|
14
|
-
variant: {
|
|
15
|
-
primary:
|
|
16
|
-
'bg-primary-alt-idle text-primary-label-idle hover:bg-primary-alt-hover',
|
|
17
|
-
danger:
|
|
18
|
-
'bg-danger-alt-idle text-danger-label-idle hover:bg-danger-alt-hover',
|
|
19
|
-
neutral: 'bg-layer-1-idle text-neutral-dark hover:bg-layer-1-hover'
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
defaultVariants: {
|
|
23
|
-
variant: 'primary'
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
export function ChipRoot({
|
|
29
|
-
className,
|
|
30
|
-
variant = 'primary',
|
|
31
|
-
disabled = false,
|
|
32
|
-
...props
|
|
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
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function ChipText({
|
|
45
|
-
variant = 'label',
|
|
46
|
-
size = 'sm-1x',
|
|
47
|
-
weight = 'medium',
|
|
48
|
-
className,
|
|
49
|
-
...props
|
|
50
|
-
}: ComponentProps<typeof Typography>) {
|
|
51
|
-
return (
|
|
52
|
-
<Typography
|
|
53
|
-
className={cx(className, 'truncate')}
|
|
54
|
-
size={size}
|
|
55
|
-
variant={variant}
|
|
56
|
-
weight={weight}
|
|
57
|
-
{...props}
|
|
58
|
-
/>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function ChipIcon({ className, ...props }: ComponentProps<typeof Icon>) {
|
|
63
|
-
return (
|
|
64
|
-
<Icon
|
|
65
|
-
className={
|
|
66
|
-
(cx(
|
|
67
|
-
'text-size-body-md',
|
|
68
|
-
'group-data-[variant=primary]:text-primary-label-idle',
|
|
69
|
-
'group-data-[variant=danger]:text-danger-label-idle',
|
|
70
|
-
'group-data-[variant=neutral]:text-icon-neutral-3'
|
|
71
|
-
),
|
|
72
|
-
className)
|
|
73
|
-
}
|
|
74
|
-
{...props}
|
|
75
|
-
/>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function ChipClose({
|
|
80
|
-
className,
|
|
81
|
-
children = <ChipIcon name="close" />,
|
|
82
|
-
...props
|
|
83
|
-
}: ComponentProps<'button'> & { name?: IconType }) {
|
|
84
|
-
return (
|
|
85
|
-
<button
|
|
86
|
-
className={cx(
|
|
87
|
-
className,
|
|
88
|
-
'cursor-pointer bg-inherit',
|
|
89
|
-
'invisible items-center justify-center group-hover/chip:data-[disabled=false]:visible',
|
|
90
|
-
'absolute top-0 right-0',
|
|
91
|
-
'h-large-2x w-large-2x rounded-circle',
|
|
92
|
-
'transition-[visibility] duration-200'
|
|
93
|
-
)}
|
|
94
|
-
type="button"
|
|
95
|
-
{...props}
|
|
96
|
-
>
|
|
97
|
-
{children}
|
|
98
|
-
</button>
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export function ChipAvatar({
|
|
103
|
-
size = 'xs',
|
|
104
|
-
avatarFallback = 'CN',
|
|
105
|
-
avatarUrl,
|
|
106
|
-
...props
|
|
107
|
-
}: ComponentProps<typeof AvatarRoot> & {
|
|
108
|
-
avatarUrl?: string
|
|
109
|
-
avatarFallback: string
|
|
110
|
-
}) {
|
|
111
|
-
return (
|
|
112
|
-
<AvatarRoot size={size} style={{ marginLeft: '-4px' }} {...props}>
|
|
113
|
-
{avatarUrl && <AvatarImage src={avatarUrl} />}
|
|
114
|
-
<AvatarFallback>{avatarFallback}</AvatarFallback>
|
|
115
|
-
</AvatarRoot>
|
|
116
|
-
)
|
|
117
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible'
|
|
2
|
-
import { cx } from '@xjur-ui/util'
|
|
3
|
-
|
|
4
|
-
export function CollapsibleRoot({
|
|
5
|
-
...props
|
|
6
|
-
}: React.ComponentProps<typeof CollapsiblePrimitive.Root>) {
|
|
7
|
-
return <CollapsiblePrimitive.Root data-slot="collapsible" {...props} />
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function CollapsibleTrigger({
|
|
11
|
-
...props
|
|
12
|
-
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>) {
|
|
13
|
-
return (
|
|
14
|
-
<CollapsiblePrimitive.CollapsibleTrigger
|
|
15
|
-
data-slot="collapsible-trigger"
|
|
16
|
-
{...props}
|
|
17
|
-
/>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function CollapsibleContent({
|
|
22
|
-
className,
|
|
23
|
-
...props
|
|
24
|
-
}: React.ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) {
|
|
25
|
-
return (
|
|
26
|
-
<CollapsiblePrimitive.CollapsibleContent
|
|
27
|
-
className={cx(
|
|
28
|
-
className,
|
|
29
|
-
'data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up'
|
|
30
|
-
)}
|
|
31
|
-
data-slot="collapsible-content"
|
|
32
|
-
{...props}
|
|
33
|
-
/>
|
|
34
|
-
)
|
|
35
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { Slot } from '@radix-ui/react-slot'
|
|
2
|
-
import type { ComponentProps } from 'react'
|
|
3
|
-
import { cva, cx, type ClassVariantProps } from '@xjur-ui/util'
|
|
4
|
-
|
|
5
|
-
export const buttonVariants = cva(
|
|
6
|
-
[
|
|
7
|
-
'outline-none inline-flex items-center justify-center rounded-circle gap-small cursor-pointer disabled:opacity-38 disabled:pointer-events-none transition-colors'
|
|
8
|
-
],
|
|
9
|
-
{
|
|
10
|
-
variants: {
|
|
11
|
-
size: {
|
|
12
|
-
md: 'py-small_1x-alt px-medium text-size-body-md',
|
|
13
|
-
sm: 'py-small-1x px-small text-size-label-sm',
|
|
14
|
-
icon_md: 'p-small text-size-body-md h-large-4x w-large-4x',
|
|
15
|
-
icon_sm: 'p-small-1x text-size-label-sm h-large-2x w-large-2x'
|
|
16
|
-
},
|
|
17
|
-
variant: {
|
|
18
|
-
primary: '',
|
|
19
|
-
secondary: '',
|
|
20
|
-
tertiary: '',
|
|
21
|
-
destructive: '',
|
|
22
|
-
outlined:
|
|
23
|
-
'bg-layer-2-idle border border-border-layer-2 hover:bg-layer-2-hover active:bg-layer-2-pressed'
|
|
24
|
-
},
|
|
25
|
-
appearance: {
|
|
26
|
-
solid: '',
|
|
27
|
-
ghost: 'bg-transparent'
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
compoundVariants: [
|
|
31
|
-
{
|
|
32
|
-
variant: 'primary',
|
|
33
|
-
appearance: 'solid',
|
|
34
|
-
class:
|
|
35
|
-
'bg-primary-idle text-neutral-label hover:bg-primary-hover active:bg-primary-pressed'
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
variant: 'primary',
|
|
39
|
-
appearance: 'ghost',
|
|
40
|
-
class:
|
|
41
|
-
'text-primary-idle hover:bg-primary-alt-idle active:bg-primary-alt-pressed'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
variant: 'secondary',
|
|
45
|
-
appearance: 'solid',
|
|
46
|
-
class:
|
|
47
|
-
'bg-layer-1-hover text-neutral-dark hover:bg-layer-1-pressed active:bg-layer-1-active'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
variant: 'secondary',
|
|
51
|
-
appearance: 'ghost',
|
|
52
|
-
class: 'hover:bg-layer-1-hover active:bg-layer-1-pressed'
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
variant: 'tertiary',
|
|
56
|
-
appearance: 'solid',
|
|
57
|
-
class:
|
|
58
|
-
'bg-layer-2-hover text-neutral-dark hover:bg-layer-2-pressed active:bg-layer-2-active'
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
variant: 'tertiary',
|
|
62
|
-
appearance: 'ghost',
|
|
63
|
-
class: 'hover:bg-layer-2-hover active:bg-layer-2-pressed'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
variant: 'destructive',
|
|
67
|
-
appearance: 'solid',
|
|
68
|
-
class:
|
|
69
|
-
'bg-danger-idle text-neutral-label hover:bg-danger-hover active:bg-danger-pressed'
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
variant: 'destructive',
|
|
73
|
-
appearance: 'ghost',
|
|
74
|
-
class:
|
|
75
|
-
'text-danger-label-idle hover:bg-danger-alt-idle active:bg-danger-alt-pressed'
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
defaultVariants: {
|
|
79
|
-
size: 'md',
|
|
80
|
-
variant: 'primary',
|
|
81
|
-
appearance: 'solid'
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
export interface ButtonProps
|
|
87
|
-
extends ComponentProps<'button'>,
|
|
88
|
-
ClassVariantProps<typeof buttonVariants> {
|
|
89
|
-
asChild?: boolean
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export function Button({
|
|
93
|
-
asChild,
|
|
94
|
-
className,
|
|
95
|
-
variant = 'primary',
|
|
96
|
-
size = 'md',
|
|
97
|
-
appearance = 'solid',
|
|
98
|
-
...props
|
|
99
|
-
}: ButtonProps) {
|
|
100
|
-
const Component = asChild ? Slot : 'button'
|
|
101
|
-
return (
|
|
102
|
-
<Component
|
|
103
|
-
className={cx(buttonVariants({ variant, appearance, size }), className)}
|
|
104
|
-
{...props}
|
|
105
|
-
/>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import 'react-day-picker/style.css'
|
|
2
|
-
import { ptBR } from 'date-fns/locale'
|
|
3
|
-
import { cx } from '@xjur-ui/util'
|
|
4
|
-
import {
|
|
5
|
-
type DayPickerProps,
|
|
6
|
-
type ClassNames,
|
|
7
|
-
DayPicker,
|
|
8
|
-
getDefaultClassNames
|
|
9
|
-
} from 'react-day-picker'
|
|
10
|
-
import { Icon, type IconType } from '../icon'
|
|
11
|
-
import { Button } from './button'
|
|
12
|
-
|
|
13
|
-
function capitalize(str: string) {
|
|
14
|
-
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { type DateRange } from 'react-day-picker'
|
|
18
|
-
|
|
19
|
-
export type CalendarProps = DayPickerProps & {
|
|
20
|
-
handleClear?: () => void
|
|
21
|
-
handleToday?: () => void
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function Calendar({
|
|
25
|
-
showOutsideDays = true,
|
|
26
|
-
locale = ptBR,
|
|
27
|
-
navLayout = 'around',
|
|
28
|
-
handleClear,
|
|
29
|
-
handleToday,
|
|
30
|
-
...props
|
|
31
|
-
}: CalendarProps) {
|
|
32
|
-
const defaultClassNames = getDefaultClassNames()
|
|
33
|
-
|
|
34
|
-
const classNames: Partial<ClassNames> = {
|
|
35
|
-
root: cx(
|
|
36
|
-
'bg-layer-2-idle shadow-elevation-2 rounded-[6px] p-small w-fit border border-border-layer-2 text-size-body-md text-neutral-dark font-inter',
|
|
37
|
-
defaultClassNames.root
|
|
38
|
-
),
|
|
39
|
-
day: cx('rounded-circle hover:bg-layer-2-hover'),
|
|
40
|
-
caption_label: cx(
|
|
41
|
-
'text-size-label-md text-neutral-dark font-medium',
|
|
42
|
-
defaultClassNames.caption_label
|
|
43
|
-
),
|
|
44
|
-
outside: cx('text-neutral-placeholder', defaultClassNames.outside),
|
|
45
|
-
selected: cx(
|
|
46
|
-
'text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover:!bg-primary-alt-active'
|
|
47
|
-
),
|
|
48
|
-
disabled: cx('opacity-60', defaultClassNames.disabled),
|
|
49
|
-
today: cx(
|
|
50
|
-
'text-neutral-dark font-medium bg-layer-2-active hover:!bg-layer-2-active'
|
|
51
|
-
),
|
|
52
|
-
range_start: cx(
|
|
53
|
-
'rounded-r-none text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover:!bg-primary-alt-active'
|
|
54
|
-
),
|
|
55
|
-
range_end: cx(
|
|
56
|
-
'rounded-l-none text-size-body-md bg-primary-alt-active text-primary-label-active font-medium hover:!bg-primary-alt-active'
|
|
57
|
-
),
|
|
58
|
-
range_middle: cx(
|
|
59
|
-
'!bg-primary-alt-active !text-primary-label-active rounded-none hover:!bg-primary-alt-active'
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<DayPicker
|
|
65
|
-
classNames={{ ...classNames, ...props.classNames }}
|
|
66
|
-
components={{
|
|
67
|
-
Chevron: ({ orientation }) => {
|
|
68
|
-
const icon = orientation === 'left' ? 'chevron_left' : 'chevron_right'
|
|
69
|
-
return (
|
|
70
|
-
<Icon
|
|
71
|
-
className="size-large text-icon-neutral-3"
|
|
72
|
-
name={icon as IconType}
|
|
73
|
-
/>
|
|
74
|
-
)
|
|
75
|
-
},
|
|
76
|
-
...props.components
|
|
77
|
-
}}
|
|
78
|
-
footer={
|
|
79
|
-
(handleClear || handleToday) && (
|
|
80
|
-
<div className="py-small border-border-layer-2 mt-small flex h-full w-full items-center justify-between border-t">
|
|
81
|
-
{handleToday && (
|
|
82
|
-
<Button
|
|
83
|
-
appearance="ghost"
|
|
84
|
-
variant="secondary"
|
|
85
|
-
onClick={handleToday}
|
|
86
|
-
>
|
|
87
|
-
Hoje
|
|
88
|
-
</Button>
|
|
89
|
-
)}
|
|
90
|
-
{handleClear && (
|
|
91
|
-
<Button
|
|
92
|
-
appearance="ghost"
|
|
93
|
-
variant="secondary"
|
|
94
|
-
onClick={handleClear}
|
|
95
|
-
>
|
|
96
|
-
Limpar
|
|
97
|
-
</Button>
|
|
98
|
-
)}
|
|
99
|
-
</div>
|
|
100
|
-
)
|
|
101
|
-
}
|
|
102
|
-
formatters={{
|
|
103
|
-
formatWeekdayName: date => {
|
|
104
|
-
const weekday = date.toLocaleDateString('pt-BR', { weekday: 'short' })
|
|
105
|
-
return (
|
|
106
|
-
weekday.charAt(0).toUpperCase() + weekday.slice(1).replace('.', '')
|
|
107
|
-
)
|
|
108
|
-
},
|
|
109
|
-
formatCaption(month) {
|
|
110
|
-
const monthName = month.toLocaleDateString('pt-BR', {
|
|
111
|
-
month: 'long'
|
|
112
|
-
})
|
|
113
|
-
return `${capitalize(monthName)} ${month.getFullYear()}`
|
|
114
|
-
},
|
|
115
|
-
...props.formatters
|
|
116
|
-
}}
|
|
117
|
-
locale={locale}
|
|
118
|
-
mode={props.mode ?? 'single'}
|
|
119
|
-
navLayout={navLayout}
|
|
120
|
-
showOutsideDays={showOutsideDays}
|
|
121
|
-
{...props}
|
|
122
|
-
/>
|
|
123
|
-
)
|
|
124
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import * as CheckoxPrimitive from '@radix-ui/react-checkbox'
|
|
2
|
-
import { cx } from '@xjur-ui/util'
|
|
3
|
-
import { Icon } from '../icon'
|
|
4
|
-
import { Typography } from '../typography'
|
|
5
|
-
|
|
6
|
-
export function Checkbox({
|
|
7
|
-
label,
|
|
8
|
-
name,
|
|
9
|
-
className,
|
|
10
|
-
disabled = false,
|
|
11
|
-
...props
|
|
12
|
-
}: CheckoxPrimitive.CheckboxProps & {
|
|
13
|
-
label?: string
|
|
14
|
-
}) {
|
|
15
|
-
const fieldId = `field-checkbox-${name}`
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<div className="group gap-small flex items-center">
|
|
19
|
-
<CheckoxPrimitive.Root
|
|
20
|
-
disabled={disabled}
|
|
21
|
-
{...props}
|
|
22
|
-
className={cx(
|
|
23
|
-
// layout
|
|
24
|
-
'size-large-alt rounded-small-1x inline-flex items-center justify-center transition-[border-color,box-shadow,background-color] duration-200 outline-none',
|
|
25
|
-
// base
|
|
26
|
-
'border-border-layer-2 bg-layer-2-idle cursor-pointer border-2',
|
|
27
|
-
// hover/focus (desmarcado)
|
|
28
|
-
'hover:border-primary-idle focus:border-primary-idle focus:shadow-focus-primary',
|
|
29
|
-
// estado checked
|
|
30
|
-
'data-[state=checked]:bg-primary-active data-[state=checked]:border-primary-active',
|
|
31
|
-
// hover quando estiver checked (opcional)
|
|
32
|
-
'data-[state=checked]:hover:border-primary-idle',
|
|
33
|
-
// disabled
|
|
34
|
-
'disabled:hover:border-border-layer-2 disabled:cursor-not-allowed disabled:opacity-[38%]',
|
|
35
|
-
className
|
|
36
|
-
)}
|
|
37
|
-
id={fieldId}
|
|
38
|
-
name={name}
|
|
39
|
-
>
|
|
40
|
-
<CheckoxPrimitive.Indicator className="flex items-center justify-center">
|
|
41
|
-
<Icon className="text-neutral-label" name="check" />
|
|
42
|
-
</CheckoxPrimitive.Indicator>
|
|
43
|
-
</CheckoxPrimitive.Root>
|
|
44
|
-
|
|
45
|
-
{!!label && (
|
|
46
|
-
<Typography
|
|
47
|
-
asChild={true}
|
|
48
|
-
className="text-size-body-sm data-[disabled=true]:opacity-38"
|
|
49
|
-
data-disabled={disabled}
|
|
50
|
-
weight="medium"
|
|
51
|
-
>
|
|
52
|
-
<label htmlFor={fieldId}>{label}</label>
|
|
53
|
-
</Typography>
|
|
54
|
-
)}
|
|
55
|
-
</div>
|
|
56
|
-
)
|
|
57
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react'
|
|
2
|
-
import type { MaskOptions } from '@react-input/mask'
|
|
3
|
-
import type { InputMaskType } from '../../../resources/input-mask'
|
|
4
|
-
|
|
5
|
-
export interface FieldContextValue {
|
|
6
|
-
state?: 'normal' | 'error' | 'disabled'
|
|
7
|
-
variant?: 'normal' | 'filter'
|
|
8
|
-
customMask?: MaskOptions
|
|
9
|
-
mask?: InputMaskType
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const FieldContext = createContext<FieldContextValue>({
|
|
13
|
-
state: 'normal',
|
|
14
|
-
variant: 'normal',
|
|
15
|
-
customMask: undefined,
|
|
16
|
-
mask: undefined
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
export function useFieldContext() {
|
|
20
|
-
const context = useContext(FieldContext)
|
|
21
|
-
if (!context) {
|
|
22
|
-
throw new Error(
|
|
23
|
-
'useFieldContext must be used within a InputRoot, SelectRoot, DatePickerRoot, etc.'
|
|
24
|
-
)
|
|
25
|
-
}
|
|
26
|
-
return context
|
|
27
|
-
}
|