@capillarytech/blaze-ui 1.0.3-alpha.12 → 1.0.3-alpha.14

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.
@@ -1,18 +1,8 @@
1
1
  import React from 'react';
2
- /**
3
- * Mock data for CapUnifiedSelect component tests
4
- * Centralized test data to ensure consistency across all test cases
5
- */
6
- /**
7
- * Basic flat options array - used in most test cases
8
- */
9
2
  export declare const mockOptions: {
10
3
  label: string;
11
4
  value: string;
12
5
  }[];
13
- /**
14
- * Tree structure options with parent-child relationships
15
- */
16
6
  export declare const mockTreeOptions: {
17
7
  label: string;
18
8
  value: string;
@@ -21,9 +11,6 @@ export declare const mockTreeOptions: {
21
11
  value: string;
22
12
  }[];
23
13
  }[];
24
- /**
25
- * Tree options with mixed structure (parent with children, some parents may not be leaf values)
26
- */
27
14
  export declare const mockTreeOptionsWithMixed: {
28
15
  label: string;
29
16
  value: string;
@@ -32,88 +19,51 @@ export declare const mockTreeOptionsWithMixed: {
32
19
  value: string;
33
20
  }[];
34
21
  }[];
35
- /**
36
- * Async search results - used for testing API-based search functionality
37
- */
38
22
  export declare const mockAsyncResults: {
39
23
  label: string;
40
24
  value: string;
41
25
  }[];
42
- /**
43
- * Async search results for caching tests
44
- */
45
26
  export declare const mockAsyncResultsForCache: {
46
27
  label: string;
47
28
  value: string;
48
29
  }[];
49
- /**
50
- * Async search results for resetSearch tests
51
- */
52
30
  export declare const mockAsyncResultsForResetSearch: {
53
31
  label: string;
54
32
  value: string;
55
33
  }[];
56
- /**
57
- * Async search results for scroll tests
58
- */
59
34
  export declare const mockAsyncResultsForScroll: {
60
35
  label: string;
61
36
  value: string;
62
37
  }[];
63
- /**
64
- * Simple async result for basic tests
65
- */
66
38
  export declare const mockSimpleAsyncResult: {
67
39
  label: string;
68
40
  value: string;
69
41
  }[];
70
- /**
71
- * Initial options for resetData timeout tests
72
- */
73
42
  export declare const mockInitialOptions: {
74
43
  label: string;
75
44
  value: string;
76
45
  }[];
77
- /**
78
- * Updated options for resetData timeout tests
79
- */
80
46
  export declare const mockUpdatedOptions: {
81
47
  label: string;
82
48
  value: string;
83
49
  }[];
84
- /**
85
- * New options for resetData cleanup tests
86
- */
87
50
  export declare const mockNewOptions: {
88
51
  label: string;
89
52
  value: string;
90
53
  }[];
91
- /**
92
- * Options with React element titles - used for testing custom title rendering
93
- * Returns a function that creates the options with React elements
94
- */
95
54
  export declare const getMockOptionsWithReactTitle: () => {
96
55
  label: string;
97
56
  value: string;
98
57
  title: React.DetailedReactHTMLElement<React.HTMLAttributes<HTMLElement>, HTMLElement>;
99
58
  }[];
100
- /**
101
- * Empty options array - used for testing empty states
102
- */
103
59
  export declare const mockEmptyOptions: Array<{
104
60
  label: string;
105
61
  value: string;
106
62
  }>;
107
- /**
108
- * Simple flat options array - used in Storybook stories
109
- */
110
63
  export declare const simpleOptions: {
111
64
  label: string;
112
65
  value: string;
113
66
  }[];
114
- /**
115
- * Tree structure options - used in Storybook stories
116
- */
117
67
  export declare const treeOptions: {
118
68
  label: string;
119
69
  value: string;
@@ -1 +1 @@
1
- {"version":3,"file":"testData.d.ts","sourceRoot":"","sources":["../../components/CapUnifiedSelect/testData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW;;;GAIvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;GAc3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;GASpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;GAG5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;GAGpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,8BAA8B;;;GAG1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;GAGrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAA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AC;AAE5E,eAAO,MAAM,aAAa;;;GAMzB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;GA4BvB,CAAC"}
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ /**
3
+ * Represents a single option in the unified select component
4
+ */
5
+ export interface OptionData {
6
+ label?: React.ReactNode;
7
+ value?: string | number;
8
+ key?: string | number;
9
+ title?: React.ReactNode;
10
+ children?: OptionData[];
11
+ optionSuffix?: React.ReactNode;
12
+ optionSuffixInfo?: React.ReactNode;
13
+ optionTooltipInfo?: React.ReactNode;
14
+ disabled?: boolean;
15
+ [key: string]: unknown;
16
+ }
17
+ /**
18
+ * Tree data structure maps for efficient tree operations
19
+ */
20
+ export interface TreeMaps {
21
+ leafValues: (string | number)[];
22
+ parentChildMap: Record<string | number, (string | number)[]>;
23
+ nodeMap: Record<string | number, OptionData>;
24
+ }
25
+ /**
26
+ * Props for the NoResult component
27
+ */
28
+ export interface NoResultProps {
29
+ noResultCustomText?: string;
30
+ className?: string;
31
+ showUpload?: boolean;
32
+ options?: OptionData[];
33
+ noResultCustomIcon?: string;
34
+ }
35
+ /**
36
+ * Props for the SelectAllCheckbox component
37
+ */
38
+ export interface SelectAllCheckboxProps {
39
+ currentItems: OptionData[];
40
+ tempValue: (string | number)[] | undefined;
41
+ setTempValue: (value: (string | number)[]) => void;
42
+ processTreeData: (nodes: OptionData[]) => TreeMaps;
43
+ disabled?: boolean;
44
+ }
45
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapUnifiedSelect/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;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, TreeMaps } from './types';
2
+ /**
3
+ * Builds tree maps for efficient tree operations
4
+ * Creates maps for leaf values, parent-child relationships, and node lookups
5
+ */
6
+ export declare const buildTreeMaps: (nodes?: OptionData[]) => TreeMaps;
7
+ /**
8
+ * Counts the number of selected leaf nodes in a tree structure
9
+ * Handles parent-child relationships by expanding selected parent nodes
10
+ */
11
+ export declare const countSelectedLeaves: (treeMaps: TreeMaps, selectedValues?: (string | number)[]) => number;
12
+ /**
13
+ * Filters tree data based on search query
14
+ * Includes nodes that match search OR are selected OR have matching children
15
+ * Supports searching by label, value, or key
16
+ */
17
+ export declare const filterTreeData: (data: OptionData[], search?: string, searchBasedOn?: "label" | "value" | "key", selectedValues?: (string | number)[]) => OptionData[];
18
+ /**
19
+ * Checks if a value exists in options (recursive for tree structures)
20
+ */
21
+ export declare const findValueInOptions: (opts: OptionData[], targetValue: string | number) => boolean;
22
+ /**
23
+ * Finds selected values that don't exist in the current options
24
+ */
25
+ export declare const findMissingValues: (selectedValues: (string | number)[], currentOptions: OptionData[]) => (string | number)[];
26
+ /**
27
+ * Reorders options based on selection order
28
+ * Selected items are moved to top in the order they were selected
29
+ * For tree structures, maintains parent-child relationships
30
+ * For flat lists, directly reorders items
31
+ * Works for all data types: flat lists, tree structures, nested trees
32
+ */
33
+ export declare const reorderOptionsBySelection: (opts: OptionData[], selectedOrder: (string | number)[]) => OptionData[];
34
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../components/CapUnifiedSelect/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,UAAU,EAAE,KAAG,QAyBpD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,QAAQ,EAClB,iBAAiB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KACnC,MAkBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,UAAU,EAAE,EAClB,SAAS,MAAM,EACf,gBAAe,OAAO,GAAG,OAAO,GAAG,KAAe,EAClD,iBAAiB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KACnC,UAAU,EA8BZ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,UAAU,EAAE,EAAE,aAAa,MAAM,GAAG,MAAM,KAAG,OAYrF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EACnC,gBAAgB,UAAU,EAAE,KAC3B,CAAC,MAAM,GAAG,MAAM,CAAC,EAMnB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GACpC,MAAM,UAAU,EAAE,EAClB,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,KACjC,UAAU,EAiGZ,CAAC"}