@websolutespa/bom-mixer-ui 1.9.5 → 1.9.6
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/CHANGELOG.md +6 -0
- package/dist/cjs/index.js +23 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/forms/select/select-select.js +5 -1
- package/dist/esm/forms/select/select-select.js.map +1 -1
- package/dist/esm/forms/select/select.context.js.map +1 -1
- package/dist/esm/forms/select/select.js +18 -17
- package/dist/esm/forms/select/select.js.map +1 -1
- package/dist/types/forms/select/select-select.d.ts.map +1 -1
- package/dist/types/forms/select/select.context.d.ts +0 -2
- package/dist/types/forms/select/select.context.d.ts.map +1 -1
- package/dist/types/forms/select/select.d.ts +8 -3
- package/dist/types/forms/select/select.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/forms/select/select-select.tsx +12 -6
- package/src/forms/select/select.context.tsx +0 -2
- package/src/forms/select/select.tsx +25 -19
package/CHANGELOG.md
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -11833,8 +11833,8 @@ const selectVariants = {
|
|
|
11833
11833
|
function Select$1(_a) {
|
|
11834
11834
|
var {
|
|
11835
11835
|
name,
|
|
11836
|
+
label,
|
|
11836
11837
|
value: outerValue,
|
|
11837
|
-
label: outerLabel,
|
|
11838
11838
|
defaultValue: outerDefaultValue,
|
|
11839
11839
|
options,
|
|
11840
11840
|
multiple,
|
|
@@ -11846,43 +11846,44 @@ function Select$1(_a) {
|
|
|
11846
11846
|
onChange,
|
|
11847
11847
|
children
|
|
11848
11848
|
} = _a,
|
|
11849
|
-
props = __rest(_a, ["name", "
|
|
11849
|
+
props = __rest(_a, ["name", "label", "value", "defaultValue", "options", "multiple", "placeholder", "variant", "variants", "onBlur", "onFocus", "onChange", "children"]);
|
|
11850
11850
|
const value = outerToInnerSelectValue(outerValue);
|
|
11851
11851
|
const defaultValue = outerToInnerSelectValue(outerDefaultValue) || (multiple ? [] : '');
|
|
11852
11852
|
const [innerValue, setInnerValue] = React.useState(value || defaultValue);
|
|
11853
|
-
|
|
11853
|
+
const [previousOuterValue, setPreviousOuterValue] = React.useState(outerValue);
|
|
11854
|
+
// console.log('outerValue', outerValue, 'innerValue', innerValue);
|
|
11854
11855
|
React.useEffect(() => {
|
|
11855
|
-
if (
|
|
11856
|
+
if (previousOuterValue !== outerValue) {
|
|
11857
|
+
setPreviousOuterValue(outerValue);
|
|
11856
11858
|
setInnerValue(value);
|
|
11859
|
+
// console.log('useEffect.setInnerValue', value);
|
|
11857
11860
|
}
|
|
11858
|
-
}, [
|
|
11859
|
-
const onBlur_ = event => {
|
|
11860
|
-
onBlur && onBlur(event);
|
|
11861
|
-
};
|
|
11862
|
-
const onFocus_ = event => {
|
|
11863
|
-
onFocus && onFocus(event);
|
|
11864
|
-
};
|
|
11861
|
+
}, [previousOuterValue, outerValue, value]);
|
|
11865
11862
|
const onChange_ = value => {
|
|
11866
11863
|
if (innerValue !== value) {
|
|
11867
11864
|
setInnerValue(value);
|
|
11865
|
+
// console.log('onChange_.setInnerValue', value);
|
|
11868
11866
|
const outerValue = innerToOuterSelectValue(value, options);
|
|
11869
|
-
console.log('setInnerValue', value, outerValue);
|
|
11870
11867
|
onChange && onChange(outerValue);
|
|
11868
|
+
// console.log('onChange_.setOuterValue', outerValue);
|
|
11871
11869
|
}
|
|
11872
11870
|
};
|
|
11871
|
+
const onBlur_ = event => {
|
|
11872
|
+
onBlur && onBlur(event);
|
|
11873
|
+
};
|
|
11874
|
+
const onFocus_ = event => {
|
|
11875
|
+
onFocus && onFocus(event);
|
|
11876
|
+
};
|
|
11873
11877
|
const globalVariants = useVariants('select', selectVariants);
|
|
11874
11878
|
variants = variants || globalVariants;
|
|
11875
11879
|
return jsxRuntime.jsx(Ariakit__namespace.SelectProvider, Object.assign({
|
|
11876
|
-
value:
|
|
11877
|
-
defaultValue: defaultValue,
|
|
11880
|
+
value: innerValue,
|
|
11878
11881
|
setValue: onChange_
|
|
11879
11882
|
}, props, {
|
|
11880
11883
|
children: jsxRuntime.jsx(SelectContext.Provider, {
|
|
11881
11884
|
value: {
|
|
11882
11885
|
name,
|
|
11883
|
-
|
|
11884
|
-
label: outerLabel,
|
|
11885
|
-
defaultValue: outerDefaultValue,
|
|
11886
|
+
label,
|
|
11886
11887
|
options,
|
|
11887
11888
|
multiple,
|
|
11888
11889
|
placeholder,
|
|
@@ -12071,7 +12072,10 @@ function SelectSelection() {
|
|
|
12071
12072
|
return;
|
|
12072
12073
|
}
|
|
12073
12074
|
const state = selectContext === null || selectContext === void 0 ? void 0 : selectContext.getState();
|
|
12074
|
-
const items =
|
|
12075
|
+
const items = context.options ? context.options.map(x => ({
|
|
12076
|
+
value: String(x.id),
|
|
12077
|
+
label: x.name
|
|
12078
|
+
})) : ((state === null || state === void 0 ? void 0 : state.items) || []).filter(x => x.element.parentElement !== (state === null || state === void 0 ? void 0 : state.anchorElement)).map(x => ({
|
|
12075
12079
|
value: x.value,
|
|
12076
12080
|
label: x.element.innerText || x.value
|
|
12077
12081
|
}));
|
|
@@ -12090,6 +12094,7 @@ function SelectSelection() {
|
|
|
12090
12094
|
return context.placeholder || 'Select';
|
|
12091
12095
|
}
|
|
12092
12096
|
}
|
|
12097
|
+
// console.log(context.options, state?.items, items, value);
|
|
12093
12098
|
return ((_a = items.find(x => x.value === value)) === null || _a === void 0 ? void 0 : _a.label) || context.placeholder || 'Select';
|
|
12094
12099
|
}
|
|
12095
12100
|
|