@jbpark/ui-kit 8.0.0 → 8.1.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/atoms/float-button/float-button.d.mts.map +1 -1
- package/dist/components/atoms/float-button/float-button.mjs +2 -1
- package/dist/components/atoms/float-button/float-button.mjs.map +1 -1
- package/dist/components/molecules/dropdown.d.mts.map +1 -1
- package/dist/components/molecules/dropdown.mjs +2 -1
- package/dist/components/molecules/dropdown.mjs.map +1 -1
- package/dist/components/molecules/marquees/item.d.mts +2 -1
- package/dist/components/molecules/marquees/item.d.mts.map +1 -1
- package/dist/components/molecules/marquees/item.mjs +20 -5
- package/dist/components/molecules/marquees/item.mjs.map +1 -1
- package/dist/components/molecules/marquees/marquees.d.mts +2 -1
- package/dist/components/molecules/marquees/marquees.d.mts.map +1 -1
- package/dist/components/molecules/marquees/marquees.mjs +3 -2
- package/dist/components/molecules/marquees/marquees.mjs.map +1 -1
- package/dist/components/organisms/drawer.mjs +7 -7
- package/dist/components/organisms/drawer.mjs.map +1 -1
- package/dist/components/templates/layout/header.d.mts.map +1 -1
- package/dist/components/templates/layout/header.mjs +2 -1
- package/dist/components/templates/layout/header.mjs.map +1 -1
- package/dist/components/templates/layout/sider.mjs.map +1 -1
- package/dist/components/templates/page-header.mjs +4 -4
- package/dist/components/templates/page-header.mjs.map +1 -1
- package/dist/core/dialog.mjs +5 -5
- package/dist/core/dialog.mjs.map +1 -1
- package/dist/core/drawer.mjs +3 -2
- package/dist/core/drawer.mjs.map +1 -1
- package/dist/core/popover.mjs +3 -2
- package/dist/core/popover.mjs.map +1 -1
- package/dist/core/select.d.mts.map +1 -1
- package/dist/core/select.mjs +3 -2
- package/dist/core/select.mjs.map +1 -1
- package/dist/lib/z-layers.mjs +33 -0
- package/dist/lib/z-layers.mjs.map +1 -0
- package/dist/style.css +7 -0
- package/dist/utils.d.mts +12 -0
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +12 -0
- package/dist/utils.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"float-button.d.mts","names":[],"sources":["../../../../src/components/atoms/float-button/float-button.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"float-button.d.mts","names":[],"sources":["../../../../src/components/atoms/float-button/float-button.tsx"],"mappings":";;UAKiB,cAAc;cAEzB,gBAAe,WAAA,aAAA,SAAmC,0BAAK,IAAA"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { cn } from "../../../utils.mjs";
|
|
2
2
|
import Button from "../../../Button.mjs";
|
|
3
|
+
import { OVERLAY_LAYER } from "../../../lib/z-layers.mjs";
|
|
3
4
|
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/atoms/float-button/float-button.tsx
|
|
5
6
|
const FloatButton = ({ className, children, ...props }) => {
|
|
6
7
|
return /* @__PURE__ */ jsx(Button, {
|
|
7
|
-
className: cn("fixed right-5 bottom-5 rounded-full", "
|
|
8
|
+
className: cn("fixed right-5 bottom-5 rounded-full", OVERLAY_LAYER, "h-12 w-12", "shadow-md", className),
|
|
8
9
|
variant: "outlined",
|
|
9
10
|
...props,
|
|
10
11
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"float-button.mjs","names":[],"sources":["../../../../src/components/atoms/float-button/float-button.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nimport Button, { Props as ButtonProps } from '../button';\n\nexport interface Props extends ButtonProps {}\n\nconst FloatButton = ({ className, children, ...props }: Props) => {\n return (\n <Button\n className={cn(\n 'fixed right-5 bottom-5 rounded-full',\n '
|
|
1
|
+
{"version":3,"file":"float-button.mjs","names":[],"sources":["../../../../src/components/atoms/float-button/float-button.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nimport { OVERLAY_LAYER } from '../../../lib/z-layers';\nimport Button, { Props as ButtonProps } from '../button';\n\nexport interface Props extends ButtonProps {}\n\nconst FloatButton = ({ className, children, ...props }: Props) => {\n return (\n <Button\n className={cn(\n 'fixed right-5 bottom-5 rounded-full',\n OVERLAY_LAYER,\n 'h-12 w-12',\n 'shadow-md',\n className,\n )}\n variant=\"outlined\"\n {...props}\n >\n {children}\n </Button>\n );\n};\n\nexport default FloatButton;\n"],"mappings":";;;;;AAOA,MAAM,eAAe,EAAE,WAAW,UAAU,GAAG,YAAmB;CAChE,OACE,oBAAC,QAAD;EACE,WAAW,GACT,uCACA,eACA,aACA,aACA,SACF;EACA,SAAQ;EACR,GAAI;EAEH;CACK,CAAA;AAEZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.d.mts","names":[],"sources":["../../../src/components/molecules/dropdown.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"dropdown.d.mts","names":[],"sources":["../../../src/components/molecules/dropdown.tsx"],"mappings":";;KAYK,sBAAsB;UAEV,cAAc,MAAM;EACnC;EACA;EACA,OAAO;EACP,eAAe;;cAGX,aAAY,UAAA,MAAA,SAAA,MAAA,OAAA,cAAA,eAAA,WAAA,cAAA,iBAAA,SAUf,0BAAK,IAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../utils.mjs";
|
|
3
|
+
import "../../lib/z-layers.mjs";
|
|
3
4
|
import Menu from "./menu/menu.mjs";
|
|
4
5
|
import { useId, useRef } from "react";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -60,7 +61,7 @@ const Dropdown = ({ children, menu, trigger = "hover", open: _open, onOpenChange
|
|
|
60
61
|
},
|
|
61
62
|
children
|
|
62
63
|
}), /* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsx(motion.div, {
|
|
63
|
-
className: cn("absolute top-full
|
|
64
|
+
className: cn("absolute top-full pt-2", "z-1000"),
|
|
64
65
|
initial: {
|
|
65
66
|
opacity: 0,
|
|
66
67
|
y: -10
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown.mjs","names":[],"sources":["../../../src/components/molecules/dropdown.tsx"],"sourcesContent":["'use client';\n\nimport { useId, useRef } from 'react';\n\nimport { useControllableState, useKeyPress } from '@jbpark/use-hooks';\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport Menu, { MenuProps } from './menu';\n\ntype ChangeEventHandler = (open: boolean) => void;\n\nexport interface Props extends React.ComponentPropsWithoutRef<'div'> {\n open?: boolean;\n trigger?: 'hover' | 'click';\n menu?: MenuProps;\n onOpenChange?: ChangeEventHandler;\n}\n\nconst Dropdown = ({\n children,\n menu,\n trigger = 'hover',\n open: _open,\n onOpenChange: _onOpenChange = () => {},\n className,\n onMouseEnter,\n onMouseLeave,\n ...props\n}: Props) => {\n const [open, onOpenChange] = useControllableState<boolean>({\n value: _open,\n defaultValue: false,\n onChange: _onOpenChange,\n });\n\n const isClickTrigger = trigger === 'click';\n const menuId = useId();\n const containerRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLDivElement>(null);\n\n useKeyPress(\n 'esc',\n () => {\n onOpenChange(false);\n },\n { target: triggerRef },\n );\n\n useKeyPress(\n ['Enter', 'space'],\n event => {\n event.preventDefault();\n onOpenChange(!open);\n },\n { target: triggerRef, enabled: isClickTrigger },\n );\n\n return (\n <div\n {...props}\n ref={containerRef}\n className={cn(\n 'relative',\n 'inline-block cursor-pointer',\n className,\n //\n )}\n onMouseEnter={event => {\n onMouseEnter?.(event);\n if (isClickTrigger) {\n return;\n }\n onOpenChange(true);\n }}\n onMouseLeave={event => {\n onMouseLeave?.(event);\n if (isClickTrigger) {\n return;\n }\n onOpenChange(false);\n }}\n >\n <div\n ref={triggerRef}\n role={isClickTrigger ? 'button' : undefined}\n tabIndex={isClickTrigger ? 0 : undefined}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={open ? menuId : undefined}\n onClick={() => {\n if (!isClickTrigger) {\n return;\n }\n onOpenChange(!open);\n }}\n onFocus={() => {\n if (isClickTrigger) {\n return;\n }\n onOpenChange(true);\n }}\n onBlur={e => {\n // Without this check, moving focus from the trigger into the\n // menu itself (e.g. via Tab) closed the dropdown before the\n // user could ever reach it — the mouse path avoided the same\n // bug only by way of onMouseDown's preventDefault below, which\n // does nothing for keyboard focus. Mirrors the containment\n // check menu/item/item.tsx already uses for the same reason.\n if (!containerRef.current?.contains(e.relatedTarget as Node)) {\n onOpenChange(false);\n }\n }}\n >\n {children}\n </div>\n <AnimatePresence>\n {open && (\n <motion.div\n className={cn(\n 'absolute top-full
|
|
1
|
+
{"version":3,"file":"dropdown.mjs","names":[],"sources":["../../../src/components/molecules/dropdown.tsx"],"sourcesContent":["'use client';\n\nimport { useId, useRef } from 'react';\n\nimport { useControllableState, useKeyPress } from '@jbpark/use-hooks';\nimport { AnimatePresence, motion } from 'motion/react';\n\nimport { cn } from '@repo/ui/utils';\n\nimport { OVERLAY_LAYER } from '../../lib/z-layers';\nimport Menu, { MenuProps } from './menu';\n\ntype ChangeEventHandler = (open: boolean) => void;\n\nexport interface Props extends React.ComponentPropsWithoutRef<'div'> {\n open?: boolean;\n trigger?: 'hover' | 'click';\n menu?: MenuProps;\n onOpenChange?: ChangeEventHandler;\n}\n\nconst Dropdown = ({\n children,\n menu,\n trigger = 'hover',\n open: _open,\n onOpenChange: _onOpenChange = () => {},\n className,\n onMouseEnter,\n onMouseLeave,\n ...props\n}: Props) => {\n const [open, onOpenChange] = useControllableState<boolean>({\n value: _open,\n defaultValue: false,\n onChange: _onOpenChange,\n });\n\n const isClickTrigger = trigger === 'click';\n const menuId = useId();\n const containerRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLDivElement>(null);\n\n useKeyPress(\n 'esc',\n () => {\n onOpenChange(false);\n },\n { target: triggerRef },\n );\n\n useKeyPress(\n ['Enter', 'space'],\n event => {\n event.preventDefault();\n onOpenChange(!open);\n },\n { target: triggerRef, enabled: isClickTrigger },\n );\n\n return (\n <div\n {...props}\n ref={containerRef}\n className={cn(\n 'relative',\n 'inline-block cursor-pointer',\n className,\n //\n )}\n onMouseEnter={event => {\n onMouseEnter?.(event);\n if (isClickTrigger) {\n return;\n }\n onOpenChange(true);\n }}\n onMouseLeave={event => {\n onMouseLeave?.(event);\n if (isClickTrigger) {\n return;\n }\n onOpenChange(false);\n }}\n >\n <div\n ref={triggerRef}\n role={isClickTrigger ? 'button' : undefined}\n tabIndex={isClickTrigger ? 0 : undefined}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={open ? menuId : undefined}\n onClick={() => {\n if (!isClickTrigger) {\n return;\n }\n onOpenChange(!open);\n }}\n onFocus={() => {\n if (isClickTrigger) {\n return;\n }\n onOpenChange(true);\n }}\n onBlur={e => {\n // Without this check, moving focus from the trigger into the\n // menu itself (e.g. via Tab) closed the dropdown before the\n // user could ever reach it — the mouse path avoided the same\n // bug only by way of onMouseDown's preventDefault below, which\n // does nothing for keyboard focus. Mirrors the containment\n // check menu/item/item.tsx already uses for the same reason.\n if (!containerRef.current?.contains(e.relatedTarget as Node)) {\n onOpenChange(false);\n }\n }}\n >\n {children}\n </div>\n <AnimatePresence>\n {open && (\n <motion.div\n className={cn(\n 'absolute top-full pt-2',\n OVERLAY_LAYER,\n //\n )}\n initial={{ opacity: 0, y: -10 }}\n animate={{ opacity: 1, y: 0 }}\n exit={{ opacity: 0, y: -10 }}\n transition={{ duration: 0.1 }}\n >\n <Menu\n {...menu}\n id={menuId}\n onMouseDown={e => {\n e.preventDefault();\n }}\n />\n </motion.div>\n )}\n </AnimatePresence>\n </div>\n );\n};\n\nexport default Dropdown;\n"],"mappings":";;;;;;;;;AAqBA,MAAM,YAAY,EAChB,UACA,MACA,UAAU,SACV,MAAM,OACN,cAAc,sBAAsB,CAAC,GACrC,WACA,cACA,cACA,GAAG,YACQ;CACX,MAAM,CAAC,MAAM,gBAAgB,qBAA8B;EACzD,OAAO;EACP,cAAc;EACd,UAAU;CACZ,CAAC;CAED,MAAM,iBAAiB,YAAY;CACnC,MAAM,SAAS,MAAM;CACrB,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,aAAa,OAAuB,IAAI;CAE9C,YACE,aACM;EACJ,aAAa,KAAK;CACpB,GACA,EAAE,QAAQ,WAAW,CACvB;CAEA,YACE,CAAC,SAAS,OAAO,IACjB,UAAS;EACP,MAAM,eAAe;EACrB,aAAa,CAAC,IAAI;CACpB,GACA;EAAE,QAAQ;EAAY,SAAS;CAAe,CAChD;CAEA,OACE,qBAAC,OAAD;EACE,GAAI;EACJ,KAAK;EACL,WAAW,GACT,YACA,+BACA,SAEF;EACA,eAAc,UAAS;GACrB,eAAe,KAAK;GACpB,IAAI,gBACF;GAEF,aAAa,IAAI;EACnB;EACA,eAAc,UAAS;GACrB,eAAe,KAAK;GACpB,IAAI,gBACF;GAEF,aAAa,KAAK;EACpB;EAtBF,UAAA,CAwBE,oBAAC,OAAD;GACE,KAAK;GACL,MAAM,iBAAiB,WAAW,KAAA;GAClC,UAAU,iBAAiB,IAAI,KAAA;GAC/B,iBAAc;GACd,iBAAe;GACf,iBAAe,OAAO,SAAS,KAAA;GAC/B,eAAe;IACb,IAAI,CAAC,gBACH;IAEF,aAAa,CAAC,IAAI;GACpB;GACA,eAAe;IACb,IAAI,gBACF;IAEF,aAAa,IAAI;GACnB;GACA,SAAQ,MAAK;IAOX,IAAI,CAAC,aAAa,SAAS,SAAS,EAAE,aAAqB,GACzD,aAAa,KAAK;GAEtB;GAEC;EACE,CAAA,GACL,oBAAC,iBAAD,EAAA,UACG,QACC,oBAAC,OAAO,KAAR;GACE,WAAW,GACT,0BAAA,QAGF;GACA,SAAS;IAAE,SAAS;IAAG,GAAG;GAAI;GAC9B,SAAS;IAAE,SAAS;IAAG,GAAG;GAAE;GAC5B,MAAM;IAAE,SAAS;IAAG,GAAG;GAAI;GAC3B,YAAY,EAAE,UAAU,GAAI;GAE5B,UAAA,oBAAC,MAAD;IACE,GAAI;IACJ,IAAI;IACJ,cAAa,MAAK;KAChB,EAAE,eAAe;IACnB;GACD,CAAA;EACS,CAAA,EAEC,CAAA,CACd;;AAET"}
|
|
@@ -5,12 +5,13 @@ interface ItemProps {
|
|
|
5
5
|
autoFill?: boolean | number;
|
|
6
6
|
pause?: boolean;
|
|
7
7
|
pauseOnHover?: boolean;
|
|
8
|
+
gap?: number;
|
|
8
9
|
children?: React.ReactNode;
|
|
9
10
|
}
|
|
10
11
|
interface Props extends Omit<React.ComponentPropsWithoutRef<'div'>, 'key'>, ItemProps {
|
|
11
12
|
width: string | number;
|
|
12
13
|
}
|
|
13
|
-
declare const Item: ({ width: _width, speed, autoFill, pause: _pause, pauseOnHover, children }: Props) => import("react").JSX.Element;
|
|
14
|
+
declare const Item: ({ width: _width, speed, autoFill, pause: _pause, pauseOnHover, gap, children }: Props) => import("react").JSX.Element;
|
|
14
15
|
//#endregion
|
|
15
16
|
export { ItemProps, Props, Item as default };
|
|
16
17
|
//# sourceMappingURL=item.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.mts","names":[],"sources":["../../../../src/components/molecules/marquees/item.tsx"],"mappings":";UASiB;EACf,MAAM,MAAM;EACZ;EACA;EACA;EACA;EACA,WAAW,MAAM;;UAGF,cACP,KAAK,MAAM,yCAAyC;EAC5D;;
|
|
1
|
+
{"version":3,"file":"item.d.mts","names":[],"sources":["../../../../src/components/molecules/marquees/item.tsx"],"mappings":";UASiB;EACf,MAAM,MAAM;EACZ;EACA;EACA;EACA;EACA;EACA,WAAW,MAAM;;UAGF,cACP,KAAK,MAAM,yCAAyC;EAC5D;;cAoBI,SAAQ,OAAA,QAAA,OAAA,UAAA,OAAA,QAAA,cAAA,KAAA,YAQX,0BAAK,IAAA"}
|
|
@@ -6,22 +6,32 @@ import { useGSAP } from "@gsap/react";
|
|
|
6
6
|
import { gsap } from "gsap";
|
|
7
7
|
//#region src/components/molecules/marquees/item.tsx
|
|
8
8
|
const INITIAL_AUTO_FILL_GUESS = 10;
|
|
9
|
-
const
|
|
9
|
+
const resolveInitialRepeatCount = (autoFill) => {
|
|
10
|
+
if (!autoFill) return 0;
|
|
11
|
+
return typeof autoFill === "boolean" ? INITIAL_AUTO_FILL_GUESS : autoFill;
|
|
12
|
+
};
|
|
13
|
+
const Item = ({ width: _width, speed = 100, autoFill = false, pause: _pause = false, pauseOnHover = false, gap = 0, children }) => {
|
|
10
14
|
const itemRefs = useRef([]);
|
|
11
15
|
const containerRef = useRef(null);
|
|
12
16
|
const tweenRef = useRef(null);
|
|
13
17
|
const [width, setWidth] = useState(_width);
|
|
14
18
|
const { pause, hoverEvents } = usePauseOnHover(pauseOnHover);
|
|
15
|
-
const [repeatCount, setRepeatCount] = useState(autoFill
|
|
19
|
+
const [repeatCount, setRepeatCount] = useState(resolveInitialRepeatCount(autoFill));
|
|
16
20
|
const [prevWidthProp, setPrevWidthProp] = useState(_width);
|
|
17
21
|
const [prevAutoFill, setPrevAutoFill] = useState(autoFill);
|
|
22
|
+
const [prevGap, setPrevGap] = useState(gap);
|
|
18
23
|
if (_width !== prevWidthProp) {
|
|
19
24
|
setPrevWidthProp(_width);
|
|
20
25
|
setWidth(_width);
|
|
21
26
|
}
|
|
22
27
|
if (autoFill !== prevAutoFill) {
|
|
23
28
|
setPrevAutoFill(autoFill);
|
|
24
|
-
setRepeatCount(autoFill
|
|
29
|
+
setRepeatCount(resolveInitialRepeatCount(autoFill));
|
|
30
|
+
}
|
|
31
|
+
if (gap !== prevGap) {
|
|
32
|
+
setPrevGap(gap);
|
|
33
|
+
setWidth(_width);
|
|
34
|
+
setRepeatCount(resolveInitialRepeatCount(autoFill));
|
|
25
35
|
}
|
|
26
36
|
const isPaused = _pause || pause;
|
|
27
37
|
useEffect(() => {
|
|
@@ -43,7 +53,8 @@ const Item = ({ width: _width, speed = 100, autoFill = false, pause: _pause = fa
|
|
|
43
53
|
}, [
|
|
44
54
|
autoFill,
|
|
45
55
|
width,
|
|
46
|
-
children
|
|
56
|
+
children,
|
|
57
|
+
gap
|
|
47
58
|
]);
|
|
48
59
|
useGSAP(() => {
|
|
49
60
|
if (!containerRef.current || typeof width === "string") return;
|
|
@@ -79,8 +90,12 @@ const Item = ({ width: _width, speed = 100, autoFill = false, pause: _pause = fa
|
|
|
79
90
|
ref: (el) => {
|
|
80
91
|
if (el) itemRefs.current[index] = el;
|
|
81
92
|
},
|
|
93
|
+
style: { paddingRight: gap },
|
|
94
|
+
children
|
|
95
|
+
}), [...Array(typeof autoFill === "number" ? autoFill : repeatCount)].map((_, i) => /* @__PURE__ */ jsx("div", {
|
|
96
|
+
style: { paddingRight: gap },
|
|
82
97
|
children
|
|
83
|
-
}
|
|
98
|
+
}, i))]
|
|
84
99
|
}, index))
|
|
85
100
|
})
|
|
86
101
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.mjs","names":[],"sources":["../../../../src/components/molecules/marquees/item.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport { useGSAP } from '@gsap/react';\nimport { gsap } from 'gsap';\n\nimport usePauseOnHover from './use-pause-on-hover';\n\nexport interface ItemProps {\n key?: React.Key;\n speed?: number;\n autoFill?: boolean | number;\n pause?: boolean;\n pauseOnHover?: boolean;\n children?: React.ReactNode;\n}\n\nexport interface Props\n extends Omit<React.ComponentPropsWithoutRef<'div'>, 'key'>, ItemProps {\n width: string | number;\n}\n\n// `autoFill={true}` (the default on `Marquees`) needs *some* repeat count\n// before the item can be measured and the real count computed — this is\n// only ever visible for that one render, but rendering 100 copies (200\n// with the 2x loop duplication) up front was needlessly heavy for the\n// common case. A modest guess still avoids visible gaps for typical\n// item/container width ratios while cutting the worst-case default\n// render by ~90%.\nconst INITIAL_AUTO_FILL_GUESS = 10;\n\nconst Item = ({\n width: _width,\n speed = 100,\n autoFill = false,\n pause: _pause = false,\n pauseOnHover = false,\n children,\n}: Props) => {\n const itemRefs = useRef<HTMLDivElement[]>([]);\n const containerRef = useRef<HTMLDivElement>(null);\n const tweenRef = useRef<gsap.core.Tween | null>(null);\n\n const [width, setWidth] = useState<string | number>(_width);\n const { pause, hoverEvents } = usePauseOnHover(pauseOnHover);\n const [repeatCount, setRepeatCount] = useState(\n autoFill
|
|
1
|
+
{"version":3,"file":"item.mjs","names":[],"sources":["../../../../src/components/molecules/marquees/item.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport { useGSAP } from '@gsap/react';\nimport { gsap } from 'gsap';\n\nimport usePauseOnHover from './use-pause-on-hover';\n\nexport interface ItemProps {\n key?: React.Key;\n speed?: number;\n autoFill?: boolean | number;\n pause?: boolean;\n pauseOnHover?: boolean;\n gap?: number;\n children?: React.ReactNode;\n}\n\nexport interface Props\n extends Omit<React.ComponentPropsWithoutRef<'div'>, 'key'>, ItemProps {\n width: string | number;\n}\n\n// `autoFill={true}` (the default on `Marquees`) needs *some* repeat count\n// before the item can be measured and the real count computed — this is\n// only ever visible for that one render, but rendering 100 copies (200\n// with the 2x loop duplication) up front was needlessly heavy for the\n// common case. A modest guess still avoids visible gaps for typical\n// item/container width ratios while cutting the worst-case default\n// render by ~90%.\nconst INITIAL_AUTO_FILL_GUESS = 10;\n\nconst resolveInitialRepeatCount = (autoFill: boolean | number) => {\n if (!autoFill) {\n return 0;\n }\n\n return typeof autoFill === 'boolean' ? INITIAL_AUTO_FILL_GUESS : autoFill;\n};\n\nconst Item = ({\n width: _width,\n speed = 100,\n autoFill = false,\n pause: _pause = false,\n pauseOnHover = false,\n gap = 0,\n children,\n}: Props) => {\n const itemRefs = useRef<HTMLDivElement[]>([]);\n const containerRef = useRef<HTMLDivElement>(null);\n const tweenRef = useRef<gsap.core.Tween | null>(null);\n\n const [width, setWidth] = useState<string | number>(_width);\n const { pause, hoverEvents } = usePauseOnHover(pauseOnHover);\n const [repeatCount, setRepeatCount] = useState(\n resolveInitialRepeatCount(autoFill),\n );\n const [prevWidthProp, setPrevWidthProp] = useState(_width);\n const [prevAutoFill, setPrevAutoFill] = useState(autoFill);\n const [prevGap, setPrevGap] = useState(gap);\n\n // Adjusted directly in render (React's \"adjust state during render\"\n // pattern) instead of an effect, so `width`/`repeatCount` re-sync with\n // the prop in the same render it changes rather than the render after.\n if (_width !== prevWidthProp) {\n setPrevWidthProp(_width);\n setWidth(_width);\n }\n\n if (autoFill !== prevAutoFill) {\n setPrevAutoFill(autoFill);\n setRepeatCount(resolveInitialRepeatCount(autoFill));\n }\n\n // `gap` widens every copy, so both the measured item width and the repeat\n // count derived from it are stale. Rewind `width` to the container width\n // so the measuring effect below recomputes the loop distance from scratch.\n if (gap !== prevGap) {\n setPrevGap(gap);\n setWidth(_width);\n setRepeatCount(resolveInitialRepeatCount(autoFill));\n }\n\n const isPaused = _pause || pause;\n\n useEffect(() => {\n if (\n !autoFill ||\n !children ||\n !itemRefs.current[0] ||\n typeof width === 'string'\n ) {\n return;\n }\n\n // `offsetWidth` is the border-box width, so it already includes the\n // `gap` padding each copy carries — the loop distance stays exact\n // without adding `gap` back in here.\n const itemWidth = itemRefs.current[0].offsetWidth;\n\n if (itemWidth >= width) {\n setWidth(itemWidth);\n setRepeatCount(0);\n return;\n }\n\n let totalWidth = 0;\n let repeatCount = 0;\n\n while (totalWidth < width) {\n totalWidth += itemWidth;\n repeatCount += 1;\n }\n\n setWidth(totalWidth);\n setRepeatCount(repeatCount - 1);\n }, [autoFill, width, children, gap]);\n\n useGSAP(\n () => {\n if (!containerRef.current || typeof width === 'string') {\n return;\n }\n\n if (tweenRef.current) {\n tweenRef.current.kill();\n }\n\n tweenRef.current = gsap.fromTo(\n containerRef.current,\n { x: 0 },\n {\n x: -width,\n duration: width / speed,\n repeat: -1,\n ease: 'linear',\n },\n );\n\n return () => {\n tweenRef.current?.kill();\n };\n },\n {\n scope: containerRef,\n dependencies: [width, speed],\n },\n );\n\n useEffect(() => {\n if (!tweenRef.current) {\n return;\n }\n\n if (isPaused) {\n tweenRef.current.pause();\n } else {\n tweenRef.current.play();\n }\n }, [isPaused]);\n\n return (\n <div\n className=\"flex overflow-hidden\"\n {...hoverEvents}\n //\n >\n <div ref={containerRef} className=\"flex flex-nowrap\">\n {[...Array(2)].map((_, index) => (\n <div\n key={index}\n style={{ minWidth: width }}\n className=\"flex flex-nowrap\"\n >\n {/* Every copy carries the same trailing `gap`, so the spacing is\n uniform at the seam between copies and between the two loop\n halves — no special-casing at either boundary. */}\n <div\n ref={el => {\n if (el) {\n itemRefs.current[index] = el;\n }\n }}\n style={{ paddingRight: gap }}\n >\n {children}\n </div>\n {[\n ...Array(typeof autoFill === 'number' ? autoFill : repeatCount),\n ].map((_, i) => (\n <div key={i} style={{ paddingRight: gap }}>\n {children}\n </div>\n ))}\n </div>\n ))}\n </div>\n </div>\n );\n};\n\nexport default Item;\n"],"mappings":";;;;;;;AA+BA,MAAM,0BAA0B;AAEhC,MAAM,6BAA6B,aAA+B;CAChE,IAAI,CAAC,UACH,OAAO;CAGT,OAAO,OAAO,aAAa,YAAY,0BAA0B;AACnE;AAEA,MAAM,QAAQ,EACZ,OAAO,QACP,QAAQ,KACR,WAAW,OACX,OAAO,SAAS,OAChB,eAAe,OACf,MAAM,GACN,eACW;CACX,MAAM,WAAW,OAAyB,CAAC,CAAC;CAC5C,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,WAAW,OAA+B,IAAI;CAEpD,MAAM,CAAC,OAAO,YAAY,SAA0B,MAAM;CAC1D,MAAM,EAAE,OAAO,gBAAgB,gBAAgB,YAAY;CAC3D,MAAM,CAAC,aAAa,kBAAkB,SACpC,0BAA0B,QAAQ,CACpC;CACA,MAAM,CAAC,eAAe,oBAAoB,SAAS,MAAM;CACzD,MAAM,CAAC,cAAc,mBAAmB,SAAS,QAAQ;CACzD,MAAM,CAAC,SAAS,cAAc,SAAS,GAAG;CAK1C,IAAI,WAAW,eAAe;EAC5B,iBAAiB,MAAM;EACvB,SAAS,MAAM;CACjB;CAEA,IAAI,aAAa,cAAc;EAC7B,gBAAgB,QAAQ;EACxB,eAAe,0BAA0B,QAAQ,CAAC;CACpD;CAKA,IAAI,QAAQ,SAAS;EACnB,WAAW,GAAG;EACd,SAAS,MAAM;EACf,eAAe,0BAA0B,QAAQ,CAAC;CACpD;CAEA,MAAM,WAAW,UAAU;CAE3B,gBAAgB;EACd,IACE,CAAC,YACD,CAAC,YACD,CAAC,SAAS,QAAQ,MAClB,OAAO,UAAU,UAEjB;EAMF,MAAM,YAAY,SAAS,QAAQ,EAAE,CAAC;EAEtC,IAAI,aAAa,OAAO;GACtB,SAAS,SAAS;GAClB,eAAe,CAAC;GAChB;EACF;EAEA,IAAI,aAAa;EACjB,IAAI,cAAc;EAElB,OAAO,aAAa,OAAO;GACzB,cAAc;GACd,eAAe;EACjB;EAEA,SAAS,UAAU;EACnB,eAAe,cAAc,CAAC;CAChC,GAAG;EAAC;EAAU;EAAO;EAAU;CAAG,CAAC;CAEnC,cACQ;EACJ,IAAI,CAAC,aAAa,WAAW,OAAO,UAAU,UAC5C;EAGF,IAAI,SAAS,SACX,SAAS,QAAQ,KAAK;EAGxB,SAAS,UAAU,KAAK,OACtB,aAAa,SACb,EAAE,GAAG,EAAE,GACP;GACE,GAAG,CAAC;GACJ,UAAU,QAAQ;GAClB,QAAQ;GACR,MAAM;EACR,CACF;EAEA,aAAa;GACX,SAAS,SAAS,KAAK;EACzB;CACF,GACA;EACE,OAAO;EACP,cAAc,CAAC,OAAO,KAAK;CAC7B,CACF;CAEA,gBAAgB;EACd,IAAI,CAAC,SAAS,SACZ;EAGF,IAAI,UACF,SAAS,QAAQ,MAAM;OAEvB,SAAS,QAAQ,KAAK;CAE1B,GAAG,CAAC,QAAQ,CAAC;CAEb,OACE,oBAAC,OAAD;EACE,WAAU;EACV,GAAI;EAGJ,UAAA,oBAAC,OAAD;GAAK,KAAK;GAAc,WAAU;GAC/B,UAAA,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,UACrB,qBAAC,OAAD;IAEE,OAAO,EAAE,UAAU,MAAM;IACzB,WAAU;IAHZ,UAAA,CAQE,oBAAC,OAAD;KACE,MAAK,OAAM;MACT,IAAI,IACF,SAAS,QAAQ,SAAS;KAE9B;KACA,OAAO,EAAE,cAAc,IAAI;KAE1B;IACE,CAAA,GACJ,CACC,GAAG,MAAM,OAAO,aAAa,WAAW,WAAW,WAAW,CAChE,CAAC,CAAC,KAAK,GAAG,MACR,oBAAC,OAAD;KAAa,OAAO,EAAE,cAAc,IAAI;KACrC;IACE,GAFK,CAEL,CACN,CACE;GAxBE,GAAA,KAwBF,CACN;EACE,CAAA;CACF,CAAA;AAET"}
|
|
@@ -4,9 +4,10 @@ interface Props extends React.ComponentPropsWithoutRef<'div'> {
|
|
|
4
4
|
speed?: number;
|
|
5
5
|
autoFill?: boolean | number;
|
|
6
6
|
pauseOnHover?: boolean;
|
|
7
|
+
gap?: number;
|
|
7
8
|
items?: ItemProps[];
|
|
8
9
|
}
|
|
9
|
-
declare const Marquees: ({ className, items, speed, pauseOnHover, autoFill, ...props }: Props) => import("react").JSX.Element;
|
|
10
|
+
declare const Marquees: ({ className, items, speed, pauseOnHover, autoFill, gap, ...props }: Props) => import("react").JSX.Element;
|
|
10
11
|
//#endregion
|
|
11
12
|
export { Props, Marquees as default };
|
|
12
13
|
//# sourceMappingURL=marquees.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marquees.d.mts","names":[],"sources":["../../../../src/components/molecules/marquees/marquees.tsx"],"mappings":";;UAeiB,cAAc,MAAM;EACnC;EACA;EACA;EACA,QAAQ;;cAGJ,aAAY,WAAA,OAAA,OAAA,cAAA,
|
|
1
|
+
{"version":3,"file":"marquees.d.mts","names":[],"sources":["../../../../src/components/molecules/marquees/marquees.tsx"],"mappings":";;UAeiB,cAAc,MAAM;EACnC;EACA;EACA;EACA;EACA,QAAQ;;cAGJ,aAAY,WAAA,OAAA,OAAA,cAAA,UAAA,QAAA,SAQf,0BAAK,IAAA"}
|
|
@@ -6,8 +6,8 @@ import { useEffect, useRef, useState } from "react";
|
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
7
7
|
import { useMergedRef, useResponsiveSize, useThrottledValue } from "@jbpark/use-hooks";
|
|
8
8
|
//#region src/components/molecules/marquees/marquees.tsx
|
|
9
|
-
const Marquees = ({ className, items, speed, pauseOnHover = true, autoFill = true, ...props }) => {
|
|
10
|
-
const [width, setWidth] = useState("
|
|
9
|
+
const Marquees = ({ className, items, speed, pauseOnHover = true, autoFill = true, gap, ...props }) => {
|
|
10
|
+
const [width, setWidth] = useState("100%");
|
|
11
11
|
const [padding, setPadding] = useState(0);
|
|
12
12
|
const { pause, hoverEvents } = usePauseOnHover(pauseOnHover);
|
|
13
13
|
const throttledWidth = useThrottledValue(width, 200);
|
|
@@ -35,6 +35,7 @@ const Marquees = ({ className, items, speed, pauseOnHover = true, autoFill = tru
|
|
|
35
35
|
pause,
|
|
36
36
|
speed,
|
|
37
37
|
autoFill,
|
|
38
|
+
gap,
|
|
38
39
|
...item,
|
|
39
40
|
children
|
|
40
41
|
}, itemKey || key))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marquees.mjs","names":[],"sources":["../../../../src/components/molecules/marquees/marquees.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport {\n useMergedRef,\n useResponsiveSize,\n useThrottledValue,\n} from '@jbpark/use-hooks';\n\nimport { cn } from '@repo/ui/utils';\n\nimport Item, { type ItemProps } from './item';\nimport usePauseOnHover from './use-pause-on-hover';\n\nexport interface Props extends React.ComponentPropsWithoutRef<'div'> {\n speed?: number;\n autoFill?: boolean | number;\n pauseOnHover?: boolean;\n items?: ItemProps[];\n}\n\nconst Marquees = ({\n className,\n items,\n speed,\n pauseOnHover = true,\n autoFill = true,\n ...props\n}: Props) => {\n const [width, setWidth] = useState<string | number>(\n '
|
|
1
|
+
{"version":3,"file":"marquees.mjs","names":[],"sources":["../../../../src/components/molecules/marquees/marquees.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef, useState } from 'react';\n\nimport {\n useMergedRef,\n useResponsiveSize,\n useThrottledValue,\n} from '@jbpark/use-hooks';\n\nimport { cn } from '@repo/ui/utils';\n\nimport Item, { type ItemProps } from './item';\nimport usePauseOnHover from './use-pause-on-hover';\n\nexport interface Props extends React.ComponentPropsWithoutRef<'div'> {\n speed?: number;\n autoFill?: boolean | number;\n pauseOnHover?: boolean;\n gap?: number;\n items?: ItemProps[];\n}\n\nconst Marquees = ({\n className,\n items,\n speed,\n pauseOnHover = true,\n autoFill = true,\n gap,\n ...props\n}: Props) => {\n // The container's own width, not the viewport's. `useResponsiveSize`\n // measures in a layout effect, but this component copies the result into\n // state in a passive effect and then throttles it, so the seed is what\n // paints for the first ~200ms. `100vw` overflowed every padded or columned\n // layout for that window — on the docs page it drew the track 1280px wide\n // inside a 703px column, briefly showing the whole track and giving the\n // page a horizontal scrollbar. `100%` resolves to the same value the\n // measurement lands on, so there is nothing left to snap.\n const [width, setWidth] = useState<string | number>(\n '100%',\n //\n );\n const [padding, setPadding] = useState(0);\n const { pause, hoverEvents } = usePauseOnHover(pauseOnHover);\n\n const throttledWidth = useThrottledValue(width, 200);\n\n const { size, ref: responsiveRef } = useResponsiveSize<HTMLDivElement>();\n const containerRef = useRef<HTMLDivElement | null>(null);\n const setContainerRef = useMergedRef(containerRef, responsiveRef);\n\n useEffect(() => {\n if (!size.width || !containerRef.current) {\n return;\n }\n\n const computedStyle = getComputedStyle(containerRef.current);\n const paddingLeft = parseFloat(computedStyle.paddingLeft) || 0;\n const paddingRight = parseFloat(computedStyle.paddingRight) || 0;\n\n setPadding(paddingLeft + paddingRight);\n\n setWidth(size.width);\n }, [size]);\n\n return (\n <div\n ref={setContainerRef}\n className={cn(\n className,\n //\n )}\n {...hoverEvents}\n {...props}\n >\n <div\n className={cn(\n 'flex flex-col gap-y-5',\n 'overflow-hidden',\n 'whitespace-nowrap',\n 'bg-inherit',\n //\n )}\n style={{\n width:\n typeof throttledWidth === 'number'\n ? throttledWidth - padding\n : throttledWidth,\n }}\n >\n {items?.map(({ children, key: itemKey, ...item }: ItemProps, key) => (\n <Item\n key={itemKey || key}\n width={throttledWidth}\n pause={pause}\n speed={speed}\n autoFill={autoFill}\n gap={gap}\n {...item}\n >\n {children}\n </Item>\n ))}\n </div>\n </div>\n );\n};\n\nexport default Marquees;\n"],"mappings":";;;;;;;;AAuBA,MAAM,YAAY,EAChB,WACA,OACA,OACA,eAAe,MACf,WAAW,MACX,KACA,GAAG,YACQ;CASX,MAAM,CAAC,OAAO,YAAY,SACxB,MAEF;CACA,MAAM,CAAC,SAAS,cAAc,SAAS,CAAC;CACxC,MAAM,EAAE,OAAO,gBAAgB,gBAAgB,YAAY;CAE3D,MAAM,iBAAiB,kBAAkB,OAAO,GAAG;CAEnD,MAAM,EAAE,MAAM,KAAK,kBAAkB,kBAAkC;CACvE,MAAM,eAAe,OAA8B,IAAI;CACvD,MAAM,kBAAkB,aAAa,cAAc,aAAa;CAEhE,gBAAgB;EACd,IAAI,CAAC,KAAK,SAAS,CAAC,aAAa,SAC/B;EAGF,MAAM,gBAAgB,iBAAiB,aAAa,OAAO;EAC3D,MAAM,cAAc,WAAW,cAAc,WAAW,KAAK;EAC7D,MAAM,eAAe,WAAW,cAAc,YAAY,KAAK;EAE/D,WAAW,cAAc,YAAY;EAErC,SAAS,KAAK,KAAK;CACrB,GAAG,CAAC,IAAI,CAAC;CAET,OACE,oBAAC,OAAD;EACE,KAAK;EACL,WAAW,GACT,SAEF;EACA,GAAI;EACJ,GAAI;EAEJ,UAAA,oBAAC,OAAD;GACE,WAAW,GACT,yBACA,mBACA,qBACA,YAEF;GACA,OAAO,EACL,OACE,OAAO,mBAAmB,WACtB,iBAAiB,UACjB,eACR;GAEC,UAAA,OAAO,KAAK,EAAE,UAAU,KAAK,SAAS,GAAG,QAAmB,QAC3D,oBAAC,MAAD;IAEE,OAAO;IACA;IACA;IACG;IACL;IACL,GAAI;IAEH;GACG,GATC,WAAW,GASZ,CACP;EACE,CAAA;CACF,CAAA;AAET"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn
|
|
2
|
+
import { cn } from "../../utils.mjs";
|
|
3
3
|
import { DEFAULT_LOCALE, useConfig } from "../../providers/config/context.mjs";
|
|
4
4
|
import Button from "../../Button.mjs";
|
|
5
5
|
import { drawer_exports } from "../../core/drawer.mjs";
|
|
@@ -104,10 +104,10 @@ const Drawer = ({ open, title, extra, footer, closable = true, closeIcon, direct
|
|
|
104
104
|
children: [/* @__PURE__ */ jsx(DrawerTitle, {
|
|
105
105
|
className: cn(classNames?.title),
|
|
106
106
|
children: title
|
|
107
|
-
}),
|
|
107
|
+
}), extra != null && /* @__PURE__ */ jsx("div", {
|
|
108
108
|
className: cn("shrink-0", classNames?.extra),
|
|
109
|
-
children:
|
|
110
|
-
})
|
|
109
|
+
children: extra
|
|
110
|
+
})]
|
|
111
111
|
})]
|
|
112
112
|
}), /* @__PURE__ */ jsx(DrawerDescription, { className: "hidden" })]
|
|
113
113
|
}),
|
|
@@ -115,10 +115,10 @@ const Drawer = ({ open, title, extra, footer, closable = true, closeIcon, direct
|
|
|
115
115
|
className: cn("overflow-auto p-5", classNames?.body),
|
|
116
116
|
children
|
|
117
117
|
}),
|
|
118
|
-
|
|
118
|
+
footer != null && /* @__PURE__ */ jsx(DrawerFooter, {
|
|
119
119
|
className: cn(classNames?.footer),
|
|
120
|
-
children:
|
|
121
|
-
})
|
|
120
|
+
children: footer
|
|
121
|
+
})
|
|
122
122
|
]
|
|
123
123
|
})
|
|
124
124
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.mjs","names":["drawer"],"sources":["../../../src/components/organisms/drawer.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\n\nimport { X } from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn
|
|
1
|
+
{"version":3,"file":"drawer.mjs","names":["drawer"],"sources":["../../../src/components/organisms/drawer.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect } from 'react';\n\nimport { X } from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { drawer } from '../../core';\nimport Button from '../atoms/button';\n\nconst {\n DrawerContent,\n Drawer: DrawerCore,\n DrawerDescription,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n} = drawer;\n\n// `body.style.pointerEvents` is global state (per document), so several\n// mask-less overlays opening at once would otherwise race: each instance\n// would capture whatever the previous one had already written and the\n// last cleanup would restore a stale value. Reference counting makes only\n// the first instance capture the original value and only the last one\n// restore it. Keyed by document (not a single module-level counter) so\n// drawers portaled into different documents — e.g. live-editor's iframe\n// Renderer — don't share state with the host document.\ntype MaskLessState = { count: number; originalPointerEvents: string | null };\nconst maskLessStates = new WeakMap<Document, MaskLessState>();\n\nconst getMaskLessState = (doc: Document): MaskLessState => {\n let state = maskLessStates.get(doc);\n\n if (!state) {\n state = { count: 0, originalPointerEvents: null };\n maskLessStates.set(doc, state);\n }\n\n return state;\n};\n\nexport interface Props {\n open: boolean;\n children?: React.ReactNode;\n title?: React.ReactNode;\n extra?: React.ReactNode;\n footer?: React.ReactNode;\n closable?: boolean;\n closeIcon?: React.ReactNode;\n direction?: 'top' | 'bottom' | 'left' | 'right';\n size?: 'small' | 'medium' | 'large' | 'full' | string;\n maskClosable?: boolean;\n handlebar?: boolean;\n draggable?: boolean;\n rounded?: boolean;\n mask?: boolean;\n className?: string;\n style?: React.CSSProperties;\n classNames?: {\n mask?: string;\n content?: string;\n handlebar?: string;\n header?: string;\n title?: string;\n close?: string;\n extra?: string;\n body?: string;\n footer?: string;\n };\n container?: HTMLElement;\n onClose: () => void;\n}\n\nconst SIZES: Record<string, string> = {\n small: '30%',\n medium: '50%',\n large: '75%',\n full: '90%',\n};\n\n// Rounds the edge facing into the viewport — the opposite edge from\n// whichever side the drawer is anchored to.\nconst ROUNDED_CLASSES: Record<'top' | 'bottom' | 'left' | 'right', string> = {\n top: 'rounded-b-[30px]!',\n bottom: 'rounded-t-[30px]!',\n left: 'rounded-r-[30px]!',\n right: 'rounded-l-[30px]!',\n};\n\nconst getSizeStyles = (\n direction: 'top' | 'bottom' | 'left' | 'right',\n size: string,\n): React.CSSProperties => {\n const value = SIZES[size] || size;\n\n return direction === 'top' || direction === 'bottom'\n ? { height: value }\n : { width: value };\n};\n\nconst Drawer = ({\n open,\n title,\n extra,\n footer,\n closable = true,\n closeIcon,\n direction = 'bottom',\n size = 'medium',\n maskClosable = true,\n handlebar = true,\n draggable = false,\n rounded = false,\n mask = true,\n className,\n classNames,\n style,\n children,\n container,\n onClose,\n ...props\n}: Props) => {\n const { locale } = useConfig();\n\n useEffect(() => {\n if (!open || mask) {\n return;\n }\n\n const targetDocument = container?.ownerDocument ?? document;\n const targetWindow = targetDocument.defaultView ?? window;\n const body = targetDocument.body;\n const state = getMaskLessState(targetDocument);\n\n if (state.count === 0) {\n state.originalPointerEvents = body.style.pointerEvents;\n }\n state.count += 1;\n\n const raf = targetWindow.requestAnimationFrame(() => {\n body.style.pointerEvents = 'auto';\n });\n\n return () => {\n targetWindow.cancelAnimationFrame(raf);\n state.count -= 1;\n\n if (state.count === 0) {\n body.style.pointerEvents = state.originalPointerEvents ?? '';\n state.originalPointerEvents = null;\n }\n };\n }, [open, mask, container]);\n\n return (\n <DrawerCore\n open={open}\n direction={direction}\n handleOnly={!draggable}\n container={container}\n onOpenChange={open => {\n if (!open) {\n onClose();\n }\n }}\n {...props}\n >\n <DrawerContent\n className={cn(\n 'border-none outline-none',\n rounded ? ROUNDED_CLASSES[direction] : 'rounded-none!',\n classNames?.content,\n className,\n //\n )}\n handlebar={handlebar}\n mask={mask}\n onPointerDownOutside={event => {\n if (!maskClosable) {\n event.preventDefault();\n }\n }}\n classNames={{\n mask: classNames?.mask || '',\n handlebar: classNames?.handlebar || '',\n }}\n style={{\n ...getSizeStyles(direction, size),\n ...style,\n }}\n >\n <DrawerHeader\n className={cn(\n classNames?.header,\n !title && 'p-0',\n //\n )}\n >\n <div className=\"flex items-start gap-2\">\n {closable && (\n <Button\n variant=\"text\"\n shape=\"circle\"\n size=\"small\"\n aria-label={locale.close ?? DEFAULT_LOCALE.close}\n icon={closeIcon || <X />}\n onClick={onClose}\n className={cn(classNames?.close)}\n />\n )}\n <div className=\"flex flex-1 items-start justify-between gap-2\">\n <DrawerTitle className={cn(classNames?.title)}>\n {title}\n </DrawerTitle>\n {extra != null && (\n <div className={cn('shrink-0', classNames?.extra)}>{extra}</div>\n )}\n </div>\n </div>\n <DrawerDescription className=\"hidden\" />\n </DrawerHeader>\n <div\n className={cn(\n 'overflow-auto p-5',\n classNames?.body,\n //\n )}\n >\n {children}\n </div>\n {footer != null && (\n <DrawerFooter className={cn(classNames?.footer)}>\n {footer}\n </DrawerFooter>\n )}\n </DrawerContent>\n </DrawerCore>\n );\n};\n\nexport default Drawer;\n"],"mappings":";;;;;;;;;AAYA,MAAM,EACJ,eACA,QAAQ,YACR,mBACA,cACA,cACA,gBACEA;AAWJ,MAAM,iCAAiB,IAAI,QAAiC;AAE5D,MAAM,oBAAoB,QAAiC;CACzD,IAAI,QAAQ,eAAe,IAAI,GAAG;CAElC,IAAI,CAAC,OAAO;EACV,QAAQ;GAAE,OAAO;GAAG,uBAAuB;EAAK;EAChD,eAAe,IAAI,KAAK,KAAK;CAC/B;CAEA,OAAO;AACT;AAkCA,MAAM,QAAgC;CACpC,OAAO;CACP,QAAQ;CACR,OAAO;CACP,MAAM;AACR;AAIA,MAAM,kBAAuE;CAC3E,KAAK;CACL,QAAQ;CACR,MAAM;CACN,OAAO;AACT;AAEA,MAAM,iBACJ,WACA,SACwB;CACxB,MAAM,QAAQ,MAAM,SAAS;CAE7B,OAAO,cAAc,SAAS,cAAc,WACxC,EAAE,QAAQ,MAAM,IAChB,EAAE,OAAO,MAAM;AACrB;AAEA,MAAM,UAAU,EACd,MACA,OACA,OACA,QACA,WAAW,MACX,WACA,YAAY,UACZ,OAAO,UACP,eAAe,MACf,YAAY,MACZ,YAAY,OACZ,UAAU,OACV,OAAO,MACP,WACA,YACA,OACA,UACA,WACA,SACA,GAAG,YACQ;CACX,MAAM,EAAE,WAAW,UAAU;CAE7B,gBAAgB;EACd,IAAI,CAAC,QAAQ,MACX;EAGF,MAAM,iBAAiB,WAAW,iBAAiB;EACnD,MAAM,eAAe,eAAe,eAAe;EACnD,MAAM,OAAO,eAAe;EAC5B,MAAM,QAAQ,iBAAiB,cAAc;EAE7C,IAAI,MAAM,UAAU,GAClB,MAAM,wBAAwB,KAAK,MAAM;EAE3C,MAAM,SAAS;EAEf,MAAM,MAAM,aAAa,4BAA4B;GACnD,KAAK,MAAM,gBAAgB;EAC7B,CAAC;EAED,aAAa;GACX,aAAa,qBAAqB,GAAG;GACrC,MAAM,SAAS;GAEf,IAAI,MAAM,UAAU,GAAG;IACrB,KAAK,MAAM,gBAAgB,MAAM,yBAAyB;IAC1D,MAAM,wBAAwB;GAChC;EACF;CACF,GAAG;EAAC;EAAM;EAAM;CAAS,CAAC;CAE1B,OACE,oBAAC,YAAD;EACQ;EACK;EACX,YAAY,CAAC;EACF;EACX,eAAc,SAAQ;GACpB,IAAI,CAAC,MACH,QAAQ;EAEZ;EACA,GAAI;EAEJ,UAAA,qBAAC,eAAD;GACE,WAAW,GACT,4BACA,UAAU,gBAAgB,aAAa,iBACvC,YAAY,SACZ,SAEF;GACW;GACL;GACN,uBAAsB,UAAS;IAC7B,IAAI,CAAC,cACH,MAAM,eAAe;GAEzB;GACA,YAAY;IACV,MAAM,YAAY,QAAQ;IAC1B,WAAW,YAAY,aAAa;GACtC;GACA,OAAO;IACL,GAAG,cAAc,WAAW,IAAI;IAChC,GAAG;GACL;GAtBF,UAAA;IAwBE,qBAAC,cAAD;KACE,WAAW,GACT,YAAY,QACZ,CAAC,SAAS,KAEZ;KALF,UAAA,CAOE,qBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACG,YACC,oBAAC,QAAD;OACE,SAAQ;OACR,OAAM;OACN,MAAK;OACL,cAAY,OAAO,SAAS,eAAe;OAC3C,MAAM,aAAa,oBAAC,GAAD,CAAI,CAAA;OACvB,SAAS;OACT,WAAW,GAAG,YAAY,KAAK;MAChC,CAAA,GAEH,qBAAC,OAAD;OAAK,WAAU;OAAf,UAAA,CACE,oBAAC,aAAD;QAAa,WAAW,GAAG,YAAY,KAAK;QACzC,UAAA;OACU,CAAA,GACZ,SAAS,QACR,oBAAC,OAAD;QAAK,WAAW,GAAG,YAAY,YAAY,KAAK;QAAI,UAAA;OAAW,CAAA,CAE9D;MACF,CAAA,CAAA;KACL,CAAA,GAAA,oBAAC,mBAAD,EAAmB,WAAU,SAAU,CAAA,CAC3B;;IACd,oBAAC,OAAD;KACE,WAAW,GACT,qBACA,YAAY,IAEd;KAEC;IACE,CAAA;IACJ,UAAU,QACT,oBAAC,cAAD;KAAc,WAAW,GAAG,YAAY,MAAM;KAC3C,UAAA;IACW,CAAA;GAEH;;CACL,CAAA;AAEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.mts","names":[],"sources":["../../../../src/components/templates/layout/header.tsx"],"mappings":";
|
|
1
|
+
{"version":3,"file":"header.d.mts","names":[],"sources":["../../../../src/components/templates/layout/header.tsx"],"mappings":";UAIiB,cAAc,MAAM;EACnC;;cAGI,WAAU,UAAA,WAAA,aAAA,SAKb,0BAAK,IAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { cn } from "../../../utils.mjs";
|
|
2
|
+
import "../../../lib/z-layers.mjs";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
//#region src/components/templates/layout/header.tsx
|
|
4
5
|
const Header = ({ children, className, position = "sticky", ...props }) => {
|
|
5
6
|
return /* @__PURE__ */ jsx("header", {
|
|
6
|
-
className: cn(position === "sticky" && "sticky top-0
|
|
7
|
+
className: cn(position !== "static" && "z-1000", position === "sticky" && "sticky top-0", position === "fixed" && "fixed inset-x-0 top-0", "bg-background", "flex h-16 w-full items-center px-5", className),
|
|
7
8
|
...props,
|
|
8
9
|
children
|
|
9
10
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header.mjs","names":[],"sources":["../../../../src/components/templates/layout/header.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nexport interface Props extends React.ComponentProps<'header'> {\n position?: 'sticky' | 'static' | 'fixed';\n}\n\nconst Header = ({\n children,\n className,\n position = 'sticky',\n ...props\n}: Props) => {\n return (\n <header\n className={cn(\n position === 'sticky' && 'sticky top-0
|
|
1
|
+
{"version":3,"file":"header.mjs","names":[],"sources":["../../../../src/components/templates/layout/header.tsx"],"sourcesContent":["import { cn } from '@repo/ui/utils';\n\nimport { OVERLAY_LAYER } from '../../../lib/z-layers';\n\nexport interface Props extends React.ComponentProps<'header'> {\n position?: 'sticky' | 'static' | 'fixed';\n}\n\nconst Header = ({\n children,\n className,\n position = 'sticky',\n ...props\n}: Props) => {\n return (\n <header\n className={cn(\n position !== 'static' && OVERLAY_LAYER,\n position === 'sticky' && 'sticky top-0',\n position === 'fixed' && 'fixed inset-x-0 top-0',\n 'bg-background',\n 'flex h-16 w-full items-center px-5',\n className,\n //\n )}\n {...props}\n >\n {children}\n </header>\n );\n};\n\nexport default Header;\n"],"mappings":";;;;AAQA,MAAM,UAAU,EACd,UACA,WACA,WAAW,UACX,GAAG,YACQ;CACX,OACE,oBAAC,UAAD;EACE,WAAW,GACT,aAAa,YAAA,UACb,aAAa,YAAY,gBACzB,aAAa,WAAW,yBACxB,iBACA,sCACA,SAEF;EACA,GAAI;EAEH;CACK,CAAA;AAEZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sider.mjs","names":[],"sources":["../../../../src/components/templates/layout/sider.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useId, useRef } from 'react';\n\nimport { useControllableState, useResponsiveSize } from '@jbpark/use-hooks';\nimport { PanelLeftClose, PanelLeftOpen } from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { useRegisterSider } from './sider-context';\n\ntype Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n// Order matters here, not the values — used to compare the current\n// viewport tier against the configured `breakpoint` ordinally, since\n// `useResponsiveSize` reports which named tier the viewport is currently\n// in rather than a raw pixel width.\nconst BREAKPOINT_ORDER: Breakpoint[] = ['xs', 'sm', 'md', 'lg', 'xl', '2xl'];\n\nexport interface Props extends Omit<\n React.ComponentProps<'aside'>,\n 'onCollapse'\n> {\n width?: number | string;\n collapsedWidth?: number | string;\n collapsible?: boolean;\n defaultCollapsed?: boolean;\n collapsed?: boolean;\n placement?: 'left' | 'right';\n reverseArrow?: boolean;\n trigger?: React.ReactNode;\n classNames?: {\n trigger?: string;\n };\n breakpoint?: Breakpoint;\n onCollapse?: (collapsed: boolean) => void;\n onBreakpoint?: (broken: boolean) => void;\n}\n\nconst toCssSize = (value: number | string) =>\n typeof value === 'number' ? `${value}px` : value;\n\nconst Sider = ({\n children,\n className,\n classNames,\n style,\n width = 200,\n collapsedWidth = 80,\n collapsible = false,\n defaultCollapsed = false,\n collapsed: _collapsed,\n placement = 'left',\n reverseArrow = false,\n trigger,\n breakpoint,\n onCollapse,\n onBreakpoint,\n ...props\n}: Props) => {\n useRegisterSider();\n\n const { locale } = useConfig();\n const contentId = useId();\n const [collapsed, setCollapsed] = useControllableState<boolean>({\n value: _collapsed,\n defaultValue: defaultCollapsed,\n onChange: onCollapse,\n });\n\n const { breakpoint: viewportBreakpoint } = useResponsiveSize({\n viewport: true,\n });\n const broken = breakpoint\n ? BREAKPOINT_ORDER.indexOf(viewportBreakpoint.current) <\n BREAKPOINT_ORDER.indexOf(breakpoint)\n : false;\n\n const latestBrokenRef = useRef(broken);\n const previousBrokenRef = useRef<boolean | null>(null);\n const microtaskScheduledRef = useRef(false);\n const onBreakpointRef = useRef(onBreakpoint);\n\n useEffect(() => {\n onBreakpointRef.current = onBreakpoint;\n });\n\n // `useResponsiveSize`'s own initial measurement resolves through its own\n // layout effect, which (since it's called earlier in this component)\n // commits and — if the real viewport differs from its SSR-safe 'xs'\n // placeholder default — triggers a synchronous corrective re-render, all\n // before the browser paints. Both the placeholder-derived render and the\n // corrected one get their own effect pass (React doesn't coalesce\n // same-tick synchronous re-commits into a single effect flush), so\n // reacting to `broken` directly — in a layout or passive effect either\n // way — fires once with the wrong placeholder value, then again with the\n // corrected one.\n //\n // Coalescing through a microtask sidesteps that: every effect pass just\n // records its `broken` into a ref and schedules (at most once) a\n // microtask that reads whatever ended up latest once the synchronous\n // cascade has fully settled, and acts on that single, correct value.\n //\n // The `previousBrokenRef` guard is the separate fix for #227 point 3:\n // without it, an inline `onCollapse`/`onBreakpoint` (a fresh identity\n // every render) would change `setCollapsed`'s own identity and re-run\n // this effect on every unrelated parent re-render, reapplying `broken`\n // and undoing a user's manual toggle. Only a genuine change should act.\n useEffect(() => {\n if (!breakpoint) {\n return;\n }\n\n latestBrokenRef.current = broken;\n\n if (microtaskScheduledRef.current) {\n return;\n }\n microtaskScheduledRef.current = true;\n\n queueMicrotask(() => {\n microtaskScheduledRef.current = false;\n\n const settledBroken = latestBrokenRef.current;\n\n if (previousBrokenRef.current === settledBroken) {\n return;\n }\n\n previousBrokenRef.current = settledBroken;\n setCollapsed(settledBroken);\n onBreakpointRef.current?.(settledBroken);\n });\n }, [broken, breakpoint, setCollapsed]);\n\n const onTriggerClick = () => {\n setCollapsed(!collapsed);\n };\n\n // A right-placed Sider's collapse icon should default to pointing the\n // opposite way from a left-placed one (it's opening/closing a panel on\n // the other side of the content), so `placement` flips the effective\n // direction on top of whatever `reverseArrow` already requests —\n // `reverseArrow` still layers on as a manual override either way.\n const effectiveReverseArrow = reverseArrow !== (placement === 'right');\n const TriggerIcon =\n collapsed !== effectiveReverseArrow ? PanelLeftOpen : PanelLeftClose;\n\n return (\n <aside\n className={cn(\n // Below Header
|
|
1
|
+
{"version":3,"file":"sider.mjs","names":[],"sources":["../../../../src/components/templates/layout/sider.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useId, useRef } from 'react';\n\nimport { useControllableState, useResponsiveSize } from '@jbpark/use-hooks';\nimport { PanelLeftClose, PanelLeftOpen } from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { useRegisterSider } from './sider-context';\n\ntype Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';\n\n// Order matters here, not the values — used to compare the current\n// viewport tier against the configured `breakpoint` ordinally, since\n// `useResponsiveSize` reports which named tier the viewport is currently\n// in rather than a raw pixel width.\nconst BREAKPOINT_ORDER: Breakpoint[] = ['xs', 'sm', 'md', 'lg', 'xl', '2xl'];\n\nexport interface Props extends Omit<\n React.ComponentProps<'aside'>,\n 'onCollapse'\n> {\n width?: number | string;\n collapsedWidth?: number | string;\n collapsible?: boolean;\n defaultCollapsed?: boolean;\n collapsed?: boolean;\n placement?: 'left' | 'right';\n reverseArrow?: boolean;\n trigger?: React.ReactNode;\n classNames?: {\n trigger?: string;\n };\n breakpoint?: Breakpoint;\n onCollapse?: (collapsed: boolean) => void;\n onBreakpoint?: (broken: boolean) => void;\n}\n\nconst toCssSize = (value: number | string) =>\n typeof value === 'number' ? `${value}px` : value;\n\nconst Sider = ({\n children,\n className,\n classNames,\n style,\n width = 200,\n collapsedWidth = 80,\n collapsible = false,\n defaultCollapsed = false,\n collapsed: _collapsed,\n placement = 'left',\n reverseArrow = false,\n trigger,\n breakpoint,\n onCollapse,\n onBreakpoint,\n ...props\n}: Props) => {\n useRegisterSider();\n\n const { locale } = useConfig();\n const contentId = useId();\n const [collapsed, setCollapsed] = useControllableState<boolean>({\n value: _collapsed,\n defaultValue: defaultCollapsed,\n onChange: onCollapse,\n });\n\n const { breakpoint: viewportBreakpoint } = useResponsiveSize({\n viewport: true,\n });\n const broken = breakpoint\n ? BREAKPOINT_ORDER.indexOf(viewportBreakpoint.current) <\n BREAKPOINT_ORDER.indexOf(breakpoint)\n : false;\n\n const latestBrokenRef = useRef(broken);\n const previousBrokenRef = useRef<boolean | null>(null);\n const microtaskScheduledRef = useRef(false);\n const onBreakpointRef = useRef(onBreakpoint);\n\n useEffect(() => {\n onBreakpointRef.current = onBreakpoint;\n });\n\n // `useResponsiveSize`'s own initial measurement resolves through its own\n // layout effect, which (since it's called earlier in this component)\n // commits and — if the real viewport differs from its SSR-safe 'xs'\n // placeholder default — triggers a synchronous corrective re-render, all\n // before the browser paints. Both the placeholder-derived render and the\n // corrected one get their own effect pass (React doesn't coalesce\n // same-tick synchronous re-commits into a single effect flush), so\n // reacting to `broken` directly — in a layout or passive effect either\n // way — fires once with the wrong placeholder value, then again with the\n // corrected one.\n //\n // Coalescing through a microtask sidesteps that: every effect pass just\n // records its `broken` into a ref and schedules (at most once) a\n // microtask that reads whatever ended up latest once the synchronous\n // cascade has fully settled, and acts on that single, correct value.\n //\n // The `previousBrokenRef` guard is the separate fix for #227 point 3:\n // without it, an inline `onCollapse`/`onBreakpoint` (a fresh identity\n // every render) would change `setCollapsed`'s own identity and re-run\n // this effect on every unrelated parent re-render, reapplying `broken`\n // and undoing a user's manual toggle. Only a genuine change should act.\n useEffect(() => {\n if (!breakpoint) {\n return;\n }\n\n latestBrokenRef.current = broken;\n\n if (microtaskScheduledRef.current) {\n return;\n }\n microtaskScheduledRef.current = true;\n\n queueMicrotask(() => {\n microtaskScheduledRef.current = false;\n\n const settledBroken = latestBrokenRef.current;\n\n if (previousBrokenRef.current === settledBroken) {\n return;\n }\n\n previousBrokenRef.current = settledBroken;\n setCollapsed(settledBroken);\n onBreakpointRef.current?.(settledBroken);\n });\n }, [broken, breakpoint, setCollapsed]);\n\n const onTriggerClick = () => {\n setCollapsed(!collapsed);\n };\n\n // A right-placed Sider's collapse icon should default to pointing the\n // opposite way from a left-placed one (it's opening/closing a panel on\n // the other side of the content), so `placement` flips the effective\n // direction on top of whatever `reverseArrow` already requests —\n // `reverseArrow` still layers on as a manual override either way.\n const effectiveReverseArrow = reverseArrow !== (placement === 'right');\n const TriggerIcon =\n collapsed !== effectiveReverseArrow ? PanelLeftOpen : PanelLeftClose;\n\n return (\n <aside\n className={cn(\n // Below Header — and below every other floating/overlay primitive\n // in this library, which all share OVERLAY_LAYER (lib/z-layers.ts).\n // Sider is a static layout column, not floating chrome, and\n // previously outranked Header with an arbitrary z-100, covering it\n // once Header stuck to the viewport top on scroll. Kept as a small\n // absolute value rather than tracking OVERLAY_LAYER: it only has to\n // stay under that layer, and raising it in step would defeat this.\n 'z-10 flex h-full shrink-0 flex-col overflow-hidden',\n 'transition-[width] duration-200',\n // Lets a Sider visually sit on the right without needing to\n // reorder JSX/children — useful since Sider's presence is\n // detected via context (sider-context.ts) rather than requiring\n // it to be a specific direct child in a specific position.\n placement === 'right' && 'order-last',\n className,\n //\n )}\n style={{\n width: toCssSize(collapsed ? collapsedWidth : width),\n ...style,\n }}\n {...props}\n >\n <div id={contentId} className=\"min-h-0 flex-1 overflow-auto\">\n {children}\n </div>\n {collapsible && trigger !== null && (\n <button\n type=\"button\"\n aria-label={\n collapsed\n ? (locale.expand ?? DEFAULT_LOCALE.expand)\n : (locale.collapse ?? DEFAULT_LOCALE.collapse)\n }\n aria-expanded={!collapsed}\n aria-controls={contentId}\n onClick={onTriggerClick}\n className={cn(\n 'flex w-full shrink-0 items-center justify-center py-2',\n 'cursor-pointer transition-colors hover:bg-black/5',\n classNames?.trigger,\n //\n )}\n >\n {trigger === undefined ? <TriggerIcon className=\"size-4\" /> : trigger}\n </button>\n )}\n </aside>\n );\n};\n\nexport default Sider;\n"],"mappings":";;;;;;;;;AAkBA,MAAM,mBAAiC;CAAC;CAAM;CAAM;CAAM;CAAM;CAAM;AAAK;AAsB3E,MAAM,aAAa,UACjB,OAAO,UAAU,WAAW,GAAG,MAAM,MAAM;AAE7C,MAAM,SAAS,EACb,UACA,WACA,YACA,OACA,QAAQ,KACR,iBAAiB,IACjB,cAAc,OACd,mBAAmB,OACnB,WAAW,YACX,YAAY,QACZ,eAAe,OACf,SACA,YACA,YACA,cACA,GAAG,YACQ;CACX,iBAAiB;CAEjB,MAAM,EAAE,WAAW,UAAU;CAC7B,MAAM,YAAY,MAAM;CACxB,MAAM,CAAC,WAAW,gBAAgB,qBAA8B;EAC9D,OAAO;EACP,cAAc;EACd,UAAU;CACZ,CAAC;CAED,MAAM,EAAE,YAAY,uBAAuB,kBAAkB,EAC3D,UAAU,KACZ,CAAC;CACD,MAAM,SAAS,aACX,iBAAiB,QAAQ,mBAAmB,OAAO,IACnD,iBAAiB,QAAQ,UAAU,IACnC;CAEJ,MAAM,kBAAkB,OAAO,MAAM;CACrC,MAAM,oBAAoB,OAAuB,IAAI;CACrD,MAAM,wBAAwB,OAAO,KAAK;CAC1C,MAAM,kBAAkB,OAAO,YAAY;CAE3C,gBAAgB;EACd,gBAAgB,UAAU;CAC5B,CAAC;CAuBD,gBAAgB;EACd,IAAI,CAAC,YACH;EAGF,gBAAgB,UAAU;EAE1B,IAAI,sBAAsB,SACxB;EAEF,sBAAsB,UAAU;EAEhC,qBAAqB;GACnB,sBAAsB,UAAU;GAEhC,MAAM,gBAAgB,gBAAgB;GAEtC,IAAI,kBAAkB,YAAY,eAChC;GAGF,kBAAkB,UAAU;GAC5B,aAAa,aAAa;GAC1B,gBAAgB,UAAU,aAAa;EACzC,CAAC;CACH,GAAG;EAAC;EAAQ;EAAY;CAAY,CAAC;CAErC,MAAM,uBAAuB;EAC3B,aAAa,CAAC,SAAS;CACzB;CAQA,MAAM,cACJ,eAF4B,kBAAkB,cAAc,YAEtB,gBAAgB;CAExD,OACE,qBAAC,SAAD;EACE,WAAW,GAQT,sDACA,mCAKA,cAAc,WAAW,cACzB,SAEF;EACA,OAAO;GACL,OAAO,UAAU,YAAY,iBAAiB,KAAK;GACnD,GAAG;EACL;EACA,GAAI;EAvBN,UAAA,CAyBE,oBAAC,OAAD;GAAK,IAAI;GAAW,WAAU;GAC3B;EACE,CAAA,GACJ,eAAe,YAAY,QAC1B,oBAAC,UAAD;GACE,MAAK;GACL,cACE,YACK,OAAO,UAAU,eAAe,SAChC,OAAO,YAAY,eAAe;GAEzC,iBAAe,CAAC;GAChB,iBAAe;GACf,SAAS;GACT,WAAW,GACT,yDACA,qDACA,YAAY,OAEd;GAEC,UAAA,YAAY,KAAA,IAAY,oBAAC,aAAD,EAAa,WAAU,SAAU,CAAA,IAAI;EACxD,CAAA,CAEL;;AAEX"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn
|
|
2
|
+
import { cn } from "../../utils.mjs";
|
|
3
3
|
import { DEFAULT_LOCALE, useConfig } from "../../providers/config/context.mjs";
|
|
4
4
|
import Button from "../../Button.mjs";
|
|
5
5
|
import { ArrowLeft } from "lucide-react";
|
|
@@ -31,10 +31,10 @@ const PageHeader = ({ title, subTitle, extra, backIcon, onBack, className, class
|
|
|
31
31
|
className: cn("text-muted-foreground text-sm", classNames?.subTitle),
|
|
32
32
|
children: subTitle
|
|
33
33
|
})]
|
|
34
|
-
}),
|
|
34
|
+
}), extra != null && /* @__PURE__ */ jsx("div", {
|
|
35
35
|
className: cn("shrink-0", classNames?.extra),
|
|
36
|
-
children:
|
|
37
|
-
})
|
|
36
|
+
children: extra
|
|
37
|
+
})]
|
|
38
38
|
})]
|
|
39
39
|
}), children]
|
|
40
40
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-header.mjs","names":[],"sources":["../../../src/components/templates/page-header.tsx"],"sourcesContent":["'use client';\n\nimport { ArrowLeft } from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn
|
|
1
|
+
{"version":3,"file":"page-header.mjs","names":[],"sources":["../../../src/components/templates/page-header.tsx"],"sourcesContent":["'use client';\n\nimport { ArrowLeft } from 'lucide-react';\n\nimport { DEFAULT_LOCALE, useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport Button from '../atoms/button';\n\nexport interface Props extends Omit<React.ComponentProps<'div'>, 'title'> {\n title?: React.ReactNode;\n subTitle?: React.ReactNode;\n extra?: React.ReactNode;\n backIcon?: React.ReactNode;\n onBack?: () => void;\n classNames?: {\n back?: string;\n title?: string;\n subTitle?: string;\n extra?: string;\n };\n}\n\n// Title + back button + extra action area — same shape as Drawer's header\n// (title/extra/closable), which this borrows the layout from wholesale;\n// PageHeader just swaps Drawer's close button for a back button.\nconst PageHeader = ({\n title,\n subTitle,\n extra,\n backIcon,\n onBack,\n className,\n classNames,\n children,\n ...props\n}: Props) => {\n const { locale } = useConfig();\n\n return (\n <div className={cn('flex flex-col gap-2', className)} {...props}>\n <div className=\"flex items-start gap-2\">\n {onBack && (\n <Button\n variant=\"text\"\n shape=\"circle\"\n size=\"small\"\n aria-label={locale.back ?? DEFAULT_LOCALE.back}\n icon={backIcon || <ArrowLeft />}\n onClick={onBack}\n className={cn(classNames?.back)}\n />\n )}\n <div className=\"flex flex-1 items-start justify-between gap-2\">\n <div className=\"flex flex-col gap-0.5\">\n {title && (\n <p className={cn('text-lg font-medium', classNames?.title)}>\n {title}\n </p>\n )}\n {subTitle && (\n <p\n className={cn(\n 'text-muted-foreground text-sm',\n classNames?.subTitle,\n )}\n >\n {subTitle}\n </p>\n )}\n </div>\n {extra != null && (\n <div className={cn('shrink-0', classNames?.extra)}>{extra}</div>\n )}\n </div>\n </div>\n {children}\n </div>\n );\n};\n\nexport default PageHeader;\n"],"mappings":";;;;;;;AA0BA,MAAM,cAAc,EAClB,OACA,UACA,OACA,UACA,QACA,WACA,YACA,UACA,GAAG,YACQ;CACX,MAAM,EAAE,WAAW,UAAU;CAE7B,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,uBAAuB,SAAS;EAAG,GAAI;EAA1D,UAAA,CACE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG,UACC,oBAAC,QAAD;IACE,SAAQ;IACR,OAAM;IACN,MAAK;IACL,cAAY,OAAO,QAAQ,eAAe;IAC1C,MAAM,YAAY,oBAAC,WAAD,CAAY,CAAA;IAC9B,SAAS;IACT,WAAW,GAAG,YAAY,IAAI;GAC/B,CAAA,GAEH,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACG,SACC,oBAAC,KAAD;MAAG,WAAW,GAAG,uBAAuB,YAAY,KAAK;MACtD,UAAA;KACA,CAAA,GAEJ,YACC,oBAAC,KAAD;MACE,WAAW,GACT,iCACA,YAAY,QACd;MAEC,UAAA;KACA,CAAA,CAEF;IACJ,CAAA,GAAA,SAAS,QACR,oBAAC,OAAD;KAAK,WAAW,GAAG,YAAY,YAAY,KAAK;KAAI,UAAA;IAAW,CAAA,CAE9D;GACF,CAAA,CAAA;EACJ,CAAA,GAAA,QACE;;AAET"}
|
package/dist/core/dialog.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
|
3
3
|
import { cn } from "../utils.mjs";
|
|
4
4
|
import { useConfig } from "../providers/config/context.mjs";
|
|
5
5
|
import Button from "../Button.mjs";
|
|
6
|
+
import { OVERLAY_LAYER } from "../lib/z-layers.mjs";
|
|
6
7
|
import "react";
|
|
7
8
|
import { XIcon } from "lucide-react";
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -49,7 +50,7 @@ function DialogOverlay({ className, ...props }) {
|
|
|
49
50
|
"data-slot": "dialog-overlay",
|
|
50
51
|
className: cn(`data-[state=open]:animate-in data-[state=closed]:animate-out
|
|
51
52
|
data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0
|
|
52
|
-
|
|
53
|
+
bg-black/50`, OVERLAY_LAYER, className),
|
|
53
54
|
...props
|
|
54
55
|
});
|
|
55
56
|
}
|
|
@@ -73,10 +74,9 @@ function DialogContent({ className, children, classNames, closeIcon: _closeIcon,
|
|
|
73
74
|
className: cn(`bg-background data-[state=open]:animate-in
|
|
74
75
|
data-[state=closed]:animate-out data-[state=closed]:fade-out-0
|
|
75
76
|
data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95
|
|
76
|
-
data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%]
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
sm:max-w-lg`, className),
|
|
77
|
+
data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] grid w-full
|
|
78
|
+
max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4
|
|
79
|
+
rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg`, OVERLAY_LAYER, className),
|
|
80
80
|
...props,
|
|
81
81
|
children: [children, closable && closeIcon]
|
|
82
82
|
})]
|
package/dist/core/dialog.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.mjs","names":[],"sources":["../../src/core/dialog.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { XIcon } from 'lucide-react';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport Button from '../components/atoms/button';\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n `data-[state=open]:animate-in data-[state=closed]:animate-out\n data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0\n
|
|
1
|
+
{"version":3,"file":"dialog.mjs","names":[],"sources":["../../src/core/dialog.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog';\nimport { XIcon } from 'lucide-react';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport Button from '../components/atoms/button';\nimport { OVERLAY_LAYER } from '../lib/z-layers';\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n return <DialogPrimitive.Root data-slot=\"dialog\" {...props} />;\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n `data-[state=open]:animate-in data-[state=closed]:animate-out\n data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0\n bg-black/50`,\n OVERLAY_LAYER,\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface CustomContentProps {\n classNames?: Record<string, string>;\n closeIcon?: React.ReactNode;\n closable?: boolean | { disabled?: boolean };\n container?: HTMLElement;\n}\n\nfunction DialogContent({\n className,\n children,\n classNames,\n closeIcon: _closeIcon,\n closable,\n container,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & CustomContentProps) {\n const { getContainer } = useConfig();\n const resolvedContainer = container ?? getContainer();\n\n const closeIcon = (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"ring-offset-background focus:ring-ring\n data-[state=open]:bg-accent data-[state=open]:text-muted-foreground\n absolute top-4 right-4 rounded-xs opacity-70 transition-opacity\n hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden\n disabled:pointer-events-none [&_svg]:pointer-events-none\n [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\"\n disabled={typeof closable === 'object' && closable.disabled}\n >\n {_closeIcon || <XIcon />}\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n );\n\n return (\n <DialogPortal data-slot=\"dialog-portal\" container={resolvedContainer}>\n <DialogOverlay className={cn(classNames?.mask)} />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n `bg-background data-[state=open]:animate-in\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95\n data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] grid w-full\n max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4\n rounded-lg border p-6 shadow-lg duration-200 outline-none sm:max-w-lg`,\n OVERLAY_LAYER,\n className,\n )}\n {...props}\n >\n {children}\n {closable && closeIcon}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn('flex flex-col gap-2 text-center sm:text-left', className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({\n className,\n showCloseButton = false,\n children,\n ...props\n}: React.ComponentProps<'div'> & {\n showCloseButton?: boolean;\n}) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n 'flex flex-col-reverse gap-2 sm:flex-row sm:justify-end',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close asChild>\n <Button variant=\"outlined\">Close</Button>\n </DialogPrimitive.Close>\n )}\n </div>\n );\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn('text-lg leading-none font-semibold', className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAaA,SAAS,OAAO,EACd,GAAG,SACiD;CACpD,OAAO,oBAAC,gBAAgB,MAAjB;EAAsB,aAAU;EAAS,GAAI;CAAQ,CAAA;AAC9D;AAEA,SAAS,cAAc,EACrB,GAAG,SACoD;CACvD,OAAO,oBAAC,gBAAgB,SAAjB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAEA,SAAS,aAAa,EACpB,GAAG,SACmD;CACtD,OAAO,oBAAC,gBAAgB,QAAjB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,SAAS,YAAY,EACnB,GAAG,SACkD;CACrD,OAAO,oBAAC,gBAAgB,OAAjB;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;CACvD,OACE,oBAAC,gBAAgB,SAAjB;EACE,aAAU;EACV,WAAW,GACT;;sBAGA,eACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AASA,SAAS,cAAc,EACrB,WACA,UACA,YACA,WAAW,YACX,UACA,WACA,GAAG,SACyE;CAC5E,MAAM,EAAE,iBAAiB,UAAU;CACnC,MAAM,oBAAoB,aAAa,aAAa;CAEpD,MAAM,YACJ,qBAAC,gBAAgB,OAAjB;EACE,aAAU;EACV,WAAU;EAMV,UAAU,OAAO,aAAa,YAAY,SAAS;EARrD,UAAA,CAUG,cAAc,oBAAC,OAAD,CAAQ,CAAA,GACvB,oBAAC,QAAD;GAAM,WAAU;GAAU,UAAA;EAAW,CAAA,CAChB;;CAGzB,OACE,qBAAC,cAAD;EAAc,aAAU;EAAgB,WAAW;EAAnD,UAAA,CACE,oBAAC,eAAD,EAAe,WAAW,GAAG,YAAY,IAAI,EAAI,CAAA,GACjD,qBAAC,gBAAgB,SAAjB;GACE,aAAU;GACV,WAAW,GACT;;;;;kFAMA,eACA,SACF;GACA,GAAI;GAZN,UAAA,CAcG,UACA,YAAY,SACU;EACb,CAAA,CAAA;;AAElB;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,gDAAgD,SAAS;EACvE,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EACpB,WACA,kBAAkB,OAClB,UACA,GAAG,SAGF;CACD,OACE,qBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT,0DACA,SACF;EACA,GAAI;EANN,UAAA,CAQG,UACA,mBACC,oBAAC,gBAAgB,OAAjB;GAAuB,SAAA;GACrB,UAAA,oBAAC,QAAD;IAAQ,SAAQ;IAAW,UAAA;GAAa,CAAA;EACnB,CAAA,CAEtB;;AAET;AAEA,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;CACrD,OACE,oBAAC,gBAAgB,OAAjB;EACE,aAAU;EACV,WAAW,GAAG,sCAAsC,SAAS;EAC7D,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SACwD;CAC3D,OACE,oBAAC,gBAAgB,aAAjB;EACE,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACL,CAAA;AAEL"}
|
package/dist/core/drawer.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
3
3
|
import { cn } from "../utils.mjs";
|
|
4
4
|
import { useConfig } from "../providers/config/context.mjs";
|
|
5
|
+
import { OVERLAY_LAYER } from "../lib/z-layers.mjs";
|
|
5
6
|
import "react";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { Drawer } from "vaul";
|
|
@@ -50,7 +51,7 @@ function DrawerOverlay({ className, ...props }) {
|
|
|
50
51
|
"data-slot": "drawer-overlay",
|
|
51
52
|
className: cn(`data-[state=open]:animate-in data-[state=closed]:animate-out
|
|
52
53
|
data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0
|
|
53
|
-
|
|
54
|
+
bg-black/50`, OVERLAY_LAYER, className),
|
|
54
55
|
...props
|
|
55
56
|
});
|
|
56
57
|
}
|
|
@@ -59,7 +60,7 @@ function DrawerContent({ className, children, classNames = {}, handlebar, mask,
|
|
|
59
60
|
"data-slot": "drawer-portal",
|
|
60
61
|
children: [/* @__PURE__ */ jsx(DrawerOverlay, { className: cn(classNames?.mask || "", !mask && "hidden") }), /* @__PURE__ */ jsxs(Drawer.Content, {
|
|
61
62
|
"data-slot": "drawer-content",
|
|
62
|
-
className: cn("group/drawer-content bg-background fixed
|
|
63
|
+
className: cn("group/drawer-content bg-background fixed flex h-auto flex-col", OVERLAY_LAYER, `data-[vaul-drawer-direction=top]:inset-x-0
|
|
63
64
|
data-[vaul-drawer-direction=top]:top-0
|
|
64
65
|
data-[vaul-drawer-direction=top]:mb-24
|
|
65
66
|
data-[vaul-drawer-direction=top]:max-h-[80vh]
|
package/dist/core/drawer.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.mjs","names":["Drawer","DrawerPrimitive"],"sources":["../../src/core/drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { Drawer as DrawerPrimitive } from 'vaul';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\ninterface CustomProps {\n draggable?: boolean;\n}\n\nfunction Drawer({\n draggable,\n container,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root> & CustomProps) {\n const { getContainer } = useConfig();\n\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n handleOnly={!draggable}\n container={container ?? getContainer()}\n {...props}\n />\n );\n}\n\nfunction DrawerTrigger({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />;\n}\n\nfunction DrawerPortal({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />;\n}\n\nfunction DrawerClose({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Close>) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />;\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot=\"drawer-overlay\"\n className={cn(\n `data-[state=open]:animate-in data-[state=closed]:animate-out\n data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0\n
|
|
1
|
+
{"version":3,"file":"drawer.mjs","names":["Drawer","DrawerPrimitive"],"sources":["../../src/core/drawer.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport { Drawer as DrawerPrimitive } from 'vaul';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { OVERLAY_LAYER } from '../lib/z-layers';\n\ninterface CustomProps {\n draggable?: boolean;\n}\n\nfunction Drawer({\n draggable,\n container,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Root> & CustomProps) {\n const { getContainer } = useConfig();\n\n return (\n <DrawerPrimitive.Root\n data-slot=\"drawer\"\n handleOnly={!draggable}\n container={container ?? getContainer()}\n {...props}\n />\n );\n}\n\nfunction DrawerTrigger({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Trigger>) {\n return <DrawerPrimitive.Trigger data-slot=\"drawer-trigger\" {...props} />;\n}\n\nfunction DrawerPortal({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Portal>) {\n return <DrawerPrimitive.Portal data-slot=\"drawer-portal\" {...props} />;\n}\n\nfunction DrawerClose({\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Close>) {\n return <DrawerPrimitive.Close data-slot=\"drawer-close\" {...props} />;\n}\n\nfunction DrawerOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Overlay>) {\n return (\n <DrawerPrimitive.Overlay\n data-slot=\"drawer-overlay\"\n className={cn(\n `data-[state=open]:animate-in data-[state=closed]:animate-out\n data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0\n bg-black/50`,\n OVERLAY_LAYER,\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface CustomContentProps {\n classNames?: Record<string, string>;\n handlebar?: boolean;\n mask?: boolean;\n}\n\nfunction DrawerContent({\n className,\n children,\n classNames = {},\n handlebar,\n mask,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Content> & CustomContentProps) {\n return (\n <DrawerPortal data-slot=\"drawer-portal\">\n <DrawerOverlay\n className={cn(\n classNames?.mask || '',\n !mask && 'hidden',\n //\n )}\n />\n <DrawerPrimitive.Content\n data-slot=\"drawer-content\"\n className={cn(\n 'group/drawer-content bg-background fixed flex h-auto flex-col',\n OVERLAY_LAYER,\n `data-[vaul-drawer-direction=top]:inset-x-0\n data-[vaul-drawer-direction=top]:top-0\n data-[vaul-drawer-direction=top]:mb-24\n data-[vaul-drawer-direction=top]:max-h-[80vh]\n data-[vaul-drawer-direction=top]:rounded-b-lg\n data-[vaul-drawer-direction=top]:border-b`,\n `data-[vaul-drawer-direction=bottom]:inset-x-0\n data-[vaul-drawer-direction=bottom]:bottom-0\n data-[vaul-drawer-direction=bottom]:mt-24\n data-[vaul-drawer-direction=bottom]:max-h-[80vh]\n data-[vaul-drawer-direction=bottom]:rounded-t-lg\n data-[vaul-drawer-direction=bottom]:border-t`,\n `data-[vaul-drawer-direction=right]:inset-y-0\n data-[vaul-drawer-direction=right]:right-0\n data-[vaul-drawer-direction=right]:w-3/4\n data-[vaul-drawer-direction=right]:border-l\n data-[vaul-drawer-direction=right]:sm:max-w-sm`,\n `data-[vaul-drawer-direction=left]:inset-y-0\n data-[vaul-drawer-direction=left]:left-0\n data-[vaul-drawer-direction=left]:w-3/4\n data-[vaul-drawer-direction=left]:border-r\n data-[vaul-drawer-direction=left]:sm:max-w-sm`,\n className,\n )}\n {...props}\n >\n {handlebar && (\n <div\n className={cn(\n `bg-muted mx-auto mt-4 hidden h-2 w-25 shrink-0 rounded-full\n group-data-[vaul-drawer-direction=bottom]/drawer-content:block`,\n classNames?.handlebar,\n )}\n />\n )}\n {/* <div\n className=\"bg-muted mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full\n group-data-[vaul-drawer-direction=bottom]/drawer-content:block\"\n /> */}\n {children}\n </DrawerPrimitive.Content>\n </DrawerPortal>\n );\n}\n\nfunction DrawerHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-header\"\n className={cn(\n `flex flex-col gap-0.5 p-4\n group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center\n group-data-[vaul-drawer-direction=top]/drawer-content:text-center\n md:gap-1.5 md:text-left`,\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction DrawerFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"drawer-footer\"\n className={cn('mt-auto flex flex-col gap-2 p-4', className)}\n {...props}\n />\n );\n}\n\nfunction DrawerTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Title>) {\n return (\n <DrawerPrimitive.Title\n data-slot=\"drawer-title\"\n className={cn('text-foreground font-semibold', className)}\n {...props}\n />\n );\n}\n\nfunction DrawerDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DrawerPrimitive.Description>) {\n return (\n <DrawerPrimitive.Description\n data-slot=\"drawer-description\"\n className={cn('text-muted-foreground text-sm', className)}\n {...props}\n />\n );\n}\n\nexport {\n Drawer,\n DrawerPortal,\n DrawerOverlay,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,SAASA,SAAO,EACd,WACA,WACA,GAAG,SAC+D;CAClE,MAAM,EAAE,iBAAiB,UAAU;CAEnC,OACE,oBAACC,OAAgB,MAAjB;EACE,aAAU;EACV,YAAY,CAAC;EACb,WAAW,aAAa,aAAa;EACrC,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cAAc,EACrB,GAAG,SACoD;CACvD,OAAO,oBAACA,OAAgB,SAAjB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAEA,SAAS,aAAa,EACpB,GAAG,SACmD;CACtD,OAAO,oBAACA,OAAgB,QAAjB;EAAwB,aAAU;EAAgB,GAAI;CAAQ,CAAA;AACvE;AAEA,SAAS,YAAY,EACnB,GAAG,SACkD;CACrD,OAAO,oBAACA,OAAgB,OAAjB;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;CACvD,OACE,oBAACA,OAAgB,SAAjB;EACE,aAAU;EACV,WAAW,GACT;;sBAGA,eACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAQA,SAAS,cAAc,EACrB,WACA,UACA,aAAa,CAAC,GACd,WACA,MACA,GAAG,SACyE;CAC5E,OACE,qBAAC,cAAD;EAAc,aAAU;EAAxB,UAAA,CACE,oBAAC,eAAD,EACE,WAAW,GACT,YAAY,QAAQ,IACpB,CAAC,QAAQ,QAEX,EACD,CAAA,GACD,qBAACA,OAAgB,SAAjB;GACE,aAAU;GACV,WAAW,GACT,iEACA,eACA;;;;;sDAMA;;;;;yDAMA;;;;2DAKA;;;;0DAKA,SACF;GACA,GAAI;GA7BN,UAAA,CA+BG,aACC,oBAAC,OAAD,EACE,WAAW,GACT;+EAEA,YAAY,SACd,EACD,CAAA,GAMF,QACsB;EACb,CAAA,CAAA;;AAElB;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GACT;;;kCAIA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAsC;CAC1E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,mCAAmC,SAAS;EAC1D,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;CACrD,OACE,oBAACA,OAAgB,OAAjB;EACE,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SACwD;CAC3D,OACE,oBAACA,OAAgB,aAAjB;EACE,aAAU;EACV,WAAW,GAAG,iCAAiC,SAAS;EACxD,GAAI;CACL,CAAA;AAEL"}
|
package/dist/core/popover.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
3
3
|
import { cn } from "../utils.mjs";
|
|
4
4
|
import { useConfig } from "../providers/config/context.mjs";
|
|
5
|
+
import { OVERLAY_LAYER } from "../lib/z-layers.mjs";
|
|
5
6
|
import "react";
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
@@ -41,9 +42,9 @@ function PopoverContent({ className, align = "center", sideOffset = 4, container
|
|
|
41
42
|
data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2
|
|
42
43
|
data-[side=left]:slide-in-from-right-2
|
|
43
44
|
data-[side=right]:slide-in-from-left-2
|
|
44
|
-
data-[side=top]:slide-in-from-bottom-2
|
|
45
|
+
data-[side=top]:slide-in-from-bottom-2 w-72
|
|
45
46
|
origin-(--radix-popover-content-transform-origin) rounded-md border
|
|
46
|
-
p-4 shadow-md outline-hidden`, className),
|
|
47
|
+
p-4 shadow-md outline-hidden`, OVERLAY_LAYER, className),
|
|
47
48
|
...props
|
|
48
49
|
})
|
|
49
50
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.mjs","names":[],"sources":["../../src/core/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\nfunction PopoverTrigger({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n sideOffset = 4,\n container,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content> & {\n container?: HTMLElement;\n}) {\n const { getContainer } = useConfig();\n\n return (\n <PopoverPrimitive.Portal container={container ?? getContainer()}>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n `bg-popover text-popover-foreground data-[state=open]:animate-in\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95\n data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2
|
|
1
|
+
{"version":3,"file":"popover.mjs","names":[],"sources":["../../src/core/popover.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as PopoverPrimitive from '@radix-ui/react-popover';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { OVERLAY_LAYER } from '../lib/z-layers';\n\nfunction Popover({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Root>) {\n return <PopoverPrimitive.Root data-slot=\"popover\" {...props} />;\n}\n\nfunction PopoverTrigger({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {\n return <PopoverPrimitive.Trigger data-slot=\"popover-trigger\" {...props} />;\n}\n\nfunction PopoverContent({\n className,\n align = 'center',\n sideOffset = 4,\n container,\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Content> & {\n container?: HTMLElement;\n}) {\n const { getContainer } = useConfig();\n\n return (\n <PopoverPrimitive.Portal container={container ?? getContainer()}>\n <PopoverPrimitive.Content\n data-slot=\"popover-content\"\n align={align}\n sideOffset={sideOffset}\n className={cn(\n `bg-popover text-popover-foreground data-[state=open]:animate-in\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95\n data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2 w-72\n origin-(--radix-popover-content-transform-origin) rounded-md border\n p-4 shadow-md outline-hidden`,\n OVERLAY_LAYER,\n className,\n )}\n {...props}\n />\n </PopoverPrimitive.Portal>\n );\n}\n\nfunction PopoverAnchor({\n ...props\n}: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {\n return <PopoverPrimitive.Anchor data-slot=\"popover-anchor\" {...props} />;\n}\n\nfunction PopoverHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"popover-header\"\n className={cn('flex flex-col gap-1 text-sm', className)}\n {...props}\n />\n );\n}\n\nfunction PopoverTitle({ className, ...props }: React.ComponentProps<'h2'>) {\n return (\n <div\n data-slot=\"popover-title\"\n className={cn('font-medium', className)}\n {...props}\n />\n );\n}\n\nfunction PopoverDescription({\n className,\n ...props\n}: React.ComponentProps<'p'>) {\n return (\n <p\n data-slot=\"popover-description\"\n className={cn('text-muted-foreground', className)}\n {...props}\n />\n );\n}\n\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n PopoverHeader,\n PopoverTitle,\n PopoverDescription,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAWA,SAAS,QAAQ,EACf,GAAG,SACkD;CACrD,OAAO,oBAAC,iBAAiB,MAAlB;EAAuB,aAAU;EAAU,GAAI;CAAQ,CAAA;AAChE;AAEA,SAAS,eAAe,EACtB,GAAG,SACqD;CACxD,OAAO,oBAAC,iBAAiB,SAAlB;EAA0B,aAAU;EAAkB,GAAI;CAAQ,CAAA;AAC3E;AAEA,SAAS,eAAe,EACtB,WACA,QAAQ,UACR,aAAa,GACb,WACA,GAAG,SAGF;CACD,MAAM,EAAE,iBAAiB,UAAU;CAEnC,OACE,oBAAC,iBAAiB,QAAlB;EAAyB,WAAW,aAAa,aAAa;EAC5D,UAAA,oBAAC,iBAAiB,SAAlB;GACE,aAAU;GACH;GACK;GACZ,WAAW,GACT;;;;;;;;yCASA,eACA,SACF;GACA,GAAI;EACL,CAAA;CACsB,CAAA;AAE7B;AAEA,SAAS,cAAc,EACrB,GAAG,SACoD;CACvD,OAAO,oBAAC,iBAAiB,QAAlB;EAAyB,aAAU;EAAiB,GAAI;CAAQ,CAAA;AACzE;AAEA,SAAS,cAAc,EAAE,WAAW,GAAG,SAAsC;CAC3E,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,+BAA+B,SAAS;EACtD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EAAE,WAAW,GAAG,SAAqC;CACzE,OACE,oBAAC,OAAD;EACE,aAAU;EACV,WAAW,GAAG,eAAe,SAAS;EACtC,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,mBAAmB,EAC1B,WACA,GAAG,SACyB;CAC5B,OACE,oBAAC,KAAD;EACE,aAAU;EACV,WAAW,GAAG,yBAAyB,SAAS;EAChD,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.mts","names":[],"sources":["../../src/core/select.tsx"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"select.d.mts","names":[],"sources":["../../src/core/select.tsx"],"mappings":";;;iBAYS,YACJ,SACF,QAAM,sBAAsB,gBAAgB,QAAK,QAAA,IAAA"}
|
package/dist/core/select.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { __exportAll } from "../_virtual/_rolldown/runtime.mjs";
|
|
3
3
|
import { cn } from "../utils.mjs";
|
|
4
4
|
import { useConfig } from "../providers/config/context.mjs";
|
|
5
|
+
import { OVERLAY_LAYER } from "../lib/z-layers.mjs";
|
|
5
6
|
import "react";
|
|
6
7
|
import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from "lucide-react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -73,10 +74,10 @@ function SelectContent({ className, children, position = "item-aligned", align =
|
|
|
73
74
|
data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2
|
|
74
75
|
data-[side=left]:slide-in-from-right-2
|
|
75
76
|
data-[side=right]:slide-in-from-left-2
|
|
76
|
-
data-[side=top]:slide-in-from-bottom-2 relative
|
|
77
|
+
data-[side=top]:slide-in-from-bottom-2 relative
|
|
77
78
|
max-h-(--radix-select-content-available-height) min-w-[8rem]
|
|
78
79
|
origin-(--radix-select-content-transform-origin) overflow-x-hidden
|
|
79
|
-
overflow-y-auto rounded-md border shadow-md`, position === "popper" && `data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1
|
|
80
|
+
overflow-y-auto rounded-md border shadow-md`, OVERLAY_LAYER, position === "popper" && `data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1
|
|
80
81
|
data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`, className),
|
|
81
82
|
position,
|
|
82
83
|
align,
|
package/dist/core/select.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.mjs","names":[],"sources":["../../src/core/select.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nfunction Select({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />;\n}\n\nfunction SelectGroup({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectValue({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />;\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default';\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n `border-input data-[placeholder]:text-muted-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground\n focus-visible:border-ring focus-visible:ring-ring/50\n aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\n aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50\n flex w-fit items-center justify-between gap-2 rounded-md border\n bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs\n transition-[color,box-shadow] outline-none focus-visible:ring-[3px]\n disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9\n data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1\n *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center\n *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none\n [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon className=\"size-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction SelectContent({\n className,\n children,\n position = 'item-aligned',\n align = 'center',\n container,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content> & {\n container?: HTMLElement;\n}) {\n const { getContainer } = useConfig();\n\n return (\n <SelectPrimitive.Portal container={container ?? getContainer()}>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n `bg-popover text-popover-foreground data-[state=open]:animate-in\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95\n data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2 relative
|
|
1
|
+
{"version":3,"file":"select.mjs","names":[],"sources":["../../src/core/select.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nimport * as SelectPrimitive from '@radix-ui/react-select';\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport { OVERLAY_LAYER } from '../lib/z-layers';\n\nfunction Select({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Root>) {\n return <SelectPrimitive.Root data-slot=\"select\" {...props} />;\n}\n\nfunction SelectGroup({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Group>) {\n return <SelectPrimitive.Group data-slot=\"select-group\" {...props} />;\n}\n\nfunction SelectValue({\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Value>) {\n return <SelectPrimitive.Value data-slot=\"select-value\" {...props} />;\n}\n\nfunction SelectTrigger({\n className,\n size = 'default',\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n size?: 'sm' | 'default';\n}) {\n return (\n <SelectPrimitive.Trigger\n data-slot=\"select-trigger\"\n data-size={size}\n className={cn(\n `border-input data-[placeholder]:text-muted-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground\n focus-visible:border-ring focus-visible:ring-ring/50\n aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40\n aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50\n flex w-fit items-center justify-between gap-2 rounded-md border\n bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs\n transition-[color,box-shadow] outline-none focus-visible:ring-[3px]\n disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9\n data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1\n *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center\n *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none\n [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,\n className,\n )}\n {...props}\n >\n {children}\n <SelectPrimitive.Icon asChild>\n <ChevronDownIcon className=\"size-4 opacity-50\" />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n );\n}\n\nfunction SelectContent({\n className,\n children,\n position = 'item-aligned',\n align = 'center',\n container,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Content> & {\n container?: HTMLElement;\n}) {\n const { getContainer } = useConfig();\n\n return (\n <SelectPrimitive.Portal container={container ?? getContainer()}>\n <SelectPrimitive.Content\n data-slot=\"select-content\"\n className={cn(\n `bg-popover text-popover-foreground data-[state=open]:animate-in\n data-[state=closed]:animate-out data-[state=closed]:fade-out-0\n data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95\n data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2\n data-[side=left]:slide-in-from-right-2\n data-[side=right]:slide-in-from-left-2\n data-[side=top]:slide-in-from-bottom-2 relative\n max-h-(--radix-select-content-available-height) min-w-[8rem]\n origin-(--radix-select-content-transform-origin) overflow-x-hidden\n overflow-y-auto rounded-md border shadow-md`,\n OVERLAY_LAYER,\n position === 'popper' &&\n `data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1\n data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,\n className,\n )}\n position={position}\n align={align}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\n 'p-1',\n position === 'popper' &&\n `h-[var(--radix-select-trigger-height)] w-full\n min-w-[var(--radix-select-trigger-width)] scroll-my-1`,\n )}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n}\n\nfunction SelectLabel({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n data-slot=\"select-label\"\n className={cn('text-muted-foreground px-2 py-1.5 text-xs', className)}\n {...props}\n />\n );\n}\n\nfunction SelectItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Item>) {\n return (\n <SelectPrimitive.Item\n data-slot=\"select-item\"\n className={cn(\n `focus:bg-accent focus:text-accent-foreground\n [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full\n cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm\n outline-hidden select-none data-[disabled]:pointer-events-none\n data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0\n [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex\n *:[span]:last:items-center *:[span]:last:gap-2`,\n className,\n )}\n {...props}\n >\n <span\n data-slot=\"select-item-indicator\"\n className=\"absolute right-2 flex size-3.5 items-center justify-center\"\n >\n <SelectPrimitive.ItemIndicator>\n <CheckIcon className=\"size-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n}\n\nfunction SelectSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator\n data-slot=\"select-separator\"\n className={cn('bg-border pointer-events-none -mx-1 my-1 h-px', className)}\n {...props}\n />\n );\n}\n\nfunction SelectScrollUpButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollUpButton>) {\n return (\n <SelectPrimitive.ScrollUpButton\n data-slot=\"select-scroll-up-button\"\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className,\n )}\n {...props}\n >\n <ChevronUpIcon className=\"size-4\" />\n </SelectPrimitive.ScrollUpButton>\n );\n}\n\nfunction SelectScrollDownButton({\n className,\n ...props\n}: React.ComponentProps<typeof SelectPrimitive.ScrollDownButton>) {\n return (\n <SelectPrimitive.ScrollDownButton\n data-slot=\"select-scroll-down-button\"\n className={cn(\n 'flex cursor-default items-center justify-center py-1',\n className,\n )}\n {...props}\n >\n <ChevronDownIcon className=\"size-4\" />\n </SelectPrimitive.ScrollDownButton>\n );\n}\n\nexport {\n Select,\n SelectContent,\n SelectGroup,\n SelectItem,\n SelectLabel,\n SelectScrollDownButton,\n SelectScrollUpButton,\n SelectSeparator,\n SelectTrigger,\n SelectValue,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,OAAO,EACd,GAAG,SACiD;CACpD,OAAO,oBAAC,gBAAgB,MAAjB;EAAsB,aAAU;EAAS,GAAI;CAAQ,CAAA;AAC9D;AAEA,SAAS,YAAY,EACnB,GAAG,SACkD;CACrD,OAAO,oBAAC,gBAAgB,OAAjB;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,YAAY,EACnB,GAAG,SACkD;CACrD,OAAO,oBAAC,gBAAgB,OAAjB;EAAuB,aAAU;EAAe,GAAI;CAAQ,CAAA;AACrE;AAEA,SAAS,cAAc,EACrB,WACA,OAAO,WACP,UACA,GAAG,SAGF;CACD,OACE,qBAAC,gBAAgB,SAAjB;EACE,aAAU;EACV,aAAW;EACX,WAAW,GACT;;;;;;;;;;;;gEAaA,SACF;EACA,GAAI;EAnBN,UAAA,CAqBG,UACD,oBAAC,gBAAgB,MAAjB;GAAsB,SAAA;GACpB,UAAA,oBAAC,iBAAD,EAAiB,WAAU,oBAAqB,CAAA;EAC5B,CAAA,CACC;;AAE7B;AAEA,SAAS,cAAc,EACrB,WACA,UACA,WAAW,gBACX,QAAQ,UACR,WACA,GAAG,SAGF;CACD,MAAM,EAAE,iBAAiB,UAAU;CAEnC,OACE,oBAAC,gBAAgB,QAAjB;EAAwB,WAAW,aAAa,aAAa;EAC3D,UAAA,qBAAC,gBAAgB,SAAjB;GACE,aAAU;GACV,WAAW,GACT;;;;;;;;;wDAUA,eACA,aAAa,YACX;6EAEF,SACF;GACU;GACH;GACP,GAAI;GArBN,UAAA;IAuBE,oBAAC,sBAAD,CAAuB,CAAA;IACvB,oBAAC,gBAAgB,UAAjB;KACE,WAAW,GACT,OACA,aAAa,YACX;oEAEJ;KAEC;IACuB,CAAA;IAC1B,oBAAC,wBAAD,CAAyB,CAAA;GACF;;CACH,CAAA;AAE5B;AAEA,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;CACrD,OACE,oBAAC,gBAAgB,OAAjB;EACE,aAAU;EACV,WAAW,GAAG,6CAA6C,SAAS;EACpE,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAClB,WACA,UACA,GAAG,SACiD;CACpD,OACE,qBAAC,gBAAgB,MAAjB;EACE,aAAU;EACV,WAAW,GACT;;;;;;yDAOA,SACF;EACA,GAAI;EAZN,UAAA,CAcE,oBAAC,QAAD;GACE,aAAU;GACV,WAAU;GAEV,UAAA,oBAAC,gBAAgB,eAAjB,EAAA,UACE,oBAAC,WAAD,EAAW,WAAU,SAAU,CAAA,EACF,CAAA;EAC3B,CAAA,GACN,oBAAC,gBAAgB,UAAjB,EAA2B,SAAmC,CAAA,CAC1C;;AAE1B;AAEA,SAAS,gBAAgB,EACvB,WACA,GAAG,SACsD;CACzD,OACE,oBAAC,gBAAgB,WAAjB;EACE,aAAU;EACV,WAAW,GAAG,iDAAiD,SAAS;EACxE,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,qBAAqB,EAC5B,WACA,GAAG,SAC2D;CAC9D,OACE,oBAAC,gBAAgB,gBAAjB;EACE,aAAU;EACV,WAAW,GACT,wDACA,SACF;EACA,GAAI;EAEJ,UAAA,oBAAC,eAAD,EAAe,WAAU,SAAU,CAAA;CACL,CAAA;AAEpC;AAEA,SAAS,uBAAuB,EAC9B,WACA,GAAG,SAC6D;CAChE,OACE,oBAAC,gBAAgB,kBAAjB;EACE,aAAU;EACV,WAAW,GACT,wDACA,SACF;EACA,GAAI;EAEJ,UAAA,oBAAC,iBAAD,EAAiB,WAAU,SAAU,CAAA;CACL,CAAA;AAEtC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/lib/z-layers.ts
|
|
2
|
+
/**
|
|
3
|
+
* The single stacking layer every floating/overlay primitive in this library
|
|
4
|
+
* shares — dialog and drawer (mask + content), popover, select, dropdown,
|
|
5
|
+
* float button, and `Layout.Header`.
|
|
6
|
+
*
|
|
7
|
+
* **They are all deliberately equal.** Nothing here ranks against anything else
|
|
8
|
+
* here by z-index; relative order falls out of DOM order, which is what puts a
|
|
9
|
+
* Select popup above the Drawer it was opened from (Radix appends each portal to
|
|
10
|
+
* `body` as it opens) and a Drawer above `Layout.Header`. Give one of them a
|
|
11
|
+
* different value and those pairs silently invert. `Modal.confirm` and the
|
|
12
|
+
* imperative `Toast`/`Modal` stack roots sit above this on purpose (`z-10000` /
|
|
13
|
+
* `zIndex = '10000'`), so an imperative confirm opened from inside a declarative
|
|
14
|
+
* Modal still lands on top.
|
|
15
|
+
*
|
|
16
|
+
* **Why 1000 and not shadcn's default of 50.** 50 assumes you own the whole app
|
|
17
|
+
* and keep its chrome below that. This package is published, so it doesn't get
|
|
18
|
+
* that assumption: Infima (Docusaurus) puts its navbar at `--ifm-z-index-fixed: 200`
|
|
19
|
+
* and its own overlay at 400, so on this repo's own docs site a right-anchored
|
|
20
|
+
* Drawer had its top 60px — the entire header, title and close button — painted
|
|
21
|
+
* under the navbar. It still hit-tested fine, because vaul/Radix mark outside
|
|
22
|
+
* content `pointer-events: none` while a modal is open, so the close button was
|
|
23
|
+
* clickable but invisible. 1000 clears Infima's whole scale and sits in the band
|
|
24
|
+
* every major library reserves for modals (antd 1000, Bootstrap 1055, MUI 1300).
|
|
25
|
+
*
|
|
26
|
+
* Retune per call site with `className` / `classNames.mask` — both land after
|
|
27
|
+
* this in `cn()`, so `tailwind-merge` lets them win.
|
|
28
|
+
*/
|
|
29
|
+
const OVERLAY_LAYER = "z-1000";
|
|
30
|
+
//#endregion
|
|
31
|
+
export { OVERLAY_LAYER };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=z-layers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"z-layers.mjs","names":[],"sources":["../../src/lib/z-layers.ts"],"sourcesContent":["/**\n * The single stacking layer every floating/overlay primitive in this library\n * shares — dialog and drawer (mask + content), popover, select, dropdown,\n * float button, and `Layout.Header`.\n *\n * **They are all deliberately equal.** Nothing here ranks against anything else\n * here by z-index; relative order falls out of DOM order, which is what puts a\n * Select popup above the Drawer it was opened from (Radix appends each portal to\n * `body` as it opens) and a Drawer above `Layout.Header`. Give one of them a\n * different value and those pairs silently invert. `Modal.confirm` and the\n * imperative `Toast`/`Modal` stack roots sit above this on purpose (`z-10000` /\n * `zIndex = '10000'`), so an imperative confirm opened from inside a declarative\n * Modal still lands on top.\n *\n * **Why 1000 and not shadcn's default of 50.** 50 assumes you own the whole app\n * and keep its chrome below that. This package is published, so it doesn't get\n * that assumption: Infima (Docusaurus) puts its navbar at `--ifm-z-index-fixed: 200`\n * and its own overlay at 400, so on this repo's own docs site a right-anchored\n * Drawer had its top 60px — the entire header, title and close button — painted\n * under the navbar. It still hit-tested fine, because vaul/Radix mark outside\n * content `pointer-events: none` while a modal is open, so the close button was\n * clickable but invisible. 1000 clears Infima's whole scale and sits in the band\n * every major library reserves for modals (antd 1000, Bootstrap 1055, MUI 1300).\n *\n * Retune per call site with `className` / `classNames.mask` — both land after\n * this in `cn()`, so `tailwind-merge` lets them win.\n */\nexport const OVERLAY_LAYER = 'z-1000';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAa,gBAAgB"}
|
package/dist/style.css
CHANGED
|
@@ -367,6 +367,9 @@
|
|
|
367
367
|
.z-50 {
|
|
368
368
|
z-index: 50;
|
|
369
369
|
}
|
|
370
|
+
.z-1000 {
|
|
371
|
+
z-index: 1000;
|
|
372
|
+
}
|
|
370
373
|
.z-10000 {
|
|
371
374
|
z-index: 10000;
|
|
372
375
|
}
|
|
@@ -1560,6 +1563,10 @@
|
|
|
1560
1563
|
--tw-blur: blur(8px);
|
|
1561
1564
|
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
1562
1565
|
}
|
|
1566
|
+
.invert {
|
|
1567
|
+
--tw-invert: invert(100%);
|
|
1568
|
+
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
1569
|
+
}
|
|
1563
1570
|
.filter {
|
|
1564
1571
|
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
1565
1572
|
}
|
package/dist/utils.d.mts
CHANGED
|
@@ -2,6 +2,18 @@ import * as React$1 from "react";
|
|
|
2
2
|
import { ClassValue } from "clsx";
|
|
3
3
|
//#region src/lib/utils/index.d.ts
|
|
4
4
|
declare const cn: (...inputs: ClassValue[]) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Renders a slot value, applying `wrapper` only to values that aren't already
|
|
7
|
+
* a React element. Passing an element opts out of the wrapper entirely.
|
|
8
|
+
*
|
|
9
|
+
* **Only use this for content slots where that opt-out is the point** — a
|
|
10
|
+
* `title` the caller may want to supply as their own heading, so we don't end
|
|
11
|
+
* up nesting `<h6><h3>`. Do *not* use it for a wrapper that carries layout the
|
|
12
|
+
* component owns (padding, `shrink-0`, a footer bar): the common case is an
|
|
13
|
+
* element, so the wrapper would be skipped exactly when it's needed, and any
|
|
14
|
+
* `classNames.*` threaded through it would silently do nothing. Write those as
|
|
15
|
+
* a plain `{value != null && <Wrapper>{value}</Wrapper>}`.
|
|
16
|
+
*/
|
|
5
17
|
declare const renderConditional: <T extends React$1.ReactNode>(value: T, wrapper?: (value: NonNullable<T>) => React$1.ReactNode) => React$1.ReactNode;
|
|
6
18
|
//#endregion
|
|
7
19
|
export { cn, renderConditional };
|
package/dist/utils.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.mts","names":[],"sources":["../src/lib/utils/index.ts"],"mappings":";;;cAKa,QAAS,QAAQ
|
|
1
|
+
{"version":3,"file":"utils.d.mts","names":[],"sources":["../src/lib/utils/index.ts"],"mappings":";;;cAKa,QAAS,QAAQ;;;;;;;;;;;;;cAgBjB,oBAAqB,UAAU,QAAM,WAChD,OAAO,GACP,WAAW,OAAO,YAAY,OAAO,QAAM,cAC1C,QAAM"}
|
package/dist/utils.mjs
CHANGED
|
@@ -5,6 +5,18 @@ import { twMerge } from "tailwind-merge";
|
|
|
5
5
|
const cn = (...inputs) => {
|
|
6
6
|
return twMerge(clsx(inputs));
|
|
7
7
|
};
|
|
8
|
+
/**
|
|
9
|
+
* Renders a slot value, applying `wrapper` only to values that aren't already
|
|
10
|
+
* a React element. Passing an element opts out of the wrapper entirely.
|
|
11
|
+
*
|
|
12
|
+
* **Only use this for content slots where that opt-out is the point** — a
|
|
13
|
+
* `title` the caller may want to supply as their own heading, so we don't end
|
|
14
|
+
* up nesting `<h6><h3>`. Do *not* use it for a wrapper that carries layout the
|
|
15
|
+
* component owns (padding, `shrink-0`, a footer bar): the common case is an
|
|
16
|
+
* element, so the wrapper would be skipped exactly when it's needed, and any
|
|
17
|
+
* `classNames.*` threaded through it would silently do nothing. Write those as
|
|
18
|
+
* a plain `{value != null && <Wrapper>{value}</Wrapper>}`.
|
|
19
|
+
*/
|
|
8
20
|
const renderConditional = (value, wrapper) => {
|
|
9
21
|
if (value === null || value === void 0) return null;
|
|
10
22
|
if (React$1.isValidElement(value)) return value;
|
package/dist/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":["React"],"sources":["../src/lib/utils/index.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport const cn = (...inputs: ClassValue[]) => {\n return twMerge(clsx(inputs));\n};\n\nexport const renderConditional = <T extends React.ReactNode>(\n value: T,\n wrapper?: (value: NonNullable<T>) => React.ReactNode,\n): React.ReactNode => {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (React.isValidElement(value)) {\n return value;\n }\n\n return wrapper ? wrapper(value as NonNullable<T>) : value;\n};\n"],"mappings":";;;;AAKA,MAAa,MAAM,GAAG,WAAyB;CAC7C,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":["React"],"sources":["../src/lib/utils/index.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport const cn = (...inputs: ClassValue[]) => {\n return twMerge(clsx(inputs));\n};\n\n/**\n * Renders a slot value, applying `wrapper` only to values that aren't already\n * a React element. Passing an element opts out of the wrapper entirely.\n *\n * **Only use this for content slots where that opt-out is the point** — a\n * `title` the caller may want to supply as their own heading, so we don't end\n * up nesting `<h6><h3>`. Do *not* use it for a wrapper that carries layout the\n * component owns (padding, `shrink-0`, a footer bar): the common case is an\n * element, so the wrapper would be skipped exactly when it's needed, and any\n * `classNames.*` threaded through it would silently do nothing. Write those as\n * a plain `{value != null && <Wrapper>{value}</Wrapper>}`.\n */\nexport const renderConditional = <T extends React.ReactNode>(\n value: T,\n wrapper?: (value: NonNullable<T>) => React.ReactNode,\n): React.ReactNode => {\n if (value === null || value === undefined) {\n return null;\n }\n\n if (React.isValidElement(value)) {\n return value;\n }\n\n return wrapper ? wrapper(value as NonNullable<T>) : value;\n};\n"],"mappings":";;;;AAKA,MAAa,MAAM,GAAG,WAAyB;CAC7C,OAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;;;;;;;;;;;AAcA,MAAa,qBACX,OACA,YACoB;CACpB,IAAI,UAAU,QAAQ,UAAU,KAAA,GAC9B,OAAO;CAGT,IAAIA,QAAM,eAAe,KAAK,GAC5B,OAAO;CAGT,OAAO,UAAU,QAAQ,KAAuB,IAAI;AACtD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbpark/ui-kit",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "Modern React UI component library built with TypeScript, Tailwind CSS, and Radix UI. Featuring atoms, molecules, organisms and layout templates for building beautiful interfaces.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|