@firecms/ui 3.0.0-canary.210 → 3.0.0-canary.211
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/components/MultiSelect.d.ts +13 -21
- package/dist/components/Select.d.ts +9 -8
- package/dist/index.es.js +54 -40
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +54 -40
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/MultiSelect.tsx +38 -46
- package/src/components/Select.tsx +62 -50
package/dist/index.umd.js
CHANGED
@@ -29723,8 +29723,8 @@
|
|
29723
29723
|
if ($[12] !== onValueChange || $[13] !== selectedValues) {
|
29724
29724
|
onItemClick = function onItemClick2(newValue) {
|
29725
29725
|
let newSelectedValues;
|
29726
|
-
if (selectedValues.
|
29727
|
-
newSelectedValues = selectedValues.filter((v) => v !== newValue);
|
29726
|
+
if (selectedValues.some((v_0) => String(v_0) === String(newValue))) {
|
29727
|
+
newSelectedValues = selectedValues.filter((v) => String(v) !== String(newValue));
|
29728
29728
|
} else {
|
29729
29729
|
newSelectedValues = [...selectedValues, newValue];
|
29730
29730
|
}
|
@@ -29766,7 +29766,7 @@
|
|
29766
29766
|
let t13;
|
29767
29767
|
if ($[20] !== selectedValues || $[21] !== updateValues) {
|
29768
29768
|
t13 = (value_0) => {
|
29769
|
-
const newSelectedValues_1 = selectedValues.
|
29769
|
+
const newSelectedValues_1 = selectedValues.some((v_2) => String(v_2) === String(value_0)) ? selectedValues.filter((v_1) => String(v_1) !== String(value_0)) : [...selectedValues, value_0];
|
29770
29770
|
updateValues(newSelectedValues_1);
|
29771
29771
|
};
|
29772
29772
|
$[20] = selectedValues;
|
@@ -29867,7 +29867,7 @@
|
|
29867
29867
|
renderValues && renderValues(selectedValues),
|
29868
29868
|
!renderValues && selectedValues.map((value_1) => {
|
29869
29869
|
const childrenProps = React.Children.map(children, _temp2).filter(Boolean);
|
29870
|
-
const option = childrenProps.find((o) => o.value === value_1);
|
29870
|
+
const option = childrenProps.find((o) => String(o.value) === String(value_1));
|
29871
29871
|
if (!useChips) {
|
29872
29872
|
return option?.children;
|
29873
29873
|
}
|
@@ -29877,7 +29877,7 @@
|
|
29877
29877
|
event_0.stopPropagation();
|
29878
29878
|
toggleOption(value_1);
|
29879
29879
|
} })
|
29880
|
-
] }, value_1);
|
29880
|
+
] }, String(value_1));
|
29881
29881
|
})
|
29882
29882
|
] }),
|
29883
29883
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
@@ -30063,7 +30063,7 @@
|
|
30063
30063
|
});
|
30064
30064
|
MultiSelect.displayName = "MultiSelect";
|
30065
30065
|
function MultiSelectItem(t0) {
|
30066
|
-
const $ = reactCompilerRuntime.c(
|
30066
|
+
const $ = reactCompilerRuntime.c(20);
|
30067
30067
|
const {
|
30068
30068
|
children,
|
30069
30069
|
value,
|
@@ -30087,7 +30087,15 @@
|
|
30087
30087
|
}
|
30088
30088
|
let t2;
|
30089
30089
|
if ($[2] !== t1 || $[3] !== value) {
|
30090
|
-
|
30090
|
+
let t32;
|
30091
|
+
if ($[5] !== value) {
|
30092
|
+
t32 = (v) => String(v) === String(value);
|
30093
|
+
$[5] = value;
|
30094
|
+
$[6] = t32;
|
30095
|
+
} else {
|
30096
|
+
t32 = $[6];
|
30097
|
+
}
|
30098
|
+
t2 = t1.some(t32);
|
30091
30099
|
$[2] = t1;
|
30092
30100
|
$[3] = value;
|
30093
30101
|
$[4] = t2;
|
@@ -30096,47 +30104,47 @@
|
|
30096
30104
|
}
|
30097
30105
|
const isSelected = t2;
|
30098
30106
|
let t3;
|
30099
|
-
if ($[
|
30107
|
+
if ($[7] !== onItemClick || $[8] !== value) {
|
30100
30108
|
t3 = (_) => {
|
30101
30109
|
onItemClick(value);
|
30102
30110
|
};
|
30103
|
-
$[
|
30104
|
-
$[
|
30105
|
-
$[
|
30111
|
+
$[7] = onItemClick;
|
30112
|
+
$[8] = value;
|
30113
|
+
$[9] = t3;
|
30106
30114
|
} else {
|
30107
|
-
t3 = $[
|
30115
|
+
t3 = $[9];
|
30108
30116
|
}
|
30109
30117
|
const t4 = isSelected ? "bg-surface-accent-200 dark:bg-surface-accent-950" : "";
|
30110
30118
|
let t5;
|
30111
|
-
if ($[
|
30119
|
+
if ($[10] !== className || $[11] !== t4) {
|
30112
30120
|
t5 = cls("flex flex-row items-center gap-1.5", t4, "cursor-pointer", "m-1", "ring-offset-transparent", "p-1 rounded aria-[selected=true]:outline-none aria-[selected=true]:ring-2 aria-[selected=true]:ring-primary aria-[selected=true]:ring-opacity-75 aria-[selected=true]:ring-offset-2", "aria-[selected=true]:bg-surface-accent-100 aria-[selected=true]:dark:bg-surface-accent-900", "cursor-pointer p-2 rounded aria-[selected=true]:bg-surface-accent-100 aria-[selected=true]:dark:bg-surface-accent-900", className);
|
30113
|
-
$[
|
30114
|
-
$[
|
30115
|
-
$[
|
30121
|
+
$[10] = className;
|
30122
|
+
$[11] = t4;
|
30123
|
+
$[12] = t5;
|
30116
30124
|
} else {
|
30117
|
-
t5 = $[
|
30125
|
+
t5 = $[12];
|
30118
30126
|
}
|
30119
30127
|
let t6;
|
30120
|
-
if ($[
|
30128
|
+
if ($[13] !== isSelected) {
|
30121
30129
|
t6 = /* @__PURE__ */ jsxRuntime.jsx(InnerCheckBox, { checked: isSelected });
|
30122
|
-
$[
|
30123
|
-
$[
|
30130
|
+
$[13] = isSelected;
|
30131
|
+
$[14] = t6;
|
30124
30132
|
} else {
|
30125
|
-
t6 = $[
|
30133
|
+
t6 = $[14];
|
30126
30134
|
}
|
30127
30135
|
let t7;
|
30128
|
-
if ($[
|
30136
|
+
if ($[15] !== children || $[16] !== t3 || $[17] !== t5 || $[18] !== t6) {
|
30129
30137
|
t7 = /* @__PURE__ */ jsxRuntime.jsxs(cmdk.Command.Item, { onMouseDown: _temp3, onSelect: t3, className: t5, children: [
|
30130
30138
|
t6,
|
30131
30139
|
children
|
30132
30140
|
] });
|
30133
|
-
$[
|
30134
|
-
$[
|
30135
|
-
$[
|
30136
|
-
$[
|
30137
|
-
$[
|
30141
|
+
$[15] = children;
|
30142
|
+
$[16] = t3;
|
30143
|
+
$[17] = t5;
|
30144
|
+
$[18] = t6;
|
30145
|
+
$[19] = t7;
|
30138
30146
|
} else {
|
30139
|
-
t7 = $[
|
30147
|
+
t7 = $[19];
|
30140
30148
|
}
|
30141
30149
|
return t7;
|
30142
30150
|
}
|
@@ -30498,19 +30506,24 @@
|
|
30498
30506
|
setOpenInternal(open ?? false);
|
30499
30507
|
}, [open]);
|
30500
30508
|
const onValueChangeInternal = React.useCallback((newValue) => {
|
30501
|
-
|
30509
|
+
let typedValue = newValue;
|
30510
|
+
if (newValue === "true") typedValue = true;
|
30511
|
+
else if (newValue === "false") typedValue = false;
|
30512
|
+
else if (!isNaN(Number(newValue)) && newValue.trim() !== "") typedValue = Number(newValue);
|
30513
|
+
onValueChange?.(typedValue);
|
30502
30514
|
if (onChange) {
|
30503
30515
|
const event = {
|
30504
30516
|
target: {
|
30505
30517
|
name,
|
30506
|
-
value:
|
30518
|
+
value: typedValue
|
30507
30519
|
}
|
30508
30520
|
};
|
30509
30521
|
onChange(event);
|
30510
30522
|
}
|
30511
|
-
}, [onChange,
|
30523
|
+
}, [onChange, onValueChange, name]);
|
30512
30524
|
const hasValue = Array.isArray(value) ? value.length > 0 : value != null && value !== "" && value !== void 0;
|
30513
|
-
|
30525
|
+
const stringValue = value !== void 0 ? String(value) : void 0;
|
30526
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(SelectPrimitive__namespace.Root, { name, value: stringValue, open: openInternal, disabled, onValueChange: onValueChangeInternal, onOpenChange: (open_0) => {
|
30514
30527
|
onOpenChange?.(open_0);
|
30515
30528
|
setOpenInternal(open_0);
|
30516
30529
|
}, ...props, children: [
|
@@ -30540,14 +30553,14 @@
|
|
30540
30553
|
e.preventDefault();
|
30541
30554
|
e.stopPropagation();
|
30542
30555
|
}, placeholder, className: "w-full", children: [
|
30543
|
-
hasValue && value && renderValue ? renderValue(value) : placeholder,
|
30556
|
+
hasValue && value !== void 0 && renderValue ? renderValue(value) : placeholder,
|
30544
30557
|
hasValue && !renderValue && (() => {
|
30545
30558
|
const childrenProps = React.Children.map(children, (child) => {
|
30546
30559
|
if (React.isValidElement(child)) {
|
30547
30560
|
return child.props;
|
30548
30561
|
}
|
30549
30562
|
}).filter(Boolean);
|
30550
|
-
const option = childrenProps.find((o) => o.value === value);
|
30563
|
+
const option = childrenProps.find((o) => String(o.value) === String(value));
|
30551
30564
|
return option?.children;
|
30552
30565
|
})()
|
30553
30566
|
] }) }),
|
@@ -30574,6 +30587,7 @@
|
|
30574
30587
|
disabled,
|
30575
30588
|
className
|
30576
30589
|
} = t0;
|
30590
|
+
const stringValue = String(value);
|
30577
30591
|
const t1 = disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer";
|
30578
30592
|
let t2;
|
30579
30593
|
if ($[0] !== className || $[1] !== t1) {
|
@@ -30600,15 +30614,15 @@
|
|
30600
30614
|
t4 = $[5];
|
30601
30615
|
}
|
30602
30616
|
let t5;
|
30603
|
-
if ($[6] !== disabled || $[7] !==
|
30604
|
-
t5 = /* @__PURE__ */ jsxRuntime.jsxs(SelectPrimitive__namespace.Item, { value, disabled, className: t2, children: [
|
30617
|
+
if ($[6] !== disabled || $[7] !== stringValue || $[8] !== t2 || $[9] !== t3) {
|
30618
|
+
t5 = /* @__PURE__ */ jsxRuntime.jsxs(SelectPrimitive__namespace.Item, { value: stringValue, disabled, className: t2, children: [
|
30605
30619
|
t3,
|
30606
30620
|
t4
|
30607
|
-
] },
|
30621
|
+
] }, stringValue);
|
30608
30622
|
$[6] = disabled;
|
30609
|
-
$[7] =
|
30610
|
-
$[8] =
|
30611
|
-
$[9] =
|
30623
|
+
$[7] = stringValue;
|
30624
|
+
$[8] = t2;
|
30625
|
+
$[9] = t3;
|
30612
30626
|
$[10] = t5;
|
30613
30627
|
} else {
|
30614
30628
|
t5 = $[10];
|