@sarunyu/system-one 4.9.36 → 4.9.39

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/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,7 +5991,7 @@ TimeInput.displayName = "TimeInput";
5991
5991
  const avatarPlaceholder = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAOdEVYdFNvZnR3YXJlAEZpZ21hnrGWYwAACYhJREFUe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JJq8SqhTtUf9c9gOWkR1KoTZGklnsoKFsbHb2XRRPwCfO0pk0kAcsMAAAAASUVORK5CYII=";
5992
5992
  const TEXT_GRADIENT = "linear-gradient(to top right, #B5D3F8, #E6F6FB)";
5993
5993
  const TEXT_COLOR = "#00A2D9";
5994
- const SIZE_CONFIG = {
5994
+ const SIZE_CONFIG$1 = {
5995
5995
  xxs: { container: "size-4", fontSize: "text-[11px]", dotSize: "size-[5px]", 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]" },
@@ -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",
@@ -6798,7 +6798,7 @@ const oppositeSideMap = {
6798
6798
  bottom: "top",
6799
6799
  top: "bottom"
6800
6800
  };
6801
- function clamp(start, value, end) {
6801
+ function clamp$1(start, value, end) {
6802
6802
  return max(start, min(value, end));
6803
6803
  }
6804
6804
  function evaluate(value, param) {
@@ -7155,7 +7155,7 @@ const arrow$3 = (options) => ({
7155
7155
  const min$1 = minPadding;
7156
7156
  const max2 = clientSize - arrowDimensions[length] - maxPadding;
7157
7157
  const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
7158
- const offset2 = clamp(min$1, center, max2);
7158
+ const offset2 = clamp$1(min$1, center, max2);
7159
7159
  const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
7160
7160
  const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
7161
7161
  return {
@@ -7454,14 +7454,14 @@ const shift$2 = function(options) {
7454
7454
  const maxSide = mainAxis === "y" ? "bottom" : "right";
7455
7455
  const min2 = mainAxisCoord + overflow[minSide];
7456
7456
  const max2 = mainAxisCoord - overflow[maxSide];
7457
- mainAxisCoord = clamp(min2, mainAxisCoord, max2);
7457
+ mainAxisCoord = clamp$1(min2, mainAxisCoord, max2);
7458
7458
  }
7459
7459
  if (checkCrossAxis) {
7460
7460
  const minSide = crossAxis === "y" ? "top" : "left";
7461
7461
  const maxSide = crossAxis === "y" ? "bottom" : "right";
7462
7462
  const min2 = crossAxisCoord + overflow[minSide];
7463
7463
  const max2 = crossAxisCoord - overflow[maxSide];
7464
- crossAxisCoord = clamp(min2, crossAxisCoord, max2);
7464
+ crossAxisCoord = clamp$1(min2, crossAxisCoord, max2);
7465
7465
  }
7466
7466
  const limitedCoords = limiter.fn({
7467
7467
  ...state,
@@ -9731,6 +9731,613 @@ function Tooltip({
9731
9731
  )
9732
9732
  ] }) });
9733
9733
  }
9734
+ const TRACK_HEIGHT = {
9735
+ sm: "h-1",
9736
+ md: "h-2",
9737
+ lg: "h-3"
9738
+ };
9739
+ const THUMB_SIZE_CLASS = {
9740
+ sm: "size-4",
9741
+ md: "size-5",
9742
+ lg: "size-6"
9743
+ };
9744
+ function clamp(v, lo, hi) {
9745
+ return Math.min(Math.max(v, lo), hi);
9746
+ }
9747
+ function snapToStep(raw, min2, max2, step) {
9748
+ return clamp(Math.round((raw - min2) / step) * step + min2, min2, max2);
9749
+ }
9750
+ function pctToValue(pct, min2, max2, step) {
9751
+ return snapToStep(min2 + pct / 100 * (max2 - min2), min2, max2, step);
9752
+ }
9753
+ function valueToPct(value, min2, max2) {
9754
+ if (max2 <= min2) return 0;
9755
+ return clamp((value - min2) / (max2 - min2) * 100, 0, 100);
9756
+ }
9757
+ const Slider = forwardRef(function Slider2({
9758
+ size: size2 = "md",
9759
+ type = "single",
9760
+ disabled = false,
9761
+ showSteps = false,
9762
+ min: min2 = 0,
9763
+ max: max2 = 100,
9764
+ step = 1,
9765
+ value: valueProp,
9766
+ rangeValue: rangeProp,
9767
+ defaultValue = 50,
9768
+ defaultRangeValue = [25, 75],
9769
+ onChange,
9770
+ onRangeChange,
9771
+ className,
9772
+ id: idProp
9773
+ }, ref) {
9774
+ const autoId = useId$1();
9775
+ const trackRef = useRef(null);
9776
+ const activeThumb = useRef(null);
9777
+ const [internalValue, setInternalValue] = useState(
9778
+ () => clamp(defaultValue, min2, max2)
9779
+ );
9780
+ const [internalRange, setInternalRange] = useState(() => [
9781
+ clamp(defaultRangeValue[0], min2, max2),
9782
+ clamp(defaultRangeValue[1], min2, max2)
9783
+ ]);
9784
+ const isSingle = type === "single";
9785
+ const value = valueProp !== void 0 ? valueProp : internalValue;
9786
+ const range = rangeProp !== void 0 ? rangeProp : internalRange;
9787
+ const getValueFromClientX = useCallback(
9788
+ (clientX) => {
9789
+ const track = trackRef.current;
9790
+ if (!track) return min2;
9791
+ const { left, width } = track.getBoundingClientRect();
9792
+ const pct = clamp((clientX - left) / width * 100, 0, 100);
9793
+ return pctToValue(pct, min2, max2, step);
9794
+ },
9795
+ [min2, max2, step]
9796
+ );
9797
+ const commitSingle = useCallback(
9798
+ (newValue) => {
9799
+ if (valueProp === void 0) setInternalValue(newValue);
9800
+ onChange == null ? void 0 : onChange(newValue);
9801
+ },
9802
+ [valueProp, onChange]
9803
+ );
9804
+ const commitRange = useCallback(
9805
+ (newValue, thumb) => {
9806
+ const [s, e] = rangeProp !== void 0 ? rangeProp : internalRange;
9807
+ const next = thumb === "start" ? [clamp(newValue, min2, e), e] : [s, clamp(newValue, s, max2)];
9808
+ if (rangeProp === void 0) setInternalRange(next);
9809
+ onRangeChange == null ? void 0 : onRangeChange(next);
9810
+ },
9811
+ [rangeProp, internalRange, min2, max2, onRangeChange]
9812
+ );
9813
+ const handlePointerDown = useCallback(
9814
+ (e) => {
9815
+ if (disabled) return;
9816
+ e.currentTarget.setPointerCapture(e.pointerId);
9817
+ const newValue = getValueFromClientX(e.clientX);
9818
+ if (isSingle) {
9819
+ activeThumb.current = "end";
9820
+ commitSingle(newValue);
9821
+ } else {
9822
+ const track = trackRef.current;
9823
+ if (track) {
9824
+ const { left, width } = track.getBoundingClientRect();
9825
+ const clickPct = (e.clientX - left) / width * 100;
9826
+ const distToStart = Math.abs(clickPct - valueToPct(range[0], min2, max2));
9827
+ const distToEnd = Math.abs(clickPct - valueToPct(range[1], min2, max2));
9828
+ activeThumb.current = distToStart <= distToEnd ? "start" : "end";
9829
+ } else {
9830
+ activeThumb.current = "end";
9831
+ }
9832
+ commitRange(newValue, activeThumb.current);
9833
+ }
9834
+ },
9835
+ [disabled, getValueFromClientX, isSingle, range, min2, max2, commitSingle, commitRange]
9836
+ );
9837
+ const handlePointerMove = useCallback(
9838
+ (e) => {
9839
+ if (!activeThumb.current || disabled) return;
9840
+ const newValue = getValueFromClientX(e.clientX);
9841
+ if (isSingle) {
9842
+ commitSingle(newValue);
9843
+ } else {
9844
+ commitRange(newValue, activeThumb.current);
9845
+ }
9846
+ },
9847
+ [disabled, getValueFromClientX, isSingle, commitSingle, commitRange]
9848
+ );
9849
+ const handlePointerUp = useCallback(() => {
9850
+ activeThumb.current = null;
9851
+ }, []);
9852
+ const handleKeyDown = useCallback(
9853
+ (e, thumb) => {
9854
+ if (disabled) return;
9855
+ let delta = 0;
9856
+ if (e.key === "ArrowRight" || e.key === "ArrowUp") delta = step;
9857
+ else if (e.key === "ArrowLeft" || e.key === "ArrowDown") delta = -step;
9858
+ else if (e.key === "Home") delta = min2 - (isSingle ? value : range[thumb === "start" ? 0 : 1]);
9859
+ else if (e.key === "End") delta = max2 - (isSingle ? value : range[thumb === "start" ? 0 : 1]);
9860
+ if (!delta && e.key !== "Home" && e.key !== "End") return;
9861
+ e.preventDefault();
9862
+ if (isSingle) {
9863
+ commitSingle(clamp(value + delta, min2, max2));
9864
+ } else {
9865
+ const thumbVal = thumb === "start" ? range[0] : range[1];
9866
+ commitRange(clamp(thumbVal + delta, min2, max2), thumb);
9867
+ }
9868
+ },
9869
+ [disabled, step, min2, max2, isSingle, value, range, commitSingle, commitRange]
9870
+ );
9871
+ const startPct = isSingle ? 0 : valueToPct(range[0], min2, max2);
9872
+ const endPct = isSingle ? valueToPct(value, min2, max2) : valueToPct(range[1], min2, max2);
9873
+ const thumbInteractive = cn(
9874
+ "absolute rounded-full",
9875
+ "shadow-[0px_1px_3px_0px_rgba(0,0,0,0.10),0px_1px_2px_-1px_rgba(0,0,0,0.10)]",
9876
+ THUMB_SIZE_CLASS[size2],
9877
+ disabled ? "bg-[var(--bg-default-secondary)] cursor-not-allowed" : "bg-[var(--fill-white-1000)] cursor-grab active:cursor-grabbing",
9878
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--bg-brand-primary)] focus-visible:ring-offset-2"
9879
+ );
9880
+ const stepLabels = [0, 0.25, 0.5, 0.75, 1].map(
9881
+ (f) => Math.round(min2 + (max2 - min2) * f)
9882
+ );
9883
+ return /* @__PURE__ */ jsxs(
9884
+ "div",
9885
+ {
9886
+ ref,
9887
+ id: idProp ?? autoId,
9888
+ className: cn("flex w-full flex-col", showSteps ? "gap-1.5" : "", className),
9889
+ children: [
9890
+ /* @__PURE__ */ jsxs(
9891
+ "div",
9892
+ {
9893
+ ref: trackRef,
9894
+ className: cn(
9895
+ "relative w-full rounded-full",
9896
+ TRACK_HEIGHT[size2],
9897
+ "bg-[var(--fill-gray-200)]",
9898
+ disabled ? "cursor-not-allowed" : "cursor-pointer"
9899
+ ),
9900
+ onPointerDown: handlePointerDown,
9901
+ onPointerMove: handlePointerMove,
9902
+ onPointerUp: handlePointerUp,
9903
+ onPointerLeave: handlePointerUp,
9904
+ children: [
9905
+ /* @__PURE__ */ jsx(
9906
+ "div",
9907
+ {
9908
+ "aria-hidden": "true",
9909
+ className: cn(
9910
+ "pointer-events-none absolute top-0 h-full rounded-full",
9911
+ disabled ? "bg-[var(--fill-gray-300)]" : "bg-[var(--bg-brand-primary)]"
9912
+ ),
9913
+ style: { left: `${startPct}%`, width: `${endPct - startPct}%` }
9914
+ }
9915
+ ),
9916
+ isSingle && /* @__PURE__ */ jsx(
9917
+ "div",
9918
+ {
9919
+ role: "slider",
9920
+ tabIndex: disabled ? -1 : 0,
9921
+ "aria-valuemin": min2,
9922
+ "aria-valuemax": max2,
9923
+ "aria-valuenow": value,
9924
+ "aria-disabled": disabled,
9925
+ className: thumbInteractive,
9926
+ style: {
9927
+ left: `${endPct}%`,
9928
+ top: "50%",
9929
+ transform: "translateX(-50%) translateY(-50%)"
9930
+ },
9931
+ onKeyDown: (e) => handleKeyDown(e, "end")
9932
+ }
9933
+ ),
9934
+ !isSingle && /* @__PURE__ */ jsxs(Fragment, { children: [
9935
+ /* @__PURE__ */ jsx(
9936
+ "div",
9937
+ {
9938
+ role: "slider",
9939
+ tabIndex: disabled ? -1 : 0,
9940
+ "aria-valuemin": min2,
9941
+ "aria-valuemax": range[1],
9942
+ "aria-valuenow": range[0],
9943
+ "aria-label": "Start value",
9944
+ "aria-disabled": disabled,
9945
+ className: thumbInteractive,
9946
+ style: {
9947
+ left: `${startPct}%`,
9948
+ top: "50%",
9949
+ transform: "translateX(-50%) translateY(-50%)"
9950
+ },
9951
+ onKeyDown: (e) => handleKeyDown(e, "start")
9952
+ }
9953
+ ),
9954
+ /* @__PURE__ */ jsx(
9955
+ "div",
9956
+ {
9957
+ role: "slider",
9958
+ tabIndex: disabled ? -1 : 0,
9959
+ "aria-valuemin": range[0],
9960
+ "aria-valuemax": max2,
9961
+ "aria-valuenow": range[1],
9962
+ "aria-label": "End value",
9963
+ "aria-disabled": disabled,
9964
+ className: cn(thumbInteractive, "z-10"),
9965
+ style: {
9966
+ left: `${endPct}%`,
9967
+ top: "50%",
9968
+ transform: "translateX(-50%) translateY(-50%)"
9969
+ },
9970
+ onKeyDown: (e) => handleKeyDown(e, "end")
9971
+ }
9972
+ )
9973
+ ] })
9974
+ ]
9975
+ }
9976
+ ),
9977
+ showSteps && /* @__PURE__ */ jsx(
9978
+ "div",
9979
+ {
9980
+ "aria-hidden": "true",
9981
+ className: "relative w-full h-4",
9982
+ children: stepLabels.map((label) => {
9983
+ const pct = valueToPct(label, min2, max2);
9984
+ return /* @__PURE__ */ jsx(
9985
+ "span",
9986
+ {
9987
+ className: "absolute text-xs leading-4 text-[var(--text-default-primary)] whitespace-nowrap",
9988
+ style: { left: `${pct}%`, transform: "translateX(-50%)" },
9989
+ children: label
9990
+ },
9991
+ label
9992
+ );
9993
+ })
9994
+ }
9995
+ )
9996
+ ]
9997
+ }
9998
+ );
9999
+ });
10000
+ Slider.displayName = "Slider";
10001
+ const LinearProgress = forwardRef(
10002
+ function LinearProgress2({ value, className }, ref) {
10003
+ const pct = Math.min(100, Math.max(0, value));
10004
+ return /* @__PURE__ */ jsx(
10005
+ "div",
10006
+ {
10007
+ ref,
10008
+ role: "progressbar",
10009
+ "aria-valuenow": pct,
10010
+ "aria-valuemin": 0,
10011
+ "aria-valuemax": 100,
10012
+ className: cn(
10013
+ "relative h-1 w-full rounded-full bg-bg-default-tertiary overflow-hidden",
10014
+ className
10015
+ ),
10016
+ children: /* @__PURE__ */ jsx(
10017
+ "div",
10018
+ {
10019
+ className: "absolute inset-y-0 left-0 h-full rounded-full bg-bg-brand transition-[width] duration-300",
10020
+ style: { width: `${pct}%` }
10021
+ }
10022
+ )
10023
+ }
10024
+ );
10025
+ }
10026
+ );
10027
+ LinearProgress.displayName = "LinearProgress";
10028
+ const SIZE_CONFIG = {
10029
+ lg: { dimension: 128, r: 60, strokeWidth: 8, trackColor: "var(--bg-default-tertiary)", fontSize: 24, lineHeight: 36, showLabel: true },
10030
+ md: { dimension: 48, r: 22, strokeWidth: 3, trackColor: "var(--bg-default-tertiary)", fontSize: 14, lineHeight: 20, showLabel: true },
10031
+ sm: { dimension: 24, r: 8, strokeWidth: 2, trackColor: "var(--fill-black-200)", fontSize: 0, lineHeight: 0, showLabel: false }
10032
+ };
10033
+ const CircleProgress = forwardRef(
10034
+ function CircleProgress2({ value, size: size2 = "lg", className }, ref) {
10035
+ const pct = Math.min(100, Math.max(0, value));
10036
+ const cfg = SIZE_CONFIG[size2];
10037
+ const circumference = 2 * Math.PI * cfg.r;
10038
+ const offset2 = circumference * (1 - pct / 100);
10039
+ const cx = cfg.dimension / 2;
10040
+ const isZero = pct === 0;
10041
+ const uid = useId$1();
10042
+ const gradientId = `cp-grad-${uid}`;
10043
+ return /* @__PURE__ */ jsxs(
10044
+ "svg",
10045
+ {
10046
+ ref,
10047
+ role: "progressbar",
10048
+ "aria-valuenow": pct,
10049
+ "aria-valuemin": 0,
10050
+ "aria-valuemax": 100,
10051
+ width: cfg.dimension,
10052
+ height: cfg.dimension,
10053
+ viewBox: `0 0 ${cfg.dimension} ${cfg.dimension}`,
10054
+ className: cn("shrink-0", className),
10055
+ children: [
10056
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
10057
+ "linearGradient",
10058
+ {
10059
+ id: gradientId,
10060
+ gradientUnits: "userSpaceOnUse",
10061
+ x1: cx,
10062
+ y1: 0,
10063
+ x2: cx,
10064
+ y2: cfg.dimension,
10065
+ children: [
10066
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "#00a1e9" }),
10067
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "#004eba" })
10068
+ ]
10069
+ }
10070
+ ) }),
10071
+ /* @__PURE__ */ jsx(
10072
+ "circle",
10073
+ {
10074
+ cx,
10075
+ cy: cx,
10076
+ r: cfg.r,
10077
+ fill: "none",
10078
+ stroke: cfg.trackColor,
10079
+ strokeWidth: cfg.strokeWidth
10080
+ }
10081
+ ),
10082
+ pct > 0 && /* @__PURE__ */ jsx(
10083
+ "circle",
10084
+ {
10085
+ cx,
10086
+ cy: cx,
10087
+ r: cfg.r,
10088
+ fill: "none",
10089
+ stroke: `url(#${gradientId})`,
10090
+ strokeWidth: cfg.strokeWidth,
10091
+ strokeDasharray: circumference,
10092
+ strokeDashoffset: offset2,
10093
+ strokeLinecap: "round",
10094
+ transform: `rotate(-90 ${cx} ${cx})`,
10095
+ style: { transition: "stroke-dashoffset 0.3s ease" }
10096
+ }
10097
+ ),
10098
+ cfg.showLabel && /* @__PURE__ */ jsxs(
10099
+ "text",
10100
+ {
10101
+ x: cx,
10102
+ y: cx,
10103
+ textAnchor: "middle",
10104
+ dominantBaseline: "central",
10105
+ style: {
10106
+ fontSize: cfg.fontSize,
10107
+ lineHeight: cfg.lineHeight,
10108
+ fontWeight: 700,
10109
+ fontVariationSettings: "'CTGR' 0, 'wdth' 100, 'wght' 700",
10110
+ fill: isZero ? "var(--text-default-placeholder)" : "var(--text-brand-primary)",
10111
+ fontFamily: "'Noto Sans Thai', sans-serif"
10112
+ },
10113
+ children: [
10114
+ pct,
10115
+ "%"
10116
+ ]
10117
+ }
10118
+ )
10119
+ ]
10120
+ }
10121
+ );
10122
+ }
10123
+ );
10124
+ CircleProgress.displayName = "CircleProgress";
10125
+ const UploadArea = forwardRef(
10126
+ function UploadArea2({ disabled = false, label = "อัปโหลดไฟล์", className, onClick, ...props }, ref) {
10127
+ return /* @__PURE__ */ jsxs(
10128
+ "div",
10129
+ {
10130
+ ref,
10131
+ role: disabled ? void 0 : "button",
10132
+ tabIndex: disabled ? void 0 : 0,
10133
+ "aria-disabled": disabled,
10134
+ onClick: disabled ? void 0 : onClick,
10135
+ onKeyDown: disabled ? void 0 : (e) => {
10136
+ if (e.key === "Enter" || e.key === " ") {
10137
+ e.preventDefault();
10138
+ onClick == null ? void 0 : onClick(e);
10139
+ }
10140
+ },
10141
+ className: cn(
10142
+ "flex items-center justify-center gap-2 min-h-12 py-3.5 rounded-lg",
10143
+ "border border-dashed border-border-default",
10144
+ disabled ? "bg-bg-default-secondary cursor-not-allowed" : "bg-background cursor-pointer hover:bg-bg-default-secondary transition-colors",
10145
+ className
10146
+ ),
10147
+ ...props,
10148
+ children: [
10149
+ /* @__PURE__ */ jsx(
10150
+ "span",
10151
+ {
10152
+ className: cn(
10153
+ "flex items-center justify-center w-5 h-5 shrink-0",
10154
+ disabled ? "text-disabled" : "text-primary-action"
10155
+ ),
10156
+ children: /* @__PURE__ */ jsx(UploadSimpleIcon, { size: 20, weight: "regular" })
10157
+ }
10158
+ ),
10159
+ /* @__PURE__ */ jsx(
10160
+ "span",
10161
+ {
10162
+ className: cn(
10163
+ "text-sm font-medium leading-5 whitespace-nowrap",
10164
+ disabled ? "text-disabled" : "text-primary-action"
10165
+ ),
10166
+ children: label
10167
+ }
10168
+ )
10169
+ ]
10170
+ }
10171
+ );
10172
+ }
10173
+ );
10174
+ UploadArea.displayName = "UploadArea";
10175
+ const UploadItem = forwardRef(
10176
+ function UploadItem2({
10177
+ variant = "text",
10178
+ status = "loading",
10179
+ fileName = "filename.pdf",
10180
+ fileSize = "1.66KB",
10181
+ errorText = "Error Text",
10182
+ progress = 50,
10183
+ onDelete,
10184
+ className
10185
+ }, ref) {
10186
+ const isLoading = status === "loading";
10187
+ const isSuccess = status === "success";
10188
+ const isError = status === "error";
10189
+ if (variant === "text") {
10190
+ return /* @__PURE__ */ jsxs(
10191
+ "div",
10192
+ {
10193
+ ref,
10194
+ className: cn(
10195
+ "flex max-w-[500px] w-[300px] overflow-hidden",
10196
+ isError ? "flex-col gap-1 items-start" : "gap-2 items-center",
10197
+ className
10198
+ ),
10199
+ children: [
10200
+ isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
10201
+ /* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 text-sm leading-5 text-text-default-placeholder truncate", children: fileName }),
10202
+ /* @__PURE__ */ jsx(CircleProgress, { size: "sm", value: progress, className: "shrink-0" })
10203
+ ] }),
10204
+ isSuccess && /* @__PURE__ */ jsxs(Fragment, { children: [
10205
+ /* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 text-sm leading-5 text-text-info truncate", children: fileName }),
10206
+ /* @__PURE__ */ jsx(TrashButton, { onDelete })
10207
+ ] }),
10208
+ isError && /* @__PURE__ */ jsxs(Fragment, { children: [
10209
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center w-full py-px", children: [
10210
+ /* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 text-sm leading-5 text-text-danger truncate", children: fileName }),
10211
+ /* @__PURE__ */ jsx(TrashButton, { onDelete })
10212
+ ] }),
10213
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-0.5 px-0.5 text-text-danger", children: [
10214
+ /* @__PURE__ */ jsx("span", { className: "text-[7.74px] leading-none", children: "*" }),
10215
+ /* @__PURE__ */ jsx("p", { className: "text-xs leading-4", children: errorText })
10216
+ ] })
10217
+ ] })
10218
+ ]
10219
+ }
10220
+ );
10221
+ }
10222
+ const cardBase = "flex-1 min-w-0 flex items-center gap-2 p-3.5 bg-background border border-border-default rounded-lg text-base leading-6 whitespace-nowrap";
10223
+ return /* @__PURE__ */ jsxs(
10224
+ "div",
10225
+ {
10226
+ ref,
10227
+ className: cn(
10228
+ "flex flex-col gap-1 items-start w-[343px]",
10229
+ className
10230
+ ),
10231
+ children: [
10232
+ isLoading && /* @__PURE__ */ jsxs("div", { className: "w-full flex flex-col gap-1 px-3.5 py-2.5 bg-background border border-border-default rounded-lg", children: [
10233
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2 items-center h-5 text-sm leading-5 text-text-default-placeholder", children: [
10234
+ /* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 truncate", children: fileName }),
10235
+ /* @__PURE__ */ jsx("p", { className: "shrink-0 text-right w-[46px]", children: fileSize })
10236
+ ] }),
10237
+ /* @__PURE__ */ jsx(LinearProgress, { value: progress })
10238
+ ] }),
10239
+ (isSuccess || isError) && /* @__PURE__ */ jsxs("div", { className: "flex gap-1 items-center w-full", children: [
10240
+ /* @__PURE__ */ jsxs(
10241
+ "div",
10242
+ {
10243
+ className: cn(
10244
+ cardBase,
10245
+ isSuccess ? "text-text-info" : "text-text-danger"
10246
+ ),
10247
+ children: [
10248
+ /* @__PURE__ */ jsx("p", { className: "flex-1 min-w-0 overflow-hidden text-ellipsis", children: fileName }),
10249
+ /* @__PURE__ */ jsx("p", { className: "shrink-0 text-right", children: fileSize })
10250
+ ]
10251
+ }
10252
+ ),
10253
+ /* @__PURE__ */ jsx(
10254
+ "button",
10255
+ {
10256
+ type: "button",
10257
+ onClick: onDelete,
10258
+ className: cn(
10259
+ "flex items-center justify-center size-12 shrink-0",
10260
+ "bg-background border border-border-default rounded-lg",
10261
+ "text-icon-danger cursor-pointer"
10262
+ ),
10263
+ "aria-label": "ลบไฟล์",
10264
+ children: /* @__PURE__ */ jsx(TrashIcon, { size: 20 })
10265
+ }
10266
+ )
10267
+ ] }),
10268
+ 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 }) })
10269
+ ]
10270
+ }
10271
+ );
10272
+ }
10273
+ );
10274
+ UploadItem.displayName = "UploadItem";
10275
+ function TrashButton({ onDelete }) {
10276
+ return /* @__PURE__ */ jsx(
10277
+ "button",
10278
+ {
10279
+ type: "button",
10280
+ onClick: onDelete,
10281
+ className: "flex items-center justify-center w-5 h-5 shrink-0 text-text-danger cursor-pointer",
10282
+ "aria-label": "ลบไฟล์",
10283
+ children: /* @__PURE__ */ jsx(TrashIcon, { size: 20 })
10284
+ }
10285
+ );
10286
+ }
10287
+ const ListItem = forwardRef(
10288
+ function ListItem2({
10289
+ label,
10290
+ leading,
10291
+ action,
10292
+ onAction,
10293
+ trailing,
10294
+ highlighted = false,
10295
+ onClick,
10296
+ className
10297
+ }, ref) {
10298
+ const [pressed, setPressed] = useState(false);
10299
+ const isHighlighted = highlighted || !!onClick && pressed;
10300
+ return /* @__PURE__ */ jsxs(
10301
+ "div",
10302
+ {
10303
+ ref,
10304
+ onClick,
10305
+ onPointerDown: () => {
10306
+ if (onClick) setPressed(true);
10307
+ },
10308
+ onPointerUp: () => setPressed(false),
10309
+ onPointerLeave: () => setPressed(false),
10310
+ className: cn(
10311
+ "flex items-center gap-3 p-4 border-b border-border",
10312
+ isHighlighted ? "bg-bg-default-pressed" : "bg-background",
10313
+ onClick && "cursor-pointer select-none",
10314
+ className
10315
+ ),
10316
+ children: [
10317
+ leading != null && /* @__PURE__ */ jsx("span", { className: "shrink-0 flex items-center text-icon-default [&_svg]:text-icon-default [&_svg]:size-6", children: leading }),
10318
+ /* @__PURE__ */ jsx("span", { className: "flex-1 min-w-0 text-sm leading-5 text-foreground truncate", children: label }),
10319
+ action && /* @__PURE__ */ jsx(
10320
+ "button",
10321
+ {
10322
+ type: "button",
10323
+ onClick: (e) => {
10324
+ e.stopPropagation();
10325
+ onAction == null ? void 0 : onAction(e);
10326
+ },
10327
+ className: "shrink-0 text-sm font-medium text-primary-action hover:underline cursor-pointer whitespace-nowrap",
10328
+ children: action
10329
+ }
10330
+ ),
10331
+ trailing != null && /* @__PURE__ */ jsx("span", { className: "shrink-0 flex items-center text-icon-default [&_svg]:text-icon-default [&_svg]:size-6", children: trailing })
10332
+ ]
10333
+ }
10334
+ );
10335
+ }
10336
+ );
10337
+ ListItem.displayName = "ListItem";
10338
+ function List({ children, className }) {
10339
+ return /* @__PURE__ */ jsx("div", { className: cn("flex flex-col", className), children });
10340
+ }
9734
10341
  const index = {
9735
10342
  Button,
9736
10343
  Badge,
@@ -9772,6 +10379,13 @@ const index = {
9772
10379
  PaginationCarousel,
9773
10380
  Tooltip,
9774
10381
  Popover,
10382
+ Slider,
10383
+ LinearProgress,
10384
+ CircleProgress,
10385
+ UploadArea,
10386
+ UploadItem,
10387
+ List,
10388
+ ListItem,
9775
10389
  cn,
9776
10390
  useIsMobile
9777
10391
  };
@@ -9786,10 +10400,14 @@ export {
9786
10400
  Card,
9787
10401
  Checkbox,
9788
10402
  Chip,
10403
+ CircleProgress,
9789
10404
  DateInput,
9790
10405
  Dropdown,
9791
10406
  DropdownMultiple,
9792
10407
  Input,
10408
+ LinearProgress,
10409
+ List,
10410
+ ListItem,
9793
10411
  Modal,
9794
10412
  Notification,
9795
10413
  OptionList,
@@ -9799,6 +10417,7 @@ export {
9799
10417
  Popover,
9800
10418
  Radio,
9801
10419
  SearchInput,
10420
+ Slider,
9802
10421
  StatusTag,
9803
10422
  Tab,
9804
10423
  TabGroup,
@@ -9816,6 +10435,8 @@ export {
9816
10435
  Toaster,
9817
10436
  Toggle,
9818
10437
  Tooltip,
10438
+ UploadArea,
10439
+ UploadItem,
9819
10440
  cn,
9820
10441
  index as default,
9821
10442
  useIsMobile