@wix/auto-patterns 1.38.0 → 1.40.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.
Files changed (30) hide show
  1. package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +72 -18
  2. package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
  3. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +41 -10
  4. package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  5. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js +50 -14
  6. package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -1
  7. package/dist/cjs/hooks/useActionCell.js +14 -8
  8. package/dist/cjs/hooks/useActionCell.js.map +1 -1
  9. package/dist/cjs/types/actions/actionCell.js.map +1 -1
  10. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +28 -10
  11. package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
  12. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +18 -6
  13. package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
  14. package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js +16 -6
  15. package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -1
  16. package/dist/esm/hooks/useActionCell.js +14 -8
  17. package/dist/esm/hooks/useActionCell.js.map +1 -1
  18. package/dist/esm/types/actions/actionCell.js.map +1 -1
  19. package/dist/types/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.d.ts +1 -1
  20. package/dist/types/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.d.ts.map +1 -1
  21. package/dist/types/components/AutoPatternsEntityPage/AutoPatternsEntityPage.d.ts.map +1 -1
  22. package/dist/types/components/AutoPatternsRoute/AutoPatternsPage.d.ts.map +1 -1
  23. package/dist/types/hooks/useActionCell.d.ts.map +1 -1
  24. package/dist/types/types/actions/actionCell.d.ts +13 -1
  25. package/dist/types/types/actions/actionCell.d.ts.map +1 -1
  26. package/mcp-docs/action_cell.md +66 -8
  27. package/mcp-docs/app_config_structure.md +50 -43
  28. package/mcp-docs/auto-patterns-guide.md +116 -51
  29. package/mcp-docs/wix_fqdn_custom_data_source.md +360 -196
  30. package/package.json +12 -12
@@ -248,52 +248,16 @@ export interface AppConfig {
248
248
  };
249
249
  actionCell?: {
250
250
  primaryAction?: {
251
- item: {
252
- id: string; // Unique identifier for the action
253
- type: 'update' | 'delete' | 'custom'; // Action type
254
- label?: string; // Text displayed for the action
255
- skin?: string; // Visual appearance of the action button (see Action Button Skin Values section)
256
- biName: string; // MANDATORY: Business intelligence name for analytics tracking
257
- disabled?: boolean; // Whether the action is disabled
258
- tooltip?: string; // Tooltip text shown on hover
259
- update?: { // Required when type is 'update'
260
- mode: 'page'; // Update mode
261
- page?: { // Required when mode is 'page'
262
- id: string; // Entity page ID to navigate to
263
- };
264
- };
265
- delete?: { // Required when type is 'delete'
266
- mode: 'modal'; // Currently only 'modal' is supported
267
- modal: {
268
- title?: {
269
- text: string; // Modal title
270
- };
271
- description?: {
272
- text: string; // Modal description
273
- };
274
- actions?: {
275
- submit?: {
276
- text: string; // Submit button text
277
- };
278
- cancel?: {
279
- text: string; // Cancel button text
280
- };
281
- };
282
- feedback?: {
283
- successToast?: {
284
- text: string; // Success message
285
- };
286
- errorToast?: {
287
- text: string; // Error message
288
- };
289
- };
290
- };
291
- };
292
- };
251
+ // Single primary action configuration
252
+ item: ActionItem;
293
253
  alwaysVisible?: boolean; // Whether to always show the primary action (not just on hover)
254
+ } | {
255
+ // Multiple primary actions configuration
256
+ items: ActionItem[];
257
+ alwaysVisible?: boolean; // Whether to always show the primary actions (not just on hover)
294
258
  };
295
259
  secondaryActions?: {
296
- items: {}[]; // Array of action configurations, same structure as primaryAction.item, can include dividers
260
+ items: ActionItem[]; // Array of action configurations, can include dividers
297
261
  inlineCount?: number; // How many secondary actions to show inline before showing popover
298
262
  inlineAlwaysVisible?: boolean; // Whether to always show inline actions (not just on hover)
299
263
  };
@@ -522,6 +486,49 @@ export interface AppConfig {
522
486
  }[];
523
487
  }
524
488
 
489
+ type ActionItem = {
490
+ id: string; // Unique identifier for the action
491
+ type: 'update' | 'delete' | 'custom'; // Action type
492
+ label?: string; // Text displayed for the action
493
+ skin?: string; // Visual appearance of the action button (see Action Button Skin Values section)
494
+ biName: string; // MANDATORY: Business intelligence name for analytics tracking
495
+ disabled?: boolean; // Whether the action is disabled
496
+ tooltip?: string; // Tooltip text shown on hover
497
+ update?: { // Required when type is 'update'
498
+ mode: 'page'; // Update mode
499
+ page?: { // Required when mode is 'page'
500
+ id: string; // Entity page ID to navigate to
501
+ };
502
+ };
503
+ delete?: { // Required when type is 'delete'
504
+ mode: 'modal'; // Currently only 'modal' is supported
505
+ modal: {
506
+ title?: {
507
+ text: string; // Modal title
508
+ };
509
+ description?: {
510
+ text: string; // Modal description
511
+ };
512
+ actions?: {
513
+ submit?: {
514
+ text: string; // Submit button text
515
+ };
516
+ cancel?: {
517
+ text: string; // Cancel button text
518
+ };
519
+ };
520
+ feedback?: {
521
+ successToast?: {
522
+ text: string; // Success message
523
+ };
524
+ errorToast?: {
525
+ text: string; // Error message
526
+ };
527
+ };
528
+ };
529
+ };
530
+ };
531
+
525
532
  type LayoutContent =
526
533
  | {
527
534
  type: 'field';
@@ -1607,12 +1614,54 @@ The ActionCell feature adds an interactive action column to collection tables or
1607
1614
 
1608
1615
  ## Placement and Structure
1609
1616
 
1610
- The ActionCell has a two-level structure:
1611
- * `primaryAction`: A single prominent action shown directly in the table/grid row
1617
+ The ActionCell has a flexible structure supporting both single and multiple primary actions:
1618
+ * `primaryAction`: Type: `ActionCellPrimaryAction | ActionCellPrimaryActions` - Can be either a single action or multiple actions shown directly in the table/grid row
1619
+ - **Single Primary Action** (`ActionCellPrimaryAction`): `{ item: ActionCellItemConfig, alwaysVisible?: boolean }`
1620
+ - **Multiple Primary Actions** (`ActionCellPrimaryActions`): `{ items: ActionCellItemConfig[], alwaysVisible?: boolean }`
1612
1621
  * `secondaryActions`: Additional actions shown in a dropdown menu
1613
1622
 
1614
1623
  Both properties are optional, but at least one should be provided for the ActionCell to be useful.
1615
1624
 
1625
+ ### Multiple Primary Actions
1626
+
1627
+ **New Feature**: Primary actions now support both single and multiple action configurations:
1628
+
1629
+ #### Single Primary Action Configuration
1630
+ ```json
1631
+ {
1632
+ "primaryAction": {
1633
+ "item": {
1634
+ "id": "editItem",
1635
+ "type": "update",
1636
+ "label": "Edit",
1637
+ "biName": "edit-item-action"
1638
+ },
1639
+ "alwaysVisible": false
1640
+ }
1641
+ }
1642
+ ```
1643
+
1644
+ #### Multiple Primary Actions Configuration
1645
+ ```json
1646
+ {
1647
+ "primaryAction": {
1648
+ "items": [
1649
+ {
1650
+ "id": "editItem",
1651
+ "type": "update",
1652
+ "label": "Edit"
1653
+ },
1654
+ {
1655
+ "id": "quickApprove",
1656
+ "type": "custom",
1657
+ "label": "Approve"
1658
+ }
1659
+ ],
1660
+ "alwaysVisible": true
1661
+ }
1662
+ }
1663
+ ```
1664
+
1616
1665
  ### Primary Action Visibility Control
1617
1666
 
1618
1667
  **New Feature**: Primary actions now support visibility control through the `alwaysVisible` property. By default, primary actions follow standard table interaction patterns (typically visible on hover), but you can configure them to be always visible for improved accessibility and user discovery.
@@ -1880,25 +1929,37 @@ Follow this decision process when implementing ActionCell:
1880
1929
  - Delete entities? → Use `delete` actions
1881
1930
  - Custom operations? → Use `custom` actions
1882
1931
 
1883
- 2. **Primary vs Secondary**: Choose the most common/important action as primary:
1884
- - Most common operation (typically Edit) → Place in `primaryAction.item`
1932
+ 2. **Primary vs Secondary**: Choose the most common/important actions as primary:
1933
+ - **Single Primary Action**: Most common operation (typically Edit) → Place in `primaryAction.item`
1934
+ - **Multiple Primary Actions**: 2-3 most common operations → Place in `primaryAction.items` array
1885
1935
  - Less common operations → Place in `secondaryActions.items` array
1886
1936
 
1887
- 3. **Primary Action Visibility Strategy**:
1937
+ 3. **Single vs Multiple Primary Actions**:
1938
+ - **Use Single Primary Action** when:
1939
+ - You have one dominant action (e.g., "Edit" for most entities)
1940
+ - Space is limited or you want a clean, minimal interface
1941
+ - The action is contextually obvious
1942
+ - **Use Multiple Primary Actions** when:
1943
+ - You have 2-3 equally important actions (e.g., "Edit", "Approve", "Reject")
1944
+ - Users frequently need to perform multiple actions in sequence
1945
+ - Actions are complementary and often used together
1946
+ - You want to reduce clicks by avoiding secondary menus
1947
+
1948
+ 4. **Primary Action Visibility Strategy**:
1888
1949
  - **Standard Visibility** (`alwaysVisible: false` or omitted): Use for most cases where actions appear on interaction
1889
1950
  - **Always Visible** (`alwaysVisible: true`): Use for critical actions that need constant visibility or when user discovery is important
1890
1951
 
1891
- 4. **Inline Secondary Actions Strategy**:
1952
+ 5. **Inline Secondary Actions Strategy**:
1892
1953
  - **Action Prioritization**: Order `secondaryActions.items` by frequency of use (most used first)
1893
1954
  - **Inline Count**: Use `inlineCount: 1-3` for optimal UX (avoid cluttering)
1894
1955
  - **Visibility Control**:
1895
1956
  - Use `inlineAlwaysVisible: false` (default) for cleaner visual appearance
1896
1957
  - Use `inlineAlwaysVisible: true` only for critical actions requiring constant visibility
1897
1958
 
1898
- 5. **Update Action Mode**:
1959
+ 6. **Update Action Mode**:
1899
1960
  - Complex, full-entity edits → Use `mode: "page"` to navigate to entity page
1900
1961
 
1901
- 6. **Custom Implementation**:
1962
+ 7. **Custom Implementation**:
1902
1963
  - For `custom` actions, you must provide implementations in your code and register them with `AutoPatternsOverridesProvider`
1903
1964
 
1904
1965
  ### ActionCell Validation Checklist
@@ -1912,8 +1973,12 @@ AI agents should verify these requirements before generating ActionCell configur
1912
1973
  ✓ Delete action has a modal configuration
1913
1974
  ✓ Custom actions match implementations in overrides
1914
1975
  ✓ At least one of `primaryAction` or `secondaryActions` is provided
1976
+ ✓ Primary action configuration is valid (Type: `ActionCellPrimaryAction | ActionCellPrimaryActions`):
1977
+ - Single primary action (`ActionCellPrimaryAction`): `{ item: ActionCellItemConfig, alwaysVisible?: boolean }`
1978
+ - Multiple primary actions (`ActionCellPrimaryActions`): `{ items: ActionCellItemConfig[], alwaysVisible?: boolean }`
1915
1979
  ✓ `alwaysVisible` property on primary actions (if specified) is a boolean value
1916
1980
  ✓ Primary action visibility is properly considered for UX (use `alwaysVisible: true` for critical actions)
1981
+ ✓ Multiple primary actions are limited to 2-3 actions for optimal UX
1917
1982
  ✓ `inlineCount` (if specified) is a non-negative number ≤ total secondary actions count
1918
1983
  ✓ `inlineAlwaysVisible` (if specified) is a boolean value
1919
1984
  ✓ Inline secondary actions configuration is applied only when secondary actions exist