@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.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import React__default, { forwardRef, isValidElement, useMemo, useRef, useEffect, useCallback, useLayoutEffect, useState, createElement } from 'react';
2
+ import React__default, { forwardRef, memo, isValidElement, useMemo, useRef, useEffect, useCallback, useLayoutEffect, useState, createElement } from 'react';
3
3
  import { useRouter } from '@tanstack/react-router';
4
4
  import { create } from 'zustand';
5
5
  import clsx2, { clsx } from 'clsx';
@@ -18,7 +18,7 @@ import * as LabelPrimitive from '@radix-ui/react-label';
18
18
  import { format, isValid, parse, parseISO, isAfter, compareAsc } from 'date-fns';
19
19
  import * as PopoverPrimitive from '@radix-ui/react-popover';
20
20
  import { Command as Command$1 } from 'cmdk';
21
- import * as SheetPrimitive from '@radix-ui/react-dialog';
21
+ import * as DialogPrimitive2 from '@radix-ui/react-dialog';
22
22
  import { useVirtualizer } from '@tanstack/react-virtual';
23
23
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
24
24
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
@@ -5651,7 +5651,7 @@ function MonthCal({
5651
5651
  setMenuYear(year);
5652
5652
  }
5653
5653
  }
5654
- }, [selectedMonthDate, menuYear]);
5654
+ }, [selectedMonthDate]);
5655
5655
  React.useEffect(() => {
5656
5656
  if (typeof minYear === "number" && menuYear < minYear) {
5657
5657
  setMenuYear(minYear);
@@ -6063,14 +6063,14 @@ var ConditionMonthInput = ({ row, control, onClear }) => {
6063
6063
  return renderPicker(`value_${row.id}`, "value");
6064
6064
  };
6065
6065
  function Dialog({ ...props }) {
6066
- return /* @__PURE__ */ jsx(SheetPrimitive.Root, { "data-slot": "dialog", ...props });
6066
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Root, { "data-slot": "dialog", ...props });
6067
6067
  }
6068
6068
  function DialogPortal({ ...props }) {
6069
- return /* @__PURE__ */ jsx(SheetPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
6069
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Portal, { "data-slot": "dialog-portal", ...props });
6070
6070
  }
6071
6071
  function DialogOverlay({ className, ...props }) {
6072
6072
  return /* @__PURE__ */ jsx(
6073
- SheetPrimitive.Overlay,
6073
+ DialogPrimitive2.Overlay,
6074
6074
  {
6075
6075
  "data-slot": "dialog-overlay",
6076
6076
  className: cn(
@@ -6090,7 +6090,7 @@ function DialogContent({
6090
6090
  return /* @__PURE__ */ jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [
6091
6091
  /* @__PURE__ */ jsx(DialogOverlay, {}),
6092
6092
  /* @__PURE__ */ jsxs(
6093
- SheetPrimitive.Content,
6093
+ DialogPrimitive2.Content,
6094
6094
  {
6095
6095
  "data-slot": "dialog-content",
6096
6096
  className: cn(
@@ -6101,7 +6101,7 @@ function DialogContent({
6101
6101
  children: [
6102
6102
  children,
6103
6103
  showCloseButton && /* @__PURE__ */ jsxs(
6104
- SheetPrimitive.Close,
6104
+ DialogPrimitive2.Close,
6105
6105
  {
6106
6106
  "data-slot": "dialog-close",
6107
6107
  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",
@@ -6128,7 +6128,7 @@ function DialogHeader({ className, ...props }) {
6128
6128
  }
6129
6129
  function DialogTitle({ className, ...props }) {
6130
6130
  return /* @__PURE__ */ jsx(
6131
- SheetPrimitive.Title,
6131
+ DialogPrimitive2.Title,
6132
6132
  {
6133
6133
  "data-slot": "dialog-title",
6134
6134
  className: cn("text-lg leading-none font-semibold", className),
@@ -6141,7 +6141,7 @@ function DialogDescription({
6141
6141
  ...props
6142
6142
  }) {
6143
6143
  return /* @__PURE__ */ jsx(
6144
- SheetPrimitive.Description,
6144
+ DialogPrimitive2.Description,
6145
6145
  {
6146
6146
  "data-slot": "dialog-description",
6147
6147
  className: cn("text-muted-foreground text-sm", className),
@@ -9895,17 +9895,17 @@ var DataTable = ({
9895
9895
  };
9896
9896
  var DataTable_default = DataTable;
9897
9897
  function Dialog2(props) {
9898
- return /* @__PURE__ */ jsx(SheetPrimitive.Root, { "data-slot": "dialog", ...props });
9898
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Root, { "data-slot": "dialog", ...props });
9899
9899
  }
9900
9900
  function DialogTrigger(props) {
9901
- return /* @__PURE__ */ jsx(SheetPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
9901
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Trigger, { "data-slot": "dialog-trigger", ...props });
9902
9902
  }
9903
9903
  function DialogPortal2(props) {
9904
- return /* @__PURE__ */ jsx(SheetPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
9904
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Portal, { "data-slot": "dialog-portal", ...props });
9905
9905
  }
9906
9906
  function DialogOverlay2({ className, ...props }) {
9907
9907
  return /* @__PURE__ */ jsx(
9908
- SheetPrimitive.Overlay,
9908
+ DialogPrimitive2.Overlay,
9909
9909
  {
9910
9910
  "data-slot": "dialog-overlay",
9911
9911
  className: cn(
@@ -9916,7 +9916,7 @@ function DialogOverlay2({ className, ...props }) {
9916
9916
  }
9917
9917
  );
9918
9918
  }
9919
- function DialogHeader2({ className, children, ...props }) {
9919
+ function InternalDialogHeader({ className, children, ...props }) {
9920
9920
  return /* @__PURE__ */ jsxs(
9921
9921
  "div",
9922
9922
  {
@@ -9929,7 +9929,7 @@ function DialogHeader2({ className, children, ...props }) {
9929
9929
  children: [
9930
9930
  /* @__PURE__ */ jsx("div", { className: "text-lg font-semibold", children }),
9931
9931
  /* @__PURE__ */ jsxs(
9932
- SheetPrimitive.Close,
9932
+ DialogPrimitive2.Close,
9933
9933
  {
9934
9934
  "data-slot": "dialog-close",
9935
9935
  className: "absolute right-4 top-4 rounded-xs opacity-80 hover:opacity-100 transition-opacity focus:outline-hidden",
@@ -9953,7 +9953,7 @@ function DialogContent2({
9953
9953
  return /* @__PURE__ */ jsxs(DialogPortal2, { children: [
9954
9954
  showOverlay && /* @__PURE__ */ jsx(DialogOverlay2, {}),
9955
9955
  /* @__PURE__ */ jsxs(
9956
- SheetPrimitive.Content,
9956
+ DialogPrimitive2.Content,
9957
9957
  {
9958
9958
  "data-slot": "dialog-content",
9959
9959
  className: cn(
@@ -9962,7 +9962,7 @@ function DialogContent2({
9962
9962
  ),
9963
9963
  ...props,
9964
9964
  children: [
9965
- header && /* @__PURE__ */ jsx(DialogHeader2, { children: header }),
9965
+ header && /* @__PURE__ */ jsx(InternalDialogHeader, { children: header }),
9966
9966
  /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-auto", children })
9967
9967
  ]
9968
9968
  }
@@ -9984,7 +9984,7 @@ function DialogFooter({ className, ...props }) {
9984
9984
  }
9985
9985
  function DialogTitle2({ className, ...props }) {
9986
9986
  return /* @__PURE__ */ jsx(
9987
- SheetPrimitive.Title,
9987
+ DialogPrimitive2.Title,
9988
9988
  {
9989
9989
  "data-slot": "dialog-title",
9990
9990
  className: cn("text-lg font-semibold leading-none", className),
@@ -9997,7 +9997,7 @@ function DialogDescription2({
9997
9997
  ...props
9998
9998
  }) {
9999
9999
  return /* @__PURE__ */ jsx(
10000
- SheetPrimitive.Description,
10000
+ DialogPrimitive2.Description,
10001
10001
  {
10002
10002
  "data-slot": "dialog-description",
10003
10003
  className: cn("text-sm text-muted-foreground", className),
@@ -10005,18 +10005,50 @@ function DialogDescription2({
10005
10005
  }
10006
10006
  );
10007
10007
  }
10008
+ function DialogCloseButton(props) {
10009
+ return /* @__PURE__ */ jsx(
10010
+ "button",
10011
+ {
10012
+ ...props,
10013
+ type: "button",
10014
+ "aria-label": "Close",
10015
+ className: cn("absolute top-4 right-4", props.className),
10016
+ style: {
10017
+ background: "none",
10018
+ border: "none",
10019
+ padding: 0,
10020
+ cursor: "pointer",
10021
+ ...props?.style
10022
+ },
10023
+ children: /* @__PURE__ */ jsx(X, { className: "w-6 h-6 text-white" })
10024
+ }
10025
+ );
10026
+ }
10027
+ function DialogClose({ ...props }) {
10028
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Close, { "data-slot": "dialog-close", ...props });
10029
+ }
10030
+ function DialogHeader2({ className, ...props }) {
10031
+ return /* @__PURE__ */ jsx(
10032
+ "div",
10033
+ {
10034
+ "data-slot": "dialog-header",
10035
+ className: cn("flex flex-col gap-2 text-center sm:text-left", className),
10036
+ ...props
10037
+ }
10038
+ );
10039
+ }
10008
10040
  function cn2(...inputs) {
10009
10041
  return twMerge(clsx(inputs));
10010
10042
  }
10011
10043
  function Dialog3({ ...props }) {
10012
- return /* @__PURE__ */ jsx(SheetPrimitive.Root, { "data-slot": "dialog", ...props });
10044
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Root, { "data-slot": "dialog", ...props });
10013
10045
  }
10014
10046
  function DialogPortal3({ ...props }) {
10015
- return /* @__PURE__ */ jsx(SheetPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
10047
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Portal, { "data-slot": "dialog-portal", ...props });
10016
10048
  }
10017
10049
  function DialogOverlay3({ className, ...props }) {
10018
10050
  return /* @__PURE__ */ jsx(
10019
- SheetPrimitive.Overlay,
10051
+ DialogPrimitive2.Overlay,
10020
10052
  {
10021
10053
  "data-slot": "dialog-overlay",
10022
10054
  className: cn2(
@@ -10036,7 +10068,7 @@ function DialogContent3({
10036
10068
  return /* @__PURE__ */ jsxs(DialogPortal3, { "data-slot": "dialog-portal", children: [
10037
10069
  /* @__PURE__ */ jsx(DialogOverlay3, { className: "z-99" }),
10038
10070
  /* @__PURE__ */ jsxs(
10039
- SheetPrimitive.Content,
10071
+ DialogPrimitive2.Content,
10040
10072
  {
10041
10073
  "data-slot": "dialog-content",
10042
10074
  className: cn2(
@@ -10047,7 +10079,7 @@ function DialogContent3({
10047
10079
  children: [
10048
10080
  children,
10049
10081
  showCloseButton && /* @__PURE__ */ jsxs(
10050
- SheetPrimitive.Close,
10082
+ DialogPrimitive2.Close,
10051
10083
  {
10052
10084
  "data-slot": "dialog-close",
10053
10085
  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",
@@ -10074,7 +10106,7 @@ function DialogHeader3({ className, ...props }) {
10074
10106
  }
10075
10107
  function DialogTitle3({ className, ...props }) {
10076
10108
  return /* @__PURE__ */ jsx(
10077
- SheetPrimitive.Title,
10109
+ DialogPrimitive2.Title,
10078
10110
  {
10079
10111
  "data-slot": "dialog-title",
10080
10112
  className: cn2("text-lg leading-none font-semibold", className),
@@ -10087,7 +10119,7 @@ function DialogDescription3({
10087
10119
  ...props
10088
10120
  }) {
10089
10121
  return /* @__PURE__ */ jsx(
10090
- SheetPrimitive.Description,
10122
+ DialogPrimitive2.Description,
10091
10123
  {
10092
10124
  "data-slot": "dialog-description",
10093
10125
  className: cn2("text-muted-foreground text-sm", className),
@@ -11360,9 +11392,12 @@ __export(ui_exports, {
11360
11392
  CollapsibleTrigger: () => CollapsibleTrigger2,
11361
11393
  DatePicker: () => DatePicker,
11362
11394
  Dialog: () => Dialog2,
11395
+ DialogClose: () => DialogClose,
11396
+ DialogCloseButton: () => DialogCloseButton,
11363
11397
  DialogContent: () => DialogContent2,
11364
11398
  DialogDescription: () => DialogDescription2,
11365
11399
  DialogFooter: () => DialogFooter,
11400
+ DialogHeader: () => DialogHeader2,
11366
11401
  DialogTitle: () => DialogTitle2,
11367
11402
  DialogTrigger: () => DialogTrigger,
11368
11403
  DropdownMenu: () => DropdownMenu,
@@ -11809,20 +11844,20 @@ function Separator3({
11809
11844
  );
11810
11845
  }
11811
11846
  function Sheet({ ...props }) {
11812
- return /* @__PURE__ */ jsx(SheetPrimitive.Root, { "data-slot": "sheet", ...props });
11847
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Root, { "data-slot": "sheet", ...props });
11813
11848
  }
11814
11849
  function SheetTrigger({ ...props }) {
11815
- return /* @__PURE__ */ jsx(SheetPrimitive.Trigger, { "data-slot": "sheet-trigger", ...props });
11850
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Trigger, { "data-slot": "sheet-trigger", ...props });
11816
11851
  }
11817
11852
  function SheetClose({ ...props }) {
11818
- return /* @__PURE__ */ jsx(SheetPrimitive.Close, { "data-slot": "sheet-close", ...props });
11853
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Close, { "data-slot": "sheet-close", ...props });
11819
11854
  }
11820
11855
  function SheetPortal({ ...props }) {
11821
- return /* @__PURE__ */ jsx(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
11856
+ return /* @__PURE__ */ jsx(DialogPrimitive2.Portal, { "data-slot": "sheet-portal", ...props });
11822
11857
  }
11823
11858
  function SheetOverlay({ className, ...props }) {
11824
11859
  return /* @__PURE__ */ jsx(
11825
- SheetPrimitive.Overlay,
11860
+ DialogPrimitive2.Overlay,
11826
11861
  {
11827
11862
  "data-slot": "sheet-overlay",
11828
11863
  className: cn(
@@ -11842,7 +11877,7 @@ function SheetContent({
11842
11877
  return /* @__PURE__ */ jsxs(SheetPortal, { children: [
11843
11878
  /* @__PURE__ */ jsx(SheetOverlay, {}),
11844
11879
  /* @__PURE__ */ jsxs(
11845
- SheetPrimitive.Content,
11880
+ DialogPrimitive2.Content,
11846
11881
  {
11847
11882
  "data-slot": "sheet-content",
11848
11883
  className: cn(
@@ -11856,7 +11891,7 @@ function SheetContent({
11856
11891
  ...props,
11857
11892
  children: [
11858
11893
  children,
11859
- /* @__PURE__ */ jsxs(SheetPrimitive.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: [
11894
+ /* @__PURE__ */ jsxs(DialogPrimitive2.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: [
11860
11895
  /* @__PURE__ */ jsx(XIcon, { className: "size-4" }),
11861
11896
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
11862
11897
  ] })
@@ -11880,7 +11915,7 @@ function SheetFooter({ className, ...props }) {
11880
11915
  }
11881
11916
  function SheetTitle({ className, ...props }) {
11882
11917
  return /* @__PURE__ */ jsx(
11883
- SheetPrimitive.Title,
11918
+ DialogPrimitive2.Title,
11884
11919
  {
11885
11920
  "data-slot": "sheet-title",
11886
11921
  className: cn("text-foreground font-semibold", className),
@@ -11893,7 +11928,7 @@ function SheetDescription({
11893
11928
  ...props
11894
11929
  }) {
11895
11930
  return /* @__PURE__ */ jsx(
11896
- SheetPrimitive.Description,
11931
+ DialogPrimitive2.Description,
11897
11932
  {
11898
11933
  "data-slot": "sheet-description",
11899
11934
  className: cn("text-muted-foreground text-sm", className),
@@ -17090,60 +17125,11 @@ var Input2 = React.forwardRef(
17090
17125
  }
17091
17126
  );
17092
17127
  Input2.displayName = "Input";
17093
- function useFillDecimalOnBlur({
17094
- enabled,
17095
- decimalScale,
17096
- value,
17097
- defaultValue
17098
- }) {
17099
- const blurScale = enabled ? decimalScale ?? 2 : void 0;
17100
- const isUserEditingRef = React.useRef(false);
17101
- const [formattedValue, setFormattedValue] = React.useState(() => {
17102
- if (!enabled) return void 0;
17103
- const scale = decimalScale ?? 2;
17104
- const initial = parseToNumber(value) ?? parseToNumber(defaultValue);
17105
- if (initial !== void 0) return truncateToFixed(initial, scale);
17106
- return void 0;
17107
- });
17108
- React.useEffect(() => {
17109
- if (!enabled) return;
17110
- const parsed = parseToNumber(value);
17111
- if (parsed !== void 0) {
17112
- if (blurScale !== void 0 && !isUserEditingRef.current) {
17113
- setFormattedValue(truncateToFixed(parsed, blurScale));
17114
- }
17115
- } else if (value === null || value === "") {
17116
- setFormattedValue(void 0);
17117
- }
17118
- }, [value, enabled, blurScale]);
17119
- const onEdit = React.useCallback(
17120
- (values, sourceInfo) => {
17121
- if (!enabled || sourceInfo.source !== "event") return;
17122
- isUserEditingRef.current = true;
17123
- setFormattedValue(values.value || void 0);
17124
- },
17125
- [enabled]
17126
- );
17127
- const onBlur = React.useCallback(
17128
- (truncatedStr) => {
17129
- isUserEditingRef.current = false;
17130
- if (!enabled || blurScale === void 0) return;
17131
- setFormattedValue(truncatedStr);
17132
- },
17133
- [enabled, blurScale]
17134
- );
17135
- const resetEditing = React.useCallback(() => {
17136
- isUserEditingRef.current = false;
17137
- }, []);
17138
- return { formattedValue, blurScale, onEdit, onBlur, resetEditing, setFormattedValue };
17139
- }
17140
17128
  function useStepper({ value, step, min, max, disabled, onStep }) {
17141
- const [changed, setChanged] = React.useState(false);
17142
17129
  const changeValue = React.useCallback(
17143
17130
  (delta) => {
17144
17131
  const current = value ?? 0;
17145
17132
  const clamped = clamp(current + delta, min, max);
17146
- setChanged(true);
17147
17133
  onStep(clamped);
17148
17134
  },
17149
17135
  [value, max, min, onStep]
@@ -17152,7 +17138,7 @@ function useStepper({ value, step, min, max, disabled, onStep }) {
17152
17138
  const decrement = React.useCallback(() => changeValue(-step), [changeValue, step]);
17153
17139
  const isIncrementDisabled = disabled || max !== void 0 && (value ?? 0) >= max;
17154
17140
  const isDecrementDisabled = disabled || min !== void 0 && (value ?? 0) <= min;
17155
- return { changed, increment, decrement, isIncrementDisabled, isDecrementDisabled };
17141
+ return { increment, decrement, isIncrementDisabled, isDecrementDisabled };
17156
17142
  }
17157
17143
  var InputNumber = ({
17158
17144
  customInputProps,
@@ -17176,26 +17162,37 @@ var InputNumber = ({
17176
17162
  ...props
17177
17163
  }) => {
17178
17164
  const blurFormatEnabled = fillDecimalOnBlur || truncateDecimalOnBlur;
17179
- const [internalValue, setInternalValue] = React.useState(
17165
+ const blurScale = blurFormatEnabled ? decimalScaleProp ?? 2 : void 0;
17166
+ const [displayOverride, setDisplayOverride] = React.useState(() => {
17167
+ if (!blurFormatEnabled) return void 0;
17168
+ const scale = decimalScaleProp ?? 2;
17169
+ const initial = parseToNumber(value) ?? parseToNumber(defaultValue);
17170
+ if (initial !== void 0) return truncateToFixed(initial, scale);
17171
+ return void 0;
17172
+ });
17173
+ const [numericValue, setNumericValue] = React.useState(
17180
17174
  () => parseToNumber(value) ?? parseToNumber(defaultValue)
17181
17175
  );
17182
- const internalValueRef = React.useRef(internalValue);
17183
- const rawValueRef = React.useRef("");
17184
- const isBlurClampedRef = React.useRef(false);
17185
- React.useEffect(() => {
17186
- const parsed = parseToNumber(value);
17187
- if (parsed !== void 0) {
17188
- internalValueRef.current = parsed;
17189
- setInternalValue(parsed);
17190
- }
17191
- isBlurClampedRef.current = false;
17192
- }, [value]);
17193
- const autoFormat = useFillDecimalOnBlur({
17194
- enabled: blurFormatEnabled,
17195
- decimalScale: decimalScaleProp,
17196
- value,
17197
- defaultValue
17198
- });
17176
+ const isEditingRef = React.useRef(false);
17177
+ const rawRef = React.useRef("");
17178
+ const prevValueRef = React.useRef(value);
17179
+ if (value !== prevValueRef.current) {
17180
+ prevValueRef.current = value;
17181
+ if (value === "" || value === null) {
17182
+ if (displayOverride !== void 0) setDisplayOverride(void 0);
17183
+ if (numericValue !== void 0) setNumericValue(void 0);
17184
+ isEditingRef.current = false;
17185
+ } else if (!isEditingRef.current) {
17186
+ const num = parseToNumber(value);
17187
+ if (num !== numericValue) setNumericValue(num);
17188
+ if (blurFormatEnabled && num !== void 0) {
17189
+ const formatted = truncateToFixed(num, blurScale);
17190
+ if (formatted !== displayOverride) setDisplayOverride(formatted);
17191
+ } else {
17192
+ if (displayOverride !== void 0) setDisplayOverride(void 0);
17193
+ }
17194
+ }
17195
+ }
17199
17196
  const isAllowed = React.useMemo(() => {
17200
17197
  if (maxIntegerDigits === void 0 && !isAllowedProp) return void 0;
17201
17198
  return (values) => {
@@ -17208,80 +17205,73 @@ var InputNumber = ({
17208
17205
  return isAllowedProp ? isAllowedProp(values) : true;
17209
17206
  };
17210
17207
  }, [maxIntegerDigits, isAllowedProp]);
17211
- const notifyChange = React.useCallback(
17212
- (newValue, event) => {
17213
- internalValueRef.current = newValue;
17214
- setInternalValue(newValue);
17215
- onStepChange?.(newValue);
17216
- onValueChange?.(
17217
- { floatValue: newValue, formattedValue: String(newValue), value: String(newValue) },
17218
- createSourceInfo(event)
17219
- );
17220
- },
17221
- [onStepChange, onValueChange]
17222
- );
17223
17208
  const stepper = useStepper({
17224
- value: internalValue,
17209
+ value: numericValue,
17225
17210
  step,
17226
17211
  min,
17227
17212
  max,
17228
17213
  disabled,
17229
17214
  onStep: React.useCallback(
17230
17215
  (clamped) => {
17231
- setInternalValue(clamped);
17232
- if (autoFormat.blurScale !== void 0) {
17233
- autoFormat.setFormattedValue(truncateToFixed(clamped, autoFormat.blurScale));
17234
- }
17235
- notifyChange(clamped);
17216
+ setNumericValue(clamped);
17217
+ const formatted = blurScale !== void 0 ? truncateToFixed(clamped, blurScale) : String(clamped);
17218
+ setDisplayOverride(formatted);
17219
+ rawRef.current = String(clamped);
17220
+ onStepChange?.(clamped);
17221
+ onValueChange?.(
17222
+ { floatValue: clamped, formattedValue: formatted, value: String(clamped) },
17223
+ createSourceInfo()
17224
+ );
17236
17225
  },
17237
- [autoFormat, notifyChange]
17226
+ [blurScale, onStepChange, onValueChange]
17238
17227
  )
17239
17228
  });
17240
17229
  const handleValueChange = React.useCallback(
17241
17230
  (values, sourceInfo) => {
17242
- internalValueRef.current = values.floatValue;
17243
- rawValueRef.current = values.value;
17244
- setInternalValue(values.floatValue);
17245
17231
  if (sourceInfo.source === "event") {
17246
- isBlurClampedRef.current = false;
17232
+ isEditingRef.current = true;
17233
+ setDisplayOverride(values.value);
17247
17234
  }
17235
+ setNumericValue(values.floatValue);
17236
+ rawRef.current = values.value;
17248
17237
  onValueChange?.(values, sourceInfo);
17249
17238
  if (values.floatValue !== void 0) onStepChange?.(values.floatValue);
17250
- autoFormat.onEdit(values, sourceInfo);
17251
17239
  },
17252
- [onValueChange, onStepChange, autoFormat]
17240
+ [onValueChange, onStepChange]
17253
17241
  );
17254
17242
  const handleBlur = React.useCallback(
17255
17243
  (event) => {
17244
+ isEditingRef.current = false;
17256
17245
  onBlur?.(event);
17257
- const latestValue = internalValueRef.current;
17258
- if (latestValue === void 0) {
17259
- autoFormat.resetEditing();
17246
+ const currentNumeric = numericValue;
17247
+ if (currentNumeric === void 0) {
17248
+ setDisplayOverride("");
17260
17249
  return;
17261
17250
  }
17262
- const clamped = clamp(latestValue, min, max);
17263
- const wasClamped = clamped !== latestValue;
17251
+ const clamped = clamp(currentNumeric, min, max);
17252
+ const wasClamped = clamped !== currentNumeric;
17264
17253
  if (wasClamped) {
17265
- isBlurClampedRef.current = true;
17266
- internalValueRef.current = clamped;
17267
- rawValueRef.current = String(clamped);
17268
- setInternalValue(clamped);
17254
+ setNumericValue(clamped);
17255
+ rawRef.current = String(clamped);
17269
17256
  onValueChange?.(
17270
17257
  { floatValue: clamped, formattedValue: String(clamped), value: String(clamped) },
17271
17258
  createSourceInfo()
17272
17259
  );
17273
17260
  onStepChange?.(clamped);
17274
17261
  }
17275
- if (blurFormatEnabled && autoFormat.blurScale !== void 0) {
17276
- const rawStr = wasClamped ? String(clamped) : rawValueRef.current || String(clamped);
17277
- autoFormat.onBlur(truncateStringToFixed(rawStr, autoFormat.blurScale));
17262
+ if (blurFormatEnabled && blurScale !== void 0) {
17263
+ const rawStr = wasClamped ? String(clamped) : rawRef.current || String(clamped);
17264
+ setDisplayOverride(truncateStringToFixed(rawStr, blurScale));
17265
+ } else if (wasClamped) {
17266
+ setDisplayOverride(String(clamped));
17278
17267
  } else {
17279
- autoFormat.resetEditing();
17268
+ setDisplayOverride(void 0);
17280
17269
  }
17281
17270
  },
17282
- [onBlur, blurFormatEnabled, autoFormat, min, max, onValueChange, onStepChange]
17271
+ [onBlur, blurFormatEnabled, blurScale, numericValue, min, max, onValueChange, onStepChange]
17283
17272
  );
17284
- const effectiveValue = autoFormat.formattedValue !== void 0 ? autoFormat.formattedValue : isBlurClampedRef.current || stepper.changed || blurFormatEnabled ? internalValue : value;
17273
+ const isValueExplicitlyEmpty = value === "" || value === null;
17274
+ const effectiveValue = isValueExplicitlyEmpty ? "" : displayOverride !== void 0 ? displayOverride : value;
17285
17275
  const buttonClass = cn(
17286
17276
  "flex items-center justify-center h-3 w-5 transition-colors outline-none",
17287
17277
  "text-neutral-400 hover:text-neutral-600 active:text-neutral-900",
@@ -17297,7 +17287,7 @@ var InputNumber = ({
17297
17287
  onBlur: handleBlur,
17298
17288
  ...isAllowed && { isAllowed },
17299
17289
  ...truncateDecimalOnBlur ? {} : fillDecimalOnBlur ? { decimalScale: decimalScaleProp } : { decimalScale: decimalScaleProp, fixedDecimalScale: fixedDecimalScaleProp },
17300
- ...autoFormat.formattedValue !== void 0 && { valueIsNumericString: true },
17290
+ ...displayOverride !== void 0 && { valueIsNumericString: true },
17301
17291
  ...props,
17302
17292
  disabled,
17303
17293
  invalid,
@@ -17547,6 +17537,104 @@ var ActionDropdown = ({
17547
17537
  ] });
17548
17538
  };
17549
17539
  var dropdownMenu_default = ActionDropdown;
17540
+ var sizeMap = {
17541
+ sm: "h-1",
17542
+ md: "h-2",
17543
+ lg: "h-3"
17544
+ };
17545
+ var resolveSize = (size) => typeof size === "number" ? { style: { height: size } } : { className: sizeMap[size] };
17546
+ var linecapMap = {
17547
+ round: "rounded-full",
17548
+ butt: "rounded-none",
17549
+ square: "rounded-none"
17550
+ };
17551
+ var alignClassMap = {
17552
+ start: "justify-start",
17553
+ center: "justify-center",
17554
+ end: "justify-end"
17555
+ };
17556
+ var ProgressBar = ({
17557
+ percent = 0,
17558
+ size = "md",
17559
+ showInfo = true,
17560
+ format: format6,
17561
+ precision = 0,
17562
+ success,
17563
+ strokeLinecap = "round",
17564
+ percentPosition = { align: "end", type: "outer" },
17565
+ barClassName,
17566
+ trailClassName,
17567
+ className
17568
+ }) => {
17569
+ const clamped = useMemo(() => Math.min(100, Math.max(0, percent)), [percent]);
17570
+ const displayValue = useMemo(() => parseFloat(clamped.toFixed(precision)), [clamped, precision]);
17571
+ const successClamped = useMemo(
17572
+ () => success ? Math.min(100, Math.max(0, success.percent)) : 0,
17573
+ [success]
17574
+ );
17575
+ const linecapClass = linecapMap[strokeLinecap];
17576
+ const posType = percentPosition?.type ?? "outer";
17577
+ const posAlign = percentPosition?.align ?? "end";
17578
+ const isInner = posType === "inner";
17579
+ const { className: sizeClass, style: sizeStyle } = resolveSize(size);
17580
+ const info = useMemo(() => {
17581
+ if (!showInfo) return null;
17582
+ if (format6) return format6(displayValue);
17583
+ return `${displayValue}%`;
17584
+ }, [showInfo, format6, displayValue]);
17585
+ return /* @__PURE__ */ jsxs(
17586
+ "div",
17587
+ {
17588
+ className: cn(
17589
+ "flex w-full items-center gap-2 min-w-0",
17590
+ posAlign === "start" && !isInner && "flex-row-reverse",
17591
+ className
17592
+ ),
17593
+ children: [
17594
+ /* @__PURE__ */ jsxs(
17595
+ "div",
17596
+ {
17597
+ className: cn(
17598
+ "relative flex-1 overflow-hidden",
17599
+ trailClassName ?? "bg-muted",
17600
+ linecapClass,
17601
+ isInner ? "min-h-4" : sizeClass
17602
+ ),
17603
+ style: isInner ? void 0 : sizeStyle,
17604
+ children: [
17605
+ success && /* @__PURE__ */ jsx(
17606
+ "div",
17607
+ {
17608
+ className: cn(
17609
+ "absolute left-0 top-0 h-full transition-all duration-300",
17610
+ success.className ?? "bg-sus-green-1",
17611
+ linecapClass
17612
+ ),
17613
+ style: { width: `${successClamped}%` }
17614
+ }
17615
+ ),
17616
+ /* @__PURE__ */ jsx(
17617
+ "div",
17618
+ {
17619
+ className: cn(
17620
+ "relative transition-all duration-300",
17621
+ barClassName ?? "bg-sus-primary-green-9",
17622
+ linecapClass,
17623
+ isInner ? cn("min-h-4 flex items-center px-1", alignClassMap[posAlign]) : cn("h-full", sizeClass)
17624
+ ),
17625
+ style: { width: `${clamped}%`, ...!isInner ? sizeStyle : void 0 },
17626
+ children: isInner && info && /* @__PURE__ */ jsx("span", { className: "text-[10px] leading-none text-primary-foreground whitespace-nowrap tabular-nums", children: info })
17627
+ }
17628
+ )
17629
+ ]
17630
+ }
17631
+ ),
17632
+ !isInner && info && /* @__PURE__ */ jsx("span", { className: "text-xs shrink-0 tabular-nums", children: info })
17633
+ ]
17634
+ }
17635
+ );
17636
+ };
17637
+ var ProgressBar_default = memo(ProgressBar);
17550
17638
  var TruncatedMouseEnterDiv = ({
17551
17639
  value,
17552
17640
  className,
@@ -18426,6 +18514,6 @@ function InputMentionInner({
18426
18514
  }
18427
18515
  var InputMention = forwardRef(InputMentionInner);
18428
18516
 
18429
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, dropdownMenu_default as ActionDropdown, ActionMenu, AdministrationIcon, AdvanceSearch_default as AdvanceSearch, AnalyticsIcon, ApplicationLogIcon, ArrowIcon, AuditFooter, BookmarkIcon, BriefcaseBusinessIcon, BuildingIcon, Button, SuiCalendarIcon2 as Calendar2Icon, CalendarDaysIcon, CardIcon, Carousel, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, CarouselThumbnails, Checkbox, CircleUserIcon, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Combobox_default as Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CopyUserRightsIcon, CropperModal, CropperModalError, CustomActionStatusIcon, CustomFieldIcon, DIALOG_ALERT_I18N_SUBNAMESPACE, DIALOG_ALERT_TEMPLATES, DashboardIcon, DataEntryIcon, DataTable_default as DataTable, DatePicker2 as DatePicker, DecreaseIcon, Dialog2 as Dialog, DialogAlert, DialogAlertProvider, DialogContent2 as DialogContent, DialogDescription2 as DialogDescription, DialogFooter, DialogTitle2 as DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EllipsisBoxIcon, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, FactoryIcon, FileCogIcon, FileSpreadsheet, FileTextIcon, FiltersIcon, FolderIcon, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormulaEditor, GridSettingsModal_default as GridSettingsModal, HamburgerMenuIcon, HandymanIcon, header_default as Header, HeaderCell_default as HeaderCell, HelpIcon, HomeIcon, HomePlusIcon, Image2 as Image, ImagePlaceholderIcon, InformationIcon, Input, InputMention, InputNumber_default as InputNumber, Label2 as Label, LoadingPage, LookupSelect, MailIcon, MainListContainer_default as MainListContainer, ManIcon, ManagementIcon, MenuIcon, MessageIcon, MessageIconInverse, MessageSquareIcon, MonthPicker2 as MonthPicker, navbar_default as Navbar, NotFoundIcon, OutlineArrowIcon, PlusIcon, PlusSearchIcon, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PowerIcon, PreventPageLeave_default as PreventPageLeave, QuestionIcon, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, RightPanelContainer_default as RightPanelContainer, RoleIcon, SearchIcon, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, SetupIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, SuiCalendarIcon, SuiCalendarIcon2, SuiCheckIcon, SuiDotsVerticalIcon, SuiEmptyDataIcon, SuiExpandIcon, SuiFilterIcon, SuiSettingIcon, SuiTriangleDownIcon, SuiWarningIcon, Switch, TabSelect, Table, TableBody, TableCaption, TableCell, TableContainer, TableFooter, TableHead, TableHeader, TableOfContents, TableRow, TagListViewIcon, TextArea, TimePicker, ToolBoxIcon, Tooltip2 as Tooltip, TooltipArrow, TooltipContent2 as TooltipContent, TooltipProvider2 as TooltipProvider, TooltipTrigger2 as TooltipTrigger, TransferUserRightsIcon, TrashIcon, truncated_default as Truncated, truncatedMouseEnterDiv_default as TruncatedMouseEnterDiv, ui_exports as UI, UserActiveIcon, UserAloneIcon, UserFriendIcon, UserGroupIcon, UserIcon, UserInactiveIcon, UserNameIcon, UserProtectIcon, UsersIcon, VirtualizedCommand_default as VirtualizedCommand, WorkFlowIcon, booleanToSelectValue, buildPrefixMap, buttonVariants, cn, compareAlphanumeric, debounce, defaultOperatorShortcuts, defaultOperators, formatISODate, getDialogAlertControls, inputVariants, isDefined, isEmptyObject, isValidParentheses, mapTokensToOutput, parseFormula, parseFormulaToToken, resetVisibleTableState, selectValueToBoolean, spinnerVariants, splitOperators, stripNullishObject, throttle, tokenizeFormulaString, useBindRef_default as useBindRef, useCarousel, useControllableState_default as useControllableState, useDraftGuardStore, useFormField, useGridSettingsStore_default as useGridSettingsStore, useHover_default as useHover, useIntersectionObserver_default as useIntersectionObserver, useIsomorphicLayoutEffect, useMediaQuery_default as useMediaQuery, usePreventPageLeave_default as usePreventPageLeave, usePreventPageLeaveStore_default as usePreventPageLeaveStore, useSafeBlocker, useScreenSize_default as useScreenSize, useSidebar, useTruncated_default as useTruncated, validateTokenPrefixes };
18517
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, dropdownMenu_default as ActionDropdown, ActionMenu, AdministrationIcon, AdvanceSearch_default as AdvanceSearch, AnalyticsIcon, ApplicationLogIcon, ArrowIcon, AuditFooter, BookmarkIcon, BriefcaseBusinessIcon, BuildingIcon, Button, SuiCalendarIcon2 as Calendar2Icon, CalendarDaysIcon, CardIcon, Carousel, CarouselContent, CarouselDots, CarouselItem, CarouselNext, CarouselPrevious, CarouselThumbnails, Checkbox, CircleUserIcon, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, Combobox_default as Combobox, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, CopyUserRightsIcon, CropperModal, CropperModalError, CustomActionStatusIcon, CustomFieldIcon, DIALOG_ALERT_I18N_SUBNAMESPACE, DIALOG_ALERT_TEMPLATES, DashboardIcon, DataEntryIcon, DataTable_default as DataTable, DatePicker2 as DatePicker, DecreaseIcon, Dialog2 as Dialog, DialogAlert, DialogAlertProvider, DialogClose, DialogCloseButton, DialogContent2 as DialogContent, DialogDescription2 as DialogDescription, DialogFooter, DialogHeader2 as DialogHeader, DialogTitle2 as DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EllipsisBoxIcon, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, FactoryIcon, FileCogIcon, FileSpreadsheet, FileTextIcon, FiltersIcon, FolderIcon, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormulaEditor, GridSettingsModal_default as GridSettingsModal, HamburgerMenuIcon, HandymanIcon, header_default as Header, HeaderCell_default as HeaderCell, HelpIcon, HomeIcon, HomePlusIcon, Image2 as Image, ImagePlaceholderIcon, InformationIcon, Input, InputMention, InputNumber_default as InputNumber, Label2 as Label, LoadingPage, LookupSelect, MailIcon, MainListContainer_default as MainListContainer, ManIcon, ManagementIcon, MenuIcon, MessageIcon, MessageIconInverse, MessageSquareIcon, MonthPicker2 as MonthPicker, navbar_default as Navbar, NotFoundIcon, OutlineArrowIcon, PlusIcon, PlusSearchIcon, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PowerIcon, PreventPageLeave_default as PreventPageLeave, ProgressBar_default as ProgressBar, QuestionIcon, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, RightPanelContainer_default as RightPanelContainer, RoleIcon, SearchIcon, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator3 as Separator, SetupIcon, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, SuiCalendarIcon, SuiCalendarIcon2, SuiCheckIcon, SuiDotsVerticalIcon, SuiEmptyDataIcon, SuiExpandIcon, SuiFilterIcon, SuiSettingIcon, SuiTriangleDownIcon, SuiWarningIcon, Switch, TabSelect, Table, TableBody, TableCaption, TableCell, TableContainer, TableFooter, TableHead, TableHeader, TableOfContents, TableRow, TagListViewIcon, TextArea, TimePicker, ToolBoxIcon, Tooltip2 as Tooltip, TooltipArrow, TooltipContent2 as TooltipContent, TooltipProvider2 as TooltipProvider, TooltipTrigger2 as TooltipTrigger, TransferUserRightsIcon, TrashIcon, truncated_default as Truncated, truncatedMouseEnterDiv_default as TruncatedMouseEnterDiv, ui_exports as UI, UserActiveIcon, UserAloneIcon, UserFriendIcon, UserGroupIcon, UserIcon, UserInactiveIcon, UserNameIcon, UserProtectIcon, UsersIcon, VirtualizedCommand_default as VirtualizedCommand, WorkFlowIcon, booleanToSelectValue, buildPrefixMap, buttonVariants, cn, compareAlphanumeric, debounce, defaultOperatorShortcuts, defaultOperators, formatISODate, getDialogAlertControls, inputVariants, isDefined, isEmptyObject, isValidParentheses, mapTokensToOutput, parseFormula, parseFormulaToToken, resetVisibleTableState, selectValueToBoolean, spinnerVariants, splitOperators, stripNullishObject, throttle, tokenizeFormulaString, useBindRef_default as useBindRef, useCarousel, useControllableState_default as useControllableState, useDraftGuardStore, useFormField, useGridSettingsStore_default as useGridSettingsStore, useHover_default as useHover, useIntersectionObserver_default as useIntersectionObserver, useIsomorphicLayoutEffect, useMediaQuery_default as useMediaQuery, usePreventPageLeave_default as usePreventPageLeave, usePreventPageLeaveStore_default as usePreventPageLeaveStore, useSafeBlocker, useScreenSize_default as useScreenSize, useSidebar, useTruncated_default as useTruncated, validateTokenPrefixes };
18430
18518
  //# sourceMappingURL=index.mjs.map
18431
18519
  //# sourceMappingURL=index.mjs.map