@deepnoid/ui 0.0.83 → 0.0.86

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 (83) hide show
  1. package/dist/{chunk-GJKNTX2T.mjs → chunk-AHORH5PH.mjs} +6 -4
  2. package/dist/{chunk-7LYJAJIS.mjs → chunk-EWKYBS7I.mjs} +13 -6
  3. package/dist/chunk-FRIK4CS7.mjs +83 -0
  4. package/dist/chunk-HH2LF2SU.mjs +113 -0
  5. package/dist/{chunk-H737LHAY.mjs → chunk-KA4L5SCT.mjs} +8 -8
  6. package/dist/{chunk-BHSCW5D6.mjs → chunk-LGELMZCN.mjs} +1 -1
  7. package/dist/{chunk-6U736HAX.mjs → chunk-PSXPOYLX.mjs} +1 -1
  8. package/dist/{chunk-WIKB37T7.mjs → chunk-QCOPD2HG.mjs} +1 -1
  9. package/dist/{chunk-TLYAFXE2.mjs → chunk-QURXBWKK.mjs} +1902 -746
  10. package/dist/{chunk-KWOLWE6I.mjs → chunk-RVGOARET.mjs} +2 -2
  11. package/dist/{chunk-FLJ4ZZXV.mjs → chunk-SQLRQTFC.mjs} +1 -1
  12. package/dist/chunk-ZOTHPHXA.mjs +41 -0
  13. package/dist/chunk-ZYIIXWVY.mjs +1 -0
  14. package/dist/components/accordion/accordionItem.js +1905 -749
  15. package/dist/components/accordion/accordionItem.mjs +4 -4
  16. package/dist/components/accordion/index.js +1905 -749
  17. package/dist/components/accordion/index.mjs +4 -4
  18. package/dist/components/icon/Icon.d.mts +499 -1
  19. package/dist/components/icon/Icon.d.ts +499 -1
  20. package/dist/components/icon/Icon.js +1940 -778
  21. package/dist/components/icon/Icon.mjs +6 -4
  22. package/dist/components/icon/index.d.mts +1 -1
  23. package/dist/components/icon/index.d.ts +1 -1
  24. package/dist/components/icon/index.js +1910 -751
  25. package/dist/components/icon/index.mjs +7 -5
  26. package/dist/components/icon/template.d.mts +98 -61
  27. package/dist/components/icon/template.d.ts +98 -61
  28. package/dist/components/icon/template.js +1902 -746
  29. package/dist/components/icon/template.mjs +1 -1
  30. package/dist/components/input/index.js +1912 -756
  31. package/dist/components/input/index.mjs +4 -4
  32. package/dist/components/input/input.js +1912 -756
  33. package/dist/components/input/input.mjs +4 -4
  34. package/dist/components/input/input.test.js +1919 -763
  35. package/dist/components/input/input.test.mjs +4 -4
  36. package/dist/components/modal/index.js +1942 -779
  37. package/dist/components/modal/index.mjs +3 -3
  38. package/dist/components/modal/modal.js +1942 -779
  39. package/dist/components/modal/modal.mjs +3 -3
  40. package/dist/components/modal/modal.test.js +1942 -779
  41. package/dist/components/modal/modal.test.mjs +3 -3
  42. package/dist/components/select/index.js +1905 -749
  43. package/dist/components/select/index.mjs +5 -5
  44. package/dist/components/select/option.js +1905 -749
  45. package/dist/components/select/option.mjs +4 -4
  46. package/dist/components/select/select.js +1905 -749
  47. package/dist/components/select/select.mjs +5 -5
  48. package/dist/components/select/select.test.js +1912 -756
  49. package/dist/components/select/select.test.mjs +5 -5
  50. package/dist/components/table/index.js +1905 -749
  51. package/dist/components/table/index.mjs +5 -5
  52. package/dist/components/table/table-body.js +1905 -749
  53. package/dist/components/table/table-body.mjs +4 -4
  54. package/dist/components/table/table.js +1905 -749
  55. package/dist/components/table/table.mjs +5 -5
  56. package/dist/components/table/table.test.js +1912 -756
  57. package/dist/components/table/table.test.mjs +5 -5
  58. package/dist/components/toast/index.d.mts +9 -0
  59. package/dist/components/toast/index.d.ts +9 -0
  60. package/dist/components/toast/index.js +3830 -0
  61. package/dist/components/toast/index.mjs +21 -0
  62. package/dist/components/toast/toast-utils.d.mts +9 -0
  63. package/dist/components/toast/toast-utils.d.ts +9 -0
  64. package/dist/components/toast/toast-utils.js +64 -0
  65. package/dist/components/toast/toast-utils.mjs +8 -0
  66. package/dist/components/toast/toast.d.mts +207 -0
  67. package/dist/components/toast/toast.d.ts +207 -0
  68. package/dist/components/toast/toast.js +3711 -0
  69. package/dist/components/toast/toast.mjs +13 -0
  70. package/dist/components/toast/toast.test.d.mts +2 -0
  71. package/dist/components/toast/toast.test.d.ts +2 -0
  72. package/dist/components/toast/toast.test.js +16594 -0
  73. package/dist/components/toast/toast.test.mjs +28 -0
  74. package/dist/components/toast/use-toast.d.mts +31 -0
  75. package/dist/components/toast/use-toast.d.ts +31 -0
  76. package/dist/components/toast/use-toast.js +3826 -0
  77. package/dist/components/toast/use-toast.mjs +17 -0
  78. package/dist/index.d.mts +4 -1
  79. package/dist/index.d.ts +4 -1
  80. package/dist/index.js +2244 -764
  81. package/dist/index.mjs +133 -19
  82. package/package.json +3 -2
  83. /package/dist/{chunk-M5PMA3CT.mjs → chunk-LUWGOKLG.mjs} +0 -0
@@ -1,10 +1,11 @@
1
1
  "use client";
2
2
  import {
3
3
  template
4
- } from "./chunk-TLYAFXE2.mjs";
4
+ } from "./chunk-QURXBWKK.mjs";
5
5
 
6
6
  // src/components/icon/Icon.tsx
7
7
  import { jsx } from "react/jsx-runtime";
8
+ var iconTemplate = template;
8
9
  var Icon = ({ name, size = "md", fill = false, className, onClick, ...props }) => {
9
10
  const SVGIcon = template[name];
10
11
  const getInputIconSize = (size2) => {
@@ -12,12 +13,12 @@ var Icon = ({ name, size = "md", fill = false, className, onClick, ...props }) =
12
13
  case "sm":
13
14
  return "size-[15px]";
14
15
  case "md":
15
- return "size-[17px]";
16
+ return "size-[17px] stroke-[1.25px]";
16
17
  case "lg":
17
- return "size-[20px]";
18
+ return "size-[20px] stroke-[1.5px]";
18
19
  }
19
20
  };
20
- return /* @__PURE__ */ jsx("div", { onClick, children: /* @__PURE__ */ jsx(
21
+ return /* @__PURE__ */ jsx("div", { className: "w-fit h-fit", onClick, children: /* @__PURE__ */ jsx(
21
22
  SVGIcon,
22
23
  {
23
24
  fill,
@@ -29,5 +30,6 @@ var Icon = ({ name, size = "md", fill = false, className, onClick, ...props }) =
29
30
  var Icon_default = Icon;
30
31
 
31
32
  export {
33
+ iconTemplate,
32
34
  Icon_default
33
35
  };
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-66WCZEEU.mjs";
5
5
  import {
6
6
  Icon_default
7
- } from "./chunk-GJKNTX2T.mjs";
7
+ } from "./chunk-AHORH5PH.mjs";
8
8
  import {
9
9
  mapPropsVariants
10
10
  } from "./chunk-E3G5QXSH.mjs";
@@ -150,15 +150,22 @@ var modal_default = Modal;
150
150
  var modal = tv({
151
151
  slots: {
152
152
  backdrop: ["relative w-screen h-screen fixed inset-0 bg-black/60", "z-[9999]"],
153
- modalWrapper: ["group", "absolute", "top-1/2", "-translate-y-1/2", "left-1/2", "-translate-x-1/2"],
154
- icon: ["absolute", "top-[20px]", "left-1/2", "-translate-x-1/2", "z-10"],
153
+ modalWrapper: ["group/modal", "absolute", "top-1/2", "-translate-y-1/2", "left-1/2", "-translate-x-1/2"],
154
+ icon: [
155
+ "absolute",
156
+ "top-[20px]",
157
+ "left-1/2",
158
+ "-translate-x-1/2",
159
+ "z-10",
160
+ "group-data-[modal-icon-visibility=true]/modal:top-[80px]"
161
+ ],
155
162
  closeIcon: [
156
163
  "absolute",
157
164
  "top-[20px]",
158
165
  "right-[20px]",
159
166
  "cursor-pointer",
160
167
  "z-10",
161
- "group-data-[icon-visibility=true]:top-[80px]"
168
+ "group-data-[modal-icon-visibility=true]/modal:top-[80px]"
162
169
  ],
163
170
  titleWrapper: ["relative", "flex", "flex-col", "gap-[10px]"],
164
171
  title: "text-h5 text-center text-foreground",
@@ -170,8 +177,8 @@ var modal = tv({
170
177
  "bg-background",
171
178
  "shadow-drop shadow-foreground/20 rounded-xxlg",
172
179
  "overflow-hidden",
173
- "group-data-[icon-visibility=true]:mt-[60px]",
174
- "group-data-[icon-visibility=true]:pt-[60px]"
180
+ "group-data-[modal-icon-visibility=true]/modal:mt-[60px]",
181
+ "group-data-[modal-icon-visibility=true]/modal:pt-[60px]"
175
182
  ],
176
183
  body: ["flex", "flex-col", "gap-[20px]"],
177
184
  content: ["text-md text-center", "break-words", "bg-neutral-soft", "rounded-[5px]", "p-[10px]"],
@@ -0,0 +1,83 @@
1
+ "use client";
2
+ import {
3
+ getToastPosition
4
+ } from "./chunk-ZOTHPHXA.mjs";
5
+ import {
6
+ toast_default
7
+ } from "./chunk-HH2LF2SU.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();
27
+ const addToast = useCallback((content, options) => {
28
+ const id = Date.now();
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 = typeof ((_a = toastRef.current) == null ? void 0 : _a.getWidth) === "function" ? toastRef.current.getWidth() : (globalOptions == null ? void 0 : globalOptions.width) || 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
+ };
@@ -0,0 +1,113 @@
1
+ "use client";
2
+ import {
3
+ Icon_default
4
+ } from "./chunk-AHORH5PH.mjs";
5
+ import {
6
+ mapPropsVariants
7
+ } from "./chunk-E3G5QXSH.mjs";
8
+ import {
9
+ tv
10
+ } from "./chunk-J725QONZ.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 { 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: [classNames == null ? void 0 : classNames.base, (placement == null ? void 0 : placement.includes("top")) ? "animate-slideInFromTop" : "animate-slideInFromBottom"]
35
+ })
36
+ }),
37
+ [slots, classNames == null ? void 0 : classNames.base]
38
+ );
39
+ return /* @__PURE__ */ jsxs("div", { ref: toastRef, ...getBaseProps(), children: [
40
+ showIcon && /* @__PURE__ */ jsx(Icon_default, { name: originalProps.icon || "info-circle", fill: true, className: "mt-[2px]" }),
41
+ /* @__PURE__ */ jsx("div", { className: "flex-1", children: props.content }),
42
+ showCloseButton && /* @__PURE__ */ jsx(Icon_default, { name: "close", className: "cursor-pointer mt-[2px]", onClick: onClose })
43
+ ] });
44
+ });
45
+ Toast.displayName = "Toast";
46
+ var toast_default = Toast;
47
+ var toast = tv({
48
+ slots: {
49
+ base: [
50
+ "w-[300px]",
51
+ "relative",
52
+ "inline-flex",
53
+ "items-start",
54
+ "border",
55
+ "rounded-md",
56
+ "text-md",
57
+ "p-[10px]",
58
+ "gap-[5px]",
59
+ "z-0",
60
+ "transition-all",
61
+ "duration-300"
62
+ ],
63
+ content: [
64
+ "absolute",
65
+ "top-0",
66
+ "left-0",
67
+ "inline-flex",
68
+ "items-center",
69
+ "justify-center",
70
+ "font-[500]",
71
+ "text-white",
72
+ "bg-trans-strong"
73
+ ]
74
+ },
75
+ variants: {
76
+ color: {
77
+ primary: {
78
+ base: "bg-primary-soft border-primary-light text-primary-main"
79
+ },
80
+ secondary: {
81
+ base: "bg-secondary-soft border-secondary-light text-secondary-main"
82
+ },
83
+ default: {
84
+ base: "bg-default-soft border-default-light text-default-main"
85
+ },
86
+ success: {
87
+ base: "bg-success-soft border-success-light text-success-main"
88
+ },
89
+ info: {
90
+ base: "bg-info-soft border-info-light text-info-main"
91
+ },
92
+ warning: {
93
+ base: "bg-warning-soft border-warning-light text-warning-main"
94
+ },
95
+ danger: {
96
+ base: "bg-danger-soft border-danger-light text-danger-main"
97
+ }
98
+ },
99
+ disableAnimation: {
100
+ true: {
101
+ base: "animate-none"
102
+ }
103
+ }
104
+ },
105
+ defaultVariants: {
106
+ color: "default",
107
+ disableAnimation: false
108
+ }
109
+ });
110
+
111
+ export {
112
+ toast_default
113
+ };
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Icon_default
4
- } from "./chunk-GJKNTX2T.mjs";
4
+ } from "./chunk-AHORH5PH.mjs";
5
5
  import {
6
6
  mapPropsVariants
7
7
  } from "./chunk-E3G5QXSH.mjs";
@@ -131,18 +131,18 @@ Input.displayName = "Input";
131
131
  var input_default = Input;
132
132
  var inputStyle = tv({
133
133
  slots: {
134
- base: ["group", "flex", "flex-col"],
134
+ base: ["group/input", "flex", "flex-col"],
135
135
  label: ["flex", "items-center"],
136
136
  innerWrapper: ["flex", "flex-col"],
137
137
  inputWrapper: [
138
138
  "flex",
139
139
  "items-center",
140
- "group-has-[p]:border-danger-main",
141
- "group-has-[p]:bg-danger-soft",
140
+ "group-has-[p]/input:border-danger-main",
141
+ "group-has-[p]/input:bg-danger-soft",
142
142
  "transition duration-200"
143
143
  ],
144
144
  input: ["w-full", "h-full", "bg-transparent", "placeholder:text-neutral-main", "focus-visible:outline-none"],
145
- content: ["flex", "items-center", "group-has-[p]:text-danger-main", "select-none"],
145
+ content: ["flex", "items-center", "group-has-[p]/input:text-danger-main", "select-none"],
146
146
  errorMessage: ["text-danger-main"]
147
147
  },
148
148
  variants: {
@@ -183,19 +183,19 @@ var inputStyle = tv({
183
183
  size: {
184
184
  sm: {
185
185
  base: ["text-sm", "gap-[6px]"],
186
- innerWrapper: ["group-has-[p]:gap-[6px]"],
186
+ innerWrapper: ["group-has-[p]/input:gap-[6px]"],
187
187
  inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[6px]", "py-[4.5px]", "gap-[6px]"],
188
188
  errorMessage: ["text-sm"]
189
189
  },
190
190
  md: {
191
191
  base: ["text-md", "gap-[8px]"],
192
- innerWrapper: ["group-has-[p]:gap-[8px]"],
192
+ innerWrapper: ["group-has-[p]/input:gap-[8px]"],
193
193
  inputWrapper: ["w-[240px]", "h-[30px]", "rounded-md", "px-[8px]", "py-[6.5px]", "gap-[8px]"],
194
194
  errorMessage: ["text-md"]
195
195
  },
196
196
  lg: {
197
197
  base: ["text-lg", "gap-[10px]"],
198
- innerWrapper: ["group-has-[p]:gap-[10px]"],
198
+ innerWrapper: ["group-has-[p]/input:gap-[10px]"],
199
199
  inputWrapper: ["w-[240px]", "h-[36px]", "rounded-lg", "px-[10px]", "py-[8px]", "gap-[10px]"],
200
200
  errorMessage: ["text-lg"]
201
201
  }
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-27Y6K5NK.mjs";
8
8
  import {
9
9
  Icon_default
10
- } from "./chunk-GJKNTX2T.mjs";
10
+ } from "./chunk-AHORH5PH.mjs";
11
11
 
12
12
  // src/components/table/table-body.tsx
13
13
  import React, { useState, useCallback, useEffect } from "react";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-PUFNT5LS.mjs";
5
5
  import {
6
6
  table_body_default
7
- } from "./chunk-BHSCW5D6.mjs";
7
+ } from "./chunk-LGELMZCN.mjs";
8
8
  import {
9
9
  clsx
10
10
  } from "./chunk-27Y6K5NK.mjs";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  Icon_default
4
- } from "./chunk-GJKNTX2T.mjs";
4
+ } from "./chunk-AHORH5PH.mjs";
5
5
  import {
6
6
  mapPropsVariants
7
7
  } from "./chunk-E3G5QXSH.mjs";