@dafaz-ui/react 3.0.4 → 4.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dafaz-ui/react",
3
- "version": "3.0.4",
3
+ "version": "4.0.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -10,11 +10,12 @@ export function CheckBox({
10
10
  id,
11
11
  label,
12
12
  size,
13
+ disabled = false,
13
14
  ...props
14
15
  }: CheckboxIUProps & CheckboxProps) {
15
16
  return (
16
- <Label htmlFor={id} size={size}>
17
- <CheckBoxUI id={id} {...props} size={size}>
17
+ <Label disabled={disabled} htmlFor={id} size={size}>
18
+ <CheckBoxUI disabled={disabled} id={id} {...props} size={size}>
18
19
  <CheckBoxIndicator asChild size={size}>
19
20
  <Check weight="bold" />
20
21
  </CheckBoxIndicator>
@@ -28,6 +28,11 @@ export const CheckBoxUI = styled(Checkbox.Root, {
28
28
  borderColor: '$dafaz600',
29
29
  },
30
30
 
31
+ '&:disabled': {
32
+ opacity: 0.5,
33
+ cursor: 'not-allowed',
34
+ },
35
+
31
36
  variants: {
32
37
  size: {
33
38
  lg: {
@@ -48,7 +53,7 @@ export const CheckBoxUI = styled(Checkbox.Root, {
48
53
  },
49
54
  },
50
55
  defaultVariants: {
51
- size: 'lg',
56
+ size: 'md',
52
57
  },
53
58
  })
54
59
 
@@ -90,7 +95,7 @@ export const CheckBoxIndicator = styled(Checkbox.Indicator, {
90
95
  },
91
96
  },
92
97
  defaultVariants: {
93
- size: 'lg',
98
+ size: 'md',
94
99
  },
95
100
  })
96
101
 
@@ -106,6 +111,12 @@ export const Label = styled('label', {
106
111
  alignItems: 'center',
107
112
 
108
113
  variants: {
114
+ disabled: {
115
+ true: {
116
+ opacity: 0.5,
117
+ cursor: 'not-allowed',
118
+ },
119
+ },
109
120
  size: {
110
121
  lg: {
111
122
  fontSize: '$xl',
@@ -119,10 +130,12 @@ export const Label = styled('label', {
119
130
  },
120
131
  },
121
132
  defaultVariants: {
122
- size: 'lg',
133
+ disabled: false,
134
+ size: 'md',
123
135
  },
124
136
  })
125
137
 
126
138
  export interface CheckboxIUProps extends ComponentProps<typeof CheckBoxUI> {
127
139
  size?: 'sm' | 'md' | 'lg'
140
+ disabled?: boolean
128
141
  }
@@ -15,16 +15,17 @@ export function RadioItem({
15
15
  label,
16
16
  id,
17
17
  size,
18
+ disabled = false,
18
19
  ...props
19
20
  }: RadioItemProps & RadioItemUIProps) {
20
21
  return (
21
22
  <RadioItemContainer key={id}>
22
- <RadioItemUI id={id} {...props} size={size}>
23
+ <RadioItemUI disabled={disabled} id={id} {...props} size={size}>
23
24
  <RadioIndicator asChild size={size}>
24
25
  <Check weight="bold" />
25
26
  </RadioIndicator>
26
27
  </RadioItemUI>
27
- <Label htmlFor={id} size={size}>
28
+ <Label disabled={disabled} htmlFor={id} size={size}>
28
29
  {label}
29
30
  </Label>
30
31
  </RadioItemContainer>
@@ -21,6 +21,10 @@ export const RadioItemUI = styled(RadioGroup.Item, {
21
21
  borderBottom: '2px solid $dafaz600',
22
22
  transition: 'border 0.1s linear',
23
23
 
24
+ '&:disabled': {
25
+ cursor: 'not-allowed',
26
+ },
27
+
24
28
  '&:focus,&[data-state="checked"]': {
25
29
  backgroundColor: '$dafaz600',
26
30
  borderColor: '$dafaz600',
@@ -54,7 +58,7 @@ export const RadioItemUI = styled(RadioGroup.Item, {
54
58
  },
55
59
  },
56
60
  defaultVariants: {
57
- size: 'lg',
61
+ size: 'md',
58
62
  },
59
63
  })
60
64
 
@@ -96,7 +100,7 @@ export const RadioIndicator = styled(RadioGroup.Indicator, {
96
100
  },
97
101
  },
98
102
  defaultVariants: {
99
- size: 'lg',
103
+ size: 'md',
100
104
  },
101
105
  })
102
106
 
@@ -108,6 +112,12 @@ export const Label = styled('label', {
108
112
  cursor: 'pointer',
109
113
 
110
114
  variants: {
115
+ disabled: {
116
+ true: {
117
+ opacity: 0.5,
118
+ cursor: 'not-allowed',
119
+ },
120
+ },
111
121
  size: {
112
122
  lg: {
113
123
  fontSize: '$xl',
@@ -121,7 +131,8 @@ export const Label = styled('label', {
121
131
  },
122
132
  },
123
133
  defaultVariants: {
124
- size: 'lg',
134
+ disabled: false,
135
+ size: 'md',
125
136
  },
126
137
  })
127
138
 
@@ -5,15 +5,21 @@ interface Item {
5
5
  id: string
6
6
  label: string
7
7
  value: string
8
+ disabled: boolean
8
9
  }
9
10
 
10
11
  interface RadioGroupProps extends RadioUIProps {
11
12
  items: Item[]
12
13
  }
13
14
 
14
- export function Radio({ items, size, ...props }: RadioGroupProps) {
15
+ export function Radio({
16
+ items,
17
+ size,
18
+ disabled = false,
19
+ ...props
20
+ }: RadioGroupProps) {
15
21
  return (
16
- <RadioUI {...props}>
22
+ <RadioUI disabled={disabled} {...props}>
17
23
  {items.map((item) => {
18
24
  return (
19
25
  <RadioItem
@@ -21,6 +27,7 @@ export function Radio({ items, size, ...props }: RadioGroupProps) {
21
27
  label={item.label}
22
28
  value={item.value}
23
29
  size={size}
30
+ disabled={disabled}
24
31
  />
25
32
  )
26
33
  })}
@@ -8,6 +8,11 @@ export const RadioUI = styled(RadioGroup.Root, {
8
8
  flexDirection: 'column',
9
9
  gap: '$4',
10
10
 
11
+ '&:disabled': {
12
+ opacity: 0.5,
13
+ cursor: 'not-allowed',
14
+ },
15
+
11
16
  variants: {
12
17
  size: {
13
18
  lg: {},
@@ -16,7 +21,7 @@ export const RadioUI = styled(RadioGroup.Root, {
16
21
  },
17
22
  },
18
23
  defaultVariants: {
19
- size: 'lg',
24
+ size: 'md',
20
25
  },
21
26
  })
22
27
 
@@ -0,0 +1,36 @@
1
+ import { SelectUI, SelectUIProps, OptionUI } from './styles'
2
+
3
+ interface Item {
4
+ id: string
5
+ label: string
6
+ value: string
7
+ }
8
+
9
+ interface SelectProps {
10
+ items: Item[]
11
+ placeholder?: string
12
+ }
13
+
14
+ export function Select({
15
+ size,
16
+ placeholder,
17
+ items,
18
+ ...props
19
+ }: SelectUIProps & SelectProps) {
20
+ return (
21
+ <SelectUI size={size} {...props} defaultValue="">
22
+ <OptionUI className="placeholder" value="">
23
+ {placeholder}
24
+ </OptionUI>
25
+ {items.map((item) => {
26
+ return (
27
+ <OptionUI key={item.id} value={item.value}>
28
+ {item.label}
29
+ </OptionUI>
30
+ )
31
+ })}
32
+ </SelectUI>
33
+ )
34
+ }
35
+
36
+ Select.displayName = 'Select'
@@ -0,0 +1,83 @@
1
+ import type { ComponentProps } from 'react'
2
+ import { styled } from '../../styles'
3
+
4
+ export const SelectUI = styled('select', {
5
+ gap: '$2',
6
+ overflow: 'hidden',
7
+
8
+ background: 'transparent',
9
+ border: 'none',
10
+
11
+ fontFamily: '$app',
12
+ color: '$white',
13
+ fontWeight: '$regular',
14
+ cursor: 'pointer',
15
+
16
+ boxSizing: 'border-box',
17
+ borderRadius: '$md',
18
+ borderBottom: '2px solid $dafaz600',
19
+ transition: 'border 0.2s linear',
20
+
21
+ width: '100%',
22
+ margin: 0,
23
+ padding: '$1 $2',
24
+
25
+ '&:focus': {
26
+ outline: 0,
27
+ borderBottom: '2px solid $dafaz400',
28
+ },
29
+
30
+ '&:disabled': {
31
+ opacity: 0.5,
32
+ cursor: 'not-allowed',
33
+ },
34
+
35
+ variants: {
36
+ size: {
37
+ lg: {
38
+ fontSize: '$xl',
39
+ },
40
+ md: {
41
+ fontSize: '$lg',
42
+ },
43
+ sm: {
44
+ fontSize: '$md',
45
+ },
46
+ },
47
+ },
48
+
49
+ defaultVariants: {
50
+ size: 'md',
51
+ },
52
+ })
53
+
54
+ export interface SelectUIProps extends ComponentProps<typeof SelectUI> {
55
+ size?: 'sm' | 'md' | 'lg'
56
+ }
57
+
58
+ export const OptionUI = styled('option', {
59
+ backgroundColor: '$gray800',
60
+
61
+ '&.placeholder': {
62
+ backgroundColor: '$gray400',
63
+ },
64
+
65
+ variants: {
66
+ size: {
67
+ lg: {
68
+ fontSize: '$xl',
69
+ },
70
+ md: {
71
+ fontSize: '$lg',
72
+ },
73
+ sm: {
74
+ fontSize: '$md',
75
+ },
76
+ },
77
+ },
78
+ defaultVariants: {
79
+ size: 'md',
80
+ },
81
+ })
82
+
83
+ export interface OptionUIProps extends ComponentProps<typeof OptionUI> {}
@@ -30,7 +30,7 @@ export const TextAreaUI = styled('textarea', {
30
30
  },
31
31
 
32
32
  '&::placeholder': {
33
- fontSize: '$xl',
33
+ fontSize: '$lg',
34
34
  fontWeight: '$regular',
35
35
  color: '$white',
36
36
  opacity: 0.75,
package/src/index.tsx CHANGED
@@ -3,6 +3,7 @@ export * from './components/Button'
3
3
  export * from './components/CheckBox'
4
4
  export * from './components/Heading'
5
5
  export * from './components/Radio'
6
+ export * from './components/Select'
6
7
  export * from './components/Text'
7
8
  export * from './components/TextArea'
8
9
  export * from './components/TextInput'