@dafaz-ui/react 4.0.19 → 6.0.5
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 +8 -8
- package/CHANGELOG.md +55 -0
- package/dist/index.d.mts +678 -42
- package/dist/index.d.ts +678 -42
- package/dist/index.js +776 -147
- package/dist/index.mjs +780 -149
- package/package.json +1 -1
- package/src/components/Box/styles.ts +64 -10
- package/src/components/Button/index.tsx +1 -1
- package/src/components/Button/styles.ts +14 -7
- package/src/components/CheckBox/index.tsx +10 -26
- package/src/components/CheckBox/styles.ts +3 -1
- package/src/components/Heading/index.tsx +1 -1
- package/src/components/Heading/styles.ts +29 -15
- package/src/components/MultiSelect/index.tsx +232 -0
- package/src/components/MultiSelect/styles.ts +116 -0
- package/src/components/Radio/RadioItem/index.tsx +6 -4
- package/src/components/Radio/RadioItem/styles.ts +4 -1
- package/src/components/Radio/index.tsx +38 -23
- package/src/components/Radio/styles.ts +2 -1
- package/src/components/Select/index.tsx +49 -35
- package/src/components/Select/styles.ts +78 -13
- package/src/components/Separator/index.tsx +7 -0
- package/src/components/Separator/styles.ts +51 -0
- package/src/components/Text/index.tsx +3 -2
- package/src/components/Text/styles.ts +24 -3
- package/src/components/TextArea/index.tsx +17 -9
- package/src/components/TextArea/styles.ts +7 -2
- package/src/components/TextInput/index.tsx +38 -4
- package/src/components/TextInput/styles.ts +60 -3
- package/src/index.tsx +2 -0
package/package.json
CHANGED
@@ -1,37 +1,91 @@
|
|
1
|
-
import type { CSS } from '@stitches/react'
|
2
1
|
import { styled } from '../../styles'
|
3
|
-
import type { ComponentProps, ElementType } from 'react'
|
2
|
+
import type { ComponentProps, ElementType, CSSProperties } from 'react'
|
4
3
|
|
5
4
|
export const BoxUI = styled('div', {
|
6
5
|
padding: '$4',
|
7
6
|
|
8
7
|
variants: {
|
8
|
+
withShadow: {
|
9
|
+
true: {
|
10
|
+
boxShadow: '1px 1px 2px $colors$gray800',
|
11
|
+
},
|
12
|
+
},
|
9
13
|
stretch: {
|
10
14
|
true: {
|
11
15
|
width: '100%',
|
16
|
+
'> div': {
|
17
|
+
paddingLeft: 0,
|
18
|
+
},
|
12
19
|
},
|
13
20
|
false: {
|
14
|
-
width: '
|
21
|
+
width: '24.5rem',
|
22
|
+
|
23
|
+
'> div': {
|
24
|
+
paddingLeft: 0,
|
25
|
+
},
|
15
26
|
},
|
16
27
|
},
|
17
|
-
|
18
|
-
|
28
|
+
color: {
|
29
|
+
dark: {
|
19
30
|
background: '$gray800',
|
20
31
|
},
|
21
|
-
|
32
|
+
primary: {
|
33
|
+
background: '$dafaz400',
|
34
|
+
},
|
35
|
+
secondary: {
|
36
|
+
background: '$dafaz800',
|
37
|
+
},
|
38
|
+
light: {
|
39
|
+
background: '$dafaz100',
|
40
|
+
},
|
41
|
+
transparent: {
|
22
42
|
background: 'transparent',
|
23
43
|
},
|
24
44
|
},
|
45
|
+
rounded: {
|
46
|
+
px: {
|
47
|
+
borderRadius: '$px',
|
48
|
+
},
|
49
|
+
sm: {
|
50
|
+
borderRadius: '$sm',
|
51
|
+
},
|
52
|
+
md: {
|
53
|
+
borderRadius: '$md',
|
54
|
+
},
|
55
|
+
full: {
|
56
|
+
borderRadius: '$full',
|
57
|
+
},
|
58
|
+
},
|
59
|
+
direction: {
|
60
|
+
none: {},
|
61
|
+
row: {
|
62
|
+
display: 'flex',
|
63
|
+
alignItems: 'center',
|
64
|
+
justifyContent: 'center',
|
65
|
+
},
|
66
|
+
column: {
|
67
|
+
display: 'flex',
|
68
|
+
flexDirection: 'column',
|
69
|
+
alignItems: 'center',
|
70
|
+
justifyContent: 'center',
|
71
|
+
},
|
72
|
+
},
|
25
73
|
},
|
26
74
|
defaultVariants: {
|
27
|
-
stretch:
|
28
|
-
|
75
|
+
stretch: true,
|
76
|
+
color: 'dark',
|
77
|
+
rounded: 'px',
|
78
|
+
withShadow: false,
|
79
|
+
direction: 'row',
|
29
80
|
},
|
30
81
|
})
|
31
82
|
|
32
83
|
export interface BoxUIProps extends ComponentProps<typeof BoxUI> {
|
33
84
|
as?: ElementType
|
34
85
|
stretch?: boolean
|
35
|
-
|
36
|
-
|
86
|
+
color?: 'dark' | 'primary' | 'secondary' | 'light' | 'transparent'
|
87
|
+
rounded?: 'px' | 'sm' | 'md' | 'full'
|
88
|
+
withShadow?: boolean
|
89
|
+
style?: CSSProperties
|
90
|
+
direction?: 'row' | 'column' | 'none'
|
37
91
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { ComponentProps, ElementType } from 'react'
|
1
|
+
import type { ComponentProps, CSSProperties, ElementType } from 'react'
|
2
2
|
import { styled } from '../../styles'
|
3
3
|
|
4
4
|
/** Primary UI component for user interaction */
|
@@ -11,6 +11,7 @@ export const ButtonUI = styled('button', {
|
|
11
11
|
textAlign: 'center',
|
12
12
|
minWidth: 120,
|
13
13
|
boxSizing: 'border-box',
|
14
|
+
boxShadow: '3px 3px 2px -2px $colors$gray400',
|
14
15
|
|
15
16
|
display: 'flex',
|
16
17
|
alignItems: 'center',
|
@@ -20,6 +21,8 @@ export const ButtonUI = styled('button', {
|
|
20
21
|
|
21
22
|
cursor: 'pointer',
|
22
23
|
|
24
|
+
transition: 'background 0.2s linear',
|
25
|
+
|
23
26
|
'&:disabled': {
|
24
27
|
cursor: 'not-allowed',
|
25
28
|
},
|
@@ -29,10 +32,9 @@ export const ButtonUI = styled('button', {
|
|
29
32
|
primary: {
|
30
33
|
color: '$white',
|
31
34
|
background: '$dafaz600',
|
32
|
-
opacity: 0.8,
|
33
35
|
|
34
36
|
'&:not(:disabled):hover': {
|
35
|
-
|
37
|
+
background: '$dafaz400',
|
36
38
|
},
|
37
39
|
|
38
40
|
'&:disabled': {
|
@@ -40,13 +42,15 @@ export const ButtonUI = styled('button', {
|
|
40
42
|
},
|
41
43
|
},
|
42
44
|
secondary: {
|
45
|
+
transition: 'border, color 0.2s linear',
|
46
|
+
|
43
47
|
fontWeight: '$medium',
|
44
48
|
color: '$dafaz600',
|
45
49
|
border: '2px solid $dafaz600',
|
46
|
-
opacity: 0.8,
|
47
50
|
|
48
51
|
'&:not(:disabled):hover': {
|
49
|
-
|
52
|
+
color: '$dafaz400',
|
53
|
+
border: '2px solid $dafaz400',
|
50
54
|
},
|
51
55
|
|
52
56
|
'&:disabled': {
|
@@ -55,11 +59,13 @@ export const ButtonUI = styled('button', {
|
|
55
59
|
},
|
56
60
|
},
|
57
61
|
tertiary: {
|
62
|
+
transition: 'color 0.2s linear',
|
63
|
+
boxShadow: 'none',
|
58
64
|
fontWeight: '$medium',
|
59
|
-
color: '$
|
65
|
+
color: '$gray100',
|
60
66
|
|
61
67
|
'&:not(:disabled):hover': {
|
62
|
-
|
68
|
+
opacity: 0.9,
|
63
69
|
},
|
64
70
|
|
65
71
|
'&:disabled': {
|
@@ -114,4 +120,5 @@ export interface ButtonUIProps extends ComponentProps<typeof ButtonUI> {
|
|
114
120
|
variant?: 'primary' | 'secondary' | 'tertiary'
|
115
121
|
//** Flat mode */
|
116
122
|
flat?: boolean
|
123
|
+
style?: CSSProperties
|
117
124
|
}
|
@@ -1,52 +1,36 @@
|
|
1
|
-
import { forwardRef,
|
1
|
+
import { forwardRef, useId, type ElementRef } from 'react'
|
2
2
|
import { CheckBoxIndicator, CheckBoxUI, Label, CheckboxIUProps } from './styles'
|
3
3
|
import { Check } from '@phosphor-icons/react'
|
4
4
|
|
5
|
-
interface
|
6
|
-
id: string
|
5
|
+
interface CheckboxItemProps extends CheckboxIUProps {
|
7
6
|
label: string
|
8
|
-
checked: boolean
|
9
|
-
value: string | number | readonly string[] | undefined
|
10
|
-
onCheckedChange: (checked: boolean) => void
|
7
|
+
handleOnChange?: (checked: boolean, id?: string) => void
|
11
8
|
}
|
12
9
|
|
13
10
|
export const CheckBox = forwardRef<
|
14
11
|
ElementRef<typeof CheckBoxUI>,
|
15
|
-
|
12
|
+
CheckboxItemProps
|
16
13
|
>(
|
17
14
|
(
|
18
15
|
{
|
19
|
-
id,
|
20
16
|
label,
|
21
17
|
size,
|
22
18
|
disabled = false,
|
23
|
-
|
24
|
-
onCheckedChange,
|
25
|
-
value,
|
19
|
+
handleOnChange,
|
26
20
|
...props
|
27
|
-
}:
|
21
|
+
}: CheckboxItemProps,
|
28
22
|
ref,
|
29
23
|
) => {
|
30
|
-
const
|
31
|
-
|
32
|
-
useEffect(() => {
|
33
|
-
if (checked) {
|
34
|
-
setCheckValue(value)
|
35
|
-
} else {
|
36
|
-
setCheckValue(undefined)
|
37
|
-
}
|
38
|
-
}, [checked, value])
|
24
|
+
const htmlId = useId()
|
39
25
|
|
40
26
|
return (
|
41
|
-
<Label htmlFor={
|
27
|
+
<Label htmlFor={htmlId} disabled={disabled} size={size}>
|
42
28
|
<CheckBoxUI
|
43
29
|
ref={ref}
|
44
|
-
checked={checked}
|
45
|
-
onCheckedChange={onCheckedChange}
|
46
30
|
disabled={disabled}
|
47
|
-
id={
|
31
|
+
id={htmlId}
|
48
32
|
size={size}
|
49
|
-
|
33
|
+
onCheckedChange={handleOnChange}
|
50
34
|
{...props}
|
51
35
|
>
|
52
36
|
<CheckBoxIndicator asChild size={size}>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as Checkbox from '@radix-ui/react-checkbox'
|
2
2
|
import { styled, keyframes } from '../../styles'
|
3
|
-
import type { ComponentProps } from 'react'
|
3
|
+
import type { ComponentProps, CSSProperties } from 'react'
|
4
4
|
|
5
5
|
export const CheckBoxUI = styled(Checkbox.Root, {
|
6
6
|
all: 'unset',
|
@@ -14,6 +14,7 @@ export const CheckBoxUI = styled(Checkbox.Root, {
|
|
14
14
|
alignItems: 'center',
|
15
15
|
transition: 'border 0.2s linear',
|
16
16
|
border: '2px solid $gray400',
|
17
|
+
boxShadow: '1.3px 1.3px 4px -1px $colors$dafaz600',
|
17
18
|
|
18
19
|
'&:focus,&[data-state="checked"]': {
|
19
20
|
backgroundColor: '$dafaz600',
|
@@ -136,4 +137,5 @@ export const Label = styled('label', {
|
|
136
137
|
export interface CheckboxIUProps extends ComponentProps<typeof CheckBoxUI> {
|
137
138
|
size?: 'sm' | 'md' | 'lg'
|
138
139
|
disabled?: boolean
|
140
|
+
style?: CSSProperties
|
139
141
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ComponentProps, ElementType } from 'react'
|
1
|
+
import { ComponentProps, ElementType, type CSSProperties } from 'react'
|
2
2
|
import { styled } from '../../styles'
|
3
3
|
|
4
4
|
export const HeadingUI = styled('h2', {
|
@@ -7,30 +7,44 @@ export const HeadingUI = styled('h2', {
|
|
7
7
|
margin: 0,
|
8
8
|
|
9
9
|
variants: {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
},
|
10
|
+
size: {
|
11
|
+
sm: { fontSize: '$2xl' },
|
12
|
+
md: { fontSize: '$3xl' },
|
13
|
+
lg: { fontSize: '$4xl' },
|
14
|
+
xl: { fontSize: '$5xl' },
|
15
|
+
'2xl': { fontSize: '$6xl' },
|
16
|
+
'3xl': { fontSize: '$7xl' },
|
17
|
+
'4xl': { fontSize: '$8xl' },
|
18
|
+
'5xl': { fontSize: '$9xl' },
|
19
|
+
'6xl': { fontSize: '$10xl' },
|
20
|
+
},
|
21
|
+
color: {
|
14
22
|
white: {
|
15
23
|
color: '$white',
|
16
24
|
},
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
25
|
+
black: {
|
26
|
+
color: 'black',
|
27
|
+
},
|
28
|
+
primary: {
|
29
|
+
color: '$dafaz400',
|
30
|
+
},
|
31
|
+
lightGray: {
|
32
|
+
color: '$gray400',
|
33
|
+
},
|
34
|
+
darkGray: {
|
35
|
+
color: '$gray800',
|
36
|
+
},
|
24
37
|
},
|
25
38
|
},
|
26
39
|
defaultVariants: {
|
27
|
-
|
40
|
+
color: 'white',
|
28
41
|
size: 'lg',
|
29
42
|
},
|
30
43
|
})
|
31
44
|
|
32
45
|
export interface HeadingUIProps extends ComponentProps<typeof HeadingUI> {
|
33
46
|
as?: ElementType
|
34
|
-
size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl'
|
35
|
-
|
47
|
+
size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl'
|
48
|
+
color: 'white' | 'black' | 'primary' | 'lightGray' | 'darkGray'
|
49
|
+
style?: CSSProperties
|
36
50
|
}
|
@@ -0,0 +1,232 @@
|
|
1
|
+
import { CaretDown, X } from '@phosphor-icons/react'
|
2
|
+
import { CheckBox } from '../CheckBox'
|
3
|
+
import { SelectUI, SelectContainerUI, SelectUIProps } from './styles'
|
4
|
+
|
5
|
+
import {
|
6
|
+
forwardRef,
|
7
|
+
useEffect,
|
8
|
+
useState,
|
9
|
+
type ChangeEvent,
|
10
|
+
type ElementRef,
|
11
|
+
type MouseEvent,
|
12
|
+
} from 'react'
|
13
|
+
|
14
|
+
interface Item {
|
15
|
+
id: string
|
16
|
+
label: string
|
17
|
+
value: string
|
18
|
+
}
|
19
|
+
|
20
|
+
interface SelectContainerProps extends SelectUIProps {
|
21
|
+
id: string
|
22
|
+
items: Item[]
|
23
|
+
placeholder?: string
|
24
|
+
name?: string
|
25
|
+
value?: string[]
|
26
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void
|
27
|
+
}
|
28
|
+
|
29
|
+
export const MultiSelect = forwardRef<
|
30
|
+
ElementRef<typeof SelectUI>,
|
31
|
+
SelectContainerProps
|
32
|
+
>(
|
33
|
+
(
|
34
|
+
{ id, size, items, placeholder, onChange, ...props }: SelectContainerProps,
|
35
|
+
ref,
|
36
|
+
) => {
|
37
|
+
const [values, setValues] = useState([
|
38
|
+
{ id: '', label: '', value: '', isChecked: false },
|
39
|
+
])
|
40
|
+
const [selectedValue, setSelectedValue] = useState([''])
|
41
|
+
const [clickClass, setClickClass] = useState(false)
|
42
|
+
|
43
|
+
useEffect(() => {
|
44
|
+
items.map((item) =>
|
45
|
+
setValues((state) => {
|
46
|
+
const values = state.filter((item) => item.id !== '')
|
47
|
+
return [
|
48
|
+
...values,
|
49
|
+
{
|
50
|
+
id: item.id,
|
51
|
+
label: item.label,
|
52
|
+
value: item.value,
|
53
|
+
isChecked: false,
|
54
|
+
},
|
55
|
+
].sort((a, b) => (a.label > b.label ? 1 : -1))
|
56
|
+
}),
|
57
|
+
)
|
58
|
+
}, [items])
|
59
|
+
|
60
|
+
useEffect(() => {
|
61
|
+
setClickClass(false)
|
62
|
+
values.map((item) => {
|
63
|
+
if (item.isChecked) {
|
64
|
+
setSelectedValue((state) => {
|
65
|
+
const alreadyChecked = state.find((obj) => obj === item.value)
|
66
|
+
if (alreadyChecked) {
|
67
|
+
return state
|
68
|
+
} else {
|
69
|
+
return [...state, item.value]
|
70
|
+
}
|
71
|
+
})
|
72
|
+
} else {
|
73
|
+
setSelectedValue((state) => {
|
74
|
+
const itemsChecked = state.filter((obj) => obj !== item.value)
|
75
|
+
return itemsChecked
|
76
|
+
})
|
77
|
+
}
|
78
|
+
})
|
79
|
+
}, [values, items, setValues])
|
80
|
+
|
81
|
+
function handleOnValueChange(id: string) {
|
82
|
+
setClickClass(() => false)
|
83
|
+
setValues((state) => {
|
84
|
+
const items = state.filter((item) => item.id !== id)
|
85
|
+
const item = state.find((item) => item.id === id)
|
86
|
+
|
87
|
+
if (item) {
|
88
|
+
return [
|
89
|
+
{
|
90
|
+
id: item.id,
|
91
|
+
label: item.label,
|
92
|
+
value: item.value,
|
93
|
+
isChecked: !item.isChecked,
|
94
|
+
},
|
95
|
+
...items,
|
96
|
+
].sort((a, b) => (a.label > b.label ? 1 : -1))
|
97
|
+
}
|
98
|
+
return state
|
99
|
+
})
|
100
|
+
|
101
|
+
values.map((item) => {
|
102
|
+
if (item.isChecked) {
|
103
|
+
setSelectedValue((state) => {
|
104
|
+
const alreadyChecked = state.find((obj) => obj === item.value)
|
105
|
+
if (alreadyChecked) {
|
106
|
+
return state
|
107
|
+
} else {
|
108
|
+
return [...state, item.value]
|
109
|
+
}
|
110
|
+
})
|
111
|
+
} else {
|
112
|
+
setSelectedValue((state) => {
|
113
|
+
const itemsChecked = state.filter((obj) => obj !== item.value)
|
114
|
+
return itemsChecked
|
115
|
+
})
|
116
|
+
}
|
117
|
+
})
|
118
|
+
}
|
119
|
+
|
120
|
+
function handleOnClick() {
|
121
|
+
setClickClass((state) => !state)
|
122
|
+
}
|
123
|
+
|
124
|
+
function handleRemoveItem(e: MouseEvent<HTMLElement>, id: string) {
|
125
|
+
handleOnValueChange(id)
|
126
|
+
}
|
127
|
+
|
128
|
+
function updateSelectComponent(item: string) {
|
129
|
+
const checkedItem = selectedValue.find((obj) => obj === item)
|
130
|
+
|
131
|
+
if (checkedItem) {
|
132
|
+
return selectedValue.filter((obj) => obj !== item)
|
133
|
+
} else {
|
134
|
+
return [...selectedValue.filter((obj) => obj !== ''), item].sort(
|
135
|
+
(a, b) => (a > b ? 1 : -1),
|
136
|
+
)
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
const itemsChecked = values
|
141
|
+
.filter((item) => item.isChecked === true)
|
142
|
+
.sort((a, b) => (a.label > b.label ? 1 : -1))
|
143
|
+
|
144
|
+
return (
|
145
|
+
<SelectUI
|
146
|
+
ref={ref}
|
147
|
+
id={id}
|
148
|
+
size={size}
|
149
|
+
onClick={handleOnClick}
|
150
|
+
onBlur={handleOnClick}
|
151
|
+
value={selectedValue}
|
152
|
+
onChange={onChange}
|
153
|
+
className={clickClass ? 'clicked' : ''}
|
154
|
+
{...props}
|
155
|
+
>
|
156
|
+
{(itemsChecked.length > 0 &&
|
157
|
+
itemsChecked.map((item) => {
|
158
|
+
return (
|
159
|
+
<div key={`opt:${item.id}`}>
|
160
|
+
<div
|
161
|
+
style={{
|
162
|
+
display: 'flex',
|
163
|
+
justifyContent: 'space-between',
|
164
|
+
width: '100%',
|
165
|
+
marginTop: '0.2rem',
|
166
|
+
alignItems: 'center',
|
167
|
+
}}
|
168
|
+
>
|
169
|
+
<span>{item.label}</span>
|
170
|
+
<button
|
171
|
+
style={{
|
172
|
+
all: 'unset',
|
173
|
+
display: 'flex',
|
174
|
+
alignItems: 'center',
|
175
|
+
paddingLeft: '1rem',
|
176
|
+
}}
|
177
|
+
type="button"
|
178
|
+
onClick={(e) => handleRemoveItem(e, item.id)}
|
179
|
+
>
|
180
|
+
<X size={24} weight="bold" />
|
181
|
+
</button>
|
182
|
+
</div>
|
183
|
+
</div>
|
184
|
+
)
|
185
|
+
})) ||
|
186
|
+
(itemsChecked.length === 0 && (
|
187
|
+
<div>
|
188
|
+
<div
|
189
|
+
style={{
|
190
|
+
display: 'flex',
|
191
|
+
justifyContent: 'space-between',
|
192
|
+
width: '100%',
|
193
|
+
alignItems: 'center',
|
194
|
+
}}
|
195
|
+
>
|
196
|
+
<span style={{ opacity: 0.75 }}>{placeholder}</span>
|
197
|
+
<span
|
198
|
+
style={{
|
199
|
+
display: 'flex',
|
200
|
+
alignItems: 'center',
|
201
|
+
paddingLeft: '1rem',
|
202
|
+
}}
|
203
|
+
>
|
204
|
+
<CaretDown size={24} weight="bold" />
|
205
|
+
</span>
|
206
|
+
</div>
|
207
|
+
</div>
|
208
|
+
))}
|
209
|
+
|
210
|
+
<SelectContainerUI onMouseOutCapture={handleOnClick}>
|
211
|
+
{values.map((item) => {
|
212
|
+
return (
|
213
|
+
<CheckBox
|
214
|
+
name={`chk${item.id}`}
|
215
|
+
size={size}
|
216
|
+
key={item.id}
|
217
|
+
label={item.label}
|
218
|
+
checked={item.isChecked}
|
219
|
+
value={updateSelectComponent(item.value)}
|
220
|
+
handleOnChange={async () => {
|
221
|
+
handleOnValueChange(item.id)
|
222
|
+
}}
|
223
|
+
/>
|
224
|
+
)
|
225
|
+
})}
|
226
|
+
</SelectContainerUI>
|
227
|
+
</SelectUI>
|
228
|
+
)
|
229
|
+
},
|
230
|
+
)
|
231
|
+
|
232
|
+
MultiSelect.displayName = 'MultiSelect'
|
@@ -0,0 +1,116 @@
|
|
1
|
+
import { styled } from '../../styles'
|
2
|
+
import type { ComponentProps, CSSProperties } from 'react'
|
3
|
+
|
4
|
+
export const SelectUI = styled('div', {
|
5
|
+
width: '100%',
|
6
|
+
maxWidth: '24.5rem',
|
7
|
+
|
8
|
+
position: 'relative',
|
9
|
+
display: 'inline-block',
|
10
|
+
|
11
|
+
fontFamily: '$app',
|
12
|
+
color: '$white',
|
13
|
+
fontWeight: '$regular',
|
14
|
+
cursor: 'pointer',
|
15
|
+
|
16
|
+
margin: 0,
|
17
|
+
backgroundColor: 'transparent',
|
18
|
+
borderBottom: '2px solid $dafaz600',
|
19
|
+
borderRadius: '$md',
|
20
|
+
boxSizing: 'border-box',
|
21
|
+
transition: 'border 0.2s linear',
|
22
|
+
|
23
|
+
padding: '$1 $2',
|
24
|
+
|
25
|
+
boxShadow: '0 3px 2px -2px $colors$gray400',
|
26
|
+
|
27
|
+
'&:hover': {
|
28
|
+
borderBottom: '2px solid $dafaz400',
|
29
|
+
},
|
30
|
+
|
31
|
+
'&.clicked': {
|
32
|
+
borderBottom: '2px solid $dafaz400',
|
33
|
+
|
34
|
+
'&:hover': {
|
35
|
+
'> div': {
|
36
|
+
display: 'flex',
|
37
|
+
flexDirection: 'column',
|
38
|
+
alignItems: 'start',
|
39
|
+
gap: '$3',
|
40
|
+
},
|
41
|
+
},
|
42
|
+
},
|
43
|
+
|
44
|
+
variants: {
|
45
|
+
disabled: {
|
46
|
+
true: {
|
47
|
+
opacity: 0.5,
|
48
|
+
cursor: 'not-allowed',
|
49
|
+
},
|
50
|
+
},
|
51
|
+
size: {
|
52
|
+
lg: {
|
53
|
+
fontSize: '$xl',
|
54
|
+
svg: {
|
55
|
+
width: '$5',
|
56
|
+
height: '$5',
|
57
|
+
},
|
58
|
+
},
|
59
|
+
md: {
|
60
|
+
fontSize: '$lg',
|
61
|
+
svg: {
|
62
|
+
width: '$4',
|
63
|
+
height: '$4',
|
64
|
+
},
|
65
|
+
},
|
66
|
+
sm: {
|
67
|
+
fontSize: '$md',
|
68
|
+
svg: {
|
69
|
+
width: '$3',
|
70
|
+
height: '$3',
|
71
|
+
},
|
72
|
+
},
|
73
|
+
},
|
74
|
+
},
|
75
|
+
defaultVariants: {
|
76
|
+
disabled: false,
|
77
|
+
size: 'lg',
|
78
|
+
},
|
79
|
+
})
|
80
|
+
|
81
|
+
export interface SelectUIProps extends ComponentProps<typeof SelectUI> {
|
82
|
+
size?: 'sm' | 'md' | 'lg'
|
83
|
+
disabled?: boolean
|
84
|
+
style?: CSSProperties
|
85
|
+
}
|
86
|
+
|
87
|
+
export const SelectContainerUI = styled('div', {
|
88
|
+
marginTop: '0.4rem',
|
89
|
+
marginLeft: '-0.5rem',
|
90
|
+
padding: '$3 $2',
|
91
|
+
|
92
|
+
border: '1px solid $gray400',
|
93
|
+
boxSizing: 'border-box',
|
94
|
+
borderRadius: '$md',
|
95
|
+
|
96
|
+
display: 'none',
|
97
|
+
|
98
|
+
position: 'absolute',
|
99
|
+
zIndex: 999,
|
100
|
+
minWidth: '100%',
|
101
|
+
maxWidth: '24.5rem',
|
102
|
+
|
103
|
+
background: '$gray800',
|
104
|
+
|
105
|
+
fontFamily: '$app',
|
106
|
+
color: '$white',
|
107
|
+
fontWeight: '$regular',
|
108
|
+
cursor: 'pointer',
|
109
|
+
|
110
|
+
'&:hover': {
|
111
|
+
display: 'flex',
|
112
|
+
flexDirection: 'column',
|
113
|
+
alignItems: 'start',
|
114
|
+
gap: '$3',
|
115
|
+
},
|
116
|
+
})
|