@ngrok/mantle 0.32.0 → 0.32.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.d.ts +143 -2
- package/dist/accordion.js +1 -1
- package/dist/accordion.js.map +1 -1
- package/dist/alert-dialog.d.ts +1 -1
- package/dist/alert-dialog.js +1 -1
- package/dist/alert-dialog.js.map +1 -1
- package/dist/alert.d.ts +5 -2
- package/dist/alert.js +1 -1
- package/dist/alert.js.map +1 -1
- package/dist/anchor.d.ts +1 -1
- package/dist/anchor.js +1 -1
- package/dist/anchor.js.map +1 -1
- package/dist/badge.d.ts +4 -1
- package/dist/badge.js +1 -1
- package/dist/badge.js.map +1 -1
- package/dist/{button-C8eGiHOm.d.ts → button-BvWgeelK.d.ts} +8 -1
- package/dist/{button-group-CpDp0fYZ.d.ts → button-group-7oT-O90J.d.ts} +11 -0
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +17 -0
- package/dist/calendar.js +1 -1
- package/dist/calendar.js.map +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.js.map +1 -1
- package/dist/{chunk-7XIZZ4HQ.js → chunk-3H3EUKI7.js} +1 -1
- package/dist/chunk-3H3EUKI7.js.map +1 -0
- package/dist/{chunk-ZXLA5BJX.js → chunk-3X4AKTRA.js} +2 -2
- package/dist/chunk-3X4AKTRA.js.map +1 -0
- package/dist/chunk-6RJ2G2DK.js +34 -0
- package/dist/chunk-6RJ2G2DK.js.map +1 -0
- package/dist/chunk-I6T6YV2L.js +2 -0
- package/dist/chunk-I6T6YV2L.js.map +1 -0
- package/dist/chunk-IVXZIYX4.js +2 -0
- package/dist/chunk-IVXZIYX4.js.map +1 -0
- package/dist/chunk-J6ZF5J72.js +2 -0
- package/dist/chunk-J6ZF5J72.js.map +1 -0
- package/dist/chunk-JIRNFNH5.js +2 -0
- package/dist/{chunk-72UMV3YP.js.map → chunk-JIRNFNH5.js.map} +1 -1
- package/dist/chunk-NPTDRQT5.js +2 -0
- package/dist/chunk-NPTDRQT5.js.map +1 -0
- package/dist/chunk-NRMIFYYG.js +2 -0
- package/dist/chunk-NRMIFYYG.js.map +1 -0
- package/dist/{chunk-VTCWSFFJ.js → chunk-PANPBV3Q.js} +2 -2
- package/dist/{chunk-VTCWSFFJ.js.map → chunk-PANPBV3Q.js.map} +1 -1
- package/dist/{chunk-BK4P33ZH.js → chunk-RTXWW6ND.js} +2 -2
- package/dist/{chunk-BK4P33ZH.js.map → chunk-RTXWW6ND.js.map} +1 -1
- package/dist/{chunk-3MDQ3LC2.js → chunk-W2YQRWR5.js} +2 -2
- package/dist/{chunk-3MDQ3LC2.js.map → chunk-W2YQRWR5.js.map} +1 -1
- package/dist/code-block.d.ts +3 -0
- package/dist/code-block.js +3 -3
- package/dist/code-block.js.map +1 -1
- package/dist/combobox.d.ts +4 -1
- package/dist/combobox.js +1 -1
- package/dist/combobox.js.map +1 -1
- package/dist/data-table.d.ts +41 -12
- package/dist/data-table.js +1 -1
- package/dist/data-table.js.map +1 -1
- package/dist/dialog.d.ts +256 -3
- package/dist/dialog.js +1 -1
- package/dist/dialog.js.map +1 -1
- package/dist/dropdown-menu.d.ts +80 -0
- package/dist/dropdown-menu.js +1 -1
- package/dist/dropdown-menu.js.map +1 -1
- package/dist/flag.d.ts +4 -1
- package/dist/flag.js +1 -1
- package/dist/flag.js.map +1 -1
- package/dist/hover-card.d.ts +58 -0
- package/dist/hover-card.js +1 -1
- package/dist/hover-card.js.map +1 -1
- package/dist/{icon-Cu-iYUjr.d.ts → icon-CkvpQ4BK.d.ts} +1 -7
- package/dist/{icon-button-D41yiI7H.d.ts → icon-button-D4BTvC7F.d.ts} +12 -1
- package/dist/icon.d.ts +2 -2
- package/dist/icon.js +1 -1
- package/dist/icons.d.ts +9 -0
- package/dist/icons.js +1 -1
- package/dist/icons.js.map +1 -1
- package/dist/inline-code.d.ts +10 -1
- package/dist/inline-code.js.map +1 -1
- package/dist/input.d.ts +39 -1
- package/dist/input.js +1 -1
- package/dist/input.js.map +1 -1
- package/dist/label.d.ts +1 -1
- package/dist/label.js.map +1 -1
- package/dist/pagination.d.ts +51 -1
- package/dist/pagination.js +1 -1
- package/dist/pagination.js.map +1 -1
- package/dist/popover.d.ts +77 -17
- package/dist/popover.js.map +1 -1
- package/dist/{primitive-hud69IM9.d.ts → primitive-BUbUB7RS.d.ts} +3 -0
- package/dist/progress.d.ts +14 -2
- package/dist/progress.js +1 -1
- package/dist/progress.js.map +1 -1
- package/dist/radio-group.d.ts +51 -3
- package/dist/radio-group.js +1 -1
- package/dist/radio-group.js.map +1 -1
- package/dist/sandboxed-on-click.d.ts +0 -3
- package/dist/sandboxed-on-click.js.map +1 -1
- package/dist/select.d.ts +8 -4
- package/dist/select.js +1 -1
- package/dist/separator.d.ts +4 -1
- package/dist/separator.js +1 -1
- package/dist/sheet.d.ts +18 -6
- package/dist/sheet.js +1 -1
- package/dist/sheet.js.map +1 -1
- package/dist/{svg-only-CS2INnEL.d.ts → svg-only-Bj2yffO4.d.ts} +7 -7
- package/dist/switch.d.ts +2 -2
- package/dist/switch.js.map +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +104 -1
- package/dist/tabs.js +1 -1
- package/dist/tabs.js.map +1 -1
- package/dist/text-area.d.ts +2 -1
- package/dist/text-area.js.map +1 -1
- package/dist/theme-provider.d.ts +29 -5
- package/dist/theme-provider.js +1 -1
- package/dist/toast.d.ts +70 -2
- package/dist/toast.js +1 -1
- package/dist/tooltip.d.ts +53 -13
- package/dist/tooltip.js +1 -1
- package/dist/tooltip.js.map +1 -1
- package/package.json +9 -9
- package/dist/chunk-3XX7M573.js +0 -34
- package/dist/chunk-3XX7M573.js.map +0 -1
- package/dist/chunk-72UMV3YP.js +0 -2
- package/dist/chunk-7XIZZ4HQ.js.map +0 -1
- package/dist/chunk-BGY3DO4G.js +0 -2
- package/dist/chunk-BGY3DO4G.js.map +0 -1
- package/dist/chunk-HDPLH5HC.js +0 -2
- package/dist/chunk-HDPLH5HC.js.map +0 -1
- package/dist/chunk-HVMKFNT3.js +0 -2
- package/dist/chunk-HVMKFNT3.js.map +0 -1
- package/dist/chunk-UXH22BMO.js +0 -2
- package/dist/chunk-UXH22BMO.js.map +0 -1
- package/dist/chunk-XQVVOOLT.js +0 -2
- package/dist/chunk-XQVVOOLT.js.map +0 -1
- package/dist/chunk-ZXLA5BJX.js.map +0 -1
package/dist/accordion.d.ts
CHANGED
|
@@ -2,14 +2,155 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ComponentPropsWithoutRef } from 'react';
|
|
4
4
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
5
|
-
import { a as IconProps } from './icon-
|
|
5
|
+
import { a as IconProps } from './icon-CkvpQ4BK.js';
|
|
6
6
|
import './types-BuKAGhC-.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* A vertically stacked set of interactive headings that each reveal a section of content.
|
|
10
|
+
* The root component that contains all accordion items.
|
|
11
|
+
*
|
|
12
|
+
* @see https://mantle.ngrok.com/components/accordion#api-accordion
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <Accordion type="single" collapsible>
|
|
17
|
+
* <AccordionItem value="item-1">
|
|
18
|
+
* <AccordionHeading>
|
|
19
|
+
* <AccordionTrigger>
|
|
20
|
+
* <AccordionTriggerIcon />
|
|
21
|
+
* Is it accessible?
|
|
22
|
+
* </AccordionTrigger>
|
|
23
|
+
* </AccordionHeading>
|
|
24
|
+
* <AccordionContent>
|
|
25
|
+
* Yes. It adheres to the WAI-ARIA design pattern.
|
|
26
|
+
* </AccordionContent>
|
|
27
|
+
* </AccordionItem>
|
|
28
|
+
* </Accordion>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
8
31
|
declare const Accordion: react.ForwardRefExoticComponent<ComponentPropsWithoutRef<react.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & react.RefAttributes<HTMLDivElement>>> & react.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
/**
|
|
33
|
+
* Contains all the parts of a collapsible section.
|
|
34
|
+
* A single accordion item that can be expanded or collapsed.
|
|
35
|
+
*
|
|
36
|
+
* @see https://mantle.ngrok.com/components/accordion#api-accordion-item
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* <Accordion type="single" collapsible>
|
|
41
|
+
* <AccordionItem value="item-1">
|
|
42
|
+
* <AccordionHeading>
|
|
43
|
+
* <AccordionTrigger>
|
|
44
|
+
* <AccordionTriggerIcon />
|
|
45
|
+
* Is it accessible?
|
|
46
|
+
* </AccordionTrigger>
|
|
47
|
+
* </AccordionHeading>
|
|
48
|
+
* <AccordionContent>
|
|
49
|
+
* Yes. It adheres to the WAI-ARIA design pattern.
|
|
50
|
+
* </AccordionContent>
|
|
51
|
+
* </AccordionItem>
|
|
52
|
+
* </Accordion>
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
9
55
|
declare const AccordionItem: react.ForwardRefExoticComponent<AccordionPrimitive.AccordionItemProps & react.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
/**
|
|
57
|
+
* Wraps an AccordionTrigger.
|
|
58
|
+
* Contains the accordion trigger and provides proper heading semantics.
|
|
59
|
+
*
|
|
60
|
+
* @see https://mantle.ngrok.com/components/accordion#api-accordion-heading
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```tsx
|
|
64
|
+
* <Accordion type="single" collapsible>
|
|
65
|
+
* <AccordionItem value="item-1">
|
|
66
|
+
* <AccordionHeading>
|
|
67
|
+
* <AccordionTrigger>
|
|
68
|
+
* <AccordionTriggerIcon />
|
|
69
|
+
* Is it accessible?
|
|
70
|
+
* </AccordionTrigger>
|
|
71
|
+
* </AccordionHeading>
|
|
72
|
+
* <AccordionContent>
|
|
73
|
+
* Yes. It adheres to the WAI-ARIA design pattern.
|
|
74
|
+
* </AccordionContent>
|
|
75
|
+
* </AccordionItem>
|
|
76
|
+
* </Accordion>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
10
79
|
declare const AccordionHeading: react.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionHeaderProps & react.RefAttributes<HTMLHeadingElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
80
|
+
/**
|
|
81
|
+
* Toggles the collapsed state of its associated item.
|
|
82
|
+
* The interactive element that expands or collapses the accordion content.
|
|
83
|
+
*
|
|
84
|
+
* @see https://mantle.ngrok.com/components/accordion#api-accordion-trigger
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <Accordion type="single" collapsible>
|
|
89
|
+
* <AccordionItem value="item-1">
|
|
90
|
+
* <AccordionHeading>
|
|
91
|
+
* <AccordionTrigger>
|
|
92
|
+
* <AccordionTriggerIcon />
|
|
93
|
+
* Is it accessible?
|
|
94
|
+
* </AccordionTrigger>
|
|
95
|
+
* </AccordionHeading>
|
|
96
|
+
* <AccordionContent>
|
|
97
|
+
* Yes. It adheres to the WAI-ARIA design pattern.
|
|
98
|
+
* </AccordionContent>
|
|
99
|
+
* </AccordionItem>
|
|
100
|
+
* </Accordion>
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
11
103
|
declare const AccordionTrigger: react.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & react.RefAttributes<HTMLButtonElement>, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
12
|
-
|
|
104
|
+
/**
|
|
105
|
+
* An icon that indicates the expanded/collapsed state of the accordion trigger.
|
|
106
|
+
* Rotates based on the accordion item state to provide visual feedback.
|
|
107
|
+
*
|
|
108
|
+
* @see https://mantle.ngrok.com/components/accordion#api-accordion-trigger-icon
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```tsx
|
|
112
|
+
* <Accordion type="single" collapsible>
|
|
113
|
+
* <AccordionItem value="item-1">
|
|
114
|
+
* <AccordionHeading>
|
|
115
|
+
* <AccordionTrigger>
|
|
116
|
+
* <AccordionTriggerIcon />
|
|
117
|
+
* Is it accessible?
|
|
118
|
+
* </AccordionTrigger>
|
|
119
|
+
* </AccordionHeading>
|
|
120
|
+
* <AccordionContent>
|
|
121
|
+
* Yes. It adheres to the WAI-ARIA design pattern.
|
|
122
|
+
* </AccordionContent>
|
|
123
|
+
* </AccordionItem>
|
|
124
|
+
* </Accordion>
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
declare const AccordionTriggerIcon: {
|
|
128
|
+
({ className, ...props }: Omit<IconProps, "svg">): react_jsx_runtime.JSX.Element;
|
|
129
|
+
displayName: string;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Contains the collapsible content for an item.
|
|
133
|
+
* The content area that is revealed when the accordion item is expanded.
|
|
134
|
+
*
|
|
135
|
+
* @see https://mantle.ngrok.com/components/accordion#api-accordion-content
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```tsx
|
|
139
|
+
* <Accordion type="single" collapsible>
|
|
140
|
+
* <AccordionItem value="item-1">
|
|
141
|
+
* <AccordionHeading>
|
|
142
|
+
* <AccordionTrigger>
|
|
143
|
+
* <AccordionTriggerIcon />
|
|
144
|
+
* Is it accessible?
|
|
145
|
+
* </AccordionTrigger>
|
|
146
|
+
* </AccordionHeading>
|
|
147
|
+
* <AccordionContent>
|
|
148
|
+
* Yes. It adheres to the WAI-ARIA design pattern.
|
|
149
|
+
* </AccordionContent>
|
|
150
|
+
* </AccordionItem>
|
|
151
|
+
* </Accordion>
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
13
154
|
declare const AccordionContent: react.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
14
155
|
|
|
15
156
|
export { Accordion, AccordionContent, AccordionHeading, AccordionItem, AccordionTrigger, AccordionTriggerIcon };
|
package/dist/accordion.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-I6T6YV2L.js";import"./chunk-NPTDRQT5.js";import{a as t}from"./chunk-AZ56JGNY.js";import{CaretDownIcon as l}from"@phosphor-icons/react/CaretDown";import*as o from"@radix-ui/react-accordion";import{forwardRef as c}from"react";import{jsx as n}from"react/jsx-runtime";var a=c(({className:i,...e},r)=>n(o.Root,{ref:r,className:t("w-full space-y-2.5",i),...e}));a.displayName="Accordion";var p=o.Item;p.displayName="AccordionItem";var s=c(({className:i,...e},r)=>n(o.Header,{ref:r,className:t("flex items-center gap-2",i),...e}));s.displayName="AccordionHeading";var f=c(({className:i,children:e,...r},d)=>n(o.Trigger,{ref:d,className:t("group flex items-center gap-1.5",i),...r,children:e}));f.displayName="AccordionTrigger";var A=({className:i,...e})=>n(m,{...e,svg:n(l,{weight:"fill"}),className:t("group-data-state-open:rotate-0 -rotate-90",i)});A.displayName="AccordionTriggerIcon";var g=c(({className:i,children:e,...r},d)=>n(o.Content,{ref:d,className:t("data-state-closed:animate-accordion-up data-state-open:animate-accordion-down overflow-hidden pt-4",i),...r,children:e}));g.displayName="AccordionContent";export{a as Accordion,g as AccordionContent,s as AccordionHeading,p as AccordionItem,f as AccordionTrigger,A as AccordionTriggerIcon};
|
|
2
2
|
//# sourceMappingURL=accordion.js.map
|
package/dist/accordion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/accordion/accordion.tsx"],"sourcesContent":["\"use client\";\n\nimport { CaretDownIcon } from \"@phosphor-icons/react/CaretDown\";\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\tforwardRef,\n} from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon, type IconProps } from \"../icon/icon.js\";\n\nconst Accordion = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentPropsWithoutRef<typeof AccordionPrimitive.Root>\n>(({ className, ...props }, ref) => (\n\t<AccordionPrimitive.Root\n\t\tref={ref}\n\t\tclassName={cx(\"w-full space-y-2.5\", className)}\n\t\t{...props}\n\t/>\n));\nAccordion.displayName = \"Accordion\";\n\nconst AccordionItem = AccordionPrimitive.Item;\nAccordionItem.displayName = \"AccordionItem\";\n\nconst AccordionHeading = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentPropsWithoutRef<typeof AccordionPrimitive.Header>\n>(({ className, ...props }, ref) => (\n\t<AccordionPrimitive.Header\n\t\tref={ref}\n\t\tclassName={cx(\"flex items-center gap-2\", className)}\n\t\t{...props}\n\t/>\n));\nAccordionHeading.displayName = \"AccordionHeading\";\n\nconst AccordionTrigger = forwardRef<\n\tComponentRef<\"button\">,\n\tComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n\t<AccordionPrimitive.Trigger\n\t\tref={ref}\n\t\tclassName={cx(\"group flex items-center gap-1.5\", className)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t</AccordionPrimitive.Trigger>\n));\nAccordionTrigger.displayName = \"AccordionTrigger\";\n\nconst AccordionTriggerIcon = ({\n\tclassName,\n\t...props\n}: Omit<IconProps, \"svg\">) => (\n\t<Icon\n\t\t{...props}\n\t\tsvg={<CaretDownIcon weight=\"fill\" />}\n\t\tclassName={cx(\"group-data-state-open:rotate-0 -rotate-90\", className)}\n\t/>\n);\n\nconst AccordionContent = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n\t<AccordionPrimitive.Content\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"data-state-closed:animate-accordion-up data-state-open:animate-accordion-down overflow-hidden pt-4\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t</AccordionPrimitive.Content>\n));\nAccordionContent.displayName = \"AccordionContent\";\n\nexport {\n\t//,\n\tAccordion,\n\tAccordionContent,\n\tAccordionHeading,\n\tAccordionItem,\n\tAccordionTrigger,\n\tAccordionTriggerIcon,\n};\n"],"mappings":"4GAEA,OAAS,iBAAAA,MAAqB,kCAC9B,UAAYC,MAAwB,4BACpC,OAGC,cAAAC,MACM,
|
|
1
|
+
{"version":3,"sources":["../src/components/accordion/accordion.tsx"],"sourcesContent":["\"use client\";\n\nimport { CaretDownIcon } from \"@phosphor-icons/react/CaretDown\";\nimport * as AccordionPrimitive from \"@radix-ui/react-accordion\";\nimport {\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\tforwardRef,\n} from \"react\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon, type IconProps } from \"../icon/icon.js\";\n\n/**\n * A vertically stacked set of interactive headings that each reveal a section of content.\n * The root component that contains all accordion items.\n *\n * @see https://mantle.ngrok.com/components/accordion#api-accordion\n *\n * @example\n * ```tsx\n * <Accordion type=\"single\" collapsible>\n * <AccordionItem value=\"item-1\">\n * <AccordionHeading>\n * <AccordionTrigger>\n * <AccordionTriggerIcon />\n * Is it accessible?\n * </AccordionTrigger>\n * </AccordionHeading>\n * <AccordionContent>\n * Yes. It adheres to the WAI-ARIA design pattern.\n * </AccordionContent>\n * </AccordionItem>\n * </Accordion>\n * ```\n */\nconst Accordion = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentPropsWithoutRef<typeof AccordionPrimitive.Root>\n>(({ className, ...props }, ref) => (\n\t<AccordionPrimitive.Root\n\t\tref={ref}\n\t\tclassName={cx(\"w-full space-y-2.5\", className)}\n\t\t{...props}\n\t/>\n));\nAccordion.displayName = \"Accordion\";\n\n/**\n * Contains all the parts of a collapsible section.\n * A single accordion item that can be expanded or collapsed.\n *\n * @see https://mantle.ngrok.com/components/accordion#api-accordion-item\n *\n * @example\n * ```tsx\n * <Accordion type=\"single\" collapsible>\n * <AccordionItem value=\"item-1\">\n * <AccordionHeading>\n * <AccordionTrigger>\n * <AccordionTriggerIcon />\n * Is it accessible?\n * </AccordionTrigger>\n * </AccordionHeading>\n * <AccordionContent>\n * Yes. It adheres to the WAI-ARIA design pattern.\n * </AccordionContent>\n * </AccordionItem>\n * </Accordion>\n * ```\n */\nconst AccordionItem = AccordionPrimitive.Item;\nAccordionItem.displayName = \"AccordionItem\";\n\n/**\n * Wraps an AccordionTrigger.\n * Contains the accordion trigger and provides proper heading semantics.\n *\n * @see https://mantle.ngrok.com/components/accordion#api-accordion-heading\n *\n * @example\n * ```tsx\n * <Accordion type=\"single\" collapsible>\n * <AccordionItem value=\"item-1\">\n * <AccordionHeading>\n * <AccordionTrigger>\n * <AccordionTriggerIcon />\n * Is it accessible?\n * </AccordionTrigger>\n * </AccordionHeading>\n * <AccordionContent>\n * Yes. It adheres to the WAI-ARIA design pattern.\n * </AccordionContent>\n * </AccordionItem>\n * </Accordion>\n * ```\n */\nconst AccordionHeading = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentPropsWithoutRef<typeof AccordionPrimitive.Header>\n>(({ className, ...props }, ref) => (\n\t<AccordionPrimitive.Header\n\t\tref={ref}\n\t\tclassName={cx(\"flex items-center gap-2\", className)}\n\t\t{...props}\n\t/>\n));\nAccordionHeading.displayName = \"AccordionHeading\";\n\n/**\n * Toggles the collapsed state of its associated item.\n * The interactive element that expands or collapses the accordion content.\n *\n * @see https://mantle.ngrok.com/components/accordion#api-accordion-trigger\n *\n * @example\n * ```tsx\n * <Accordion type=\"single\" collapsible>\n * <AccordionItem value=\"item-1\">\n * <AccordionHeading>\n * <AccordionTrigger>\n * <AccordionTriggerIcon />\n * Is it accessible?\n * </AccordionTrigger>\n * </AccordionHeading>\n * <AccordionContent>\n * Yes. It adheres to the WAI-ARIA design pattern.\n * </AccordionContent>\n * </AccordionItem>\n * </Accordion>\n * ```\n */\nconst AccordionTrigger = forwardRef<\n\tComponentRef<\"button\">,\n\tComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>\n>(({ className, children, ...props }, ref) => (\n\t<AccordionPrimitive.Trigger\n\t\tref={ref}\n\t\tclassName={cx(\"group flex items-center gap-1.5\", className)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t</AccordionPrimitive.Trigger>\n));\nAccordionTrigger.displayName = \"AccordionTrigger\";\n\n/**\n * An icon that indicates the expanded/collapsed state of the accordion trigger.\n * Rotates based on the accordion item state to provide visual feedback.\n *\n * @see https://mantle.ngrok.com/components/accordion#api-accordion-trigger-icon\n *\n * @example\n * ```tsx\n * <Accordion type=\"single\" collapsible>\n * <AccordionItem value=\"item-1\">\n * <AccordionHeading>\n * <AccordionTrigger>\n * <AccordionTriggerIcon />\n * Is it accessible?\n * </AccordionTrigger>\n * </AccordionHeading>\n * <AccordionContent>\n * Yes. It adheres to the WAI-ARIA design pattern.\n * </AccordionContent>\n * </AccordionItem>\n * </Accordion>\n * ```\n */\nconst AccordionTriggerIcon = ({\n\tclassName,\n\t...props\n}: Omit<IconProps, \"svg\">) => (\n\t<Icon\n\t\t{...props}\n\t\tsvg={<CaretDownIcon weight=\"fill\" />}\n\t\tclassName={cx(\"group-data-state-open:rotate-0 -rotate-90\", className)}\n\t/>\n);\nAccordionTriggerIcon.displayName = \"AccordionTriggerIcon\";\n\n/**\n * Contains the collapsible content for an item.\n * The content area that is revealed when the accordion item is expanded.\n *\n * @see https://mantle.ngrok.com/components/accordion#api-accordion-content\n *\n * @example\n * ```tsx\n * <Accordion type=\"single\" collapsible>\n * <AccordionItem value=\"item-1\">\n * <AccordionHeading>\n * <AccordionTrigger>\n * <AccordionTriggerIcon />\n * Is it accessible?\n * </AccordionTrigger>\n * </AccordionHeading>\n * <AccordionContent>\n * Yes. It adheres to the WAI-ARIA design pattern.\n * </AccordionContent>\n * </AccordionItem>\n * </Accordion>\n * ```\n */\nconst AccordionContent = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentPropsWithoutRef<typeof AccordionPrimitive.Content>\n>(({ className, children, ...props }, ref) => (\n\t<AccordionPrimitive.Content\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"data-state-closed:animate-accordion-up data-state-open:animate-accordion-down overflow-hidden pt-4\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t>\n\t\t{children}\n\t</AccordionPrimitive.Content>\n));\nAccordionContent.displayName = \"AccordionContent\";\n\nexport {\n\t//,\n\tAccordion,\n\tAccordionContent,\n\tAccordionHeading,\n\tAccordionItem,\n\tAccordionTrigger,\n\tAccordionTriggerIcon,\n};\n"],"mappings":"4GAEA,OAAS,iBAAAA,MAAqB,kCAC9B,UAAYC,MAAwB,4BACpC,OAGC,cAAAC,MACM,QA+BN,cAAAC,MAAA,oBAJD,IAAMC,EAAYC,EAGhB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BL,EAAoB,OAAnB,CACA,IAAKK,EACL,UAAWC,EAAG,qBAAsBH,CAAS,EAC5C,GAAGC,EACL,CACA,EACDH,EAAU,YAAc,YAyBxB,IAAMM,EAAmC,OACzCA,EAAc,YAAc,gBAyB5B,IAAMC,EAAmBN,EAGvB,CAAC,CAAE,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAC3BL,EAAoB,SAAnB,CACA,IAAKK,EACL,UAAWC,EAAG,0BAA2BH,CAAS,EACjD,GAAGC,EACL,CACA,EACDI,EAAiB,YAAc,mBAyB/B,IAAMC,EAAmBP,EAGvB,CAAC,CAAE,UAAAC,EAAW,SAAAO,EAAU,GAAGN,CAAM,EAAGC,IACrCL,EAAoB,UAAnB,CACA,IAAKK,EACL,UAAWC,EAAG,kCAAmCH,CAAS,EACzD,GAAGC,EAEH,SAAAM,EACF,CACA,EACDD,EAAiB,YAAc,mBAyB/B,IAAME,EAAuB,CAAC,CAC7B,UAAAR,EACA,GAAGC,CACJ,IACCJ,EAACY,EAAA,CACC,GAAGR,EACJ,IAAKJ,EAACa,EAAA,CAAc,OAAO,OAAO,EAClC,UAAWP,EAAG,4CAA6CH,CAAS,EACrE,EAEDQ,EAAqB,YAAc,uBAyBnC,IAAMG,EAAmBZ,EAGvB,CAAC,CAAE,UAAAC,EAAW,SAAAO,EAAU,GAAGN,CAAM,EAAGC,IACrCL,EAAoB,UAAnB,CACA,IAAKK,EACL,UAAWC,EACV,qGACAH,CACD,EACC,GAAGC,EAEH,SAAAM,EACF,CACA,EACDI,EAAiB,YAAc","names":["CaretDownIcon","AccordionPrimitive","forwardRef","jsx","Accordion","forwardRef","className","props","ref","cx","AccordionItem","AccordionHeading","AccordionTrigger","children","AccordionTriggerIcon","Icon","CaretDownIcon","AccordionContent"]}
|
package/dist/alert-dialog.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ComponentProps, ReactNode } from 'react';
|
|
|
6
6
|
import * as _radix_ui_react_dialog from '@radix-ui/react-dialog';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
8
|
import { W as WithAsChild } from './as-child-DJ7x3JFV.js';
|
|
9
|
-
import { R as Root } from './primitive-
|
|
9
|
+
import { R as Root } from './primitive-BUbUB7RS.js';
|
|
10
10
|
import { S as SvgAttributes } from './types-BuKAGhC-.js';
|
|
11
11
|
|
|
12
12
|
declare const priorities: readonly ["info", "danger"];
|
package/dist/alert-dialog.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as A,b as D,c as y,d as g,e as u,f as C,g as P,h as v}from"./chunk-
|
|
1
|
+
import{a as A,b as D,c as y,d as g,e as u,f as C,g as P,h as v}from"./chunk-IVXZIYX4.js";import{g as c}from"./chunk-NRMIFYYG.js";import"./chunk-6RJ2G2DK.js";import"./chunk-D3XF6J5A.js";import{b as m}from"./chunk-PANPBV3Q.js";import"./chunk-4LSFAAZW.js";import"./chunk-72TJUKMV.js";import"./chunk-3C5O3AQA.js";import"./chunk-I6T6YV2L.js";import{a as f}from"./chunk-NPTDRQT5.js";import{a}from"./chunk-AZ56JGNY.js";import{InfoIcon as V}from"@phosphor-icons/react/Info";import{WarningIcon as k}from"@phosphor-icons/react/Warning";import{Slot as d}from"@radix-ui/react-slot";import{createContext as M,forwardRef as n,useContext as $,useMemo as q}from"react";import E from"tiny-invariant";import{jsx as i,jsxs as G}from"react/jsx-runtime";var x=M(null);function N(){let t=$(x);return E(t,"AlertDialog child component used outside of AlertDialog parent!"),t}function R({priority:t,...e}){let o=q(()=>({priority:t}),[t]);return i(x.Provider,{value:o,children:i(A,{...e})})}R.displayName="AlertDialog";var h=D;h.displayName="AlertDialogTrigger";var b=y;b.displayName="AlertDialogPortal";var I=n(({className:t,...e},o)=>i(u,{className:a("data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-sm",t),...e,ref:o}));I.displayName="AlertDialogOverlay";var W=n(({className:t,onInteractOutside:e,onPointerDownOutside:o,preferredWidth:l="max-w-md",...r},p)=>G(b,{children:[i(I,{}),i("div",{className:"fixed inset-4 z-50 flex items-center justify-center",children:i(C,{ref:p,className:a("flex w-full flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start","outline-none focus-within:outline-none","p-6","border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200","data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95",l,t),onInteractOutside:s=>{c(s),e?.(s)},onPointerDownOutside:s=>{c(s),o?.(s)},...r})})]}));W.displayName="AlertDialogContent";var O=n(({asChild:t=!1,className:e,...o},l)=>i(t?d:"div",{className:a("flex-1 space-y-4",e),ref:l,...o}));O.displayName="AlertDialogBody";var T=n(({asChild:t=!1,className:e,...o},l)=>i(t?d:"div",{className:a("flex flex-col space-y-2 text-center sm:text-start",e),...o}));T.displayName="AlertDialogHeader";var w=n(({asChild:t=!1,className:e,...o},l)=>i(t?d:"div",{className:a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...o}));w.displayName="AlertDialogFooter";var B=n(({className:t,...e},o)=>i(P,{ref:o,className:a("text-strong text-center text-lg font-medium sm:text-start",t),...e}));B.displayName="AlertDialogTitle";var z=n(({className:t,...e},o)=>i(v,{ref:o,className:a("text-body text-center text-sm font-normal sm:text-start",t),...e}));z.displayName="AlertDialogDescription";var S=n(({appearance:t="filled",...e},o)=>{let l=N(),r="default";return l.priority==="danger"&&(r="danger"),i(m,{appearance:t,priority:r,ref:o,...e})});S.displayName="AlertDialogAction";var j=n(({appearance:t="outlined",className:e,priority:o="neutral",...l},r)=>i(g,{asChild:!0,children:i(m,{appearance:t,className:a("mt-2 sm:mt-0",e),priority:o,ref:r,...l})}));j.displayName="AlertDialogCancel";var F=n(({className:t,svg:e,...o},l)=>{let r=N(),p=r.priority==="danger"?"text-danger-600":"text-accent-600",s=r.priority==="danger"?i(k,{}):i(V,{});return i(f,{ref:l,className:a("size-12 sm:size-7",p,t),svg:e??s,...o})});F.displayName="AlertDialogIcon";var H=g;H.displayName="AlertDialogClose";export{R as AlertDialog,S as AlertDialogAction,O as AlertDialogBody,j as AlertDialogCancel,H as AlertDialogClose,W as AlertDialogContent,z as AlertDialogDescription,w as AlertDialogFooter,T as AlertDialogHeader,F as AlertDialogIcon,B as AlertDialogTitle,h as AlertDialogTrigger};
|
|
2
2
|
//# sourceMappingURL=alert-dialog.js.map
|
package/dist/alert-dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/alert-dialog/alert-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { InfoIcon } from \"@phosphor-icons/react/Info\";\nimport { WarningIcon } from \"@phosphor-icons/react/Warning\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n\ttype ComponentProps,\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\ttype ReactNode,\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n\tuseMemo,\n} from \"react\";\nimport invariant from \"tiny-invariant\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport {\n\tButton,\n\ttype ButtonPriority,\n\ttype ButtonProps,\n} from \"../button/button.js\";\nimport * as AlertDialogPrimitive from \"../dialog/primitive.js\";\nimport { SvgOnly } from \"../icon/svg-only.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\nimport { preventCloseOnPromptInteraction } from \"../toast/toast.js\";\n\nconst priorities = [\"info\", \"danger\"] as const;\ntype Priority = (typeof priorities)[number];\n\ntype AlertDialogContextValue = {\n\tpriority: Priority;\n};\n\nconst AlertDialogContext = createContext<AlertDialogContextValue | null>(null);\n\nfunction useAlertDialogContext() {\n\tconst context = useContext(AlertDialogContext);\n\tinvariant(\n\t\tcontext,\n\t\t\"AlertDialog child component used outside of AlertDialog parent!\",\n\t);\n\treturn context;\n}\n\ntype AlertDialogProps = ComponentProps<typeof AlertDialogPrimitive.Root> & {\n\t/**\n\t * Indicates the importance or impact level of the AlertDialog, affecting its\n\t * color and styling to communicate its purpose to the user.\n\t */\n\tpriority: Priority;\n};\n\n/**\n * A modal dialog that interrupts the user with important content and expects a\n * response.\n * The root stateful component for the Alert Dialog.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nfunction AlertDialog({ priority, ...props }: AlertDialogProps) {\n\tconst context: AlertDialogContextValue = useMemo(\n\t\t() => ({ priority }),\n\t\t[priority],\n\t);\n\n\treturn (\n\t\t<AlertDialogContext.Provider value={context}>\n\t\t\t<AlertDialogPrimitive.Root {...props} />\n\t\t</AlertDialogContext.Provider>\n\t);\n}\nAlertDialog.displayName = \"AlertDialog\";\n\n/**\n * A button that opens the Alert Dialog.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-trigger\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\n\n/**\n * The portal for the Alert Dialog.\n *\n * @private\n */\nconst AlertDialogPortal = AlertDialogPrimitive.Portal;\n\n/**\n * A layer that covers the inert portion of the view when the dialog is open.\n *\n * @private\n */\nconst AlertDialogOverlay = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Overlay\n\t\tclassName={cx(\n\t\t\t\"data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-sm\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t\tref={ref}\n\t/>\n));\nAlertDialogOverlay.displayName = \"AlertDialogOverlay\";\n\ntype AlertDialogContentProps = ComponentPropsWithoutRef<\n\ttypeof AlertDialogPrimitive.Content\n> & {\n\t/**\n\t * The preferred width of the `AlertDialogContent` as a tailwind `max-w-` class.\n\t *\n\t * By default, a `AlertDialog`'s content width is responsive with a default\n\t * preferred width: the maximum width of the `AlertDialogContent`\n\t *\n\t * @default `max-w-md`\n\t */\n\tpreferredWidth?: `max-w-${string}`;\n};\n\n/**\n * The popover alert dialog container.\n *\n * Renders on top of the overlay and is centered in the viewport.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-content\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogContent = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Content>,\n\tAlertDialogContentProps\n>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tonInteractOutside,\n\t\t\tonPointerDownOutside,\n\t\t\tpreferredWidth = \"max-w-md\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => (\n\t\t<AlertDialogPortal>\n\t\t\t<AlertDialogOverlay />\n\t\t\t<div className=\"fixed inset-4 z-50 flex items-center justify-center\">\n\t\t\t\t<AlertDialogPrimitive.Content\n\t\t\t\t\tref={ref}\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"flex w-full flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start\",\n\t\t\t\t\t\t\"outline-none focus-within:outline-none\",\n\t\t\t\t\t\t\"p-6\",\n\t\t\t\t\t\t\"border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200\",\n\t\t\t\t\t\t\"data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\t\tpreferredWidth,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tonInteractOutside={(event) => {\n\t\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\t\tonInteractOutside?.(event);\n\t\t\t\t\t}}\n\t\t\t\t\tonPointerDownOutside={(event) => {\n\t\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\t\tonPointerDownOutside?.(event);\n\t\t\t\t\t}}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</AlertDialogPortal>\n\t),\n);\nAlertDialogContent.displayName = \"AlertDialogContent\";\n\n/**\n * Contains the main content of the alert dialog.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-body\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogBody = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentProps<\"div\"> & WithAsChild\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={cx(\"flex-1 space-y-4\", className)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogBody.displayName = \"AlertDialogBody\";\n\n/**\n * Contains the header content of the dialog, including the title and description.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-header\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogHeader = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentProps<\"div\"> & WithAsChild\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={cx(\n\t\t\t\t\"flex flex-col space-y-2 text-center sm:text-start\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogHeader.displayName = \"AlertDialogHeader\";\n\n/**\n * Contains the footer content of the dialog, including the action and cancel buttons.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-footer\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogFooter = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentProps<\"div\"> & WithAsChild\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={cx(\n\t\t\t\t\"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogFooter.displayName = \"AlertDialogFooter\";\n\n/**\n * An accessible name to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-label` or `aria-labelledby` to\n * `AlertDialogContent` and exclude this component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-title\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogTitle = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Title\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"text-strong text-center text-lg font-medium sm:text-start\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nAlertDialogTitle.displayName = \"AlertDialogTitle\";\n\n/**\n * An accessible description to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-describedby` to `AlertDialogContent` and\n * exclude this component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-description\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogDescription = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Description\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"text-body text-center text-sm font-normal sm:text-start\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nAlertDialogDescription.displayName = \"AlertDialogDescription\";\n\n/**\n * A button that confirms the Alert Dialog action.\n * Will default to appearance=\"filled\", as well as the priority color from the `AlertDialog`.\n * Does not close the alert dialog by default.\n *\n * These buttons should be distinguished visually from the AlertDialogCancel button.\n *\n * Composes around the mantle Button component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-action\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogAction = forwardRef<ComponentRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"filled\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst ctx = useAlertDialogContext();\n\t\tlet buttonPriority: NonNullable<ButtonPriority> = \"default\";\n\t\tif (ctx.priority === \"danger\") {\n\t\t\tbuttonPriority = \"danger\";\n\t\t}\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\t//\n\t\t\t\tappearance={appearance}\n\t\t\t\tpriority={buttonPriority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertDialogAction.displayName = \"AlertDialogAction\";\n\n/**\n * A button that closes the dialog and cancels the action.\n * Will default to appearance=\"outlined\" and priority=\"neutral\".\n *\n * This button should be distinguished visually from AlertDialogAction buttons.\n *\n * Composes around the mantle Button component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-cancel\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogCancel = forwardRef<ComponentRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"outlined\",\n\t\t\tclassName,\n\t\t\tpriority = \"neutral\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => (\n\t\t<AlertDialogPrimitive.Close asChild>\n\t\t\t<Button\n\t\t\t\tappearance={appearance}\n\t\t\t\tclassName={cx(\"mt-2 sm:mt-0\", className)}\n\t\t\t\tpriority={priority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</AlertDialogPrimitive.Close>\n\t),\n);\nAlertDialogCancel.displayName = \"AlertDialogCancel\";\n\ntype AlertDialogIconProps = Omit<SvgAttributes, \"children\"> & {\n\tsvg?: ReactNode;\n};\n\n/**\n * An icon that visually represents the priority of the AlertDialog.\n *\n * Defaults to a warning icon for danger priority and an info icon for info\n * priority with the appropriate color.\n *\n * Can be overridden with a custom icon using the `svg` prop.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-icon\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogIcon = forwardRef<ComponentRef<\"svg\">, AlertDialogIconProps>(\n\t({ className, svg, ...props }, ref) => {\n\t\tconst ctx = useAlertDialogContext();\n\t\tconst defaultColor =\n\t\t\tctx.priority === \"danger\" ? \"text-danger-600\" : \"text-accent-600\";\n\t\tconst defaultIcon =\n\t\t\tctx.priority === \"danger\" ? <WarningIcon /> : <InfoIcon />;\n\n\t\treturn (\n\t\t\t<SvgOnly\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"size-12 sm:size-7\", defaultColor, className)}\n\t\t\t\tsvg={svg ?? defaultIcon}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertDialogIcon.displayName = \"AlertDialogIcon\";\n\n/**\n * A button that closes the Alert Dialog. (Unstyled)\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-close\n *\n * @example\n * ```tsx\n * <AlertDialogClose asChild>\n * <AlertDialogAction\n * \ttype=\"button\"\n * \tonClick={() => doThing()}\n * >\n * \tDo thing and close\n * </AlertDialogAction>\n * </AlertDialogClose>\n */\nconst AlertDialogClose = AlertDialogPrimitive.Close;\n\nexport {\n\t//,\n\tAlertDialog,\n\tAlertDialogAction,\n\tAlertDialogBody,\n\tAlertDialogCancel,\n\tAlertDialogClose,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAlertDialogFooter,\n\tAlertDialogHeader,\n\tAlertDialogIcon,\n\tAlertDialogTitle,\n\tAlertDialogTrigger,\n};\n"],"mappings":"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","names":["InfoIcon","WarningIcon","Slot","createContext","forwardRef","useContext","useMemo","invariant","jsx","jsxs","AlertDialogContext","createContext","useAlertDialogContext","context","useContext","invariant","AlertDialog","priority","props","useMemo","jsx","Root","AlertDialogTrigger","Trigger","AlertDialogPortal","Portal","AlertDialogOverlay","forwardRef","className","ref","Overlay","cx","AlertDialogContent","onInteractOutside","onPointerDownOutside","preferredWidth","jsxs","Content","event","preventCloseOnPromptInteraction","AlertDialogBody","asChild","Slot","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogAction","appearance","ctx","buttonPriority","Button","AlertDialogCancel","Close","AlertDialogIcon","svg","defaultColor","defaultIcon","WarningIcon","InfoIcon","SvgOnly","AlertDialogClose"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/alert-dialog/alert-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { InfoIcon } from \"@phosphor-icons/react/Info\";\nimport { WarningIcon } from \"@phosphor-icons/react/Warning\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n\ttype ComponentProps,\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\ttype ReactNode,\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n\tuseMemo,\n} from \"react\";\nimport invariant from \"tiny-invariant\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport {\n\tButton,\n\ttype ButtonPriority,\n\ttype ButtonProps,\n} from \"../button/button.js\";\nimport * as AlertDialogPrimitive from \"../dialog/primitive.js\";\nimport { SvgOnly } from \"../icon/svg-only.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\nimport { preventCloseOnPromptInteraction } from \"../toast/toast.js\";\n\nconst priorities = [\"info\", \"danger\"] as const;\ntype Priority = (typeof priorities)[number];\n\ntype AlertDialogContextValue = {\n\tpriority: Priority;\n};\n\nconst AlertDialogContext = createContext<AlertDialogContextValue | null>(null);\n\nfunction useAlertDialogContext() {\n\tconst context = useContext(AlertDialogContext);\n\tinvariant(\n\t\tcontext,\n\t\t\"AlertDialog child component used outside of AlertDialog parent!\",\n\t);\n\treturn context;\n}\n\ntype AlertDialogProps = ComponentProps<typeof AlertDialogPrimitive.Root> & {\n\t/**\n\t * Indicates the importance or impact level of the AlertDialog, affecting its\n\t * color and styling to communicate its purpose to the user.\n\t */\n\tpriority: Priority;\n};\n\n/**\n * A modal dialog that interrupts the user with important content and expects a\n * response.\n * The root stateful component for the Alert Dialog.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nfunction AlertDialog({ priority, ...props }: AlertDialogProps) {\n\tconst context: AlertDialogContextValue = useMemo(\n\t\t() => ({ priority }),\n\t\t[priority],\n\t);\n\n\treturn (\n\t\t<AlertDialogContext.Provider value={context}>\n\t\t\t<AlertDialogPrimitive.Root {...props} />\n\t\t</AlertDialogContext.Provider>\n\t);\n}\nAlertDialog.displayName = \"AlertDialog\";\n\n/**\n * A button that opens the Alert Dialog.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-trigger\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\nAlertDialogTrigger.displayName = \"AlertDialogTrigger\";\n\n/**\n * The portal for the Alert Dialog.\n *\n * @private\n */\nconst AlertDialogPortal = AlertDialogPrimitive.Portal;\nAlertDialogPortal.displayName = \"AlertDialogPortal\";\n\n/**\n * A layer that covers the inert portion of the view when the dialog is open.\n *\n * @private\n */\nconst AlertDialogOverlay = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Overlay\n\t\tclassName={cx(\n\t\t\t\"data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-sm\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t\tref={ref}\n\t/>\n));\nAlertDialogOverlay.displayName = \"AlertDialogOverlay\";\n\ntype AlertDialogContentProps = ComponentPropsWithoutRef<\n\ttypeof AlertDialogPrimitive.Content\n> & {\n\t/**\n\t * The preferred width of the `AlertDialogContent` as a tailwind `max-w-` class.\n\t *\n\t * By default, a `AlertDialog`'s content width is responsive with a default\n\t * preferred width: the maximum width of the `AlertDialogContent`\n\t *\n\t * @default `max-w-md`\n\t */\n\tpreferredWidth?: `max-w-${string}`;\n};\n\n/**\n * The popover alert dialog container.\n *\n * Renders on top of the overlay and is centered in the viewport.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-content\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogContent = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Content>,\n\tAlertDialogContentProps\n>(\n\t(\n\t\t{\n\t\t\tclassName,\n\t\t\tonInteractOutside,\n\t\t\tonPointerDownOutside,\n\t\t\tpreferredWidth = \"max-w-md\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => (\n\t\t<AlertDialogPortal>\n\t\t\t<AlertDialogOverlay />\n\t\t\t<div className=\"fixed inset-4 z-50 flex items-center justify-center\">\n\t\t\t\t<AlertDialogPrimitive.Content\n\t\t\t\t\tref={ref}\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\"flex w-full flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start\",\n\t\t\t\t\t\t\"outline-none focus-within:outline-none\",\n\t\t\t\t\t\t\"p-6\",\n\t\t\t\t\t\t\"border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200\",\n\t\t\t\t\t\t\"data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\t\tpreferredWidth,\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\tonInteractOutside={(event) => {\n\t\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\t\tonInteractOutside?.(event);\n\t\t\t\t\t}}\n\t\t\t\t\tonPointerDownOutside={(event) => {\n\t\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\t\tonPointerDownOutside?.(event);\n\t\t\t\t\t}}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</AlertDialogPortal>\n\t),\n);\nAlertDialogContent.displayName = \"AlertDialogContent\";\n\n/**\n * Contains the main content of the alert dialog.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-body\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogBody = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentProps<\"div\"> & WithAsChild\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={cx(\"flex-1 space-y-4\", className)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogBody.displayName = \"AlertDialogBody\";\n\n/**\n * Contains the header content of the dialog, including the title and description.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-header\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogHeader = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentProps<\"div\"> & WithAsChild\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={cx(\n\t\t\t\t\"flex flex-col space-y-2 text-center sm:text-start\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogHeader.displayName = \"AlertDialogHeader\";\n\n/**\n * Contains the footer content of the dialog, including the action and cancel buttons.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-footer\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogFooter = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentProps<\"div\"> & WithAsChild\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={cx(\n\t\t\t\t\"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogFooter.displayName = \"AlertDialogFooter\";\n\n/**\n * An accessible name to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-label` or `aria-labelledby` to\n * `AlertDialogContent` and exclude this component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-title\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogTitle = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Title\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"text-strong text-center text-lg font-medium sm:text-start\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nAlertDialogTitle.displayName = \"AlertDialogTitle\";\n\n/**\n * An accessible description to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-describedby` to `AlertDialogContent` and\n * exclude this component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-description\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogDescription = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Description\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"text-body text-center text-sm font-normal sm:text-start\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nAlertDialogDescription.displayName = \"AlertDialogDescription\";\n\n/**\n * A button that confirms the Alert Dialog action.\n * Will default to appearance=\"filled\", as well as the priority color from the `AlertDialog`.\n * Does not close the alert dialog by default.\n *\n * These buttons should be distinguished visually from the AlertDialogCancel button.\n *\n * Composes around the mantle Button component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-action\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogAction = forwardRef<ComponentRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"filled\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst ctx = useAlertDialogContext();\n\t\tlet buttonPriority: NonNullable<ButtonPriority> = \"default\";\n\t\tif (ctx.priority === \"danger\") {\n\t\t\tbuttonPriority = \"danger\";\n\t\t}\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\t//\n\t\t\t\tappearance={appearance}\n\t\t\t\tpriority={buttonPriority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertDialogAction.displayName = \"AlertDialogAction\";\n\n/**\n * A button that closes the dialog and cancels the action.\n * Will default to appearance=\"outlined\" and priority=\"neutral\".\n *\n * This button should be distinguished visually from AlertDialogAction buttons.\n *\n * Composes around the mantle Button component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-cancel\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogCancel = forwardRef<ComponentRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"outlined\",\n\t\t\tclassName,\n\t\t\tpriority = \"neutral\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => (\n\t\t<AlertDialogPrimitive.Close asChild>\n\t\t\t<Button\n\t\t\t\tappearance={appearance}\n\t\t\t\tclassName={cx(\"mt-2 sm:mt-0\", className)}\n\t\t\t\tpriority={priority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</AlertDialogPrimitive.Close>\n\t),\n);\nAlertDialogCancel.displayName = \"AlertDialogCancel\";\n\ntype AlertDialogIconProps = Omit<SvgAttributes, \"children\"> & {\n\tsvg?: ReactNode;\n};\n\n/**\n * An icon that visually represents the priority of the AlertDialog.\n *\n * Defaults to a warning icon for danger priority and an info icon for info\n * priority with the appropriate color.\n *\n * Can be overridden with a custom icon using the `svg` prop.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-icon\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogIcon = forwardRef<ComponentRef<\"svg\">, AlertDialogIconProps>(\n\t({ className, svg, ...props }, ref) => {\n\t\tconst ctx = useAlertDialogContext();\n\t\tconst defaultColor =\n\t\t\tctx.priority === \"danger\" ? \"text-danger-600\" : \"text-accent-600\";\n\t\tconst defaultIcon =\n\t\t\tctx.priority === \"danger\" ? <WarningIcon /> : <InfoIcon />;\n\n\t\treturn (\n\t\t\t<SvgOnly\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"size-12 sm:size-7\", defaultColor, className)}\n\t\t\t\tsvg={svg ?? defaultIcon}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertDialogIcon.displayName = \"AlertDialogIcon\";\n\n/**\n * A button that closes the Alert Dialog. (Unstyled)\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-close\n *\n * @example\n * ```tsx\n * <AlertDialogClose asChild>\n * <AlertDialogAction\n * \ttype=\"button\"\n * \tonClick={() => doThing()}\n * >\n * \tDo thing and close\n * </AlertDialogAction>\n * </AlertDialogClose>\n */\nconst AlertDialogClose = AlertDialogPrimitive.Close;\nAlertDialogClose.displayName = \"AlertDialogClose\";\n\nexport {\n\t//,\n\tAlertDialog,\n\tAlertDialogAction,\n\tAlertDialogBody,\n\tAlertDialogCancel,\n\tAlertDialogClose,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAlertDialogFooter,\n\tAlertDialogHeader,\n\tAlertDialogIcon,\n\tAlertDialogTitle,\n\tAlertDialogTrigger,\n};\n"],"mappings":"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","names":["InfoIcon","WarningIcon","Slot","createContext","forwardRef","useContext","useMemo","invariant","jsx","jsxs","AlertDialogContext","createContext","useAlertDialogContext","context","useContext","invariant","AlertDialog","priority","props","useMemo","jsx","Root","AlertDialogTrigger","Trigger","AlertDialogPortal","Portal","AlertDialogOverlay","forwardRef","className","ref","Overlay","cx","AlertDialogContent","onInteractOutside","onPointerDownOutside","preferredWidth","jsxs","Content","event","preventCloseOnPromptInteraction","AlertDialogBody","asChild","Slot","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogAction","appearance","ctx","buttonPriority","Button","AlertDialogCancel","Close","AlertDialogIcon","svg","defaultColor","defaultIcon","WarningIcon","InfoIcon","SvgOnly","AlertDialogClose"]}
|
package/dist/alert.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ComponentProps, HTMLAttributes, ReactNode } from 'react';
|
|
4
4
|
import { W as WithAsChild } from './as-child-DJ7x3JFV.js';
|
|
5
|
-
import { a as IconButtonProps } from './icon-button-
|
|
5
|
+
import { a as IconButtonProps } from './icon-button-D4BTvC7F.js';
|
|
6
6
|
import { S as SvgAttributes } from './types-BuKAGhC-.js';
|
|
7
7
|
import 'class-variance-authority/types';
|
|
8
8
|
import './variant-props-oDo2u-We.js';
|
|
@@ -128,6 +128,9 @@ type AlertDescriptionProps = ComponentProps<"p"> & WithAsChild;
|
|
|
128
128
|
*/
|
|
129
129
|
declare const AlertDescription: react.ForwardRefExoticComponent<Omit<AlertDescriptionProps, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
|
|
130
130
|
type AlertDismissIconButtonProps = Partial<Omit<IconButtonProps, "icon">>;
|
|
131
|
-
declare const AlertDismissIconButton:
|
|
131
|
+
declare const AlertDismissIconButton: {
|
|
132
|
+
({ size, type, label, appearance, className, ...props }: AlertDismissIconButtonProps): react_jsx_runtime.JSX.Element;
|
|
133
|
+
displayName: string;
|
|
134
|
+
};
|
|
132
135
|
|
|
133
136
|
export { Alert, AlertContent, AlertDescription, AlertDismissIconButton, AlertIcon, AlertTitle };
|
package/dist/alert.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-RTXWW6ND.js";import"./chunk-4LSFAAZW.js";import"./chunk-72TJUKMV.js";import"./chunk-3C5O3AQA.js";import"./chunk-I6T6YV2L.js";import{a as p}from"./chunk-NPTDRQT5.js";import{a as i}from"./chunk-AZ56JGNY.js";import{CheckCircleIcon as b}from"@phosphor-icons/react/CheckCircle";import{InfoIcon as P}from"@phosphor-icons/react/Info";import{WarningIcon as I}from"@phosphor-icons/react/Warning";import{WarningDiamondIcon as h}from"@phosphor-icons/react/WarningDiamond";import{XIcon as N}from"@phosphor-icons/react/X";import{Slot as d}from"@radix-ui/react-slot";import{cva as w}from"class-variance-authority";import{createContext as D,forwardRef as a,useContext as R,useMemo as T}from"react";import B from"tiny-invariant";import{jsx as o}from"react/jsx-runtime";var u=D(null);function f(){let t=R(u);return B(t,"useAlertContext hook used outside of Alert parent!"),t}var H=w("relative flex w-full gap-1.5 rounded-md border p-2.5 text-sm",{variants:{priority:{danger:"border-danger-500/50 bg-danger-500/10 text-danger-700",info:"border-accent-500/50 bg-accent-500/10 text-accent-700",success:"border-success-500/50 bg-success-500/10 text-success-700",warning:"border-warning-500/50 bg-warning-500/10 text-warning-700"}}}),A=a(({className:t,priority:e,...r},n)=>{let s=T(()=>({priority:e}),[e]);return o(u.Provider,{value:s,children:o("div",{ref:n,className:i(H({priority:e}),t),...r})})});A.displayName="Alert";var M={danger:o(I,{}),info:o(P,{}),success:o(b,{}),warning:o(h,{})},g=a(({className:t,svg:e,...r},n)=>{let s=f(),l=M[s.priority];return o(p,{ref:n,className:i("size-5",t),svg:e??l,...r})});g.displayName="AlertIcon";var x=a(({className:t,...e},r)=>o("div",{ref:r,className:i("min-w-0 flex-1 has-[[data-alert-dismiss]]:pr-6",t),...e}));x.displayName="AlertContent";var y=a(({asChild:t=!1,className:e,...r},n)=>o(t?d:"h5",{ref:n,className:i("font-medium",e),...r}));y.displayName="AlertTitle";var C=a(({asChild:t=!1,className:e,...r},n)=>o(t?d:"p",{ref:n,className:i("text-sm",e),...r}));C.displayName="AlertDescription";var v=({size:t="sm",type:e="button",label:r="Dismiss Alert",appearance:n="ghost",className:s,...l})=>{let c=f();return o(m,{appearance:n,icon:o(N,{}),label:r,size:t,"data-alert-dismiss":!0,className:i("right-1.5 top-1.5 absolute",{"text-danger-700 not-disabled:hover:text-danger-800 not-disabled:active:text-danger-900":c.priority==="danger","text-accent-700 not-disabled:hover:text-accent-800 not-disabled:active:text-accent-900":c.priority==="info","text-success-700 not-disabled:hover:text-success-800 not-disabled:active:text-success-900":c.priority==="success","text-warning-700 not-disabled:hover:text-warning-800 not-disabled:active:text-warning-900":c.priority==="warning"},s),type:e,...l})};v.displayName="AlertDismissIconButton";export{A as Alert,x as AlertContent,C as AlertDescription,v as AlertDismissIconButton,g as AlertIcon,y as AlertTitle};
|
|
2
2
|
//# sourceMappingURL=alert.js.map
|
package/dist/alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/alert/alert.tsx"],"sourcesContent":["import { CheckCircleIcon } from \"@phosphor-icons/react/CheckCircle\";\nimport { InfoIcon } from \"@phosphor-icons/react/Info\";\nimport { WarningIcon } from \"@phosphor-icons/react/Warning\";\nimport { WarningDiamondIcon } from \"@phosphor-icons/react/WarningDiamond\";\nimport { XIcon } from \"@phosphor-icons/react/X\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva } from \"class-variance-authority\";\nimport type {\n\tComponentProps,\n\tComponentRef,\n\tHTMLAttributes,\n\tReactNode,\n} from \"react\";\nimport { createContext, forwardRef, useContext, useMemo } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport type { WithAsChild } from \"../../types/index.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { IconButton, type IconButtonProps } from \"../button/icon-button.js\";\nimport { SvgOnly } from \"../icon/svg-only.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\n\nconst priorities = [\n\t//,\n\t\"danger\",\n\t\"info\",\n\t// \"neutral\",\n\t\"success\",\n\t\"warning\",\n] as const;\ntype Priority = (typeof priorities)[number];\n\ntype AlertContextValue = {\n\tpriority: Priority;\n};\n\nconst AlertContext = createContext<AlertContextValue | null>(null);\n\nfunction useAlertContext() {\n\tconst context = useContext(AlertContext);\n\tinvariant(context, \"useAlertContext hook used outside of Alert parent!\");\n\treturn context;\n}\n\nconst alertVariants = cva(\n\t\"relative flex w-full gap-1.5 rounded-md border p-2.5 text-sm\",\n\t{\n\t\tvariants: {\n\t\t\t/**\n\t\t\t * The priority of the Alert. Indicates the importance or impact level of the Alert,\n\t\t\t * affecting its color and styling to communicate its purpose to the user.\n\t\t\t */\n\t\t\tpriority: {\n\t\t\t\tdanger: \"border-danger-500/50 bg-danger-500/10 text-danger-700\",\n\t\t\t\tinfo: \"border-accent-500/50 bg-accent-500/10 text-accent-700\",\n\t\t\t\t// neutral: \"border-neutral-500/50 bg-neutral-500/10 text-neutral-700\",\n\t\t\t\tsuccess: \"border-success-500/50 bg-success-500/10 text-success-700\",\n\t\t\t\twarning: \"border-warning-500/50 bg-warning-500/10 text-warning-700\",\n\t\t\t} as const satisfies Record<Priority, string>,\n\t\t},\n\t},\n);\n\ntype AlertProps = ComponentProps<\"div\"> & {\n\t/**\n\t * Indicates the importance or impact level of the Alert, affecting its\n\t * color and styling to communicate its purpose to the user.\n\t */\n\tpriority: Priority;\n};\n\n/**\n * Displays a callout for user attention. Root container for all Alert sub-components.\n *\n * @see https://mantle.ngrok.com/components/alert#api-alert\n *\n * @example\n * ```tsx\n * <Alert priority=\"info\">\n * <AlertIcon />\n * <AlertContent>\n * <AlertTitle>Alert Title</AlertTitle>\n * \t <AlertDismissIconButton />\n * <AlertDescription>\n * Alert description text.\n * </AlertDescription>\n * </AlertContent>\n * </Alert>\n *```\n */\nconst Alert = forwardRef<ComponentRef<\"div\">, AlertProps>(\n\t({ className, priority, ...props }, ref) => {\n\t\tconst context: AlertContextValue = useMemo(\n\t\t\t() => ({ priority }),\n\t\t\t[priority],\n\t\t);\n\n\t\treturn (\n\t\t\t<AlertContext.Provider value={context}>\n\t\t\t\t<div\n\t\t\t\t\tref={ref}\n\t\t\t\t\tclassName={cx(alertVariants({ priority }), className)}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t</AlertContext.Provider>\n\t\t);\n\t},\n);\nAlert.displayName = \"Alert\";\n\ntype AlertIconProps = Omit<SvgAttributes, \"children\"> & {\n\t/**\n\t * An optional icon that renders in place of the default icon for the Alert priority.\n\t */\n\tsvg?: ReactNode;\n};\n\n/**\n * Default `<AlertIcon>` icons for each priority.\n */\nconst defaultIcons = {\n\tdanger: <WarningIcon />,\n\tinfo: <InfoIcon />,\n\t// neutral: <BellRinging />,\n\tsuccess: <CheckCircleIcon />,\n\twarning: <WarningDiamondIcon />,\n} as const satisfies Record<Priority, ReactNode>;\n\n/**\n * An optional icon that visually represents the priority of the Alert.\n *\n * The default rendered icon be overridden with a custom icon using the `svg` prop.\n *\n * @see https://mantle.ngrok.com/components/alert#api-alert-icon\n *\n * @example\n * ```tsx\n * <Alert priority=\"info\">\n * <AlertIcon />\n * <AlertContent>\n * <AlertTitle>Alert Title</AlertTitle>\n * <AlertDismissIconButton />\n * <AlertDescription>\n * Alert description text.\n * </AlertDescription>\n * </AlertContent>\n * </Alert>\n * ```\n */\nconst AlertIcon = forwardRef<ComponentRef<\"svg\">, AlertIconProps>(\n\t({ className, svg, ...props }, ref) => {\n\t\tconst ctx = useAlertContext();\n\t\tconst defaultIcon = defaultIcons[ctx.priority];\n\n\t\treturn (\n\t\t\t<SvgOnly\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"size-5\", className)}\n\t\t\t\tsvg={svg ?? defaultIcon}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertIcon.displayName = \"AlertIcon\";\n\n/**\n * The container for the content slot of an alert. Place the title and description as direct children.\n *\n * @see https://mantle.ngrok.com/components/alert#api-alert-content\n *\n * @example\n * ```tsx\n * <Alert priority=\"info\">\n * <AlertIcon />\n * <AlertContent>\n * <AlertTitle>Alert Title</AlertTitle>\n * <AlertDismissIconButton />\n * <AlertDescription>\n * Alert description text.\n * </AlertDescription>\n * </AlertContent>\n * </Alert>\n *```\n */\nconst AlertContent = forwardRef<ComponentRef<\"div\">, ComponentProps<\"div\">>(\n\t({ className, ...props }, ref) => (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"min-w-0 flex-1 has-[[data-alert-dismiss]]:pr-6\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nAlertContent.displayName = \"AlertContent\";\n\ntype AlertTitleProps = HTMLAttributes<HTMLHeadingElement> & WithAsChild;\n\n/**\n * The title of an alert. Default renders as an h5 element, use asChild to render something else.\n *\n * @see https://mantle.ngrok.com/components/alert#api-alert-title\n *\n * @example\n * ```tsx\n * <Alert priority=\"info\">\n * <AlertIcon />\n * <AlertContent>\n * <AlertTitle>Alert Title</AlertTitle>\n * <AlertDismissIconButton />\n * <AlertDescription>\n * Alert description text.\n * </AlertDescription>\n * </AlertContent>\n * </Alert>\n *```\n */\nconst AlertTitle = forwardRef<HTMLHeadingElement, AlertTitleProps>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"h5\";\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"font-medium\", className)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertTitle.displayName = \"AlertTitle\";\n\ntype AlertDescriptionProps = ComponentProps<\"p\"> & WithAsChild;\n\n/**\n * The optional description of an alert. Default renders as an p element, use asChild to render something else.\n *\n * @see https://mantle.ngrok.com/components/alert#api-alert-description\n *\n * @example\n * ```tsx\n * <Alert priority=\"info\">\n * <AlertIcon />\n * <AlertContent>\n * <AlertTitle>Alert Title</AlertTitle>\n * <AlertDismissIconButton />\n * <AlertDescription>\n * Alert description text.\n * </AlertDescription>\n * </AlertContent>\n * </Alert>\n * ```\n */\nconst AlertDescription = forwardRef<ComponentRef<\"p\">, AlertDescriptionProps>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"p\";\n\n\t\treturn (\n\t\t\t<Component ref={ref} className={cx(\"text-sm\", className)} {...props} />\n\t\t);\n\t},\n);\nAlertDescription.displayName = \"AlertDescription\";\n\ntype AlertDismissIconButtonProps = Partial<Omit<IconButtonProps, \"icon\">>;\nconst AlertDismissIconButton = ({\n\tsize = \"sm\",\n\ttype = \"button\",\n\tlabel = \"Dismiss Alert\",\n\tappearance = \"ghost\",\n\tclassName,\n\t...props\n}: AlertDismissIconButtonProps) => {\n\tconst ctx = useAlertContext();\n\treturn (\n\t\t<IconButton\n\t\t\tappearance={appearance}\n\t\t\ticon={<XIcon />}\n\t\t\tlabel={label}\n\t\t\tsize={size}\n\t\t\tdata-alert-dismiss\n\t\t\tclassName={cx(\n\t\t\t\t\"right-1.5 top-1.5 absolute\",\n\t\t\t\t{\n\t\t\t\t\t\"text-danger-700 not-disabled:hover:text-danger-800 not-disabled:active:text-danger-900\":\n\t\t\t\t\t\tctx.priority === \"danger\",\n\t\t\t\t\t\"text-accent-700 not-disabled:hover:text-accent-800 not-disabled:active:text-accent-900\":\n\t\t\t\t\t\tctx.priority === \"info\",\n\t\t\t\t\t\"text-success-700 not-disabled:hover:text-success-800 not-disabled:active:text-success-900\":\n\t\t\t\t\t\tctx.priority === \"success\",\n\t\t\t\t\t\"text-warning-700 not-disabled:hover:text-warning-800 not-disabled:active:text-warning-900\":\n\t\t\t\t\t\tctx.priority === \"warning\",\n\t\t\t\t},\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\ttype={type}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\n\nexport {\n\t//,\n\tAlert,\n\tAlertContent,\n\tAlertDescription,\n\tAlertIcon,\n\tAlertTitle,\n\tAlertDismissIconButton,\n};\n"],"mappings":"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","names":["CheckCircleIcon","InfoIcon","WarningIcon","WarningDiamondIcon","XIcon","Slot","cva","createContext","forwardRef","useContext","useMemo","invariant","jsx","AlertContext","createContext","useAlertContext","context","useContext","invariant","alertVariants","cva","Alert","forwardRef","className","priority","props","ref","useMemo","jsx","cx","defaultIcons","WarningIcon","InfoIcon","CheckCircleIcon","WarningDiamondIcon","AlertIcon","svg","ctx","defaultIcon","SvgOnly","AlertContent","AlertTitle","asChild","Slot","AlertDescription","AlertDismissIconButton","size","type","label","appearance","IconButton","XIcon"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/alert/alert.tsx"],"sourcesContent":["import { CheckCircleIcon } from \"@phosphor-icons/react/CheckCircle\";\nimport { InfoIcon } from \"@phosphor-icons/react/Info\";\nimport { WarningIcon } from \"@phosphor-icons/react/Warning\";\nimport { WarningDiamondIcon } from \"@phosphor-icons/react/WarningDiamond\";\nimport { XIcon } from \"@phosphor-icons/react/X\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva } from \"class-variance-authority\";\nimport type {\n\tComponentProps,\n\tComponentRef,\n\tHTMLAttributes,\n\tReactNode,\n} from \"react\";\nimport { createContext, forwardRef, useContext, useMemo } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport type { WithAsChild } from \"../../types/index.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { IconButton, type IconButtonProps } from \"../button/icon-button.js\";\nimport { SvgOnly } from \"../icon/svg-only.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\n\nconst priorities = [\n\t//,\n\t\"danger\",\n\t\"info\",\n\t// \"neutral\",\n\t\"success\",\n\t\"warning\",\n] as const;\ntype Priority = (typeof priorities)[number];\n\ntype AlertContextValue = {\n\tpriority: Priority;\n};\n\nconst AlertContext = createContext<AlertContextValue | null>(null);\n\nfunction useAlertContext() {\n\tconst context = useContext(AlertContext);\n\tinvariant(context, \"useAlertContext hook used outside of Alert parent!\");\n\treturn context;\n}\n\nconst alertVariants = cva(\n\t\"relative flex w-full gap-1.5 rounded-md border p-2.5 text-sm\",\n\t{\n\t\tvariants: {\n\t\t\t/**\n\t\t\t * The priority of the Alert. Indicates the importance or impact level of the Alert,\n\t\t\t * affecting its color and styling to communicate its purpose to the user.\n\t\t\t */\n\t\t\tpriority: {\n\t\t\t\tdanger: \"border-danger-500/50 bg-danger-500/10 text-danger-700\",\n\t\t\t\tinfo: \"border-accent-500/50 bg-accent-500/10 text-accent-700\",\n\t\t\t\t// neutral: \"border-neutral-500/50 bg-neutral-500/10 text-neutral-700\",\n\t\t\t\tsuccess: \"border-success-500/50 bg-success-500/10 text-success-700\",\n\t\t\t\twarning: \"border-warning-500/50 bg-warning-500/10 text-warning-700\",\n\t\t\t} as const satisfies Record<Priority, string>,\n\t\t},\n\t},\n);\n\ntype AlertProps = ComponentProps<\"div\"> & {\n\t/**\n\t * Indicates the importance or impact level of the Alert, affecting its\n\t * color and styling to communicate its purpose to the user.\n\t */\n\tpriority: Priority;\n};\n\n/**\n * Displays a callout for user attention. Root container for all Alert sub-components.\n *\n * @see https://mantle.ngrok.com/components/alert#api-alert\n *\n * @example\n * ```tsx\n * <Alert priority=\"info\">\n * <AlertIcon />\n * <AlertContent>\n * <AlertTitle>Alert Title</AlertTitle>\n * \t <AlertDismissIconButton />\n * <AlertDescription>\n * Alert description text.\n * </AlertDescription>\n * </AlertContent>\n * </Alert>\n *```\n */\nconst Alert = forwardRef<ComponentRef<\"div\">, AlertProps>(\n\t({ className, priority, ...props }, ref) => {\n\t\tconst context: AlertContextValue = useMemo(\n\t\t\t() => ({ priority }),\n\t\t\t[priority],\n\t\t);\n\n\t\treturn (\n\t\t\t<AlertContext.Provider value={context}>\n\t\t\t\t<div\n\t\t\t\t\tref={ref}\n\t\t\t\t\tclassName={cx(alertVariants({ priority }), className)}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t</AlertContext.Provider>\n\t\t);\n\t},\n);\nAlert.displayName = \"Alert\";\n\ntype AlertIconProps = Omit<SvgAttributes, \"children\"> & {\n\t/**\n\t * An optional icon that renders in place of the default icon for the Alert priority.\n\t */\n\tsvg?: ReactNode;\n};\n\n/**\n * Default `<AlertIcon>` icons for each priority.\n */\nconst defaultIcons = {\n\tdanger: <WarningIcon />,\n\tinfo: <InfoIcon />,\n\t// neutral: <BellRinging />,\n\tsuccess: <CheckCircleIcon />,\n\twarning: <WarningDiamondIcon />,\n} as const satisfies Record<Priority, ReactNode>;\n\n/**\n * An optional icon that visually represents the priority of the Alert.\n *\n * The default rendered icon be overridden with a custom icon using the `svg` prop.\n *\n * @see https://mantle.ngrok.com/components/alert#api-alert-icon\n *\n * @example\n * ```tsx\n * <Alert priority=\"info\">\n * <AlertIcon />\n * <AlertContent>\n * <AlertTitle>Alert Title</AlertTitle>\n * <AlertDismissIconButton />\n * <AlertDescription>\n * Alert description text.\n * </AlertDescription>\n * </AlertContent>\n * </Alert>\n * ```\n */\nconst AlertIcon = forwardRef<ComponentRef<\"svg\">, AlertIconProps>(\n\t({ className, svg, ...props }, ref) => {\n\t\tconst ctx = useAlertContext();\n\t\tconst defaultIcon = defaultIcons[ctx.priority];\n\n\t\treturn (\n\t\t\t<SvgOnly\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"size-5\", className)}\n\t\t\t\tsvg={svg ?? defaultIcon}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertIcon.displayName = \"AlertIcon\";\n\n/**\n * The container for the content slot of an alert. Place the title and description as direct children.\n *\n * @see https://mantle.ngrok.com/components/alert#api-alert-content\n *\n * @example\n * ```tsx\n * <Alert priority=\"info\">\n * <AlertIcon />\n * <AlertContent>\n * <AlertTitle>Alert Title</AlertTitle>\n * <AlertDismissIconButton />\n * <AlertDescription>\n * Alert description text.\n * </AlertDescription>\n * </AlertContent>\n * </Alert>\n *```\n */\nconst AlertContent = forwardRef<ComponentRef<\"div\">, ComponentProps<\"div\">>(\n\t({ className, ...props }, ref) => (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cx(\n\t\t\t\t\"min-w-0 flex-1 has-[[data-alert-dismiss]]:pr-6\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n);\nAlertContent.displayName = \"AlertContent\";\n\ntype AlertTitleProps = HTMLAttributes<HTMLHeadingElement> & WithAsChild;\n\n/**\n * The title of an alert. Default renders as an h5 element, use asChild to render something else.\n *\n * @see https://mantle.ngrok.com/components/alert#api-alert-title\n *\n * @example\n * ```tsx\n * <Alert priority=\"info\">\n * <AlertIcon />\n * <AlertContent>\n * <AlertTitle>Alert Title</AlertTitle>\n * <AlertDismissIconButton />\n * <AlertDescription>\n * Alert description text.\n * </AlertDescription>\n * </AlertContent>\n * </Alert>\n *```\n */\nconst AlertTitle = forwardRef<HTMLHeadingElement, AlertTitleProps>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"h5\";\n\n\t\treturn (\n\t\t\t<Component\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"font-medium\", className)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertTitle.displayName = \"AlertTitle\";\n\ntype AlertDescriptionProps = ComponentProps<\"p\"> & WithAsChild;\n\n/**\n * The optional description of an alert. Default renders as an p element, use asChild to render something else.\n *\n * @see https://mantle.ngrok.com/components/alert#api-alert-description\n *\n * @example\n * ```tsx\n * <Alert priority=\"info\">\n * <AlertIcon />\n * <AlertContent>\n * <AlertTitle>Alert Title</AlertTitle>\n * <AlertDismissIconButton />\n * <AlertDescription>\n * Alert description text.\n * </AlertDescription>\n * </AlertContent>\n * </Alert>\n * ```\n */\nconst AlertDescription = forwardRef<ComponentRef<\"p\">, AlertDescriptionProps>(\n\t({ asChild = false, className, ...props }, ref) => {\n\t\tconst Component = asChild ? Slot : \"p\";\n\n\t\treturn (\n\t\t\t<Component ref={ref} className={cx(\"text-sm\", className)} {...props} />\n\t\t);\n\t},\n);\nAlertDescription.displayName = \"AlertDescription\";\n\ntype AlertDismissIconButtonProps = Partial<Omit<IconButtonProps, \"icon\">>;\nconst AlertDismissIconButton = ({\n\tsize = \"sm\",\n\ttype = \"button\",\n\tlabel = \"Dismiss Alert\",\n\tappearance = \"ghost\",\n\tclassName,\n\t...props\n}: AlertDismissIconButtonProps) => {\n\tconst ctx = useAlertContext();\n\treturn (\n\t\t<IconButton\n\t\t\tappearance={appearance}\n\t\t\ticon={<XIcon />}\n\t\t\tlabel={label}\n\t\t\tsize={size}\n\t\t\tdata-alert-dismiss\n\t\t\tclassName={cx(\n\t\t\t\t\"right-1.5 top-1.5 absolute\",\n\t\t\t\t{\n\t\t\t\t\t\"text-danger-700 not-disabled:hover:text-danger-800 not-disabled:active:text-danger-900\":\n\t\t\t\t\t\tctx.priority === \"danger\",\n\t\t\t\t\t\"text-accent-700 not-disabled:hover:text-accent-800 not-disabled:active:text-accent-900\":\n\t\t\t\t\t\tctx.priority === \"info\",\n\t\t\t\t\t\"text-success-700 not-disabled:hover:text-success-800 not-disabled:active:text-success-900\":\n\t\t\t\t\t\tctx.priority === \"success\",\n\t\t\t\t\t\"text-warning-700 not-disabled:hover:text-warning-800 not-disabled:active:text-warning-900\":\n\t\t\t\t\t\tctx.priority === \"warning\",\n\t\t\t\t},\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\ttype={type}\n\t\t\t{...props}\n\t\t/>\n\t);\n};\nAlertDismissIconButton.displayName = \"AlertDismissIconButton\";\n\nexport {\n\t//,\n\tAlert,\n\tAlertContent,\n\tAlertDescription,\n\tAlertIcon,\n\tAlertTitle,\n\tAlertDismissIconButton,\n};\n"],"mappings":"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","names":["CheckCircleIcon","InfoIcon","WarningIcon","WarningDiamondIcon","XIcon","Slot","cva","createContext","forwardRef","useContext","useMemo","invariant","jsx","AlertContext","createContext","useAlertContext","context","useContext","invariant","alertVariants","cva","Alert","forwardRef","className","priority","props","ref","useMemo","jsx","cx","defaultIcons","WarningIcon","InfoIcon","CheckCircleIcon","WarningDiamondIcon","AlertIcon","svg","ctx","defaultIcon","SvgOnly","AlertContent","AlertTitle","asChild","Slot","AlertDescription","AlertDismissIconButton","size","type","label","appearance","IconButton","XIcon"]}
|
package/dist/anchor.d.ts
CHANGED
|
@@ -63,7 +63,7 @@ type AnchorProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "rel" | "target
|
|
|
63
63
|
* @note If you need to link to an internal application route, prefer using the
|
|
64
64
|
* [`react-router` `<Link>`](https://reactrouter.com/en/main/components/link)
|
|
65
65
|
*
|
|
66
|
-
* @see https://mantle.ngrok.com/components/anchor#api
|
|
66
|
+
* @see https://mantle.ngrok.com/components/anchor#api-anchor
|
|
67
67
|
*
|
|
68
68
|
* @example
|
|
69
69
|
* ```tsx
|
package/dist/anchor.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as n}from"./chunk-
|
|
1
|
+
import{a as n}from"./chunk-I6T6YV2L.js";import"./chunk-NPTDRQT5.js";import{a as m}from"./chunk-AZ56JGNY.js";import{Slot as y}from"@radix-ui/react-slot";import{Children as b,cloneElement as v,forwardRef as N,isValidElement as C}from"react";import x from"tiny-invariant";import{Fragment as T,jsx as t,jsxs as p}from"react/jsx-runtime";var d=r=>m("cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent",r),u=N(({asChild:r,children:s,className:a,rel:l,icon:e,iconPlacement:o="start",...h},g)=>{let A=f(l),c={className:d(a),ref:g,rel:A,...h};if(r){let i=b.only(s);x(C(i),"When using `asChild`, Anchor must be passed a single child as a JSX tag.");let R=i.props?.children;return t(y,{...c,children:v(i,{},p(T,{children:[e&&o==="start"&&t(n,{className:"inline-block mr-1.5",svg:e}),R,e&&o==="end"&&t(n,{className:"inline-block ml-1.5",svg:e})]}))})}return p("a",{...c,children:[e&&o==="start"&&t(n,{className:"inline-block mr-1.5",svg:e}),s,e&&o==="end"&&t(n,{className:"inline-block ml-1.5",svg:e})]})});u.displayName="Anchor";function f(r){return Array.isArray(r)?[...new Set(r)].map(l=>l?.trim()).filter(Boolean).sort().join(" ")||void 0:r?.trim()||void 0}export{u as Anchor,d as anchorClassNames,f as resolveRel};
|
|
2
2
|
//# sourceMappingURL=anchor.js.map
|
package/dist/anchor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/anchor/anchor.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport type { AnchorHTMLAttributes, ComponentRef, ReactNode } from \"react\";\nimport { Children, cloneElement, forwardRef, isValidElement } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon } from \"../icon/icon.js\";\nimport type { Rel, Target } from \"./types.js\";\n\n/**\n * The class names for the `Anchor` component which define the styles for the component.\n */\nconst anchorClassNames = (className?: string) =>\n\tcx(\n\t\t\"cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent\",\n\t\tclassName,\n\t);\n\n/**\n * The props for the `Anchor` component.\n */\ntype AnchorProps = Omit<\n\tAnchorHTMLAttributes<HTMLAnchorElement>,\n\t\"rel\" | \"target\"\n> &\n\tWithAsChild & {\n\t\t/**\n\t\t * An icon to render inside the anchor\n\t\t */\n\t\ticon?: ReactNode;\n\t\t/**\n\t\t * The side that the icon will render on, if one is present\n\t\t * @default \"start\"\n\t\t */\n\t\ticonPlacement?: \"start\" | \"end\";\n\t\t/**\n\t\t * The rel attribute defines the relationship between a linked resource and the current document.\n\t\t *\n\t\t * Every keyword within a space-separated value should be unique within that value.\n\t\t *\n\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel\n\t\t */\n\t\trel?:\n\t\t\t| Rel\n\t\t\t| (string & {})\n\t\t\t| undefined\n\t\t\t| (Rel | (string & {}) | undefined | null)[];\n\t\t/**\n\t\t * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).\n\t\t *\n\t\t * Note: Setting `target=\"_blank\"` on <a> elements implicitly provides the same rel behavior as setting `rel=\"noopener\"` which does not set `window.opener`.\n\t\t *\n\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target\n\t\t *\n\t\t * @default \"_self\"\n\t\t */\n\t\ttarget?: Target | undefined;\n\t};\n\n/**\n * Fundamental component for rendering links to external addresses.\n *\n * @note If you need to link to an internal application route, prefer using the\n * [`react-router` `<Link>`](https://reactrouter.com/en/main/components/link)\n *\n * @see https://mantle.ngrok.com/components/anchor#api\n *\n * @example\n * ```tsx\n * <Anchor href=\"https://ngrok.com/\">ngrok.com</Anchor>\n *\n * <Anchor href=\"https://ngrok.com/docs\" target=\"_blank\" icon={<Book />}>\n * ngrok docs\n * </Anchor>\n * ```\n */\nconst Anchor = forwardRef<ComponentRef<\"a\">, AnchorProps>(\n\t(\n\t\t{\n\t\t\tasChild,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\trel: propRel,\n\t\t\ticon,\n\t\t\ticonPlacement = \"start\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst rel = resolveRel(propRel);\n\t\tconst componentProps = {\n\t\t\tclassName: anchorClassNames(className),\n\t\t\tref,\n\t\t\trel,\n\t\t\t...props,\n\t\t};\n\n\t\tif (asChild) {\n\t\t\tconst singleChild = Children.only(children);\n\t\t\tinvariant(\n\t\t\t\tisValidElement<AnchorProps>(singleChild),\n\t\t\t\t\"When using `asChild`, Anchor must be passed a single child as a JSX tag.\",\n\t\t\t);\n\t\t\tconst grandchildren = singleChild.props?.children;\n\n\t\t\treturn (\n\t\t\t\t<Slot {...componentProps}>\n\t\t\t\t\t{cloneElement(\n\t\t\t\t\t\tsingleChild,\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{icon && iconPlacement === \"start\" && (\n\t\t\t\t\t\t\t\t<Icon className=\"inline-block mr-1.5\" svg={icon} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{grandchildren}\n\t\t\t\t\t\t\t{icon && iconPlacement === \"end\" && (\n\t\t\t\t\t\t\t\t<Icon className=\"inline-block ml-1.5\" svg={icon} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</>,\n\t\t\t\t\t)}\n\t\t\t\t</Slot>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<a {...componentProps}>\n\t\t\t\t{icon && iconPlacement === \"start\" && (\n\t\t\t\t\t<Icon className=\"inline-block mr-1.5\" svg={icon} />\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t\t{icon && iconPlacement === \"end\" && (\n\t\t\t\t\t<Icon className=\"inline-block ml-1.5\" svg={icon} />\n\t\t\t\t)}\n\t\t\t</a>\n\t\t);\n\t},\n);\nAnchor.displayName = \"Anchor\";\n\n/**\n * Resolves the `rel` attribute to a string.\n *\n * If the value is an array, it will be filtered for empty values, ensure uniqueness, sorted, and joined with a space.\n */\nfunction resolveRel(\n\trel:\n\t\t| Rel\n\t\t| (string & {})\n\t\t| undefined\n\t\t| null\n\t\t| (Rel | (string & {}) | undefined | null)[],\n) {\n\tif (Array.isArray(rel)) {\n\t\tconst uniqueRel = new Set(rel);\n\t\tconst result = [...uniqueRel]\n\t\t\t.map((item) => item?.trim())\n\t\t\t.filter(Boolean)\n\t\t\t.sort()\n\t\t\t.join(\" \");\n\t\treturn result || undefined;\n\t}\n\n\treturn rel?.trim() || undefined;\n}\n\nexport {\n\t//,\n\tAnchor,\n\tanchorClassNames,\n\tresolveRel,\n};\n\nexport type {\n\t//,\n\tAnchorProps,\n};\n"],"mappings":"4GAAA,OAAS,QAAAA,MAAY,uBAErB,OAAS,YAAAC,EAAU,gBAAAC,EAAc,cAAAC,EAAY,kBAAAC,MAAsB,QACnE,OAAOC,MAAe,iBA2GhB,mBAAAC,EAEE,OAAAC,EAFF,QAAAC,MAAA,oBAlGN,IAAMC,EAAoBC,GACzBC,EACC,8IACAD,CACD,EA4DKE,EAASC,EACd,CACC,CACC,QAAAC,EACA,SAAAC,EACA,UAAAL,EACA,IAAKM,EACL,KAAAC,EACA,cAAAC,EAAgB,QAChB,GAAGC,CACJ,EACAC,IACI,CACJ,IAAMC,EAAMC,EAAWN,CAAO,EACxBO,EAAiB,CACtB,UAAWd,EAAiBC,CAAS,EACrC,IAAAU,EACA,IAAAC,EACA,GAAGF,CACJ,EAEA,GAAIL,EAAS,CACZ,IAAMU,EAAcC,EAAS,KAAKV,CAAQ,EAC1CW,EACCC,EAA4BH,CAAW,EACvC,0EACD,EACA,IAAMI,EAAgBJ,EAAY,OAAO,SAEzC,OACCjB,EAACsB,EAAA,CAAM,GAAGN,EACR,SAAAO,EACAN,EACA,CAAC,EACDhB,EAAAF,EAAA,CACE,UAAAW,GAAQC,IAAkB,SAC1BX,EAACwB,EAAA,CAAK,UAAU,sBAAsB,IAAKd,EAAM,EAEjDW,EACAX,GAAQC,IAAkB,OAC1BX,EAACwB,EAAA,CAAK,UAAU,sBAAsB,IAAKd,EAAM,GAEnD,CACD,EACD,CAEF,CAEA,OACCT,EAAC,KAAG,GAAGe,EACL,UAAAN,GAAQC,IAAkB,SAC1BX,EAACwB,EAAA,CAAK,UAAU,sBAAsB,IAAKd,EAAM,EAEjDF,EACAE,GAAQC,IAAkB,OAC1BX,EAACwB,EAAA,CAAK,UAAU,sBAAsB,IAAKd,EAAM,GAEnD,CAEF,CACD,EACAL,EAAO,YAAc,SAOrB,SAASU,EACRD,EAMC,CACD,OAAI,MAAM,QAAQA,CAAG,EAEL,CAAC,GADE,IAAI,IAAIA,CAAG,CACD,EAC1B,IAAKW,GAASA,GAAM,KAAK,CAAC,EAC1B,OAAO,OAAO,EACd,KAAK,EACL,KAAK,GAAG,GACO,OAGXX,GAAK,KAAK,GAAK,MACvB","names":["Slot","Children","cloneElement","forwardRef","isValidElement","invariant","Fragment","jsx","jsxs","anchorClassNames","className","cx","Anchor","forwardRef","asChild","children","propRel","icon","iconPlacement","props","ref","rel","resolveRel","componentProps","singleChild","Children","invariant","isValidElement","grandchildren","Slot","cloneElement","Icon","item"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/anchor/anchor.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport type { AnchorHTMLAttributes, ComponentRef, ReactNode } from \"react\";\nimport { Children, cloneElement, forwardRef, isValidElement } from \"react\";\nimport invariant from \"tiny-invariant\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport { Icon } from \"../icon/icon.js\";\nimport type { Rel, Target } from \"./types.js\";\n\n/**\n * The class names for the `Anchor` component which define the styles for the component.\n */\nconst anchorClassNames = (className?: string) =>\n\tcx(\n\t\t\"cursor-pointer rounded bg-transparent text-accent-600 hover:underline focus:outline-none focus-visible:ring focus-visible:ring-focus-accent\",\n\t\tclassName,\n\t);\n\n/**\n * The props for the `Anchor` component.\n */\ntype AnchorProps = Omit<\n\tAnchorHTMLAttributes<HTMLAnchorElement>,\n\t\"rel\" | \"target\"\n> &\n\tWithAsChild & {\n\t\t/**\n\t\t * An icon to render inside the anchor\n\t\t */\n\t\ticon?: ReactNode;\n\t\t/**\n\t\t * The side that the icon will render on, if one is present\n\t\t * @default \"start\"\n\t\t */\n\t\ticonPlacement?: \"start\" | \"end\";\n\t\t/**\n\t\t * The rel attribute defines the relationship between a linked resource and the current document.\n\t\t *\n\t\t * Every keyword within a space-separated value should be unique within that value.\n\t\t *\n\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel\n\t\t */\n\t\trel?:\n\t\t\t| Rel\n\t\t\t| (string & {})\n\t\t\t| undefined\n\t\t\t| (Rel | (string & {}) | undefined | null)[];\n\t\t/**\n\t\t * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).\n\t\t *\n\t\t * Note: Setting `target=\"_blank\"` on <a> elements implicitly provides the same rel behavior as setting `rel=\"noopener\"` which does not set `window.opener`.\n\t\t *\n\t\t * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target\n\t\t *\n\t\t * @default \"_self\"\n\t\t */\n\t\ttarget?: Target | undefined;\n\t};\n\n/**\n * Fundamental component for rendering links to external addresses.\n *\n * @note If you need to link to an internal application route, prefer using the\n * [`react-router` `<Link>`](https://reactrouter.com/en/main/components/link)\n *\n * @see https://mantle.ngrok.com/components/anchor#api-anchor\n *\n * @example\n * ```tsx\n * <Anchor href=\"https://ngrok.com/\">ngrok.com</Anchor>\n *\n * <Anchor href=\"https://ngrok.com/docs\" target=\"_blank\" icon={<Book />}>\n * ngrok docs\n * </Anchor>\n * ```\n */\nconst Anchor = forwardRef<ComponentRef<\"a\">, AnchorProps>(\n\t(\n\t\t{\n\t\t\tasChild,\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\trel: propRel,\n\t\t\ticon,\n\t\t\ticonPlacement = \"start\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst rel = resolveRel(propRel);\n\t\tconst componentProps = {\n\t\t\tclassName: anchorClassNames(className),\n\t\t\tref,\n\t\t\trel,\n\t\t\t...props,\n\t\t};\n\n\t\tif (asChild) {\n\t\t\tconst singleChild = Children.only(children);\n\t\t\tinvariant(\n\t\t\t\tisValidElement<AnchorProps>(singleChild),\n\t\t\t\t\"When using `asChild`, Anchor must be passed a single child as a JSX tag.\",\n\t\t\t);\n\t\t\tconst grandchildren = singleChild.props?.children;\n\n\t\t\treturn (\n\t\t\t\t<Slot {...componentProps}>\n\t\t\t\t\t{cloneElement(\n\t\t\t\t\t\tsingleChild,\n\t\t\t\t\t\t{},\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{icon && iconPlacement === \"start\" && (\n\t\t\t\t\t\t\t\t<Icon className=\"inline-block mr-1.5\" svg={icon} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{grandchildren}\n\t\t\t\t\t\t\t{icon && iconPlacement === \"end\" && (\n\t\t\t\t\t\t\t\t<Icon className=\"inline-block ml-1.5\" svg={icon} />\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</>,\n\t\t\t\t\t)}\n\t\t\t\t</Slot>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<a {...componentProps}>\n\t\t\t\t{icon && iconPlacement === \"start\" && (\n\t\t\t\t\t<Icon className=\"inline-block mr-1.5\" svg={icon} />\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t\t{icon && iconPlacement === \"end\" && (\n\t\t\t\t\t<Icon className=\"inline-block ml-1.5\" svg={icon} />\n\t\t\t\t)}\n\t\t\t</a>\n\t\t);\n\t},\n);\nAnchor.displayName = \"Anchor\";\n\n/**\n * Resolves the `rel` attribute to a string.\n *\n * If the value is an array, it will be filtered for empty values, ensure uniqueness, sorted, and joined with a space.\n */\nfunction resolveRel(\n\trel:\n\t\t| Rel\n\t\t| (string & {})\n\t\t| undefined\n\t\t| null\n\t\t| (Rel | (string & {}) | undefined | null)[],\n) {\n\tif (Array.isArray(rel)) {\n\t\tconst uniqueRel = new Set(rel);\n\t\tconst result = [...uniqueRel]\n\t\t\t.map((item) => item?.trim())\n\t\t\t.filter(Boolean)\n\t\t\t.sort()\n\t\t\t.join(\" \");\n\t\treturn result || undefined;\n\t}\n\n\treturn rel?.trim() || undefined;\n}\n\nexport {\n\t//,\n\tAnchor,\n\tanchorClassNames,\n\tresolveRel,\n};\n\nexport type {\n\t//,\n\tAnchorProps,\n};\n"],"mappings":"4GAAA,OAAS,QAAAA,MAAY,uBAErB,OAAS,YAAAC,EAAU,gBAAAC,EAAc,cAAAC,EAAY,kBAAAC,MAAsB,QACnE,OAAOC,MAAe,iBA2GhB,mBAAAC,EAEE,OAAAC,EAFF,QAAAC,MAAA,oBAlGN,IAAMC,EAAoBC,GACzBC,EACC,8IACAD,CACD,EA4DKE,EAASC,EACd,CACC,CACC,QAAAC,EACA,SAAAC,EACA,UAAAL,EACA,IAAKM,EACL,KAAAC,EACA,cAAAC,EAAgB,QAChB,GAAGC,CACJ,EACAC,IACI,CACJ,IAAMC,EAAMC,EAAWN,CAAO,EACxBO,EAAiB,CACtB,UAAWd,EAAiBC,CAAS,EACrC,IAAAU,EACA,IAAAC,EACA,GAAGF,CACJ,EAEA,GAAIL,EAAS,CACZ,IAAMU,EAAcC,EAAS,KAAKV,CAAQ,EAC1CW,EACCC,EAA4BH,CAAW,EACvC,0EACD,EACA,IAAMI,EAAgBJ,EAAY,OAAO,SAEzC,OACCjB,EAACsB,EAAA,CAAM,GAAGN,EACR,SAAAO,EACAN,EACA,CAAC,EACDhB,EAAAF,EAAA,CACE,UAAAW,GAAQC,IAAkB,SAC1BX,EAACwB,EAAA,CAAK,UAAU,sBAAsB,IAAKd,EAAM,EAEjDW,EACAX,GAAQC,IAAkB,OAC1BX,EAACwB,EAAA,CAAK,UAAU,sBAAsB,IAAKd,EAAM,GAEnD,CACD,EACD,CAEF,CAEA,OACCT,EAAC,KAAG,GAAGe,EACL,UAAAN,GAAQC,IAAkB,SAC1BX,EAACwB,EAAA,CAAK,UAAU,sBAAsB,IAAKd,EAAM,EAEjDF,EACAE,GAAQC,IAAkB,OAC1BX,EAACwB,EAAA,CAAK,UAAU,sBAAsB,IAAKd,EAAM,GAEnD,CAEF,CACD,EACAL,EAAO,YAAc,SAOrB,SAASU,EACRD,EAMC,CACD,OAAI,MAAM,QAAQA,CAAG,EAEL,CAAC,GADE,IAAI,IAAIA,CAAG,CACD,EAC1B,IAAKW,GAASA,GAAM,KAAK,CAAC,EAC1B,OAAO,OAAO,EACd,KAAK,EACL,KAAK,GAAG,GACO,OAGXX,GAAK,KAAK,GAAK,MACvB","names":["Slot","Children","cloneElement","forwardRef","isValidElement","invariant","Fragment","jsx","jsxs","anchorClassNames","className","cx","Anchor","forwardRef","asChild","children","propRel","icon","iconPlacement","props","ref","rel","resolveRel","componentProps","singleChild","Children","invariant","isValidElement","grandchildren","Slot","cloneElement","Icon","item"]}
|
package/dist/badge.d.ts
CHANGED
|
@@ -32,6 +32,9 @@ type BadgeProps = ComponentProps<"span"> & WithAsChild & {
|
|
|
32
32
|
* </Badge>
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
|
-
declare const Badge:
|
|
35
|
+
declare const Badge: {
|
|
36
|
+
({ appearance, asChild, children, className, color, icon, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
displayName: string;
|
|
38
|
+
};
|
|
36
39
|
|
|
37
40
|
export { Badge, type BadgeProps };
|
package/dist/badge.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-NPTDRQT5.js";import{a as c}from"./chunk-AZ56JGNY.js";import{Slot as f}from"@radix-ui/react-slot";import{Children as C,cloneElement as h,isValidElement as k}from"react";import n from"tiny-invariant";import{Fragment as P,jsx as s,jsxs as d}from"react/jsx-runtime";var m=({appearance:t,asChild:e=!1,children:l,className:u,color:g="neutral",icon:r,...i})=>{let b=B(g,t),x=N(g,t),p=c("inline-flex w-fit shrink-0 cursor-default items-center gap-1 rounded px-1.5 py-0.5 font-medium text-xs",r&&"ps-1",b,x,u);if(e){let a=C.only(l);n(k(a),"When using `asChild`, Badge must be passed a single child as a JSX tag.");let y=a.props?.children;return s(f,{className:p,...i,children:h(a,{},d(P,{children:[r&&s(o,{className:"size-4",svg:r}),y]}))})}return d("span",{className:p,...i,children:[r&&s(o,{className:"size-4",svg:r}),l]})};m.displayName="Badge";var w={amber:"bg-amber-500/20",blue:"bg-blue-500/20",cyan:"bg-cyan-500/20",emerald:"bg-emerald-500/20",fuchsia:"bg-fuchsia-500/20",gray:"bg-gray-500/20",green:"bg-green-500/20",indigo:"bg-indigo-500/20",lime:"bg-lime-500/20",orange:"bg-orange-500/20",pink:"bg-pink-500/20",purple:"bg-purple-500/20",red:"bg-red-500/20",rose:"bg-rose-500/20",sky:"bg-sky-500/20",teal:"bg-teal-500/20",violet:"bg-violet-500/20",yellow:"bg-yellow-500/20",accent:"bg-accent-500/20",danger:"bg-danger-500/20",neutral:"bg-neutral-500/20",success:"bg-success-500/20",warning:"bg-warning-500/20"};function B(t,e){switch(e){case"muted":return w[t];default:n(!1,`Invalid appearance: ${String(e)}`)}}var v={amber:"text-amber-700",blue:"text-blue-700",cyan:"text-cyan-700",emerald:"text-emerald-700",fuchsia:"text-fuchsia-700",gray:"text-gray-700",green:"text-green-700",indigo:"text-indigo-700",lime:"text-lime-700",orange:"text-orange-700",pink:"text-pink-700",purple:"text-purple-700",red:"text-red-700",rose:"text-rose-700",sky:"text-sky-700",teal:"text-teal-700",violet:"text-violet-700",yellow:"text-yellow-700",accent:"text-accent-700",danger:"text-danger-700",neutral:"text-neutral-700",success:"text-success-700",warning:"text-warning-700"};function N(t,e){switch(e){case"muted":return v[t];default:n(!1,`Invalid appearance: ${String(e)}`)}}export{m as Badge};
|
|
2
2
|
//# sourceMappingURL=badge.js.map
|