uibee 3.1.6 → 3.3.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.
@@ -0,0 +1,20 @@
1
+ type SpinnerProps = {
2
+ size?: 'sm' | 'md' | 'lg'
3
+ className?: string
4
+ }
5
+
6
+ const sizes = {
7
+ sm: 'w-4 h-4 border-2',
8
+ md: 'w-6 h-6 border-2',
9
+ lg: 'w-9 h-9 border-[3px]',
10
+ }
11
+
12
+ export default function Spinner({ size = 'md', className = '' }: SpinnerProps) {
13
+ return (
14
+ <div
15
+ role='status'
16
+ aria-label='Loading'
17
+ className={`rounded-full border-login-500 border-t-login animate-spin ${sizes[size]} ${className}`}
18
+ />
19
+ )
20
+ }
@@ -51,7 +51,7 @@ function Cell<T extends Record<string, unknown>>({
51
51
 
52
52
  const wrapperAlign =
53
53
  align === 'right' ? 'text-right' :
54
- align === 'center' ? 'text-center' : ''
54
+ align === 'center' ? 'text-center' : ''
55
55
 
56
56
  let content: React.ReactNode
57
57
 
@@ -146,7 +146,11 @@ export default function Body<T extends Record<string, unknown>>({
146
146
  return (
147
147
  <tbody className={VARIANT_TBODY[variant]}>
148
148
  {data.map((row, rowIdx) => {
149
- const id = resolveId(row as Record<string, unknown>, idKey as string | undefined, columns as Column<Record<string, unknown>>[])
149
+ const id = resolveId(
150
+ row as Record<string, unknown>,
151
+ idKey as string | undefined,
152
+ columns as Column<Record<string, unknown>>[],
153
+ )
150
154
  const url = resolveRedirectUrl(redirectPath, row as Record<string, unknown>, id)
151
155
  const isClickable = Boolean(url || onRowClick || hasExpand)
152
156
  const isMenuOpen = openMenuId === id
@@ -191,28 +195,34 @@ export default function Body<T extends Record<string, unknown>>({
191
195
  {selectable && (
192
196
  <td className={`align-middle ${VARIANT_ROW_BORDER[variant]}`}
193
197
  style={{ width: '3rem', minWidth: '3rem' }}>
194
- <div className='flex items-center justify-center'>
195
- <button
196
- type='button'
197
- aria-label={isSelected ? 'Deselect row' : 'Select row'}
198
- aria-checked={isSelected}
199
- role='checkbox'
200
- onClick={(e) => { e.stopPropagation(); toggleSelect(id) }}
201
- className={`
198
+ <div className='flex items-center justify-center'>
199
+ <button
200
+ type='button'
201
+ aria-label={isSelected ? 'Deselect row' : 'Select row'}
202
+ aria-checked={isSelected}
203
+ role='checkbox'
204
+ onClick={(e) => { e.stopPropagation(); toggleSelect(id) }}
205
+ className={`
202
206
  h-4 w-4 rounded border flex items-center justify-center transition-colors cursor-pointer
203
207
  ${isSelected
204
- ? 'bg-login border-login text-white'
205
- : 'border-login-400 bg-transparent hover:border-login-100'
206
- }
208
+ ? 'bg-login border-login text-white'
209
+ : 'border-login-400 bg-transparent hover:border-login-100'
210
+ }
207
211
  `}
208
- >
209
- {isSelected && (
210
- <svg className='h-3 w-3' viewBox='0 0 12 12' fill='none'>
211
- <path d='M2 6l3 3 5-5' stroke='currentColor' strokeWidth='1.5' strokeLinecap='round' strokeLinejoin='round' />
212
- </svg>
213
- )}
214
- </button>
215
- </div>
212
+ >
213
+ {isSelected && (
214
+ <svg className='h-3 w-3' viewBox='0 0 12 12' fill='none'>
215
+ <path
216
+ d='M2 6l3 3 5-5'
217
+ stroke='currentColor'
218
+ strokeWidth='1.5'
219
+ strokeLinecap='round'
220
+ strokeLinejoin='round'
221
+ />
222
+ </svg>
223
+ )}
224
+ </button>
225
+ </div>
216
226
  </td>
217
227
  )}
218
228
 
@@ -223,12 +233,12 @@ export default function Body<T extends Record<string, unknown>>({
223
233
  {hasExpand && (
224
234
  <td className={`align-middle ${VARIANT_ROW_BORDER[variant]}`}
225
235
  style={{ width: '2.5rem', minWidth: '2.5rem' }}>
226
- <div className='flex items-center justify-center'>
227
- <ChevronDown className={`
236
+ <div className='flex items-center justify-center'>
237
+ <ChevronDown className={`
228
238
  h-4 w-4 transition-transform duration-200
229
239
  ${isExpanded ? 'rotate-180 text-login' : 'text-login-400'}
230
240
  `} />
231
- </div>
241
+ </div>
232
242
  </td>
233
243
  )}
234
244
 
@@ -254,9 +264,9 @@ export default function Body<T extends Record<string, unknown>>({
254
264
  className={`
255
265
  p-1.5 rounded flex items-center justify-center transition-colors
256
266
  ${isMenuOpen
257
- ? 'bg-login-500 text-login-75'
258
- : 'text-login-300 hover:bg-login-500/60 hover:text-login-75'
259
- }
267
+ ? 'bg-login-500 text-login-75'
268
+ : 'text-login-300 hover:bg-login-500/60 hover:text-login-75'
269
+ }
260
270
  `}
261
271
  >
262
272
  <EllipsisVertical className='h-4 w-4' />
@@ -49,29 +49,35 @@ export default function Header<T extends Record<string, unknown>>({
49
49
  {hasSelect && (
50
50
  <th className={`sticky top-0 z-10 ${VARIANT_HEAD_BG[variant]} ${VARIANT_HEAD_BORDER[variant]}`}
51
51
  style={{ width: '3rem', minWidth: '3rem' }}>
52
- <div className='flex items-center justify-center'>
53
- <button
54
- type='button'
55
- aria-label={allSelected ? 'Deselect all' : 'Select all'}
56
- onClick={onSelectAll}
57
- className={`
52
+ <div className='flex items-center justify-center'>
53
+ <button
54
+ type='button'
55
+ aria-label={allSelected ? 'Deselect all' : 'Select all'}
56
+ onClick={onSelectAll}
57
+ className={`
58
58
  h-4 w-4 rounded border flex items-center justify-center transition-colors cursor-pointer
59
59
  ${allSelected || someSelected
60
- ? 'bg-login border-login text-white'
61
- : 'border-login-400 bg-transparent hover:border-login-200'
62
- }
60
+ ? 'bg-login border-login text-white'
61
+ : 'border-login-400 bg-transparent hover:border-login-200'
62
+ }
63
63
  `}
64
- >
65
- {someSelected && !allSelected && (
66
- <span className='block h-0.5 w-2 bg-white rounded-full' />
67
- )}
68
- {allSelected && (
69
- <svg className='h-3 w-3' viewBox='0 0 12 12' fill='none'>
70
- <path d='M2 6l3 3 5-5' stroke='currentColor' strokeWidth='1.5' strokeLinecap='round' strokeLinejoin='round' />
71
- </svg>
72
- )}
73
- </button>
74
- </div>
64
+ >
65
+ {someSelected && !allSelected && (
66
+ <span className='block h-0.5 w-2 bg-white rounded-full' />
67
+ )}
68
+ {allSelected && (
69
+ <svg className='h-3 w-3' viewBox='0 0 12 12' fill='none'>
70
+ <path
71
+ d='M2 6l3 3 5-5'
72
+ stroke='currentColor'
73
+ strokeWidth='1.5'
74
+ strokeLinecap='round'
75
+ strokeLinejoin='round'
76
+ />
77
+ </svg>
78
+ )}
79
+ </button>
80
+ </div>
75
81
  </th>
76
82
  )}
77
83
 
@@ -84,7 +90,7 @@ export default function Header<T extends Record<string, unknown>>({
84
90
 
85
91
  const alignClass =
86
92
  col.align === 'right' ? 'justify-end' :
87
- col.align === 'center' ? 'justify-center' : ''
93
+ col.align === 'center' ? 'justify-center' : ''
88
94
 
89
95
  return (
90
96
  <th
@@ -126,7 +132,11 @@ export default function Header<T extends Record<string, unknown>>({
126
132
  {hasExpand && (
127
133
  <th className={`sticky top-0 z-10 ${VARIANT_HEAD_BG[variant]} ${VARIANT_HEAD_BORDER[variant]}`}
128
134
  style={{ width: '2.5rem', minWidth: '2.5rem' }}>
129
- <span className={`flex items-center justify-center text-xs font-medium tracking-wider uppercase opacity-50 ${VARIANT_THEAD_TH[variant]}`}>
135
+ <span className={`
136
+ flex items-center justify-center
137
+ text-xs font-medium tracking-wider uppercase opacity-50
138
+ ${VARIANT_THEAD_TH[variant]}
139
+ `}>
130
140
  +
131
141
  </span>
132
142
  </th>
package/src/globals.css CHANGED
@@ -35,7 +35,7 @@
35
35
  --color-login-100: #b0b0b0;
36
36
  --color-login-75: #e4e4e4;
37
37
  --color-login-50: #ededed;
38
-
38
+
39
39
  --color-login-text: #ededed;
40
40
  }
41
41