luan-ui 0.5.3 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +34 -14
- 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 +51 -19
- 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 +8 -10
- 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 +8 -4
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Popover as
|
|
1
|
+
import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
2
3
|
/**
|
|
3
4
|
* Popover
|
|
4
5
|
*/
|
|
@@ -6,14 +7,18 @@ export type PopoverProps = {
|
|
|
6
7
|
showArrow?: boolean;
|
|
7
8
|
closeButtonAriaLabel?: string;
|
|
8
9
|
showCloseButton?: boolean;
|
|
9
|
-
|
|
10
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
11
|
+
sideOffset?: number;
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
} & ComponentProps<typeof PopoverPrimitive.Root>;
|
|
10
14
|
/**
|
|
11
15
|
* Popover component that provides a popover container with a trigger and content.
|
|
12
16
|
*
|
|
13
17
|
* @param {boolean} [props.showArrow=true] - Whether to show the arrow pointing to the trigger
|
|
14
18
|
* @param {string} [props.closeButtonAriaLabel="Close"] - Aria label for the close button
|
|
15
19
|
* @param {boolean} [props.showCloseButton=true] - Whether to show the close button
|
|
16
|
-
* @param {
|
|
20
|
+
* @param {"top" | "right" | "bottom" | "left"} [props.side] - The preferred side to show the popover
|
|
21
|
+
* @param {number} [props.sideOffset=4] - The offset from the trigger
|
|
17
22
|
*
|
|
18
23
|
* @example
|
|
19
24
|
* ```tsx
|
|
@@ -25,11 +30,13 @@ export type PopoverProps = {
|
|
|
25
30
|
* </Popover>
|
|
26
31
|
* ```
|
|
27
32
|
*/
|
|
28
|
-
declare
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
declare function Popover({ children, showArrow, closeButtonAriaLabel, showCloseButton, side, sideOffset, ...props }: PopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export type PopoverTriggerProps = ComponentProps<typeof PopoverPrimitive.Trigger>;
|
|
35
|
+
declare function PopoverTrigger({ className, ref, ...props }: PopoverTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export type PopoverContentProps = ComponentProps<typeof PopoverPrimitive.Popup> & {
|
|
31
37
|
showArrow?: boolean;
|
|
32
38
|
closeButtonAriaLabel?: string;
|
|
39
|
+
sideOffset?: number;
|
|
33
40
|
};
|
|
34
41
|
/**
|
|
35
42
|
* Popover Content
|
|
@@ -45,20 +52,29 @@ export type PopoverContentProps = RadixPopover.PopoverContentProps & {
|
|
|
45
52
|
* </PopoverContent>
|
|
46
53
|
* ```
|
|
47
54
|
*/
|
|
48
|
-
declare
|
|
49
|
-
showArrow?: boolean;
|
|
50
|
-
closeButtonAriaLabel?: string;
|
|
51
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
55
|
+
declare function PopoverContent({ children, className, sideOffset: sideOffsetProp, ref, ...props }: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
|
|
52
56
|
/**
|
|
53
57
|
* Popover Close
|
|
54
58
|
*/
|
|
55
|
-
|
|
59
|
+
export type PopoverCloseProps = ComponentProps<typeof PopoverPrimitive.Close>;
|
|
60
|
+
declare function PopoverClose({ className, ref, ...props }: PopoverCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
56
61
|
/**
|
|
57
62
|
* Popover Portal
|
|
58
63
|
*/
|
|
59
|
-
declare const PopoverPortal: import("react").
|
|
64
|
+
declare const PopoverPortal: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverPortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
60
65
|
/**
|
|
61
66
|
* Popover Anchor
|
|
62
67
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
export type PopoverAnchorProps = ComponentProps<typeof PopoverPrimitive.Positioner> & {
|
|
69
|
+
children?: React.ReactNode;
|
|
70
|
+
};
|
|
71
|
+
declare function PopoverAnchor({ children, ref, ...props }: PopoverAnchorProps): import("react/jsx-runtime").JSX.Element;
|
|
72
|
+
/**
|
|
73
|
+
* Popover Title
|
|
74
|
+
*/
|
|
75
|
+
declare const PopoverTitle: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverTitleProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
76
|
+
/**
|
|
77
|
+
* Popover Description
|
|
78
|
+
*/
|
|
79
|
+
declare const PopoverDescription: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverDescriptionProps, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
80
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverClose, PopoverPortal, PopoverAnchor, PopoverTitle, PopoverDescription, };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
|
|
2
3
|
import { Icon } from "../icon/icon";
|
|
3
4
|
import { Cross1Icon } from "@radix-ui/react-icons";
|
|
4
5
|
import { cn } from "../../utilities/cn/cn";
|
|
5
|
-
import {
|
|
6
|
-
import { createContext, forwardRef, useContext, useMemo, } from "react";
|
|
7
|
-
/**
|
|
8
|
-
* Popover Context
|
|
9
|
-
*/
|
|
6
|
+
import { createContext, useContext, useMemo } from "react";
|
|
10
7
|
const PopoverContext = createContext(undefined);
|
|
11
8
|
const usePopoverContext = () => {
|
|
12
9
|
const context = useContext(PopoverContext);
|
|
@@ -21,7 +18,8 @@ const usePopoverContext = () => {
|
|
|
21
18
|
* @param {boolean} [props.showArrow=true] - Whether to show the arrow pointing to the trigger
|
|
22
19
|
* @param {string} [props.closeButtonAriaLabel="Close"] - Aria label for the close button
|
|
23
20
|
* @param {boolean} [props.showCloseButton=true] - Whether to show the close button
|
|
24
|
-
* @param {
|
|
21
|
+
* @param {"top" | "right" | "bottom" | "left"} [props.side] - The preferred side to show the popover
|
|
22
|
+
* @param {number} [props.sideOffset=4] - The offset from the trigger
|
|
25
23
|
*
|
|
26
24
|
* @example
|
|
27
25
|
* ```tsx
|
|
@@ -33,16 +31,19 @@ const usePopoverContext = () => {
|
|
|
33
31
|
* </Popover>
|
|
34
32
|
* ```
|
|
35
33
|
*/
|
|
36
|
-
|
|
34
|
+
function Popover({ children, showArrow = true, closeButtonAriaLabel = "Close", showCloseButton = true, side, sideOffset = 10, ...props }) {
|
|
37
35
|
const contextValue = useMemo(() => ({
|
|
38
36
|
showArrow,
|
|
39
37
|
closeButtonAriaLabel,
|
|
40
38
|
side,
|
|
41
39
|
showCloseButton,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
};
|
|
45
|
-
|
|
40
|
+
sideOffset,
|
|
41
|
+
}), [showArrow, closeButtonAriaLabel, side, showCloseButton, sideOffset]);
|
|
42
|
+
return (_jsx(PopoverContext.Provider, { value: contextValue, children: _jsx(PopoverPrimitive.Root, { ...props, children: children }) }));
|
|
43
|
+
}
|
|
44
|
+
function PopoverTrigger({ className, ref, ...props }) {
|
|
45
|
+
return (_jsx(PopoverPrimitive.Trigger, { ref: ref, className: className, ...props }));
|
|
46
|
+
}
|
|
46
47
|
/**
|
|
47
48
|
* Popover Content
|
|
48
49
|
*/
|
|
@@ -57,21 +58,28 @@ const PopoverTrigger = RadixPopover.Trigger;
|
|
|
57
58
|
* </PopoverContent>
|
|
58
59
|
* ```
|
|
59
60
|
*/
|
|
60
|
-
|
|
61
|
-
const { showArrow, closeButtonAriaLabel, side, showCloseButton } = usePopoverContext();
|
|
62
|
-
|
|
63
|
-
});
|
|
61
|
+
function PopoverContent({ children, className, sideOffset: sideOffsetProp, ref, ...props }) {
|
|
62
|
+
const { showArrow, closeButtonAriaLabel, side, showCloseButton, sideOffset: sideOffsetContext, } = usePopoverContext();
|
|
63
|
+
const sideOffset = sideOffsetProp ?? sideOffsetContext ?? 10;
|
|
64
|
+
return (_jsx(PopoverPrimitive.Portal, { children: _jsx(PopoverPrimitive.Positioner, { side: side, sideOffset: sideOffset, children: _jsxs(PopoverPrimitive.Popup, { className: cn("relative z-50 w-fit max-w-72 rounded-md bg-gray-700 p-4 text-sm text-white shadow-md", className), ...props, ref: ref, children: [showCloseButton && (_jsx(PopoverClose, { className: "absolute top-4 right-4", "aria-label": closeButtonAriaLabel, children: _jsx(Icon, { render: _jsx(Cross1Icon, {}), size: "small" }) })), children, showArrow && (_jsx(PopoverPrimitive.Arrow, { className: "data-[side=bottom]:-top-1.25 data-[side=left]:-right-1.25 data-[side=top]:-bottom-1.25 data-[side=right]:-left-1.25", children: _jsx("div", { className: "h-2.5 w-2.5 rotate-45 bg-gray-700" }) }))] }) }) }));
|
|
65
|
+
}
|
|
66
|
+
function PopoverClose({ className, ref, ...props }) {
|
|
67
|
+
return _jsx(PopoverPrimitive.Close, { ref: ref, className: className, ...props });
|
|
68
|
+
}
|
|
64
69
|
/**
|
|
65
|
-
* Popover
|
|
70
|
+
* Popover Portal
|
|
66
71
|
*/
|
|
67
|
-
const
|
|
72
|
+
const PopoverPortal = PopoverPrimitive.Portal;
|
|
73
|
+
function PopoverAnchor({ children, ref, ...props }) {
|
|
74
|
+
return (_jsx(PopoverPrimitive.Positioner, { ref: ref, ...props, children: children }));
|
|
75
|
+
}
|
|
68
76
|
/**
|
|
69
|
-
* Popover
|
|
77
|
+
* Popover Title
|
|
70
78
|
*/
|
|
71
|
-
const
|
|
79
|
+
const PopoverTitle = PopoverPrimitive.Title;
|
|
72
80
|
/**
|
|
73
|
-
* Popover
|
|
81
|
+
* Popover Description
|
|
74
82
|
*/
|
|
75
|
-
const
|
|
76
|
-
export { Popover, PopoverTrigger, PopoverContent, PopoverClose, PopoverPortal, PopoverAnchor, };
|
|
83
|
+
const PopoverDescription = PopoverPrimitive.Description;
|
|
84
|
+
export { Popover, PopoverTrigger, PopoverContent, PopoverClose, PopoverPortal, PopoverAnchor, PopoverTitle, PopoverDescription, };
|
|
77
85
|
//# sourceMappingURL=popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sourceRoot":"/","sources":["components/popover/popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"popover.js","sourceRoot":"/","sources":["components/popover/popover.tsx"],"names":[],"mappings":"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","sourcesContent":["import { Popover as PopoverPrimitive } from \"@base-ui/react/popover\";\nimport { Icon } from \"@components/icon/icon\";\nimport { Cross1Icon } from \"@radix-ui/react-icons\";\nimport { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\nimport { createContext, useContext, useMemo } from \"react\";\n\n/**\n * Popover Context\n */\n\ntype PopoverContextValue = {\n\tshowArrow?: boolean;\n\tcloseButtonAriaLabel?: string;\n\tshowCloseButton?: boolean;\n\tside?: \"top\" | \"right\" | \"bottom\" | \"left\";\n\tsideOffset?: number;\n};\n\nconst PopoverContext = createContext<PopoverContextValue | undefined>(\n\tundefined,\n);\n\nconst usePopoverContext = () => {\n\tconst context = useContext(PopoverContext);\n\tif (!context) {\n\t\tthrow new Error(\"Popover components must be used within a Popover\");\n\t}\n\treturn context;\n};\n\n/**\n * Popover\n */\n\nexport type PopoverProps = {\n\tshowArrow?: boolean;\n\tcloseButtonAriaLabel?: string;\n\tshowCloseButton?: boolean;\n\tside?: \"top\" | \"right\" | \"bottom\" | \"left\";\n\tsideOffset?: number;\n\tchildren?: React.ReactNode;\n} & ComponentProps<typeof PopoverPrimitive.Root>;\n\n/**\n * Popover component that provides a popover container with a trigger and content.\n *\n * @param {boolean} [props.showArrow=true] - Whether to show the arrow pointing to the trigger\n * @param {string} [props.closeButtonAriaLabel=\"Close\"] - Aria label for the close button\n * @param {boolean} [props.showCloseButton=true] - Whether to show the close button\n * @param {\"top\" | \"right\" | \"bottom\" | \"left\"} [props.side] - The preferred side to show the popover\n * @param {number} [props.sideOffset=4] - The offset from the trigger\n *\n * @example\n * ```tsx\n * <Popover>\n * <PopoverTrigger>Open Popover</PopoverTrigger>\n * <PopoverContent>\n * <p>Popover content goes here</p>\n * </PopoverContent>\n * </Popover>\n * ```\n */\nfunction Popover({\n\tchildren,\n\tshowArrow = true,\n\tcloseButtonAriaLabel = \"Close\",\n\tshowCloseButton = true,\n\tside,\n\tsideOffset = 10,\n\t...props\n}: PopoverProps) {\n\tconst contextValue = useMemo(\n\t\t() => ({\n\t\t\tshowArrow,\n\t\t\tcloseButtonAriaLabel,\n\t\t\tside,\n\t\t\tshowCloseButton,\n\t\t\tsideOffset,\n\t\t}),\n\t\t[showArrow, closeButtonAriaLabel, side, showCloseButton, sideOffset],\n\t);\n\treturn (\n\t\t<PopoverContext.Provider value={contextValue}>\n\t\t\t<PopoverPrimitive.Root {...props}>{children}</PopoverPrimitive.Root>\n\t\t</PopoverContext.Provider>\n\t);\n}\n\nexport type PopoverTriggerProps = ComponentProps<\n\ttypeof PopoverPrimitive.Trigger\n>;\n\nfunction PopoverTrigger({ className, ref, ...props }: PopoverTriggerProps) {\n\treturn (\n\t\t<PopoverPrimitive.Trigger ref={ref} className={className} {...props} />\n\t);\n}\n\nexport type PopoverContentProps = ComponentProps<\n\ttypeof PopoverPrimitive.Popup\n> & {\n\tshowArrow?: boolean;\n\tcloseButtonAriaLabel?: string;\n\tsideOffset?: number;\n};\n\n/**\n * Popover Content\n */\n\n/**\n * Popover Content component that provides the content area for the Popover.\n * Inherits size from parent Popover component.\n *\n * @example\n * ```tsx\n * <PopoverContent>\n * <p>Popover content goes here</p>\n * </PopoverContent>\n * ```\n */\nfunction PopoverContent({\n\tchildren,\n\tclassName,\n\tsideOffset: sideOffsetProp,\n\tref,\n\t...props\n}: PopoverContentProps) {\n\tconst {\n\t\tshowArrow,\n\t\tcloseButtonAriaLabel,\n\t\tside,\n\t\tshowCloseButton,\n\t\tsideOffset: sideOffsetContext,\n\t} = usePopoverContext();\n\tconst sideOffset = sideOffsetProp ?? sideOffsetContext ?? 10;\n\n\treturn (\n\t\t<PopoverPrimitive.Portal>\n\t\t\t<PopoverPrimitive.Positioner side={side} sideOffset={sideOffset}>\n\t\t\t\t<PopoverPrimitive.Popup\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"relative z-50 w-fit max-w-72 rounded-md bg-gray-700 p-4 text-sm text-white shadow-md\",\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t)}\n\t\t\t\t\t{...props}\n\t\t\t\t\tref={ref}\n\t\t\t\t>\n\t\t\t\t\t{showCloseButton && (\n\t\t\t\t\t\t<PopoverClose\n\t\t\t\t\t\t\tclassName=\"absolute top-4 right-4\"\n\t\t\t\t\t\t\taria-label={closeButtonAriaLabel}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Icon render={<Cross1Icon />} size=\"small\" />\n\t\t\t\t\t\t</PopoverClose>\n\t\t\t\t\t)}\n\t\t\t\t\t{children}\n\t\t\t\t\t{showArrow && (\n\t\t\t\t\t\t<PopoverPrimitive.Arrow className=\"data-[side=bottom]:-top-1.25 data-[side=left]:-right-1.25 data-[side=top]:-bottom-1.25 data-[side=right]:-left-1.25\">\n\t\t\t\t\t\t\t<div className=\"h-2.5 w-2.5 rotate-45 bg-gray-700\" />\n\t\t\t\t\t\t</PopoverPrimitive.Arrow>\n\t\t\t\t\t)}\n\t\t\t\t</PopoverPrimitive.Popup>\n\t\t\t</PopoverPrimitive.Positioner>\n\t\t</PopoverPrimitive.Portal>\n\t);\n}\n\n/**\n * Popover Close\n */\n\nexport type PopoverCloseProps = ComponentProps<typeof PopoverPrimitive.Close>;\n\nfunction PopoverClose({ className, ref, ...props }: PopoverCloseProps) {\n\treturn <PopoverPrimitive.Close ref={ref} className={className} {...props} />;\n}\n\n/**\n * Popover Portal\n */\n\nconst PopoverPortal = PopoverPrimitive.Portal;\n\n/**\n * Popover Anchor\n */\n\nexport type PopoverAnchorProps = ComponentProps<\n\ttypeof PopoverPrimitive.Positioner\n> & {\n\tchildren?: React.ReactNode;\n};\n\nfunction PopoverAnchor({ children, ref, ...props }: PopoverAnchorProps) {\n\treturn (\n\t\t<PopoverPrimitive.Positioner ref={ref} {...props}>\n\t\t\t{children}\n\t\t</PopoverPrimitive.Positioner>\n\t);\n}\n\n/**\n * Popover Title\n */\n\nconst PopoverTitle = PopoverPrimitive.Title;\n\n/**\n * Popover Description\n */\n\nconst PopoverDescription = PopoverPrimitive.Description;\n\nexport {\n\tPopover,\n\tPopoverTrigger,\n\tPopoverContent,\n\tPopoverClose,\n\tPopoverPortal,\n\tPopoverAnchor,\n\tPopoverTitle,\n\tPopoverDescription,\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Progress as ProgressPrimitive } from "
|
|
2
|
-
import {
|
|
3
|
-
export type ProgressProps =
|
|
1
|
+
import { Progress as ProgressPrimitive } from "@base-ui/react/progress";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
|
+
export type ProgressProps = ComponentProps<typeof ProgressPrimitive.Root> & {
|
|
4
4
|
showLabel?: boolean;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
@@ -11,7 +11,5 @@ export type ProgressProps = ComponentPropsWithoutRef<typeof ProgressPrimitive.Ro
|
|
|
11
11
|
* @param {number} props.value - The value of the progress bar.
|
|
12
12
|
* @param {boolean} props.showLabel - Whether to show the label.
|
|
13
13
|
*/
|
|
14
|
-
declare
|
|
15
|
-
showLabel?: boolean;
|
|
16
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare function Progress({ className, value, showLabel, max, ref, ...props }: ProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
17
15
|
export { Progress };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Progress as ProgressPrimitive } from "@base-ui/react/progress";
|
|
2
3
|
import { cn } from "../../utilities/cn/cn";
|
|
3
|
-
import { Progress as ProgressPrimitive } from "radix-ui";
|
|
4
|
-
import { forwardRef, } from "react";
|
|
5
4
|
/**
|
|
6
5
|
* A progress bar component that displays a progress indicator and a label.
|
|
7
6
|
*
|
|
@@ -10,9 +9,8 @@ import { forwardRef, } from "react";
|
|
|
10
9
|
* @param {number} props.value - The value of the progress bar.
|
|
11
10
|
* @param {boolean} props.showLabel - Whether to show the label.
|
|
12
11
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Progress.displayName = ProgressPrimitive.Root.displayName;
|
|
12
|
+
function Progress({ className, value, showLabel = true, max = 100, ref, ...props }) {
|
|
13
|
+
return (_jsxs(ProgressPrimitive.Root, { className: "flex items-center gap-4", value: value, max: max, ref: ref, ...props, children: [_jsx(ProgressPrimitive.Track, { className: cn("relative h-2 w-full overflow-hidden rounded-full bg-gray-200/80", className), children: _jsx(ProgressPrimitive.Indicator, { className: "h-full bg-gray-700/80 transition-all" }) }), showLabel && (_jsx(ProgressPrimitive.Value, { className: "text-gray-500 text-sm", children: (_formattedValue, rawValue) => `${rawValue}%` }))] }));
|
|
14
|
+
}
|
|
17
15
|
export { Progress };
|
|
18
16
|
//# sourceMappingURL=progress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress.js","sourceRoot":"/","sources":["components/progress/progress.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"/","sources":["components/progress/progress.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAOtC;;;;;;;GAOG;AAEH,SAAS,QAAQ,CAAC,EACjB,SAAS,EACT,KAAK,EACL,SAAS,GAAG,IAAI,EAChB,GAAG,GAAG,GAAG,EACT,GAAG,EACH,GAAG,KAAK,EACO;IACf,OAAO,CACN,MAAC,iBAAiB,CAAC,IAAI,IACtB,SAAS,EAAC,yBAAyB,EACnC,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,KACJ,KAAK,aAET,KAAC,iBAAiB,CAAC,KAAK,IACvB,SAAS,EAAE,EAAE,CACZ,iEAAiE,EACjE,SAAS,CACT,YAED,KAAC,iBAAiB,CAAC,SAAS,IAAC,SAAS,EAAC,sCAAsC,GAAG,GACvD,EACzB,SAAS,IAAI,CACb,KAAC,iBAAiB,CAAC,KAAK,IAAC,SAAS,EAAC,uBAAuB,YACxD,CAAC,eAA8B,EAAE,QAAuB,EAAE,EAAE,CAC5D,GAAG,QAAQ,GAAG,GAEU,CAC1B,IACuB,CACzB,CAAC;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import { Progress as ProgressPrimitive } from \"@base-ui/react/progress\";\nimport { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\n\nexport type ProgressProps = ComponentProps<typeof ProgressPrimitive.Root> & {\n\tshowLabel?: boolean;\n};\n\n/**\n * A progress bar component that displays a progress indicator and a label.\n *\n * @param {Object} props - The component props.\n * @param {string} props.className - The class name for the component.\n * @param {number} props.value - The value of the progress bar.\n * @param {boolean} props.showLabel - Whether to show the label.\n */\n\nfunction Progress({\n\tclassName,\n\tvalue,\n\tshowLabel = true,\n\tmax = 100,\n\tref,\n\t...props\n}: ProgressProps) {\n\treturn (\n\t\t<ProgressPrimitive.Root\n\t\t\tclassName=\"flex items-center gap-4\"\n\t\t\tvalue={value}\n\t\t\tmax={max}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t>\n\t\t\t<ProgressPrimitive.Track\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"relative h-2 w-full overflow-hidden rounded-full bg-gray-200/80\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<ProgressPrimitive.Indicator className=\"h-full bg-gray-700/80 transition-all\" />\n\t\t\t</ProgressPrimitive.Track>\n\t\t\t{showLabel && (\n\t\t\t\t<ProgressPrimitive.Value className=\"text-gray-500 text-sm\">\n\t\t\t\t\t{(_formattedValue: string | null, rawValue: number | null) =>\n\t\t\t\t\t\t`${rawValue}%`\n\t\t\t\t\t}\n\t\t\t\t</ProgressPrimitive.Value>\n\t\t\t)}\n\t\t</ProgressPrimitive.Root>\n\t);\n}\n\nexport { Progress };\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Radio } from "@base-ui/react/radio";
|
|
2
|
+
import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
|
|
3
|
+
import type { ComponentProps } from "react";
|
|
2
4
|
/**
|
|
3
5
|
* A RadioGroup component that provides a set of radio buttons where only one can be selected at a time.
|
|
4
6
|
*
|
|
@@ -23,11 +25,10 @@ import { RadioGroup as RadixRadioGroup } from "radix-ui";
|
|
|
23
25
|
* @param {boolean} [disabled] - When true, prevents the user from interacting with the radio group
|
|
24
26
|
* @param {boolean} [required] - When true, indicates that the user must select a value before the owning form can be submitted
|
|
25
27
|
* @param {string} [name] - The name of the group. Submitted with its owning form as part of a name/value pair
|
|
26
|
-
* @
|
|
27
|
-
* @param {string} [orientation] - The orientation of the radio group
|
|
28
|
-
* @param {boolean} [loop] - When true, keyboard navigation will loop from last item to first, and vice versa
|
|
29
|
-
* @returns {React.ForwardRefExoticComponent} A React component that renders a radio group
|
|
28
|
+
* @returns {React.ReactElement} A React component that renders a radio group
|
|
30
29
|
*/
|
|
31
|
-
|
|
32
|
-
declare
|
|
30
|
+
export type RadioGroupProps = ComponentProps<typeof BaseRadioGroup>;
|
|
31
|
+
declare function RadioGroup({ className, disabled: initialDisabled, required: initialRequired, ref, ...props }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export type RadioGroupItemProps = ComponentProps<typeof Radio.Root>;
|
|
33
|
+
declare function RadioGroupItem({ className, ref, ...props }: RadioGroupItemProps): import("react/jsx-runtime").JSX.Element;
|
|
33
34
|
export { RadioGroup, RadioGroupItem };
|
|
@@ -1,44 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Radio } from "@base-ui/react/radio";
|
|
3
|
+
import { RadioGroup as BaseRadioGroup } from "@base-ui/react/radio-group";
|
|
2
4
|
import { useFormContext } from "../form-field/form-field-context";
|
|
3
5
|
import { cn } from "../../utilities/cn/cn";
|
|
4
|
-
|
|
5
|
-
import { forwardRef, } from "react";
|
|
6
|
-
/**
|
|
7
|
-
* A RadioGroup component that provides a set of radio buttons where only one can be selected at a time.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* <RadioGroup defaultValue="option1">
|
|
12
|
-
* <div>
|
|
13
|
-
* <RadioGroupItem value="option1" id="option1" />
|
|
14
|
-
* <label htmlFor="option1">Option 1</label>
|
|
15
|
-
* </div>
|
|
16
|
-
* <div>
|
|
17
|
-
* <RadioGroupItem value="option2" id="option2" />
|
|
18
|
-
* <label htmlFor="option2">Option 2</label>
|
|
19
|
-
* </div>
|
|
20
|
-
* </RadioGroup>
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* @param {string} [className] - Additional CSS classes to apply to the root element
|
|
24
|
-
* @param {string} [defaultValue] - The value of the radio item that should be checked when initially rendered
|
|
25
|
-
* @param {string} [value] - The controlled value of the radio item to check
|
|
26
|
-
* @param {function} [onValueChange] - Event handler called when the value changes
|
|
27
|
-
* @param {boolean} [disabled] - When true, prevents the user from interacting with the radio group
|
|
28
|
-
* @param {boolean} [required] - When true, indicates that the user must select a value before the owning form can be submitted
|
|
29
|
-
* @param {string} [name] - The name of the group. Submitted with its owning form as part of a name/value pair
|
|
30
|
-
* @param {string} [dir] - The reading direction of the radio group
|
|
31
|
-
* @param {string} [orientation] - The orientation of the radio group
|
|
32
|
-
* @param {boolean} [loop] - When true, keyboard navigation will loop from last item to first, and vice versa
|
|
33
|
-
* @returns {React.ForwardRefExoticComponent} A React component that renders a radio group
|
|
34
|
-
*/
|
|
35
|
-
const RadioGroup = forwardRef(({ className, disabled: initialDisabled, required: initialRequired, ...props }, ref) => {
|
|
6
|
+
function RadioGroup({ className, disabled: initialDisabled, required: initialRequired, ref, ...props }) {
|
|
36
7
|
const { disabled, required } = useFormContext({
|
|
37
8
|
disabled: initialDisabled,
|
|
38
9
|
required: initialRequired,
|
|
39
10
|
});
|
|
40
|
-
return (_jsx(
|
|
41
|
-
}
|
|
42
|
-
|
|
11
|
+
return (_jsx(BaseRadioGroup, { ref: ref, className: cn("flex flex-col gap-2", className), disabled: disabled, required: required, ...props }));
|
|
12
|
+
}
|
|
13
|
+
function RadioGroupItem({ className, ref, ...props }) {
|
|
14
|
+
return (_jsx(Radio.Root, { ref: ref, className: cn("flex h-4 w-4 items-center justify-center rounded-full border border-gray-700 bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-700 data-disabled:cursor-not-allowed data-disabled:opacity-50", className), ...props, children: _jsx(Radio.Indicator, { className: "relative h-2 w-2 rounded-full bg-gray-500" }) }));
|
|
15
|
+
}
|
|
43
16
|
export { RadioGroup, RadioGroupItem };
|
|
44
17
|
//# sourceMappingURL=radio-group.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","sourceRoot":"/","sources":["components/radio-group/radio-group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"radio-group.js","sourceRoot":"/","sources":["components/radio-group/radio-group.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAgCtC,SAAS,UAAU,CAAC,EACnB,SAAS,EACT,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,eAAe,EACzB,GAAG,EACH,GAAG,KAAK,EACS;IACjB,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QAC7C,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IACH,OAAO,CACN,KAAC,cAAc,IACd,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAC/C,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,KACd,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAID,SAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAuB;IACxE,OAAO,CACN,KAAC,KAAK,CAAC,IAAI,IACV,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,6NAA6N,EAC7N,SAAS,CACT,KACG,KAAK,YAET,KAAC,KAAK,CAAC,SAAS,IAAC,SAAS,EAAC,2CAA2C,GAAG,GAC7D,CACb,CAAC;AACH,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { Radio } from \"@base-ui/react/radio\";\nimport { RadioGroup as BaseRadioGroup } from \"@base-ui/react/radio-group\";\nimport { useFormContext } from \"@components/form-field/form-field-context\";\nimport { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\n\n/**\n * A RadioGroup component that provides a set of radio buttons where only one can be selected at a time.\n *\n * @example\n * ```tsx\n * <RadioGroup defaultValue=\"option1\">\n * <div>\n * <RadioGroupItem value=\"option1\" id=\"option1\" />\n * <label htmlFor=\"option1\">Option 1</label>\n * </div>\n * <div>\n * <RadioGroupItem value=\"option2\" id=\"option2\" />\n * <label htmlFor=\"option2\">Option 2</label>\n * </div>\n * </RadioGroup>\n * ```\n *\n * @param {string} [className] - Additional CSS classes to apply to the root element\n * @param {string} [defaultValue] - The value of the radio item that should be checked when initially rendered\n * @param {string} [value] - The controlled value of the radio item to check\n * @param {function} [onValueChange] - Event handler called when the value changes\n * @param {boolean} [disabled] - When true, prevents the user from interacting with the radio group\n * @param {boolean} [required] - When true, indicates that the user must select a value before the owning form can be submitted\n * @param {string} [name] - The name of the group. Submitted with its owning form as part of a name/value pair\n * @returns {React.ReactElement} A React component that renders a radio group\n */\n\nexport type RadioGroupProps = ComponentProps<typeof BaseRadioGroup>;\n\nfunction RadioGroup({\n\tclassName,\n\tdisabled: initialDisabled,\n\trequired: initialRequired,\n\tref,\n\t...props\n}: RadioGroupProps) {\n\tconst { disabled, required } = useFormContext({\n\t\tdisabled: initialDisabled,\n\t\trequired: initialRequired,\n\t});\n\treturn (\n\t\t<BaseRadioGroup\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"flex flex-col gap-2\", className)}\n\t\t\tdisabled={disabled}\n\t\t\trequired={required}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport type RadioGroupItemProps = ComponentProps<typeof Radio.Root>;\n\nfunction RadioGroupItem({ className, ref, ...props }: RadioGroupItemProps) {\n\treturn (\n\t\t<Radio.Root\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-4 w-4 items-center justify-center rounded-full border border-gray-700 bg-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-700 data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<Radio.Indicator className=\"relative h-2 w-2 rounded-full bg-gray-500\" />\n\t\t</Radio.Root>\n\t);\n}\n\nexport { RadioGroup, RadioGroupItem };\n"]}
|
|
@@ -1,43 +1,54 @@
|
|
|
1
|
-
import { Select as SelectPrimitive } from "
|
|
2
|
-
import {
|
|
1
|
+
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
2
|
+
import type { ComponentProps } from "react";
|
|
3
3
|
/**
|
|
4
4
|
* Select
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
export type SelectProps = ComponentProps<typeof SelectPrimitive.Root>;
|
|
7
|
+
declare function Select({ disabled: initialDisabled, required: initialRequired, ...props }: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
/**
|
|
8
9
|
* SelectGroup
|
|
9
10
|
*/
|
|
10
|
-
declare const SelectGroup: import("react").ForwardRefExoticComponent<
|
|
11
|
+
declare const SelectGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").SelectGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
12
|
/**
|
|
12
13
|
* SelectValue
|
|
13
14
|
*/
|
|
14
|
-
|
|
15
|
+
export type SelectValueProps = ComponentProps<typeof SelectPrimitive.Value>;
|
|
16
|
+
declare function SelectValue({ ref, ...props }: SelectValueProps): import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
/**
|
|
16
18
|
* SelectTrigger
|
|
17
19
|
*/
|
|
18
|
-
|
|
20
|
+
export type SelectTriggerProps = ComponentProps<typeof SelectPrimitive.Trigger>;
|
|
21
|
+
declare function SelectTrigger({ className, children, ref, ...props }: SelectTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
19
22
|
/**
|
|
20
|
-
*
|
|
23
|
+
* SelectScrollUpArrow
|
|
21
24
|
*/
|
|
22
|
-
|
|
25
|
+
export type SelectScrollUpArrowProps = ComponentProps<typeof SelectPrimitive.ScrollUpArrow>;
|
|
26
|
+
declare function SelectScrollUpArrow({ className, ref, ...props }: SelectScrollUpArrowProps): import("react/jsx-runtime").JSX.Element;
|
|
23
27
|
/**
|
|
24
|
-
*
|
|
28
|
+
* SelectScrollDownArrow
|
|
25
29
|
*/
|
|
26
|
-
|
|
30
|
+
export type SelectScrollDownArrowProps = ComponentProps<typeof SelectPrimitive.ScrollDownArrow>;
|
|
31
|
+
declare function SelectScrollDownArrow({ className, ref, ...props }: SelectScrollDownArrowProps): import("react/jsx-runtime").JSX.Element;
|
|
27
32
|
/**
|
|
28
33
|
* SelectContent
|
|
29
34
|
*/
|
|
30
|
-
|
|
35
|
+
export type SelectContentProps = ComponentProps<typeof SelectPrimitive.Popup> & {
|
|
36
|
+
sideOffset?: number;
|
|
37
|
+
};
|
|
38
|
+
declare function SelectContent({ className, children, sideOffset, ref, ...props }: SelectContentProps): import("react/jsx-runtime").JSX.Element;
|
|
31
39
|
/**
|
|
32
40
|
* SelectLabel
|
|
33
41
|
*/
|
|
34
|
-
|
|
42
|
+
export type SelectLabelProps = ComponentProps<typeof SelectPrimitive.GroupLabel>;
|
|
43
|
+
declare function SelectLabel({ className, ref, ...props }: SelectLabelProps): import("react/jsx-runtime").JSX.Element;
|
|
35
44
|
/**
|
|
36
45
|
* SelectItem
|
|
37
46
|
*/
|
|
38
|
-
|
|
47
|
+
export type SelectItemProps = ComponentProps<typeof SelectPrimitive.Item>;
|
|
48
|
+
declare function SelectItem({ className, children, ref, ...props }: SelectItemProps): import("react/jsx-runtime").JSX.Element;
|
|
39
49
|
/**
|
|
40
50
|
* SelectSeparator
|
|
41
51
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
export type SelectSeparatorProps = ComponentProps<typeof SelectPrimitive.Separator>;
|
|
53
|
+
declare function SelectSeparator({ className, ref, ...props }: SelectSeparatorProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpArrow, SelectScrollDownArrow, };
|
|
@@ -1,65 +1,43 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
2
3
|
import { useFormContext } from "../form-field/form-field-context";
|
|
3
4
|
import { Icon } from "../icon/icon";
|
|
4
5
|
import { CheckIcon, ChevronDownIcon, ChevronUpIcon, } from "@radix-ui/react-icons";
|
|
5
6
|
import { cn } from "../../utilities/cn/cn";
|
|
6
|
-
|
|
7
|
-
import { forwardRef, } from "react";
|
|
8
|
-
/**
|
|
9
|
-
* Select
|
|
10
|
-
*/
|
|
11
|
-
const Select = ({ disabled: initialDisabled, required: initialRequired, ...props }) => {
|
|
7
|
+
function Select({ disabled: initialDisabled, required: initialRequired, ...props }) {
|
|
12
8
|
const { disabled, required } = useFormContext({
|
|
13
9
|
disabled: initialDisabled,
|
|
14
10
|
required: initialRequired,
|
|
15
11
|
});
|
|
16
12
|
return (_jsx(SelectPrimitive.Root, { disabled: disabled, required: required, ...props }));
|
|
17
|
-
}
|
|
13
|
+
}
|
|
18
14
|
/**
|
|
19
15
|
* SelectGroup
|
|
20
16
|
*/
|
|
21
17
|
const SelectGroup = SelectPrimitive.Group;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
SelectPrimitive.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"), children: children }), _jsx(SelectScrollDownButton, {})] }) })));
|
|
48
|
-
SelectContent.displayName = SelectPrimitive.Content.displayName;
|
|
49
|
-
/**
|
|
50
|
-
* SelectLabel
|
|
51
|
-
*/
|
|
52
|
-
const SelectLabel = forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Label, { ref: ref, className: cn("px-2 py-1.5 font-semibold text-sm", className), ...props })));
|
|
53
|
-
SelectLabel.displayName = SelectPrimitive.Label.displayName;
|
|
54
|
-
/**
|
|
55
|
-
* SelectItem
|
|
56
|
-
*/
|
|
57
|
-
const SelectItem = forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Item, { ref: ref, className: cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none focus-visible:bg-gray-700 focus-visible:text-white data-[disabled]:pointer-events-none data-[disabled]:opacity-50", className), ...props, children: [_jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Icon, { asChild: true, size: "small", children: _jsx(CheckIcon, {}) }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] })));
|
|
58
|
-
SelectItem.displayName = SelectPrimitive.Item.displayName;
|
|
59
|
-
/**
|
|
60
|
-
* SelectSeparator
|
|
61
|
-
*/
|
|
62
|
-
const SelectSeparator = forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.Separator, { ref: ref, className: cn("my-2 h-px bg-gray-200", className), ...props })));
|
|
63
|
-
SelectSeparator.displayName = SelectPrimitive.Separator.displayName;
|
|
64
|
-
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
|
|
18
|
+
function SelectValue({ ref, ...props }) {
|
|
19
|
+
return _jsx(SelectPrimitive.Value, { ref: ref, ...props });
|
|
20
|
+
}
|
|
21
|
+
function SelectTrigger({ className, children, ref, ...props }) {
|
|
22
|
+
return (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-gray-400 bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-placeholder:text-gray-500 [&>span]:line-clamp-1", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { render: _jsx(Icon, { size: "small", className: "opacity-50", children: _jsx(ChevronDownIcon, {}) }) })] }));
|
|
23
|
+
}
|
|
24
|
+
function SelectScrollUpArrow({ className, ref, ...props }) {
|
|
25
|
+
return (_jsx(SelectPrimitive.ScrollUpArrow, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(Icon, { size: "small", className: "opacity-50", children: _jsx(ChevronUpIcon, {}) }) }));
|
|
26
|
+
}
|
|
27
|
+
function SelectScrollDownArrow({ className, ref, ...props }) {
|
|
28
|
+
return (_jsx(SelectPrimitive.ScrollDownArrow, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(Icon, { size: "small", className: "opacity-50", children: _jsx(ChevronDownIcon, {}) }) }));
|
|
29
|
+
}
|
|
30
|
+
function SelectContent({ className, children, sideOffset = 4, ref, ...props }) {
|
|
31
|
+
return (_jsx(SelectPrimitive.Portal, { children: _jsxs(SelectPrimitive.Positioner, { sideOffset: sideOffset, alignItemWithTrigger: false, children: [_jsx(SelectScrollUpArrow, {}), _jsx(SelectPrimitive.Popup, { ref: ref, className: cn("data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-closed:fade-out data-closed:zoom-out-95 data-open:fade-in data-open:zoom-in-95 relative z-50 max-h-(--available-height) min-w-32 origin-(--transform-origin) overflow-y-auto overflow-x-hidden rounded-md border border-gray-400 bg-white text-gray-700 shadow-md transition-all data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1 data-[side=top]:-translate-y-1 data-closed:animate-out data-open:animate-in", className), ...props, children: _jsx(SelectPrimitive.List, { className: "w-full min-w-(--anchor-width) p-1", children: children }) }), _jsx(SelectScrollDownArrow, {})] }) }));
|
|
32
|
+
}
|
|
33
|
+
function SelectLabel({ className, ref, ...props }) {
|
|
34
|
+
return (_jsx(SelectPrimitive.GroupLabel, { ref: ref, className: cn("px-2 py-1.5 font-semibold text-sm", className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
function SelectItem({ className, children, ref, ...props }) {
|
|
37
|
+
return (_jsxs(SelectPrimitive.Item, { ref: ref, className: cn("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pr-8 pl-2 text-sm outline-none data-disabled:pointer-events-none data-highlighted:bg-gray-700 data-highlighted:text-white data-disabled:opacity-50", className), ...props, children: [_jsx("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: _jsx(SelectPrimitive.ItemIndicator, { children: _jsx(Icon, { size: "small", children: _jsx(CheckIcon, {}) }) }) }), _jsx(SelectPrimitive.ItemText, { children: children })] }));
|
|
38
|
+
}
|
|
39
|
+
function SelectSeparator({ className, ref, ...props }) {
|
|
40
|
+
return (_jsx(SelectPrimitive.Separator, { ref: ref, className: cn("my-2 h-px bg-gray-200", className), ...props }));
|
|
41
|
+
}
|
|
42
|
+
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpArrow, SelectScrollDownArrow, };
|
|
65
43
|
//# sourceMappingURL=select.js.map
|