@wallarm-org/design-system 4.8.0-rc-feat-parser.1 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/components/BulkBar/index.d.ts +5 -0
- package/dist/components/Drawer/classes.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -2
- package/dist/components/DropdownMenu/DropdownMenu.js +71 -84
- package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
- package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
- package/dist/components/NotificationCenter/NotificationCenter.d.ts +20 -0
- package/dist/components/NotificationCenter/NotificationCenter.js +65 -0
- package/dist/components/NotificationCenter/NotificationCenterBody.d.ts +18 -0
- package/dist/components/NotificationCenter/NotificationCenterBody.js +202 -0
- package/dist/components/NotificationCenter/NotificationCenterContent.d.ts +5 -0
- package/dist/components/NotificationCenter/NotificationCenterContent.js +42 -0
- package/dist/components/NotificationCenter/NotificationCenterHeader.d.ts +20 -0
- package/dist/components/NotificationCenter/NotificationCenterHeader.js +202 -0
- package/dist/components/NotificationCenter/NotificationCenterItem.d.ts +26 -0
- package/dist/components/NotificationCenter/NotificationCenterItem.js +211 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTime.d.ts +9 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTime.js +148 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTitle.d.ts +14 -0
- package/dist/components/NotificationCenter/NotificationCenterItemTitle.js +115 -0
- package/dist/components/NotificationCenter/NotificationCenterTabs.d.ts +10 -0
- package/dist/components/NotificationCenter/NotificationCenterTabs.js +77 -0
- package/dist/components/NotificationCenter/NotificationCenterTrigger.d.ts +13 -0
- package/dist/components/NotificationCenter/NotificationCenterTrigger.js +138 -0
- package/dist/components/NotificationCenter/index.d.ts +9 -0
- package/dist/components/NotificationCenter/index.js +9 -0
- package/dist/components/Overlay/Overlay.js +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +7 -5
- package/dist/components/SearchInput/SearchInput.js +119 -101
- package/dist/components/Select/SelectSearchInput.d.ts +1 -1
- package/dist/components/Table/types.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -0
- package/dist/components/Tabs/Tabs.js +30 -28
- package/dist/components/Tabs/TabsList/index.d.ts +1 -1
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/Tour/TourPositioner.d.ts +3 -0
- package/dist/components/Tour/TourPositioner.js +4 -4
- package/dist/guidelines/foundations/color.md +157 -0
- package/dist/guidelines/foundations/focus.md +122 -0
- package/dist/guidelines/foundations/layering.md +131 -0
- package/dist/guidelines/foundations/radius-elevation.md +111 -0
- package/dist/guidelines/foundations/spacing.md +117 -0
- package/dist/guidelines/foundations/typography.md +114 -0
- package/dist/guidelines/patterns/app-layout.md +1567 -0
- package/dist/guidelines/patterns/auth-page.md +668 -0
- package/dist/guidelines/patterns/confirmation-dialogs.md +605 -0
- package/dist/guidelines/patterns/create-edit-forms.md +768 -0
- package/dist/guidelines/patterns/detail-drawer.md +868 -0
- package/dist/guidelines/patterns/empty-states.md +461 -0
- package/dist/guidelines/patterns/entity-table.md +533 -0
- package/dist/guidelines/patterns/feedback-toasts.md +493 -0
- package/dist/guidelines/patterns/filtering.md +630 -0
- package/dist/guidelines/patterns/resource-list-page.md +558 -0
- package/dist/guidelines/patterns/settings-page.md +752 -0
- package/dist/guidelines/rules.md +25 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -2
- package/dist/metadata/components.json +12431 -9208
- package/dist/metadata/guidelines.json +1705 -0
- package/dist/theme/typography.css +5 -0
- package/dist/utils/formatDateTime.d.ts +6 -0
- package/dist/utils/formatDateTime.js +13 -1
- package/package.json +6 -4
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +0 -14
- package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +0 -209
- package/dist/components/Rules/PointSelector/MatchStep.d.ts +0 -15
- package/dist/components/Rules/PointSelector/MatchStep.js +0 -186
- package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +0 -16
- package/dist/components/Rules/PointSelector/MenuFooterHints.js +0 -177
- package/dist/components/Rules/PointSelector/PointPreview.d.ts +0 -10
- package/dist/components/Rules/PointSelector/PointPreview.js +0 -88
- package/dist/components/Rules/PointSelector/PointSelector.d.ts +0 -17
- package/dist/components/Rules/PointSelector/PointSelector.js +0 -937
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +0 -12
- package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +0 -173
- package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +0 -31
- package/dist/components/Rules/PointSelector/PointSelectorError.js +0 -275
- package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +0 -20
- package/dist/components/Rules/PointSelector/PointSelectorInput.js +0 -130
- package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +0 -31
- package/dist/components/Rules/PointSelector/PointSelectorMenu.js +0 -317
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +0 -8
- package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +0 -73
- package/dist/components/Rules/PointSelector/SampleRequest.d.ts +0 -14
- package/dist/components/Rules/PointSelector/SampleRequest.js +0 -116
- package/dist/components/Rules/PointSelector/StepMenu.d.ts +0 -40
- package/dist/components/Rules/PointSelector/StepMenu.js +0 -210
- package/dist/components/Rules/PointSelector/VersionWarning.d.ts +0 -26
- package/dist/components/Rules/PointSelector/VersionWarning.js +0 -231
- package/dist/components/Rules/PointSelector/WhereBar.d.ts +0 -48
- package/dist/components/Rules/PointSelector/WhereBar.js +0 -263
- package/dist/components/Rules/PointSelector/classes.d.ts +0 -28
- package/dist/components/Rules/PointSelector/classes.js +0 -22
- package/dist/components/Rules/PointSelector/index.d.ts +0 -20
- package/dist/components/Rules/PointSelector/index.js +0 -18
- package/dist/components/Rules/PointSelector/liftLayer.d.ts +0 -8
- package/dist/components/Rules/PointSelector/liftLayer.js +0 -4
- package/dist/components/Rules/PointSelector/sampleValue.d.ts +0 -6
- package/dist/components/Rules/PointSelector/sampleValue.js +0 -51
- package/dist/components/Rules/PointSelector/sdkBridge.d.ts +0 -508
- package/dist/components/Rules/PointSelector/sdkBridge.js +0 -339
- package/dist/components/Rules/PointSelector/types.d.ts +0 -304
- package/dist/components/Rules/PointSelector/types.js +0 -0
- package/dist/components/Rules/PointSelector/usePointSelector.d.ts +0 -161
- package/dist/components/Rules/PointSelector/usePointSelector.js +0 -1088
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +0 -28
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +0 -208
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +0 -23
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +0 -950
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +0 -21
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +0 -110
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +0 -20
- package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +0 -31
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +0 -23
- package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +0 -131
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +0 -17
- package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +0 -14
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +0 -6
- package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +0 -6
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +0 -24
- package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +0 -245
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +0 -15
- package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +0 -691
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +0 -19
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +0 -72
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +0 -407
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +0 -269
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +0 -25
- package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +0 -99
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +0 -118
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +0 -446
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +0 -14
- package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +0 -266
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +0 -35
- package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +0 -57
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +0 -15
- package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +0 -10
- package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +0 -67
- package/dist/components/Rules/RuleBuilder/RuleBuilder.js +0 -366
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +0 -32
- package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +0 -420
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +0 -446
- package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +0 -7
- package/dist/components/Rules/RuleBuilder/Summary/index.js +0 -2
- package/dist/components/Rules/RuleBuilder/classes.d.ts +0 -19
- package/dist/components/Rules/RuleBuilder/classes.js +0 -18
- package/dist/components/Rules/RuleBuilder/index.d.ts +0 -55
- package/dist/components/Rules/RuleBuilder/index.js +0 -11
- package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +0 -31
- package/dist/components/Rules/RuleBuilder/models/actionModel.js +0 -276
- package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +0 -95
- package/dist/components/Rules/RuleBuilder/models/conditionModel.js +0 -418
- package/dist/components/Rules/RuleBuilder/models/index.d.ts +0 -3
- package/dist/components/Rules/RuleBuilder/models/index.js +0 -3
- package/dist/components/Rules/RuleBuilder/models/validation.d.ts +0 -176
- package/dist/components/Rules/RuleBuilder/models/validation.js +0 -242
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +0 -27
- package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +0 -92
- package/dist/components/Rules/RuleBuilder/shared/index.d.ts +0 -1
- package/dist/components/Rules/RuleBuilder/shared/index.js +0 -1
- package/dist/components/Rules/RuleBuilder/types.d.ts +0 -384
- package/dist/components/Rules/RuleBuilder/types.js +0 -0
- package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +0 -65
- package/dist/components/Rules/RuleBuilder/utils/constants.js +0 -356
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +0 -48
- package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +0 -42
- package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +0 -92
- package/dist/components/Rules/RuleBuilder/utils/helpers.js +0 -54
- package/dist/components/Rules/RuleBuilder/utils/index.d.ts +0 -2
- package/dist/components/Rules/RuleBuilder/utils/index.js +0 -2
|
@@ -32,6 +32,11 @@
|
|
|
32
32
|
--text-sm: 14px;
|
|
33
33
|
--text-sm--line-height: 20px;
|
|
34
34
|
|
|
35
|
+
/* Text size="md" and CardContent's step. Same metrics as sm: both render inside
|
|
36
|
+
Card's text-sm today, so the alias keeps them unchanged where they are used. */
|
|
37
|
+
--text-md: 14px;
|
|
38
|
+
--text-md--line-height: 20px;
|
|
39
|
+
|
|
35
40
|
--text-base: 16px;
|
|
36
41
|
--text-base--line-height: 24px;
|
|
37
42
|
|
|
@@ -29,6 +29,12 @@ export interface DateTimeFormatOptions {
|
|
|
29
29
|
* Future dates are treated as "Just now" (clock skew tolerance).
|
|
30
30
|
*/
|
|
31
31
|
export declare const formatRelativeTime: (date: Date, now?: Date, options?: DateTimeFormatOptions) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Compact relative time for space-constrained lists (the notification inbox):
|
|
34
|
+
* "now", "3m", "2h", "5d", "1w", then the short date ("11 Feb" / "11 Feb, 2025").
|
|
35
|
+
* No "ago" suffix. Future dates read "now" (clock skew tolerance).
|
|
36
|
+
*/
|
|
37
|
+
export declare const formatCompactRelativeTime: (date: Date, now?: Date, options?: DateTimeFormatOptions) => string;
|
|
32
38
|
/**
|
|
33
39
|
* Format a date as absolute time for tooltips.
|
|
34
40
|
*
|
|
@@ -25,6 +25,18 @@ const formatRelativeTime = (date, now = new Date(), options = {})=>{
|
|
|
25
25
|
if (differenceInYears(now, date) < 1) return format(date, dayMonth(options.order));
|
|
26
26
|
return format(date, dayMonthYear(options.order));
|
|
27
27
|
};
|
|
28
|
+
const formatCompactRelativeTime = (date, now = new Date(), options = {})=>{
|
|
29
|
+
if (!isValid(date)) return '—';
|
|
30
|
+
const minutes = differenceInMinutes(now, date);
|
|
31
|
+
if (minutes < 1) return 'now';
|
|
32
|
+
if (minutes < 60) return `${minutes}m`;
|
|
33
|
+
const hours = differenceInHours(now, date);
|
|
34
|
+
if (hours < 24) return `${hours}h`;
|
|
35
|
+
const days = differenceInDays(now, date);
|
|
36
|
+
if (days < 7) return `${days}d`;
|
|
37
|
+
if (days < 28) return `${differenceInWeeks(now, date)}w`;
|
|
38
|
+
return formatAbsoluteDate(date, now, options);
|
|
39
|
+
};
|
|
28
40
|
const formatAbsoluteTime = (date, options = {})=>{
|
|
29
41
|
if (!isValid(date)) return '—';
|
|
30
42
|
const { showSeconds = true } = options;
|
|
@@ -49,4 +61,4 @@ const formatTimezone = (date)=>{
|
|
|
49
61
|
const minutes = Math.abs(offset) % 60;
|
|
50
62
|
return 0 === minutes ? `GMT${sign}${hours}` : `GMT${sign}${hours}:${String(minutes).padStart(2, '0')}`;
|
|
51
63
|
};
|
|
52
|
-
export { formatAbsoluteDate, formatAbsoluteTime, formatRelativeTime, formatTimeOnly, formatTimezone };
|
|
64
|
+
export { formatAbsoluteDate, formatAbsoluteTime, formatCompactRelativeTime, formatRelativeTime, formatTimeOnly, formatTimezone };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wallarm-org/design-system",
|
|
3
|
-
"version": "4.8.0
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "Core design system library with React components and Storybook documentation",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -40,6 +40,11 @@
|
|
|
40
40
|
"require": "./dist/metadata/components.json",
|
|
41
41
|
"default": "./dist/metadata/components.json"
|
|
42
42
|
},
|
|
43
|
+
"./guidelines": {
|
|
44
|
+
"import": "./dist/metadata/guidelines.json",
|
|
45
|
+
"require": "./dist/metadata/guidelines.json",
|
|
46
|
+
"default": "./dist/metadata/guidelines.json"
|
|
47
|
+
},
|
|
43
48
|
"./utils/*": {
|
|
44
49
|
"types": "./dist/utils/*.d.ts",
|
|
45
50
|
"import": "./dist/utils/*.js",
|
|
@@ -90,7 +95,6 @@
|
|
|
90
95
|
"code-connect:publish": "node --env-file-if-exists=../../.env.local node_modules/@figma/code-connect/bin/figma connect publish --exit-on-unreadable-files"
|
|
91
96
|
},
|
|
92
97
|
"devDependencies": {
|
|
93
|
-
"@axe-core/playwright": "4.14.0",
|
|
94
98
|
"@babel/core": "7.29.7",
|
|
95
99
|
"@babel/preset-typescript": "7.29.7",
|
|
96
100
|
"@figma/code-connect": "2.0.2",
|
|
@@ -120,10 +124,8 @@
|
|
|
120
124
|
"@wallarm-org/publish-scripts": "workspace:*",
|
|
121
125
|
"@wallarm-org/rsbuild-config": "workspace:*",
|
|
122
126
|
"@wallarm-org/rstest-config": "workspace:*",
|
|
123
|
-
"@wallarm-org/rules-lib": "workspace:*",
|
|
124
127
|
"@wallarm-org/tailwind-config": "workspace:*",
|
|
125
128
|
"@wallarm-org/typescript-config": "workspace:*",
|
|
126
|
-
"axe-playwright": "2.2.2",
|
|
127
129
|
"babel-plugin-react-compiler": "1.0.0",
|
|
128
130
|
"glob": "13.0.6",
|
|
129
131
|
"jsdom": "catalog:",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
export interface KeyboardShortcutsDialogProps {
|
|
3
|
-
/** Whether dialog is open */
|
|
4
|
-
open: boolean;
|
|
5
|
-
/** Called when dialog should close */
|
|
6
|
-
onOpenChange: (open: boolean) => void;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* KeyboardShortcutsDialog Component
|
|
10
|
-
*
|
|
11
|
-
* Modal showing all available keyboard shortcuts.
|
|
12
|
-
* Triggered by pressing '?' key.
|
|
13
|
-
*/
|
|
14
|
-
export declare const KeyboardShortcutsDialog: FC<KeyboardShortcutsDialogProps>;
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react/compiler-runtime";
|
|
3
|
-
import { useTestId } from "../../../utils/testId.js";
|
|
4
|
-
import { Dialog, DialogBody, DialogClose, DialogContent, DialogHeader, DialogPositioner, DialogTitle } from "../../Dialog/index.js";
|
|
5
|
-
import { Kbd } from "../../Kbd/index.js";
|
|
6
|
-
import { Text } from "../../Text/index.js";
|
|
7
|
-
const SHORTCUTS = [
|
|
8
|
-
{
|
|
9
|
-
title: "Navigation",
|
|
10
|
-
shortcuts: [
|
|
11
|
-
{
|
|
12
|
-
keys: [
|
|
13
|
-
"↑",
|
|
14
|
-
"↓"
|
|
15
|
-
],
|
|
16
|
-
description: "Navigate menu items (focus stays in input)"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
keys: [
|
|
20
|
-
"Tab"
|
|
21
|
-
],
|
|
22
|
-
description: "Move to Next button (closes menu)"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
keys: [
|
|
26
|
-
"↵"
|
|
27
|
-
],
|
|
28
|
-
description: "Select highlighted item"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
keys: [
|
|
32
|
-
"Esc"
|
|
33
|
-
],
|
|
34
|
-
description: "Close menu (press again to blur input)"
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
title: "Selection",
|
|
40
|
-
shortcuts: [
|
|
41
|
-
{
|
|
42
|
-
keys: [
|
|
43
|
-
"1",
|
|
44
|
-
"2",
|
|
45
|
-
"…"
|
|
46
|
-
],
|
|
47
|
-
description: 'Choose item by number (type 1-2 digits, e.g. "12" for option 12)'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
keys: [
|
|
51
|
-
"Space"
|
|
52
|
-
],
|
|
53
|
-
description: "Toggle checkbox (multi-select step only)"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
keys: [
|
|
57
|
-
"↵"
|
|
58
|
-
],
|
|
59
|
-
description: "Apply selected items (multi-select)"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
keys: [
|
|
63
|
-
"Ctrl",
|
|
64
|
-
"↵"
|
|
65
|
-
],
|
|
66
|
-
description: "Jump to condition step"
|
|
67
|
-
}
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
title: "Editing",
|
|
72
|
-
shortcuts: [
|
|
73
|
-
{
|
|
74
|
-
keys: [
|
|
75
|
-
"Backspace"
|
|
76
|
-
],
|
|
77
|
-
description: "Remove last step (when input empty)"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
keys: [
|
|
81
|
-
"⌥C"
|
|
82
|
-
],
|
|
83
|
-
description: "Toggle ignore case (name/value input)"
|
|
84
|
-
}
|
|
85
|
-
]
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
title: "Advanced",
|
|
89
|
-
shortcuts: [
|
|
90
|
-
{
|
|
91
|
-
keys: [
|
|
92
|
-
"?"
|
|
93
|
-
],
|
|
94
|
-
description: "Show this keyboard shortcuts dialog"
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
keys: [
|
|
98
|
-
"Esc"
|
|
99
|
-
],
|
|
100
|
-
description: "Close dialog"
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
];
|
|
105
|
-
const KeyboardShortcutsDialog = (t0)=>{
|
|
106
|
-
const $ = c(8);
|
|
107
|
-
const { open, onOpenChange } = t0;
|
|
108
|
-
const testId = useTestId("keyboard-shortcuts");
|
|
109
|
-
let t1;
|
|
110
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
111
|
-
t1 = /*#__PURE__*/ jsxs(DialogHeader, {
|
|
112
|
-
children: [
|
|
113
|
-
/*#__PURE__*/ jsx(DialogTitle, {
|
|
114
|
-
children: "Keyboard Shortcuts"
|
|
115
|
-
}),
|
|
116
|
-
/*#__PURE__*/ jsx(DialogClose, {})
|
|
117
|
-
]
|
|
118
|
-
});
|
|
119
|
-
$[0] = t1;
|
|
120
|
-
} else t1 = $[0];
|
|
121
|
-
let t2;
|
|
122
|
-
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
123
|
-
t2 = /*#__PURE__*/ jsx(DialogBody, {
|
|
124
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
125
|
-
className: "flex flex-col gap-24",
|
|
126
|
-
children: SHORTCUTS.map(_temp2)
|
|
127
|
-
})
|
|
128
|
-
});
|
|
129
|
-
$[1] = t2;
|
|
130
|
-
} else t2 = $[1];
|
|
131
|
-
let t3;
|
|
132
|
-
if ($[2] !== testId) {
|
|
133
|
-
t3 = /*#__PURE__*/ jsx(DialogPositioner, {
|
|
134
|
-
children: /*#__PURE__*/ jsxs(DialogContent, {
|
|
135
|
-
"data-slot": "keyboard-shortcuts-dialog",
|
|
136
|
-
"data-testid": testId,
|
|
137
|
-
children: [
|
|
138
|
-
t1,
|
|
139
|
-
t2
|
|
140
|
-
]
|
|
141
|
-
})
|
|
142
|
-
});
|
|
143
|
-
$[2] = testId;
|
|
144
|
-
$[3] = t3;
|
|
145
|
-
} else t3 = $[3];
|
|
146
|
-
let t4;
|
|
147
|
-
if ($[4] !== onOpenChange || $[5] !== open || $[6] !== t3) {
|
|
148
|
-
t4 = /*#__PURE__*/ jsx(Dialog, {
|
|
149
|
-
open: open,
|
|
150
|
-
onOpenChange: onOpenChange,
|
|
151
|
-
children: t3
|
|
152
|
-
});
|
|
153
|
-
$[4] = onOpenChange;
|
|
154
|
-
$[5] = open;
|
|
155
|
-
$[6] = t3;
|
|
156
|
-
$[7] = t4;
|
|
157
|
-
} else t4 = $[7];
|
|
158
|
-
return t4;
|
|
159
|
-
};
|
|
160
|
-
KeyboardShortcutsDialog.displayName = "KeyboardShortcutsDialog";
|
|
161
|
-
function _temp(shortcut) {
|
|
162
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
163
|
-
className: "flex items-center justify-between gap-16",
|
|
164
|
-
children: [
|
|
165
|
-
/*#__PURE__*/ jsx("div", {
|
|
166
|
-
className: "flex-1",
|
|
167
|
-
children: /*#__PURE__*/ jsx(Text, {
|
|
168
|
-
size: "sm",
|
|
169
|
-
children: shortcut.description
|
|
170
|
-
})
|
|
171
|
-
}),
|
|
172
|
-
/*#__PURE__*/ jsx("div", {
|
|
173
|
-
className: "flex items-center gap-4",
|
|
174
|
-
children: shortcut.keys.map((key, j)=>/*#__PURE__*/ jsxs("span", {
|
|
175
|
-
className: "contents",
|
|
176
|
-
children: [
|
|
177
|
-
/*#__PURE__*/ jsx(Kbd, {
|
|
178
|
-
size: "small",
|
|
179
|
-
children: key
|
|
180
|
-
}),
|
|
181
|
-
j < shortcut.keys.length - 1 && /*#__PURE__*/ jsx(Text, {
|
|
182
|
-
size: "xs",
|
|
183
|
-
color: "secondary",
|
|
184
|
-
children: "+"
|
|
185
|
-
})
|
|
186
|
-
]
|
|
187
|
-
}, `${shortcut.description}-${key}`))
|
|
188
|
-
})
|
|
189
|
-
]
|
|
190
|
-
}, shortcut.description);
|
|
191
|
-
}
|
|
192
|
-
function _temp2(section) {
|
|
193
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
194
|
-
className: "flex flex-col gap-12",
|
|
195
|
-
children: [
|
|
196
|
-
/*#__PURE__*/ jsx(Text, {
|
|
197
|
-
size: "sm",
|
|
198
|
-
weight: "bold",
|
|
199
|
-
color: "secondary",
|
|
200
|
-
children: section.title
|
|
201
|
-
}),
|
|
202
|
-
/*#__PURE__*/ jsx("div", {
|
|
203
|
-
className: "flex flex-col gap-8",
|
|
204
|
-
children: section.shortcuts.map(_temp)
|
|
205
|
-
})
|
|
206
|
-
]
|
|
207
|
-
}, section.title);
|
|
208
|
-
}
|
|
209
|
-
export { KeyboardShortcutsDialog };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { type FC, type RefObject } from 'react';
|
|
2
|
-
import { type ConditionType } from '@wallarm-org/rules-lib/ui';
|
|
3
|
-
import type { PointSelectorModel } from './usePointSelector.js';
|
|
4
|
-
interface Props {
|
|
5
|
-
model: PointSelectorModel;
|
|
6
|
-
conditionInputRef: RefObject<HTMLInputElement | null>;
|
|
7
|
-
valueInputRef: RefObject<HTMLInputElement | null>;
|
|
8
|
-
conditionChipRef: RefObject<HTMLButtonElement | null>;
|
|
9
|
-
condition: ConditionType | null;
|
|
10
|
-
value: string;
|
|
11
|
-
ignoreCase: boolean;
|
|
12
|
-
}
|
|
13
|
-
/** Step 2: a numbered list of conditions, then the value. */
|
|
14
|
-
export declare const MatchStep: FC<Props>;
|
|
15
|
-
export {};
|
|
@@ -1,186 +0,0 @@
|
|
|
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 };
|
|
@@ -1,16 +0,0 @@
|
|
|
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>;
|