@gentleduck/registry-ui 0.3.1 → 0.3.2

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.
@@ -1,41 +1,41 @@
1
1
  $ bun test
2
2
  bun test v1.3.10 (30e609e0)
3
3
 
4
- ::group::src/pagination/__test__/pagination.test.tsx:
5
- (pass) registry-ui pagination > PaginationWrapper prefers provided button icons over the default chevrons [17.00ms]
6
- (pass) registry-ui pagination > PaginationWrapper still renders default chevrons when icons are not provided [3.00ms]
4
+ ::group::src/carousel/__test__/carousel.test.tsx:
5
+ (pass) registry-ui carousel > CarouselPrevious prefers a provided icon over the default arrow icon [17.00ms]
6
+ (pass) registry-ui carousel > CarouselNext still renders the default arrow icon when no icon is provided [2.00ms]
7
7
 
8
8
  ::endgroup::
9
9
 
10
- ::group::src/sidebar/__test__/sidebar.test.tsx:
11
- (pass) registry-ui sidebar > SidebarTrigger prefers a provided icon over the default panel icon [1.00ms]
12
- (pass) registry-ui sidebar > SidebarTrigger still renders the default panel icon when no icon is provided
10
+ ::group::src/button/__test__/button.test.tsx:
11
+ (pass) registry-ui button > buttonVariants returns the shared base styles and defaults
12
+ (pass) registry-ui button > buttonVariants applies explicit variant and size overrides
13
+ (pass) registry-ui button > button exports keep stable display names
14
+ (pass) registry-ui button > Button renders loading state as a busy disabled native button [2.00ms]
15
+ (pass) registry-ui button > Button preserves explicit disabled state even when loading is false
16
+ (pass) registry-ui button > Button collapses into icon-only mode and hides secondary content
17
+ (pass) registry-ui button > AnimationIcon renders left and right placements around children [1.00ms]
13
18
 
14
19
  ::endgroup::
15
20
 
16
- ::group::src/chart/__test__/chart.test.tsx:
17
- (pass) registry-ui chart > ChartContainer server render does not emit invalid size warnings [11.00ms]
21
+ ::group::src/sidebar/__test__/sidebar.test.tsx:
22
+ (pass) registry-ui sidebar > SidebarTrigger prefers a provided icon over the default panel icon [1.00ms]
23
+ (pass) registry-ui sidebar > SidebarTrigger still renders the default panel icon when no icon is provided [1.00ms]
18
24
 
19
25
  ::endgroup::
20
26
 
21
- ::group::src/carousel/__test__/carousel.test.tsx:
22
- (pass) registry-ui carousel > CarouselPrevious prefers a provided icon over the default arrow icon [2.00ms]
23
- (pass) registry-ui carousel > CarouselNext still renders the default arrow icon when no icon is provided [1.00ms]
27
+ ::group::src/chart/__test__/chart.test.tsx:
28
+ (pass) registry-ui chart > ChartContainer server render does not emit invalid size warnings [12.00ms]
24
29
 
25
30
  ::endgroup::
26
31
 
27
- ::group::src/button/__test__/button.test.tsx:
28
- (pass) registry-ui button > buttonVariants returns the shared base styles and defaults
29
- (pass) registry-ui button > buttonVariants applies explicit variant and size overrides
30
- (pass) registry-ui button > button exports keep stable display names
31
- (pass) registry-ui button > Button renders loading state as a busy disabled native button [1.00ms]
32
- (pass) registry-ui button > Button preserves explicit disabled state even when loading is false
33
- (pass) registry-ui button > Button collapses into icon-only mode and hides secondary content
34
- (pass) registry-ui button > AnimationIcon renders left and right placements around children
32
+ ::group::src/pagination/__test__/pagination.test.tsx:
33
+ (pass) registry-ui pagination > PaginationWrapper prefers provided button icons over the default chevrons [2.00ms]
34
+ (pass) registry-ui pagination > PaginationWrapper still renders default chevrons when icons are not provided [2.00ms]
35
35
 
36
36
  ::endgroup::
37
37
 
38
38
  14 pass
39
39
  0 fail
40
40
  43 expect() calls
41
- Ran 14 tests across 5 files. [441.00ms]
41
+ Ran 14 tests across 5 files. [499.00ms]
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @gentleduck/registry-ui
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [32d0136]
8
+ - @gentleduck/calendar@0.2.1
9
+
3
10
  ## 0.3.1
4
11
 
5
12
  ### Patch Changes
package/bunfig.toml ADDED
@@ -0,0 +1,2 @@
1
+ [test]
2
+ timeout = 15000
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "@gentleduck/variants": "^0.1.20",
13
13
  "@gentleduck/vim": "^0.1.16",
14
14
  "embla-carousel-react": "8.6.0",
15
- "lucide-react": "0.577.0",
15
+ "lucide-react": "1.6.0",
16
16
  "next-themes": "^0.4.6",
17
17
  "react": "^19.2.4",
18
18
  "react-dom": "^19.2.4",
@@ -29,7 +29,7 @@
29
29
  "@gentleduck/typescript-config": "workspace:*",
30
30
  "@types/react": "19.2.14",
31
31
  "@types/react-dom": "19.2.3",
32
- "typescript": "5.9.3"
32
+ "typescript": "6.0.2"
33
33
  },
34
34
  "exports": {
35
35
  "./*": "./src/*/index.ts"
@@ -56,7 +56,7 @@
56
56
  "test": "bun test"
57
57
  },
58
58
  "type": "module",
59
- "version": "0.3.1",
59
+ "version": "0.3.2",
60
60
  "description": "Styled Tailwind components for Duck UI.",
61
61
  "keywords": [
62
62
  "gentleduck",
package/tsconfig.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/tsconfig",
3
3
  "compilerOptions": {
4
- "baseUrl": ".",
4
+ "ignoreDeprecations": "6.0",
5
5
  "incremental": false,
6
6
  "isolatedModules": true,
7
7
  "jsx": "react-jsx",
@@ -1,14 +0,0 @@
1
- /**
2
- * @deprecated These table components are deprecated and no longer maintained.
3
- * Use the components from `@duck-ui/registry-ui/table` instead.
4
- * This module will be removed in a future release.
5
- */
6
- export * from './table'
7
- /** @deprecated Use components from `@duck-ui/registry-ui/table` instead. */
8
- export * from './table.constants'
9
- /** @deprecated Use components from `@duck-ui/registry-ui/table` instead. */
10
- export * from './table.hook'
11
- /** @deprecated Use components from `@duck-ui/registry-ui/table` instead. */
12
- export * from './table.lib'
13
- /** @deprecated Use components from `@duck-ui/registry-ui/table` instead. */
14
- export * from './table.types'
@@ -1,24 +0,0 @@
1
- import { ArrowDownIcon, ArrowUpIcon, EyeOff } from 'lucide-react'
2
- import { TableColumnSortableType } from './table-advanced.types'
3
-
4
- export const dropdownMenuOptions: TableColumnSortableType[] = [
5
- {
6
- children: 'ascending',
7
- icon: <ArrowDownIcon className="mr-2 text-muted-foreground/80" />,
8
- size: 'sm',
9
- variant: 'ghost',
10
- },
11
-
12
- {
13
- children: 'descending',
14
- icon: <ArrowUpIcon className="mr-2 text-muted-foreground/80" />,
15
- size: 'sm',
16
- variant: 'ghost',
17
- },
18
- {
19
- children: 'hide' as 'other',
20
- icon: <EyeOff className="mr-2 text-muted-foreground/80" />,
21
- size: 'sm',
22
- variant: 'ghost',
23
- },
24
- ]
@@ -1,311 +0,0 @@
1
- import { cn } from '@gentleduck/libs/cn'
2
- import { ArrowDownIcon, ArrowUpDown, ArrowUpIcon } from 'lucide-react'
3
- import React from 'react'
4
- import { Button } from '../button'
5
- import { Checkbox } from '../checkbox'
6
- import {
7
- DropdownMenu,
8
- DropdownMenuContent,
9
- DropdownMenuGroup,
10
- DropdownMenuItem,
11
- DropdownMenuSeparator,
12
- DropdownMenuTrigger,
13
- } from '../dropdown-menu'
14
- import { Input } from '../input'
15
- import { ScrollArea } from '../scroll-area/'
16
- import { TableHead, TableHeader, TableRow } from '../table'
17
- import { Table, TableBody } from './table'
18
- import { dropdownMenuOptions } from './table-advanced.constants'
19
- import {
20
- DuckTableBodyProps,
21
- DuckTableContextType,
22
- DuckTableHeadCheckboxProps,
23
- DuckTableHeaderProps,
24
- DuckTableHeadSelectableProps,
25
- DuckTableProps,
26
- DuckTableProviderProps,
27
- DuckTableRowCheckboxProps,
28
- GetColumnLabel,
29
- TableColumnType,
30
- TableContentDataType,
31
- TableSearchStateType,
32
- } from './table-advanced.types'
33
-
34
- export const DuckTableContext = React.createContext<DuckTableContextType<any> | null>(null)
35
-
36
- export function useDuckTable<TColumnName extends readonly TableColumnType[]>() {
37
- const context = React.useContext<DuckTableContextType<GetColumnLabel<TColumnName>>>(
38
- DuckTableContext as unknown as React.Context<DuckTableContextType<GetColumnLabel<TColumnName>>>,
39
- )
40
- if (!context) {
41
- throw new Error('useTableProvider must be used within an TableProvider')
42
- }
43
- return context
44
- }
45
-
46
- export function DuckTableProvider<TColumnName extends string[]>({
47
- table_rows,
48
- table_columns,
49
- children,
50
- className,
51
- ...props
52
- }: DuckTableProviderProps<TColumnName>) {
53
- const [search, setSearch] = React.useState<TableSearchStateType>({
54
- query: '',
55
- queryBy: [],
56
- })
57
-
58
- const [tableColumns, setTableColumns] = React.useState<Map<string, TableColumnType>>(
59
- new Map(table_columns.map((column) => [column.label, column])),
60
- )
61
-
62
- const [selectedRows, setSelectedRows] = React.useState<Set<TableContentDataType<TColumnName>>>(new Set())
63
-
64
- const DuckTable = DuckTableContext //<TColumnName>()
65
-
66
- return (
67
- <DuckTable.Provider
68
- value={{
69
- search,
70
- selectedRows,
71
- setSearch,
72
- setSelectedRows,
73
- setTableColumns,
74
- tableColumns,
75
- tableRows: table_rows,
76
- }}>
77
- <div className={cn(`w-full- flex flex-col gap-4 w-[800px] h-[500px]`, className)} {...props}>
78
- {children}
79
- </div>
80
- </DuckTable.Provider>
81
- )
82
- }
83
- DuckTableProvider.displayName = 'DuckTableProvider'
84
-
85
- export function DuckTable({ wrapper, className, children, ...props }: DuckTableProps) {
86
- const { className: wrapperClassName, ...wrapperProps } = wrapper! ?? {}
87
-
88
- return (
89
- <ScrollArea
90
- className={cn('border border-border rounded-lg !overflow-visible relative', wrapperClassName)}
91
- {...wrapperProps}>
92
- <Table {...props}>{children}</Table>
93
- </ScrollArea>
94
- )
95
- }
96
- DuckTable.displayName = 'DuckTable'
97
-
98
- // ------------------------------------------------------------------------------------------------
99
-
100
- export function DuckTableHeader({}: DuckTableHeaderProps) {
101
- const { tableColumns } = useDuckTable()
102
- return (
103
- <>
104
- <TableHeader>
105
- <TableRow>
106
- {Array.from(tableColumns.values())?.map((column, idx) => {
107
- const { children, className, sortable, label, showLabel, ...props } = column
108
-
109
- const Component = () =>
110
- sortable ? (
111
- <DuckTableHeadSelectable column={column} label={(label as string) ?? children} showLabel={showLabel} />
112
- ) : (
113
- <span className="capitalize">{(label as string) ?? children}</span>
114
- )
115
-
116
- return (
117
- !column['aria-hidden'] && (
118
- <React.Fragment key={idx}>
119
- <TableHead
120
- className={cn('py-2', idx === 0 && 'justify-start ', sortable && 'px-2', className)}
121
- {...props}>
122
- {idx === 0 ? (
123
- <div className="flex items-center gap-4">
124
- <DuckTableHeadCheckbox className={cn(sortable && 'justify-end')} type="header" />
125
- {/*NOTE: Rendering Sorting else rendering label*/}
126
- <Component />
127
- </div>
128
- ) : (
129
- <Component />
130
- )}
131
- </TableHead>
132
- </React.Fragment>
133
- )
134
- )
135
- })}
136
- </TableRow>
137
- </TableHeader>
138
- </>
139
- )
140
- }
141
- DuckTableHeader.displayName = 'TableCustomViewHeader'
142
-
143
- export function DuckTableHeadCheckbox({ className, ...props }: DuckTableHeadCheckboxProps) {
144
- const { selectedRows, setSelectedRows, tableRows } = useDuckTable()
145
-
146
- return (
147
- <div className={cn('flex items-center w-fit data-[state=open]:bg-accent text-xs capitalize', className)} {...props}>
148
- <Checkbox
149
- checked={
150
- selectedRows.size === tableRows.length
151
- ? true
152
- : selectedRows.size < tableRows.length && selectedRows.size
153
- ? 'indeterminate'
154
- : false
155
- }
156
- className="border-border"
157
- onClick={() => {
158
- setSelectedRows(() => {
159
- if (selectedRows.size === tableRows.length) {
160
- return new Set()
161
- }
162
- return new Set(tableRows.map((item) => item))
163
- })
164
- }}
165
- />
166
- </div>
167
- )
168
- }
169
-
170
- export function DuckTableHeadSelectable<TSort extends boolean = true>({
171
- column,
172
- label,
173
- showLabel,
174
- children,
175
- }: DuckTableHeadSelectableProps<TSort>) {
176
- const { setTableColumns } = useDuckTable()
177
-
178
- return (
179
- <div className={cn('flex items-center space-x-2')}>
180
- {(dropdownMenuOptions?.length ?? 0) > 0 && (
181
- <DropdownMenu>
182
- <DropdownMenuTrigger asChild>
183
- <Button
184
- aria-controls="dropdown-menu"
185
- aria-label="table-column-options"
186
- aria-sort={column['aria-sort']}
187
- className="data-[state=open]:bg-accent [&>div]:justify-between w-full [&>div]:w-full capitalize"
188
- label={
189
- showLabel
190
- ? {
191
- children: label.toString() + ' options',
192
- className: 'capitalize',
193
- showLabel: true,
194
- side: 'top',
195
- }
196
- : undefined
197
- }
198
- name="dropdown-menu-trigger"
199
- secondIcon={
200
- column['aria-sort'] === 'ascending' ? (
201
- <ArrowDownIcon className="text-muted-foreground" />
202
- ) : column['aria-sort'] === 'descending' ? (
203
- <ArrowUpIcon className="text-muted-foreground" />
204
- ) : (
205
- <ArrowUpDown className="text-muted-foreground" />
206
- )
207
- }
208
- size="sm"
209
- variant="ghost">
210
- {(label as string) ?? children}
211
- </Button>
212
- </DropdownMenuTrigger>
213
- <DropdownMenuContent className="w-48">
214
- <DropdownMenuGroup>
215
- {dropdownMenuOptions.map((item, idx) => {
216
- return (
217
- <>
218
- {idx === dropdownMenuOptions.length - 1 && <DropdownMenuSeparator />}
219
- <DropdownMenuItem
220
- className="p-0"
221
- key={idx}
222
- onClick={() => {
223
- setTableColumns((prev) => {
224
- const newSet = new Map(prev)
225
-
226
- if (item.children === ('hide' as 'other')) {
227
- newSet.set(label, {
228
- ...column,
229
- 'aria-hidden': true,
230
- hidden: true,
231
- })
232
- } else {
233
- if (newSet.get(label)?.label === item.children) {
234
- newSet.set(label, {
235
- ...column,
236
- 'aria-sort': 'none',
237
- })
238
- } else {
239
- newSet.set(label, {
240
- ...column,
241
- 'aria-sort': item.children,
242
- })
243
- }
244
- }
245
-
246
- return newSet
247
- })
248
- }}>
249
- <Button {...item} className={cn('w-full justify-start capitalize', item.className)}>
250
- {item.children}
251
- </Button>
252
- </DropdownMenuItem>
253
- </>
254
- )
255
- })}
256
- </DropdownMenuGroup>
257
- </DropdownMenuContent>
258
- </DropdownMenu>
259
- )}
260
- </div>
261
- )
262
- }
263
-
264
- export function DuckTableBody({ children }: DuckTableBodyProps) {
265
- return <TableBody>{children}</TableBody>
266
- }
267
-
268
- export function DuckTableRowCheckbox<TColumnName extends readonly TableColumnType[]>({
269
- className,
270
- tableRow,
271
- ...props
272
- }: DuckTableRowCheckboxProps<TColumnName>) {
273
- const { selectedRows, setSelectedRows } = useDuckTable()
274
-
275
- return (
276
- <div className={cn('flex items-center w-fit data-[state=open]:bg-accent text-xs capitalize', className)} {...props}>
277
- <Checkbox
278
- checked={selectedRows.has(tableRow) ? true : false}
279
- className="border-border"
280
- onClick={() => {
281
- setSelectedRows(() => {
282
- if (selectedRows.has(tableRow)) {
283
- return new Set(Array.from(selectedRows.values()).filter((item) => item !== tableRow))
284
- }
285
- return new Set([...selectedRows, tableRow])
286
- })
287
- }}
288
- />
289
- </div>
290
- )
291
- }
292
-
293
- export interface DuckTableTopBarProps extends React.HTMLProps<HTMLDivElement> {}
294
-
295
- export function DuckTableTopBar({ className, children, ...props }: DuckTableTopBarProps) {
296
- return (
297
- <div className={cn('', className)} {...props}>
298
- {children}
299
- </div>
300
- )
301
- }
302
-
303
- export interface DuckTableSearchInputProps extends React.HTMLProps<HTMLDivElement> {}
304
-
305
- export function DuckTableSearchInput({ className, ...props }: DuckTableSearchInputProps) {
306
- return (
307
- <div className={cn('flex-1', className)} {...props}>
308
- <Input placeholder="Search..." />
309
- </div>
310
- )
311
- }