@vellira-ui/react-native 2.95.2 → 2.97.0

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 +11 -15
  2. package/package.json +4 -2
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AccessibilityInfo, ActivityIndicator, Animated, BackHandler, Dimensions, Easing, FlatList, Modal as Modal$1, Platform, Pressable, ScrollView, StyleSheet, Text, TextInput, View, findNodeHandle, useWindowDimensions } from "react-native";
2
2
  import { Children, cloneElement, createContext, createElement, forwardRef, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
- import { createConsoleOverlayDiagnostics, createOverlayManagerStore, createOverlayZIndexPolicy, createRetainedResourceRegistry, deferOverlayFocusRestore, getCompoundSlot, markCompoundSlot, resolveOverlayPresentation } from "@vellira-ui/core";
3
+ import { createConsoleOverlayDiagnostics, createOverlayManagerStore, createOverlayZIndexPolicy, createRetainedResourceRegistry, deferOverlayFocusRestore, getCompoundSlot, markCompoundSlot, resolveOverlayPresentation, resolveSelectGroupSelection } from "@vellira-ui/core";
4
4
  import { controlSizes, darkTheme, highContrastTheme, lightTheme } from "@vellira-ui/tokens";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { Check, ChevronDown, Close, Search } from "@vellira-ui/icons";
@@ -4815,24 +4815,20 @@ function useSelectRootActions({ multiple, maxSelected, closeOnSelect, selectedVa
4815
4815
  ]),
4816
4816
  selectGroup: useCallback((values) => {
4817
4817
  if (!multiple || values.length === 0) return;
4818
- const enabledValues = values.filter((value) => optionsByValue.has(value));
4819
- const selectedGroupValues = enabledValues.filter((value) => selectedValues.includes(value));
4820
- const outsideSelectedCount = selectedValues.filter((value) => !enabledValues.includes(value)).length;
4821
- const maxSelectableGroupCount = typeof maxSelected === "number" ? Math.max(0, Math.min(enabledValues.length, maxSelected - outsideSelectedCount)) : enabledValues.length;
4822
- if (selectedGroupValues.length > 0 && selectedGroupValues.length >= maxSelectableGroupCount) {
4818
+ const nextSelection = resolveSelectGroupSelection({
4819
+ selectedValues,
4820
+ groupValues: values,
4821
+ enabledValues: new Set(optionsByValue.keys()),
4822
+ maxSelected
4823
+ });
4824
+ if (nextSelection.clearedGroup) {
4823
4825
  selectedFocusValueRef.current = void 0;
4824
- setSelectedValue(selectedValues.filter((value) => !enabledValues.includes(value)));
4826
+ setSelectedValue(nextSelection.selectedValues);
4825
4827
  announce("Group selection cleared");
4826
4828
  return;
4827
4829
  }
4828
- const nextValues = [...selectedValues];
4829
- for (const value of enabledValues) {
4830
- if (nextValues.includes(value)) continue;
4831
- if (typeof maxSelected === "number" && nextValues.length >= maxSelected) break;
4832
- nextValues.push(value);
4833
- }
4834
- setSelectedValue(nextValues);
4835
- selectedFocusValueRef.current = nextValues.at(-1);
4830
+ setSelectedValue(nextSelection.selectedValues);
4831
+ selectedFocusValueRef.current = nextSelection.selectedValues.at(-1);
4836
4832
  announce("Group selected");
4837
4833
  if (closeOnSelect) closeAndFocusTrigger();
4838
4834
  }, [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vellira-ui/react-native",
3
- "version": "2.95.2",
3
+ "version": "2.97.0",
4
4
  "description": "React Native components for Vellira Design System",
5
5
  "keywords": [
6
6
  "vellira",
@@ -48,7 +48,7 @@
48
48
  "build": "pnpm run clean && tsdown && tsc -p tsconfig.build.json --emitDeclarationOnly",
49
49
  "lint": "eslint 'src/**/*.{ts,tsx}'",
50
50
  "lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
51
- "typecheck": "tsc -p tsconfig.typecheck.json --noEmit",
51
+ "typecheck": "tsc -p tsconfig.typecheck.json --noEmit && tsc -p tsconfig.test.json --noEmit && tsc -p tsconfig.stories.json --noEmit",
52
52
  "test": "vitest run --config vitest.config.ts",
53
53
  "test:coverage": "vitest run --config vitest.config.ts --coverage"
54
54
  },
@@ -65,9 +65,11 @@
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/react": "^19.2.3",
68
+ "@storybook/react-native": "^10.5.0",
68
69
  "@vitest/coverage-v8": "^4.1.10",
69
70
  "jsdom": "^28.1.0",
70
71
  "react": "19.2.3",
72
+ "storybook": "^10.5.0",
71
73
  "tsdown": "^0.22.13",
72
74
  "typescript": "6.0.3",
73
75
  "vitest": "^4.1.10"