@sth87/shadcn-design-system 0.1.4 → 0.1.6
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.
- package/dist/AI_CONTEXT.md +1 -0
- package/dist/cjs/components/Button/Button.cjs +1 -1
- package/dist/cjs/components/Button/Button.cjs.map +1 -1
- package/dist/cjs/components/DatePicker/RangePicker.cjs +1 -1
- package/dist/cjs/components/DatePicker/RangePicker.cjs.map +1 -1
- package/dist/cjs/components/Input/Input.cjs +1 -1
- package/dist/cjs/components/Input/Input.cjs.map +1 -1
- package/dist/cjs/components/Table/data-table.cjs +1 -1
- package/dist/cjs/components/Table/data-table.cjs.map +1 -1
- package/dist/cjs/packages/ui/src/components/alert-dialog.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/alert-dialog.cjs.map +1 -1
- package/dist/cjs/packages/ui/src/components/calendar.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/calendar.cjs.map +1 -1
- package/dist/cjs/packages/ui/src/components/combobox.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/combobox.cjs.map +1 -1
- package/dist/cjs/packages/ui/src/components/context-menu.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/context-menu.cjs.map +1 -1
- package/dist/cjs/packages/ui/src/components/popover.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/popover.cjs.map +1 -1
- package/dist/cjs/packages/ui/src/components/sidebar.cjs +1 -1
- package/dist/cjs/packages/ui/src/components/sidebar.cjs.map +1 -1
- package/dist/cjs/styles/index.css +1 -1
- package/dist/esm/components/Button/Button.js +22 -24
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/DatePicker/RangePicker.js +41 -41
- package/dist/esm/components/DatePicker/RangePicker.js.map +1 -1
- package/dist/esm/components/Input/Input.js +37 -36
- package/dist/esm/components/Input/Input.js.map +1 -1
- package/dist/esm/components/Table/data-table.js +22 -16
- package/dist/esm/components/Table/data-table.js.map +1 -1
- package/dist/esm/packages/ui/src/components/alert-dialog.js +7 -7
- package/dist/esm/packages/ui/src/components/alert-dialog.js.map +1 -1
- package/dist/esm/packages/ui/src/components/calendar.js +1 -1
- package/dist/esm/packages/ui/src/components/calendar.js.map +1 -1
- package/dist/esm/packages/ui/src/components/combobox.js +1 -1
- package/dist/esm/packages/ui/src/components/combobox.js.map +1 -1
- package/dist/esm/packages/ui/src/components/context-menu.js +1 -1
- package/dist/esm/packages/ui/src/components/context-menu.js.map +1 -1
- package/dist/esm/packages/ui/src/components/popover.js +1 -1
- package/dist/esm/packages/ui/src/components/popover.js.map +1 -1
- package/dist/esm/packages/ui/src/components/sidebar.js +2 -2
- package/dist/esm/packages/ui/src/components/sidebar.js.map +1 -1
- package/dist/esm/styles/index.css +1 -1
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Input/Input.d.ts +1 -0
- package/dist/types/components/Input/Input.d.ts.map +1 -1
- package/dist/types/components/Table/data-table.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as t, jsxs as o } from "react/jsx-runtime";
|
|
2
2
|
import r from "react";
|
|
3
|
-
import { Input as
|
|
3
|
+
import { Input as W } from "../../packages/ui/src/components/input.js";
|
|
4
4
|
import { cn as a } from "../../packages/ui/src/lib/utils.js";
|
|
5
|
-
import { FloatingLabel as
|
|
6
|
-
import { Info as
|
|
7
|
-
import { withMask as
|
|
8
|
-
import { Tooltip as
|
|
9
|
-
import { Label as
|
|
10
|
-
const
|
|
5
|
+
import { FloatingLabel as Y } from "../FloatLabel.js";
|
|
6
|
+
import { Info as Z, ChevronUp as T, ChevronDown as q, X as F, EyeOff as L, Eye as ee } from "lucide-react";
|
|
7
|
+
import { withMask as se } from "use-mask-input";
|
|
8
|
+
import { Tooltip as te } from "../Tooltip/Tooltip.js";
|
|
9
|
+
import { Label as de } from "../../packages/ui/src/components/label.js";
|
|
10
|
+
const ne = r.forwardRef(
|
|
11
11
|
({
|
|
12
12
|
className: _,
|
|
13
13
|
label: x,
|
|
@@ -27,11 +27,12 @@ const de = r.forwardRef(
|
|
|
27
27
|
suffixIcon: i,
|
|
28
28
|
placeholder: B = " ",
|
|
29
29
|
required: C,
|
|
30
|
+
inputClassName: H,
|
|
30
31
|
...e
|
|
31
|
-
},
|
|
32
|
-
const [f, M] = r.useState(() => typeof e.value == "string" ? e.value.length : typeof e.defaultValue == "string" ? e.defaultValue.length : 0),
|
|
32
|
+
}, U) => {
|
|
33
|
+
const [f, M] = r.useState(() => typeof e.value == "string" ? e.value.length : typeof e.defaultValue == "string" ? e.defaultValue.length : 0), X = (s) => {
|
|
33
34
|
M(s.target.value.length), e.onChange && e.onChange(s);
|
|
34
|
-
},
|
|
35
|
+
}, $ = () => {
|
|
35
36
|
if (d.current) {
|
|
36
37
|
d.current.value = "", M(0);
|
|
37
38
|
const s = {
|
|
@@ -40,17 +41,17 @@ const de = r.forwardRef(
|
|
|
40
41
|
};
|
|
41
42
|
e.onChange?.(s), I && I();
|
|
42
43
|
}
|
|
43
|
-
}, y = r.useId(), d = r.useRef(null),
|
|
44
|
+
}, y = r.useId(), d = r.useRef(null), A = r.useCallback(
|
|
44
45
|
(s) => {
|
|
45
46
|
if (d && (d.current = s), g && s) {
|
|
46
|
-
const m =
|
|
47
|
+
const m = se(g, P);
|
|
47
48
|
typeof m == "function" && m(s);
|
|
48
49
|
}
|
|
49
50
|
},
|
|
50
51
|
[g, P]
|
|
51
52
|
);
|
|
52
|
-
r.useImperativeHandle(
|
|
53
|
-
const [R,
|
|
53
|
+
r.useImperativeHandle(U, () => d.current);
|
|
54
|
+
const [R, G] = r.useState(!1), J = {
|
|
54
55
|
default: "ds:text-muted-foreground",
|
|
55
56
|
success: "ds:text-success",
|
|
56
57
|
warning: "ds:text-warning",
|
|
@@ -70,7 +71,7 @@ const de = r.forwardRef(
|
|
|
70
71
|
normal: "ds:size-4",
|
|
71
72
|
lg: "ds:size-4",
|
|
72
73
|
xl: "ds:size-4"
|
|
73
|
-
}[z] || "ds:size-4",
|
|
74
|
+
}[z] || "ds:size-4", K = () => {
|
|
74
75
|
const s = n === "number" || n === "password" || n === "datetime" || p && (f > 0 || e?.value);
|
|
75
76
|
return s && i ? n === "password" && p && (f > 0 || e?.value) ? "ds:pr-20" : "ds:pr-16" : s ? n === "password" && p && (f > 0 || e?.value) ? "ds:pr-16" : "ds:pr-10" : i ? k.suffix : "";
|
|
76
77
|
}, D = (() => {
|
|
@@ -82,14 +83,14 @@ const de = r.forwardRef(
|
|
|
82
83
|
xl: { left: "ds:left-4", right: "ds:right-4" }
|
|
83
84
|
};
|
|
84
85
|
return s[z] || s.normal;
|
|
85
|
-
})(),
|
|
86
|
+
})(), O = () => {
|
|
86
87
|
if (d.current) {
|
|
87
88
|
const s = Number(e.step || 1), m = e.max ? Number(e.max) : 1 / 0, S = Number(d.current.value || 0), E = Math.min(S + s, m);
|
|
88
89
|
d.current.value = String(E);
|
|
89
90
|
const h = new Event("input", { bubbles: !0 });
|
|
90
91
|
d.current.dispatchEvent(h), e.onChange?.(h);
|
|
91
92
|
}
|
|
92
|
-
},
|
|
93
|
+
}, Q = () => {
|
|
93
94
|
if (d.current) {
|
|
94
95
|
const s = Number(e.step || 1), m = e.min ? Number(e.min) : -1 / 0, S = Number(d.current.value || 0), E = Math.max(S - s, m);
|
|
95
96
|
d.current.value = String(E);
|
|
@@ -105,7 +106,7 @@ const de = r.forwardRef(
|
|
|
105
106
|
}),
|
|
106
107
|
children: [
|
|
107
108
|
!c && x && /* @__PURE__ */ o(
|
|
108
|
-
|
|
109
|
+
de,
|
|
109
110
|
{
|
|
110
111
|
htmlFor: y,
|
|
111
112
|
className: "ds:flex ds:gap-2 ds:text-sm ds:font-medium ds:leading-none ds:peer-disabled:cursor-not-allowed ds:peer-disabled:opacity-70",
|
|
@@ -114,7 +115,7 @@ const de = r.forwardRef(
|
|
|
114
115
|
x,
|
|
115
116
|
C && /* @__PURE__ */ t("span", { className: "ds:text-error ds:ml-0.5", children: "*" })
|
|
116
117
|
] }),
|
|
117
|
-
w && /* @__PURE__ */ t(
|
|
118
|
+
w && /* @__PURE__ */ t(te, { content: w, children: /* @__PURE__ */ t(Z, { className: "ds:size-3.5 ds:min-w-3.5" }) })
|
|
118
119
|
]
|
|
119
120
|
}
|
|
120
121
|
),
|
|
@@ -135,9 +136,9 @@ const de = r.forwardRef(
|
|
|
135
136
|
}
|
|
136
137
|
),
|
|
137
138
|
/* @__PURE__ */ t(
|
|
138
|
-
|
|
139
|
+
W,
|
|
139
140
|
{
|
|
140
|
-
ref:
|
|
141
|
+
ref: A,
|
|
141
142
|
id: y,
|
|
142
143
|
className: a(
|
|
143
144
|
"ds:peer",
|
|
@@ -148,21 +149,21 @@ const de = r.forwardRef(
|
|
|
148
149
|
},
|
|
149
150
|
u && k.prefix,
|
|
150
151
|
g && "ds:placeholder:text-slate-400 ds:placeholder:opacity-100",
|
|
151
|
-
|
|
152
|
-
|
|
152
|
+
K(),
|
|
153
|
+
H
|
|
153
154
|
),
|
|
154
155
|
state: N,
|
|
155
156
|
size: c ? l === "xl" || l === "lg" ? l : "xl" : l,
|
|
156
157
|
type: n === "password" ? R ? "text" : "password" : n,
|
|
157
158
|
placeholder: B,
|
|
158
159
|
maxLength: b,
|
|
159
|
-
onChange:
|
|
160
|
+
onChange: X,
|
|
160
161
|
required: C,
|
|
161
162
|
...e
|
|
162
163
|
}
|
|
163
164
|
),
|
|
164
165
|
c && /* @__PURE__ */ t(
|
|
165
|
-
|
|
166
|
+
Y,
|
|
166
167
|
{
|
|
167
168
|
htmlFor: y,
|
|
168
169
|
size: l,
|
|
@@ -176,28 +177,28 @@ const de = r.forwardRef(
|
|
|
176
177
|
"button",
|
|
177
178
|
{
|
|
178
179
|
type: "button",
|
|
179
|
-
onClick:
|
|
180
|
+
onClick: O,
|
|
180
181
|
disabled: e.disabled,
|
|
181
182
|
className: a(
|
|
182
183
|
"ds:h-1/2 ds:w-6 ds:flex ds:items-center ds:justify-center ds:rounded ds:cursor-pointer ds:hover:scale-150 ds:transition-transform",
|
|
183
184
|
"ds:disabled:opacity-50 ds:disabled:cursor-not-allowed ds:disabled:hover:bg-transparent"
|
|
184
185
|
),
|
|
185
186
|
tabIndex: -1,
|
|
186
|
-
children: /* @__PURE__ */ t(
|
|
187
|
+
children: /* @__PURE__ */ t(T, { className: "ds:size-3" })
|
|
187
188
|
}
|
|
188
189
|
),
|
|
189
190
|
/* @__PURE__ */ t(
|
|
190
191
|
"button",
|
|
191
192
|
{
|
|
192
193
|
type: "button",
|
|
193
|
-
onClick:
|
|
194
|
+
onClick: Q,
|
|
194
195
|
disabled: e.disabled,
|
|
195
196
|
className: a(
|
|
196
197
|
"ds:h-1/2 ds:w-6 ds:flex ds:items-center ds:justify-center ds:rounded ds:cursor-pointer ds:hover:scale-150 ds:transition-transform",
|
|
197
198
|
"ds:disabled:opacity-50 ds:disabled:cursor-not-allowed ds:disabled:hover:bg-transparent"
|
|
198
199
|
),
|
|
199
200
|
tabIndex: -1,
|
|
200
|
-
children: /* @__PURE__ */ t(
|
|
201
|
+
children: /* @__PURE__ */ t(q, { className: "ds:size-3" })
|
|
201
202
|
}
|
|
202
203
|
)
|
|
203
204
|
] }),
|
|
@@ -210,9 +211,9 @@ const de = r.forwardRef(
|
|
|
210
211
|
"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:p-1 ds:rounded ds:hover:bg-accent ds:transition-colors ds:cursor-pointer",
|
|
211
212
|
n === "password" ? i ? "ds:right-14" : "ds:right-10" : i ? "ds:right-10" : "ds:right-2"
|
|
212
213
|
),
|
|
213
|
-
onClick:
|
|
214
|
+
onClick: $,
|
|
214
215
|
disabled: e.disabled,
|
|
215
|
-
children: /* @__PURE__ */ t(
|
|
216
|
+
children: /* @__PURE__ */ t(F, { className: "ds:size-4" })
|
|
216
217
|
}
|
|
217
218
|
),
|
|
218
219
|
n === "password" && /* @__PURE__ */ t(
|
|
@@ -224,9 +225,9 @@ const de = r.forwardRef(
|
|
|
224
225
|
"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:p-1 ds:rounded ds:hover:bg-accent ds:transition-colors",
|
|
225
226
|
i ? "ds:right-10" : "ds:right-2"
|
|
226
227
|
),
|
|
227
|
-
onClick: () =>
|
|
228
|
+
onClick: () => G((s) => !s),
|
|
228
229
|
disabled: e.disabled,
|
|
229
|
-
children: R ? /* @__PURE__ */ t(
|
|
230
|
+
children: R ? /* @__PURE__ */ t(L, { className: "ds:size-4" }) : /* @__PURE__ */ t(ee, { className: "ds:size-4" })
|
|
230
231
|
}
|
|
231
232
|
),
|
|
232
233
|
i && /* @__PURE__ */ t(
|
|
@@ -251,7 +252,7 @@ const de = r.forwardRef(
|
|
|
251
252
|
{
|
|
252
253
|
className: a(
|
|
253
254
|
"ds:text-xs",
|
|
254
|
-
N ?
|
|
255
|
+
N ? J?.[N] : ""
|
|
255
256
|
),
|
|
256
257
|
children: v
|
|
257
258
|
}
|
|
@@ -267,8 +268,8 @@ const de = r.forwardRef(
|
|
|
267
268
|
) });
|
|
268
269
|
}
|
|
269
270
|
);
|
|
270
|
-
|
|
271
|
+
ne.displayName = "Input";
|
|
271
272
|
export {
|
|
272
|
-
|
|
273
|
+
ne as default
|
|
273
274
|
};
|
|
274
275
|
//# sourceMappingURL=Input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import React, { type ChangeEvent } from \"react\";\nimport {\n Input as SInput,\n type InputProps as SInputProps,\n} from \"@dsui/ui/components/input\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\nimport { Eye, EyeOff, ChevronDown, ChevronUp, Info, X } from \"lucide-react\";\nimport { withMask, type Options } from \"use-mask-input\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\nimport { Label } from \"../Label\";\n\n// Re-export base input props to avoid external dependency issues\nexport type BaseInputProps = Omit<React.ComponentProps<\"input\">, \"size\"> & {\n size?: \"normal\" | \"sm\" | \"xs\" | \"lg\" | \"xl\";\n state?: \"default\" | \"success\" | \"error\" | \"warning\";\n};\n\nexport type InputProps = BaseInputProps & {\n label?: string;\n helperText?: React.ReactNode;\n isFloatLabel?: boolean;\n mask?: string;\n maskOptions?: {\n placeholder?: string;\n inputFormat?: string;\n outputFormat?: string;\n showMaskOnHover?: boolean;\n showMaskOnFocus?: boolean;\n separate?: boolean;\n } & Options;\n maxLength?: number;\n showCharCount?: boolean;\n infoTooltip?: React.ReactNode;\n clearable?: boolean;\n onClear?: () => void;\n prefixIcon?: React.ReactNode;\n suffixIcon?: React.ReactNode;\n required?: boolean;\n};\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n label,\n helperText,\n state,\n size,\n isFloatLabel,\n type,\n mask,\n maskOptions,\n maxLength,\n showCharCount,\n infoTooltip,\n clearable,\n onClear,\n prefixIcon,\n suffixIcon,\n placeholder = \" \",\n required,\n ...props\n },\n ref\n ) => {\n // Character count state\n const [charCount, setCharCount] = React.useState(() => {\n if (typeof props.value === \"string\") return props.value.length;\n if (typeof props.defaultValue === \"string\")\n return props.defaultValue.length;\n return 0;\n });\n\n const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {\n setCharCount(e.target.value.length);\n if (props.onChange) props.onChange(e);\n };\n\n const handleClear = () => {\n if (innerRef.current) {\n innerRef.current.value = \"\";\n setCharCount(0);\n const event = {\n target: innerRef.current,\n currentTarget: innerRef.current,\n } as React.ChangeEvent<HTMLInputElement>;\n props.onChange?.(event);\n if (onClear) onClear();\n }\n };\n\n const inputId = React.useId();\n const innerRef = React.useRef<HTMLInputElement>(null);\n\n // Combine refs\n const combinedRef = React.useCallback(\n (element: HTMLInputElement | null) => {\n // Set innerRef\n if (innerRef) {\n (\n innerRef as React.MutableRefObject<HTMLInputElement | null>\n ).current = element;\n }\n\n // Apply mask if provided\n if (mask && element) {\n const maskRefCallback = withMask(mask, maskOptions);\n if (typeof maskRefCallback === \"function\") {\n maskRefCallback(element);\n }\n }\n },\n [mask, maskOptions]\n );\n\n // Expose ref to parent\n React.useImperativeHandle(ref, () => innerRef.current!);\n\n const [showPassword, setShowPassword] = React.useState(false);\n\n // State\n const helperTextStyles = {\n default: \"ds:text-muted-foreground\",\n success: \"ds:text-success\",\n warning: \"ds:text-warning\",\n error: \"ds:text-error\",\n };\n\n // Calculate current size\n const currentSize = isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size || \"normal\";\n\n // Calculate padding based on size and icons\n const getPadding = () => {\n const sizeMap = {\n xs: { prefix: \"ds:pl-8\", suffix: \"ds:pr-8\" },\n sm: { prefix: \"ds:pl-9\", suffix: \"ds:pr-9\" },\n normal: { prefix: \"ds:pl-10\", suffix: \"ds:pr-10\" },\n lg: { prefix: \"ds:pl-11\", suffix: \"ds:pr-11\" },\n xl: { prefix: \"ds:pl-12\", suffix: \"ds:pr-12\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const padding = getPadding();\n\n // Get icon size class based on current size\n const getIconSizeClass = () => {\n const sizeMap = {\n xs: \"ds:size-3\",\n sm: \"ds:size-3.5\",\n normal: \"ds:size-4\",\n lg: \"ds:size-4\",\n xl: \"ds:size-4\",\n };\n return sizeMap[currentSize as keyof typeof sizeMap] || \"ds:size-4\";\n };\n\n const iconSizeClass = getIconSizeClass();\n\n // Calculate right padding considering built-in icons\n const getRightPadding = () => {\n const hasBuiltInSuffix =\n type === \"number\" ||\n type === \"password\" ||\n type === \"datetime\" ||\n (clearable && (charCount > 0 || props?.value));\n\n if (hasBuiltInSuffix && suffixIcon) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"ds:pr-20\" // password + clear + custom icon\n : \"ds:pr-16\"; // one built-in + custom icon\n }\n\n if (hasBuiltInSuffix) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"ds:pr-16\" // password + clear\n : \"ds:pr-10\"; // single built-in icon\n }\n\n if (suffixIcon) {\n return padding.suffix;\n }\n\n return \"\";\n };\n\n // Icon position calculations\n const getIconPosition = () => {\n const sizeMap = {\n xs: { left: \"ds:left-2.5\", right: \"ds:right-2.5\" },\n sm: { left: \"ds:left-3\", right: \"ds:right-3\" },\n normal: { left: \"ds:left-3\", right: \"ds:right-3\" },\n lg: { left: \"ds:left-3.5\", right: \"ds:right-3.5\" },\n xl: { left: \"ds:left-4\", right: \"ds:right-4\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const iconPosition = getIconPosition();\n\n /* Spinner Button Handlers */\n const handleIncrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const max = props.max ? Number(props.max) : Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.min(currentValue + step, max);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n\n const handleDecrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const min = props.min ? Number(props.min) : -Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.max(currentValue - step, min);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n /* End Spinner Button Handlers */\n\n return (\n <div className={className}>\n <div\n className={cn(\"ds:flex ds:flex-col ds:gap-1.5 ds:relative ds:flex-auto\", {\n \"ds:floating-label ds:relative\": isFloatLabel,\n })}\n >\n {!isFloatLabel && label && (\n <Label\n htmlFor={inputId}\n className=\"ds:flex ds:gap-2 ds:text-sm ds:font-medium ds:leading-none ds:peer-disabled:cursor-not-allowed ds:peer-disabled:opacity-70\"\n >\n <span>\n {label}\n {required && <span className=\"ds:text-error ds:ml-0.5\">*</span>}\n </span>\n {infoTooltip && (\n <Tooltip content={infoTooltip}>\n <Info className=\"ds:size-3.5 ds:min-w-3.5\" />\n </Tooltip>\n )}\n </Label>\n )}\n\n <div className=\"ds:relative\">\n {/* Prefix Icon */}\n {prefixIcon && (\n <div\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:text-muted-foreground ds:leading-0\",\n iconPosition.left\n )}\n >\n {React.isValidElement(prefixIcon)\n ? React.cloneElement(prefixIcon, {\n className: cn(\n iconSizeClass,\n (prefixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : prefixIcon}\n </div>\n )}\n\n <SInput\n ref={combinedRef}\n id={inputId}\n className={cn(\n \"ds:peer\",\n {\n \"ds:pt-5 ds:pb-1\": isFloatLabel && size !== \"lg\",\n \"ds:[&::-webkit-outer-spin-button]:appearance-none ds:[&::-webkit-inner-spin-button]:appearance-none ds:[-moz-appearance:textfield] ds:pr-8\":\n type === \"number\",\n // \"[-webkit-text-fill-color:var(--foreground)]\": mask,\n },\n prefixIcon && padding.prefix,\n mask && \"ds:placeholder:text-slate-400 ds:placeholder:opacity-100\",\n getRightPadding()\n // className,\n )}\n state={state}\n size={\n isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size\n }\n type={\n type === \"password\"\n ? showPassword\n ? \"text\"\n : \"password\"\n : type\n }\n placeholder={placeholder}\n maxLength={maxLength}\n onChange={handleInput}\n required={required}\n {...props}\n />\n {isFloatLabel && (\n <FloatingLabel\n htmlFor={inputId}\n size={size}\n infoTooltip={infoTooltip}\n required={required}\n >\n {label}\n </FloatingLabel>\n )}\n\n {/* Spinner Buttons */}\n {type === \"number\" && (\n <div className=\"ds:absolute ds:right-1 ds:top-0 ds:h-full ds:flex ds:flex-col ds:gap-0.5\">\n <button\n type=\"button\"\n onClick={handleIncrement}\n disabled={props.disabled}\n className={cn(\n \"ds:h-1/2 ds:w-6 ds:flex ds:items-center ds:justify-center ds:rounded ds:cursor-pointer ds:hover:scale-150 ds:transition-transform\",\n \"ds:disabled:opacity-50 ds:disabled:cursor-not-allowed ds:disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronUp className=\"ds:size-3\" />\n </button>\n <button\n type=\"button\"\n onClick={handleDecrement}\n disabled={props.disabled}\n className={cn(\n \"ds:h-1/2 ds:w-6 ds:flex ds:items-center ds:justify-center ds:rounded ds:cursor-pointer ds:hover:scale-150 ds:transition-transform\",\n \"ds:disabled:opacity-50 ds:disabled:cursor-not-allowed ds:disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronDown className=\"ds:size-3\" />\n </button>\n </div>\n )}\n\n {/* Clear Button */}\n {clearable &&\n (charCount > 0 || props?.value) &&\n !props.disabled &&\n type !== \"number\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:p-1 ds:rounded ds:hover:bg-accent ds:transition-colors ds:cursor-pointer\",\n type === \"password\"\n ? suffixIcon\n ? \"ds:right-14\"\n : \"ds:right-10\"\n : suffixIcon\n ? \"ds:right-10\"\n : \"ds:right-2\"\n )}\n onClick={handleClear}\n disabled={props.disabled}\n >\n <X className=\"ds:size-4\" />\n </button>\n )}\n\n {/* Show/Hide Password Button */}\n {type === \"password\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:p-1 ds:rounded ds:hover:bg-accent ds:transition-colors\",\n suffixIcon ? \"ds:right-10\" : \"ds:right-2\"\n )}\n onClick={() => setShowPassword((prev) => !prev)}\n disabled={props.disabled}\n >\n {showPassword ? (\n <EyeOff className=\"ds:size-4\" />\n ) : (\n <Eye className=\"ds:size-4\" />\n )}\n </button>\n )}\n\n {/* Suffix Icon */}\n {suffixIcon && (\n <div\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:text-muted-foreground ds:leading-0\",\n iconPosition.right\n )}\n >\n {React.isValidElement(suffixIcon)\n ? React.cloneElement(suffixIcon, {\n className: cn(\n iconSizeClass,\n (suffixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : suffixIcon}\n </div>\n )}\n </div>\n\n {(helperText || (showCharCount && typeof maxLength === \"number\")) && (\n <div className=\"ds:flex ds:items-center ds:justify-between ds:text-xs ds:gap-2\">\n {helperText && (\n <p\n className={cn(\n \"ds:text-xs\",\n state ? helperTextStyles?.[state] : \"\"\n )}\n >\n {helperText}\n </p>\n )}\n {showCharCount && typeof maxLength === \"number\" && (\n <span className=\"ds:ml-auto ds:text-muted-foreground\">\n {charCount} / {maxLength}\n </span>\n )}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nInput.displayName = \"Input\";\nexport default Input;\n"],"names":["Input","React","className","label","helperText","state","size","isFloatLabel","type","mask","maskOptions","maxLength","showCharCount","infoTooltip","clearable","onClear","prefixIcon","suffixIcon","placeholder","required","props","ref","charCount","setCharCount","handleInput","e","handleClear","innerRef","event","inputId","combinedRef","element","maskRefCallback","withMask","showPassword","setShowPassword","helperTextStyles","currentSize","padding","sizeMap","iconSizeClass","getRightPadding","hasBuiltInSuffix","iconPosition","handleIncrement","step","max","currentValue","newValue","handleDecrement","min","jsx","jsxs","cn","Label","Tooltip","Info","SInput","FloatingLabel","ChevronUp","ChevronDown","X","prev","EyeOff","Eye"],"mappings":";;;;;;;;;AAyCA,MAAMA,KAAQC,EAAM;AAAA,EAClB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,UAAAC;A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MAAMkB,EAAgB,CAAC2B,MAAS,CAACA,CAAI;AAAA,gBAC9C,UAAU1C,EAAM;AAAA,gBAEf,UAAAc,sBACE6B,GAAA,EAAO,WAAU,aAAY,IAE9B,gBAAAZ,EAACa,GAAA,EAAI,WAAU,YAAA,CAAY;AAAA,cAAA;AAAA,YAAA;AAAA,YAMhC/C,KACC,gBAAAkC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWE;AAAA,kBACT;AAAA,kBACAV,EAAa;AAAA,gBAAA;AAAA,gBAGd,YAAM,eAAe1B,CAAU,IAC5BhB,EAAM,aAAagB,GAAY;AAAA,kBAC7B,WAAWoC;AAAA,oBACTb;AAAA,oBACCvB,EAAW,OAAe;AAAA,kBAAA;AAAA,gBAC7B,CACmB,IACrBA;AAAA,cAAA;AAAA,YAAA;AAAA,UACN,GAEJ;AAAA,WAEEb,KAAeQ,KAAiB,OAAOD,KAAc,aACrD,gBAAAyC,EAAC,OAAA,EAAI,WAAU,kEACZ,UAAA;AAAA,YAAAhD,KACC,gBAAA+C;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAWE;AAAA,kBACT;AAAA,kBACAhD,IAAQ+B,IAAmB/B,CAAK,IAAI;AAAA,gBAAA;AAAA,gBAGrC,UAAAD;AAAA,cAAA;AAAA,YAAA;AAAA,YAGJQ,KAAiB,OAAOD,KAAc,YACrC,gBAAAyC,EAAC,QAAA,EAAK,WAAU,uCACb,UAAA;AAAA,cAAA9B;AAAA,cAAU;AAAA,cAAIX;AAAA,YAAA,EAAA,CACjB;AAAA,UAAA,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAGN;AAAA,EAEJ;AACF;AAEAX,GAAM,cAAc;"}
|
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import React, { type ChangeEvent } from \"react\";\nimport {\n Input as SInput,\n type InputProps as SInputProps,\n} from \"@dsui/ui/components/input\";\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { FloatingLabel } from \"@/components/FloatLabel\";\nimport { Eye, EyeOff, ChevronDown, ChevronUp, Info, X } from \"lucide-react\";\nimport { withMask, type Options } from \"use-mask-input\";\nimport { Tooltip } from \"../Tooltip/Tooltip\";\nimport { Label } from \"../Label\";\n\n// Re-export base input props to avoid external dependency issues\nexport type BaseInputProps = Omit<React.ComponentProps<\"input\">, \"size\"> & {\n size?: \"normal\" | \"sm\" | \"xs\" | \"lg\" | \"xl\";\n state?: \"default\" | \"success\" | \"error\" | \"warning\";\n};\n\nexport type InputProps = BaseInputProps & {\n label?: string;\n helperText?: React.ReactNode;\n isFloatLabel?: boolean;\n mask?: string;\n maskOptions?: {\n placeholder?: string;\n inputFormat?: string;\n outputFormat?: string;\n showMaskOnHover?: boolean;\n showMaskOnFocus?: boolean;\n separate?: boolean;\n } & Options;\n maxLength?: number;\n showCharCount?: boolean;\n infoTooltip?: React.ReactNode;\n clearable?: boolean;\n onClear?: () => void;\n prefixIcon?: React.ReactNode;\n suffixIcon?: React.ReactNode;\n required?: boolean;\n inputClassName?: string;\n};\n\nconst Input = React.forwardRef<HTMLInputElement, InputProps>(\n (\n {\n className,\n label,\n helperText,\n state,\n size,\n isFloatLabel,\n type,\n mask,\n maskOptions,\n maxLength,\n showCharCount,\n infoTooltip,\n clearable,\n onClear,\n prefixIcon,\n suffixIcon,\n placeholder = \" \",\n required,\n inputClassName,\n ...props\n },\n ref\n ) => {\n // Character count state\n const [charCount, setCharCount] = React.useState(() => {\n if (typeof props.value === \"string\") return props.value.length;\n if (typeof props.defaultValue === \"string\")\n return props.defaultValue.length;\n return 0;\n });\n\n const handleInput = (e: React.ChangeEvent<HTMLInputElement>) => {\n setCharCount(e.target.value.length);\n if (props.onChange) props.onChange(e);\n };\n\n const handleClear = () => {\n if (innerRef.current) {\n innerRef.current.value = \"\";\n setCharCount(0);\n const event = {\n target: innerRef.current,\n currentTarget: innerRef.current,\n } as React.ChangeEvent<HTMLInputElement>;\n props.onChange?.(event);\n if (onClear) onClear();\n }\n };\n\n const inputId = React.useId();\n const innerRef = React.useRef<HTMLInputElement>(null);\n\n // Combine refs\n const combinedRef = React.useCallback(\n (element: HTMLInputElement | null) => {\n // Set innerRef\n if (innerRef) {\n (\n innerRef as React.MutableRefObject<HTMLInputElement | null>\n ).current = element;\n }\n\n // Apply mask if provided\n if (mask && element) {\n const maskRefCallback = withMask(mask, maskOptions);\n if (typeof maskRefCallback === \"function\") {\n maskRefCallback(element);\n }\n }\n },\n [mask, maskOptions]\n );\n\n // Expose ref to parent\n React.useImperativeHandle(ref, () => innerRef.current!);\n\n const [showPassword, setShowPassword] = React.useState(false);\n\n // State\n const helperTextStyles = {\n default: \"ds:text-muted-foreground\",\n success: \"ds:text-success\",\n warning: \"ds:text-warning\",\n error: \"ds:text-error\",\n };\n\n // Calculate current size\n const currentSize = isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size || \"normal\";\n\n // Calculate padding based on size and icons\n const getPadding = () => {\n const sizeMap = {\n xs: { prefix: \"ds:pl-8\", suffix: \"ds:pr-8\" },\n sm: { prefix: \"ds:pl-9\", suffix: \"ds:pr-9\" },\n normal: { prefix: \"ds:pl-10\", suffix: \"ds:pr-10\" },\n lg: { prefix: \"ds:pl-11\", suffix: \"ds:pr-11\" },\n xl: { prefix: \"ds:pl-12\", suffix: \"ds:pr-12\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const padding = getPadding();\n\n // Get icon size class based on current size\n const getIconSizeClass = () => {\n const sizeMap = {\n xs: \"ds:size-3\",\n sm: \"ds:size-3.5\",\n normal: \"ds:size-4\",\n lg: \"ds:size-4\",\n xl: \"ds:size-4\",\n };\n return sizeMap[currentSize as keyof typeof sizeMap] || \"ds:size-4\";\n };\n\n const iconSizeClass = getIconSizeClass();\n\n // Calculate right padding considering built-in icons\n const getRightPadding = () => {\n const hasBuiltInSuffix =\n type === \"number\" ||\n type === \"password\" ||\n type === \"datetime\" ||\n (clearable && (charCount > 0 || props?.value));\n\n if (hasBuiltInSuffix && suffixIcon) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"ds:pr-20\" // password + clear + custom icon\n : \"ds:pr-16\"; // one built-in + custom icon\n }\n\n if (hasBuiltInSuffix) {\n return type === \"password\" &&\n clearable &&\n (charCount > 0 || props?.value)\n ? \"ds:pr-16\" // password + clear\n : \"ds:pr-10\"; // single built-in icon\n }\n\n if (suffixIcon) {\n return padding.suffix;\n }\n\n return \"\";\n };\n\n // Icon position calculations\n const getIconPosition = () => {\n const sizeMap = {\n xs: { left: \"ds:left-2.5\", right: \"ds:right-2.5\" },\n sm: { left: \"ds:left-3\", right: \"ds:right-3\" },\n normal: { left: \"ds:left-3\", right: \"ds:right-3\" },\n lg: { left: \"ds:left-3.5\", right: \"ds:right-3.5\" },\n xl: { left: \"ds:left-4\", right: \"ds:right-4\" },\n };\n\n return sizeMap[currentSize as keyof typeof sizeMap] || sizeMap.normal;\n };\n\n const iconPosition = getIconPosition();\n\n /* Spinner Button Handlers */\n const handleIncrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const max = props.max ? Number(props.max) : Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.min(currentValue + step, max);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n\n const handleDecrement = () => {\n if (innerRef.current) {\n const step = Number(props.step || 1);\n const min = props.min ? Number(props.min) : -Infinity;\n const currentValue = Number(innerRef.current.value || 0);\n const newValue = Math.max(currentValue - step, min);\n\n innerRef.current.value = String(newValue);\n const event = new Event(\"input\", { bubbles: true });\n innerRef.current.dispatchEvent(event);\n props.onChange?.(event as unknown as ChangeEvent<HTMLInputElement>);\n }\n };\n /* End Spinner Button Handlers */\n\n return (\n <div className={className}>\n <div\n className={cn(\"ds:flex ds:flex-col ds:gap-1.5 ds:relative ds:flex-auto\", {\n \"ds:floating-label ds:relative\": isFloatLabel,\n })}\n >\n {!isFloatLabel && label && (\n <Label\n htmlFor={inputId}\n className=\"ds:flex ds:gap-2 ds:text-sm ds:font-medium ds:leading-none ds:peer-disabled:cursor-not-allowed ds:peer-disabled:opacity-70\"\n >\n <span>\n {label}\n {required && <span className=\"ds:text-error ds:ml-0.5\">*</span>}\n </span>\n {infoTooltip && (\n <Tooltip content={infoTooltip}>\n <Info className=\"ds:size-3.5 ds:min-w-3.5\" />\n </Tooltip>\n )}\n </Label>\n )}\n\n <div className=\"ds:relative\">\n {/* Prefix Icon */}\n {prefixIcon && (\n <div\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:text-muted-foreground ds:leading-0\",\n iconPosition.left\n )}\n >\n {React.isValidElement(prefixIcon)\n ? React.cloneElement(prefixIcon, {\n className: cn(\n iconSizeClass,\n (prefixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : prefixIcon}\n </div>\n )}\n\n <SInput\n ref={combinedRef}\n id={inputId}\n className={cn(\n \"ds:peer\",\n {\n \"ds:pt-5 ds:pb-1\": isFloatLabel && size !== \"lg\",\n \"ds:[&::-webkit-outer-spin-button]:appearance-none ds:[&::-webkit-inner-spin-button]:appearance-none ds:[-moz-appearance:textfield] ds:pr-8\":\n type === \"number\",\n // \"[-webkit-text-fill-color:var(--foreground)]\": mask,\n },\n prefixIcon && padding.prefix,\n mask && \"ds:placeholder:text-slate-400 ds:placeholder:opacity-100\",\n getRightPadding(),\n inputClassName,\n )}\n state={state}\n size={\n isFloatLabel\n ? size === \"xl\" || size === \"lg\"\n ? size\n : \"xl\"\n : size\n }\n type={\n type === \"password\"\n ? showPassword\n ? \"text\"\n : \"password\"\n : type\n }\n placeholder={placeholder}\n maxLength={maxLength}\n onChange={handleInput}\n required={required}\n {...props}\n />\n {isFloatLabel && (\n <FloatingLabel\n htmlFor={inputId}\n size={size}\n infoTooltip={infoTooltip}\n required={required}\n >\n {label}\n </FloatingLabel>\n )}\n\n {/* Spinner Buttons */}\n {type === \"number\" && (\n <div className=\"ds:absolute ds:right-1 ds:top-0 ds:h-full ds:flex ds:flex-col ds:gap-0.5\">\n <button\n type=\"button\"\n onClick={handleIncrement}\n disabled={props.disabled}\n className={cn(\n \"ds:h-1/2 ds:w-6 ds:flex ds:items-center ds:justify-center ds:rounded ds:cursor-pointer ds:hover:scale-150 ds:transition-transform\",\n \"ds:disabled:opacity-50 ds:disabled:cursor-not-allowed ds:disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronUp className=\"ds:size-3\" />\n </button>\n <button\n type=\"button\"\n onClick={handleDecrement}\n disabled={props.disabled}\n className={cn(\n \"ds:h-1/2 ds:w-6 ds:flex ds:items-center ds:justify-center ds:rounded ds:cursor-pointer ds:hover:scale-150 ds:transition-transform\",\n \"ds:disabled:opacity-50 ds:disabled:cursor-not-allowed ds:disabled:hover:bg-transparent\"\n )}\n tabIndex={-1}\n >\n <ChevronDown className=\"ds:size-3\" />\n </button>\n </div>\n )}\n\n {/* Clear Button */}\n {clearable &&\n (charCount > 0 || props?.value) &&\n !props.disabled &&\n type !== \"number\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:p-1 ds:rounded ds:hover:bg-accent ds:transition-colors ds:cursor-pointer\",\n type === \"password\"\n ? suffixIcon\n ? \"ds:right-14\"\n : \"ds:right-10\"\n : suffixIcon\n ? \"ds:right-10\"\n : \"ds:right-2\"\n )}\n onClick={handleClear}\n disabled={props.disabled}\n >\n <X className=\"ds:size-4\" />\n </button>\n )}\n\n {/* Show/Hide Password Button */}\n {type === \"password\" && (\n <button\n type=\"button\"\n tabIndex={-1}\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:p-1 ds:rounded ds:hover:bg-accent ds:transition-colors\",\n suffixIcon ? \"ds:right-10\" : \"ds:right-2\"\n )}\n onClick={() => setShowPassword((prev) => !prev)}\n disabled={props.disabled}\n >\n {showPassword ? (\n <EyeOff className=\"ds:size-4\" />\n ) : (\n <Eye className=\"ds:size-4\" />\n )}\n </button>\n )}\n\n {/* Suffix Icon */}\n {suffixIcon && (\n <div\n className={cn(\n \"ds:absolute ds:top-1/2 ds:-translate-y-1/2 ds:text-muted-foreground ds:leading-0\",\n iconPosition.right\n )}\n >\n {React.isValidElement(suffixIcon)\n ? React.cloneElement(suffixIcon, {\n className: cn(\n iconSizeClass,\n (suffixIcon.props as any)?.className\n ),\n } as Partial<unknown>)\n : suffixIcon}\n </div>\n )}\n </div>\n\n {(helperText || (showCharCount && typeof maxLength === \"number\")) && (\n <div className=\"ds:flex ds:items-center ds:justify-between ds:text-xs ds:gap-2\">\n {helperText && (\n <p\n className={cn(\n \"ds:text-xs\",\n state ? helperTextStyles?.[state] : \"\"\n )}\n >\n {helperText}\n </p>\n )}\n {showCharCount && typeof maxLength === \"number\" && (\n <span className=\"ds:ml-auto ds:text-muted-foreground\">\n {charCount} / {maxLength}\n </span>\n )}\n </div>\n )}\n </div>\n </div>\n );\n }\n);\n\nInput.displayName = \"Input\";\nexport default Input;\n"],"names":["Input","React","className","label","helperText","state","size","isFloatLabel","type","mask","maskOptions","maxLength","showCharCount","infoTooltip","clearable","onClear","prefixIcon","suffixIcon","placeholder","required","inputClassName","props","ref","charCount","setCharCount","handleInput","e","handleClear","innerRef","event","inputId","combinedRef","element","maskRefCallback","withMask","showPassword","setShowPassword","helperTextStyles","currentSize","padding","sizeMap","iconSizeClass","getRightPadding","hasBuiltInSuffix","iconPosition","handleIncrement","step","max","currentValue","newValue","handleDecrement","min","jsx","jsxs","cn","Label","Tooltip","Info","SInput","FloatingLabel","ChevronUp","ChevronDown","X","prev","EyeOff","Eye"],"mappings":";;;;;;;;;AA0CA,MAAMA,KAAQC,EAAM;AAAA,EAClB,CACE;AAAA,IACE,WAAAC;AAAA,IACA,OAAA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,cAAU;AAAA,cAAIZ;AAAA,YAAA,EAAA,CACjB;AAAA,UAAA,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAGN;AAAA,EAEJ;AACF;AAEAX,GAAM,cAAc;"}
|
|
@@ -34,11 +34,11 @@ import "../../packages/ui/src/components/sidebar.js";
|
|
|
34
34
|
import "@radix-ui/react-slider";
|
|
35
35
|
import "../../packages/ui/src/components/tabs.js";
|
|
36
36
|
import "../../packages/ui/src/components/toggle.js";
|
|
37
|
-
import { Table as b, TableHeader as w, TableRow as
|
|
37
|
+
import { Table as b, TableHeader as w, TableRow as t, TableHead as T, TableBody as C, TableCell as d } from "../../packages/ui/src/components/table.js";
|
|
38
38
|
import { getCommonPinningStyles as u } from "../../utils/data-table.js";
|
|
39
39
|
import { DataTableColumnHeader as y } from "./data-table-column-header.js";
|
|
40
40
|
function po({
|
|
41
|
-
table:
|
|
41
|
+
table: r,
|
|
42
42
|
actionBar: n,
|
|
43
43
|
children: f,
|
|
44
44
|
className: g,
|
|
@@ -52,7 +52,10 @@ function po({
|
|
|
52
52
|
return /* @__PURE__ */ i(
|
|
53
53
|
"div",
|
|
54
54
|
{
|
|
55
|
-
className: a(
|
|
55
|
+
className: a(
|
|
56
|
+
"ds:flex ds:w-full ds:flex-col ds:gap-2.5 ds:relative",
|
|
57
|
+
g
|
|
58
|
+
),
|
|
56
59
|
...h,
|
|
57
60
|
children: [
|
|
58
61
|
f,
|
|
@@ -60,9 +63,12 @@ function po({
|
|
|
60
63
|
/* @__PURE__ */ o(
|
|
61
64
|
"div",
|
|
62
65
|
{
|
|
63
|
-
className: a(
|
|
66
|
+
className: a(
|
|
67
|
+
"ds:overflow-auto ds:rounded-md ds:border ds-border-border",
|
|
68
|
+
s && "ds:blur-sm"
|
|
69
|
+
),
|
|
64
70
|
children: /* @__PURE__ */ i(b, { children: [
|
|
65
|
-
/* @__PURE__ */ o(w, { children:
|
|
71
|
+
/* @__PURE__ */ o(w, { children: r.getHeaderGroups().map((l) => /* @__PURE__ */ o(t, { children: l.headers.map((e) => /* @__PURE__ */ o(
|
|
66
72
|
T,
|
|
67
73
|
{
|
|
68
74
|
colSpan: e.colSpan,
|
|
@@ -75,12 +81,12 @@ function po({
|
|
|
75
81
|
) : /* @__PURE__ */ o(y, { column: e.column }) : null
|
|
76
82
|
},
|
|
77
83
|
e.id
|
|
78
|
-
)) },
|
|
79
|
-
/* @__PURE__ */ o(C, { children:
|
|
80
|
-
|
|
84
|
+
)) }, l.id)) }),
|
|
85
|
+
/* @__PURE__ */ o(C, { children: r.getRowModel().rows?.length ? r.getRowModel().rows.map((l) => /* @__PURE__ */ o(
|
|
86
|
+
t,
|
|
81
87
|
{
|
|
82
|
-
"data-state":
|
|
83
|
-
children:
|
|
88
|
+
"data-state": l.getIsSelected() && "selected",
|
|
89
|
+
children: l.getVisibleCells().map((e) => /* @__PURE__ */ o(
|
|
84
90
|
d,
|
|
85
91
|
{
|
|
86
92
|
style: {
|
|
@@ -94,16 +100,16 @@ function po({
|
|
|
94
100
|
e.id
|
|
95
101
|
))
|
|
96
102
|
},
|
|
97
|
-
|
|
98
|
-
)) : /* @__PURE__ */ o(
|
|
103
|
+
l.id
|
|
104
|
+
)) : /* @__PURE__ */ o(t, { children: /* @__PURE__ */ o(
|
|
99
105
|
d,
|
|
100
106
|
{
|
|
101
|
-
colSpan:
|
|
107
|
+
colSpan: r.getAllColumns().length,
|
|
102
108
|
className: "ds:h-24 ds:text-center",
|
|
103
109
|
children: "No results."
|
|
104
110
|
}
|
|
105
111
|
) }) }),
|
|
106
|
-
c && /* @__PURE__ */ o("tfoot", { children: /* @__PURE__ */ o(
|
|
112
|
+
c && /* @__PURE__ */ o("tfoot", { children: /* @__PURE__ */ o(t, { children: /* @__PURE__ */ o(d, { colSpan: r.getAllColumns().length, children: c(r.getRowModel().rows.map((l) => l.original)) }) }) })
|
|
107
113
|
] })
|
|
108
114
|
}
|
|
109
115
|
),
|
|
@@ -111,11 +117,11 @@ function po({
|
|
|
111
117
|
m && /* @__PURE__ */ o(
|
|
112
118
|
x,
|
|
113
119
|
{
|
|
114
|
-
table:
|
|
120
|
+
table: r,
|
|
115
121
|
...m === !0 ? {} : m
|
|
116
122
|
}
|
|
117
123
|
),
|
|
118
|
-
n &&
|
|
124
|
+
n && r.getFilteredSelectedRowModel().rows.length > 0 && n
|
|
119
125
|
] })
|
|
120
126
|
]
|
|
121
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-table.js","sources":["../../../../src/components/Table/data-table.tsx"],"sourcesContent":["import { flexRender, type Table as TanstackTable } from \"@tanstack/react-table\";\nimport type * as React from \"react\";\n\nimport { DataTablePagination } from \"./data-table-pagination\";\nimport {\n cn,\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"@dsui/ui\";\nimport { getCommonPinningStyles } from \"@/utils/data-table\";\nimport { DataTableColumnHeader } from \"./data-table-column-header\";\n\nexport interface DataTableProps<TData> extends React.ComponentProps<\"div\"> {\n table: TanstackTable<TData>;\n actionBar?: React.ReactNode;\n pagination?:\n | boolean\n | Omit<React.ComponentProps<typeof DataTablePagination<TData>>, \"table\">;\n sticky?: boolean | { offsetHeader?: number; offsetScroll?: number };\n bordered?: boolean;\n loading?: boolean;\n footer?: (currentPageData: TData[]) => React.ReactNode;\n}\n\nexport function DataTable<TData>({\n table,\n actionBar,\n children,\n className,\n pagination = true,\n sticky,\n bordered,\n loading,\n footer,\n ...props\n}: DataTableProps<TData>) {\n return (\n <div\n className={cn(\"ds:flex ds:w-full ds:flex-col ds:gap-2.5 ds:relative\"
|
|
1
|
+
{"version":3,"file":"data-table.js","sources":["../../../../src/components/Table/data-table.tsx"],"sourcesContent":["import { flexRender, type Table as TanstackTable } from \"@tanstack/react-table\";\nimport type * as React from \"react\";\n\nimport { DataTablePagination } from \"./data-table-pagination\";\nimport {\n cn,\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"@dsui/ui\";\nimport { getCommonPinningStyles } from \"@/utils/data-table\";\nimport { DataTableColumnHeader } from \"./data-table-column-header\";\n\nexport interface DataTableProps<TData> extends React.ComponentProps<\"div\"> {\n table: TanstackTable<TData>;\n actionBar?: React.ReactNode;\n pagination?:\n | boolean\n | Omit<React.ComponentProps<typeof DataTablePagination<TData>>, \"table\">;\n sticky?: boolean | { offsetHeader?: number; offsetScroll?: number };\n bordered?: boolean;\n loading?: boolean;\n footer?: (currentPageData: TData[]) => React.ReactNode;\n}\n\nexport function DataTable<TData>({\n table,\n actionBar,\n children,\n className,\n pagination = true,\n sticky,\n bordered,\n loading,\n footer,\n ...props\n}: DataTableProps<TData>) {\n return (\n <div\n className={cn(\n \"ds:flex ds:w-full ds:flex-col ds:gap-2.5 ds:relative\",\n className\n )}\n {...props}\n >\n {children}\n {loading && (\n <div className=\"ds:absolute ds:inset-0 ds:bg-background/50 ds:flex ds:items-center ds:justify-center ds:z-20\">\n Loading...\n </div>\n )}\n <div\n className={cn(\n \"ds:overflow-auto ds:rounded-md ds:border ds-border-border\",\n loading && \"ds:blur-sm\"\n )}\n >\n <Table>\n <TableHeader>\n {table.getHeaderGroups().map((headerGroup) => (\n <TableRow key={headerGroup.id}>\n {headerGroup.headers.map((header) => (\n <TableHead\n key={header.id}\n colSpan={header.colSpan}\n style={{\n ...getCommonPinningStyles({ column: header.column }),\n }}\n >\n {header.isPlaceholder ? null : header.column.columnDef\n .header ? (\n typeof header.column.columnDef.header === \"function\" ? (\n flexRender(\n header.column.columnDef.header,\n header.getContext()\n )\n ) : (\n <DataTableColumnHeader column={header.column} />\n )\n ) : null}\n </TableHead>\n ))}\n </TableRow>\n ))}\n </TableHeader>\n <TableBody>\n {table.getRowModel().rows?.length ? (\n table.getRowModel().rows.map((row) => (\n <TableRow\n key={row.id}\n data-state={row.getIsSelected() && \"selected\"}\n >\n {row.getVisibleCells().map((cell) => (\n <TableCell\n key={cell.id}\n style={{\n ...getCommonPinningStyles({ column: cell.column }),\n }}\n >\n {flexRender(\n cell.column.columnDef.cell,\n cell.getContext()\n )}\n </TableCell>\n ))}\n </TableRow>\n ))\n ) : (\n <TableRow>\n <TableCell\n colSpan={table.getAllColumns().length}\n className=\"ds:h-24 ds:text-center\"\n >\n No results.\n </TableCell>\n </TableRow>\n )}\n </TableBody>\n {footer && (\n <tfoot>\n <TableRow>\n <TableCell colSpan={table.getAllColumns().length}>\n {footer(table.getRowModel().rows.map((row) => row.original))}\n </TableCell>\n </TableRow>\n </tfoot>\n )}\n </Table>\n </div>\n <div className=\"ds:flex ds:flex-col ds:gap-2.5\">\n {pagination && (\n <DataTablePagination\n table={table}\n {...(pagination === true ? {} : pagination)}\n />\n )}\n {actionBar &&\n table.getFilteredSelectedRowModel().rows.length > 0 &&\n actionBar}\n </div>\n </div>\n );\n}\n"],"names":["DataTable","table","actionBar","children","className","pagination","sticky","bordered","loading","footer","props","jsxs","cn","jsx","Table","TableHeader","headerGroup","TableRow","header","TableHead","getCommonPinningStyles","flexRender","DataTableColumnHeader","TableBody","row","cell","TableCell","DataTablePagination"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,SAASA,GAAiB;AAAA,EAC/B,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAGC;AACL,GAA0B;AACxB,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAR;AAAA,MAAA;AAAA,MAED,GAAGM;AAAA,MAEH,UAAA;AAAA,QAAAP;AAAA,QACAK,KACC,gBAAAK,EAAC,OAAA,EAAI,WAAU,gGAA+F,UAAA,cAE9G;AAAA,QAEF,gBAAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,WAAWD;AAAA,cACT;A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gBAfID,EAAI;AAAA,cAAA,CAiBZ,IAED,gBAAAX,EAACI,GAAA,EACC,UAAA,gBAAAJ;AAAA,gBAACa;AAAA,gBAAA;AAAA,kBACC,SAASzB,EAAM,cAAA,EAAgB;AAAA,kBAC/B,WAAU;AAAA,kBACX,UAAA;AAAA,gBAAA;AAAA,cAAA,GAGH,EAAA,CAEJ;AAAA,cACCQ,KACC,gBAAAI,EAAC,SAAA,EACC,UAAA,gBAAAA,EAACI,GAAA,EACC,4BAACS,GAAA,EAAU,SAASzB,EAAM,cAAA,EAAgB,QACvC,YAAOA,EAAM,YAAA,EAAc,KAAK,IAAI,CAACuB,MAAQA,EAAI,QAAQ,CAAC,EAAA,CAC7D,EAAA,CACF,EAAA,CACF;AAAA,YAAA,EAAA,CAEJ;AAAA,UAAA;AAAA,QAAA;AAAA,QAEF,gBAAAb,EAAC,OAAA,EAAI,WAAU,kCACZ,UAAA;AAAA,UAAAN,KACC,gBAAAQ;AAAA,YAACc;AAAA,YAAA;AAAA,cACC,OAAA1B;AAAA,cACC,GAAII,MAAe,KAAO,KAAKA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGnCH,KACCD,EAAM,4BAAA,EAA8B,KAAK,SAAS,KAClDC;AAAA,QAAA,EAAA,CACJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -52,7 +52,7 @@ function x({
|
|
|
52
52
|
{
|
|
53
53
|
"data-slot": "alert-dialog-content",
|
|
54
54
|
className: s(
|
|
55
|
-
"ds:bg-background ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0 ds:data-[state=open]:fade-in-0 ds:data-[state=closed]:zoom-out-95 ds:data-[state=open]:zoom-in-95 ds:fixed ds:top-[50%] ds:left-[50%] ds:z-50 ds:grid ds:w-full ds:max-w-[calc(100%-2rem)] ds:translate-x-[-50%] ds:translate-y-[-50%] ds:gap-4 ds:rounded-lg ds:border ds:p-6 ds:shadow-lg ds:duration-200 ds:sm:max-w-lg",
|
|
55
|
+
"ds:bg-background ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0 ds:data-[state=open]:fade-in-0 ds:data-[state=closed]:zoom-out-95 ds:data-[state=open]:zoom-in-95 ds:fixed ds:top-[50%] ds:left-[50%] ds:z-50 ds:grid ds:w-full ds:max-w-[calc(100%-2rem)] ds:translate-x-[-50%] ds:translate-y-[-50%] ds:gap-4 ds:rounded-lg ds:border ds:border-border ds:p-6 ds:shadow-lg ds:duration-200 ds:sm:max-w-lg",
|
|
56
56
|
{
|
|
57
57
|
"ds:data-[state=open]:animate-in": !a
|
|
58
58
|
},
|
|
@@ -76,7 +76,7 @@ function D({
|
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function b({
|
|
80
80
|
className: t,
|
|
81
81
|
...a
|
|
82
82
|
}) {
|
|
@@ -92,7 +92,7 @@ function A({
|
|
|
92
92
|
}
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function A({
|
|
96
96
|
className: t,
|
|
97
97
|
...a
|
|
98
98
|
}) {
|
|
@@ -105,7 +105,7 @@ function v({
|
|
|
105
105
|
}
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function v({
|
|
109
109
|
className: t,
|
|
110
110
|
...a
|
|
111
111
|
}) {
|
|
@@ -121,12 +121,12 @@ function b({
|
|
|
121
121
|
export {
|
|
122
122
|
m as AlertDialog,
|
|
123
123
|
x as AlertDialogContent,
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
v as AlertDialogDescription,
|
|
125
|
+
b as AlertDialogFooter,
|
|
126
126
|
D as AlertDialogHeader,
|
|
127
127
|
g as AlertDialogOverlay,
|
|
128
128
|
n as AlertDialogPortal,
|
|
129
|
-
|
|
129
|
+
A as AlertDialogTitle,
|
|
130
130
|
p as AlertDialogTrigger
|
|
131
131
|
};
|
|
132
132
|
//# sourceMappingURL=alert-dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.js","sources":["../../../../../../../../packages/ui/src/components/alert-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\";\n\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { buttonVariants } from \"@dsui/ui/components/button\";\n\nfunction AlertDialog({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />;\n}\n\nfunction AlertDialogTrigger({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {\n return (\n <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n );\n}\n\nfunction AlertDialogPortal({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {\n return (\n <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n );\n}\n\nfunction AlertDialogOverlay({\n className,\n backdropFilter,\n overlay = \"dark\",\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay> & {\n backdropFilter?: number;\n overlay?: \"dark\" | \"light\";\n}) {\n const overlayClass = overlay === \"dark\" ? \"bg-black/50\" : \"bg-white/50\";\n return (\n <AlertDialogPrimitive.Overlay\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n \"ds:data-[state=open]:animate-in ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0 ds:data-[state=open]:fade-in-0 ds:fixed ds:inset-0 ds:z-50\",\n overlayClass,\n className\n )}\n style={\n backdropFilter\n ? { backdropFilter: `blur(${backdropFilter}px)` }\n : undefined\n }\n {...props}\n />\n );\n}\n\nfunction AlertDialogContent({\n className,\n noDefaultAnimation,\n backdropFilter,\n overlay,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {\n noDefaultAnimation?: boolean;\n backdropFilter?: number;\n overlay?: \"dark\" | \"light\";\n}) {\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay backdropFilter={backdropFilter} overlay={overlay} />\n <AlertDialogPrimitive.Content\n data-slot=\"alert-dialog-content\"\n className={cn(\n \"ds:bg-background ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0 ds:data-[state=open]:fade-in-0 ds:data-[state=closed]:zoom-out-95 ds:data-[state=open]:zoom-in-95 ds:fixed ds:top-[50%] ds:left-[50%] ds:z-50 ds:grid ds:w-full ds:max-w-[calc(100%-2rem)] ds:translate-x-[-50%] ds:translate-y-[-50%] ds:gap-4 ds:rounded-lg ds:border ds:p-6 ds:shadow-lg ds:duration-200 ds:sm:max-w-lg\",\n {\n \"ds:data-[state=open]:animate-in\": !noDefaultAnimation,\n },\n className\n )}\n {...props}\n />\n </AlertDialogPortal>\n );\n}\n\nfunction AlertDialogHeader({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\"ds:flex ds:flex-col ds:gap-2 ds:text-center ds:sm:text-left\", className)}\n {...props}\n />\n );\n}\n\nfunction AlertDialogFooter({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n \"ds:flex ds:flex-col-reverse ds:gap-2 ds:sm:flex-row ds:sm:justify-end\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction AlertDialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\"ds:text-lg ds:font-semibold\", className)}\n {...props}\n />\n );\n}\n\nfunction AlertDialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n return (\n <AlertDialogPrimitive.Description\n data-slot=\"alert-dialog-description\"\n className={cn(\"ds:text-muted-foreground ds:text-sm\", className)}\n {...props}\n />\n );\n}\n\nfunction AlertDialogAction({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {\n return (\n <AlertDialogPrimitive.Action\n className={cn(buttonVariants(), className)}\n {...props}\n />\n );\n}\n\nfunction AlertDialogCancel({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {\n return (\n <AlertDialogPrimitive.Cancel\n className={cn(buttonVariants({ variant: \"outline\" }), className)}\n {...props}\n />\n );\n}\n\nexport {\n AlertDialog,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogAction,\n AlertDialogCancel,\n};\n"],"names":["AlertDialog","props","AlertDialogPrimitive","AlertDialogTrigger","AlertDialogPortal","AlertDialogOverlay","className","backdropFilter","overlay","overlayClass","jsx","cn","AlertDialogContent","noDefaultAnimation","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","AlertDialogDescription"],"mappings":";;;;AAQA,SAASA,EAAY;AAAA,EACnB,GAAGC;AACL,GAA2D;AACzD,2BAAQC,EAAqB,MAArB,EAA0B,aAAU,gBAAgB,GAAGD,GAAO;AACxE;AAEA,SAASE,EAAmB;AAAA,EAC1B,GAAGF;AACL,GAA8D;AAC5D,2BACGC,EAAqB,SAArB,EAA6B,aAAU,wBAAwB,GAAGD,GAAO;AAE9E;AAEA,SAASG,EAAkB;AAAA,EACzB,GAAGH;AACL,GAA6D;AAC3D,2BACGC,EAAqB,QAArB,EAA4B,aAAU,uBAAuB,GAAGD,GAAO;AAE5E;AAEA,SAASI,EAAmB;AAAA,EAC1B,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,GAAGP;AACL,GAGG;AACD,QAAMQ,IAAeD,MAAY,SAAS,gBAAgB;AAC1D,SACE,gBAAAE;AAAA,IAACR,EAAqB;AAAA,IAArB;AAAA,MACC,aAAU;AAAA,MACV,WAAWS;AAAA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BL,CAAS;AAAA,MACrD,GAAGL;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAASgB,EAAuB;AAAA,EAC9B,WAAAX;AAAA,EACA,GAAGL;AACL,GAAkE;AAChE,SACE,gBAAAS;AAAA,IAACR,EAAqB;AAAA,IAArB;AAAA,MACC,aAAU;AAAA,MACV,WAAWS,EAAG,uCAAuCL,CAAS;AAAA,MAC7D,GAAGL;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
1
|
+
{"version":3,"file":"alert-dialog.js","sources":["../../../../../../../../packages/ui/src/components/alert-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as AlertDialogPrimitive from \"@radix-ui/react-alert-dialog\";\n\nimport { cn } from \"@dsui/ui/lib/utils\";\nimport { buttonVariants } from \"@dsui/ui/components/button\";\n\nfunction AlertDialog({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {\n return <AlertDialogPrimitive.Root data-slot=\"alert-dialog\" {...props} />;\n}\n\nfunction AlertDialogTrigger({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {\n return (\n <AlertDialogPrimitive.Trigger data-slot=\"alert-dialog-trigger\" {...props} />\n );\n}\n\nfunction AlertDialogPortal({\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {\n return (\n <AlertDialogPrimitive.Portal data-slot=\"alert-dialog-portal\" {...props} />\n );\n}\n\nfunction AlertDialogOverlay({\n className,\n backdropFilter,\n overlay = \"dark\",\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Overlay> & {\n backdropFilter?: number;\n overlay?: \"dark\" | \"light\";\n}) {\n const overlayClass = overlay === \"dark\" ? \"bg-black/50\" : \"bg-white/50\";\n return (\n <AlertDialogPrimitive.Overlay\n data-slot=\"alert-dialog-overlay\"\n className={cn(\n \"ds:data-[state=open]:animate-in ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0 ds:data-[state=open]:fade-in-0 ds:fixed ds:inset-0 ds:z-50\",\n overlayClass,\n className\n )}\n style={\n backdropFilter\n ? { backdropFilter: `blur(${backdropFilter}px)` }\n : undefined\n }\n {...props}\n />\n );\n}\n\nfunction AlertDialogContent({\n className,\n noDefaultAnimation,\n backdropFilter,\n overlay,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Content> & {\n noDefaultAnimation?: boolean;\n backdropFilter?: number;\n overlay?: \"dark\" | \"light\";\n}) {\n return (\n <AlertDialogPortal>\n <AlertDialogOverlay backdropFilter={backdropFilter} overlay={overlay} />\n <AlertDialogPrimitive.Content\n data-slot=\"alert-dialog-content\"\n className={cn(\n \"ds:bg-background ds:data-[state=closed]:animate-out ds:data-[state=closed]:fade-out-0 ds:data-[state=open]:fade-in-0 ds:data-[state=closed]:zoom-out-95 ds:data-[state=open]:zoom-in-95 ds:fixed ds:top-[50%] ds:left-[50%] ds:z-50 ds:grid ds:w-full ds:max-w-[calc(100%-2rem)] ds:translate-x-[-50%] ds:translate-y-[-50%] ds:gap-4 ds:rounded-lg ds:border ds:border-border ds:p-6 ds:shadow-lg ds:duration-200 ds:sm:max-w-lg\",\n {\n \"ds:data-[state=open]:animate-in\": !noDefaultAnimation,\n },\n className\n )}\n {...props}\n />\n </AlertDialogPortal>\n );\n}\n\nfunction AlertDialogHeader({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"alert-dialog-header\"\n className={cn(\"ds:flex ds:flex-col ds:gap-2 ds:text-center ds:sm:text-left\", className)}\n {...props}\n />\n );\n}\n\nfunction AlertDialogFooter({\n className,\n ...props\n}: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"alert-dialog-footer\"\n className={cn(\n \"ds:flex ds:flex-col-reverse ds:gap-2 ds:sm:flex-row ds:sm:justify-end\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction AlertDialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {\n return (\n <AlertDialogPrimitive.Title\n data-slot=\"alert-dialog-title\"\n className={cn(\"ds:text-lg ds:font-semibold\", className)}\n {...props}\n />\n );\n}\n\nfunction AlertDialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {\n return (\n <AlertDialogPrimitive.Description\n data-slot=\"alert-dialog-description\"\n className={cn(\"ds:text-muted-foreground ds:text-sm\", className)}\n {...props}\n />\n );\n}\n\nfunction AlertDialogAction({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {\n return (\n <AlertDialogPrimitive.Action\n className={cn(buttonVariants(), className)}\n {...props}\n />\n );\n}\n\nfunction AlertDialogCancel({\n className,\n ...props\n}: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {\n return (\n <AlertDialogPrimitive.Cancel\n className={cn(buttonVariants({ variant: \"outline\" }), className)}\n {...props}\n />\n );\n}\n\nexport {\n AlertDialog,\n AlertDialogPortal,\n AlertDialogOverlay,\n AlertDialogTrigger,\n AlertDialogContent,\n AlertDialogHeader,\n AlertDialogFooter,\n AlertDialogTitle,\n AlertDialogDescription,\n AlertDialogAction,\n AlertDialogCancel,\n};\n"],"names":["AlertDialog","props","AlertDialogPrimitive","AlertDialogTrigger","AlertDialogPortal","AlertDialogOverlay","className","backdropFilter","overlay","overlayClass","jsx","cn","AlertDialogContent","noDefaultAnimation","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","AlertDialogDescription"],"mappings":";;;;AAQA,SAASA,EAAY;AAAA,EACnB,GAAGC;AACL,GAA2D;AACzD,2BAAQC,EAAqB,MAArB,EAA0B,aAAU,gBAAgB,GAAGD,GAAO;AACxE;AAEA,SAASE,EAAmB;AAAA,EAC1B,GAAGF;AACL,GAA8D;AAC5D,2BACGC,EAAqB,SAArB,EAA6B,aAAU,wBAAwB,GAAGD,GAAO;AAE9E;AAEA,SAASG,EAAkB;AAAA,EACzB,GAAGH;AACL,GAA6D;AAC3D,2BACGC,EAAqB,QAArB,EAA4B,a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ACC,aAAU;AAAA,MACV,WAAWC;AAAA,QACT;AAAA,QACAL;AAAA,MAAA;AAAA,MAED,GAAGL;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAASe,EAAiB;AAAA,EACxB,WAAAV;AAAA,EACA,GAAGL;AACL,GAA4D;AAC1D,SACE,gBAAAS;AAAA,IAACR,EAAqB;AAAA,IAArB;AAAA,MACC,aAAU;AAAA,MACV,WAAWS,EAAG,+BAA+BL,CAAS;AAAA,MACrD,GAAGL;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAASgB,EAAuB;AAAA,EAC9B,WAAAX;AAAA,EACA,GAAGL;AACL,GAAkE;AAChE,SACE,gBAAAS;AAAA,IAACR,EAAqB;AAAA,IAArB;AAAA,MACC,aAAU;AAAA,MACV,WAAWS,EAAG,uCAAuCL,CAAS;AAAA,MAC7D,GAAGL;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -22,7 +22,7 @@ function j({
|
|
|
22
22
|
{
|
|
23
23
|
showOutsideDays: d,
|
|
24
24
|
className: e(
|
|
25
|
-
"ds:bg-background ds:group/calendar ds:p-3 ds:[--cell-size:--spacing(8)] ds:[[data-slot=card-content]_&]:bg-transparent ds:[[data-slot=popover-content]_&]:bg-transparent",
|
|
25
|
+
"ds:bg-background ds:group/calendar ds:p-3 ds:[--cell-size:--ds-spacing(8)] ds:[[data-slot=card-content]_&]:bg-transparent ds:[[data-slot=popover-content]_&]:bg-transparent",
|
|
26
26
|
String.raw`ds:rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
27
27
|
String.raw`ds:rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
28
28
|
u
|