@divayth/brick-ui 0.6.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/app/ModalProvider.d.ts.map +1 -0
  2. package/dist/{ui/Modal → app}/ModalProvider.js +1 -1
  3. package/dist/app/Provider.d.ts +9 -8
  4. package/dist/app/Provider.d.ts.map +1 -1
  5. package/dist/app/Provider.js +16 -57
  6. package/dist/app/ThemeProvider.d.ts +14 -0
  7. package/dist/app/ThemeProvider.d.ts.map +1 -0
  8. package/dist/app/ThemeProvider.js +43 -0
  9. package/dist/app/index.d.ts +1 -1
  10. package/dist/app/index.d.ts.map +1 -1
  11. package/dist/index.js +60 -56
  12. package/dist/lib/locale.d.ts +2 -0
  13. package/dist/lib/locale.d.ts.map +1 -1
  14. package/dist/lib/locale.js +2 -0
  15. package/dist/styles.css +1 -1
  16. package/dist/ui/Date/DateInput.d.ts +1 -1
  17. package/dist/ui/Date/DateInput.d.ts.map +1 -1
  18. package/dist/ui/Date/DateInput.js +14 -14
  19. package/dist/ui/DropdownMenu/DropdownMenu.d.ts +17 -0
  20. package/dist/ui/DropdownMenu/DropdownMenu.d.ts.map +1 -0
  21. package/dist/ui/DropdownMenu/DropdownMenu.js +34 -0
  22. package/dist/ui/DropdownMenu/DropdownMenu.module.css.js +11 -0
  23. package/dist/ui/DropdownMenu/index.d.ts +2 -0
  24. package/dist/ui/DropdownMenu/index.d.ts.map +1 -0
  25. package/dist/ui/Field/Field.d.ts +1 -1
  26. package/dist/ui/Field/Field.d.ts.map +1 -1
  27. package/dist/ui/Flex/Flex.d.ts +3 -3
  28. package/dist/ui/Flex/Flex.d.ts.map +1 -1
  29. package/dist/ui/Flex/Flex.js +12 -14
  30. package/dist/ui/Flex/constants.d.ts +1 -1
  31. package/dist/ui/Flex/constants.d.ts.map +1 -1
  32. package/dist/ui/Flex/index.d.ts +2 -0
  33. package/dist/ui/Flex/index.d.ts.map +1 -0
  34. package/dist/ui/Grid/Grid.types.d.ts +2 -2
  35. package/dist/ui/Grid/Grid.types.d.ts.map +1 -1
  36. package/dist/ui/IconButton/IconButton.d.ts +2 -1
  37. package/dist/ui/IconButton/IconButton.d.ts.map +1 -1
  38. package/dist/ui/IconButton/IconButton.js +61 -56
  39. package/dist/ui/IconButton/IconButton.module.css.js +24 -24
  40. package/dist/ui/IconButton/index.d.ts +2 -0
  41. package/dist/ui/IconButton/index.d.ts.map +1 -0
  42. package/dist/ui/Input/Input.d.ts +1 -1
  43. package/dist/ui/Input/Input.d.ts.map +1 -1
  44. package/dist/ui/Input/Input.js +31 -27
  45. package/dist/ui/Input/index.d.ts +2 -0
  46. package/dist/ui/Input/index.d.ts.map +1 -0
  47. package/dist/ui/Modal/Modal.d.ts +9 -6
  48. package/dist/ui/Modal/Modal.d.ts.map +1 -1
  49. package/dist/ui/Modal/Modal.js +85 -101
  50. package/dist/ui/Modal/Modal.module.css.js +17 -17
  51. package/dist/ui/Modal/ModalContext.js +2 -2
  52. package/dist/ui/Modal/index.d.ts +4 -0
  53. package/dist/ui/Modal/index.d.ts.map +1 -0
  54. package/dist/ui/MultipleChip/MultipleChip.d.ts +1 -1
  55. package/dist/ui/MultipleChip/MultipleChip.d.ts.map +1 -1
  56. package/dist/ui/NoData/NoData.d.ts +1 -1
  57. package/dist/ui/NoData/NoData.d.ts.map +1 -1
  58. package/dist/ui/Select/Select.types.d.ts +1 -1
  59. package/dist/ui/Select/Select.types.d.ts.map +1 -1
  60. package/dist/ui/Select/SelectOptions.js +1 -1
  61. package/dist/ui/Sticky/Sticky.d.ts +1 -1
  62. package/dist/ui/Sticky/Sticky.d.ts.map +1 -1
  63. package/dist/ui/Tabs/TabsList.d.ts +1 -1
  64. package/dist/ui/Tabs/TabsList.d.ts.map +1 -1
  65. package/dist/ui/Textarea/Textarea.d.ts +1 -1
  66. package/dist/ui/Textarea/Textarea.d.ts.map +1 -1
  67. package/dist/ui/Tooltip/Tooltip.js +15 -15
  68. package/dist/ui/index.d.ts +5 -6
  69. package/dist/ui/index.d.ts.map +1 -1
  70. package/package.json +1 -1
  71. package/dist/ui/Modal/ModalProvider.d.ts.map +0 -1
  72. /package/dist/{ui/Modal → app}/ModalProvider.d.ts +0 -0
  73. /package/dist/app/{Provider.module.css.js → ThemeProvider.module.css.js} +0 -0
@@ -1,65 +1,70 @@
1
1
  "use client";
2
- import { jsxs as k, jsx as l } from "react/jsx-runtime";
3
- import N from "clsx";
4
- import { CircularLoading as j } from "../CircularLoading/CircularLoading.js";
5
- import o from "./IconButton.module.css.js";
6
- const E = ({
7
- color: p = "primary",
8
- variant: m = "transparent",
9
- size: i = "md",
10
- disabled: c = !1,
11
- isLoading: r = !1,
12
- component: d,
13
- children: u,
14
- className: b,
15
- type: f = "button",
16
- onClick: y,
17
- onKeyDown: h,
18
- tabIndex: x,
19
- "aria-disabled": C,
20
- "aria-busy": D,
21
- ...g
2
+ import { jsxs as S, jsx as i } from "react/jsx-runtime";
3
+ import { CircularLoading as g } from "../CircularLoading/CircularLoading.js";
4
+ import { cn as j } from "../../lib/cn.js";
5
+ import t from "./IconButton.module.css.js";
6
+ const v = {
7
+ xs: "rounded-xs",
8
+ sm: "rounded-sm",
9
+ md: "rounded-md",
10
+ lg: "rounded-lg",
11
+ xl: "rounded-xl",
12
+ full: "rounded-full"
13
+ }, O = ({
14
+ color: u = "primary",
15
+ variant: c = "transparent",
16
+ size: a = "md",
17
+ rounded: m = "full",
18
+ disabled: p = !1,
19
+ isLoading: n = !1,
20
+ component: b,
21
+ children: f,
22
+ className: y,
23
+ type: x = "button",
24
+ onClick: D,
25
+ onKeyDown: l,
26
+ tabIndex: h,
27
+ "aria-disabled": k,
28
+ "aria-busy": C,
29
+ ...B
22
30
  }) => {
23
- const s = d ?? "button", a = c || r, n = s === "button", e = typeof s != "string";
24
- return /* @__PURE__ */ k(
25
- s,
31
+ const d = b ?? "button", r = p || n, e = d === "button", s = !e && r, N = (o) => {
32
+ o.preventDefault();
33
+ }, E = (o) => {
34
+ if (o.key === "Enter" || o.key === " ") {
35
+ o.preventDefault();
36
+ return;
37
+ }
38
+ l?.(o);
39
+ };
40
+ return /* @__PURE__ */ S(
41
+ d,
26
42
  {
27
- ...g,
28
- type: n || e ? f : void 0,
29
- disabled: n || e ? a : void 0,
30
- "aria-disabled": a || C,
31
- "aria-busy": r || D,
32
- tabIndex: !n && a ? -1 : x,
33
- className: N(
34
- o.root,
35
- o[p],
36
- o[m],
37
- o[i],
38
- { [o.disabled]: a },
39
- b
43
+ type: e ? x : void 0,
44
+ disabled: e ? r : void 0,
45
+ "aria-disabled": r || k,
46
+ "aria-busy": n || C,
47
+ tabIndex: s ? -1 : h,
48
+ className: j(
49
+ t.root,
50
+ t[u],
51
+ t[c],
52
+ t[a],
53
+ v[m],
54
+ { [t.disabled]: r },
55
+ y
40
56
  ),
41
- onClick: (t) => {
42
- if (a) {
43
- t.preventDefault(), t.stopPropagation();
44
- return;
45
- }
46
- y?.(t);
47
- },
48
- onKeyDown: (t) => {
49
- if (a && (t.key === "Enter" || t.key === " ")) {
50
- t.preventDefault(), t.stopPropagation();
51
- return;
52
- }
53
- h?.(t);
54
- },
57
+ onClick: s ? N : D,
58
+ onKeyDown: s ? E : l,
59
+ ...B,
55
60
  children: [
56
- /* @__PURE__ */ l("span", { className: o.content, style: { opacity: r ? 0 : 1 }, children: u }),
57
- r && /* @__PURE__ */ l(
58
- j,
61
+ /* @__PURE__ */ i("span", { className: t.content, style: { opacity: n ? 0 : 1 }, children: f }),
62
+ n && /* @__PURE__ */ i(
63
+ g,
59
64
  {
60
- size: i,
65
+ size: a,
61
66
  style: { width: "1em", height: "1em" },
62
- className: o.loading,
67
+ className: t.loading,
63
68
  "aria-hidden": "true"
64
69
  }
65
70
  )
@@ -68,5 +73,5 @@ const E = ({
68
73
  );
69
74
  };
70
75
  export {
71
- E as IconButton
76
+ O as IconButton
72
77
  };
@@ -1,33 +1,33 @@
1
- const i = "_root_ivirq_2", _ = "_xs_ivirq_24", o = "_sm_ivirq_29", n = "_md_ivirq_34", r = "_lg_ivirq_39", s = "_xl_ivirq_44", t = "_primary_ivirq_49", d = "_secondary_ivirq_57", l = "_danger_ivirq_66", c = "_outlined_ivirq_75", e = "_filled_ivirq_79", a = "_disabled_ivirq_109", q = "_content_ivirq_122", v = "_loading_ivirq_130", g = {
2
- root: i,
1
+ const t = "_root_1tkxq_2", _ = "_xs_1tkxq_24", o = "_sm_1tkxq_29", n = "_md_1tkxq_34", s = "_lg_1tkxq_39", d = "_xl_1tkxq_44", l = "_primary_1tkxq_49", c = "_secondary_1tkxq_57", x = "_danger_1tkxq_66", e = "_outlined_1tkxq_75", a = "_filled_1tkxq_79", r = "_disabled_1tkxq_109", i = "_content_1tkxq_122", k = "_loading_1tkxq_130", q = {
2
+ root: t,
3
3
  xs: _,
4
4
  sm: o,
5
5
  md: n,
6
- lg: r,
7
- xl: s,
8
- primary: t,
9
- secondary: d,
10
- danger: l,
11
- outlined: c,
12
- filled: e,
13
- disabled: a,
14
- content: q,
15
- loading: v
6
+ lg: s,
7
+ xl: d,
8
+ primary: l,
9
+ secondary: c,
10
+ danger: x,
11
+ outlined: e,
12
+ filled: a,
13
+ disabled: r,
14
+ content: i,
15
+ loading: k
16
16
  };
17
17
  export {
18
- q as content,
19
- l as danger,
20
- g as default,
21
- a as disabled,
22
- e as filled,
23
- r as lg,
24
- v as loading,
18
+ i as content,
19
+ x as danger,
20
+ q as default,
21
+ r as disabled,
22
+ a as filled,
23
+ s as lg,
24
+ k as loading,
25
25
  n as md,
26
- c as outlined,
27
- t as primary,
28
- i as root,
29
- d as secondary,
26
+ e as outlined,
27
+ l as primary,
28
+ t as root,
29
+ c as secondary,
30
30
  o as sm,
31
- s as xl,
31
+ d as xl,
32
32
  _ as xs
33
33
  };
@@ -0,0 +1,2 @@
1
+ export { IconButton, type IconButtonColor, type IconButtonProps, type IconButtonVariant, } from './IconButton.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/IconButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC"}
@@ -10,5 +10,5 @@ export interface InputControlProps {
10
10
  fullWidth?: boolean;
11
11
  }
12
12
  export type InputProps = InputControlProps & Omit<ComponentProps<'input'>, 'size'>;
13
- export declare const Input: ({ id: idProps, label, error, size, fullWidth, className, startIcon, endIcon, ...inputProps }: InputProps) => import("react").JSX.Element;
13
+ export declare const Input: ({ id: idProps, label, error, size, fullWidth, className, startIcon, endIcon, "aria-describedby": describedBy, "aria-invalid": ariaInvalid, ...inputProps }: InputProps) => import("react").JSX.Element;
14
14
  //# sourceMappingURL=Input.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/ui/Input/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAS,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,KAAK,WAAW,EAAS,MAAM,oBAAoB,CAAC;AAI7D,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,UAAU,GAAG,iBAAiB,GACtC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;AAE1C,eAAO,MAAM,KAAK,GAAI,8FAUnB,UAAU,gCAyBZ,CAAC"}
1
+ {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/ui/Input/Input.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAS,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,KAAK,WAAW,EAAS,MAAM,oBAAoB,CAAC;AAK7D,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,UAAU,GAAG,iBAAiB,GACtC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC;AAE1C,eAAO,MAAM,KAAK,GAAI,4JAYnB,UAAU,gCA6BZ,CAAC"}
@@ -1,44 +1,48 @@
1
1
  "use client";
2
- import { jsxs as e, jsx as r } from "react/jsx-runtime";
3
- import { useId as h } from "react";
4
- import w from "clsx";
5
- import { Field as o } from "../Field/Field.js";
6
- import i from "./Input.module.css.js";
7
- const N = ({
2
+ import { jsxs as c, jsx as r } from "react/jsx-runtime";
3
+ import { useId as I } from "react";
4
+ import { Field as i } from "../Field/Field.js";
5
+ import { cn as j } from "../../lib/cn.js";
6
+ import t from "./Input.module.css.js";
7
+ const g = ({
8
8
  id: l,
9
- label: c,
10
- error: t,
11
- size: d = "md",
9
+ label: a,
10
+ error: o,
11
+ size: m = "md",
12
12
  fullWidth: p = !1,
13
13
  className: f,
14
- startIcon: m,
15
- endIcon: n,
16
- ...u
14
+ startIcon: n,
15
+ endIcon: d,
16
+ "aria-describedby": u,
17
+ "aria-invalid": h,
18
+ ...b
17
19
  }) => {
18
- const a = h(), s = l ?? a;
19
- return /* @__PURE__ */ e(o.Root, { className: p ? "w-full" : "w-auto", children: [
20
- c && /* @__PURE__ */ r(o.Label, { htmlFor: s, label: c }),
21
- /* @__PURE__ */ e(o.Control, { size: d, children: [
22
- m && /* @__PURE__ */ r(o.Icon, { icon: m }),
20
+ const v = I(), e = l ?? v, s = o ? `${e}-error` : void 0, w = [u, s].filter(Boolean).join(" ") || void 0;
21
+ return /* @__PURE__ */ c(i.Root, { className: p ? "w-full" : "w-auto", children: [
22
+ a && /* @__PURE__ */ r(i.Label, { htmlFor: e, label: a }),
23
+ /* @__PURE__ */ c(i.Control, { size: m, children: [
24
+ n && /* @__PURE__ */ r(i.Icon, { icon: n }),
23
25
  /* @__PURE__ */ r(
24
26
  "input",
25
27
  {
26
- id: s,
27
- className: w(
28
- i.input,
29
- t && i.error,
30
- m && i.withStartIcon,
31
- n && i.withEndIcon,
28
+ id: e,
29
+ "aria-invalid": o ? !0 : h,
30
+ "aria-describedby": w,
31
+ className: j(
32
+ t.input,
33
+ o && t.error,
34
+ n && t.withStartIcon,
35
+ d && t.withEndIcon,
32
36
  f
33
37
  ),
34
- ...u
38
+ ...b
35
39
  }
36
40
  ),
37
- n && /* @__PURE__ */ r(o.Icon, { icon: n, position: "end" })
41
+ d && /* @__PURE__ */ r(i.Icon, { icon: d, position: "end" })
38
42
  ] }),
39
- t && /* @__PURE__ */ r(o.Error, { id: `${s}-error`, error: t })
43
+ o && /* @__PURE__ */ r(i.Error, { id: s, error: o })
40
44
  ] });
41
45
  };
42
46
  export {
43
- N as Input
47
+ g as Input
44
48
  };
@@ -0,0 +1,2 @@
1
+ export { Input, type InputControlProps, type InputProps } from './Input.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/Input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,iBAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC"}
@@ -1,6 +1,6 @@
1
- import { type ReactNode } from 'react';
1
+ import { type ReactElement, type ReactNode } from 'react';
2
2
  import { type ButtonProps } from '../Button/index.js';
3
- import { type FlexProps } from '../Flex/Flex.js';
3
+ import { type FlexProps } from '../Flex/index.js';
4
4
  export declare const MODAL_SIZE: {
5
5
  readonly xs: "xs";
6
6
  readonly sm: "sm";
@@ -14,18 +14,21 @@ export interface ModalRootProps {
14
14
  size?: ModalSize;
15
15
  className?: string;
16
16
  closeDisabled?: boolean;
17
+ open?: boolean;
18
+ onOpenChange?: (open: boolean) => void;
17
19
  'aria-label'?: string;
18
20
  }
19
21
  interface HeaderProps extends FlexProps {
22
+ text: string | ReactElement;
20
23
  closeLabel?: string;
21
24
  startIcon?: ReactNode;
22
25
  withCloseButton?: boolean;
23
26
  }
24
27
  export declare const Modal: {
25
- Root: ({ children, size, className, closeDisabled, "aria-label": ariaLabel, }: ModalRootProps) => import("react").JSX.Element;
26
- Header: ({ children, startIcon, withCloseButton, closeLabel, ...props }: HeaderProps) => import("react").JSX.Element;
27
- Content: ({ children, className, ref, ...props }: FlexProps) => import("react").JSX.Element;
28
- Footer: ({ children, justifyContent, ...props }: FlexProps) => import("react").JSX.Element;
28
+ Root: ({ children, size, className, closeDisabled, open, onOpenChange, "aria-label": ariaLabel, }: ModalRootProps) => import("react").JSX.Element;
29
+ Header: ({ text, children, startIcon, withCloseButton, closeLabel, ...props }: HeaderProps) => import("react").JSX.Element;
30
+ Content: ({ className, ...props }: FlexProps) => import("react").JSX.Element;
31
+ Actions: (props: FlexProps) => import("react").JSX.Element;
29
32
  Cancel: ({ children, onClick, disabled, ...props }: ButtonProps) => import("react").JSX.Element;
30
33
  Confirm: ({ children, type, ...props }: ButtonProps) => import("react").JSX.Element;
31
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/ui/Modal/Modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,SAAS,EASf,MAAM,OAAO,CAAC;AAMf,OAAO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AM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA6DD,UAAU,WAAY,SAAQ,SAAS;IACrC,IAAI,EAAE,MAAM,GAAG,YAAY,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAwED,eAAO,MAAM,KAAK;uGAhIf,cAAc;mFAiEd,WAAW;uCA0B4B,SAAS;qBAI3B,SAAS;wDAI0B,WAAW;4CAoBZ,WAAW;CASG,CAAC"}
@@ -1,130 +1,114 @@
1
1
  "use client";
2
- import { jsx as s, jsxs as R } from "react/jsx-runtime";
3
- import { createContext as H, useContext as M, useRef as b, useState as N, useImperativeHandle as P, useLayoutEffect as j, useId as B, useMemo as T, useEffect as X } from "react";
4
- import E from "clsx";
5
- import { X as z } from "lucide-react";
6
- import { useProvider as p } from "../../app/Provider.js";
7
- import { Button as S } from "../Button/Button.js";
8
- import { Flex as v } from "../Flex/Flex.js";
9
- import { IconButton as A } from "../IconButton/IconButton.js";
10
- import { Text as D } from "../Text/Text.js";
11
- import { useModal as h } from "./ModalContext.js";
12
- import m from "./Modal.module.css.js";
2
+ import { jsx as o, jsxs as x } from "react/jsx-runtime";
3
+ import { useContext as M, useRef as h, useCallback as E, useMemo as N, createContext as P } from "react";
4
+ import { X as R } from "lucide-react";
5
+ import { Dialog as u } from "radix-ui";
6
+ import { useProvider as v } from "../../app/Provider.js";
7
+ import { Button as g } from "../Button/Button.js";
8
+ import { Flex as f } from "../Flex/Flex.js";
9
+ import { IconButton as j } from "../IconButton/IconButton.js";
10
+ import { Text as A } from "../Text/Text.js";
11
+ import { cn as y } from "../../lib/cn.js";
12
+ import { useModal as D } from "./ModalContext.js";
13
+ import a from "./Modal.module.css.js";
13
14
  const F = {
14
15
  xs: "xs",
15
16
  sm: "sm",
16
17
  md: "md",
17
18
  lg: "lg",
18
19
  xl: "xl"
19
- }, x = H(
20
+ }, C = P(
20
21
  {}
21
- );
22
- let g = 0, w = "", C = "";
23
- const L = () => (g === 0 && (w = document.body.style.overflow, C = document.documentElement.style.overflow, document.body.style.overflow = "hidden", document.documentElement.style.overflow = "hidden"), g += 1, () => {
24
- g -= 1, g === 0 && (document.body.style.overflow = w, document.documentElement.style.overflow = C);
25
- }), Y = ({
26
- children: o,
22
+ ), I = ({
23
+ children: e,
27
24
  size: n = F.md,
28
- className: l,
29
- closeDisabled: r = !1,
30
- "aria-label": c
25
+ className: s,
26
+ closeDisabled: t = !1,
27
+ open: m = !0,
28
+ onOpenChange: r,
29
+ "aria-label": i
31
30
  }) => {
32
- const { closeModal: a } = h(), i = b(null), t = b(!1), d = B(), u = T(
33
- () => ({ titleId: d, closeDisabled: r }),
34
- [d, r]
35
- );
36
- X(() => {
37
- const e = i.current;
38
- if (!e) return;
39
- e.showModal();
40
- const y = L();
41
- return () => {
42
- e.close(), y();
43
- };
44
- }, []);
45
- const f = (e) => {
46
- if (e.target !== e.currentTarget) return !1;
47
- const { left: y, right: k, top: I, bottom: O } = e.currentTarget.getBoundingClientRect();
48
- return e.clientX < y || e.clientX > k || e.clientY < I || e.clientY > O;
49
- };
50
- return /* @__PURE__ */ s(x.Provider, { value: u, children: /* @__PURE__ */ s(
51
- "dialog",
31
+ const { closeModal: l } = D(), d = h(null), p = E(() => {
32
+ r ? r(!1) : l();
33
+ }, [r, l]), b = N(() => ({ closeDisabled: t, closeModal: p }), [t, p]);
34
+ return /* @__PURE__ */ o(C.Provider, { value: b, children: /* @__PURE__ */ o(
35
+ u.Root,
52
36
  {
53
- ref: i,
54
- className: E(m.root, m[n], l),
55
- "aria-modal": "true",
56
- "aria-labelledby": c ? void 0 : d,
57
- "aria-label": c,
58
- onCancel: (e) => {
59
- e.preventDefault(), r || a();
60
- },
61
- onPointerDown: (e) => {
62
- t.current = f(e);
63
- },
64
- onClick: (e) => {
65
- !r && t.current && f(e) && a(), t.current = !1;
37
+ open: m,
38
+ onOpenChange: (c) => {
39
+ !c && !t && p();
66
40
  },
67
- children: /* @__PURE__ */ s(v, { direction: "col", gap: "md", className: m.layout, children: o })
41
+ children: /* @__PURE__ */ x(u.Portal, { children: [
42
+ /* @__PURE__ */ o(u.Overlay, { className: a.overlay }),
43
+ /* @__PURE__ */ o(
44
+ u.Content,
45
+ {
46
+ className: y(a.root, a[n], s),
47
+ "aria-describedby": void 0,
48
+ "aria-label": i,
49
+ onEscapeKeyDown: (c) => {
50
+ t && c.preventDefault();
51
+ },
52
+ onInteractOutside: (c) => {
53
+ t && c.preventDefault();
54
+ },
55
+ onOpenAutoFocus: () => {
56
+ d.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
57
+ },
58
+ onCloseAutoFocus: (c) => {
59
+ d.current?.isConnected && (c.preventDefault(), d.current.focus());
60
+ },
61
+ ...i ? { "aria-labelledby": void 0 } : {},
62
+ children: /* @__PURE__ */ o(f, { direction: "col", gap: "md", className: a.layout, children: e })
63
+ }
64
+ )
65
+ ] })
68
66
  }
69
67
  ) });
70
- }, V = ({
71
- children: o,
72
- startIcon: n,
73
- withCloseButton: l = !0,
74
- closeLabel: r,
75
- ...c
68
+ }, k = ({
69
+ text: e,
70
+ children: n,
71
+ startIcon: s,
72
+ withCloseButton: t = !0,
73
+ closeLabel: m,
74
+ ...r
76
75
  }) => {
77
- const { messages: a } = p(), { closeModal: i } = h(), { titleId: t, closeDisabled: d } = M(x);
78
- return /* @__PURE__ */ R(v, { justifyContent: "between", alignItems: "center", ...c, children: [
76
+ const { messages: i } = v(), { closeDisabled: l, closeModal: d } = M(C);
77
+ return /* @__PURE__ */ x(f, { justifyContent: "between", alignItems: "start", ...r, children: [
78
+ s,
79
+ /* @__PURE__ */ o(u.Title, { asChild: !0, children: typeof e == "string" ? /* @__PURE__ */ o(A, { size: "xl", weight: "medium", children: e }) : e }),
79
80
  n,
80
- /* @__PURE__ */ s(D, { id: t, size: "xl", weight: "medium", children: o }),
81
- l && /* @__PURE__ */ s(
82
- A,
81
+ t && /* @__PURE__ */ o(
82
+ j,
83
83
  {
84
- className: m.close,
84
+ className: a.close,
85
85
  color: "secondary",
86
- "aria-label": r ?? a.close,
87
- disabled: d,
88
- onClick: i,
89
- children: /* @__PURE__ */ s(z, {})
86
+ "aria-label": m ?? i.close,
87
+ disabled: l,
88
+ onClick: d,
89
+ children: /* @__PURE__ */ o(R, {})
90
90
  }
91
91
  )
92
92
  ] });
93
- }, Z = ({ children: o, className: n, ref: l, ...r }) => {
94
- const c = b(null), [a, i] = N(!1);
95
- return P(l, () => c.current, []), j(() => {
96
- const t = c.current;
97
- if (!t) return;
98
- const d = () => i(t.scrollHeight > t.clientHeight), u = new ResizeObserver(d);
99
- return u.observe(t), Array.from(t.children).forEach((f) => u.observe(f)), d(), () => u.disconnect();
100
- }, [o]), /* @__PURE__ */ s(
101
- v,
102
- {
103
- ref: c,
104
- className: E(m.content, { [m.scrollable]: a }, n),
105
- ...r,
106
- children: o
107
- }
108
- );
109
- }, _ = ({ children: o, justifyContent: n = "end", ...l }) => /* @__PURE__ */ s(v, { direction: "row", justifyContent: n, ...l, children: o }), q = ({ children: o, onClick: n, disabled: l, ...r }) => {
110
- const { messages: c } = p(), { closeModal: a } = h(), { closeDisabled: i } = M(x);
111
- return /* @__PURE__ */ s(
112
- S,
93
+ }, w = ({ className: e, ...n }) => /* @__PURE__ */ o(f, { className: y(a.content, e), ...n }), O = (e) => /* @__PURE__ */ o(f, { justifyContent: "end", gap: "sm", ...e }), T = ({ children: e, onClick: n, disabled: s, ...t }) => {
94
+ const { messages: m } = v(), { closeDisabled: r, closeModal: i } = M(C);
95
+ return /* @__PURE__ */ o(
96
+ g,
113
97
  {
114
98
  variant: "outlined",
115
- disabled: l || i,
116
- onClick: (t) => {
117
- i || (n?.(t), t.defaultPrevented || a());
99
+ disabled: s || r,
100
+ onClick: (l) => {
101
+ r || (n?.(l), l.defaultPrevented || i());
118
102
  },
119
- ...r,
120
- children: o === void 0 ? c.cancel : o
103
+ ...t,
104
+ children: e === void 0 ? m.cancel : e
121
105
  }
122
106
  );
123
- }, G = ({ children: o, type: n = "submit", ...l }) => {
124
- const { messages: r } = p();
125
- return /* @__PURE__ */ s(S, { type: n, ...l, children: o === void 0 ? r.confirm : o });
126
- }, le = { Root: Y, Header: V, Content: Z, Footer: _, Cancel: q, Confirm: G };
107
+ }, B = ({ children: e, type: n = "submit", ...s }) => {
108
+ const { messages: t } = v();
109
+ return /* @__PURE__ */ o(g, { type: n, ...s, children: e === void 0 ? t.confirm : e });
110
+ }, Q = { Root: I, Header: k, Content: w, Actions: O, Cancel: T, Confirm: B };
127
111
  export {
128
112
  F as MODAL_SIZE,
129
- le as Modal
113
+ Q as Modal
130
114
  };
@@ -1,25 +1,25 @@
1
- const o = "_root_12ndw_2", _ = "_layout_12ndw_24", n = "_content_12ndw_28", s = "_scrollable_12ndw_36", t = "_xs_12ndw_40", l = "_sm_12ndw_41", c = "_md_12ndw_42", d = "_lg_12ndw_43", e = "_xl_12ndw_44", w = "_close_12ndw_46", a = {
1
+ const o = "_root_1oqf7_2", _ = "_overlay_1oqf7_21", t = "_layout_1oqf7_28", s = "_content_1oqf7_32", c = "_xs_1oqf7_40", l = "_sm_1oqf7_41", n = "_md_1oqf7_42", e = "_lg_1oqf7_43", f = "_xl_1oqf7_44", q = "_close_1oqf7_46", a = {
2
2
  root: o,
3
- layout: _,
4
- content: n,
5
- scrollable: s,
6
- xs: t,
3
+ overlay: _,
4
+ layout: t,
5
+ content: s,
6
+ xs: c,
7
7
  sm: l,
8
- md: c,
9
- lg: d,
10
- xl: e,
11
- close: w
8
+ md: n,
9
+ lg: e,
10
+ xl: f,
11
+ close: q
12
12
  };
13
13
  export {
14
- w as close,
15
- n as content,
14
+ q as close,
15
+ s as content,
16
16
  a as default,
17
- _ as layout,
18
- d as lg,
19
- c as md,
17
+ t as layout,
18
+ e as lg,
19
+ n as md,
20
+ _ as overlay,
20
21
  o as root,
21
- s as scrollable,
22
22
  l as sm,
23
- e as xl,
24
- t as xs
23
+ f as xl,
24
+ c as xs
25
25
  };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { createContext as t, useContext as o } from "react";
3
- const e = t({}), r = () => o(e);
2
+ import { useContext as t, createContext as o } from "react";
3
+ const e = o({}), r = () => t(e);
4
4
  export {
5
5
  e as ModalContext,
6
6
  r as useModal
@@ -0,0 +1,4 @@
1
+ export { Modal, MODAL_SIZE, type ModalRootProps, type ModalSize } from './Modal.js';
2
+ export { type ModalActions, useModal } from './ModalContext.js';
3
+ export { ModalProvider } from '../../app/Provider.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/Modal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,KAAK,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type FlexProps } from '../Flex/Flex.js';
1
+ import { type FlexProps } from '../Flex/index.js';
2
2
  export interface MultipleChipOption {
3
3
  value: string;
4
4
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"MultipleChip.d.ts","sourceRoot":"","sources":["../../../src/ui/MultipleChip/MultipleChip.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,iBAAkB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