@northlight/ui 2.32.3 → 2.32.5
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/umd/northlight.cjs
CHANGED
|
@@ -4819,6 +4819,11 @@
|
|
|
4819
4819
|
bgColor: color["destructive-alt"],
|
|
4820
4820
|
[$arrowBg.variable]: color["destructive-alt"]
|
|
4821
4821
|
}),
|
|
4822
|
+
error: ({ theme: { colors: color } }) => ({
|
|
4823
|
+
color: "text.over.error",
|
|
4824
|
+
bgColor: color["destructive-alt"],
|
|
4825
|
+
[$arrowBg.variable]: color["destructive-alt"]
|
|
4826
|
+
}),
|
|
4822
4827
|
ai: ({ theme: { colors: color } }) => ({
|
|
4823
4828
|
bgColor: color.bg.ai.default,
|
|
4824
4829
|
[$arrowBg.variable]: color.bg.ai.default
|
|
@@ -7745,12 +7750,12 @@
|
|
|
7745
7750
|
);
|
|
7746
7751
|
});
|
|
7747
7752
|
|
|
7748
|
-
const
|
|
7753
|
+
const tooltipIconMap = {
|
|
7749
7754
|
success: icons.CheckCircleSolid,
|
|
7750
7755
|
warning: icons.AlertTriangleSolid,
|
|
7751
7756
|
error: icons.AlertCircleSolid,
|
|
7752
|
-
danger: icons.
|
|
7753
|
-
info: icons.
|
|
7757
|
+
danger: icons.AlertOctagonSolid,
|
|
7758
|
+
info: icons.InfoSolid,
|
|
7754
7759
|
ai: icons.BrightnessSolid,
|
|
7755
7760
|
default: icons.HelpCircleSolid,
|
|
7756
7761
|
ghost: icons.HelpCircleSolid
|
|
@@ -7799,7 +7804,7 @@
|
|
|
7799
7804
|
"hasIcon"
|
|
7800
7805
|
]);
|
|
7801
7806
|
const iconVariant = variant;
|
|
7802
|
-
const icon =
|
|
7807
|
+
const icon = tooltipIconMap[iconVariant];
|
|
7803
7808
|
const TooltipContent = /* @__PURE__ */ React.createElement(react.HStack, { alignItems: "flex-start" }, hasIcon && /* @__PURE__ */ React.createElement(Icon$1, { as: icon, color: `icon.toast.${iconVariant}` }), /* @__PURE__ */ React.createElement(react.VStack, { spacing: 0, alignItems: "flex-start" }, /* @__PURE__ */ React.createElement(Label$1, { size: "sm" }, title), /* @__PURE__ */ React.createElement(
|
|
7804
7809
|
P$1,
|
|
7805
7810
|
{
|
|
@@ -13336,6 +13341,17 @@
|
|
|
13336
13341
|
);
|
|
13337
13342
|
});
|
|
13338
13343
|
|
|
13344
|
+
const toastIconMap = {
|
|
13345
|
+
success: icons.CheckCircleSolid,
|
|
13346
|
+
warning: icons.AlertTriangleSolid,
|
|
13347
|
+
error: icons.AlertCircleSolid,
|
|
13348
|
+
danger: icons.AlertCircleSolid,
|
|
13349
|
+
info: icons.BellSolid,
|
|
13350
|
+
ai: icons.BrightnessSolid,
|
|
13351
|
+
default: icons.HelpCircleSolid,
|
|
13352
|
+
ghost: icons.HelpCircleSolid
|
|
13353
|
+
};
|
|
13354
|
+
|
|
13339
13355
|
var __defProp$g = Object.defineProperty;
|
|
13340
13356
|
var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
|
|
13341
13357
|
var __hasOwnProp$g = Object.prototype.hasOwnProperty;
|
|
@@ -14297,7 +14313,7 @@
|
|
|
14297
14313
|
var _a2;
|
|
14298
14314
|
const { isOpen, onToggle, onClose } = react.useDisclosure();
|
|
14299
14315
|
const [inputValueState, setInputValueState] = React.useState(valueProp == null ? void 0 : valueProp.input);
|
|
14300
|
-
const [selectOptionState, setselectOptionState] = React.useState(
|
|
14316
|
+
const [selectOptionState, setselectOptionState] = React.useState(valueProp == null ? void 0 : valueProp.option);
|
|
14301
14317
|
const [enableSelectInput, setEnableSelectInput] = React.useState(false);
|
|
14302
14318
|
const isInputValueControlled = typeof (valueProp == null ? void 0 : valueProp.input) !== "undefined";
|
|
14303
14319
|
const inputValue = isInputValueControlled ? valueProp.input : inputValueState;
|
|
@@ -14305,7 +14321,10 @@
|
|
|
14305
14321
|
const selectOption = isOptionControlled ? valueProp.option : selectOptionState;
|
|
14306
14322
|
const buttonRef = React.useRef();
|
|
14307
14323
|
const selectRef = React.useRef();
|
|
14308
|
-
const getNewValue = (option, input) =>
|
|
14324
|
+
const getNewValue = (option, input) => {
|
|
14325
|
+
const newValueOption = option != null ? option : options[0];
|
|
14326
|
+
return ramda.is(Number, input) ? { input: Number(input), option: newValueOption } : { option: newValueOption };
|
|
14327
|
+
};
|
|
14309
14328
|
const handleInputChange = (newInputvalue) => {
|
|
14310
14329
|
const newValue = getNewValue(selectOption, newInputvalue);
|
|
14311
14330
|
setInputValueState(newValue.input);
|
|
@@ -14339,10 +14358,20 @@
|
|
|
14339
14358
|
}
|
|
14340
14359
|
}, [enableSelectInput]);
|
|
14341
14360
|
React.useEffect(() => {
|
|
14342
|
-
|
|
14343
|
-
|
|
14361
|
+
const needsToCorrectOption = !selectOption;
|
|
14362
|
+
const needsToCorrectInput = !ramda.is(Number, inputValue) && defaultToZeroIfEmpty;
|
|
14363
|
+
const option = needsToCorrectOption ? options[0] : selectOption;
|
|
14364
|
+
const input = needsToCorrectInput ? clamp(min, max, 0) : inputValue;
|
|
14365
|
+
if (needsToCorrectOption) {
|
|
14366
|
+
setselectOptionState(option);
|
|
14367
|
+
}
|
|
14368
|
+
if (needsToCorrectInput) {
|
|
14369
|
+
setInputValueState(input);
|
|
14370
|
+
}
|
|
14371
|
+
if (needsToCorrectOption || needsToCorrectInput) {
|
|
14372
|
+
onChange == null ? void 0 : onChange(getNewValue(option, input));
|
|
14344
14373
|
}
|
|
14345
|
-
}, [
|
|
14374
|
+
}, [inputValue, defaultToZeroIfEmpty]);
|
|
14346
14375
|
return /* @__PURE__ */ React.createElement(react.InputGroup, null, /* @__PURE__ */ React.createElement(
|
|
14347
14376
|
FormattedNumberInput,
|
|
14348
14377
|
__spreadValues$1({
|
|
@@ -14375,7 +14404,7 @@
|
|
|
14375
14404
|
flexShrink: "0",
|
|
14376
14405
|
height: "100%"
|
|
14377
14406
|
},
|
|
14378
|
-
selectOption.label
|
|
14407
|
+
(_a2 = selectOption == null ? void 0 : selectOption.label) != null ? _a2 : ""
|
|
14379
14408
|
)
|
|
14380
14409
|
), /* @__PURE__ */ React.createElement(react.Box, { position: "absolute", width: "100%" }, /* @__PURE__ */ React.createElement(
|
|
14381
14410
|
Select,
|