@vellira-ui/react-native 2.98.5 → 2.98.7

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -856,7 +856,10 @@ function AccordionTrigger({ children, disabled = false, expanded = false, onActi
856
856
  }
857
857
  //#endregion
858
858
  //#region src/components/Accordion/Root/AccordionRoot.tsx
859
- function AccordionRoot({ children, type = "single", value, defaultValue, onValueChange, collapsible = false, disabled = false }) {
859
+ function AccordionRoot(props) {
860
+ const { children, value, defaultValue, disabled = false } = props;
861
+ const type = props.type ?? "single";
862
+ const collapsible = props.type === "multiple" ? false : props.collapsible ?? false;
860
863
  const { theme } = useTheme();
861
864
  const styles = createStyles$23(theme);
862
865
  const isControlled = value !== void 0;
@@ -872,17 +875,22 @@ function AccordionRoot({ children, type = "single", value, defaultValue, onValue
872
875
  const selectValue = useCallback((itemValue) => {
873
876
  if (disabled) return;
874
877
  const isExpanded = expandedValues.includes(itemValue);
875
- const nextValues = type === "multiple" ? isExpanded ? expandedValues.filter((current) => current !== itemValue) : [...expandedValues, itemValue] : isExpanded ? collapsible ? [] : expandedValues : [itemValue];
876
- const nextValue = type === "multiple" ? nextValues : nextValues[0] ?? "";
878
+ if (props.type === "multiple") {
879
+ const nextValues = isExpanded ? expandedValues.filter((current) => current !== itemValue) : [...expandedValues, itemValue];
880
+ if (!isControlled) setUncontrolledValue(nextValues);
881
+ props.onValueChange?.(nextValues);
882
+ return;
883
+ }
884
+ const nextValue = (isExpanded ? collapsible ? [] : expandedValues : [itemValue])[0] ?? "";
877
885
  if (!isControlled) setUncontrolledValue(nextValue);
878
- onValueChange?.(nextValue);
886
+ props.onValueChange?.(nextValue);
879
887
  }, [
880
888
  collapsible,
881
889
  disabled,
882
890
  expandedValues,
883
891
  isControlled,
884
- onValueChange,
885
- type
892
+ props.onValueChange,
893
+ props.type
886
894
  ]);
887
895
  const enhanceItem = (node) => {
888
896
  if (!isValidElement(node) || node.type !== AccordionItem) return node;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellira-ui/react-native",
3
- "version": "2.98.5",
3
+ "version": "2.98.7",
4
4
  "description": "React Native components for Vellira Design System",
5
5
  "keywords": [
6
6
  "vellira",