@adobe-commerce/aio-experience-kit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +105 -0
- package/LICENSE +56 -0
- package/README.md +479 -0
- package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +341 -0
- package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/cjs/components/ConfirmationDialog/index.js +68 -0
- package/dist/cjs/components/ConfirmationDialog/index.js.map +1 -0
- package/dist/cjs/components/DataForm/FieldBuilder/index.js +168 -0
- package/dist/cjs/components/DataForm/FieldBuilder/index.js.map +1 -0
- package/dist/cjs/components/DataForm/FormBuilder/index.js +154 -0
- package/dist/cjs/components/DataForm/FormBuilder/index.js.map +1 -0
- package/dist/cjs/components/DataForm/FormBuilder/types.js +15 -0
- package/dist/cjs/components/DataForm/FormBuilder/types.js.map +1 -0
- package/dist/cjs/components/DataForm/index.js +93 -0
- package/dist/cjs/components/DataForm/index.js.map +1 -0
- package/dist/cjs/components/DataTable/ActionsBuilder/index.js +47 -0
- package/dist/cjs/components/DataTable/ActionsBuilder/index.js.map +1 -0
- package/dist/cjs/components/DataTable/GridBuilder/ActionMenuRenderer/index.js +117 -0
- package/dist/cjs/components/DataTable/GridBuilder/ActionMenuRenderer/index.js.map +1 -0
- package/dist/cjs/components/DataTable/GridBuilder/ButtonsRenderer/index.js +114 -0
- package/dist/cjs/components/DataTable/GridBuilder/ButtonsRenderer/index.js.map +1 -0
- package/dist/cjs/components/DataTable/GridBuilder/LinksRenderer/index.js +120 -0
- package/dist/cjs/components/DataTable/GridBuilder/LinksRenderer/index.js.map +1 -0
- package/dist/cjs/components/DataTable/GridBuilder/index.js +114 -0
- package/dist/cjs/components/DataTable/GridBuilder/index.js.map +1 -0
- package/dist/cjs/components/DataTable/index.js +158 -0
- package/dist/cjs/components/DataTable/index.js.map +1 -0
- package/dist/cjs/components/DataTable/types.js +12 -0
- package/dist/cjs/components/DataTable/types.js.map +1 -0
- package/dist/cjs/components/MainContainer/ContentBuilder/index.js +32 -0
- package/dist/cjs/components/MainContainer/ContentBuilder/index.js.map +1 -0
- package/dist/cjs/components/MainContainer/NavigationBuilder/Buttons/index.js +40 -0
- package/dist/cjs/components/MainContainer/NavigationBuilder/Buttons/index.js.map +1 -0
- package/dist/cjs/components/MainContainer/NavigationBuilder/Links/index.js +41 -0
- package/dist/cjs/components/MainContainer/NavigationBuilder/Links/index.js.map +1 -0
- package/dist/cjs/components/MainContainer/NavigationBuilder/index.js +37 -0
- package/dist/cjs/components/MainContainer/NavigationBuilder/index.js.map +1 -0
- package/dist/cjs/components/MainContainer/NavigationBuilder/types.js +11 -0
- package/dist/cjs/components/MainContainer/NavigationBuilder/types.js.map +1 -0
- package/dist/cjs/components/MainContainer/OneColumn/index.js +44 -0
- package/dist/cjs/components/MainContainer/OneColumn/index.js.map +1 -0
- package/dist/cjs/components/MainContainer/TitleBuilder/index.js +22 -0
- package/dist/cjs/components/MainContainer/TitleBuilder/index.js.map +1 -0
- package/dist/cjs/components/MainContainer/TwoColumnLeft/index.js +56 -0
- package/dist/cjs/components/MainContainer/TwoColumnLeft/index.js.map +1 -0
- package/dist/cjs/components/MainContainer/index.js +70 -0
- package/dist/cjs/components/MainContainer/index.js.map +1 -0
- package/dist/cjs/components/MainContainer/types.js +8 -0
- package/dist/cjs/components/MainContainer/types.js.map +1 -0
- package/dist/cjs/index.js +38 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/utils/AdminUiSdk/index.js +159 -0
- package/dist/cjs/utils/AdminUiSdk/index.js.map +1 -0
- package/dist/cjs/utils/RouteParams/index.js +29 -0
- package/dist/cjs/utils/RouteParams/index.js.map +1 -0
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +318 -0
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/esm/components/ConfirmationDialog/index.js +64 -0
- package/dist/esm/components/ConfirmationDialog/index.js.map +1 -0
- package/dist/esm/components/DataForm/FieldBuilder/index.js +164 -0
- package/dist/esm/components/DataForm/FieldBuilder/index.js.map +1 -0
- package/dist/esm/components/DataForm/FormBuilder/index.js +150 -0
- package/dist/esm/components/DataForm/FormBuilder/index.js.map +1 -0
- package/dist/esm/components/DataForm/FormBuilder/types.js +15 -0
- package/dist/esm/components/DataForm/FormBuilder/types.js.map +1 -0
- package/dist/esm/components/DataForm/index.js +89 -0
- package/dist/esm/components/DataForm/index.js.map +1 -0
- package/dist/esm/components/DataTable/ActionsBuilder/index.js +43 -0
- package/dist/esm/components/DataTable/ActionsBuilder/index.js.map +1 -0
- package/dist/esm/components/DataTable/GridBuilder/ActionMenuRenderer/index.js +113 -0
- package/dist/esm/components/DataTable/GridBuilder/ActionMenuRenderer/index.js.map +1 -0
- package/dist/esm/components/DataTable/GridBuilder/ButtonsRenderer/index.js +110 -0
- package/dist/esm/components/DataTable/GridBuilder/ButtonsRenderer/index.js.map +1 -0
- package/dist/esm/components/DataTable/GridBuilder/LinksRenderer/index.js +116 -0
- package/dist/esm/components/DataTable/GridBuilder/LinksRenderer/index.js.map +1 -0
- package/dist/esm/components/DataTable/GridBuilder/index.js +110 -0
- package/dist/esm/components/DataTable/GridBuilder/index.js.map +1 -0
- package/dist/esm/components/DataTable/index.js +154 -0
- package/dist/esm/components/DataTable/index.js.map +1 -0
- package/dist/esm/components/DataTable/types.js +12 -0
- package/dist/esm/components/DataTable/types.js.map +1 -0
- package/dist/esm/components/MainContainer/ContentBuilder/index.js +28 -0
- package/dist/esm/components/MainContainer/ContentBuilder/index.js.map +1 -0
- package/dist/esm/components/MainContainer/NavigationBuilder/Buttons/index.js +36 -0
- package/dist/esm/components/MainContainer/NavigationBuilder/Buttons/index.js.map +1 -0
- package/dist/esm/components/MainContainer/NavigationBuilder/Links/index.js +37 -0
- package/dist/esm/components/MainContainer/NavigationBuilder/Links/index.js.map +1 -0
- package/dist/esm/components/MainContainer/NavigationBuilder/index.js +33 -0
- package/dist/esm/components/MainContainer/NavigationBuilder/index.js.map +1 -0
- package/dist/esm/components/MainContainer/NavigationBuilder/types.js +11 -0
- package/dist/esm/components/MainContainer/NavigationBuilder/types.js.map +1 -0
- package/dist/esm/components/MainContainer/OneColumn/index.js +40 -0
- package/dist/esm/components/MainContainer/OneColumn/index.js.map +1 -0
- package/dist/esm/components/MainContainer/TitleBuilder/index.js +18 -0
- package/dist/esm/components/MainContainer/TitleBuilder/index.js.map +1 -0
- package/dist/esm/components/MainContainer/TwoColumnLeft/index.js +52 -0
- package/dist/esm/components/MainContainer/TwoColumnLeft/index.js.map +1 -0
- package/dist/esm/components/MainContainer/index.js +58 -0
- package/dist/esm/components/MainContainer/index.js.map +1 -0
- package/dist/esm/components/MainContainer/types.js +8 -0
- package/dist/esm/components/MainContainer/types.js.map +1 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/ConfirmationDialog/index.d.ts +12 -0
- package/dist/esm/types/components/ConfirmationDialog/index.d.ts.map +1 -0
- package/dist/esm/types/components/ConfirmationDialog/types.d.ts +47 -0
- package/dist/esm/types/components/ConfirmationDialog/types.d.ts.map +1 -0
- package/dist/esm/types/components/DataForm/FieldBuilder/index.d.ts +8 -0
- package/dist/esm/types/components/DataForm/FieldBuilder/index.d.ts.map +1 -0
- package/dist/esm/types/components/DataForm/FieldBuilder/types.d.ts +11 -0
- package/dist/esm/types/components/DataForm/FieldBuilder/types.d.ts.map +1 -0
- package/dist/esm/types/components/DataForm/FormBuilder/index.d.ts +8 -0
- package/dist/esm/types/components/DataForm/FormBuilder/index.d.ts.map +1 -0
- package/dist/esm/types/components/DataForm/FormBuilder/types.d.ts +51 -0
- package/dist/esm/types/components/DataForm/FormBuilder/types.d.ts.map +1 -0
- package/dist/esm/types/components/DataForm/index.d.ts +8 -0
- package/dist/esm/types/components/DataForm/index.d.ts.map +1 -0
- package/dist/esm/types/components/DataForm/types.d.ts +16 -0
- package/dist/esm/types/components/DataForm/types.d.ts.map +1 -0
- package/dist/esm/types/components/DataTable/ActionsBuilder/index.d.ts +8 -0
- package/dist/esm/types/components/DataTable/ActionsBuilder/index.d.ts.map +1 -0
- package/dist/esm/types/components/DataTable/ActionsBuilder/types.d.ts +12 -0
- package/dist/esm/types/components/DataTable/ActionsBuilder/types.d.ts.map +1 -0
- package/dist/esm/types/components/DataTable/GridBuilder/ActionMenuRenderer/index.d.ts +12 -0
- package/dist/esm/types/components/DataTable/GridBuilder/ActionMenuRenderer/index.d.ts.map +1 -0
- package/dist/esm/types/components/DataTable/GridBuilder/ButtonsRenderer/index.d.ts +12 -0
- package/dist/esm/types/components/DataTable/GridBuilder/ButtonsRenderer/index.d.ts.map +1 -0
- package/dist/esm/types/components/DataTable/GridBuilder/LinksRenderer/index.d.ts +12 -0
- package/dist/esm/types/components/DataTable/GridBuilder/LinksRenderer/index.d.ts.map +1 -0
- package/dist/esm/types/components/DataTable/GridBuilder/index.d.ts +8 -0
- package/dist/esm/types/components/DataTable/GridBuilder/index.d.ts.map +1 -0
- package/dist/esm/types/components/DataTable/GridBuilder/types.d.ts +15 -0
- package/dist/esm/types/components/DataTable/GridBuilder/types.d.ts.map +1 -0
- package/dist/esm/types/components/DataTable/index.d.ts +7 -0
- package/dist/esm/types/components/DataTable/index.d.ts.map +1 -0
- package/dist/esm/types/components/DataTable/types.d.ts +41 -0
- package/dist/esm/types/components/DataTable/types.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/ContentBuilder/index.d.ts +8 -0
- package/dist/esm/types/components/MainContainer/ContentBuilder/index.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/ContentBuilder/types.d.ts +11 -0
- package/dist/esm/types/components/MainContainer/ContentBuilder/types.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/Buttons/index.d.ts +7 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/Buttons/index.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/Buttons/types.d.ts +12 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/Buttons/types.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/Links/index.d.ts +7 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/Links/index.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/Links/types.d.ts +12 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/Links/types.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/index.d.ts +7 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/index.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/types.d.ts +21 -0
- package/dist/esm/types/components/MainContainer/NavigationBuilder/types.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/OneColumn/index.d.ts +7 -0
- package/dist/esm/types/components/MainContainer/OneColumn/index.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/OneColumn/types.d.ts +18 -0
- package/dist/esm/types/components/MainContainer/OneColumn/types.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/TitleBuilder/index.d.ts +9 -0
- package/dist/esm/types/components/MainContainer/TitleBuilder/index.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/TitleBuilder/types.d.ts +8 -0
- package/dist/esm/types/components/MainContainer/TitleBuilder/types.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/TwoColumnLeft/index.d.ts +7 -0
- package/dist/esm/types/components/MainContainer/TwoColumnLeft/index.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/TwoColumnLeft/types.d.ts +18 -0
- package/dist/esm/types/components/MainContainer/TwoColumnLeft/types.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/index.d.ts +10 -0
- package/dist/esm/types/components/MainContainer/index.d.ts.map +1 -0
- package/dist/esm/types/components/MainContainer/types.d.ts +23 -0
- package/dist/esm/types/components/MainContainer/types.d.ts.map +1 -0
- package/dist/esm/types/components/index.d.ts +19 -0
- package/dist/esm/types/components/index.d.ts.map +1 -0
- package/dist/esm/types/index.d.ts +6 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/utils/AdminUiSdk/index.d.ts +60 -0
- package/dist/esm/types/utils/AdminUiSdk/index.d.ts.map +1 -0
- package/dist/esm/types/utils/AdminUiSdk/types.d.ts +63 -0
- package/dist/esm/types/utils/AdminUiSdk/types.d.ts.map +1 -0
- package/dist/esm/types/utils/RouteParams/index.d.ts +14 -0
- package/dist/esm/types/utils/RouteParams/index.d.ts.map +1 -0
- package/dist/esm/types/utils/index.d.ts +7 -0
- package/dist/esm/types/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/AdminUiSdk/index.js +155 -0
- package/dist/esm/utils/AdminUiSdk/index.js.map +1 -0
- package/dist/esm/utils/RouteParams/index.js +24 -0
- package/dist/esm/utils/RouteParams/index.js.map +1 -0
- package/package.json +124 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2024-12-19
|
|
9
|
+
|
|
10
|
+
### 🎉 Initial Release
|
|
11
|
+
|
|
12
|
+
This is the first stable release of the **@adobe-commerce/aio-experience-kit** - a comprehensive TypeScript toolkit for building Adobe Commerce Admin UI extensions with React Spectrum components. This release provides production-ready components and utilities that integrate seamlessly with Adobe's I/O extensibility platform.
|
|
13
|
+
|
|
14
|
+
#### ⚛️ React Components
|
|
15
|
+
|
|
16
|
+
- **[MainContainer](./src/components/MainContainer/index.tsx)** `[Added]` - Foundational layout component for admin extensions
|
|
17
|
+
- Flexible layout options (OneColumn, TwoColumnLeft)
|
|
18
|
+
- Integrated navigation system (Links, Buttons)
|
|
19
|
+
- React Router integration with automatic route matching
|
|
20
|
+
- Responsive design with customizable spacing
|
|
21
|
+
- Built-in accessibility with keyboard navigation and screen reader support
|
|
22
|
+
- TypeScript interfaces for all props and configuration options
|
|
23
|
+
|
|
24
|
+
- **[DataTable](./src/components/DataTable/index.tsx)** `[Added]` - Advanced data grid with comprehensive features
|
|
25
|
+
- Sortable columns with intelligent data type handling
|
|
26
|
+
- Flexible selection (single/multiple) with visual feedback
|
|
27
|
+
- Mass actions system for bulk operations
|
|
28
|
+
- Contextual per-row actions (buttons, links, dropdown menus)
|
|
29
|
+
- Built-in loading states and empty state handling
|
|
30
|
+
- Performance optimized with efficient re-rendering
|
|
31
|
+
- Integration with backend APIs through configurable callbacks
|
|
32
|
+
|
|
33
|
+
- **[DataForm](./src/components/DataForm/index.tsx)** `[Added]` - Dynamic form builder with intelligent field generation
|
|
34
|
+
- Configuration-driven form creation from declarative objects
|
|
35
|
+
- Rich field types (text, email, password, number, select) with FieldType enum
|
|
36
|
+
- Built-in validation with real-time feedback and error messaging
|
|
37
|
+
- Loading states and processing indicators for async operations
|
|
38
|
+
- Field grouping with organized layout and collapsible sections
|
|
39
|
+
- Event-driven architecture with lifecycle hooks for business logic
|
|
40
|
+
- Toast notification integration for user feedback
|
|
41
|
+
|
|
42
|
+
- **[ConfirmationDialog](./src/components/ConfirmationDialog/index.tsx)** `[Added]` - Sophisticated modal dialog for critical decisions
|
|
43
|
+
- Customizable title, message, and button text for any scenario
|
|
44
|
+
- Multiple button variants (primary, secondary, negative) for action severity
|
|
45
|
+
- Keyboard navigation with escape key dismissal and tab order management
|
|
46
|
+
- Full accessibility with screen reader support and ARIA labels
|
|
47
|
+
- Adobe Spectrum design patterns for consistent user interactions
|
|
48
|
+
- Integration with DataTable for delete confirmations and bulk operations
|
|
49
|
+
|
|
50
|
+
#### 🔧 Utilities
|
|
51
|
+
|
|
52
|
+
- **[AdminUiSdk](./src/utils/AdminUiSdk/index.ts)** `[Added]` - Adobe UIX extension registration utility
|
|
53
|
+
- Menu item management with validation and duplicate prevention
|
|
54
|
+
- Page title configuration with automatic registration
|
|
55
|
+
- Seamless Adobe UIX integration using @adobe/uix-guest
|
|
56
|
+
- Input sanitization, trimming, and comprehensive validation
|
|
57
|
+
- Error prevention with meaningful messages for invalid configurations
|
|
58
|
+
- Type-safe API with intelligent code completion
|
|
59
|
+
- Production-ready utility used in real Adobe Commerce extensions
|
|
60
|
+
|
|
61
|
+
- **[useRouteParams](./src/utils/RouteParams/index.ts)** `[Added]` - React Router parameter and navigation hook
|
|
62
|
+
- Type-safe access to URL parameters with automatic inference
|
|
63
|
+
- Wrapped navigation function with programmatic routing
|
|
64
|
+
- Clean API that abstracts React Router complexity
|
|
65
|
+
- Seamless integration with React component lifecycle
|
|
66
|
+
- Built-in protection against navigation errors and invalid parameters
|
|
67
|
+
- Performance optimized with minimal re-renders
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 🛠️ **Development & Quality Assurance**
|
|
72
|
+
|
|
73
|
+
- **100% Component Coverage**: All components thoroughly tested with real-world scenarios
|
|
74
|
+
- **TypeScript First**: Full TypeScript implementation with strict configuration and comprehensive type definitions
|
|
75
|
+
- **Automated Quality Pipeline**:
|
|
76
|
+
- Pre-commit hooks with ESLint fixing and Prettier formatting
|
|
77
|
+
- Pre-push validation with type checking, linting, testing, and building
|
|
78
|
+
- Conventional commit message validation with commitlint
|
|
79
|
+
- **Modern Build System**: Rollup-based pipeline supporting ESM/CJS dual output with source maps
|
|
80
|
+
- **Comprehensive Documentation**: Detailed README with component examples, features, and usage patterns
|
|
81
|
+
- **Development Workflow**:
|
|
82
|
+
- Watch mode for development with hot reloading
|
|
83
|
+
- Automated validation pipeline preventing broken code
|
|
84
|
+
- Code quality enforcement with strict linting rules
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 🎯 **Key Features**
|
|
89
|
+
|
|
90
|
+
- **🎨 Adobe Design Consistency**: All components follow Adobe Spectrum design principles
|
|
91
|
+
- **⚡ Rapid Development**: Pre-built components reduce development time from weeks to days
|
|
92
|
+
- **🔒 Type Safety**: Full TypeScript support with comprehensive type definitions and intelligent code completion
|
|
93
|
+
- **♿ Accessibility First**: Built-in accessibility features with keyboard navigation and screen reader support
|
|
94
|
+
- **📱 Responsive Design**: Components automatically adapt to different screen sizes
|
|
95
|
+
- **🔧 Extensible Architecture**: Modular design allows for easy customization and extension
|
|
96
|
+
- **🧪 Production Ready**: Battle-tested components with 100% test coverage
|
|
97
|
+
- **📊 Performance Optimized**: Efficient rendering with minimal re-renders and optimized bundle size
|
|
98
|
+
- **🔄 Event-Driven**: Comprehensive callback system for custom business logic integration
|
|
99
|
+
- **🎯 Adobe UIX Integration**: Seamless registration and configuration for Adobe Commerce extensions
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
This release provides a solid foundation for Adobe Commerce Admin UI extension development with enterprise-grade components, comprehensive documentation, and production-ready tooling.
|
|
104
|
+
|
|
105
|
+
For detailed usage instructions and component documentation, please refer to the README.md and individual component source files.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
COMMERCIAL INTERNAL USE LICENSE
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Adobe Consulting Services, Commerce Team
|
|
4
|
+
|
|
5
|
+
GRANT OF LICENSE
|
|
6
|
+
|
|
7
|
+
Subject to the terms and conditions of this License, the copyright holders hereby
|
|
8
|
+
grant you a non-exclusive, non-transferable license to use, copy, modify, and
|
|
9
|
+
distribute this software and associated documentation files (the "Software") for
|
|
10
|
+
the following permitted purposes:
|
|
11
|
+
|
|
12
|
+
PERMITTED USES:
|
|
13
|
+
(a) Internal business operations and development activities;
|
|
14
|
+
(b) Client projects and commercial engagements;
|
|
15
|
+
(c) Integration with Adobe App Builder applications;
|
|
16
|
+
(d) Development, testing, and deployment of Adobe Commerce solutions;
|
|
17
|
+
(e) Consulting services and professional services engagements;
|
|
18
|
+
(f) Training and educational purposes within commercial contexts.
|
|
19
|
+
|
|
20
|
+
RESTRICTIONS:
|
|
21
|
+
(a) You may not redistribute the Software as a standalone product or library;
|
|
22
|
+
(b) You may not sublicense the Software to third parties for independent use;
|
|
23
|
+
(c) You may not remove or alter copyright notices and attribution;
|
|
24
|
+
(d) Public distribution of the source code requires explicit written permission;
|
|
25
|
+
(e) Any derivative works must maintain this license and attribution.
|
|
26
|
+
|
|
27
|
+
ATTRIBUTION REQUIREMENTS:
|
|
28
|
+
When using this Software in client projects or commercial engagements, you must:
|
|
29
|
+
(a) Retain all copyright notices in the source code;
|
|
30
|
+
(b) Include attribution in project documentation where applicable;
|
|
31
|
+
(c) Acknowledge the use of this toolkit in professional contexts as appropriate.
|
|
32
|
+
|
|
33
|
+
COMMERCIAL USE CLARIFICATION:
|
|
34
|
+
"Commercial use" explicitly includes but is not limited to:
|
|
35
|
+
(a) Client consulting projects and engagements;
|
|
36
|
+
(b) Adobe Commerce implementation services;
|
|
37
|
+
(c) Custom application development for clients;
|
|
38
|
+
(d) Training and professional services delivery;
|
|
39
|
+
(e) Integration services and solution development.
|
|
40
|
+
|
|
41
|
+
DISCLAIMER OF WARRANTY:
|
|
42
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
+
SOFTWARE.
|
|
49
|
+
|
|
50
|
+
TERMINATION:
|
|
51
|
+
This license is effective until terminated. Your rights under this license will
|
|
52
|
+
terminate automatically without notice if you fail to comply with any term(s) of
|
|
53
|
+
this license.
|
|
54
|
+
|
|
55
|
+
For questions regarding licensing terms or permissions beyond those granted herein,
|
|
56
|
+
please contact the copyright holders.
|
package/README.md
ADDED
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
# @adobe-commerce/aio-experience-kit
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
A TypeScript toolkit for building Adobe Commerce Admin UI extensions with React Spectrum components. This library provides production-ready components and utilities that integrate seamlessly with Adobe's I/O extensibility platform.
|
|
6
|
+
|
|
7
|
+
**Key Benefits:**
|
|
8
|
+
- **Rapid Development**: Pre-built components reduce development time from weeks to days
|
|
9
|
+
- **Adobe Design Consistency**: All components follow Adobe Spectrum design principles
|
|
10
|
+
- **Enterprise Ready**: Built-in accessibility, internationalization, and performance optimizations
|
|
11
|
+
- **Developer Experience**: Full TypeScript support with intelligent code completion
|
|
12
|
+
- **Extensible Architecture**: Modular design allows for easy customization and extension
|
|
13
|
+
- **Production Tested**: Battle-tested components used in real Adobe Commerce extensions
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install the TypeScript library with custom React components using React Spectrum:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @adobe-commerce/aio-experience-kit
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
The toolkit is organized into two main modules:
|
|
26
|
+
|
|
27
|
+
### ⚛️ React Components
|
|
28
|
+
|
|
29
|
+
A collection of specialized React components built on Adobe React Spectrum, designed for creating consistent and accessible admin interfaces.
|
|
30
|
+
|
|
31
|
+
#### `MainContainer`
|
|
32
|
+
|
|
33
|
+
The main layout component for Adobe Commerce admin extensions. Provides flexible layouts with integrated navigation, routing, and responsive design.
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import { MainContainer, LayoutOptions, NavigationOptions } from '@adobe-commerce/aio-experience-kit';
|
|
37
|
+
import { Text } from '@adobe/react-spectrum';
|
|
38
|
+
import HomeIcon from "@spectrum-icons/workflow/Home"
|
|
39
|
+
import BookIcon from "@spectrum-icons/workflow/Book"
|
|
40
|
+
|
|
41
|
+
const LibraryApp = (props) => {
|
|
42
|
+
const navigationButtons = [
|
|
43
|
+
{
|
|
44
|
+
label: "Home",
|
|
45
|
+
path: "/",
|
|
46
|
+
icon: <HomeIcon size={"S"} gridArea="Home" />
|
|
47
|
+
}, {
|
|
48
|
+
label: "Books",
|
|
49
|
+
path: "/book/grid",
|
|
50
|
+
icon: <BookIcon size={"S"} gridArea="Books" />
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
const appRoutes = [
|
|
55
|
+
{
|
|
56
|
+
paths: ['/'],
|
|
57
|
+
component: <Text>Home</Text>
|
|
58
|
+
}, {
|
|
59
|
+
paths: ['/book/:component/', '/book/:component/:id'],
|
|
60
|
+
component: <Text>Books</Text>
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<MainContainer
|
|
66
|
+
title="Library Application"
|
|
67
|
+
titleLevel={1}
|
|
68
|
+
buttons={navigationButtons}
|
|
69
|
+
routes={appRoutes}
|
|
70
|
+
navigation={NavigationOptions.NavigationButtons}
|
|
71
|
+
layout={LayoutOptions.OneColumn}
|
|
72
|
+
/>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Features:**
|
|
78
|
+
- **Flexible Layouts**: Choose between OneColumn for focused content or TwoColumnLeft for navigation-heavy interfaces
|
|
79
|
+
- **Smart Navigation**: Integrated navigation system supporting both link-based and button-based patterns
|
|
80
|
+
- **Routing Integration**: Seamless React Router integration with automatic route matching and component rendering
|
|
81
|
+
- **Responsive Design**: Automatically adapts to different screen sizes while maintaining usability
|
|
82
|
+
- **Customizable Spacing**: Fine-grained control over padding, margins, and component spacing
|
|
83
|
+
- **Accessibility First**: Built-in keyboard navigation, screen reader support, and focus management
|
|
84
|
+
|
|
85
|
+
#### `DataTable`
|
|
86
|
+
|
|
87
|
+
A powerful data grid component for displaying and managing tabular data with advanced features like sorting, selection, and bulk operations.
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
import React, { useState } from 'react';
|
|
91
|
+
import { View, ActionButton, Text } from '@adobe/react-spectrum';
|
|
92
|
+
import { DataTable, useRouteParams } from '@adobe-commerce/aio-experience-kit';
|
|
93
|
+
import AddCircle from '@spectrum-icons/workflow/AddCircle';
|
|
94
|
+
|
|
95
|
+
const EntityGrid = ({ actionCallHeaders }) => {
|
|
96
|
+
const { getNavigate } = useRouteParams();
|
|
97
|
+
const navigate = getNavigate();
|
|
98
|
+
|
|
99
|
+
const [isProcessing, setProcessing] = useState(false);
|
|
100
|
+
const [gridData, setGridData] = useState([]);
|
|
101
|
+
|
|
102
|
+
const entityModel = new EntityModel(actionCallHeaders);
|
|
103
|
+
const columns = entityModel.columns();
|
|
104
|
+
|
|
105
|
+
const buttons = [
|
|
106
|
+
<ActionButton
|
|
107
|
+
variant="primary"
|
|
108
|
+
type="button"
|
|
109
|
+
marginEnd="size-150"
|
|
110
|
+
isDisabled={isProcessing}
|
|
111
|
+
onPress={() => {
|
|
112
|
+
navigate('/entity/form');
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
<AddCircle gridArea="Create Entity" />
|
|
116
|
+
<Text>Create Entity</Text>
|
|
117
|
+
</ActionButton>
|
|
118
|
+
];
|
|
119
|
+
|
|
120
|
+
const gridActions = [
|
|
121
|
+
{ key: 'edit', text: 'Edit' },
|
|
122
|
+
{ key: 'delete', text: 'Delete' }
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
const massActions = [
|
|
126
|
+
{ key: 'delete', text: 'Delete' }
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<DataTable
|
|
131
|
+
columns={columns}
|
|
132
|
+
data={gridData}
|
|
133
|
+
buttons={buttons}
|
|
134
|
+
gridActions={gridActions}
|
|
135
|
+
massActions={massActions}
|
|
136
|
+
isProcessing={isProcessing}
|
|
137
|
+
onMassActionPress={async (key, ids) => {
|
|
138
|
+
switch (key) {
|
|
139
|
+
case 'delete':
|
|
140
|
+
// Process mass delete
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}}
|
|
144
|
+
onGridActionPress={async (key, item) => {
|
|
145
|
+
switch (key) {
|
|
146
|
+
case 'edit':
|
|
147
|
+
navigate(`/entity/form/${item.id}`);
|
|
148
|
+
break;
|
|
149
|
+
case 'delete':
|
|
150
|
+
// Process single delete
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}}
|
|
154
|
+
onGridLoad={async () => {
|
|
155
|
+
setGridData(await entityModel.list());
|
|
156
|
+
}}
|
|
157
|
+
/>
|
|
158
|
+
);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// Entity Model
|
|
162
|
+
class EntityModel {
|
|
163
|
+
constructor(actionCallHeaders) {
|
|
164
|
+
this.actionCallHeaders = actionCallHeaders;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async list() {
|
|
168
|
+
// Load data using API
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
columns() {
|
|
173
|
+
return [
|
|
174
|
+
{ name: 'Name', uid: 'name' },
|
|
175
|
+
{ name: 'Status', uid: 'status' },
|
|
176
|
+
{ name: 'Created At', uid: 'created_at' },
|
|
177
|
+
{ name: 'Updated At', uid: 'updated_at' },
|
|
178
|
+
{ name: 'Actions', uid: 'actions' }
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Features:**
|
|
185
|
+
- **Advanced Data Management**: Sortable columns with intelligent data type handling and custom sort functions
|
|
186
|
+
- **Flexible Selection**: Support for single-row selection or multi-row selection with visual feedback
|
|
187
|
+
- **Bulk Operations**: Mass action system for performing operations on multiple selected items
|
|
188
|
+
- **Contextual Actions**: Per-row actions with customizable button layouts, links, or dropdown menus
|
|
189
|
+
- **State Management**: Built-in loading states, empty state handling, and error boundary support
|
|
190
|
+
- **Performance Optimized**: Virtual scrolling for large datasets and efficient re-rendering
|
|
191
|
+
- **User Experience**: Intuitive interactions with hover states, keyboard navigation, and clear visual hierarchy
|
|
192
|
+
|
|
193
|
+
#### `DataForm`
|
|
194
|
+
|
|
195
|
+
A dynamic form builder that creates forms from configuration objects with built-in validation and multiple field types.
|
|
196
|
+
|
|
197
|
+
```javascript
|
|
198
|
+
import React, { useState } from 'react';
|
|
199
|
+
import { DataForm, useRouteParams, FieldType } from '@adobe-commerce/aio-experience-kit';
|
|
200
|
+
import { ToastQueue } from '@react-spectrum/toast';
|
|
201
|
+
|
|
202
|
+
const EntityForm = ({ actionCallHeaders, id = undefined }) => {
|
|
203
|
+
const entityModel = new EntityModel(actionCallHeaders);
|
|
204
|
+
|
|
205
|
+
const [formFields, setFormFields] = useState({});
|
|
206
|
+
const [editItem, setEditItem] = useState({});
|
|
207
|
+
|
|
208
|
+
const { getNavigate } = useRouteParams();
|
|
209
|
+
const navigate = getNavigate();
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<DataForm
|
|
213
|
+
components={formFields}
|
|
214
|
+
editItem={editItem}
|
|
215
|
+
onFormLoad={async () => {
|
|
216
|
+
// Load edit item first
|
|
217
|
+
let editItem = {};
|
|
218
|
+
if (id !== undefined) {
|
|
219
|
+
editItem = await entityModel.load(id);
|
|
220
|
+
setEditItem(editItem);
|
|
221
|
+
}
|
|
222
|
+
// Then load form fields
|
|
223
|
+
const formFields = entityModel.fields(editItem);
|
|
224
|
+
setFormFields(formFields);
|
|
225
|
+
}}
|
|
226
|
+
onFormSubmit={async (values) => {
|
|
227
|
+
try {
|
|
228
|
+
await entityModel.save(values);
|
|
229
|
+
ToastQueue.positive('Entity saved successfully', { timeout: 5000 });
|
|
230
|
+
} catch (e) {
|
|
231
|
+
ToastQueue.negative(e.message, { timeout: 5000 });
|
|
232
|
+
}
|
|
233
|
+
}}
|
|
234
|
+
onPostFormSubmit={() => {
|
|
235
|
+
navigate('/entity/grid');
|
|
236
|
+
}}
|
|
237
|
+
onBackPress={() => {
|
|
238
|
+
navigate('/entity/grid');
|
|
239
|
+
}}
|
|
240
|
+
/>
|
|
241
|
+
);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// Entity Model
|
|
245
|
+
class EntityModel {
|
|
246
|
+
constructor(actionCallHeaders) {
|
|
247
|
+
this.actionCallHeaders = actionCallHeaders;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async load(id) {
|
|
251
|
+
// Load entity using API
|
|
252
|
+
return {};
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
async save(formValues) {
|
|
256
|
+
// Save entity using API
|
|
257
|
+
return [];
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
fields(editItem) {
|
|
261
|
+
return {
|
|
262
|
+
groups: [
|
|
263
|
+
{
|
|
264
|
+
code: 'entity_settings',
|
|
265
|
+
label: 'Entity Settings',
|
|
266
|
+
fields: [
|
|
267
|
+
{
|
|
268
|
+
label: 'Name',
|
|
269
|
+
code: 'name',
|
|
270
|
+
db_field: 'name',
|
|
271
|
+
type: FieldType.TEXT,
|
|
272
|
+
required: true
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
label: 'Status',
|
|
276
|
+
code: 'status',
|
|
277
|
+
db_field: 'status',
|
|
278
|
+
type: FieldType.SELECT,
|
|
279
|
+
required: true,
|
|
280
|
+
options: [
|
|
281
|
+
{
|
|
282
|
+
value: '1',
|
|
283
|
+
label: 'Enabled'
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
value: '0',
|
|
287
|
+
label: 'Disabled'
|
|
288
|
+
}
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
**Features:**
|
|
300
|
+
- **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
|
|
302
|
+
- **Intelligent Validation**: Built-in validation with custom rules, real-time feedback, and error messaging
|
|
303
|
+
- **Workflow Integration**: Loading states, processing indicators, and navigation controls for multi-step workflows
|
|
304
|
+
- **Organized Layout**: Logical field grouping with collapsible sections and intuitive information hierarchy
|
|
305
|
+
- **Developer Friendly**: Event-driven architecture with lifecycle hooks for custom business logic integration
|
|
306
|
+
|
|
307
|
+
#### `ConfirmationDialog`
|
|
308
|
+
|
|
309
|
+
A modal dialog component for user confirmations with customizable actions and styling. Perfect for delete confirmations and critical user decisions.
|
|
310
|
+
|
|
311
|
+
```javascript
|
|
312
|
+
import React, { useState } from 'react';
|
|
313
|
+
import { View, ActionButton, Text } from '@adobe/react-spectrum';
|
|
314
|
+
import { DataTable, useRouteParams, ConfirmationDialog } from '@adobe-commerce/aio-experience-kit';
|
|
315
|
+
|
|
316
|
+
const EntityGrid = ({ actionCallHeaders }) => {
|
|
317
|
+
const { getNavigate } = useRouteParams();
|
|
318
|
+
const navigate = getNavigate();
|
|
319
|
+
const [isProcessing, setProcessing] = useState(false);
|
|
320
|
+
const [gridData, setGridData] = useState([]);
|
|
321
|
+
const [deleteMessage, setDeleteMessage] = useState('');
|
|
322
|
+
const [deleteKeys, setDeleteKeys] = useState([]);
|
|
323
|
+
|
|
324
|
+
const entityModel = new EntityModel(actionCallHeaders);
|
|
325
|
+
|
|
326
|
+
return (
|
|
327
|
+
<View>
|
|
328
|
+
<DataTable
|
|
329
|
+
// ... other DataTable props
|
|
330
|
+
onMassActionPress={async (key, ids) => {
|
|
331
|
+
switch (key) {
|
|
332
|
+
case 'delete':
|
|
333
|
+
setDeleteKeys(ids);
|
|
334
|
+
setDeleteMessage(`Are you sure you want to delete ${ids.length} selected items?`);
|
|
335
|
+
break;
|
|
336
|
+
}
|
|
337
|
+
}}
|
|
338
|
+
onGridActionPress={async (key, item) => {
|
|
339
|
+
switch (key) {
|
|
340
|
+
case 'delete':
|
|
341
|
+
setDeleteKeys([item.id]);
|
|
342
|
+
setDeleteMessage(`Are you sure you want to delete "${item.name}"?`);
|
|
343
|
+
break;
|
|
344
|
+
}
|
|
345
|
+
}}
|
|
346
|
+
/>
|
|
347
|
+
|
|
348
|
+
<ConfirmationDialog
|
|
349
|
+
title="Delete Dialog"
|
|
350
|
+
message={deleteMessage}
|
|
351
|
+
primaryButtonVariant="negative"
|
|
352
|
+
onDismiss={() => {
|
|
353
|
+
setDeleteMessage('');
|
|
354
|
+
}}
|
|
355
|
+
onSecondaryPress={() => {
|
|
356
|
+
setDeleteMessage('');
|
|
357
|
+
}}
|
|
358
|
+
onPrimaryPress={async () => {
|
|
359
|
+
setDeleteMessage('');
|
|
360
|
+
setProcessing(true);
|
|
361
|
+
setGridData(await entityModel.delete(deleteKeys));
|
|
362
|
+
setProcessing(false);
|
|
363
|
+
}}
|
|
364
|
+
/>
|
|
365
|
+
</View>
|
|
366
|
+
);
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// Entity Model
|
|
370
|
+
class EntityModel {
|
|
371
|
+
constructor(actionCallHeaders) {
|
|
372
|
+
this.actionCallHeaders = actionCallHeaders;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
async delete(itemIds = []) {
|
|
376
|
+
// Delete entity using API
|
|
377
|
+
return [];
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
**Features:**
|
|
383
|
+
- **Flexible Content**: Customizable title, message, and button text to match any confirmation scenario
|
|
384
|
+
- **Action Variants**: Support for different button styles (primary, secondary, negative) to indicate action severity
|
|
385
|
+
- **User Experience**: Intuitive keyboard navigation with escape key dismissal and tab order management
|
|
386
|
+
- **Accessibility Excellence**: Full screen reader support, proper ARIA labels, and focus trap implementation
|
|
387
|
+
- **Design Consistency**: Follows Adobe Spectrum design patterns for familiar user interactions
|
|
388
|
+
|
|
389
|
+
### 🔧 Utils
|
|
390
|
+
|
|
391
|
+
Utility functions and classes that simplify common tasks in Adobe Commerce extension development.
|
|
392
|
+
|
|
393
|
+
#### `AdminUiSdk`
|
|
394
|
+
|
|
395
|
+
A comprehensive utility class for registering Adobe Admin UI extensions with the Adobe UIX registry, managing menu items and page configurations.
|
|
396
|
+
|
|
397
|
+
```typescript
|
|
398
|
+
import { AdminUiSdk } from '@adobe-commerce/aio-experience-kit';
|
|
399
|
+
|
|
400
|
+
// Initialize the SDK
|
|
401
|
+
const extensionId = 'my_admin_extension';
|
|
402
|
+
const sdk = new AdminUiSdk(extensionId);
|
|
403
|
+
|
|
404
|
+
// Add menu items
|
|
405
|
+
sdk.addMenu({
|
|
406
|
+
id: `${extensionId}::products`,
|
|
407
|
+
title: 'Product Manager',
|
|
408
|
+
parent: 'Magento_Catalog::catalog',
|
|
409
|
+
sortOrder: 10
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
// Set page title
|
|
413
|
+
sdk.addPage('Product Management Dashboard');
|
|
414
|
+
|
|
415
|
+
// Register with Adobe UIX
|
|
416
|
+
await sdk.register();
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**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
|
|
425
|
+
- **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
|
|
427
|
+
|
|
428
|
+
#### `useRouteParams`
|
|
429
|
+
|
|
430
|
+
A React hook that provides a clean API for accessing React Router parameters and navigation functions.
|
|
431
|
+
|
|
432
|
+
```typescript
|
|
433
|
+
import { useRouteParams } from '@adobe-commerce/aio-experience-kit';
|
|
434
|
+
|
|
435
|
+
const ProductDetail = () => {
|
|
436
|
+
const { getParam, getNavigate } = useRouteParams();
|
|
437
|
+
|
|
438
|
+
const productId = getParam('id');
|
|
439
|
+
const navigate = getNavigate();
|
|
440
|
+
|
|
441
|
+
const handleBack = () => {
|
|
442
|
+
navigate('/products');
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
return (
|
|
446
|
+
<div>
|
|
447
|
+
<h1>Product {productId}</h1>
|
|
448
|
+
<button onClick={handleBack}>Back to Products</button>
|
|
449
|
+
</div>
|
|
450
|
+
);
|
|
451
|
+
};
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
**Features:**
|
|
455
|
+
- **Parameter Access**: Type-safe access to URL parameters with automatic type inference and null safety
|
|
456
|
+
- **Navigation Control**: Wrapped navigation function with programmatic routing and history management
|
|
457
|
+
- **Clean API**: Simplified interface that abstracts React Router complexity while maintaining full functionality
|
|
458
|
+
- **Hook Integration**: Seamless integration with React component lifecycle and state management patterns
|
|
459
|
+
- **Error Handling**: Built-in protection against navigation errors and invalid route parameters
|
|
460
|
+
- **Performance Optimized**: Efficient parameter extraction and navigation with minimal re-renders
|
|
461
|
+
|
|
462
|
+
## TypeScript Support
|
|
463
|
+
|
|
464
|
+
This library is built with TypeScript and provides comprehensive type definitions for all components and utilities. Import types as needed:
|
|
465
|
+
|
|
466
|
+
```typescript
|
|
467
|
+
import type {
|
|
468
|
+
MainContainerProps,
|
|
469
|
+
DataTableProps,
|
|
470
|
+
DataFormProps,
|
|
471
|
+
ConfirmationDialogProps,
|
|
472
|
+
AdminUiSdkInterface,
|
|
473
|
+
MenuItem
|
|
474
|
+
} from '@adobe-commerce/aio-experience-kit';
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## License
|
|
478
|
+
|
|
479
|
+
See the LICENSE file (in package) for license rights and limitations.
|