@yuno-payments/dashboard-design-system 0.0.96 → 0.0.98

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.
@@ -3,7 +3,7 @@ import { ComponentProps, ChangeEvent } from 'react';
3
3
  /**
4
4
  * Props for the Switch component
5
5
  */
6
- export interface SwitchProps extends Omit<ComponentProps<typeof ShadcnSwitch>, "children" | "onCheckedChange"> {
6
+ export interface SwitchProps extends Omit<ComponentProps<typeof ShadcnSwitch>, "children" | "onCheckedChange" | "className" | "onChange"> {
7
7
  /**
8
8
  * Label text displayed next to the switch
9
9
  */
@@ -29,6 +29,14 @@ export interface SwitchProps extends Omit<ComponentProps<typeof ShadcnSwitch>, "
29
29
  * Provides a synthetic ChangeEvent compatible with react-hook-form
30
30
  */
31
31
  onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
32
+ /**
33
+ * Additional CSS classes to apply to the wrapper container
34
+ */
35
+ className?: string;
36
+ /**
37
+ * Additional CSS classes to apply to the switch element itself
38
+ */
39
+ switchClassName?: string;
32
40
  }
33
41
  /**
34
42
  * Toggle switch component with label and optional description.
@@ -1,20 +1,22 @@
1
1
  import { j as e } from "../../../_virtual/jsx-runtime.js";
2
- import { Switch as u } from "../../../vendor/shadcn/switch.js";
3
- import { forwardRef as g, useId as w } from "react";
4
- import { cn as b } from "../../../lib/utils.js";
5
- import { Label as j } from "../../../vendor/shadcn/label.js";
6
- const v = g(
2
+ import { Switch as b } from "../../../vendor/shadcn/switch.js";
3
+ import { forwardRef as j, useId as v } from "react";
4
+ import { cn as n } from "../../../lib/utils.js";
5
+ import { Label as y } from "../../../vendor/shadcn/label.js";
6
+ const N = j(
7
7
  ({
8
- label: n,
8
+ label: i,
9
9
  description: o,
10
- side: i = "left",
11
- variant: l = "default",
12
- id: c,
10
+ side: l = "left",
11
+ variant: c = "default",
12
+ id: x,
13
13
  name: t,
14
14
  onChange: a,
15
- ...x
16
- }, f) => {
17
- const m = w(), r = c || t || m, p = (s) => {
15
+ className: f,
16
+ switchClassName: m,
17
+ ...p
18
+ }, d) => {
19
+ const h = v(), r = x || t || h, u = (s) => {
18
20
  if (!a) return;
19
21
  a({
20
22
  target: {
@@ -34,29 +36,29 @@ const v = g(
34
36
  stopPropagation: () => {
35
37
  }
36
38
  });
37
- }, d = /* @__PURE__ */ e.jsx(
38
- u,
39
+ }, g = /* @__PURE__ */ e.jsx(
40
+ b,
39
41
  {
40
- ref: f,
42
+ ref: d,
41
43
  id: r,
42
44
  name: t,
43
- className: "cursor-pointer",
44
- onCheckedChange: p,
45
- ...x
45
+ className: n("cursor-pointer", m),
46
+ onCheckedChange: u,
47
+ ...p
46
48
  }
47
- ), h = b("flex gap-3 items-start", {
48
- "flex-row-reverse": i === "right",
49
- "bg-white box-border justify-start p-4 rounded-lg border shadow-xs": l === "box"
50
- });
51
- return /* @__PURE__ */ e.jsxs("div", { className: h, children: [
52
- d,
49
+ ), w = n("flex gap-3 items-start", {
50
+ "flex-row-reverse": l === "right",
51
+ "bg-white box-border justify-start p-4 rounded-lg border shadow-xs": c === "box"
52
+ }, f);
53
+ return /* @__PURE__ */ e.jsxs("div", { className: w, children: [
54
+ g,
53
55
  /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2 flex-1", children: [
54
56
  /* @__PURE__ */ e.jsx(
55
- j,
57
+ y,
56
58
  {
57
59
  htmlFor: r,
58
60
  className: "text-sm leading-[18.39px] cursor-pointer",
59
- children: n
61
+ children: i
60
62
  }
61
63
  ),
62
64
  o && /* @__PURE__ */ e.jsx("p", { className: "text-sm text-neutral-500", children: o })
@@ -64,7 +66,7 @@ const v = g(
64
66
  ] });
65
67
  }
66
68
  );
67
- v.displayName = "Switch";
69
+ N.displayName = "Switch";
68
70
  export {
69
- v as Switch
71
+ N as Switch
70
72
  };
@@ -0,0 +1,3 @@
1
+ export { useBodyScrollLock } from './use-body-scroll-lock';
2
+ export { useEscapeKey } from './use-escape-key';
3
+ export { useMediaQuery } from './use-media-query';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Custom hook to lock/unlock body scroll when a modal or overlay is open
3
+ * This prevents the background from scrolling while a modal is active
4
+ *
5
+ * @param isLocked - Whether the body scroll should be locked
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * const [isOpen, setIsOpen] = useState(false)
10
+ * useBodyScrollLock(isOpen)
11
+ * ```
12
+ */
13
+ export declare function useBodyScrollLock(isLocked: boolean): void;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Custom hook to handle Escape key press
3
+ * Commonly used for closing modals, dialogs, sheets, etc.
4
+ *
5
+ * @param isActive - Whether the Escape key handler should be active
6
+ * @param onEscape - Callback function to execute when Escape is pressed
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * const [isOpen, setIsOpen] = useState(false)
11
+ * useEscapeKey(isOpen, () => setIsOpen(false))
12
+ * ```
13
+ */
14
+ export declare function useEscapeKey(isActive: boolean, onEscape: () => void): void;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Custom hook to track media query matches
3
+ * Returns true if the media query matches, false otherwise
4
+ *
5
+ * This hook uses the native window.matchMedia API and updates reactively
6
+ * when the media query match state changes
7
+ *
8
+ * @param query - Media query string (e.g., '(max-width: 768px)')
9
+ * @param defaultValue - Optional default value for SSR (defaults to false)
10
+ *
11
+ * @returns boolean indicating whether the media query matches
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const isMobile = useMediaQuery('(max-width: 599px)')
16
+ * const isTablet = useMediaQuery('(max-width: 1023px)')
17
+ * const isDesktop = useMediaQuery('(min-width: 1024px)')
18
+ * ```
19
+ */
20
+ export declare function useMediaQuery(query: string, defaultValue?: boolean): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuno-payments/dashboard-design-system",
3
- "version": "0.0.96",
3
+ "version": "0.0.98",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",