@wallarm-org/design-system 4.9.0 → 4.10.0-rc-feat-parser.1

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 (121) hide show
  1. package/dist/components/DropdownMenu/DropdownMenu.d.ts +2 -0
  2. package/dist/components/DropdownMenu/DropdownMenu.js +84 -71
  3. package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
  4. package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
  5. package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +14 -0
  6. package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +209 -0
  7. package/dist/components/Rules/PointSelector/MatchStep.d.ts +15 -0
  8. package/dist/components/Rules/PointSelector/MatchStep.js +186 -0
  9. package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +16 -0
  10. package/dist/components/Rules/PointSelector/MenuFooterHints.js +177 -0
  11. package/dist/components/Rules/PointSelector/PointPreview.d.ts +10 -0
  12. package/dist/components/Rules/PointSelector/PointPreview.js +88 -0
  13. package/dist/components/Rules/PointSelector/PointSelector.d.ts +17 -0
  14. package/dist/components/Rules/PointSelector/PointSelector.js +937 -0
  15. package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +12 -0
  16. package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +173 -0
  17. package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +31 -0
  18. package/dist/components/Rules/PointSelector/PointSelectorError.js +275 -0
  19. package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +20 -0
  20. package/dist/components/Rules/PointSelector/PointSelectorInput.js +130 -0
  21. package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +31 -0
  22. package/dist/components/Rules/PointSelector/PointSelectorMenu.js +317 -0
  23. package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +8 -0
  24. package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +73 -0
  25. package/dist/components/Rules/PointSelector/SampleRequest.d.ts +14 -0
  26. package/dist/components/Rules/PointSelector/SampleRequest.js +116 -0
  27. package/dist/components/Rules/PointSelector/StepMenu.d.ts +40 -0
  28. package/dist/components/Rules/PointSelector/StepMenu.js +210 -0
  29. package/dist/components/Rules/PointSelector/VersionWarning.d.ts +26 -0
  30. package/dist/components/Rules/PointSelector/VersionWarning.js +231 -0
  31. package/dist/components/Rules/PointSelector/WhereBar.d.ts +48 -0
  32. package/dist/components/Rules/PointSelector/WhereBar.js +263 -0
  33. package/dist/components/Rules/PointSelector/classes.d.ts +28 -0
  34. package/dist/components/Rules/PointSelector/classes.js +22 -0
  35. package/dist/components/Rules/PointSelector/index.d.ts +20 -0
  36. package/dist/components/Rules/PointSelector/index.js +18 -0
  37. package/dist/components/Rules/PointSelector/liftLayer.d.ts +8 -0
  38. package/dist/components/Rules/PointSelector/liftLayer.js +4 -0
  39. package/dist/components/Rules/PointSelector/sampleValue.d.ts +6 -0
  40. package/dist/components/Rules/PointSelector/sampleValue.js +51 -0
  41. package/dist/components/Rules/PointSelector/sdkBridge.d.ts +508 -0
  42. package/dist/components/Rules/PointSelector/sdkBridge.js +339 -0
  43. package/dist/components/Rules/PointSelector/types.d.ts +304 -0
  44. package/dist/components/Rules/PointSelector/types.js +0 -0
  45. package/dist/components/Rules/PointSelector/usePointSelector.d.ts +161 -0
  46. package/dist/components/Rules/PointSelector/usePointSelector.js +1088 -0
  47. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +28 -0
  48. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +208 -0
  49. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +23 -0
  50. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +950 -0
  51. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +21 -0
  52. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +110 -0
  53. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +20 -0
  54. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +31 -0
  55. package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +23 -0
  56. package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +131 -0
  57. package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +17 -0
  58. package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +14 -0
  59. package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +6 -0
  60. package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +6 -0
  61. package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +24 -0
  62. package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +245 -0
  63. package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +15 -0
  64. package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +691 -0
  65. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +19 -0
  66. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +72 -0
  67. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +27 -0
  68. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +407 -0
  69. package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +14 -0
  70. package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +269 -0
  71. package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +25 -0
  72. package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +99 -0
  73. package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +14 -0
  74. package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +118 -0
  75. package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +14 -0
  76. package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +446 -0
  77. package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +14 -0
  78. package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +266 -0
  79. package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +35 -0
  80. package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +57 -0
  81. package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +15 -0
  82. package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +10 -0
  83. package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +67 -0
  84. package/dist/components/Rules/RuleBuilder/RuleBuilder.js +366 -0
  85. package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +32 -0
  86. package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +420 -0
  87. package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +27 -0
  88. package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +446 -0
  89. package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +7 -0
  90. package/dist/components/Rules/RuleBuilder/Summary/index.js +2 -0
  91. package/dist/components/Rules/RuleBuilder/classes.d.ts +19 -0
  92. package/dist/components/Rules/RuleBuilder/classes.js +18 -0
  93. package/dist/components/Rules/RuleBuilder/index.d.ts +55 -0
  94. package/dist/components/Rules/RuleBuilder/index.js +11 -0
  95. package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +31 -0
  96. package/dist/components/Rules/RuleBuilder/models/actionModel.js +276 -0
  97. package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +95 -0
  98. package/dist/components/Rules/RuleBuilder/models/conditionModel.js +418 -0
  99. package/dist/components/Rules/RuleBuilder/models/index.d.ts +3 -0
  100. package/dist/components/Rules/RuleBuilder/models/index.js +3 -0
  101. package/dist/components/Rules/RuleBuilder/models/validation.d.ts +176 -0
  102. package/dist/components/Rules/RuleBuilder/models/validation.js +242 -0
  103. package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +27 -0
  104. package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +92 -0
  105. package/dist/components/Rules/RuleBuilder/shared/index.d.ts +1 -0
  106. package/dist/components/Rules/RuleBuilder/shared/index.js +1 -0
  107. package/dist/components/Rules/RuleBuilder/types.d.ts +384 -0
  108. package/dist/components/Rules/RuleBuilder/types.js +0 -0
  109. package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +65 -0
  110. package/dist/components/Rules/RuleBuilder/utils/constants.js +356 -0
  111. package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +48 -0
  112. package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +42 -0
  113. package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +92 -0
  114. package/dist/components/Rules/RuleBuilder/utils/helpers.js +54 -0
  115. package/dist/components/Rules/RuleBuilder/utils/index.d.ts +2 -0
  116. package/dist/components/Rules/RuleBuilder/utils/index.js +2 -0
  117. package/dist/index.d.ts +2 -0
  118. package/dist/index.js +2 -0
  119. package/dist/metadata/components.json +100 -2
  120. package/dist/metadata/guidelines.json +1 -1
  121. package/package.json +4 -1
@@ -0,0 +1,21 @@
1
+ /**
2
+ * ActionTargetPicker
3
+ *
4
+ * Target selection for actions: whole flow or specific point.
5
+ * Conditionally renders based on action kind's target requirements.
6
+ */
7
+ import type { FC } from 'react';
8
+ import type { ActionDraft } from '../types.js';
9
+ export interface ActionTargetPickerProps {
10
+ /** Current action draft */
11
+ action: ActionDraft;
12
+ /** Called when target changes */
13
+ onChange: (action: ActionDraft) => void;
14
+ }
15
+ /**
16
+ * Action target selector with conditional rendering:
17
+ * - 'flow' actions: no picker (always whole request)
18
+ * - 'point' actions: only PointSelector (must specify point)
19
+ * - 'either' actions: toggle + conditional PointSelector
20
+ */
21
+ export declare const ActionTargetPicker: FC<ActionTargetPickerProps>;
@@ -0,0 +1,110 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { SegmentedControl, SegmentedControlItem } from "../../../SegmentedControl/index.js";
4
+ import { PointSelector } from "../../PointSelector/index.js";
5
+ import { TARGET_REQUIREMENT } from "../utils/constants.js";
6
+ const ActionTargetPicker = (t0)=>{
7
+ const $ = c(20);
8
+ const { action, onChange } = t0;
9
+ const kind = action.kind;
10
+ const targetMode = TARGET_REQUIREMENT[kind];
11
+ if ("flow" === targetMode) return null;
12
+ let t1;
13
+ if ($[0] !== action || $[1] !== onChange) {
14
+ t1 = (value)=>{
15
+ onChange({
16
+ ...action,
17
+ target: {
18
+ ...action.target,
19
+ whole: "whole" === value
20
+ }
21
+ });
22
+ };
23
+ $[0] = action;
24
+ $[1] = onChange;
25
+ $[2] = t1;
26
+ } else t1 = $[2];
27
+ const handleWholeChange = t1;
28
+ let t2;
29
+ if ($[3] !== action || $[4] !== onChange) {
30
+ t2 = (value_0)=>{
31
+ onChange({
32
+ ...action,
33
+ target: {
34
+ ...action.target,
35
+ whole: false,
36
+ segments: value_0.segments
37
+ }
38
+ });
39
+ };
40
+ $[3] = action;
41
+ $[4] = onChange;
42
+ $[5] = t2;
43
+ } else t2 = $[5];
44
+ const handlePointChange = t2;
45
+ let t3;
46
+ if ($[6] !== action.target.whole || $[7] !== handleWholeChange || $[8] !== targetMode) {
47
+ t3 = "either" === targetMode && /*#__PURE__*/ jsx("div", {
48
+ className: "flex",
49
+ children: /*#__PURE__*/ jsxs(SegmentedControl, {
50
+ value: action.target.whole ? "whole" : "part",
51
+ onChange: handleWholeChange,
52
+ children: [
53
+ /*#__PURE__*/ jsx(SegmentedControlItem, {
54
+ value: "whole",
55
+ children: "The whole request"
56
+ }),
57
+ /*#__PURE__*/ jsx(SegmentedControlItem, {
58
+ value: "part",
59
+ children: "A part of the request"
60
+ })
61
+ ]
62
+ })
63
+ });
64
+ $[6] = action.target.whole;
65
+ $[7] = handleWholeChange;
66
+ $[8] = targetMode;
67
+ $[9] = t3;
68
+ } else t3 = $[9];
69
+ let t4;
70
+ if ($[10] !== action.target.context || $[11] !== action.target.segments || $[12] !== action.target.whole || $[13] !== handlePointChange || $[14] !== kind || $[15] !== targetMode) {
71
+ t4 = (!action.target.whole || "point" === targetMode) && /*#__PURE__*/ jsx(PointSelector, {
72
+ pointOnly: true,
73
+ title: "combine" === kind ? "Where do keys repeat?" : "Which part of the request?",
74
+ context: action.target.context,
75
+ value: {
76
+ segments: action.target.segments,
77
+ condition: null,
78
+ value: "",
79
+ ignoreCase: false,
80
+ canonical: null,
81
+ canonicalVersion: null
82
+ },
83
+ onChange: handlePointChange
84
+ });
85
+ $[10] = action.target.context;
86
+ $[11] = action.target.segments;
87
+ $[12] = action.target.whole;
88
+ $[13] = handlePointChange;
89
+ $[14] = kind;
90
+ $[15] = targetMode;
91
+ $[16] = t4;
92
+ } else t4 = $[16];
93
+ let t5;
94
+ if ($[17] !== t3 || $[18] !== t4) {
95
+ t5 = /*#__PURE__*/ jsxs("div", {
96
+ className: "flex flex-col gap-8",
97
+ "data-slot": "action-target-picker",
98
+ children: [
99
+ t3,
100
+ t4
101
+ ]
102
+ });
103
+ $[17] = t3;
104
+ $[18] = t4;
105
+ $[19] = t5;
106
+ } else t5 = $[19];
107
+ return t5;
108
+ };
109
+ ActionTargetPicker.displayName = "ActionTargetPicker";
110
+ export { ActionTargetPicker };
@@ -0,0 +1,20 @@
1
+ /**
2
+ * ActionTypeSelect
3
+ *
4
+ * Dropdown for selecting action kind.
5
+ */
6
+ import type { FC } from 'react';
7
+ import type { ActionKind } from '../types.js';
8
+ export interface ActionTypeSelectProps {
9
+ /** Current action kind */
10
+ value: ActionKind;
11
+ /** Called when action kind changes */
12
+ onChange: (kind: ActionKind) => void;
13
+ /** Test ID for the select button */
14
+ testId?: string;
15
+ }
16
+ /**
17
+ * Action kind selector dropdown.
18
+ * Displays human-readable labels for all 12 action types.
19
+ */
20
+ export declare const ActionTypeSelect: FC<ActionTypeSelectProps>;
@@ -0,0 +1,31 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { ChoiceSelect } from "../shared/ChoiceSelect.js";
4
+ import { ACTION_KIND_CHOICES } from "../utils/constants.js";
5
+ const ActionTypeSelect = (t0)=>{
6
+ const $ = c(6);
7
+ const { value, onChange, testId } = t0;
8
+ let t1;
9
+ if ($[0] !== onChange) {
10
+ t1 = (v)=>v && onChange(v);
11
+ $[0] = onChange;
12
+ $[1] = t1;
13
+ } else t1 = $[1];
14
+ let t2;
15
+ if ($[2] !== t1 || $[3] !== testId || $[4] !== value) {
16
+ t2 = /*#__PURE__*/ jsx(ChoiceSelect, {
17
+ label: "What the rule does",
18
+ value: value,
19
+ choices: ACTION_KIND_CHOICES,
20
+ testId: testId,
21
+ onChange: t1
22
+ });
23
+ $[2] = t1;
24
+ $[3] = testId;
25
+ $[4] = value;
26
+ $[5] = t2;
27
+ } else t2 = $[5];
28
+ return t2;
29
+ };
30
+ ActionTypeSelect.displayName = "ActionTypeSelect";
31
+ export { ActionTypeSelect };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * AttackTypeField
3
+ *
4
+ * Specialized field for selecting attack types.
5
+ * Allows selecting from known types or entering a custom type.
6
+ */
7
+ import { type FC } from 'react';
8
+ import type { Choice } from '../types.js';
9
+ export interface AttackTypeFieldProps {
10
+ /** Current attack type value */
11
+ value: string;
12
+ /** Available attack type choices */
13
+ choices: Choice[];
14
+ /** Called when value changes */
15
+ onChange: (value: string) => void;
16
+ /** Allow empty value (any attack) - used in filters */
17
+ allowAny?: boolean;
18
+ }
19
+ /**
20
+ * Attack type selector with custom type input option.
21
+ * Used for add_attack, suppress_attack, and mark_attack actions.
22
+ */
23
+ export declare const AttackTypeField: FC<AttackTypeFieldProps>;
@@ -0,0 +1,131 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c as compiler_runtime_c } from "react/compiler-runtime";
3
+ import { useState } from "react";
4
+ import { Input } from "../../../Input/index.js";
5
+ import { ChoiceSelect } from "../shared/ChoiceSelect.js";
6
+ const OTHER = "__other__";
7
+ const AttackTypeField = (t0)=>{
8
+ const $ = compiler_runtime_c(26);
9
+ const { value, choices, onChange, allowAny } = t0;
10
+ let t1;
11
+ if ($[0] !== choices || $[1] !== value) {
12
+ let t2;
13
+ if ($[3] !== value) {
14
+ t2 = (c)=>c.value === value;
15
+ $[3] = value;
16
+ $[4] = t2;
17
+ } else t2 = $[4];
18
+ t1 = choices.some(t2);
19
+ $[0] = choices;
20
+ $[1] = value;
21
+ $[2] = t1;
22
+ } else t1 = $[2];
23
+ const known = t1;
24
+ const [typing, setTyping] = useState("" !== value && !known);
25
+ let t2;
26
+ if ($[5] !== allowAny) {
27
+ t2 = allowAny ? [
28
+ {
29
+ value: "",
30
+ label: "Any attack"
31
+ }
32
+ ] : [];
33
+ $[5] = allowAny;
34
+ $[6] = t2;
35
+ } else t2 = $[6];
36
+ let t3;
37
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
38
+ t3 = {
39
+ value: OTHER,
40
+ label: "Another type…"
41
+ };
42
+ $[7] = t3;
43
+ } else t3 = $[7];
44
+ let t4;
45
+ if ($[8] !== choices || $[9] !== t2) {
46
+ t4 = [
47
+ ...t2,
48
+ ...choices,
49
+ t3
50
+ ];
51
+ $[8] = choices;
52
+ $[9] = t2;
53
+ $[10] = t4;
54
+ } else t4 = $[10];
55
+ const options = t4;
56
+ let t5;
57
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
58
+ t5 = {
59
+ width: 260
60
+ };
61
+ $[11] = t5;
62
+ } else t5 = $[11];
63
+ const t6 = allowAny ? "Any attack" : "Choose an attack type";
64
+ const t7 = typing ? OTHER : value;
65
+ let t8;
66
+ if ($[12] !== onChange) {
67
+ t8 = (v)=>{
68
+ if (v === OTHER) {
69
+ setTyping(true);
70
+ onChange("");
71
+ } else {
72
+ setTyping(false);
73
+ onChange(v);
74
+ }
75
+ };
76
+ $[12] = onChange;
77
+ $[13] = t8;
78
+ } else t8 = $[13];
79
+ let t9;
80
+ if ($[14] !== options || $[15] !== t6 || $[16] !== t7 || $[17] !== t8) {
81
+ t9 = /*#__PURE__*/ jsx("div", {
82
+ style: t5,
83
+ children: /*#__PURE__*/ jsx(ChoiceSelect, {
84
+ label: "Attack type",
85
+ placeholder: t6,
86
+ value: t7,
87
+ choices: options,
88
+ onChange: t8
89
+ })
90
+ });
91
+ $[14] = options;
92
+ $[15] = t6;
93
+ $[16] = t7;
94
+ $[17] = t8;
95
+ $[18] = t9;
96
+ } else t9 = $[18];
97
+ let t10;
98
+ if ($[19] !== onChange || $[20] !== typing || $[21] !== value) {
99
+ t10 = typing && /*#__PURE__*/ jsx("div", {
100
+ style: {
101
+ width: 220
102
+ },
103
+ children: /*#__PURE__*/ jsx(Input, {
104
+ "aria-label": "Attack type name",
105
+ placeholder: "attack type, e.g. acl_violation",
106
+ value: value,
107
+ onChange: (e)=>onChange(e.target.value.trim())
108
+ })
109
+ });
110
+ $[19] = onChange;
111
+ $[20] = typing;
112
+ $[21] = value;
113
+ $[22] = t10;
114
+ } else t10 = $[22];
115
+ let t11;
116
+ if ($[23] !== t10 || $[24] !== t9) {
117
+ t11 = /*#__PURE__*/ jsxs("div", {
118
+ className: "flex flex-wrap items-center gap-8",
119
+ children: [
120
+ t9,
121
+ t10
122
+ ]
123
+ });
124
+ $[23] = t10;
125
+ $[24] = t9;
126
+ $[25] = t11;
127
+ } else t11 = $[25];
128
+ return t11;
129
+ };
130
+ AttackTypeField.displayName = "AttackTypeField";
131
+ export { AttackTypeField };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * ActionEditor CVA Classes
3
+ *
4
+ * Variant definitions for ActionEditor components.
5
+ */
6
+ /**
7
+ * Action editor container variants.
8
+ */
9
+ export declare const actionEditorVariants: (props?: ({} & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
+ /**
11
+ * Action field group variants.
12
+ */
13
+ export declare const actionFieldsVariants: (props?: ({} & import("class-variance-authority/types").ClassProp) | undefined) => string;
14
+ /**
15
+ * Action target picker variants.
16
+ */
17
+ export declare const actionTargetPickerVariants: (props?: ({} & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -0,0 +1,14 @@
1
+ import { cva } from "class-variance-authority";
2
+ const actionEditorVariants = cva('flex flex-col gap-12', {
3
+ variants: {},
4
+ defaultVariants: {}
5
+ });
6
+ const actionFieldsVariants = cva('flex flex-col gap-12', {
7
+ variants: {},
8
+ defaultVariants: {}
9
+ });
10
+ const actionTargetPickerVariants = cva('flex flex-col gap-8', {
11
+ variants: {},
12
+ defaultVariants: {}
13
+ });
14
+ export { actionEditorVariants, actionFieldsVariants, actionTargetPickerVariants };
@@ -0,0 +1,6 @@
1
+ export { ActionEditor, type ActionEditorProps } from './ActionEditor.js';
2
+ export { ActionFields, type ActionFieldsProps } from './ActionFields.js';
3
+ export { ActionTargetPicker, type ActionTargetPickerProps } from './ActionTargetPicker.js';
4
+ export { ActionTypeSelect, type ActionTypeSelectProps } from './ActionTypeSelect.js';
5
+ export { AttackTypeField, type AttackTypeFieldProps } from './AttackTypeField.js';
6
+ export { actionEditorVariants, actionFieldsVariants, actionTargetPickerVariants } from './classes.js';
@@ -0,0 +1,6 @@
1
+ export { ActionEditor } from "./ActionEditor.js";
2
+ export { ActionFields } from "./ActionFields.js";
3
+ export { ActionTargetPicker } from "./ActionTargetPicker.js";
4
+ export { ActionTypeSelect } from "./ActionTypeSelect.js";
5
+ export { AttackTypeField } from "./AttackTypeField.js";
6
+ export { actionEditorVariants, actionFieldsVariants, actionTargetPickerVariants } from "./classes.js";
@@ -0,0 +1,24 @@
1
+ /**
2
+ * AddConditionMenu
3
+ *
4
+ * Dropdown menu for adding new conditions to the tree.
5
+ * Shows 6 options: field, attack, signal, tag, sample, or group.
6
+ * Conditionally hides attack/signal when inside a 'not' group.
7
+ */
8
+ import type { FC } from 'react';
9
+ import type { ConditionNode } from '../types.js';
10
+ export interface AddConditionMenuProps {
11
+ onAdd: (node: ConditionNode) => void;
12
+ /** True when inside a 'not' group - hides attack/signal options */
13
+ insideNone?: boolean;
14
+ /** Factory functions for creating new nodes */
15
+ factories: {
16
+ field: () => ConditionNode;
17
+ attack: () => ConditionNode;
18
+ signal: () => ConditionNode;
19
+ tag: () => ConditionNode;
20
+ sample: () => ConditionNode;
21
+ group: () => ConditionNode;
22
+ };
23
+ }
24
+ export declare const AddConditionMenu: FC<AddConditionMenuProps>;
@@ -0,0 +1,245 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react/compiler-runtime";
3
+ import { Plus } from "../../../../icons/index.js";
4
+ import { useTestId } from "../../../../utils/testId.js";
5
+ import { Button } from "../../../Button/index.js";
6
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuItemDescription, DropdownMenuItemText, DropdownMenuTrigger } from "../../../DropdownMenu/index.js";
7
+ const AddConditionMenu = (t0)=>{
8
+ const $ = c(46);
9
+ const { onAdd, insideNone: t1, factories } = t0;
10
+ const insideNone = void 0 === t1 ? false : t1;
11
+ const testId = useTestId("add-condition");
12
+ let t2;
13
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
14
+ t2 = {
15
+ placement: "bottom-start"
16
+ };
17
+ $[0] = t2;
18
+ } else t2 = $[0];
19
+ let t3;
20
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
21
+ t3 = /*#__PURE__*/ jsx(Plus, {});
22
+ $[1] = t3;
23
+ } else t3 = $[1];
24
+ let t4;
25
+ if ($[2] !== testId) {
26
+ t4 = /*#__PURE__*/ jsx(DropdownMenuTrigger, {
27
+ asChild: true,
28
+ children: /*#__PURE__*/ jsxs(Button, {
29
+ variant: "outline",
30
+ color: "neutral",
31
+ size: "small",
32
+ "data-slot": "add-condition-trigger",
33
+ "data-testid": testId,
34
+ children: [
35
+ t3,
36
+ "Add condition"
37
+ ]
38
+ })
39
+ });
40
+ $[2] = testId;
41
+ $[3] = t4;
42
+ } else t4 = $[3];
43
+ let t5;
44
+ if ($[4] !== factories || $[5] !== onAdd) {
45
+ t5 = ()=>onAdd(factories.field());
46
+ $[4] = factories;
47
+ $[5] = onAdd;
48
+ $[6] = t5;
49
+ } else t5 = $[6];
50
+ let t6;
51
+ if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
52
+ t6 = /*#__PURE__*/ jsxs("div", {
53
+ className: "flex flex-col",
54
+ children: [
55
+ /*#__PURE__*/ jsx(DropdownMenuItemText, {
56
+ children: "A value in the request or response"
57
+ }),
58
+ /*#__PURE__*/ jsx(DropdownMenuItemDescription, {
59
+ children: "A header, a field in the body, the path…"
60
+ })
61
+ ]
62
+ });
63
+ $[7] = t6;
64
+ } else t6 = $[7];
65
+ let t7;
66
+ if ($[8] !== t5) {
67
+ t7 = /*#__PURE__*/ jsx(DropdownMenuItem, {
68
+ onSelect: t5,
69
+ children: t6
70
+ });
71
+ $[8] = t5;
72
+ $[9] = t7;
73
+ } else t7 = $[9];
74
+ let t8;
75
+ if ($[10] !== factories || $[11] !== insideNone || $[12] !== onAdd) {
76
+ t8 = !insideNone && /*#__PURE__*/ jsx(DropdownMenuItem, {
77
+ onSelect: ()=>onAdd(factories.attack()),
78
+ children: /*#__PURE__*/ jsxs("div", {
79
+ className: "flex flex-col",
80
+ children: [
81
+ /*#__PURE__*/ jsx(DropdownMenuItemText, {
82
+ children: "An attack was detected"
83
+ }),
84
+ /*#__PURE__*/ jsx(DropdownMenuItemDescription, {
85
+ children: "Another rule or the detector found an attack of a given type"
86
+ })
87
+ ]
88
+ })
89
+ });
90
+ $[10] = factories;
91
+ $[11] = insideNone;
92
+ $[12] = onAdd;
93
+ $[13] = t8;
94
+ } else t8 = $[13];
95
+ let t9;
96
+ if ($[14] !== factories || $[15] !== insideNone || $[16] !== onAdd) {
97
+ t9 = !insideNone && /*#__PURE__*/ jsx(DropdownMenuItem, {
98
+ onSelect: ()=>onAdd(factories.signal()),
99
+ children: /*#__PURE__*/ jsxs("div", {
100
+ className: "flex flex-col",
101
+ children: [
102
+ /*#__PURE__*/ jsx(DropdownMenuItemText, {
103
+ children: "A request anomaly was detected"
104
+ }),
105
+ /*#__PURE__*/ jsx(DropdownMenuItemDescription, {
106
+ children: "For example, a parameter sent more than once"
107
+ })
108
+ ]
109
+ })
110
+ });
111
+ $[14] = factories;
112
+ $[15] = insideNone;
113
+ $[16] = onAdd;
114
+ $[17] = t9;
115
+ } else t9 = $[17];
116
+ let t10;
117
+ if ($[18] !== factories || $[19] !== onAdd) {
118
+ t10 = ()=>onAdd(factories.tag());
119
+ $[18] = factories;
120
+ $[19] = onAdd;
121
+ $[20] = t10;
122
+ } else t10 = $[20];
123
+ let t11;
124
+ if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
125
+ t11 = /*#__PURE__*/ jsxs("div", {
126
+ className: "flex flex-col",
127
+ children: [
128
+ /*#__PURE__*/ jsx(DropdownMenuItemText, {
129
+ children: "A tag is present or absent"
130
+ }),
131
+ /*#__PURE__*/ jsx(DropdownMenuItemDescription, {
132
+ children: "Check for tags added by other rules"
133
+ })
134
+ ]
135
+ });
136
+ $[21] = t11;
137
+ } else t11 = $[21];
138
+ let t12;
139
+ if ($[22] !== t10) {
140
+ t12 = /*#__PURE__*/ jsx(DropdownMenuItem, {
141
+ onSelect: t10,
142
+ children: t11
143
+ });
144
+ $[22] = t10;
145
+ $[23] = t12;
146
+ } else t12 = $[23];
147
+ let t13;
148
+ if ($[24] !== factories || $[25] !== onAdd) {
149
+ t13 = ()=>onAdd(factories.sample());
150
+ $[24] = factories;
151
+ $[25] = onAdd;
152
+ $[26] = t13;
153
+ } else t13 = $[26];
154
+ let t14;
155
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
156
+ t14 = /*#__PURE__*/ jsxs("div", {
157
+ className: "flex flex-col",
158
+ children: [
159
+ /*#__PURE__*/ jsx(DropdownMenuItemText, {
160
+ children: "Sample a percentage of flows"
161
+ }),
162
+ /*#__PURE__*/ jsx(DropdownMenuItemDescription, {
163
+ children: "Apply the rule to a random sample of requests"
164
+ })
165
+ ]
166
+ });
167
+ $[27] = t14;
168
+ } else t14 = $[27];
169
+ let t15;
170
+ if ($[28] !== t13) {
171
+ t15 = /*#__PURE__*/ jsx(DropdownMenuItem, {
172
+ onSelect: t13,
173
+ children: t14
174
+ });
175
+ $[28] = t13;
176
+ $[29] = t15;
177
+ } else t15 = $[29];
178
+ let t16;
179
+ if ($[30] !== factories || $[31] !== onAdd) {
180
+ t16 = ()=>onAdd(factories.group());
181
+ $[30] = factories;
182
+ $[31] = onAdd;
183
+ $[32] = t16;
184
+ } else t16 = $[32];
185
+ let t17;
186
+ if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
187
+ t17 = /*#__PURE__*/ jsxs("div", {
188
+ className: "flex flex-col",
189
+ children: [
190
+ /*#__PURE__*/ jsx(DropdownMenuItemText, {
191
+ children: "A group of conditions"
192
+ }),
193
+ /*#__PURE__*/ jsx(DropdownMenuItemDescription, {
194
+ children: "Its own all / any / none, inside this one"
195
+ })
196
+ ]
197
+ });
198
+ $[33] = t17;
199
+ } else t17 = $[33];
200
+ let t18;
201
+ if ($[34] !== t16) {
202
+ t18 = /*#__PURE__*/ jsx(DropdownMenuItem, {
203
+ onSelect: t16,
204
+ children: t17
205
+ });
206
+ $[34] = t16;
207
+ $[35] = t18;
208
+ } else t18 = $[35];
209
+ let t19;
210
+ if ($[36] !== t12 || $[37] !== t15 || $[38] !== t18 || $[39] !== t7 || $[40] !== t8 || $[41] !== t9) {
211
+ t19 = /*#__PURE__*/ jsxs(DropdownMenuContent, {
212
+ children: [
213
+ t7,
214
+ t8,
215
+ t9,
216
+ t12,
217
+ t15,
218
+ t18
219
+ ]
220
+ });
221
+ $[36] = t12;
222
+ $[37] = t15;
223
+ $[38] = t18;
224
+ $[39] = t7;
225
+ $[40] = t8;
226
+ $[41] = t9;
227
+ $[42] = t19;
228
+ } else t19 = $[42];
229
+ let t20;
230
+ if ($[43] !== t19 || $[44] !== t4) {
231
+ t20 = /*#__PURE__*/ jsxs(DropdownMenu, {
232
+ positioning: t2,
233
+ children: [
234
+ t4,
235
+ t19
236
+ ]
237
+ });
238
+ $[43] = t19;
239
+ $[44] = t4;
240
+ $[45] = t20;
241
+ } else t20 = $[45];
242
+ return t20;
243
+ };
244
+ AddConditionMenu.displayName = "AddConditionMenu";
245
+ export { AddConditionMenu };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * AttackCondition
3
+ *
4
+ * "An attack was detected" condition.
5
+ * Allows selecting attack type and detection point.
6
+ */
7
+ import type { FC } from 'react';
8
+ import type { AttackCondition as AttackConditionType, Choice } from '../types.js';
9
+ export interface AttackConditionProps {
10
+ condition: AttackConditionType;
11
+ onChange: (condition: AttackConditionType) => void;
12
+ onRemove: () => void;
13
+ attackTypes: Choice[];
14
+ }
15
+ export declare const AttackCondition: FC<AttackConditionProps>;