@wallarm-org/design-system 4.7.0 → 4.8.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.
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +2 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +84 -71
- package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +14 -0
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +209 -0
- package/dist/components/Rules/PointSelector/MatchStep.d.ts +15 -0
- package/dist/components/Rules/PointSelector/MatchStep.js +186 -0
- package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +16 -0
- package/dist/components/Rules/PointSelector/MenuFooterHints.js +177 -0
- package/dist/components/Rules/PointSelector/PointPreview.d.ts +10 -0
- package/dist/components/Rules/PointSelector/PointPreview.js +88 -0
- package/dist/components/Rules/PointSelector/PointSelector.d.ts +17 -0
- package/dist/components/Rules/PointSelector/PointSelector.js +937 -0
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +12 -0
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +173 -0
- package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +31 -0
- package/dist/components/Rules/PointSelector/PointSelectorError.js +275 -0
- package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +20 -0
- package/dist/components/Rules/PointSelector/PointSelectorInput.js +130 -0
- package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +31 -0
- package/dist/components/Rules/PointSelector/PointSelectorMenu.js +317 -0
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +8 -0
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +73 -0
- package/dist/components/Rules/PointSelector/SampleRequest.d.ts +14 -0
- package/dist/components/Rules/PointSelector/SampleRequest.js +116 -0
- package/dist/components/Rules/PointSelector/StepMenu.d.ts +40 -0
- package/dist/components/Rules/PointSelector/StepMenu.js +210 -0
- package/dist/components/Rules/PointSelector/VersionWarning.d.ts +26 -0
- package/dist/components/Rules/PointSelector/VersionWarning.js +231 -0
- package/dist/components/Rules/PointSelector/WhereBar.d.ts +48 -0
- package/dist/components/Rules/PointSelector/WhereBar.js +263 -0
- package/dist/components/Rules/PointSelector/classes.d.ts +28 -0
- package/dist/components/Rules/PointSelector/classes.js +22 -0
- package/dist/components/Rules/PointSelector/index.d.ts +20 -0
- package/dist/components/Rules/PointSelector/index.js +18 -0
- package/dist/components/Rules/PointSelector/liftLayer.d.ts +8 -0
- package/dist/components/Rules/PointSelector/liftLayer.js +4 -0
- package/dist/components/Rules/PointSelector/sampleValue.d.ts +6 -0
- package/dist/components/Rules/PointSelector/sampleValue.js +51 -0
- package/dist/components/Rules/PointSelector/sdkBridge.d.ts +508 -0
- package/dist/components/Rules/PointSelector/sdkBridge.js +339 -0
- package/dist/components/Rules/PointSelector/types.d.ts +304 -0
- package/dist/components/Rules/PointSelector/types.js +0 -0
- package/dist/components/Rules/PointSelector/usePointSelector.d.ts +161 -0
- package/dist/components/Rules/PointSelector/usePointSelector.js +1088 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +28 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +208 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +23 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +950 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +21 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +110 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +20 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +31 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +23 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +131 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +17 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +14 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +6 -0
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +6 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +24 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +245 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +15 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +691 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +19 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +72 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +27 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +407 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +269 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +25 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +99 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +118 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +446 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +14 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +266 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +35 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +57 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +15 -0
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +10 -0
- package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +67 -0
- package/dist/components/Rules/RuleBuilder/RuleBuilder.js +366 -0
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +32 -0
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +420 -0
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +27 -0
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +446 -0
- package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +7 -0
- package/dist/components/Rules/RuleBuilder/Summary/index.js +2 -0
- package/dist/components/Rules/RuleBuilder/classes.d.ts +19 -0
- package/dist/components/Rules/RuleBuilder/classes.js +18 -0
- package/dist/components/Rules/RuleBuilder/index.d.ts +55 -0
- package/dist/components/Rules/RuleBuilder/index.js +11 -0
- package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +31 -0
- package/dist/components/Rules/RuleBuilder/models/actionModel.js +276 -0
- package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +95 -0
- package/dist/components/Rules/RuleBuilder/models/conditionModel.js +418 -0
- package/dist/components/Rules/RuleBuilder/models/index.d.ts +3 -0
- package/dist/components/Rules/RuleBuilder/models/index.js +3 -0
- package/dist/components/Rules/RuleBuilder/models/validation.d.ts +176 -0
- package/dist/components/Rules/RuleBuilder/models/validation.js +242 -0
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +27 -0
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +92 -0
- package/dist/components/Rules/RuleBuilder/shared/index.d.ts +1 -0
- package/dist/components/Rules/RuleBuilder/shared/index.js +1 -0
- package/dist/components/Rules/RuleBuilder/types.d.ts +384 -0
- package/dist/components/Rules/RuleBuilder/types.js +0 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +65 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.js +356 -0
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +48 -0
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +42 -0
- package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +92 -0
- package/dist/components/Rules/RuleBuilder/utils/helpers.js +54 -0
- package/dist/components/Rules/RuleBuilder/utils/index.d.ts +2 -0
- package/dist/components/Rules/RuleBuilder/utils/index.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/metadata/components.json +100 -2
- package/package.json +4 -1
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useId, useRef, useState } from "react";
|
|
3
|
+
import { conditionLabel } from "@wallarm-org/rules-lib/ui";
|
|
4
|
+
import { useTestId } from "../../../utils/testId.js";
|
|
5
|
+
import { Button } from "../../Button/index.js";
|
|
6
|
+
import { Checkbox, CheckboxIndicator, CheckboxLabel } from "../../Checkbox/index.js";
|
|
7
|
+
import { Input } from "../../Input/index.js";
|
|
8
|
+
import { Loader } from "../../Loader/index.js";
|
|
9
|
+
import { Text } from "../../Text/index.js";
|
|
10
|
+
import { StepMenu } from "./StepMenu.js";
|
|
11
|
+
const MatchStep = ({ model, conditionInputRef, valueInputRef, conditionChipRef, condition, value, ignoreCase })=>{
|
|
12
|
+
const testId = useTestId('match');
|
|
13
|
+
const anchorRef = useRef(null);
|
|
14
|
+
const menuId = useId();
|
|
15
|
+
const { ui, actions, keys } = model;
|
|
16
|
+
const choosing = 'condition' === ui.stage;
|
|
17
|
+
const safeActions = {
|
|
18
|
+
closeConditionList: actions?.closeConditionList ?? (()=>{}),
|
|
19
|
+
setConditionQuery: actions?.setConditionQuery ?? (()=>{}),
|
|
20
|
+
highlightCondition: actions?.highlightCondition ?? (()=>{}),
|
|
21
|
+
chooseCondition: actions?.chooseCondition ?? (()=>{}),
|
|
22
|
+
editCondition: actions?.editCondition ?? (()=>{}),
|
|
23
|
+
setValue: actions?.setValue ?? (()=>{}),
|
|
24
|
+
setIgnoreCase: actions?.setIgnoreCase ?? (()=>{})
|
|
25
|
+
};
|
|
26
|
+
const safeKeys = {
|
|
27
|
+
handleConditionKey: keys?.handleConditionKey ?? (()=>{}),
|
|
28
|
+
handleValueKey: keys?.handleValueKey ?? (()=>{})
|
|
29
|
+
};
|
|
30
|
+
const [regexError, setRegexError] = useState(null);
|
|
31
|
+
const [validatingRegex, setValidatingRegex] = useState(false);
|
|
32
|
+
const validationTimeoutRef = useRef(null);
|
|
33
|
+
useEffect(()=>{
|
|
34
|
+
const isRegexCondition = 'regexp' === condition || 'nregexp' === condition;
|
|
35
|
+
if (!isRegexCondition || !value) {
|
|
36
|
+
setRegexError(null);
|
|
37
|
+
setValidatingRegex(false);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (validationTimeoutRef.current) clearTimeout(validationTimeoutRef.current);
|
|
41
|
+
setValidatingRegex(true);
|
|
42
|
+
validationTimeoutRef.current = setTimeout(()=>{
|
|
43
|
+
try {
|
|
44
|
+
new RegExp(value);
|
|
45
|
+
setRegexError(null);
|
|
46
|
+
} catch (error) {
|
|
47
|
+
setRegexError(error instanceof Error ? error.message : 'Invalid regex pattern');
|
|
48
|
+
} finally{
|
|
49
|
+
setValidatingRegex(false);
|
|
50
|
+
}
|
|
51
|
+
}, 300);
|
|
52
|
+
return ()=>{
|
|
53
|
+
if (validationTimeoutRef.current) clearTimeout(validationTimeoutRef.current);
|
|
54
|
+
};
|
|
55
|
+
}, [
|
|
56
|
+
condition,
|
|
57
|
+
value
|
|
58
|
+
]);
|
|
59
|
+
const handleListClose = ()=>requestAnimationFrame(()=>{
|
|
60
|
+
if (conditionInputRef.current !== document.activeElement) safeActions.closeConditionList();
|
|
61
|
+
});
|
|
62
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
63
|
+
"data-slot": "match-step",
|
|
64
|
+
"data-testid": testId,
|
|
65
|
+
className: "flex flex-col gap-8",
|
|
66
|
+
children: [
|
|
67
|
+
/*#__PURE__*/ jsxs(Text, {
|
|
68
|
+
size: "sm",
|
|
69
|
+
weight: "medium",
|
|
70
|
+
children: [
|
|
71
|
+
"2. ",
|
|
72
|
+
model.conditionTitle
|
|
73
|
+
]
|
|
74
|
+
}),
|
|
75
|
+
choosing ? /*#__PURE__*/ jsxs("div", {
|
|
76
|
+
ref: anchorRef,
|
|
77
|
+
className: "w-[460px] max-w-full",
|
|
78
|
+
children: [
|
|
79
|
+
/*#__PURE__*/ jsx(Input, {
|
|
80
|
+
ref: conditionInputRef,
|
|
81
|
+
role: "combobox",
|
|
82
|
+
"aria-haspopup": "menu",
|
|
83
|
+
"aria-controls": menuId,
|
|
84
|
+
"aria-expanded": true,
|
|
85
|
+
"aria-label": "type to filter, or the number of a condition",
|
|
86
|
+
placeholder: "type to filter, or a number",
|
|
87
|
+
value: ui.conditionQuery,
|
|
88
|
+
spellCheck: false,
|
|
89
|
+
autoComplete: "off",
|
|
90
|
+
onChange: (e)=>safeActions.setConditionQuery(e.target.value),
|
|
91
|
+
onKeyDown: safeKeys.handleConditionKey
|
|
92
|
+
}),
|
|
93
|
+
/*#__PURE__*/ jsx(StepMenu, {
|
|
94
|
+
open: true,
|
|
95
|
+
contentId: menuId,
|
|
96
|
+
anchorRef: anchorRef,
|
|
97
|
+
focusRef: conditionInputRef,
|
|
98
|
+
title: "Choose a condition",
|
|
99
|
+
rows: model.conditionRows,
|
|
100
|
+
highlightedId: model.conditionHighlightedId ?? null,
|
|
101
|
+
footer: "list",
|
|
102
|
+
escLabel: "to go back",
|
|
103
|
+
onHighlight: safeActions.highlightCondition,
|
|
104
|
+
onChoose: safeActions.chooseCondition,
|
|
105
|
+
onClose: handleListClose
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
}) : /*#__PURE__*/ jsxs("div", {
|
|
109
|
+
className: "flex flex-col gap-6",
|
|
110
|
+
children: [
|
|
111
|
+
/*#__PURE__*/ jsxs("div", {
|
|
112
|
+
className: "flex items-center gap-8",
|
|
113
|
+
children: [
|
|
114
|
+
/*#__PURE__*/ jsx(Button, {
|
|
115
|
+
ref: conditionChipRef,
|
|
116
|
+
variant: "outline",
|
|
117
|
+
color: "neutral",
|
|
118
|
+
size: "large",
|
|
119
|
+
onClick: safeActions.editCondition,
|
|
120
|
+
children: condition ? `${conditionLabel(condition)} ✎` : 'Choose a condition'
|
|
121
|
+
}),
|
|
122
|
+
model.conditionTakesValue && /*#__PURE__*/ jsxs("div", {
|
|
123
|
+
className: "relative flex-1",
|
|
124
|
+
children: [
|
|
125
|
+
/*#__PURE__*/ jsx(Input, {
|
|
126
|
+
ref: valueInputRef,
|
|
127
|
+
"aria-label": "value",
|
|
128
|
+
className: "font-mono",
|
|
129
|
+
placeholder: "the value; * stands for any text",
|
|
130
|
+
value: value,
|
|
131
|
+
spellCheck: false,
|
|
132
|
+
autoComplete: "off",
|
|
133
|
+
onChange: (e)=>safeActions.setValue(e.target.value),
|
|
134
|
+
onKeyDown: safeKeys.handleValueKey,
|
|
135
|
+
error: null !== regexError,
|
|
136
|
+
"aria-describedby": regexError ? `${testId}--regex-error` : void 0
|
|
137
|
+
}),
|
|
138
|
+
validatingRegex && /*#__PURE__*/ jsx("div", {
|
|
139
|
+
className: "absolute right-12 top-1/2 -translate-y-1/2",
|
|
140
|
+
children: /*#__PURE__*/ jsx(Loader, {
|
|
141
|
+
size: "sm",
|
|
142
|
+
background: false,
|
|
143
|
+
"data-testid": `${testId}--regex-loading`
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
}),
|
|
150
|
+
regexError && /*#__PURE__*/ jsxs(Text, {
|
|
151
|
+
id: `${testId}--regex-error`,
|
|
152
|
+
size: "xs",
|
|
153
|
+
color: "danger",
|
|
154
|
+
"data-testid": `${testId}--regex-error`,
|
|
155
|
+
children: [
|
|
156
|
+
"Regex compilation error: ",
|
|
157
|
+
regexError
|
|
158
|
+
]
|
|
159
|
+
}),
|
|
160
|
+
model.conditionTakesValue && /*#__PURE__*/ jsxs("div", {
|
|
161
|
+
className: "flex items-center justify-between gap-12",
|
|
162
|
+
children: [
|
|
163
|
+
/*#__PURE__*/ jsx(Text, {
|
|
164
|
+
size: "xs",
|
|
165
|
+
color: "secondary",
|
|
166
|
+
children: model.readAs
|
|
167
|
+
}),
|
|
168
|
+
/*#__PURE__*/ jsxs(Checkbox, {
|
|
169
|
+
checked: ignoreCase,
|
|
170
|
+
onCheckedChange: (d)=>safeActions.setIgnoreCase(true === d.checked),
|
|
171
|
+
children: [
|
|
172
|
+
/*#__PURE__*/ jsx(CheckboxIndicator, {}),
|
|
173
|
+
/*#__PURE__*/ jsx(CheckboxLabel, {
|
|
174
|
+
children: "Ignore letter case (⌥C)"
|
|
175
|
+
})
|
|
176
|
+
]
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
})
|
|
182
|
+
]
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
MatchStep.displayName = 'MatchStep';
|
|
186
|
+
export { MatchStep };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FC, HTMLAttributes, Ref } from 'react';
|
|
2
|
+
export interface MenuFooterHintsProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Ref forwarding to root element */
|
|
4
|
+
ref?: Ref<HTMLDivElement>;
|
|
5
|
+
/** Variant determines which shortcuts to show */
|
|
6
|
+
variant: 'list' | 'pick' | 'name';
|
|
7
|
+
/** Label for Escape key */
|
|
8
|
+
escLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* MenuFooterHints Component
|
|
12
|
+
*
|
|
13
|
+
* Keyboard hints in the menu footer, matching FilterInput style.
|
|
14
|
+
* Based on rules-frontend MenuFooterHints pattern.
|
|
15
|
+
*/
|
|
16
|
+
export declare const MenuFooterHints: FC<MenuFooterHintsProps>;
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cn } from "../../../utils/cn.js";
|
|
4
|
+
import { useTestId } from "../../../utils/testId.js";
|
|
5
|
+
import { Kbd, KbdGroup } from "../../Kbd/index.js";
|
|
6
|
+
import { menuFooterHintsClasses } from "./classes.js";
|
|
7
|
+
const Hint = (t0)=>{
|
|
8
|
+
const $ = c(7);
|
|
9
|
+
const { keys, children } = t0;
|
|
10
|
+
let t1;
|
|
11
|
+
if ($[0] !== keys) {
|
|
12
|
+
t1 = keys.map(_temp);
|
|
13
|
+
$[0] = keys;
|
|
14
|
+
$[1] = t1;
|
|
15
|
+
} else t1 = $[1];
|
|
16
|
+
let t2;
|
|
17
|
+
if ($[2] !== t1) {
|
|
18
|
+
t2 = /*#__PURE__*/ jsx(KbdGroup, {
|
|
19
|
+
children: t1
|
|
20
|
+
});
|
|
21
|
+
$[2] = t1;
|
|
22
|
+
$[3] = t2;
|
|
23
|
+
} else t2 = $[3];
|
|
24
|
+
let t3;
|
|
25
|
+
if ($[4] !== children || $[5] !== t2) {
|
|
26
|
+
t3 = /*#__PURE__*/ jsxs("span", {
|
|
27
|
+
className: "flex items-center gap-4",
|
|
28
|
+
children: [
|
|
29
|
+
t2,
|
|
30
|
+
children
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
$[4] = children;
|
|
34
|
+
$[5] = t2;
|
|
35
|
+
$[6] = t3;
|
|
36
|
+
} else t3 = $[6];
|
|
37
|
+
return t3;
|
|
38
|
+
};
|
|
39
|
+
const MenuFooterHints = (t0)=>{
|
|
40
|
+
const $ = c(23);
|
|
41
|
+
let className;
|
|
42
|
+
let props;
|
|
43
|
+
let ref;
|
|
44
|
+
let t1;
|
|
45
|
+
let variant;
|
|
46
|
+
if ($[0] !== t0) {
|
|
47
|
+
({ ref, variant, escLabel: t1, className, ...props } = t0);
|
|
48
|
+
$[0] = t0;
|
|
49
|
+
$[1] = className;
|
|
50
|
+
$[2] = props;
|
|
51
|
+
$[3] = ref;
|
|
52
|
+
$[4] = t1;
|
|
53
|
+
$[5] = variant;
|
|
54
|
+
} else {
|
|
55
|
+
className = $[1];
|
|
56
|
+
props = $[2];
|
|
57
|
+
ref = $[3];
|
|
58
|
+
t1 = $[4];
|
|
59
|
+
variant = $[5];
|
|
60
|
+
}
|
|
61
|
+
const escLabel = void 0 === t1 ? "to close" : t1;
|
|
62
|
+
const testId = useTestId("hints");
|
|
63
|
+
let t2;
|
|
64
|
+
if ($[6] !== className) {
|
|
65
|
+
t2 = cn(menuFooterHintsClasses, className);
|
|
66
|
+
$[6] = className;
|
|
67
|
+
$[7] = t2;
|
|
68
|
+
} else t2 = $[7];
|
|
69
|
+
let t3;
|
|
70
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
71
|
+
t3 = /*#__PURE__*/ jsx(Hint, {
|
|
72
|
+
keys: [
|
|
73
|
+
"↑",
|
|
74
|
+
"↓"
|
|
75
|
+
],
|
|
76
|
+
children: "to navigate"
|
|
77
|
+
});
|
|
78
|
+
$[8] = t3;
|
|
79
|
+
} else t3 = $[8];
|
|
80
|
+
let t4;
|
|
81
|
+
let t5;
|
|
82
|
+
if ($[9] !== variant) {
|
|
83
|
+
t4 = "pick" === variant ? /*#__PURE__*/ jsxs(Fragment, {
|
|
84
|
+
children: [
|
|
85
|
+
/*#__PURE__*/ jsx(Hint, {
|
|
86
|
+
keys: [
|
|
87
|
+
"1",
|
|
88
|
+
"2"
|
|
89
|
+
],
|
|
90
|
+
children: "or space to tick"
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ jsx(Hint, {
|
|
93
|
+
keys: [
|
|
94
|
+
"↵"
|
|
95
|
+
],
|
|
96
|
+
children: "to apply"
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
}) : /*#__PURE__*/ jsx(Hint, {
|
|
100
|
+
keys: [
|
|
101
|
+
"↵"
|
|
102
|
+
],
|
|
103
|
+
children: "to select"
|
|
104
|
+
});
|
|
105
|
+
t5 = "list" === variant && /*#__PURE__*/ jsxs(Fragment, {
|
|
106
|
+
children: [
|
|
107
|
+
/*#__PURE__*/ jsx(Hint, {
|
|
108
|
+
keys: [
|
|
109
|
+
"1",
|
|
110
|
+
"2"
|
|
111
|
+
],
|
|
112
|
+
children: "to choose by number"
|
|
113
|
+
}),
|
|
114
|
+
/*#__PURE__*/ jsx(Hint, {
|
|
115
|
+
keys: [
|
|
116
|
+
"tab"
|
|
117
|
+
],
|
|
118
|
+
children: "Next"
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
$[9] = variant;
|
|
123
|
+
$[10] = t4;
|
|
124
|
+
$[11] = t5;
|
|
125
|
+
} else {
|
|
126
|
+
t4 = $[10];
|
|
127
|
+
t5 = $[11];
|
|
128
|
+
}
|
|
129
|
+
let t6;
|
|
130
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
131
|
+
t6 = [
|
|
132
|
+
"esc"
|
|
133
|
+
];
|
|
134
|
+
$[12] = t6;
|
|
135
|
+
} else t6 = $[12];
|
|
136
|
+
let t7;
|
|
137
|
+
if ($[13] !== escLabel) {
|
|
138
|
+
t7 = /*#__PURE__*/ jsx(Hint, {
|
|
139
|
+
keys: t6,
|
|
140
|
+
children: escLabel
|
|
141
|
+
});
|
|
142
|
+
$[13] = escLabel;
|
|
143
|
+
$[14] = t7;
|
|
144
|
+
} else t7 = $[14];
|
|
145
|
+
let t8;
|
|
146
|
+
if ($[15] !== props || $[16] !== ref || $[17] !== t2 || $[18] !== t4 || $[19] !== t5 || $[20] !== t7 || $[21] !== testId) {
|
|
147
|
+
t8 = /*#__PURE__*/ jsxs("div", {
|
|
148
|
+
...props,
|
|
149
|
+
ref: ref,
|
|
150
|
+
"data-slot": "menu-footer-hints",
|
|
151
|
+
"data-testid": testId,
|
|
152
|
+
className: t2,
|
|
153
|
+
children: [
|
|
154
|
+
t3,
|
|
155
|
+
t4,
|
|
156
|
+
t5,
|
|
157
|
+
t7
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
$[15] = props;
|
|
161
|
+
$[16] = ref;
|
|
162
|
+
$[17] = t2;
|
|
163
|
+
$[18] = t4;
|
|
164
|
+
$[19] = t5;
|
|
165
|
+
$[20] = t7;
|
|
166
|
+
$[21] = testId;
|
|
167
|
+
$[22] = t8;
|
|
168
|
+
} else t8 = $[22];
|
|
169
|
+
return t8;
|
|
170
|
+
};
|
|
171
|
+
MenuFooterHints.displayName = "MenuFooterHints";
|
|
172
|
+
function _temp(k) {
|
|
173
|
+
return /*#__PURE__*/ jsx(Kbd, {
|
|
174
|
+
children: k
|
|
175
|
+
}, k);
|
|
176
|
+
}
|
|
177
|
+
export { MenuFooterHints };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { ProtonCheck } from '@wallarm-org/rules-lib';
|
|
3
|
+
export interface PointPreviewProps {
|
|
4
|
+
point: string;
|
|
5
|
+
check: ProtonCheck | null;
|
|
6
|
+
/** The point uses a form proton reserves but does not support yet. */
|
|
7
|
+
reserved: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** The generated proton point and check, as copyable technical text. */
|
|
10
|
+
export declare const PointPreview: FC<PointPreviewProps>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useTestId } from "../../../utils/testId.js";
|
|
4
|
+
import { Code } from "../../Code/index.js";
|
|
5
|
+
import { Text } from "../../Text/index.js";
|
|
6
|
+
const PointPreview = (t0)=>{
|
|
7
|
+
const $ = c(15);
|
|
8
|
+
const { point, check, reserved } = t0;
|
|
9
|
+
const testId = useTestId("preview");
|
|
10
|
+
let t1;
|
|
11
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
12
|
+
t1 = /*#__PURE__*/ jsx(Text, {
|
|
13
|
+
size: "xs",
|
|
14
|
+
color: "secondary",
|
|
15
|
+
children: "Rule code (generated)"
|
|
16
|
+
});
|
|
17
|
+
$[0] = t1;
|
|
18
|
+
} else t1 = $[0];
|
|
19
|
+
const t2 = point || "—";
|
|
20
|
+
let t3;
|
|
21
|
+
if ($[1] !== t2) {
|
|
22
|
+
t3 = /*#__PURE__*/ jsx(Code, {
|
|
23
|
+
size: "s",
|
|
24
|
+
className: "break-all",
|
|
25
|
+
children: t2
|
|
26
|
+
});
|
|
27
|
+
$[1] = t2;
|
|
28
|
+
$[2] = t3;
|
|
29
|
+
} else t3 = $[2];
|
|
30
|
+
let t4;
|
|
31
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
32
|
+
t4 = /*#__PURE__*/ jsx(Text, {
|
|
33
|
+
size: "xs",
|
|
34
|
+
color: "secondary",
|
|
35
|
+
children: "Check"
|
|
36
|
+
});
|
|
37
|
+
$[3] = t4;
|
|
38
|
+
} else t4 = $[3];
|
|
39
|
+
let t5;
|
|
40
|
+
if ($[4] !== check) {
|
|
41
|
+
t5 = check ? JSON.stringify(check) : "— press Next and set the condition";
|
|
42
|
+
$[4] = check;
|
|
43
|
+
$[5] = t5;
|
|
44
|
+
} else t5 = $[5];
|
|
45
|
+
let t6;
|
|
46
|
+
if ($[6] !== t5) {
|
|
47
|
+
t6 = /*#__PURE__*/ jsx(Code, {
|
|
48
|
+
size: "s",
|
|
49
|
+
className: "break-all",
|
|
50
|
+
children: t5
|
|
51
|
+
});
|
|
52
|
+
$[6] = t5;
|
|
53
|
+
$[7] = t6;
|
|
54
|
+
} else t6 = $[7];
|
|
55
|
+
let t7;
|
|
56
|
+
if ($[8] !== reserved) {
|
|
57
|
+
t7 = reserved && /*#__PURE__*/ jsx(Text, {
|
|
58
|
+
size: "xs",
|
|
59
|
+
color: "danger",
|
|
60
|
+
children: "Matching key names by pattern is not supported by the engine yet. A rule that uses it will not work until it is."
|
|
61
|
+
});
|
|
62
|
+
$[8] = reserved;
|
|
63
|
+
$[9] = t7;
|
|
64
|
+
} else t7 = $[9];
|
|
65
|
+
let t8;
|
|
66
|
+
if ($[10] !== t3 || $[11] !== t6 || $[12] !== t7 || $[13] !== testId) {
|
|
67
|
+
t8 = /*#__PURE__*/ jsxs("div", {
|
|
68
|
+
"data-slot": "point-preview",
|
|
69
|
+
"data-testid": testId,
|
|
70
|
+
className: "flex flex-col gap-6 rounded-12 border border-border-primary-light bg-bg-surface-2 p-12",
|
|
71
|
+
children: [
|
|
72
|
+
t1,
|
|
73
|
+
t3,
|
|
74
|
+
t4,
|
|
75
|
+
t6,
|
|
76
|
+
t7
|
|
77
|
+
]
|
|
78
|
+
});
|
|
79
|
+
$[10] = t3;
|
|
80
|
+
$[11] = t6;
|
|
81
|
+
$[12] = t7;
|
|
82
|
+
$[13] = testId;
|
|
83
|
+
$[14] = t8;
|
|
84
|
+
} else t8 = $[14];
|
|
85
|
+
return t8;
|
|
86
|
+
};
|
|
87
|
+
PointPreview.displayName = "PointPreview";
|
|
88
|
+
export { PointPreview };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import type { PointSelectorProps } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Writes the selector of a WAF rule without the point syntax: step 1 says
|
|
5
|
+
* where the value is, in a guided query bar; step 2, behind Next, says how
|
|
6
|
+
* the value should match.
|
|
7
|
+
*
|
|
8
|
+
* SDK Integration:
|
|
9
|
+
* - Loads Proton SDK on mount (~75KB brotli, ~2ms compile)
|
|
10
|
+
* - Validates points and stores canonical form
|
|
11
|
+
* - Gracefully degrades if SDK fails to load
|
|
12
|
+
*
|
|
13
|
+
* @see {@link ../../../../docs/point-format.md} Complete point grammar specification (Star notation)
|
|
14
|
+
* @see {@link ../../../../docs/tree-shape.md} What can exist under each point
|
|
15
|
+
* @see {@link ./ANALYTICS_GAPS.md} Analytics integration pattern (wrapper-level, onChange-based)
|
|
16
|
+
*/
|
|
17
|
+
export declare const PointSelector: FC<PointSelectorProps>;
|