orcs-design-system 3.3.74 → 3.3.76
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/es/components/Avatar/index.js +2 -1
- package/es/components/CodeBlock/CodeBlock.stories.js +475 -0
- package/es/components/CodeBlock/CodeBlock.stories.test.js +92 -0
- package/es/components/CodeBlock/CodeBlock.test.js +325 -0
- package/es/components/CodeBlock/index.js +308 -0
- package/es/components/Icon/index.js +67 -2
- package/es/components/Notification/index.js +3 -18
- package/es/components/Popover/index.js +10 -4
- package/es/components/SideNavV2/NavItem.js +43 -15
- package/es/components/SideNavV2/PanelLink.stories.js +90 -0
- package/es/components/SideNavV2/SideNavV2.stories.js +172 -86
- package/es/components/SideNavV2/components/BaseSection.js +4 -4
- package/es/components/SideNavV2/components/FullWidthPopoverLink.js +134 -0
- package/es/components/SideNavV2/components/PanelLink.js +29 -0
- package/es/components/SideNavV2/index.js +1 -0
- package/es/components/SideNavV2/sections/SideNavCurrentViewSection.js +2 -2
- package/es/components/SideNavV2/sections/SideNavPinnedSection.js +43 -17
- package/es/components/SideNavV2/sections/SideNavTeamsSection.js +11 -1
- package/es/components/SideNavV2/styles/SideNavV2.styles.js +5 -2
- package/es/components/StatusDot/index.js +18 -3
- package/es/components/Typography/index.js +40 -9
- package/es/components.test.js +2 -0
- package/es/index.js +2 -1
- package/package.json +2 -1
|
@@ -637,9 +637,10 @@ const Avatar = _ref0 => {
|
|
|
637
637
|
text: localTime,
|
|
638
638
|
children: /*#__PURE__*/_jsx(StatusDot, {
|
|
639
639
|
icon: true,
|
|
640
|
+
variant: "secondary",
|
|
640
641
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
641
642
|
icon: ["fas", "clock"],
|
|
642
|
-
color:
|
|
643
|
+
color: "white",
|
|
643
644
|
transform: "grow-2"
|
|
644
645
|
})
|
|
645
646
|
})
|
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import CodeBlock from "./index";
|
|
3
|
+
import { H2, P } from "../Typography";
|
|
4
|
+
import Box from "../Box";
|
|
5
|
+
import Spacer from "../Spacer";
|
|
6
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
export default {
|
|
8
|
+
title: "Components/CodeBlock",
|
|
9
|
+
component: CodeBlock,
|
|
10
|
+
decorators: [Story => /*#__PURE__*/_jsx(Box, {
|
|
11
|
+
p: "r",
|
|
12
|
+
children: /*#__PURE__*/_jsx(Story, {})
|
|
13
|
+
})]
|
|
14
|
+
};
|
|
15
|
+
const sampleJSON = {
|
|
16
|
+
name: "TeamForm Configuration",
|
|
17
|
+
version: "2.0",
|
|
18
|
+
features: {
|
|
19
|
+
allocation: true,
|
|
20
|
+
integrations: ["jira", "slack", "azure"],
|
|
21
|
+
limits: {
|
|
22
|
+
maxUsers: 1000,
|
|
23
|
+
maxProjects: 50
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
metadata: {
|
|
27
|
+
created: "2025-01-15",
|
|
28
|
+
lastModified: "2025-01-20"
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const sampleJavaScript = `function calculateAllocation(person, project, fte) {
|
|
32
|
+
if (!person || !project) {
|
|
33
|
+
throw new Error("Person and project are required");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const allocation = {
|
|
37
|
+
personId: person.id,
|
|
38
|
+
projectId: project.id,
|
|
39
|
+
fte: Math.min(Math.max(fte, 0), 1),
|
|
40
|
+
startDate: new Date(),
|
|
41
|
+
status: "active"
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
return allocation;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default calculateAllocation;`;
|
|
48
|
+
const sampleTypeScript = `interface Person {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
email: string;
|
|
52
|
+
fte: number;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
type AllocationStatus = "active" | "pending" | "completed";
|
|
56
|
+
|
|
57
|
+
class AllocationManager {
|
|
58
|
+
private allocations: Map<string, Person>;
|
|
59
|
+
|
|
60
|
+
constructor() {
|
|
61
|
+
this.allocations = new Map();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
addAllocation(person: Person): void {
|
|
65
|
+
this.allocations.set(person.id, person);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
getTotalFte(): number {
|
|
69
|
+
return Array.from(this.allocations.values())
|
|
70
|
+
.reduce((sum, person) => sum + person.fte, 0);
|
|
71
|
+
}
|
|
72
|
+
}`;
|
|
73
|
+
const sampleSQL = `SELECT
|
|
74
|
+
p.id,
|
|
75
|
+
p.name,
|
|
76
|
+
p.email,
|
|
77
|
+
COUNT(a.id) as allocation_count,
|
|
78
|
+
SUM(a.fte) as total_fte
|
|
79
|
+
FROM persons p
|
|
80
|
+
LEFT JOIN allocations a ON p.id = a.person_id
|
|
81
|
+
WHERE a.status = 'active'
|
|
82
|
+
AND a.start_date >= '2025-01-01'
|
|
83
|
+
GROUP BY p.id, p.name, p.email
|
|
84
|
+
HAVING SUM(a.fte) > 0.5
|
|
85
|
+
ORDER BY total_fte DESC;`;
|
|
86
|
+
const sampleBash = `#!/bin/bash
|
|
87
|
+
|
|
88
|
+
# Deploy script for TeamForm
|
|
89
|
+
set -e
|
|
90
|
+
|
|
91
|
+
echo "Starting deployment..."
|
|
92
|
+
|
|
93
|
+
# Build the application
|
|
94
|
+
npm run build
|
|
95
|
+
|
|
96
|
+
# Run tests
|
|
97
|
+
npm test
|
|
98
|
+
|
|
99
|
+
# Deploy to production
|
|
100
|
+
if [ "$ENV" = "production" ]; then
|
|
101
|
+
echo "Deploying to production..."
|
|
102
|
+
npm run deploy:prod
|
|
103
|
+
else
|
|
104
|
+
echo "Deploying to staging..."
|
|
105
|
+
npm run deploy:staging
|
|
106
|
+
fi
|
|
107
|
+
|
|
108
|
+
echo "Deployment complete!"`;
|
|
109
|
+
const samplePython = `class AllocationCalculator:
|
|
110
|
+
def __init__(self, max_fte=1.0):
|
|
111
|
+
self.max_fte = max_fte
|
|
112
|
+
self.allocations = []
|
|
113
|
+
|
|
114
|
+
def add_allocation(self, person_id, project_id, fte):
|
|
115
|
+
"""Add a new allocation for a person to a project."""
|
|
116
|
+
if fte > self.max_fte:
|
|
117
|
+
raise ValueError(f"FTE cannot exceed {self.max_fte}")
|
|
118
|
+
|
|
119
|
+
allocation = {
|
|
120
|
+
'person_id': person_id,
|
|
121
|
+
'project_id': project_id,
|
|
122
|
+
'fte': fte,
|
|
123
|
+
'status': 'active'
|
|
124
|
+
}
|
|
125
|
+
self.allocations.append(allocation)
|
|
126
|
+
return allocation
|
|
127
|
+
|
|
128
|
+
def get_total_fte(self, person_id):
|
|
129
|
+
"""Calculate total FTE for a person across all projects."""
|
|
130
|
+
return sum(
|
|
131
|
+
a['fte'] for a in self.allocations
|
|
132
|
+
if a['person_id'] == person_id
|
|
133
|
+
)`;
|
|
134
|
+
|
|
135
|
+
// Default story (light variant)
|
|
136
|
+
export const Default = () => /*#__PURE__*/_jsx(CodeBlock, {
|
|
137
|
+
language: "json",
|
|
138
|
+
children: JSON.stringify(sampleJSON, null, 2)
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
// Light variant (explicit)
|
|
142
|
+
export const LightVariant = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
143
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
144
|
+
mb: "r",
|
|
145
|
+
children: "Light Theme (Default)"
|
|
146
|
+
}), /*#__PURE__*/_jsx(P, {
|
|
147
|
+
mb: "r",
|
|
148
|
+
children: "Clean white background with dark text - matches existing pre tag styling"
|
|
149
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
150
|
+
language: "json",
|
|
151
|
+
variant: "light",
|
|
152
|
+
showLineNumbers: true,
|
|
153
|
+
children: JSON.stringify(sampleJSON, null, 2)
|
|
154
|
+
})]
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Dark variant
|
|
158
|
+
export const DarkVariant = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
159
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
160
|
+
mb: "r",
|
|
161
|
+
children: "Dark Theme"
|
|
162
|
+
}), /*#__PURE__*/_jsx(P, {
|
|
163
|
+
mb: "r",
|
|
164
|
+
children: "Dark background with light text for reduced eye strain"
|
|
165
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
166
|
+
language: "json",
|
|
167
|
+
variant: "dark",
|
|
168
|
+
showLineNumbers: true,
|
|
169
|
+
children: JSON.stringify(sampleJSON, null, 2)
|
|
170
|
+
})]
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// Side by side comparison
|
|
174
|
+
export const VariantComparison = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
175
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
176
|
+
mb: "r",
|
|
177
|
+
children: "Light vs Dark Comparison"
|
|
178
|
+
}), /*#__PURE__*/_jsx(P, {
|
|
179
|
+
mb: "r",
|
|
180
|
+
children: "Light variant (default):"
|
|
181
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
182
|
+
language: "javascript",
|
|
183
|
+
variant: "light",
|
|
184
|
+
children: sampleJavaScript
|
|
185
|
+
}), /*#__PURE__*/_jsx(Spacer, {
|
|
186
|
+
mb: "r"
|
|
187
|
+
}), /*#__PURE__*/_jsx(P, {
|
|
188
|
+
mb: "r",
|
|
189
|
+
children: "Dark variant:"
|
|
190
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
191
|
+
language: "javascript",
|
|
192
|
+
variant: "dark",
|
|
193
|
+
children: sampleJavaScript
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// With line numbers
|
|
198
|
+
export const WithLineNumbers = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
199
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
200
|
+
mb: "r",
|
|
201
|
+
children: "JSON Configuration with Line Numbers"
|
|
202
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
203
|
+
language: "json",
|
|
204
|
+
showLineNumbers: true,
|
|
205
|
+
children: JSON.stringify(sampleJSON, null, 2)
|
|
206
|
+
})]
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Without header
|
|
210
|
+
export const WithoutHeader = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
211
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
212
|
+
mb: "r",
|
|
213
|
+
children: "Minimal Mode (No Header)"
|
|
214
|
+
}), /*#__PURE__*/_jsx(P, {
|
|
215
|
+
mb: "r",
|
|
216
|
+
children: "Useful for embedding in tight spaces"
|
|
217
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
218
|
+
language: "json",
|
|
219
|
+
showHeader: false,
|
|
220
|
+
children: JSON.stringify(sampleJSON, null, 2)
|
|
221
|
+
})]
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
// Custom max height
|
|
225
|
+
export const CustomMaxHeight = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
226
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
227
|
+
mb: "r",
|
|
228
|
+
children: "Limited Height with Scrolling"
|
|
229
|
+
}), /*#__PURE__*/_jsx(P, {
|
|
230
|
+
mb: "r",
|
|
231
|
+
children: "Set maxHeight to control vertical scrolling"
|
|
232
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
233
|
+
language: "json",
|
|
234
|
+
maxHeight: "200px",
|
|
235
|
+
children: JSON.stringify(sampleJSON, null, 2)
|
|
236
|
+
})]
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// JavaScript example
|
|
240
|
+
export const JavaScript = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
241
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
242
|
+
mb: "r",
|
|
243
|
+
children: "JavaScript with Line Numbers"
|
|
244
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
245
|
+
language: "javascript",
|
|
246
|
+
showLineNumbers: true,
|
|
247
|
+
children: sampleJavaScript
|
|
248
|
+
})]
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
// TypeScript example
|
|
252
|
+
export const TypeScript = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
253
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
254
|
+
mb: "r",
|
|
255
|
+
children: "TypeScript"
|
|
256
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
257
|
+
language: "typescript",
|
|
258
|
+
showLineNumbers: true,
|
|
259
|
+
children: sampleTypeScript
|
|
260
|
+
})]
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// SQL example
|
|
264
|
+
export const SQL = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
265
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
266
|
+
mb: "r",
|
|
267
|
+
children: "SQL Query"
|
|
268
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
269
|
+
language: "sql",
|
|
270
|
+
showLineNumbers: true,
|
|
271
|
+
children: sampleSQL
|
|
272
|
+
})]
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// Bash example
|
|
276
|
+
export const BashScript = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
277
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
278
|
+
mb: "r",
|
|
279
|
+
children: "Shell Script"
|
|
280
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
281
|
+
language: "bash",
|
|
282
|
+
showLineNumbers: true,
|
|
283
|
+
children: sampleBash
|
|
284
|
+
})]
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
// Python example
|
|
288
|
+
export const Python = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
289
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
290
|
+
mb: "r",
|
|
291
|
+
children: "Python Class"
|
|
292
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
293
|
+
language: "python",
|
|
294
|
+
showLineNumbers: true,
|
|
295
|
+
children: samplePython
|
|
296
|
+
})]
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// Multiple code blocks
|
|
300
|
+
export const MultipleBlocks = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
301
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
302
|
+
mb: "r",
|
|
303
|
+
children: "Configuration Comparison"
|
|
304
|
+
}), /*#__PURE__*/_jsx(P, {
|
|
305
|
+
mb: "r",
|
|
306
|
+
children: "Original Configuration:"
|
|
307
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
308
|
+
language: "json",
|
|
309
|
+
maxHeight: "150px",
|
|
310
|
+
children: JSON.stringify({
|
|
311
|
+
version: "1.0",
|
|
312
|
+
features: ["basic"]
|
|
313
|
+
}, null, 2)
|
|
314
|
+
}), /*#__PURE__*/_jsx(Spacer, {
|
|
315
|
+
mb: "r"
|
|
316
|
+
}), /*#__PURE__*/_jsx(P, {
|
|
317
|
+
mb: "r",
|
|
318
|
+
children: "Updated Configuration:"
|
|
319
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
320
|
+
language: "json",
|
|
321
|
+
maxHeight: "150px",
|
|
322
|
+
children: JSON.stringify(sampleJSON, null, 2)
|
|
323
|
+
})]
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// Compact JSON
|
|
327
|
+
export const CompactJSON = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
328
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
329
|
+
mb: "r",
|
|
330
|
+
children: "Compact Mode for Small Snippets"
|
|
331
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
332
|
+
language: "json",
|
|
333
|
+
showHeader: false,
|
|
334
|
+
maxHeight: "100px",
|
|
335
|
+
children: JSON.stringify({
|
|
336
|
+
status: "success",
|
|
337
|
+
count: 42
|
|
338
|
+
}, null, 2)
|
|
339
|
+
})]
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
// All features enabled
|
|
343
|
+
export const AllFeaturesEnabled = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
344
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
345
|
+
mb: "r",
|
|
346
|
+
children: "All Features Enabled"
|
|
347
|
+
}), /*#__PURE__*/_jsx(P, {
|
|
348
|
+
mb: "r",
|
|
349
|
+
children: "Header + Line Numbers + Copy Button + Custom Height"
|
|
350
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
351
|
+
language: "javascript",
|
|
352
|
+
showLineNumbers: true,
|
|
353
|
+
showCopyButton: true,
|
|
354
|
+
showHeader: true,
|
|
355
|
+
maxHeight: "300px",
|
|
356
|
+
children: sampleJavaScript
|
|
357
|
+
})]
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
// Usage example for migration
|
|
361
|
+
export const MigrationExample = () => /*#__PURE__*/_jsxs(_Fragment, {
|
|
362
|
+
children: [/*#__PURE__*/_jsx(H2, {
|
|
363
|
+
mb: "r",
|
|
364
|
+
children: "Migration from <pre> tags"
|
|
365
|
+
}), /*#__PURE__*/_jsxs(P, {
|
|
366
|
+
mb: "r",
|
|
367
|
+
children: [/*#__PURE__*/_jsx("strong", {
|
|
368
|
+
children: "Before:"
|
|
369
|
+
}), " Plain HTML pre tag"]
|
|
370
|
+
}), /*#__PURE__*/_jsx(Box, {
|
|
371
|
+
bg: "greyLightest",
|
|
372
|
+
p: "r",
|
|
373
|
+
borderRadius: "2",
|
|
374
|
+
mb: "r",
|
|
375
|
+
style: {
|
|
376
|
+
fontFamily: "monospace"
|
|
377
|
+
},
|
|
378
|
+
children: /*#__PURE__*/_jsx("pre", {
|
|
379
|
+
children: JSON.stringify({
|
|
380
|
+
old: "approach"
|
|
381
|
+
}, null, 2)
|
|
382
|
+
})
|
|
383
|
+
}), /*#__PURE__*/_jsxs(P, {
|
|
384
|
+
mb: "r",
|
|
385
|
+
children: [/*#__PURE__*/_jsx("strong", {
|
|
386
|
+
children: "After:"
|
|
387
|
+
}), " CodeBlock component with syntax highlighting"]
|
|
388
|
+
}), /*#__PURE__*/_jsx(CodeBlock, {
|
|
389
|
+
language: "json",
|
|
390
|
+
children: JSON.stringify({
|
|
391
|
+
new: "approach",
|
|
392
|
+
benefits: ["highlighting", "copy", "themes"]
|
|
393
|
+
}, null, 2)
|
|
394
|
+
})]
|
|
395
|
+
});
|
|
396
|
+
Default.__docgenInfo = {
|
|
397
|
+
"description": "",
|
|
398
|
+
"methods": [],
|
|
399
|
+
"displayName": "Default"
|
|
400
|
+
};
|
|
401
|
+
LightVariant.__docgenInfo = {
|
|
402
|
+
"description": "",
|
|
403
|
+
"methods": [],
|
|
404
|
+
"displayName": "LightVariant"
|
|
405
|
+
};
|
|
406
|
+
DarkVariant.__docgenInfo = {
|
|
407
|
+
"description": "",
|
|
408
|
+
"methods": [],
|
|
409
|
+
"displayName": "DarkVariant"
|
|
410
|
+
};
|
|
411
|
+
VariantComparison.__docgenInfo = {
|
|
412
|
+
"description": "",
|
|
413
|
+
"methods": [],
|
|
414
|
+
"displayName": "VariantComparison"
|
|
415
|
+
};
|
|
416
|
+
WithLineNumbers.__docgenInfo = {
|
|
417
|
+
"description": "",
|
|
418
|
+
"methods": [],
|
|
419
|
+
"displayName": "WithLineNumbers"
|
|
420
|
+
};
|
|
421
|
+
WithoutHeader.__docgenInfo = {
|
|
422
|
+
"description": "",
|
|
423
|
+
"methods": [],
|
|
424
|
+
"displayName": "WithoutHeader"
|
|
425
|
+
};
|
|
426
|
+
CustomMaxHeight.__docgenInfo = {
|
|
427
|
+
"description": "",
|
|
428
|
+
"methods": [],
|
|
429
|
+
"displayName": "CustomMaxHeight"
|
|
430
|
+
};
|
|
431
|
+
JavaScript.__docgenInfo = {
|
|
432
|
+
"description": "",
|
|
433
|
+
"methods": [],
|
|
434
|
+
"displayName": "JavaScript"
|
|
435
|
+
};
|
|
436
|
+
TypeScript.__docgenInfo = {
|
|
437
|
+
"description": "",
|
|
438
|
+
"methods": [],
|
|
439
|
+
"displayName": "TypeScript"
|
|
440
|
+
};
|
|
441
|
+
SQL.__docgenInfo = {
|
|
442
|
+
"description": "",
|
|
443
|
+
"methods": [],
|
|
444
|
+
"displayName": "SQL"
|
|
445
|
+
};
|
|
446
|
+
BashScript.__docgenInfo = {
|
|
447
|
+
"description": "",
|
|
448
|
+
"methods": [],
|
|
449
|
+
"displayName": "BashScript"
|
|
450
|
+
};
|
|
451
|
+
Python.__docgenInfo = {
|
|
452
|
+
"description": "",
|
|
453
|
+
"methods": [],
|
|
454
|
+
"displayName": "Python"
|
|
455
|
+
};
|
|
456
|
+
MultipleBlocks.__docgenInfo = {
|
|
457
|
+
"description": "",
|
|
458
|
+
"methods": [],
|
|
459
|
+
"displayName": "MultipleBlocks"
|
|
460
|
+
};
|
|
461
|
+
CompactJSON.__docgenInfo = {
|
|
462
|
+
"description": "",
|
|
463
|
+
"methods": [],
|
|
464
|
+
"displayName": "CompactJSON"
|
|
465
|
+
};
|
|
466
|
+
AllFeaturesEnabled.__docgenInfo = {
|
|
467
|
+
"description": "",
|
|
468
|
+
"methods": [],
|
|
469
|
+
"displayName": "AllFeaturesEnabled"
|
|
470
|
+
};
|
|
471
|
+
MigrationExample.__docgenInfo = {
|
|
472
|
+
"description": "",
|
|
473
|
+
"methods": [],
|
|
474
|
+
"displayName": "MigrationExample"
|
|
475
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import * as stories from "./CodeBlock.stories";
|
|
5
|
+
|
|
6
|
+
// Mock clipboard API
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
Object.assign(navigator, {
|
|
9
|
+
clipboard: {
|
|
10
|
+
writeText: jest.fn().mockResolvedValue()
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
describe("CodeBlock Stories", () => {
|
|
14
|
+
it("Renders components-codeblock--default story", () => {
|
|
15
|
+
const {
|
|
16
|
+
container
|
|
17
|
+
} = render(/*#__PURE__*/_jsx(stories.Default, {}));
|
|
18
|
+
expect(container.firstChild).not.toBeNull();
|
|
19
|
+
});
|
|
20
|
+
it("Renders components-codeblock--with-line-numbers story", () => {
|
|
21
|
+
const {
|
|
22
|
+
container
|
|
23
|
+
} = render(/*#__PURE__*/_jsx(stories.WithLineNumbers, {}));
|
|
24
|
+
expect(container.firstChild).not.toBeNull();
|
|
25
|
+
});
|
|
26
|
+
it("Renders components-codeblock--without-header story", () => {
|
|
27
|
+
const {
|
|
28
|
+
container
|
|
29
|
+
} = render(/*#__PURE__*/_jsx(stories.WithoutHeader, {}));
|
|
30
|
+
expect(container.firstChild).not.toBeNull();
|
|
31
|
+
});
|
|
32
|
+
it("Renders components-codeblock--custom-max-height story", () => {
|
|
33
|
+
const {
|
|
34
|
+
container
|
|
35
|
+
} = render(/*#__PURE__*/_jsx(stories.CustomMaxHeight, {}));
|
|
36
|
+
expect(container.firstChild).not.toBeNull();
|
|
37
|
+
});
|
|
38
|
+
it("Renders components-codeblock--java-script story", () => {
|
|
39
|
+
const {
|
|
40
|
+
container
|
|
41
|
+
} = render(/*#__PURE__*/_jsx(stories.JavaScript, {}));
|
|
42
|
+
expect(container.firstChild).not.toBeNull();
|
|
43
|
+
});
|
|
44
|
+
it("Renders components-codeblock--type-script story", () => {
|
|
45
|
+
const {
|
|
46
|
+
container
|
|
47
|
+
} = render(/*#__PURE__*/_jsx(stories.TypeScript, {}));
|
|
48
|
+
expect(container.firstChild).not.toBeNull();
|
|
49
|
+
});
|
|
50
|
+
it("Renders components-codeblock--sql story", () => {
|
|
51
|
+
const {
|
|
52
|
+
container
|
|
53
|
+
} = render(/*#__PURE__*/_jsx(stories.SQL, {}));
|
|
54
|
+
expect(container.firstChild).not.toBeNull();
|
|
55
|
+
});
|
|
56
|
+
it("Renders components-codeblock--bash-script story", () => {
|
|
57
|
+
const {
|
|
58
|
+
container
|
|
59
|
+
} = render(/*#__PURE__*/_jsx(stories.BashScript, {}));
|
|
60
|
+
expect(container.firstChild).not.toBeNull();
|
|
61
|
+
});
|
|
62
|
+
it("Renders components-codeblock--python story", () => {
|
|
63
|
+
const {
|
|
64
|
+
container
|
|
65
|
+
} = render(/*#__PURE__*/_jsx(stories.Python, {}));
|
|
66
|
+
expect(container.firstChild).not.toBeNull();
|
|
67
|
+
});
|
|
68
|
+
it("Renders components-codeblock--multiple-blocks story", () => {
|
|
69
|
+
const {
|
|
70
|
+
container
|
|
71
|
+
} = render(/*#__PURE__*/_jsx(stories.MultipleBlocks, {}));
|
|
72
|
+
expect(container.firstChild).not.toBeNull();
|
|
73
|
+
});
|
|
74
|
+
it("Renders components-codeblock--compact-json story", () => {
|
|
75
|
+
const {
|
|
76
|
+
container
|
|
77
|
+
} = render(/*#__PURE__*/_jsx(stories.CompactJSON, {}));
|
|
78
|
+
expect(container.firstChild).not.toBeNull();
|
|
79
|
+
});
|
|
80
|
+
it("Renders components-codeblock--all-features-enabled story", () => {
|
|
81
|
+
const {
|
|
82
|
+
container
|
|
83
|
+
} = render(/*#__PURE__*/_jsx(stories.AllFeaturesEnabled, {}));
|
|
84
|
+
expect(container.firstChild).not.toBeNull();
|
|
85
|
+
});
|
|
86
|
+
it("Renders components-codeblock--migration-example story", () => {
|
|
87
|
+
const {
|
|
88
|
+
container
|
|
89
|
+
} = render(/*#__PURE__*/_jsx(stories.MigrationExample, {}));
|
|
90
|
+
expect(container.firstChild).not.toBeNull();
|
|
91
|
+
});
|
|
92
|
+
});
|