@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.
Files changed (90) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/build/browser/cbac-picker/base/CategoryMarkingGroup.js +80 -0
  3. package/build/browser/cbac-picker/base/CategoryMarkingGroup.js.map +1 -0
  4. package/build/browser/cbac-picker/base/CategoryMarkingGroup.module.css +44 -0
  5. package/build/browser/cbac-picker/base/CategoryMarkingGroup.module.css.js +9 -0
  6. package/build/browser/cbac-picker/base/InfoBanner.js +32 -0
  7. package/build/browser/cbac-picker/base/InfoBanner.js.map +1 -0
  8. package/build/browser/cbac-picker/base/InfoBanner.module.css +30 -0
  9. package/build/browser/cbac-picker/base/InfoBanner.module.css.js +7 -0
  10. package/build/browser/cbac-picker/base/MarkingButton.js +42 -0
  11. package/build/browser/cbac-picker/base/MarkingButton.js.map +1 -0
  12. package/build/browser/cbac-picker/base/MarkingButton.module.css +76 -0
  13. package/build/browser/cbac-picker/base/MarkingButton.module.css.js +10 -0
  14. package/build/browser/cbac-picker/base/OverflowButton.js +50 -0
  15. package/build/browser/cbac-picker/base/OverflowButton.js.map +1 -0
  16. package/build/browser/cbac-picker/base/OverflowButton.module.css +57 -0
  17. package/build/browser/cbac-picker/base/OverflowButton.module.css.js +8 -0
  18. package/build/browser/cbac-picker/base/OverflowItem.js +42 -0
  19. package/build/browser/cbac-picker/base/OverflowItem.js.map +1 -0
  20. package/build/browser/cbac-picker/base/OverflowItem.module.css +51 -0
  21. package/build/browser/cbac-picker/base/OverflowItem.module.css.js +8 -0
  22. package/build/browser/cbac-picker/base/ValidationWarning.js +44 -0
  23. package/build/browser/cbac-picker/base/ValidationWarning.js.map +1 -0
  24. package/build/browser/cbac-picker/base/ValidationWarning.module.css +71 -0
  25. package/build/browser/cbac-picker/base/ValidationWarning.module.css.js +12 -0
  26. package/build/browser/cbac-picker/base/selectionStateHelpers.js +26 -0
  27. package/build/browser/cbac-picker/base/selectionStateHelpers.js.map +1 -0
  28. package/build/browser/cbac-picker/types.js +2 -0
  29. package/build/browser/cbac-picker/types.js.map +1 -0
  30. package/build/browser/cbac-picker/utils/cbacPickerUtils.js +37 -0
  31. package/build/browser/cbac-picker/utils/cbacPickerUtils.js.map +1 -0
  32. package/build/browser/cbac-picker/utils/selectionLogic.js +91 -0
  33. package/build/browser/cbac-picker/utils/selectionLogic.js.map +1 -0
  34. package/build/browser/public/experimental.js +3 -1
  35. package/build/browser/public/experimental.js.map +1 -1
  36. package/build/browser/styles.css +347 -0
  37. package/build/cjs/public/experimental.cjs +76 -0
  38. package/build/cjs/public/experimental.cjs.map +1 -1
  39. package/build/cjs/public/experimental.d.cts +32 -1
  40. package/build/esm/cbac-picker/base/CategoryMarkingGroup.js +80 -0
  41. package/build/esm/cbac-picker/base/CategoryMarkingGroup.js.map +1 -0
  42. package/build/esm/cbac-picker/base/CategoryMarkingGroup.module.css +44 -0
  43. package/build/esm/cbac-picker/base/InfoBanner.js +32 -0
  44. package/build/esm/cbac-picker/base/InfoBanner.js.map +1 -0
  45. package/build/esm/cbac-picker/base/InfoBanner.module.css +30 -0
  46. package/build/esm/cbac-picker/base/MarkingButton.js +42 -0
  47. package/build/esm/cbac-picker/base/MarkingButton.js.map +1 -0
  48. package/build/esm/cbac-picker/base/MarkingButton.module.css +76 -0
  49. package/build/esm/cbac-picker/base/OverflowButton.js +50 -0
  50. package/build/esm/cbac-picker/base/OverflowButton.js.map +1 -0
  51. package/build/esm/cbac-picker/base/OverflowButton.module.css +57 -0
  52. package/build/esm/cbac-picker/base/OverflowItem.js +42 -0
  53. package/build/esm/cbac-picker/base/OverflowItem.js.map +1 -0
  54. package/build/esm/cbac-picker/base/OverflowItem.module.css +51 -0
  55. package/build/esm/cbac-picker/base/ValidationWarning.js +44 -0
  56. package/build/esm/cbac-picker/base/ValidationWarning.js.map +1 -0
  57. package/build/esm/cbac-picker/base/ValidationWarning.module.css +71 -0
  58. package/build/esm/cbac-picker/base/selectionStateHelpers.js +26 -0
  59. package/build/esm/cbac-picker/base/selectionStateHelpers.js.map +1 -0
  60. package/build/esm/cbac-picker/types.js +2 -0
  61. package/build/esm/cbac-picker/types.js.map +1 -0
  62. package/build/esm/cbac-picker/utils/cbacPickerUtils.js +37 -0
  63. package/build/esm/cbac-picker/utils/cbacPickerUtils.js.map +1 -0
  64. package/build/esm/cbac-picker/utils/selectionLogic.js +91 -0
  65. package/build/esm/cbac-picker/utils/selectionLogic.js.map +1 -0
  66. package/build/esm/public/experimental.js +3 -1
  67. package/build/esm/public/experimental.js.map +1 -1
  68. package/build/types/cbac-picker/base/CategoryMarkingGroup.d.ts +13 -0
  69. package/build/types/cbac-picker/base/CategoryMarkingGroup.d.ts.map +1 -0
  70. package/build/types/cbac-picker/base/InfoBanner.d.ts +6 -0
  71. package/build/types/cbac-picker/base/InfoBanner.d.ts.map +1 -0
  72. package/build/types/cbac-picker/base/MarkingButton.d.ts +9 -0
  73. package/build/types/cbac-picker/base/MarkingButton.d.ts.map +1 -0
  74. package/build/types/cbac-picker/base/OverflowButton.d.ts +13 -0
  75. package/build/types/cbac-picker/base/OverflowButton.d.ts.map +1 -0
  76. package/build/types/cbac-picker/base/OverflowItem.d.ts +10 -0
  77. package/build/types/cbac-picker/base/OverflowItem.d.ts.map +1 -0
  78. package/build/types/cbac-picker/base/ValidationWarning.d.ts +7 -0
  79. package/build/types/cbac-picker/base/ValidationWarning.d.ts.map +1 -0
  80. package/build/types/cbac-picker/base/selectionStateHelpers.d.ts +4 -0
  81. package/build/types/cbac-picker/base/selectionStateHelpers.d.ts.map +1 -0
  82. package/build/types/cbac-picker/types.d.ts +27 -0
  83. package/build/types/cbac-picker/types.d.ts.map +1 -0
  84. package/build/types/cbac-picker/utils/cbacPickerUtils.d.ts +10 -0
  85. package/build/types/cbac-picker/utils/cbacPickerUtils.d.ts.map +1 -0
  86. package/build/types/cbac-picker/utils/selectionLogic.d.ts +4 -0
  87. package/build/types/cbac-picker/utils/selectionLogic.d.ts.map +1 -0
  88. package/build/types/public/experimental.d.ts +2 -1
  89. package/build/types/public/experimental.d.ts.map +1 -1
  90. package/package.json +3 -3
@@ -0,0 +1,44 @@
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
+ import { WarningSign } from "@blueprintjs/icons";
18
+ import classnames from "classnames";
19
+ import React from "react";
20
+ import styles from "./ValidationWarning.module.css.js";
21
+ export function ValidationWarning({
22
+ requiredMarkingGroups,
23
+ className
24
+ }) {
25
+ return /*#__PURE__*/React.createElement("div", {
26
+ className: classnames(styles.validationWarning, className)
27
+ }, /*#__PURE__*/React.createElement("div", {
28
+ className: styles.header
29
+ }, /*#__PURE__*/React.createElement(WarningSign, {
30
+ className: styles.icon,
31
+ size: 14
32
+ }), /*#__PURE__*/React.createElement("span", null, "To complete a valid classification, at least one marking from each of the following sets needs to be selected:")), /*#__PURE__*/React.createElement("ol", {
33
+ className: styles.groupList
34
+ }, requiredMarkingGroups.map((group, index) => /*#__PURE__*/React.createElement("li", {
35
+ key: group.markingNames.join(","),
36
+ className: styles.groupItem
37
+ }, /*#__PURE__*/React.createElement("span", {
38
+ className: styles.groupNumber
39
+ }, index + 1, "."), group.markingNames.map(name => /*#__PURE__*/React.createElement("span", {
40
+ key: name,
41
+ className: styles.chip
42
+ }, name))))));
43
+ }
44
+ //# sourceMappingURL=ValidationWarning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationWarning.js","names":["WarningSign","classnames","React","styles","ValidationWarning","requiredMarkingGroups","className","createElement","validationWarning","header","icon","size","groupList","map","group","index","key","markingNames","join","groupItem","groupNumber","name","chip"],"sources":["ValidationWarning.tsx"],"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 { WarningSign } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport React from \"react\";\nimport type { RequiredMarkingGroup } from \"../types.js\";\nimport styles from \"./ValidationWarning.module.css\";\n\nexport interface ValidationWarningProps {\n requiredMarkingGroups: ReadonlyArray<RequiredMarkingGroup>;\n className?: string;\n}\n\nexport function ValidationWarning({\n requiredMarkingGroups,\n className,\n}: ValidationWarningProps): React.ReactElement {\n return (\n <div className={classnames(styles.validationWarning, className)}>\n <div className={styles.header}>\n <WarningSign className={styles.icon} size={14} />\n <span>\n To complete a valid classification, at least one marking from each of\n the following sets needs to be selected:\n </span>\n </div>\n <ol className={styles.groupList}>\n {requiredMarkingGroups.map((group, index) => (\n <li key={group.markingNames.join(\",\")} className={styles.groupItem}>\n <span className={styles.groupNumber}>{index + 1}.</span>\n {group.markingNames.map((name) => (\n <span key={name} className={styles.chip}>{name}</span>\n ))}\n </li>\n ))}\n </ol>\n </div>\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,oBAAoB;AAChD,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,MAAM,MAAM,gCAAgC;AAOnD,OAAO,SAASC,iBAAiBA,CAAC;EAChCC,qBAAqB;EACrBC;AACsB,CAAC,EAAsB;EAC7C,oBACEJ,KAAA,CAAAK,aAAA;IAAKD,SAAS,EAAEL,UAAU,CAACE,MAAM,CAACK,iBAAiB,EAAEF,SAAS;EAAE,gBAC9DJ,KAAA,CAAAK,aAAA;IAAKD,SAAS,EAAEH,MAAM,CAACM;EAAO,gBAC5BP,KAAA,CAAAK,aAAA,CAACP,WAAW;IAACM,SAAS,EAAEH,MAAM,CAACO,IAAK;IAACC,IAAI,EAAE;EAAG,CAAE,CAAC,eACjDT,KAAA,CAAAK,aAAA,eAAM,gHAGA,CACH,CAAC,eACNL,KAAA,CAAAK,aAAA;IAAID,SAAS,EAAEH,MAAM,CAACS;EAAU,GAC7BP,qBAAqB,CAACQ,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,kBACtCb,KAAA,CAAAK,aAAA;IAAIS,GAAG,EAAEF,KAAK,CAACG,YAAY,CAACC,IAAI,CAAC,GAAG,CAAE;IAACZ,SAAS,EAAEH,MAAM,CAACgB;EAAU,gBACjEjB,KAAA,CAAAK,aAAA;IAAMD,SAAS,EAAEH,MAAM,CAACiB;EAAY,GAAEL,KAAK,GAAG,CAAC,EAAC,GAAO,CAAC,EACvDD,KAAK,CAACG,YAAY,CAACJ,GAAG,CAAEQ,IAAI,iBAC3BnB,KAAA,CAAAK,aAAA;IAAMS,GAAG,EAAEK,IAAK;IAACf,SAAS,EAAEH,MAAM,CAACmB;EAAK,GAAED,IAAW,CACtD,CACC,CACL,CACC,CACD,CAAC;AAEV","ignoreList":[]}
@@ -0,0 +1,71 @@
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
+ .validationWarning {
18
+ display: flex;
19
+ flex-direction: column;
20
+ gap: calc(var(--osdk-surface-spacing) * 1.5);
21
+ padding: var(--osdk-cbac-validation-warning-padding);
22
+ background: var(--osdk-cbac-validation-warning-bg);
23
+ color: var(--osdk-cbac-validation-warning-color);
24
+ font-size: var(--osdk-cbac-validation-warning-font-size);
25
+ border-radius: var(--osdk-cbac-validation-warning-border-radius);
26
+ max-height: var(--osdk-cbac-validation-warning-max-height);
27
+ overflow-y: auto;
28
+ }
29
+
30
+ .header {
31
+ display: flex;
32
+ align-items: center;
33
+ gap: calc(var(--osdk-surface-spacing) * 1.5);
34
+ }
35
+
36
+ .icon {
37
+ flex-shrink: 0;
38
+ }
39
+
40
+ .groupList {
41
+ list-style: none;
42
+ margin: 0;
43
+ padding: 0;
44
+ padding-left: calc(var(--osdk-surface-spacing) * 3);
45
+ display: flex;
46
+ flex-direction: column;
47
+ gap: var(--osdk-surface-spacing);
48
+ }
49
+
50
+ .groupItem {
51
+ display: flex;
52
+ align-items: center;
53
+ gap: var(--osdk-surface-spacing);
54
+ flex-wrap: wrap;
55
+ }
56
+
57
+ .groupNumber {
58
+ font-weight: var(--osdk-typography-weight-bold);
59
+ flex-shrink: 0;
60
+ }
61
+
62
+ .chip {
63
+ display: inline-flex;
64
+ align-items: center;
65
+ padding: 0 var(--osdk-surface-spacing);
66
+ border: 1px solid var(--osdk-cbac-validation-warning-chip-border-color);
67
+ border-radius: var(--osdk-surface-border-radius);
68
+ background: var(--osdk-cbac-validation-warning-chip-bg);
69
+ font-size: var(--osdk-cbac-validation-warning-font-size);
70
+ color: var(--osdk-typography-color-default-rest);
71
+ }
@@ -0,0 +1,12 @@
1
+ // CSS Module proxy for ValidationWarning.module.css
2
+ const styles = {
3
+ "validationWarning": "ValidationWarning-module__validationWarning___oADBKhG-",
4
+ "header": "ValidationWarning-module__header___ylq-kIOW",
5
+ "icon": "ValidationWarning-module__icon___PuGol1EB",
6
+ "groupList": "ValidationWarning-module__groupList___ua5t3Rm2",
7
+ "groupItem": "ValidationWarning-module__groupItem___0BGH5HxZ",
8
+ "groupNumber": "ValidationWarning-module__groupNumber___rTdfnH3f",
9
+ "chip": "ValidationWarning-module__chip___3EH1UeL0"
10
+ };
11
+
12
+ export default styles;
@@ -0,0 +1,26 @@
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 isDisallowed(state) {
18
+ return state === "DISALLOWED" || state === "IMPLIED_DISALLOWED";
19
+ }
20
+ export function isImplied(state) {
21
+ return state === "IMPLIED" || state === "IMPLIED_DISALLOWED";
22
+ }
23
+ export function getDisplayLabel(label, state) {
24
+ return isImplied(state) ? `(${label})` : label;
25
+ }
26
+ //# sourceMappingURL=selectionStateHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectionStateHelpers.js","names":["isDisallowed","state","isImplied","getDisplayLabel","label"],"sources":["selectionStateHelpers.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 { MarkingSelectionState } from \"../types.js\";\n\nexport function isDisallowed(state: MarkingSelectionState): boolean {\n return state === \"DISALLOWED\" || state === \"IMPLIED_DISALLOWED\";\n}\n\nexport function isImplied(state: MarkingSelectionState): boolean {\n return state === \"IMPLIED\" || state === \"IMPLIED_DISALLOWED\";\n}\n\nexport function getDisplayLabel(\n label: string,\n state: MarkingSelectionState,\n): string {\n return isImplied(state) ? `(${label})` : label;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,YAAYA,CAACC,KAA4B,EAAW;EAClE,OAAOA,KAAK,KAAK,YAAY,IAAIA,KAAK,KAAK,oBAAoB;AACjE;AAEA,OAAO,SAASC,SAASA,CAACD,KAA4B,EAAW;EAC/D,OAAOA,KAAK,KAAK,SAAS,IAAIA,KAAK,KAAK,oBAAoB;AAC9D;AAEA,OAAO,SAASE,eAAeA,CAC7BC,KAAa,EACbH,KAA4B,EACpB;EACR,OAAOC,SAAS,CAACD,KAAK,CAAC,GAAG,IAAIG,KAAK,GAAG,GAAGA,KAAK;AAChD","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["types.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 type MarkingSelectionState =\n | \"NONE\"\n | \"SELECTED\"\n | \"IMPLIED\"\n | \"DISALLOWED\"\n | \"IMPLIED_DISALLOWED\";\n\nexport interface CbacBannerData {\n classificationString: string;\n textColor: string;\n backgroundColors: string[];\n markingIds: string[];\n}\n\nexport interface PickerMarkingCategory {\n id: string;\n name: string;\n description: string;\n categoryType: \"CONJUNCTIVE\" | \"DISJUNCTIVE\";\n markingType: \"MANDATORY\" | \"CBAC\";\n}\n\nexport interface PickerMarking {\n id: string;\n categoryId: string;\n name: string;\n description?: string;\n}\n\nexport interface CategoryMarkingGroup {\n category: PickerMarkingCategory;\n markings: PickerMarking[];\n}\n\nexport interface RequiredMarkingGroup {\n markingNames: string[];\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,37 @@
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
+ const UNMARKED_BACKGROUND_COLORS = ["#8F99A8"];
18
+ const UNMARKED_TEXT_COLOR = "#FFFFFF";
19
+ const UNMARKED_CLASSIFICATION_STRING = "UNMARKED";
20
+ export const EMPTY_ARRAY = [];
21
+ export function backgroundFromColors(backgroundColors) {
22
+ return backgroundColors.length > 1 ? `linear-gradient(to right, ${backgroundColors.join(", ")})` : backgroundColors[0] ?? "transparent";
23
+ }
24
+ export function resolveBannerDisplay(banner) {
25
+ return {
26
+ classificationString: banner?.classificationString ?? UNMARKED_CLASSIFICATION_STRING,
27
+ textColor: banner?.textColor ?? UNMARKED_TEXT_COLOR,
28
+ backgroundColors: banner?.backgroundColors ?? UNMARKED_BACKGROUND_COLORS
29
+ };
30
+ }
31
+ export function resolveRequiredGroups(categoryGroups, requiredMarkingGroups) {
32
+ const markingIdToName = new Map(categoryGroups.flatMap(g => g.markings).map(m => [m.id, m.name]));
33
+ return requiredMarkingGroups.map(ids => ({
34
+ markingNames: ids.map(id => markingIdToName.get(id) ?? id)
35
+ }));
36
+ }
37
+ //# sourceMappingURL=cbacPickerUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cbacPickerUtils.js","names":["UNMARKED_BACKGROUND_COLORS","UNMARKED_TEXT_COLOR","UNMARKED_CLASSIFICATION_STRING","EMPTY_ARRAY","backgroundFromColors","backgroundColors","length","join","resolveBannerDisplay","banner","classificationString","textColor","resolveRequiredGroups","categoryGroups","requiredMarkingGroups","markingIdToName","Map","flatMap","g","markings","map","m","id","name","ids","markingNames","get"],"sources":["cbacPickerUtils.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 CbacBannerData,\n RequiredMarkingGroup,\n} from \"../types.js\";\nconst UNMARKED_BACKGROUND_COLORS: string[] = [\"#8F99A8\"];\nconst UNMARKED_TEXT_COLOR = \"#FFFFFF\";\nconst UNMARKED_CLASSIFICATION_STRING = \"UNMARKED\";\n\nexport const EMPTY_ARRAY: string[] = [];\n\nexport function backgroundFromColors(backgroundColors: string[]): string {\n return backgroundColors.length > 1\n ? `linear-gradient(to right, ${backgroundColors.join(\", \")})`\n : backgroundColors[0] ?? \"transparent\";\n}\n\nexport interface ResolvedBannerDisplay {\n classificationString: string;\n textColor: string;\n backgroundColors: string[];\n}\n\nexport function resolveBannerDisplay(\n banner: CbacBannerData | undefined,\n): ResolvedBannerDisplay {\n return {\n classificationString: banner?.classificationString\n ?? UNMARKED_CLASSIFICATION_STRING,\n textColor: banner?.textColor ?? UNMARKED_TEXT_COLOR,\n backgroundColors: banner?.backgroundColors ?? UNMARKED_BACKGROUND_COLORS,\n };\n}\n\nexport function resolveRequiredGroups(\n categoryGroups: CategoryMarkingGroup[],\n requiredMarkingGroups: string[][],\n): RequiredMarkingGroup[] {\n const markingIdToName = new Map(\n categoryGroups.flatMap((g) => g.markings).map((m) =>\n [m.id, m.name] as const\n ),\n );\n return requiredMarkingGroups.map((ids) => ({\n markingNames: ids.map((id) => markingIdToName.get(id) ?? id),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,MAAMA,0BAAoC,GAAG,CAAC,SAAS,CAAC;AACxD,MAAMC,mBAAmB,GAAG,SAAS;AACrC,MAAMC,8BAA8B,GAAG,UAAU;AAEjD,OAAO,MAAMC,WAAqB,GAAG,EAAE;AAEvC,OAAO,SAASC,oBAAoBA,CAACC,gBAA0B,EAAU;EACvE,OAAOA,gBAAgB,CAACC,MAAM,GAAG,CAAC,GAC9B,6BAA6BD,gBAAgB,CAACE,IAAI,CAAC,IAAI,CAAC,GAAG,GAC3DF,gBAAgB,CAAC,CAAC,CAAC,IAAI,aAAa;AAC1C;AAQA,OAAO,SAASG,oBAAoBA,CAClCC,MAAkC,EACX;EACvB,OAAO;IACLC,oBAAoB,EAAED,MAAM,EAAEC,oBAAoB,IAC7CR,8BAA8B;IACnCS,SAAS,EAAEF,MAAM,EAAEE,SAAS,IAAIV,mBAAmB;IACnDI,gBAAgB,EAAEI,MAAM,EAAEJ,gBAAgB,IAAIL;EAChD,CAAC;AACH;AAEA,OAAO,SAASY,qBAAqBA,CACnCC,cAAsC,EACtCC,qBAAiC,EACT;EACxB,MAAMC,eAAe,GAAG,IAAIC,GAAG,CAC7BH,cAAc,CAACI,OAAO,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAAC,CAACC,GAAG,CAAEC,CAAC,IAC9C,CAACA,CAAC,CAACC,EAAE,EAAED,CAAC,CAACE,IAAI,CACf,CACF,CAAC;EACD,OAAOT,qBAAqB,CAACM,GAAG,CAAEI,GAAG,KAAM;IACzCC,YAAY,EAAED,GAAG,CAACJ,GAAG,CAAEE,EAAE,IAAKP,eAAe,CAACW,GAAG,CAACJ,EAAE,CAAC,IAAIA,EAAE;EAC7D,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
@@ -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,IAAIJ,UAAU,EAAE;IAC9B,KAAK,MAAMK,OAAO,IAAID,KAAK,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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
- export {};
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":[]}