sellmate-design-system-react 9.0.0-beta.43 → 9.0.0-beta.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +41 -1
- package/dist/components/SDraggableList/README.md +3 -3
- package/dist/components/SDraggableList/SDraggableList.d.ts +7 -3
- package/dist/components/SNumberInput/README.md +3 -2
- package/dist/components/SNumberInput/SNumberInput.d.ts +22 -2
- package/dist/components/STable/README.md +1 -1
- package/dist/components/STable/STable.d.ts +1 -1
- package/dist/index.cjs +46 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +46 -10
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +48 -7
- package/dist/llms.txt +41 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4265,6 +4265,13 @@ function SDraggableProvider({ children }) {
|
|
|
4265
4265
|
function SDraggableGroup({ children, onMove, ...rest }) {
|
|
4266
4266
|
return /* @__PURE__ */ jsx(SDraggableProviderInternal, { defaultGroup: "__legacy", legacyOnMove: onMove, children: /* @__PURE__ */ jsx("div", { ...rest, children }) });
|
|
4267
4267
|
}
|
|
4268
|
+
var INTERACTIVE_DESCENDANT_SELECTOR = 'input,textarea,select,button,a[href],label,[contenteditable="true"],[role="button"],[role="checkbox"],[role="radio"],[role="switch"],[role="tab"],[role="menuitem"]';
|
|
4269
|
+
function isFromInteractiveDescendant(event) {
|
|
4270
|
+
const target = event.target;
|
|
4271
|
+
if (target == null || target === event.currentTarget) return false;
|
|
4272
|
+
const interactive = target.closest?.(INTERACTIVE_DESCENDANT_SELECTOR);
|
|
4273
|
+
return interactive != null && interactive !== event.currentTarget;
|
|
4274
|
+
}
|
|
4268
4275
|
function reorder(items, fromIndex, toIndex) {
|
|
4269
4276
|
if (fromIndex === toIndex) return items;
|
|
4270
4277
|
const nextItems = [...items];
|
|
@@ -4348,6 +4355,7 @@ function SDraggableListInner({
|
|
|
4348
4355
|
const listRef = useRef(null);
|
|
4349
4356
|
const fromIndexRef = useRef(null);
|
|
4350
4357
|
const currentSelectedKey = selectedKey ?? internalSelectedKey;
|
|
4358
|
+
const selectable = selectedKey !== void 0 || defaultSelectedKey !== void 0 || onSelectedKeyChange != null;
|
|
4351
4359
|
const usesDepth = getDepth != null;
|
|
4352
4360
|
const depthEnabled = usesDepth && !gap;
|
|
4353
4361
|
const groupDragging = dragContext?.dragging;
|
|
@@ -4507,20 +4515,28 @@ function SDraggableListInner({
|
|
|
4507
4515
|
setInternalSelectedKey(itemKey);
|
|
4508
4516
|
onSelectedKeyChange?.(itemKey);
|
|
4509
4517
|
};
|
|
4518
|
+
const handleItemClick = (event) => {
|
|
4519
|
+
if (isFromInteractiveDescendant(event)) return;
|
|
4520
|
+
selectItem();
|
|
4521
|
+
};
|
|
4510
4522
|
const handleItemKeyDown = (event) => {
|
|
4523
|
+
if (event.target !== event.currentTarget) return;
|
|
4511
4524
|
if (event.key !== "Enter" && event.key !== " ") return;
|
|
4512
4525
|
event.preventDefault();
|
|
4513
4526
|
selectItem();
|
|
4514
4527
|
};
|
|
4528
|
+
const selectionProps = selectable ? {
|
|
4529
|
+
role: "button",
|
|
4530
|
+
tabIndex: disabled ? -1 : 0,
|
|
4531
|
+
onClick: handleItemClick,
|
|
4532
|
+
onKeyDown: handleItemKeyDown
|
|
4533
|
+
} : {};
|
|
4515
4534
|
return /* @__PURE__ */ jsxs(
|
|
4516
4535
|
"div",
|
|
4517
4536
|
{
|
|
4518
4537
|
"data-draggable-list-item": true,
|
|
4519
|
-
role: "button",
|
|
4520
|
-
tabIndex: disabled ? -1 : 0,
|
|
4521
4538
|
"aria-disabled": disabled || void 0,
|
|
4522
|
-
|
|
4523
|
-
onKeyDown: handleItemKeyDown,
|
|
4539
|
+
...selectionProps,
|
|
4524
4540
|
className: "relative",
|
|
4525
4541
|
children: [
|
|
4526
4542
|
showBefore && /* @__PURE__ */ jsx(
|
|
@@ -14656,6 +14672,16 @@ var formatInputWithCommas = (value) => {
|
|
|
14656
14672
|
const formattedInt = addCommas(intPart === "" ? "0" : intPart);
|
|
14657
14673
|
return `${isNeg ? "-" : ""}${formattedInt}${hasDecimal ? `.${decPart}` : ""}`;
|
|
14658
14674
|
};
|
|
14675
|
+
var getRangeError = (value, min, max) => {
|
|
14676
|
+
if (value === null) return "";
|
|
14677
|
+
const belowMin = value < min;
|
|
14678
|
+
const aboveMax = value > max;
|
|
14679
|
+
if (!belowMin && !aboveMax) return "";
|
|
14680
|
+
if (Number.isFinite(min) && Number.isFinite(max)) {
|
|
14681
|
+
return `${formatWithCommas(min)}~${formatWithCommas(max)} \uC0AC\uC774\uB85C \uC785\uB825\uD574 \uC8FC\uC138\uC694.`;
|
|
14682
|
+
}
|
|
14683
|
+
return belowMin ? `${formatWithCommas(min)} \uC774\uC0C1\uC73C\uB85C \uC785\uB825\uD574 \uC8FC\uC138\uC694.` : `${formatWithCommas(max)} \uC774\uD558\uB85C \uC785\uB825\uD574 \uC8FC\uC138\uC694.`;
|
|
14684
|
+
};
|
|
14659
14685
|
var getDecimalLimit = (allowDecimal, maxDecimalLength) => {
|
|
14660
14686
|
if (!allowDecimal || maxDecimalLength === void 0 || !Number.isFinite(maxDecimalLength)) {
|
|
14661
14687
|
return void 0;
|
|
@@ -14686,6 +14712,7 @@ var SNumberInput = /* @__PURE__ */ forwardRef(function SNumberInput2({
|
|
|
14686
14712
|
min = Number.NEGATIVE_INFINITY,
|
|
14687
14713
|
max = Number.POSITIVE_INFINITY,
|
|
14688
14714
|
step = 1,
|
|
14715
|
+
clampOnBlur = false,
|
|
14689
14716
|
showButton = false,
|
|
14690
14717
|
allowDecimal = false,
|
|
14691
14718
|
maxDecimalLength,
|
|
@@ -14725,6 +14752,7 @@ var SNumberInput = /* @__PURE__ */ forwardRef(function SNumberInput2({
|
|
|
14725
14752
|
const numValue = applyDecimalLimit(toNumber(value), decimalLimit);
|
|
14726
14753
|
const [display, setDisplay] = useState(() => formatWithCommas(numValue));
|
|
14727
14754
|
const [ruleError, setRuleError] = useState("");
|
|
14755
|
+
const [rangeError, setRangeError] = useState("");
|
|
14728
14756
|
const innerRef = useRef(null);
|
|
14729
14757
|
const valueTooltip = useTruncatedValueTooltip({ enabled: readOnly && !disabled, text: display });
|
|
14730
14758
|
const setRefs2 = (el) => {
|
|
@@ -14742,12 +14770,19 @@ var SNumberInput = /* @__PURE__ */ forwardRef(function SNumberInput2({
|
|
|
14742
14770
|
validate: () => {
|
|
14743
14771
|
const msg = runRules(numValue, rules);
|
|
14744
14772
|
setRuleError(msg);
|
|
14745
|
-
|
|
14773
|
+
const range = clampOnBlur ? "" : getRangeError(numValue, min, max);
|
|
14774
|
+
setRangeError(range);
|
|
14775
|
+
return msg === "" && range === "";
|
|
14746
14776
|
},
|
|
14747
|
-
resetValidation: () =>
|
|
14777
|
+
resetValidation: () => {
|
|
14778
|
+
setRuleError("");
|
|
14779
|
+
setRangeError("");
|
|
14780
|
+
}
|
|
14748
14781
|
});
|
|
14749
|
-
const
|
|
14750
|
-
const
|
|
14782
|
+
const autoError = ruleError !== "" ? ruleError : rangeError;
|
|
14783
|
+
const resolvedError = error || autoError !== "";
|
|
14784
|
+
const resolvedStatus = status ?? (autoError !== "" ? "error" : void 0);
|
|
14785
|
+
const resolvedErrorMessage = ruleError !== "" ? ruleError : (errorMessage ?? "") !== "" ? errorMessage : rangeError;
|
|
14751
14786
|
const restoreCaret = (nextDisplay, logicalCaret) => {
|
|
14752
14787
|
const input = innerRef.current;
|
|
14753
14788
|
if (logicalCaret === void 0 || !input || document.activeElement !== input) return;
|
|
@@ -14879,7 +14914,7 @@ var SNumberInput = /* @__PURE__ */ forwardRef(function SNumberInput2({
|
|
|
14879
14914
|
status: resolvedStatus,
|
|
14880
14915
|
focused,
|
|
14881
14916
|
hovered,
|
|
14882
|
-
errorMessage:
|
|
14917
|
+
errorMessage: resolvedErrorMessage,
|
|
14883
14918
|
width,
|
|
14884
14919
|
disabled,
|
|
14885
14920
|
readOnly,
|
|
@@ -14925,10 +14960,11 @@ var SNumberInput = /* @__PURE__ */ forwardRef(function SNumberInput2({
|
|
|
14925
14960
|
onBlur: (e) => {
|
|
14926
14961
|
const cleaned = display.replace(/,/g, "");
|
|
14927
14962
|
const n = toNumber(cleaned);
|
|
14928
|
-
const clamped = n === null ?
|
|
14963
|
+
const clamped = !clampOnBlur || n === null ? n : Math.min(Math.max(n, min), max);
|
|
14929
14964
|
if (clamped !== n) emit3(clamped);
|
|
14930
14965
|
else setDisplay(n === null ? "" : formatInputWithCommas(cleaned));
|
|
14931
14966
|
if (rules && rules.length > 0) setRuleError(runRules(clamped, rules));
|
|
14967
|
+
setRangeError(clampOnBlur ? "" : getRangeError(clamped, min, max));
|
|
14932
14968
|
onBlur?.(e);
|
|
14933
14969
|
},
|
|
14934
14970
|
className: cn(
|