@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.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import React__default, { forwardRef, useState, useRef, useEffect, useCallback, useId as useId$1, useMemo, useLayoutEffect, useContext, createContext } from "react";
|
|
5
5
|
import { clsx } from "clsx";
|
|
6
6
|
import { twMerge } from "tailwind-merge";
|
|
7
|
-
import { BellSimple, FunnelSimple, CheckCircle, Warning, XCircle, Info, BookmarkSimpleIcon, BroadcastIcon as BroadcastIcon$1, CalendarBlank, MapPin, Users, Lock, Check, Plus, Circle, Minus, CaretLeft, CaretRight, CaretDoubleLeft, CaretDoubleRight, CaretUp, CaretDown, X, ImageSquare, Gift, MegaphoneSimple, GearSix, MagnifyingGlass, ArrowUp, ArrowDown, ArrowsDownUp, Clock } from "@phosphor-icons/react";
|
|
7
|
+
import { BellSimple, FunnelSimple, CheckCircle, Warning, XCircle, Info, BookmarkSimpleIcon, BroadcastIcon as BroadcastIcon$1, CalendarBlank, MapPin, Users, Lock, Check, Plus, Circle, Minus, CaretLeft, CaretRight, CaretDoubleLeft, CaretDoubleRight, CaretUp, CaretDown, X, ImageSquare, Gift, MegaphoneSimple, GearSix, MagnifyingGlass, ArrowUp, ArrowDown, ArrowsDownUp, Clock, UploadSimpleIcon, TrashIcon } from "@phosphor-icons/react";
|
|
8
8
|
import { DayPicker, useDayPicker } from "react-day-picker";
|
|
9
9
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
10
10
|
import { Drawer as Drawer$1 } from "vaul";
|
|
@@ -5991,8 +5991,8 @@ TimeInput.displayName = "TimeInput";
|
|
|
5991
5991
|
const avatarPlaceholder = "data:image/png;base64,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";
|
|
5992
5992
|
const TEXT_GRADIENT = "linear-gradient(to top right, #B5D3F8, #E6F6FB)";
|
|
5993
5993
|
const TEXT_COLOR = "#00A2D9";
|
|
5994
|
-
const SIZE_CONFIG = {
|
|
5995
|
-
xxs: { container: "size-4", fontSize: "text-[11px]", dotSize: "size-
|
|
5994
|
+
const SIZE_CONFIG$1 = {
|
|
5995
|
+
xxs: { container: "size-4", fontSize: "text-[11px]", dotSize: "size-1", dotRing: "ring-[1.5px]" },
|
|
5996
5996
|
xs: { container: "size-5", fontSize: "text-sm", dotSize: "size-[5px]", dotRing: "ring-[1.5px]" },
|
|
5997
5997
|
s: { container: "size-6", fontSize: "text-base", dotSize: "size-[6px]", dotRing: "ring-[1.5px]" },
|
|
5998
5998
|
m: { container: "size-8", fontSize: "text-xl", dotSize: "size-[7px]", dotRing: "ring-2" },
|
|
@@ -6009,7 +6009,7 @@ function Avatar({
|
|
|
6009
6009
|
initials,
|
|
6010
6010
|
className
|
|
6011
6011
|
}) {
|
|
6012
|
-
const { container, fontSize, dotSize, dotRing } = SIZE_CONFIG[size2];
|
|
6012
|
+
const { container, fontSize, dotSize, dotRing } = SIZE_CONFIG$1[size2];
|
|
6013
6013
|
return /* @__PURE__ */ jsxs("div", { className: cn("relative inline-flex shrink-0", container, className), children: [
|
|
6014
6014
|
type === "photo" && /* @__PURE__ */ jsx(
|
|
6015
6015
|
"img",
|
|
@@ -6049,7 +6049,7 @@ function Avatar({
|
|
|
6049
6049
|
)
|
|
6050
6050
|
}
|
|
6051
6051
|
),
|
|
6052
|
-
status &&
|
|
6052
|
+
status && /* @__PURE__ */ jsx(
|
|
6053
6053
|
"span",
|
|
6054
6054
|
{
|
|
6055
6055
|
"aria-label": "Online",
|
|
@@ -6170,33 +6170,71 @@ function PaginationBanner({
|
|
|
6170
6170
|
);
|
|
6171
6171
|
}
|
|
6172
6172
|
function PaginationCarousel({
|
|
6173
|
-
|
|
6174
|
-
|
|
6173
|
+
count: count2,
|
|
6174
|
+
activeIndex,
|
|
6175
|
+
viewRatio,
|
|
6176
|
+
scrollProgress,
|
|
6177
|
+
onIndexChange,
|
|
6175
6178
|
className
|
|
6176
6179
|
}) {
|
|
6177
|
-
const
|
|
6178
|
-
|
|
6180
|
+
const clampedCount = Math.max(1, count2);
|
|
6181
|
+
const clampedIndex = Math.min(clampedCount - 1, Math.max(0, activeIndex));
|
|
6182
|
+
const trackWidth = 40;
|
|
6183
|
+
const pillWidth = Math.max(4, Math.round(trackWidth * (viewRatio ?? 1 / clampedCount)));
|
|
6184
|
+
const maxSlide = trackWidth - pillWidth;
|
|
6185
|
+
const pillLeft = scrollProgress !== void 0 ? Math.round(scrollProgress * maxSlide) : clampedCount > 1 ? Math.round(clampedIndex / (clampedCount - 1) * maxSlide) : 0;
|
|
6186
|
+
const goTo = (index2) => {
|
|
6187
|
+
const next = Math.min(clampedCount - 1, Math.max(0, index2));
|
|
6188
|
+
if (next !== clampedIndex) onIndexChange == null ? void 0 : onIndexChange(next);
|
|
6189
|
+
};
|
|
6190
|
+
return /* @__PURE__ */ jsxs(
|
|
6179
6191
|
"div",
|
|
6180
6192
|
{
|
|
6181
|
-
className: cn("flex items-center", className),
|
|
6182
|
-
role: "
|
|
6183
|
-
"aria-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
"
|
|
6193
|
-
{
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6193
|
+
className: cn("flex items-center gap-2", className),
|
|
6194
|
+
role: "group",
|
|
6195
|
+
"aria-label": "Carousel pagination",
|
|
6196
|
+
children: [
|
|
6197
|
+
/* @__PURE__ */ jsx(
|
|
6198
|
+
"button",
|
|
6199
|
+
{
|
|
6200
|
+
type: "button",
|
|
6201
|
+
"aria-label": "Previous slide",
|
|
6202
|
+
onClick: () => goTo(clampedIndex - 1),
|
|
6203
|
+
disabled: clampedIndex <= 0,
|
|
6204
|
+
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",
|
|
6205
|
+
children: /* @__PURE__ */ jsx(CaretLeft, { size: 16, weight: "regular" })
|
|
6206
|
+
}
|
|
6207
|
+
),
|
|
6208
|
+
/* @__PURE__ */ jsx(
|
|
6209
|
+
"div",
|
|
6210
|
+
{
|
|
6211
|
+
className: "relative h-1.5 overflow-hidden rounded-[48px] bg-black/10 dark:bg-white/10",
|
|
6212
|
+
style: { width: trackWidth },
|
|
6213
|
+
role: "progressbar",
|
|
6214
|
+
"aria-valuenow": clampedIndex + 1,
|
|
6215
|
+
"aria-valuemin": 1,
|
|
6216
|
+
"aria-valuemax": clampedCount,
|
|
6217
|
+
children: /* @__PURE__ */ jsx(
|
|
6218
|
+
"div",
|
|
6219
|
+
{
|
|
6220
|
+
className: "absolute top-0 h-full rounded-[12px] bg-bg-brand transition-all duration-200",
|
|
6221
|
+
style: { width: pillWidth, left: pillLeft }
|
|
6222
|
+
}
|
|
6223
|
+
)
|
|
6224
|
+
}
|
|
6225
|
+
),
|
|
6226
|
+
/* @__PURE__ */ jsx(
|
|
6227
|
+
"button",
|
|
6228
|
+
{
|
|
6229
|
+
type: "button",
|
|
6230
|
+
"aria-label": "Next slide",
|
|
6231
|
+
onClick: () => goTo(clampedIndex + 1),
|
|
6232
|
+
disabled: clampedIndex >= clampedCount - 1,
|
|
6233
|
+
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",
|
|
6234
|
+
children: /* @__PURE__ */ jsx(CaretRight, { size: 16, weight: "regular" })
|
|
6235
|
+
}
|
|
6236
|
+
)
|
|
6237
|
+
]
|
|
6200
6238
|
}
|
|
6201
6239
|
);
|
|
6202
6240
|
}
|
|
@@ -6236,7 +6274,8 @@ function Pagination({
|
|
|
6236
6274
|
setDropdownOpen(false);
|
|
6237
6275
|
}
|
|
6238
6276
|
};
|
|
6239
|
-
const
|
|
6277
|
+
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";
|
|
6278
|
+
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";
|
|
6240
6279
|
const divider = "border-l border-border";
|
|
6241
6280
|
const ellipsisLeft = ellipsisRef.current ? ellipsisRef.current.offsetLeft + ellipsisRef.current.offsetWidth / 2 : void 0;
|
|
6242
6281
|
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: cn("relative inline-flex w-fit", className), children: [
|
|
@@ -6244,7 +6283,7 @@ function Pagination({
|
|
|
6244
6283
|
"nav",
|
|
6245
6284
|
{
|
|
6246
6285
|
"aria-label": "Pagination",
|
|
6247
|
-
className: "inline-flex w-fit overflow-hidden rounded-lg border border-border",
|
|
6286
|
+
className: "box-border inline-flex h-8 w-fit items-stretch overflow-hidden rounded-lg border border-border",
|
|
6248
6287
|
children: [
|
|
6249
6288
|
/* @__PURE__ */ jsx(
|
|
6250
6289
|
"button",
|
|
@@ -6254,8 +6293,8 @@ function Pagination({
|
|
|
6254
6293
|
disabled: currentPage <= 1,
|
|
6255
6294
|
onClick: () => goTo(currentPage - 1),
|
|
6256
6295
|
className: cn(
|
|
6257
|
-
|
|
6258
|
-
"bg-bg-default
|
|
6296
|
+
cellNav,
|
|
6297
|
+
"bg-bg-default hover:bg-bg-default-hover disabled:cursor-not-allowed disabled:opacity-40 cursor-pointer"
|
|
6259
6298
|
),
|
|
6260
6299
|
children: /* @__PURE__ */ jsx(CaretLeft, { size: 16, weight: "regular" })
|
|
6261
6300
|
}
|
|
@@ -6271,9 +6310,9 @@ function Pagination({
|
|
|
6271
6310
|
"aria-haspopup": "listbox",
|
|
6272
6311
|
onClick: () => setDropdownOpen((v) => !v),
|
|
6273
6312
|
className: cn(
|
|
6274
|
-
|
|
6313
|
+
cellPage,
|
|
6275
6314
|
divider,
|
|
6276
|
-
"bg-bg-default
|
|
6315
|
+
"bg-bg-default cursor-pointer hover:bg-bg-default-hover"
|
|
6277
6316
|
),
|
|
6278
6317
|
children: "..."
|
|
6279
6318
|
},
|
|
@@ -6286,10 +6325,10 @@ function Pagination({
|
|
|
6286
6325
|
"aria-current": item === currentPage ? "page" : void 0,
|
|
6287
6326
|
onClick: () => goTo(item),
|
|
6288
6327
|
className: cn(
|
|
6289
|
-
|
|
6328
|
+
cellPage,
|
|
6290
6329
|
divider,
|
|
6291
6330
|
"cursor-pointer",
|
|
6292
|
-
item === currentPage ? "bg-bg-
|
|
6331
|
+
item === currentPage ? "bg-bg-default font-bold text-text-brand hover:bg-bg-default-hover" : "bg-bg-default hover:bg-bg-default-hover"
|
|
6293
6332
|
),
|
|
6294
6333
|
children: item
|
|
6295
6334
|
},
|
|
@@ -6304,9 +6343,9 @@ function Pagination({
|
|
|
6304
6343
|
disabled: currentPage >= totalPages,
|
|
6305
6344
|
onClick: () => goTo(currentPage + 1),
|
|
6306
6345
|
className: cn(
|
|
6307
|
-
|
|
6346
|
+
cellNav,
|
|
6308
6347
|
divider,
|
|
6309
|
-
"bg-bg-default
|
|
6348
|
+
"bg-bg-default hover:bg-bg-default-hover disabled:cursor-not-allowed disabled:opacity-40 cursor-pointer"
|
|
6310
6349
|
),
|
|
6311
6350
|
children: /* @__PURE__ */ jsx(CaretRight, { size: 16, weight: "regular" })
|
|
6312
6351
|
}
|
|
@@ -6319,7 +6358,7 @@ function Pagination({
|
|
|
6319
6358
|
{
|
|
6320
6359
|
role: "listbox",
|
|
6321
6360
|
"aria-label": "Select page",
|
|
6322
|
-
className: "absolute bottom-full mb-1
|
|
6361
|
+
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",
|
|
6323
6362
|
style: { left: ellipsisLeft, transform: "translateX(-50%)", maxHeight: 160 },
|
|
6324
6363
|
children: hiddenPages.map((page) => /* @__PURE__ */ jsx(
|
|
6325
6364
|
"button",
|
|
@@ -6329,8 +6368,8 @@ function Pagination({
|
|
|
6329
6368
|
"aria-selected": page === currentPage,
|
|
6330
6369
|
onClick: () => goTo(page),
|
|
6331
6370
|
className: cn(
|
|
6332
|
-
"flex h-8 w-full shrink-0 cursor-pointer items-center justify-center text-sm leading-5 transition-colors select-none",
|
|
6333
|
-
page === currentPage ? "bg-bg-
|
|
6371
|
+
"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",
|
|
6372
|
+
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"
|
|
6334
6373
|
),
|
|
6335
6374
|
children: page
|
|
6336
6375
|
},
|
|
@@ -6798,7 +6837,7 @@ const oppositeSideMap = {
|
|
|
6798
6837
|
bottom: "top",
|
|
6799
6838
|
top: "bottom"
|
|
6800
6839
|
};
|
|
6801
|
-
function clamp(start, value, end) {
|
|
6840
|
+
function clamp$1(start, value, end) {
|
|
6802
6841
|
return max(start, min(value, end));
|
|
6803
6842
|
}
|
|
6804
6843
|
function evaluate(value, param) {
|
|
@@ -7155,7 +7194,7 @@ const arrow$3 = (options) => ({
|
|
|
7155
7194
|
const min$1 = minPadding;
|
|
7156
7195
|
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
7157
7196
|
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
7158
|
-
const offset2 = clamp(min$1, center, max2);
|
|
7197
|
+
const offset2 = clamp$1(min$1, center, max2);
|
|
7159
7198
|
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
7160
7199
|
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
7161
7200
|
return {
|
|
@@ -7454,14 +7493,14 @@ const shift$2 = function(options) {
|
|
|
7454
7493
|
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
7455
7494
|
const min2 = mainAxisCoord + overflow[minSide];
|
|
7456
7495
|
const max2 = mainAxisCoord - overflow[maxSide];
|
|
7457
|
-
mainAxisCoord = clamp(min2, mainAxisCoord, max2);
|
|
7496
|
+
mainAxisCoord = clamp$1(min2, mainAxisCoord, max2);
|
|
7458
7497
|
}
|
|
7459
7498
|
if (checkCrossAxis) {
|
|
7460
7499
|
const minSide = crossAxis === "y" ? "top" : "left";
|
|
7461
7500
|
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
7462
7501
|
const min2 = crossAxisCoord + overflow[minSide];
|
|
7463
7502
|
const max2 = crossAxisCoord - overflow[maxSide];
|
|
7464
|
-
crossAxisCoord = clamp(min2, crossAxisCoord, max2);
|
|
7503
|
+
crossAxisCoord = clamp$1(min2, crossAxisCoord, max2);
|
|
7465
7504
|
}
|
|
7466
7505
|
const limitedCoords = limiter.fn({
|
|
7467
7506
|
...state,
|
|
@@ -9731,6 +9770,638 @@ function Tooltip({
|
|
|
9731
9770
|
)
|
|
9732
9771
|
] }) });
|
|
9733
9772
|
}
|
|
9773
|
+
const TRACK_HEIGHT = {
|
|
9774
|
+
sm: "h-1",
|
|
9775
|
+
md: "h-2",
|
|
9776
|
+
lg: "h-3"
|
|
9777
|
+
};
|
|
9778
|
+
const THUMB_SIZE_CLASS = {
|
|
9779
|
+
sm: "size-4",
|
|
9780
|
+
md: "size-5",
|
|
9781
|
+
lg: "size-6"
|
|
9782
|
+
};
|
|
9783
|
+
function clamp(v, lo, hi) {
|
|
9784
|
+
return Math.min(Math.max(v, lo), hi);
|
|
9785
|
+
}
|
|
9786
|
+
function snapToStep(raw, min2, max2, step) {
|
|
9787
|
+
return clamp(Math.round((raw - min2) / step) * step + min2, min2, max2);
|
|
9788
|
+
}
|
|
9789
|
+
function valueToPct(value, min2, max2) {
|
|
9790
|
+
if (max2 <= min2) return 0;
|
|
9791
|
+
return clamp((value - min2) / (max2 - min2) * 100, 0, 100);
|
|
9792
|
+
}
|
|
9793
|
+
function getStepLabels(min2, max2, step) {
|
|
9794
|
+
const n = step > 0 ? Math.round((max2 - min2) / step) : 0;
|
|
9795
|
+
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));
|
|
9796
|
+
}
|
|
9797
|
+
const Slider = forwardRef(function Slider2({
|
|
9798
|
+
size: size2 = "md",
|
|
9799
|
+
type = "single",
|
|
9800
|
+
disabled = false,
|
|
9801
|
+
showSteps = false,
|
|
9802
|
+
min: min2 = 0,
|
|
9803
|
+
max: max2 = 100,
|
|
9804
|
+
step = 1,
|
|
9805
|
+
value: valueProp,
|
|
9806
|
+
rangeValue: rangeProp,
|
|
9807
|
+
defaultValue = 50,
|
|
9808
|
+
defaultRangeValue = [25, 75],
|
|
9809
|
+
onChange,
|
|
9810
|
+
onRangeChange,
|
|
9811
|
+
className,
|
|
9812
|
+
id: idProp
|
|
9813
|
+
}, ref) {
|
|
9814
|
+
const autoId = useId$1();
|
|
9815
|
+
const trackRef = useRef(null);
|
|
9816
|
+
const activeThumb = useRef(null);
|
|
9817
|
+
const [internalValue, setInternalValue] = useState(
|
|
9818
|
+
() => clamp(defaultValue, min2, max2)
|
|
9819
|
+
);
|
|
9820
|
+
const [internalRange, setInternalRange] = useState(() => [
|
|
9821
|
+
clamp(defaultRangeValue[0], min2, max2),
|
|
9822
|
+
clamp(defaultRangeValue[1], min2, max2)
|
|
9823
|
+
]);
|
|
9824
|
+
const isSingle = type === "single";
|
|
9825
|
+
const value = valueProp !== void 0 ? valueProp : internalValue;
|
|
9826
|
+
const range = rangeProp !== void 0 ? rangeProp : internalRange;
|
|
9827
|
+
const stepLabels = useMemo(() => getStepLabels(min2, max2, step), [min2, max2, step]);
|
|
9828
|
+
const getValueFromClientX = useCallback(
|
|
9829
|
+
(clientX) => {
|
|
9830
|
+
const track = trackRef.current;
|
|
9831
|
+
if (!track) return min2;
|
|
9832
|
+
const { left, width } = track.getBoundingClientRect();
|
|
9833
|
+
const raw = min2 + clamp((clientX - left) / width, 0, 1) * (max2 - min2);
|
|
9834
|
+
if (showSteps) {
|
|
9835
|
+
return stepLabels.reduce((best, l) => Math.abs(l - raw) < Math.abs(best - raw) ? l : best);
|
|
9836
|
+
}
|
|
9837
|
+
return snapToStep(raw, min2, max2, step);
|
|
9838
|
+
},
|
|
9839
|
+
[min2, max2, step, showSteps, stepLabels]
|
|
9840
|
+
);
|
|
9841
|
+
const commitSingle = useCallback(
|
|
9842
|
+
(newValue) => {
|
|
9843
|
+
if (valueProp === void 0) setInternalValue(newValue);
|
|
9844
|
+
onChange == null ? void 0 : onChange(newValue);
|
|
9845
|
+
},
|
|
9846
|
+
[valueProp, onChange]
|
|
9847
|
+
);
|
|
9848
|
+
const commitRange = useCallback(
|
|
9849
|
+
(newValue, thumb) => {
|
|
9850
|
+
const [s, e] = rangeProp !== void 0 ? rangeProp : internalRange;
|
|
9851
|
+
const next = thumb === "start" ? [clamp(newValue, min2, e), e] : [s, clamp(newValue, s, max2)];
|
|
9852
|
+
if (rangeProp === void 0) setInternalRange(next);
|
|
9853
|
+
onRangeChange == null ? void 0 : onRangeChange(next);
|
|
9854
|
+
},
|
|
9855
|
+
[rangeProp, internalRange, min2, max2, onRangeChange]
|
|
9856
|
+
);
|
|
9857
|
+
const handlePointerDown = useCallback(
|
|
9858
|
+
(e) => {
|
|
9859
|
+
if (disabled) return;
|
|
9860
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
9861
|
+
const newValue = getValueFromClientX(e.clientX);
|
|
9862
|
+
if (isSingle) {
|
|
9863
|
+
activeThumb.current = "end";
|
|
9864
|
+
commitSingle(newValue);
|
|
9865
|
+
} else {
|
|
9866
|
+
const track = trackRef.current;
|
|
9867
|
+
if (track) {
|
|
9868
|
+
const { left, width } = track.getBoundingClientRect();
|
|
9869
|
+
const clickPct = (e.clientX - left) / width * 100;
|
|
9870
|
+
const distToStart = Math.abs(clickPct - valueToPct(range[0], min2, max2));
|
|
9871
|
+
const distToEnd = Math.abs(clickPct - valueToPct(range[1], min2, max2));
|
|
9872
|
+
activeThumb.current = distToStart <= distToEnd ? "start" : "end";
|
|
9873
|
+
} else {
|
|
9874
|
+
activeThumb.current = "end";
|
|
9875
|
+
}
|
|
9876
|
+
commitRange(newValue, activeThumb.current);
|
|
9877
|
+
}
|
|
9878
|
+
},
|
|
9879
|
+
[disabled, getValueFromClientX, isSingle, range, min2, max2, commitSingle, commitRange]
|
|
9880
|
+
);
|
|
9881
|
+
const handlePointerMove = useCallback(
|
|
9882
|
+
(e) => {
|
|
9883
|
+
if (!activeThumb.current || disabled) return;
|
|
9884
|
+
const newValue = getValueFromClientX(e.clientX);
|
|
9885
|
+
if (isSingle) {
|
|
9886
|
+
commitSingle(newValue);
|
|
9887
|
+
} else {
|
|
9888
|
+
commitRange(newValue, activeThumb.current);
|
|
9889
|
+
}
|
|
9890
|
+
},
|
|
9891
|
+
[disabled, getValueFromClientX, isSingle, commitSingle, commitRange]
|
|
9892
|
+
);
|
|
9893
|
+
const handlePointerUp = useCallback(() => {
|
|
9894
|
+
activeThumb.current = null;
|
|
9895
|
+
}, []);
|
|
9896
|
+
const handleKeyDown = useCallback(
|
|
9897
|
+
(e, thumb) => {
|
|
9898
|
+
if (disabled) return;
|
|
9899
|
+
if (showSteps) {
|
|
9900
|
+
const currentVal = isSingle ? value : range[thumb === "start" ? 0 : 1];
|
|
9901
|
+
const idx = stepLabels.reduce(
|
|
9902
|
+
(best, _, i) => Math.abs(stepLabels[i] - currentVal) < Math.abs(stepLabels[best] - currentVal) ? i : best,
|
|
9903
|
+
0
|
|
9904
|
+
);
|
|
9905
|
+
let nextVal;
|
|
9906
|
+
if (e.key === "ArrowRight" || e.key === "ArrowUp") nextVal = stepLabels[Math.min(idx + 1, stepLabels.length - 1)];
|
|
9907
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowDown") nextVal = stepLabels[Math.max(idx - 1, 0)];
|
|
9908
|
+
else if (e.key === "Home") nextVal = stepLabels[0];
|
|
9909
|
+
else if (e.key === "End") nextVal = stepLabels[stepLabels.length - 1];
|
|
9910
|
+
if (nextVal === void 0) return;
|
|
9911
|
+
e.preventDefault();
|
|
9912
|
+
if (isSingle) commitSingle(nextVal);
|
|
9913
|
+
else commitRange(nextVal, thumb);
|
|
9914
|
+
return;
|
|
9915
|
+
}
|
|
9916
|
+
let delta = 0;
|
|
9917
|
+
if (e.key === "ArrowRight" || e.key === "ArrowUp") delta = step;
|
|
9918
|
+
else if (e.key === "ArrowLeft" || e.key === "ArrowDown") delta = -step;
|
|
9919
|
+
else if (e.key === "Home") delta = min2 - (isSingle ? value : range[thumb === "start" ? 0 : 1]);
|
|
9920
|
+
else if (e.key === "End") delta = max2 - (isSingle ? value : range[thumb === "start" ? 0 : 1]);
|
|
9921
|
+
if (!delta && e.key !== "Home" && e.key !== "End") return;
|
|
9922
|
+
e.preventDefault();
|
|
9923
|
+
if (isSingle) {
|
|
9924
|
+
commitSingle(clamp(value + delta, min2, max2));
|
|
9925
|
+
} else {
|
|
9926
|
+
const thumbVal = thumb === "start" ? range[0] : range[1];
|
|
9927
|
+
commitRange(clamp(thumbVal + delta, min2, max2), thumb);
|
|
9928
|
+
}
|
|
9929
|
+
},
|
|
9930
|
+
[disabled, showSteps, stepLabels, min2, max2, isSingle, value, range, commitSingle, commitRange]
|
|
9931
|
+
);
|
|
9932
|
+
const startPct = isSingle ? 0 : valueToPct(range[0], min2, max2);
|
|
9933
|
+
const endPct = isSingle ? valueToPct(value, min2, max2) : valueToPct(range[1], min2, max2);
|
|
9934
|
+
const thumbInteractive = cn(
|
|
9935
|
+
"absolute rounded-full bg-[var(--fill-white-1000)]",
|
|
9936
|
+
"shadow-[0px_1px_3px_0px_rgba(0,0,0,0.10),0px_1px_2px_-1px_rgba(0,0,0,0.10)]",
|
|
9937
|
+
THUMB_SIZE_CLASS[size2],
|
|
9938
|
+
disabled ? "cursor-not-allowed" : "cursor-grab active:cursor-grabbing",
|
|
9939
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--bg-brand-primary)] focus-visible:ring-offset-2"
|
|
9940
|
+
);
|
|
9941
|
+
return /* @__PURE__ */ jsxs(
|
|
9942
|
+
"div",
|
|
9943
|
+
{
|
|
9944
|
+
ref,
|
|
9945
|
+
id: idProp ?? autoId,
|
|
9946
|
+
className: cn("flex w-full flex-col", showSteps ? "gap-1.5" : "", className),
|
|
9947
|
+
children: [
|
|
9948
|
+
/* @__PURE__ */ jsxs(
|
|
9949
|
+
"div",
|
|
9950
|
+
{
|
|
9951
|
+
ref: trackRef,
|
|
9952
|
+
className: cn(
|
|
9953
|
+
"relative w-full rounded-full",
|
|
9954
|
+
TRACK_HEIGHT[size2],
|
|
9955
|
+
disabled ? "bg-[var(--fill-gray-200)] dark:bg-[var(--fill-gray-700)] cursor-not-allowed" : "bg-[var(--fill-gray-200)] cursor-pointer"
|
|
9956
|
+
),
|
|
9957
|
+
onPointerDown: handlePointerDown,
|
|
9958
|
+
onPointerMove: handlePointerMove,
|
|
9959
|
+
onPointerUp: handlePointerUp,
|
|
9960
|
+
onPointerLeave: handlePointerUp,
|
|
9961
|
+
children: [
|
|
9962
|
+
/* @__PURE__ */ jsx(
|
|
9963
|
+
"div",
|
|
9964
|
+
{
|
|
9965
|
+
"aria-hidden": "true",
|
|
9966
|
+
className: cn(
|
|
9967
|
+
"pointer-events-none absolute top-0 h-full rounded-full",
|
|
9968
|
+
disabled ? "bg-[var(--fill-gray-300)]" : "bg-[var(--bg-brand-primary)]"
|
|
9969
|
+
),
|
|
9970
|
+
style: { left: `${startPct}%`, width: `${endPct - startPct}%` }
|
|
9971
|
+
}
|
|
9972
|
+
),
|
|
9973
|
+
isSingle && /* @__PURE__ */ jsx(
|
|
9974
|
+
"div",
|
|
9975
|
+
{
|
|
9976
|
+
role: "slider",
|
|
9977
|
+
tabIndex: disabled ? -1 : 0,
|
|
9978
|
+
"aria-valuemin": min2,
|
|
9979
|
+
"aria-valuemax": max2,
|
|
9980
|
+
"aria-valuenow": value,
|
|
9981
|
+
"aria-disabled": disabled,
|
|
9982
|
+
className: thumbInteractive,
|
|
9983
|
+
style: {
|
|
9984
|
+
left: `${endPct}%`,
|
|
9985
|
+
top: "50%",
|
|
9986
|
+
transform: "translateX(-50%) translateY(-50%)"
|
|
9987
|
+
},
|
|
9988
|
+
onKeyDown: (e) => handleKeyDown(e, "end")
|
|
9989
|
+
}
|
|
9990
|
+
),
|
|
9991
|
+
!isSingle && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9992
|
+
/* @__PURE__ */ jsx(
|
|
9993
|
+
"div",
|
|
9994
|
+
{
|
|
9995
|
+
role: "slider",
|
|
9996
|
+
tabIndex: disabled ? -1 : 0,
|
|
9997
|
+
"aria-valuemin": min2,
|
|
9998
|
+
"aria-valuemax": range[1],
|
|
9999
|
+
"aria-valuenow": range[0],
|
|
10000
|
+
"aria-label": "Start value",
|
|
10001
|
+
"aria-disabled": disabled,
|
|
10002
|
+
className: thumbInteractive,
|
|
10003
|
+
style: {
|
|
10004
|
+
left: `${startPct}%`,
|
|
10005
|
+
top: "50%",
|
|
10006
|
+
transform: "translateX(-50%) translateY(-50%)"
|
|
10007
|
+
},
|
|
10008
|
+
onKeyDown: (e) => handleKeyDown(e, "start")
|
|
10009
|
+
}
|
|
10010
|
+
),
|
|
10011
|
+
/* @__PURE__ */ jsx(
|
|
10012
|
+
"div",
|
|
10013
|
+
{
|
|
10014
|
+
role: "slider",
|
|
10015
|
+
tabIndex: disabled ? -1 : 0,
|
|
10016
|
+
"aria-valuemin": range[0],
|
|
10017
|
+
"aria-valuemax": max2,
|
|
10018
|
+
"aria-valuenow": range[1],
|
|
10019
|
+
"aria-label": "End value",
|
|
10020
|
+
"aria-disabled": disabled,
|
|
10021
|
+
className: cn(thumbInteractive, "z-10"),
|
|
10022
|
+
style: {
|
|
10023
|
+
left: `${endPct}%`,
|
|
10024
|
+
top: "50%",
|
|
10025
|
+
transform: "translateX(-50%) translateY(-50%)"
|
|
10026
|
+
},
|
|
10027
|
+
onKeyDown: (e) => handleKeyDown(e, "end")
|
|
10028
|
+
}
|
|
10029
|
+
)
|
|
10030
|
+
] })
|
|
10031
|
+
]
|
|
10032
|
+
}
|
|
10033
|
+
),
|
|
10034
|
+
showSteps && /* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "relative w-full h-4", children: stepLabels.map((label) => {
|
|
10035
|
+
const pct = valueToPct(label, min2, max2);
|
|
10036
|
+
return /* @__PURE__ */ jsx(
|
|
10037
|
+
"button",
|
|
10038
|
+
{
|
|
10039
|
+
type: "button",
|
|
10040
|
+
tabIndex: -1,
|
|
10041
|
+
disabled,
|
|
10042
|
+
onClick: () => {
|
|
10043
|
+
if (isSingle) {
|
|
10044
|
+
commitSingle(label);
|
|
10045
|
+
} else {
|
|
10046
|
+
const thumb = Math.abs(label - range[0]) <= Math.abs(label - range[1]) ? "start" : "end";
|
|
10047
|
+
commitRange(label, thumb);
|
|
10048
|
+
}
|
|
10049
|
+
},
|
|
10050
|
+
className: cn(
|
|
10051
|
+
"absolute text-xs leading-4 whitespace-nowrap",
|
|
10052
|
+
disabled ? "cursor-not-allowed text-[var(--text-default-disabled)]" : "cursor-pointer text-[var(--text-default-primary)]"
|
|
10053
|
+
),
|
|
10054
|
+
style: { left: `${pct}%`, transform: "translateX(-50%)" },
|
|
10055
|
+
children: label
|
|
10056
|
+
},
|
|
10057
|
+
label
|
|
10058
|
+
);
|
|
10059
|
+
}) })
|
|
10060
|
+
]
|
|
10061
|
+
}
|
|
10062
|
+
);
|
|
10063
|
+
});
|
|
10064
|
+
Slider.displayName = "Slider";
|
|
10065
|
+
const LinearProgress = forwardRef(
|
|
10066
|
+
function LinearProgress2({ value, className }, ref) {
|
|
10067
|
+
const pct = Math.min(100, Math.max(0, value));
|
|
10068
|
+
return /* @__PURE__ */ jsx(
|
|
10069
|
+
"div",
|
|
10070
|
+
{
|
|
10071
|
+
ref,
|
|
10072
|
+
role: "progressbar",
|
|
10073
|
+
"aria-valuenow": pct,
|
|
10074
|
+
"aria-valuemin": 0,
|
|
10075
|
+
"aria-valuemax": 100,
|
|
10076
|
+
className: cn(
|
|
10077
|
+
"relative h-1 w-full rounded-full bg-bg-default-tertiary overflow-hidden",
|
|
10078
|
+
className
|
|
10079
|
+
),
|
|
10080
|
+
children: /* @__PURE__ */ jsx(
|
|
10081
|
+
"div",
|
|
10082
|
+
{
|
|
10083
|
+
className: "absolute inset-y-0 left-0 h-full rounded-full bg-bg-brand transition-[width] duration-300",
|
|
10084
|
+
style: { width: `${pct}%` }
|
|
10085
|
+
}
|
|
10086
|
+
)
|
|
10087
|
+
}
|
|
10088
|
+
);
|
|
10089
|
+
}
|
|
10090
|
+
);
|
|
10091
|
+
LinearProgress.displayName = "LinearProgress";
|
|
10092
|
+
const SIZE_CONFIG = {
|
|
10093
|
+
lg: { dimension: 128, r: 60, strokeWidth: 8, trackColor: "var(--bg-default-tertiary)", fontSize: 24, lineHeight: 36, showLabel: true },
|
|
10094
|
+
md: { dimension: 48, r: 22, strokeWidth: 3, trackColor: "var(--bg-default-tertiary)", fontSize: 14, lineHeight: 20, showLabel: true },
|
|
10095
|
+
sm: { dimension: 18, r: 8, strokeWidth: 2, trackColor: "var(--fill-black-200)", fontSize: 0, lineHeight: 0, showLabel: false }
|
|
10096
|
+
};
|
|
10097
|
+
const CircleProgress = forwardRef(
|
|
10098
|
+
function CircleProgress2({ value, size: size2 = "lg", className }, ref) {
|
|
10099
|
+
const pct = Math.min(100, Math.max(0, value));
|
|
10100
|
+
const cfg = SIZE_CONFIG[size2];
|
|
10101
|
+
const circumference = 2 * Math.PI * cfg.r;
|
|
10102
|
+
const offset2 = circumference * (1 - pct / 100);
|
|
10103
|
+
const cx = cfg.dimension / 2;
|
|
10104
|
+
const isZero = pct === 0;
|
|
10105
|
+
const uid = useId$1();
|
|
10106
|
+
const gradientId = `cp-grad-${uid}`;
|
|
10107
|
+
return /* @__PURE__ */ jsxs(
|
|
10108
|
+
"svg",
|
|
10109
|
+
{
|
|
10110
|
+
ref,
|
|
10111
|
+
role: "progressbar",
|
|
10112
|
+
"aria-valuenow": pct,
|
|
10113
|
+
"aria-valuemin": 0,
|
|
10114
|
+
"aria-valuemax": 100,
|
|
10115
|
+
width: cfg.dimension,
|
|
10116
|
+
height: cfg.dimension,
|
|
10117
|
+
viewBox: `0 0 ${cfg.dimension} ${cfg.dimension}`,
|
|
10118
|
+
className: cn("shrink-0", className),
|
|
10119
|
+
children: [
|
|
10120
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
10121
|
+
"linearGradient",
|
|
10122
|
+
{
|
|
10123
|
+
id: gradientId,
|
|
10124
|
+
gradientUnits: "userSpaceOnUse",
|
|
10125
|
+
x1: cx,
|
|
10126
|
+
y1: 0,
|
|
10127
|
+
x2: cx,
|
|
10128
|
+
y2: cfg.dimension,
|
|
10129
|
+
children: [
|
|
10130
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#00a1e9" }),
|
|
10131
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#004eba" })
|
|
10132
|
+
]
|
|
10133
|
+
}
|
|
10134
|
+
) }),
|
|
10135
|
+
/* @__PURE__ */ jsx(
|
|
10136
|
+
"circle",
|
|
10137
|
+
{
|
|
10138
|
+
cx,
|
|
10139
|
+
cy: cx,
|
|
10140
|
+
r: cfg.r,
|
|
10141
|
+
fill: "none",
|
|
10142
|
+
stroke: cfg.trackColor,
|
|
10143
|
+
strokeWidth: cfg.strokeWidth
|
|
10144
|
+
}
|
|
10145
|
+
),
|
|
10146
|
+
pct > 0 && /* @__PURE__ */ jsx(
|
|
10147
|
+
"circle",
|
|
10148
|
+
{
|
|
10149
|
+
cx,
|
|
10150
|
+
cy: cx,
|
|
10151
|
+
r: cfg.r,
|
|
10152
|
+
fill: "none",
|
|
10153
|
+
stroke: `url(#${gradientId})`,
|
|
10154
|
+
strokeWidth: cfg.strokeWidth,
|
|
10155
|
+
strokeDasharray: circumference,
|
|
10156
|
+
strokeDashoffset: offset2,
|
|
10157
|
+
strokeLinecap: "round",
|
|
10158
|
+
transform: `rotate(-90 ${cx} ${cx})`,
|
|
10159
|
+
style: { transition: "stroke-dashoffset 0.3s ease" }
|
|
10160
|
+
}
|
|
10161
|
+
),
|
|
10162
|
+
cfg.showLabel && /* @__PURE__ */ jsxs(
|
|
10163
|
+
"text",
|
|
10164
|
+
{
|
|
10165
|
+
x: cx,
|
|
10166
|
+
y: cx,
|
|
10167
|
+
textAnchor: "middle",
|
|
10168
|
+
dominantBaseline: "central",
|
|
10169
|
+
style: {
|
|
10170
|
+
fontSize: cfg.fontSize,
|
|
10171
|
+
lineHeight: cfg.lineHeight,
|
|
10172
|
+
fontWeight: 700,
|
|
10173
|
+
fontVariationSettings: "'CTGR' 0, 'wdth' 100, 'wght' 700",
|
|
10174
|
+
fill: isZero ? "var(--text-default-placeholder)" : "var(--text-brand-primary)",
|
|
10175
|
+
fontFamily: "'Noto Sans Thai', sans-serif"
|
|
10176
|
+
},
|
|
10177
|
+
children: [
|
|
10178
|
+
pct,
|
|
10179
|
+
"%"
|
|
10180
|
+
]
|
|
10181
|
+
}
|
|
10182
|
+
)
|
|
10183
|
+
]
|
|
10184
|
+
}
|
|
10185
|
+
);
|
|
10186
|
+
}
|
|
10187
|
+
);
|
|
10188
|
+
CircleProgress.displayName = "CircleProgress";
|
|
10189
|
+
const UploadArea = forwardRef(
|
|
10190
|
+
function UploadArea2({ disabled = false, label = "อัปโหลดไฟล์", className, onClick, ...props }, ref) {
|
|
10191
|
+
return /* @__PURE__ */ jsxs(
|
|
10192
|
+
"div",
|
|
10193
|
+
{
|
|
10194
|
+
ref,
|
|
10195
|
+
role: disabled ? void 0 : "button",
|
|
10196
|
+
tabIndex: disabled ? void 0 : 0,
|
|
10197
|
+
"aria-disabled": disabled,
|
|
10198
|
+
onClick: disabled ? void 0 : onClick,
|
|
10199
|
+
onKeyDown: disabled ? void 0 : (e) => {
|
|
10200
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
10201
|
+
e.preventDefault();
|
|
10202
|
+
onClick == null ? void 0 : onClick(e);
|
|
10203
|
+
}
|
|
10204
|
+
},
|
|
10205
|
+
className: cn(
|
|
10206
|
+
"flex h-12 items-center justify-center gap-2 rounded-lg",
|
|
10207
|
+
"border border-dashed border-border-default",
|
|
10208
|
+
disabled ? "bg-bg-default-secondary cursor-not-allowed" : "bg-background cursor-pointer hover:bg-bg-default-secondary transition-colors",
|
|
10209
|
+
className
|
|
10210
|
+
),
|
|
10211
|
+
...props,
|
|
10212
|
+
children: [
|
|
10213
|
+
/* @__PURE__ */ jsx(
|
|
10214
|
+
"span",
|
|
10215
|
+
{
|
|
10216
|
+
className: cn(
|
|
10217
|
+
"flex items-center justify-center w-5 h-5 shrink-0",
|
|
10218
|
+
disabled ? "text-disabled" : "text-primary-action"
|
|
10219
|
+
),
|
|
10220
|
+
children: /* @__PURE__ */ jsx(UploadSimpleIcon, { size: 20, weight: "regular" })
|
|
10221
|
+
}
|
|
10222
|
+
),
|
|
10223
|
+
/* @__PURE__ */ jsx(
|
|
10224
|
+
"span",
|
|
10225
|
+
{
|
|
10226
|
+
className: cn(
|
|
10227
|
+
"text-sm font-medium leading-5 whitespace-nowrap",
|
|
10228
|
+
disabled ? "text-disabled" : "text-primary-action"
|
|
10229
|
+
),
|
|
10230
|
+
children: label
|
|
10231
|
+
}
|
|
10232
|
+
)
|
|
10233
|
+
]
|
|
10234
|
+
}
|
|
10235
|
+
);
|
|
10236
|
+
}
|
|
10237
|
+
);
|
|
10238
|
+
UploadArea.displayName = "UploadArea";
|
|
10239
|
+
const UploadItem = forwardRef(
|
|
10240
|
+
function UploadItem2({
|
|
10241
|
+
variant = "text",
|
|
10242
|
+
status = "loading",
|
|
10243
|
+
fileName = "filename.pdf",
|
|
10244
|
+
fileSize = "1.66KB",
|
|
10245
|
+
errorText = "Error Text",
|
|
10246
|
+
progress = 50,
|
|
10247
|
+
onDelete,
|
|
10248
|
+
className
|
|
10249
|
+
}, ref) {
|
|
10250
|
+
const isLoading = status === "loading";
|
|
10251
|
+
const isSuccess = status === "success";
|
|
10252
|
+
const isError = status === "error";
|
|
10253
|
+
if (variant === "text") {
|
|
10254
|
+
return /* @__PURE__ */ jsxs(
|
|
10255
|
+
"div",
|
|
10256
|
+
{
|
|
10257
|
+
ref,
|
|
10258
|
+
className: cn(
|
|
10259
|
+
"flex max-w-[500px] w-[300px] overflow-hidden",
|
|
10260
|
+
isError ? "flex-col gap-1 items-start" : "gap-2 items-center",
|
|
10261
|
+
className
|
|
10262
|
+
),
|
|
10263
|
+
children: [
|
|
10264
|
+
isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10265
|
+
/* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 text-sm leading-5 text-text-default-placeholder truncate", children: fileName }),
|
|
10266
|
+
/* @__PURE__ */ jsx(CircleProgress, { size: "sm", value: progress, className: "shrink-0" })
|
|
10267
|
+
] }),
|
|
10268
|
+
isSuccess && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10269
|
+
/* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 text-sm leading-5 text-text-info truncate", children: fileName }),
|
|
10270
|
+
/* @__PURE__ */ jsx(TrashButton, { onDelete })
|
|
10271
|
+
] }),
|
|
10272
|
+
isError && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10273
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center w-full py-px", children: [
|
|
10274
|
+
/* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 text-sm leading-5 text-text-danger truncate", children: fileName }),
|
|
10275
|
+
/* @__PURE__ */ jsx(TrashButton, { onDelete })
|
|
10276
|
+
] }),
|
|
10277
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 px-0.5 text-text-danger", children: [
|
|
10278
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs leading-4", children: "*" }),
|
|
10279
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs leading-4", children: errorText })
|
|
10280
|
+
] })
|
|
10281
|
+
] })
|
|
10282
|
+
]
|
|
10283
|
+
}
|
|
10284
|
+
);
|
|
10285
|
+
}
|
|
10286
|
+
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";
|
|
10287
|
+
return /* @__PURE__ */ jsxs(
|
|
10288
|
+
"div",
|
|
10289
|
+
{
|
|
10290
|
+
ref,
|
|
10291
|
+
className: cn(
|
|
10292
|
+
"flex flex-col gap-1 items-start w-[343px]",
|
|
10293
|
+
className
|
|
10294
|
+
),
|
|
10295
|
+
children: [
|
|
10296
|
+
isLoading && /* @__PURE__ */ 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: [
|
|
10297
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center h-5 text-sm leading-5 text-text-default-placeholder", children: [
|
|
10298
|
+
/* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 truncate", children: fileName }),
|
|
10299
|
+
/* @__PURE__ */ jsx("p", { className: "shrink-0 text-right w-[46px]", children: fileSize })
|
|
10300
|
+
] }),
|
|
10301
|
+
/* @__PURE__ */ jsx(LinearProgress, { value: progress })
|
|
10302
|
+
] }),
|
|
10303
|
+
(isSuccess || isError) && /* @__PURE__ */ jsxs("div", { className: "flex gap-1 items-center w-full", children: [
|
|
10304
|
+
/* @__PURE__ */ jsxs(
|
|
10305
|
+
"div",
|
|
10306
|
+
{
|
|
10307
|
+
className: cn(
|
|
10308
|
+
cardBase,
|
|
10309
|
+
isSuccess ? "text-text-info" : "text-text-danger"
|
|
10310
|
+
),
|
|
10311
|
+
children: [
|
|
10312
|
+
/* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 overflow-hidden text-ellipsis", children: fileName }),
|
|
10313
|
+
/* @__PURE__ */ jsx("p", { className: "shrink-0 text-right", children: fileSize })
|
|
10314
|
+
]
|
|
10315
|
+
}
|
|
10316
|
+
),
|
|
10317
|
+
/* @__PURE__ */ jsx(
|
|
10318
|
+
"button",
|
|
10319
|
+
{
|
|
10320
|
+
type: "button",
|
|
10321
|
+
onClick: onDelete,
|
|
10322
|
+
className: cn(
|
|
10323
|
+
"flex items-center justify-center size-12 shrink-0",
|
|
10324
|
+
"bg-background border border-border-default rounded-lg",
|
|
10325
|
+
"text-icon-danger cursor-pointer"
|
|
10326
|
+
),
|
|
10327
|
+
"aria-label": "ลบไฟล์",
|
|
10328
|
+
children: /* @__PURE__ */ jsx(TrashIcon, { size: 20 })
|
|
10329
|
+
}
|
|
10330
|
+
)
|
|
10331
|
+
] }),
|
|
10332
|
+
isError && /* @__PURE__ */ jsx("div", { className: "flex items-center px-1 py-0 w-full text-text-danger", children: /* @__PURE__ */ jsx("p", { className: "text-xs leading-4 whitespace-nowrap", children: errorText }) })
|
|
10333
|
+
]
|
|
10334
|
+
}
|
|
10335
|
+
);
|
|
10336
|
+
}
|
|
10337
|
+
);
|
|
10338
|
+
UploadItem.displayName = "UploadItem";
|
|
10339
|
+
function TrashButton({ onDelete }) {
|
|
10340
|
+
return /* @__PURE__ */ jsx(
|
|
10341
|
+
"button",
|
|
10342
|
+
{
|
|
10343
|
+
type: "button",
|
|
10344
|
+
onClick: onDelete,
|
|
10345
|
+
className: "flex items-center justify-center w-5 h-5 shrink-0 text-icon-danger cursor-pointer",
|
|
10346
|
+
"aria-label": "ลบไฟล์",
|
|
10347
|
+
children: /* @__PURE__ */ jsx(TrashIcon, { size: 20 })
|
|
10348
|
+
}
|
|
10349
|
+
);
|
|
10350
|
+
}
|
|
10351
|
+
const ListItem = forwardRef(
|
|
10352
|
+
function ListItem2({
|
|
10353
|
+
label,
|
|
10354
|
+
leading,
|
|
10355
|
+
action,
|
|
10356
|
+
onAction,
|
|
10357
|
+
trailing,
|
|
10358
|
+
highlighted = false,
|
|
10359
|
+
onClick,
|
|
10360
|
+
className
|
|
10361
|
+
}, ref) {
|
|
10362
|
+
const [pressed, setPressed] = useState(false);
|
|
10363
|
+
const isHighlighted = highlighted || !!onClick && pressed;
|
|
10364
|
+
return /* @__PURE__ */ jsxs(
|
|
10365
|
+
"div",
|
|
10366
|
+
{
|
|
10367
|
+
ref,
|
|
10368
|
+
onClick,
|
|
10369
|
+
onPointerDown: () => {
|
|
10370
|
+
if (onClick) setPressed(true);
|
|
10371
|
+
},
|
|
10372
|
+
onPointerUp: () => setPressed(false),
|
|
10373
|
+
onPointerLeave: () => setPressed(false),
|
|
10374
|
+
className: cn(
|
|
10375
|
+
"flex items-center gap-3 p-4 h-[52px] border-b border-border",
|
|
10376
|
+
isHighlighted ? "bg-bg-default-pressed" : "bg-background",
|
|
10377
|
+
onClick && "cursor-pointer select-none hover:bg-bg-default-pressed",
|
|
10378
|
+
className
|
|
10379
|
+
),
|
|
10380
|
+
children: [
|
|
10381
|
+
leading != null && /* @__PURE__ */ jsx("span", { className: "shrink-0 flex items-center text-icon-default [&_svg]:text-icon-default [&_svg]:size-6", children: leading }),
|
|
10382
|
+
/* @__PURE__ */ jsx("span", { className: "flex-1 min-w-0 text-sm leading-5 text-foreground truncate", children: label }),
|
|
10383
|
+
action && /* @__PURE__ */ jsx(
|
|
10384
|
+
"button",
|
|
10385
|
+
{
|
|
10386
|
+
type: "button",
|
|
10387
|
+
onClick: (e) => {
|
|
10388
|
+
e.stopPropagation();
|
|
10389
|
+
onAction == null ? void 0 : onAction(e);
|
|
10390
|
+
},
|
|
10391
|
+
className: "shrink-0 text-sm font-medium text-primary-action hover:underline cursor-pointer whitespace-nowrap",
|
|
10392
|
+
children: action
|
|
10393
|
+
}
|
|
10394
|
+
),
|
|
10395
|
+
trailing != null && /* @__PURE__ */ jsx("span", { className: "shrink-0 flex items-center text-icon-default [&_svg]:text-icon-default [&_svg]:size-6", children: trailing })
|
|
10396
|
+
]
|
|
10397
|
+
}
|
|
10398
|
+
);
|
|
10399
|
+
}
|
|
10400
|
+
);
|
|
10401
|
+
ListItem.displayName = "ListItem";
|
|
10402
|
+
function List({ children, className }) {
|
|
10403
|
+
return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col", className), children });
|
|
10404
|
+
}
|
|
9734
10405
|
const index = {
|
|
9735
10406
|
Button,
|
|
9736
10407
|
Badge,
|
|
@@ -9772,6 +10443,13 @@ const index = {
|
|
|
9772
10443
|
PaginationCarousel,
|
|
9773
10444
|
Tooltip,
|
|
9774
10445
|
Popover,
|
|
10446
|
+
Slider,
|
|
10447
|
+
LinearProgress,
|
|
10448
|
+
CircleProgress,
|
|
10449
|
+
UploadArea,
|
|
10450
|
+
UploadItem,
|
|
10451
|
+
List,
|
|
10452
|
+
ListItem,
|
|
9775
10453
|
cn,
|
|
9776
10454
|
useIsMobile
|
|
9777
10455
|
};
|
|
@@ -9786,10 +10464,14 @@ export {
|
|
|
9786
10464
|
Card,
|
|
9787
10465
|
Checkbox,
|
|
9788
10466
|
Chip,
|
|
10467
|
+
CircleProgress,
|
|
9789
10468
|
DateInput,
|
|
9790
10469
|
Dropdown,
|
|
9791
10470
|
DropdownMultiple,
|
|
9792
10471
|
Input,
|
|
10472
|
+
LinearProgress,
|
|
10473
|
+
List,
|
|
10474
|
+
ListItem,
|
|
9793
10475
|
Modal,
|
|
9794
10476
|
Notification,
|
|
9795
10477
|
OptionList,
|
|
@@ -9799,6 +10481,7 @@ export {
|
|
|
9799
10481
|
Popover,
|
|
9800
10482
|
Radio,
|
|
9801
10483
|
SearchInput,
|
|
10484
|
+
Slider,
|
|
9802
10485
|
StatusTag,
|
|
9803
10486
|
Tab,
|
|
9804
10487
|
TabGroup,
|
|
@@ -9816,6 +10499,8 @@ export {
|
|
|
9816
10499
|
Toaster,
|
|
9817
10500
|
Toggle,
|
|
9818
10501
|
Tooltip,
|
|
10502
|
+
UploadArea,
|
|
10503
|
+
UploadItem,
|
|
9819
10504
|
cn,
|
|
9820
10505
|
index as default,
|
|
9821
10506
|
useIsMobile
|