pelatform-ui 1.2.9 → 1.3.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.
@@ -0,0 +1,22 @@
1
+ "use client";
2
+
3
+ // src/hooks/use-is-mobile.ts
4
+ import * as React from "react";
5
+ var DEFAULT_MOBILE_BREAKPOINT = 1024;
6
+ function useIsMobile(breakpoint = DEFAULT_MOBILE_BREAKPOINT) {
7
+ const [isMobile, setIsMobile] = React.useState(void 0);
8
+ React.useEffect(() => {
9
+ const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
10
+ const onChange = () => {
11
+ setIsMobile(window.innerWidth < breakpoint);
12
+ };
13
+ mql.addEventListener("change", onChange);
14
+ setIsMobile(window.innerWidth < breakpoint);
15
+ return () => mql.removeEventListener("change", onChange);
16
+ }, [breakpoint]);
17
+ return !!isMobile;
18
+ }
19
+
20
+ export {
21
+ useIsMobile
22
+ };
@@ -0,0 +1,59 @@
1
+ "use client";
2
+
3
+ // src/ui/base/scroll-area.tsx
4
+ import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
5
+ import { cn } from "@pelatform/utils";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ function ScrollArea({ className, children, ...props }) {
8
+ return /* @__PURE__ */ jsxs(
9
+ ScrollAreaPrimitive.Root,
10
+ {
11
+ "data-slot": "scroll-area",
12
+ className: cn("cn-scroll-area relative", className),
13
+ ...props,
14
+ children: [
15
+ /* @__PURE__ */ jsx(
16
+ ScrollAreaPrimitive.Viewport,
17
+ {
18
+ "data-slot": "scroll-area-viewport",
19
+ className: "cn-scroll-area-viewport size-full rounded-[inherit] outline-none transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] focus-visible:ring-ring/50",
20
+ children
21
+ }
22
+ ),
23
+ /* @__PURE__ */ jsx(ScrollBar, {}),
24
+ /* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
25
+ ]
26
+ }
27
+ );
28
+ }
29
+ function ScrollBar({
30
+ className,
31
+ orientation = "vertical",
32
+ ...props
33
+ }) {
34
+ return /* @__PURE__ */ jsx(
35
+ ScrollAreaPrimitive.Scrollbar,
36
+ {
37
+ "data-slot": "scroll-area-scrollbar",
38
+ "data-orientation": orientation,
39
+ orientation,
40
+ className: cn(
41
+ "cn-scroll-area-scrollbar flex touch-none select-none p-px transition-colors",
42
+ className
43
+ ),
44
+ ...props,
45
+ children: /* @__PURE__ */ jsx(
46
+ ScrollAreaPrimitive.Thumb,
47
+ {
48
+ "data-slot": "scroll-area-thumb",
49
+ className: "cn-scroll-area-thumb relative flex-1 bg-border"
50
+ }
51
+ )
52
+ }
53
+ );
54
+ }
55
+
56
+ export {
57
+ ScrollArea,
58
+ ScrollBar
59
+ };