@timeax/form-palette 0.1.8 → 0.1.10
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/extra.js +18 -18
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +18 -18
- package/dist/extra.mjs.map +1 -1
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/extra.js
CHANGED
|
@@ -15941,6 +15941,7 @@ var ShadcnSelectVariant = React72__namespace.forwardRef(function ShadcnSelectVar
|
|
|
15941
15941
|
optionIcon
|
|
15942
15942
|
]
|
|
15943
15943
|
);
|
|
15944
|
+
const normalizedValue = value === "" || value == null ? void 0 : value;
|
|
15944
15945
|
const valueMap = React72__namespace.useMemo(() => {
|
|
15945
15946
|
const map = /* @__PURE__ */ new Map();
|
|
15946
15947
|
for (const item of items) {
|
|
@@ -15948,7 +15949,9 @@ var ShadcnSelectVariant = React72__namespace.forwardRef(function ShadcnSelectVar
|
|
|
15948
15949
|
}
|
|
15949
15950
|
return map;
|
|
15950
15951
|
}, [items]);
|
|
15951
|
-
const selectedItem =
|
|
15952
|
+
const selectedItem = normalizedValue == null ? null : (_a = items.find(
|
|
15953
|
+
(it) => String(it.value) === String(normalizedValue)
|
|
15954
|
+
)) != null ? _a : null;
|
|
15952
15955
|
const filteredItems = React72__namespace.useMemo(() => {
|
|
15953
15956
|
if (!query) return items;
|
|
15954
15957
|
const q2 = query.toLowerCase();
|
|
@@ -15991,7 +15994,7 @@ var ShadcnSelectVariant = React72__namespace.forwardRef(function ShadcnSelectVar
|
|
|
15991
15994
|
const handleChange = React72__namespace.useCallback(
|
|
15992
15995
|
(rawKey) => {
|
|
15993
15996
|
var _a2, _b2, _c;
|
|
15994
|
-
if (!onValue) return;
|
|
15997
|
+
if (!onValue || rawKey === "") return;
|
|
15995
15998
|
const primitive = (_a2 = valueMap.get(rawKey)) != null ? _a2 : rawKey;
|
|
15996
15999
|
const item = (_b2 = items.find((it) => String(it.value) === String(primitive))) != null ? _b2 : null;
|
|
15997
16000
|
const detail = {
|
|
@@ -23218,23 +23221,18 @@ function buildLabelsFromOptions(args) {
|
|
|
23218
23221
|
).trim();
|
|
23219
23222
|
};
|
|
23220
23223
|
const labels = (() => {
|
|
23221
|
-
|
|
23222
|
-
|
|
23223
|
-
|
|
23224
|
-
|
|
23225
|
-
|
|
23226
|
-
|
|
23227
|
-
|
|
23228
|
-
}
|
|
23229
|
-
return arr.map((v2) => {
|
|
23230
|
-
var _a;
|
|
23231
|
-
return (_a = map.get(v2)) != null ? _a : String(v2);
|
|
23232
|
-
});
|
|
23224
|
+
let options = mode !== "multiple" ? Array.isArray(selectedOptions) ? selectedOptions : selectedOptions ? [selectedOptions] : [] : selectedOptions;
|
|
23225
|
+
const arr = Array.isArray(value) ? value : value ? [value] : [];
|
|
23226
|
+
const map = /* @__PURE__ */ new Map();
|
|
23227
|
+
for (const o3 of options != null ? options : []) {
|
|
23228
|
+
if ((o3 == null ? void 0 : o3.value) == null) continue;
|
|
23229
|
+
const lbl = labelFor(o3);
|
|
23230
|
+
if (lbl) map.set(o3.value, lbl);
|
|
23233
23231
|
}
|
|
23234
|
-
|
|
23235
|
-
|
|
23236
|
-
|
|
23237
|
-
|
|
23232
|
+
return arr.map((v2) => {
|
|
23233
|
+
var _a;
|
|
23234
|
+
return (_a = map.get(v2)) != null ? _a : String(v2);
|
|
23235
|
+
});
|
|
23238
23236
|
})();
|
|
23239
23237
|
if (!labels.length) {
|
|
23240
23238
|
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: placeholder });
|
|
@@ -23678,6 +23676,8 @@ function ListerInner(props) {
|
|
|
23678
23676
|
}
|
|
23679
23677
|
const nextSelected = mode === "multiple" ? (Array.isArray(value) ? value : []).map((v2) => byValue.get(v2)).filter(Boolean) : value != null && value !== "" ? [byValue.get(value)].filter(Boolean) : [];
|
|
23680
23678
|
setSelectedOptions((prev) => {
|
|
23679
|
+
if (mode == "single" && prev && !Array.isArray(prev))
|
|
23680
|
+
prev = [prev];
|
|
23681
23681
|
const p2 = prev != null ? prev : [];
|
|
23682
23682
|
const n3 = nextSelected != null ? nextSelected : [];
|
|
23683
23683
|
const pv = p2.map((o3) => o3 == null ? void 0 : o3.value);
|