@deepnoid/ui 0.1.2 → 0.1.3

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,292 @@
1
+ "use client";
2
+ import {
3
+ Icon_default
4
+ } from "./chunk-24NQEB73.mjs";
5
+ import {
6
+ tv
7
+ } from "./chunk-2ZT6V4QR.mjs";
8
+ import {
9
+ clsx
10
+ } from "./chunk-27Y6K5NK.mjs";
11
+ import {
12
+ mapPropsVariants
13
+ } from "./chunk-E3G5QXSH.mjs";
14
+
15
+ // src/components/input/input.tsx
16
+ import React, { forwardRef, useRef, useCallback, useMemo } from "react";
17
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
18
+ var Input = forwardRef((originalProps, ref) => {
19
+ const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
20
+ const { classNames, label, helperText, errorText, startContent, endContent, ...inputProps } = props;
21
+ const inputRef = useRef(null);
22
+ const slots = useMemo(() => inputStyle({ ...variantProps }), [variantProps]);
23
+ const getContentProps = useCallback(
24
+ () => ({
25
+ className: slots.content({ class: classNames == null ? void 0 : classNames.content }),
26
+ size: originalProps.size
27
+ }),
28
+ [slots, classNames, originalProps.size]
29
+ );
30
+ const renderStartContent = () => {
31
+ if (React.isValidElement(startContent)) {
32
+ const existingProps = startContent.props;
33
+ const mergedProps = {
34
+ ...getContentProps(),
35
+ className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
36
+ };
37
+ return React.cloneElement(startContent, mergedProps);
38
+ } else {
39
+ const contentProps = getContentProps();
40
+ return /* @__PURE__ */ jsx("div", { ...contentProps, children: startContent });
41
+ }
42
+ };
43
+ const renderDateTimePickerIcon = () => /* @__PURE__ */ jsx(
44
+ "div",
45
+ {
46
+ ...getContentProps(),
47
+ onClick: () => {
48
+ const target = ref && "current" in ref ? ref.current : inputRef.current;
49
+ target == null ? void 0 : target.focus();
50
+ target == null ? void 0 : target.showPicker();
51
+ },
52
+ children: /* @__PURE__ */ jsx(Icon_default, { name: props.type === "time" ? "clock" : "calendar", size: originalProps.size, className: "cursor-pointer" })
53
+ }
54
+ );
55
+ const renderContentWithIcon = () => {
56
+ if (React.isValidElement(endContent)) {
57
+ const existingProps = endContent.props;
58
+ const mergedProps = {
59
+ ...getContentProps(),
60
+ className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
61
+ };
62
+ return React.cloneElement(endContent, mergedProps);
63
+ } else if (errorText) {
64
+ const iconProps = { ...getContentProps(), className: getContentProps().className };
65
+ return /* @__PURE__ */ jsx("div", { ...iconProps, children: /* @__PURE__ */ jsx(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
66
+ } else {
67
+ return /* @__PURE__ */ jsx(Fragment, {});
68
+ }
69
+ };
70
+ const renderEndContent = () => {
71
+ switch (props.type) {
72
+ case "date":
73
+ case "datetime-local":
74
+ case "month":
75
+ case "week":
76
+ case "time":
77
+ return renderDateTimePickerIcon();
78
+ default:
79
+ return renderContentWithIcon();
80
+ }
81
+ };
82
+ return /* @__PURE__ */ jsxs(
83
+ "div",
84
+ {
85
+ className: clsx(
86
+ slots.base({ class: classNames == null ? void 0 : classNames.base }),
87
+ variantProps.direction === "horizon" ? slots.horizon({ class: classNames == null ? void 0 : classNames.horizon }) : slots.vertical({ class: classNames == null ? void 0 : classNames.vertical })
88
+ ),
89
+ children: [
90
+ label && /* @__PURE__ */ jsx("label", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), children: label }),
91
+ /* @__PURE__ */ jsxs("div", { className: slots.innerWrapper({ class: classNames == null ? void 0 : classNames.innerWrapper }), children: [
92
+ /* @__PURE__ */ jsxs(
93
+ "div",
94
+ {
95
+ className: clsx(
96
+ slots.inputWrapper({ class: classNames == null ? void 0 : classNames.inputWrapper }),
97
+ inputProps.readOnly ? slots.readonly({ class: classNames == null ? void 0 : classNames.readonly }) : ""
98
+ ),
99
+ children: [
100
+ startContent && renderStartContent(),
101
+ /* @__PURE__ */ jsx("input", { ...inputProps, ref: ref || inputRef, className: slots.input({ class: classNames == null ? void 0 : classNames.input }), size: 0 }),
102
+ renderEndContent()
103
+ ]
104
+ }
105
+ ),
106
+ helperText && !errorText && /* @__PURE__ */ jsx("p", { className: slots.helperText({ class: classNames == null ? void 0 : classNames.helperText }), children: helperText }),
107
+ errorText && /* @__PURE__ */ jsx("p", { className: clsx("error", slots.errorText({ class: classNames == null ? void 0 : classNames.errorText })), children: errorText })
108
+ ] })
109
+ ]
110
+ }
111
+ );
112
+ });
113
+ Input.displayName = "Input";
114
+ var input_default = Input;
115
+ var inputStyle = tv(
116
+ {
117
+ slots: {
118
+ base: ["group/input", "flex"],
119
+ vertical: ["flex-col"],
120
+ horizon: ["flex-row", "gap-0"],
121
+ label: ["flex", "items-center", "font-bold", "text-body-foreground", "min-w-[80px]"],
122
+ innerWrapper: ["flex", "flex-col"],
123
+ inputWrapper: ["flex", "items-center", "duration-200", "group-has-[p.error]/input:bg-danger-soft"],
124
+ input: [
125
+ "w-full",
126
+ "h-full",
127
+ "bg-transparent",
128
+ "text-neutral-main",
129
+ "placeholder:text-neutral-main",
130
+ "outline-none",
131
+ "focus:ring-0",
132
+ "group-has-[:hover]/input:text-neutral-dark",
133
+ "group-has-[:hover]/input:placeholder:text-neutral-dark",
134
+ "group-has-[:focus]/input:text-neutral-dark",
135
+ "group-has-[:focus]/input:placeholder:text-neutral-dark",
136
+ "group-has-[p.error]/input:text-danger-main",
137
+ "group-has-[p.error]/input:placeholder:text-danger-main"
138
+ ],
139
+ content: [
140
+ "flex",
141
+ "items-center",
142
+ "select-none",
143
+ "text-neutral-main",
144
+ "group-has-[:hover]/input:text-neutral-dark",
145
+ "group-has-[p.error]/input:text-danger-main"
146
+ ],
147
+ helperText: ["text-neutral-main", "group-has-[:hover]/input:text-neutral-dark"],
148
+ errorText: ["text-danger-main"],
149
+ readonly: ["pointer-events-none"]
150
+ },
151
+ variants: {
152
+ variant: {
153
+ solid: {
154
+ inputWrapper: ["border-transparent", "bg-trans-soft"],
155
+ readonly: ["!bg-trans-light"]
156
+ },
157
+ outline: {
158
+ inputWrapper: [
159
+ "border-neutral-light",
160
+ "group-has-[:hover]/input:bg-trans-soft",
161
+ "group-has-[:focus]/input:bg-body-background",
162
+ "group-has-[p.error]/input:border-danger-main"
163
+ ],
164
+ readonly: ["!bg-trans-soft"]
165
+ },
166
+ underline: {
167
+ inputWrapper: [
168
+ "bg-transparent",
169
+ "rounded-none",
170
+ "!border-t-transparent",
171
+ "!border-l-transparent",
172
+ "!border-r-transparent",
173
+ "group-has-[:hover]/input:bg-trans-soft",
174
+ "group-has-[:focus]/input:bg-body-background",
175
+ "group-has-[p.error]/input:border-danger-main"
176
+ ],
177
+ readonly: ["!bg-trans-soft"]
178
+ }
179
+ },
180
+ color: {
181
+ primary: {
182
+ content: [
183
+ "group-has-[:focus]/input:text-primary-main",
184
+ "group-has-[:focus:hover]/input:text-primary-main",
185
+ "!group-has-[p.error]:not(input:focus):hover/input:text-primary-main"
186
+ ],
187
+ helperText: [
188
+ "group-has-[:focus]/input:text-primary-main",
189
+ "group-has-[:focus:hover]/input:text-primary-main",
190
+ "group-has-[:focus]/input:hover:text-primary-main"
191
+ ]
192
+ },
193
+ secondary: {
194
+ content: [
195
+ "group-has-[:focus]/input:text-secondary-main",
196
+ "group-has-[:focus:hover]/input:text-secondary-main",
197
+ "!group-has-[p.error]:not(input:focus):hover/input:text-secondary-main"
198
+ ],
199
+ helperText: [
200
+ "group-has-[:focus]/input:text-secondary-main",
201
+ "group-has-[:focus:hover]/input:text-secondary-main",
202
+ "group-has-[:focus]/input:hover:text-secondary-main"
203
+ ]
204
+ }
205
+ },
206
+ size: {
207
+ sm: {
208
+ base: ["text-sm", "gap-[4px]"],
209
+ label: ["text-sm"],
210
+ innerWrapper: ["gap-[4px]"],
211
+ inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]", "gap-[4px]", "border-sm"],
212
+ helperText: ["text-sm"],
213
+ errorText: ["text-sm"]
214
+ },
215
+ md: {
216
+ base: ["text-md", "gap-[6px]"],
217
+ label: ["text-md"],
218
+ innerWrapper: ["gap-[6px]"],
219
+ inputWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]", "gap-[6px]", "border-md"],
220
+ helperText: ["text-sm"],
221
+ errorText: ["text-sm"]
222
+ },
223
+ lg: {
224
+ base: ["text-lg", "gap-[8px]"],
225
+ label: ["text-lg"],
226
+ innerWrapper: ["gap-[8px]"],
227
+ inputWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]", "gap-[8px]", "border-lg"],
228
+ helperText: ["text-md"],
229
+ errorText: ["text-md"]
230
+ },
231
+ xl: {
232
+ base: ["text-xl", "gap-[10px]"],
233
+ label: ["text-xl"],
234
+ innerWrapper: ["gap-[10px]"],
235
+ inputWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]", "gap-[10px]", "border-xl"],
236
+ helperText: ["text-md"],
237
+ errorText: ["text-md"]
238
+ }
239
+ },
240
+ direction: {
241
+ vertical: "",
242
+ horizon: ""
243
+ },
244
+ full: {
245
+ true: {
246
+ base: ["w-full"],
247
+ innerWrapper: ["flex-1"],
248
+ inputWrapper: ["w-full"]
249
+ }
250
+ },
251
+ disabled: {
252
+ true: {
253
+ inputWrapper: ["!bg-neutral-soft", "pointer-events-none", "!group-has-[p.error]/input:text-danger-light"],
254
+ input: [
255
+ "text-neutral-light",
256
+ "placeholder:text-neutral-light",
257
+ "group-has-[p.error]/input:text-danger-light",
258
+ "group-has-[p.error]/input:placeholder:text-danger-light"
259
+ ],
260
+ content: ["text-neutral-light", "group-has-[p.error]/input:text-danger-light"],
261
+ helperText: ["!text-neutral-light"],
262
+ errorText: ["!text-danger-light"]
263
+ }
264
+ }
265
+ },
266
+ compoundVariants: [
267
+ {
268
+ disabled: true,
269
+ variant: ["outline", "underline"],
270
+ class: {
271
+ inputWrapper: ["!bg-body-background", "group-has-[p.error]/input:border-danger-light"]
272
+ }
273
+ }
274
+ ],
275
+ defaultVariants: {
276
+ variant: "solid",
277
+ color: "primary",
278
+ size: "md",
279
+ direction: "vertical",
280
+ disabled: false,
281
+ readonly: false
282
+ }
283
+ },
284
+ {
285
+ twMerge: false
286
+ }
287
+ );
288
+
289
+ export {
290
+ input_default,
291
+ inputStyle
292
+ };
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-OQS4LGZK.mjs";
8
8
  import {
9
9
  pagination_default
10
- } from "./chunk-OELLMF2V.mjs";
10
+ } from "./chunk-X7FHRV4S.mjs";
11
11
  import {
12
12
  mapPropsVariants
13
13
  } from "./chunk-E3G5QXSH.mjs";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  timePicker_default
4
- } from "./chunk-VP3NVHFU.mjs";
4
+ } from "./chunk-YCMZELLD.mjs";
5
5
  import {
6
6
  useDatePicker
7
7
  } from "./chunk-FWJ2ZKH6.mjs";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-F3HENRVM.mjs";
5
5
  import {
6
6
  input_default
7
- } from "./chunk-OYNGJ33M.mjs";
7
+ } from "./chunk-B6CXZCXQ.mjs";
8
8
  import {
9
9
  Icon_default
10
10
  } from "./chunk-24NQEB73.mjs";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VVOOYDJS.mjs";
5
5
  import {
6
6
  listItem_default
7
- } from "./chunk-KWWYMTJP.mjs";
7
+ } from "./chunk-AYWI2CRE.mjs";
8
8
 
9
9
  // src/components/dateTimePicker/timePicker.tsx
10
10
  import { useState, useRef, useEffect } from "react";
@@ -2,17 +2,17 @@
2
2
  import {
3
3
  dateTimePickerStyle,
4
4
  dateTimePicker_default
5
- } from "../../chunk-DNFBQYVG.mjs";
6
- import "../../chunk-VP3NVHFU.mjs";
5
+ } from "../../chunk-SSEQSF5F.mjs";
6
+ import "../../chunk-YCMZELLD.mjs";
7
7
  import "../../chunk-7MVEAQ7Z.mjs";
8
8
  import "../../chunk-VVOOYDJS.mjs";
9
- import "../../chunk-KWWYMTJP.mjs";
9
+ import "../../chunk-AYWI2CRE.mjs";
10
10
  import "../../chunk-FWJ2ZKH6.mjs";
11
11
  import "../../chunk-HKXUNG3H.mjs";
12
12
  import "../../chunk-P732YGHO.mjs";
13
+ import "../../chunk-CF6O6TCF.mjs";
13
14
  import "../../chunk-ZYIIXWVY.mjs";
14
15
  import "../../chunk-24NQEB73.mjs";
15
- import "../../chunk-CF6O6TCF.mjs";
16
16
  import "../../chunk-P2TMIZRH.mjs";
17
17
  import "../../chunk-2ZT6V4QR.mjs";
18
18
  import "../../chunk-E3G5QXSH.mjs";
@@ -2,17 +2,17 @@
2
2
  import "../../chunk-75HLCORR.mjs";
3
3
  import {
4
4
  dateTimePicker_default
5
- } from "../../chunk-DNFBQYVG.mjs";
6
- import "../../chunk-VP3NVHFU.mjs";
5
+ } from "../../chunk-SSEQSF5F.mjs";
6
+ import "../../chunk-YCMZELLD.mjs";
7
7
  import "../../chunk-7MVEAQ7Z.mjs";
8
8
  import "../../chunk-VVOOYDJS.mjs";
9
- import "../../chunk-KWWYMTJP.mjs";
9
+ import "../../chunk-AYWI2CRE.mjs";
10
10
  import "../../chunk-FWJ2ZKH6.mjs";
11
11
  import "../../chunk-HKXUNG3H.mjs";
12
12
  import "../../chunk-P732YGHO.mjs";
13
+ import "../../chunk-CF6O6TCF.mjs";
13
14
  import "../../chunk-ZYIIXWVY.mjs";
14
15
  import "../../chunk-24NQEB73.mjs";
15
- import "../../chunk-CF6O6TCF.mjs";
16
16
  import "../../chunk-P2TMIZRH.mjs";
17
17
  import "../../chunk-2ZT6V4QR.mjs";
18
18
  import "../../chunk-E3G5QXSH.mjs";
@@ -1,13 +1,13 @@
1
1
  "use client";
2
2
  import {
3
3
  timePicker_default
4
- } from "../../chunk-VP3NVHFU.mjs";
4
+ } from "../../chunk-YCMZELLD.mjs";
5
5
  import "../../chunk-7MVEAQ7Z.mjs";
6
6
  import "../../chunk-VVOOYDJS.mjs";
7
- import "../../chunk-KWWYMTJP.mjs";
7
+ import "../../chunk-AYWI2CRE.mjs";
8
+ import "../../chunk-CF6O6TCF.mjs";
8
9
  import "../../chunk-ZYIIXWVY.mjs";
9
10
  import "../../chunk-24NQEB73.mjs";
10
- import "../../chunk-CF6O6TCF.mjs";
11
11
  import "../../chunk-P2TMIZRH.mjs";
12
12
  import "../../chunk-2ZT6V4QR.mjs";
13
13
  import "../../chunk-E3G5QXSH.mjs";