@craftzbay/ui 0.10.0 → 0.11.1
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/README.md +18 -12
- package/dist-lib/__tests__/helpers/color.d.ts +9 -0
- package/dist-lib/__tests__/helpers/theme.d.ts +18 -0
- package/dist-lib/components/ui/Accordion.js +18 -7
- package/dist-lib/components/ui/Accordion.js.map +1 -1
- package/dist-lib/components/ui/Alert.d.ts +16 -0
- package/dist-lib/components/ui/Alert.js +47 -34
- package/dist-lib/components/ui/Alert.js.map +1 -1
- package/dist-lib/components/ui/Avatar.d.ts +1 -1
- package/dist-lib/components/ui/Avatar.js +45 -47
- package/dist-lib/components/ui/Avatar.js.map +1 -1
- package/dist-lib/components/ui/Badge.d.ts +3 -1
- package/dist-lib/components/ui/Badge.js +24 -15
- package/dist-lib/components/ui/Badge.js.map +1 -1
- package/dist-lib/components/ui/Breadcrumbs.d.ts +2 -0
- package/dist-lib/components/ui/Breadcrumbs.js +46 -28
- package/dist-lib/components/ui/Breadcrumbs.js.map +1 -1
- package/dist-lib/components/ui/Button.d.ts +5 -3
- package/dist-lib/components/ui/Button.js +59 -45
- package/dist-lib/components/ui/Button.js.map +1 -1
- package/dist-lib/components/ui/Calendar.d.ts +1 -1
- package/dist-lib/components/ui/Calendar.js +87 -59
- package/dist-lib/components/ui/Calendar.js.map +1 -1
- package/dist-lib/components/ui/Card.d.ts +2 -0
- package/dist-lib/components/ui/Card.js +48 -67
- package/dist-lib/components/ui/Card.js.map +1 -1
- package/dist-lib/components/ui/Carousel.d.ts +6 -6
- package/dist-lib/components/ui/Carousel.js +133 -102
- package/dist-lib/components/ui/Carousel.js.map +1 -1
- package/dist-lib/components/ui/Chart.d.ts +49 -10
- package/dist-lib/components/ui/Chart.js +415 -181
- package/dist-lib/components/ui/Chart.js.map +1 -1
- package/dist-lib/components/ui/Checkbox.js +42 -28
- package/dist-lib/components/ui/Checkbox.js.map +1 -1
- package/dist-lib/components/ui/Combobox.d.ts +2 -0
- package/dist-lib/components/ui/Combobox.js +142 -111
- package/dist-lib/components/ui/Combobox.js.map +1 -1
- package/dist-lib/components/ui/CommandPalette.d.ts +6 -3
- package/dist-lib/components/ui/CommandPalette.js +92 -87
- package/dist-lib/components/ui/CommandPalette.js.map +1 -1
- package/dist-lib/components/ui/ContextMenu.d.ts +7 -2
- package/dist-lib/components/ui/ContextMenu.js +77 -62
- package/dist-lib/components/ui/ContextMenu.js.map +1 -1
- package/dist-lib/components/ui/DataGrid.d.ts +17 -4
- package/dist-lib/components/ui/DataGrid.js +65 -50
- package/dist-lib/components/ui/DataGrid.js.map +1 -1
- package/dist-lib/components/ui/DatePicker.js +118 -99
- package/dist-lib/components/ui/DatePicker.js.map +1 -1
- package/dist-lib/components/ui/DesignSystemProvider.d.ts +94 -40
- package/dist-lib/components/ui/DesignSystemProvider.js +111 -55
- package/dist-lib/components/ui/DesignSystemProvider.js.map +1 -1
- package/dist-lib/components/ui/Dialog.d.ts +18 -3
- package/dist-lib/components/ui/Dialog.js +105 -80
- package/dist-lib/components/ui/Dialog.js.map +1 -1
- package/dist-lib/components/ui/Drawer.d.ts +17 -2
- package/dist-lib/components/ui/Drawer.js +89 -55
- package/dist-lib/components/ui/Drawer.js.map +1 -1
- package/dist-lib/components/ui/DropdownMenu.js +14 -9
- package/dist-lib/components/ui/DropdownMenu.js.map +1 -1
- package/dist-lib/components/ui/EmptyState.d.ts +2 -0
- package/dist-lib/components/ui/EmptyState.js +30 -16
- package/dist-lib/components/ui/EmptyState.js.map +1 -1
- package/dist-lib/components/ui/ErrorState.d.ts +13 -2
- package/dist-lib/components/ui/ErrorState.js +44 -23
- package/dist-lib/components/ui/ErrorState.js.map +1 -1
- package/dist-lib/components/ui/FileUpload.js +59 -56
- package/dist-lib/components/ui/FileUpload.js.map +1 -1
- package/dist-lib/components/ui/Form.d.ts +15 -2
- package/dist-lib/components/ui/Form.js +97 -71
- package/dist-lib/components/ui/Form.js.map +1 -1
- package/dist-lib/components/ui/Icon.d.ts +1 -1
- package/dist-lib/components/ui/Icon.js +20 -14
- package/dist-lib/components/ui/Icon.js.map +1 -1
- package/dist-lib/components/ui/IconButton.d.ts +2 -2
- package/dist-lib/components/ui/IconButton.js +28 -20
- package/dist-lib/components/ui/IconButton.js.map +1 -1
- package/dist-lib/components/ui/Input.d.ts +3 -1
- package/dist-lib/components/ui/Input.js +102 -79
- package/dist-lib/components/ui/Input.js.map +1 -1
- package/dist-lib/components/ui/Kbd.js +1 -1
- package/dist-lib/components/ui/Kbd.js.map +1 -1
- package/dist-lib/components/ui/MultiSelect.js +121 -107
- package/dist-lib/components/ui/MultiSelect.js.map +1 -1
- package/dist-lib/components/ui/Pagination.js +67 -62
- package/dist-lib/components/ui/Pagination.js.map +1 -1
- package/dist-lib/components/ui/Popover.js +14 -14
- package/dist-lib/components/ui/Popover.js.map +1 -1
- package/dist-lib/components/ui/Progress.d.ts +3 -3
- package/dist-lib/components/ui/Progress.js +77 -72
- package/dist-lib/components/ui/Progress.js.map +1 -1
- package/dist-lib/components/ui/RadioGroup.d.ts +1 -1
- package/dist-lib/components/ui/RadioGroup.js +69 -52
- package/dist-lib/components/ui/RadioGroup.js.map +1 -1
- package/dist-lib/components/ui/RelativeTime.d.ts +19 -0
- package/dist-lib/components/ui/RelativeTime.js +31 -0
- package/dist-lib/components/ui/RelativeTime.js.map +1 -0
- package/dist-lib/components/ui/ScrollArea.d.ts +9 -1
- package/dist-lib/components/ui/ScrollArea.js +43 -27
- package/dist-lib/components/ui/ScrollArea.js.map +1 -1
- package/dist-lib/components/ui/Select.d.ts +6 -1
- package/dist-lib/components/ui/Select.js +79 -71
- package/dist-lib/components/ui/Select.js.map +1 -1
- package/dist-lib/components/ui/Separator.js +1 -1
- package/dist-lib/components/ui/Separator.js.map +1 -1
- package/dist-lib/components/ui/Sheet.d.ts +9 -0
- package/dist-lib/components/ui/Sheet.js +69 -46
- package/dist-lib/components/ui/Sheet.js.map +1 -1
- package/dist-lib/components/ui/Sidebar.d.ts +12 -9
- package/dist-lib/components/ui/Sidebar.js +152 -109
- package/dist-lib/components/ui/Sidebar.js.map +1 -1
- package/dist-lib/components/ui/Skeleton.d.ts +13 -2
- package/dist-lib/components/ui/Skeleton.js +15 -14
- package/dist-lib/components/ui/Skeleton.js.map +1 -1
- package/dist-lib/components/ui/Slider.js +41 -29
- package/dist-lib/components/ui/Slider.js.map +1 -1
- package/dist-lib/components/ui/Snackbar.js +23 -22
- package/dist-lib/components/ui/Snackbar.js.map +1 -1
- package/dist-lib/components/ui/Spinner.js +18 -6
- package/dist-lib/components/ui/Spinner.js.map +1 -1
- package/dist-lib/components/ui/Stepper.d.ts +6 -0
- package/dist-lib/components/ui/Stepper.js +71 -48
- package/dist-lib/components/ui/Stepper.js.map +1 -1
- package/dist-lib/components/ui/Switch.js +46 -43
- package/dist-lib/components/ui/Switch.js.map +1 -1
- package/dist-lib/components/ui/Table.d.ts +33 -5
- package/dist-lib/components/ui/Table.js +141 -119
- package/dist-lib/components/ui/Table.js.map +1 -1
- package/dist-lib/components/ui/Tabs.js +50 -48
- package/dist-lib/components/ui/Tabs.js.map +1 -1
- package/dist-lib/components/ui/TagInput.js +45 -45
- package/dist-lib/components/ui/TagInput.js.map +1 -1
- package/dist-lib/components/ui/Textarea.js +65 -54
- package/dist-lib/components/ui/Textarea.js.map +1 -1
- package/dist-lib/components/ui/Timeline.js +39 -35
- package/dist-lib/components/ui/Timeline.js.map +1 -1
- package/dist-lib/components/ui/Toast.js +44 -57
- package/dist-lib/components/ui/Toast.js.map +1 -1
- package/dist-lib/components/ui/Tooltip.d.ts +4 -1
- package/dist-lib/components/ui/Tooltip.js +24 -22
- package/dist-lib/components/ui/Tooltip.js.map +1 -1
- package/dist-lib/components/ui/TopNav.d.ts +7 -3
- package/dist-lib/components/ui/TopNav.js +39 -22
- package/dist-lib/components/ui/TopNav.js.map +1 -1
- package/dist-lib/components/ui/Tree.d.ts +15 -10
- package/dist-lib/components/ui/Tree.js +82 -79
- package/dist-lib/components/ui/Tree.js.map +1 -1
- package/dist-lib/hooks/use-debounce.d.ts +19 -0
- package/dist-lib/hooks/use-debounce.js +36 -0
- package/dist-lib/hooks/use-debounce.js.map +1 -0
- package/dist-lib/hooks/use-delayed-loading.d.ts +21 -0
- package/dist-lib/hooks/use-delayed-loading.js +20 -0
- package/dist-lib/hooks/use-delayed-loading.js.map +1 -0
- package/dist-lib/hooks/use-field-ids.d.ts +2 -1
- package/dist-lib/hooks/use-field-ids.js +9 -9
- package/dist-lib/hooks/use-field-ids.js.map +1 -1
- package/dist-lib/hooks/use-media-query.d.ts +3 -1
- package/dist-lib/hooks/use-media-query.js +16 -12
- package/dist-lib/hooks/use-media-query.js.map +1 -1
- package/dist-lib/hooks/use-modifier-key.d.ts +13 -0
- package/dist-lib/hooks/use-modifier-key.js +19 -0
- package/dist-lib/hooks/use-modifier-key.js.map +1 -0
- package/dist-lib/hooks/use-toast.d.ts +7 -2
- package/dist-lib/hooks/use-toast.js +61 -30
- package/dist-lib/hooks/use-toast.js.map +1 -1
- package/dist-lib/icons/index.d.ts +9 -0
- package/dist-lib/icons/index.js +148 -130
- package/dist-lib/icons/index.js.map +1 -1
- package/dist-lib/illustrations/index.d.ts +1 -0
- package/dist-lib/illustrations/index.js +15 -6
- package/dist-lib/illustrations/index.js.map +1 -1
- package/dist-lib/index.d.ts +6 -0
- package/dist-lib/index.js +280 -260
- package/dist-lib/index.js.map +1 -1
- package/dist-lib/lib/format.d.ts +65 -0
- package/dist-lib/lib/format.js +95 -0
- package/dist-lib/lib/format.js.map +1 -0
- package/dist-lib/lib/return-focus.d.ts +11 -0
- package/dist-lib/lib/return-focus.js +12 -0
- package/dist-lib/lib/return-focus.js.map +1 -0
- package/dist-lib/lib/strings.d.ts +62 -1
- package/dist-lib/lib/strings.js +75 -19
- package/dist-lib/lib/strings.js.map +1 -1
- package/dist-lib/lib/strings.mn.js +50 -5
- package/dist-lib/lib/strings.mn.js.map +1 -1
- package/dist-lib/styles.css +1 -1
- package/dist-lib/theme.css +141 -78
- package/package.json +11 -4
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as N } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef as h } from "react";
|
|
4
|
+
import { formatDate as v } from "../../lib/format.js";
|
|
5
|
+
import { formatString as a } from "../../lib/strings.js";
|
|
6
|
+
import { useStrings as M } from "../../hooks/use-strings.js";
|
|
7
|
+
import { cn as b } from "../../lib/utils.js";
|
|
8
|
+
const f = 6e4, c = 60 * f, m = 24 * c, R = h(function({ date: n, now: o, absolute: d, className: g, ...p }, T) {
|
|
9
|
+
const t = M().relativeTime, s = n instanceof Date ? n : new Date(n), D = o === void 0 ? Date.now() : o instanceof Date ? o.getTime() : o, l = s.getTime() - D, e = Math.abs(l), r = l > 0, u = v(s, d);
|
|
10
|
+
let i;
|
|
11
|
+
return e < f ? i = t.justNow : e < c ? i = a(r ? t.inMinutes : t.minutesAgo, {
|
|
12
|
+
n: Math.round(e / f)
|
|
13
|
+
}) : e < m ? i = a(r ? t.inHours : t.hoursAgo, {
|
|
14
|
+
n: Math.round(e / c)
|
|
15
|
+
}) : e < 30 * m ? i = a(r ? t.inDays : t.daysAgo, { n: Math.round(e / m) }) : i = u, /* @__PURE__ */ N(
|
|
16
|
+
"time",
|
|
17
|
+
{
|
|
18
|
+
ref: T,
|
|
19
|
+
dateTime: Number.isNaN(s.getTime()) ? void 0 : s.toISOString(),
|
|
20
|
+
title: u,
|
|
21
|
+
className: b("tabular", g),
|
|
22
|
+
...p,
|
|
23
|
+
children: i
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
R.displayName = "RelativeTime";
|
|
28
|
+
export {
|
|
29
|
+
R as RelativeTime
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=RelativeTime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RelativeTime.js","sources":["../../../src/components/ui/RelativeTime.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, type TimeHTMLAttributes } from 'react';\nimport { formatDate, type FormatDateOptions } from '@/lib/format';\nimport { formatString } from '@/lib/strings';\nimport { useStrings } from '@/hooks/use-strings';\nimport { cn } from '@/lib/utils';\n\nexport interface RelativeTimeProps extends Omit<TimeHTMLAttributes<HTMLTimeElement>, 'dateTime'> {\n /** The instant to describe. */\n date: Date | number | string;\n /** Reference \"now\". Default `Date.now()` at render — pass one for stable SSR/tests. */\n now?: Date | number;\n /** Options for the absolute `title` (tooltip). */\n absolute?: FormatDateOptions;\n}\n\nconst MIN = 60_000;\nconst HOUR = 60 * MIN;\nconst DAY = 24 * HOUR;\n\n/**\n * `<time>` showing \"5 min ago\" with the absolute timestamp as `title` and a\n * machine-readable `dateTime`. Strings come from `UiStrings.relativeTime`.\n * Beyond 30 days it falls back to the absolute date so text never goes stale.\n *\n * @example\n * <RelativeTime date={post.createdAt} />\n */\nexport const RelativeTime = forwardRef<HTMLTimeElement, RelativeTimeProps>(function RelativeTime(\n { date, now, absolute, className, ...props },\n ref,\n) {\n const strings = useStrings().relativeTime;\n const d = date instanceof Date ? date : new Date(date);\n const ref_ = now === undefined ? Date.now() : now instanceof Date ? now.getTime() : now;\n const diff = d.getTime() - ref_;\n const abs = Math.abs(diff);\n const future = diff > 0;\n const title = formatDate(d, absolute);\n\n let label: string;\n if (abs < MIN) label = strings.justNow;\n else if (abs < HOUR)\n label = formatString(future ? strings.inMinutes : strings.minutesAgo, {\n n: Math.round(abs / MIN),\n });\n else if (abs < DAY)\n label = formatString(future ? strings.inHours : strings.hoursAgo, {\n n: Math.round(abs / HOUR),\n });\n else if (abs < 30 * DAY)\n label = formatString(future ? strings.inDays : strings.daysAgo, { n: Math.round(abs / DAY) });\n else label = title;\n\n return (\n <time\n ref={ref}\n dateTime={Number.isNaN(d.getTime()) ? undefined : d.toISOString()}\n title={title}\n className={cn('tabular', className)}\n {...props}\n >\n {label}\n </time>\n );\n});\nRelativeTime.displayName = 'RelativeTime';\n"],"names":["MIN","HOUR","DAY","RelativeTime","forwardRef","date","now","absolute","className","props","ref","strings","useStrings","d","ref_","diff","abs","future","title","formatDate","label","formatString","jsx","cn"],"mappings":";;;;;;;AAiBA,MAAMA,IAAM,KACNC,IAAO,KAAKD,GACZE,IAAM,KAAKD,GAUJE,IAAeC,EAA+C,SACzE,EAAE,MAAAC,GAAM,KAAAC,GAAK,UAAAC,GAAU,WAAAC,GAAW,GAAGC,EAAA,GACrCC,GACA;AACA,QAAMC,IAAUC,IAAa,cACvBC,IAAIR,aAAgB,OAAOA,IAAO,IAAI,KAAKA,CAAI,GAC/CS,IAAOR,MAAQ,SAAY,KAAK,QAAQA,aAAe,OAAOA,EAAI,QAAA,IAAYA,GAC9ES,IAAOF,EAAE,QAAA,IAAYC,GACrBE,IAAM,KAAK,IAAID,CAAI,GACnBE,IAASF,IAAO,GAChBG,IAAQC,EAAWN,GAAGN,CAAQ;AAEpC,MAAIa;AACJ,SAAIJ,IAAMhB,IAAKoB,IAAQT,EAAQ,UACtBK,IAAMf,IACbmB,IAAQC,EAAaJ,IAASN,EAAQ,YAAYA,EAAQ,YAAY;AAAA,IACpE,GAAG,KAAK,MAAMK,IAAMhB,CAAG;AAAA,EAAA,CACxB,IACMgB,IAAMd,IACbkB,IAAQC,EAAaJ,IAASN,EAAQ,UAAUA,EAAQ,UAAU;AAAA,IAChE,GAAG,KAAK,MAAMK,IAAMf,CAAI;AAAA,EAAA,CACzB,IACMe,IAAM,KAAKd,IAClBkB,IAAQC,EAAaJ,IAASN,EAAQ,SAASA,EAAQ,SAAS,EAAE,GAAG,KAAK,MAAMK,IAAMd,CAAG,GAAG,IACzFkB,IAAQF,GAGX,gBAAAI;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAZ;AAAA,MACA,UAAU,OAAO,MAAMG,EAAE,SAAS,IAAI,SAAYA,EAAE,YAAA;AAAA,MACpD,OAAAK;AAAA,MACA,WAAWK,EAAG,WAAWf,CAAS;AAAA,MACjC,GAAGC;AAAA,MAEH,UAAAW;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;AACDjB,EAAa,cAAc;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
1
2
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
2
3
|
/**
|
|
3
4
|
* Custom scroll container with consistent styled scrollbars across OS / browsers.
|
|
@@ -9,5 +10,12 @@ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
|
9
10
|
* <div className="p-3">…long content…</div>
|
|
10
11
|
* </ScrollArea>
|
|
11
12
|
*/
|
|
12
|
-
export
|
|
13
|
+
export interface ScrollAreaProps extends ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {
|
|
14
|
+
/**
|
|
15
|
+
* Accessible name of the viewport (a focusable `group` so keyboard users
|
|
16
|
+
* can scroll it). Defaults to `strings.scrollArea.region`.
|
|
17
|
+
*/
|
|
18
|
+
viewportLabel?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const ScrollArea: import('react').ForwardRefExoticComponent<ScrollAreaProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
13
21
|
export declare const ScrollBar: import('react').ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,44 +1,60 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as d, jsx as l } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import * as
|
|
3
|
+
import { forwardRef as s } from "react";
|
|
4
|
+
import * as o from "@radix-ui/react-scroll-area";
|
|
5
5
|
import { cn as n } from "../../lib/utils.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
import { useStrings as m } from "../../hooks/use-strings.js";
|
|
7
|
+
const p = s(
|
|
8
|
+
function({ className: e, children: r, viewportLabel: a, ...i }, f) {
|
|
9
|
+
const u = m();
|
|
10
|
+
return /* @__PURE__ */ d(
|
|
11
|
+
o.Root,
|
|
12
|
+
{
|
|
13
|
+
ref: f,
|
|
14
|
+
className: n("relative overflow-hidden", e),
|
|
15
|
+
...i,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ l(
|
|
18
|
+
o.Viewport,
|
|
19
|
+
{
|
|
20
|
+
role: "group",
|
|
21
|
+
"aria-label": a ?? u.scrollArea.region,
|
|
22
|
+
tabIndex: 0,
|
|
23
|
+
className: n(
|
|
24
|
+
"h-full w-full rounded-[inherit]",
|
|
25
|
+
"focus-visible:ring-ring focus-visible:ring-offset-background outline-none focus-visible:ring-2 focus-visible:ring-offset-2"
|
|
26
|
+
),
|
|
27
|
+
children: r
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ l(t, {}),
|
|
31
|
+
/* @__PURE__ */ l(o.Corner, {})
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
p.displayName = "ScrollArea";
|
|
38
|
+
const t = s(function({ className: e, orientation: r = "vertical", ...a }, i) {
|
|
23
39
|
return /* @__PURE__ */ l(
|
|
24
|
-
|
|
40
|
+
o.ScrollAreaScrollbar,
|
|
25
41
|
{
|
|
26
|
-
ref:
|
|
42
|
+
ref: i,
|
|
27
43
|
orientation: r,
|
|
28
44
|
className: n(
|
|
29
|
-
"flex touch-none
|
|
45
|
+
"flex touch-none transition-colors duration-[var(--duration-fast)] select-none",
|
|
30
46
|
r === "vertical" && "h-full w-2 border-l border-l-transparent p-px",
|
|
31
47
|
r === "horizontal" && "h-2 flex-col border-t border-t-transparent p-px",
|
|
32
|
-
|
|
48
|
+
e
|
|
33
49
|
),
|
|
34
50
|
...a,
|
|
35
|
-
children: /* @__PURE__ */ l(
|
|
51
|
+
children: /* @__PURE__ */ l(o.ScrollAreaThumb, { className: "bg-border-strong relative flex-1 rounded-full" })
|
|
36
52
|
}
|
|
37
53
|
);
|
|
38
54
|
});
|
|
39
|
-
|
|
55
|
+
t.displayName = "ScrollBar";
|
|
40
56
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
57
|
+
p as ScrollArea,
|
|
58
|
+
t as ScrollBar
|
|
43
59
|
};
|
|
44
60
|
//# sourceMappingURL=ScrollArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollArea.js","sources":["../../../src/components/ui/ScrollArea.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"ScrollArea.js","sources":["../../../src/components/ui/ScrollArea.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from 'react';\nimport * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\n\n/**\n * Custom scroll container with consistent styled scrollbars across OS / browsers.\n * Use when the default OS scrollbar would visually clash (sidebars, command\n * palettes, code panes). Falls back to native scroll inside the viewport.\n *\n * @example\n * <ScrollArea className=\"h-64 rounded-md border border-border\">\n * <div className=\"p-3\">…long content…</div>\n * </ScrollArea>\n */\nexport interface ScrollAreaProps extends ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> {\n /**\n * Accessible name of the viewport (a focusable `group` so keyboard users\n * can scroll it). Defaults to `strings.scrollArea.region`.\n */\n viewportLabel?: string;\n}\n\nexport const ScrollArea = forwardRef<ElementRef<typeof ScrollAreaPrimitive.Root>, ScrollAreaProps>(\n function ScrollArea({ className, children, viewportLabel, ...props }, ref) {\n const strings = useStrings();\n return (\n <ScrollAreaPrimitive.Root\n ref={ref}\n className={cn('relative overflow-hidden', className)}\n {...props}\n >\n <ScrollAreaPrimitive.Viewport\n role=\"group\"\n aria-label={viewportLabel ?? strings.scrollArea.region}\n tabIndex={0}\n className={cn(\n 'h-full w-full rounded-[inherit]',\n 'focus-visible:ring-ring focus-visible:ring-offset-background outline-none focus-visible:ring-2 focus-visible:ring-offset-2',\n )}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n <ScrollBar />\n <ScrollAreaPrimitive.Corner />\n </ScrollAreaPrimitive.Root>\n );\n },\n);\nScrollArea.displayName = 'ScrollArea';\n\nexport const ScrollBar = forwardRef<\n ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,\n ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>\n>(function ScrollBar({ className, orientation = 'vertical', ...props }, ref) {\n return (\n <ScrollAreaPrimitive.ScrollAreaScrollbar\n ref={ref}\n orientation={orientation}\n className={cn(\n 'flex touch-none transition-colors duration-[var(--duration-fast)] select-none',\n orientation === 'vertical' && 'h-full w-2 border-l border-l-transparent p-px',\n orientation === 'horizontal' && 'h-2 flex-col border-t border-t-transparent p-px',\n className,\n )}\n {...props}\n >\n <ScrollAreaPrimitive.ScrollAreaThumb className=\"bg-border-strong relative flex-1 rounded-full\" />\n </ScrollAreaPrimitive.ScrollAreaScrollbar>\n );\n});\nScrollBar.displayName = 'ScrollBar';\n"],"names":["ScrollArea","forwardRef","className","children","viewportLabel","props","ref","strings","useStrings","jsxs","ScrollAreaPrimitive","cn","jsx","ScrollBar","orientation"],"mappings":";;;;;;AAyBO,MAAMA,IAAaC;AAAA,EACxB,SAAoB,EAAE,WAAAC,GAAW,UAAAC,GAAU,eAAAC,GAAe,GAAGC,EAAA,GAASC,GAAK;AACzE,UAAMC,IAAUC,EAAA;AAChB,WACE,gBAAAC;AAAA,MAACC,EAAoB;AAAA,MAApB;AAAA,QACC,KAAAJ;AAAA,QACA,WAAWK,EAAG,4BAA4BT,CAAS;AAAA,QAClD,GAAGG;AAAA,QAEJ,UAAA;AAAA,UAAA,gBAAAO;AAAA,YAACF,EAAoB;AAAA,YAApB;AAAA,cACC,MAAK;AAAA,cACL,cAAYN,KAAiBG,EAAQ,WAAW;AAAA,cAChD,UAAU;AAAA,cACV,WAAWI;AAAA,gBACT;AAAA,gBACA;AAAA,cAAA;AAAA,cAGD,UAAAR;AAAA,YAAA;AAAA,UAAA;AAAA,4BAEFU,GAAA,EAAU;AAAA,UACX,gBAAAD,EAACF,EAAoB,QAApB,CAAA,CAA2B;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGlC;AACF;AACAV,EAAW,cAAc;AAElB,MAAMa,IAAYZ,EAGvB,SAAmB,EAAE,WAAAC,GAAW,aAAAY,IAAc,YAAY,GAAGT,EAAA,GAASC,GAAK;AAC3E,SACE,gBAAAM;AAAA,IAACF,EAAoB;AAAA,IAApB;AAAA,MACC,KAAAJ;AAAA,MACA,aAAAQ;AAAA,MACA,WAAWH;AAAA,QACT;AAAA,QACAG,MAAgB,cAAc;AAAA,QAC9BA,MAAgB,gBAAgB;AAAA,QAChCZ;AAAA,MAAA;AAAA,MAED,GAAGG;AAAA,MAEJ,UAAA,gBAAAO,EAACF,EAAoB,iBAApB,EAAoC,WAAU,gDAAA,CAAgD;AAAA,IAAA;AAAA,EAAA;AAGrG,CAAC;AACDG,EAAU,cAAc;"}
|
|
@@ -3,7 +3,12 @@ import * as SelectPrimitive from '@radix-ui/react-select';
|
|
|
3
3
|
export declare const Select: import('react').FC<SelectPrimitive.SelectProps>;
|
|
4
4
|
export declare const SelectValue: import('react').ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & import('react').RefAttributes<HTMLSpanElement>>;
|
|
5
5
|
export interface SelectTriggerProps extends Omit<ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>, 'children'> {
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Placeholder shown when no value is selected. Also used as the trigger's
|
|
8
|
+
* accessible name when no `aria-label` / `aria-labelledby` / `id` (external
|
|
9
|
+
* `<Label htmlFor>`) is supplied — `role="combobox"` takes no name from
|
|
10
|
+
* its content.
|
|
11
|
+
*/
|
|
7
12
|
placeholder?: string;
|
|
8
13
|
/** Trigger height — matches Input sizes. */
|
|
9
14
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -1,53 +1,57 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as t, jsxs as d } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import * as
|
|
5
|
-
import { Check as
|
|
3
|
+
import { forwardRef as l } from "react";
|
|
4
|
+
import * as a from "@radix-ui/react-select";
|
|
5
|
+
import { Check as S, ChevronDown as x, ChevronUp as v, ChevronsUpDown as N } from "../../icons/index.js";
|
|
6
6
|
import { cn as c } from "../../lib/utils.js";
|
|
7
|
-
|
|
7
|
+
import { useStrings as y } from "../../hooks/use-strings.js";
|
|
8
|
+
const G = a.Root, L = a.Value, w = l(function({ className: r, placeholder: o, size: e = "md", tone: i = "default", ...n }, g) {
|
|
9
|
+
const b = y(), h = !!(n["aria-label"] || n["aria-labelledby"] || n.id);
|
|
8
10
|
return /* @__PURE__ */ d(
|
|
9
|
-
|
|
11
|
+
a.Trigger,
|
|
10
12
|
{
|
|
11
13
|
ref: g,
|
|
14
|
+
"aria-label": h ? void 0 : o ?? b.select.placeholder,
|
|
12
15
|
className: c(
|
|
13
|
-
"inline-flex w-full items-center justify-between gap-2 rounded-md border
|
|
16
|
+
"bg-card text-foreground inline-flex w-full items-center justify-between gap-2 rounded-md border text-lg md:text-sm",
|
|
17
|
+
"[&>span]:min-w-0 [&>span]:truncate",
|
|
14
18
|
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]",
|
|
15
19
|
"outline-none",
|
|
16
|
-
"focus-visible:ring-
|
|
17
|
-
"disabled:
|
|
20
|
+
"focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
21
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
18
22
|
"data-[placeholder]:text-foreground-subtle",
|
|
19
23
|
e === "sm" && "h-8 px-2.5",
|
|
20
24
|
e === "md" && "h-9 px-3",
|
|
21
25
|
e === "lg" && "h-10 px-3.5",
|
|
22
|
-
|
|
26
|
+
i === "default" ? "border-border-input focus-visible:border-accent focus-visible:ring-ring" : "border-danger focus-visible:border-danger focus-visible:ring-danger",
|
|
23
27
|
r
|
|
24
28
|
),
|
|
25
|
-
...
|
|
29
|
+
...n,
|
|
26
30
|
children: [
|
|
27
|
-
/* @__PURE__ */ t(
|
|
28
|
-
/* @__PURE__ */ t(
|
|
31
|
+
/* @__PURE__ */ t(a.Value, { placeholder: o }),
|
|
32
|
+
/* @__PURE__ */ t(a.Icon, { asChild: !0, children: /* @__PURE__ */ t(N, { className: "text-foreground-subtle size-4 shrink-0", "aria-hidden": !0 }) })
|
|
29
33
|
]
|
|
30
34
|
}
|
|
31
35
|
);
|
|
32
36
|
});
|
|
33
|
-
|
|
34
|
-
const u = "flex h-6 cursor-default items-center justify-center text-foreground-subtle", m =
|
|
35
|
-
return /* @__PURE__ */ t(
|
|
37
|
+
w.displayName = "SelectTrigger";
|
|
38
|
+
const u = "flex h-6 cursor-default items-center justify-center text-foreground-subtle", m = l(function({ className: r, ...o }, e) {
|
|
39
|
+
return /* @__PURE__ */ t(a.ScrollUpButton, { ref: e, className: c(u, r), ...o, children: /* @__PURE__ */ t(v, { className: "size-4", "aria-hidden": !0 }) });
|
|
36
40
|
});
|
|
37
41
|
m.displayName = "SelectScrollUpButton";
|
|
38
|
-
const p =
|
|
39
|
-
return /* @__PURE__ */ t(
|
|
42
|
+
const p = l(function({ className: r, ...o }, e) {
|
|
43
|
+
return /* @__PURE__ */ t(a.ScrollDownButton, { ref: e, className: c(u, r), ...o, children: /* @__PURE__ */ t(x, { className: "size-4", "aria-hidden": !0 }) });
|
|
40
44
|
});
|
|
41
45
|
p.displayName = "SelectScrollDownButton";
|
|
42
|
-
const
|
|
43
|
-
return /* @__PURE__ */ t(
|
|
44
|
-
|
|
46
|
+
const B = l(function({ className: r, children: o, position: e = "popper", ...i }, n) {
|
|
47
|
+
return /* @__PURE__ */ t(a.Portal, { children: /* @__PURE__ */ d(
|
|
48
|
+
a.Content,
|
|
45
49
|
{
|
|
46
|
-
ref:
|
|
50
|
+
ref: n,
|
|
47
51
|
position: e,
|
|
48
52
|
className: c(
|
|
49
|
-
"z-[var(--z-popover)] min-w-[var(--radix-select-trigger-width)]
|
|
50
|
-
"
|
|
53
|
+
"z-[var(--z-popover)] max-h-96 min-w-[var(--radix-select-trigger-width)]",
|
|
54
|
+
"border-border bg-popover text-popover-foreground overflow-hidden rounded-lg border",
|
|
51
55
|
"shadow-md",
|
|
52
56
|
"data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
53
57
|
"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
@@ -55,77 +59,81 @@ const N = n(function({ className: r, children: a, position: e = "popper", ...s }
|
|
|
55
59
|
e === "popper" && "data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1",
|
|
56
60
|
r
|
|
57
61
|
),
|
|
58
|
-
...
|
|
62
|
+
...i,
|
|
59
63
|
children: [
|
|
60
64
|
/* @__PURE__ */ t(m, {}),
|
|
61
|
-
/* @__PURE__ */ t(
|
|
65
|
+
/* @__PURE__ */ t(a.Viewport, { className: "p-1", children: o }),
|
|
62
66
|
/* @__PURE__ */ t(p, {})
|
|
63
67
|
]
|
|
64
68
|
}
|
|
65
69
|
) });
|
|
66
70
|
});
|
|
67
|
-
|
|
68
|
-
const f =
|
|
71
|
+
B.displayName = "SelectContent";
|
|
72
|
+
const f = l(function({ className: r, ...o }, e) {
|
|
69
73
|
return /* @__PURE__ */ t(
|
|
70
|
-
|
|
74
|
+
a.Label,
|
|
71
75
|
{
|
|
72
76
|
ref: e,
|
|
73
|
-
className: c("px-2 py-1.5 text-xs font-medium
|
|
74
|
-
...
|
|
77
|
+
className: c("text-foreground-subtle px-2 py-1.5 text-xs font-medium", r),
|
|
78
|
+
...o
|
|
75
79
|
}
|
|
76
80
|
);
|
|
77
81
|
});
|
|
78
82
|
f.displayName = "SelectLabel";
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
83
|
+
const C = l(
|
|
84
|
+
function({ className: r, children: o, leadingIcon: e, ...i }, n) {
|
|
85
|
+
return /* @__PURE__ */ d(
|
|
86
|
+
a.Item,
|
|
87
|
+
{
|
|
88
|
+
ref: n,
|
|
89
|
+
className: c(
|
|
90
|
+
"relative flex w-full cursor-default items-center gap-2 select-none",
|
|
91
|
+
"text-foreground rounded-sm px-2 py-1.5 pr-8 text-sm outline-none",
|
|
92
|
+
"data-[highlighted]:bg-background-muted data-[highlighted]:text-foreground",
|
|
93
|
+
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
94
|
+
r
|
|
95
|
+
),
|
|
96
|
+
...i,
|
|
97
|
+
children: [
|
|
98
|
+
e && /* @__PURE__ */ t("span", { className: "text-foreground-subtle flex items-center [&_svg]:size-4", children: e }),
|
|
99
|
+
/* @__PURE__ */ t(a.ItemText, { children: o }),
|
|
100
|
+
/* @__PURE__ */ t("span", { className: "absolute right-2 flex items-center justify-center", children: /* @__PURE__ */ t(a.ItemIndicator, { children: /* @__PURE__ */ t(S, { className: "text-accent size-4", "aria-hidden": !0 }) }) })
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
C.displayName = "SelectItem";
|
|
107
|
+
const z = l(function({ className: r, ...o }, e) {
|
|
102
108
|
return /* @__PURE__ */ t(
|
|
103
|
-
|
|
109
|
+
a.Separator,
|
|
104
110
|
{
|
|
105
111
|
ref: e,
|
|
106
|
-
className: c("-mx-1 my-1 h-px
|
|
107
|
-
...
|
|
112
|
+
className: c("bg-border -mx-1 my-1 h-px", r),
|
|
113
|
+
...o
|
|
108
114
|
}
|
|
109
115
|
);
|
|
110
116
|
});
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
});
|
|
118
|
-
|
|
117
|
+
z.displayName = "SelectSeparator";
|
|
118
|
+
const I = l(
|
|
119
|
+
function({ label: r, children: o, ...e }, i) {
|
|
120
|
+
return /* @__PURE__ */ d(a.Group, { ref: i, ...e, children: [
|
|
121
|
+
r && /* @__PURE__ */ t(f, { children: r }),
|
|
122
|
+
o
|
|
123
|
+
] });
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
I.displayName = "SelectGroup";
|
|
119
127
|
export {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
128
|
+
G as Select,
|
|
129
|
+
B as SelectContent,
|
|
130
|
+
I as SelectGroup,
|
|
131
|
+
C as SelectItem,
|
|
124
132
|
f as SelectLabel,
|
|
125
133
|
p as SelectScrollDownButton,
|
|
126
134
|
m as SelectScrollUpButton,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
135
|
+
z as SelectSeparator,
|
|
136
|
+
w as SelectTrigger,
|
|
137
|
+
L as SelectValue
|
|
130
138
|
};
|
|
131
139
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","sources":["../../../src/components/ui/Select.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n type ComponentPropsWithoutRef,\n type ElementRef,\n type ReactNode,\n} from 'react';\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport { Check, ChevronDown, ChevronUp, ChevronsUpDown } from '@/icons';\nimport { cn } from '@/lib/utils';\n\n/* -----------------------------------------------------------------------------\n * Compound API:\n *\n * <Select value={…} onValueChange={…}>\n * <SelectTrigger placeholder=\"Pick one\" />\n * <SelectContent>\n * <SelectGroup label=\"Active\">\n * <SelectItem value=\"a\">Apple</SelectItem>\n * <SelectItem value=\"b\">Banana</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n * </Select>\n *\n * All accessibility is handled by Radix: keyboard navigation, type-ahead,\n * focus trap, ARIA roles. We only style.\n * --------------------------------------------------------------------------- */\n\nexport const Select = SelectPrimitive.Root;\nexport const SelectValue = SelectPrimitive.Value;\n\nexport interface SelectTriggerProps\n extends Omit<ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>, 'children'> {\n /** Placeholder shown when no value is selected. */\n placeholder?: string;\n /** Trigger height — matches Input sizes. */\n size?: 'sm' | 'md' | 'lg';\n /** Visual tone — `error` swaps the border + ring to danger. */\n tone?: 'default' | 'error';\n}\n\nexport const SelectTrigger = forwardRef<\n ElementRef<typeof SelectPrimitive.Trigger>,\n SelectTriggerProps\n>(function SelectTrigger({ className, placeholder, size = 'md', tone = 'default', ...props }, ref) {\n return (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n 'inline-flex w-full items-center justify-between gap-2 rounded-md border bg-card text-lg md:text-sm text-foreground',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'outline-none',\n 'focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n 'disabled:opacity-50 disabled:cursor-not-allowed',\n 'data-[placeholder]:text-foreground-subtle',\n size === 'sm' && 'h-8 px-2.5',\n size === 'md' && 'h-9 px-3',\n size === 'lg' && 'h-10 px-3.5',\n tone === 'default'\n ? 'border-border-input focus-visible:border-accent focus-visible:ring-ring'\n : 'border-danger focus-visible:border-danger focus-visible:ring-danger',\n className,\n )}\n {...props}\n >\n <SelectPrimitive.Value placeholder={placeholder} />\n <SelectPrimitive.Icon asChild>\n <ChevronsUpDown className=\"size-4 text-foreground-subtle shrink-0\" aria-hidden />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n});\nSelectTrigger.displayName = 'SelectTrigger';\n\nconst scrollBtn =\n 'flex h-6 cursor-default items-center justify-center text-foreground-subtle';\n\nexport const SelectScrollUpButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(function SelectScrollUpButton({ className, ...props }, ref) {\n return (\n <SelectPrimitive.ScrollUpButton ref={ref} className={cn(scrollBtn, className)} {...props}>\n <ChevronUp className=\"size-4\" aria-hidden />\n </SelectPrimitive.ScrollUpButton>\n );\n});\nSelectScrollUpButton.displayName = 'SelectScrollUpButton';\n\nexport const SelectScrollDownButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(function SelectScrollDownButton({ className, ...props }, ref) {\n return (\n <SelectPrimitive.ScrollDownButton ref={ref} className={cn(scrollBtn, className)} {...props}>\n <ChevronDown className=\"size-4\" aria-hidden />\n </SelectPrimitive.ScrollDownButton>\n );\n});\nSelectScrollDownButton.displayName = 'SelectScrollDownButton';\n\nexport const SelectContent = forwardRef<\n ElementRef<typeof SelectPrimitive.Content>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(function SelectContent({ className, children, position = 'popper', ...props }, ref) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n className={cn(\n 'z-[var(--z-popover)] min-w-[var(--radix-select-trigger-width)] max-h-96',\n 'overflow-hidden rounded-lg border border-border bg-popover text-popover-foreground',\n 'shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n position === 'popper' &&\n 'data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1',\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport className=\"p-1\">{children}</SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n});\nSelectContent.displayName = 'SelectContent';\n\nexport const SelectLabel = forwardRef<\n ElementRef<typeof SelectPrimitive.Label>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(function SelectLabel({ className, ...props }, ref) {\n return (\n <SelectPrimitive.Label\n ref={ref}\n className={cn('px-2 py-1.5 text-xs font-medium text-foreground-subtle', className)}\n {...props}\n />\n );\n});\nSelectLabel.displayName = 'SelectLabel';\n\nexport interface SelectItemProps\n extends ComponentPropsWithoutRef<typeof SelectPrimitive.Item> {\n /** Icon shown to the left of the label. */\n leadingIcon?: ReactNode;\n}\n\nexport const SelectItem = forwardRef<\n ElementRef<typeof SelectPrimitive.Item>,\n SelectItemProps\n>(function SelectItem({ className, children, leadingIcon, ...props }, ref) {\n return (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex w-full cursor-default select-none items-center gap-2',\n 'rounded-sm px-2 py-1.5 pr-8 text-sm text-foreground outline-none',\n 'data-[highlighted]:bg-background-muted data-[highlighted]:text-foreground',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n {leadingIcon && (\n <span className=\"flex items-center text-foreground-subtle [&_svg]:size-4\">\n {leadingIcon}\n </span>\n )}\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n <span className=\"absolute right-2 flex items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"size-4 text-accent\" aria-hidden />\n </SelectPrimitive.ItemIndicator>\n </span>\n </SelectPrimitive.Item>\n );\n});\nSelectItem.displayName = 'SelectItem';\n\nexport const SelectSeparator = forwardRef<\n ElementRef<typeof SelectPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(function SelectSeparator({ className, ...props }, ref) {\n return (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn('-mx-1 my-1 h-px bg-border', className)}\n {...props}\n />\n );\n});\nSelectSeparator.displayName = 'SelectSeparator';\n\n/** Optional grouping with a label header. Pure composition over Radix Group + Label. */\nexport interface SelectGroupProps\n extends ComponentPropsWithoutRef<typeof SelectPrimitive.Group> {\n label?: ReactNode;\n}\nexport const SelectGroup = forwardRef<\n ElementRef<typeof SelectPrimitive.Group>,\n SelectGroupProps\n>(function SelectGroup({ label, children, ...props }, ref) {\n return (\n <SelectPrimitive.Group ref={ref} {...props}>\n {label && <SelectLabel>{label}</SelectLabel>}\n {children}\n </SelectPrimitive.Group>\n );\n});\nSelectGroup.displayName = 'SelectGroup';\n\n/**\n * Compose `Select` + `SelectTrigger` + `SelectContent` + `SelectItem` for a\n * single-choice picker. Keyboard, type-ahead, and ARIA come from Radix.\n *\n * @example Basic\n * <Select onValueChange={setStatus}>\n * <SelectTrigger placeholder=\"Status\" />\n * <SelectContent>\n * <SelectItem value=\"open\">Open</SelectItem>\n * <SelectItem value=\"closed\">Closed</SelectItem>\n * </SelectContent>\n * </Select>\n *\n * @example Grouped\n * <SelectContent>\n * <SelectGroup label=\"People\">\n * <SelectItem value=\"anu\">Anu</SelectItem>\n * <SelectItem value=\"bat\">Bat</SelectItem>\n * </SelectGroup>\n * <SelectSeparator />\n * <SelectGroup label=\"Bots\">\n * <SelectItem value=\"robo\">Robo</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n *\n * @do Use `placeholder` on the trigger when there is no default value.\n * @dont Use Select for more than ~12 options — switch to `Combobox`.\n */\n"],"names":["Select","SelectPrimitive","SelectValue","SelectTrigger","forwardRef","className","placeholder","size","tone","props","ref","jsxs","cn","jsx","ChevronsUpDown","scrollBtn","SelectScrollUpButton","ChevronUp","SelectScrollDownButton","ChevronDown","SelectContent","children","position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KAAAS;AAAA,MACA,WAAWE;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACAP;AAAA,MAAA;AAAA,MAED,GAAGI;AAAA,MAEH,UAAA;AAAA,QAAAgB,KACC,gBAAAZ,EAAC,QAAA,EAAK,WAAU,2DACb,UAAAY,GACH;AAAA,QAEF,gBAAAZ,EAACZ,EAAgB,UAAhB,EAA0B,UAAAoB,EAAA,CAAS;AAAA,QACpC,gBAAAR,EAAC,QAAA,EAAK,WAAU,qDACd,4BAACZ,EAAgB,eAAhB,EACC,UAAA,gBAAAY,EAACa,KAAM,WAAU,sBAAqB,eAAW,GAAA,CAAC,GACpD,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;AACDF,EAAW,cAAc;AAElB,MAAMG,IAAkBvB,EAG7B,SAAyB,EAAE,WAAAC,GAAW,GAAGI,EAAA,GAASC,GAAK;AACvD,SACE,gBAAAG;AAAA,IAACZ,EAAgB;AAAA,IAAhB;AAAA,MACC,KAAAS;AAAA,MACA,WAAWE,EAAG,6BAA6BP,CAAS;AAAA,MACnD,GAAGI;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AACDkB,EAAgB,cAAc;AAOvB,MAAMC,IAAcxB,EAGzB,SAAqB,EAAE,OAAAyB,GAAO,UAAAR,GAAU,GAAGZ,EAAA,GAASC,GAAK;AACzD,2BACGT,EAAgB,OAAhB,EAAsB,KAAAS,GAAW,GAAGD,GAClC,UAAA;AAAA,IAAAoB,KAAS,gBAAAhB,EAACU,KAAa,UAAAM,EAAA,CAAM;AAAA,IAC7BR;AAAA,EAAA,GACH;AAEJ,CAAC;AACDO,EAAY,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Select.js","sources":["../../../src/components/ui/Select.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, type ComponentPropsWithoutRef, type ElementRef, type ReactNode } from 'react';\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport { Check, ChevronDown, ChevronUp, ChevronsUpDown } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { useStrings } from '@/hooks/use-strings';\n\n/* -----------------------------------------------------------------------------\n * Compound API:\n *\n * <Select value={…} onValueChange={…}>\n * <SelectTrigger placeholder=\"Pick one\" />\n * <SelectContent>\n * <SelectGroup label=\"Active\">\n * <SelectItem value=\"a\">Apple</SelectItem>\n * <SelectItem value=\"b\">Banana</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n * </Select>\n *\n * All accessibility is handled by Radix: keyboard navigation, type-ahead,\n * focus trap, ARIA roles. We only style.\n * --------------------------------------------------------------------------- */\n\nexport const Select = SelectPrimitive.Root;\nexport const SelectValue = SelectPrimitive.Value;\n\nexport interface SelectTriggerProps extends Omit<\n ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>,\n 'children'\n> {\n /**\n * Placeholder shown when no value is selected. Also used as the trigger's\n * accessible name when no `aria-label` / `aria-labelledby` / `id` (external\n * `<Label htmlFor>`) is supplied — `role=\"combobox\"` takes no name from\n * its content.\n */\n placeholder?: string;\n /** Trigger height — matches Input sizes. */\n size?: 'sm' | 'md' | 'lg';\n /** Visual tone — `error` swaps the border + ring to danger. */\n tone?: 'default' | 'error';\n}\n\nexport const SelectTrigger = forwardRef<\n ElementRef<typeof SelectPrimitive.Trigger>,\n SelectTriggerProps\n>(function SelectTrigger({ className, placeholder, size = 'md', tone = 'default', ...props }, ref) {\n const strings = useStrings();\n const hasName = Boolean(props['aria-label'] || props['aria-labelledby'] || props.id);\n return (\n <SelectPrimitive.Trigger\n ref={ref}\n aria-label={hasName ? undefined : (placeholder ?? strings.select.placeholder)}\n className={cn(\n 'bg-card text-foreground inline-flex w-full items-center justify-between gap-2 rounded-md border text-lg md:text-sm',\n '[&>span]:min-w-0 [&>span]:truncate',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'outline-none',\n 'focus-visible:ring-offset-background focus-visible:ring-2 focus-visible:ring-offset-2',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n 'data-[placeholder]:text-foreground-subtle',\n size === 'sm' && 'h-8 px-2.5',\n size === 'md' && 'h-9 px-3',\n size === 'lg' && 'h-10 px-3.5',\n tone === 'default'\n ? 'border-border-input focus-visible:border-accent focus-visible:ring-ring'\n : 'border-danger focus-visible:border-danger focus-visible:ring-danger',\n className,\n )}\n {...props}\n >\n <SelectPrimitive.Value placeholder={placeholder} />\n <SelectPrimitive.Icon asChild>\n <ChevronsUpDown className=\"text-foreground-subtle size-4 shrink-0\" aria-hidden />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n});\nSelectTrigger.displayName = 'SelectTrigger';\n\nconst scrollBtn = 'flex h-6 cursor-default items-center justify-center text-foreground-subtle';\n\nexport const SelectScrollUpButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(function SelectScrollUpButton({ className, ...props }, ref) {\n return (\n <SelectPrimitive.ScrollUpButton ref={ref} className={cn(scrollBtn, className)} {...props}>\n <ChevronUp className=\"size-4\" aria-hidden />\n </SelectPrimitive.ScrollUpButton>\n );\n});\nSelectScrollUpButton.displayName = 'SelectScrollUpButton';\n\nexport const SelectScrollDownButton = forwardRef<\n ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(function SelectScrollDownButton({ className, ...props }, ref) {\n return (\n <SelectPrimitive.ScrollDownButton ref={ref} className={cn(scrollBtn, className)} {...props}>\n <ChevronDown className=\"size-4\" aria-hidden />\n </SelectPrimitive.ScrollDownButton>\n );\n});\nSelectScrollDownButton.displayName = 'SelectScrollDownButton';\n\nexport const SelectContent = forwardRef<\n ElementRef<typeof SelectPrimitive.Content>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(function SelectContent({ className, children, position = 'popper', ...props }, ref) {\n return (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n position={position}\n className={cn(\n 'z-[var(--z-popover)] max-h-96 min-w-[var(--radix-select-trigger-width)]',\n 'border-border bg-popover text-popover-foreground overflow-hidden rounded-lg border',\n 'shadow-md',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',\n 'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',\n position === 'popper' &&\n 'data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1',\n className,\n )}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport className=\"p-1\">{children}</SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n});\nSelectContent.displayName = 'SelectContent';\n\nexport const SelectLabel = forwardRef<\n ElementRef<typeof SelectPrimitive.Label>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Label>\n>(function SelectLabel({ className, ...props }, ref) {\n return (\n <SelectPrimitive.Label\n ref={ref}\n className={cn('text-foreground-subtle px-2 py-1.5 text-xs font-medium', className)}\n {...props}\n />\n );\n});\nSelectLabel.displayName = 'SelectLabel';\n\nexport interface SelectItemProps extends ComponentPropsWithoutRef<typeof SelectPrimitive.Item> {\n /** Icon shown to the left of the label. */\n leadingIcon?: ReactNode;\n}\n\nexport const SelectItem = forwardRef<ElementRef<typeof SelectPrimitive.Item>, SelectItemProps>(\n function SelectItem({ className, children, leadingIcon, ...props }, ref) {\n return (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex w-full cursor-default items-center gap-2 select-none',\n 'text-foreground rounded-sm px-2 py-1.5 pr-8 text-sm outline-none',\n 'data-[highlighted]:bg-background-muted data-[highlighted]:text-foreground',\n 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50',\n className,\n )}\n {...props}\n >\n {leadingIcon && (\n <span className=\"text-foreground-subtle flex items-center [&_svg]:size-4\">\n {leadingIcon}\n </span>\n )}\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n <span className=\"absolute right-2 flex items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"text-accent size-4\" aria-hidden />\n </SelectPrimitive.ItemIndicator>\n </span>\n </SelectPrimitive.Item>\n );\n },\n);\nSelectItem.displayName = 'SelectItem';\n\nexport const SelectSeparator = forwardRef<\n ElementRef<typeof SelectPrimitive.Separator>,\n ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(function SelectSeparator({ className, ...props }, ref) {\n return (\n <SelectPrimitive.Separator\n ref={ref}\n className={cn('bg-border -mx-1 my-1 h-px', className)}\n {...props}\n />\n );\n});\nSelectSeparator.displayName = 'SelectSeparator';\n\n/** Optional grouping with a label header. Pure composition over Radix Group + Label. */\nexport interface SelectGroupProps extends ComponentPropsWithoutRef<typeof SelectPrimitive.Group> {\n label?: ReactNode;\n}\nexport const SelectGroup = forwardRef<ElementRef<typeof SelectPrimitive.Group>, SelectGroupProps>(\n function SelectGroup({ label, children, ...props }, ref) {\n return (\n <SelectPrimitive.Group ref={ref} {...props}>\n {label && <SelectLabel>{label}</SelectLabel>}\n {children}\n </SelectPrimitive.Group>\n );\n },\n);\nSelectGroup.displayName = 'SelectGroup';\n\n/**\n * Compose `Select` + `SelectTrigger` + `SelectContent` + `SelectItem` for a\n * single-choice picker. Keyboard, type-ahead, and ARIA come from Radix.\n *\n * @example Basic\n * <Select onValueChange={setStatus}>\n * <SelectTrigger placeholder=\"Status\" />\n * <SelectContent>\n * <SelectItem value=\"open\">Open</SelectItem>\n * <SelectItem value=\"closed\">Closed</SelectItem>\n * </SelectContent>\n * </Select>\n *\n * @example Grouped\n * <SelectContent>\n * <SelectGroup label=\"People\">\n * <SelectItem value=\"anu\">Anu</SelectItem>\n * <SelectItem value=\"bat\">Bat</SelectItem>\n * </SelectGroup>\n * <SelectSeparator />\n * <SelectGroup label=\"Bots\">\n * <SelectItem value=\"robo\">Robo</SelectItem>\n * </SelectGroup>\n * </SelectContent>\n *\n * @do Use `placeholder` on the trigger when there is no default value.\n * @dont Use Select for more than ~12 options — switch to `Combobox`.\n */\n"],"names":["Select","SelectPrimitive","SelectValue","SelectTrigger","forwardRef","className","placeholder","size","tone","props","ref","strings","useStrings","hasName","jsxs","cn","jsx","ChevronsUpDown","scrollBtn","SelectScrollUpButton","ChevronUp","SelectScrollDownButton","ChevronDown","SelectContent","children","position","SelectLabel","SelectItem","leadingIcon","Check","SelectSeparator","SelectGroup","label"],"mappings":";;;;;;;AAyBO,MAAMA,IAASC,EAAgB,MACzBC,IAAcD,EAAgB,OAmB9BE,IAAgBC,EAG3B,SAAuB,EAAE,WAAAC,GAAW,aAAAC,GAAa,MAAAC,IAAO,MAAM,MAAAC,IAAO,WAAW,GAAGC,EAAA,GAASC,GAAK;AACjG,QAAMC,IAAUC,EAAA,GACVC,IAAU,GAAQJ,EAAM,YAAY,KAAKA,EAAM,iBAAiB,KAAKA,EAAM;AACjF,SACE,gBAAAK;AAAA,IAACb,EAAgB;AAAA,IAAhB;AAAA,MACC,KAAAS;AAAA,MACA,cAAYG,IAAU,SAAaP,KAAeK,EAAQ,OAAO;AAAA,MACjE,WAAWI;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACAR,MAAS,QAAQ;AAAA,QACjBA,MAAS,QAAQ;AAAA,QACjBA,MAAS,QAAQ;AAAA,QACjBC,MAAS,YACL,4EACA;AAAA,QACJH;AAAA,MAAA;AAAA,MAED,GAAGI;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAO,EAACf,EAAgB,OAAhB,EAAsB,aAAAK,EAAA,CAA0B;AAAA,QACjD,gBAAAU,EAACf,EAAgB,MAAhB,EAAqB,SAAO,IAC3B,UAAA,gBAAAe,EAACC,GAAA,EAAe,WAAU,0CAAyC,eAAW,GAAA,CAAC,EAAA,CACjF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;AACDd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UAAAR,GAAU,GAAGf,EAAA,GAASC,GAAK;AACvD,6BACGT,EAAgB,OAAhB,EAAsB,KAAAS,GAAW,GAAGD,GAClC,UAAA;AAAA,MAAAuB,KAAS,gBAAAhB,EAACU,KAAa,UAAAM,EAAA,CAAM;AAAA,MAC7BR;AAAA,IAAA,GACH;AAAA,EAEJ;AACF;AACAO,EAAY,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Separator.js","sources":["../../../src/components/ui/Separator.tsx"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"Separator.js","sources":["../../../src/components/ui/Separator.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from 'react';\nimport * as SeparatorPrimitive from '@radix-ui/react-separator';\nimport { cn } from '@/lib/utils';\n\n/**\n * Hairline divider. Decorative by default (no role announced). Pass\n * `decorative={false}` when the separator carries semantic meaning, e.g.\n * splitting two regions in a landmark.\n *\n * @example Section divider\n * <Separator className=\"my-6\" />\n *\n * @example Vertical inside a toolbar\n * <Separator orientation=\"vertical\" className=\"h-5 mx-2\" />\n */\nexport const Separator = forwardRef<\n ElementRef<typeof SeparatorPrimitive.Root>,\n ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(function Separator({ className, orientation = 'horizontal', decorative = true, ...props }, ref) {\n return (\n <SeparatorPrimitive.Root\n ref={ref}\n orientation={orientation}\n decorative={decorative}\n className={cn(\n 'bg-border shrink-0',\n orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',\n className,\n )}\n {...props}\n />\n );\n});\nSeparator.displayName = 'Separator';\n"],"names":["Separator","forwardRef","className","orientation","decorative","props","ref","jsx","SeparatorPrimitive","cn"],"mappings":";;;;;AAiBO,MAAMA,IAAYC,EAGvB,SAAmB,EAAE,WAAAC,GAAW,aAAAC,IAAc,cAAc,YAAAC,IAAa,IAAM,GAAGC,EAAA,GAASC,GAAK;AAChG,SACE,gBAAAC;AAAA,IAACC,EAAmB;AAAA,IAAnB;AAAA,MACC,KAAAF;AAAA,MACA,aAAAH;AAAA,MACA,YAAAC;AAAA,MACA,WAAWK;AAAA,QACT;AAAA,QACAN,MAAgB,eAAe,gBAAgB;AAAA,QAC/CD;AAAA,MAAA;AAAA,MAED,GAAGG;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AACDL,EAAU,cAAc;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentPropsWithoutRef, HTMLAttributes } from 'react';
|
|
2
2
|
import { VariantProps } from '../../lib/cva.js';
|
|
3
|
+
import { ReturnFocusRef } from '../../lib/return-focus.js';
|
|
3
4
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
5
|
export declare const Sheet: import('react').FC<DialogPrimitive.DialogProps>;
|
|
5
6
|
export declare const SheetTrigger: import('react').ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -10,6 +11,14 @@ declare const sheet: (props?: ({
|
|
|
10
11
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
11
12
|
export interface SheetContentProps extends ComponentPropsWithoutRef<typeof DialogPrimitive.Content>, VariantProps<typeof sheet> {
|
|
12
13
|
showClose?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Element to focus when the overlay closes. Overrides Radix's default
|
|
16
|
+
* (the element focused when the content mounted), which is `<body>` for
|
|
17
|
+
* controlled overlays opened from a pointer click on a non-focusable /
|
|
18
|
+
* tooltip-wrapped trigger. A consumer `onCloseAutoFocus` runs first and
|
|
19
|
+
* wins if it calls `preventDefault()`.
|
|
20
|
+
*/
|
|
21
|
+
returnFocusTo?: ReturnFocusRef;
|
|
13
22
|
}
|
|
14
23
|
export declare const SheetContent: import('react').ForwardRefExoticComponent<SheetContentProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
15
24
|
export declare function SheetHeader({ className, ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|