@sarunyu/system-one 4.9.37 → 4.9.40
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/AGENTS.md +4 -0
- package/DESIGN.md +2 -2
- package/dist/index.cjs +729 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +730 -45
- package/dist/index.js.map +1 -1
- package/dist/src/components/avatar.d.ts +1 -1
- package/dist/src/components/avatar.d.ts.map +1 -1
- package/dist/src/components/list.d.ts +25 -0
- package/dist/src/components/list.d.ts.map +1 -0
- package/dist/src/components/pagination.d.ts +11 -8
- package/dist/src/components/pagination.d.ts.map +1 -1
- package/dist/src/components/progress.d.ts +23 -0
- package/dist/src/components/progress.d.ts.map +1 -0
- package/dist/src/components/slider.d.ts +34 -0
- package/dist/src/components/slider.d.ts.map +1 -0
- package/dist/src/components/upload.d.ts +38 -0
- package/dist/src/components/upload.d.ts.map +1 -0
- package/dist/src/index.d.ts +16 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/llms.txt +119 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6010,8 +6010,8 @@ TimeInput.displayName = "TimeInput";
|
|
|
6010
6010
|
const avatarPlaceholder = "data:image/png;base64,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";
|
|
6011
6011
|
const TEXT_GRADIENT = "linear-gradient(to top right, #B5D3F8, #E6F6FB)";
|
|
6012
6012
|
const TEXT_COLOR = "#00A2D9";
|
|
6013
|
-
const SIZE_CONFIG = {
|
|
6014
|
-
xxs: { container: "size-4", fontSize: "text-[11px]", dotSize: "size-
|
|
6013
|
+
const SIZE_CONFIG$1 = {
|
|
6014
|
+
xxs: { container: "size-4", fontSize: "text-[11px]", dotSize: "size-1", dotRing: "ring-[1.5px]" },
|
|
6015
6015
|
xs: { container: "size-5", fontSize: "text-sm", dotSize: "size-[5px]", dotRing: "ring-[1.5px]" },
|
|
6016
6016
|
s: { container: "size-6", fontSize: "text-base", dotSize: "size-[6px]", dotRing: "ring-[1.5px]" },
|
|
6017
6017
|
m: { container: "size-8", fontSize: "text-xl", dotSize: "size-[7px]", dotRing: "ring-2" },
|
|
@@ -6028,7 +6028,7 @@ function Avatar({
|
|
|
6028
6028
|
initials,
|
|
6029
6029
|
className
|
|
6030
6030
|
}) {
|
|
6031
|
-
const { container, fontSize, dotSize, dotRing } = SIZE_CONFIG[size2];
|
|
6031
|
+
const { container, fontSize, dotSize, dotRing } = SIZE_CONFIG$1[size2];
|
|
6032
6032
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("relative inline-flex shrink-0", container, className), children: [
|
|
6033
6033
|
type === "photo" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6034
6034
|
"img",
|
|
@@ -6068,7 +6068,7 @@ function Avatar({
|
|
|
6068
6068
|
)
|
|
6069
6069
|
}
|
|
6070
6070
|
),
|
|
6071
|
-
status &&
|
|
6071
|
+
status && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6072
6072
|
"span",
|
|
6073
6073
|
{
|
|
6074
6074
|
"aria-label": "Online",
|
|
@@ -6189,33 +6189,71 @@ function PaginationBanner({
|
|
|
6189
6189
|
);
|
|
6190
6190
|
}
|
|
6191
6191
|
function PaginationCarousel({
|
|
6192
|
-
|
|
6193
|
-
|
|
6192
|
+
count: count2,
|
|
6193
|
+
activeIndex,
|
|
6194
|
+
viewRatio,
|
|
6195
|
+
scrollProgress,
|
|
6196
|
+
onIndexChange,
|
|
6194
6197
|
className
|
|
6195
6198
|
}) {
|
|
6196
|
-
const
|
|
6197
|
-
|
|
6199
|
+
const clampedCount = Math.max(1, count2);
|
|
6200
|
+
const clampedIndex = Math.min(clampedCount - 1, Math.max(0, activeIndex));
|
|
6201
|
+
const trackWidth = 40;
|
|
6202
|
+
const pillWidth = Math.max(4, Math.round(trackWidth * (viewRatio ?? 1 / clampedCount)));
|
|
6203
|
+
const maxSlide = trackWidth - pillWidth;
|
|
6204
|
+
const pillLeft = scrollProgress !== void 0 ? Math.round(scrollProgress * maxSlide) : clampedCount > 1 ? Math.round(clampedIndex / (clampedCount - 1) * maxSlide) : 0;
|
|
6205
|
+
const goTo = (index2) => {
|
|
6206
|
+
const next = Math.min(clampedCount - 1, Math.max(0, index2));
|
|
6207
|
+
if (next !== clampedIndex) onIndexChange == null ? void 0 : onIndexChange(next);
|
|
6208
|
+
};
|
|
6209
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6198
6210
|
"div",
|
|
6199
6211
|
{
|
|
6200
|
-
className: cn("flex items-center", className),
|
|
6201
|
-
role: "
|
|
6202
|
-
"aria-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
"
|
|
6212
|
-
{
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6212
|
+
className: cn("flex items-center gap-2", className),
|
|
6213
|
+
role: "group",
|
|
6214
|
+
"aria-label": "Carousel pagination",
|
|
6215
|
+
children: [
|
|
6216
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6217
|
+
"button",
|
|
6218
|
+
{
|
|
6219
|
+
type: "button",
|
|
6220
|
+
"aria-label": "Previous slide",
|
|
6221
|
+
onClick: () => goTo(clampedIndex - 1),
|
|
6222
|
+
disabled: clampedIndex <= 0,
|
|
6223
|
+
className: "inline-flex h-6 w-6 items-center justify-center rounded-md text-icon-default transition-colors hover:bg-bg-default-hover disabled:cursor-not-allowed disabled:opacity-40",
|
|
6224
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.CaretLeft, { size: 16, weight: "regular" })
|
|
6225
|
+
}
|
|
6226
|
+
),
|
|
6227
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6228
|
+
"div",
|
|
6229
|
+
{
|
|
6230
|
+
className: "relative h-1.5 overflow-hidden rounded-[48px] bg-black/10 dark:bg-white/10",
|
|
6231
|
+
style: { width: trackWidth },
|
|
6232
|
+
role: "progressbar",
|
|
6233
|
+
"aria-valuenow": clampedIndex + 1,
|
|
6234
|
+
"aria-valuemin": 1,
|
|
6235
|
+
"aria-valuemax": clampedCount,
|
|
6236
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6237
|
+
"div",
|
|
6238
|
+
{
|
|
6239
|
+
className: "absolute top-0 h-full rounded-[12px] bg-bg-brand transition-all duration-200",
|
|
6240
|
+
style: { width: pillWidth, left: pillLeft }
|
|
6241
|
+
}
|
|
6242
|
+
)
|
|
6243
|
+
}
|
|
6244
|
+
),
|
|
6245
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6246
|
+
"button",
|
|
6247
|
+
{
|
|
6248
|
+
type: "button",
|
|
6249
|
+
"aria-label": "Next slide",
|
|
6250
|
+
onClick: () => goTo(clampedIndex + 1),
|
|
6251
|
+
disabled: clampedIndex >= clampedCount - 1,
|
|
6252
|
+
className: "inline-flex h-6 w-6 items-center justify-center rounded-md text-icon-default transition-colors hover:bg-bg-default-hover disabled:cursor-not-allowed disabled:opacity-40",
|
|
6253
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.CaretRight, { size: 16, weight: "regular" })
|
|
6254
|
+
}
|
|
6255
|
+
)
|
|
6256
|
+
]
|
|
6219
6257
|
}
|
|
6220
6258
|
);
|
|
6221
6259
|
}
|
|
@@ -6255,7 +6293,8 @@ function Pagination({
|
|
|
6255
6293
|
setDropdownOpen(false);
|
|
6256
6294
|
}
|
|
6257
6295
|
};
|
|
6258
|
-
const
|
|
6296
|
+
const cellPage = "box-border flex h-full min-h-0 shrink-0 items-center justify-center px-4 py-1 text-sm font-normal leading-5 text-text-default transition-colors select-none";
|
|
6297
|
+
const cellNav = "box-border inline-flex h-full min-h-0 w-[39px] shrink-0 items-center justify-center p-0 leading-none text-icon-default transition-colors select-none [&_svg]:block [&_svg]:shrink-0";
|
|
6259
6298
|
const divider = "border-l border-border";
|
|
6260
6299
|
const ellipsisLeft = ellipsisRef.current ? ellipsisRef.current.offsetLeft + ellipsisRef.current.offsetWidth / 2 : void 0;
|
|
6261
6300
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: containerRef, className: cn("relative inline-flex w-fit", className), children: [
|
|
@@ -6263,7 +6302,7 @@ function Pagination({
|
|
|
6263
6302
|
"nav",
|
|
6264
6303
|
{
|
|
6265
6304
|
"aria-label": "Pagination",
|
|
6266
|
-
className: "inline-flex w-fit overflow-hidden rounded-lg border border-border",
|
|
6305
|
+
className: "box-border inline-flex h-8 w-fit items-stretch overflow-hidden rounded-lg border border-border",
|
|
6267
6306
|
children: [
|
|
6268
6307
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6269
6308
|
"button",
|
|
@@ -6273,8 +6312,8 @@ function Pagination({
|
|
|
6273
6312
|
disabled: currentPage <= 1,
|
|
6274
6313
|
onClick: () => goTo(currentPage - 1),
|
|
6275
6314
|
className: cn(
|
|
6276
|
-
|
|
6277
|
-
"bg-bg-default
|
|
6315
|
+
cellNav,
|
|
6316
|
+
"bg-bg-default hover:bg-bg-default-hover disabled:cursor-not-allowed disabled:opacity-40 cursor-pointer"
|
|
6278
6317
|
),
|
|
6279
6318
|
children: /* @__PURE__ */ jsxRuntime.jsx(react.CaretLeft, { size: 16, weight: "regular" })
|
|
6280
6319
|
}
|
|
@@ -6290,9 +6329,9 @@ function Pagination({
|
|
|
6290
6329
|
"aria-haspopup": "listbox",
|
|
6291
6330
|
onClick: () => setDropdownOpen((v) => !v),
|
|
6292
6331
|
className: cn(
|
|
6293
|
-
|
|
6332
|
+
cellPage,
|
|
6294
6333
|
divider,
|
|
6295
|
-
"bg-bg-default
|
|
6334
|
+
"bg-bg-default cursor-pointer hover:bg-bg-default-hover"
|
|
6296
6335
|
),
|
|
6297
6336
|
children: "..."
|
|
6298
6337
|
},
|
|
@@ -6305,10 +6344,10 @@ function Pagination({
|
|
|
6305
6344
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
6306
6345
|
onClick: () => goTo(item),
|
|
6307
6346
|
className: cn(
|
|
6308
|
-
|
|
6347
|
+
cellPage,
|
|
6309
6348
|
divider,
|
|
6310
6349
|
"cursor-pointer",
|
|
6311
|
-
item === currentPage ? "bg-bg-
|
|
6350
|
+
item === currentPage ? "bg-bg-default font-bold text-text-brand hover:bg-bg-default-hover" : "bg-bg-default hover:bg-bg-default-hover"
|
|
6312
6351
|
),
|
|
6313
6352
|
children: item
|
|
6314
6353
|
},
|
|
@@ -6323,9 +6362,9 @@ function Pagination({
|
|
|
6323
6362
|
disabled: currentPage >= totalPages,
|
|
6324
6363
|
onClick: () => goTo(currentPage + 1),
|
|
6325
6364
|
className: cn(
|
|
6326
|
-
|
|
6365
|
+
cellNav,
|
|
6327
6366
|
divider,
|
|
6328
|
-
"bg-bg-default
|
|
6367
|
+
"bg-bg-default hover:bg-bg-default-hover disabled:cursor-not-allowed disabled:opacity-40 cursor-pointer"
|
|
6329
6368
|
),
|
|
6330
6369
|
children: /* @__PURE__ */ jsxRuntime.jsx(react.CaretRight, { size: 16, weight: "regular" })
|
|
6331
6370
|
}
|
|
@@ -6338,7 +6377,7 @@ function Pagination({
|
|
|
6338
6377
|
{
|
|
6339
6378
|
role: "listbox",
|
|
6340
6379
|
"aria-label": "Select page",
|
|
6341
|
-
className: "absolute bottom-full mb-1
|
|
6380
|
+
className: "absolute bottom-full z-50 mb-1 flex min-w-[39px] w-max flex-col overflow-y-auto rounded-lg border border-border bg-bg-default shadow-md [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
6342
6381
|
style: { left: ellipsisLeft, transform: "translateX(-50%)", maxHeight: 160 },
|
|
6343
6382
|
children: hiddenPages.map((page) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
6344
6383
|
"button",
|
|
@@ -6348,8 +6387,8 @@ function Pagination({
|
|
|
6348
6387
|
"aria-selected": page === currentPage,
|
|
6349
6388
|
onClick: () => goTo(page),
|
|
6350
6389
|
className: cn(
|
|
6351
|
-
"flex h-8 w-full shrink-0 cursor-pointer items-center justify-center text-sm leading-5 transition-colors select-none",
|
|
6352
|
-
page === currentPage ? "bg-bg-
|
|
6390
|
+
"box-border flex h-8 w-full min-w-full shrink-0 cursor-pointer items-center justify-center px-4 py-1 text-sm leading-5 transition-colors select-none",
|
|
6391
|
+
page === currentPage ? "bg-bg-default font-bold text-text-brand hover:bg-bg-default-hover" : "bg-bg-default font-normal text-text-default hover:bg-bg-default-hover"
|
|
6353
6392
|
),
|
|
6354
6393
|
children: page
|
|
6355
6394
|
},
|
|
@@ -6817,7 +6856,7 @@ const oppositeSideMap = {
|
|
|
6817
6856
|
bottom: "top",
|
|
6818
6857
|
top: "bottom"
|
|
6819
6858
|
};
|
|
6820
|
-
function clamp(start, value, end) {
|
|
6859
|
+
function clamp$1(start, value, end) {
|
|
6821
6860
|
return max(start, min(value, end));
|
|
6822
6861
|
}
|
|
6823
6862
|
function evaluate(value, param) {
|
|
@@ -7174,7 +7213,7 @@ const arrow$3 = (options) => ({
|
|
|
7174
7213
|
const min$1 = minPadding;
|
|
7175
7214
|
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
7176
7215
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
7177
|
-
const offset2 = clamp(min$1, center, max2);
|
|
7216
|
+
const offset2 = clamp$1(min$1, center, max2);
|
|
7178
7217
|
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
7179
7218
|
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
7180
7219
|
return {
|
|
@@ -7473,14 +7512,14 @@ const shift$2 = function(options) {
|
|
|
7473
7512
|
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
7474
7513
|
const min2 = mainAxisCoord + overflow[minSide];
|
|
7475
7514
|
const max2 = mainAxisCoord - overflow[maxSide];
|
|
7476
|
-
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
7515
|
+
mainAxisCoord = clamp$1(min2, mainAxisCoord, max2);
|
|
7477
7516
|
}
|
|
7478
7517
|
if (checkCrossAxis) {
|
|
7479
7518
|
const minSide = crossAxis === "y" ? "top" : "left";
|
|
7480
7519
|
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
7481
7520
|
const min2 = crossAxisCoord + overflow[minSide];
|
|
7482
7521
|
const max2 = crossAxisCoord - overflow[maxSide];
|
|
7483
|
-
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
7522
|
+
crossAxisCoord = clamp$1(min2, crossAxisCoord, max2);
|
|
7484
7523
|
}
|
|
7485
7524
|
const limitedCoords = limiter.fn({
|
|
7486
7525
|
...state,
|
|
@@ -9750,6 +9789,638 @@ function Tooltip({
|
|
|
9750
9789
|
)
|
|
9751
9790
|
] }) });
|
|
9752
9791
|
}
|
|
9792
|
+
const TRACK_HEIGHT = {
|
|
9793
|
+
sm: "h-1",
|
|
9794
|
+
md: "h-2",
|
|
9795
|
+
lg: "h-3"
|
|
9796
|
+
};
|
|
9797
|
+
const THUMB_SIZE_CLASS = {
|
|
9798
|
+
sm: "size-4",
|
|
9799
|
+
md: "size-5",
|
|
9800
|
+
lg: "size-6"
|
|
9801
|
+
};
|
|
9802
|
+
function clamp(v, lo, hi) {
|
|
9803
|
+
return Math.min(Math.max(v, lo), hi);
|
|
9804
|
+
}
|
|
9805
|
+
function snapToStep(raw, min2, max2, step) {
|
|
9806
|
+
return clamp(Math.round((raw - min2) / step) * step + min2, min2, max2);
|
|
9807
|
+
}
|
|
9808
|
+
function valueToPct(value, min2, max2) {
|
|
9809
|
+
if (max2 <= min2) return 0;
|
|
9810
|
+
return clamp((value - min2) / (max2 - min2) * 100, 0, 100);
|
|
9811
|
+
}
|
|
9812
|
+
function getStepLabels(min2, max2, step) {
|
|
9813
|
+
const n = step > 0 ? Math.round((max2 - min2) / step) : 0;
|
|
9814
|
+
return n > 0 && n <= 10 ? Array.from({ length: n + 1 }, (_, i) => clamp(min2 + i * step, min2, max2)) : [0, 0.25, 0.5, 0.75, 1].map((f) => Math.round(min2 + (max2 - min2) * f));
|
|
9815
|
+
}
|
|
9816
|
+
const Slider = React.forwardRef(function Slider2({
|
|
9817
|
+
size: size2 = "md",
|
|
9818
|
+
type = "single",
|
|
9819
|
+
disabled = false,
|
|
9820
|
+
showSteps = false,
|
|
9821
|
+
min: min2 = 0,
|
|
9822
|
+
max: max2 = 100,
|
|
9823
|
+
step = 1,
|
|
9824
|
+
value: valueProp,
|
|
9825
|
+
rangeValue: rangeProp,
|
|
9826
|
+
defaultValue = 50,
|
|
9827
|
+
defaultRangeValue = [25, 75],
|
|
9828
|
+
onChange,
|
|
9829
|
+
onRangeChange,
|
|
9830
|
+
className,
|
|
9831
|
+
id: idProp
|
|
9832
|
+
}, ref) {
|
|
9833
|
+
const autoId = React.useId();
|
|
9834
|
+
const trackRef = React.useRef(null);
|
|
9835
|
+
const activeThumb = React.useRef(null);
|
|
9836
|
+
const [internalValue, setInternalValue] = React.useState(
|
|
9837
|
+
() => clamp(defaultValue, min2, max2)
|
|
9838
|
+
);
|
|
9839
|
+
const [internalRange, setInternalRange] = React.useState(() => [
|
|
9840
|
+
clamp(defaultRangeValue[0], min2, max2),
|
|
9841
|
+
clamp(defaultRangeValue[1], min2, max2)
|
|
9842
|
+
]);
|
|
9843
|
+
const isSingle = type === "single";
|
|
9844
|
+
const value = valueProp !== void 0 ? valueProp : internalValue;
|
|
9845
|
+
const range = rangeProp !== void 0 ? rangeProp : internalRange;
|
|
9846
|
+
const stepLabels = React.useMemo(() => getStepLabels(min2, max2, step), [min2, max2, step]);
|
|
9847
|
+
const getValueFromClientX = React.useCallback(
|
|
9848
|
+
(clientX) => {
|
|
9849
|
+
const track = trackRef.current;
|
|
9850
|
+
if (!track) return min2;
|
|
9851
|
+
const { left, width } = track.getBoundingClientRect();
|
|
9852
|
+
const raw = min2 + clamp((clientX - left) / width, 0, 1) * (max2 - min2);
|
|
9853
|
+
if (showSteps) {
|
|
9854
|
+
return stepLabels.reduce((best, l) => Math.abs(l - raw) < Math.abs(best - raw) ? l : best);
|
|
9855
|
+
}
|
|
9856
|
+
return snapToStep(raw, min2, max2, step);
|
|
9857
|
+
},
|
|
9858
|
+
[min2, max2, step, showSteps, stepLabels]
|
|
9859
|
+
);
|
|
9860
|
+
const commitSingle = React.useCallback(
|
|
9861
|
+
(newValue) => {
|
|
9862
|
+
if (valueProp === void 0) setInternalValue(newValue);
|
|
9863
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
9864
|
+
},
|
|
9865
|
+
[valueProp, onChange]
|
|
9866
|
+
);
|
|
9867
|
+
const commitRange = React.useCallback(
|
|
9868
|
+
(newValue, thumb) => {
|
|
9869
|
+
const [s, e] = rangeProp !== void 0 ? rangeProp : internalRange;
|
|
9870
|
+
const next = thumb === "start" ? [clamp(newValue, min2, e), e] : [s, clamp(newValue, s, max2)];
|
|
9871
|
+
if (rangeProp === void 0) setInternalRange(next);
|
|
9872
|
+
onRangeChange == null ? void 0 : onRangeChange(next);
|
|
9873
|
+
},
|
|
9874
|
+
[rangeProp, internalRange, min2, max2, onRangeChange]
|
|
9875
|
+
);
|
|
9876
|
+
const handlePointerDown = React.useCallback(
|
|
9877
|
+
(e) => {
|
|
9878
|
+
if (disabled) return;
|
|
9879
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
9880
|
+
const newValue = getValueFromClientX(e.clientX);
|
|
9881
|
+
if (isSingle) {
|
|
9882
|
+
activeThumb.current = "end";
|
|
9883
|
+
commitSingle(newValue);
|
|
9884
|
+
} else {
|
|
9885
|
+
const track = trackRef.current;
|
|
9886
|
+
if (track) {
|
|
9887
|
+
const { left, width } = track.getBoundingClientRect();
|
|
9888
|
+
const clickPct = (e.clientX - left) / width * 100;
|
|
9889
|
+
const distToStart = Math.abs(clickPct - valueToPct(range[0], min2, max2));
|
|
9890
|
+
const distToEnd = Math.abs(clickPct - valueToPct(range[1], min2, max2));
|
|
9891
|
+
activeThumb.current = distToStart <= distToEnd ? "start" : "end";
|
|
9892
|
+
} else {
|
|
9893
|
+
activeThumb.current = "end";
|
|
9894
|
+
}
|
|
9895
|
+
commitRange(newValue, activeThumb.current);
|
|
9896
|
+
}
|
|
9897
|
+
},
|
|
9898
|
+
[disabled, getValueFromClientX, isSingle, range, min2, max2, commitSingle, commitRange]
|
|
9899
|
+
);
|
|
9900
|
+
const handlePointerMove = React.useCallback(
|
|
9901
|
+
(e) => {
|
|
9902
|
+
if (!activeThumb.current || disabled) return;
|
|
9903
|
+
const newValue = getValueFromClientX(e.clientX);
|
|
9904
|
+
if (isSingle) {
|
|
9905
|
+
commitSingle(newValue);
|
|
9906
|
+
} else {
|
|
9907
|
+
commitRange(newValue, activeThumb.current);
|
|
9908
|
+
}
|
|
9909
|
+
},
|
|
9910
|
+
[disabled, getValueFromClientX, isSingle, commitSingle, commitRange]
|
|
9911
|
+
);
|
|
9912
|
+
const handlePointerUp = React.useCallback(() => {
|
|
9913
|
+
activeThumb.current = null;
|
|
9914
|
+
}, []);
|
|
9915
|
+
const handleKeyDown = React.useCallback(
|
|
9916
|
+
(e, thumb) => {
|
|
9917
|
+
if (disabled) return;
|
|
9918
|
+
if (showSteps) {
|
|
9919
|
+
const currentVal = isSingle ? value : range[thumb === "start" ? 0 : 1];
|
|
9920
|
+
const idx = stepLabels.reduce(
|
|
9921
|
+
(best, _, i) => Math.abs(stepLabels[i] - currentVal) < Math.abs(stepLabels[best] - currentVal) ? i : best,
|
|
9922
|
+
0
|
|
9923
|
+
);
|
|
9924
|
+
let nextVal;
|
|
9925
|
+
if (e.key === "ArrowRight" || e.key === "ArrowUp") nextVal = stepLabels[Math.min(idx + 1, stepLabels.length - 1)];
|
|
9926
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowDown") nextVal = stepLabels[Math.max(idx - 1, 0)];
|
|
9927
|
+
else if (e.key === "Home") nextVal = stepLabels[0];
|
|
9928
|
+
else if (e.key === "End") nextVal = stepLabels[stepLabels.length - 1];
|
|
9929
|
+
if (nextVal === void 0) return;
|
|
9930
|
+
e.preventDefault();
|
|
9931
|
+
if (isSingle) commitSingle(nextVal);
|
|
9932
|
+
else commitRange(nextVal, thumb);
|
|
9933
|
+
return;
|
|
9934
|
+
}
|
|
9935
|
+
let delta = 0;
|
|
9936
|
+
if (e.key === "ArrowRight" || e.key === "ArrowUp") delta = step;
|
|
9937
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowDown") delta = -step;
|
|
9938
|
+
else if (e.key === "Home") delta = min2 - (isSingle ? value : range[thumb === "start" ? 0 : 1]);
|
|
9939
|
+
else if (e.key === "End") delta = max2 - (isSingle ? value : range[thumb === "start" ? 0 : 1]);
|
|
9940
|
+
if (!delta && e.key !== "Home" && e.key !== "End") return;
|
|
9941
|
+
e.preventDefault();
|
|
9942
|
+
if (isSingle) {
|
|
9943
|
+
commitSingle(clamp(value + delta, min2, max2));
|
|
9944
|
+
} else {
|
|
9945
|
+
const thumbVal = thumb === "start" ? range[0] : range[1];
|
|
9946
|
+
commitRange(clamp(thumbVal + delta, min2, max2), thumb);
|
|
9947
|
+
}
|
|
9948
|
+
},
|
|
9949
|
+
[disabled, showSteps, stepLabels, min2, max2, isSingle, value, range, commitSingle, commitRange]
|
|
9950
|
+
);
|
|
9951
|
+
const startPct = isSingle ? 0 : valueToPct(range[0], min2, max2);
|
|
9952
|
+
const endPct = isSingle ? valueToPct(value, min2, max2) : valueToPct(range[1], min2, max2);
|
|
9953
|
+
const thumbInteractive = cn(
|
|
9954
|
+
"absolute rounded-full bg-[var(--fill-white-1000)]",
|
|
9955
|
+
"shadow-[0px_1px_3px_0px_rgba(0,0,0,0.10),0px_1px_2px_-1px_rgba(0,0,0,0.10)]",
|
|
9956
|
+
THUMB_SIZE_CLASS[size2],
|
|
9957
|
+
disabled ? "cursor-not-allowed" : "cursor-grab active:cursor-grabbing",
|
|
9958
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--bg-brand-primary)] focus-visible:ring-offset-2"
|
|
9959
|
+
);
|
|
9960
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
9961
|
+
"div",
|
|
9962
|
+
{
|
|
9963
|
+
ref,
|
|
9964
|
+
id: idProp ?? autoId,
|
|
9965
|
+
className: cn("flex w-full flex-col", showSteps ? "gap-1.5" : "", className),
|
|
9966
|
+
children: [
|
|
9967
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
9968
|
+
"div",
|
|
9969
|
+
{
|
|
9970
|
+
ref: trackRef,
|
|
9971
|
+
className: cn(
|
|
9972
|
+
"relative w-full rounded-full",
|
|
9973
|
+
TRACK_HEIGHT[size2],
|
|
9974
|
+
disabled ? "bg-[var(--fill-gray-200)] dark:bg-[var(--fill-gray-700)] cursor-not-allowed" : "bg-[var(--fill-gray-200)] cursor-pointer"
|
|
9975
|
+
),
|
|
9976
|
+
onPointerDown: handlePointerDown,
|
|
9977
|
+
onPointerMove: handlePointerMove,
|
|
9978
|
+
onPointerUp: handlePointerUp,
|
|
9979
|
+
onPointerLeave: handlePointerUp,
|
|
9980
|
+
children: [
|
|
9981
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9982
|
+
"div",
|
|
9983
|
+
{
|
|
9984
|
+
"aria-hidden": "true",
|
|
9985
|
+
className: cn(
|
|
9986
|
+
"pointer-events-none absolute top-0 h-full rounded-full",
|
|
9987
|
+
disabled ? "bg-[var(--fill-gray-300)]" : "bg-[var(--bg-brand-primary)]"
|
|
9988
|
+
),
|
|
9989
|
+
style: { left: `${startPct}%`, width: `${endPct - startPct}%` }
|
|
9990
|
+
}
|
|
9991
|
+
),
|
|
9992
|
+
isSingle && /* @__PURE__ */ jsxRuntime.jsx(
|
|
9993
|
+
"div",
|
|
9994
|
+
{
|
|
9995
|
+
role: "slider",
|
|
9996
|
+
tabIndex: disabled ? -1 : 0,
|
|
9997
|
+
"aria-valuemin": min2,
|
|
9998
|
+
"aria-valuemax": max2,
|
|
9999
|
+
"aria-valuenow": value,
|
|
10000
|
+
"aria-disabled": disabled,
|
|
10001
|
+
className: thumbInteractive,
|
|
10002
|
+
style: {
|
|
10003
|
+
left: `${endPct}%`,
|
|
10004
|
+
top: "50%",
|
|
10005
|
+
transform: "translateX(-50%) translateY(-50%)"
|
|
10006
|
+
},
|
|
10007
|
+
onKeyDown: (e) => handleKeyDown(e, "end")
|
|
10008
|
+
}
|
|
10009
|
+
),
|
|
10010
|
+
!isSingle && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10011
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10012
|
+
"div",
|
|
10013
|
+
{
|
|
10014
|
+
role: "slider",
|
|
10015
|
+
tabIndex: disabled ? -1 : 0,
|
|
10016
|
+
"aria-valuemin": min2,
|
|
10017
|
+
"aria-valuemax": range[1],
|
|
10018
|
+
"aria-valuenow": range[0],
|
|
10019
|
+
"aria-label": "Start value",
|
|
10020
|
+
"aria-disabled": disabled,
|
|
10021
|
+
className: thumbInteractive,
|
|
10022
|
+
style: {
|
|
10023
|
+
left: `${startPct}%`,
|
|
10024
|
+
top: "50%",
|
|
10025
|
+
transform: "translateX(-50%) translateY(-50%)"
|
|
10026
|
+
},
|
|
10027
|
+
onKeyDown: (e) => handleKeyDown(e, "start")
|
|
10028
|
+
}
|
|
10029
|
+
),
|
|
10030
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10031
|
+
"div",
|
|
10032
|
+
{
|
|
10033
|
+
role: "slider",
|
|
10034
|
+
tabIndex: disabled ? -1 : 0,
|
|
10035
|
+
"aria-valuemin": range[0],
|
|
10036
|
+
"aria-valuemax": max2,
|
|
10037
|
+
"aria-valuenow": range[1],
|
|
10038
|
+
"aria-label": "End value",
|
|
10039
|
+
"aria-disabled": disabled,
|
|
10040
|
+
className: cn(thumbInteractive, "z-10"),
|
|
10041
|
+
style: {
|
|
10042
|
+
left: `${endPct}%`,
|
|
10043
|
+
top: "50%",
|
|
10044
|
+
transform: "translateX(-50%) translateY(-50%)"
|
|
10045
|
+
},
|
|
10046
|
+
onKeyDown: (e) => handleKeyDown(e, "end")
|
|
10047
|
+
}
|
|
10048
|
+
)
|
|
10049
|
+
] })
|
|
10050
|
+
]
|
|
10051
|
+
}
|
|
10052
|
+
),
|
|
10053
|
+
showSteps && /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", className: "relative w-full h-4", children: stepLabels.map((label) => {
|
|
10054
|
+
const pct = valueToPct(label, min2, max2);
|
|
10055
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10056
|
+
"button",
|
|
10057
|
+
{
|
|
10058
|
+
type: "button",
|
|
10059
|
+
tabIndex: -1,
|
|
10060
|
+
disabled,
|
|
10061
|
+
onClick: () => {
|
|
10062
|
+
if (isSingle) {
|
|
10063
|
+
commitSingle(label);
|
|
10064
|
+
} else {
|
|
10065
|
+
const thumb = Math.abs(label - range[0]) <= Math.abs(label - range[1]) ? "start" : "end";
|
|
10066
|
+
commitRange(label, thumb);
|
|
10067
|
+
}
|
|
10068
|
+
},
|
|
10069
|
+
className: cn(
|
|
10070
|
+
"absolute text-xs leading-4 whitespace-nowrap",
|
|
10071
|
+
disabled ? "cursor-not-allowed text-[var(--text-default-disabled)]" : "cursor-pointer text-[var(--text-default-primary)]"
|
|
10072
|
+
),
|
|
10073
|
+
style: { left: `${pct}%`, transform: "translateX(-50%)" },
|
|
10074
|
+
children: label
|
|
10075
|
+
},
|
|
10076
|
+
label
|
|
10077
|
+
);
|
|
10078
|
+
}) })
|
|
10079
|
+
]
|
|
10080
|
+
}
|
|
10081
|
+
);
|
|
10082
|
+
});
|
|
10083
|
+
Slider.displayName = "Slider";
|
|
10084
|
+
const LinearProgress = React.forwardRef(
|
|
10085
|
+
function LinearProgress2({ value, className }, ref) {
|
|
10086
|
+
const pct = Math.min(100, Math.max(0, value));
|
|
10087
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10088
|
+
"div",
|
|
10089
|
+
{
|
|
10090
|
+
ref,
|
|
10091
|
+
role: "progressbar",
|
|
10092
|
+
"aria-valuenow": pct,
|
|
10093
|
+
"aria-valuemin": 0,
|
|
10094
|
+
"aria-valuemax": 100,
|
|
10095
|
+
className: cn(
|
|
10096
|
+
"relative h-1 w-full rounded-full bg-bg-default-tertiary overflow-hidden",
|
|
10097
|
+
className
|
|
10098
|
+
),
|
|
10099
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10100
|
+
"div",
|
|
10101
|
+
{
|
|
10102
|
+
className: "absolute inset-y-0 left-0 h-full rounded-full bg-bg-brand transition-[width] duration-300",
|
|
10103
|
+
style: { width: `${pct}%` }
|
|
10104
|
+
}
|
|
10105
|
+
)
|
|
10106
|
+
}
|
|
10107
|
+
);
|
|
10108
|
+
}
|
|
10109
|
+
);
|
|
10110
|
+
LinearProgress.displayName = "LinearProgress";
|
|
10111
|
+
const SIZE_CONFIG = {
|
|
10112
|
+
lg: { dimension: 128, r: 60, strokeWidth: 8, trackColor: "var(--bg-default-tertiary)", fontSize: 24, lineHeight: 36, showLabel: true },
|
|
10113
|
+
md: { dimension: 48, r: 22, strokeWidth: 3, trackColor: "var(--bg-default-tertiary)", fontSize: 14, lineHeight: 20, showLabel: true },
|
|
10114
|
+
sm: { dimension: 18, r: 8, strokeWidth: 2, trackColor: "var(--fill-black-200)", fontSize: 0, lineHeight: 0, showLabel: false }
|
|
10115
|
+
};
|
|
10116
|
+
const CircleProgress = React.forwardRef(
|
|
10117
|
+
function CircleProgress2({ value, size: size2 = "lg", className }, ref) {
|
|
10118
|
+
const pct = Math.min(100, Math.max(0, value));
|
|
10119
|
+
const cfg = SIZE_CONFIG[size2];
|
|
10120
|
+
const circumference = 2 * Math.PI * cfg.r;
|
|
10121
|
+
const offset2 = circumference * (1 - pct / 100);
|
|
10122
|
+
const cx = cfg.dimension / 2;
|
|
10123
|
+
const isZero = pct === 0;
|
|
10124
|
+
const uid = React.useId();
|
|
10125
|
+
const gradientId = `cp-grad-${uid}`;
|
|
10126
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10127
|
+
"svg",
|
|
10128
|
+
{
|
|
10129
|
+
ref,
|
|
10130
|
+
role: "progressbar",
|
|
10131
|
+
"aria-valuenow": pct,
|
|
10132
|
+
"aria-valuemin": 0,
|
|
10133
|
+
"aria-valuemax": 100,
|
|
10134
|
+
width: cfg.dimension,
|
|
10135
|
+
height: cfg.dimension,
|
|
10136
|
+
viewBox: `0 0 ${cfg.dimension} ${cfg.dimension}`,
|
|
10137
|
+
className: cn("shrink-0", className),
|
|
10138
|
+
children: [
|
|
10139
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10140
|
+
"linearGradient",
|
|
10141
|
+
{
|
|
10142
|
+
id: gradientId,
|
|
10143
|
+
gradientUnits: "userSpaceOnUse",
|
|
10144
|
+
x1: cx,
|
|
10145
|
+
y1: 0,
|
|
10146
|
+
x2: cx,
|
|
10147
|
+
y2: cfg.dimension,
|
|
10148
|
+
children: [
|
|
10149
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "0%", stopColor: "#00a1e9" }),
|
|
10150
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "100%", stopColor: "#004eba" })
|
|
10151
|
+
]
|
|
10152
|
+
}
|
|
10153
|
+
) }),
|
|
10154
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10155
|
+
"circle",
|
|
10156
|
+
{
|
|
10157
|
+
cx,
|
|
10158
|
+
cy: cx,
|
|
10159
|
+
r: cfg.r,
|
|
10160
|
+
fill: "none",
|
|
10161
|
+
stroke: cfg.trackColor,
|
|
10162
|
+
strokeWidth: cfg.strokeWidth
|
|
10163
|
+
}
|
|
10164
|
+
),
|
|
10165
|
+
pct > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10166
|
+
"circle",
|
|
10167
|
+
{
|
|
10168
|
+
cx,
|
|
10169
|
+
cy: cx,
|
|
10170
|
+
r: cfg.r,
|
|
10171
|
+
fill: "none",
|
|
10172
|
+
stroke: `url(#${gradientId})`,
|
|
10173
|
+
strokeWidth: cfg.strokeWidth,
|
|
10174
|
+
strokeDasharray: circumference,
|
|
10175
|
+
strokeDashoffset: offset2,
|
|
10176
|
+
strokeLinecap: "round",
|
|
10177
|
+
transform: `rotate(-90 ${cx} ${cx})`,
|
|
10178
|
+
style: { transition: "stroke-dashoffset 0.3s ease" }
|
|
10179
|
+
}
|
|
10180
|
+
),
|
|
10181
|
+
cfg.showLabel && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10182
|
+
"text",
|
|
10183
|
+
{
|
|
10184
|
+
x: cx,
|
|
10185
|
+
y: cx,
|
|
10186
|
+
textAnchor: "middle",
|
|
10187
|
+
dominantBaseline: "central",
|
|
10188
|
+
style: {
|
|
10189
|
+
fontSize: cfg.fontSize,
|
|
10190
|
+
lineHeight: cfg.lineHeight,
|
|
10191
|
+
fontWeight: 700,
|
|
10192
|
+
fontVariationSettings: "'CTGR' 0, 'wdth' 100, 'wght' 700",
|
|
10193
|
+
fill: isZero ? "var(--text-default-placeholder)" : "var(--text-brand-primary)",
|
|
10194
|
+
fontFamily: "'Noto Sans Thai', sans-serif"
|
|
10195
|
+
},
|
|
10196
|
+
children: [
|
|
10197
|
+
pct,
|
|
10198
|
+
"%"
|
|
10199
|
+
]
|
|
10200
|
+
}
|
|
10201
|
+
)
|
|
10202
|
+
]
|
|
10203
|
+
}
|
|
10204
|
+
);
|
|
10205
|
+
}
|
|
10206
|
+
);
|
|
10207
|
+
CircleProgress.displayName = "CircleProgress";
|
|
10208
|
+
const UploadArea = React.forwardRef(
|
|
10209
|
+
function UploadArea2({ disabled = false, label = "อัปโหลดไฟล์", className, onClick, ...props }, ref) {
|
|
10210
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10211
|
+
"div",
|
|
10212
|
+
{
|
|
10213
|
+
ref,
|
|
10214
|
+
role: disabled ? void 0 : "button",
|
|
10215
|
+
tabIndex: disabled ? void 0 : 0,
|
|
10216
|
+
"aria-disabled": disabled,
|
|
10217
|
+
onClick: disabled ? void 0 : onClick,
|
|
10218
|
+
onKeyDown: disabled ? void 0 : (e) => {
|
|
10219
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
10220
|
+
e.preventDefault();
|
|
10221
|
+
onClick == null ? void 0 : onClick(e);
|
|
10222
|
+
}
|
|
10223
|
+
},
|
|
10224
|
+
className: cn(
|
|
10225
|
+
"flex h-12 items-center justify-center gap-2 rounded-lg",
|
|
10226
|
+
"border border-dashed border-border-default",
|
|
10227
|
+
disabled ? "bg-bg-default-secondary cursor-not-allowed" : "bg-background cursor-pointer hover:bg-bg-default-secondary transition-colors",
|
|
10228
|
+
className
|
|
10229
|
+
),
|
|
10230
|
+
...props,
|
|
10231
|
+
children: [
|
|
10232
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10233
|
+
"span",
|
|
10234
|
+
{
|
|
10235
|
+
className: cn(
|
|
10236
|
+
"flex items-center justify-center w-5 h-5 shrink-0",
|
|
10237
|
+
disabled ? "text-disabled" : "text-primary-action"
|
|
10238
|
+
),
|
|
10239
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.UploadSimpleIcon, { size: 20, weight: "regular" })
|
|
10240
|
+
}
|
|
10241
|
+
),
|
|
10242
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10243
|
+
"span",
|
|
10244
|
+
{
|
|
10245
|
+
className: cn(
|
|
10246
|
+
"text-sm font-medium leading-5 whitespace-nowrap",
|
|
10247
|
+
disabled ? "text-disabled" : "text-primary-action"
|
|
10248
|
+
),
|
|
10249
|
+
children: label
|
|
10250
|
+
}
|
|
10251
|
+
)
|
|
10252
|
+
]
|
|
10253
|
+
}
|
|
10254
|
+
);
|
|
10255
|
+
}
|
|
10256
|
+
);
|
|
10257
|
+
UploadArea.displayName = "UploadArea";
|
|
10258
|
+
const UploadItem = React.forwardRef(
|
|
10259
|
+
function UploadItem2({
|
|
10260
|
+
variant = "text",
|
|
10261
|
+
status = "loading",
|
|
10262
|
+
fileName = "filename.pdf",
|
|
10263
|
+
fileSize = "1.66KB",
|
|
10264
|
+
errorText = "Error Text",
|
|
10265
|
+
progress = 50,
|
|
10266
|
+
onDelete,
|
|
10267
|
+
className
|
|
10268
|
+
}, ref) {
|
|
10269
|
+
const isLoading = status === "loading";
|
|
10270
|
+
const isSuccess = status === "success";
|
|
10271
|
+
const isError = status === "error";
|
|
10272
|
+
if (variant === "text") {
|
|
10273
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10274
|
+
"div",
|
|
10275
|
+
{
|
|
10276
|
+
ref,
|
|
10277
|
+
className: cn(
|
|
10278
|
+
"flex max-w-[500px] w-[300px] overflow-hidden",
|
|
10279
|
+
isError ? "flex-col gap-1 items-start" : "gap-2 items-center",
|
|
10280
|
+
className
|
|
10281
|
+
),
|
|
10282
|
+
children: [
|
|
10283
|
+
isLoading && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10284
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex-1 min-w-0 text-sm leading-5 text-text-default-placeholder truncate", children: fileName }),
|
|
10285
|
+
/* @__PURE__ */ jsxRuntime.jsx(CircleProgress, { size: "sm", value: progress, className: "shrink-0" })
|
|
10286
|
+
] }),
|
|
10287
|
+
isSuccess && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10288
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex-1 min-w-0 text-sm leading-5 text-text-info truncate", children: fileName }),
|
|
10289
|
+
/* @__PURE__ */ jsxRuntime.jsx(TrashButton, { onDelete })
|
|
10290
|
+
] }),
|
|
10291
|
+
isError && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10292
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 items-center w-full py-px", children: [
|
|
10293
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex-1 min-w-0 text-sm leading-5 text-text-danger truncate", children: fileName }),
|
|
10294
|
+
/* @__PURE__ */ jsxRuntime.jsx(TrashButton, { onDelete })
|
|
10295
|
+
] }),
|
|
10296
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-0.5 px-0.5 text-text-danger", children: [
|
|
10297
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs leading-4", children: "*" }),
|
|
10298
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs leading-4", children: errorText })
|
|
10299
|
+
] })
|
|
10300
|
+
] })
|
|
10301
|
+
]
|
|
10302
|
+
}
|
|
10303
|
+
);
|
|
10304
|
+
}
|
|
10305
|
+
const cardBase = "flex-1 min-w-0 flex h-[52px] items-center gap-2 px-3.5 bg-background border border-border-default rounded-lg text-base leading-6 whitespace-nowrap";
|
|
10306
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10307
|
+
"div",
|
|
10308
|
+
{
|
|
10309
|
+
ref,
|
|
10310
|
+
className: cn(
|
|
10311
|
+
"flex flex-col gap-1 items-start w-[343px]",
|
|
10312
|
+
className
|
|
10313
|
+
),
|
|
10314
|
+
children: [
|
|
10315
|
+
isLoading && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full flex h-12 flex-col justify-center gap-1 px-3.5 bg-background border border-border-default rounded-lg", children: [
|
|
10316
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-2 items-center h-5 text-sm leading-5 text-text-default-placeholder", children: [
|
|
10317
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex-1 min-w-0 truncate", children: fileName }),
|
|
10318
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 text-right w-[46px]", children: fileSize })
|
|
10319
|
+
] }),
|
|
10320
|
+
/* @__PURE__ */ jsxRuntime.jsx(LinearProgress, { value: progress })
|
|
10321
|
+
] }),
|
|
10322
|
+
(isSuccess || isError) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 items-center w-full", children: [
|
|
10323
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
10324
|
+
"div",
|
|
10325
|
+
{
|
|
10326
|
+
className: cn(
|
|
10327
|
+
cardBase,
|
|
10328
|
+
isSuccess ? "text-text-info" : "text-text-danger"
|
|
10329
|
+
),
|
|
10330
|
+
children: [
|
|
10331
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "flex-1 min-w-0 overflow-hidden text-ellipsis", children: fileName }),
|
|
10332
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "shrink-0 text-right", children: fileSize })
|
|
10333
|
+
]
|
|
10334
|
+
}
|
|
10335
|
+
),
|
|
10336
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10337
|
+
"button",
|
|
10338
|
+
{
|
|
10339
|
+
type: "button",
|
|
10340
|
+
onClick: onDelete,
|
|
10341
|
+
className: cn(
|
|
10342
|
+
"flex items-center justify-center size-12 shrink-0",
|
|
10343
|
+
"bg-background border border-border-default rounded-lg",
|
|
10344
|
+
"text-icon-danger cursor-pointer"
|
|
10345
|
+
),
|
|
10346
|
+
"aria-label": "ลบไฟล์",
|
|
10347
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.TrashIcon, { size: 20 })
|
|
10348
|
+
}
|
|
10349
|
+
)
|
|
10350
|
+
] }),
|
|
10351
|
+
isError && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center px-1 py-0 w-full text-text-danger", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs leading-4 whitespace-nowrap", children: errorText }) })
|
|
10352
|
+
]
|
|
10353
|
+
}
|
|
10354
|
+
);
|
|
10355
|
+
}
|
|
10356
|
+
);
|
|
10357
|
+
UploadItem.displayName = "UploadItem";
|
|
10358
|
+
function TrashButton({ onDelete }) {
|
|
10359
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10360
|
+
"button",
|
|
10361
|
+
{
|
|
10362
|
+
type: "button",
|
|
10363
|
+
onClick: onDelete,
|
|
10364
|
+
className: "flex items-center justify-center w-5 h-5 shrink-0 text-icon-danger cursor-pointer",
|
|
10365
|
+
"aria-label": "ลบไฟล์",
|
|
10366
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.TrashIcon, { size: 20 })
|
|
10367
|
+
}
|
|
10368
|
+
);
|
|
10369
|
+
}
|
|
10370
|
+
const ListItem = React.forwardRef(
|
|
10371
|
+
function ListItem2({
|
|
10372
|
+
label,
|
|
10373
|
+
leading,
|
|
10374
|
+
action,
|
|
10375
|
+
onAction,
|
|
10376
|
+
trailing,
|
|
10377
|
+
highlighted = false,
|
|
10378
|
+
onClick,
|
|
10379
|
+
className
|
|
10380
|
+
}, ref) {
|
|
10381
|
+
const [pressed, setPressed] = React.useState(false);
|
|
10382
|
+
const isHighlighted = highlighted || !!onClick && pressed;
|
|
10383
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10384
|
+
"div",
|
|
10385
|
+
{
|
|
10386
|
+
ref,
|
|
10387
|
+
onClick,
|
|
10388
|
+
onPointerDown: () => {
|
|
10389
|
+
if (onClick) setPressed(true);
|
|
10390
|
+
},
|
|
10391
|
+
onPointerUp: () => setPressed(false),
|
|
10392
|
+
onPointerLeave: () => setPressed(false),
|
|
10393
|
+
className: cn(
|
|
10394
|
+
"flex items-center gap-3 p-4 h-[52px] border-b border-border",
|
|
10395
|
+
isHighlighted ? "bg-bg-default-pressed" : "bg-background",
|
|
10396
|
+
onClick && "cursor-pointer select-none hover:bg-bg-default-pressed",
|
|
10397
|
+
className
|
|
10398
|
+
),
|
|
10399
|
+
children: [
|
|
10400
|
+
leading != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 flex items-center text-icon-default [&_svg]:text-icon-default [&_svg]:size-6", children: leading }),
|
|
10401
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 min-w-0 text-sm leading-5 text-foreground truncate", children: label }),
|
|
10402
|
+
action && /* @__PURE__ */ jsxRuntime.jsx(
|
|
10403
|
+
"button",
|
|
10404
|
+
{
|
|
10405
|
+
type: "button",
|
|
10406
|
+
onClick: (e) => {
|
|
10407
|
+
e.stopPropagation();
|
|
10408
|
+
onAction == null ? void 0 : onAction(e);
|
|
10409
|
+
},
|
|
10410
|
+
className: "shrink-0 text-sm font-medium text-primary-action hover:underline cursor-pointer whitespace-nowrap",
|
|
10411
|
+
children: action
|
|
10412
|
+
}
|
|
10413
|
+
),
|
|
10414
|
+
trailing != null && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 flex items-center text-icon-default [&_svg]:text-icon-default [&_svg]:size-6", children: trailing })
|
|
10415
|
+
]
|
|
10416
|
+
}
|
|
10417
|
+
);
|
|
10418
|
+
}
|
|
10419
|
+
);
|
|
10420
|
+
ListItem.displayName = "ListItem";
|
|
10421
|
+
function List({ children, className }) {
|
|
10422
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("flex flex-col", className), children });
|
|
10423
|
+
}
|
|
9753
10424
|
const index = {
|
|
9754
10425
|
Button,
|
|
9755
10426
|
Badge,
|
|
@@ -9791,6 +10462,13 @@ const index = {
|
|
|
9791
10462
|
PaginationCarousel,
|
|
9792
10463
|
Tooltip,
|
|
9793
10464
|
Popover,
|
|
10465
|
+
Slider,
|
|
10466
|
+
LinearProgress,
|
|
10467
|
+
CircleProgress,
|
|
10468
|
+
UploadArea,
|
|
10469
|
+
UploadItem,
|
|
10470
|
+
List,
|
|
10471
|
+
ListItem,
|
|
9794
10472
|
cn,
|
|
9795
10473
|
useIsMobile
|
|
9796
10474
|
};
|
|
@@ -9804,10 +10482,14 @@ exports.Button = Button;
|
|
|
9804
10482
|
exports.Card = Card;
|
|
9805
10483
|
exports.Checkbox = Checkbox;
|
|
9806
10484
|
exports.Chip = Chip;
|
|
10485
|
+
exports.CircleProgress = CircleProgress;
|
|
9807
10486
|
exports.DateInput = DateInput;
|
|
9808
10487
|
exports.Dropdown = Dropdown;
|
|
9809
10488
|
exports.DropdownMultiple = DropdownMultiple;
|
|
9810
10489
|
exports.Input = Input;
|
|
10490
|
+
exports.LinearProgress = LinearProgress;
|
|
10491
|
+
exports.List = List;
|
|
10492
|
+
exports.ListItem = ListItem;
|
|
9811
10493
|
exports.Modal = Modal;
|
|
9812
10494
|
exports.Notification = Notification;
|
|
9813
10495
|
exports.OptionList = OptionList;
|
|
@@ -9817,6 +10499,7 @@ exports.PaginationCarousel = PaginationCarousel;
|
|
|
9817
10499
|
exports.Popover = Popover;
|
|
9818
10500
|
exports.Radio = Radio;
|
|
9819
10501
|
exports.SearchInput = SearchInput;
|
|
10502
|
+
exports.Slider = Slider;
|
|
9820
10503
|
exports.StatusTag = StatusTag;
|
|
9821
10504
|
exports.Tab = Tab;
|
|
9822
10505
|
exports.TabGroup = TabGroup;
|
|
@@ -9834,6 +10517,8 @@ exports.ToastStack = ToastStack;
|
|
|
9834
10517
|
exports.Toaster = Toaster;
|
|
9835
10518
|
exports.Toggle = Toggle;
|
|
9836
10519
|
exports.Tooltip = Tooltip;
|
|
10520
|
+
exports.UploadArea = UploadArea;
|
|
10521
|
+
exports.UploadItem = UploadItem;
|
|
9837
10522
|
exports.cn = cn;
|
|
9838
10523
|
exports.default = index;
|
|
9839
10524
|
exports.useIsMobile = useIsMobile;
|