@dloizides/ui-forms 1.15.0 → 1.16.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.
- package/dist/index.d.mts +57 -1
- package/dist/index.d.ts +57 -1
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1673,6 +1673,30 @@ function DateRangeControl({
|
|
|
1673
1673
|
] });
|
|
1674
1674
|
}
|
|
1675
1675
|
|
|
1676
|
-
|
|
1676
|
+
// src/groupSelection/groupSelection.ts
|
|
1677
|
+
var NONE = 0;
|
|
1678
|
+
function countSelected(selected, groupKeys) {
|
|
1679
|
+
return groupKeys.filter((key) => selected.includes(key)).length;
|
|
1680
|
+
}
|
|
1681
|
+
function resolveGroupSelection(selected, groupKeys) {
|
|
1682
|
+
const count = countSelected(selected, groupKeys);
|
|
1683
|
+
if (count === NONE) return { all: false, some: false };
|
|
1684
|
+
return count === groupKeys.length ? { all: true, some: false } : { all: false, some: true };
|
|
1685
|
+
}
|
|
1686
|
+
function groupAriaChecked(state) {
|
|
1687
|
+
if (state.all) return true;
|
|
1688
|
+
return state.some ? "mixed" : false;
|
|
1689
|
+
}
|
|
1690
|
+
function toggleGroupSelection(selected, groupKeys, order) {
|
|
1691
|
+
const { all } = resolveGroupSelection(selected, groupKeys);
|
|
1692
|
+
if (all) return selected.filter((key) => !groupKeys.includes(key));
|
|
1693
|
+
const merged = [...selected];
|
|
1694
|
+
groupKeys.forEach((key) => {
|
|
1695
|
+
if (!merged.includes(key)) merged.push(key);
|
|
1696
|
+
});
|
|
1697
|
+
return order === void 0 ? merged : order.filter((key) => merged.includes(key));
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
export { AnchoredMenu, ChipSelector, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeControl, Field, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormSwitch, SelectControl, ThemedTextInput, TypeaheadControl, controlStyles, groupAriaChecked, isUnmatched, resolveGroupSelection, suggestOptions, toggleGroupSelection, useRecentValues, useThemedInput };
|
|
1677
1701
|
//# sourceMappingURL=index.mjs.map
|
|
1678
1702
|
//# sourceMappingURL=index.mjs.map
|