@xjur-ui/react 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/.turbo/turbo-build.log +61 -57
  2. package/CHANGELOG.md +11 -0
  3. package/dist/components/avatar.d.ts +11 -0
  4. package/dist/components/avatar.js +58 -0
  5. package/dist/components/{ui/button.d.ts → button.d.ts} +2 -2
  6. package/dist/components/{ui/button.js → button.js} +9 -6
  7. package/dist/components/calendar.d.ts +11 -0
  8. package/dist/components/calendar.js +751 -0
  9. package/dist/components/checkbox.d.ts +8 -0
  10. package/dist/components/{ui/input/root.js → checkbox.js} +69 -79
  11. package/dist/components/chip.d.ts +24 -0
  12. package/dist/components/chip.js +255 -0
  13. package/dist/components/collapsible.d.ts +8 -0
  14. package/dist/components/collapsible.js +41 -0
  15. package/dist/components/date-picker.d.ts +20 -0
  16. package/dist/components/date-picker.js +230 -0
  17. package/dist/components/divider.d.ts +7 -0
  18. package/dist/components/divider.js +28 -0
  19. package/dist/components/dropdown-menu.d.ts +22 -0
  20. package/dist/components/dropdown-menu.js +294 -0
  21. package/dist/components/{resources/icons.d.ts → icon.d.ts} +11 -2
  22. package/dist/components/{ui/icon.js → icon.js} +18 -5
  23. package/dist/components/input.d.ts +32 -0
  24. package/dist/components/input.js +299 -0
  25. package/dist/components/list.d.ts +25 -0
  26. package/dist/components/{ui/input/content.js → list.js} +83 -87
  27. package/dist/components/{ui/logo.d.ts → logo.d.ts} +2 -2
  28. package/dist/components/{ui/logo.js → logo.js} +5 -5
  29. package/dist/components/{ui/otp-input.js → otp-input.js} +1 -1
  30. package/dist/components/radio.d.ts +10 -0
  31. package/dist/components/{ui/input/label.js → radio.js} +68 -77
  32. package/dist/components/search-input.d.ts +17 -0
  33. package/dist/components/search-input.js +274 -0
  34. package/dist/components/select.d.ts +33 -0
  35. package/dist/components/select.js +548 -0
  36. package/dist/components/sheet.d.ts +19 -0
  37. package/dist/components/sheet.js +251 -0
  38. package/dist/components/switch.d.ts +7 -0
  39. package/dist/components/switch.js +36 -0
  40. package/dist/components/tabs.d.ts +11 -0
  41. package/dist/components/tabs.js +54 -0
  42. package/dist/components/tag.d.ts +18 -0
  43. package/dist/components/tag.js +189 -0
  44. package/dist/components/{ui/typography.d.ts → typography.d.ts} +3 -3
  45. package/dist/components/{ui/typography.js → typography.js} +1 -1
  46. package/dist/index.css +1156 -62
  47. package/dist/index.d.ts +2 -17
  48. package/dist/index.js +0 -788
  49. package/eslint.config.js +8 -1
  50. package/package.json +40 -10
  51. package/src/components/avatar.tsx +53 -0
  52. package/src/components/{ui/button.tsx → button.tsx} +7 -5
  53. package/src/components/calendar.tsx +123 -0
  54. package/src/components/checkbox.tsx +57 -0
  55. package/src/components/chip.tsx +109 -0
  56. package/src/components/collapsible.tsx +35 -0
  57. package/src/components/date-picker.tsx +154 -0
  58. package/src/components/divider.tsx +23 -0
  59. package/src/components/dropdown-menu.tsx +101 -0
  60. package/src/components/{ui/icon.tsx → icon.tsx} +1 -1
  61. package/src/components/input.tsx +241 -0
  62. package/src/components/list.tsx +111 -0
  63. package/src/components/radio.tsx +74 -0
  64. package/src/components/search-input.tsx +112 -0
  65. package/src/components/select.tsx +234 -0
  66. package/src/components/sheet.tsx +141 -0
  67. package/src/components/switch.tsx +31 -0
  68. package/src/components/tabs.tsx +53 -0
  69. package/src/components/tag.tsx +91 -0
  70. package/src/index.css +4 -1
  71. package/src/index.ts +0 -1
  72. package/src/{components/resources → resources}/icons.ts +14 -1
  73. package/src/resources/input-mask.ts +91 -0
  74. package/dist/components/resources/icons.js +0 -133
  75. package/dist/components/resources/logo/horizontal.d.ts +0 -12
  76. package/dist/components/resources/logo/horizontal.js +0 -107
  77. package/dist/components/resources/logo/icon.d.ts +0 -12
  78. package/dist/components/resources/logo/icon.js +0 -79
  79. package/dist/components/resources/logo/index.d.ts +0 -4
  80. package/dist/components/resources/logo/index.js +0 -291
  81. package/dist/components/resources/logo/vertical.d.ts +0 -12
  82. package/dist/components/resources/logo/vertical.js +0 -107
  83. package/dist/components/ui/accordion.d.ts +0 -5
  84. package/dist/components/ui/accordion.js +0 -8
  85. package/dist/components/ui/icon.d.ts +0 -12
  86. package/dist/components/ui/index.d.ts +0 -17
  87. package/dist/components/ui/index.js +0 -788
  88. package/dist/components/ui/input/content.d.ts +0 -9
  89. package/dist/components/ui/input/index.d.ts +0 -12
  90. package/dist/components/ui/input/index.js +0 -335
  91. package/dist/components/ui/input/label.d.ts +0 -12
  92. package/dist/components/ui/input/message.d.ts +0 -10
  93. package/dist/components/ui/input/message.js +0 -128
  94. package/dist/components/ui/input/root.d.ts +0 -18
  95. package/dist/components/ui/input/slot.d.ts +0 -10
  96. package/dist/components/ui/input/slot.js +0 -20
  97. package/dist/components/ui/input/text.d.ts +0 -10
  98. package/dist/components/ui/input/text.js +0 -195
  99. package/src/components/ui/accordion.tsx +0 -3
  100. package/src/components/ui/index.ts +0 -13
  101. package/src/components/ui/input/content.tsx +0 -59
  102. package/src/components/ui/input/index.ts +0 -6
  103. package/src/components/ui/input/label.tsx +0 -41
  104. package/src/components/ui/input/message.tsx +0 -37
  105. package/src/components/ui/input/root.tsx +0 -57
  106. package/src/components/ui/input/slot.tsx +0 -21
  107. package/src/components/ui/input/text.tsx +0 -69
  108. /package/dist/components/{ui/otp-input.d.ts → otp-input.d.ts} +0 -0
  109. /package/src/components/{ui/logo.tsx → logo.tsx} +0 -0
  110. /package/src/components/{ui/otp-input.tsx → otp-input.tsx} +0 -0
  111. /package/src/components/{ui/typography.tsx → typography.tsx} +0 -0
  112. /package/src/{components/resources → resources}/logo/horizontal.tsx +0 -0
  113. /package/src/{components/resources → resources}/logo/icon.tsx +0 -0
  114. /package/src/{components/resources → resources}/logo/index.ts +0 -0
  115. /package/src/{components/resources → resources}/logo/vertical.tsx +0 -0
@@ -0,0 +1,234 @@
1
+ import type { ComponentProps } from 'react'
2
+ import * as RadixPopover from '@radix-ui/react-popover'
3
+ import { cx } from '@xjur-ui/util'
4
+ import {
5
+ ListContent,
6
+ ListItem,
7
+ ListRoot,
8
+ ListHeader,
9
+ ListHeaderTitle
10
+ } from './list'
11
+ import {
12
+ SearchInputContent,
13
+ SearchInputText,
14
+ SearchInputRoot,
15
+ SearchInputSlot
16
+ } from './search-input'
17
+ import { Icon } from './icon'
18
+ import { Typography, type TypographyProps } from './typography'
19
+
20
+ export function SelectRoot(props: ComponentProps<typeof RadixPopover.Root>) {
21
+ return <RadixPopover.Root {...props} />
22
+ }
23
+
24
+ export function SelectTrigger({
25
+ className,
26
+ ...props
27
+ }: ComponentProps<typeof RadixPopover.Trigger>) {
28
+ return (
29
+ <RadixPopover.Trigger
30
+ className={cx(
31
+ className,
32
+ 'group h-large-4x rounded-small-1x gap-small py-small_1x-alt px-small relative flex w-full cursor-pointer items-center',
33
+ 'bg-layer-2-idle border-border-layer-2 hover:border-border-layer-3 border',
34
+ 'data-[state=open]:border-primary-idle data-[state=open]:shadow-focus-primary',
35
+ 'has-[input:not(:placeholder-shown)]:text-primary-idle',
36
+ 'has-[input:not(:placeholder-shown)]:border-primary-idle'
37
+ )}
38
+ {...props}
39
+ />
40
+ )
41
+ }
42
+
43
+ export function SelectContent({
44
+ className,
45
+ children,
46
+ sideOffset = 4,
47
+ side = 'bottom',
48
+ align = 'start',
49
+ ...props
50
+ }: ComponentProps<typeof RadixPopover.Content>) {
51
+ return (
52
+ <RadixPopover.Portal>
53
+ <RadixPopover.Content
54
+ align={align}
55
+ className={cx(
56
+ className,
57
+ 'group z-10 max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)]'
58
+ )}
59
+ side={side}
60
+ sideOffset={sideOffset}
61
+ {...props}
62
+ >
63
+ <ListRoot>{children}</ListRoot>
64
+ </RadixPopover.Content>
65
+ </RadixPopover.Portal>
66
+ )
67
+ }
68
+
69
+ export function SelectValue({
70
+ className,
71
+ displayValue = '',
72
+ ...props
73
+ }: ComponentProps<'input'> & { displayValue?: string }) {
74
+ return (
75
+ <>
76
+ {!!displayValue && (
77
+ <Typography className="text-neutral-dark group-has-[div[data-slot=select-left-slot]]:pl-large-1x">
78
+ {displayValue}
79
+ </Typography>
80
+ )}
81
+
82
+ <input
83
+ {...props}
84
+ aria-readonly={true}
85
+ className={cx(className, 'pointer-events-none')}
86
+ hidden={true}
87
+ placeholder={props.placeholder ?? ' '}
88
+ readOnly={true}
89
+ />
90
+ </>
91
+ )
92
+ }
93
+
94
+ export function SelectMultiValue({
95
+ className,
96
+ values,
97
+ children,
98
+ ...props
99
+ }: ComponentProps<'div'> & { values: string[] }) {
100
+ return (
101
+ <div
102
+ className={cx(
103
+ className,
104
+ 'gap-small-1x scrollbar-hide group-has-[div[data-slot=select-left-slot]]:pl-large-1x flex overflow-x-auto'
105
+ )}
106
+ {...props}
107
+ >
108
+ {children}
109
+
110
+ <input
111
+ aria-readonly={true}
112
+ className={cx(className, 'pointer-events-none')}
113
+ hidden={true}
114
+ placeholder={' '}
115
+ readOnly={true}
116
+ value={values.join(',')}
117
+ />
118
+ </div>
119
+ )
120
+ }
121
+
122
+ export function SelectLabel({
123
+ className,
124
+ htmlFor,
125
+ children,
126
+ ...props
127
+ }: TypographyProps & { htmlFor?: string }) {
128
+ return (
129
+ <Typography
130
+ asChild={true}
131
+ className={cx(
132
+ 'bg-layer-2-idle w-fit font-normal',
133
+ 'pointer-events-none absolute top-1/2 left-auto -translate-y-1/2',
134
+ 'ease transition-all duration-250',
135
+ // Content Open
136
+ 'group-data-[state=open]:text-primary-idle',
137
+ 'group-data-[state=open]:bg-layer-2-idle',
138
+ 'group-data-[state=open]:-top-[3px]',
139
+ 'group-data-[state=open]:text-size-label-sm-1x',
140
+ 'group-data-[state=open]:font-medium',
141
+ // Filled
142
+ 'group-has-[input:not(:placeholder-shown)]:text-primary-idle',
143
+ 'group-has-[input:not(:placeholder-shown)]:bg-layer-2-idle',
144
+ 'group-has-[input:not(:placeholder-shown)]:-top-[3px]',
145
+ 'group-has-[input:not(:placeholder-shown)]:text-size-label-sm-1x',
146
+ 'group-has-[input:not(:placeholder-shown)]:font-medium',
147
+ // If has left slot
148
+ 'group-has-[div[data-slot=select-left-slot]]:left-large-4x',
149
+ 'group-has-[div[data-slot=select-left-slot]]:group-data-[state=open]:left-auto',
150
+ 'group-has-[div[data-slot=select-left-slot]]:group-has-[input:not(:placeholder-shown)]:left-auto',
151
+ // Animate
152
+ 'group-data-[state=open]:animate-in',
153
+ 'group-data-[state=closed]:animate-out',
154
+ 'group-has-[input:not(:placeholder-shown)]:animate-out',
155
+ className
156
+ )}
157
+ weight="medium"
158
+ {...props}
159
+ >
160
+ <label htmlFor={htmlFor}>{children}</label>
161
+ </Typography>
162
+ )
163
+ }
164
+
165
+ export function SelectOptions(props: ComponentProps<typeof ListContent>) {
166
+ return <ListContent {...props} />
167
+ }
168
+
169
+ export function SelectOption({
170
+ className,
171
+ ...props
172
+ }: ComponentProps<typeof ListItem>) {
173
+ return <ListItem className={cx(className, 'cursor-pointer')} {...props} />
174
+ }
175
+
176
+ export function SelectOptionText(props: ComponentProps<typeof Typography>) {
177
+ return <Typography {...props} />
178
+ }
179
+
180
+ export function SelectHeader(props: ComponentProps<typeof ListHeader>) {
181
+ return <ListHeader {...props} />
182
+ }
183
+
184
+ export function SelectHeaderTitle(
185
+ props: ComponentProps<typeof ListHeaderTitle>
186
+ ) {
187
+ return <ListHeaderTitle {...props} />
188
+ }
189
+
190
+ export function SelectDropdown(props: ComponentProps<'div'>) {
191
+ return <div {...props} />
192
+ }
193
+
194
+ export function SelectLeftSlot({ className, ...props }: ComponentProps<'div'>) {
195
+ return (
196
+ <div
197
+ {...props}
198
+ className={cx(
199
+ className,
200
+ 'left-small absolute top-1/2 flex -translate-y-1/2 items-center justify-center'
201
+ )}
202
+ data-slot="select-left-slot"
203
+ />
204
+ )
205
+ }
206
+
207
+ export function SelectRightSlot({
208
+ className,
209
+ ...props
210
+ }: ComponentProps<'div'>) {
211
+ return (
212
+ <div
213
+ {...props}
214
+ className={cx(
215
+ className,
216
+ 'right-small absolute top-1/2 flex -translate-y-1/2 items-center justify-center'
217
+ )}
218
+ data-slot="select-right-slot"
219
+ />
220
+ )
221
+ }
222
+
223
+ export function SelectSearch(props: ComponentProps<typeof SearchInputText>) {
224
+ return (
225
+ <SearchInputRoot variant="line">
226
+ <SearchInputContent>
227
+ <SearchInputSlot>
228
+ <Icon className="text-icon-neutral-3" name="search" />
229
+ </SearchInputSlot>
230
+ <SearchInputText {...props} />
231
+ </SearchInputContent>
232
+ </SearchInputRoot>
233
+ )
234
+ }
@@ -0,0 +1,141 @@
1
+ import * as React from 'react'
2
+ import * as SheetPrimitive from '@radix-ui/react-dialog'
3
+ import { cx } from '@xjur-ui/util'
4
+ import { Button } from './button'
5
+ import { Icon } from './icon'
6
+
7
+ export function SheetRoot({
8
+ ...props
9
+ }: React.ComponentProps<typeof SheetPrimitive.Root>) {
10
+ return <SheetPrimitive.Root data-slot="sheet" {...props} />
11
+ }
12
+
13
+ export function SheetTrigger({
14
+ ...props
15
+ }: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
16
+ return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
17
+ }
18
+
19
+ export function SheetClose({
20
+ children = (
21
+ <Button appearance="ghost" size="icon_md" variant="tertiary">
22
+ <Icon className="text-icon-neutral-3" name="close" />
23
+ </Button>
24
+ ),
25
+ ...props
26
+ }: React.ComponentProps<typeof SheetPrimitive.Close>) {
27
+ return (
28
+ <SheetPrimitive.Close data-slot="sheet-close" {...props}>
29
+ {children}
30
+ </SheetPrimitive.Close>
31
+ )
32
+ }
33
+
34
+ export function SheetPortal({
35
+ ...props
36
+ }: React.ComponentProps<typeof SheetPrimitive.Portal>) {
37
+ return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
38
+ }
39
+
40
+ export function SheetOverlay({
41
+ className,
42
+ ...props
43
+ }: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
44
+ return (
45
+ <SheetPrimitive.Overlay
46
+ className={cx(
47
+ 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',
48
+ className
49
+ )}
50
+ data-slot="sheet-overlay"
51
+ {...props}
52
+ />
53
+ )
54
+ }
55
+
56
+ export function SheetContent({
57
+ className,
58
+ children,
59
+ side = 'right',
60
+ overlay = false,
61
+ ...props
62
+ }: React.ComponentProps<typeof SheetPrimitive.Content> & {
63
+ side?: 'top' | 'right' | 'bottom' | 'left'
64
+ overlay?: boolean
65
+ }) {
66
+ return (
67
+ <SheetPortal>
68
+ {overlay && <SheetOverlay />}
69
+ <SheetPrimitive.Content
70
+ className={cx(
71
+ 'border-border-layer-2 bg-layer-2-idle data-[state=open]:animate-in data-[state=closed]:animate-out shadow-elevation-2 fixed z-50 flex flex-col gap-4 transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
72
+ side === 'right' &&
73
+ 'data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm',
74
+ side === 'left' &&
75
+ 'data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm',
76
+ side === 'top' &&
77
+ 'data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b',
78
+ side === 'bottom' &&
79
+ 'data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t',
80
+ className
81
+ )}
82
+ data-slot="sheet-content"
83
+ {...props}
84
+ >
85
+ {children}
86
+ </SheetPrimitive.Content>
87
+ </SheetPortal>
88
+ )
89
+ }
90
+
91
+ export function SheetBody({
92
+ className,
93
+ ...props
94
+ }: React.ComponentProps<'div'>) {
95
+ return <div className={cx('px-large-2x', className)} {...props} />
96
+ }
97
+
98
+ export function SheetHeader({
99
+ className,
100
+ ...props
101
+ }: React.ComponentProps<'div'>) {
102
+ return (
103
+ <div
104
+ className={cx(
105
+ 'py-large px-large-2x border-b-border-layer-2 border-b',
106
+ className
107
+ )}
108
+ data-slot="sheet-header"
109
+ {...props}
110
+ />
111
+ )
112
+ }
113
+
114
+ export function SheetFooter({
115
+ className,
116
+ ...props
117
+ }: React.ComponentProps<'div'>) {
118
+ return (
119
+ <div
120
+ className={cx(
121
+ 'py-large px-large-2x border-t-border-layer-2 mt-auto border-t',
122
+ className
123
+ )}
124
+ data-slot="sheet-footer"
125
+ {...props}
126
+ />
127
+ )
128
+ }
129
+
130
+ export function SheetTitle({
131
+ className,
132
+ ...props
133
+ }: React.ComponentProps<typeof SheetPrimitive.Title>) {
134
+ return (
135
+ <SheetPrimitive.Title
136
+ className={cx('text-size-title-lg font-medium', className)}
137
+ data-slot="sheet-title"
138
+ {...props}
139
+ />
140
+ )
141
+ }
@@ -0,0 +1,31 @@
1
+ import * as React from 'react'
2
+ import * as SwitchPrimitive from '@radix-ui/react-switch'
3
+ import { cx } from '@xjur-ui/util'
4
+
5
+ function Switch({
6
+ className,
7
+ ...props
8
+ }: React.ComponentProps<typeof SwitchPrimitive.Root>) {
9
+ return (
10
+ <SwitchPrimitive.Root
11
+ className={cx(
12
+ 'w-large-3x h-large rounded-circle inline-flex shrink-0 items-center border border-transparent',
13
+ 'peer data-[state=checked]:bg-primary-idle data-[state=unchecked]:bg-alt-4',
14
+ 'focus-visible:border-ring focus-visible:ring-ring/50 transition-all outline-none disabled:cursor-not-allowed disabled:opacity-50',
15
+ 'hover:shadow-focus-primary p-[2px]',
16
+ className
17
+ )}
18
+ data-slot="switch"
19
+ {...props}
20
+ >
21
+ <SwitchPrimitive.Thumb
22
+ className={cx(
23
+ 'bg-layer-2-idle size-medium pointer-events-none rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0'
24
+ )}
25
+ data-slot="switch-thumb"
26
+ />
27
+ </SwitchPrimitive.Root>
28
+ )
29
+ }
30
+
31
+ export { Switch }
@@ -0,0 +1,53 @@
1
+ import * as TabsPrimitive from '@radix-ui/react-tabs'
2
+ import { cva, cx } from '@xjur-ui/util'
3
+
4
+ export function TabsRoot({
5
+ ...props
6
+ }: React.ComponentProps<typeof TabsPrimitive.Tabs>) {
7
+ return <TabsPrimitive.Tabs {...props} />
8
+ }
9
+
10
+ export function TabsList({
11
+ ...props
12
+ }: React.ComponentProps<typeof TabsPrimitive.TabsList>) {
13
+ return <TabsPrimitive.TabsList {...props} />
14
+ }
15
+
16
+ export function TabsTrigger({
17
+ variant,
18
+ className,
19
+ ...props
20
+ }: React.ComponentProps<typeof TabsPrimitive.TabsTrigger> & {
21
+ variant?: 'line' | 'button'
22
+ }) {
23
+ const variants = cva(
24
+ [
25
+ 'rounded-small-1x h-large-4x cursor-pointer text-size-label-md text-neutral-dark'
26
+ ],
27
+ {
28
+ variants: {
29
+ variant: {
30
+ line: 'py-small_1x-alt px-small data-[state=active]:border-b-[3px] data-[state=active]:border-b-primary-active data-[state=active]:rounded-none hover:bg-layer-2-hover',
31
+ button:
32
+ 'rounded-br-none rounded-bl-none py-small_1x-alt px-large bg-primary-idle text-neutral-label hover:bg-primary-hover data-[state=active]:bg-layer-2-idle data-[state=active]:text-primary-label-active'
33
+ }
34
+ },
35
+ defaultVariants: {
36
+ variant: 'button'
37
+ }
38
+ }
39
+ )
40
+
41
+ return (
42
+ <TabsPrimitive.TabsTrigger
43
+ className={cx(className, variants({ variant }))}
44
+ {...props}
45
+ />
46
+ )
47
+ }
48
+
49
+ export function TabsContent({
50
+ ...props
51
+ }: React.ComponentProps<typeof TabsPrimitive.TabsContent>) {
52
+ return <TabsPrimitive.TabsContent {...props} />
53
+ }
@@ -0,0 +1,91 @@
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
+
6
+ const tagVariants = cva(
7
+ [
8
+ 'group/tag relative h-large-2x w-fit rounded-small-1x px-small py-none flex items-center gap-small_1x-alt',
9
+ 'transition-all duration-200'
10
+ ],
11
+ {
12
+ variants: {
13
+ variant: {
14
+ primary:
15
+ 'bg-primary-alt-idle text-primary-label-idle hover:bg-primary-alt-hover',
16
+ danger:
17
+ 'bg-danger-alt-idle text-danger-label-idle hover:bg-danger-alt-hover',
18
+ neutral: 'bg-layer-1-idle text-neutral-dark hover:bg-layer-1-hover'
19
+ }
20
+ },
21
+ defaultVariants: {
22
+ variant: 'primary'
23
+ }
24
+ }
25
+ )
26
+
27
+ export function TagRoot({
28
+ className,
29
+ variant = 'primary',
30
+ ...props
31
+ }: ComponentProps<'div'> & ClassVariantProps<typeof tagVariants>) {
32
+ return <div className={cx(tagVariants({ variant }), className)} {...props} />
33
+ }
34
+
35
+ export function TagText({
36
+ variant = 'label',
37
+ size = 'sm-1x',
38
+ weight = 'medium',
39
+ className,
40
+ ...props
41
+ }: ComponentProps<typeof Typography>) {
42
+ return (
43
+ <Typography
44
+ className={cx(className, 'truncate')}
45
+ size={size}
46
+ variant={variant}
47
+ weight={weight}
48
+ {...props}
49
+ />
50
+ )
51
+ }
52
+
53
+ export function TagIcon({ className, ...props }: ComponentProps<typeof Icon>) {
54
+ return (
55
+ <Icon
56
+ className={
57
+ (cx(
58
+ 'text-size-body-md',
59
+ 'group-data-[variant=primary]:text-primary-label-idle',
60
+ 'group-data-[variant=danger]:text-danger-label-idle',
61
+ 'group-data-[variant=neutral]:text-icon-neutral-3'
62
+ ),
63
+ className)
64
+ }
65
+ {...props}
66
+ />
67
+ )
68
+ }
69
+
70
+ export function TagClose({
71
+ className,
72
+ children = <TagIcon name="close" />,
73
+ ...props
74
+ }: ComponentProps<'button'> & { name?: IconType }) {
75
+ return (
76
+ <button
77
+ className={cx(
78
+ className,
79
+ 'cursor-pointer bg-inherit',
80
+ 'invisible items-center justify-center group-hover/tag:visible',
81
+ 'absolute top-0 right-0',
82
+ 'h-large-2x w-large-2x rounded-circle',
83
+ 'transition-[visibility] duration-200'
84
+ )}
85
+ type="button"
86
+ {...props}
87
+ >
88
+ {children}
89
+ </button>
90
+ )
91
+ }
package/src/index.css CHANGED
@@ -1,2 +1,5 @@
1
1
  @import "tailwindcss";
2
- @import "@xjur-ui/styles/theme.css";
2
+ @import "@xjur-ui/styles/theme.css";
3
+ @import "tw-animate-css";
4
+ @plugin "tailwind-scrollbar-hide";
5
+ @plugin "tailwind-scrollbar";
package/src/index.ts CHANGED
@@ -1,2 +1 @@
1
1
  import './index.css'
2
- export * from './components/ui'
@@ -125,7 +125,20 @@ export const icons = [
125
125
  'wifi_off',
126
126
  'wifi',
127
127
  'work',
128
- 'workspaces'
128
+ 'workspaces',
129
+ 'article',
130
+ 'id_card',
131
+ 'badge',
132
+ 'home',
133
+ 'save',
134
+ 'code',
135
+ 'favorite',
136
+ 'analytics',
137
+ 'reports',
138
+ 'event',
139
+ 'account_circle',
140
+ 'history',
141
+ 'security'
129
142
  ] as const
130
143
 
131
144
  export type IconType = (typeof icons)[number]
@@ -0,0 +1,91 @@
1
+ import type { MaskOptions } from '@react-input/mask'
2
+
3
+ export type InputMaskType =
4
+ | 'cpf'
5
+ | 'cnpj'
6
+ | 'telefone'
7
+ | 'cep'
8
+ | 'numero-processo'
9
+ | 'custom'
10
+ | 'data'
11
+ | 'hora'
12
+ | 'data-hora'
13
+
14
+ export function inputMask(
15
+ type: InputMaskType,
16
+ options?: MaskOptions
17
+ ): MaskOptions {
18
+ switch (type) {
19
+ case 'cpf':
20
+ return { ...options, ...CPF_MASK }
21
+ case 'cnpj':
22
+ return { ...options, ...CNPJ_MASK }
23
+ case 'telefone':
24
+ return { ...options, ...PHONE_MASK }
25
+ case 'cep':
26
+ return { ...options, ...CEP_MASK }
27
+ case 'numero-processo':
28
+ return { ...options, ...NUMERO_PROCESSO_MASK }
29
+ case 'data':
30
+ return { ...options, ...DATE_MASK }
31
+ case 'hora':
32
+ return { ...options, ...TIME_MASK }
33
+ case 'data-hora':
34
+ return { ...options, ...DATETIME_MASK }
35
+ case 'custom':
36
+ if (!options) {
37
+ throw new Error('Options are required for custom mask')
38
+ }
39
+
40
+ return options
41
+ }
42
+ }
43
+
44
+ const CPF_MASK: MaskOptions = {
45
+ mask: '###.###.###-##',
46
+ replacement: {
47
+ '#': /\d/
48
+ }
49
+ }
50
+ const CNPJ_MASK: MaskOptions = {
51
+ mask: '##.###.###/####-##',
52
+ replacement: {
53
+ '#': /\d/
54
+ }
55
+ }
56
+ const PHONE_MASK: MaskOptions = {
57
+ mask: '(##) #####-####',
58
+ replacement: {
59
+ '#': /\d/
60
+ }
61
+ }
62
+ const CEP_MASK: MaskOptions = {
63
+ mask: '#####-###',
64
+ replacement: {
65
+ '#': /\d/
66
+ }
67
+ }
68
+ const NUMERO_PROCESSO_MASK: MaskOptions = {
69
+ mask: '#######-##.####.#.##.####',
70
+ replacement: {
71
+ '#': /\d/
72
+ }
73
+ }
74
+ const DATE_MASK: MaskOptions = {
75
+ mask: '##/##/####',
76
+ replacement: {
77
+ '#': /\d/
78
+ }
79
+ }
80
+ const TIME_MASK: MaskOptions = {
81
+ mask: '##:##',
82
+ replacement: {
83
+ '#': /\d/
84
+ }
85
+ }
86
+ const DATETIME_MASK: MaskOptions = {
87
+ mask: '##/##/#### ##:##',
88
+ replacement: {
89
+ '#': /\d/
90
+ }
91
+ }