luan-ui 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/components/accordion/accordion.d.ts +14 -15
- package/dist/components/accordion/accordion.js +11 -9
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/alert/alert.d.ts +19 -18
- package/dist/components/alert/alert.js +35 -15
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.d.ts +14 -9
- package/dist/components/alert-dialog/alert-dialog.js +21 -15
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/avatar/avatar-group.d.ts +3 -2
- package/dist/components/avatar/avatar-group.js +4 -4
- package/dist/components/avatar/avatar-group.js.map +1 -1
- package/dist/components/avatar/avatar.d.ts +8 -4
- package/dist/components/avatar/avatar.js +10 -8
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/badge/badge.d.ts +12 -5
- package/dist/components/badge/badge.js +18 -7
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/button/button.d.ts +24 -18
- package/dist/components/button/button.js +30 -15
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/card/card.d.ts +32 -19
- package/dist/components/card/card.js +52 -20
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/checkbox/checkbox.d.ts +6 -7
- package/dist/components/checkbox/checkbox.js +6 -8
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/dialog/dialog.d.ts +16 -9
- package/dist/components/dialog/dialog.js +23 -18
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.d.ts +19 -9
- package/dist/components/drawer/drawer.js +31 -25
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +30 -21
- package/dist/components/dropdown-menu/dropdown-menu.js +35 -30
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/form-field/form-field.d.ts +4 -8
- package/dist/components/form-field/form-field.js +3 -4
- package/dist/components/form-field/form-field.js.map +1 -1
- package/dist/components/form-helper/form-helper.d.ts +4 -6
- package/dist/components/form-helper/form-helper.js +2 -3
- package/dist/components/form-helper/form-helper.js.map +1 -1
- package/dist/components/icon/icon.d.ts +9 -15
- package/dist/components/icon/icon.js +20 -19
- package/dist/components/icon/icon.js.map +1 -1
- package/dist/components/input/input.d.ts +4 -4
- package/dist/components/input/input.js +2 -4
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/label/label.d.ts +3 -4
- package/dist/components/label/label.js +5 -6
- package/dist/components/label/label.js.map +1 -1
- package/dist/components/pagination/pagination.d.ts +25 -21
- package/dist/components/pagination/pagination.js +30 -19
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/popover/popover.d.ts +30 -14
- package/dist/components/popover/popover.js +30 -22
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/progress/progress.d.ts +4 -6
- package/dist/components/progress/progress.js +4 -6
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts +8 -7
- package/dist/components/radio-group/radio-group.js +8 -35
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/select/select.d.ts +26 -15
- package/dist/components/select/select.js +28 -50
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/skeleton/skeleton.d.ts +3 -1
- package/dist/components/skeleton/skeleton.js +3 -6
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/slider/slider.d.ts +7 -14
- package/dist/components/slider/slider.js +23 -13
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/switch/switch.d.ts +7 -7
- package/dist/components/switch/switch.js +9 -11
- package/dist/components/switch/switch.js.map +1 -1
- package/dist/components/table/table.d.ts +17 -8
- package/dist/components/table/table.js +24 -41
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.d.ts +9 -5
- package/dist/components/tabs/tabs.js +10 -8
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/text-area/text-area.d.ts +3 -5
- package/dist/components/text-area/text-area.js +2 -4
- package/dist/components/text-area/text-area.js.map +1 -1
- package/dist/components/toast/toast.d.ts +4 -10
- package/dist/components/toast/toast.js +4 -7
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/tooltip/tooltip.d.ts +18 -9
- package/dist/components/tooltip/tooltip.js +21 -20
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +2 -2
- package/dist/utilities/merge-refs/merge-refs.d.ts +2 -2
- package/dist/utilities/merge-refs/merge-refs.js +1 -1
- package/dist/utilities/merge-refs/merge-refs.js.map +1 -1
- package/dist/utilities/responsive/responsive.d.ts +14 -10
- package/package.json +71 -72
- package/dist/components/slot/slot.d.ts +0 -13
- package/dist/components/slot/slot.js +0 -70
- package/dist/components/slot/slot.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# luan-ui
|
|
2
2
|
|
|
3
|
-
Luan UI is built with Tailwind on top of
|
|
3
|
+
Luan UI is built with Tailwind on top of Base UI Primitives. It includes Responsive values that can be defined based on breakpoints.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -29,12 +29,16 @@ In your project, you have to import the custom config to enable animations and c
|
|
|
29
29
|
|
|
30
30
|
Now you should be able to use the components in your project.
|
|
31
31
|
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
This library requires **React 19** or higher due to its use of the ref-as-prop pattern.
|
|
35
|
+
|
|
32
36
|
## Philosophy
|
|
33
37
|
|
|
34
38
|
While I strive for some standardisation and enforcement of best practices, it is equally important that all components remain flexible and that they easily adapt to changing requirements among consumers. Having common design requirements shouldn't limit consumers in their way how they use the components.
|
|
35
39
|
|
|
36
40
|
Therefore all the components pass on their standard HTML props. You can use and overwrite all props like id, event handlers and so on. Also all components forward their ref, hence they can be targeted by other libraries or with settings refs yourself.
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
Base UI is used as a headless UI library. Using a headless ui library gives you the advantage to have full control over the styling, while the "heavy-lifting" - especially in regards to accessibility - is done for you already. Because handling focus, setting the appropriate aria attributes and similar things are a difficult task to do right.
|
|
39
43
|
|
|
40
|
-
All of the components are built with composability and extensibility in mind.
|
|
44
|
+
All of the components are built with composability and extensibility in mind.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Accordion as
|
|
2
|
-
import {
|
|
1
|
+
import { Accordion as BaseAccordion } from "@base-ui/react/accordion";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* Accordion component that allows users to expand and collapse content sections.
|
|
5
|
-
* Built on top of
|
|
5
|
+
* Built on top of Base UI's Accordion primitive.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```tsx
|
|
9
|
-
* <Accordion
|
|
9
|
+
* <Accordion>
|
|
10
10
|
* <AccordionItem value="item-1">
|
|
11
11
|
* <AccordionTrigger>Section 1</AccordionTrigger>
|
|
12
12
|
* <AccordionContent>Content for section 1</AccordionContent>
|
|
@@ -17,18 +17,17 @@ import { type ComponentPropsWithoutRef } from "react";
|
|
|
17
17
|
* @param {Object} props - The component props
|
|
18
18
|
* @param {string} props.className - Optional class name for custom styling
|
|
19
19
|
* @param {React.ReactNode} props.children - The accordion items to render
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {string} [props.value] - The controlled value(s) of the expanded accordion item(s)
|
|
20
|
+
* @param {boolean} [props.multiple=false] - Whether to allow multiple items expanded at once
|
|
21
|
+
* @param {any[]} [props.value] - The controlled value(s) of the expanded accordion item(s)
|
|
23
22
|
* @param {function} [props.onValueChange] - Callback when value changes
|
|
24
23
|
* @returns {React.ReactNode} The rendered accordion component
|
|
25
24
|
*/
|
|
26
|
-
export type AccordionProps =
|
|
27
|
-
declare const Accordion: import("react").ForwardRefExoticComponent<(
|
|
28
|
-
export type AccordionItemProps =
|
|
29
|
-
declare
|
|
30
|
-
export type AccordionTriggerProps =
|
|
31
|
-
declare
|
|
32
|
-
export type AccordionContentProps =
|
|
33
|
-
declare
|
|
25
|
+
export type AccordionProps = ComponentProps<typeof BaseAccordion.Root>;
|
|
26
|
+
declare const Accordion: import("react").ForwardRefExoticComponent<import("@base-ui/react/accordion").AccordionRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
27
|
+
export type AccordionItemProps = ComponentProps<typeof BaseAccordion.Item>;
|
|
28
|
+
declare function AccordionItem({ className, ref, ...props }: AccordionItemProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export type AccordionTriggerProps = ComponentProps<typeof BaseAccordion.Trigger>;
|
|
30
|
+
declare function AccordionTrigger({ className, children, ref, ...props }: AccordionTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export type AccordionContentProps = ComponentProps<typeof BaseAccordion.Panel>;
|
|
32
|
+
declare function AccordionContent({ className, children, ref, ...props }: AccordionContentProps): import("react/jsx-runtime").JSX.Element;
|
|
34
33
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Accordion as BaseAccordion } from "@base-ui/react/accordion";
|
|
2
3
|
import { Icon } from "../icon/icon";
|
|
3
4
|
import { ChevronDownIcon } from "@radix-ui/react-icons";
|
|
4
5
|
import { cn } from "../../utilities/cn/cn";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const Accordion = BaseAccordion.Root;
|
|
7
|
+
function AccordionItem({ className, ref, ...props }) {
|
|
8
|
+
return (_jsx(BaseAccordion.Item, { ref: ref, className: cn("border-gray-200 border-b", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function AccordionTrigger({ className, children, ref, ...props }) {
|
|
11
|
+
return (_jsx(BaseAccordion.Header, { className: "flex", children: _jsxs(BaseAccordion.Trigger, { ref: ref, className: cn("flex flex-1 cursor-pointer items-center justify-between py-4 text-left font-medium text-sm transition-all hover:underline [&[data-panel-open]>svg]:rotate-180", className), ...props, children: [children, _jsx(Icon, { render: _jsx(ChevronDownIcon, { className: "shrink-0 cursor-pointer text-gray-500 transition-transform duration-350" }), size: "small" })] }) }));
|
|
12
|
+
}
|
|
13
|
+
function AccordionContent({ className, children, ref, ...props }) {
|
|
14
|
+
return (_jsx(BaseAccordion.Panel, { ref: ref, className: cn("h-(--accordion-panel-height) overflow-hidden text-sm transition-[height] duration-350 ease-in-out data-ending-style:h-0 data-starting-style:h-0", className), ...props, children: _jsx("div", { className: "pt-0 pb-4", children: children }) }));
|
|
15
|
+
}
|
|
14
16
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger };
|
|
15
17
|
//# sourceMappingURL=accordion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","sourceRoot":"/","sources":["components/accordion/accordion.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"accordion.js","sourceRoot":"/","sources":["components/accordion/accordion.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AA4BtC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC;AAIrC,SAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAsB;IACtE,OAAO,CACN,KAAC,aAAa,CAAC,IAAI,IAClB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,0BAA0B,EAAE,SAAS,CAAC,KAChD,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAMD,SAAS,gBAAgB,CAAC,EACzB,SAAS,EACT,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACe;IACvB,OAAO,CACN,KAAC,aAAa,CAAC,MAAM,IAAC,SAAS,EAAC,MAAM,YACrC,MAAC,aAAa,CAAC,OAAO,IACrB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,+JAA+J,EAC/J,SAAS,CACT,KACG,KAAK,aAER,QAAQ,EACT,KAAC,IAAI,IACJ,MAAM,EACL,KAAC,eAAe,IAAC,SAAS,EAAC,yEAAyE,GAAG,EAExG,IAAI,EAAC,OAAO,GACX,IACqB,GACF,CACvB,CAAC;AACH,CAAC;AAID,SAAS,gBAAgB,CAAC,EACzB,SAAS,EACT,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACe;IACvB,OAAO,CACN,KAAC,aAAa,CAAC,KAAK,IACnB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,iJAAiJ,EACjJ,SAAS,CACT,KACG,KAAK,YAET,cAAK,SAAS,EAAC,WAAW,YAAE,QAAQ,GAAO,GACtB,CACtB,CAAC;AACH,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { Accordion as BaseAccordion } from \"@base-ui/react/accordion\";\nimport { Icon } from \"@components/icon/icon\";\nimport { ChevronDownIcon } from \"@radix-ui/react-icons\";\nimport { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\n\n/**\n * Accordion component that allows users to expand and collapse content sections.\n * Built on top of Base UI's Accordion primitive.\n *\n * @example\n * ```tsx\n * <Accordion>\n * <AccordionItem value=\"item-1\">\n * <AccordionTrigger>Section 1</AccordionTrigger>\n * <AccordionContent>Content for section 1</AccordionContent>\n * </AccordionItem>\n * </Accordion>\n * ```\n *\n * @param {Object} props - The component props\n * @param {string} props.className - Optional class name for custom styling\n * @param {React.ReactNode} props.children - The accordion items to render\n * @param {boolean} [props.multiple=false] - Whether to allow multiple items expanded at once\n * @param {any[]} [props.value] - The controlled value(s) of the expanded accordion item(s)\n * @param {function} [props.onValueChange] - Callback when value changes\n * @returns {React.ReactNode} The rendered accordion component\n */\n\nexport type AccordionProps = ComponentProps<typeof BaseAccordion.Root>;\n\nconst Accordion = BaseAccordion.Root;\n\nexport type AccordionItemProps = ComponentProps<typeof BaseAccordion.Item>;\n\nfunction AccordionItem({ className, ref, ...props }: AccordionItemProps) {\n\treturn (\n\t\t<BaseAccordion.Item\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"border-gray-200 border-b\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport type AccordionTriggerProps = ComponentProps<\n\ttypeof BaseAccordion.Trigger\n>;\n\nfunction AccordionTrigger({\n\tclassName,\n\tchildren,\n\tref,\n\t...props\n}: AccordionTriggerProps) {\n\treturn (\n\t\t<BaseAccordion.Header className=\"flex\">\n\t\t\t<BaseAccordion.Trigger\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"flex flex-1 cursor-pointer items-center justify-between py-4 text-left font-medium text-sm transition-all hover:underline [&[data-panel-open]>svg]:rotate-180\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t<Icon\n\t\t\t\t\trender={\n\t\t\t\t\t\t<ChevronDownIcon className=\"shrink-0 cursor-pointer text-gray-500 transition-transform duration-350\" />\n\t\t\t\t\t}\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t/>\n\t\t\t</BaseAccordion.Trigger>\n\t\t</BaseAccordion.Header>\n\t);\n}\n\nexport type AccordionContentProps = ComponentProps<typeof BaseAccordion.Panel>;\n\nfunction AccordionContent({\n\tclassName,\n\tchildren,\n\tref,\n\t...props\n}: AccordionContentProps) {\n\treturn (\n\t\t<BaseAccordion.Panel\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"h-(--accordion-panel-height) overflow-hidden text-sm transition-[height] duration-350 ease-in-out data-ending-style:h-0 data-starting-style:h-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<div className=\"pt-0 pb-4\">{children}</div>\n\t\t</BaseAccordion.Panel>\n\t);\n}\n\nexport { Accordion, AccordionContent, AccordionItem, AccordionTrigger };\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
1
2
|
import type { ResponsiveValue } from "../../utilities/responsive/responsive";
|
|
2
|
-
|
|
3
|
-
type AlertProps = ComponentPropsWithoutRef<"div"> & {
|
|
3
|
+
type AlertProps = useRender.ComponentProps<"div"> & {
|
|
4
4
|
variant?: "primary" | "secondary" | "error";
|
|
5
|
-
asChild?: boolean;
|
|
6
5
|
size?: ResponsiveValue<"small" | "medium">;
|
|
6
|
+
className?: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const SIZES: {
|
|
9
9
|
sm: {
|
|
@@ -23,13 +23,12 @@ export declare const SIZES: {
|
|
|
23
23
|
medium: string;
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
declare
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
asChild?: boolean;
|
|
26
|
+
declare function Alert({ variant, size, className, render, children, ...props }: AlertProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
27
|
+
declare namespace Alert {
|
|
28
|
+
var displayName: string;
|
|
29
|
+
}
|
|
30
|
+
type AlertTitleProps = useRender.ComponentProps<"div"> & {
|
|
31
|
+
className?: string;
|
|
33
32
|
};
|
|
34
33
|
export declare const TITLE_SIZES: {
|
|
35
34
|
sm: {
|
|
@@ -49,11 +48,12 @@ export declare const TITLE_SIZES: {
|
|
|
49
48
|
medium: string;
|
|
50
49
|
};
|
|
51
50
|
};
|
|
52
|
-
declare
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
declare function AlertTitle({ className, render, ...props }: AlertTitleProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
52
|
+
declare namespace AlertTitle {
|
|
53
|
+
var displayName: string;
|
|
54
|
+
}
|
|
55
|
+
type AlertDescriptionProps = useRender.ComponentProps<"div"> & {
|
|
56
|
+
className?: string;
|
|
57
57
|
};
|
|
58
58
|
export declare const DESCRIPTION_SIZES: {
|
|
59
59
|
sm: {
|
|
@@ -73,7 +73,8 @@ export declare const DESCRIPTION_SIZES: {
|
|
|
73
73
|
medium: string;
|
|
74
74
|
};
|
|
75
75
|
};
|
|
76
|
-
declare
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
declare function AlertDescription({ className, render, ...props }: AlertDescriptionProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
77
|
+
declare namespace AlertDescription {
|
|
78
|
+
var displayName: string;
|
|
79
|
+
}
|
|
79
80
|
export { Alert, AlertDescription, AlertTitle, type AlertDescriptionProps, type AlertProps, type AlertTitleProps, };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
4
|
import { getVariants } from "../../utilities/responsive/responsive";
|
|
4
|
-
import { createContext,
|
|
5
|
+
import { createContext, useContext } from "react";
|
|
5
6
|
const AlertContext = createContext(undefined);
|
|
6
7
|
const useAlertContext = () => {
|
|
7
8
|
const context = useContext(AlertContext);
|
|
@@ -42,7 +43,7 @@ const alertStyles = getVariants({
|
|
|
42
43
|
},
|
|
43
44
|
},
|
|
44
45
|
});
|
|
45
|
-
const { root, title, description } = alertStyles;
|
|
46
|
+
const { root, title, description } = alertStyles();
|
|
46
47
|
export const SIZES = {
|
|
47
48
|
sm: {
|
|
48
49
|
small: "sm:px-2 sm:py-1 sm:has-[>svg]:gap-x-2",
|
|
@@ -61,10 +62,17 @@ export const SIZES = {
|
|
|
61
62
|
medium: "xl:px-3 xl:py-2 xl:has-[>svg]:gap-x-3",
|
|
62
63
|
},
|
|
63
64
|
};
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
})
|
|
65
|
+
function Alert({ variant = "primary", size = "medium", className, render, children, ...props }) {
|
|
66
|
+
const defaultProps = {
|
|
67
|
+
className: root({ variant, size, className }),
|
|
68
|
+
children: (_jsx(AlertContext.Provider, { value: { variant, size }, children: children })),
|
|
69
|
+
};
|
|
70
|
+
return useRender({
|
|
71
|
+
defaultTagName: "div",
|
|
72
|
+
render,
|
|
73
|
+
props: mergeProps(defaultProps, props),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
68
76
|
Alert.displayName = "Alert";
|
|
69
77
|
export const TITLE_SIZES = {
|
|
70
78
|
sm: {
|
|
@@ -84,11 +92,17 @@ export const TITLE_SIZES = {
|
|
|
84
92
|
medium: "xl:text-base",
|
|
85
93
|
},
|
|
86
94
|
};
|
|
87
|
-
|
|
95
|
+
function AlertTitle({ className, render, ...props }) {
|
|
88
96
|
const { size } = useAlertContext();
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
}
|
|
97
|
+
const defaultProps = {
|
|
98
|
+
className: title({ size, className }),
|
|
99
|
+
};
|
|
100
|
+
return useRender({
|
|
101
|
+
defaultTagName: "div",
|
|
102
|
+
render,
|
|
103
|
+
props: mergeProps(defaultProps, props),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
92
106
|
AlertTitle.displayName = "AlertTitle";
|
|
93
107
|
export const DESCRIPTION_SIZES = {
|
|
94
108
|
sm: {
|
|
@@ -108,11 +122,17 @@ export const DESCRIPTION_SIZES = {
|
|
|
108
122
|
medium: "xl:text-sm",
|
|
109
123
|
},
|
|
110
124
|
};
|
|
111
|
-
|
|
125
|
+
function AlertDescription({ className, render, ...props }) {
|
|
112
126
|
const { size } = useAlertContext();
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
}
|
|
127
|
+
const defaultProps = {
|
|
128
|
+
className: description({ size, className }),
|
|
129
|
+
};
|
|
130
|
+
return useRender({
|
|
131
|
+
defaultTagName: "div",
|
|
132
|
+
render,
|
|
133
|
+
props: mergeProps(defaultProps, props),
|
|
134
|
+
});
|
|
135
|
+
}
|
|
116
136
|
AlertDescription.displayName = "AlertDescription";
|
|
117
137
|
export { Alert, AlertDescription, AlertTitle, };
|
|
118
138
|
//# sourceMappingURL=alert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sourceRoot":"/","sources":["components/alert/alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"alert.js","sourceRoot":"/","sources":["components/alert/alert.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAOlD,MAAM,YAAY,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAE5E,MAAM,eAAe,GAAG,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAQF,MAAM,WAAW,GAAG,WAAW,CAAC;IAC/B,KAAK,EAAE;QACN,IAAI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QACnB,MAAM,EAAE,YAAY;KACpB;IACD,EAAE,EAAE;QACH,KAAK,EAAE,YAAY;QACnB,MAAM,EAAE,YAAY;KACpB;CACD,CAAC;AAEF,SAAS,gBAAgB,CAAC,EACzB,SAAS,EACT,MAAM,EACN,GAAG,KAAK,EACe;IACvB,MAAM,EAAE,IAAI,EAAE,GAAG,eAAe,EAAE,CAAC;IAEnC,MAAM,YAAY,GAAkC;QACnD,SAAS,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;KAC3C,CAAC;IAEF,OAAO,SAAS,CAAC;QAChB,cAAc,EAAE,KAAK;QACrB,MAAM;QACN,KAAK,EAAE,UAAU,CAAQ,YAAY,EAAE,KAAK,CAAC;KAC7C,CAAC,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;AAElD,OAAO,EACN,KAAK,EACL,gBAAgB,EAChB,UAAU,GAIV,CAAC","sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport { createContext, useContext } from \"react\";\n\ntype AlertContextType = {\n\tvariant: \"primary\" | \"secondary\" | \"error\";\n\tsize: ResponsiveValue<\"small\" | \"medium\">;\n};\n\nconst AlertContext = createContext<AlertContextType | undefined>(undefined);\n\nconst useAlertContext = () => {\n\tconst context = useContext(AlertContext);\n\tif (!context) {\n\t\tthrow new Error(\"useAlertContext must be used within an Alert component\");\n\t}\n\treturn context;\n};\n\ntype AlertProps = useRender.ComponentProps<\"div\"> & {\n\tvariant?: \"primary\" | \"secondary\" | \"error\";\n\tsize?: ResponsiveValue<\"small\" | \"medium\">;\n\tclassName?: string;\n};\n\nconst alertStyles = getVariants({\n\tslots: {\n\t\troot: \"grid w-fit grid-cols-[0_1fr] items-start gap-1 rounded-md border border-transparent has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] [&>svg]:translate-y-1\",\n\t\ttitle: \"col-start-2 font-bold\",\n\t\tdescription: \"col-start-2\",\n\t},\n\tvariants: {\n\t\tvariant: {\n\t\t\tprimary: {\n\t\t\t\troot: \"bg-gray-700 text-white\",\n\t\t\t},\n\t\t\tsecondary: {\n\t\t\t\troot: \"border-gray-700 text-gray-700\",\n\t\t\t},\n\t\t\terror: {\n\t\t\t\troot: \"bg-red-500 text-white\",\n\t\t\t},\n\t\t},\n\t\tsize: {\n\t\t\tsmall: {\n\t\t\t\troot: \"px-2 py-1 has-[>svg]:gap-x-2\",\n\t\t\t\ttitle: \"text-sm\",\n\t\t\t\tdescription: \"text-xs\",\n\t\t\t},\n\t\t\tmedium: {\n\t\t\t\troot: \"px-3 py-2 has-[>svg]:gap-x-3\",\n\t\t\t\ttitle: \"text-base\",\n\t\t\t\tdescription: \"text-sm\",\n\t\t\t},\n\t\t},\n\t},\n});\n\nconst { root, title, description } = alertStyles();\n\nexport const SIZES = {\n\tsm: {\n\t\tsmall: \"sm:px-2 sm:py-1 sm:has-[>svg]:gap-x-2\",\n\t\tmedium: \"sm:px-3 sm:py-2 sm:has-[>svg]:gap-x-3\",\n\t},\n\tmd: {\n\t\tsmall: \"md:px-2 md:py-1 md:has-[>svg]:gap-x-2\",\n\t\tmedium: \"md:px-3 md:py-2 md:has-[>svg]:gap-x-3\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:px-2 lg:py-1 lg:has-[>svg]:gap-x-2\",\n\t\tmedium: \"lg:px-3 lg:py-2 lg:has-[>svg]:gap-x-3\",\n\t},\n\txl: {\n\t\tsmall: \"xl:px-2 xl:py-1 xl:has-[>svg]:gap-x-2\",\n\t\tmedium: \"xl:px-3 xl:py-2 xl:has-[>svg]:gap-x-3\",\n\t},\n};\n\nfunction Alert({\n\tvariant = \"primary\",\n\tsize = \"medium\",\n\tclassName,\n\trender,\n\tchildren,\n\t...props\n}: AlertProps) {\n\tconst defaultProps: useRender.ElementProps<\"div\"> = {\n\t\tclassName: root({ variant, size, className }),\n\t\tchildren: (\n\t\t\t<AlertContext.Provider value={{ variant, size }}>\n\t\t\t\t{children}\n\t\t\t</AlertContext.Provider>\n\t\t),\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\trender,\n\t\tprops: mergeProps<\"div\">(defaultProps, props),\n\t});\n}\n\nAlert.displayName = \"Alert\";\n\ntype AlertTitleProps = useRender.ComponentProps<\"div\"> & {\n\tclassName?: string;\n};\n\nexport const TITLE_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:text-sm\",\n\t\tmedium: \"sm:text-base\",\n\t},\n\tmd: {\n\t\tsmall: \"md:text-sm\",\n\t\tmedium: \"md:text-base\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:text-sm\",\n\t\tmedium: \"lg:text-base\",\n\t},\n\txl: {\n\t\tsmall: \"xl:text-sm\",\n\t\tmedium: \"xl:text-base\",\n\t},\n};\n\nfunction AlertTitle({ className, render, ...props }: AlertTitleProps) {\n\tconst { size } = useAlertContext();\n\n\tconst defaultProps: useRender.ElementProps<\"div\"> = {\n\t\tclassName: title({ size, className }),\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\trender,\n\t\tprops: mergeProps<\"div\">(defaultProps, props),\n\t});\n}\n\nAlertTitle.displayName = \"AlertTitle\";\n\ntype AlertDescriptionProps = useRender.ComponentProps<\"div\"> & {\n\tclassName?: string;\n};\n\nexport const DESCRIPTION_SIZES = {\n\tsm: {\n\t\tsmall: \"sm:text-xs\",\n\t\tmedium: \"sm:text-sm\",\n\t},\n\tmd: {\n\t\tsmall: \"md:text-xs\",\n\t\tmedium: \"md:text-sm\",\n\t},\n\tlg: {\n\t\tsmall: \"lg:text-xs\",\n\t\tmedium: \"lg:text-sm\",\n\t},\n\txl: {\n\t\tsmall: \"xl:text-xs\",\n\t\tmedium: \"xl:text-sm\",\n\t},\n};\n\nfunction AlertDescription({\n\tclassName,\n\trender,\n\t...props\n}: AlertDescriptionProps) {\n\tconst { size } = useAlertContext();\n\n\tconst defaultProps: useRender.ElementProps<\"div\"> = {\n\t\tclassName: description({ size, className }),\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"div\",\n\t\trender,\n\t\tprops: mergeProps<\"div\">(defaultProps, props),\n\t});\n}\n\nAlertDescription.displayName = \"AlertDescription\";\n\nexport {\n\tAlert,\n\tAlertDescription,\n\tAlertTitle,\n\ttype AlertDescriptionProps,\n\ttype AlertProps,\n\ttype AlertTitleProps,\n};\n"]}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { AlertDialog as
|
|
2
|
-
|
|
3
|
-
declare const
|
|
4
|
-
declare const
|
|
5
|
-
|
|
6
|
-
declare
|
|
7
|
-
|
|
8
|
-
declare
|
|
9
|
-
|
|
1
|
+
import { AlertDialog as BaseAlertDialog } from "@base-ui/react/alert-dialog";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
declare const AlertDialog: typeof BaseAlertDialog.Root;
|
|
4
|
+
declare const AlertDialogTrigger: BaseAlertDialog.Trigger;
|
|
5
|
+
export type AlertDialogOverlayProps = ComponentProps<typeof BaseAlertDialog.Backdrop>;
|
|
6
|
+
declare function AlertDialogOverlay({ className, ref, ...props }: AlertDialogOverlayProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export type AlertDialogContentProps = ComponentProps<typeof BaseAlertDialog.Popup>;
|
|
8
|
+
declare function AlertDialogContent({ className, ref, ...props }: AlertDialogContentProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export type AlertDialogTitleProps = ComponentProps<typeof BaseAlertDialog.Title>;
|
|
10
|
+
declare function AlertDialogTitle({ className, ref, ...props }: AlertDialogTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export type AlertDialogDescriptionProps = ComponentProps<typeof BaseAlertDialog.Description>;
|
|
12
|
+
declare function AlertDialogDescription({ className, ref, ...props }: AlertDialogDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const AlertDialogAction: import("react").ForwardRefExoticComponent<import("@base-ui/react/dialog").DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
declare const AlertDialogCancel: import("react").ForwardRefExoticComponent<import("@base-ui/react/dialog").DialogCloseProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
10
15
|
export { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogOverlay, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AlertDialog as BaseAlertDialog } from "@base-ui/react/alert-dialog";
|
|
2
3
|
import { cn } from "../../utilities/cn/cn";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
AlertDialogTitle
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
const AlertDialog = BaseAlertDialog.Root;
|
|
5
|
+
const AlertDialogTrigger = BaseAlertDialog.Trigger;
|
|
6
|
+
const AlertDialogPortal = BaseAlertDialog.Portal;
|
|
7
|
+
function AlertDialogOverlay({ className, ref, ...props }) {
|
|
8
|
+
return (_jsx(BaseAlertDialog.Backdrop, { ref: ref, className: cn("fixed inset-0 z-50 bg-black/50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function AlertDialogContent({ className, ref, ...props }) {
|
|
11
|
+
return (_jsxs(AlertDialogPortal, { children: [_jsx(AlertDialogOverlay, {}), _jsx(BaseAlertDialog.Popup, { ref: ref, className: cn("fixed top-1/2 left-1/2 z-50 flex w-fit max-w-xl -translate-x-1/2 -translate-y-1/2 flex-col gap-4 rounded-lg bg-white p-4 transition-all duration-150 data-ending-style:scale-95 data-starting-style:scale-95 data-ending-style:opacity-0 data-starting-style:opacity-0", className), ...props })] }));
|
|
12
|
+
}
|
|
13
|
+
function AlertDialogTitle({ className, ref, ...props }) {
|
|
14
|
+
return (_jsx(BaseAlertDialog.Title, { ref: ref, className: cn("font-medium text-lg", className), ...props }));
|
|
15
|
+
}
|
|
16
|
+
function AlertDialogDescription({ className, ref, ...props }) {
|
|
17
|
+
return (_jsx(BaseAlertDialog.Description, { ref: ref, className: cn("text-gray-500 text-sm", className), ...props }));
|
|
18
|
+
}
|
|
19
|
+
// Base UI doesn't have separate Action/Cancel components - both use Close
|
|
20
|
+
// We export Close as both Action and Cancel for API compatibility
|
|
21
|
+
const AlertDialogAction = BaseAlertDialog.Close;
|
|
22
|
+
const AlertDialogCancel = BaseAlertDialog.Close;
|
|
17
23
|
export { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogOverlay, AlertDialogTitle, AlertDialogDescription, AlertDialogAction, AlertDialogCancel, };
|
|
18
24
|
//# sourceMappingURL=alert-dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.js","sourceRoot":"/","sources":["components/alert-dialog/alert-dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"alert-dialog.js","sourceRoot":"/","sources":["components/alert-dialog/alert-dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAGtC,MAAM,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC;AAEzC,MAAM,kBAAkB,GAAG,eAAe,CAAC,OAAO,CAAC;AAEnD,MAAM,iBAAiB,GAAG,eAAe,CAAC,MAAM,CAAC;AAMjD,SAAS,kBAAkB,CAAC,EAC3B,SAAS,EACT,GAAG,EACH,GAAG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\"@base-ui/react/alert-dialog\";\nimport { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\n\nconst AlertDialog = BaseAlertDialog.Root;\n\nconst AlertDialogTrigger = BaseAlertDialog.Trigger;\n\nconst AlertDialogPortal = BaseAlertDialog.Portal;\n\nexport type AlertDialogOverlayProps = ComponentProps<\n\ttypeof BaseAlertDialog.Backdrop\n>;\n\nfunction AlertDialogOverlay({\n\tclassName,\n\tref,\n\t...props\n}: AlertDialogOverlayProps) {\n\treturn (\n\t\t<BaseAlertDialog.Backdrop\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"fixed inset-0 z-50 bg-black/50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport type AlertDialogContentProps = ComponentProps<\n\ttypeof BaseAlertDialog.Popup\n>;\n\nfunction AlertDialogContent({\n\tclassName,\n\tref,\n\t...props\n}: AlertDialogContentProps) {\n\treturn (\n\t\t<AlertDialogPortal>\n\t\t\t<AlertDialogOverlay />\n\t\t\t<BaseAlertDialog.Popup\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"fixed top-1/2 left-1/2 z-50 flex w-fit max-w-xl -translate-x-1/2 -translate-y-1/2 flex-col gap-4 rounded-lg bg-white p-4 transition-all duration-150 data-ending-style:scale-95 data-starting-style:scale-95 data-ending-style:opacity-0 data-starting-style:opacity-0\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</AlertDialogPortal>\n\t);\n}\n\nexport type AlertDialogTitleProps = ComponentProps<\n\ttypeof BaseAlertDialog.Title\n>;\n\nfunction AlertDialogTitle({ className, ref, ...props }: AlertDialogTitleProps) {\n\treturn (\n\t\t<BaseAlertDialog.Title\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"font-medium text-lg\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport type AlertDialogDescriptionProps = ComponentProps<\n\ttypeof BaseAlertDialog.Description\n>;\n\nfunction AlertDialogDescription({\n\tclassName,\n\tref,\n\t...props\n}: AlertDialogDescriptionProps) {\n\treturn (\n\t\t<BaseAlertDialog.Description\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"text-gray-500 text-sm\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n// Base UI doesn't have separate Action/Cancel components - both use Close\n// We export Close as both Action and Cancel for API compatibility\nconst AlertDialogAction = BaseAlertDialog.Close;\n\nconst AlertDialogCancel = BaseAlertDialog.Close;\n\nexport {\n\tAlertDialog,\n\tAlertDialogTrigger,\n\tAlertDialogContent,\n\tAlertDialogOverlay,\n\tAlertDialogTitle,\n\tAlertDialogDescription,\n\tAlertDialogAction,\n\tAlertDialogCancel,\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type ComponentProps } from "react";
|
|
1
|
+
import { type ComponentProps, type Ref } from "react";
|
|
2
2
|
export type AvatarGroupProps = ComponentProps<"div"> & {
|
|
3
3
|
maxAvatars?: number;
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
4
5
|
};
|
|
5
|
-
declare
|
|
6
|
+
declare function AvatarGroup({ children, maxAvatars, ref, ...props }: AvatarGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export { AvatarGroup };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Children
|
|
3
|
-
|
|
2
|
+
import { Children } from "react";
|
|
3
|
+
function AvatarGroup({ children, maxAvatars = 3, ref, ...props }) {
|
|
4
4
|
const elements = Children.toArray(children);
|
|
5
5
|
const avatars = elements.slice(0, maxAvatars).reverse();
|
|
6
|
-
return (_jsxs("div", { className: "
|
|
7
|
-
}
|
|
6
|
+
return (_jsxs("div", { className: "group flex w-fit flex-row-reverse items-center [&>*]:-mr-4 [&>*]:transition-all [&>*]:duration-500 [&>*]:ease-in-out hover:[&>*]:-mr-1", ...props, ref: ref, children: [elements.length > maxAvatars && (_jsxs("span", { className: "mr-0 ml-2 hidden text-gray-500 text-sm group-hover:block", children: ["+", elements.length - maxAvatars] })), avatars] }));
|
|
7
|
+
}
|
|
8
8
|
export { AvatarGroup };
|
|
9
9
|
//# sourceMappingURL=avatar-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar-group.js","sourceRoot":"/","sources":["components/avatar/avatar-group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"avatar-group.js","sourceRoot":"/","sources":["components/avatar/avatar-group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAiC,MAAM,OAAO,CAAC;AAOhE,SAAS,WAAW,CAAC,EACpB,QAAQ,EACR,UAAU,GAAG,CAAC,EACd,GAAG,EACH,GAAG,KAAK,EACU;IAClB,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE5C,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;IAExD,OAAO,CACN,eACC,SAAS,EAAC,wIAAwI,KAC9I,KAAK,EACT,GAAG,EAAE,GAAG,aAEP,QAAQ,CAAC,MAAM,GAAG,UAAU,IAAI,CAChC,gBAAM,SAAS,EAAC,0DAA0D,kBACvE,QAAQ,CAAC,MAAM,GAAG,UAAU,IACxB,CACP,EACA,OAAO,IACH,CACN,CAAC;AACH,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { Children, type ComponentProps, type Ref } from \"react\";\n\nexport type AvatarGroupProps = ComponentProps<\"div\"> & {\n\tmaxAvatars?: number;\n\tref?: Ref<HTMLDivElement>;\n};\n\nfunction AvatarGroup({\n\tchildren,\n\tmaxAvatars = 3,\n\tref,\n\t...props\n}: AvatarGroupProps) {\n\tconst elements = Children.toArray(children);\n\n\tconst avatars = elements.slice(0, maxAvatars).reverse();\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"group flex w-fit flex-row-reverse items-center [&>*]:-mr-4 [&>*]:transition-all [&>*]:duration-500 [&>*]:ease-in-out hover:[&>*]:-mr-1\"\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t{elements.length > maxAvatars && (\n\t\t\t\t<span className=\"mr-0 ml-2 hidden text-gray-500 text-sm group-hover:block\">\n\t\t\t\t\t+{elements.length - maxAvatars}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t\t{avatars}\n\t\t</div>\n\t);\n}\n\nexport { AvatarGroup };\n"]}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { Avatar as AvatarPrimitive } from "
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare
|
|
1
|
+
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
export type AvatarProps = ComponentProps<typeof AvatarPrimitive.Root>;
|
|
4
|
+
declare function Avatar({ className, ref, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export type AvatarImageProps = ComponentProps<typeof AvatarPrimitive.Image>;
|
|
6
|
+
declare function AvatarImage({ className, ref, ...props }: AvatarImageProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export type AvatarFallbackProps = ComponentProps<typeof AvatarPrimitive.Fallback>;
|
|
8
|
+
declare function AvatarFallback({ className, ref, ...props }: AvatarFallbackProps): import("react/jsx-runtime").JSX.Element;
|
|
5
9
|
export { Avatar, AvatarFallback, AvatarImage };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Avatar as AvatarPrimitive } from "@base-ui/react/avatar";
|
|
2
3
|
import { cn } from "../../utilities/cn/cn";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
function Avatar({ className, ref, ...props }) {
|
|
5
|
+
return (_jsx(AvatarPrimitive.Root, { ref: ref, className: cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full border-2 border-white", className), ...props }));
|
|
6
|
+
}
|
|
7
|
+
function AvatarImage({ className, ref, ...props }) {
|
|
8
|
+
return (_jsx(AvatarPrimitive.Image, { ref: ref, className: cn("absolute h-full w-full object-cover", className), ...props }));
|
|
9
|
+
}
|
|
10
|
+
function AvatarFallback({ className, ref, ...props }) {
|
|
11
|
+
return (_jsx(AvatarPrimitive.Fallback, { ref: ref, className: cn("flex h-full w-full items-center justify-center rounded-full border border-white bg-gray-700 text-white", className), ...props }));
|
|
12
|
+
}
|
|
11
13
|
export { Avatar, AvatarFallback, AvatarImage };
|
|
12
14
|
//# sourceMappingURL=avatar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sourceRoot":"/","sources":["components/avatar/avatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"/","sources":["components/avatar/avatar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAKtC,SAAS,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAe;IACxD,OAAO,CACN,KAAC,eAAe,CAAC,IAAI,IACpB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,qFAAqF,EACrF,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAID,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAoB;IAClE,OAAO,CACN,KAAC,eAAe,CAAC,KAAK,IACrB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,qCAAqC,EAAE,SAAS,CAAC,KAC3D,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAMD,SAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAuB;IACxE,OAAO,CACN,KAAC,eAAe,CAAC,QAAQ,IACxB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,wGAAwG,EACxG,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { Avatar as AvatarPrimitive } from \"@base-ui/react/avatar\";\nimport { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\n\nexport type AvatarProps = ComponentProps<typeof AvatarPrimitive.Root>;\n\nfunction Avatar({ className, ref, ...props }: AvatarProps) {\n\treturn (\n\t\t<AvatarPrimitive.Root\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full border-2 border-white\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport type AvatarImageProps = ComponentProps<typeof AvatarPrimitive.Image>;\n\nfunction AvatarImage({ className, ref, ...props }: AvatarImageProps) {\n\treturn (\n\t\t<AvatarPrimitive.Image\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"absolute h-full w-full object-cover\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport type AvatarFallbackProps = ComponentProps<\n\ttypeof AvatarPrimitive.Fallback\n>;\n\nfunction AvatarFallback({ className, ref, ...props }: AvatarFallbackProps) {\n\treturn (\n\t\t<AvatarPrimitive.Fallback\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-full w-full items-center justify-center rounded-full border border-white bg-gray-700 text-white\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Avatar, AvatarFallback, AvatarImage };\n"]}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
1
2
|
import type { ResponsiveValue } from "../../utilities/responsive/responsive";
|
|
2
3
|
import type { ComponentProps } from "react";
|
|
3
4
|
/**
|
|
4
5
|
* Props for the Badge component
|
|
5
6
|
* @interface BadgeProps
|
|
6
|
-
* @extends {ComponentProps<"div">}
|
|
7
|
+
* @extends {useRender.ComponentProps<"div">}
|
|
7
8
|
*/
|
|
8
|
-
export type BadgeProps = ComponentProps<"div"> & {
|
|
9
|
-
/** Whether to render the badge as a child component */
|
|
10
|
-
asChild?: boolean;
|
|
9
|
+
export type BadgeProps = Omit<ComponentProps<"div">, "className"> & useRender.ComponentProps<"div"> & {
|
|
11
10
|
/** The visual style variant of the badge */
|
|
12
11
|
variant?: "primary" | "secondary" | "destructive" | "outline";
|
|
13
12
|
/** The size of the badge, can be responsive */
|
|
14
13
|
size?: ResponsiveValue<"small" | "medium" | "large">;
|
|
14
|
+
/** Additional CSS classes to apply */
|
|
15
|
+
className?: string;
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
18
|
* Badge component for displaying status, labels, or counts
|
|
@@ -20,6 +21,12 @@ export type BadgeProps = ComponentProps<"div"> & {
|
|
|
20
21
|
* ```tsx
|
|
21
22
|
* <Badge variant="primary" size="medium">New</Badge>
|
|
22
23
|
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // With render prop to change the element
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <Badge render={<a href="/link" />}>Link Badge</Badge>
|
|
29
|
+
* ```
|
|
23
30
|
*/
|
|
24
|
-
declare
|
|
31
|
+
declare function Badge({ className, variant, size, render, ...props }: BadgeProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
25
32
|
export { Badge };
|