@wallarm-org/design-system 4.8.0-rc-feat-parser.1 → 4.8.0-rc-fix-claude-code.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 (176) hide show
  1. package/README.md +4 -2
  2. package/dist/components/BulkBar/index.d.ts +5 -0
  3. package/dist/components/Drawer/classes.js +1 -1
  4. package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -2
  5. package/dist/components/DropdownMenu/DropdownMenu.js +71 -84
  6. package/dist/components/DropdownMenu/DropdownMenuItemDescription.js +1 -1
  7. package/dist/components/FilterInput/hooks/useFilterInputAutocomplete/useFilterInputAutocomplete.js +1 -1
  8. package/dist/components/NotificationCenter/NotificationCenter.d.ts +20 -0
  9. package/dist/components/NotificationCenter/NotificationCenter.js +65 -0
  10. package/dist/components/NotificationCenter/NotificationCenterBody.d.ts +18 -0
  11. package/dist/components/NotificationCenter/NotificationCenterBody.js +202 -0
  12. package/dist/components/NotificationCenter/NotificationCenterContent.d.ts +5 -0
  13. package/dist/components/NotificationCenter/NotificationCenterContent.js +42 -0
  14. package/dist/components/NotificationCenter/NotificationCenterHeader.d.ts +20 -0
  15. package/dist/components/NotificationCenter/NotificationCenterHeader.js +202 -0
  16. package/dist/components/NotificationCenter/NotificationCenterItem.d.ts +26 -0
  17. package/dist/components/NotificationCenter/NotificationCenterItem.js +211 -0
  18. package/dist/components/NotificationCenter/NotificationCenterItemTime.d.ts +9 -0
  19. package/dist/components/NotificationCenter/NotificationCenterItemTime.js +148 -0
  20. package/dist/components/NotificationCenter/NotificationCenterItemTitle.d.ts +14 -0
  21. package/dist/components/NotificationCenter/NotificationCenterItemTitle.js +115 -0
  22. package/dist/components/NotificationCenter/NotificationCenterTabs.d.ts +10 -0
  23. package/dist/components/NotificationCenter/NotificationCenterTabs.js +77 -0
  24. package/dist/components/NotificationCenter/NotificationCenterTrigger.d.ts +13 -0
  25. package/dist/components/NotificationCenter/NotificationCenterTrigger.js +138 -0
  26. package/dist/components/NotificationCenter/index.d.ts +9 -0
  27. package/dist/components/NotificationCenter/index.js +9 -0
  28. package/dist/components/Overlay/Overlay.js +1 -1
  29. package/dist/components/SearchInput/SearchInput.d.ts +7 -5
  30. package/dist/components/SearchInput/SearchInput.js +119 -101
  31. package/dist/components/Select/SelectSearchInput.d.ts +1 -1
  32. package/dist/components/Table/types.d.ts +1 -1
  33. package/dist/components/Tabs/Tabs.d.ts +1 -0
  34. package/dist/components/Tabs/Tabs.js +30 -28
  35. package/dist/components/Tabs/TabsList/index.d.ts +1 -1
  36. package/dist/components/Tabs/index.d.ts +2 -2
  37. package/dist/components/Tour/TourPositioner.d.ts +3 -0
  38. package/dist/components/Tour/TourPositioner.js +4 -4
  39. package/dist/guidelines/foundations/color.md +157 -0
  40. package/dist/guidelines/foundations/focus.md +122 -0
  41. package/dist/guidelines/foundations/layering.md +131 -0
  42. package/dist/guidelines/foundations/radius-elevation.md +111 -0
  43. package/dist/guidelines/foundations/spacing.md +117 -0
  44. package/dist/guidelines/foundations/typography.md +114 -0
  45. package/dist/guidelines/patterns/app-layout.md +1567 -0
  46. package/dist/guidelines/patterns/auth-page.md +668 -0
  47. package/dist/guidelines/patterns/confirmation-dialogs.md +605 -0
  48. package/dist/guidelines/patterns/create-edit-forms.md +768 -0
  49. package/dist/guidelines/patterns/detail-drawer.md +868 -0
  50. package/dist/guidelines/patterns/empty-states.md +461 -0
  51. package/dist/guidelines/patterns/entity-table.md +533 -0
  52. package/dist/guidelines/patterns/feedback-toasts.md +493 -0
  53. package/dist/guidelines/patterns/filtering.md +630 -0
  54. package/dist/guidelines/patterns/resource-list-page.md +558 -0
  55. package/dist/guidelines/patterns/settings-page.md +752 -0
  56. package/dist/guidelines/rules.md +25 -0
  57. package/dist/index.d.ts +2 -3
  58. package/dist/index.js +1 -2
  59. package/dist/metadata/components.json +12431 -9208
  60. package/dist/metadata/guidelines.json +1705 -0
  61. package/dist/theme/typography.css +5 -0
  62. package/dist/utils/formatDateTime.d.ts +6 -0
  63. package/dist/utils/formatDateTime.js +13 -1
  64. package/package.json +6 -4
  65. package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.d.ts +0 -14
  66. package/dist/components/Rules/PointSelector/KeyboardShortcutsDialog.js +0 -209
  67. package/dist/components/Rules/PointSelector/MatchStep.d.ts +0 -15
  68. package/dist/components/Rules/PointSelector/MatchStep.js +0 -186
  69. package/dist/components/Rules/PointSelector/MenuFooterHints.d.ts +0 -16
  70. package/dist/components/Rules/PointSelector/MenuFooterHints.js +0 -177
  71. package/dist/components/Rules/PointSelector/PointPreview.d.ts +0 -10
  72. package/dist/components/Rules/PointSelector/PointPreview.js +0 -88
  73. package/dist/components/Rules/PointSelector/PointSelector.d.ts +0 -17
  74. package/dist/components/Rules/PointSelector/PointSelector.js +0 -937
  75. package/dist/components/Rules/PointSelector/PointSelectorEmptyState.d.ts +0 -12
  76. package/dist/components/Rules/PointSelector/PointSelectorEmptyState.js +0 -173
  77. package/dist/components/Rules/PointSelector/PointSelectorError.d.ts +0 -31
  78. package/dist/components/Rules/PointSelector/PointSelectorError.js +0 -275
  79. package/dist/components/Rules/PointSelector/PointSelectorInput.d.ts +0 -20
  80. package/dist/components/Rules/PointSelector/PointSelectorInput.js +0 -130
  81. package/dist/components/Rules/PointSelector/PointSelectorMenu.d.ts +0 -31
  82. package/dist/components/Rules/PointSelector/PointSelectorMenu.js +0 -317
  83. package/dist/components/Rules/PointSelector/PointSelectorSkeleton.d.ts +0 -8
  84. package/dist/components/Rules/PointSelector/PointSelectorSkeleton.js +0 -73
  85. package/dist/components/Rules/PointSelector/SampleRequest.d.ts +0 -14
  86. package/dist/components/Rules/PointSelector/SampleRequest.js +0 -116
  87. package/dist/components/Rules/PointSelector/StepMenu.d.ts +0 -40
  88. package/dist/components/Rules/PointSelector/StepMenu.js +0 -210
  89. package/dist/components/Rules/PointSelector/VersionWarning.d.ts +0 -26
  90. package/dist/components/Rules/PointSelector/VersionWarning.js +0 -231
  91. package/dist/components/Rules/PointSelector/WhereBar.d.ts +0 -48
  92. package/dist/components/Rules/PointSelector/WhereBar.js +0 -263
  93. package/dist/components/Rules/PointSelector/classes.d.ts +0 -28
  94. package/dist/components/Rules/PointSelector/classes.js +0 -22
  95. package/dist/components/Rules/PointSelector/index.d.ts +0 -20
  96. package/dist/components/Rules/PointSelector/index.js +0 -18
  97. package/dist/components/Rules/PointSelector/liftLayer.d.ts +0 -8
  98. package/dist/components/Rules/PointSelector/liftLayer.js +0 -4
  99. package/dist/components/Rules/PointSelector/sampleValue.d.ts +0 -6
  100. package/dist/components/Rules/PointSelector/sampleValue.js +0 -51
  101. package/dist/components/Rules/PointSelector/sdkBridge.d.ts +0 -508
  102. package/dist/components/Rules/PointSelector/sdkBridge.js +0 -339
  103. package/dist/components/Rules/PointSelector/types.d.ts +0 -304
  104. package/dist/components/Rules/PointSelector/types.js +0 -0
  105. package/dist/components/Rules/PointSelector/usePointSelector.d.ts +0 -161
  106. package/dist/components/Rules/PointSelector/usePointSelector.js +0 -1088
  107. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.d.ts +0 -28
  108. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionEditor.js +0 -208
  109. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.d.ts +0 -23
  110. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionFields.js +0 -950
  111. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.d.ts +0 -21
  112. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTargetPicker.js +0 -110
  113. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.d.ts +0 -20
  114. package/dist/components/Rules/RuleBuilder/ActionEditor/ActionTypeSelect.js +0 -31
  115. package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.d.ts +0 -23
  116. package/dist/components/Rules/RuleBuilder/ActionEditor/AttackTypeField.js +0 -131
  117. package/dist/components/Rules/RuleBuilder/ActionEditor/classes.d.ts +0 -17
  118. package/dist/components/Rules/RuleBuilder/ActionEditor/classes.js +0 -14
  119. package/dist/components/Rules/RuleBuilder/ActionEditor/index.d.ts +0 -6
  120. package/dist/components/Rules/RuleBuilder/ActionEditor/index.js +0 -6
  121. package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.d.ts +0 -24
  122. package/dist/components/Rules/RuleBuilder/ConditionTree/AddConditionMenu.js +0 -245
  123. package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.d.ts +0 -15
  124. package/dist/components/Rules/RuleBuilder/ConditionTree/AttackCondition.js +0 -691
  125. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.d.ts +0 -19
  126. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionCard.js +0 -72
  127. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.d.ts +0 -27
  128. package/dist/components/Rules/RuleBuilder/ConditionTree/ConditionTree.js +0 -407
  129. package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.d.ts +0 -14
  130. package/dist/components/Rules/RuleBuilder/ConditionTree/FieldCondition.js +0 -269
  131. package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.d.ts +0 -25
  132. package/dist/components/Rules/RuleBuilder/ConditionTree/GroupCondition.js +0 -99
  133. package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.d.ts +0 -14
  134. package/dist/components/Rules/RuleBuilder/ConditionTree/SampleCondition.js +0 -118
  135. package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.d.ts +0 -14
  136. package/dist/components/Rules/RuleBuilder/ConditionTree/SignalCondition.js +0 -446
  137. package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.d.ts +0 -14
  138. package/dist/components/Rules/RuleBuilder/ConditionTree/TagCondition.js +0 -266
  139. package/dist/components/Rules/RuleBuilder/ConditionTree/classes.d.ts +0 -35
  140. package/dist/components/Rules/RuleBuilder/ConditionTree/classes.js +0 -57
  141. package/dist/components/Rules/RuleBuilder/ConditionTree/index.d.ts +0 -15
  142. package/dist/components/Rules/RuleBuilder/ConditionTree/index.js +0 -10
  143. package/dist/components/Rules/RuleBuilder/RuleBuilder.d.ts +0 -67
  144. package/dist/components/Rules/RuleBuilder/RuleBuilder.js +0 -366
  145. package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.d.ts +0 -32
  146. package/dist/components/Rules/RuleBuilder/Summary/ActionSummary.js +0 -420
  147. package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.d.ts +0 -27
  148. package/dist/components/Rules/RuleBuilder/Summary/ConditionSummary.js +0 -446
  149. package/dist/components/Rules/RuleBuilder/Summary/index.d.ts +0 -7
  150. package/dist/components/Rules/RuleBuilder/Summary/index.js +0 -2
  151. package/dist/components/Rules/RuleBuilder/classes.d.ts +0 -19
  152. package/dist/components/Rules/RuleBuilder/classes.js +0 -18
  153. package/dist/components/Rules/RuleBuilder/index.d.ts +0 -55
  154. package/dist/components/Rules/RuleBuilder/index.js +0 -11
  155. package/dist/components/Rules/RuleBuilder/models/actionModel.d.ts +0 -31
  156. package/dist/components/Rules/RuleBuilder/models/actionModel.js +0 -276
  157. package/dist/components/Rules/RuleBuilder/models/conditionModel.d.ts +0 -95
  158. package/dist/components/Rules/RuleBuilder/models/conditionModel.js +0 -418
  159. package/dist/components/Rules/RuleBuilder/models/index.d.ts +0 -3
  160. package/dist/components/Rules/RuleBuilder/models/index.js +0 -3
  161. package/dist/components/Rules/RuleBuilder/models/validation.d.ts +0 -176
  162. package/dist/components/Rules/RuleBuilder/models/validation.js +0 -242
  163. package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.d.ts +0 -27
  164. package/dist/components/Rules/RuleBuilder/shared/ChoiceSelect.js +0 -92
  165. package/dist/components/Rules/RuleBuilder/shared/index.d.ts +0 -1
  166. package/dist/components/Rules/RuleBuilder/shared/index.js +0 -1
  167. package/dist/components/Rules/RuleBuilder/types.d.ts +0 -384
  168. package/dist/components/Rules/RuleBuilder/types.js +0 -0
  169. package/dist/components/Rules/RuleBuilder/utils/constants.d.ts +0 -65
  170. package/dist/components/Rules/RuleBuilder/utils/constants.js +0 -356
  171. package/dist/components/Rules/RuleBuilder/utils/extractBindings.d.ts +0 -48
  172. package/dist/components/Rules/RuleBuilder/utils/extractBindings.js +0 -42
  173. package/dist/components/Rules/RuleBuilder/utils/helpers.d.ts +0 -92
  174. package/dist/components/Rules/RuleBuilder/utils/helpers.js +0 -54
  175. package/dist/components/Rules/RuleBuilder/utils/index.d.ts +0 -2
  176. 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-rc-feat-parser.1",
3
+ "version": "4.8.0-rc-fix-claude-code.2",
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>;