luan-ui 0.6.2 → 0.8.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/dist/components/accordion/accordion.d.ts +1 -1
- package/dist/components/accordion/accordion.js +2 -2
- package/dist/components/accordion/accordion.js.map +1 -1
- package/dist/components/alert/alert.d.ts +1 -1
- package/dist/components/alert/alert.js +3 -3
- package/dist/components/alert/alert.js.map +1 -1
- package/dist/components/alert-dialog/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog/alert-dialog.js +4 -4
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +69 -0
- package/dist/components/autocomplete/autocomplete.js +50 -0
- package/dist/components/autocomplete/autocomplete.js.map +1 -0
- package/dist/components/avatar/avatar-group.js +1 -1
- package/dist/components/avatar/avatar-group.js.map +1 -1
- package/dist/components/avatar/avatar.js +2 -2
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/badge/badge.js +4 -4
- package/dist/components/badge/badge.js.map +1 -1
- package/dist/components/button/button.js +3 -3
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/card/card.js +3 -3
- package/dist/components/card/card.js.map +1 -1
- package/dist/components/checkbox/checkbox.js +2 -2
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/combobox/combobox.d.ts +68 -0
- package/dist/components/combobox/combobox.js +49 -0
- package/dist/components/combobox/combobox.js.map +1 -0
- package/dist/components/dialog/dialog.js +3 -3
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/drawer/drawer.d.ts +16 -13
- package/dist/components/drawer/drawer.js +15 -34
- package/dist/components/drawer/drawer.js.map +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +1 -1
- package/dist/components/dropdown-menu/dropdown-menu.js +8 -8
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
- package/dist/components/form-helper/form-helper.js +4 -4
- package/dist/components/form-helper/form-helper.js.map +1 -1
- package/dist/components/input/input.js +3 -3
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/label/label.js +1 -1
- package/dist/components/label/label.js.map +1 -1
- package/dist/components/pagination/pagination.d.ts +1 -1
- package/dist/components/pagination/pagination.js +5 -5
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/popover/popover.d.ts +1 -1
- package/dist/components/popover/popover.js +2 -2
- package/dist/components/popover/popover.js.map +1 -1
- package/dist/components/progress/progress.js +1 -1
- package/dist/components/progress/progress.js.map +1 -1
- package/dist/components/radio-group/radio-group.js +1 -1
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.js +5 -5
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/skeleton/skeleton.js +1 -1
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/slider/slider.js +2 -2
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/switch/switch.js +5 -5
- package/dist/components/switch/switch.js.map +1 -1
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +5 -5
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/tabs/tabs.d.ts +1 -1
- package/dist/components/tabs/tabs.js +4 -4
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/text-area/text-area.js +3 -3
- package/dist/components/text-area/text-area.js.map +1 -1
- package/dist/components/toast/toast.d.ts +1 -1
- package/dist/components/toast/toast.js +2 -2
- package/dist/components/toast/toast.js.map +1 -1
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +2 -2
- package/dist/components/tooltip/tooltip.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/index.css +43 -0
- package/dist/utilities/pagination/get-truncated-elements.js +4 -4
- package/dist/utilities/pagination/get-truncated-elements.js.map +1 -1
- package/package.json +16 -16
|
@@ -16,7 +16,7 @@ function Label({ className, required: initialRequired, children, ref, ...props }
|
|
|
16
16
|
});
|
|
17
17
|
return (
|
|
18
18
|
// biome-ignore lint/a11y/noLabelWithoutControl: htmlFor is passed via props at runtime
|
|
19
|
-
_jsxs("label", { className: cn("font-medium text-
|
|
19
|
+
_jsxs("label", { className: cn("font-medium text-md text-text peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className), ...props, ref: ref, children: [children, required && _jsx("span", { children: "*" })] }));
|
|
20
20
|
}
|
|
21
21
|
export { Label };
|
|
22
22
|
//# sourceMappingURL=label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","sourceRoot":"/","sources":["components/label/label.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAOtC;;;;;;;;GAQG;AACH,SAAS,KAAK,CAAC,EACd,SAAS,EACT,QAAQ,EAAE,eAAe,EACzB,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACI;IACZ,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QACnC,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IACH,OAAO;IACN,uFAAuF;IACvF,iBACC,SAAS,EAAE,EAAE,CACZ,
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"/","sources":["components/label/label.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAOtC;;;;;;;;GAQG;AACH,SAAS,KAAK,CAAC,EACd,SAAS,EACT,QAAQ,EAAE,eAAe,EACzB,QAAQ,EACR,GAAG,EACH,GAAG,KAAK,EACI;IACZ,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QACnC,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IACH,OAAO;IACN,uFAAuF;IACvF,iBACC,SAAS,EAAE,EAAE,CACZ,yFAAyF,EACzF,SAAS,CACT,KACG,KAAK,EACT,GAAG,EAAE,GAAG,aAEP,QAAQ,EACR,QAAQ,IAAI,+BAAc,IACpB,CACR,CAAC;AACH,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,CAAC","sourcesContent":["import { useFormContext } from \"@components/form-field/form-field-context\";\nimport { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\n\nexport type LabelProps = ComponentProps<\"label\"> & {\n\trequired?: boolean;\n};\n\n/**\n * A label component that can be used to label form fields.\n *\n * @example\n * ```tsx\n * <Label htmlFor=\"email\">Email</Label>\n * <Input id=\"email\" />\n * ```\n */\nfunction Label({\n\tclassName,\n\trequired: initialRequired,\n\tchildren,\n\tref,\n\t...props\n}: LabelProps) {\n\tconst { required } = useFormContext({\n\t\trequired: initialRequired,\n\t});\n\treturn (\n\t\t// biome-ignore lint/a11y/noLabelWithoutControl: htmlFor is passed via props at runtime\n\t\t<label\n\t\t\tclassName={cn(\n\t\t\t\t\"font-medium text-md text-text peer-disabled:cursor-not-allowed peer-disabled:opacity-50\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t{children}\n\t\t\t{required && <span>*</span>}\n\t\t</label>\n\t);\n}\n\nexport { Label };\n"]}
|
|
@@ -87,4 +87,4 @@ export type PaginationNextProps = PropsWithChildren<React.HTMLAttributes<HTMLBut
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
declare function PaginationNext({ children, className, ref, ...props }: PaginationNextProps): import("react/jsx-runtime").JSX.Element;
|
|
90
|
-
export { Pagination, PaginationItem,
|
|
90
|
+
export { Pagination, PaginationItem, PaginationNext, PaginationPrev };
|
|
@@ -111,8 +111,8 @@ function PaginationItem({ index, children, className, ref, ...props }) {
|
|
|
111
111
|
setPage(index);
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
|
-
return (_jsx("button", { type: "button", onClick: handleClick, ref: mergeRefs(ref, (el) => registerRef(index ?? 0, el)), className: cn("flex h-10 w-10 items-center justify-center rounded-full hover:bg-
|
|
115
|
-
"bg-
|
|
114
|
+
return (_jsx("button", { type: "button", onClick: handleClick, ref: mergeRefs(ref, (el) => registerRef(index ?? 0, el)), className: cn("flex h-10 w-10 items-center justify-center rounded-full hover:bg-border", {
|
|
115
|
+
"bg-primary text-on-primary hover:bg-primary-hover": isActive,
|
|
116
116
|
}, className), "aria-current": isActive ? "page" : undefined, ...props, children: children ?? index }));
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -126,7 +126,7 @@ function PaginationItem({ index, children, className, ref, ...props }) {
|
|
|
126
126
|
*/
|
|
127
127
|
function PaginationPrev({ children, className, ref, ...props }) {
|
|
128
128
|
const { registerRef, page, setPage, hasPreviousPage } = usePaginationContext();
|
|
129
|
-
return (_jsx("button", { type: "button", onClick: () => setPage(page - 1), ref: mergeRefs(ref, (el) => registerRef(0, el)), disabled: !hasPreviousPage, className: cn("flex h-10 w-10 items-center justify-center rounded-full hover:bg-
|
|
129
|
+
return (_jsx("button", { type: "button", onClick: () => setPage(page - 1), ref: mergeRefs(ref, (el) => registerRef(0, el)), disabled: !hasPreviousPage, className: cn("flex h-10 w-10 items-center justify-center rounded-full hover:bg-border disabled:opacity-25", className), ...props, children: children }));
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* Next page button component for the Pagination.
|
|
@@ -139,7 +139,7 @@ function PaginationPrev({ children, className, ref, ...props }) {
|
|
|
139
139
|
*/
|
|
140
140
|
function PaginationNext({ children, className, ref, ...props }) {
|
|
141
141
|
const { page, setPage, hasNextPage, registerRef, totalPages } = usePaginationContext();
|
|
142
|
-
return (_jsx("button", { type: "button", className: cn("flex h-10 w-10 items-center justify-center rounded-full hover:bg-
|
|
142
|
+
return (_jsx("button", { type: "button", className: cn("flex h-10 w-10 items-center justify-center rounded-full hover:bg-border disabled:opacity-25", className), onClick: () => setPage(page + 1), disabled: !hasNextPage, ref: mergeRefs(ref, (el) => registerRef(totalPages + 1, el)), ...props, children: children }));
|
|
143
143
|
}
|
|
144
|
-
export { Pagination, PaginationItem,
|
|
144
|
+
export { Pagination, PaginationItem, PaginationNext, PaginationPrev };
|
|
145
145
|
//# sourceMappingURL=pagination.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"/","sources":["components/pagination/pagination.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACN,aAAa,EAGb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACR,MAAM,OAAO,CAAC;AAef,MAAM,iBAAiB,GAAG,aAAa,CACtC,SAAS,CACT,CAAC;AAEF,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACjC,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAC9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAcF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAS,UAAU,CAAC,EACnB,QAAQ,EACR,IAAI,EAAE,WAAW,EACjB,UAAU,EAAE,iBAAiB,EAC7B,YAAY,EACZ,SAAS,EACT,MAAM,EACN,GAAG,KA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AAYD;;;;;;;;GAQG;AACH,SAAS,cAAc,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACa;IACrB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,GAC5D,oBAAoB,EAAE,CAAC;IACxB,OAAO,CACN,iBACC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,EAAE,CACZ,+FAA+F,EAC/F,SAAS,CACT,EACD,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,EAChC,QAAQ,EAAE,CAAC,WAAW,EACtB,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,KACxD,KAAK,YAER,QAAQ,GACD,CACT,CAAC;AACH,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cn } from \"@utilities/cn/cn\";\nimport { mergeRefs } from \"@utilities/merge-refs/merge-refs\";\nimport { getTruncatedElements } from \"@utilities/pagination/get-truncated-elements\";\nimport { handleKeyboardNavigation } from \"@utilities/pagination/keyboard-navigation\";\nimport clsx from \"clsx\";\nimport {\n\tcreateContext,\n\ttype PropsWithChildren,\n\ttype Ref,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\";\n\n/**\n * Pagination Context\n */\n\ntype PaginationContextValue = {\n\tpage: number;\n\ttotalPages: number;\n\thasNextPage: boolean;\n\thasPreviousPage: boolean;\n\tsetPage: (page: number) => void;\n\tregisterRef: (index: number, element: HTMLButtonElement | null) => void;\n};\n\nconst PaginationContext = createContext<PaginationContextValue | undefined>(\n\tundefined,\n);\n\nconst usePaginationContext = () => {\n\tconst context = useContext(PaginationContext);\n\tif (!context) {\n\t\tthrow new Error(\"Pagination components must be used within a Pagination\");\n\t}\n\treturn context;\n};\n\n/**\n * Pagination\n */\n\nexport type PaginationProps = useRender.ComponentProps<\"nav\"> & {\n\tchildren?: React.ReactNode;\n\tpage: number;\n\ttotalPages: number;\n\tonPageChange: (page: number) => void;\n\tclassName?: string;\n};\n\n/**\n * Pagination component that provides navigation controls for a set of pages.\n *\n * @param {number} props.page - The current active page number\n * @param {number} props.totalPages - The total number of pages\n * @param {(page: number) => void} props.onPageChange - Callback function called when page changes\n * @param {React.ReactElement | ((props, state) => React.ReactElement)} [props.render] - Custom element to render instead of nav\n * @param {React.ReactNode} [props.children] - The content to render within the pagination component\n * @param {string} [props.className] - Additional CSS classes to apply\n *\n * @example\n * ```tsx\n * <Pagination page={1} totalPages={10} onPageChange={(page) => console.log(page)}>\n * <PaginationPrev>Previous</PaginationPrev>\n * <PaginationItem index={1}>1</PaginationItem>\n * <PaginationItem index={2}>2</PaginationItem>\n * <PaginationNext>Next</PaginationNext>\n * </Pagination>\n * ```\n *\n * @example\n * // With render prop to change the element\n * ```tsx\n * <Pagination render={<div />} page={1} totalPages={10} onPageChange={handleChange}>\n * ...\n * </Pagination>\n * ```\n */\nfunction Pagination({\n\tchildren,\n\tpage: initialPage,\n\ttotalPages: initialTotalPages,\n\tonPageChange,\n\tclassName,\n\trender,\n\t...props\n}: PaginationProps) {\n\tconst [page, setPage] = useState(initialPage);\n\tconst [totalPages, setTotalPages] = useState(initialTotalPages);\n\tconst [hasNextPage, setHasNextPage] = useState(page < totalPages);\n\tconst [hasPreviousPage, setHasPreviousPage] = useState(page > 1);\n\n\tconst refs = useRef(new Map<number, HTMLButtonElement>());\n\n\tconst handleKeyDown = useCallback(\n\t\t(e: KeyboardEvent) =>\n\t\t\thandleKeyboardNavigation(e, { current: refs.current }, totalPages),\n\t\t[totalPages],\n\t);\n\n\tconst registerRefWrapper = useCallback(\n\t\t(index: number, element: HTMLButtonElement | null) => {\n\t\t\tif (element) {\n\t\t\t\trefs.current.set(index, element);\n\t\t\t} else {\n\t\t\t\trefs.current.delete(index);\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\n\tuseEffect(() => {\n\t\tdocument.addEventListener(\"keydown\", handleKeyDown);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"keydown\", handleKeyDown);\n\t\t};\n\t}, [handleKeyDown]);\n\n\tuseEffect(() => {\n\t\tsetHasNextPage(page < totalPages);\n\t\tsetHasPreviousPage(page > 1);\n\t}, [page, totalPages]);\n\n\tuseEffect(() => {\n\t\tsetPage(initialPage);\n\t\tsetTotalPages(initialTotalPages);\n\t}, [initialPage, initialTotalPages]);\n\n\tuseEffect(() => {\n\t\tif (onPageChange) {\n\t\t\tonPageChange(page);\n\t\t}\n\t}, [page, onPageChange]);\n\n\tconst memoContextValue = useMemo(\n\t\t() => ({\n\t\t\tpage,\n\t\t\tsetPage,\n\t\t\ttotalPages,\n\t\t\thasNextPage,\n\t\t\thasPreviousPage,\n\t\t\tregisterRef: registerRefWrapper,\n\t\t}),\n\t\t[page, totalPages, hasNextPage, hasPreviousPage, registerRefWrapper],\n\t);\n\n\tconst defaultProps: useRender.ElementProps<\"nav\"> = {\n\t\t\"aria-label\": \"Pagination\",\n\t\tclassName: clsx(\"flex items-center gap-1\", className),\n\t\tchildren: (\n\t\t\t<PaginationContext.Provider value={memoContextValue}>\n\t\t\t\t{getTruncatedElements({ page, children })}\n\t\t\t</PaginationContext.Provider>\n\t\t),\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"nav\",\n\t\trender,\n\t\tprops: mergeProps<\"nav\">(defaultProps, props),\n\t});\n}\n\n/**\n * Pagination Item\n */\n\nexport type PaginationItemProps = {\n\tchildren?: React.ReactNode;\n\tindex?: number;\n\tref?: Ref<HTMLButtonElement>;\n} & React.HTMLAttributes<HTMLButtonElement>;\n\n/**\n * Individual page item within the Pagination component.\n *\n * @example\n * ```tsx\n * <PaginationItem index={1}>1</PaginationItem>\n */\nfunction PaginationItem({\n\tindex,\n\tchildren,\n\tclassName,\n\tref,\n\t...props\n}: PaginationItemProps) {\n\tconst { registerRef, page, setPage } = usePaginationContext();\n\n\tconst isActive = page === index;\n\tconst handleClick = () => {\n\t\tif (index !== undefined) {\n\t\t\tsetPage(index);\n\t\t}\n\t};\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonClick={handleClick}\n\t\t\tref={mergeRefs(ref, (el) => registerRef(index ?? 0, el))}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-gray-200\",\n\t\t\t\t{\n\t\t\t\t\t\"bg-gray-700 text-white hover:bg-gray-800\": isActive,\n\t\t\t\t},\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\taria-current={isActive ? \"page\" : undefined}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children ?? index}\n\t\t</button>\n\t);\n}\n\n/**\n * Pagination Prev\n */\n\nexport type PaginationPrevProps = PropsWithChildren<\n\tReact.HTMLAttributes<HTMLButtonElement>\n> & {\n\tref?: Ref<HTMLButtonElement>;\n};\n\n/**\n * Previous page button component for the Pagination.\n * Automatically disabled when on the first page.\n *\n * @example\n * ```tsx\n * <PaginationPrev>Previous</PaginationPrev>\n * ```\n */\nfunction PaginationPrev({\n\tchildren,\n\tclassName,\n\tref,\n\t...props\n}: PaginationPrevProps) {\n\tconst { registerRef, page, setPage, hasPreviousPage } =\n\t\tusePaginationContext();\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonClick={() => setPage(page - 1)}\n\t\t\tref={mergeRefs(ref, (el) => registerRef(0, el))}\n\t\t\tdisabled={!hasPreviousPage}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-gray-200 disabled:opacity-25\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n}\n\n/**\n * Pagination Next\n */\n\nexport type PaginationNextProps = PropsWithChildren<\n\tReact.HTMLAttributes<HTMLButtonElement>\n> & {\n\tref?: Ref<HTMLButtonElement>;\n};\n\n/**\n * Next page button component for the Pagination.\n * Automatically disabled when on the last page.\n *\n * @example\n * ```tsx\n * <PaginationNext>Next</PaginationNext>\n * ```\n */\nfunction PaginationNext({\n\tchildren,\n\tclassName,\n\tref,\n\t...props\n}: PaginationNextProps) {\n\tconst { page, setPage, hasNextPage, registerRef, totalPages } =\n\t\tusePaginationContext();\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-gray-200 disabled:opacity-25\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tonClick={() => setPage(page + 1)}\n\t\t\tdisabled={!hasNextPage}\n\t\t\tref={mergeRefs(ref, (el) => registerRef(totalPages + 1, el))}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n}\n\nexport { Pagination, PaginationItem, PaginationPrev, PaginationNext };\n"]}
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"/","sources":["components/pagination/pagination.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EACN,aAAa,EAGb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP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,QAAQ,EACR,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACa;IACrB,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,GACpD,oBAAoB,EAAE,CAAC;IAExB,OAAO,CACN,iBACC,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,EAChC,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAC/C,QAAQ,EAAE,CAAC,eAAe,EAC1B,SAAS,EAAE,EAAE,CACZ,6FAA6F,EAC7F,SAAS,CACT,KACG,KAAK,YAER,QAAQ,GACD,CACT,CAAC;AACH,CAAC;AAYD;;;;;;;;GAQG;AACH,SAAS,cAAc,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACa;IACrB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,GAC5D,oBAAoB,EAAE,CAAC;IACxB,OAAO,CACN,iBACC,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,EAAE,CACZ,6FAA6F,EAC7F,SAAS,CACT,EACD,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC,EAChC,QAAQ,EAAE,CAAC,WAAW,EACtB,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,UAAU,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,KACxD,KAAK,YAER,QAAQ,GACD,CACT,CAAC;AACH,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cn } from \"@utilities/cn/cn\";\nimport { mergeRefs } from \"@utilities/merge-refs/merge-refs\";\nimport { getTruncatedElements } from \"@utilities/pagination/get-truncated-elements\";\nimport { handleKeyboardNavigation } from \"@utilities/pagination/keyboard-navigation\";\nimport clsx from \"clsx\";\nimport {\n\tcreateContext,\n\ttype PropsWithChildren,\n\ttype Ref,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from \"react\";\n\n/**\n * Pagination Context\n */\n\ntype PaginationContextValue = {\n\tpage: number;\n\ttotalPages: number;\n\thasNextPage: boolean;\n\thasPreviousPage: boolean;\n\tsetPage: (page: number) => void;\n\tregisterRef: (index: number, element: HTMLButtonElement | null) => void;\n};\n\nconst PaginationContext = createContext<PaginationContextValue | undefined>(\n\tundefined,\n);\n\nconst usePaginationContext = () => {\n\tconst context = useContext(PaginationContext);\n\tif (!context) {\n\t\tthrow new Error(\"Pagination components must be used within a Pagination\");\n\t}\n\treturn context;\n};\n\n/**\n * Pagination\n */\n\nexport type PaginationProps = useRender.ComponentProps<\"nav\"> & {\n\tchildren?: React.ReactNode;\n\tpage: number;\n\ttotalPages: number;\n\tonPageChange: (page: number) => void;\n\tclassName?: string;\n};\n\n/**\n * Pagination component that provides navigation controls for a set of pages.\n *\n * @param {number} props.page - The current active page number\n * @param {number} props.totalPages - The total number of pages\n * @param {(page: number) => void} props.onPageChange - Callback function called when page changes\n * @param {React.ReactElement | ((props, state) => React.ReactElement)} [props.render] - Custom element to render instead of nav\n * @param {React.ReactNode} [props.children] - The content to render within the pagination component\n * @param {string} [props.className] - Additional CSS classes to apply\n *\n * @example\n * ```tsx\n * <Pagination page={1} totalPages={10} onPageChange={(page) => console.log(page)}>\n * <PaginationPrev>Previous</PaginationPrev>\n * <PaginationItem index={1}>1</PaginationItem>\n * <PaginationItem index={2}>2</PaginationItem>\n * <PaginationNext>Next</PaginationNext>\n * </Pagination>\n * ```\n *\n * @example\n * // With render prop to change the element\n * ```tsx\n * <Pagination render={<div />} page={1} totalPages={10} onPageChange={handleChange}>\n * ...\n * </Pagination>\n * ```\n */\nfunction Pagination({\n\tchildren,\n\tpage: initialPage,\n\ttotalPages: initialTotalPages,\n\tonPageChange,\n\tclassName,\n\trender,\n\t...props\n}: PaginationProps) {\n\tconst [page, setPage] = useState(initialPage);\n\tconst [totalPages, setTotalPages] = useState(initialTotalPages);\n\tconst [hasNextPage, setHasNextPage] = useState(page < totalPages);\n\tconst [hasPreviousPage, setHasPreviousPage] = useState(page > 1);\n\n\tconst refs = useRef(new Map<number, HTMLButtonElement>());\n\n\tconst handleKeyDown = useCallback(\n\t\t(e: KeyboardEvent) =>\n\t\t\thandleKeyboardNavigation(e, { current: refs.current }, totalPages),\n\t\t[totalPages],\n\t);\n\n\tconst registerRefWrapper = useCallback(\n\t\t(index: number, element: HTMLButtonElement | null) => {\n\t\t\tif (element) {\n\t\t\t\trefs.current.set(index, element);\n\t\t\t} else {\n\t\t\t\trefs.current.delete(index);\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\n\tuseEffect(() => {\n\t\tdocument.addEventListener(\"keydown\", handleKeyDown);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"keydown\", handleKeyDown);\n\t\t};\n\t}, [handleKeyDown]);\n\n\tuseEffect(() => {\n\t\tsetHasNextPage(page < totalPages);\n\t\tsetHasPreviousPage(page > 1);\n\t}, [page, totalPages]);\n\n\tuseEffect(() => {\n\t\tsetPage(initialPage);\n\t\tsetTotalPages(initialTotalPages);\n\t}, [initialPage, initialTotalPages]);\n\n\tuseEffect(() => {\n\t\tif (onPageChange) {\n\t\t\tonPageChange(page);\n\t\t}\n\t}, [page, onPageChange]);\n\n\tconst memoContextValue = useMemo(\n\t\t() => ({\n\t\t\tpage,\n\t\t\tsetPage,\n\t\t\ttotalPages,\n\t\t\thasNextPage,\n\t\t\thasPreviousPage,\n\t\t\tregisterRef: registerRefWrapper,\n\t\t}),\n\t\t[page, totalPages, hasNextPage, hasPreviousPage, registerRefWrapper],\n\t);\n\n\tconst defaultProps: useRender.ElementProps<\"nav\"> = {\n\t\t\"aria-label\": \"Pagination\",\n\t\tclassName: clsx(\"flex items-center gap-1\", className),\n\t\tchildren: (\n\t\t\t<PaginationContext.Provider value={memoContextValue}>\n\t\t\t\t{getTruncatedElements({ page, children })}\n\t\t\t</PaginationContext.Provider>\n\t\t),\n\t};\n\n\treturn useRender({\n\t\tdefaultTagName: \"nav\",\n\t\trender,\n\t\tprops: mergeProps<\"nav\">(defaultProps, props),\n\t});\n}\n\n/**\n * Pagination Item\n */\n\nexport type PaginationItemProps = {\n\tchildren?: React.ReactNode;\n\tindex?: number;\n\tref?: Ref<HTMLButtonElement>;\n} & React.HTMLAttributes<HTMLButtonElement>;\n\n/**\n * Individual page item within the Pagination component.\n *\n * @example\n * ```tsx\n * <PaginationItem index={1}>1</PaginationItem>\n */\nfunction PaginationItem({\n\tindex,\n\tchildren,\n\tclassName,\n\tref,\n\t...props\n}: PaginationItemProps) {\n\tconst { registerRef, page, setPage } = usePaginationContext();\n\n\tconst isActive = page === index;\n\tconst handleClick = () => {\n\t\tif (index !== undefined) {\n\t\t\tsetPage(index);\n\t\t}\n\t};\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonClick={handleClick}\n\t\t\tref={mergeRefs(ref, (el) => registerRef(index ?? 0, el))}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-border\",\n\t\t\t\t{\n\t\t\t\t\t\"bg-primary text-on-primary hover:bg-primary-hover\": isActive,\n\t\t\t\t},\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\taria-current={isActive ? \"page\" : undefined}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children ?? index}\n\t\t</button>\n\t);\n}\n\n/**\n * Pagination Prev\n */\n\nexport type PaginationPrevProps = PropsWithChildren<\n\tReact.HTMLAttributes<HTMLButtonElement>\n> & {\n\tref?: Ref<HTMLButtonElement>;\n};\n\n/**\n * Previous page button component for the Pagination.\n * Automatically disabled when on the first page.\n *\n * @example\n * ```tsx\n * <PaginationPrev>Previous</PaginationPrev>\n * ```\n */\nfunction PaginationPrev({\n\tchildren,\n\tclassName,\n\tref,\n\t...props\n}: PaginationPrevProps) {\n\tconst { registerRef, page, setPage, hasPreviousPage } =\n\t\tusePaginationContext();\n\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonClick={() => setPage(page - 1)}\n\t\t\tref={mergeRefs(ref, (el) => registerRef(0, el))}\n\t\t\tdisabled={!hasPreviousPage}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-border disabled:opacity-25\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n}\n\n/**\n * Pagination Next\n */\n\nexport type PaginationNextProps = PropsWithChildren<\n\tReact.HTMLAttributes<HTMLButtonElement>\n> & {\n\tref?: Ref<HTMLButtonElement>;\n};\n\n/**\n * Next page button component for the Pagination.\n * Automatically disabled when on the last page.\n *\n * @example\n * ```tsx\n * <PaginationNext>Next</PaginationNext>\n * ```\n */\nfunction PaginationNext({\n\tchildren,\n\tclassName,\n\tref,\n\t...props\n}: PaginationNextProps) {\n\tconst { page, setPage, hasNextPage, registerRef, totalPages } =\n\t\tusePaginationContext();\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-10 w-10 items-center justify-center rounded-full hover:bg-border disabled:opacity-25\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tonClick={() => setPage(page + 1)}\n\t\t\tdisabled={!hasNextPage}\n\t\t\tref={mergeRefs(ref, (el) => registerRef(totalPages + 1, el))}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n}\n\nexport { Pagination, PaginationItem, PaginationNext, PaginationPrev };\n"]}
|
|
@@ -77,4 +77,4 @@ declare const PopoverTitle: import("react").ForwardRefExoticComponent<Omit<impor
|
|
|
77
77
|
* Popover Description
|
|
78
78
|
*/
|
|
79
79
|
declare const PopoverDescription: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").PopoverDescriptionProps, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
80
|
-
export { Popover,
|
|
80
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverPortal, PopoverTitle, PopoverTrigger, };
|
|
@@ -61,7 +61,7 @@ function PopoverTrigger({ className, ref, ...props }) {
|
|
|
61
61
|
function PopoverContent({ children, className, sideOffset: sideOffsetProp, ref, ...props }) {
|
|
62
62
|
const { showArrow, closeButtonAriaLabel, side, showCloseButton, sideOffset: sideOffsetContext, } = usePopoverContext();
|
|
63
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-
|
|
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-primary p-4 text-on-primary text-sm 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-primary" }) }))] }) }) }));
|
|
65
65
|
}
|
|
66
66
|
function PopoverClose({ className, ref, ...props }) {
|
|
67
67
|
return _jsx(PopoverPrimitive.Close, { ref: ref, className: className, ...props });
|
|
@@ -81,5 +81,5 @@ const PopoverTitle = PopoverPrimitive.Title;
|
|
|
81
81
|
* Popover Description
|
|
82
82
|
*/
|
|
83
83
|
const PopoverDescription = PopoverPrimitive.Description;
|
|
84
|
-
export { Popover,
|
|
84
|
+
export { Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverDescription, PopoverPortal, PopoverTitle, PopoverTrigger, };
|
|
85
85
|
//# sourceMappingURL=popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sourceRoot":"/","sources":["components/popover/popover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAc3D,MAAM,cAAc,GAAG,aAAa,CACnC,SAAS,CACT,CAAC;AAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAeF;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAS,OAAO,CAAC,EAChB,QAAQ,EACR,SAAS,GAAG,IAAI,EAChB,oBAAoB,GAAG,OAAO,EAC9B,eAAe,GAAG,IAAI,EACtB,IAAI,EACJ,UAAU,GAAG,EAAE,EACf,GAAG,KAAK,EACM;IACd,MA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,CAAC,MAAM,CAAC;AAY9C,SAAS,aAAa,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,KAAK,EAAsB;IACrE,OAAO,CACN,KAAC,gBAAgB,CAAC,UAAU,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,YAC9C,QAAQ,GACoB,CAC9B,CAAC;AACH,CAAC;AAED;;GAEG;AAEH,MAAM,YAAY,GAAG,gBAAgB,CAAC,KAAK,CAAC;AAE5C;;GAEG;AAEH,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,WAAW,CAAC;AAExD,OAAO,EACN,OAAO,EACP,aAAa,EACb,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,cAAc,GACd,CAAC","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-primary p-4 text-on-primary text-sm 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-primary\" />\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\tPopoverAnchor,\n\tPopoverClose,\n\tPopoverContent,\n\tPopoverDescription,\n\tPopoverPortal,\n\tPopoverTitle,\n\tPopoverTrigger,\n};\n"]}
|
|
@@ -10,7 +10,7 @@ import { cn } from "../../utilities/cn/cn";
|
|
|
10
10
|
* @param {boolean} props.showLabel - Whether to show the label.
|
|
11
11
|
*/
|
|
12
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-
|
|
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-skeleton/80", className), children: _jsx(ProgressPrimitive.Indicator, { className: "h-full bg-primary/80 transition-all" }) }), showLabel && (_jsx(ProgressPrimitive.Value, { className: "text-sm text-text-muted", children: (_formattedValue, rawValue) => `${rawValue}%` }))] }));
|
|
14
14
|
}
|
|
15
15
|
export { Progress };
|
|
16
16
|
//# sourceMappingURL=progress.js.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,qCAAqC,GAAG,GACtD,EACzB,SAAS,IAAI,CACb,KAAC,iBAAiB,CAAC,KAAK,IAAC,SAAS,EAAC,yBAAyB,YAC1D,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-skeleton/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-primary/80 transition-all\" />\n\t\t\t</ProgressPrimitive.Track>\n\t\t\t{showLabel && (\n\t\t\t\t<ProgressPrimitive.Value className=\"text-sm text-text-muted\">\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"]}
|
|
@@ -11,7 +11,7 @@ function RadioGroup({ className, disabled: initialDisabled, required: initialReq
|
|
|
11
11
|
return (_jsx(BaseRadioGroup, { ref: ref, className: cn("flex flex-col gap-2", className), disabled: disabled, required: required, ...props }));
|
|
12
12
|
}
|
|
13
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-
|
|
14
|
+
return (_jsx(Radio.Root, { ref: ref, className: cn("flex h-4 w-4 items-center justify-center rounded-full border border-primary bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring data-disabled:cursor-not-allowed data-disabled:opacity-50", className), ...props, children: _jsx(Radio.Indicator, { className: "relative h-2 w-2 rounded-full bg-indicator" }) }));
|
|
15
15
|
}
|
|
16
16
|
export { RadioGroup, RadioGroupItem };
|
|
17
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,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,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G,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,gOAAgO,EAChO,SAAS,CACT,KACG,KAAK,YAET,KAAC,KAAK,CAAC,SAAS,IAAC,SAAS,EAAC,4CAA4C,GAAG,GAC9D,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-primary bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring 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-indicator\" />\n\t\t</Radio.Root>\n\t);\n}\n\nexport { RadioGroup, RadioGroupItem };\n"]}
|
|
@@ -51,4 +51,4 @@ declare function SelectItem({ className, children, ref, ...props }: SelectItemPr
|
|
|
51
51
|
*/
|
|
52
52
|
export type SelectSeparatorProps = ComponentProps<typeof SelectPrimitive.Separator>;
|
|
53
53
|
declare function SelectSeparator({ className, ref, ...props }: SelectSeparatorProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
-
export { Select,
|
|
54
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownArrow, SelectScrollUpArrow, SelectSeparator, SelectTrigger, SelectValue, };
|
|
@@ -19,7 +19,7 @@ function SelectValue({ ref, ...props }) {
|
|
|
19
19
|
return _jsx(SelectPrimitive.Value, { ref: ref, ...props });
|
|
20
20
|
}
|
|
21
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-
|
|
22
|
+
return (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-border-input 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-text-muted [&>span]:line-clamp-1", className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { render: _jsx(Icon, { size: "small", className: "opacity-50", children: _jsx(ChevronDownIcon, {}) }) })] }));
|
|
23
23
|
}
|
|
24
24
|
function SelectScrollUpArrow({ className, ref, ...props }) {
|
|
25
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, {}) }) }));
|
|
@@ -28,16 +28,16 @@ function SelectScrollDownArrow({ className, ref, ...props }) {
|
|
|
28
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
29
|
}
|
|
30
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-
|
|
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-border-input bg-surface text-text-secondary 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
32
|
}
|
|
33
33
|
function SelectLabel({ className, ref, ...props }) {
|
|
34
34
|
return (_jsx(SelectPrimitive.GroupLabel, { ref: ref, className: cn("px-2 py-1.5 font-semibold text-sm", className), ...props }));
|
|
35
35
|
}
|
|
36
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-
|
|
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-highlight data-highlighted:text-on-highlight 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
38
|
}
|
|
39
39
|
function SelectSeparator({ className, ref, ...props }) {
|
|
40
|
-
return (_jsx(SelectPrimitive.Separator, { ref: ref, className: cn("my-2 h-px bg-
|
|
40
|
+
return (_jsx(SelectPrimitive.Separator, { ref: ref, className: cn("my-2 h-px bg-separator", className), ...props }));
|
|
41
41
|
}
|
|
42
|
-
export { Select,
|
|
42
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownArrow, SelectScrollUpArrow, SelectSeparator, SelectTrigger, SelectValue, };
|
|
43
43
|
//# sourceMappingURL=select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"/","sources":["components/select/select.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EACN,SAAS,EACT,eAAe,EACf,aAAa,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAStC,SAAS,MAAM,CAAC,EACf,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,eAAe,EACzB,GAAG,KAAK,EACK;IACb,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QAC7C,QAAQ,EAAE,eAAe;QACzB,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IACH,OAAO,CACN,KAAC,eAAe,CAAC,IAAI,IAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,KAAM,KAAK,GAAI,CAC3E,CAAC;AACH,CAAC;AAED;;GAEG;AAEH,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC;AAQ1C,SAAS,WAAW,CAAC,EAAE,GAAG,EAAE,GAAG,KAAK,EAAoB;IACvD,OAAO,KAAC,eAAe,CAAC,KAAK,IAAC,GAAG,EAAE,GAAG,KAAM,KAAK,GAAI,CAAC;AACvD,CAAC;AAQD,SAAS,aAAa,CAAC,EACtB,SAAS,EACT,Q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cesContent":["import { Select as SelectPrimitive } from \"@base-ui/react/select\";\nimport { useFormContext } from \"@components/form-field/form-field-context\";\nimport { Icon } from \"@components/icon/icon\";\nimport {\n\tCheckIcon,\n\tChevronDownIcon,\n\tChevronUpIcon,\n} from \"@radix-ui/react-icons\";\nimport { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\n\n/**\n * Select\n */\n\nexport type SelectProps = ComponentProps<typeof SelectPrimitive.Root>;\n\nfunction Select({\n\tdisabled: initialDisabled,\n\trequired: initialRequired,\n\t...props\n}: SelectProps) {\n\tconst { disabled, required } = useFormContext({\n\t\tdisabled: initialDisabled,\n\t\trequired: initialRequired,\n\t});\n\treturn (\n\t\t<SelectPrimitive.Root disabled={disabled} required={required} {...props} />\n\t);\n}\n\n/**\n * SelectGroup\n */\n\nconst SelectGroup = SelectPrimitive.Group;\n\n/**\n * SelectValue\n */\n\nexport type SelectValueProps = ComponentProps<typeof SelectPrimitive.Value>;\n\nfunction SelectValue({ ref, ...props }: SelectValueProps) {\n\treturn <SelectPrimitive.Value ref={ref} {...props} />;\n}\n\n/**\n * SelectTrigger\n */\n\nexport type SelectTriggerProps = ComponentProps<typeof SelectPrimitive.Trigger>;\n\nfunction SelectTrigger({\n\tclassName,\n\tchildren,\n\tref,\n\t...props\n}: SelectTriggerProps) {\n\treturn (\n\t\t<SelectPrimitive.Trigger\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-border-input 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-text-muted [&>span]:line-clamp-1\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t\t<SelectPrimitive.Icon\n\t\t\t\trender={\n\t\t\t\t\t<Icon size=\"small\" className=\"opacity-50\">\n\t\t\t\t\t\t<ChevronDownIcon />\n\t\t\t\t\t</Icon>\n\t\t\t\t}\n\t\t\t/>\n\t\t</SelectPrimitive.Trigger>\n\t);\n}\n\n/**\n * SelectScrollUpArrow\n */\n\nexport type SelectScrollUpArrowProps = ComponentProps<\n\ttypeof SelectPrimitive.ScrollUpArrow\n>;\n\nfunction SelectScrollUpArrow({\n\tclassName,\n\tref,\n\t...props\n}: SelectScrollUpArrowProps) {\n\treturn (\n\t\t<SelectPrimitive.ScrollUpArrow\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex cursor-default items-center justify-center py-1\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<Icon size=\"small\" className=\"opacity-50\">\n\t\t\t\t<ChevronUpIcon />\n\t\t\t</Icon>\n\t\t</SelectPrimitive.ScrollUpArrow>\n\t);\n}\n\n/**\n * SelectScrollDownArrow\n */\n\nexport type SelectScrollDownArrowProps = ComponentProps<\n\ttypeof SelectPrimitive.ScrollDownArrow\n>;\n\nfunction SelectScrollDownArrow({\n\tclassName,\n\tref,\n\t...props\n}: SelectScrollDownArrowProps) {\n\treturn (\n\t\t<SelectPrimitive.ScrollDownArrow\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"flex cursor-default items-center justify-center py-1\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t>\n\t\t\t<Icon size=\"small\" className=\"opacity-50\">\n\t\t\t\t<ChevronDownIcon />\n\t\t\t</Icon>\n\t\t</SelectPrimitive.ScrollDownArrow>\n\t);\n}\n\n/**\n * SelectContent\n */\n\nexport type SelectContentProps = ComponentProps<\n\ttypeof SelectPrimitive.Popup\n> & {\n\tsideOffset?: number;\n};\n\nfunction SelectContent({\n\tclassName,\n\tchildren,\n\tsideOffset = 4,\n\tref,\n\t...props\n}: SelectContentProps) {\n\treturn (\n\t\t<SelectPrimitive.Portal>\n\t\t\t<SelectPrimitive.Positioner\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\talignItemWithTrigger={false}\n\t\t\t>\n\t\t\t\t<SelectScrollUpArrow />\n\t\t\t\t<SelectPrimitive.Popup\n\t\t\t\t\tref={ref}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\"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-border-input bg-surface text-text-secondary 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\",\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>\n\t\t\t\t\t<SelectPrimitive.List className=\"w-full min-w-(--anchor-width) p-1\">\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</SelectPrimitive.List>\n\t\t\t\t</SelectPrimitive.Popup>\n\t\t\t\t<SelectScrollDownArrow />\n\t\t\t</SelectPrimitive.Positioner>\n\t\t</SelectPrimitive.Portal>\n\t);\n}\n\n/**\n * SelectLabel\n */\n\nexport type SelectLabelProps = ComponentProps<\n\ttypeof SelectPrimitive.GroupLabel\n>;\n\nfunction SelectLabel({ className, ref, ...props }: SelectLabelProps) {\n\treturn (\n\t\t<SelectPrimitive.GroupLabel\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"px-2 py-1.5 font-semibold text-sm\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n/**\n * SelectItem\n */\n\nexport type SelectItemProps = ComponentProps<typeof SelectPrimitive.Item>;\n\nfunction SelectItem({ className, children, ref, ...props }: SelectItemProps) {\n\treturn (\n\t\t<SelectPrimitive.Item\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"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-highlight data-highlighted:text-on-highlight 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<span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n\t\t\t\t<SelectPrimitive.ItemIndicator>\n\t\t\t\t\t<Icon size=\"small\">\n\t\t\t\t\t\t<CheckIcon />\n\t\t\t\t\t</Icon>\n\t\t\t\t</SelectPrimitive.ItemIndicator>\n\t\t\t</span>\n\t\t\t<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n\t\t</SelectPrimitive.Item>\n\t);\n}\n\n/**\n * SelectSeparator\n */\n\nexport type SelectSeparatorProps = ComponentProps<\n\ttypeof SelectPrimitive.Separator\n>;\n\nfunction SelectSeparator({ className, ref, ...props }: SelectSeparatorProps) {\n\treturn (\n\t\t<SelectPrimitive.Separator\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"my-2 h-px bg-separator\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tSelect,\n\tSelectContent,\n\tSelectGroup,\n\tSelectItem,\n\tSelectLabel,\n\tSelectScrollDownArrow,\n\tSelectScrollUpArrow,\n\tSelectSeparator,\n\tSelectTrigger,\n\tSelectValue,\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../../utilities/cn/cn";
|
|
3
3
|
function Skeleton({ className, ref, ...props }) {
|
|
4
|
-
return (_jsx("div", { ref: ref, className: cn("animate-pulse rounded-md bg-
|
|
4
|
+
return (_jsx("div", { ref: ref, className: cn("animate-pulse rounded-md bg-skeleton", className), ...props }));
|
|
5
5
|
}
|
|
6
6
|
export { Skeleton };
|
|
7
7
|
//# sourceMappingURL=skeleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skeleton.js","sourceRoot":"/","sources":["components/skeleton/skeleton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAStC,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAiB;IAC5D,OAAO,CACN,cACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,sCAAsC,EAAE,SAAS,CAAC,KAC5D,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\n\n/**\n * Skeleton\n */\n\nexport type SkeletonProps = ComponentProps<\"div\">;\n\nfunction Skeleton({ className, ref, ...props }: SkeletonProps) {\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"animate-pulse rounded-md bg-
|
|
1
|
+
{"version":3,"file":"skeleton.js","sourceRoot":"/","sources":["components/skeleton/skeleton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAStC,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAiB;IAC5D,OAAO,CACN,cACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,sCAAsC,EAAE,SAAS,CAAC,KAC5D,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["import { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\n\n/**\n * Skeleton\n */\n\nexport type SkeletonProps = ComponentProps<\"div\">;\n\nfunction Skeleton({ className, ref, ...props }: SkeletonProps) {\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"animate-pulse rounded-md bg-skeleton\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Skeleton };\n"]}
|
|
@@ -42,9 +42,9 @@ function Slider({ className, defaultValue, min = 0, max = 100, showMinMax = true
|
|
|
42
42
|
setValue(normalizedValue);
|
|
43
43
|
onValueChange?.(newValue, event);
|
|
44
44
|
};
|
|
45
|
-
return (_jsxs(_Fragment, { children: [_jsx(SliderPrimitive.Root, { ref: ref, value: value, onValueChange: handleValueChange, className: cn("relative flex w-full touch-none select-none flex-col items-center", className), disabled: disabled, min: min, max: max, ...props, children: _jsx(SliderPrimitive.Control, { className: "flex w-full items-center", children: _jsxs(SliderPrimitive.Track, { className: "relative h-1.5 w-full grow rounded-full bg-
|
|
45
|
+
return (_jsxs(_Fragment, { children: [_jsx(SliderPrimitive.Root, { ref: ref, value: value, onValueChange: handleValueChange, className: cn("relative flex w-full touch-none select-none flex-col items-center", className), disabled: disabled, min: min, max: max, ...props, children: _jsx(SliderPrimitive.Control, { className: "flex w-full items-center", children: _jsxs(SliderPrimitive.Track, { className: "relative h-1.5 w-full grow rounded-full bg-primary/20 data-disabled:opacity-50", children: [_jsx(SliderPrimitive.Indicator, { className: "absolute h-full bg-primary" }), value.map((thumbValue, index) => (
|
|
46
46
|
// biome-ignore lint/suspicious/noArrayIndexKey: index is the only stable identifier for thumbs
|
|
47
|
-
_jsxs(Tooltip, { delayDuration: 0, children: [_jsx(TooltipTrigger, { render: _jsx(SliderPrimitive.Thumb, { index: index, className: "block h-4 w-4 rounded-full border border-
|
|
47
|
+
_jsxs(Tooltip, { delayDuration: 0, children: [_jsx(TooltipTrigger, { render: _jsx(SliderPrimitive.Thumb, { index: index, className: "block h-4 w-4 rounded-full border border-primary bg-surface shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring data-disabled:pointer-events-none" }) }), _jsx(TooltipContent, { children: _jsx("p", { children: thumbValue }) })] }, index)))] }) }) }), showMinMax && (_jsxs("div", { className: "mt-2 flex w-full flex-row justify-between", children: [_jsx("p", { children: min }), _jsx("p", { children: max })] }))] }));
|
|
48
48
|
}
|
|
49
49
|
export { Slider };
|
|
50
50
|
//# sourceMappingURL=slider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slider.js","sourceRoot":"/","sources":["components/slider/slider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EACN,OAAO,EACP,cAAc,EACd,cAAc,GACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAUjC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,MAAM,CAAC,EACf,SAAS,EACT,YAAY,EACZ,GAAG,GAAG,CAAC,EACP,GAAG,GAAG,GAAG,EACT,UAAU,GAAG,IAAI,EACjB,QAAQ,EAAE,eAAe,EACzB,aAAa,EACb,GAAG,EACH,GAAG,KAAK,EACK;IACb,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;QACpD,CAAC,CAAC,YAAY;QACd,CAAC,CAAC,YAAY,KAAK,SAAS;YAC3B,CAAC,CAAC,CAAC,YAAY,CAAC;YAChB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAER,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAW,iBAAiB,CAAC,CAAC;IAChE,MAAM,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC;QACnC,QAAQ,EAAE,eAAe;KACzB,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,CACzB,QAAoC,EACpC,KAA8C,EAC7C,EAAE;QACH,MAAM,eAAe,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YAC9C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ACrB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAC,sMAAsM,GAC/M,GAEF,EACF,KAAC,cAAc,cACd,sBAAI,UAAU,GAAK,GACH,KAXJ,KAAK,CAYT,CACV,CAAC,IACqB,GACC,GACJ,EACtB,UAAU,IAAI,CACd,eAAK,SAAS,EAAC,2CAA2C,aACzD,sBAAI,GAAG,GAAK,EACZ,sBAAI,GAAG,GAAK,IACP,CACN,IACC,CACH,CAAC;AACH,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["import { Slider as SliderPrimitive } from \"@base-ui/react/slider\";\nimport { useFormContext } from \"@components/form-field/form-field-context\";\nimport {\n\tTooltip,\n\tTooltipContent,\n\tTooltipTrigger,\n} from \"@components/tooltip/tooltip\";\nimport { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\nimport { useState } from \"react\";\n\nexport type SliderProps = ComponentProps<typeof SliderPrimitive.Root> & {\n\t/**\n\t * Whether to show the minimum and maximum values below the slider\n\t * @default true\n\t */\n\tshowMinMax?: boolean;\n};\n\n/**\n * A customizable slider component built on top of Base UI's slider primitive.\n *\n * @example\n * ```tsx\n * <Slider\n * min={0}\n * max={100}\n * defaultValue={50}\n * showMinMax={true}\n * />\n * ```\n *\n * @param {Object} props - The props for the Slider component\n * @param {number | number[]} [props.defaultValue] - The initial value of the slider\n * @param {number} [props.min=0] - The minimum value of the slider\n * @param {number} [props.max=100] - The maximum value of the slider\n * @param {boolean} [props.showMinMax=true] - Whether to show min/max values below the slider\n * @param {string} [props.className] - Additional CSS classes to apply to the slider\n * @returns {JSX.Element} A slider component with optional tooltips and min/max display\n */\nfunction Slider({\n\tclassName,\n\tdefaultValue,\n\tmin = 0,\n\tmax = 100,\n\tshowMinMax = true,\n\tdisabled: initialDisabled,\n\tonValueChange,\n\tref,\n\t...props\n}: SliderProps) {\n\tconst normalizedDefault = Array.isArray(defaultValue)\n\t\t? defaultValue\n\t\t: defaultValue !== undefined\n\t\t\t? [defaultValue]\n\t\t\t: [0];\n\n\tconst [value, setValue] = useState<number[]>(normalizedDefault);\n\tconst { disabled } = useFormContext({\n\t\tdisabled: initialDisabled,\n\t});\n\n\tconst handleValueChange = (\n\t\tnewValue: number | readonly number[],\n\t\tevent: SliderPrimitive.Root.ChangeEventDetails,\n\t) => {\n\t\tconst normalizedValue = Array.isArray(newValue)\n\t\t\t? [...newValue]\n\t\t\t: [newValue];\n\t\tsetValue(normalizedValue);\n\t\tonValueChange?.(newValue, event);\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<SliderPrimitive.Root\n\t\t\t\tref={ref}\n\t\t\t\tvalue={value}\n\t\t\t\tonValueChange={handleValueChange}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t\"relative flex w-full touch-none select-none flex-col items-center\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdisabled={disabled}\n\t\t\t\tmin={min}\n\t\t\t\tmax={max}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t<SliderPrimitive.Control className=\"flex w-full items-center\">\n\t\t\t\t\t<SliderPrimitive.Track className=\"relative h-1.5 w-full grow rounded-full bg-primary/20 data-disabled:opacity-50\">\n\t\t\t\t\t\t<SliderPrimitive.Indicator className=\"absolute h-full bg-primary\" />\n\t\t\t\t\t\t{value.map((thumbValue, index) => (\n\t\t\t\t\t\t\t// biome-ignore lint/suspicious/noArrayIndexKey: index is the only stable identifier for thumbs\n\t\t\t\t\t\t\t<Tooltip key={index} delayDuration={0}>\n\t\t\t\t\t\t\t\t<TooltipTrigger\n\t\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t\t<SliderPrimitive.Thumb\n\t\t\t\t\t\t\t\t\t\t\tindex={index}\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block h-4 w-4 rounded-full border border-primary bg-surface shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-focus-ring data-disabled:pointer-events-none\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<TooltipContent>\n\t\t\t\t\t\t\t\t\t<p>{thumbValue}</p>\n\t\t\t\t\t\t\t\t</TooltipContent>\n\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</SliderPrimitive.Track>\n\t\t\t\t</SliderPrimitive.Control>\n\t\t\t</SliderPrimitive.Root>\n\t\t\t{showMinMax && (\n\t\t\t\t<div className=\"mt-2 flex w-full flex-row justify-between\">\n\t\t\t\t\t<p>{min}</p>\n\t\t\t\t\t<p>{max}</p>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</>\n\t);\n}\n\nexport { Slider };\n"]}
|
|
@@ -4,24 +4,24 @@ import { useFormContext } from "../form-field/form-field-context";
|
|
|
4
4
|
import { getVariants } from "../../utilities/responsive/responsive";
|
|
5
5
|
const thumbStyles = getVariants({
|
|
6
6
|
slots: {
|
|
7
|
-
root: "relative flex cursor-pointer appearance-none items-center rounded-full bg-
|
|
7
|
+
root: "relative flex cursor-pointer appearance-none items-center rounded-full bg-indicator transition-colors duration-500 ease-out focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring data-[checked]:bg-primary",
|
|
8
8
|
thumb: "absolute left-1 h-5 w-5 rounded-full transition-transform duration-500 ease-out data-[checked]:translate-x-[1.125rem]",
|
|
9
9
|
},
|
|
10
10
|
variants: {
|
|
11
11
|
disabled: {
|
|
12
12
|
true: {
|
|
13
13
|
root: "cursor-not-allowed opacity-50",
|
|
14
|
-
thumb: "bg-
|
|
14
|
+
thumb: "bg-text-disabled",
|
|
15
15
|
},
|
|
16
16
|
false: {
|
|
17
17
|
root: "cursor-pointer opacity-100",
|
|
18
|
-
thumb: "bg-
|
|
18
|
+
thumb: "bg-surface",
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
error: {
|
|
22
22
|
true: {
|
|
23
|
-
root: "bg-
|
|
24
|
-
thumb: "bg-
|
|
23
|
+
root: "bg-error data-[checked]:bg-error",
|
|
24
|
+
thumb: "bg-error",
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
size: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"/","sources":["components/switch/switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAU/D,MAAM,WAAW,GAAG,WAAW,CAAC;IAC/B,KAAK,EAAE;QACN,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"/","sources":["components/switch/switch.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAU/D,MAAM,WAAW,GAAG,WAAW,CAAC;IAC/B,KAAK,EAAE;QACN,IAAI,EAAE,6NAA6N;QACnO,KAAK,EACJ,uHAAuH;KACxH;IACD,QAAQ,EAAE;QACT,QAAQ,EAAE;YACT,IAAI,EAAE;gBACL,IAAI,EAAE,+BAA+B;gBACrC,KAAK,EAAE,kBAAkB;aACzB;YACD,KAAK,EAAE;gBACN,IAAI,EAAE,4BAA4B;gBAClC,KAAK,EAAE,YAAY;aACnB;SACD;QACD,KAAK,EAAE;YACN,IAAI,EAAE;gBACL,IAAI,EAAE,kCAAkC;gBACxC,KAAK,EAAE,UAAU;aACjB;SACD;QACD,IAAI,EAAE;YACL,KAAK,EAAE;gBACN,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,SAAS;aAChB;YACD,MAAM,EAAE;gBACP,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,SAAS;aAChB;YACD,KAAK,EAAE;gBACN,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,SAAS;aAChB;SACD;KACD;CACD,CAAC,CAAC;AAEH,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,MAAM,CAAC,EACtB,SAAS,EACT,QAAQ,EAAE,eAAe,EACzB,IAAI,GAAG,QAAQ,EACf,KAAK,EAAE,YAAY,EACnB,GAAG,EACH,GAAG,KAAK,EACK;IACb,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,cAAc,CAAC;QAC1C,QAAQ,EAAE,eAAe;QACzB,KAAK,EAAE,YAAY;KACnB,CAAC,CAAC;IACH,OAAO,CACN,KAAC,eAAe,CAAC,IAAI,IACpB,SAAS,EAAE,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EACrD,QAAQ,EAAE,QAAQ,KACd,KAAK,EACT,GAAG,EAAE,GAAG,YAER,KAAC,eAAe,CAAC,KAAK,IAAC,SAAS,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAI,GACzC,CACvB,CAAC;AACH,CAAC","sourcesContent":["import { Switch as SwitchPrimitive } from \"@base-ui/react/switch\";\nimport { useFormContext } from \"@components/form-field/form-field-context\";\nimport type { ResponsiveValue } from \"@utilities/responsive/responsive\";\nimport { getVariants } from \"@utilities/responsive/responsive\";\nimport type { Ref } from \"react\";\n\nexport type SwitchProps = Omit<SwitchPrimitive.Root.Props, \"className\"> & {\n\tsize?: ResponsiveValue<\"small\" | \"medium\" | \"large\">;\n\terror?: boolean;\n\tclassName?: string;\n\tref?: Ref<HTMLButtonElement>;\n};\n\nconst thumbStyles = getVariants({\n\tslots: {\n\t\troot: \"relative flex cursor-pointer appearance-none items-center rounded-full bg-indicator transition-colors duration-500 ease-out focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring data-[checked]:bg-primary\",\n\t\tthumb:\n\t\t\t\"absolute left-1 h-5 w-5 rounded-full transition-transform duration-500 ease-out data-[checked]:translate-x-[1.125rem]\",\n\t},\n\tvariants: {\n\t\tdisabled: {\n\t\t\ttrue: {\n\t\t\t\troot: \"cursor-not-allowed opacity-50\",\n\t\t\t\tthumb: \"bg-text-disabled\",\n\t\t\t},\n\t\t\tfalse: {\n\t\t\t\troot: \"cursor-pointer opacity-100\",\n\t\t\t\tthumb: \"bg-surface\",\n\t\t\t},\n\t\t},\n\t\terror: {\n\t\t\ttrue: {\n\t\t\t\troot: \"bg-error data-[checked]:bg-error\",\n\t\t\t\tthumb: \"bg-error\",\n\t\t\t},\n\t\t},\n\t\tsize: {\n\t\t\tsmall: {\n\t\t\t\troot: \"h-5 w-10\",\n\t\t\t\tthumb: \"h-3 w-3\",\n\t\t\t},\n\t\t\tmedium: {\n\t\t\t\troot: \"h-7 w-12\",\n\t\t\t\tthumb: \"h-5 w-5\",\n\t\t\t},\n\t\t\tlarge: {\n\t\t\t\troot: \"h-9 w-14\",\n\t\t\t\tthumb: \"h-7 w-7\",\n\t\t\t},\n\t\t},\n\t},\n});\n\nconst { root, thumb } = thumbStyles();\n\n/**\n * A switch component that toggles between on and off states.\n * Built on top of Base UI's Switch primitive.\n *\n * @param {SwitchProps} props - The props for the Switch component\n * @param {ResponsiveValue<\"small\" | \"medium\" | \"large\">} [props.size=\"medium\"] - The size of the switch\n * @param {boolean} [props.disabled] - Whether the switch is disabled\n * @param {string} [props.className] - Additional CSS classes to apply\n *\n * @example\n * // Basic usage\n * <Switch />\n *\n * @example\n * // With different sizes\n * <Switch size=\"small\" />\n * <Switch size=\"medium\" />\n * <Switch size=\"large\" />\n *\n * @example\n * // Disabled state\n * <Switch disabled />\n *\n * @example\n * // With onChange handler\n * <Switch onCheckedChange={(checked) => console.log(checked)} />\n *\n * @param {ResponsiveValue<\"small\" | \"medium\" | \"large\">} [props.size=\"medium\"] - The size of the switch\n * @param {boolean} [props.disabled] - Whether the switch is disabled\n * @param {string} [props.className] - Additional CSS classes to apply\n */\nexport function Switch({\n\tclassName,\n\tdisabled: initialDisabled,\n\tsize = \"medium\",\n\terror: initialError,\n\tref,\n\t...props\n}: SwitchProps) {\n\tconst { disabled, error } = useFormContext({\n\t\tdisabled: initialDisabled,\n\t\terror: initialError,\n\t});\n\treturn (\n\t\t<SwitchPrimitive.Root\n\t\t\tclassName={root({ disabled, size, error, className })}\n\t\t\tdisabled={disabled}\n\t\t\t{...props}\n\t\t\tref={ref}\n\t\t>\n\t\t\t<SwitchPrimitive.Thumb className={thumb({ disabled, size })} />\n\t\t</SwitchPrimitive.Root>\n\t);\n}\n"]}
|
|
@@ -39,4 +39,4 @@ declare function TableCell({ className, ref, ...props }: TableCellProps): import
|
|
|
39
39
|
*/
|
|
40
40
|
export type TableCaptionProps = ComponentProps<"caption">;
|
|
41
41
|
declare function TableCaption({ className, ref, ...props }: TableCaptionProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
-
export { Table,
|
|
42
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, };
|
|
@@ -4,16 +4,16 @@ function Table({ className, ref, ...props }) {
|
|
|
4
4
|
return (_jsx("div", { className: "relative w-full overflow-auto", children: _jsx("table", { ref: ref, className: cn("w-full caption-bottom text-sm", className), ...props }) }));
|
|
5
5
|
}
|
|
6
6
|
function TableHeader({ className, ref, ...props }) {
|
|
7
|
-
return (_jsx("thead", { ref: ref, className: cn("[&_tr]:border-b [&_tr]:bg-
|
|
7
|
+
return (_jsx("thead", { ref: ref, className: cn("[&_tr]:border-b [&_tr]:bg-primary! [&_tr]:text-on-primary [&_tr]:hover:bg-primary! [&_tr]:hover:text-on-primary!", className), ...props }));
|
|
8
8
|
}
|
|
9
9
|
function TableBody({ className, ref, ...props }) {
|
|
10
10
|
return (_jsx("tbody", { ref: ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
11
11
|
}
|
|
12
12
|
function TableFooter({ className, ref, ...props }) {
|
|
13
|
-
return (_jsx("tfoot", { ref: ref, className: cn("border-t bg-
|
|
13
|
+
return (_jsx("tfoot", { ref: ref, className: cn("border-t bg-surface-muted font-medium [&>tr]:bg-surface-muted! [&>tr]:text-text-secondary! [&>tr]:last:border-b-0", className), ...props }));
|
|
14
14
|
}
|
|
15
15
|
function TableRow({ className, ref, ...props }) {
|
|
16
|
-
return (_jsx("tr", { ref: ref, className: cn("border-b transition-colors hover:bg-
|
|
16
|
+
return (_jsx("tr", { ref: ref, className: cn("border-b transition-colors hover:bg-border-input hover:text-on-primary data-[state=selected]:bg-indicator data-[state=selected]:text-on-primary", className), ...props }));
|
|
17
17
|
}
|
|
18
18
|
function TableHead({ className, ref, ...props }) {
|
|
19
19
|
return (_jsx("th", { ref: ref, className: cn("h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
|
|
@@ -22,7 +22,7 @@ function TableCell({ className, ref, ...props }) {
|
|
|
22
22
|
return (_jsx("td", { ref: ref, className: cn("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className), ...props }));
|
|
23
23
|
}
|
|
24
24
|
function TableCaption({ className, ref, ...props }) {
|
|
25
|
-
return (_jsx("caption", { ref: ref, className: cn("mt-4 text-start text-
|
|
25
|
+
return (_jsx("caption", { ref: ref, className: cn("mt-4 text-start text-sm text-text-muted", className), ...props }));
|
|
26
26
|
}
|
|
27
|
-
export { Table,
|
|
27
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, };
|
|
28
28
|
//# sourceMappingURL=table.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sourceRoot":"/","sources":["components/table/table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAStC,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAc;IACtD,OAAO,CACN,cAAK,SAAS,EAAC,+BAA+B,YAC7C,gBACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KACrD,KAAK,GACR,GACG,CACN,CAAC;AACH,CAAC;AAQD,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAoB;IAClE,OAAO,CACN,gBACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"/","sources":["components/table/table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAStC,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAc;IACtD,OAAO,CACN,cAAK,SAAS,EAAC,+BAA+B,YAC7C,gBACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KACrD,KAAK,GACR,GACG,CACN,CAAC;AACH,CAAC;AAQD,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAoB;IAClE,OAAO,CACN,gBACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,kHAAkH,EAClH,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAQD,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAkB;IAC9D,OAAO,CACN,gBACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,4BAA4B,EAAE,SAAS,CAAC,KAClD,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAQD,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAoB;IAClE,OAAO,CACN,gBACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,mHAAmH,EACnH,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAQD,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAiB;IAC5D,OAAO,CACN,aACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,iJAAiJ,EACjJ,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAQD,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAkB;IAC9D,OAAO,CACN,aACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,kHAAkH,EAClH,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAQD,SAAS,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAkB;IAC9D,OAAO,CACN,aACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACZ,sFAAsF,EACtF,SAAS,CACT,KACG,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAQD,SAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,KAAK,EAAqB;IACpE,OAAO,CACN,kBACC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,yCAAyC,EAAE,SAAS,CAAC,KAC/D,KAAK,GACR,CACF,CAAC;AACH,CAAC;AAED,OAAO,EACN,KAAK,EACL,SAAS,EACT,YAAY,EACZ,SAAS,EACT,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,GACR,CAAC","sourcesContent":["import { cn } from \"@utilities/cn/cn\";\nimport type { ComponentProps } from \"react\";\n\n/**\n * Table\n */\n\nexport type TableProps = ComponentProps<\"table\">;\n\nfunction Table({ className, ref, ...props }: TableProps) {\n\treturn (\n\t\t<div className=\"relative w-full overflow-auto\">\n\t\t\t<table\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cn(\"w-full caption-bottom text-sm\", className)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\n/**\n * TableHeader\n */\n\nexport type TableHeaderProps = ComponentProps<\"thead\">;\n\nfunction TableHeader({ className, ref, ...props }: TableHeaderProps) {\n\treturn (\n\t\t<thead\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"[&_tr]:border-b [&_tr]:bg-primary! [&_tr]:text-on-primary [&_tr]:hover:bg-primary! [&_tr]:hover:text-on-primary!\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n/**\n * TableBody\n */\n\nexport type TableBodyProps = ComponentProps<\"tbody\">;\n\nfunction TableBody({ className, ref, ...props }: TableBodyProps) {\n\treturn (\n\t\t<tbody\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"[&_tr:last-child]:border-0\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n/**\n * TableFooter\n */\n\nexport type TableFooterProps = ComponentProps<\"tfoot\">;\n\nfunction TableFooter({ className, ref, ...props }: TableFooterProps) {\n\treturn (\n\t\t<tfoot\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"border-t bg-surface-muted font-medium [&>tr]:bg-surface-muted! [&>tr]:text-text-secondary! [&>tr]:last:border-b-0\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n/**\n * TableRow\n */\n\nexport type TableRowProps = ComponentProps<\"tr\">;\n\nfunction TableRow({ className, ref, ...props }: TableRowProps) {\n\treturn (\n\t\t<tr\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"border-b transition-colors hover:bg-border-input hover:text-on-primary data-[state=selected]:bg-indicator data-[state=selected]:text-on-primary\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n/**\n * TableHead\n */\n\nexport type TableHeadProps = ComponentProps<\"th\">;\n\nfunction TableHead({ className, ref, ...props }: TableHeadProps) {\n\treturn (\n\t\t<th\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n/**\n * TableCell\n */\n\nexport type TableCellProps = ComponentProps<\"td\">;\n\nfunction TableCell({ className, ref, ...props }: TableCellProps) {\n\treturn (\n\t\t<td\n\t\t\tref={ref}\n\t\t\tclassName={cn(\n\t\t\t\t\"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n/**\n * TableCaption\n */\n\nexport type TableCaptionProps = ComponentProps<\"caption\">;\n\nfunction TableCaption({ className, ref, ...props }: TableCaptionProps) {\n\treturn (\n\t\t<caption\n\t\t\tref={ref}\n\t\t\tclassName={cn(\"mt-4 text-start text-sm text-text-muted\", className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport {\n\tTable,\n\tTableBody,\n\tTableCaption,\n\tTableCell,\n\tTableFooter,\n\tTableHead,\n\tTableHeader,\n\tTableRow,\n};\n"]}
|
|
@@ -7,4 +7,4 @@ export type TabsTriggerProps = ComponentProps<typeof TabsPrimitive.Tab>;
|
|
|
7
7
|
declare function TabsTrigger({ className, ref, ...props }: TabsTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export type TabsContentProps = ComponentProps<typeof TabsPrimitive.Panel>;
|
|
9
9
|
declare function TabsContent({ className, ref, ...props }: TabsContentProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export { Tabs, TabsList, TabsTrigger
|
|
10
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger };
|