sheerly 0.0.2 → 0.0.3

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,8 +1,11 @@
1
- import { AnchorHTMLAttributes, ElementType, HTMLAttributes, OlHTMLAttributes } from 'react';
1
+ import { ElementType } from 'react';
2
2
  import { PolymorphicProps } from './utils/polymorphic';
3
+ export type BreadcrumbProps<T extends ElementType = 'nav'> = PolymorphicProps<T>;
3
4
  /**
4
5
  * A path hierarchy of links.
5
6
  *
7
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `nav`).
8
+ *
6
9
  * @example
7
10
  * <Breadcrumb>
8
11
  * <BreadcrumbList>
@@ -12,12 +15,35 @@ import { PolymorphicProps } from './utils/polymorphic';
12
15
  * </BreadcrumbList>
13
16
  * </Breadcrumb>
14
17
  */
15
- export declare function Breadcrumb({ className, ...props }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
16
- export declare function BreadcrumbList({ className, ...props }: OlHTMLAttributes<HTMLOListElement>): import("react").JSX.Element;
17
- export declare function BreadcrumbItem({ className, ...props }: HTMLAttributes<HTMLLIElement>): import("react").JSX.Element;
18
- export declare function BreadcrumbLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnchorElement>): import("react").JSX.Element;
18
+ export declare function Breadcrumb<T extends ElementType = 'nav'>({ as, className, ...props }: BreadcrumbProps<T>): import("react").JSX.Element;
19
+ export type BreadcrumbListProps<T extends ElementType = 'ol'> = PolymorphicProps<T>;
20
+ /**
21
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `ol`).
22
+ */
23
+ export declare function BreadcrumbList<T extends ElementType = 'ol'>({ as, className, ...props }: BreadcrumbListProps<T>): import("react").JSX.Element;
24
+ export type BreadcrumbItemProps<T extends ElementType = 'li'> = PolymorphicProps<T>;
25
+ /**
26
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `li`).
27
+ */
28
+ export declare function BreadcrumbItem<T extends ElementType = 'li'>({ as, className, ...props }: BreadcrumbItemProps<T>): import("react").JSX.Element;
29
+ export type BreadcrumbLinkProps<T extends ElementType = 'a'> = PolymorphicProps<T>;
30
+ /**
31
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `a`, e.g.
32
+ * `as={Link}` for a router link).
33
+ */
34
+ export declare function BreadcrumbLink<T extends ElementType = 'a'>({ as, className, ...props }: BreadcrumbLinkProps<T>): import("react").JSX.Element;
19
35
  export type BreadcrumbPageProps<T extends ElementType = 'span'> = PolymorphicProps<T>;
36
+ /**
37
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `span`).
38
+ */
20
39
  export declare function BreadcrumbPage<T extends ElementType = 'span'>({ as, className, ...props }: BreadcrumbPageProps<T>): import("react").JSX.Element;
21
- export declare function BreadcrumbSeparator({ className, children, ...props }: HTMLAttributes<HTMLLIElement>): import("react").JSX.Element;
40
+ export type BreadcrumbSeparatorProps<T extends ElementType = 'li'> = PolymorphicProps<T>;
41
+ /**
42
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `li`).
43
+ */
44
+ export declare function BreadcrumbSeparator<T extends ElementType = 'li'>({ as, className, ...props }: BreadcrumbSeparatorProps<T>): import("react").JSX.Element;
22
45
  export type BreadcrumbEllipsisProps<T extends ElementType = 'span'> = PolymorphicProps<T>;
23
- export declare function BreadcrumbEllipsis<T extends ElementType = 'span'>({ as, className, children, ...props }: BreadcrumbEllipsisProps<T>): import("react").JSX.Element;
46
+ /**
47
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `span`).
48
+ */
49
+ export declare function BreadcrumbEllipsis<T extends ElementType = 'span'>({ as, className, ...props }: BreadcrumbEllipsisProps<T>): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType } from 'react';
1
+ import { ButtonHTMLAttributes, ElementType } from 'react';
2
2
  import { PolymorphicProps } from './utils/polymorphic';
3
3
  /**
4
4
  * Wrapper carrying the anchor. Nest the trigger button + content inside.
@@ -35,12 +35,17 @@ export interface DropdownMenuItemProps extends ButtonHTMLAttributes<HTMLButtonEl
35
35
  'data-inset'?: boolean;
36
36
  }
37
37
  export declare function DropdownMenuItem({ className, type, ...props }: DropdownMenuItemProps): import("react").JSX.Element;
38
- /** An interactive menu row rendered as a link (<a>). */
39
- export interface DropdownMenuLinkItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
38
+ /**
39
+ * An interactive menu row rendered as a link.
40
+ *
41
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `a`, e.g.
42
+ * `as={Link}` for a router link).
43
+ */
44
+ export type DropdownMenuLinkItemProps<T extends ElementType = 'a'> = PolymorphicProps<T, {
40
45
  'data-variant'?: 'destructive';
41
46
  'data-inset'?: boolean;
42
- }
43
- export declare function DropdownMenuLinkItem({ className, ...props }: DropdownMenuLinkItemProps): import("react").JSX.Element;
47
+ }>;
48
+ export declare function DropdownMenuLinkItem<T extends ElementType = 'a'>({ as, className, ...props }: DropdownMenuLinkItemProps<T>): import("react").JSX.Element;
44
49
  /** A trailing keyboard-shortcut hint inside an item. */
45
50
  export type DropdownMenuShortcutProps<T extends ElementType = 'span'> = PolymorphicProps<T>;
46
51
  export declare function DropdownMenuShortcut<T extends ElementType = 'span'>({ as, className, ...props }: DropdownMenuShortcutProps<T>): import("react").JSX.Element;
package/lib/index.js CHANGED
@@ -77,32 +77,32 @@ function ee({ as: t, className: r, ...i }) {
77
77
  }
78
78
  //#endregion
79
79
  //#region src/breadcrumb.tsx
80
- function te({ className: t, ...r }) {
81
- return /* @__PURE__ */ e("nav", {
80
+ function p({ as: t, className: r, ...i }) {
81
+ return /* @__PURE__ */ e(t ?? "nav", {
82
82
  "aria-label": "breadcrumb",
83
- className: n("sheerly-breadcrumb", t),
84
- ...r
83
+ className: n("sheerly-breadcrumb", r),
84
+ ...i
85
85
  });
86
86
  }
87
- function ne({ className: t, ...r }) {
88
- return /* @__PURE__ */ e("ol", {
89
- className: n("sheerly-breadcrumb-list", t),
90
- ...r
87
+ function m({ as: t, className: r, ...i }) {
88
+ return /* @__PURE__ */ e(t ?? "ol", {
89
+ className: n("sheerly-breadcrumb-list", r),
90
+ ...i
91
91
  });
92
92
  }
93
- function p({ className: t, ...r }) {
94
- return /* @__PURE__ */ e("li", {
95
- className: n("sheerly-breadcrumb-item", t),
96
- ...r
93
+ function h({ as: t, className: r, ...i }) {
94
+ return /* @__PURE__ */ e(t ?? "li", {
95
+ className: n("sheerly-breadcrumb-item", r),
96
+ ...i
97
97
  });
98
98
  }
99
- function m({ className: t, ...r }) {
100
- return /* @__PURE__ */ e("a", {
101
- className: n("sheerly-breadcrumb-link", t),
102
- ...r
99
+ function g({ as: t, className: r, ...i }) {
100
+ return /* @__PURE__ */ e(t ?? "a", {
101
+ className: n("sheerly-breadcrumb-link", r),
102
+ ...i
103
103
  });
104
104
  }
105
- function h({ as: t, className: r, ...i }) {
105
+ function _({ as: t, className: r, ...i }) {
106
106
  return /* @__PURE__ */ e(t ?? "span", {
107
107
  role: "link",
108
108
  "aria-disabled": "true",
@@ -111,28 +111,26 @@ function h({ as: t, className: r, ...i }) {
111
111
  ...i
112
112
  });
113
113
  }
114
- function g({ className: t, children: r, ...i }) {
115
- return /* @__PURE__ */ e("li", {
114
+ function v({ as: t, className: r, ...i }) {
115
+ return /* @__PURE__ */ e(t ?? "li", {
116
116
  role: "presentation",
117
117
  "aria-hidden": "true",
118
- className: n("sheerly-breadcrumb-separator", t),
119
- ...i,
120
- children: r
118
+ className: n("sheerly-breadcrumb-separator", r),
119
+ ...i
121
120
  });
122
121
  }
123
- function _({ as: t, className: r, children: i, ...a }) {
122
+ function y({ as: t, className: r, ...i }) {
124
123
  return /* @__PURE__ */ e(t ?? "span", {
125
124
  role: "presentation",
126
125
  "aria-hidden": "true",
127
126
  "aria-label": "More",
128
127
  className: n("sheerly-breadcrumb-ellipsis", r),
129
- ...a,
130
- children: i
128
+ ...i
131
129
  });
132
130
  }
133
131
  //#endregion
134
132
  //#region src/button.tsx
135
- function v({ as: t, className: r, ...i }) {
133
+ function b({ as: t, className: r, ...i }) {
136
134
  return /* @__PURE__ */ e(t ?? "button", {
137
135
  className: n("sheerly-button", r),
138
136
  ...i
@@ -140,43 +138,43 @@ function v({ as: t, className: r, ...i }) {
140
138
  }
141
139
  //#endregion
142
140
  //#region src/card.tsx
143
- function y({ as: t, className: r, ...i }) {
141
+ function x({ as: t, className: r, ...i }) {
144
142
  return /* @__PURE__ */ e(t ?? "div", {
145
143
  className: n("sheerly-card", r),
146
144
  ...i
147
145
  });
148
146
  }
149
- function b({ as: t, className: r, ...i }) {
147
+ function S({ as: t, className: r, ...i }) {
150
148
  return /* @__PURE__ */ e(t ?? "div", {
151
149
  className: n("sheerly-card-header", r),
152
150
  ...i
153
151
  });
154
152
  }
155
- function x({ as: t, className: r, ...i }) {
153
+ function C({ as: t, className: r, ...i }) {
156
154
  return /* @__PURE__ */ e(t ?? "h3", {
157
155
  className: n("sheerly-card-title", r),
158
156
  ...i
159
157
  });
160
158
  }
161
- function S({ as: t, className: r, ...i }) {
159
+ function w({ as: t, className: r, ...i }) {
162
160
  return /* @__PURE__ */ e(t ?? "p", {
163
161
  className: n("sheerly-card-description", r),
164
162
  ...i
165
163
  });
166
164
  }
167
- function C({ as: t, className: r, ...i }) {
165
+ function T({ as: t, className: r, ...i }) {
168
166
  return /* @__PURE__ */ e(t ?? "div", {
169
167
  className: n("sheerly-card-action", r),
170
168
  ...i
171
169
  });
172
170
  }
173
- function w({ as: t, className: r, ...i }) {
171
+ function E({ as: t, className: r, ...i }) {
174
172
  return /* @__PURE__ */ e(t ?? "div", {
175
173
  className: n("sheerly-card-content", r),
176
174
  ...i
177
175
  });
178
176
  }
179
- function T({ as: t, className: r, ...i }) {
177
+ function D({ as: t, className: r, ...i }) {
180
178
  return /* @__PURE__ */ e(t ?? "div", {
181
179
  className: n("sheerly-card-footer", r),
182
180
  ...i
@@ -184,13 +182,13 @@ function T({ as: t, className: r, ...i }) {
184
182
  }
185
183
  //#endregion
186
184
  //#region src/carousel.tsx
187
- function E({ as: t, className: r, ...i }) {
185
+ function O({ as: t, className: r, ...i }) {
188
186
  return /* @__PURE__ */ e(t ?? "div", {
189
187
  className: n("sheerly-carousel", r),
190
188
  ...i
191
189
  });
192
190
  }
193
- function D({ as: t, className: r, ...i }) {
191
+ function k({ as: t, className: r, ...i }) {
194
192
  return /* @__PURE__ */ e(t ?? "div", {
195
193
  className: n("sheerly-carousel-item", r),
196
194
  ...i
@@ -198,7 +196,7 @@ function D({ as: t, className: r, ...i }) {
198
196
  }
199
197
  //#endregion
200
198
  //#region src/checkbox.tsx
201
- function O({ className: t, ...r }) {
199
+ function A({ className: t, ...r }) {
202
200
  return /* @__PURE__ */ e("input", {
203
201
  type: "checkbox",
204
202
  className: n("sheerly-checkbox", t),
@@ -207,43 +205,43 @@ function O({ className: t, ...r }) {
207
205
  }
208
206
  //#endregion
209
207
  //#region src/dialog.tsx
210
- function k({ className: t, ...r }) {
208
+ function j({ className: t, ...r }) {
211
209
  return /* @__PURE__ */ e("dialog", {
212
210
  className: n("sheerly-dialog", t),
213
211
  ...r
214
212
  });
215
213
  }
216
- function A({ as: t, className: r, ...i }) {
214
+ function M({ as: t, className: r, ...i }) {
217
215
  return /* @__PURE__ */ e(t ?? "div", {
218
216
  className: n("sheerly-dialog-header", r),
219
217
  ...i
220
218
  });
221
219
  }
222
- function j({ as: t, className: r, ...i }) {
220
+ function N({ as: t, className: r, ...i }) {
223
221
  return /* @__PURE__ */ e(t ?? "h3", {
224
222
  className: n("sheerly-dialog-title", r),
225
223
  ...i
226
224
  });
227
225
  }
228
- function M({ as: t, className: r, ...i }) {
226
+ function P({ as: t, className: r, ...i }) {
229
227
  return /* @__PURE__ */ e(t ?? "p", {
230
228
  className: n("sheerly-dialog-description", r),
231
229
  ...i
232
230
  });
233
231
  }
234
- function N({ as: t, className: r, ...i }) {
232
+ function F({ as: t, className: r, ...i }) {
235
233
  return /* @__PURE__ */ e(t ?? "div", {
236
234
  className: n("sheerly-dialog-body", r),
237
235
  ...i
238
236
  });
239
237
  }
240
- function P({ as: t, className: r, ...i }) {
238
+ function I({ as: t, className: r, ...i }) {
241
239
  return /* @__PURE__ */ e(t ?? "div", {
242
240
  className: n("sheerly-dialog-footer", r),
243
241
  ...i
244
242
  });
245
243
  }
246
- function F({ className: t, type: r = "button", ...i }) {
244
+ function L({ className: t, type: r = "button", ...i }) {
247
245
  return /* @__PURE__ */ e("button", {
248
246
  type: r,
249
247
  className: n("sheerly-dialog-close", t),
@@ -252,70 +250,70 @@ function F({ className: t, type: r = "button", ...i }) {
252
250
  }
253
251
  //#endregion
254
252
  //#region src/dropdown-menu.tsx
255
- function I({ as: t, className: r, ...i }) {
253
+ function R({ as: t, className: r, ...i }) {
256
254
  return /* @__PURE__ */ e(t ?? "span", {
257
255
  className: n("sheerly-dropdown-menu", r),
258
256
  ...i
259
257
  });
260
258
  }
261
- function L({ as: t, className: r, ...i }) {
259
+ function z({ as: t, className: r, ...i }) {
262
260
  return /* @__PURE__ */ e(t ?? "div", {
263
261
  className: n("sheerly-dropdown-menu-content", r),
264
262
  ...i
265
263
  });
266
264
  }
267
- function R({ as: t, className: r, ...i }) {
265
+ function B({ as: t, className: r, ...i }) {
268
266
  return /* @__PURE__ */ e(t ?? "div", {
269
267
  className: n("sheerly-dropdown-menu-group", r),
270
268
  ...i
271
269
  });
272
270
  }
273
- function z({ as: t, className: r, ...i }) {
271
+ function V({ as: t, className: r, ...i }) {
274
272
  return /* @__PURE__ */ e(t ?? "div", {
275
273
  className: n("sheerly-dropdown-menu-label", r),
276
274
  ...i
277
275
  });
278
276
  }
279
- function B({ className: t, type: r = "button", ...i }) {
277
+ function H({ className: t, type: r = "button", ...i }) {
280
278
  return /* @__PURE__ */ e("button", {
281
279
  type: r,
282
280
  className: n("sheerly-dropdown-menu-item", t),
283
281
  ...i
284
282
  });
285
283
  }
286
- function V({ className: t, ...r }) {
287
- return /* @__PURE__ */ e("a", {
288
- className: n("sheerly-dropdown-menu-item", t),
289
- ...r
284
+ function U({ as: t, className: r, ...i }) {
285
+ return /* @__PURE__ */ e(t ?? "a", {
286
+ className: n("sheerly-dropdown-menu-item", r),
287
+ ...i
290
288
  });
291
289
  }
292
- function H({ as: t, className: r, ...i }) {
290
+ function W({ as: t, className: r, ...i }) {
293
291
  return /* @__PURE__ */ e(t ?? "span", {
294
292
  className: n("sheerly-dropdown-menu-shortcut", r),
295
293
  ...i
296
294
  });
297
295
  }
298
- function U({ as: t, className: r, ...i }) {
296
+ function G({ as: t, className: r, ...i }) {
299
297
  return /* @__PURE__ */ e(t ?? "div", {
300
298
  role: "separator",
301
299
  className: n("sheerly-dropdown-menu-separator", r),
302
300
  ...i
303
301
  });
304
302
  }
305
- function W({ as: t, className: r, ...i }) {
303
+ function K({ as: t, className: r, ...i }) {
306
304
  return /* @__PURE__ */ e(t ?? "div", {
307
305
  className: n("sheerly-dropdown-menu-sub", r),
308
306
  ...i
309
307
  });
310
308
  }
311
- function G({ className: t, type: r = "button", ...i }) {
309
+ function q({ className: t, type: r = "button", ...i }) {
312
310
  return /* @__PURE__ */ e("button", {
313
311
  type: r,
314
312
  className: n("sheerly-dropdown-menu-sub-trigger", t),
315
313
  ...i
316
314
  });
317
315
  }
318
- function K({ as: t, className: r, ...i }) {
316
+ function J({ as: t, className: r, ...i }) {
319
317
  return /* @__PURE__ */ e(t ?? "div", {
320
318
  className: n("sheerly-dropdown-menu-content", r),
321
319
  ...i
@@ -323,13 +321,13 @@ function K({ as: t, className: r, ...i }) {
323
321
  }
324
322
  //#endregion
325
323
  //#region src/hover-card.tsx
326
- function q({ as: t, className: r, ...i }) {
324
+ function Y({ as: t, className: r, ...i }) {
327
325
  return /* @__PURE__ */ e(t ?? "span", {
328
326
  className: n("sheerly-hover-card", r),
329
327
  ...i
330
328
  });
331
329
  }
332
- function J({ as: t, className: r, ...i }) {
330
+ function X({ as: t, className: r, ...i }) {
333
331
  return /* @__PURE__ */ e(t ?? "div", {
334
332
  className: n("sheerly-hover-card-content", r),
335
333
  ...i
@@ -337,7 +335,7 @@ function J({ as: t, className: r, ...i }) {
337
335
  }
338
336
  //#endregion
339
337
  //#region src/input.tsx
340
- function Y({ className: t, ...r }) {
338
+ function Z({ className: t, ...r }) {
341
339
  return /* @__PURE__ */ e("input", {
342
340
  className: n("sheerly-input", t),
343
341
  ...r
@@ -345,13 +343,13 @@ function Y({ className: t, ...r }) {
345
343
  }
346
344
  //#endregion
347
345
  //#region src/kbd.tsx
348
- function X({ className: t, ...r }) {
346
+ function Q({ className: t, ...r }) {
349
347
  return /* @__PURE__ */ e("kbd", {
350
348
  className: n("sheerly-kbd", t),
351
349
  ...r
352
350
  });
353
351
  }
354
- function Z({ as: t, className: r, ...i }) {
352
+ function te({ as: t, className: r, ...i }) {
355
353
  return /* @__PURE__ */ e(t ?? "span", {
356
354
  className: n("sheerly-kbd-group", r),
357
355
  ...i
@@ -359,7 +357,7 @@ function Z({ as: t, className: r, ...i }) {
359
357
  }
360
358
  //#endregion
361
359
  //#region src/label.tsx
362
- function re({ className: t, ...r }) {
360
+ function ne({ className: t, ...r }) {
363
361
  return /* @__PURE__ */ e("label", {
364
362
  className: n("sheerly-label", t),
365
363
  ...r
@@ -367,49 +365,51 @@ function re({ className: t, ...r }) {
367
365
  }
368
366
  //#endregion
369
367
  //#region src/pagination.tsx
370
- function ie({ className: t, ...r }) {
371
- return /* @__PURE__ */ e("nav", {
368
+ function re({ as: t, className: r, ...i }) {
369
+ return /* @__PURE__ */ e(t ?? "nav", {
372
370
  role: "navigation",
373
371
  "aria-label": "pagination",
374
- className: n("sheerly-pagination", t),
375
- ...r
372
+ className: n("sheerly-pagination", r),
373
+ ...i
376
374
  });
377
375
  }
378
- function ae({ className: t, ...r }) {
379
- return /* @__PURE__ */ e("ul", {
380
- className: n("sheerly-pagination-content", t),
381
- ...r
376
+ function ie({ as: t, className: r, ...i }) {
377
+ return /* @__PURE__ */ e(t ?? "ul", {
378
+ className: n("sheerly-pagination-content", r),
379
+ ...i
382
380
  });
383
381
  }
384
- function oe({ className: t, ...r }) {
385
- return /* @__PURE__ */ e("li", {
386
- className: n("sheerly-pagination-item", t),
387
- ...r
382
+ function ae({ as: t, className: r, ...i }) {
383
+ return /* @__PURE__ */ e(t ?? "li", {
384
+ className: n("sheerly-pagination-item", r),
385
+ ...i
388
386
  });
389
387
  }
390
- function Q({ className: t, isActive: r, ...i }) {
391
- return /* @__PURE__ */ e("a", {
392
- "aria-current": r ? "page" : void 0,
393
- className: n("sheerly-pagination-link", t),
394
- ...i
388
+ function oe({ as: t, className: r, isActive: i, ...a }) {
389
+ return /* @__PURE__ */ e(t ?? "a", {
390
+ "aria-current": i ? "page" : void 0,
391
+ className: n("sheerly-pagination-link", r),
392
+ ...a
395
393
  });
396
394
  }
397
- function se({ className: t, text: n = "Previous", children: r, ...i }) {
398
- return /* @__PURE__ */ e(Q, {
395
+ function se({ as: t, className: r, isActive: i, text: a = "Previous", children: o, ...s }) {
396
+ return /* @__PURE__ */ e(t ?? "a", {
399
397
  "aria-label": "Go to previous page",
398
+ "aria-current": i ? "page" : void 0,
400
399
  "data-role": "previous",
401
- className: t,
402
- ...i,
403
- children: r ?? n
400
+ className: n("sheerly-pagination-link", r),
401
+ ...s,
402
+ children: o ?? a
404
403
  });
405
404
  }
406
- function ce({ className: t, text: n = "Next", children: r, ...i }) {
407
- return /* @__PURE__ */ e(Q, {
405
+ function ce({ as: t, className: r, isActive: i, text: a = "Next", children: o, ...s }) {
406
+ return /* @__PURE__ */ e(t ?? "a", {
408
407
  "aria-label": "Go to next page",
408
+ "aria-current": i ? "page" : void 0,
409
409
  "data-role": "next",
410
- className: t,
411
- ...i,
412
- children: r ?? n
410
+ className: n("sheerly-pagination-link", r),
411
+ ...s,
412
+ children: o ?? a
413
413
  });
414
414
  }
415
415
  function le({ as: t, className: r, ...i }) {
@@ -594,10 +594,10 @@ function je({ as: t, className: r, ...i }) {
594
594
  ...i
595
595
  });
596
596
  }
597
- function Me({ className: t, role: r = "tab", ...i }) {
598
- return /* @__PURE__ */ e("button", {
599
- role: r,
600
- className: n("sheerly-tabs-trigger", t),
597
+ function Me({ as: t, className: r, ...i }) {
598
+ return /* @__PURE__ */ e(t ?? "button", {
599
+ role: "tab",
600
+ className: n("sheerly-tabs-trigger", r),
601
601
  ...i
602
602
  });
603
603
  }
@@ -657,4 +657,4 @@ function Re({ as: t, className: r, ...i }) {
657
657
  });
658
658
  }
659
659
  //#endregion
660
- export { r as Accordion, i as AccordionContent, a as Alert, c as AlertAction, s as AlertDescription, o as AlertTitle, l as Avatar, d as AvatarFallback, f as AvatarGroup, u as AvatarImage, ee as Badge, te as Breadcrumb, _ as BreadcrumbEllipsis, p as BreadcrumbItem, m as BreadcrumbLink, ne as BreadcrumbList, h as BreadcrumbPage, g as BreadcrumbSeparator, v as Button, y as Card, C as CardAction, w as CardContent, S as CardDescription, T as CardFooter, b as CardHeader, x as CardTitle, E as Carousel, D as CarouselItem, O as Checkbox, k as Dialog, N as DialogBody, F as DialogClose, M as DialogDescription, P as DialogFooter, A as DialogHeader, j as DialogTitle, I as DropdownMenu, L as DropdownMenuContent, R as DropdownMenuGroup, B as DropdownMenuItem, z as DropdownMenuLabel, V as DropdownMenuLinkItem, U as DropdownMenuSeparator, H as DropdownMenuShortcut, W as DropdownMenuSub, K as DropdownMenuSubContent, G as DropdownMenuSubTrigger, q as HoverCard, J as HoverCardContent, Y as Input, X as Kbd, Z as KbdGroup, re as Label, ie as Pagination, ae as PaginationContent, le as PaginationEllipsis, oe as PaginationItem, Q as PaginationLink, ce as PaginationNext, se as PaginationPrevious, ue as Popover, de as PopoverContent, fe as Progress, me as Radio, pe as RadioGroup, he as Scrollbar, ge as Select, _e as Separator, ve as Sheet, Se as SheetBody, we as SheetClose, xe as SheetDescription, Ce as SheetFooter, ye as SheetHeader, be as SheetTitle, Te as Skeleton, Ee as Slider, De as Spinner, $ as Switch, ke as Table, Oe as TableContainer, Ae as Tabs, Ne as TabsContent, je as TabsList, Me as TabsTrigger, Pe as Textarea, Fe as Toggle, Ie as Tooltip, Le as TooltipContent, Re as Typography };
660
+ export { r as Accordion, i as AccordionContent, a as Alert, c as AlertAction, s as AlertDescription, o as AlertTitle, l as Avatar, d as AvatarFallback, f as AvatarGroup, u as AvatarImage, ee as Badge, p as Breadcrumb, y as BreadcrumbEllipsis, h as BreadcrumbItem, g as BreadcrumbLink, m as BreadcrumbList, _ as BreadcrumbPage, v as BreadcrumbSeparator, b as Button, x as Card, T as CardAction, E as CardContent, w as CardDescription, D as CardFooter, S as CardHeader, C as CardTitle, O as Carousel, k as CarouselItem, A as Checkbox, j as Dialog, F as DialogBody, L as DialogClose, P as DialogDescription, I as DialogFooter, M as DialogHeader, N as DialogTitle, R as DropdownMenu, z as DropdownMenuContent, B as DropdownMenuGroup, H as DropdownMenuItem, V as DropdownMenuLabel, U as DropdownMenuLinkItem, G as DropdownMenuSeparator, W as DropdownMenuShortcut, K as DropdownMenuSub, J as DropdownMenuSubContent, q as DropdownMenuSubTrigger, Y as HoverCard, X as HoverCardContent, Z as Input, Q as Kbd, te as KbdGroup, ne as Label, re as Pagination, ie as PaginationContent, le as PaginationEllipsis, ae as PaginationItem, oe as PaginationLink, ce as PaginationNext, se as PaginationPrevious, ue as Popover, de as PopoverContent, fe as Progress, me as Radio, pe as RadioGroup, he as Scrollbar, ge as Select, _e as Separator, ve as Sheet, Se as SheetBody, we as SheetClose, xe as SheetDescription, Ce as SheetFooter, ye as SheetHeader, be as SheetTitle, Te as Skeleton, Ee as Slider, De as Spinner, $ as Switch, ke as Table, Oe as TableContainer, Ae as Tabs, Ne as TabsContent, je as TabsList, Me as TabsTrigger, Pe as Textarea, Fe as Toggle, Ie as Tooltip, Le as TooltipContent, Re as Typography };
@@ -1,8 +1,11 @@
1
- import { AnchorHTMLAttributes, ElementType, HTMLAttributes } from 'react';
1
+ import { ElementType } from 'react';
2
2
  import { PolymorphicProps } from './utils/polymorphic';
3
+ export type PaginationProps<T extends ElementType = 'nav'> = PolymorphicProps<T>;
3
4
  /**
4
5
  * Page navigation. Mark the current page's link with `isActive`.
5
6
  *
7
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `nav`).
8
+ *
6
9
  * @example
7
10
  * <Pagination>
8
11
  * <PaginationContent>
@@ -12,20 +15,42 @@ import { PolymorphicProps } from './utils/polymorphic';
12
15
  * </PaginationContent>
13
16
  * </Pagination>
14
17
  */
15
- export declare function Pagination({ className, ...props }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
16
- export declare function PaginationContent({ className, ...props }: HTMLAttributes<HTMLUListElement>): import("react").JSX.Element;
17
- export declare function PaginationItem({ className, ...props }: HTMLAttributes<HTMLLIElement>): import("react").JSX.Element;
18
- export interface PaginationLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
18
+ export declare function Pagination<T extends ElementType = 'nav'>({ as, className, ...props }: PaginationProps<T>): import("react").JSX.Element;
19
+ export type PaginationContentProps<T extends ElementType = 'ul'> = PolymorphicProps<T>;
20
+ /**
21
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `ul`).
22
+ */
23
+ export declare function PaginationContent<T extends ElementType = 'ul'>({ as, className, ...props }: PaginationContentProps<T>): import("react").JSX.Element;
24
+ export type PaginationItemProps<T extends ElementType = 'li'> = PolymorphicProps<T>;
25
+ /**
26
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `li`).
27
+ */
28
+ export declare function PaginationItem<T extends ElementType = 'li'>({ as, className, ...props }: PaginationItemProps<T>): import("react").JSX.Element;
29
+ export type PaginationLinkProps<T extends ElementType = 'a'> = PolymorphicProps<T, {
19
30
  /** Marks the current page (renders like the outline button). */
20
31
  isActive?: boolean;
21
32
  'data-role'?: 'previous' | 'next';
22
- }
23
- export declare function PaginationLink({ className, isActive, ...props }: PaginationLinkProps): import("react").JSX.Element;
24
- export declare function PaginationPrevious({ className, text, children, ...props }: PaginationLinkProps & {
25
- text?: string;
26
- }): import("react").JSX.Element;
27
- export declare function PaginationNext({ className, text, children, ...props }: PaginationLinkProps & {
33
+ }>;
34
+ /**
35
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `a`, e.g.
36
+ * `as={Link}` for a router link).
37
+ */
38
+ export declare function PaginationLink<T extends ElementType = 'a'>({ as, className, isActive, ...props }: PaginationLinkProps<T>): import("react").JSX.Element;
39
+ export type PaginationPreviousProps<T extends ElementType = 'a'> = PaginationLinkProps<T> & {
40
+ /** Visible label. Children override it. */
28
41
  text?: string;
29
- }): import("react").JSX.Element;
42
+ };
43
+ /**
44
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `a`).
45
+ */
46
+ export declare function PaginationPrevious<T extends ElementType = 'a'>({ as, className, isActive, text, children, ...props }: PaginationPreviousProps<T>): import("react").JSX.Element;
47
+ export type PaginationNextProps<T extends ElementType = 'a'> = PaginationPreviousProps<T>;
48
+ /**
49
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `a`).
50
+ */
51
+ export declare function PaginationNext<T extends ElementType = 'a'>({ as, className, isActive, text, children, ...props }: PaginationNextProps<T>): import("react").JSX.Element;
30
52
  export type PaginationEllipsisProps<T extends ElementType = 'span'> = PolymorphicProps<T>;
53
+ /**
54
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `span`).
55
+ */
31
56
  export declare function PaginationEllipsis<T extends ElementType = 'span'>({ as, className, ...props }: PaginationEllipsisProps<T>): import("react").JSX.Element;
package/lib/tabs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ButtonHTMLAttributes, ElementType } from 'react';
1
+ import { ElementType } from 'react';
2
2
  import { PolymorphicProps } from './utils/polymorphic';
3
3
  export type TabsProps<T extends ElementType = 'div'> = PolymorphicProps<T>;
4
4
  /**
@@ -25,10 +25,13 @@ export type TabsListProps<T extends ElementType = 'div'> = PolymorphicProps<T, {
25
25
  * Polymorphic: pass `as` to change the rendered tag (defaults to `div`).
26
26
  */
27
27
  export declare function TabsList<T extends ElementType = 'div'>({ as, className, ...props }: TabsListProps<T>): import("react").JSX.Element;
28
- export interface TabsTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
28
+ export type TabsTriggerProps<T extends ElementType = 'button'> = PolymorphicProps<T, {
29
29
  'data-state'?: 'active';
30
- }
31
- export declare function TabsTrigger({ className, role, ...props }: TabsTriggerProps): import("react").JSX.Element;
30
+ }>;
31
+ /**
32
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `button`).
33
+ */
34
+ export declare function TabsTrigger<T extends ElementType = 'button'>({ as, className, ...props }: TabsTriggerProps<T>): import("react").JSX.Element;
32
35
  export type TabsContentProps<T extends ElementType = 'div'> = PolymorphicProps<T>;
33
36
  /**
34
37
  * Polymorphic: pass `as` to change the rendered tag (defaults to `div`).
package/package.json CHANGED
@@ -1,33 +1,34 @@
1
- {
2
- "name": "sheerly",
3
- "version": "0.0.2",
4
- "type": "module",
5
- "scripts": {
6
- "dev": "vite",
7
- "build": "tsc -b && vite build",
8
- "build:lib": "tsc -b && vite build --config vite.lib.config.ts",
9
- "lint": "oxlint",
10
- "preview": "vite preview"
11
- },
12
- "main": "lib/index.js",
13
- "types": "lib/index.d.ts",
14
- "files": [
15
- "src",
16
- "lib"
17
- ],
18
- "devDependencies": {
19
- "@tailwindcss/vite": "^4.3.3",
20
- "@types/node": "^26.2.0",
21
- "@types/react": "^19.2.18",
22
- "@types/react-dom": "^19.2.4",
23
- "@vitejs/plugin-react": "^6.0.5",
24
- "nuqs": "^2.9.5",
25
- "oxlint": "^1.78.0",
26
- "react": "^19.2.8",
27
- "react-dom": "^19.2.8",
28
- "tailwindcss": "^4.3.3",
29
- "typescript": "^6.0.3",
30
- "unplugin-dts": "^1.0.3",
31
- "vite": "^8.2.1"
32
- }
33
- }
1
+ {
2
+ "name": "sheerly",
3
+ "version": "0.0.3",
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "vite --config vite.config.doc.ts",
7
+ "build": "node --run build:lib && node --run build:doc",
8
+ "build:lib": "tsc -b && vite build --config vite.config.lib.ts",
9
+ "build:doc": "tsc -b && vite build --config vite.config.doc.ts",
10
+ "lint": "oxlint",
11
+ "preview": "vite preview"
12
+ },
13
+ "main": "lib/index.js",
14
+ "types": "lib/index.d.ts",
15
+ "files": [
16
+ "src",
17
+ "lib"
18
+ ],
19
+ "devDependencies": {
20
+ "@tailwindcss/vite": "^4.3.3",
21
+ "@types/node": "^26.2.0",
22
+ "@types/react": "^19.2.18",
23
+ "@types/react-dom": "^19.2.4",
24
+ "@vitejs/plugin-react": "^6.0.5",
25
+ "nuqs": "^2.9.6",
26
+ "oxlint": "^1.78.0",
27
+ "react": "^19.2.8",
28
+ "react-dom": "^19.2.8",
29
+ "tailwindcss": "^4.3.3",
30
+ "typescript": "^6.0.3",
31
+ "unplugin-dts": "^1.0.3",
32
+ "vite": "^8.2.1"
33
+ }
34
+ }
@@ -1,10 +1,14 @@
1
- import type { AnchorHTMLAttributes, ElementType, HTMLAttributes, OlHTMLAttributes } from 'react'
1
+ import type { ElementType } from 'react'
2
2
  import { cn } from './utils/cn'
3
3
  import type { PolymorphicProps } from './utils/polymorphic'
4
4
 
5
+ export type BreadcrumbProps<T extends ElementType = 'nav'> = PolymorphicProps<T>
6
+
5
7
  /**
6
8
  * A path hierarchy of links.
7
9
  *
10
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `nav`).
11
+ *
8
12
  * @example
9
13
  * <Breadcrumb>
10
14
  * <BreadcrumbList>
@@ -14,9 +18,14 @@ import type { PolymorphicProps } from './utils/polymorphic'
14
18
  * </BreadcrumbList>
15
19
  * </Breadcrumb>
16
20
  */
17
- export function Breadcrumb({ className, ...props }: HTMLAttributes<HTMLElement>) {
21
+ export function Breadcrumb<T extends ElementType = 'nav'>({
22
+ as,
23
+ className,
24
+ ...props
25
+ }: BreadcrumbProps<T>) {
26
+ const Tag = as ?? 'nav'
18
27
  return (
19
- <nav
28
+ <Tag
20
29
  aria-label="breadcrumb"
21
30
  className={cn('sheerly-breadcrumb', className)}
22
31
  {...props}
@@ -24,20 +33,54 @@ export function Breadcrumb({ className, ...props }: HTMLAttributes<HTMLElement>)
24
33
  )
25
34
  }
26
35
 
27
- export function BreadcrumbList({ className, ...props }: OlHTMLAttributes<HTMLOListElement>) {
28
- return <ol className={cn('sheerly-breadcrumb-list', className)} {...props} />
36
+ export type BreadcrumbListProps<T extends ElementType = 'ol'> = PolymorphicProps<T>
37
+
38
+ /**
39
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `ol`).
40
+ */
41
+ export function BreadcrumbList<T extends ElementType = 'ol'>({
42
+ as,
43
+ className,
44
+ ...props
45
+ }: BreadcrumbListProps<T>) {
46
+ const Tag = as ?? 'ol'
47
+ return <Tag className={cn('sheerly-breadcrumb-list', className)} {...props} />
29
48
  }
30
49
 
31
- export function BreadcrumbItem({ className, ...props }: HTMLAttributes<HTMLLIElement>) {
32
- return <li className={cn('sheerly-breadcrumb-item', className)} {...props} />
50
+ export type BreadcrumbItemProps<T extends ElementType = 'li'> = PolymorphicProps<T>
51
+
52
+ /**
53
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `li`).
54
+ */
55
+ export function BreadcrumbItem<T extends ElementType = 'li'>({
56
+ as,
57
+ className,
58
+ ...props
59
+ }: BreadcrumbItemProps<T>) {
60
+ const Tag = as ?? 'li'
61
+ return <Tag className={cn('sheerly-breadcrumb-item', className)} {...props} />
33
62
  }
34
63
 
35
- export function BreadcrumbLink({ className, ...props }: AnchorHTMLAttributes<HTMLAnchorElement>) {
36
- return <a className={cn('sheerly-breadcrumb-link', className)} {...props} />
64
+ export type BreadcrumbLinkProps<T extends ElementType = 'a'> = PolymorphicProps<T>
65
+
66
+ /**
67
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `a`, e.g.
68
+ * `as={Link}` for a router link).
69
+ */
70
+ export function BreadcrumbLink<T extends ElementType = 'a'>({
71
+ as,
72
+ className,
73
+ ...props
74
+ }: BreadcrumbLinkProps<T>) {
75
+ const Tag = as ?? 'a'
76
+ return <Tag className={cn('sheerly-breadcrumb-link', className)} {...props} />
37
77
  }
38
78
 
39
79
  export type BreadcrumbPageProps<T extends ElementType = 'span'> = PolymorphicProps<T>
40
80
 
81
+ /**
82
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `span`).
83
+ */
41
84
  export function BreadcrumbPage<T extends ElementType = 'span'>({
42
85
  as,
43
86
  className,
@@ -55,29 +98,35 @@ export function BreadcrumbPage<T extends ElementType = 'span'>({
55
98
  )
56
99
  }
57
100
 
58
- export function BreadcrumbSeparator({
101
+ export type BreadcrumbSeparatorProps<T extends ElementType = 'li'> = PolymorphicProps<T>
102
+
103
+ /**
104
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `li`).
105
+ */
106
+ export function BreadcrumbSeparator<T extends ElementType = 'li'>({
107
+ as,
59
108
  className,
60
- children,
61
109
  ...props
62
- }: HTMLAttributes<HTMLLIElement>) {
110
+ }: BreadcrumbSeparatorProps<T>) {
111
+ const Tag = as ?? 'li'
63
112
  return (
64
- <li
113
+ <Tag
65
114
  role="presentation"
66
115
  aria-hidden="true"
67
116
  className={cn('sheerly-breadcrumb-separator', className)}
68
117
  {...props}
69
- >
70
- {children}
71
- </li>
118
+ />
72
119
  )
73
120
  }
74
121
 
75
122
  export type BreadcrumbEllipsisProps<T extends ElementType = 'span'> = PolymorphicProps<T>
76
123
 
124
+ /**
125
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `span`).
126
+ */
77
127
  export function BreadcrumbEllipsis<T extends ElementType = 'span'>({
78
128
  as,
79
129
  className,
80
- children,
81
130
  ...props
82
131
  }: BreadcrumbEllipsisProps<T>) {
83
132
  const Tag = as ?? 'span'
@@ -88,8 +137,6 @@ export function BreadcrumbEllipsis<T extends ElementType = 'span'>({
88
137
  aria-label="More"
89
138
  className={cn('sheerly-breadcrumb-ellipsis', className)}
90
139
  {...props}
91
- >
92
- {children}
93
- </Tag>
140
+ />
94
141
  )
95
142
  }
@@ -1,4 +1,4 @@
1
- import type { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType } from 'react'
1
+ import type { ButtonHTMLAttributes, ElementType } from 'react'
2
2
  import { cn } from './utils/cn'
3
3
  import type { PolymorphicProps } from './utils/polymorphic'
4
4
 
@@ -78,14 +78,27 @@ export function DropdownMenuItem({ className, type = 'button', ...props }: Dropd
78
78
  return <button type={type} className={cn('sheerly-dropdown-menu-item', className)} {...props} />
79
79
  }
80
80
 
81
- /** An interactive menu row rendered as a link (<a>). */
82
- export interface DropdownMenuLinkItemProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
83
- 'data-variant'?: 'destructive'
84
- 'data-inset'?: boolean
85
- }
81
+ /**
82
+ * An interactive menu row rendered as a link.
83
+ *
84
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `a`, e.g.
85
+ * `as={Link}` for a router link).
86
+ */
87
+ export type DropdownMenuLinkItemProps<T extends ElementType = 'a'> = PolymorphicProps<
88
+ T,
89
+ {
90
+ 'data-variant'?: 'destructive'
91
+ 'data-inset'?: boolean
92
+ }
93
+ >
86
94
 
87
- export function DropdownMenuLinkItem({ className, ...props }: DropdownMenuLinkItemProps) {
88
- return <a className={cn('sheerly-dropdown-menu-item', className)} {...props} />
95
+ export function DropdownMenuLinkItem<T extends ElementType = 'a'>({
96
+ as,
97
+ className,
98
+ ...props
99
+ }: DropdownMenuLinkItemProps<T>) {
100
+ const Tag = as ?? 'a'
101
+ return <Tag className={cn('sheerly-dropdown-menu-item', className)} {...props} />
89
102
  }
90
103
 
91
104
  /** A trailing keyboard-shortcut hint inside an item. */
@@ -1,10 +1,14 @@
1
- import type { AnchorHTMLAttributes, ElementType, HTMLAttributes } from 'react'
1
+ import type { ElementType } from 'react'
2
2
  import { cn } from './utils/cn'
3
3
  import type { PolymorphicProps } from './utils/polymorphic'
4
4
 
5
+ export type PaginationProps<T extends ElementType = 'nav'> = PolymorphicProps<T>
6
+
5
7
  /**
6
8
  * Page navigation. Mark the current page's link with `isActive`.
7
9
  *
10
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `nav`).
11
+ *
8
12
  * @example
9
13
  * <Pagination>
10
14
  * <PaginationContent>
@@ -14,9 +18,14 @@ import type { PolymorphicProps } from './utils/polymorphic'
14
18
  * </PaginationContent>
15
19
  * </Pagination>
16
20
  */
17
- export function Pagination({ className, ...props }: HTMLAttributes<HTMLElement>) {
21
+ export function Pagination<T extends ElementType = 'nav'>({
22
+ as,
23
+ className,
24
+ ...props
25
+ }: PaginationProps<T>) {
26
+ const Tag = as ?? 'nav'
18
27
  return (
19
- <nav
28
+ <Tag
20
29
  role="navigation"
21
30
  aria-label="pagination"
22
31
  className={cn('sheerly-pagination', className)}
@@ -25,30 +34,56 @@ export function Pagination({ className, ...props }: HTMLAttributes<HTMLElement>)
25
34
  )
26
35
  }
27
36
 
28
- export function PaginationContent({
37
+ export type PaginationContentProps<T extends ElementType = 'ul'> = PolymorphicProps<T>
38
+
39
+ /**
40
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `ul`).
41
+ */
42
+ export function PaginationContent<T extends ElementType = 'ul'>({
43
+ as,
29
44
  className,
30
45
  ...props
31
- }: HTMLAttributes<HTMLUListElement>) {
32
- return <ul className={cn('sheerly-pagination-content', className)} {...props} />
46
+ }: PaginationContentProps<T>) {
47
+ const Tag = as ?? 'ul'
48
+ return <Tag className={cn('sheerly-pagination-content', className)} {...props} />
33
49
  }
34
50
 
35
- export function PaginationItem({ className, ...props }: HTMLAttributes<HTMLLIElement>) {
36
- return <li className={cn('sheerly-pagination-item', className)} {...props} />
37
- }
51
+ export type PaginationItemProps<T extends ElementType = 'li'> = PolymorphicProps<T>
38
52
 
39
- export interface PaginationLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
40
- /** Marks the current page (renders like the outline button). */
41
- isActive?: boolean
42
- 'data-role'?: 'previous' | 'next'
53
+ /**
54
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `li`).
55
+ */
56
+ export function PaginationItem<T extends ElementType = 'li'>({
57
+ as,
58
+ className,
59
+ ...props
60
+ }: PaginationItemProps<T>) {
61
+ const Tag = as ?? 'li'
62
+ return <Tag className={cn('sheerly-pagination-item', className)} {...props} />
43
63
  }
44
64
 
45
- export function PaginationLink({
65
+ export type PaginationLinkProps<T extends ElementType = 'a'> = PolymorphicProps<
66
+ T,
67
+ {
68
+ /** Marks the current page (renders like the outline button). */
69
+ isActive?: boolean
70
+ 'data-role'?: 'previous' | 'next'
71
+ }
72
+ >
73
+
74
+ /**
75
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `a`, e.g.
76
+ * `as={Link}` for a router link).
77
+ */
78
+ export function PaginationLink<T extends ElementType = 'a'>({
79
+ as,
46
80
  className,
47
81
  isActive,
48
82
  ...props
49
- }: PaginationLinkProps) {
83
+ }: PaginationLinkProps<T>) {
84
+ const Tag = as ?? 'a'
50
85
  return (
51
- <a
86
+ <Tag
52
87
  aria-current={isActive ? 'page' : undefined}
53
88
  className={cn('sheerly-pagination-link', className)}
54
89
  {...props}
@@ -56,44 +91,68 @@ export function PaginationLink({
56
91
  )
57
92
  }
58
93
 
59
- export function PaginationPrevious({
94
+ export type PaginationPreviousProps<T extends ElementType = 'a'> = PaginationLinkProps<T> & {
95
+ /** Visible label. Children override it. */
96
+ text?: string
97
+ }
98
+
99
+ /**
100
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `a`).
101
+ */
102
+ export function PaginationPrevious<T extends ElementType = 'a'>({
103
+ as,
60
104
  className,
105
+ isActive,
61
106
  text = 'Previous',
62
107
  children,
63
108
  ...props
64
- }: PaginationLinkProps & { text?: string }) {
109
+ }: PaginationPreviousProps<T>) {
110
+ const Tag = as ?? 'a'
65
111
  return (
66
- <PaginationLink
112
+ <Tag
67
113
  aria-label="Go to previous page"
114
+ aria-current={isActive ? 'page' : undefined}
68
115
  data-role="previous"
69
- className={className}
116
+ className={cn('sheerly-pagination-link', className)}
70
117
  {...props}
71
118
  >
72
119
  {children ?? text}
73
- </PaginationLink>
120
+ </Tag>
74
121
  )
75
122
  }
76
123
 
77
- export function PaginationNext({
124
+ export type PaginationNextProps<T extends ElementType = 'a'> = PaginationPreviousProps<T>
125
+
126
+ /**
127
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `a`).
128
+ */
129
+ export function PaginationNext<T extends ElementType = 'a'>({
130
+ as,
78
131
  className,
132
+ isActive,
79
133
  text = 'Next',
80
134
  children,
81
135
  ...props
82
- }: PaginationLinkProps & { text?: string }) {
136
+ }: PaginationNextProps<T>) {
137
+ const Tag = as ?? 'a'
83
138
  return (
84
- <PaginationLink
139
+ <Tag
85
140
  aria-label="Go to next page"
141
+ aria-current={isActive ? 'page' : undefined}
86
142
  data-role="next"
87
- className={className}
143
+ className={cn('sheerly-pagination-link', className)}
88
144
  {...props}
89
145
  >
90
146
  {children ?? text}
91
- </PaginationLink>
147
+ </Tag>
92
148
  )
93
149
  }
94
150
 
95
151
  export type PaginationEllipsisProps<T extends ElementType = 'span'> = PolymorphicProps<T>
96
152
 
153
+ /**
154
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `span`).
155
+ */
97
156
  export function PaginationEllipsis<T extends ElementType = 'span'>({
98
157
  as,
99
158
  className,
package/src/tabs.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import type { ButtonHTMLAttributes, ElementType } from 'react'
1
+ import type { ElementType } from 'react'
2
2
  import { cn } from './utils/cn'
3
3
  import type { PolymorphicProps } from './utils/polymorphic'
4
4
 
@@ -46,14 +46,21 @@ export function TabsList<T extends ElementType = 'div'>({
46
46
  return <Tag role="tablist" className={cn('sheerly-tabs-list', className)} {...props} />
47
47
  }
48
48
 
49
- export interface TabsTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
50
- 'data-state'?: 'active'
51
- }
49
+ export type TabsTriggerProps<T extends ElementType = 'button'> = PolymorphicProps<
50
+ T,
51
+ { 'data-state'?: 'active' }
52
+ >
52
53
 
53
- export function TabsTrigger({ className, role = 'tab', ...props }: TabsTriggerProps) {
54
- return (
55
- <button role={role} className={cn('sheerly-tabs-trigger', className)} {...props} />
56
- )
54
+ /**
55
+ * Polymorphic: pass `as` to change the rendered tag (defaults to `button`).
56
+ */
57
+ export function TabsTrigger<T extends ElementType = 'button'>({
58
+ as,
59
+ className,
60
+ ...props
61
+ }: TabsTriggerProps<T>) {
62
+ const Tag = as ?? 'button'
63
+ return <Tag role="tab" className={cn('sheerly-tabs-trigger', className)} {...props} />
57
64
  }
58
65
 
59
66
  export type TabsContentProps<T extends ElementType = 'div'> = PolymorphicProps<T>
@@ -68,4 +75,4 @@ export function TabsContent<T extends ElementType = 'div'>({
68
75
  }: TabsContentProps<T>) {
69
76
  const Tag = as ?? 'div'
70
77
  return <Tag role="tabpanel" className={cn('sheerly-tabs-content', className)} {...props} />
71
- }
78
+ }