@cognite/aura 0.1.6 → 0.1.7
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/DESIGN.md +1269 -0
- package/README.md +24 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +49 -44
- package/dist/components/ui/core/alert/alert.d.ts +2 -1
- package/dist/components/ui/core/alert/alert.js +111 -87
- package/dist/components/ui/core/alert/alert.metadata.js +1 -1
- package/dist/components/ui/core/code-block/code-block.d.ts +4 -0
- package/dist/components/ui/core/code-block/code-block.js +200 -132
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +1 -1
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +43 -40
- package/dist/components/ui/core/scroll-area/scroll-area.d.ts +3 -0
- package/dist/components/ui/core/scroll-area/scroll-area.js +71 -0
- package/dist/components/ui/core/scroll-area/scroll-area.metadata.d.ts +2 -0
- package/dist/components/ui/core/scroll-area/scroll-area.metadata.js +9 -0
- package/dist/components/ui/core/tool/tool.js +31 -27
- package/dist/index.d.ts +1 -1
- package/dist/index.js +46 -41
- package/dist/styles.css +1 -1
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
Aura exports Cognite's UI components, styles, utilities, and ESLint guidance for preserving the design system in downstream apps.
|
|
4
4
|
|
|
5
|
+
## DESIGN.md (Google design.md linter)
|
|
6
|
+
|
|
7
|
+
[`DESIGN.md`](./DESIGN.md) is linted with [`@google/design.md`](https://www.npmjs.com/package/@google/design.md) (listed in this package’s `devDependencies`). After `pnpm install` in the Fusion workspace, run the CLI’s `lint` subcommand—no `dlx` needed.
|
|
8
|
+
|
|
9
|
+
Published installs ship this spec at the package root; you can resolve it as `@cognite/aura/DESIGN.md` (for example with `import.meta.resolve` or your bundler’s raw import).
|
|
10
|
+
|
|
11
|
+
From `fusion/libs/aura`:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pnpm exec design.md lint ./DESIGN.md
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
From the Fusion workspace root:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pnpm --filter @cognite/aura exec design.md lint ./DESIGN.md
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or with Nx:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
nx run aura:design-md-lint
|
|
27
|
+
```
|
|
28
|
+
|
|
5
29
|
## ESLint
|
|
6
30
|
|
|
7
31
|
Aura ships an ESLint plugin at `@cognite/aura/eslint`.
|
|
@@ -59,6 +59,8 @@ export { InlineCitationMetadata } from './ui/core/inline-citation/inline-citatio
|
|
|
59
59
|
export { InlineCitation, InlineCitationGroup, InlineCitationText, InlineCitationCard, InlineCitationCardTrigger, InlineCitationCardBody, InlineCitationSource, InlineCitationQuote, InlineCitationLink, type InlineCitationLinkProps, } from './ui/core/inline-citation/inline-citation';
|
|
60
60
|
export { Reasoning, ReasoningContent, ReasoningHeader, ReasoningItem, } from './ui/core/reasoning/reasoning';
|
|
61
61
|
export { ReasoningMetadata } from './ui/core/reasoning/reasoning.metadata';
|
|
62
|
+
export { ScrollArea, ScrollBar } from './ui/core/scroll-area/scroll-area';
|
|
63
|
+
export { ScrollAreaMetadata } from './ui/core/scroll-area/scroll-area.metadata';
|
|
62
64
|
export { Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverHeader, PopoverHeaderContent, PopoverSlot, PopoverTitle, PopoverTrigger, } from './ui/core/popover/popover';
|
|
63
65
|
export { PopoverMetadata } from './ui/core/popover/popover.metadata';
|
|
64
66
|
export { Sources, SourcesTitle, Source } from './ui/core/sources/sources';
|
package/dist/components/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Accordion as e, AccordionContent as r, AccordionItem as a, AccordionTrigger as n } from "./ui/core/accordion/accordion.js";
|
|
2
2
|
import { AccordionMetadata as m } from "./ui/core/accordion/accordion.metadata.js";
|
|
3
|
-
import { Card as
|
|
3
|
+
import { Card as l, CardActions as u, CardContent as i, CardDescription as C, CardFooter as x, CardHeader as I, CardHeaderRight as f, CardIcon as M, CardTitle as c } from "./ui/core/card/card.js";
|
|
4
4
|
import { CardMetadata as P } from "./ui/core/card/card.metadata.js";
|
|
5
|
-
import { Button as
|
|
5
|
+
import { Button as S, buttonVariants as T } from "./ui/core/button/button.js";
|
|
6
6
|
import { ButtonMetadata as B } from "./ui/core/button/button.metadata.js";
|
|
7
7
|
import { ButtonGroup as v, ButtonGroupSeparator as b, ButtonGroupText as w, buttonGroupVariants as G } from "./ui/core/button-group/button-group.js";
|
|
8
8
|
import { ButtonGroupMetadata as L } from "./ui/core/button-group/button-group.metadata.js";
|
|
@@ -18,11 +18,11 @@ import { Shimmer as _ } from "./ui/core/shimmer/shimmer.js";
|
|
|
18
18
|
import { ShimmerMetadata as oo } from "./ui/core/shimmer/shimmer.metadata.js";
|
|
19
19
|
import { CodeBlock as eo, CodeBlockCollapseButton as ro, CodeBlockCopyButton as ao, CodeBlockDownloadButton as no } from "./ui/core/code-block/code-block.js";
|
|
20
20
|
import { CodeBlockMetadata as mo } from "./ui/core/code-block/code-block.metadata.js";
|
|
21
|
-
import { Separator as
|
|
21
|
+
import { Separator as uo } from "./ui/core/separator/separator.js";
|
|
22
22
|
import { SeparatorMetadata as Co } from "./ui/core/separator/separator.metadata.js";
|
|
23
23
|
import { Tooltip as Io, TooltipContent as fo, TooltipProvider as Mo, TooltipTrigger as co } from "./ui/core/tooltip/tooltip.js";
|
|
24
24
|
import { TooltipMetadata as Po } from "./ui/core/tooltip/tooltip.metadata.js";
|
|
25
|
-
import { Tool as
|
|
25
|
+
import { Tool as So, ToolContent as To, ToolHeader as Do, ToolInput as Bo, ToolOutput as Ao } from "./ui/core/tool/tool.js";
|
|
26
26
|
import { ToolMetadata as bo } from "./ui/core/tool/tool.metadata.js";
|
|
27
27
|
import { DropdownMenu as Go, DropdownMenuCheckboxItem as Ho, DropdownMenuContent as Lo, DropdownMenuGroup as ko, DropdownMenuHeader as Ro, DropdownMenuItem as yo, DropdownMenuLabel as ho, DropdownMenuPortal as Vo, DropdownMenuRadioGroup as Fo, DropdownMenuRadioItem as Eo, DropdownMenuSectionLabel as Oo, DropdownMenuSeparator as Qo, DropdownMenuShortcut as Uo, DropdownMenuSub as jo, DropdownMenuSubContent as qo, DropdownMenuSubTrigger as zo, DropdownMenuTrigger as Jo } from "./ui/core/dropdown-menu/dropdown-menu.js";
|
|
28
28
|
import { DropdownMenuMetadata as No } from "./ui/core/dropdown-menu/dropdown-menu.metadata.js";
|
|
@@ -30,11 +30,11 @@ import { Badge as Xo, badgeVariants as Yo } from "./ui/core/badge/badge.js";
|
|
|
30
30
|
import { BadgeMetadata as _o } from "./ui/core/badge/badge.metadata.js";
|
|
31
31
|
import { Banner as ot, BannerAction as tt, BannerActions as et, BannerClose as rt, BannerIcon as at, BannerStatus as nt, BannerTitle as pt } from "./ui/core/banner/banner.js";
|
|
32
32
|
import { BannerMetadata as dt } from "./ui/core/banner/banner.metadata.js";
|
|
33
|
-
import { Collapsible as
|
|
33
|
+
import { Collapsible as ut, CollapsibleContent as it, CollapsibleTrigger as Ct } from "./ui/core/collapsible/collapsible.js";
|
|
34
34
|
import { CollapsibleMetadata as It } from "./ui/core/collapsible/collapsible.metadata.js";
|
|
35
35
|
import { HoverCard as Mt, HoverCardContent as ct, HoverCardTrigger as gt } from "./ui/core/hover-card/hover-card.js";
|
|
36
36
|
import { HoverCardMetadata as st } from "./ui/core/hover-card/hover-card.metadata.js";
|
|
37
|
-
import { Select as
|
|
37
|
+
import { Select as Tt, SelectContent as Dt, SelectGroup as Bt, SelectItem as At, SelectLabel as vt, SelectScrollDownButton as bt, SelectScrollUpButton as wt, SelectSeparator as Gt, SelectTrigger as Ht, SelectValue as Lt } from "./ui/core/select/select.js";
|
|
38
38
|
import { SelectMetadata as Rt } from "./ui/core/select/select.metadata.js";
|
|
39
39
|
import { Skeleton as ht } from "./ui/core/skeleton/skeleton.js";
|
|
40
40
|
import { SkeletonMetadata as Ft } from "./ui/core/skeleton/skeleton.metadata.js";
|
|
@@ -46,23 +46,25 @@ import { Textarea as Nt } from "./ui/core/textarea/textarea.js";
|
|
|
46
46
|
import { TextareaMetadata as Xt } from "./ui/core/textarea/textarea.metadata.js";
|
|
47
47
|
import { InputGroup as Zt, InputGroupAddon as _t, InputGroupButton as $t, InputGroupInput as oe, InputGroupText as te, InputGroupTextarea as ee } from "./ui/core/input-group/input-group.js";
|
|
48
48
|
import { InputGroupMetadata as ae } from "./ui/core/input-group/input-group.metadata.js";
|
|
49
|
-
import { Alert as pe, AlertActions as me, AlertButton as de, AlertClose as
|
|
49
|
+
import { Alert as pe, AlertActions as me, AlertButton as de, AlertClose as le, AlertDescription as ue, AlertTitle as ie } from "./ui/core/alert/alert.js";
|
|
50
50
|
import { AlertMetadata as xe } from "./ui/core/alert/alert.metadata.js";
|
|
51
51
|
import { Message as fe, MessageAction as Me, MessageActions as ce, MessageContent as ge, MessageResponse as Pe } from "./ui/core/message/message.js";
|
|
52
|
-
import { PromptInputMetadata as
|
|
52
|
+
import { PromptInputMetadata as Se } from "./ui/core/prompt-input/prompt-input.metadata.js";
|
|
53
53
|
import { PromptInput as De, PromptInputActionMenu as Be, PromptInputActionMenuContent as Ae, PromptInputActionMenuItem as ve, PromptInputActionMenuTrigger as be, PromptInputBody as we, PromptInputButton as Ge, PromptInputCommand as He, PromptInputCommandEmpty as Le, PromptInputCommandGroup as ke, PromptInputCommandInput as Re, PromptInputCommandItem as ye, PromptInputCommandList as he, PromptInputCommandSeparator as Ve, PromptInputFooter as Fe, PromptInputHeader as Ee, PromptInputHoverCard as Oe, PromptInputHoverCardContent as Qe, PromptInputHoverCardTrigger as Ue, PromptInputModelSelect as je, PromptInputModelSelectContent as qe, PromptInputModelSelectItem as ze, PromptInputModelSelectTrigger as Je, PromptInputModelSelectValue as Ke, PromptInputProvider as Ne, PromptInputSubmit as We, PromptInputTab as Xe, PromptInputTabBody as Ye, PromptInputTabItem as Ze, PromptInputTabLabel as _e, PromptInputTabsList as $e, PromptInputTextarea as or, PromptInputTools as tr, usePromptInputController as er } from "./ui/core/prompt-input/prompt-input.js";
|
|
54
|
-
import { Dialog as ar, DialogClose as nr, DialogContent as pr, DialogDescription as mr, DialogFooter as dr, DialogHeader as
|
|
54
|
+
import { Dialog as ar, DialogClose as nr, DialogContent as pr, DialogDescription as mr, DialogFooter as dr, DialogHeader as lr, DialogOverlay as ur, DialogPortal as ir, DialogTitle as Cr, DialogTrigger as xr } from "./ui/core/dialog/dialog.js";
|
|
55
55
|
import { DialogMetadata as fr } from "./ui/core/dialog/dialog.metadata.js";
|
|
56
|
-
import { Command as cr, CommandDialog as gr, CommandEmpty as Pr, CommandGroup as sr, CommandInput as
|
|
56
|
+
import { Command as cr, CommandDialog as gr, CommandEmpty as Pr, CommandGroup as sr, CommandInput as Sr, CommandItem as Tr, CommandList as Dr, CommandSeparator as Br, CommandShortcut as Ar } from "./ui/core/command/command.js";
|
|
57
57
|
import { CommandMetadata as br } from "./ui/core/command/command.metadata.js";
|
|
58
58
|
import { InlineCitationMetadata as Gr } from "./ui/core/inline-citation/inline-citation.metadata.js";
|
|
59
59
|
import { InlineCitation as Lr, InlineCitationCard as kr, InlineCitationCardBody as Rr, InlineCitationCardTrigger as yr, InlineCitationGroup as hr, InlineCitationLink as Vr, InlineCitationQuote as Fr, InlineCitationSource as Er, InlineCitationText as Or } from "./ui/core/inline-citation/inline-citation.js";
|
|
60
60
|
import { Reasoning as Ur, ReasoningContent as jr, ReasoningHeader as qr, ReasoningItem as zr } from "./ui/core/reasoning/reasoning.js";
|
|
61
61
|
import { ReasoningMetadata as Kr } from "./ui/core/reasoning/reasoning.metadata.js";
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
62
|
+
import { ScrollArea as Wr, ScrollBar as Xr } from "./ui/core/scroll-area/scroll-area.js";
|
|
63
|
+
import { ScrollAreaMetadata as Zr } from "./ui/core/scroll-area/scroll-area.metadata.js";
|
|
64
|
+
import { Popover as $r, PopoverClose as oa, PopoverContent as ta, PopoverDescription as ea, PopoverHeader as ra, PopoverHeaderContent as aa, PopoverSlot as na, PopoverTitle as pa, PopoverTrigger as ma } from "./ui/core/popover/popover.js";
|
|
65
|
+
import { PopoverMetadata as la } from "./ui/core/popover/popover.metadata.js";
|
|
66
|
+
import { Source as ia, Sources as Ca, SourcesTitle as xa } from "./ui/core/sources/sources.js";
|
|
67
|
+
import { PortalContainerContext as fa } from "../lib/portal-container-context.js";
|
|
66
68
|
export {
|
|
67
69
|
e as Accordion,
|
|
68
70
|
r as AccordionContent,
|
|
@@ -72,8 +74,8 @@ export {
|
|
|
72
74
|
pe as Alert,
|
|
73
75
|
me as AlertActions,
|
|
74
76
|
de as AlertButton,
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
le as AlertClose,
|
|
78
|
+
ue as AlertDescription,
|
|
77
79
|
xe as AlertMetadata,
|
|
78
80
|
ie as AlertTitle,
|
|
79
81
|
R as Avatar,
|
|
@@ -91,14 +93,14 @@ export {
|
|
|
91
93
|
dt as BannerMetadata,
|
|
92
94
|
nt as BannerStatus,
|
|
93
95
|
pt as BannerTitle,
|
|
94
|
-
|
|
96
|
+
S as Button,
|
|
95
97
|
v as ButtonGroup,
|
|
96
98
|
L as ButtonGroupMetadata,
|
|
97
99
|
b as ButtonGroupSeparator,
|
|
98
100
|
w as ButtonGroupText,
|
|
99
101
|
B as ButtonMetadata,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
l as Card,
|
|
103
|
+
u as CardActions,
|
|
102
104
|
i as CardContent,
|
|
103
105
|
C as CardDescription,
|
|
104
106
|
x as CardFooter,
|
|
@@ -112,7 +114,7 @@ export {
|
|
|
112
114
|
ao as CodeBlockCopyButton,
|
|
113
115
|
no as CodeBlockDownloadButton,
|
|
114
116
|
mo as CodeBlockMetadata,
|
|
115
|
-
|
|
117
|
+
ut as Collapsible,
|
|
116
118
|
it as CollapsibleContent,
|
|
117
119
|
It as CollapsibleMetadata,
|
|
118
120
|
Ct as CollapsibleTrigger,
|
|
@@ -120,8 +122,8 @@ export {
|
|
|
120
122
|
gr as CommandDialog,
|
|
121
123
|
Pr as CommandEmpty,
|
|
122
124
|
sr as CommandGroup,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
Sr as CommandInput,
|
|
126
|
+
Tr as CommandItem,
|
|
125
127
|
Dr as CommandList,
|
|
126
128
|
br as CommandMetadata,
|
|
127
129
|
Br as CommandSeparator,
|
|
@@ -131,9 +133,9 @@ export {
|
|
|
131
133
|
pr as DialogContent,
|
|
132
134
|
mr as DialogDescription,
|
|
133
135
|
dr as DialogFooter,
|
|
134
|
-
|
|
136
|
+
lr as DialogHeader,
|
|
135
137
|
fr as DialogMetadata,
|
|
136
|
-
|
|
138
|
+
ur as DialogOverlay,
|
|
137
139
|
ir as DialogPortal,
|
|
138
140
|
Cr as DialogTitle,
|
|
139
141
|
xr as DialogTrigger,
|
|
@@ -189,17 +191,17 @@ export {
|
|
|
189
191
|
ce as MessageActions,
|
|
190
192
|
ge as MessageContent,
|
|
191
193
|
Pe as MessageResponse,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
194
|
+
$r as Popover,
|
|
195
|
+
oa as PopoverClose,
|
|
196
|
+
ta as PopoverContent,
|
|
197
|
+
ea as PopoverDescription,
|
|
198
|
+
ra as PopoverHeader,
|
|
199
|
+
aa as PopoverHeaderContent,
|
|
200
|
+
la as PopoverMetadata,
|
|
201
|
+
na as PopoverSlot,
|
|
202
|
+
pa as PopoverTitle,
|
|
203
|
+
ma as PopoverTrigger,
|
|
204
|
+
fa as PortalContainerContext,
|
|
203
205
|
qt as Progress,
|
|
204
206
|
Jt as ProgressMetadata,
|
|
205
207
|
De as PromptInput,
|
|
@@ -221,7 +223,7 @@ export {
|
|
|
221
223
|
Oe as PromptInputHoverCard,
|
|
222
224
|
Qe as PromptInputHoverCardContent,
|
|
223
225
|
Ue as PromptInputHoverCardTrigger,
|
|
224
|
-
|
|
226
|
+
Se as PromptInputMetadata,
|
|
225
227
|
je as PromptInputModelSelect,
|
|
226
228
|
qe as PromptInputModelSelectContent,
|
|
227
229
|
ze as PromptInputModelSelectItem,
|
|
@@ -241,7 +243,10 @@ export {
|
|
|
241
243
|
qr as ReasoningHeader,
|
|
242
244
|
zr as ReasoningItem,
|
|
243
245
|
Kr as ReasoningMetadata,
|
|
244
|
-
|
|
246
|
+
Wr as ScrollArea,
|
|
247
|
+
Zr as ScrollAreaMetadata,
|
|
248
|
+
Xr as ScrollBar,
|
|
249
|
+
Tt as Select,
|
|
245
250
|
Dt as SelectContent,
|
|
246
251
|
Bt as SelectGroup,
|
|
247
252
|
At as SelectItem,
|
|
@@ -252,19 +257,19 @@ export {
|
|
|
252
257
|
Gt as SelectSeparator,
|
|
253
258
|
Ht as SelectTrigger,
|
|
254
259
|
Lt as SelectValue,
|
|
255
|
-
|
|
260
|
+
uo as Separator,
|
|
256
261
|
Co as SeparatorMetadata,
|
|
257
262
|
_ as Shimmer,
|
|
258
263
|
oo as ShimmerMetadata,
|
|
259
264
|
ht as Skeleton,
|
|
260
265
|
Ft as SkeletonMetadata,
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
266
|
+
ia as Source,
|
|
267
|
+
Ca as Sources,
|
|
268
|
+
xa as SourcesTitle,
|
|
264
269
|
Nt as Textarea,
|
|
265
270
|
Xt as TextareaMetadata,
|
|
266
|
-
|
|
267
|
-
|
|
271
|
+
So as Tool,
|
|
272
|
+
To as ToolContent,
|
|
268
273
|
Do as ToolHeader,
|
|
269
274
|
Bo as ToolInput,
|
|
270
275
|
bo as ToolMetadata,
|
|
@@ -276,6 +281,6 @@ export {
|
|
|
276
281
|
co as TooltipTrigger,
|
|
277
282
|
Yo as badgeVariants,
|
|
278
283
|
G as buttonGroupVariants,
|
|
279
|
-
|
|
284
|
+
T as buttonVariants,
|
|
280
285
|
er as usePromptInputController
|
|
281
286
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
3
|
type AlertVariant = 'default' | 'secondary' | 'warning' | 'error';
|
|
4
4
|
declare const alertVariants: (props?: ({
|
|
@@ -9,6 +9,7 @@ type AlertProps = ComponentProps<'div'> & Omit<VariantProps<typeof alertVariants
|
|
|
9
9
|
visible?: boolean;
|
|
10
10
|
defaultVisible?: boolean;
|
|
11
11
|
onClose?: () => void;
|
|
12
|
+
icon?: ReactNode;
|
|
12
13
|
};
|
|
13
14
|
declare const Alert: import('react').ForwardRefExoticComponent<Omit<AlertProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
14
15
|
declare const AlertTitle: import('react').ForwardRefExoticComponent<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,134 +1,158 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { IconX as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { useControllableState as
|
|
1
|
+
import { jsx as e, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as N, forwardRef as n, useMemo as k, useContext as u } from "react";
|
|
3
|
+
import { IconX as C, IconInfoCircle as I, IconAlertHexagon as V, IconAlertTriangle as _ } from "@tabler/icons-react";
|
|
4
|
+
import { cva as h } from "class-variance-authority";
|
|
5
|
+
import { useControllableState as z } from "../../../../lib/use-controllable-state.js";
|
|
6
6
|
import { cn as s } from "../../../../lib/utils.js";
|
|
7
|
-
import { Button as
|
|
8
|
-
const
|
|
7
|
+
import { Button as x } from "../button/button.js";
|
|
8
|
+
const i = N({
|
|
9
9
|
show: !0,
|
|
10
10
|
setShow: () => {
|
|
11
11
|
},
|
|
12
12
|
variant: "default"
|
|
13
|
-
}),
|
|
14
|
-
|
|
13
|
+
}), j = h(
|
|
14
|
+
[
|
|
15
|
+
"[&_svg]:shrink-0",
|
|
16
|
+
"[&_svg:not([class*='size-']):not([class*='w-'])]:w-3.5",
|
|
17
|
+
"[&_svg:not([class*='size-']):not([class*='h-'])]:h-3.5",
|
|
18
|
+
"[&_svg:not([class*='mt-'])]:mt-0.5"
|
|
19
|
+
].join(" ")
|
|
20
|
+
), D = h(
|
|
21
|
+
"relative w-full rounded-md pt-2.5 pr-3 has-[>button[data-slot=alert-close]]:pr-12 pb-2 pl-3 text-sm grid has-[>[data-slot=alert-icon]]:grid-cols-[auto_1fr] grid-cols-[0_1fr] has-[>[data-slot=alert-icon]]:gap-x-2 has-[>[data-slot=alert-icon]]:gap-y-1 items-start",
|
|
15
22
|
{
|
|
16
23
|
variants: {
|
|
17
24
|
variant: {
|
|
18
|
-
default: "bg-neutral-muted-background text-foreground [&>
|
|
19
|
-
secondary: "bg-info-muted-background text-foreground [&>
|
|
20
|
-
warning: "bg-warning-muted-background [&>
|
|
21
|
-
error: "bg-destructive-muted-background text-foreground [&>
|
|
25
|
+
default: "bg-neutral-muted-background text-foreground [&>[data-slot=alert-icon]]:text-info-foreground",
|
|
26
|
+
secondary: "bg-info-muted-background text-foreground [&>[data-slot=alert-icon]]:text-info-foreground",
|
|
27
|
+
warning: "bg-warning-muted-background [&>[data-slot=alert-icon]]:text-warning-foreground",
|
|
28
|
+
error: "bg-destructive-muted-background text-foreground [&>[data-slot=alert-icon]]:text-destructive-foreground"
|
|
22
29
|
}
|
|
23
30
|
},
|
|
24
31
|
defaultVariants: {
|
|
25
32
|
variant: "default"
|
|
26
33
|
}
|
|
27
34
|
}
|
|
28
|
-
)
|
|
35
|
+
);
|
|
36
|
+
function S(r) {
|
|
37
|
+
const t = { "aria-hidden": !0 };
|
|
38
|
+
switch (r) {
|
|
39
|
+
case "warning":
|
|
40
|
+
return /* @__PURE__ */ e(_, { ...t });
|
|
41
|
+
case "error":
|
|
42
|
+
return /* @__PURE__ */ e(V, { ...t });
|
|
43
|
+
default:
|
|
44
|
+
return /* @__PURE__ */ e(I, { ...t });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const T = n(
|
|
29
48
|
({
|
|
30
|
-
className:
|
|
31
|
-
variant:
|
|
32
|
-
visible:
|
|
49
|
+
className: r,
|
|
50
|
+
variant: t = "default",
|
|
51
|
+
visible: a,
|
|
33
52
|
defaultVisible: o = !0,
|
|
34
|
-
onClose:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
53
|
+
onClose: l,
|
|
54
|
+
icon: c,
|
|
55
|
+
children: g,
|
|
56
|
+
...w
|
|
57
|
+
}, A) => {
|
|
58
|
+
const [f, m] = z({
|
|
39
59
|
defaultProp: o,
|
|
40
|
-
prop:
|
|
41
|
-
onChange:
|
|
42
|
-
}),
|
|
43
|
-
() => ({ show:
|
|
44
|
-
[
|
|
60
|
+
prop: a,
|
|
61
|
+
onChange: l
|
|
62
|
+
}), d = t ?? "default", y = k(
|
|
63
|
+
() => ({ show: f, setShow: m, variant: d }),
|
|
64
|
+
[f, m, d]
|
|
45
65
|
);
|
|
46
|
-
|
|
66
|
+
if (!f)
|
|
67
|
+
return null;
|
|
68
|
+
const v = c !== void 0 ? c : S(d);
|
|
69
|
+
return /* @__PURE__ */ e(i.Provider, { value: y, children: /* @__PURE__ */ p(
|
|
47
70
|
"div",
|
|
48
71
|
{
|
|
49
|
-
ref:
|
|
72
|
+
ref: A,
|
|
50
73
|
"data-slot": "alert",
|
|
51
74
|
role: "alert",
|
|
52
|
-
className: s(
|
|
53
|
-
...
|
|
75
|
+
className: s(D({ variant: d }), r),
|
|
76
|
+
...w,
|
|
54
77
|
children: [
|
|
55
|
-
|
|
56
|
-
|
|
78
|
+
l && /* @__PURE__ */ e(b, {}),
|
|
79
|
+
v && /* @__PURE__ */ e("span", { "data-slot": "alert-icon", className: j(), children: v }),
|
|
80
|
+
g
|
|
57
81
|
]
|
|
58
82
|
}
|
|
59
|
-
) })
|
|
83
|
+
) });
|
|
60
84
|
}
|
|
61
85
|
);
|
|
62
|
-
|
|
63
|
-
const
|
|
86
|
+
T.displayName = "Alert";
|
|
87
|
+
const B = {
|
|
64
88
|
default: "text-info-foreground",
|
|
65
89
|
secondary: "text-info-foreground",
|
|
66
90
|
warning: "text-warning-foreground",
|
|
67
91
|
error: "text-destructive-foreground"
|
|
68
|
-
},
|
|
69
|
-
({ className:
|
|
70
|
-
const { variant: o } =
|
|
71
|
-
return /* @__PURE__ */
|
|
92
|
+
}, P = n(
|
|
93
|
+
({ className: r, ...t }, a) => {
|
|
94
|
+
const { variant: o } = u(i);
|
|
95
|
+
return /* @__PURE__ */ e(
|
|
72
96
|
"div",
|
|
73
97
|
{
|
|
74
|
-
ref:
|
|
98
|
+
ref: a,
|
|
75
99
|
"data-slot": "alert-title",
|
|
76
100
|
className: s(
|
|
77
|
-
"text-base font-medium leading-5 tracking-tightest",
|
|
78
|
-
|
|
79
|
-
|
|
101
|
+
"col-start-2 text-base font-medium leading-5 tracking-tightest",
|
|
102
|
+
B[o],
|
|
103
|
+
r
|
|
80
104
|
),
|
|
81
|
-
...
|
|
105
|
+
...t
|
|
82
106
|
}
|
|
83
107
|
);
|
|
84
108
|
}
|
|
85
109
|
);
|
|
86
|
-
|
|
87
|
-
const
|
|
110
|
+
P.displayName = "AlertTitle";
|
|
111
|
+
const H = {
|
|
88
112
|
default: "text-foreground",
|
|
89
113
|
secondary: "text-foreground",
|
|
90
114
|
warning: "text-foreground",
|
|
91
115
|
error: "text-foreground"
|
|
92
|
-
},
|
|
93
|
-
({ className:
|
|
94
|
-
const { variant: o } =
|
|
95
|
-
return /* @__PURE__ */
|
|
116
|
+
}, M = n(
|
|
117
|
+
({ className: r, ...t }, a) => {
|
|
118
|
+
const { variant: o } = u(i);
|
|
119
|
+
return /* @__PURE__ */ e(
|
|
96
120
|
"div",
|
|
97
121
|
{
|
|
98
|
-
ref:
|
|
122
|
+
ref: a,
|
|
99
123
|
"data-slot": "alert-description",
|
|
100
124
|
className: s(
|
|
101
125
|
"col-start-2 grid justify-items-start gap-1 text-sm font-normal leading-4.5 tracking-tight items-center",
|
|
102
|
-
|
|
103
|
-
|
|
126
|
+
H[o],
|
|
127
|
+
r
|
|
104
128
|
),
|
|
105
|
-
...
|
|
129
|
+
...t
|
|
106
130
|
}
|
|
107
131
|
);
|
|
108
132
|
}
|
|
109
133
|
);
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
({ className:
|
|
134
|
+
M.displayName = "AlertDescription";
|
|
135
|
+
const R = n(
|
|
136
|
+
({ className: r, ...t }, a) => /* @__PURE__ */ e(
|
|
113
137
|
"div",
|
|
114
138
|
{
|
|
115
|
-
ref:
|
|
139
|
+
ref: a,
|
|
116
140
|
"data-slot": "alert-actions",
|
|
117
141
|
className: s(
|
|
118
142
|
"col-start-2 flex flex-wrap items-start gap-2 pt-1",
|
|
119
|
-
|
|
143
|
+
r
|
|
120
144
|
),
|
|
121
|
-
...
|
|
145
|
+
...t
|
|
122
146
|
}
|
|
123
147
|
)
|
|
124
148
|
);
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
const { variant: o } =
|
|
128
|
-
return /* @__PURE__ */
|
|
129
|
-
|
|
149
|
+
R.displayName = "AlertActions";
|
|
150
|
+
const X = n(({ className: r, ...t }, a) => {
|
|
151
|
+
const { variant: o } = u(i);
|
|
152
|
+
return /* @__PURE__ */ e(
|
|
153
|
+
x,
|
|
130
154
|
{
|
|
131
|
-
ref:
|
|
155
|
+
ref: a,
|
|
132
156
|
"data-slot": "alert-button",
|
|
133
157
|
variant: "ghost",
|
|
134
158
|
size: "sm",
|
|
@@ -137,19 +161,19 @@ const T = n(({ className: t, ...r }, e) => {
|
|
|
137
161
|
secondary: "hover:bg-info-background-hover",
|
|
138
162
|
warning: "hover:bg-warning-background-hover",
|
|
139
163
|
error: "hover:bg-destructive-background-hover"
|
|
140
|
-
}[o],
|
|
141
|
-
...
|
|
164
|
+
}[o], r),
|
|
165
|
+
...t
|
|
142
166
|
}
|
|
143
167
|
);
|
|
144
168
|
});
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
({ className:
|
|
148
|
-
const { setShow:
|
|
149
|
-
|
|
169
|
+
X.displayName = "AlertButton";
|
|
170
|
+
const b = n(
|
|
171
|
+
({ className: r, onClick: t, ...a }, o) => {
|
|
172
|
+
const { setShow: l } = u(i), c = (g) => {
|
|
173
|
+
l(!1), t?.(g);
|
|
150
174
|
};
|
|
151
|
-
return /* @__PURE__ */
|
|
152
|
-
|
|
175
|
+
return /* @__PURE__ */ p(
|
|
176
|
+
x,
|
|
153
177
|
{
|
|
154
178
|
ref: o,
|
|
155
179
|
"data-slot": "alert-close",
|
|
@@ -157,24 +181,24 @@ const h = n(
|
|
|
157
181
|
size: "icon-sm",
|
|
158
182
|
className: s(
|
|
159
183
|
"absolute top-3 right-4 h-3.5 w-3.5 p-0 opacity-70 hover:opacity-100 text-foreground",
|
|
160
|
-
|
|
184
|
+
r
|
|
161
185
|
),
|
|
162
186
|
onClick: c,
|
|
163
|
-
...
|
|
187
|
+
...a,
|
|
164
188
|
children: [
|
|
165
|
-
/* @__PURE__ */
|
|
166
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ e(C, { size: 14 }),
|
|
190
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: "Close" })
|
|
167
191
|
]
|
|
168
192
|
}
|
|
169
193
|
);
|
|
170
194
|
}
|
|
171
195
|
);
|
|
172
|
-
|
|
196
|
+
b.displayName = "AlertClose";
|
|
173
197
|
export {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
198
|
+
T as Alert,
|
|
199
|
+
R as AlertActions,
|
|
200
|
+
X as AlertButton,
|
|
201
|
+
b as AlertClose,
|
|
202
|
+
M as AlertDescription,
|
|
203
|
+
P as AlertTitle
|
|
180
204
|
};
|
|
@@ -2,7 +2,7 @@ const e = {
|
|
|
2
2
|
name: "Alert",
|
|
3
3
|
status: "in-progress-code-review",
|
|
4
4
|
description: "A dismissible alert component with multiple variants for displaying messages.",
|
|
5
|
-
llmUsage: "Use `<Alert>` with `<AlertTitle>` and `<AlertDescription
|
|
5
|
+
llmUsage: "Use `<Alert>` with optional `icon` prop (defaults to a variant-appropriate icon), plus `<AlertTitle>` and `<AlertDescription>`, for informational messages. Pass `icon={null}` to suppress the icon."
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
8
8
|
e as AlertMetadata
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ComponentProps, HTMLAttributes } from 'react';
|
|
2
2
|
import { BundledLanguage } from 'shiki';
|
|
3
3
|
import { Button } from '../button/button';
|
|
4
|
+
export declare function getCollapsedPreviewDisplay(code: string): string;
|
|
5
|
+
export declare function isContentLargerThanPreview(code: string): boolean;
|
|
6
|
+
export declare function shouldUsePlainTextInsteadOfShiki(code: string, lineCount: number): boolean;
|
|
7
|
+
export declare function plainPreMarkup(code: string): string;
|
|
4
8
|
declare const CodeBlock: import('react').ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
5
9
|
code: string;
|
|
6
10
|
copyText?: string;
|