@sustaina/shared-ui 1.60.0 → 1.62.0

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
@@ -19,7 +19,7 @@ var LabelPrimitive = require('@radix-ui/react-label');
19
19
  var dateFns = require('date-fns');
20
20
  var PopoverPrimitive = require('@radix-ui/react-popover');
21
21
  var cmdk = require('cmdk');
22
- var SheetPrimitive = require('@radix-ui/react-dialog');
22
+ var DialogPrimitive2 = require('@radix-ui/react-dialog');
23
23
  var reactVirtual = require('@tanstack/react-virtual');
24
24
  var TooltipPrimitive = require('@radix-ui/react-tooltip');
25
25
  var CheckboxPrimitive = require('@radix-ui/react-checkbox');
@@ -96,7 +96,7 @@ var Autoplay__default = /*#__PURE__*/_interopDefault(Autoplay);
96
96
  var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
97
97
  var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
98
98
  var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
99
- var SheetPrimitive__namespace = /*#__PURE__*/_interopNamespace(SheetPrimitive);
99
+ var DialogPrimitive2__namespace = /*#__PURE__*/_interopNamespace(DialogPrimitive2);
100
100
  var TooltipPrimitive__namespace = /*#__PURE__*/_interopNamespace(TooltipPrimitive);
101
101
  var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
102
102
  var CollapsiblePrimitive__namespace = /*#__PURE__*/_interopNamespace(CollapsiblePrimitive);
@@ -5694,7 +5694,7 @@ function MonthCal({
5694
5694
  setMenuYear(year);
5695
5695
  }
5696
5696
  }
5697
- }, [selectedMonthDate, menuYear]);
5697
+ }, [selectedMonthDate]);
5698
5698
  React__namespace.useEffect(() => {
5699
5699
  if (typeof minYear === "number" && menuYear < minYear) {
5700
5700
  setMenuYear(minYear);
@@ -6106,14 +6106,14 @@ var ConditionMonthInput = ({ row, control, onClear }) => {
6106
6106
  return renderPicker(`value_${row.id}`, "value");
6107
6107
  };
6108
6108
  function Dialog({ ...props }) {
6109
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
6109
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Root, { "data-slot": "dialog", ...props });
6110
6110
  }
6111
6111
  function DialogPortal({ ...props }) {
6112
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Portal, { "data-slot": "dialog-portal", ...props });
6112
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Portal, { "data-slot": "dialog-portal", ...props });
6113
6113
  }
6114
6114
  function DialogOverlay({ className, ...props }) {
6115
6115
  return /* @__PURE__ */ jsxRuntime.jsx(
6116
- SheetPrimitive__namespace.Overlay,
6116
+ DialogPrimitive2__namespace.Overlay,
6117
6117
  {
6118
6118
  "data-slot": "dialog-overlay",
6119
6119
  className: cn(
@@ -6133,7 +6133,7 @@ function DialogContent({
6133
6133
  return /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
6134
6134
  /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
6135
6135
  /* @__PURE__ */ jsxRuntime.jsxs(
6136
- SheetPrimitive__namespace.Content,
6136
+ DialogPrimitive2__namespace.Content,
6137
6137
  {
6138
6138
  "data-slot": "dialog-content",
6139
6139
  className: cn(
@@ -6144,7 +6144,7 @@ function DialogContent({
6144
6144
  children: [
6145
6145
  children,
6146
6146
  showCloseButton && /* @__PURE__ */ jsxRuntime.jsxs(
6147
- SheetPrimitive__namespace.Close,
6147
+ DialogPrimitive2__namespace.Close,
6148
6148
  {
6149
6149
  "data-slot": "dialog-close",
6150
6150
  className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
@@ -6171,7 +6171,7 @@ function DialogHeader({ className, ...props }) {
6171
6171
  }
6172
6172
  function DialogTitle({ className, ...props }) {
6173
6173
  return /* @__PURE__ */ jsxRuntime.jsx(
6174
- SheetPrimitive__namespace.Title,
6174
+ DialogPrimitive2__namespace.Title,
6175
6175
  {
6176
6176
  "data-slot": "dialog-title",
6177
6177
  className: cn("text-lg leading-none font-semibold", className),
@@ -6184,7 +6184,7 @@ function DialogDescription({
6184
6184
  ...props
6185
6185
  }) {
6186
6186
  return /* @__PURE__ */ jsxRuntime.jsx(
6187
- SheetPrimitive__namespace.Description,
6187
+ DialogPrimitive2__namespace.Description,
6188
6188
  {
6189
6189
  "data-slot": "dialog-description",
6190
6190
  className: cn("text-muted-foreground text-sm", className),
@@ -9938,17 +9938,17 @@ var DataTable = ({
9938
9938
  };
9939
9939
  var DataTable_default = DataTable;
9940
9940
  function Dialog2(props) {
9941
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
9941
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Root, { "data-slot": "dialog", ...props });
9942
9942
  }
9943
9943
  function DialogTrigger(props) {
9944
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Trigger, { "data-slot": "dialog-trigger", ...props });
9944
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Trigger, { "data-slot": "dialog-trigger", ...props });
9945
9945
  }
9946
9946
  function DialogPortal2(props) {
9947
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Portal, { "data-slot": "dialog-portal", ...props });
9947
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Portal, { "data-slot": "dialog-portal", ...props });
9948
9948
  }
9949
9949
  function DialogOverlay2({ className, ...props }) {
9950
9950
  return /* @__PURE__ */ jsxRuntime.jsx(
9951
- SheetPrimitive__namespace.Overlay,
9951
+ DialogPrimitive2__namespace.Overlay,
9952
9952
  {
9953
9953
  "data-slot": "dialog-overlay",
9954
9954
  className: cn(
@@ -9959,7 +9959,7 @@ function DialogOverlay2({ className, ...props }) {
9959
9959
  }
9960
9960
  );
9961
9961
  }
9962
- function DialogHeader2({ className, children, ...props }) {
9962
+ function InternalDialogHeader({ className, children, ...props }) {
9963
9963
  return /* @__PURE__ */ jsxRuntime.jsxs(
9964
9964
  "div",
9965
9965
  {
@@ -9972,7 +9972,7 @@ function DialogHeader2({ className, children, ...props }) {
9972
9972
  children: [
9973
9973
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-lg font-semibold", children }),
9974
9974
  /* @__PURE__ */ jsxRuntime.jsxs(
9975
- SheetPrimitive__namespace.Close,
9975
+ DialogPrimitive2__namespace.Close,
9976
9976
  {
9977
9977
  "data-slot": "dialog-close",
9978
9978
  className: "absolute right-4 top-4 rounded-xs opacity-80 hover:opacity-100 transition-opacity focus:outline-hidden",
@@ -9996,7 +9996,7 @@ function DialogContent2({
9996
9996
  return /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal2, { children: [
9997
9997
  showOverlay && /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay2, {}),
9998
9998
  /* @__PURE__ */ jsxRuntime.jsxs(
9999
- SheetPrimitive__namespace.Content,
9999
+ DialogPrimitive2__namespace.Content,
10000
10000
  {
10001
10001
  "data-slot": "dialog-content",
10002
10002
  className: cn(
@@ -10005,7 +10005,7 @@ function DialogContent2({
10005
10005
  ),
10006
10006
  ...props,
10007
10007
  children: [
10008
- header && /* @__PURE__ */ jsxRuntime.jsx(DialogHeader2, { children: header }),
10008
+ header && /* @__PURE__ */ jsxRuntime.jsx(InternalDialogHeader, { children: header }),
10009
10009
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-auto", children })
10010
10010
  ]
10011
10011
  }
@@ -10027,7 +10027,7 @@ function DialogFooter({ className, ...props }) {
10027
10027
  }
10028
10028
  function DialogTitle2({ className, ...props }) {
10029
10029
  return /* @__PURE__ */ jsxRuntime.jsx(
10030
- SheetPrimitive__namespace.Title,
10030
+ DialogPrimitive2__namespace.Title,
10031
10031
  {
10032
10032
  "data-slot": "dialog-title",
10033
10033
  className: cn("text-lg font-semibold leading-none", className),
@@ -10040,7 +10040,7 @@ function DialogDescription2({
10040
10040
  ...props
10041
10041
  }) {
10042
10042
  return /* @__PURE__ */ jsxRuntime.jsx(
10043
- SheetPrimitive__namespace.Description,
10043
+ DialogPrimitive2__namespace.Description,
10044
10044
  {
10045
10045
  "data-slot": "dialog-description",
10046
10046
  className: cn("text-sm text-muted-foreground", className),
@@ -10048,18 +10048,50 @@ function DialogDescription2({
10048
10048
  }
10049
10049
  );
10050
10050
  }
10051
+ function DialogCloseButton(props) {
10052
+ return /* @__PURE__ */ jsxRuntime.jsx(
10053
+ "button",
10054
+ {
10055
+ ...props,
10056
+ type: "button",
10057
+ "aria-label": "Close",
10058
+ className: cn("absolute top-4 right-4", props.className),
10059
+ style: {
10060
+ background: "none",
10061
+ border: "none",
10062
+ padding: 0,
10063
+ cursor: "pointer",
10064
+ ...props?.style
10065
+ },
10066
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "w-6 h-6 text-white" })
10067
+ }
10068
+ );
10069
+ }
10070
+ function DialogClose({ ...props }) {
10071
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Close, { "data-slot": "dialog-close", ...props });
10072
+ }
10073
+ function DialogHeader2({ className, ...props }) {
10074
+ return /* @__PURE__ */ jsxRuntime.jsx(
10075
+ "div",
10076
+ {
10077
+ "data-slot": "dialog-header",
10078
+ className: cn("flex flex-col gap-2 text-center sm:text-left", className),
10079
+ ...props
10080
+ }
10081
+ );
10082
+ }
10051
10083
  function cn2(...inputs) {
10052
10084
  return tailwindMerge.twMerge(clsx2.clsx(inputs));
10053
10085
  }
10054
10086
  function Dialog3({ ...props }) {
10055
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Root, { "data-slot": "dialog", ...props });
10087
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Root, { "data-slot": "dialog", ...props });
10056
10088
  }
10057
10089
  function DialogPortal3({ ...props }) {
10058
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Portal, { "data-slot": "dialog-portal", ...props });
10090
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Portal, { "data-slot": "dialog-portal", ...props });
10059
10091
  }
10060
10092
  function DialogOverlay3({ className, ...props }) {
10061
10093
  return /* @__PURE__ */ jsxRuntime.jsx(
10062
- SheetPrimitive__namespace.Overlay,
10094
+ DialogPrimitive2__namespace.Overlay,
10063
10095
  {
10064
10096
  "data-slot": "dialog-overlay",
10065
10097
  className: cn2(
@@ -10079,7 +10111,7 @@ function DialogContent3({
10079
10111
  return /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal3, { "data-slot": "dialog-portal", children: [
10080
10112
  /* @__PURE__ */ jsxRuntime.jsx(DialogOverlay3, { className: "z-99" }),
10081
10113
  /* @__PURE__ */ jsxRuntime.jsxs(
10082
- SheetPrimitive__namespace.Content,
10114
+ DialogPrimitive2__namespace.Content,
10083
10115
  {
10084
10116
  "data-slot": "dialog-content",
10085
10117
  className: cn2(
@@ -10090,7 +10122,7 @@ function DialogContent3({
10090
10122
  children: [
10091
10123
  children,
10092
10124
  showCloseButton && /* @__PURE__ */ jsxRuntime.jsxs(
10093
- SheetPrimitive__namespace.Close,
10125
+ DialogPrimitive2__namespace.Close,
10094
10126
  {
10095
10127
  "data-slot": "dialog-close",
10096
10128
  className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
@@ -10117,7 +10149,7 @@ function DialogHeader3({ className, ...props }) {
10117
10149
  }
10118
10150
  function DialogTitle3({ className, ...props }) {
10119
10151
  return /* @__PURE__ */ jsxRuntime.jsx(
10120
- SheetPrimitive__namespace.Title,
10152
+ DialogPrimitive2__namespace.Title,
10121
10153
  {
10122
10154
  "data-slot": "dialog-title",
10123
10155
  className: cn2("text-lg leading-none font-semibold", className),
@@ -10130,7 +10162,7 @@ function DialogDescription3({
10130
10162
  ...props
10131
10163
  }) {
10132
10164
  return /* @__PURE__ */ jsxRuntime.jsx(
10133
- SheetPrimitive__namespace.Description,
10165
+ DialogPrimitive2__namespace.Description,
10134
10166
  {
10135
10167
  "data-slot": "dialog-description",
10136
10168
  className: cn2("text-muted-foreground text-sm", className),
@@ -11403,9 +11435,12 @@ __export(ui_exports, {
11403
11435
  CollapsibleTrigger: () => CollapsibleTrigger2,
11404
11436
  DatePicker: () => DatePicker,
11405
11437
  Dialog: () => Dialog2,
11438
+ DialogClose: () => DialogClose,
11439
+ DialogCloseButton: () => DialogCloseButton,
11406
11440
  DialogContent: () => DialogContent2,
11407
11441
  DialogDescription: () => DialogDescription2,
11408
11442
  DialogFooter: () => DialogFooter,
11443
+ DialogHeader: () => DialogHeader2,
11409
11444
  DialogTitle: () => DialogTitle2,
11410
11445
  DialogTrigger: () => DialogTrigger,
11411
11446
  DropdownMenu: () => DropdownMenu,
@@ -11852,20 +11887,20 @@ function Separator3({
11852
11887
  );
11853
11888
  }
11854
11889
  function Sheet({ ...props }) {
11855
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Root, { "data-slot": "sheet", ...props });
11890
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Root, { "data-slot": "sheet", ...props });
11856
11891
  }
11857
11892
  function SheetTrigger({ ...props }) {
11858
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Trigger, { "data-slot": "sheet-trigger", ...props });
11893
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Trigger, { "data-slot": "sheet-trigger", ...props });
11859
11894
  }
11860
11895
  function SheetClose({ ...props }) {
11861
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Close, { "data-slot": "sheet-close", ...props });
11896
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Close, { "data-slot": "sheet-close", ...props });
11862
11897
  }
11863
11898
  function SheetPortal({ ...props }) {
11864
- return /* @__PURE__ */ jsxRuntime.jsx(SheetPrimitive__namespace.Portal, { "data-slot": "sheet-portal", ...props });
11899
+ return /* @__PURE__ */ jsxRuntime.jsx(DialogPrimitive2__namespace.Portal, { "data-slot": "sheet-portal", ...props });
11865
11900
  }
11866
11901
  function SheetOverlay({ className, ...props }) {
11867
11902
  return /* @__PURE__ */ jsxRuntime.jsx(
11868
- SheetPrimitive__namespace.Overlay,
11903
+ DialogPrimitive2__namespace.Overlay,
11869
11904
  {
11870
11905
  "data-slot": "sheet-overlay",
11871
11906
  className: cn(
@@ -11885,7 +11920,7 @@ function SheetContent({
11885
11920
  return /* @__PURE__ */ jsxRuntime.jsxs(SheetPortal, { children: [
11886
11921
  /* @__PURE__ */ jsxRuntime.jsx(SheetOverlay, {}),
11887
11922
  /* @__PURE__ */ jsxRuntime.jsxs(
11888
- SheetPrimitive__namespace.Content,
11923
+ DialogPrimitive2__namespace.Content,
11889
11924
  {
11890
11925
  "data-slot": "sheet-content",
11891
11926
  className: cn(
@@ -11899,7 +11934,7 @@ function SheetContent({
11899
11934
  ...props,
11900
11935
  children: [
11901
11936
  children,
11902
- /* @__PURE__ */ jsxRuntime.jsxs(SheetPrimitive__namespace.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
11937
+ /* @__PURE__ */ jsxRuntime.jsxs(DialogPrimitive2__namespace.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
11903
11938
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.XIcon, { className: "size-4" }),
11904
11939
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "Close" })
11905
11940
  ] })
@@ -11923,7 +11958,7 @@ function SheetFooter({ className, ...props }) {
11923
11958
  }
11924
11959
  function SheetTitle({ className, ...props }) {
11925
11960
  return /* @__PURE__ */ jsxRuntime.jsx(
11926
- SheetPrimitive__namespace.Title,
11961
+ DialogPrimitive2__namespace.Title,
11927
11962
  {
11928
11963
  "data-slot": "sheet-title",
11929
11964
  className: cn("text-foreground font-semibold", className),
@@ -11936,7 +11971,7 @@ function SheetDescription({
11936
11971
  ...props
11937
11972
  }) {
11938
11973
  return /* @__PURE__ */ jsxRuntime.jsx(
11939
- SheetPrimitive__namespace.Description,
11974
+ DialogPrimitive2__namespace.Description,
11940
11975
  {
11941
11976
  "data-slot": "sheet-description",
11942
11977
  className: cn("text-muted-foreground text-sm", className),
@@ -17133,60 +17168,11 @@ var Input2 = React__namespace.forwardRef(
17133
17168
  }
17134
17169
  );
17135
17170
  Input2.displayName = "Input";
17136
- function useFillDecimalOnBlur({
17137
- enabled,
17138
- decimalScale,
17139
- value,
17140
- defaultValue
17141
- }) {
17142
- const blurScale = enabled ? decimalScale ?? 2 : void 0;
17143
- const isUserEditingRef = React__namespace.useRef(false);
17144
- const [formattedValue, setFormattedValue] = React__namespace.useState(() => {
17145
- if (!enabled) return void 0;
17146
- const scale = decimalScale ?? 2;
17147
- const initial = parseToNumber(value) ?? parseToNumber(defaultValue);
17148
- if (initial !== void 0) return truncateToFixed(initial, scale);
17149
- return void 0;
17150
- });
17151
- React__namespace.useEffect(() => {
17152
- if (!enabled) return;
17153
- const parsed = parseToNumber(value);
17154
- if (parsed !== void 0) {
17155
- if (blurScale !== void 0 && !isUserEditingRef.current) {
17156
- setFormattedValue(truncateToFixed(parsed, blurScale));
17157
- }
17158
- } else if (value === null || value === "") {
17159
- setFormattedValue(void 0);
17160
- }
17161
- }, [value, enabled, blurScale]);
17162
- const onEdit = React__namespace.useCallback(
17163
- (values, sourceInfo) => {
17164
- if (!enabled || sourceInfo.source !== "event") return;
17165
- isUserEditingRef.current = true;
17166
- setFormattedValue(values.value || void 0);
17167
- },
17168
- [enabled]
17169
- );
17170
- const onBlur = React__namespace.useCallback(
17171
- (truncatedStr) => {
17172
- isUserEditingRef.current = false;
17173
- if (!enabled || blurScale === void 0) return;
17174
- setFormattedValue(truncatedStr);
17175
- },
17176
- [enabled, blurScale]
17177
- );
17178
- const resetEditing = React__namespace.useCallback(() => {
17179
- isUserEditingRef.current = false;
17180
- }, []);
17181
- return { formattedValue, blurScale, onEdit, onBlur, resetEditing, setFormattedValue };
17182
- }
17183
17171
  function useStepper({ value, step, min, max, disabled, onStep }) {
17184
- const [changed, setChanged] = React__namespace.useState(false);
17185
17172
  const changeValue = React__namespace.useCallback(
17186
17173
  (delta) => {
17187
17174
  const current = value ?? 0;
17188
17175
  const clamped = clamp(current + delta, min, max);
17189
- setChanged(true);
17190
17176
  onStep(clamped);
17191
17177
  },
17192
17178
  [value, max, min, onStep]
@@ -17195,7 +17181,7 @@ function useStepper({ value, step, min, max, disabled, onStep }) {
17195
17181
  const decrement = React__namespace.useCallback(() => changeValue(-step), [changeValue, step]);
17196
17182
  const isIncrementDisabled = disabled || max !== void 0 && (value ?? 0) >= max;
17197
17183
  const isDecrementDisabled = disabled || min !== void 0 && (value ?? 0) <= min;
17198
- return { changed, increment, decrement, isIncrementDisabled, isDecrementDisabled };
17184
+ return { increment, decrement, isIncrementDisabled, isDecrementDisabled };
17199
17185
  }
17200
17186
  var InputNumber = ({
17201
17187
  customInputProps,
@@ -17219,26 +17205,37 @@ var InputNumber = ({
17219
17205
  ...props
17220
17206
  }) => {
17221
17207
  const blurFormatEnabled = fillDecimalOnBlur || truncateDecimalOnBlur;
17222
- const [internalValue, setInternalValue] = React__namespace.useState(
17208
+ const blurScale = blurFormatEnabled ? decimalScaleProp ?? 2 : void 0;
17209
+ const [displayOverride, setDisplayOverride] = React__namespace.useState(() => {
17210
+ if (!blurFormatEnabled) return void 0;
17211
+ const scale = decimalScaleProp ?? 2;
17212
+ const initial = parseToNumber(value) ?? parseToNumber(defaultValue);
17213
+ if (initial !== void 0) return truncateToFixed(initial, scale);
17214
+ return void 0;
17215
+ });
17216
+ const [numericValue, setNumericValue] = React__namespace.useState(
17223
17217
  () => parseToNumber(value) ?? parseToNumber(defaultValue)
17224
17218
  );
17225
- const internalValueRef = React__namespace.useRef(internalValue);
17226
- const rawValueRef = React__namespace.useRef("");
17227
- const isBlurClampedRef = React__namespace.useRef(false);
17228
- React__namespace.useEffect(() => {
17229
- const parsed = parseToNumber(value);
17230
- if (parsed !== void 0) {
17231
- internalValueRef.current = parsed;
17232
- setInternalValue(parsed);
17233
- }
17234
- isBlurClampedRef.current = false;
17235
- }, [value]);
17236
- const autoFormat = useFillDecimalOnBlur({
17237
- enabled: blurFormatEnabled,
17238
- decimalScale: decimalScaleProp,
17239
- value,
17240
- defaultValue
17241
- });
17219
+ const isEditingRef = React__namespace.useRef(false);
17220
+ const rawRef = React__namespace.useRef("");
17221
+ const prevValueRef = React__namespace.useRef(value);
17222
+ if (value !== prevValueRef.current) {
17223
+ prevValueRef.current = value;
17224
+ if (value === "" || value === null) {
17225
+ if (displayOverride !== void 0) setDisplayOverride(void 0);
17226
+ if (numericValue !== void 0) setNumericValue(void 0);
17227
+ isEditingRef.current = false;
17228
+ } else if (!isEditingRef.current) {
17229
+ const num = parseToNumber(value);
17230
+ if (num !== numericValue) setNumericValue(num);
17231
+ if (blurFormatEnabled && num !== void 0) {
17232
+ const formatted = truncateToFixed(num, blurScale);
17233
+ if (formatted !== displayOverride) setDisplayOverride(formatted);
17234
+ } else {
17235
+ if (displayOverride !== void 0) setDisplayOverride(void 0);
17236
+ }
17237
+ }
17238
+ }
17242
17239
  const isAllowed = React__namespace.useMemo(() => {
17243
17240
  if (maxIntegerDigits === void 0 && !isAllowedProp) return void 0;
17244
17241
  return (values) => {
@@ -17251,80 +17248,73 @@ var InputNumber = ({
17251
17248
  return isAllowedProp ? isAllowedProp(values) : true;
17252
17249
  };
17253
17250
  }, [maxIntegerDigits, isAllowedProp]);
17254
- const notifyChange = React__namespace.useCallback(
17255
- (newValue, event) => {
17256
- internalValueRef.current = newValue;
17257
- setInternalValue(newValue);
17258
- onStepChange?.(newValue);
17259
- onValueChange?.(
17260
- { floatValue: newValue, formattedValue: String(newValue), value: String(newValue) },
17261
- createSourceInfo(event)
17262
- );
17263
- },
17264
- [onStepChange, onValueChange]
17265
- );
17266
17251
  const stepper = useStepper({
17267
- value: internalValue,
17252
+ value: numericValue,
17268
17253
  step,
17269
17254
  min,
17270
17255
  max,
17271
17256
  disabled,
17272
17257
  onStep: React__namespace.useCallback(
17273
17258
  (clamped) => {
17274
- setInternalValue(clamped);
17275
- if (autoFormat.blurScale !== void 0) {
17276
- autoFormat.setFormattedValue(truncateToFixed(clamped, autoFormat.blurScale));
17277
- }
17278
- notifyChange(clamped);
17259
+ setNumericValue(clamped);
17260
+ const formatted = blurScale !== void 0 ? truncateToFixed(clamped, blurScale) : String(clamped);
17261
+ setDisplayOverride(formatted);
17262
+ rawRef.current = String(clamped);
17263
+ onStepChange?.(clamped);
17264
+ onValueChange?.(
17265
+ { floatValue: clamped, formattedValue: formatted, value: String(clamped) },
17266
+ createSourceInfo()
17267
+ );
17279
17268
  },
17280
- [autoFormat, notifyChange]
17269
+ [blurScale, onStepChange, onValueChange]
17281
17270
  )
17282
17271
  });
17283
17272
  const handleValueChange = React__namespace.useCallback(
17284
17273
  (values, sourceInfo) => {
17285
- internalValueRef.current = values.floatValue;
17286
- rawValueRef.current = values.value;
17287
- setInternalValue(values.floatValue);
17288
17274
  if (sourceInfo.source === "event") {
17289
- isBlurClampedRef.current = false;
17275
+ isEditingRef.current = true;
17276
+ setDisplayOverride(values.value);
17290
17277
  }
17278
+ setNumericValue(values.floatValue);
17279
+ rawRef.current = values.value;
17291
17280
  onValueChange?.(values, sourceInfo);
17292
17281
  if (values.floatValue !== void 0) onStepChange?.(values.floatValue);
17293
- autoFormat.onEdit(values, sourceInfo);
17294
17282
  },
17295
- [onValueChange, onStepChange, autoFormat]
17283
+ [onValueChange, onStepChange]
17296
17284
  );
17297
17285
  const handleBlur = React__namespace.useCallback(
17298
17286
  (event) => {
17287
+ isEditingRef.current = false;
17299
17288
  onBlur?.(event);
17300
- const latestValue = internalValueRef.current;
17301
- if (latestValue === void 0) {
17302
- autoFormat.resetEditing();
17289
+ const currentNumeric = numericValue;
17290
+ if (currentNumeric === void 0) {
17291
+ setDisplayOverride("");
17303
17292
  return;
17304
17293
  }
17305
- const clamped = clamp(latestValue, min, max);
17306
- const wasClamped = clamped !== latestValue;
17294
+ const clamped = clamp(currentNumeric, min, max);
17295
+ const wasClamped = clamped !== currentNumeric;
17307
17296
  if (wasClamped) {
17308
- isBlurClampedRef.current = true;
17309
- internalValueRef.current = clamped;
17310
- rawValueRef.current = String(clamped);
17311
- setInternalValue(clamped);
17297
+ setNumericValue(clamped);
17298
+ rawRef.current = String(clamped);
17312
17299
  onValueChange?.(
17313
17300
  { floatValue: clamped, formattedValue: String(clamped), value: String(clamped) },
17314
17301
  createSourceInfo()
17315
17302
  );
17316
17303
  onStepChange?.(clamped);
17317
17304
  }
17318
- if (blurFormatEnabled && autoFormat.blurScale !== void 0) {
17319
- const rawStr = wasClamped ? String(clamped) : rawValueRef.current || String(clamped);
17320
- autoFormat.onBlur(truncateStringToFixed(rawStr, autoFormat.blurScale));
17305
+ if (blurFormatEnabled && blurScale !== void 0) {
17306
+ const rawStr = wasClamped ? String(clamped) : rawRef.current || String(clamped);
17307
+ setDisplayOverride(truncateStringToFixed(rawStr, blurScale));
17308
+ } else if (wasClamped) {
17309
+ setDisplayOverride(String(clamped));
17321
17310
  } else {
17322
- autoFormat.resetEditing();
17311
+ setDisplayOverride(void 0);
17323
17312
  }
17324
17313
  },
17325
- [onBlur, blurFormatEnabled, autoFormat, min, max, onValueChange, onStepChange]
17314
+ [onBlur, blurFormatEnabled, blurScale, numericValue, min, max, onValueChange, onStepChange]
17326
17315
  );
17327
- const effectiveValue = autoFormat.formattedValue !== void 0 ? autoFormat.formattedValue : isBlurClampedRef.current || stepper.changed || blurFormatEnabled ? internalValue : value;
17316
+ const isValueExplicitlyEmpty = value === "" || value === null;
17317
+ const effectiveValue = isValueExplicitlyEmpty ? "" : displayOverride !== void 0 ? displayOverride : value;
17328
17318
  const buttonClass = cn(
17329
17319
  "flex items-center justify-center h-3 w-5 transition-colors outline-none",
17330
17320
  "text-neutral-400 hover:text-neutral-600 active:text-neutral-900",
@@ -17340,7 +17330,7 @@ var InputNumber = ({
17340
17330
  onBlur: handleBlur,
17341
17331
  ...isAllowed && { isAllowed },
17342
17332
  ...truncateDecimalOnBlur ? {} : fillDecimalOnBlur ? { decimalScale: decimalScaleProp } : { decimalScale: decimalScaleProp, fixedDecimalScale: fixedDecimalScaleProp },
17343
- ...autoFormat.formattedValue !== void 0 && { valueIsNumericString: true },
17333
+ ...displayOverride !== void 0 && { valueIsNumericString: true },
17344
17334
  ...props,
17345
17335
  disabled,
17346
17336
  invalid,
@@ -17590,6 +17580,104 @@ var ActionDropdown = ({
17590
17580
  ] });
17591
17581
  };
17592
17582
  var dropdownMenu_default = ActionDropdown;
17583
+ var sizeMap = {
17584
+ sm: "h-1",
17585
+ md: "h-2",
17586
+ lg: "h-3"
17587
+ };
17588
+ var resolveSize = (size) => typeof size === "number" ? { style: { height: size } } : { className: sizeMap[size] };
17589
+ var linecapMap = {
17590
+ round: "rounded-full",
17591
+ butt: "rounded-none",
17592
+ square: "rounded-none"
17593
+ };
17594
+ var alignClassMap = {
17595
+ start: "justify-start",
17596
+ center: "justify-center",
17597
+ end: "justify-end"
17598
+ };
17599
+ var ProgressBar = ({
17600
+ percent = 0,
17601
+ size = "md",
17602
+ showInfo = true,
17603
+ format: format6,
17604
+ precision = 0,
17605
+ success,
17606
+ strokeLinecap = "round",
17607
+ percentPosition = { align: "end", type: "outer" },
17608
+ barClassName,
17609
+ trailClassName,
17610
+ className
17611
+ }) => {
17612
+ const clamped = React.useMemo(() => Math.min(100, Math.max(0, percent)), [percent]);
17613
+ const displayValue = React.useMemo(() => parseFloat(clamped.toFixed(precision)), [clamped, precision]);
17614
+ const successClamped = React.useMemo(
17615
+ () => success ? Math.min(100, Math.max(0, success.percent)) : 0,
17616
+ [success]
17617
+ );
17618
+ const linecapClass = linecapMap[strokeLinecap];
17619
+ const posType = percentPosition?.type ?? "outer";
17620
+ const posAlign = percentPosition?.align ?? "end";
17621
+ const isInner = posType === "inner";
17622
+ const { className: sizeClass, style: sizeStyle } = resolveSize(size);
17623
+ const info = React.useMemo(() => {
17624
+ if (!showInfo) return null;
17625
+ if (format6) return format6(displayValue);
17626
+ return `${displayValue}%`;
17627
+ }, [showInfo, format6, displayValue]);
17628
+ return /* @__PURE__ */ jsxRuntime.jsxs(
17629
+ "div",
17630
+ {
17631
+ className: cn(
17632
+ "flex w-full items-center gap-2 min-w-0",
17633
+ posAlign === "start" && !isInner && "flex-row-reverse",
17634
+ className
17635
+ ),
17636
+ children: [
17637
+ /* @__PURE__ */ jsxRuntime.jsxs(
17638
+ "div",
17639
+ {
17640
+ className: cn(
17641
+ "relative flex-1 overflow-hidden",
17642
+ trailClassName ?? "bg-muted",
17643
+ linecapClass,
17644
+ isInner ? "min-h-4" : sizeClass
17645
+ ),
17646
+ style: isInner ? void 0 : sizeStyle,
17647
+ children: [
17648
+ success && /* @__PURE__ */ jsxRuntime.jsx(
17649
+ "div",
17650
+ {
17651
+ className: cn(
17652
+ "absolute left-0 top-0 h-full transition-all duration-300",
17653
+ success.className ?? "bg-sus-green-1",
17654
+ linecapClass
17655
+ ),
17656
+ style: { width: `${successClamped}%` }
17657
+ }
17658
+ ),
17659
+ /* @__PURE__ */ jsxRuntime.jsx(
17660
+ "div",
17661
+ {
17662
+ className: cn(
17663
+ "relative transition-all duration-300",
17664
+ barClassName ?? "bg-sus-primary-green-9",
17665
+ linecapClass,
17666
+ isInner ? cn("min-h-4 flex items-center px-1", alignClassMap[posAlign]) : cn("h-full", sizeClass)
17667
+ ),
17668
+ style: { width: `${clamped}%`, ...!isInner ? sizeStyle : void 0 },
17669
+ children: isInner && info && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] leading-none text-primary-foreground whitespace-nowrap tabular-nums", children: info })
17670
+ }
17671
+ )
17672
+ ]
17673
+ }
17674
+ ),
17675
+ !isInner && info && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs shrink-0 tabular-nums", children: info })
17676
+ ]
17677
+ }
17678
+ );
17679
+ };
17680
+ var ProgressBar_default = React.memo(ProgressBar);
17593
17681
  var TruncatedMouseEnterDiv = ({
17594
17682
  value,
17595
17683
  className,
@@ -18525,9 +18613,12 @@ exports.DecreaseIcon = DecreaseIcon;
18525
18613
  exports.Dialog = Dialog2;
18526
18614
  exports.DialogAlert = DialogAlert;
18527
18615
  exports.DialogAlertProvider = DialogAlertProvider;
18616
+ exports.DialogClose = DialogClose;
18617
+ exports.DialogCloseButton = DialogCloseButton;
18528
18618
  exports.DialogContent = DialogContent2;
18529
18619
  exports.DialogDescription = DialogDescription2;
18530
18620
  exports.DialogFooter = DialogFooter;
18621
+ exports.DialogHeader = DialogHeader2;
18531
18622
  exports.DialogTitle = DialogTitle2;
18532
18623
  exports.DialogTrigger = DialogTrigger;
18533
18624
  exports.DropdownMenu = DropdownMenu;
@@ -18603,6 +18694,7 @@ exports.PopoverContent = PopoverContent;
18603
18694
  exports.PopoverTrigger = PopoverTrigger;
18604
18695
  exports.PowerIcon = PowerIcon;
18605
18696
  exports.PreventPageLeave = PreventPageLeave_default;
18697
+ exports.ProgressBar = ProgressBar_default;
18606
18698
  exports.QuestionIcon = QuestionIcon;
18607
18699
  exports.RadioGroupItem = RadioGroupItem;
18608
18700
  exports.RadioGroupRoot = RadioGroupRoot;