@ostack.tech/ui 0.14.0 → 0.14.2
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/ostack-ui.js +109 -96
- package/dist/ostack-ui.js.map +1 -1
- package/package.json +1 -1
package/dist/ostack-ui.js
CHANGED
|
@@ -5619,17 +5619,6 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
5619
5619
|
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
5620
5620
|
const descriptionIds = useFieldDescriptionIds();
|
|
5621
5621
|
const errorMessageIds = useFieldErrorMessageIds();
|
|
5622
|
-
const { generatedId, controlId, codeId } = useRegisterFieldControl(
|
|
5623
|
-
id,
|
|
5624
|
-
"BUTTON",
|
|
5625
|
-
codeProps?.id,
|
|
5626
|
-
Boolean(code),
|
|
5627
|
-
required,
|
|
5628
|
-
status
|
|
5629
|
-
);
|
|
5630
|
-
const labelId = children && (labelProps?.id ?? prefix(`checkbox-label-${generatedId}`));
|
|
5631
|
-
const loadingDescriptionId = loading && loadingDescription && prefix(`control-loading-${generatedId}`);
|
|
5632
|
-
const checkboxRef = useRef(null);
|
|
5633
5622
|
const containerRef = useRef(null);
|
|
5634
5623
|
const labelRef = useRef(null);
|
|
5635
5624
|
const isInTableCell = useIsInTableCell();
|
|
@@ -5650,6 +5639,17 @@ const Checkbox = forwardRef(function Checkbox2({
|
|
|
5650
5639
|
status = controlContext?.status ?? status ?? formStatus;
|
|
5651
5640
|
disabled = controlContext?.disabled || disabled || formDisabled;
|
|
5652
5641
|
readOnly = controlContext?.readOnly || readOnly;
|
|
5642
|
+
const { generatedId, controlId, codeId } = useRegisterFieldControl(
|
|
5643
|
+
id,
|
|
5644
|
+
"BUTTON",
|
|
5645
|
+
codeProps?.id,
|
|
5646
|
+
Boolean(code),
|
|
5647
|
+
required,
|
|
5648
|
+
status
|
|
5649
|
+
);
|
|
5650
|
+
const labelId = children && (labelProps?.id ?? prefix(`checkbox-label-${generatedId}`));
|
|
5651
|
+
const loadingDescriptionId = loading && loadingDescription && prefix(`control-loading-${generatedId}`);
|
|
5652
|
+
const checkboxRef = useRef(null);
|
|
5653
5653
|
const requiredInGroup = useIsRequiredInGroup();
|
|
5654
5654
|
const groupDescriptionIds = useCheckboxGroupDescriptionIds(controlId);
|
|
5655
5655
|
const softDisabled = controlContext?.softDisabled || loading || ariaDisabled === "true" || ariaDisabled === true;
|
|
@@ -9108,7 +9108,7 @@ const SelectNative = forwardRef(function SelectNative2({ actualElement, multiple
|
|
|
9108
9108
|
[hasEmptyOption, optionStates]
|
|
9109
9109
|
);
|
|
9110
9110
|
const options = useMemo(
|
|
9111
|
-
() => optionStates.map(({ value: value2, disabled }) => /* @__PURE__ */ jsx("option", { value: value2, disabled
|
|
9111
|
+
() => optionStates.map(({ value: value2, disabled }) => /* @__PURE__ */ jsx("option", { value: value2, disabled }, value2)),
|
|
9112
9112
|
[optionStates]
|
|
9113
9113
|
);
|
|
9114
9114
|
return /* @__PURE__ */ jsx(
|
|
@@ -10248,6 +10248,15 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
10248
10248
|
const prefix = usePrefix();
|
|
10249
10249
|
const [locale7] = useLocale();
|
|
10250
10250
|
loadingDescription ??= locale7.Input.loadingDescription;
|
|
10251
|
+
const initialValue = value ?? defaultValue ?? [];
|
|
10252
|
+
const {
|
|
10253
|
+
status: formStatus,
|
|
10254
|
+
disabled: formDisabled,
|
|
10255
|
+
onChange: formOnChange,
|
|
10256
|
+
onBlur: formOnBlur
|
|
10257
|
+
} = useRegisterFormControl(name, initialValue, validate, validationMode);
|
|
10258
|
+
status ??= formStatus;
|
|
10259
|
+
disabled ||= formDisabled;
|
|
10251
10260
|
const labelId = useFieldLabelId();
|
|
10252
10261
|
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
10253
10262
|
const descriptionIds = useFieldDescriptionIds();
|
|
@@ -10262,15 +10271,6 @@ const CheckboxGroup = forwardRef(function CheckboxGroup2({
|
|
|
10262
10271
|
);
|
|
10263
10272
|
const loadingDescriptionId = loading && loadingDescription ? prefix(`control-loading-${generatedId}`) : void 0;
|
|
10264
10273
|
const checkboxGroupRef = useRef(null);
|
|
10265
|
-
const initialValue = value ?? defaultValue ?? [];
|
|
10266
|
-
const {
|
|
10267
|
-
status: formStatus,
|
|
10268
|
-
disabled: formDisabled,
|
|
10269
|
-
onChange: formOnChange,
|
|
10270
|
-
onBlur: formOnBlur
|
|
10271
|
-
} = useRegisterFormControl(name, initialValue, validate, validationMode);
|
|
10272
|
-
status ??= formStatus;
|
|
10273
|
-
disabled ||= formDisabled;
|
|
10274
10274
|
const isInTableCell = useIsInTableCell();
|
|
10275
10275
|
inline ??= isInTableCell;
|
|
10276
10276
|
variant ??= isInTableCell ? "cell" : "default";
|
|
@@ -11025,24 +11025,6 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
11025
11025
|
const { format: formatDate, parse: parseDate } = useDateTransformer({
|
|
11026
11026
|
format: format2
|
|
11027
11027
|
});
|
|
11028
|
-
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
11029
|
-
const labelId = useFieldLabelId();
|
|
11030
|
-
const descriptionIds = useFieldDescriptionIds();
|
|
11031
|
-
const errorMessageIds = useFieldErrorMessageIds();
|
|
11032
|
-
const { printHidden } = usePrintClassNames();
|
|
11033
|
-
const { generatedId, controlId, codeId } = useRegisterFieldControl(
|
|
11034
|
-
startInputProps?.id,
|
|
11035
|
-
"INPUT",
|
|
11036
|
-
codeProps?.id,
|
|
11037
|
-
Boolean(code),
|
|
11038
|
-
required,
|
|
11039
|
-
status
|
|
11040
|
-
);
|
|
11041
|
-
const setFieldControlFocused = useSetFieldControlFocused();
|
|
11042
|
-
const startInputLabelId = startInputLabel && prefix(`control-start-label-${generatedId}`);
|
|
11043
|
-
const endInputLabelId = endInputLabel && prefix(`control-end-label-${generatedId}`);
|
|
11044
|
-
const loadingDescriptionId = loading && loadingDescription && prefix(`control-loading-${generatedId}`);
|
|
11045
|
-
const formatDescriptionId = formatDescription && typeof formatDescription !== "boolean" ? prefix(`control-format-${generatedId}`) : void 0;
|
|
11046
11028
|
const isInTableCell = useIsInTableCell();
|
|
11047
11029
|
variant ??= isInTableCell ? "cell" : "default";
|
|
11048
11030
|
const [formattedValue, setFormattedValue] = useControllableState(
|
|
@@ -11112,6 +11094,24 @@ const DateRangeInput = forwardRef(function DateRangeInput2({
|
|
|
11112
11094
|
);
|
|
11113
11095
|
status ??= formStatus;
|
|
11114
11096
|
disabled ||= formDisabled;
|
|
11097
|
+
const dataTableColumnLabelId = useDataTableColumnLabelId();
|
|
11098
|
+
const labelId = useFieldLabelId();
|
|
11099
|
+
const descriptionIds = useFieldDescriptionIds();
|
|
11100
|
+
const errorMessageIds = useFieldErrorMessageIds();
|
|
11101
|
+
const { printHidden } = usePrintClassNames();
|
|
11102
|
+
const { generatedId, controlId, codeId } = useRegisterFieldControl(
|
|
11103
|
+
startInputProps?.id,
|
|
11104
|
+
"INPUT",
|
|
11105
|
+
codeProps?.id,
|
|
11106
|
+
Boolean(code),
|
|
11107
|
+
required,
|
|
11108
|
+
status
|
|
11109
|
+
);
|
|
11110
|
+
const setFieldControlFocused = useSetFieldControlFocused();
|
|
11111
|
+
const startInputLabelId = startInputLabel && prefix(`control-start-label-${generatedId}`);
|
|
11112
|
+
const endInputLabelId = endInputLabel && prefix(`control-end-label-${generatedId}`);
|
|
11113
|
+
const loadingDescriptionId = loading && loadingDescription && prefix(`control-loading-${generatedId}`);
|
|
11114
|
+
const formatDescriptionId = formatDescription && typeof formatDescription !== "boolean" ? prefix(`control-format-${generatedId}`) : void 0;
|
|
11115
11115
|
const startDisabled = disabled || startInputProps?.disabled;
|
|
11116
11116
|
const endDisabled = disabled || endInputProps?.disabled;
|
|
11117
11117
|
const bothDisabled = startDisabled && endDisabled;
|
|
@@ -13385,54 +13385,6 @@ const NumericInput = forwardRef(function NumericInput2({
|
|
|
13385
13385
|
exclusiveMaxString
|
|
13386
13386
|
});
|
|
13387
13387
|
}
|
|
13388
|
-
const isAllowed = useCallback(
|
|
13389
|
-
(values) => {
|
|
13390
|
-
const valueRepresentations = transformNumberFormatValues(
|
|
13391
|
-
values,
|
|
13392
|
-
valueIsInteger,
|
|
13393
|
-
scale
|
|
13394
|
-
);
|
|
13395
|
-
const { stringValue: stringValue2 } = valueRepresentations;
|
|
13396
|
-
if (stringValue2) {
|
|
13397
|
-
if (precision != null) {
|
|
13398
|
-
const isNegative = isNumericStringNegative(stringValue2);
|
|
13399
|
-
if (valueIsInteger) {
|
|
13400
|
-
if (stringValue2.length - (isNegative ? 1 : 0) > precision) {
|
|
13401
|
-
return false;
|
|
13402
|
-
}
|
|
13403
|
-
} else {
|
|
13404
|
-
const decimalSeparatorIndex = stringValue2.indexOf(".");
|
|
13405
|
-
const decimal = decimalSeparatorIndex === -1 ? stringValue2 : stringValue2.slice(0, decimalSeparatorIndex);
|
|
13406
|
-
if (decimal.length - (isNegative ? 1 : 0) > precision - scale) {
|
|
13407
|
-
return false;
|
|
13408
|
-
}
|
|
13409
|
-
}
|
|
13410
|
-
}
|
|
13411
|
-
if (minString && (compareNumericStrings(minString, "0") < 0 && compareNumericStrings(stringValue2, minString) < 0 || compareNumericStrings(minString, "0") >= 0 && compareNumericStrings(stringValue2, "0") < 0)) {
|
|
13412
|
-
return false;
|
|
13413
|
-
}
|
|
13414
|
-
if (maxString && (compareNumericStrings(maxString, "0") > 0 && compareNumericStrings(stringValue2, maxString) > 0 || compareNumericStrings(maxString, "0") <= 0 && compareNumericStrings(stringValue2, "0") > 0)) {
|
|
13415
|
-
return false;
|
|
13416
|
-
}
|
|
13417
|
-
if (exclusiveMinString && (compareNumericStrings(exclusiveMinString, "0") < 0 && compareNumericStrings(stringValue2, exclusiveMinString) <= 0 || compareNumericStrings(exclusiveMinString, "0") >= 0 && compareNumericStrings(stringValue2, "0") < 0)) {
|
|
13418
|
-
return false;
|
|
13419
|
-
}
|
|
13420
|
-
if (exclusiveMaxString && (compareNumericStrings(exclusiveMaxString, "0") > 0 && compareNumericStrings(stringValue2, exclusiveMaxString) >= 0 || compareNumericStrings(exclusiveMaxString, "0") <= 0 && compareNumericStrings(stringValue2, "0") > 0)) {
|
|
13421
|
-
return false;
|
|
13422
|
-
}
|
|
13423
|
-
}
|
|
13424
|
-
return true;
|
|
13425
|
-
},
|
|
13426
|
-
[
|
|
13427
|
-
valueIsInteger,
|
|
13428
|
-
scale,
|
|
13429
|
-
precision,
|
|
13430
|
-
minString,
|
|
13431
|
-
maxString,
|
|
13432
|
-
exclusiveMinString,
|
|
13433
|
-
exclusiveMaxString
|
|
13434
|
-
]
|
|
13435
|
-
);
|
|
13436
13388
|
const allowNegative = (!minString || compareNumericStrings(minString, "0") < 0) && (!exclusiveMinString || compareNumericStrings(exclusiveMinString, "0") < 0);
|
|
13437
13389
|
const formatProps = useMemo(
|
|
13438
13390
|
() => ({
|
|
@@ -13469,6 +13421,66 @@ const NumericInput = forwardRef(function NumericInput2({
|
|
|
13469
13421
|
() => valueToRNFString(value, valueIsInteger, formatProps),
|
|
13470
13422
|
[formatProps, value, valueIsInteger]
|
|
13471
13423
|
);
|
|
13424
|
+
const isAllowed = useCallback(
|
|
13425
|
+
(values) => {
|
|
13426
|
+
const valueRepresentations = transformNumberFormatValues(
|
|
13427
|
+
values,
|
|
13428
|
+
valueIsInteger,
|
|
13429
|
+
scale
|
|
13430
|
+
);
|
|
13431
|
+
const { stringValue: newStringValue } = valueRepresentations;
|
|
13432
|
+
if (newStringValue) {
|
|
13433
|
+
if (precision != null) {
|
|
13434
|
+
const newIsNegative = isNumericStringNegative(newStringValue);
|
|
13435
|
+
const oldIsNegative = isNumericStringNegative(stringValue);
|
|
13436
|
+
if (valueIsInteger) {
|
|
13437
|
+
const newPrecision = newStringValue.length - (newIsNegative ? 1 : 0);
|
|
13438
|
+
if (newPrecision > precision) {
|
|
13439
|
+
const oldPrecision = stringValue.length - (oldIsNegative ? 1 : 0);
|
|
13440
|
+
if (newPrecision > oldPrecision) {
|
|
13441
|
+
return false;
|
|
13442
|
+
}
|
|
13443
|
+
}
|
|
13444
|
+
} else {
|
|
13445
|
+
const newDecimalSeparatorIndex = newStringValue.indexOf(".");
|
|
13446
|
+
const newDecimal = newDecimalSeparatorIndex === -1 ? newStringValue : newStringValue.slice(0, newDecimalSeparatorIndex);
|
|
13447
|
+
const newDecimalPrecision = newDecimal.length - (newIsNegative ? 1 : 0);
|
|
13448
|
+
if (newDecimalPrecision > precision - scale) {
|
|
13449
|
+
const oldDecimalSeparatorIndex = stringValue.indexOf(".");
|
|
13450
|
+
const oldDecimal = oldDecimalSeparatorIndex === -1 ? stringValue : stringValue.slice(0, oldDecimalSeparatorIndex);
|
|
13451
|
+
const oldDecimalPrecision = oldDecimal.length - (oldIsNegative ? 1 : 0);
|
|
13452
|
+
if (newDecimalPrecision > oldDecimalPrecision) {
|
|
13453
|
+
return false;
|
|
13454
|
+
}
|
|
13455
|
+
}
|
|
13456
|
+
}
|
|
13457
|
+
}
|
|
13458
|
+
if (minString && (compareNumericStrings(minString, "0") < 0 && compareNumericStrings(newStringValue, minString) < 0 || compareNumericStrings(minString, "0") >= 0 && compareNumericStrings(newStringValue, "0") < 0) && compareNumericStrings(newStringValue, stringValue) < 0) {
|
|
13459
|
+
return false;
|
|
13460
|
+
}
|
|
13461
|
+
if (maxString && (compareNumericStrings(maxString, "0") > 0 && compareNumericStrings(newStringValue, maxString) > 0 || compareNumericStrings(maxString, "0") <= 0 && compareNumericStrings(newStringValue, "0") > 0) && compareNumericStrings(newStringValue, stringValue) > 0) {
|
|
13462
|
+
return false;
|
|
13463
|
+
}
|
|
13464
|
+
if (exclusiveMinString && (compareNumericStrings(exclusiveMinString, "0") < 0 && compareNumericStrings(newStringValue, exclusiveMinString) <= 0 || compareNumericStrings(exclusiveMinString, "0") >= 0 && compareNumericStrings(newStringValue, "0") < 0) && compareNumericStrings(newStringValue, stringValue) < 0) {
|
|
13465
|
+
return false;
|
|
13466
|
+
}
|
|
13467
|
+
if (exclusiveMaxString && (compareNumericStrings(exclusiveMaxString, "0") > 0 && compareNumericStrings(newStringValue, exclusiveMaxString) >= 0 || compareNumericStrings(exclusiveMaxString, "0") <= 0 && compareNumericStrings(newStringValue, "0") > 0) && compareNumericStrings(newStringValue, stringValue) > 0) {
|
|
13468
|
+
return false;
|
|
13469
|
+
}
|
|
13470
|
+
}
|
|
13471
|
+
return true;
|
|
13472
|
+
},
|
|
13473
|
+
[
|
|
13474
|
+
valueIsInteger,
|
|
13475
|
+
scale,
|
|
13476
|
+
precision,
|
|
13477
|
+
minString,
|
|
13478
|
+
maxString,
|
|
13479
|
+
exclusiveMinString,
|
|
13480
|
+
exclusiveMaxString,
|
|
13481
|
+
stringValue
|
|
13482
|
+
]
|
|
13483
|
+
);
|
|
13472
13484
|
const {
|
|
13473
13485
|
status: formStatus,
|
|
13474
13486
|
disabled: formDisabled,
|
|
@@ -13649,6 +13661,7 @@ const Radio = forwardRef(function Radio2({
|
|
|
13649
13661
|
"div",
|
|
13650
13662
|
{
|
|
13651
13663
|
"data-status": status,
|
|
13664
|
+
"data-accent": controlStatusToAccent(status),
|
|
13652
13665
|
...rootProps,
|
|
13653
13666
|
onFocus: combineEventHandlers(rootProps?.onFocus, handleRootFocus),
|
|
13654
13667
|
className: cx(prefix("radio__root"), rootProps?.className),
|
|
@@ -13776,6 +13789,15 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
13776
13789
|
defaultValue ?? "",
|
|
13777
13790
|
controlledValue
|
|
13778
13791
|
);
|
|
13792
|
+
const {
|
|
13793
|
+
status: formStatus,
|
|
13794
|
+
disabled: formDisabled,
|
|
13795
|
+
setValue: formSetValue,
|
|
13796
|
+
onChange: formOnChange,
|
|
13797
|
+
onBlur: formOnBlur
|
|
13798
|
+
} = useRegisterFormControl(name, value, validate, validationMode);
|
|
13799
|
+
status ??= formStatus;
|
|
13800
|
+
disabled ||= formDisabled;
|
|
13779
13801
|
const { generatedId, controlId, codeId } = useRegisterFieldControl(
|
|
13780
13802
|
id,
|
|
13781
13803
|
"DIV",
|
|
@@ -13786,15 +13808,6 @@ const RadioGroup = forwardRef(function RadioGroup2({
|
|
|
13786
13808
|
);
|
|
13787
13809
|
const loadingDescriptionId = loading && loadingDescription && prefix(`control-loading-${generatedId}`);
|
|
13788
13810
|
const [radioGroupEl, setRadioGroupEl] = useState(null);
|
|
13789
|
-
const {
|
|
13790
|
-
status: formStatus,
|
|
13791
|
-
disabled: formDisabled,
|
|
13792
|
-
setValue: formSetValue,
|
|
13793
|
-
onChange: formOnChange,
|
|
13794
|
-
onBlur: formOnBlur
|
|
13795
|
-
} = useRegisterFormControl(name, value, validate, validationMode);
|
|
13796
|
-
status ??= formStatus;
|
|
13797
|
-
disabled ||= formDisabled;
|
|
13798
13811
|
const isInTableCell = useIsInTableCell();
|
|
13799
13812
|
inline ??= isInTableCell;
|
|
13800
13813
|
variant ??= isInTableCell ? "cell" : "default";
|