@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.
- package/CHANGELOG.md +18 -0
- package/dist/{chunk-DT44JTXB.js → chunk-4M3WR2KJ.js} +2 -2
- package/dist/{chunk-DT44JTXB.js.map → chunk-4M3WR2KJ.js.map} +1 -1
- package/dist/{chunk-7HG6Y3VV.js → chunk-BYXTOSM6.js} +2 -2
- package/dist/{chunk-7HG6Y3VV.js.map → chunk-BYXTOSM6.js.map} +1 -1
- package/dist/{chunk-4PTFZTVU.js → chunk-HLWHETF5.js} +2 -2
- package/dist/{chunk-4PTFZTVU.js.map → chunk-HLWHETF5.js.map} +1 -1
- package/dist/{chunk-ASZAHSU5.js → chunk-SLMHDBWO.js} +2 -2
- package/dist/{chunk-ASZAHSU5.js.map → chunk-SLMHDBWO.js.map} +1 -1
- package/dist/{chunk-MQ7YTZBI.js → chunk-TTKENFBF.js} +2 -2
- package/dist/{chunk-MQ7YTZBI.js.map → chunk-TTKENFBF.js.map} +1 -1
- package/dist/components/accordion.d.ts +54 -0
- package/dist/components/accordion.js +2 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/controls/rating.d.ts +137 -0
- package/dist/components/controls/rating.js +2 -0
- package/dist/components/controls/rating.js.map +1 -0
- package/dist/components/controls/rich-editor.js +1 -1
- package/dist/components/controls/slider.d.ts +172 -0
- package/dist/components/controls/slider.js +2 -0
- package/dist/components/controls/slider.js.map +1 -0
- package/dist/components/custom/pessoa/index.js +1 -1
- package/dist/components/drag-and-drop/index.js +1 -1
- package/dist/components/full-calendar/calendar-cell.js +1 -1
- package/dist/components/full-calendar/calendar-day-view.js +1 -1
- package/dist/components/full-calendar/calendar-month-view.js +1 -1
- package/dist/components/full-calendar/calendar-view-renderer.js +1 -1
- package/dist/components/full-calendar/calendar-week-view.js +1 -1
- package/dist/components/full-calendar/index.js +1 -1
- package/dist/components/selection-bar.d.ts +1 -1
- package/dist/components/status.d.ts +1 -1
- package/dist/components/steps/index.js +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/toast.d.ts +27 -0
- package/dist/components/toast.js +2 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/typography.d.ts +1 -1
- package/dist/components/upload.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +25 -16
- 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
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { tv, twJoin, twMerge } from '@xjur-ui/util'
|
|
2
|
-
import { useMemo, type ComponentProps } from 'react'
|
|
3
|
-
import * as RadixPopover from '@radix-ui/react-popover'
|
|
4
|
-
import { Icon, type IconType } from '../icon'
|
|
5
|
-
import { Typography } from '../typography'
|
|
6
|
-
import {
|
|
7
|
-
FieldContext,
|
|
8
|
-
useFieldContext,
|
|
9
|
-
type FieldContextValue
|
|
10
|
-
} from './context/field.context'
|
|
11
|
-
import { FloatingLabel } from './floating-label'
|
|
12
|
-
|
|
13
|
-
export const datePicker = tv({
|
|
14
|
-
slots: {
|
|
15
|
-
wrapper: 'group flex w-full flex-col gap-small-2x',
|
|
16
|
-
trigger: [
|
|
17
|
-
'h-large-4x w-full cursor-pointer relative',
|
|
18
|
-
'flex items-center gap-small rounded-small-1x',
|
|
19
|
-
'py-small_1x-alt px-small',
|
|
20
|
-
'bg-layer-2-hover border border-transparent',
|
|
21
|
-
'group-has-[div[data-slot=input-action-slot]]:rounded-r-none',
|
|
22
|
-
'transition-all duration-200'
|
|
23
|
-
],
|
|
24
|
-
content: [
|
|
25
|
-
'group z-10 max-h-[var(--radix-popover-content-available-height)] max-w-[var(--radix-popover-content-available-width)] min-w-[var(--radix-popover-trigger-width)]'
|
|
26
|
-
],
|
|
27
|
-
icon: 'size-large text-icon-neutral-3 flex items-center justify-center',
|
|
28
|
-
slotText:
|
|
29
|
-
'size-large flex items-center justify-center !text-size-label-md text-neutral-placeholder',
|
|
30
|
-
caption: '!text-size-body-sm font-normal'
|
|
31
|
-
},
|
|
32
|
-
variants: {
|
|
33
|
-
state: {
|
|
34
|
-
normal: {
|
|
35
|
-
trigger:
|
|
36
|
-
'hover:border-border-layer-1 data-[state=open]:border-primary-idle data-[state=open]:hover:border-primary-idle'
|
|
37
|
-
},
|
|
38
|
-
error: {
|
|
39
|
-
trigger:
|
|
40
|
-
'border-danger-idle hover:border-danger-idle data-[state=open]:border-danger-idle data-[state=open]:hover:border-danger-idle',
|
|
41
|
-
caption: 'text-danger-label-idle'
|
|
42
|
-
},
|
|
43
|
-
disabled: {
|
|
44
|
-
trigger: 'pointer-events-none border-transparent bg-layer-2-idle'
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
const { wrapper, trigger, icon, caption, slotText, content } = datePicker()
|
|
51
|
-
|
|
52
|
-
export function DatePickerRoot({
|
|
53
|
-
className,
|
|
54
|
-
state = 'normal',
|
|
55
|
-
defaultOpen,
|
|
56
|
-
variant = 'normal',
|
|
57
|
-
modal,
|
|
58
|
-
open,
|
|
59
|
-
onOpenChange: handleOpenChange,
|
|
60
|
-
...props
|
|
61
|
-
}: ComponentProps<'div'> &
|
|
62
|
-
FieldContextValue &
|
|
63
|
-
ComponentProps<typeof RadixPopover.Root>) {
|
|
64
|
-
return (
|
|
65
|
-
<RadixPopover.Root
|
|
66
|
-
defaultOpen={defaultOpen}
|
|
67
|
-
modal={modal}
|
|
68
|
-
open={open}
|
|
69
|
-
onOpenChange={handleOpenChange}
|
|
70
|
-
>
|
|
71
|
-
<FieldContext.Provider value={{ state, variant }}>
|
|
72
|
-
<div className={wrapper({ className, state })} {...props} />
|
|
73
|
-
</FieldContext.Provider>
|
|
74
|
-
</RadixPopover.Root>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export function DatePickerTrigger({
|
|
79
|
-
className,
|
|
80
|
-
...props
|
|
81
|
-
}: ComponentProps<typeof RadixPopover.Trigger>) {
|
|
82
|
-
const { state, variant } = useFieldContext()
|
|
83
|
-
|
|
84
|
-
const filterTrigger = tv({
|
|
85
|
-
base: ['group bg-layer-2-idle relative'],
|
|
86
|
-
variants: {
|
|
87
|
-
state: {
|
|
88
|
-
normal: [
|
|
89
|
-
'border-border-layer-2 hover:border-border-layer-3 has-[input:not(:placeholder-shown)]:border-primary-idle'
|
|
90
|
-
],
|
|
91
|
-
error: ['border-danger-idle hover:border-danger-idle'],
|
|
92
|
-
disabled: ['border border-border-layer-2 opacity-60']
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
const mergedClassName = twMerge(
|
|
98
|
-
trigger({ state, className }),
|
|
99
|
-
variant === 'filter' && filterTrigger({ state, className })
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
<RadixPopover.Trigger
|
|
104
|
-
className={mergedClassName}
|
|
105
|
-
disabled={state === 'disabled'}
|
|
106
|
-
{...props}
|
|
107
|
-
/>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export function DatePickerLabel(props: ComponentProps<typeof FloatingLabel>) {
|
|
112
|
-
return <FloatingLabel {...props} />
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export function DatePickerIcon({
|
|
116
|
-
className,
|
|
117
|
-
name,
|
|
118
|
-
...props
|
|
119
|
-
}: ComponentProps<'div'> & {
|
|
120
|
-
name: IconType
|
|
121
|
-
}) {
|
|
122
|
-
const { state } = useFieldContext()
|
|
123
|
-
|
|
124
|
-
return (
|
|
125
|
-
<div className={icon({ className, state })} {...props}>
|
|
126
|
-
<Icon name={name} />
|
|
127
|
-
</div>
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export function DatePickerSlot({
|
|
132
|
-
className,
|
|
133
|
-
...props
|
|
134
|
-
}: ComponentProps<'span'>) {
|
|
135
|
-
const { state } = useFieldContext()
|
|
136
|
-
return <span className={slotText({ className, state })} {...props} />
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export function DatePickerValue({
|
|
140
|
-
className,
|
|
141
|
-
displayValue = '',
|
|
142
|
-
value,
|
|
143
|
-
...props
|
|
144
|
-
}: ComponentProps<'input'> & { displayValue?: string }) {
|
|
145
|
-
const { variant } = useFieldContext()
|
|
146
|
-
|
|
147
|
-
const valueOrPlaceholder = useMemo(() => {
|
|
148
|
-
if (variant === 'filter') return displayValue
|
|
149
|
-
return displayValue || props.placeholder
|
|
150
|
-
}, [displayValue, props.placeholder, variant])
|
|
151
|
-
|
|
152
|
-
return (
|
|
153
|
-
<>
|
|
154
|
-
<Typography className="text-neutral-dark group-has-[div[data-slot=date-picker-left-slot]]:pl-large-1x">
|
|
155
|
-
{valueOrPlaceholder}
|
|
156
|
-
</Typography>
|
|
157
|
-
|
|
158
|
-
<input
|
|
159
|
-
{...props}
|
|
160
|
-
aria-readonly={true}
|
|
161
|
-
className={twJoin('pointer-events-none', className)}
|
|
162
|
-
hidden={true}
|
|
163
|
-
placeholder={' '}
|
|
164
|
-
readOnly={true}
|
|
165
|
-
value={value ?? ''}
|
|
166
|
-
/>
|
|
167
|
-
</>
|
|
168
|
-
)
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export function DatePickerContent({
|
|
172
|
-
className,
|
|
173
|
-
sideOffset = 5,
|
|
174
|
-
side = 'bottom',
|
|
175
|
-
align = 'start',
|
|
176
|
-
...props
|
|
177
|
-
}: ComponentProps<typeof RadixPopover.Content>) {
|
|
178
|
-
const { state } = useFieldContext()
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
<RadixPopover.Portal>
|
|
182
|
-
<RadixPopover.Content
|
|
183
|
-
align={align}
|
|
184
|
-
className={content({ className, state })}
|
|
185
|
-
side={side}
|
|
186
|
-
sideOffset={sideOffset}
|
|
187
|
-
{...props}
|
|
188
|
-
/>
|
|
189
|
-
</RadixPopover.Portal>
|
|
190
|
-
)
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export function DatePickerCaption({
|
|
194
|
-
className,
|
|
195
|
-
...props
|
|
196
|
-
}: ComponentProps<'p'>) {
|
|
197
|
-
const { state } = useFieldContext()
|
|
198
|
-
return <p className={caption({ className, state })} {...props} />
|
|
199
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from 'react'
|
|
2
|
-
import { tv } from '@xjur-ui/util'
|
|
3
|
-
import { useFieldContext } from './context/field.context'
|
|
4
|
-
|
|
5
|
-
export function FloatingLabel({
|
|
6
|
-
className,
|
|
7
|
-
htmlFor,
|
|
8
|
-
children,
|
|
9
|
-
...props
|
|
10
|
-
}: ComponentProps<'label'>) {
|
|
11
|
-
const { state } = useFieldContext()
|
|
12
|
-
|
|
13
|
-
const label = tv({
|
|
14
|
-
base: [
|
|
15
|
-
'group inline-block max-w-full truncate text-left',
|
|
16
|
-
'ease animate-in left-small right-small pointer-events-none absolute top-1/2 -translate-y-1/2 transition-all duration-250',
|
|
17
|
-
'text-size-body-md',
|
|
18
|
-
// Filled
|
|
19
|
-
'group-focus-within:-top-[3px]',
|
|
20
|
-
'group-data-[state=open]:-top-[3px]',
|
|
21
|
-
|
|
22
|
-
'group-focus-within:text-size-label-sm-1x group-focus-within:font-medium',
|
|
23
|
-
'group-data-[state=open]:text-size-label-sm-1x group-data-[state=open]:font-medium',
|
|
24
|
-
|
|
25
|
-
'group-has-[input:not(:placeholder-shown)]:-top-[3px]',
|
|
26
|
-
'group-has-[input:not(:placeholder-shown)]:text-size-label-sm-1x',
|
|
27
|
-
'group-has-[input:not(:placeholder-shown)]:font-medium',
|
|
28
|
-
// If has left slot
|
|
29
|
-
'group-has-[div[data-slot=control-slot]]:left-large-4x',
|
|
30
|
-
'group-has-[div[data-slot=control-slot]]:group-focus-within:left-small',
|
|
31
|
-
'group-has-[div[data-slot=control-slot]]:group-has-[input:not(:placeholder-shown)]:left-small',
|
|
32
|
-
'group-has-[div[data-slot=control-slot]]:group-data-[state=open]:left-small',
|
|
33
|
-
// Animate
|
|
34
|
-
'group-focus-within:animate-in',
|
|
35
|
-
'group-has-[input:not(:placeholder-shown)]:animate-out',
|
|
36
|
-
'data-[disabled=true]:hidden'
|
|
37
|
-
],
|
|
38
|
-
variants: {
|
|
39
|
-
state: {
|
|
40
|
-
normal: [
|
|
41
|
-
'group-focus-within:!text-primary-idle group-data-[state=open]:!text-primary-idle',
|
|
42
|
-
'group-has-[input:not(:placeholder-shown)]:!text-primary-idle'
|
|
43
|
-
],
|
|
44
|
-
error: [
|
|
45
|
-
'group-focus-within:!text-danger-label-active group-data-[state=open]:!text-danger-label-active',
|
|
46
|
-
'group-has-[input:not(:placeholder-shown)]:!text-danger-label-active'
|
|
47
|
-
],
|
|
48
|
-
disabled: []
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<label className={label({ className, state })} htmlFor={htmlFor} {...props}>
|
|
55
|
-
<span className="rounded-small-1x bg-layer-2-idle max-w-full">
|
|
56
|
-
{children}
|
|
57
|
-
</span>
|
|
58
|
-
</label>
|
|
59
|
-
)
|
|
60
|
-
}
|
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { tv, twMerge } from '@xjur-ui/util'
|
|
2
|
-
import type { ComponentProps } from 'react'
|
|
3
|
-
import { InputMask as InputMaskComponent } from '@react-input/mask'
|
|
4
|
-
import {
|
|
5
|
-
InputNumberFormat,
|
|
6
|
-
type InputNumberFormatProps
|
|
7
|
-
} from '@react-input/number-format'
|
|
8
|
-
import { Icon, type IconType } from '../icon'
|
|
9
|
-
import { inputMask } from '../../resources/input-mask'
|
|
10
|
-
import { Divider } from '../divider'
|
|
11
|
-
import {
|
|
12
|
-
type FieldContextValue,
|
|
13
|
-
FieldContext,
|
|
14
|
-
useFieldContext
|
|
15
|
-
} from './context/field.context'
|
|
16
|
-
import { FloatingLabel } from './floating-label'
|
|
17
|
-
|
|
18
|
-
export const input = tv({
|
|
19
|
-
slots: {
|
|
20
|
-
wrapper: 'group flex w-full flex-col gap-small-2x',
|
|
21
|
-
trigger: [
|
|
22
|
-
'h-large-4x w-full relative',
|
|
23
|
-
'flex items-center gap-small rounded-small-1x',
|
|
24
|
-
'py-small_1x-alt px-small',
|
|
25
|
-
'bg-layer-2-hover border border-transparent',
|
|
26
|
-
'group-has-[div[data-slot=input-action-slot]]:rounded-r-none',
|
|
27
|
-
'transition-all duration-200'
|
|
28
|
-
],
|
|
29
|
-
content: 'flex w-full',
|
|
30
|
-
value:
|
|
31
|
-
'text-size-body-md font-normal placeholder:text-neutral-placeholder flex-1 outline-none',
|
|
32
|
-
icon: 'size-large text-icon-neutral-3 flex items-center justify-center',
|
|
33
|
-
slotText:
|
|
34
|
-
'size-large flex items-center justify-center !text-size-label-md text-neutral-placeholder',
|
|
35
|
-
caption: '!text-size-body-sm font-normal',
|
|
36
|
-
action: 'h-large-4x overflow-hidden'
|
|
37
|
-
},
|
|
38
|
-
variants: {
|
|
39
|
-
state: {
|
|
40
|
-
normal: {
|
|
41
|
-
trigger:
|
|
42
|
-
'hover:border-border-layer-1 focus-within:border-primary-idle focus-within:hover:border-primary-idle'
|
|
43
|
-
},
|
|
44
|
-
error: {
|
|
45
|
-
trigger:
|
|
46
|
-
'border-danger-idle hover:border-danger-idle focus-within:border-danger-idle focus-within:hover:border-danger-idle',
|
|
47
|
-
caption: 'text-danger-label-idle'
|
|
48
|
-
},
|
|
49
|
-
disabled: {
|
|
50
|
-
trigger: 'pointer-events-none border-transparent bg-layer-2-idle'
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
const { wrapper, trigger, content, value, icon, caption, action, slotText } =
|
|
57
|
-
input()
|
|
58
|
-
|
|
59
|
-
export function InputRoot({
|
|
60
|
-
className,
|
|
61
|
-
state = 'normal',
|
|
62
|
-
customMask,
|
|
63
|
-
variant = 'normal',
|
|
64
|
-
mask,
|
|
65
|
-
...props
|
|
66
|
-
}: ComponentProps<'div'> & FieldContextValue) {
|
|
67
|
-
return (
|
|
68
|
-
<FieldContext.Provider value={{ state, customMask, mask, variant }}>
|
|
69
|
-
<div className={wrapper({ className, state })} {...props} />
|
|
70
|
-
</FieldContext.Provider>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function InputContent({ className, ...props }: ComponentProps<'div'>) {
|
|
75
|
-
const { state } = useFieldContext()
|
|
76
|
-
return <div className={content({ className, state })} {...props} />
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function InputLabel(props: ComponentProps<typeof FloatingLabel>) {
|
|
80
|
-
return <FloatingLabel {...props} />
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export function InputTrigger({ className, ...props }: ComponentProps<'div'>) {
|
|
84
|
-
const { state, variant } = useFieldContext()
|
|
85
|
-
|
|
86
|
-
const filterTrigger = tv({
|
|
87
|
-
base: ['group bg-layer-2-idle relative'],
|
|
88
|
-
variants: {
|
|
89
|
-
state: {
|
|
90
|
-
normal: [
|
|
91
|
-
'border-border-layer-2 hover:border-border-layer-3 has-[input:not(:placeholder-shown)]:border-primary-idle'
|
|
92
|
-
],
|
|
93
|
-
error: ['border-danger-idle hover:border-danger-idle'],
|
|
94
|
-
disabled: ['border border-border-layer-2 opacity-60']
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
const mergedClassName = twMerge(
|
|
100
|
-
trigger({ state, className }),
|
|
101
|
-
variant === 'filter' && filterTrigger({ state, className })
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<div
|
|
106
|
-
aria-disabled={state === 'disabled'}
|
|
107
|
-
className={mergedClassName}
|
|
108
|
-
{...props}
|
|
109
|
-
/>
|
|
110
|
-
)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export function InputMask({
|
|
114
|
-
className,
|
|
115
|
-
placeholder,
|
|
116
|
-
...props
|
|
117
|
-
}: ComponentProps<'input'>) {
|
|
118
|
-
const { customMask, state, mask, variant } = useFieldContext()
|
|
119
|
-
|
|
120
|
-
return (
|
|
121
|
-
<InputMaskComponent
|
|
122
|
-
{...props}
|
|
123
|
-
{...(mask ? { ...inputMask(mask) } : customMask && { ...customMask })}
|
|
124
|
-
className={value({ className, state })}
|
|
125
|
-
disabled={state === 'disabled'}
|
|
126
|
-
placeholder={variant === 'filter' ? ' ' : placeholder}
|
|
127
|
-
readOnly={state === 'disabled'}
|
|
128
|
-
/>
|
|
129
|
-
)
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export function InputText({
|
|
133
|
-
className,
|
|
134
|
-
placeholder,
|
|
135
|
-
...props
|
|
136
|
-
}: ComponentProps<'input'>) {
|
|
137
|
-
const { state, variant } = useFieldContext()
|
|
138
|
-
|
|
139
|
-
return (
|
|
140
|
-
<input
|
|
141
|
-
{...props}
|
|
142
|
-
className={value({ className, state })}
|
|
143
|
-
disabled={state === 'disabled'}
|
|
144
|
-
placeholder={variant === 'filter' ? ' ' : placeholder}
|
|
145
|
-
readOnly={state === 'disabled'}
|
|
146
|
-
/>
|
|
147
|
-
)
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export function InputNumber({
|
|
151
|
-
className,
|
|
152
|
-
locales = 'pt-BR',
|
|
153
|
-
placeholder,
|
|
154
|
-
groupDisplay = false,
|
|
155
|
-
...props
|
|
156
|
-
}: InputNumberFormatProps) {
|
|
157
|
-
const { state, variant } = useFieldContext()
|
|
158
|
-
|
|
159
|
-
return (
|
|
160
|
-
<InputNumberFormat
|
|
161
|
-
{...props}
|
|
162
|
-
className={value({ className, state })}
|
|
163
|
-
disabled={state === 'disabled'}
|
|
164
|
-
groupDisplay={groupDisplay}
|
|
165
|
-
locales={locales}
|
|
166
|
-
placeholder={variant === 'filter' ? ' ' : placeholder}
|
|
167
|
-
readOnly={state === 'disabled'}
|
|
168
|
-
/>
|
|
169
|
-
)
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export function InputIcon({
|
|
173
|
-
className,
|
|
174
|
-
name,
|
|
175
|
-
...props
|
|
176
|
-
}: ComponentProps<'div'> & {
|
|
177
|
-
name: IconType
|
|
178
|
-
}) {
|
|
179
|
-
const { state } = useFieldContext()
|
|
180
|
-
|
|
181
|
-
return (
|
|
182
|
-
<div className={icon({ className, state })} {...props}>
|
|
183
|
-
<Icon name={name} />
|
|
184
|
-
</div>
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export function InputSlot({ className, ...props }: ComponentProps<'span'>) {
|
|
189
|
-
const { state } = useFieldContext()
|
|
190
|
-
return <span className={slotText({ className, state })} {...props} />
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export function InputCaption({ className, ...props }: ComponentProps<'p'>) {
|
|
194
|
-
const { state } = useFieldContext()
|
|
195
|
-
return <p className={caption({ className, state })} {...props} />
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export function InputAction({ className, ...props }: ComponentProps<'div'>) {
|
|
199
|
-
const { state } = useFieldContext()
|
|
200
|
-
return (
|
|
201
|
-
<div
|
|
202
|
-
className={action({ className, state })}
|
|
203
|
-
data-slot="input-action-slot"
|
|
204
|
-
{...props}
|
|
205
|
-
/>
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
export function InputNumericStepper({
|
|
210
|
-
handleIncrement,
|
|
211
|
-
handleDecrement
|
|
212
|
-
}: {
|
|
213
|
-
handleIncrement: () => void
|
|
214
|
-
handleDecrement: () => void
|
|
215
|
-
}) {
|
|
216
|
-
return (
|
|
217
|
-
<InputAction className="w-large-4x border-border-layer-2 rounded-r-small-1x bg-layer-2-hover flex flex-col items-center justify-center border">
|
|
218
|
-
<button
|
|
219
|
-
className="flex h-1/2 items-center justify-center"
|
|
220
|
-
type="button"
|
|
221
|
-
onClick={handleIncrement}
|
|
222
|
-
>
|
|
223
|
-
<Icon className="text-icon-neutral-3" name="keyboard_arrow_up" />
|
|
224
|
-
</button>
|
|
225
|
-
|
|
226
|
-
<Divider />
|
|
227
|
-
|
|
228
|
-
<button
|
|
229
|
-
className="flex h-1/2 items-center justify-center"
|
|
230
|
-
type="button"
|
|
231
|
-
onClick={handleDecrement}
|
|
232
|
-
>
|
|
233
|
-
<Icon className="text-icon-neutral-3" name="keyboard_arrow_down" />
|
|
234
|
-
</button>
|
|
235
|
-
</InputAction>
|
|
236
|
-
)
|
|
237
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import * as OTPPasswordField from '@radix-ui/react-one-time-password-field'
|
|
2
|
-
import { cx } from '@xjur-ui/util'
|
|
3
|
-
|
|
4
|
-
function Root({
|
|
5
|
-
children,
|
|
6
|
-
className,
|
|
7
|
-
...props
|
|
8
|
-
}: OTPPasswordField.OneTimePasswordFieldProps) {
|
|
9
|
-
return (
|
|
10
|
-
<OTPPasswordField.Root
|
|
11
|
-
className={cx(className, 'group gap-small flex items-center')}
|
|
12
|
-
{...props}
|
|
13
|
-
>
|
|
14
|
-
{children}
|
|
15
|
-
</OTPPasswordField.Root>
|
|
16
|
-
)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function Input({
|
|
20
|
-
className,
|
|
21
|
-
...props
|
|
22
|
-
}: OTPPasswordField.OneTimePasswordFieldInputProps) {
|
|
23
|
-
return (
|
|
24
|
-
<OTPPasswordField.Input
|
|
25
|
-
className={cx(
|
|
26
|
-
className,
|
|
27
|
-
'text-neutral-dark h-large-6x bg-layer-2-hover rounded-small-1x w-full text-center outline-0',
|
|
28
|
-
'focus-within:border-primary-idle focus-within:border'
|
|
29
|
-
)}
|
|
30
|
-
{...props}
|
|
31
|
-
/>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function HiddenInput({
|
|
36
|
-
...props
|
|
37
|
-
}: OTPPasswordField.OneTimePasswordFieldHiddenInputProps) {
|
|
38
|
-
return <OTPPasswordField.HiddenInput {...props} />
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const OTPInput = {
|
|
42
|
-
Root,
|
|
43
|
-
Input,
|
|
44
|
-
HiddenInput
|
|
45
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group'
|
|
3
|
-
import { cx } from '@xjur-ui/util'
|
|
4
|
-
import { Typography } from '../typography'
|
|
5
|
-
|
|
6
|
-
export function RadioGroup({
|
|
7
|
-
className,
|
|
8
|
-
orientation = 'vertical',
|
|
9
|
-
...props
|
|
10
|
-
}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
|
11
|
-
return (
|
|
12
|
-
<RadioGroupPrimitive.Root
|
|
13
|
-
className={cx(
|
|
14
|
-
'gap-small flex data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col',
|
|
15
|
-
className
|
|
16
|
-
)}
|
|
17
|
-
data-orientation={orientation}
|
|
18
|
-
data-slot="radio-group"
|
|
19
|
-
{...props}
|
|
20
|
-
/>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function RadioItem({
|
|
25
|
-
className,
|
|
26
|
-
id,
|
|
27
|
-
label,
|
|
28
|
-
disabled = false,
|
|
29
|
-
...props
|
|
30
|
-
}: React.ComponentProps<typeof RadioGroupPrimitive.Item> & {
|
|
31
|
-
label?: string
|
|
32
|
-
}) {
|
|
33
|
-
return (
|
|
34
|
-
<div className="gap-small flex items-center">
|
|
35
|
-
<RadioGroupPrimitive.Item
|
|
36
|
-
className={cx(
|
|
37
|
-
// layout
|
|
38
|
-
'size-large-alt rounded-circle inline-flex items-center justify-center transition-[border-color,box-shadow,background-color] duration-200 outline-none',
|
|
39
|
-
// base
|
|
40
|
-
'border-border-layer-2 bg-layer-2-idle cursor-pointer border-2',
|
|
41
|
-
// hover/focus (desmarcado)
|
|
42
|
-
'hover:border-primary-idle focus:border-primary-idle focus:shadow-focus-primary',
|
|
43
|
-
// estado checked
|
|
44
|
-
'data-[state=checked]:bg-primary-active data-[state=checked]:border-primary-active',
|
|
45
|
-
// hover quando estiver checked (opcional)
|
|
46
|
-
'data-[state=checked]:hover:border-primary-idle',
|
|
47
|
-
// disabled
|
|
48
|
-
'disabled:hover:border-border-layer-2 disabled:cursor-not-allowed disabled:opacity-[38%]',
|
|
49
|
-
className
|
|
50
|
-
)}
|
|
51
|
-
data-slot="radio-group-item"
|
|
52
|
-
disabled={disabled}
|
|
53
|
-
id={id}
|
|
54
|
-
{...props}
|
|
55
|
-
>
|
|
56
|
-
<RadioGroupPrimitive.Indicator
|
|
57
|
-
className="relative flex items-center justify-center"
|
|
58
|
-
data-slot="radio-group-indicator"
|
|
59
|
-
/>
|
|
60
|
-
</RadioGroupPrimitive.Item>
|
|
61
|
-
|
|
62
|
-
{!!label && (
|
|
63
|
-
<Typography
|
|
64
|
-
asChild={true}
|
|
65
|
-
className="text-size-body-sm data-[disabled=true]:opacity-38"
|
|
66
|
-
data-disabled={disabled}
|
|
67
|
-
weight="medium"
|
|
68
|
-
>
|
|
69
|
-
<label htmlFor={id}>{label}</label>
|
|
70
|
-
</Typography>
|
|
71
|
-
)}
|
|
72
|
-
</div>
|
|
73
|
-
)
|
|
74
|
-
}
|