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