@adobe-commerce/aio-experience-kit 1.0.0 → 1.0.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 (63) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/README.md +197 -25
  3. package/dist/cjs/components/DataForm/FieldBuilder/index.js +184 -35
  4. package/dist/cjs/components/DataForm/FieldBuilder/index.js.map +1 -1
  5. package/dist/cjs/components/DataForm/FormBuilder/index.js +9 -7
  6. package/dist/cjs/components/DataForm/FormBuilder/index.js.map +1 -1
  7. package/dist/cjs/components/DataForm/FormBuilder/types.js +2 -0
  8. package/dist/cjs/components/DataForm/FormBuilder/types.js.map +1 -1
  9. package/dist/cjs/components/DataForm/index.js +4 -1
  10. package/dist/cjs/components/DataForm/index.js.map +1 -1
  11. package/dist/cjs/components/DataTable/index.js +4 -1
  12. package/dist/cjs/components/DataTable/index.js.map +1 -1
  13. package/dist/cjs/components/FileUpload/index.js +241 -0
  14. package/dist/cjs/components/FileUpload/index.js.map +1 -0
  15. package/dist/cjs/components/MainContainer/TwoColumnLeft/index.js +1 -1
  16. package/dist/cjs/components/MainContainer/TwoColumnLeft/index.js.map +1 -1
  17. package/dist/cjs/components/ShippingCarrierForm/index.js +143 -0
  18. package/dist/cjs/components/ShippingCarrierForm/index.js.map +1 -0
  19. package/dist/cjs/index.js +8 -4
  20. package/dist/cjs/index.js.map +1 -1
  21. package/dist/cjs/utils/AdminUiSdk/index.js +67 -97
  22. package/dist/cjs/utils/AdminUiSdk/index.js.map +1 -1
  23. package/dist/esm/components/DataForm/FieldBuilder/index.js +185 -36
  24. package/dist/esm/components/DataForm/FieldBuilder/index.js.map +1 -1
  25. package/dist/esm/components/DataForm/FormBuilder/index.js +9 -7
  26. package/dist/esm/components/DataForm/FormBuilder/index.js.map +1 -1
  27. package/dist/esm/components/DataForm/FormBuilder/types.js +2 -0
  28. package/dist/esm/components/DataForm/FormBuilder/types.js.map +1 -1
  29. package/dist/esm/components/DataForm/index.js +5 -2
  30. package/dist/esm/components/DataForm/index.js.map +1 -1
  31. package/dist/esm/components/DataTable/index.js +5 -2
  32. package/dist/esm/components/DataTable/index.js.map +1 -1
  33. package/dist/esm/components/FileUpload/index.js +237 -0
  34. package/dist/esm/components/FileUpload/index.js.map +1 -0
  35. package/dist/esm/components/MainContainer/TwoColumnLeft/index.js +1 -1
  36. package/dist/esm/components/MainContainer/TwoColumnLeft/index.js.map +1 -1
  37. package/dist/esm/components/ShippingCarrierForm/index.js +139 -0
  38. package/dist/esm/components/ShippingCarrierForm/index.js.map +1 -0
  39. package/dist/esm/index.js +2 -0
  40. package/dist/esm/index.js.map +1 -1
  41. package/dist/esm/types/components/DataForm/FieldBuilder/index.d.ts.map +1 -1
  42. package/dist/esm/types/components/DataForm/FormBuilder/index.d.ts.map +1 -1
  43. package/dist/esm/types/components/DataForm/FormBuilder/types.d.ts +2 -0
  44. package/dist/esm/types/components/DataForm/FormBuilder/types.d.ts.map +1 -1
  45. package/dist/esm/types/components/DataForm/index.d.ts.map +1 -1
  46. package/dist/esm/types/components/DataTable/index.d.ts.map +1 -1
  47. package/dist/esm/types/components/FileUpload/index.d.ts +8 -0
  48. package/dist/esm/types/components/FileUpload/index.d.ts.map +1 -0
  49. package/dist/esm/types/components/FileUpload/types.d.ts +71 -0
  50. package/dist/esm/types/components/FileUpload/types.d.ts.map +1 -0
  51. package/dist/esm/types/components/ShippingCarrierForm/index.d.ts +18 -0
  52. package/dist/esm/types/components/ShippingCarrierForm/index.d.ts.map +1 -0
  53. package/dist/esm/types/components/ShippingCarrierForm/types.d.ts +55 -0
  54. package/dist/esm/types/components/ShippingCarrierForm/types.d.ts.map +1 -0
  55. package/dist/esm/types/components/index.d.ts +10 -0
  56. package/dist/esm/types/components/index.d.ts.map +1 -1
  57. package/dist/esm/types/utils/AdminUiSdk/index.d.ts +17 -30
  58. package/dist/esm/types/utils/AdminUiSdk/index.d.ts.map +1 -1
  59. package/dist/esm/types/utils/AdminUiSdk/types.d.ts +9 -50
  60. package/dist/esm/types/utils/AdminUiSdk/types.d.ts.map +1 -1
  61. package/dist/esm/utils/AdminUiSdk/index.js +69 -99
  62. package/dist/esm/utils/AdminUiSdk/index.js.map +1 -1
  63. package/package.json +36 -35
package/CHANGELOG.md CHANGED
@@ -5,6 +5,96 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.2] - 2024-11-15
9
+
10
+ ### ✨ Added
11
+
12
+ - **[FileUpload](./src/components/FileUpload/index.tsx)** - New file upload component with React Spectrum FileTrigger integration
13
+ - Single and multiple file upload support with flexible file selection
14
+ - Drag and drop functionality for intuitive file handling
15
+ - File validation with type, size, and extension constraints
16
+ - Custom file rendering with progress tracking and preview support
17
+ - Async file processing with configurable callbacks for upload and removal
18
+ - Error handling with detailed validation messages
19
+ - Accessibility-first design with keyboard navigation and screen reader support
20
+ - Type-safe props with comprehensive TypeScript interfaces
21
+ - Full test coverage with component and user interaction testing
22
+
23
+ ### 🔧 Changed
24
+
25
+ - **[FieldBuilder](./src/components/DataForm/FieldBuilder/index.tsx)** - Enhanced TOGGLE field with contextual help support
26
+ - Added `contextualHelp` prop to TOGGLE field type for inline documentation
27
+ - Improved user guidance with tooltip-style help text
28
+ - Consistent help text rendering across all field types
29
+
30
+ - **[FieldBuilder](./src/components/DataForm/FieldBuilder/index.tsx)** - Improved MULTISELECT field array handling
31
+ - Enhanced array value parsing and storage for MULTISELECT fields
32
+ - Better handling of comma-separated string to array conversion
33
+ - Improved compatibility with backend data structures
34
+
35
+ - **[TwoColumnLeft](./src/components/MainContainer/TwoColumnLeft/index.tsx)** - Layout flexibility improvement
36
+ - Changed `height` to `minHeight` for better responsive behavior
37
+ - Allows content to expand naturally beyond minimum height
38
+ - Prevents layout issues with dynamic content
39
+
40
+ ### ⚠️ Deprecated
41
+
42
+ - **[ShippingCarrierForm](./src/components/ShippingCarrierForm/index.tsx)** - Component marked as deprecated
43
+ - Use `DataForm` component instead with custom field configuration
44
+ - Will be removed in v2.0.0
45
+ - Added deprecation notices to TypeScript interfaces and component
46
+
47
+ ### 🗑️ Removed
48
+
49
+ - **[AdminUiSdk](./src/utils/AdminUiSdk/index.ts)** - Removed menu and page registration methods
50
+ - Removed `addMenuSection()`, `addMenuItem()`, and `addPage()` methods
51
+ - Removed `getRegistration()` method and related types
52
+ - Removed `registerExtension()` method for UIX registration
53
+ - Simplified to only provide `getCredentials()` for Adobe IMS authentication
54
+ - Breaking change: Projects using registration methods must update to use Adobe UIX SDK directly
55
+ - Retained credential management functionality for backward compatibility
56
+
57
+ ## [1.0.1] - 2024-10-14
58
+
59
+ ### ✨ Added
60
+
61
+ - **[ShippingCarrierForm](./src/components/ShippingCarrierForm/index.tsx)** - New specialized form component for shipping carrier configuration
62
+ - Pre-configured fields for common shipping carrier attributes (code, title, active status)
63
+ - Multi-select support for stores and countries with scrollable option lists
64
+ - Toggle fields for tracking and shipping labels availability
65
+ - Built on top of DataForm with consistent validation and user experience
66
+ - Async-friendly API with loading states and lifecycle callbacks
67
+ - Type-safe props with comprehensive TypeScript interfaces
68
+
69
+ ### 🐛 Fixed
70
+
71
+ - **FormBuilder**: Resolved race condition when handling multiple toggle fields simultaneously
72
+ - **ESLint**: Resolved React hooks linting warnings across components
73
+
74
+ ### 🔧 Changed
75
+
76
+ - **[DataForm](./src/components/DataForm/index.tsx)** - Enhanced with new field types for richer form capabilities
77
+ - Added MULTISELECT field type with React Spectrum CheckboxGroup implementation
78
+ - Added TOGGLE field type with React Spectrum Switch component
79
+ - Array value handling for MULTISELECT with proper storage and retrieval
80
+ - Automatic '1'/'0' value handling for TOGGLE fields with backend compatibility
81
+ - Scrollable containers for multi-select options with automatic overflow handling
82
+ - Enhanced styling with proper spacing and visual hierarchy for new field types
83
+ - Full accessibility support with keyboard navigation for all field types
84
+ - Environment variable mode support for TOGGLE fields
85
+
86
+ - **[AdminUiSdk](./src/utils/AdminUiSdk/index.ts)** - Refactored to use registration-based approach for improved flexibility
87
+ - **ESLint**: Migrated to ESLint 9 flat config format for modern JavaScript tooling
88
+ - **FieldBuilder**: Improved import formatting and code spacing for better readability
89
+
90
+ ### 📚 Documentation
91
+
92
+ - Added comprehensive documentation for MULTISELECT and TOGGLE field types
93
+ - Updated README with ShippingCarrierForm component usage examples
94
+ - Enhanced field type documentation with code examples and use cases
95
+
96
+ ---
97
+
8
98
  ## [1.0.0] - 2024-12-19
9
99
 
10
100
  ### 🎉 Initial Release
package/README.md CHANGED
@@ -287,6 +287,46 @@ class EntityModel {
287
287
  label: 'Disabled'
288
288
  }
289
289
  ]
290
+ },
291
+ {
292
+ label: 'Categories',
293
+ code: 'categories',
294
+ db_field: 'categories',
295
+ type: FieldType.MULTISELECT,
296
+ required: false,
297
+ options: [
298
+ {
299
+ value: 'electronics',
300
+ label: 'Electronics'
301
+ },
302
+ {
303
+ value: 'clothing',
304
+ label: 'Clothing'
305
+ },
306
+ {
307
+ value: 'books',
308
+ label: 'Books'
309
+ },
310
+ {
311
+ value: 'home',
312
+ label: 'Home & Garden'
313
+ }
314
+ ]
315
+ },
316
+ {
317
+ label: 'Featured Product',
318
+ code: 'featured',
319
+ db_field: 'featured',
320
+ type: FieldType.TOGGLE,
321
+ required: false
322
+ },
323
+ {
324
+ label: 'Notifications',
325
+ code: 'notifications',
326
+ db_field: 'notifications',
327
+ type: FieldType.TOGGLE,
328
+ required: false,
329
+ use_env_var: true
290
330
  }
291
331
  ]
292
332
  }
@@ -296,9 +336,74 @@ class EntityModel {
296
336
  }
297
337
  ```
298
338
 
339
+ ##### Field Types
340
+
341
+ The DataForm component supports various field types for different input scenarios:
342
+
343
+ **Basic Input Fields:**
344
+ - `FieldType.TEXT` - Standard text input
345
+ - `FieldType.EMAIL` - Email input with validation
346
+ - `FieldType.PASSWORD` - Password input with masking
347
+ - `FieldType.NUMBER` - Numeric input with validation
348
+ - `FieldType.URL` - URL input with validation
349
+ - `FieldType.TEL` - Telephone number input
350
+ - `FieldType.SEARCH` - Search input with appropriate styling
351
+
352
+ **Selection Fields:**
353
+ - `FieldType.SELECT` - Single selection dropdown with options
354
+ - `FieldType.MULTISELECT` - Multiple selection with checkboxes in a scrollable container
355
+ - `FieldType.TOGGLE` - Boolean toggle switch with '1'/'0' values
356
+
357
+ **Display Fields:**
358
+ - `FieldType.LABEL` - Read-only display field for showing values
359
+
360
+ **Field Configuration Examples:**
361
+
362
+ ```javascript
363
+ // MULTISELECT field with scrollable options
364
+ {
365
+ label: 'Product Categories',
366
+ code: 'categories',
367
+ db_field: 'categories',
368
+ type: FieldType.MULTISELECT,
369
+ required: false,
370
+ options: [
371
+ { value: 'electronics', label: 'Electronics' },
372
+ { value: 'clothing', label: 'Clothing' },
373
+ { value: 'books', label: 'Books' },
374
+ { value: 'home', label: 'Home & Garden' },
375
+ // ... more options (automatically scrollable when many)
376
+ ]
377
+ }
378
+
379
+ // TOGGLE field with automatic default value
380
+ {
381
+ label: 'Enable Feature',
382
+ code: 'feature_enabled',
383
+ db_field: 'feature_enabled',
384
+ type: FieldType.TOGGLE,
385
+ required: false
386
+ // Automatically defaults to '0' if no value provided
387
+ // Returns '1' when enabled, '0' when disabled
388
+ }
389
+
390
+ // Field with environment variable support
391
+ {
392
+ label: 'API Endpoint',
393
+ code: 'api_endpoint',
394
+ db_field: 'api_endpoint',
395
+ type: FieldType.TEXT,
396
+ required: true,
397
+ use_env_var: true // Adds checkbox to use as environment variable
398
+ }
399
+ ```
400
+
299
401
  **Features:**
300
402
  - **Dynamic Form Generation**: Create complex forms from simple configuration objects without manual field creation
301
- - **Rich Field Types**: Support for text, email, password, number, select, and specialized input types
403
+ - **Rich Field Types**: Support for text, email, password, number, select, multiselect, toggle, and specialized input types
404
+ - **Multi-Selection Support**: MULTISELECT field type with React Spectrum CheckboxGroup for selecting multiple options with scrollable overflow and accessibility support
405
+ - **Toggle Controls**: TOGGLE field type using React Spectrum Switch component with '1'/'0' value handling and automatic default value initialization
406
+ - **Environment Variable Support**: Built-in support for environment variable checkboxes on compatible field types (TEXT, SELECT, MULTISELECT, TOGGLE)
302
407
  - **Intelligent Validation**: Built-in validation with custom rules, real-time feedback, and error messaging
303
408
  - **Workflow Integration**: Loading states, processing indicators, and navigation controls for multi-step workflows
304
409
  - **Organized Layout**: Logical field grouping with collapsible sections and intuitive information hierarchy
@@ -386,44 +491,100 @@ class EntityModel {
386
491
  - **Accessibility Excellence**: Full screen reader support, proper ARIA labels, and focus trap implementation
387
492
  - **Design Consistency**: Follows Adobe Spectrum design patterns for familiar user interactions
388
493
 
494
+ #### `FileUpload`
495
+
496
+ A flexible file upload component with file validation and automatic content reading. Built on React Spectrum's FileTrigger for consistent Adobe design patterns.
497
+
498
+ ```javascript
499
+ import React, { useState } from 'react';
500
+ import { View } from '@adobe/react-spectrum';
501
+ import { FileUpload } from '@adobe-commerce/aio-experience-kit';
502
+ import { ToastQueue } from '@react-spectrum/toast';
503
+
504
+ const DocumentUploader = () => {
505
+ const [isProcessing, setProcessing] = useState(false);
506
+
507
+ return (
508
+ <View>
509
+ <FileUpload
510
+ label="Upload Documents"
511
+ isRequired={true}
512
+ acceptedFileTypes={['application/pdf', '.doc', '.docx']}
513
+ allowsMultiple={true}
514
+ isDisabled={isProcessing}
515
+ onSelect={async (files) => {
516
+ setProcessing(true);
517
+ try {
518
+ // Process each file
519
+ } catch (error) {
520
+ ToastQueue.negative(`Upload failed: ${error.message}`, { timeout: 5000 });
521
+ } finally {
522
+ setProcessing(false);
523
+ }
524
+ }}
525
+ />
526
+ </View>
527
+ );
528
+ };
529
+ ```
530
+
531
+ **Features:**
532
+ - **File Selection**: Click to browse files with support for single or multiple file selection
533
+ - **Automatic Content Reading**: Automatically reads file content as text or base64 based on file type
534
+ - **File Type Validation**: Built-in validation for accepted MIME types and file extensions
535
+ - **Built-in Display**: Automatically displays selected files with name, size, and type information
536
+ - **Clear Functionality**: Built-in "Clear Files" link to remove selected files
537
+ - **Loading States**: Shows processing indicator while reading file contents
538
+ - **Error Handling**: Comprehensive error messaging for file reading failures
539
+ - **Accessibility**: Full keyboard navigation, screen reader support, and ARIA labels
540
+ - **Type Safety**: Complete TypeScript support with FileInfo interface for processed files
541
+
542
+ ---
543
+
389
544
  ### 🔧 Utils
390
545
 
391
546
  Utility functions and classes that simplify common tasks in Adobe Commerce extension development.
392
547
 
393
548
  #### `AdminUiSdk`
394
549
 
395
- A comprehensive utility class for registering Adobe Admin UI extensions with the Adobe UIX registry, managing menu items and page configurations.
550
+ A utility class for managing Adobe IMS credentials in Adobe Admin UI extensions. Provides secure access to authentication tokens and organization IDs for API calls.
396
551
 
397
- ```typescript
398
- import { AdminUiSdk } from '@adobe-commerce/aio-experience-kit';
552
+ > **Note**: As of v1.0.2, registration methods have been removed. Use the Adobe UIX SDK directly for extension registration.
399
553
 
400
- // Initialize the SDK
401
- const extensionId = 'my_admin_extension';
402
- const sdk = new AdminUiSdk(extensionId);
554
+ ##### Getting Adobe IMS Credentials
403
555
 
404
- // Add menu items
405
- sdk.addMenu({
406
- id: `${extensionId}::products`,
407
- title: 'Product Manager',
408
- parent: 'Magento_Catalog::catalog',
409
- sortOrder: 10
410
- });
556
+ Retrieve authentication credentials from the Adobe shared context:
411
557
 
412
- // Set page title
413
- sdk.addPage('Product Management Dashboard');
558
+ ```typescript
559
+ import { AdminUiSdk } from '@adobe-commerce/aio-experience-kit';
560
+
561
+ try {
562
+ const sdk = new AdminUiSdk('my_admin_extension');
414
563
 
415
- // Register with Adobe UIX
416
- await sdk.register();
564
+ const credentials = await sdk.getCredentials();
565
+
566
+ if (credentials.imsToken && credentials.imsOrgId) {
567
+ // Use credentials for API calls
568
+ const apiHeaders = {
569
+ 'Authorization': `Bearer ${credentials.imsToken}`,
570
+ 'x-gw-ims-org-id': credentials.imsOrgId
571
+ };
572
+
573
+ // Make authenticated API requests
574
+ } else {
575
+ console.log('Credentials not available');
576
+ }
577
+ } catch (error) {
578
+ console.error('Failed to get credentials:', error.message);
579
+ }
417
580
  ```
418
581
 
419
582
  **Features:**
420
- - **Menu Management**: Add and organize menu items with validation, duplicate prevention, and proper hierarchy
421
- - **Page Configuration**: Set custom page titles for extension interfaces with automatic registration
422
- - **Adobe UIX Integration**: Seamless registration with Adobe's extensibility platform using official APIs
423
- - **Input Validation**: Built-in sanitization, trimming, and validation for all configuration parameters
424
- - **Error Prevention**: Comprehensive error handling with meaningful messages for invalid configurations
583
+ - **Credential Management**: Secure access to Adobe IMS authentication tokens and organization IDs
584
+ - **Shared Context Access**: Retrieves credentials from Adobe's shared context using @adobe/uix-guest
585
+ - **Error Handling**: Comprehensive error handling for credential retrieval failures
425
586
  - **Type Safety**: Full TypeScript support with intelligent code completion and compile-time validation
426
- - **Production Ready**: Battle-tested utility used in real Adobe Commerce extensions with robust error handling
587
+ - **Production Ready**: Battle-tested utility used in real Adobe Commerce extensions
427
588
 
428
589
  #### `useRouteParams`
429
590
 
@@ -469,9 +630,20 @@ import type {
469
630
  DataTableProps,
470
631
  DataFormProps,
471
632
  ConfirmationDialogProps,
633
+ FileUploadProps,
634
+ FieldType,
472
635
  AdminUiSdkInterface,
473
- MenuItem
636
+ AdminUiSdkCredentials
474
637
  } from '@adobe-commerce/aio-experience-kit';
638
+
639
+ // Deprecated types (for backward compatibility only)
640
+ // These types are deprecated and will be removed in v2.0.0
641
+ // import type {
642
+ // ShippingCarrierFormProps,
643
+ // SelectOption,
644
+ // AdminUiSdkRegistration,
645
+ // MenuItem
646
+ // } from '@adobe-commerce/aio-experience-kit';
475
647
  ```
476
648
 
477
649
  ## License
@@ -9,7 +9,7 @@ var reactSpectrum = require('@adobe/react-spectrum');
9
9
  var types = require('../FormBuilder/types.js');
10
10
 
11
11
  var FieldBuilder = function FieldBuilder(_ref) {
12
- var _editItem$envName, _ref2, _editItem$field$db_fi;
12
+ var _editItem$envName;
13
13
  var field = _ref.field,
14
14
  editItem = _ref.editItem,
15
15
  onFieldChange = _ref.onFieldChange,
@@ -20,12 +20,32 @@ var FieldBuilder = function FieldBuilder(_ref) {
20
20
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
21
21
  isChecked = _useState2[0],
22
22
  setIsChecked = _useState2[1];
23
- var _useState3 = React.useState((_ref2 = (_editItem$field$db_fi = editItem[field.db_field]) !== null && _editItem$field$db_fi !== void 0 ? _editItem$field$db_fi : field.value) !== null && _ref2 !== void 0 ? _ref2 : null),
23
+ var _useState3 = React.useState(function () {
24
+ var _editItem$field$db_fi;
25
+ var initialValue = (_editItem$field$db_fi = editItem[field.db_field]) !== null && _editItem$field$db_fi !== void 0 ? _editItem$field$db_fi : field.value;
26
+ var defaultValue = initialValue !== null && initialValue !== void 0 ? initialValue : field.type === types.FieldType.TOGGLE ? '0' : null;
27
+ // Call onFieldChange for TOGGLE fields with default value
28
+ if (field.type === types.FieldType.TOGGLE && !initialValue && defaultValue === '0') {
29
+ // Use setTimeout to avoid calling during render
30
+ setTimeout(/*#__PURE__*/_rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee() {
31
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
32
+ while (1) switch (_context.n) {
33
+ case 0:
34
+ _context.n = 1;
35
+ return onFieldChange(field.code, field.db_field, '0');
36
+ case 1:
37
+ return _context.a(2);
38
+ }
39
+ }, _callee);
40
+ })), 0);
41
+ }
42
+ return defaultValue;
43
+ }),
24
44
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
25
45
  value = _useState4[0],
26
46
  setValue = _useState4[1];
27
47
  return jsxRuntime.jsx(reactSpectrum.View, {
28
- children: function (_field$required, _field$disabled, _field$contextualHelp, _field$contextualHelp2, _field$required2, _field$disabled2, _field$contextualHelp3) {
48
+ children: function (_field$required, _field$disabled, _field$contextualHelp, _field$required2, _field$disabled2, _field$contextualHelp2, _field$disabled3, _field$contextualHelp3, _field$contextualHelp4, _field$required3, _field$disabled4, _field$contextualHelp5) {
29
49
  switch (field.type) {
30
50
  case types.FieldType.SELECT:
31
51
  return jsxRuntime.jsxs(reactSpectrum.View, {
@@ -39,17 +59,17 @@ var FieldBuilder = function FieldBuilder(_ref) {
39
59
  defaultSelectedKey: value,
40
60
  width: "100%",
41
61
  onSelectionChange: function () {
42
- var _onSelectionChange = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee(value) {
43
- return _rollupPluginBabelHelpers.regenerator().w(function (_context) {
44
- while (1) switch (_context.n) {
62
+ var _onSelectionChange = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee2(value) {
63
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context2) {
64
+ while (1) switch (_context2.n) {
45
65
  case 0:
46
66
  setValue(value);
47
- _context.n = 1;
67
+ _context2.n = 1;
48
68
  return onFieldChange(field.code, field.db_field, value);
49
69
  case 1:
50
- return _context.a(2);
70
+ return _context2.a(2);
51
71
  }
52
- }, _callee);
72
+ }, _callee2);
53
73
  }));
54
74
  function onSelectionChange(_x) {
55
75
  return _onSelectionChange.apply(this, arguments);
@@ -67,17 +87,17 @@ var FieldBuilder = function FieldBuilder(_ref) {
67
87
  isRequired: false,
68
88
  defaultSelected: isChecked,
69
89
  onChange: function () {
70
- var _onChange = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee2(checked) {
71
- return _rollupPluginBabelHelpers.regenerator().w(function (_context2) {
72
- while (1) switch (_context2.n) {
90
+ var _onChange = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee3(checked) {
91
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context3) {
92
+ while (1) switch (_context3.n) {
73
93
  case 0:
74
94
  setIsChecked(checked);
75
- _context2.n = 1;
95
+ _context3.n = 1;
76
96
  return onFieldChange(envName, envName, checked);
77
97
  case 1:
78
- return _context2.a(2);
98
+ return _context3.a(2);
79
99
  }
80
- }, _callee2);
100
+ }, _callee3);
81
101
  }));
82
102
  function onChange(_x2) {
83
103
  return _onChange.apply(this, arguments);
@@ -87,13 +107,142 @@ var FieldBuilder = function FieldBuilder(_ref) {
87
107
  children: ["Use value as environment variable: ", value]
88
108
  }, envName) : null]
89
109
  });
110
+ case types.FieldType.MULTISELECT:
111
+ return jsxRuntime.jsxs(reactSpectrum.View, {
112
+ marginBottom: 'size-100',
113
+ children: [jsxRuntime.jsx(reactSpectrum.CheckboxGroup, {
114
+ label: field.label,
115
+ width: 'size-6000',
116
+ isRequired: (_field$required2 = field.required) !== null && _field$required2 !== void 0 ? _field$required2 : false,
117
+ isDisabled: isChecked || ((_field$disabled2 = field.disabled) !== null && _field$disabled2 !== void 0 ? _field$disabled2 : false),
118
+ contextualHelp: (_field$contextualHelp2 = field.contextualHelp) !== null && _field$contextualHelp2 !== void 0 ? _field$contextualHelp2 : null,
119
+ value: Array.isArray(value) ? value : [],
120
+ onChange: function () {
121
+ var _onChange2 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee4(selectedValues) {
122
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context4) {
123
+ while (1) switch (_context4.n) {
124
+ case 0:
125
+ setValue(selectedValues);
126
+ _context4.n = 1;
127
+ return onFieldChange(field.code, field.db_field, selectedValues);
128
+ case 1:
129
+ return _context4.a(2);
130
+ }
131
+ }, _callee4);
132
+ }));
133
+ function onChange(_x3) {
134
+ return _onChange2.apply(this, arguments);
135
+ }
136
+ return onChange;
137
+ }(),
138
+ children: jsxRuntime.jsx(reactSpectrum.View, {
139
+ borderWidth: 'thin',
140
+ borderColor: 'gray-600',
141
+ borderRadius: 'medium',
142
+ padding: 'size-100',
143
+ backgroundColor: 'static-white',
144
+ children: jsxRuntime.jsx(reactSpectrum.View, {
145
+ maxHeight: 'size-2400',
146
+ overflow: 'auto',
147
+ children: (field.options || []).map(function (option, index) {
148
+ return jsxRuntime.jsx(reactSpectrum.Checkbox, {
149
+ width: '100%',
150
+ value: option.value,
151
+ children: option.label
152
+ }, "".concat(field.code, "-").concat(index));
153
+ })
154
+ })
155
+ })
156
+ }, field.code), field.use_env_var !== undefined && field.use_env_var ? jsxRuntime.jsxs(reactSpectrum.Checkbox, {
157
+ name: envName,
158
+ value: '1',
159
+ isRequired: false,
160
+ defaultSelected: isChecked,
161
+ onChange: function () {
162
+ var _onChange3 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee5(checked) {
163
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context5) {
164
+ while (1) switch (_context5.n) {
165
+ case 0:
166
+ setIsChecked(checked);
167
+ _context5.n = 1;
168
+ return onFieldChange(envName, envName, checked);
169
+ case 1:
170
+ return _context5.a(2);
171
+ }
172
+ }, _callee5);
173
+ }));
174
+ function onChange(_x4) {
175
+ return _onChange3.apply(this, arguments);
176
+ }
177
+ return onChange;
178
+ }(),
179
+ children: ["Use value as environment variable:", ' ', Array.isArray(value) ? value.join(', ') : value]
180
+ }, envName) : null]
181
+ });
182
+ case types.FieldType.TOGGLE:
183
+ return jsxRuntime.jsxs(reactSpectrum.View, {
184
+ marginBottom: 'size-100',
185
+ children: [jsxRuntime.jsxs(reactSpectrum.Flex, {
186
+ gap: "size-100",
187
+ alignItems: "start",
188
+ children: [jsxRuntime.jsx(reactSpectrum.Switch, {
189
+ isDisabled: isChecked || ((_field$disabled3 = field.disabled) !== null && _field$disabled3 !== void 0 ? _field$disabled3 : false),
190
+ isSelected: value === '1',
191
+ onChange: function () {
192
+ var _onChange4 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee6(selected) {
193
+ var toggleValue;
194
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context6) {
195
+ while (1) switch (_context6.n) {
196
+ case 0:
197
+ toggleValue = selected ? '1' : '0';
198
+ setValue(toggleValue);
199
+ _context6.n = 1;
200
+ return onFieldChange(field.code, field.db_field, toggleValue);
201
+ case 1:
202
+ return _context6.a(2);
203
+ }
204
+ }, _callee6);
205
+ }));
206
+ function onChange(_x5) {
207
+ return _onChange4.apply(this, arguments);
208
+ }
209
+ return onChange;
210
+ }(),
211
+ children: field.label
212
+ }, field.code), (_field$contextualHelp3 = field.contextualHelp) !== null && _field$contextualHelp3 !== void 0 ? _field$contextualHelp3 : null]
213
+ }), field.use_env_var !== undefined && field.use_env_var ? jsxRuntime.jsxs(reactSpectrum.Checkbox, {
214
+ name: envName,
215
+ value: '1',
216
+ isRequired: false,
217
+ defaultSelected: isChecked,
218
+ onChange: function () {
219
+ var _onChange5 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee7(checked) {
220
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context7) {
221
+ while (1) switch (_context7.n) {
222
+ case 0:
223
+ setIsChecked(checked);
224
+ _context7.n = 1;
225
+ return onFieldChange(envName, envName, checked);
226
+ case 1:
227
+ return _context7.a(2);
228
+ }
229
+ }, _callee7);
230
+ }));
231
+ function onChange(_x6) {
232
+ return _onChange5.apply(this, arguments);
233
+ }
234
+ return onChange;
235
+ }(),
236
+ children: ["Use value as environment variable: ", value]
237
+ }, envName) : null]
238
+ });
90
239
  case types.FieldType.LABEL:
91
240
  return jsxRuntime.jsx(reactSpectrum.View, {
92
241
  marginBottom: 'size-100',
93
242
  children: jsxRuntime.jsx(reactSpectrum.LabeledValue, {
94
243
  label: field.label,
95
244
  value: value,
96
- contextualHelp: (_field$contextualHelp2 = field.contextualHelp) !== null && _field$contextualHelp2 !== void 0 ? _field$contextualHelp2 : null
245
+ contextualHelp: (_field$contextualHelp4 = field.contextualHelp) !== null && _field$contextualHelp4 !== void 0 ? _field$contextualHelp4 : null
97
246
  }, field.code)
98
247
  });
99
248
  case types.FieldType.TEXT:
@@ -110,26 +259,26 @@ var FieldBuilder = function FieldBuilder(_ref) {
110
259
  type: field.type,
111
260
  label: field.label,
112
261
  placeholder: usePlaceholder ? field.label : '',
113
- isRequired: (_field$required2 = field.required) !== null && _field$required2 !== void 0 ? _field$required2 : false,
114
- isDisabled: isChecked || ((_field$disabled2 = field.disabled) !== null && _field$disabled2 !== void 0 ? _field$disabled2 : false),
262
+ isRequired: (_field$required3 = field.required) !== null && _field$required3 !== void 0 ? _field$required3 : false,
263
+ isDisabled: isChecked || ((_field$disabled4 = field.disabled) !== null && _field$disabled4 !== void 0 ? _field$disabled4 : false),
115
264
  defaultValue: value,
116
- contextualHelp: (_field$contextualHelp3 = field.contextualHelp) !== null && _field$contextualHelp3 !== void 0 ? _field$contextualHelp3 : null,
265
+ contextualHelp: (_field$contextualHelp5 = field.contextualHelp) !== null && _field$contextualHelp5 !== void 0 ? _field$contextualHelp5 : null,
117
266
  width: "100%",
118
267
  onChange: function () {
119
- var _onChange2 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee3(value) {
120
- return _rollupPluginBabelHelpers.regenerator().w(function (_context3) {
121
- while (1) switch (_context3.n) {
268
+ var _onChange6 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee8(value) {
269
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context8) {
270
+ while (1) switch (_context8.n) {
122
271
  case 0:
123
272
  setValue(value);
124
- _context3.n = 1;
273
+ _context8.n = 1;
125
274
  return onFieldChange(field.code, field.db_field, value);
126
275
  case 1:
127
- return _context3.a(2);
276
+ return _context8.a(2);
128
277
  }
129
- }, _callee3);
278
+ }, _callee8);
130
279
  }));
131
- function onChange(_x3) {
132
- return _onChange2.apply(this, arguments);
280
+ function onChange(_x7) {
281
+ return _onChange6.apply(this, arguments);
133
282
  }
134
283
  return onChange;
135
284
  }()
@@ -139,20 +288,20 @@ var FieldBuilder = function FieldBuilder(_ref) {
139
288
  isRequired: false,
140
289
  defaultSelected: isChecked,
141
290
  onChange: function () {
142
- var _onChange3 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee4(checked) {
143
- return _rollupPluginBabelHelpers.regenerator().w(function (_context4) {
144
- while (1) switch (_context4.n) {
291
+ var _onChange7 = _rollupPluginBabelHelpers.asyncToGenerator(/*#__PURE__*/_rollupPluginBabelHelpers.regenerator().m(function _callee9(checked) {
292
+ return _rollupPluginBabelHelpers.regenerator().w(function (_context9) {
293
+ while (1) switch (_context9.n) {
145
294
  case 0:
146
295
  setIsChecked(checked);
147
- _context4.n = 1;
296
+ _context9.n = 1;
148
297
  return onFieldChange(envName, envName, checked);
149
298
  case 1:
150
- return _context4.a(2);
299
+ return _context9.a(2);
151
300
  }
152
- }, _callee4);
301
+ }, _callee9);
153
302
  }));
154
- function onChange(_x4) {
155
- return _onChange3.apply(this, arguments);
303
+ function onChange(_x8) {
304
+ return _onChange7.apply(this, arguments);
156
305
  }
157
306
  return onChange;
158
307
  }(),