@moises.ai/design-system 4.21.0 → 4.21.1
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/index.js
CHANGED
|
@@ -8912,30 +8912,28 @@ function UI(n = [], t = []) {
|
|
|
8912
8912
|
return n.every((a) => r.has(a));
|
|
8913
8913
|
}
|
|
8914
8914
|
function OI({ onShowPaywall: n, selected: t = [] }) {
|
|
8915
|
-
const [r, a] = j(t)
|
|
8916
|
-
ie(() => {
|
|
8917
|
-
a(t);
|
|
8918
|
-
}, [t]);
|
|
8919
|
-
const o = async (l) => {
|
|
8920
|
-
if (l.locked) {
|
|
8921
|
-
n(l.paywallId);
|
|
8922
|
-
return;
|
|
8923
|
-
}
|
|
8924
|
-
a((c) => {
|
|
8925
|
-
var p;
|
|
8926
|
-
if (c.includes(l.value))
|
|
8927
|
-
return c.filter((h) => h !== l.value);
|
|
8928
|
-
const d = [...c, l.value], u = (p = MI.find((h) => h.value === l.value)) == null ? void 0 : p.mutualExclusiveStems;
|
|
8929
|
-
return d.filter((h) => !(u != null && u.includes(h)));
|
|
8930
|
-
});
|
|
8931
|
-
}, i = oe(
|
|
8915
|
+
const [r, a] = j(t), o = oe(
|
|
8932
8916
|
() => !UI(r, t),
|
|
8933
8917
|
[r, t]
|
|
8934
8918
|
);
|
|
8935
|
-
return {
|
|
8919
|
+
return ie(() => {
|
|
8920
|
+
o || a(t);
|
|
8921
|
+
}, [t, o]), {
|
|
8936
8922
|
stemsSelected: r,
|
|
8937
|
-
onToggleStems:
|
|
8938
|
-
|
|
8923
|
+
onToggleStems: async (l) => {
|
|
8924
|
+
if (l.locked) {
|
|
8925
|
+
n(l.paywallId);
|
|
8926
|
+
return;
|
|
8927
|
+
}
|
|
8928
|
+
a((c) => {
|
|
8929
|
+
var p;
|
|
8930
|
+
if (c.includes(l.value))
|
|
8931
|
+
return c.filter((h) => h !== l.value);
|
|
8932
|
+
const d = [...c, l.value], u = (p = MI.find((h) => h.value === l.value)) == null ? void 0 : p.mutualExclusiveStems;
|
|
8933
|
+
return d.filter((h) => !(u != null && u.includes(h)));
|
|
8934
|
+
});
|
|
8935
|
+
},
|
|
8936
|
+
hasChanges: o
|
|
8939
8937
|
};
|
|
8940
8938
|
}
|
|
8941
8939
|
const PI = ({
|
package/package.json
CHANGED
|
@@ -10,9 +10,16 @@ function areStemSelectionsEqual(current = [], initial = []) {
|
|
|
10
10
|
export function useForm({ onShowPaywall, selected = [] }) {
|
|
11
11
|
const [stemsSelected, setStemsSelected] = useState(selected)
|
|
12
12
|
|
|
13
|
+
const hasChanges = useMemo(
|
|
14
|
+
() => !areStemSelectionsEqual(stemsSelected, selected),
|
|
15
|
+
[stemsSelected, selected],
|
|
16
|
+
)
|
|
17
|
+
|
|
13
18
|
useEffect(() => {
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
if (!hasChanges) {
|
|
20
|
+
setStemsSelected(selected)
|
|
21
|
+
}
|
|
22
|
+
}, [selected, hasChanges])
|
|
16
23
|
|
|
17
24
|
const onToggleStems = async (value) => {
|
|
18
25
|
if (value.locked) {
|
|
@@ -33,11 +40,6 @@ export function useForm({ onShowPaywall, selected = [] }) {
|
|
|
33
40
|
})
|
|
34
41
|
}
|
|
35
42
|
|
|
36
|
-
const hasChanges = useMemo(
|
|
37
|
-
() => !areStemSelectionsEqual(stemsSelected, selected),
|
|
38
|
-
[stemsSelected, selected],
|
|
39
|
-
)
|
|
40
|
-
|
|
41
43
|
return {
|
|
42
44
|
stemsSelected,
|
|
43
45
|
onToggleStems,
|