@deepnoid/ui 0.1.19 → 0.1.20

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 (136) hide show
  1. package/.turbo/turbo-build.log +199 -170
  2. package/dist/assets/images/cogwheel.d.mts +2 -0
  3. package/dist/assets/images/cogwheel.d.ts +2 -0
  4. package/dist/assets/images/cogwheel.js +4 -0
  5. package/dist/assets/images/cogwheel.mjs +8 -0
  6. package/dist/assets/images/folder.d.mts +2 -0
  7. package/dist/assets/images/folder.d.ts +2 -0
  8. package/dist/assets/images/folder.js +4 -0
  9. package/dist/assets/images/folder.mjs +8 -0
  10. package/dist/chunk-3BKCODIL.mjs +49 -0
  11. package/dist/{chunk-A7OXEUCC.mjs → chunk-3IU2RPSM.mjs} +75 -9
  12. package/dist/{chunk-BFM3LPBK.mjs → chunk-6HX3PPL6.mjs} +1 -1
  13. package/dist/{chunk-RPDPB4JP.mjs → chunk-6KXBXGYR.mjs} +3 -3
  14. package/dist/chunk-7USF56CT.mjs +8 -0
  15. package/dist/chunk-BPVRXFIC.mjs +82 -0
  16. package/dist/{chunk-MJT6ZW4C.mjs → chunk-BXXAMH3R.mjs} +4 -4
  17. package/dist/{chunk-UHFJ7ZFM.mjs → chunk-EGHTZLZJ.mjs} +2 -2
  18. package/dist/{chunk-QIDZXCYP.mjs → chunk-EYVRTVRM.mjs} +3 -3
  19. package/dist/{chunk-DADMVOYI.mjs → chunk-HWL7TPUN.mjs} +1 -1
  20. package/dist/chunk-IZM66FHP.mjs +8 -0
  21. package/dist/{chunk-7TXQPX4O.mjs → chunk-JOCMCOEK.mjs} +2 -2
  22. package/dist/{chunk-3TJAGKKY.mjs → chunk-LNYMVBV5.mjs} +1 -1
  23. package/dist/chunk-MBLZYQCN.mjs +1 -0
  24. package/dist/{chunk-P6NVCCBZ.mjs → chunk-OF3X4BXG.mjs} +1 -1
  25. package/dist/chunk-OUAKGMDW.mjs +168 -0
  26. package/dist/{chunk-AG7AWQKH.mjs → chunk-OWG4RL2T.mjs} +3 -3
  27. package/dist/{chunk-7A5M7DRD.mjs → chunk-PNRS23HE.mjs} +4 -4
  28. package/dist/{chunk-FONJYZKH.mjs → chunk-PZIVMTKX.mjs} +4 -4
  29. package/dist/{chunk-5ANQDLRS.mjs → chunk-Q72LZAPG.mjs} +1 -1
  30. package/dist/{chunk-K7Z6PVXE.mjs → chunk-VQROXH43.mjs} +4 -4
  31. package/dist/{chunk-UYPVP36M.mjs → chunk-XQGD4ZIX.mjs} +1 -1
  32. package/dist/chunk-YBDA3WQP.mjs +71 -0
  33. package/dist/chunk-ZUSUVPYV.mjs +135 -0
  34. package/dist/cogwheel-U2B3CWEL.png +0 -0
  35. package/dist/components/avatar/avatar.js +75 -9
  36. package/dist/components/avatar/avatar.mjs +2 -2
  37. package/dist/components/avatar/index.js +75 -9
  38. package/dist/components/avatar/index.mjs +2 -2
  39. package/dist/components/breadcrumb/breadcrumb.js +75 -9
  40. package/dist/components/breadcrumb/breadcrumb.mjs +7 -7
  41. package/dist/components/breadcrumb/index.js +75 -9
  42. package/dist/components/breadcrumb/index.mjs +7 -7
  43. package/dist/components/button/button.js +75 -9
  44. package/dist/components/button/button.mjs +4 -4
  45. package/dist/components/button/icon-button.js +75 -9
  46. package/dist/components/button/icon-button.mjs +4 -4
  47. package/dist/components/button/index.js +75 -9
  48. package/dist/components/button/index.mjs +6 -6
  49. package/dist/components/chip/chip.js +75 -9
  50. package/dist/components/chip/chip.mjs +3 -3
  51. package/dist/components/chip/index.js +75 -9
  52. package/dist/components/chip/index.mjs +3 -3
  53. package/dist/components/dateTimePicker/calendar.js +75 -9
  54. package/dist/components/dateTimePicker/calendar.mjs +3 -3
  55. package/dist/components/dateTimePicker/dateTimePicker.js +75 -9
  56. package/dist/components/dateTimePicker/dateTimePicker.mjs +7 -7
  57. package/dist/components/dateTimePicker/index.js +75 -9
  58. package/dist/components/dateTimePicker/index.mjs +7 -7
  59. package/dist/components/dateTimePicker/timePicker.js +75 -9
  60. package/dist/components/dateTimePicker/timePicker.mjs +5 -5
  61. package/dist/components/icon/Icon.d.mts +6 -2
  62. package/dist/components/icon/Icon.d.ts +6 -2
  63. package/dist/components/icon/Icon.js +75 -9
  64. package/dist/components/icon/Icon.mjs +2 -2
  65. package/dist/components/icon/index.js +75 -9
  66. package/dist/components/icon/index.mjs +2 -2
  67. package/dist/components/icon/template.d.mts +2 -1
  68. package/dist/components/icon/template.d.ts +2 -1
  69. package/dist/components/icon/template.js +75 -9
  70. package/dist/components/icon/template.mjs +1 -1
  71. package/dist/components/input/index.js +76 -10
  72. package/dist/components/input/index.mjs +3 -3
  73. package/dist/components/input/input.js +76 -10
  74. package/dist/components/input/input.mjs +3 -3
  75. package/dist/components/list/index.js +75 -9
  76. package/dist/components/list/index.mjs +6 -6
  77. package/dist/components/list/listItem.js +75 -9
  78. package/dist/components/list/listItem.mjs +4 -4
  79. package/dist/components/modal/index.d.mts +0 -3
  80. package/dist/components/modal/index.d.ts +0 -3
  81. package/dist/components/modal/index.js +205 -158
  82. package/dist/components/modal/index.mjs +9 -7
  83. package/dist/components/modal/modal.d.mts +43 -105
  84. package/dist/components/modal/modal.d.ts +43 -105
  85. package/dist/components/modal/modal.js +206 -164
  86. package/dist/components/modal/modal.mjs +10 -10
  87. package/dist/components/pagination/index.js +76 -10
  88. package/dist/components/pagination/index.mjs +4 -4
  89. package/dist/components/pagination/pagination.js +76 -10
  90. package/dist/components/pagination/pagination.mjs +4 -4
  91. package/dist/components/ripple/index.mjs +3 -3
  92. package/dist/components/select/index.js +75 -9
  93. package/dist/components/select/index.mjs +4 -4
  94. package/dist/components/select/option.js +75 -9
  95. package/dist/components/select/option.mjs +3 -3
  96. package/dist/components/select/select.js +75 -9
  97. package/dist/components/select/select.mjs +4 -4
  98. package/dist/components/table/form-table.d.mts +52 -0
  99. package/dist/components/table/form-table.d.ts +52 -0
  100. package/dist/components/table/form-table.js +365 -0
  101. package/dist/components/table/form-table.mjs +9 -0
  102. package/dist/components/table/index.d.mts +2 -0
  103. package/dist/components/table/index.d.ts +2 -0
  104. package/dist/components/table/index.js +119 -10
  105. package/dist/components/table/index.mjs +11 -7
  106. package/dist/components/table/table.js +76 -10
  107. package/dist/components/table/table.mjs +6 -6
  108. package/dist/components/toast/index.js +239 -97
  109. package/dist/components/toast/index.mjs +5 -4
  110. package/dist/components/toast/toast.d.mts +40 -81
  111. package/dist/components/toast/toast.d.ts +40 -81
  112. package/dist/components/toast/toast.js +210 -56
  113. package/dist/components/toast/toast.mjs +4 -3
  114. package/dist/components/toast/use-toast.d.mts +6 -10
  115. package/dist/components/toast/use-toast.d.ts +6 -10
  116. package/dist/components/toast/use-toast.js +239 -97
  117. package/dist/components/toast/use-toast.mjs +5 -4
  118. package/dist/components/tree/index.d.mts +2 -0
  119. package/dist/components/tree/index.d.ts +2 -0
  120. package/dist/components/tree/index.js +4371 -0
  121. package/dist/components/tree/index.mjs +15 -0
  122. package/dist/components/tree/tree.d.mts +20 -0
  123. package/dist/components/tree/tree.d.ts +20 -0
  124. package/dist/components/tree/tree.js +4365 -0
  125. package/dist/components/tree/tree.mjs +14 -0
  126. package/dist/folder-RO3QTLGS.svg +9 -0
  127. package/dist/index.d.mts +3 -0
  128. package/dist/index.d.ts +3 -0
  129. package/dist/index.js +574 -434
  130. package/dist/index.mjs +63 -52
  131. package/package.json +1 -1
  132. package/types/images.d.ts +14 -0
  133. package/dist/chunk-5OBP42D6.mjs +0 -117
  134. package/dist/chunk-HDNQOLUJ.mjs +0 -83
  135. package/dist/chunk-RXIFDECK.mjs +0 -213
  136. /package/dist/{chunk-2UUH2MBF.mjs → chunk-DX3KXNP6.mjs} +0 -0
package/dist/index.mjs CHANGED
@@ -5,29 +5,40 @@ import {
5
5
  } from "./chunk-Z2537DF6.mjs";
6
6
  import "./chunk-ZMOAFSYE.mjs";
7
7
  import "./chunk-WSIADHVC.mjs";
8
- import "./chunk-2UUH2MBF.mjs";
8
+ import "./chunk-MBLZYQCN.mjs";
9
9
  import {
10
- table_default
11
- } from "./chunk-3TJAGKKY.mjs";
12
- import "./chunk-63WXGSTV.mjs";
13
- import "./chunk-3DPVPTHL.mjs";
14
- import "./chunk-3MY6LO7N.mjs";
15
- import {
16
- tabs_default
17
- } from "./chunk-2YMAKIZ6.mjs";
10
+ tree_default
11
+ } from "./chunk-BPVRXFIC.mjs";
18
12
  import "./chunk-RRAZM5D3.mjs";
19
13
  import {
20
14
  textarea_default
21
15
  } from "./chunk-BKE6QF6W.mjs";
16
+ import "./chunk-3MY6LO7N.mjs";
17
+ import {
18
+ tabs_default
19
+ } from "./chunk-2YMAKIZ6.mjs";
22
20
  import "./chunk-LUWGOKLG.mjs";
23
21
  import {
24
22
  ToastProvider,
25
23
  useToast
26
- } from "./chunk-HDNQOLUJ.mjs";
24
+ } from "./chunk-YBDA3WQP.mjs";
27
25
  import "./chunk-ZOTHPHXA.mjs";
28
26
  import {
29
27
  toast_default
30
- } from "./chunk-5OBP42D6.mjs";
28
+ } from "./chunk-OUAKGMDW.mjs";
29
+ import "./chunk-LVFI2NOH.mjs";
30
+ import {
31
+ switch_default
32
+ } from "./chunk-Z74QNVPG.mjs";
33
+ import "./chunk-DX3KXNP6.mjs";
34
+ import {
35
+ form_table_default
36
+ } from "./chunk-3BKCODIL.mjs";
37
+ import {
38
+ table_default
39
+ } from "./chunk-LNYMVBV5.mjs";
40
+ import "./chunk-63WXGSTV.mjs";
41
+ import "./chunk-3DPVPTHL.mjs";
31
42
  import "./chunk-DQRAFUDA.mjs";
32
43
  import {
33
44
  scrollArea_default
@@ -35,17 +46,17 @@ import {
35
46
  import "./chunk-QCEKPS7U.mjs";
36
47
  import {
37
48
  select_default
38
- } from "./chunk-MJT6ZW4C.mjs";
39
- import "./chunk-P6NVCCBZ.mjs";
49
+ } from "./chunk-BXXAMH3R.mjs";
40
50
  import "./chunk-S3QS5B7F.mjs";
41
- import "./chunk-LVFI2NOH.mjs";
51
+ import "./chunk-OF3X4BXG.mjs";
52
+ import "./chunk-DJOG6Z35.mjs";
42
53
  import {
43
- switch_default
44
- } from "./chunk-Z74QNVPG.mjs";
54
+ modal_default
55
+ } from "./chunk-ZUSUVPYV.mjs";
45
56
  import "./chunk-7B7LRG5J.mjs";
46
57
  import {
47
58
  pagination_default
48
- } from "./chunk-UHFJ7ZFM.mjs";
59
+ } from "./chunk-EGHTZLZJ.mjs";
49
60
  import "./chunk-F3HENRVM.mjs";
50
61
  import "./chunk-TPFN22HR.mjs";
51
62
  import {
@@ -54,68 +65,66 @@ import {
54
65
  import "./chunk-2GCSFWHD.mjs";
55
66
  import {
56
67
  input_default
57
- } from "./chunk-7TXQPX4O.mjs";
58
- import "./chunk-DJOG6Z35.mjs";
59
- import {
60
- modal_default
61
- } from "./chunk-RXIFDECK.mjs";
68
+ } from "./chunk-JOCMCOEK.mjs";
69
+ import "./chunk-QZ3LVYJW.mjs";
62
70
  import "./chunk-MGEWSREV.mjs";
71
+ import {
72
+ chip_default
73
+ } from "./chunk-6HX3PPL6.mjs";
63
74
  import "./chunk-75HLCORR.mjs";
64
75
  import {
65
76
  dateTimePicker_default
66
- } from "./chunk-QIDZXCYP.mjs";
67
- import "./chunk-5ANQDLRS.mjs";
68
- import "./chunk-AG7AWQKH.mjs";
77
+ } from "./chunk-EYVRTVRM.mjs";
78
+ import "./chunk-Q72LZAPG.mjs";
79
+ import "./chunk-OWG4RL2T.mjs";
69
80
  import "./chunk-7MVEAQ7Z.mjs";
81
+ import {
82
+ listItem_default
83
+ } from "./chunk-PZIVMTKX.mjs";
70
84
  import {
71
85
  list_default
72
86
  } from "./chunk-HIVPDIEP.mjs";
73
- import {
74
- listItem_default
75
- } from "./chunk-FONJYZKH.mjs";
76
87
  import "./chunk-FWJ2ZKH6.mjs";
77
88
  import "./chunk-P732YGHO.mjs";
78
- import "./chunk-QZ3LVYJW.mjs";
79
- import {
80
- checkbox_default
81
- } from "./chunk-D6QI3DJG.mjs";
82
- import {
83
- chip_default
84
- } from "./chunk-BFM3LPBK.mjs";
85
- import "./chunk-7DLOYKVC.mjs";
86
- import {
87
- avatar_default
88
- } from "./chunk-UYPVP36M.mjs";
89
- import "./chunk-SE5TU755.mjs";
90
- import {
91
- backdrop_default
92
- } from "./chunk-LL6F3WDX.mjs";
93
89
  import "./chunk-KYIODWXL.mjs";
94
90
  import {
95
91
  breadcrumb_default
96
- } from "./chunk-RPDPB4JP.mjs";
92
+ } from "./chunk-6KXBXGYR.mjs";
97
93
  import "./chunk-MY5U63QO.mjs";
98
94
  import {
99
95
  button_group_default
100
96
  } from "./chunk-LPZOH3RP.mjs";
101
97
  import {
102
98
  button_default
103
- } from "./chunk-7A5M7DRD.mjs";
99
+ } from "./chunk-PNRS23HE.mjs";
104
100
  import {
105
101
  icon_button_default
106
- } from "./chunk-K7Z6PVXE.mjs";
102
+ } from "./chunk-VQROXH43.mjs";
107
103
  import "./chunk-6WSACUIB.mjs";
108
- import "./chunk-6PNKRBUT.mjs";
109
104
  import "./chunk-LXHUO6VM.mjs";
110
- import {
111
- text_button_default
112
- } from "./chunk-WFMFC7R6.mjs";
105
+ import "./chunk-6PNKRBUT.mjs";
113
106
  import "./chunk-ZYIIXWVY.mjs";
114
107
  import {
115
108
  Icon_default,
116
109
  iconTemplate
117
- } from "./chunk-DADMVOYI.mjs";
118
- import "./chunk-A7OXEUCC.mjs";
110
+ } from "./chunk-HWL7TPUN.mjs";
111
+ import {
112
+ text_button_default
113
+ } from "./chunk-WFMFC7R6.mjs";
114
+ import {
115
+ checkbox_default
116
+ } from "./chunk-D6QI3DJG.mjs";
117
+ import "./chunk-7USF56CT.mjs";
118
+ import "./chunk-IZM66FHP.mjs";
119
+ import "./chunk-SE5TU755.mjs";
120
+ import {
121
+ backdrop_default
122
+ } from "./chunk-LL6F3WDX.mjs";
123
+ import "./chunk-7DLOYKVC.mjs";
124
+ import {
125
+ avatar_default
126
+ } from "./chunk-XQGD4ZIX.mjs";
127
+ import "./chunk-3IU2RPSM.mjs";
119
128
  import {
120
129
  deepnoidUi,
121
130
  tv
@@ -132,6 +141,7 @@ export {
132
141
  checkbox_default as CheckBox,
133
142
  chip_default as Chip,
134
143
  dateTimePicker_default as DateTimePicker,
144
+ form_table_default as FormTable,
135
145
  Icon_default as Icon,
136
146
  icon_button_default as IconButton,
137
147
  input_default as Input,
@@ -150,6 +160,7 @@ export {
150
160
  toast_default as Toast,
151
161
  ToastProvider,
152
162
  tooltip_default as Tooltip,
163
+ tree_default as Tree,
153
164
  deepnoidUi,
154
165
  iconTemplate,
155
166
  tv,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/ui",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -0,0 +1,14 @@
1
+ declare module "*.png" {
2
+ const value: string;
3
+ export default value;
4
+ }
5
+
6
+ declare module "*.jpg" {
7
+ const value: string;
8
+ export default value;
9
+ }
10
+
11
+ declare module "*.svg" {
12
+ const value: string;
13
+ export default value;
14
+ }
@@ -1,117 +0,0 @@
1
- "use client";
2
- import {
3
- Icon_default
4
- } from "./chunk-DADMVOYI.mjs";
5
- import {
6
- tv
7
- } from "./chunk-4ZJFD3L3.mjs";
8
- import {
9
- mapPropsVariants
10
- } from "./chunk-E3G5QXSH.mjs";
11
-
12
- // src/components/toast/toast.tsx
13
- import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef } from "react";
14
- import { jsx, jsxs } from "react/jsx-runtime";
15
- var Toast = forwardRef((originalProps, ref) => {
16
- const [props, variantProps] = mapPropsVariants(originalProps, toast.variantKeys);
17
- const { width = 300, placement, classNames, showIcon = true, showCloseButton = true, onClose, ...toastProps } = props;
18
- const slots = useMemo(() => toast({ ...variantProps }), [variantProps]);
19
- const toastRef = useRef(null);
20
- useImperativeHandle(
21
- ref,
22
- () => ({
23
- getWidth: () => {
24
- if (toastRef.current) {
25
- return toastRef.current.offsetWidth;
26
- }
27
- }
28
- }),
29
- []
30
- );
31
- const getBaseProps = useCallback(
32
- () => ({
33
- className: slots.base({
34
- class: [
35
- classNames == null ? void 0 : classNames.base,
36
- width ? `w-[${width}px]` : "",
37
- (placement == null ? void 0 : placement.includes("top")) ? "animate-slideInFromTop" : "animate-slideInFromBottom"
38
- ]
39
- })
40
- }),
41
- [slots, classNames == null ? void 0 : classNames.base]
42
- );
43
- return /* @__PURE__ */ jsxs("div", { ref: toastRef, ...getBaseProps(), children: [
44
- showIcon && /* @__PURE__ */ jsx(Icon_default, { name: originalProps.icon || "info-circle", fill: true, className: "mt-[2px]" }),
45
- /* @__PURE__ */ jsx("div", { className: "flex-1 select-none", children: props.content }),
46
- showCloseButton && /* @__PURE__ */ jsx(Icon_default, { name: "close", className: "cursor-pointer mt-[2px]", onClick: onClose })
47
- ] });
48
- });
49
- Toast.displayName = "Toast";
50
- var toast_default = Toast;
51
- var toast = tv({
52
- slots: {
53
- base: [
54
- "relative",
55
- "inline-flex",
56
- "items-start",
57
- "border",
58
- "rounded-md",
59
- "text-md",
60
- "p-[10px]",
61
- "gap-[5px]",
62
- "z-0",
63
- "transition-all",
64
- "duration-300",
65
- "overflow-auto"
66
- ],
67
- content: [
68
- "absolute",
69
- "top-0",
70
- "left-0",
71
- "inline-flex",
72
- "items-center",
73
- "justify-center",
74
- "font-[500]",
75
- "text-white",
76
- "bg-trans-strong"
77
- ]
78
- },
79
- variants: {
80
- color: {
81
- primary: {
82
- base: "bg-primary-soft border-primary-light text-primary-main"
83
- },
84
- secondary: {
85
- base: "bg-secondary-soft border-secondary-light text-secondary-main"
86
- },
87
- default: {
88
- base: "bg-default-soft border-default-light text-default-main"
89
- },
90
- success: {
91
- base: "bg-success-soft border-success-light text-success-main"
92
- },
93
- info: {
94
- base: "bg-info-soft border-info-light text-info-main"
95
- },
96
- warning: {
97
- base: "bg-warning-soft border-warning-light text-warning-main"
98
- },
99
- danger: {
100
- base: "bg-danger-soft border-danger-light text-danger-main"
101
- }
102
- },
103
- disableAnimation: {
104
- true: {
105
- base: "animate-none"
106
- }
107
- }
108
- },
109
- defaultVariants: {
110
- color: "default",
111
- disableAnimation: false
112
- }
113
- });
114
-
115
- export {
116
- toast_default
117
- };
@@ -1,83 +0,0 @@
1
- "use client";
2
- import {
3
- getToastPosition
4
- } from "./chunk-ZOTHPHXA.mjs";
5
- import {
6
- toast_default
7
- } from "./chunk-5OBP42D6.mjs";
8
-
9
- // src/components/toast/use-toast.tsx
10
- import { createContext, useContext, useState, useCallback, useEffect, useRef } from "react";
11
- import { jsx, jsxs } from "react/jsx-runtime";
12
- var ToastContext = createContext(null);
13
- var useToast = () => {
14
- const context = useContext(ToastContext);
15
- if (!context) {
16
- throw new Error("useToast must be used within a ToastProvider");
17
- }
18
- return context;
19
- };
20
- var ToastProvider = ({
21
- globalOptions,
22
- children
23
- }) => {
24
- const [toasts, setToasts] = useState([]);
25
- const [containerStyle, setContainerStyle] = useState({});
26
- const toastRef = useRef(null);
27
- const addToast = useCallback((content, options) => {
28
- const id = Date.now() + Math.floor(Math.random() * 1e5);
29
- const newToast = {
30
- id,
31
- content,
32
- ...options
33
- };
34
- setToasts((prevToasts) => [...prevToasts, newToast]);
35
- setTimeout(() => {
36
- setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id));
37
- }, options.duration || 3e3);
38
- }, []);
39
- const removeToast = useCallback((id) => {
40
- setToasts((prevToasts) => prevToasts.filter((toast) => toast.id !== id));
41
- }, []);
42
- const value = {
43
- default: (content, options) => addToast(content, { type: "default", icon: "info-circle", color: "default", ...globalOptions, ...options }),
44
- info: (content, options) => addToast(content, { type: "info", icon: "info-circle", color: "info", ...globalOptions, ...options }),
45
- success: (content, options) => addToast(content, { type: "success", icon: "check-circle", color: "success", ...globalOptions, ...options }),
46
- warning: (content, options) => addToast(content, {
47
- type: "warning",
48
- icon: "exclamation-triangle",
49
- color: "warning",
50
- ...globalOptions,
51
- ...options
52
- }),
53
- error: (content, options) => addToast(content, { type: "error", icon: "exclamation-circle", color: "danger", ...globalOptions, ...options })
54
- };
55
- useEffect(() => {
56
- var _a;
57
- const width = (globalOptions == null ? void 0 : globalOptions.width) ? globalOptions == null ? void 0 : globalOptions.width : typeof ((_a = toastRef.current) == null ? void 0 : _a.getWidth) === "function" ? toastRef.current.getWidth() : 300;
58
- const offset = 20;
59
- const calculatePosition = () => {
60
- const placement = (globalOptions == null ? void 0 : globalOptions.placement) || "bottom-right";
61
- const { top, left, bottom, right } = getToastPosition(placement, width, offset);
62
- setContainerStyle({
63
- position: "fixed",
64
- top: top !== void 0 ? `${top}px` : void 0,
65
- left: left !== void 0 ? `${left}px` : void 0,
66
- bottom: bottom !== void 0 ? `${bottom}px` : void 0,
67
- right: right !== void 0 ? `${right}px` : void 0
68
- });
69
- };
70
- calculatePosition();
71
- window.addEventListener("resize", calculatePosition);
72
- return () => window.removeEventListener("resize", calculatePosition);
73
- }, [globalOptions == null ? void 0 : globalOptions.placement, globalOptions == null ? void 0 : globalOptions.width]);
74
- return /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
75
- children,
76
- /* @__PURE__ */ jsx("div", { id: "deepnoid-toast-container", className: "flex flex-col gap-[10px]", style: containerStyle, children: toasts.map((toast) => /* @__PURE__ */ jsx(toast_default, { ref: toastRef, onClose: () => removeToast(toast.id), ...toast }, toast.id)) })
77
- ] });
78
- };
79
-
80
- export {
81
- useToast,
82
- ToastProvider
83
- };
@@ -1,213 +0,0 @@
1
- "use client";
2
- import {
3
- button_default
4
- } from "./chunk-7A5M7DRD.mjs";
5
- import {
6
- Icon_default
7
- } from "./chunk-DADMVOYI.mjs";
8
- import {
9
- tv
10
- } from "./chunk-4ZJFD3L3.mjs";
11
- import {
12
- mapPropsVariants
13
- } from "./chunk-E3G5QXSH.mjs";
14
-
15
- // src/components/modal/modal.tsx
16
- import { forwardRef, useCallback, useMemo, useEffect } from "react";
17
- import { createPortal } from "react-dom";
18
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
- var Modal = forwardRef((originalProps, ref) => {
20
- const [props, variantProps] = mapPropsVariants(originalProps, modal.variantKeys);
21
- const {
22
- classNames,
23
- isOpen,
24
- icon,
25
- title,
26
- subTitle,
27
- content,
28
- confirmButtonText,
29
- cancelButtonText,
30
- showCloseButton,
31
- isDismissable = true,
32
- isKeyboardDismissDisabled = false,
33
- onConfirm,
34
- onCancel
35
- } = props;
36
- const slots = useMemo(() => modal({ ...variantProps }), [...Object.values(variantProps)]);
37
- const getBackdropProps = useCallback(
38
- () => ({
39
- className: slots.backdrop({ class: classNames == null ? void 0 : classNames.backdrop }),
40
- onClick: (e) => {
41
- if (isDismissable && e.target === e.currentTarget && onCancel) {
42
- onCancel();
43
- }
44
- }
45
- }),
46
- [slots, classNames == null ? void 0 : classNames.backdrop, isDismissable, onCancel]
47
- );
48
- const getModalWrapperProps = useCallback(
49
- () => ({
50
- className: slots.modalWrapper({ class: classNames == null ? void 0 : classNames.modalWrapper }),
51
- "data-icon-visibility": typeof icon !== "undefined"
52
- }),
53
- [slots, classNames == null ? void 0 : classNames.modalWrapper, icon]
54
- );
55
- const getIconProps = useCallback(
56
- () => ({
57
- className: slots.icon({ class: [classNames == null ? void 0 : classNames.icon] })
58
- }),
59
- [slots, classNames == null ? void 0 : classNames.icon]
60
- );
61
- const getCloseIconProps = useCallback(
62
- () => ({
63
- className: slots.closeIcon({ class: [classNames == null ? void 0 : classNames.closeIcon, showCloseButton ? "" : "hidden"] })
64
- }),
65
- [slots, classNames == null ? void 0 : classNames.closeIcon, showCloseButton]
66
- );
67
- const getBodyWrapperProps = useCallback(
68
- () => ({
69
- className: slots.bodyWrapper({ class: classNames == null ? void 0 : classNames.bodyWrapper })
70
- }),
71
- [slots, classNames == null ? void 0 : classNames.bodyWrapper]
72
- );
73
- const getTitleWrapperProps = useCallback(
74
- () => ({
75
- className: slots.titleWrapper({ class: classNames == null ? void 0 : classNames.titleWrapper })
76
- }),
77
- [slots, classNames == null ? void 0 : classNames.titleWrapper]
78
- );
79
- const getTitleProps = useCallback(
80
- () => ({
81
- className: slots.title({ class: classNames == null ? void 0 : classNames.title })
82
- }),
83
- [slots, classNames == null ? void 0 : classNames.title]
84
- );
85
- const getSubTitleProps = useCallback(
86
- () => ({
87
- className: slots.subTitle({ class: classNames == null ? void 0 : classNames.subTitle })
88
- }),
89
- [slots, classNames == null ? void 0 : classNames.subTitle]
90
- );
91
- const getBodyProps = useCallback(
92
- () => ({
93
- className: slots.body({ class: classNames == null ? void 0 : classNames.body })
94
- }),
95
- [slots, classNames == null ? void 0 : classNames.body]
96
- );
97
- const getContentProps = useCallback(
98
- () => ({
99
- className: slots.content({ class: classNames == null ? void 0 : classNames.content })
100
- }),
101
- [slots, classNames == null ? void 0 : classNames.content]
102
- );
103
- const getFooterWrapperProps = useCallback(
104
- () => ({
105
- className: slots.footerWrapper({ class: classNames == null ? void 0 : classNames.footerWrapper })
106
- }),
107
- [slots, classNames == null ? void 0 : classNames.footerWrapper]
108
- );
109
- useEffect(() => {
110
- if (isOpen) {
111
- document.body.classList.add("overflow-hidden");
112
- } else {
113
- document.body.classList.remove("overflow-hidden");
114
- }
115
- if (!isOpen || isKeyboardDismissDisabled) return;
116
- const handleKeyDown = (e) => {
117
- if (e.key === "Escape" && onCancel) {
118
- onCancel();
119
- }
120
- };
121
- document.addEventListener("keydown", handleKeyDown);
122
- return () => {
123
- document.removeEventListener("keydown", handleKeyDown);
124
- document.body.classList.remove("overflow-hidden");
125
- };
126
- }, [isOpen, isKeyboardDismissDisabled, onCancel]);
127
- return /* @__PURE__ */ jsx(Fragment, { children: isOpen && createPortal(
128
- /* @__PURE__ */ jsx("div", { ...getBackdropProps(), children: /* @__PURE__ */ jsxs("div", { ref, ...getModalWrapperProps(), children: [
129
- typeof icon === "string" ? /* @__PURE__ */ jsx("div", { ...getIconProps(), children: /* @__PURE__ */ jsx(Icon_default, { name: icon, className: "h-[80px] w-[80px]" }) }) : /* @__PURE__ */ jsx("div", { ...getIconProps(), children: icon }),
130
- /* @__PURE__ */ jsxs("div", { ...getBodyWrapperProps(), children: [
131
- showCloseButton && /* @__PURE__ */ jsx(Icon_default, { name: "close", ...getCloseIconProps(), onClick: onCancel }),
132
- /* @__PURE__ */ jsxs("div", { ...getBodyProps(), children: [
133
- (title || subTitle) && /* @__PURE__ */ jsxs("div", { ...getTitleWrapperProps(), children: [
134
- title && /* @__PURE__ */ jsx("div", { ...getTitleProps(), children: title }),
135
- subTitle && /* @__PURE__ */ jsx("div", { ...getSubTitleProps(), children: subTitle })
136
- ] }),
137
- content && typeof content === "string" ? /* @__PURE__ */ jsx("div", { ...getContentProps(), children: content }) : content,
138
- (cancelButtonText || confirmButtonText) && /* @__PURE__ */ jsxs("div", { ...getFooterWrapperProps(), children: [
139
- cancelButtonText && /* @__PURE__ */ jsx(button_default, { variant: "outline", color: originalProps.color, fullWidth: true, onClick: onCancel, children: cancelButtonText }),
140
- confirmButtonText && /* @__PURE__ */ jsx(button_default, { size: "md", color: originalProps.color, fullWidth: true, onClick: onConfirm, children: confirmButtonText })
141
- ] })
142
- ] })
143
- ] })
144
- ] }) }),
145
- document.body
146
- ) });
147
- });
148
- Modal.displayName = "Modal";
149
- var modal_default = Modal;
150
- var modal = tv({
151
- slots: {
152
- backdrop: ["relative w-screen h-screen fixed inset-0 bg-black/60", "z-[900]"],
153
- modalWrapper: ["group/modal", "absolute", "top-1/2", "-translate-y-1/2", "left-1/2", "-translate-x-1/2"],
154
- icon: ["absolute", "top-[-40px]", "left-1/2", "-translate-x-1/2", "z-10"],
155
- closeIcon: [
156
- "absolute",
157
- "top-[20px]",
158
- "right-[20px]",
159
- "cursor-pointer",
160
- "z-10",
161
- "group-data-[icon-visibility=true]/modal:top-[80px]"
162
- ],
163
- titleWrapper: ["relative", "flex", "flex-col", "gap-[10px]"],
164
- title: "text-h5 text-center text-foreground",
165
- subTitle: "text-lg text-center text-neutral-dark",
166
- bodyWrapper: [
167
- "min-w-[400px]",
168
- "flex flex-col justify-center",
169
- "p-[20px]",
170
- "bg-background",
171
- "shadow-drop shadow-foreground/20 rounded-xxlg",
172
- "overflow-hidden",
173
- "group-data-[icon-visibility=true]/modal:mt-[0]",
174
- "group-data-[icon-visibility=true]/modal:pt-[60px]"
175
- ],
176
- body: ["flex", "flex-col", "gap-[20px]"],
177
- content: ["text-md text-center", "break-words", "bg-neutral-soft", "rounded-[5px]", "p-[10px]"],
178
- footerWrapper: ["flex gap-[20px]"]
179
- },
180
- variants: {
181
- color: {
182
- primary: {
183
- icon: "text-primary-main"
184
- },
185
- secondary: {
186
- icon: "text-secondary-main"
187
- },
188
- neutral: {
189
- icon: "text-neutral-main"
190
- },
191
- success: {
192
- icon: "text-success-main"
193
- },
194
- info: {
195
- icon: "text-info-main"
196
- },
197
- warning: {
198
- icon: "text-warning-main"
199
- },
200
- danger: {
201
- icon: "text-danger-main"
202
- }
203
- }
204
- },
205
- defaultVariants: {
206
- color: "primary"
207
- }
208
- });
209
-
210
- export {
211
- modal_default,
212
- modal
213
- };
File without changes