@osdk/cbac-components 0.1.0-beta.0 → 0.1.0-beta.2
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/CHANGELOG.md +32 -0
- package/build/browser/cbac-picker/base/CategoryMarkingGroup.js +80 -0
- package/build/browser/cbac-picker/base/CategoryMarkingGroup.js.map +1 -0
- package/build/browser/cbac-picker/base/CategoryMarkingGroup.module.css +44 -0
- package/build/browser/cbac-picker/base/CategoryMarkingGroup.module.css.js +9 -0
- package/build/browser/cbac-picker/base/InfoBanner.js +32 -0
- package/build/browser/cbac-picker/base/InfoBanner.js.map +1 -0
- package/build/browser/cbac-picker/base/InfoBanner.module.css +30 -0
- package/build/browser/cbac-picker/base/InfoBanner.module.css.js +7 -0
- package/build/browser/cbac-picker/base/MarkingButton.js +42 -0
- package/build/browser/cbac-picker/base/MarkingButton.js.map +1 -0
- package/build/browser/cbac-picker/base/MarkingButton.module.css +76 -0
- package/build/browser/cbac-picker/base/MarkingButton.module.css.js +10 -0
- package/build/browser/cbac-picker/base/OverflowButton.js +50 -0
- package/build/browser/cbac-picker/base/OverflowButton.js.map +1 -0
- package/build/browser/cbac-picker/base/OverflowButton.module.css +57 -0
- package/build/browser/cbac-picker/base/OverflowButton.module.css.js +8 -0
- package/build/browser/cbac-picker/base/OverflowItem.js +42 -0
- package/build/browser/cbac-picker/base/OverflowItem.js.map +1 -0
- package/build/browser/cbac-picker/base/OverflowItem.module.css +51 -0
- package/build/browser/cbac-picker/base/OverflowItem.module.css.js +8 -0
- package/build/browser/cbac-picker/base/ValidationWarning.js +44 -0
- package/build/browser/cbac-picker/base/ValidationWarning.js.map +1 -0
- package/build/browser/cbac-picker/base/ValidationWarning.module.css +71 -0
- package/build/browser/cbac-picker/base/ValidationWarning.module.css.js +12 -0
- package/build/browser/cbac-picker/base/selectionStateHelpers.js +26 -0
- package/build/browser/cbac-picker/base/selectionStateHelpers.js.map +1 -0
- package/build/browser/cbac-picker/types.js +2 -0
- package/build/browser/cbac-picker/types.js.map +1 -0
- package/build/browser/cbac-picker/utils/cbacPickerUtils.js +37 -0
- package/build/browser/cbac-picker/utils/cbacPickerUtils.js.map +1 -0
- package/build/browser/cbac-picker/utils/selectionLogic.js +91 -0
- package/build/browser/cbac-picker/utils/selectionLogic.js.map +1 -0
- package/build/browser/public/experimental.js +3 -1
- package/build/browser/public/experimental.js.map +1 -1
- package/build/browser/styles.css +347 -0
- package/build/cjs/public/experimental.cjs +76 -0
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.d.cts +32 -1
- package/build/esm/cbac-picker/base/CategoryMarkingGroup.js +80 -0
- package/build/esm/cbac-picker/base/CategoryMarkingGroup.js.map +1 -0
- package/build/esm/cbac-picker/base/CategoryMarkingGroup.module.css +44 -0
- package/build/esm/cbac-picker/base/InfoBanner.js +32 -0
- package/build/esm/cbac-picker/base/InfoBanner.js.map +1 -0
- package/build/esm/cbac-picker/base/InfoBanner.module.css +30 -0
- package/build/esm/cbac-picker/base/MarkingButton.js +42 -0
- package/build/esm/cbac-picker/base/MarkingButton.js.map +1 -0
- package/build/esm/cbac-picker/base/MarkingButton.module.css +76 -0
- package/build/esm/cbac-picker/base/OverflowButton.js +50 -0
- package/build/esm/cbac-picker/base/OverflowButton.js.map +1 -0
- package/build/esm/cbac-picker/base/OverflowButton.module.css +57 -0
- package/build/esm/cbac-picker/base/OverflowItem.js +42 -0
- package/build/esm/cbac-picker/base/OverflowItem.js.map +1 -0
- package/build/esm/cbac-picker/base/OverflowItem.module.css +51 -0
- package/build/esm/cbac-picker/base/ValidationWarning.js +44 -0
- package/build/esm/cbac-picker/base/ValidationWarning.js.map +1 -0
- package/build/esm/cbac-picker/base/ValidationWarning.module.css +71 -0
- package/build/esm/cbac-picker/base/selectionStateHelpers.js +26 -0
- package/build/esm/cbac-picker/base/selectionStateHelpers.js.map +1 -0
- package/build/esm/cbac-picker/types.js +2 -0
- package/build/esm/cbac-picker/types.js.map +1 -0
- package/build/esm/cbac-picker/utils/cbacPickerUtils.js +37 -0
- package/build/esm/cbac-picker/utils/cbacPickerUtils.js.map +1 -0
- package/build/esm/cbac-picker/utils/selectionLogic.js +91 -0
- package/build/esm/cbac-picker/utils/selectionLogic.js.map +1 -0
- package/build/esm/public/experimental.js +3 -1
- package/build/esm/public/experimental.js.map +1 -1
- package/build/types/cbac-picker/base/CategoryMarkingGroup.d.ts +13 -0
- package/build/types/cbac-picker/base/CategoryMarkingGroup.d.ts.map +1 -0
- package/build/types/cbac-picker/base/InfoBanner.d.ts +6 -0
- package/build/types/cbac-picker/base/InfoBanner.d.ts.map +1 -0
- package/build/types/cbac-picker/base/MarkingButton.d.ts +9 -0
- package/build/types/cbac-picker/base/MarkingButton.d.ts.map +1 -0
- package/build/types/cbac-picker/base/OverflowButton.d.ts +13 -0
- package/build/types/cbac-picker/base/OverflowButton.d.ts.map +1 -0
- package/build/types/cbac-picker/base/OverflowItem.d.ts +10 -0
- package/build/types/cbac-picker/base/OverflowItem.d.ts.map +1 -0
- package/build/types/cbac-picker/base/ValidationWarning.d.ts +7 -0
- package/build/types/cbac-picker/base/ValidationWarning.d.ts.map +1 -0
- package/build/types/cbac-picker/base/selectionStateHelpers.d.ts +4 -0
- package/build/types/cbac-picker/base/selectionStateHelpers.d.ts.map +1 -0
- package/build/types/cbac-picker/types.d.ts +27 -0
- package/build/types/cbac-picker/types.d.ts.map +1 -0
- package/build/types/cbac-picker/utils/cbacPickerUtils.d.ts +10 -0
- package/build/types/cbac-picker/utils/cbacPickerUtils.d.ts.map +1 -0
- package/build/types/cbac-picker/utils/selectionLogic.d.ts +4 -0
- package/build/types/cbac-picker/utils/selectionLogic.d.ts.map +1 -0
- package/build/types/public/experimental.d.ts +2 -1
- package/build/types/public/experimental.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export function toggleMarking(markingId, currentSelection, categories) {
|
|
18
|
+
const isSelected = currentSelection.includes(markingId);
|
|
19
|
+
let ownerGroup;
|
|
20
|
+
for (const group of categories) {
|
|
21
|
+
for (const marking of group.markings) {
|
|
22
|
+
if (marking.id === markingId) {
|
|
23
|
+
ownerGroup = group;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (ownerGroup !== undefined) {
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (ownerGroup === undefined) {
|
|
32
|
+
return currentSelection;
|
|
33
|
+
}
|
|
34
|
+
if (isSelected) {
|
|
35
|
+
return currentSelection.filter(id => id !== markingId);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Disjunctive categories allow only one marking selected at a time (radio-style).
|
|
39
|
+
// Conjunctive categories allow multiple markings (checkbox-style).
|
|
40
|
+
if (ownerGroup.category.categoryType === "DISJUNCTIVE") {
|
|
41
|
+
const sameCategoryMarkingIds = new Set(ownerGroup.markings.map(m => m.id));
|
|
42
|
+
const withoutSameCategory = currentSelection.filter(id => !sameCategoryMarkingIds.has(id));
|
|
43
|
+
return [...withoutSameCategory, markingId];
|
|
44
|
+
}
|
|
45
|
+
return [...currentSelection, markingId];
|
|
46
|
+
}
|
|
47
|
+
export function computeMarkingStates(selectedIds, impliedIds, disallowedIds) {
|
|
48
|
+
const states = new Map();
|
|
49
|
+
const selectedSet = new Set(selectedIds);
|
|
50
|
+
const impliedSet = new Set(impliedIds);
|
|
51
|
+
const disallowedSet = new Set(disallowedIds);
|
|
52
|
+
const allIds = new Set([...selectedIds, ...impliedIds, ...disallowedIds]);
|
|
53
|
+
for (const id of allIds) {
|
|
54
|
+
const isImplied = impliedSet.has(id);
|
|
55
|
+
const isDisallowed = disallowedSet.has(id);
|
|
56
|
+
const isSelected = selectedSet.has(id);
|
|
57
|
+
if (isSelected) {
|
|
58
|
+
states.set(id, "SELECTED");
|
|
59
|
+
} else if (isImplied && isDisallowed) {
|
|
60
|
+
states.set(id, "IMPLIED_DISALLOWED");
|
|
61
|
+
} else if (isImplied) {
|
|
62
|
+
states.set(id, "IMPLIED");
|
|
63
|
+
} else if (isDisallowed) {
|
|
64
|
+
states.set(id, "DISALLOWED");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return states;
|
|
68
|
+
}
|
|
69
|
+
export function groupMarkingsByCategory(markings, categories) {
|
|
70
|
+
const markingsByCategoryId = new Map();
|
|
71
|
+
for (const marking of markings) {
|
|
72
|
+
const existing = markingsByCategoryId.get(marking.categoryId);
|
|
73
|
+
if (existing !== undefined) {
|
|
74
|
+
existing.push(marking);
|
|
75
|
+
} else {
|
|
76
|
+
markingsByCategoryId.set(marking.categoryId, [marking]);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const groups = [];
|
|
80
|
+
for (const category of categories) {
|
|
81
|
+
const categoryMarkings = markingsByCategoryId.get(category.id);
|
|
82
|
+
if (categoryMarkings !== undefined && categoryMarkings.length > 0) {
|
|
83
|
+
groups.push({
|
|
84
|
+
category,
|
|
85
|
+
markings: categoryMarkings
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return groups;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=selectionLogic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectionLogic.js","names":["toggleMarking","markingId","currentSelection","categories","isSelected","includes","ownerGroup","group","marking","markings","id","undefined","filter","category","categoryType","sameCategoryMarkingIds","Set","map","m","withoutSameCategory","has","computeMarkingStates","selectedIds","impliedIds","disallowedIds","states","Map","selectedSet","impliedSet","disallowedSet","allIds","isImplied","isDisallowed","set","groupMarkingsByCategory","markingsByCategoryId","existing","get","categoryId","push","groups","categoryMarkings","length"],"sources":["selectionLogic.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CategoryMarkingGroup,\n MarkingSelectionState,\n PickerMarking,\n PickerMarkingCategory,\n} from \"../types.js\";\n\nexport function toggleMarking(\n markingId: string,\n currentSelection: string[],\n categories: CategoryMarkingGroup[],\n): string[] {\n const isSelected = currentSelection.includes(markingId);\n\n let ownerGroup: CategoryMarkingGroup | undefined;\n for (const group of categories) {\n for (const marking of group.markings) {\n if (marking.id === markingId) {\n ownerGroup = group;\n break;\n }\n }\n if (ownerGroup !== undefined) {\n break;\n }\n }\n\n if (ownerGroup === undefined) {\n return currentSelection;\n }\n\n if (isSelected) {\n return currentSelection.filter((id) => id !== markingId);\n }\n\n // Disjunctive categories allow only one marking selected at a time (radio-style).\n // Conjunctive categories allow multiple markings (checkbox-style).\n if (ownerGroup.category.categoryType === \"DISJUNCTIVE\") {\n const sameCategoryMarkingIds = new Set(\n ownerGroup.markings.map((m) => m.id),\n );\n const withoutSameCategory = currentSelection.filter(\n (id) => !sameCategoryMarkingIds.has(id),\n );\n return [...withoutSameCategory, markingId];\n }\n\n return [...currentSelection, markingId];\n}\n\nexport function computeMarkingStates(\n selectedIds: string[],\n impliedIds: string[],\n disallowedIds: string[],\n): Map<string, MarkingSelectionState> {\n const states = new Map<string, MarkingSelectionState>();\n\n const selectedSet = new Set(selectedIds);\n const impliedSet = new Set(impliedIds);\n const disallowedSet = new Set(disallowedIds);\n\n const allIds = new Set([...selectedIds, ...impliedIds, ...disallowedIds]);\n\n for (const id of allIds) {\n const isImplied = impliedSet.has(id);\n const isDisallowed = disallowedSet.has(id);\n const isSelected = selectedSet.has(id);\n\n if (isSelected) {\n states.set(id, \"SELECTED\");\n } else if (isImplied && isDisallowed) {\n states.set(id, \"IMPLIED_DISALLOWED\");\n } else if (isImplied) {\n states.set(id, \"IMPLIED\");\n } else if (isDisallowed) {\n states.set(id, \"DISALLOWED\");\n }\n }\n\n return states;\n}\n\nexport function groupMarkingsByCategory(\n markings: PickerMarking[],\n categories: PickerMarkingCategory[],\n): CategoryMarkingGroup[] {\n const markingsByCategoryId = new Map<string, PickerMarking[]>();\n\n for (const marking of markings) {\n const existing = markingsByCategoryId.get(marking.categoryId);\n if (existing !== undefined) {\n existing.push(marking);\n } else {\n markingsByCategoryId.set(marking.categoryId, [marking]);\n }\n }\n\n const groups: CategoryMarkingGroup[] = [];\n\n for (const category of categories) {\n const categoryMarkings = markingsByCategoryId.get(category.id);\n if (categoryMarkings !== undefined && categoryMarkings.length > 0) {\n groups.push({ category, markings: categoryMarkings });\n }\n }\n\n return groups;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAO,SAASA,aAAaA,CAC3BC,SAAiB,EACjBC,gBAA0B,EAC1BC,UAAkC,EACxB;EACV,MAAMC,UAAU,GAAGF,gBAAgB,CAACG,QAAQ,CAACJ,SAAS,CAAC;EAEvD,IAAIK,UAA4C;EAChD,KAAK,MAAMC,KAAK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E;IACjC,MAAMsC,gBAAgB,GAAGN,oBAAoB,CAACE,GAAG,CAACxB,QAAQ,CAACH,EAAE,CAAC;IAC9D,IAAI+B,gBAAgB,KAAK9B,SAAS,IAAI8B,gBAAgB,CAACC,MAAM,GAAG,CAAC,EAAE;MACjEF,MAAM,CAACD,IAAI,CAAC;QAAE1B,QAAQ;QAAEJ,QAAQ,EAAEgC;MAAiB,CAAC,CAAC;IACvD;EACF;EAEA,OAAOD,MAAM;AACf","ignoreList":[]}
|
|
@@ -14,5 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
// CBAC Picker - Selection logic utilities
|
|
18
|
+
export { computeMarkingStates, groupMarkingsByCategory, toggleMarking } from "../cbac-picker/utils/selectionLogic.js";
|
|
19
|
+
// CBAC Picker - Types
|
|
18
20
|
//# sourceMappingURL=experimental.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","names":[],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport {};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"experimental.js","names":["computeMarkingStates","groupMarkingsByCategory","toggleMarking"],"sources":["experimental.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// CBAC Picker - Selection logic utilities\nexport {\n computeMarkingStates,\n groupMarkingsByCategory,\n toggleMarking,\n} from \"../cbac-picker/utils/selectionLogic.js\";\n// CBAC Picker - Types\nexport type {\n CategoryMarkingGroup,\n CbacBannerData,\n MarkingSelectionState,\n PickerMarking,\n PickerMarkingCategory,\n RequiredMarkingGroup,\n} from \"../cbac-picker/types.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,SACEA,oBAAoB,EACpBC,uBAAuB,EACvBC,aAAa,QACR,wCAAwC;AAC/C","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { MarkingSelectionState } from "../types.js";
|
|
3
|
+
export interface CategoryMarkingGroupProps {
|
|
4
|
+
categoryName: string;
|
|
5
|
+
markings: ReadonlyArray<{
|
|
6
|
+
id: string
|
|
7
|
+
label: string
|
|
8
|
+
selectionState: MarkingSelectionState
|
|
9
|
+
disabled?: boolean
|
|
10
|
+
}>;
|
|
11
|
+
onMarkingToggle: (markingId: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const CategoryMarkingGroup: React.MemoExoticComponent<(props: CategoryMarkingGroupProps) => React.ReactElement>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,OAAO,WAAW,OAAQ;AAC1B,cAAc,6BAA6B,aAAc;AASzD,iBAAiB,0BAA0B;CACzC;CACA,UAAU,cAAc;EACtB;EACA;EACA,gBAAgB;EAChB;CACD;CACD,kBAAkBA;AACnB;AAED,OAAO,cAAMC,sBAAsB,MAAM,qBACtCC,OAAO,8BAA8B,MAAM","names":["markingId: string","CategoryMarkingGroup: React.MemoExoticComponent<\n (props: CategoryMarkingGroupProps) => React.ReactElement\n>","props: CategoryMarkingGroupProps"],"sources":["../../../../src/cbac-picker/base/CategoryMarkingGroup.tsx"],"version":3,"file":"CategoryMarkingGroup.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAkBA,OAAO,WAAW,OAAQ;AAG1B,iBAAiB,gBAAgB;CAC/B;CACA;AACD;AAED,OAAO,iBAAS,WAAW,EACzB,SACA,WACgB,EAAf,kBAAkB,MAAM","names":[],"sources":["../../../../src/cbac-picker/base/InfoBanner.tsx"],"version":3,"file":"InfoBanner.d.ts"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { MarkingSelectionState } from "../types.js";
|
|
3
|
+
export interface MarkingButtonProps {
|
|
4
|
+
label: string;
|
|
5
|
+
selectionState: MarkingSelectionState;
|
|
6
|
+
onToggle: () => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function MarkingButton({ label, selectionState, onToggle, disabled }: MarkingButtonProps): React.ReactElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAkBA,OAAO,WAAW,OAAQ;AAC1B,cAAc,6BAA6B,aAAc;AAIzD,iBAAiB,mBAAmB;CAClC;CACA,gBAAgB;CAChB;CACA;AACD;AAaD,OAAO,iBAAS,cAAc,EAC5B,OACA,gBACA,UACA,UACmB,EAAlB,qBAAqB,MAAM","names":[],"sources":["../../../../src/cbac-picker/base/MarkingButton.tsx"],"version":3,"file":"MarkingButton.d.ts"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { MarkingSelectionState } from "../types.js";
|
|
3
|
+
export interface OverflowButtonProps {
|
|
4
|
+
overflowMarkings: ReadonlyArray<{
|
|
5
|
+
id: string
|
|
6
|
+
label: string
|
|
7
|
+
selectionState: MarkingSelectionState
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
}>;
|
|
10
|
+
hasActiveOverflow: boolean;
|
|
11
|
+
onMarkingToggle: (markingId: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function OverflowButton({ overflowMarkings, hasActiveOverflow, onMarkingToggle }: OverflowButtonProps): React.ReactElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAmBA,OAAO,WAAW,OAAQ;AAC1B,cAAc,6BAA6B,aAAc;AAIzD,iBAAiB,oBAAoB;CACnC,kBAAkB,cAAc;EAC9B;EACA;EACA,gBAAgB;EAChB;CACD;CACD;CACA,kBAAkBA;AACnB;AAED,OAAO,iBAAS,eAAe,EAC7B,kBACA,mBACA,iBACoB,EAAnB,sBAAsB,MAAM","names":["markingId: string"],"sources":["../../../../src/cbac-picker/base/OverflowButton.tsx"],"version":3,"file":"OverflowButton.d.ts"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { MarkingSelectionState } from "../types.js";
|
|
3
|
+
export interface OverflowItemProps {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
selectionState: MarkingSelectionState;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onToggle: (markingId: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const OverflowItem: React.MemoExoticComponent<(props: OverflowItemProps) => React.ReactElement>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAkBA,OAAO,WAAW,OAAQ;AAC1B,cAAc,6BAA6B,aAAc;AAQzD,iBAAiB,kBAAkB;CACjC;CACA;CACA,gBAAgB;CAChB;CACA,WAAWA;AACZ;AAED,OAAO,cAAMC,cAAc,MAAM,qBAC9BC,OAAO,sBAAsB,MAAM","names":["markingId: string","OverflowItem: React.MemoExoticComponent<\n (props: OverflowItemProps) => React.ReactElement\n>","props: OverflowItemProps"],"sources":["../../../../src/cbac-picker/base/OverflowItem.tsx"],"version":3,"file":"OverflowItem.d.ts"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { RequiredMarkingGroup } from "../types.js";
|
|
3
|
+
export interface ValidationWarningProps {
|
|
4
|
+
requiredMarkingGroups: ReadonlyArray<RequiredMarkingGroup>;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function ValidationWarning({ requiredMarkingGroups, className }: ValidationWarningProps): React.ReactElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAkBA,OAAO,WAAW,OAAQ;AAC1B,cAAc,4BAA4B,aAAc;AAGxD,iBAAiB,uBAAuB;CACtC,uBAAuB,cAAc;CACrC;AACD;AAED,OAAO,iBAAS,kBAAkB,EAChC,uBACA,WACuB,EAAtB,yBAAyB,MAAM","names":[],"sources":["../../../../src/cbac-picker/base/ValidationWarning.tsx"],"version":3,"file":"ValidationWarning.d.ts"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MarkingSelectionState } from "../types.js";
|
|
2
|
+
export declare function isDisallowed(state: MarkingSelectionState): boolean;
|
|
3
|
+
export declare function isImplied(state: MarkingSelectionState): boolean;
|
|
4
|
+
export declare function getDisplayLabel(label: string, state: MarkingSelectionState): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,6BAA6B,aAAc;AAEzD,OAAO,iBAAS,aAAaA,OAAO;AAIpC,OAAO,iBAAS,UAAUA,OAAO;AAIjC,OAAO,iBAAS,gBACdC,eACAD,OAAO","names":["state: MarkingSelectionState","label: string"],"sources":["../../../../src/cbac-picker/base/selectionStateHelpers.ts"],"version":3,"file":"selectionStateHelpers.d.ts"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type MarkingSelectionState = "NONE" | "SELECTED" | "IMPLIED" | "DISALLOWED" | "IMPLIED_DISALLOWED";
|
|
2
|
+
export interface CbacBannerData {
|
|
3
|
+
classificationString: string;
|
|
4
|
+
textColor: string;
|
|
5
|
+
backgroundColors: string[];
|
|
6
|
+
markingIds: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface PickerMarkingCategory {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
categoryType: "CONJUNCTIVE" | "DISJUNCTIVE";
|
|
13
|
+
markingType: "MANDATORY" | "CBAC";
|
|
14
|
+
}
|
|
15
|
+
export interface PickerMarking {
|
|
16
|
+
id: string;
|
|
17
|
+
categoryId: string;
|
|
18
|
+
name: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface CategoryMarkingGroup {
|
|
22
|
+
category: PickerMarkingCategory;
|
|
23
|
+
markings: PickerMarking[];
|
|
24
|
+
}
|
|
25
|
+
export interface RequiredMarkingGroup {
|
|
26
|
+
markingNames: string[];
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,YAAY,wBACR,SACA,aACA,YACA,eACA;AAEJ,iBAAiB,eAAe;CAC9B;CACA;CACA;CACA;AACD;AAED,iBAAiB,sBAAsB;CACrC;CACA;CACA;CACA,cAAc,gBAAgB;CAC9B,aAAa,cAAc;AAC5B;AAED,iBAAiB,cAAc;CAC7B;CACA;CACA;CACA;AACD;AAED,iBAAiB,qBAAqB;CACpC,UAAU;CACV,UAAU;AACX;AAED,iBAAiB,qBAAqB;CACpC;AACD","names":[],"sources":["../../../src/cbac-picker/types.ts"],"version":3,"file":"types.d.ts"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CategoryMarkingGroup, CbacBannerData, RequiredMarkingGroup } from "../types.js";
|
|
2
|
+
export declare const EMPTY_ARRAY: string[];
|
|
3
|
+
export declare function backgroundFromColors(backgroundColors: string[]): string;
|
|
4
|
+
export interface ResolvedBannerDisplay {
|
|
5
|
+
classificationString: string;
|
|
6
|
+
textColor: string;
|
|
7
|
+
backgroundColors: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function resolveBannerDisplay(banner: CbacBannerData | undefined): ResolvedBannerDisplay;
|
|
10
|
+
export declare function resolveRequiredGroups(categoryGroups: CategoryMarkingGroup[], requiredMarkingGroups: string[][]): RequiredMarkingGroup[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,sBACA,gBACA,4BACK,aAAc;AAKrB,OAAO,cAAMA;AAEb,OAAO,iBAAS,qBAAqBC;AAMrC,iBAAiB,sBAAsB;CACrC;CACA;CACA;AACD;AAED,OAAO,iBAAS,qBACdC,QAAQ,6BACP;AASH,OAAO,iBAAS,sBACdC,gBAAgB,wBAChBC,oCACC","names":["EMPTY_ARRAY: string[]","backgroundColors: string[]","banner: CbacBannerData | undefined","categoryGroups: CategoryMarkingGroup[]","requiredMarkingGroups: string[][]"],"sources":["../../../../src/cbac-picker/utils/cbacPickerUtils.ts"],"version":3,"file":"cbacPickerUtils.d.ts"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CategoryMarkingGroup, MarkingSelectionState, PickerMarking, PickerMarkingCategory } from "../types.js";
|
|
2
|
+
export declare function toggleMarking(markingId: string, currentSelection: string[], categories: CategoryMarkingGroup[]): string[];
|
|
3
|
+
export declare function computeMarkingStates(selectedIds: string[], impliedIds: string[], disallowedIds: string[]): Map<string, MarkingSelectionState>;
|
|
4
|
+
export declare function groupMarkingsByCategory(markings: PickerMarking[], categories: PickerMarkingCategory[]): CategoryMarkingGroup[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,sBACA,uBACA,eACA,6BACK,aAAc;AAErB,OAAO,iBAAS,cACdA,mBACAC,4BACAC,YAAY;AAwCd,OAAO,iBAAS,qBACdC,uBACAC,sBACAC,0BACC,YAAY;AA4Bf,OAAO,iBAAS,wBACdC,UAAU,iBACVC,YAAY,0BACX","names":["markingId: string","currentSelection: string[]","categories: CategoryMarkingGroup[]","selectedIds: string[]","impliedIds: string[]","disallowedIds: string[]","markings: PickerMarking[]","categories: PickerMarkingCategory[]"],"sources":["../../../../src/cbac-picker/utils/selectionLogic.ts"],"version":3,"file":"selectionLogic.d.ts"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { computeMarkingStates, groupMarkingsByCategory, toggleMarking } from "../cbac-picker/utils/selectionLogic.js";
|
|
2
|
+
export type { CategoryMarkingGroup, CbacBannerData, MarkingSelectionState, PickerMarking, PickerMarkingCategory, RequiredMarkingGroup } from "../cbac-picker/types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":"AAiBA,SACE,sBACA,yBACA,qBACK;AAEP,cACE,sBACA,gBACA,uBACA,eACA,uBACA,4BACK","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/cbac-components",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"typescript": "~5.5.4",
|
|
59
59
|
"@osdk/monorepo.api-extractor": "~0.7.0-beta.1",
|
|
60
60
|
"@osdk/monorepo.tsconfig": "~0.7.0-beta.1",
|
|
61
|
-
"@osdk/react
|
|
62
|
-
"@osdk/react": "0.
|
|
61
|
+
"@osdk/react": "0.10.0-beta.14",
|
|
62
|
+
"@osdk/react-components": "0.2.0-beta.26"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|