@atlaskit/editor-plugin-extension 1.5.2 → 1.5.3

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 (31) hide show
  1. package/.eslintrc.js +12 -12
  2. package/CHANGELOG.md +219 -214
  3. package/LICENSE.md +6 -8
  4. package/dist/cjs/ui/ConfigPanel/ErrorMessage/ErrorImage.js +12 -4
  5. package/dist/cjs/ui/ConfigPanel/Fields/ColorPicker.js +1 -1
  6. package/dist/cjs/ui/ConfigPanel/FormContent.js +4 -1
  7. package/dist/cjs/ui/ConfigPanel/Header.js +1 -0
  8. package/dist/cjs/ui/ConfigPanel/NestedForms/RemovableField.js +3 -1
  9. package/dist/es2019/ui/ConfigPanel/ErrorMessage/ErrorImage.js +12 -4
  10. package/dist/es2019/ui/ConfigPanel/Fields/ColorPicker.js +1 -1
  11. package/dist/es2019/ui/ConfigPanel/FormContent.js +4 -1
  12. package/dist/es2019/ui/ConfigPanel/Header.js +1 -0
  13. package/dist/es2019/ui/ConfigPanel/NestedForms/RemovableField.js +3 -1
  14. package/dist/esm/ui/ConfigPanel/ErrorMessage/ErrorImage.js +12 -4
  15. package/dist/esm/ui/ConfigPanel/Fields/ColorPicker.js +1 -1
  16. package/dist/esm/ui/ConfigPanel/FormContent.js +4 -1
  17. package/dist/esm/ui/ConfigPanel/Header.js +1 -0
  18. package/dist/esm/ui/ConfigPanel/NestedForms/RemovableField.js +3 -1
  19. package/dist/types/ui/ConfigPanel/Fields/UnhandledType.d.ts +1 -1
  20. package/dist/types/ui/SaveIndicator/SaveIndicator.d.ts +1 -1
  21. package/dist/types-ts4.5/ui/ConfigPanel/Fields/UnhandledType.d.ts +1 -1
  22. package/dist/types-ts4.5/ui/SaveIndicator/SaveIndicator.d.ts +1 -1
  23. package/example-utils/config-panel/ConfigPanelWithExtensionPicker.tsx +158 -172
  24. package/example-utils/config-panel/ConfigPanelWithProviders.tsx +37 -37
  25. package/example-utils/config-panel/ExtensionNodePicker.tsx +110 -121
  26. package/example-utils/config-panel/FieldTypePicker.tsx +49 -47
  27. package/example-utils/config-panel/example-manifest-all-fields.ts +63 -63
  28. package/example-utils/config-panel/example-manifest-individual-fields.ts +64 -64
  29. package/example-utils/config-panel/fields.ts +617 -619
  30. package/package.json +8 -10
  31. package/report.api.md +42 -47
@@ -1,626 +1,624 @@
1
1
  import type { FieldDefinition } from '@atlaskit/editor-common/extensions';
2
2
 
3
3
  export const nativeFields: FieldDefinition[] = [
4
- {
5
- type: 'tab-group',
6
- label: 'Tab type',
7
- name: 'tabGroup',
8
- fields: [
9
- {
10
- type: 'tab',
11
- label: 'Tab A',
12
- name: 'optionA',
13
- fields: [
14
- {
15
- name: 'expandField',
16
- type: 'expand',
17
- label: 'awesome expand field',
18
- isExpanded: true,
19
- fields: [
20
- {
21
- name: 'textFieldOne',
22
- type: 'string',
23
- label: 'Free text',
24
- },
25
- ],
26
- },
27
- {
28
- name: 'textFieldThree',
29
- type: 'string',
30
- label: 'Free text',
31
- },
32
- ],
33
- },
34
- {
35
- type: 'tab',
36
- label: 'Tab B',
37
- name: 'optionB',
38
- fields: [
39
- {
40
- name: 'textFieldTwo',
41
- type: 'string',
42
- label: 'Free text',
43
- },
44
- ],
45
- },
46
- ],
47
- },
48
- {
49
- name: 'text-field',
50
- type: 'string',
51
- label: 'Free text',
52
- isRequired: true,
53
- description: 'Add any text',
54
- defaultValue: 'I am the default text',
55
- },
56
- {
57
- name: 'text-field-multiline',
58
- type: 'string',
59
- label: 'Free text',
60
- isRequired: true,
61
- description: 'Add any text across multiple lines',
62
- defaultValue: 'I am the default multiline text',
63
- style: 'multiline',
64
- },
65
- {
66
- name: 'text-field-optional',
67
- type: 'string',
68
- label: 'Text',
69
- isRequired: false,
70
- description: 'Leave it empty',
71
- placeholder: 'Text goes here',
72
- },
73
- {
74
- name: 'text-field-hidden',
75
- type: 'string',
76
- label: 'Hidden text field',
77
- defaultValue: 'this is a hidden value passed to the extension',
78
- isHidden: true,
79
- },
80
- {
81
- name: 'number-field',
82
- type: 'number',
83
- label: 'Number',
84
- isRequired: true,
85
- placeholder: 'Number goes here',
86
- },
87
- {
88
- name: 'boolean-field-required',
89
- type: 'boolean',
90
- label: 'Needs to be checked',
91
- description:
92
- '<b>A</b> <i>checkbox</i> that can be <code>true</code> or <strong>false</strong> <em>(by design)</em>',
93
- isRequired: true,
94
- },
95
- {
96
- name: 'boolean-field-optional',
97
- type: 'boolean',
98
- label: 'Do you want free shipping?',
99
- description: 'True or <b>FALSE</b> (should be bolded)',
100
- },
101
- {
102
- name: 'boolean-field-toggle',
103
- type: 'boolean',
104
- label: 'Turn on the Wi-Fi?',
105
- description: 'On or Off',
106
- style: 'toggle',
107
- defaultValue: true,
108
- },
109
- {
110
- name: 'date-start',
111
- type: 'date',
112
- label: 'Date',
113
- description: `Nothing of <a onclick="alert('something is wrong')">interest</a>`,
114
- placeholder: 'Date goes here',
115
- },
116
- {
117
- name: 'enum-select',
118
- type: 'enum',
119
- label: 'Select one',
120
- isRequired: true,
121
- description: 'Pick one',
122
- style: 'select',
123
- isMultiple: false,
124
- placeholder: 'Selected option goes here',
125
- items: [
126
- { label: 'Option A', value: 'a' },
127
- { label: 'Option B', value: 'b' },
128
- ],
129
- },
130
- {
131
- name: 'enum-select-icon',
132
- type: 'enum',
133
- label: 'Select with icons',
134
- description: 'Pick one',
135
- style: 'select',
136
- isMultiple: false,
137
- items: [
138
- {
139
- label: 'Option A',
140
- value: 'a',
141
- description: 'Recommended',
142
- icon: 'https://i.picsum.photos/id/237/24/24.jpg',
143
- },
144
- {
145
- label:
146
- 'Option B with a really really really really really really long label',
147
- value: 'b',
148
- description: 'One of the best options out there',
149
- icon: 'https://i.picsum.photos/id/240/24/24.jpg',
150
- },
151
- ],
152
- },
153
- {
154
- name: 'enum-select-icon-multiple',
155
- type: 'enum',
156
- label: 'Select with icons (multiple)',
157
- description: 'Pick many',
158
- defaultValue: ['a', 'b', 'long'],
159
- style: 'select',
160
- placeholder: 'Selected options go here',
161
- isMultiple: true,
162
- items: [
163
- {
164
- label: 'Option A',
165
- value: 'a',
166
- description: 'Our most popular pick',
167
- icon: 'https://i.picsum.photos/id/237/24/24.jpg',
168
- },
169
- {
170
- label: 'Option B',
171
- value: 'b',
172
- description: 'Many people like this one',
173
- icon: 'https://i.picsum.photos/id/240/24/24.jpg',
174
- },
175
- {
176
- label: 'Option Long, a really long label (longer than we expected)',
177
- value: 'long',
178
- description: 'Many people like this one',
179
- icon: 'https://i.picsum.photos/id/240/24/24.jpg',
180
- },
181
- ],
182
- },
183
- {
184
- name: 'enum-select-multiple',
185
- type: 'enum',
186
- label: 'Select 1 or many',
187
- description: '1 required, no default',
188
- style: 'select',
189
- isRequired: true,
190
- isMultiple: true,
191
- items: [
192
- { label: 'Option A', value: 'a' },
193
- { label: 'Option B', value: 'b' },
194
- { label: 'Option C', value: 'c' },
195
- { label: 'Option D', value: 'd' },
196
- { label: 'Option E', value: 'e' },
197
- ],
198
- },
199
- {
200
- name: 'enum-radio-required',
201
- type: 'enum',
202
- label: 'Select one',
203
- description: 'One is always required',
204
- style: 'radio',
205
- isRequired: true,
206
- isMultiple: false,
207
- items: [
208
- { label: 'Option A', value: 'a' },
209
- { label: 'Option B', value: 'b' },
210
- { label: 'Option C', value: 'c' },
211
- { label: 'Option D', value: 'd' },
212
- { label: 'Option E', value: 'e' },
213
- ],
214
- },
215
- {
216
- name: 'enum-radio-defaulted',
217
- type: 'enum',
218
- label: 'Select one (defaulted)',
219
- description: 'One is always required, but we default it',
220
- style: 'radio',
221
- isRequired: false,
222
- defaultValue: 'a',
223
- items: [
224
- { label: 'Option A', value: 'a' },
225
- { label: 'Option B', value: 'b' },
226
- { label: 'Option C', value: 'c' },
227
- { label: 'Option D', value: 'd' },
228
- { label: 'Option E', value: 'e' },
229
- ],
230
- },
231
- {
232
- name: 'enum-checkbox-multiple',
233
- type: 'enum',
234
- label: 'Select 1 or many, or none',
235
- description: 'Nothing required, no default',
236
- style: 'checkbox',
237
- isRequired: false,
238
- isMultiple: true,
239
- items: [
240
- {
241
- label: 'Option A',
242
- value: 'a',
243
- description: 'tooltip description for a',
244
- },
245
- {
246
- label: 'Option B',
247
- value: 'b',
248
- description: 'tooltip description for b',
249
- },
250
- {
251
- label: 'Option C',
252
- value: 'c',
253
- description: 'tooltip description for c',
254
- },
255
- {
256
- label: 'Option D',
257
- value: 'd',
258
- description: 'tooltip description for d',
259
- },
260
- {
261
- label: 'Option E',
262
- value: 'e',
263
- description: 'tooltip description for e',
264
- },
265
- ],
266
- },
267
- {
268
- name: 'enum-checkbox-multiple-required',
269
- type: 'enum',
270
- label: 'Select 1 or many',
271
- description: 'Something required',
272
- style: 'checkbox',
273
- isRequired: true,
274
- isMultiple: true,
275
- items: [
276
- {
277
- label: 'Option A',
278
- value: 'a',
279
- description: 'tooltip description for a',
280
- },
281
- {
282
- label: 'Option B',
283
- value: 'b',
284
- description: 'tooltip description for b',
285
- },
286
- {
287
- label: 'Option C',
288
- value: 'c',
289
- description: 'tooltip description for c',
290
- },
291
- {
292
- label: 'Option D',
293
- value: 'd',
294
- description: 'tooltip description for d',
295
- },
296
- {
297
- label: 'Option E',
298
- value: 'e',
299
- description: 'tooltip description for e',
300
- },
301
- ],
302
- },
303
- {
304
- name: 'unhandled',
305
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
306
- type: 'foobar' as any,
307
- label: 'Unknown type',
308
- },
309
- {
310
- name: 'fieldset-cql',
311
- type: 'fieldset',
312
- label: 'CQL',
313
- options: {
314
- isDynamic: true,
315
- transformer: {
316
- type: 'cql',
317
- },
318
- },
319
- fields: [
320
- {
321
- name: 'created-at',
322
- type: 'date-range',
323
- label: 'Created at',
324
- description: `This is how we select date range in the cql component`,
325
- items: [
326
- { label: 'Any date', value: '' },
327
- { label: 'Last 24 hours', value: 'now(-1d)' },
328
- { label: 'Last week', value: 'now(-1w)' },
329
- { label: 'Last month', value: 'now(-1M)' },
330
- { label: 'Last year', value: 'now(-1y)' },
331
- ],
332
- },
333
- {
334
- name: 'last-modified',
335
- type: 'date-range',
336
- label: 'Last modified',
337
- items: [
338
- { label: 'Today', value: 'now(-1d)' },
339
- { label: 'This week', value: 'now(-1w)' },
340
- { label: 'This month', value: 'now(-1M)' },
341
- { label: 'This year', value: 'now(-1y)' },
342
- ],
343
- },
344
- {
345
- name: 'query',
346
- type: 'string',
347
- label: 'Search term',
348
- },
349
- {
350
- name: 'custom',
351
- type: 'custom',
352
- label: 'Custom: Select anything',
353
- isRequired: true,
354
- options: {
355
- resolver: {
356
- type: 'mock-resolver',
357
- },
358
- },
359
- },
360
- {
361
- name: 'content',
362
- type: 'enum',
363
- label: 'Content Type',
364
- isRequired: false,
365
- style: 'checkbox',
366
- isMultiple: true,
367
- items: [
368
- {
369
- label: 'Page',
370
- value: 'page',
371
- },
372
- {
373
- label: 'Blogpost',
374
- value: 'blogpost',
375
- },
376
- {
377
- label: 'Question',
378
- value: 'question',
379
- },
380
- ],
381
- },
382
- ],
383
- },
384
- {
385
- name: 'fieldset-without-label',
386
- type: 'fieldset',
387
- label: 'Fieldset without label',
388
- options: {
389
- isDynamic: true,
390
- showTitle: false,
391
- transformer: {
392
- type: 'cql',
393
- },
394
- },
395
- fields: [
396
- {
397
- name: 'inner-text',
398
- type: 'string',
399
- label: 'Search term',
400
- },
401
- ],
402
- },
403
- {
404
- name: 'fieldset-jira-filter',
405
- type: 'fieldset',
406
- label: 'Issues filter',
407
- options: {
408
- isDynamic: true,
409
- transformer: {
410
- type: 'cql',
411
- },
412
- },
413
- fields: [
414
- {
415
- name: 'keywords',
416
- type: 'string',
417
- label: 'Keywords',
418
- },
419
- {
420
- name: 'project',
421
- type: 'enum',
422
- label: 'Project',
423
- isRequired: false,
424
- style: 'select',
425
- items: [
426
- {
427
- label: 'Editor platform',
428
- value: 'editor-platform',
429
- },
430
- {
431
- label: 'Editor experiences',
432
- value: 'editor-experiences',
433
- },
434
- ],
435
- },
436
- {
437
- name: 'status',
438
- type: 'enum',
439
- label: 'Status',
440
- isRequired: false,
441
- style: 'select',
442
- items: [
443
- {
444
- label: 'To do',
445
- value: 'to-do',
446
- },
447
- {
448
- label: 'In Progress',
449
- value: 'in-progress',
450
- },
451
- {
452
- label: 'Done',
453
- value: 'Done',
454
- },
455
- ],
456
- },
457
- ],
458
- },
459
- {
460
- name: 'expand field',
461
- type: 'expand',
462
- label: 'awesome expand field',
463
- fields: [
464
- {
465
- name: 'enum-select-expand',
466
- type: 'enum',
467
- label: 'Select one',
468
- isRequired: true,
469
- description: 'Pick one',
470
- style: 'select',
471
- isMultiple: false,
472
- placeholder: 'Selected option goes here',
473
- items: [
474
- { label: 'Option A', value: 'a' },
475
- { label: 'Option B', value: 'b' },
476
- ],
477
- },
478
- {
479
- name: 'enum-select-icon-expand',
480
- type: 'enum',
481
- label: 'Select with icons',
482
- description: 'Pick one',
483
- style: 'select',
484
- isMultiple: false,
485
- items: [
486
- {
487
- label: 'Option A',
488
- value: 'a',
489
- description: 'Recommended',
490
- },
491
- {
492
- label:
493
- 'Option B with a really really really really really really long label',
494
- value: 'b',
495
- description: 'One of the best options out there',
496
- },
497
- ],
498
- },
499
- ],
500
- },
501
- {
502
- name: 'color-picker',
503
- label: 'Color Picker',
504
- type: 'color',
505
- description: 'Pick your color',
506
- defaultValue: '#7AB2FF',
507
- },
508
- {
509
- name: 'color-picker-req',
510
- label: 'Color Picker Required',
511
- type: 'color',
512
- isRequired: true,
513
- description: 'Pick your color',
514
- defaultValue: '#7AB2FF',
515
- },
4
+ {
5
+ type: 'tab-group',
6
+ label: 'Tab type',
7
+ name: 'tabGroup',
8
+ fields: [
9
+ {
10
+ type: 'tab',
11
+ label: 'Tab A',
12
+ name: 'optionA',
13
+ fields: [
14
+ {
15
+ name: 'expandField',
16
+ type: 'expand',
17
+ label: 'awesome expand field',
18
+ isExpanded: true,
19
+ fields: [
20
+ {
21
+ name: 'textFieldOne',
22
+ type: 'string',
23
+ label: 'Free text',
24
+ },
25
+ ],
26
+ },
27
+ {
28
+ name: 'textFieldThree',
29
+ type: 'string',
30
+ label: 'Free text',
31
+ },
32
+ ],
33
+ },
34
+ {
35
+ type: 'tab',
36
+ label: 'Tab B',
37
+ name: 'optionB',
38
+ fields: [
39
+ {
40
+ name: 'textFieldTwo',
41
+ type: 'string',
42
+ label: 'Free text',
43
+ },
44
+ ],
45
+ },
46
+ ],
47
+ },
48
+ {
49
+ name: 'text-field',
50
+ type: 'string',
51
+ label: 'Free text',
52
+ isRequired: true,
53
+ description: 'Add any text',
54
+ defaultValue: 'I am the default text',
55
+ },
56
+ {
57
+ name: 'text-field-multiline',
58
+ type: 'string',
59
+ label: 'Free text',
60
+ isRequired: true,
61
+ description: 'Add any text across multiple lines',
62
+ defaultValue: 'I am the default multiline text',
63
+ style: 'multiline',
64
+ },
65
+ {
66
+ name: 'text-field-optional',
67
+ type: 'string',
68
+ label: 'Text',
69
+ isRequired: false,
70
+ description: 'Leave it empty',
71
+ placeholder: 'Text goes here',
72
+ },
73
+ {
74
+ name: 'text-field-hidden',
75
+ type: 'string',
76
+ label: 'Hidden text field',
77
+ defaultValue: 'this is a hidden value passed to the extension',
78
+ isHidden: true,
79
+ },
80
+ {
81
+ name: 'number-field',
82
+ type: 'number',
83
+ label: 'Number',
84
+ isRequired: true,
85
+ placeholder: 'Number goes here',
86
+ },
87
+ {
88
+ name: 'boolean-field-required',
89
+ type: 'boolean',
90
+ label: 'Needs to be checked',
91
+ description:
92
+ '<b>A</b> <i>checkbox</i> that can be <code>true</code> or <strong>false</strong> <em>(by design)</em>',
93
+ isRequired: true,
94
+ },
95
+ {
96
+ name: 'boolean-field-optional',
97
+ type: 'boolean',
98
+ label: 'Do you want free shipping?',
99
+ description: 'True or <b>FALSE</b> (should be bolded)',
100
+ },
101
+ {
102
+ name: 'boolean-field-toggle',
103
+ type: 'boolean',
104
+ label: 'Turn on the Wi-Fi?',
105
+ description: 'On or Off',
106
+ style: 'toggle',
107
+ defaultValue: true,
108
+ },
109
+ {
110
+ name: 'date-start',
111
+ type: 'date',
112
+ label: 'Date',
113
+ description: `Nothing of <a onclick="alert('something is wrong')">interest</a>`,
114
+ placeholder: 'Date goes here',
115
+ },
116
+ {
117
+ name: 'enum-select',
118
+ type: 'enum',
119
+ label: 'Select one',
120
+ isRequired: true,
121
+ description: 'Pick one',
122
+ style: 'select',
123
+ isMultiple: false,
124
+ placeholder: 'Selected option goes here',
125
+ items: [
126
+ { label: 'Option A', value: 'a' },
127
+ { label: 'Option B', value: 'b' },
128
+ ],
129
+ },
130
+ {
131
+ name: 'enum-select-icon',
132
+ type: 'enum',
133
+ label: 'Select with icons',
134
+ description: 'Pick one',
135
+ style: 'select',
136
+ isMultiple: false,
137
+ items: [
138
+ {
139
+ label: 'Option A',
140
+ value: 'a',
141
+ description: 'Recommended',
142
+ icon: 'https://i.picsum.photos/id/237/24/24.jpg',
143
+ },
144
+ {
145
+ label: 'Option B with a really really really really really really long label',
146
+ value: 'b',
147
+ description: 'One of the best options out there',
148
+ icon: 'https://i.picsum.photos/id/240/24/24.jpg',
149
+ },
150
+ ],
151
+ },
152
+ {
153
+ name: 'enum-select-icon-multiple',
154
+ type: 'enum',
155
+ label: 'Select with icons (multiple)',
156
+ description: 'Pick many',
157
+ defaultValue: ['a', 'b', 'long'],
158
+ style: 'select',
159
+ placeholder: 'Selected options go here',
160
+ isMultiple: true,
161
+ items: [
162
+ {
163
+ label: 'Option A',
164
+ value: 'a',
165
+ description: 'Our most popular pick',
166
+ icon: 'https://i.picsum.photos/id/237/24/24.jpg',
167
+ },
168
+ {
169
+ label: 'Option B',
170
+ value: 'b',
171
+ description: 'Many people like this one',
172
+ icon: 'https://i.picsum.photos/id/240/24/24.jpg',
173
+ },
174
+ {
175
+ label: 'Option Long, a really long label (longer than we expected)',
176
+ value: 'long',
177
+ description: 'Many people like this one',
178
+ icon: 'https://i.picsum.photos/id/240/24/24.jpg',
179
+ },
180
+ ],
181
+ },
182
+ {
183
+ name: 'enum-select-multiple',
184
+ type: 'enum',
185
+ label: 'Select 1 or many',
186
+ description: '1 required, no default',
187
+ style: 'select',
188
+ isRequired: true,
189
+ isMultiple: true,
190
+ items: [
191
+ { label: 'Option A', value: 'a' },
192
+ { label: 'Option B', value: 'b' },
193
+ { label: 'Option C', value: 'c' },
194
+ { label: 'Option D', value: 'd' },
195
+ { label: 'Option E', value: 'e' },
196
+ ],
197
+ },
198
+ {
199
+ name: 'enum-radio-required',
200
+ type: 'enum',
201
+ label: 'Select one',
202
+ description: 'One is always required',
203
+ style: 'radio',
204
+ isRequired: true,
205
+ isMultiple: false,
206
+ items: [
207
+ { label: 'Option A', value: 'a' },
208
+ { label: 'Option B', value: 'b' },
209
+ { label: 'Option C', value: 'c' },
210
+ { label: 'Option D', value: 'd' },
211
+ { label: 'Option E', value: 'e' },
212
+ ],
213
+ },
214
+ {
215
+ name: 'enum-radio-defaulted',
216
+ type: 'enum',
217
+ label: 'Select one (defaulted)',
218
+ description: 'One is always required, but we default it',
219
+ style: 'radio',
220
+ isRequired: false,
221
+ defaultValue: 'a',
222
+ items: [
223
+ { label: 'Option A', value: 'a' },
224
+ { label: 'Option B', value: 'b' },
225
+ { label: 'Option C', value: 'c' },
226
+ { label: 'Option D', value: 'd' },
227
+ { label: 'Option E', value: 'e' },
228
+ ],
229
+ },
230
+ {
231
+ name: 'enum-checkbox-multiple',
232
+ type: 'enum',
233
+ label: 'Select 1 or many, or none',
234
+ description: 'Nothing required, no default',
235
+ style: 'checkbox',
236
+ isRequired: false,
237
+ isMultiple: true,
238
+ items: [
239
+ {
240
+ label: 'Option A',
241
+ value: 'a',
242
+ description: 'tooltip description for a',
243
+ },
244
+ {
245
+ label: 'Option B',
246
+ value: 'b',
247
+ description: 'tooltip description for b',
248
+ },
249
+ {
250
+ label: 'Option C',
251
+ value: 'c',
252
+ description: 'tooltip description for c',
253
+ },
254
+ {
255
+ label: 'Option D',
256
+ value: 'd',
257
+ description: 'tooltip description for d',
258
+ },
259
+ {
260
+ label: 'Option E',
261
+ value: 'e',
262
+ description: 'tooltip description for e',
263
+ },
264
+ ],
265
+ },
266
+ {
267
+ name: 'enum-checkbox-multiple-required',
268
+ type: 'enum',
269
+ label: 'Select 1 or many',
270
+ description: 'Something required',
271
+ style: 'checkbox',
272
+ isRequired: true,
273
+ isMultiple: true,
274
+ items: [
275
+ {
276
+ label: 'Option A',
277
+ value: 'a',
278
+ description: 'tooltip description for a',
279
+ },
280
+ {
281
+ label: 'Option B',
282
+ value: 'b',
283
+ description: 'tooltip description for b',
284
+ },
285
+ {
286
+ label: 'Option C',
287
+ value: 'c',
288
+ description: 'tooltip description for c',
289
+ },
290
+ {
291
+ label: 'Option D',
292
+ value: 'd',
293
+ description: 'tooltip description for d',
294
+ },
295
+ {
296
+ label: 'Option E',
297
+ value: 'e',
298
+ description: 'tooltip description for e',
299
+ },
300
+ ],
301
+ },
302
+ {
303
+ name: 'unhandled',
304
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
305
+ type: 'foobar' as any,
306
+ label: 'Unknown type',
307
+ },
308
+ {
309
+ name: 'fieldset-cql',
310
+ type: 'fieldset',
311
+ label: 'CQL',
312
+ options: {
313
+ isDynamic: true,
314
+ transformer: {
315
+ type: 'cql',
316
+ },
317
+ },
318
+ fields: [
319
+ {
320
+ name: 'created-at',
321
+ type: 'date-range',
322
+ label: 'Created at',
323
+ description: `This is how we select date range in the cql component`,
324
+ items: [
325
+ { label: 'Any date', value: '' },
326
+ { label: 'Last 24 hours', value: 'now(-1d)' },
327
+ { label: 'Last week', value: 'now(-1w)' },
328
+ { label: 'Last month', value: 'now(-1M)' },
329
+ { label: 'Last year', value: 'now(-1y)' },
330
+ ],
331
+ },
332
+ {
333
+ name: 'last-modified',
334
+ type: 'date-range',
335
+ label: 'Last modified',
336
+ items: [
337
+ { label: 'Today', value: 'now(-1d)' },
338
+ { label: 'This week', value: 'now(-1w)' },
339
+ { label: 'This month', value: 'now(-1M)' },
340
+ { label: 'This year', value: 'now(-1y)' },
341
+ ],
342
+ },
343
+ {
344
+ name: 'query',
345
+ type: 'string',
346
+ label: 'Search term',
347
+ },
348
+ {
349
+ name: 'custom',
350
+ type: 'custom',
351
+ label: 'Custom: Select anything',
352
+ isRequired: true,
353
+ options: {
354
+ resolver: {
355
+ type: 'mock-resolver',
356
+ },
357
+ },
358
+ },
359
+ {
360
+ name: 'content',
361
+ type: 'enum',
362
+ label: 'Content Type',
363
+ isRequired: false,
364
+ style: 'checkbox',
365
+ isMultiple: true,
366
+ items: [
367
+ {
368
+ label: 'Page',
369
+ value: 'page',
370
+ },
371
+ {
372
+ label: 'Blogpost',
373
+ value: 'blogpost',
374
+ },
375
+ {
376
+ label: 'Question',
377
+ value: 'question',
378
+ },
379
+ ],
380
+ },
381
+ ],
382
+ },
383
+ {
384
+ name: 'fieldset-without-label',
385
+ type: 'fieldset',
386
+ label: 'Fieldset without label',
387
+ options: {
388
+ isDynamic: true,
389
+ showTitle: false,
390
+ transformer: {
391
+ type: 'cql',
392
+ },
393
+ },
394
+ fields: [
395
+ {
396
+ name: 'inner-text',
397
+ type: 'string',
398
+ label: 'Search term',
399
+ },
400
+ ],
401
+ },
402
+ {
403
+ name: 'fieldset-jira-filter',
404
+ type: 'fieldset',
405
+ label: 'Issues filter',
406
+ options: {
407
+ isDynamic: true,
408
+ transformer: {
409
+ type: 'cql',
410
+ },
411
+ },
412
+ fields: [
413
+ {
414
+ name: 'keywords',
415
+ type: 'string',
416
+ label: 'Keywords',
417
+ },
418
+ {
419
+ name: 'project',
420
+ type: 'enum',
421
+ label: 'Project',
422
+ isRequired: false,
423
+ style: 'select',
424
+ items: [
425
+ {
426
+ label: 'Editor platform',
427
+ value: 'editor-platform',
428
+ },
429
+ {
430
+ label: 'Editor experiences',
431
+ value: 'editor-experiences',
432
+ },
433
+ ],
434
+ },
435
+ {
436
+ name: 'status',
437
+ type: 'enum',
438
+ label: 'Status',
439
+ isRequired: false,
440
+ style: 'select',
441
+ items: [
442
+ {
443
+ label: 'To do',
444
+ value: 'to-do',
445
+ },
446
+ {
447
+ label: 'In Progress',
448
+ value: 'in-progress',
449
+ },
450
+ {
451
+ label: 'Done',
452
+ value: 'Done',
453
+ },
454
+ ],
455
+ },
456
+ ],
457
+ },
458
+ {
459
+ name: 'expand field',
460
+ type: 'expand',
461
+ label: 'awesome expand field',
462
+ fields: [
463
+ {
464
+ name: 'enum-select-expand',
465
+ type: 'enum',
466
+ label: 'Select one',
467
+ isRequired: true,
468
+ description: 'Pick one',
469
+ style: 'select',
470
+ isMultiple: false,
471
+ placeholder: 'Selected option goes here',
472
+ items: [
473
+ { label: 'Option A', value: 'a' },
474
+ { label: 'Option B', value: 'b' },
475
+ ],
476
+ },
477
+ {
478
+ name: 'enum-select-icon-expand',
479
+ type: 'enum',
480
+ label: 'Select with icons',
481
+ description: 'Pick one',
482
+ style: 'select',
483
+ isMultiple: false,
484
+ items: [
485
+ {
486
+ label: 'Option A',
487
+ value: 'a',
488
+ description: 'Recommended',
489
+ },
490
+ {
491
+ label: 'Option B with a really really really really really really long label',
492
+ value: 'b',
493
+ description: 'One of the best options out there',
494
+ },
495
+ ],
496
+ },
497
+ ],
498
+ },
499
+ {
500
+ name: 'color-picker',
501
+ label: 'Color Picker',
502
+ type: 'color',
503
+ description: 'Pick your color',
504
+ defaultValue: '#7AB2FF',
505
+ },
506
+ {
507
+ name: 'color-picker-req',
508
+ label: 'Color Picker Required',
509
+ type: 'color',
510
+ isRequired: true,
511
+ description: 'Pick your color',
512
+ defaultValue: '#7AB2FF',
513
+ },
516
514
  ];
517
515
 
518
516
  export const customFields: FieldDefinition[] = [
519
- {
520
- name: 'custom-required',
521
- type: 'custom',
522
- label: 'Custom: Required',
523
- description: 'Select the option',
524
- isRequired: true,
525
- options: {
526
- resolver: {
527
- type: 'mock-resolver',
528
- },
529
- },
530
- },
531
- {
532
- name: 'custom-optional',
533
- type: 'custom',
534
- label: 'Custom: Optional',
535
- description: 'Select the option, maybe',
536
- options: {
537
- resolver: {
538
- type: 'mock-resolver',
539
- },
540
- },
541
- },
542
- {
543
- name: 'custom-required-create',
544
- type: 'custom',
545
- label: 'Custom: Create an option',
546
- description: 'Select or create an option',
547
- isRequired: true,
548
- options: {
549
- isCreatable: true,
550
- resolver: {
551
- type: 'mock-resolver',
552
- },
553
- },
554
- },
555
- {
556
- name: 'custom-create-multiple',
557
- type: 'custom',
558
- label: 'Custom: Create option(s)',
559
- description: 'Select or create option(s)',
560
- isMultiple: true,
561
- options: {
562
- isCreatable: true,
563
- resolver: {
564
- type: 'mock-resolver',
565
- },
566
- },
567
- },
568
- {
569
- name: 'custom-format-create-label',
570
- type: 'custom',
571
- label: 'Custom: Customized create label',
572
- description: 'Select or create an option with a custom label',
573
- options: {
574
- isCreatable: true,
575
- formatCreateLabel: (value: string) => {
576
- return `Add "${value}" to the list`;
577
- },
578
- resolver: {
579
- type: 'mock-resolver',
580
- },
581
- },
582
- },
583
- {
584
- name: 'unsupported',
585
- type: 'custom',
586
- label: 'Custom: Missing provider',
587
- options: {
588
- resolver: {
589
- type: 'missing-type',
590
- },
591
- },
592
- },
593
- {
594
- name: 'user-jdog',
595
- type: 'user',
596
- label: 'JDog User',
597
- options: {
598
- provider: {
599
- type: 'user-jdog-provider',
600
- },
601
- },
602
- },
603
- {
604
- name: 'user-jdog-required',
605
- type: 'user',
606
- label: 'JDog User (Required)',
607
- isRequired: true,
608
- options: {
609
- provider: {
610
- type: 'user-jdog-provider',
611
- },
612
- },
613
- },
614
- {
615
- name: 'user-jdog-multiple',
616
- type: 'user',
617
- label: 'JDog User (Multiple, Required)',
618
- isRequired: true,
619
- isMultiple: true,
620
- options: {
621
- provider: {
622
- type: 'user-jdog-provider',
623
- },
624
- },
625
- },
517
+ {
518
+ name: 'custom-required',
519
+ type: 'custom',
520
+ label: 'Custom: Required',
521
+ description: 'Select the option',
522
+ isRequired: true,
523
+ options: {
524
+ resolver: {
525
+ type: 'mock-resolver',
526
+ },
527
+ },
528
+ },
529
+ {
530
+ name: 'custom-optional',
531
+ type: 'custom',
532
+ label: 'Custom: Optional',
533
+ description: 'Select the option, maybe',
534
+ options: {
535
+ resolver: {
536
+ type: 'mock-resolver',
537
+ },
538
+ },
539
+ },
540
+ {
541
+ name: 'custom-required-create',
542
+ type: 'custom',
543
+ label: 'Custom: Create an option',
544
+ description: 'Select or create an option',
545
+ isRequired: true,
546
+ options: {
547
+ isCreatable: true,
548
+ resolver: {
549
+ type: 'mock-resolver',
550
+ },
551
+ },
552
+ },
553
+ {
554
+ name: 'custom-create-multiple',
555
+ type: 'custom',
556
+ label: 'Custom: Create option(s)',
557
+ description: 'Select or create option(s)',
558
+ isMultiple: true,
559
+ options: {
560
+ isCreatable: true,
561
+ resolver: {
562
+ type: 'mock-resolver',
563
+ },
564
+ },
565
+ },
566
+ {
567
+ name: 'custom-format-create-label',
568
+ type: 'custom',
569
+ label: 'Custom: Customized create label',
570
+ description: 'Select or create an option with a custom label',
571
+ options: {
572
+ isCreatable: true,
573
+ formatCreateLabel: (value: string) => {
574
+ return `Add "${value}" to the list`;
575
+ },
576
+ resolver: {
577
+ type: 'mock-resolver',
578
+ },
579
+ },
580
+ },
581
+ {
582
+ name: 'unsupported',
583
+ type: 'custom',
584
+ label: 'Custom: Missing provider',
585
+ options: {
586
+ resolver: {
587
+ type: 'missing-type',
588
+ },
589
+ },
590
+ },
591
+ {
592
+ name: 'user-jdog',
593
+ type: 'user',
594
+ label: 'JDog User',
595
+ options: {
596
+ provider: {
597
+ type: 'user-jdog-provider',
598
+ },
599
+ },
600
+ },
601
+ {
602
+ name: 'user-jdog-required',
603
+ type: 'user',
604
+ label: 'JDog User (Required)',
605
+ isRequired: true,
606
+ options: {
607
+ provider: {
608
+ type: 'user-jdog-provider',
609
+ },
610
+ },
611
+ },
612
+ {
613
+ name: 'user-jdog-multiple',
614
+ type: 'user',
615
+ label: 'JDog User (Multiple, Required)',
616
+ isRequired: true,
617
+ isMultiple: true,
618
+ options: {
619
+ provider: {
620
+ type: 'user-jdog-provider',
621
+ },
622
+ },
623
+ },
626
624
  ];