@vritti/quantum-ui 0.6.3 → 0.6.4

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 (244) hide show
  1. package/dist/ActivePoints.js +1 -1
  2. package/dist/ActiveShapeUtils.js +1 -1
  3. package/dist/Alert.js +2 -1
  4. package/dist/Alert.js.map +1 -1
  5. package/dist/AreaChart.js +48 -19
  6. package/dist/AreaChart.js.map +1 -1
  7. package/dist/BarChart.js +38 -10
  8. package/dist/BarChart.js.map +1 -1
  9. package/dist/CartesianChart.js +1 -1
  10. package/dist/ChartEmpty.js +8 -0
  11. package/dist/ChartEmpty.js.map +1 -0
  12. package/dist/{Chart.js → ChartFrame.js} +72 -2
  13. package/dist/ChartFrame.js.map +1 -0
  14. package/dist/CurrencyFieldFilter.js +2 -1
  15. package/dist/CurrencyFieldFilter.js.map +1 -1
  16. package/dist/DateRangePicker.js +2 -1
  17. package/dist/DateRangePicker.js.map +1 -1
  18. package/dist/IconSelect.js +1916 -1945
  19. package/dist/IconSelect.js.map +1 -1
  20. package/dist/LineChart.js +116 -107
  21. package/dist/LineChart.js.map +1 -1
  22. package/dist/PieChart.js +37 -15
  23. package/dist/PieChart.js.map +1 -1
  24. package/dist/PolarChart.js +1 -1
  25. package/dist/RadarChart.js +44 -17
  26. package/dist/RadarChart.js.map +1 -1
  27. package/dist/RadialChart.js +36 -11
  28. package/dist/RadialChart.js.map +1 -1
  29. package/dist/Select.js +48 -7
  30. package/dist/Select.js.map +1 -1
  31. package/dist/SelectFilter.js +61 -6
  32. package/dist/SelectFilter.js.map +1 -1
  33. package/dist/SingleSelect.js +82 -7
  34. package/dist/SingleSelect.js.map +1 -1
  35. package/dist/Sonner.js +2 -1
  36. package/dist/Sonner.js.map +1 -1
  37. package/dist/ValueFilter.js +2 -1
  38. package/dist/ValueFilter.js.map +1 -1
  39. package/dist/ViewTabs.js.map +1 -1
  40. package/dist/assets/quantum-ui.css +116 -9
  41. package/dist/bindFilters.js +37 -0
  42. package/dist/bindFilters.js.map +1 -0
  43. package/dist/components/Chart.js +125 -0
  44. package/dist/components/Chart.js.map +1 -0
  45. package/dist/components/ContextBar.js +16 -0
  46. package/dist/components/ContextBar.js.map +1 -0
  47. package/dist/components/DataTable.js +1 -1
  48. package/dist/components/DateFilter.js +2 -1
  49. package/dist/components/DateFilter.js.map +1 -1
  50. package/dist/conditions.js +651 -0
  51. package/dist/conditions.js.map +1 -0
  52. package/dist/contextAnchor.js +3 -2
  53. package/dist/contextAnchor.js.map +1 -1
  54. package/dist/getRadiusAndStrokeWidthFromDot.js +1 -1
  55. package/dist/getZIndexFromUnknown.js +1 -1
  56. package/dist/graphicalItemSelectors.js +1 -1
  57. package/dist/hooks/index.js +1 -2
  58. package/dist/hooks/index.js.map +1 -1
  59. package/dist/index.js +2 -3
  60. package/dist/index.js.map +1 -1
  61. package/dist/index7.js +2 -1
  62. package/dist/index7.js.map +1 -1
  63. package/dist/info.js +19 -0
  64. package/dist/info.js.map +1 -0
  65. package/dist/lib/components/AreaChart/AreaChart.d.ts +12 -15
  66. package/dist/lib/components/AreaChart/AreaChart.d.ts.map +1 -1
  67. package/dist/lib/components/AreaChart/index.d.ts +0 -1
  68. package/dist/lib/components/AreaChart/index.d.ts.map +1 -1
  69. package/dist/lib/components/BarChart/BarChart.d.ts +11 -14
  70. package/dist/lib/components/BarChart/BarChart.d.ts.map +1 -1
  71. package/dist/lib/components/BarChart/index.d.ts +0 -1
  72. package/dist/lib/components/BarChart/index.d.ts.map +1 -1
  73. package/dist/lib/components/Chart/ChartEmpty.d.ts +3 -0
  74. package/dist/lib/components/Chart/ChartEmpty.d.ts.map +1 -0
  75. package/dist/lib/components/Chart/ChartFrame.d.ts +16 -0
  76. package/dist/lib/components/Chart/ChartFrame.d.ts.map +1 -0
  77. package/dist/lib/components/Chart/ChartKey.d.ts +11 -0
  78. package/dist/lib/components/Chart/ChartKey.d.ts.map +1 -0
  79. package/dist/lib/components/Chart/ChartStates.d.ts +12 -0
  80. package/dist/lib/components/Chart/ChartStates.d.ts.map +1 -0
  81. package/dist/lib/components/Chart/colorSeries.d.ts +6 -0
  82. package/dist/lib/components/Chart/colorSeries.d.ts.map +1 -0
  83. package/dist/lib/components/Chart/index.d.ts +5 -0
  84. package/dist/lib/components/Chart/index.d.ts.map +1 -0
  85. package/dist/lib/components/Chart/types.d.ts +36 -0
  86. package/dist/lib/components/Chart/types.d.ts.map +1 -0
  87. package/dist/lib/components/Chart/useChart.d.ts +23 -0
  88. package/dist/lib/components/Chart/useChart.d.ts.map +1 -0
  89. package/dist/lib/components/Chart/utils.d.ts +7 -0
  90. package/dist/lib/components/Chart/utils.d.ts.map +1 -0
  91. package/dist/lib/components/ContextBar/ContextBar.d.ts +10 -0
  92. package/dist/lib/components/ContextBar/ContextBar.d.ts.map +1 -0
  93. package/dist/lib/components/ContextBar/index.d.ts +3 -0
  94. package/dist/lib/components/ContextBar/index.d.ts.map +1 -0
  95. package/dist/lib/components/ContextBar/useContextSave.d.ts +15 -0
  96. package/dist/lib/components/ContextBar/useContextSave.d.ts.map +1 -0
  97. package/dist/lib/components/ContextBar/useContextState.d.ts +22 -0
  98. package/dist/lib/components/ContextBar/useContextState.d.ts.map +1 -0
  99. package/dist/lib/components/ContextBar/useSettlingFields.d.ts +5 -0
  100. package/dist/lib/components/ContextBar/useSettlingFields.d.ts.map +1 -0
  101. package/dist/lib/components/CurrencyField/CurrencyFieldFilter.d.ts +2 -1
  102. package/dist/lib/components/CurrencyField/CurrencyFieldFilter.d.ts.map +1 -1
  103. package/dist/lib/components/DataTable/DataTable.d.ts +1 -1
  104. package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
  105. package/dist/lib/components/DataTable/cells/cells.d.ts.map +1 -1
  106. package/dist/lib/components/DataTable/components/DataTableColumnHeader.d.ts.map +1 -1
  107. package/dist/lib/components/DataTable/components/DataTableFilters.d.ts.map +1 -1
  108. package/dist/lib/components/DataTable/components/DataTableLoadStates.d.ts +9 -0
  109. package/dist/lib/components/DataTable/components/DataTableLoadStates.d.ts.map +1 -0
  110. package/dist/lib/components/DataTable/components/DataTablePagination.d.ts.map +1 -1
  111. package/dist/lib/components/DataTable/components/DataTableSearch.d.ts.map +1 -1
  112. package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts.map +1 -1
  113. package/dist/lib/components/DataTable/components/DataTableViewOptions.d.ts.map +1 -1
  114. package/dist/lib/components/DataTable/components/bindFilters.d.ts +3 -1
  115. package/dist/lib/components/DataTable/components/bindFilters.d.ts.map +1 -1
  116. package/dist/lib/components/DataTable/hooks/useAutoUpsert.d.ts +1 -1
  117. package/dist/lib/components/DataTable/hooks/useAutoUpsert.d.ts.map +1 -1
  118. package/dist/lib/components/DataTable/hooks/useDataTable.d.ts +15 -8
  119. package/dist/lib/components/DataTable/hooks/useDataTable.d.ts.map +1 -1
  120. package/dist/lib/components/DataTable/index.d.ts +3 -4
  121. package/dist/lib/components/DataTable/index.d.ts.map +1 -1
  122. package/dist/lib/components/DataTable/store/store.d.ts +10 -9
  123. package/dist/lib/components/DataTable/store/store.d.ts.map +1 -1
  124. package/dist/lib/components/DataTable/store/useTableSlice.d.ts +5 -4
  125. package/dist/lib/components/DataTable/store/useTableSlice.d.ts.map +1 -1
  126. package/dist/lib/components/DataTable/types.d.ts +27 -7
  127. package/dist/lib/components/DataTable/types.d.ts.map +1 -1
  128. package/dist/lib/components/DataTable/utils.d.ts +1 -1
  129. package/dist/lib/components/DataTable/utils.d.ts.map +1 -1
  130. package/dist/lib/components/DateFilter/DateFilter.d.ts +2 -1
  131. package/dist/lib/components/DateFilter/DateFilter.d.ts.map +1 -1
  132. package/dist/lib/components/DateRangePicker/DateRangeFilter.d.ts +2 -1
  133. package/dist/lib/components/DateRangePicker/DateRangeFilter.d.ts.map +1 -1
  134. package/dist/lib/components/Editor/editor-ui/button.d.ts +1 -1
  135. package/dist/lib/components/LineChart/LineChart.d.ts +17 -22
  136. package/dist/lib/components/LineChart/LineChart.d.ts.map +1 -1
  137. package/dist/lib/components/LineChart/LineChartEmpty.d.ts +2 -7
  138. package/dist/lib/components/LineChart/LineChartEmpty.d.ts.map +1 -1
  139. package/dist/lib/components/LineChart/index.d.ts +1 -3
  140. package/dist/lib/components/LineChart/index.d.ts.map +1 -1
  141. package/dist/lib/components/PieChart/PieChart.d.ts +9 -8
  142. package/dist/lib/components/PieChart/PieChart.d.ts.map +1 -1
  143. package/dist/lib/components/PieChart/index.d.ts +0 -1
  144. package/dist/lib/components/PieChart/index.d.ts.map +1 -1
  145. package/dist/lib/components/RadarChart/RadarChart.d.ts +10 -13
  146. package/dist/lib/components/RadarChart/RadarChart.d.ts.map +1 -1
  147. package/dist/lib/components/RadarChart/index.d.ts +0 -1
  148. package/dist/lib/components/RadarChart/index.d.ts.map +1 -1
  149. package/dist/lib/components/RadialChart/RadialChart.d.ts +11 -8
  150. package/dist/lib/components/RadialChart/RadialChart.d.ts.map +1 -1
  151. package/dist/lib/components/RadialChart/index.d.ts +0 -1
  152. package/dist/lib/components/RadialChart/index.d.ts.map +1 -1
  153. package/dist/lib/components/Select/Select.d.ts.map +1 -1
  154. package/dist/lib/components/Select/SelectFilter.d.ts +10 -0
  155. package/dist/lib/components/Select/SelectFilter.d.ts.map +1 -1
  156. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts +1 -0
  157. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  158. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts +1 -0
  159. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -1
  160. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts +1 -0
  161. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -1
  162. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts +1 -0
  163. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
  164. package/dist/lib/components/Select/contextAnchor.d.ts +1 -0
  165. package/dist/lib/components/Select/contextAnchor.d.ts.map +1 -1
  166. package/dist/lib/components/Select/hooks/useSelect.d.ts +4 -0
  167. package/dist/lib/components/Select/hooks/useSelect.d.ts.map +1 -1
  168. package/dist/lib/components/Select/types.d.ts +1 -0
  169. package/dist/lib/components/Select/types.d.ts.map +1 -1
  170. package/dist/lib/components/ValueFilter/ValueFilter.d.ts +2 -1
  171. package/dist/lib/components/ValueFilter/ValueFilter.d.ts.map +1 -1
  172. package/dist/lib/components/ViewTabs/ViewTabs.d.ts +3 -3
  173. package/dist/lib/components/ViewTabs/ViewTabs.d.ts.map +1 -1
  174. package/dist/lib/config/index.d.ts +1 -0
  175. package/dist/lib/config/index.d.ts.map +1 -1
  176. package/dist/lib/hooks/index.d.ts +1 -0
  177. package/dist/lib/hooks/index.d.ts.map +1 -1
  178. package/dist/lib/hooks/useOrgCountryCode.d.ts +2 -0
  179. package/dist/lib/hooks/useOrgCountryCode.d.ts.map +1 -0
  180. package/dist/lib/selects/icon/IconSelect.d.ts.map +1 -1
  181. package/dist/lib/services/context-states.service.d.ts +4 -0
  182. package/dist/lib/services/context-states.service.d.ts.map +1 -0
  183. package/dist/lib/services/table-views.service.d.ts +7 -5
  184. package/dist/lib/services/table-views.service.d.ts.map +1 -1
  185. package/dist/lib/types/api-response.d.ts +2 -2
  186. package/dist/lib/types/api-response.d.ts.map +1 -1
  187. package/dist/lib/types/{table-filter.d.ts → conditions.d.ts} +1 -27
  188. package/dist/lib/types/conditions.d.ts.map +1 -0
  189. package/dist/lib/types/table-state.d.ts +28 -0
  190. package/dist/lib/types/table-state.d.ts.map +1 -0
  191. package/dist/lib/utils/axios.d.ts +1 -0
  192. package/dist/lib/utils/axios.d.ts.map +1 -1
  193. package/dist/lib/utils/conditions.d.ts +11 -0
  194. package/dist/lib/utils/conditions.d.ts.map +1 -0
  195. package/dist/lib/utils/country.d.ts +3 -0
  196. package/dist/lib/utils/country.d.ts.map +1 -0
  197. package/dist/lib/utils/filter.d.ts +1 -1
  198. package/dist/lib/utils/filter.d.ts.map +1 -1
  199. package/dist/lib/utils/timezone.d.ts +1 -0
  200. package/dist/lib/utils/timezone.d.ts.map +1 -1
  201. package/dist/polarScaleSelectors.js +1 -1
  202. package/dist/shadcn/optionKeys.d.ts +4 -0
  203. package/dist/shadcn/optionKeys.d.ts.map +1 -0
  204. package/dist/shadcn/shadcnBadge/Badge.d.ts +1 -1
  205. package/dist/shadcn/shadcnButton/Button.d.ts +2 -2
  206. package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts +1 -1
  207. package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts.map +1 -1
  208. package/dist/shadcn/shadcnSingleSelect/single-select.d.ts +1 -1
  209. package/dist/shadcn/shadcnSingleSelect/single-select.d.ts.map +1 -1
  210. package/dist/table-properties.js +64 -33
  211. package/dist/table-properties.js.map +1 -1
  212. package/dist/timezone.js +4 -1
  213. package/dist/timezone.js.map +1 -1
  214. package/dist/tooltipContext.js +1 -1
  215. package/dist/triangle-alert.js +1 -16
  216. package/dist/triangle-alert.js.map +1 -1
  217. package/dist/types/conditions.js +2 -0
  218. package/dist/types/conditions.js.map +1 -0
  219. package/dist/types/{table-filter.js → table-state.js} +1 -1
  220. package/dist/types/table-state.js.map +1 -0
  221. package/dist/useContextState.js +201 -0
  222. package/dist/useContextState.js.map +1 -0
  223. package/dist/useDataTable.js +454 -848
  224. package/dist/useDataTable.js.map +1 -1
  225. package/dist/useWorkspaceCurrency.js +27 -2
  226. package/dist/useWorkspaceCurrency.js.map +1 -1
  227. package/dist/useWorkspaceTimeZone.js +2 -2
  228. package/dist/useWorkspaceTimeZone.js.map +1 -1
  229. package/dist/utils/axios.js +5 -1
  230. package/dist/utils/axios.js.map +1 -1
  231. package/dist/utils/country.js +20 -0
  232. package/dist/utils/country.js.map +1 -0
  233. package/dist/utils/filter.js.map +1 -1
  234. package/dist/utils/format.js +2 -2
  235. package/dist/utils/format.js.map +1 -1
  236. package/dist/utils/timezone.js +1 -1
  237. package/dist/utils2.js +6 -0
  238. package/dist/utils2.js.map +1 -0
  239. package/package.json +20 -4
  240. package/dist/Chart.js.map +0 -1
  241. package/dist/lib/types/table-filter.d.ts.map +0 -1
  242. package/dist/types/table-filter.js.map +0 -1
  243. package/dist/useCategoricalColors.js +0 -20
  244. package/dist/useCategoricalColors.js.map +0 -1
@@ -0,0 +1,651 @@
1
+ const { getOwnPropertyNames, getOwnPropertySymbols } = Object;
2
+ // eslint-disable-next-line @typescript-eslint/unbound-method
3
+ const { hasOwnProperty } = Object.prototype;
4
+ /**
5
+ * Combine two comparators into a single comparators.
6
+ */
7
+ function combineComparators(comparatorA, comparatorB) {
8
+ return function isEqual(a, b, state) {
9
+ return comparatorA(a, b, state) && comparatorB(a, b, state);
10
+ };
11
+ }
12
+ /**
13
+ * Wrap the provided `areItemsEqual` method to manage the circular state, allowing
14
+ * for circular references to be safely included in the comparison without creating
15
+ * stack overflows.
16
+ */
17
+ function createIsCircular(areItemsEqual) {
18
+ return function isCircular(a, b, state) {
19
+ if (!a || !b || typeof a !== 'object' || typeof b !== 'object') {
20
+ return areItemsEqual(a, b, state);
21
+ }
22
+ const { cache } = state;
23
+ const cachedA = cache.get(a);
24
+ const cachedB = cache.get(b);
25
+ if (cachedA && cachedB) {
26
+ return cachedA === b && cachedB === a;
27
+ }
28
+ cache.set(a, b);
29
+ cache.set(b, a);
30
+ const result = areItemsEqual(a, b, state);
31
+ cache.delete(a);
32
+ cache.delete(b);
33
+ return result;
34
+ };
35
+ }
36
+ /**
37
+ * Get the properties to strictly examine, which include both own properties that are
38
+ * not enumerable and symbol properties.
39
+ */
40
+ function getStrictProperties(object) {
41
+ return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
42
+ }
43
+ /**
44
+ * Whether the object contains the property passed as an own property.
45
+ */
46
+ const hasOwn =
47
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
48
+ Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property));
49
+
50
+ const PREACT_VNODE = '__v';
51
+ const PREACT_OWNER = '__o';
52
+ const REACT_OWNER = '_owner';
53
+ const { getOwnPropertyDescriptor, keys } = Object;
54
+ /**
55
+ * Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.
56
+ * Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.
57
+ *
58
+ * @note
59
+ * When available in the environment, this is just a re-export of the global
60
+ * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) method.
61
+ */
62
+ const sameValueEqual =
63
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
64
+ Object.is
65
+ || function sameValueEqual(a, b) {
66
+ return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
67
+ };
68
+ /**
69
+ * Whether the values passed are equal based on a
70
+ * [Strict Equality Comparison](https://262.ecma-international.org/7.0/#sec-strict-equality-comparison) basis.
71
+ * Simplified, this maps to if the two values are referentially equal to one another (`a === b`).
72
+ *
73
+ * @note
74
+ * This is mainly available as a convenience function, such as being a default when a function to determine equality between
75
+ * two objects is used.
76
+ */
77
+ function strictEqual(a, b) {
78
+ return a === b;
79
+ }
80
+ /**
81
+ * Whether the array buffers are equal in value.
82
+ */
83
+ function areArrayBuffersEqual(a, b) {
84
+ return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
85
+ }
86
+ /**
87
+ * Whether the arrays are equal in value.
88
+ */
89
+ function areArraysEqual(a, b, state) {
90
+ let index = a.length;
91
+ if (b.length !== index) {
92
+ return false;
93
+ }
94
+ while (index-- > 0) {
95
+ if (!state.equals(a[index], b[index], index, index, a, b, state)) {
96
+ return false;
97
+ }
98
+ }
99
+ return true;
100
+ }
101
+ /**
102
+ * Whether the dataviews are equal in value.
103
+ */
104
+ function areDataViewsEqual(a, b) {
105
+ return (a.byteLength === b.byteLength
106
+ && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)));
107
+ }
108
+ /**
109
+ * Whether the dates passed are equal in value.
110
+ */
111
+ function areDatesEqual(a, b) {
112
+ return sameValueEqual(a.getTime(), b.getTime());
113
+ }
114
+ /**
115
+ * Whether the errors passed are equal in value.
116
+ */
117
+ function areErrorsEqual(a, b) {
118
+ return a.name === b.name && a.message === b.message && a.cause === b.cause && a.stack === b.stack;
119
+ }
120
+ /**
121
+ * Whether the `Map`s are equal in value.
122
+ */
123
+ function areMapsEqual(a, b, state) {
124
+ const size = a.size;
125
+ if (size !== b.size) {
126
+ return false;
127
+ }
128
+ if (!size) {
129
+ return true;
130
+ }
131
+ const matchedIndices = new Array(size);
132
+ const aIterable = a.entries();
133
+ let aResult;
134
+ let bResult;
135
+ let index = 0;
136
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
137
+ while ((aResult = aIterable.next())) {
138
+ if (aResult.done) {
139
+ break;
140
+ }
141
+ const bIterable = b.entries();
142
+ let hasMatch = false;
143
+ let matchIndex = 0;
144
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
145
+ while ((bResult = bIterable.next())) {
146
+ if (bResult.done) {
147
+ break;
148
+ }
149
+ if (matchedIndices[matchIndex]) {
150
+ matchIndex++;
151
+ continue;
152
+ }
153
+ const aEntry = aResult.value;
154
+ const bEntry = bResult.value;
155
+ if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state)
156
+ && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
157
+ hasMatch = matchedIndices[matchIndex] = true;
158
+ break;
159
+ }
160
+ matchIndex++;
161
+ }
162
+ if (!hasMatch) {
163
+ return false;
164
+ }
165
+ index++;
166
+ }
167
+ return true;
168
+ }
169
+ /**
170
+ * Whether the objects are equal in value.
171
+ */
172
+ function areObjectsEqual(a, b, state) {
173
+ const properties = keys(a);
174
+ let index = properties.length;
175
+ if (keys(b).length !== index) {
176
+ return false;
177
+ }
178
+ // Decrementing `while` showed faster results than either incrementing or
179
+ // decrementing `for` loop and than an incrementing `while` loop. Declarative
180
+ // methods like `some` / `every` were not used to avoid incurring the garbage
181
+ // cost of anonymous callbacks.
182
+ while (index-- > 0) {
183
+ if (!isPropertyEqual(a, b, state, properties[index])) {
184
+ return false;
185
+ }
186
+ }
187
+ return true;
188
+ }
189
+ /**
190
+ * Whether the objects are equal in value with strict property checking.
191
+ */
192
+ function areObjectsEqualStrict(a, b, state) {
193
+ const properties = getStrictProperties(a);
194
+ let index = properties.length;
195
+ if (getStrictProperties(b).length !== index) {
196
+ return false;
197
+ }
198
+ let property;
199
+ let descriptorA;
200
+ let descriptorB;
201
+ // Decrementing `while` showed faster results than either incrementing or
202
+ // decrementing `for` loop and than an incrementing `while` loop. Declarative
203
+ // methods like `some` / `every` were not used to avoid incurring the garbage
204
+ // cost of anonymous callbacks.
205
+ while (index-- > 0) {
206
+ property = properties[index];
207
+ if (!isPropertyEqual(a, b, state, property)) {
208
+ return false;
209
+ }
210
+ descriptorA = getOwnPropertyDescriptor(a, property);
211
+ descriptorB = getOwnPropertyDescriptor(b, property);
212
+ if ((descriptorA || descriptorB)
213
+ && (!descriptorA
214
+ || !descriptorB
215
+ || descriptorA.configurable !== descriptorB.configurable
216
+ || descriptorA.enumerable !== descriptorB.enumerable
217
+ || descriptorA.writable !== descriptorB.writable)) {
218
+ return false;
219
+ }
220
+ }
221
+ return true;
222
+ }
223
+ /**
224
+ * Whether the primitive wrappers passed are equal in value.
225
+ */
226
+ function arePrimitiveWrappersEqual(a, b) {
227
+ return sameValueEqual(a.valueOf(), b.valueOf());
228
+ }
229
+ /**
230
+ * Whether the regexps passed are equal in value.
231
+ */
232
+ function areRegExpsEqual(a, b) {
233
+ return a.source === b.source && a.flags === b.flags;
234
+ }
235
+ /**
236
+ * Whether the `Set`s are equal in value.
237
+ */
238
+ function areSetsEqual(a, b, state) {
239
+ const size = a.size;
240
+ if (size !== b.size) {
241
+ return false;
242
+ }
243
+ if (!size) {
244
+ return true;
245
+ }
246
+ const matchedIndices = new Array(size);
247
+ const aIterable = a.values();
248
+ let aResult;
249
+ let bResult;
250
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
251
+ while ((aResult = aIterable.next())) {
252
+ if (aResult.done) {
253
+ break;
254
+ }
255
+ const bIterable = b.values();
256
+ let hasMatch = false;
257
+ let matchIndex = 0;
258
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
259
+ while ((bResult = bIterable.next())) {
260
+ if (bResult.done) {
261
+ break;
262
+ }
263
+ if (!matchedIndices[matchIndex]
264
+ && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
265
+ hasMatch = matchedIndices[matchIndex] = true;
266
+ break;
267
+ }
268
+ matchIndex++;
269
+ }
270
+ if (!hasMatch) {
271
+ return false;
272
+ }
273
+ }
274
+ return true;
275
+ }
276
+ /**
277
+ * Whether the TypedArray instances are equal in value.
278
+ */
279
+ function areTypedArraysEqual(a, b) {
280
+ let index = a.byteLength;
281
+ if (b.byteLength !== index || a.byteOffset !== b.byteOffset) {
282
+ return false;
283
+ }
284
+ while (index-- > 0) {
285
+ if (a[index] !== b[index]) {
286
+ return false;
287
+ }
288
+ }
289
+ return true;
290
+ }
291
+ /**
292
+ * Whether the URL instances are equal in value.
293
+ */
294
+ function areUrlsEqual(a, b) {
295
+ return (a.hostname === b.hostname
296
+ && a.pathname === b.pathname
297
+ && a.protocol === b.protocol
298
+ && a.port === b.port
299
+ && a.hash === b.hash
300
+ && a.username === b.username
301
+ && a.password === b.password);
302
+ }
303
+ function isPropertyEqual(a, b, state, property) {
304
+ if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE)
305
+ && (a.$$typeof || b.$$typeof)) {
306
+ return true;
307
+ }
308
+ return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
309
+ }
310
+
311
+ // eslint-disable-next-line @typescript-eslint/unbound-method
312
+ const toString = Object.prototype.toString;
313
+ /**
314
+ * Create a comparator method based on the type-specific equality comparators passed.
315
+ */
316
+ function createEqualityComparator(config) {
317
+ const supportedComparatorMap = createSupportedComparatorMap(config);
318
+ const { areArraysEqual, areDatesEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, areRegExpsEqual, areSetsEqual, getUnsupportedCustomComparator, } = config;
319
+ /**
320
+ * compare the value of the two objects and return true if they are equivalent in values
321
+ */
322
+ return function comparator(a, b, state) {
323
+ // If the items are strictly equal, no need to do a value comparison.
324
+ if (a === b) {
325
+ return true;
326
+ }
327
+ // If either of the items are nullish and fail the strictly equal check
328
+ // above, then they must be unequal.
329
+ if (a == null || b == null) {
330
+ return false;
331
+ }
332
+ const type = typeof a;
333
+ if (type !== typeof b) {
334
+ return false;
335
+ }
336
+ if (type !== 'object') {
337
+ if (type === 'number' || type === 'bigint') {
338
+ return areNumbersEqual(a, b, state);
339
+ }
340
+ if (type === 'function') {
341
+ return areFunctionsEqual(a, b, state);
342
+ }
343
+ // If a primitive value that is not strictly equal, it must be unequal.
344
+ return false;
345
+ }
346
+ const constructor = a.constructor;
347
+ // Checks are listed in order of commonality of use-case:
348
+ // 1. Common complex object types (plain object, array)
349
+ // 2. Common data values (date, regexp)
350
+ // 3. Less-common complex object types (map, set)
351
+ // 4. Less-common data values (promise, primitive wrappers)
352
+ // Inherently this is both subjective and assumptive, however
353
+ // when reviewing comparable libraries in the wild this order
354
+ // appears to be generally consistent.
355
+ // Constructors should match, otherwise there is potential for false positives
356
+ // between class and subclass or custom object and POJO.
357
+ if (constructor !== b.constructor) {
358
+ return false;
359
+ }
360
+ // Try to fast-path equality checks for other complex object types in the
361
+ // same realm to avoid capturing the string tag. Strict equality is used
362
+ // instead of `instanceof` because it is more performant for the common
363
+ // use-case. If someone is creating a subclass from a native class, it will be
364
+ // handled with the string tag comparison.
365
+ if (constructor === Object) {
366
+ return areObjectsEqual(a, b, state);
367
+ }
368
+ if (constructor === Array) {
369
+ return areArraysEqual(a, b, state);
370
+ }
371
+ if (constructor === Date) {
372
+ return areDatesEqual(a, b, state);
373
+ }
374
+ if (constructor === RegExp) {
375
+ return areRegExpsEqual(a, b, state);
376
+ }
377
+ if (constructor === Map) {
378
+ return areMapsEqual(a, b, state);
379
+ }
380
+ if (constructor === Set) {
381
+ return areSetsEqual(a, b, state);
382
+ }
383
+ if (constructor === Promise) {
384
+ // Avoid tag checks for promise values, since we know if they are not referentially equal
385
+ // then they are not equal.
386
+ return false;
387
+ }
388
+ // `isArray()` works on subclasses and is cross-realm, so we can avoid capturing
389
+ // the string tag or doing an `instanceof` in edge cases.
390
+ if (Array.isArray(a)) {
391
+ return areArraysEqual(a, b, state);
392
+ }
393
+ // Since this is a custom object, capture the string tag to determining its type.
394
+ // This is reasonably performant in modern environments like v8 and SpiderMonkey.
395
+ const tag = toString.call(a);
396
+ const supportedComparator = supportedComparatorMap[tag];
397
+ if (supportedComparator) {
398
+ return supportedComparator(a, b, state);
399
+ }
400
+ const unsupportedCustomComparator = getUnsupportedCustomComparator && getUnsupportedCustomComparator(a, b, state, tag);
401
+ if (unsupportedCustomComparator) {
402
+ return unsupportedCustomComparator(a, b, state);
403
+ }
404
+ // If not matching any tags that require a specific type of comparison, then we hard-code false because
405
+ // the only thing remaining is strict equality, which has already been compared. This is for a few reasons:
406
+ // - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only
407
+ // comparison that can be made.
408
+ // - For types that can be introspected but do not have an objective definition of what
409
+ // equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.
410
+ // In all cases, these decisions should be reevaluated based on changes to the language and
411
+ // common development practices.
412
+ return false;
413
+ };
414
+ }
415
+ /**
416
+ * Create the configuration object used for building comparators.
417
+ */
418
+ function createEqualityComparatorConfig({ circular, createCustomConfig, strict, }) {
419
+ let config = {
420
+ areArrayBuffersEqual,
421
+ areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
422
+ areDataViewsEqual,
423
+ areDatesEqual: areDatesEqual,
424
+ areErrorsEqual: areErrorsEqual,
425
+ areFunctionsEqual: strictEqual,
426
+ areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
427
+ areNumbersEqual: sameValueEqual,
428
+ areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
429
+ arePrimitiveWrappersEqual: arePrimitiveWrappersEqual,
430
+ areRegExpsEqual: areRegExpsEqual,
431
+ areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
432
+ areTypedArraysEqual: strict
433
+ ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict)
434
+ : areTypedArraysEqual,
435
+ areUrlsEqual: areUrlsEqual,
436
+ getUnsupportedCustomComparator: undefined,
437
+ };
438
+ if (createCustomConfig) {
439
+ config = Object.assign({}, config, createCustomConfig(config));
440
+ }
441
+ if (circular) {
442
+ const areArraysEqual = createIsCircular(config.areArraysEqual);
443
+ const areMapsEqual = createIsCircular(config.areMapsEqual);
444
+ const areObjectsEqual = createIsCircular(config.areObjectsEqual);
445
+ const areSetsEqual = createIsCircular(config.areSetsEqual);
446
+ config = Object.assign({}, config, {
447
+ areArraysEqual,
448
+ areMapsEqual,
449
+ areObjectsEqual,
450
+ areSetsEqual,
451
+ });
452
+ }
453
+ return config;
454
+ }
455
+ /**
456
+ * Default equality comparator pass-through, used as the standard `isEqual` creator for
457
+ * use inside the built comparator.
458
+ */
459
+ function createInternalEqualityComparator(compare) {
460
+ return function (a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
461
+ return compare(a, b, state);
462
+ };
463
+ }
464
+ /**
465
+ * Create the `isEqual` function used by the consuming application.
466
+ */
467
+ function createIsEqual({ circular, comparator, createState, equals, strict }) {
468
+ if (createState) {
469
+ return function isEqual(a, b) {
470
+ const { cache = circular ? new WeakMap() : undefined, meta } = createState();
471
+ return comparator(a, b, {
472
+ cache,
473
+ equals,
474
+ meta,
475
+ strict,
476
+ });
477
+ };
478
+ }
479
+ if (circular) {
480
+ return function isEqual(a, b) {
481
+ return comparator(a, b, {
482
+ cache: new WeakMap(),
483
+ equals,
484
+ meta: undefined,
485
+ strict,
486
+ });
487
+ };
488
+ }
489
+ const state = {
490
+ cache: undefined,
491
+ equals,
492
+ meta: undefined,
493
+ strict,
494
+ };
495
+ return function isEqual(a, b) {
496
+ return comparator(a, b, state);
497
+ };
498
+ }
499
+ /**
500
+ * Create a map of `toString()` values to their respective handlers for `tag`-based lookups.
501
+ */
502
+ function createSupportedComparatorMap({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual, }) {
503
+ return {
504
+ '[object Arguments]': areObjectsEqual,
505
+ '[object Array]': areArraysEqual,
506
+ '[object ArrayBuffer]': areArrayBuffersEqual,
507
+ '[object AsyncGeneratorFunction]': areFunctionsEqual,
508
+ '[object BigInt]': areNumbersEqual,
509
+ '[object BigInt64Array]': areTypedArraysEqual,
510
+ '[object BigUint64Array]': areTypedArraysEqual,
511
+ '[object Boolean]': arePrimitiveWrappersEqual,
512
+ '[object DataView]': areDataViewsEqual,
513
+ '[object Date]': areDatesEqual,
514
+ // If an error tag, it should be tested explicitly. Like RegExp, the properties are not
515
+ // enumerable, and therefore will give false positives if tested like a standard object.
516
+ '[object Error]': areErrorsEqual,
517
+ '[object Float16Array]': areTypedArraysEqual,
518
+ '[object Float32Array]': areTypedArraysEqual,
519
+ '[object Float64Array]': areTypedArraysEqual,
520
+ '[object Function]': areFunctionsEqual,
521
+ '[object GeneratorFunction]': areFunctionsEqual,
522
+ '[object Int8Array]': areTypedArraysEqual,
523
+ '[object Int16Array]': areTypedArraysEqual,
524
+ '[object Int32Array]': areTypedArraysEqual,
525
+ '[object Map]': areMapsEqual,
526
+ '[object Number]': arePrimitiveWrappersEqual,
527
+ '[object Object]': (a, b, state) =>
528
+ // The exception for value comparison is custom `Promise`-like class instances. These should
529
+ // be treated the same as standard `Promise` objects, which means strict equality, and if
530
+ // it reaches this point then that strict equality comparison has already failed.
531
+ typeof a.then !== 'function' && typeof b.then !== 'function' && areObjectsEqual(a, b, state),
532
+ // For RegExp, the properties are not enumerable, and therefore will give false positives if
533
+ // tested like a standard object.
534
+ '[object RegExp]': areRegExpsEqual,
535
+ '[object Set]': areSetsEqual,
536
+ '[object String]': arePrimitiveWrappersEqual,
537
+ '[object URL]': areUrlsEqual,
538
+ '[object Uint8Array]': areTypedArraysEqual,
539
+ '[object Uint8ClampedArray]': areTypedArraysEqual,
540
+ '[object Uint16Array]': areTypedArraysEqual,
541
+ '[object Uint32Array]': areTypedArraysEqual,
542
+ };
543
+ }
544
+
545
+ /**
546
+ * Whether the items passed are deeply-equal in value.
547
+ */
548
+ const deepEqual = createCustomEqual();
549
+ /**
550
+ * Whether the items passed are deeply-equal in value based on strict comparison.
551
+ */
552
+ createCustomEqual({ strict: true });
553
+ /**
554
+ * Whether the items passed are deeply-equal in value, including circular references.
555
+ */
556
+ createCustomEqual({ circular: true });
557
+ /**
558
+ * Whether the items passed are deeply-equal in value, including circular references,
559
+ * based on strict comparison.
560
+ */
561
+ createCustomEqual({
562
+ circular: true,
563
+ strict: true,
564
+ });
565
+ /**
566
+ * Whether the items passed are shallowly-equal in value.
567
+ */
568
+ createCustomEqual({
569
+ createInternalComparator: () => sameValueEqual,
570
+ });
571
+ /**
572
+ * Whether the items passed are shallowly-equal in value based on strict comparison
573
+ */
574
+ createCustomEqual({
575
+ strict: true,
576
+ createInternalComparator: () => sameValueEqual,
577
+ });
578
+ /**
579
+ * Whether the items passed are shallowly-equal in value, including circular references.
580
+ */
581
+ createCustomEqual({
582
+ circular: true,
583
+ createInternalComparator: () => sameValueEqual,
584
+ });
585
+ /**
586
+ * Whether the items passed are shallowly-equal in value, including circular references,
587
+ * based on strict comparison.
588
+ */
589
+ createCustomEqual({
590
+ circular: true,
591
+ createInternalComparator: () => sameValueEqual,
592
+ strict: true,
593
+ });
594
+ /**
595
+ * Create a custom equality comparison method.
596
+ *
597
+ * This can be done to create very targeted comparisons in extreme hot-path scenarios
598
+ * where the standard methods are not performant enough, but can also be used to provide
599
+ * support for legacy environments that do not support expected features like
600
+ * `RegExp.prototype.flags` out of the box.
601
+ */
602
+ function createCustomEqual(options = {}) {
603
+ const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false, } = options;
604
+ const config = createEqualityComparatorConfig(options);
605
+ const comparator = createEqualityComparator(config);
606
+ const equals = createCustomInternalComparator
607
+ ? createCustomInternalComparator(comparator)
608
+ : createInternalEqualityComparator(comparator);
609
+ return createIsEqual({ circular, comparator, createState, equals, strict });
610
+ }
611
+
612
+ function withDefaults(context, defaults, { isOpening = false, resetOnOpen = [] } = {}) {
613
+ let next = context;
614
+ for (const defaultCondition of defaults) {
615
+ const current = next.find((condition) => condition.field === defaultCondition.field);
616
+ const isMissing = !current;
617
+ const resetsOnOpen = isOpening && resetOnOpen.includes(defaultCondition.field) && !deepEqual(current, defaultCondition);
618
+ if (isMissing || resetsOnOpen) {
619
+ next = [...next.filter((condition) => condition.field !== defaultCondition.field), defaultCondition];
620
+ }
621
+ }
622
+ return next;
623
+ }
624
+ function withChange(context, field, condition, dependentFields) {
625
+ const cleared = /* @__PURE__ */ new Set([field, ...dependentFields]);
626
+ const kept = context.filter((existing) => !cleared.has(existing.field));
627
+ return condition ? [...kept, condition] : kept;
628
+ }
629
+ function readValue(context, field) {
630
+ const value = context.find((condition) => condition.field === field)?.value;
631
+ return typeof value === "string" ? value : void 0;
632
+ }
633
+ function readValues(context, field) {
634
+ const value = context.find((condition) => condition.field === field)?.value;
635
+ if (Array.isArray(value)) return value.map(String);
636
+ return typeof value === "string" && value ? [value] : [];
637
+ }
638
+ function hasEveryDefault(context, defaults) {
639
+ return defaults.every((defaultCondition) => context.some((condition) => condition.field === defaultCondition.field));
640
+ }
641
+ function holdsResetDefaults(context, defaults, resetOnOpen) {
642
+ return defaults.filter((defaultCondition) => resetOnOpen.includes(defaultCondition.field)).every(
643
+ (defaultCondition) => deepEqual(
644
+ context.find((condition) => condition.field === defaultCondition.field),
645
+ defaultCondition
646
+ )
647
+ );
648
+ }
649
+
650
+ export { withChange as a, readValues as b, hasEveryDefault as c, deepEqual as d, holdsResetDefaults as h, readValue as r, withDefaults as w };
651
+ //# sourceMappingURL=conditions.js.map