@cratis/components 4.24.0 → 4.25.1

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 (201) hide show
  1. package/compat-manifest.json +11 -11
  2. package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
  3. package/dist/esm/CommandDialog/CommandDialog.js +1 -1
  4. package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
  5. package/dist/esm/Common/CratisComponentsProvider.d.ts +2 -0
  6. package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
  7. package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
  8. package/dist/esm/ConfigurationEditor/ConfigurationDestination.d.ts +13 -0
  9. package/dist/esm/ConfigurationEditor/ConfigurationDestination.d.ts.map +1 -0
  10. package/dist/esm/ConfigurationEditor/ConfigurationDestination.js +4 -0
  11. package/dist/esm/ConfigurationEditor/ConfigurationDestination.js.map +1 -0
  12. package/dist/esm/ConfigurationEditor/ConfigurationEditor.d.ts +27 -0
  13. package/dist/esm/ConfigurationEditor/ConfigurationEditor.d.ts.map +1 -0
  14. package/dist/esm/ConfigurationEditor/ConfigurationEditor.js +13 -0
  15. package/dist/esm/ConfigurationEditor/ConfigurationEditor.js.map +1 -0
  16. package/dist/esm/ConfigurationEditor/ConfigurationEditorPartAttributes.d.ts +6 -0
  17. package/dist/esm/ConfigurationEditor/ConfigurationEditorPartAttributes.d.ts.map +1 -0
  18. package/dist/esm/ConfigurationEditor/ConfigurationEditorPartAttributes.js +4 -0
  19. package/dist/esm/ConfigurationEditor/ConfigurationEditorPartAttributes.js.map +1 -0
  20. package/dist/esm/ConfigurationEditor/ConfigurationEditorProvider.d.ts +28 -0
  21. package/dist/esm/ConfigurationEditor/ConfigurationEditorProvider.d.ts.map +1 -0
  22. package/dist/esm/ConfigurationEditor/ConfigurationEditorProvider.js +16 -0
  23. package/dist/esm/ConfigurationEditor/ConfigurationEditorProvider.js.map +1 -0
  24. package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderProps.d.ts +20 -0
  25. package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderProps.d.ts.map +1 -0
  26. package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderProps.js +4 -0
  27. package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderProps.js.map +1 -0
  28. package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderer.d.ts +5 -0
  29. package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderer.d.ts.map +1 -0
  30. package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderer.js +4 -0
  31. package/dist/esm/ConfigurationEditor/ConfigurationEditorRenderer.js.map +1 -0
  32. package/dist/esm/ConfigurationEditor/ConfigurationIconReference.d.ts +17 -0
  33. package/dist/esm/ConfigurationEditor/ConfigurationIconReference.d.ts.map +1 -0
  34. package/dist/esm/ConfigurationEditor/ConfigurationIconReference.js +4 -0
  35. package/dist/esm/ConfigurationEditor/ConfigurationIconReference.js.map +1 -0
  36. package/dist/esm/ConfigurationEditor/OrderedItem.d.ts +16 -0
  37. package/dist/esm/ConfigurationEditor/OrderedItem.d.ts.map +1 -0
  38. package/dist/esm/ConfigurationEditor/OrderedItem.js +4 -0
  39. package/dist/esm/ConfigurationEditor/OrderedItem.js.map +1 -0
  40. package/dist/esm/ConfigurationEditor/OrderedItemCapabilities.d.ts +23 -0
  41. package/dist/esm/ConfigurationEditor/OrderedItemCapabilities.d.ts.map +1 -0
  42. package/dist/esm/ConfigurationEditor/OrderedItemCapabilities.js +4 -0
  43. package/dist/esm/ConfigurationEditor/OrderedItemCapabilities.js.map +1 -0
  44. package/dist/esm/ConfigurationEditor/OrderedItemDestinationField.d.ts +22 -0
  45. package/dist/esm/ConfigurationEditor/OrderedItemDestinationField.d.ts.map +1 -0
  46. package/dist/esm/ConfigurationEditor/OrderedItemDestinationField.js +23 -0
  47. package/dist/esm/ConfigurationEditor/OrderedItemDestinationField.js.map +1 -0
  48. package/dist/esm/ConfigurationEditor/OrderedItemEditor.d.ts +74 -0
  49. package/dist/esm/ConfigurationEditor/OrderedItemEditor.d.ts.map +1 -0
  50. package/dist/esm/ConfigurationEditor/OrderedItemEditor.js +188 -0
  51. package/dist/esm/ConfigurationEditor/OrderedItemEditor.js.map +1 -0
  52. package/dist/esm/ConfigurationEditor/OrderedItemEditorParts.d.ts +43 -0
  53. package/dist/esm/ConfigurationEditor/OrderedItemEditorParts.d.ts.map +1 -0
  54. package/dist/esm/ConfigurationEditor/OrderedItemEditorParts.js +4 -0
  55. package/dist/esm/ConfigurationEditor/OrderedItemEditorParts.js.map +1 -0
  56. package/dist/esm/ConfigurationEditor/OrderedItemField.d.ts +3 -0
  57. package/dist/esm/ConfigurationEditor/OrderedItemField.d.ts.map +1 -0
  58. package/dist/esm/ConfigurationEditor/OrderedItemField.js +4 -0
  59. package/dist/esm/ConfigurationEditor/OrderedItemField.js.map +1 -0
  60. package/dist/esm/ConfigurationEditor/OrderedItemFieldAccess.d.ts +9 -0
  61. package/dist/esm/ConfigurationEditor/OrderedItemFieldAccess.d.ts.map +1 -0
  62. package/dist/esm/ConfigurationEditor/OrderedItemFieldAccess.js +4 -0
  63. package/dist/esm/ConfigurationEditor/OrderedItemFieldAccess.js.map +1 -0
  64. package/dist/esm/ConfigurationEditor/OrderedItemIconField.d.ts +32 -0
  65. package/dist/esm/ConfigurationEditor/OrderedItemIconField.d.ts.map +1 -0
  66. package/dist/esm/ConfigurationEditor/OrderedItemIconField.js +26 -0
  67. package/dist/esm/ConfigurationEditor/OrderedItemIconField.js.map +1 -0
  68. package/dist/esm/ConfigurationEditor/OrderedItemIconFieldProps.d.ts +26 -0
  69. package/dist/esm/ConfigurationEditor/OrderedItemIconFieldProps.d.ts.map +1 -0
  70. package/dist/esm/ConfigurationEditor/OrderedItemIconFieldProps.js +4 -0
  71. package/dist/esm/ConfigurationEditor/OrderedItemIconFieldProps.js.map +1 -0
  72. package/dist/esm/ConfigurationEditor/OrderedItemLabels.d.ts +47 -0
  73. package/dist/esm/ConfigurationEditor/OrderedItemLabels.d.ts.map +1 -0
  74. package/dist/esm/ConfigurationEditor/OrderedItemLabels.js +4 -0
  75. package/dist/esm/ConfigurationEditor/OrderedItemLabels.js.map +1 -0
  76. package/dist/esm/ConfigurationEditor/OrderedItemOperation.d.ts +3 -0
  77. package/dist/esm/ConfigurationEditor/OrderedItemOperation.d.ts.map +1 -0
  78. package/dist/esm/ConfigurationEditor/OrderedItemOperation.js +4 -0
  79. package/dist/esm/ConfigurationEditor/OrderedItemOperation.js.map +1 -0
  80. package/dist/esm/ConfigurationEditor/OrderedItemProposal.d.ts +45 -0
  81. package/dist/esm/ConfigurationEditor/OrderedItemProposal.d.ts.map +1 -0
  82. package/dist/esm/ConfigurationEditor/OrderedItemProposal.js +4 -0
  83. package/dist/esm/ConfigurationEditor/OrderedItemProposal.js.map +1 -0
  84. package/dist/esm/ConfigurationEditor/OrderedItemRow.d.ts +5 -0
  85. package/dist/esm/ConfigurationEditor/OrderedItemRow.d.ts.map +1 -0
  86. package/dist/esm/ConfigurationEditor/OrderedItemRow.js +59 -0
  87. package/dist/esm/ConfigurationEditor/OrderedItemRow.js.map +1 -0
  88. package/dist/esm/ConfigurationEditor/OrderedItemRowProps.d.ts +43 -0
  89. package/dist/esm/ConfigurationEditor/OrderedItemRowProps.d.ts.map +1 -0
  90. package/dist/esm/ConfigurationEditor/OrderedItemRowProps.js +4 -0
  91. package/dist/esm/ConfigurationEditor/OrderedItemRowProps.js.map +1 -0
  92. package/dist/esm/ConfigurationEditor/OrderedItemValidation.d.ts +7 -0
  93. package/dist/esm/ConfigurationEditor/OrderedItemValidation.d.ts.map +1 -0
  94. package/dist/esm/ConfigurationEditor/OrderedItemValidation.js +4 -0
  95. package/dist/esm/ConfigurationEditor/OrderedItemValidation.js.map +1 -0
  96. package/dist/esm/ConfigurationEditor/PropertyChangeProposal.d.ts +15 -0
  97. package/dist/esm/ConfigurationEditor/PropertyChangeProposal.d.ts.map +1 -0
  98. package/dist/esm/ConfigurationEditor/PropertyChangeProposal.js +4 -0
  99. package/dist/esm/ConfigurationEditor/PropertyChangeProposal.js.map +1 -0
  100. package/dist/esm/ConfigurationEditor/PropertyChoice.d.ts +8 -0
  101. package/dist/esm/ConfigurationEditor/PropertyChoice.d.ts.map +1 -0
  102. package/dist/esm/ConfigurationEditor/PropertyChoice.js +4 -0
  103. package/dist/esm/ConfigurationEditor/PropertyChoice.js.map +1 -0
  104. package/dist/esm/ConfigurationEditor/PropertyControl.d.ts +17 -0
  105. package/dist/esm/ConfigurationEditor/PropertyControl.d.ts.map +1 -0
  106. package/dist/esm/ConfigurationEditor/PropertyControl.js +88 -0
  107. package/dist/esm/ConfigurationEditor/PropertyControl.js.map +1 -0
  108. package/dist/esm/ConfigurationEditor/PropertyControls.d.ts +40 -0
  109. package/dist/esm/ConfigurationEditor/PropertyControls.d.ts.map +1 -0
  110. package/dist/esm/ConfigurationEditor/PropertyControls.js +41 -0
  111. package/dist/esm/ConfigurationEditor/PropertyControls.js.map +1 -0
  112. package/dist/esm/ConfigurationEditor/PropertyControlsLabels.d.ts +18 -0
  113. package/dist/esm/ConfigurationEditor/PropertyControlsLabels.d.ts.map +1 -0
  114. package/dist/esm/ConfigurationEditor/PropertyControlsLabels.js +4 -0
  115. package/dist/esm/ConfigurationEditor/PropertyControlsLabels.js.map +1 -0
  116. package/dist/esm/ConfigurationEditor/PropertyControlsParts.d.ts +31 -0
  117. package/dist/esm/ConfigurationEditor/PropertyControlsParts.d.ts.map +1 -0
  118. package/dist/esm/ConfigurationEditor/PropertyControlsParts.js +4 -0
  119. package/dist/esm/ConfigurationEditor/PropertyControlsParts.js.map +1 -0
  120. package/dist/esm/ConfigurationEditor/PropertyDescriptor.d.ts +55 -0
  121. package/dist/esm/ConfigurationEditor/PropertyDescriptor.d.ts.map +1 -0
  122. package/dist/esm/ConfigurationEditor/PropertyDescriptor.js +4 -0
  123. package/dist/esm/ConfigurationEditor/PropertyDescriptor.js.map +1 -0
  124. package/dist/esm/ConfigurationEditor/PropertyGroup.d.ts +16 -0
  125. package/dist/esm/ConfigurationEditor/PropertyGroup.d.ts.map +1 -0
  126. package/dist/esm/ConfigurationEditor/PropertyGroup.js +4 -0
  127. package/dist/esm/ConfigurationEditor/PropertyGroup.js.map +1 -0
  128. package/dist/esm/ConfigurationEditor/defaultOrderedItemLabels.d.ts +4 -0
  129. package/dist/esm/ConfigurationEditor/defaultOrderedItemLabels.d.ts.map +1 -0
  130. package/dist/esm/ConfigurationEditor/defaultOrderedItemLabels.js +25 -0
  131. package/dist/esm/ConfigurationEditor/defaultOrderedItemLabels.js.map +1 -0
  132. package/dist/esm/ConfigurationEditor/defaultPropertyControlsLabels.d.ts +4 -0
  133. package/dist/esm/ConfigurationEditor/defaultPropertyControlsLabels.d.ts.map +1 -0
  134. package/dist/esm/ConfigurationEditor/defaultPropertyControlsLabels.js +12 -0
  135. package/dist/esm/ConfigurationEditor/defaultPropertyControlsLabels.js.map +1 -0
  136. package/dist/esm/ConfigurationEditor/index.d.ts +32 -0
  137. package/dist/esm/ConfigurationEditor/index.d.ts.map +1 -0
  138. package/dist/esm/ConfigurationEditor/index.js +7 -0
  139. package/dist/esm/ConfigurationEditor/index.js.map +1 -0
  140. package/dist/esm/ConfigurationEditor/moveOrderedItem.d.ts +5 -0
  141. package/dist/esm/ConfigurationEditor/moveOrderedItem.d.ts.map +1 -0
  142. package/dist/esm/ConfigurationEditor/moveOrderedItem.js +9 -0
  143. package/dist/esm/ConfigurationEditor/moveOrderedItem.js.map +1 -0
  144. package/dist/esm/ConfigurationEditor/resolveOrderedItemDropIndex.d.ts +10 -0
  145. package/dist/esm/ConfigurationEditor/resolveOrderedItemDropIndex.d.ts.map +1 -0
  146. package/dist/esm/ConfigurationEditor/resolveOrderedItemDropIndex.js +7 -0
  147. package/dist/esm/ConfigurationEditor/resolveOrderedItemDropIndex.js.map +1 -0
  148. package/dist/esm/ConfigurationEditor/resolveOrderedItemFieldAccess.d.ts +6 -0
  149. package/dist/esm/ConfigurationEditor/resolveOrderedItemFieldAccess.d.ts.map +1 -0
  150. package/dist/esm/ConfigurationEditor/resolveOrderedItemFieldAccess.js +4 -0
  151. package/dist/esm/ConfigurationEditor/resolveOrderedItemFieldAccess.js.map +1 -0
  152. package/dist/esm/ConfigurationEditor/resolveOrderedItemLabels.d.ts +4 -0
  153. package/dist/esm/ConfigurationEditor/resolveOrderedItemLabels.d.ts.map +1 -0
  154. package/dist/esm/ConfigurationEditor/resolveOrderedItemLabels.js +13 -0
  155. package/dist/esm/ConfigurationEditor/resolveOrderedItemLabels.js.map +1 -0
  156. package/dist/esm/ConfigurationEditor/validateOrderedItem.d.ts +18 -0
  157. package/dist/esm/ConfigurationEditor/validateOrderedItem.d.ts.map +1 -0
  158. package/dist/esm/ConfigurationEditor/validateOrderedItem.js +21 -0
  159. package/dist/esm/ConfigurationEditor/validateOrderedItem.js.map +1 -0
  160. package/dist/esm/Toolbar/ToolbarButton.d.ts +4 -1
  161. package/dist/esm/Toolbar/ToolbarButton.d.ts.map +1 -1
  162. package/dist/esm/Toolbar/ToolbarButton.js +12 -2
  163. package/dist/esm/Toolbar/ToolbarButton.js.map +1 -1
  164. package/dist/esm/Toolbar/ToolbarDrawerContext.d.ts +13 -0
  165. package/dist/esm/Toolbar/ToolbarDrawerContext.d.ts.map +1 -0
  166. package/dist/esm/Toolbar/ToolbarDrawerContext.js +7 -0
  167. package/dist/esm/Toolbar/ToolbarDrawerContext.js.map +1 -0
  168. package/dist/esm/Toolbar/ToolbarDrawerItem.d.ts +23 -0
  169. package/dist/esm/Toolbar/ToolbarDrawerItem.d.ts.map +1 -0
  170. package/dist/esm/Toolbar/ToolbarDrawerItem.js +4 -0
  171. package/dist/esm/Toolbar/ToolbarDrawerItem.js.map +1 -0
  172. package/dist/esm/Toolbar/ToolbarDrawerPlacement.d.ts +57 -0
  173. package/dist/esm/Toolbar/ToolbarDrawerPlacement.d.ts.map +1 -0
  174. package/dist/esm/Toolbar/ToolbarDrawerPlacement.js +51 -0
  175. package/dist/esm/Toolbar/ToolbarDrawerPlacement.js.map +1 -0
  176. package/dist/esm/Toolbar/ToolbarDrawerTile.d.ts +43 -0
  177. package/dist/esm/Toolbar/ToolbarDrawerTile.d.ts.map +1 -0
  178. package/dist/esm/Toolbar/ToolbarDrawerTile.js +31 -0
  179. package/dist/esm/Toolbar/ToolbarDrawerTile.js.map +1 -0
  180. package/dist/esm/Toolbar/ToolbarFolder.d.ts +51 -5
  181. package/dist/esm/Toolbar/ToolbarFolder.d.ts.map +1 -1
  182. package/dist/esm/Toolbar/ToolbarFolder.js +109 -10
  183. package/dist/esm/Toolbar/ToolbarFolder.js.map +1 -1
  184. package/dist/esm/Toolbar/ToolbarFolderPresentation.d.ts +8 -0
  185. package/dist/esm/Toolbar/ToolbarFolderPresentation.d.ts.map +1 -0
  186. package/dist/esm/Toolbar/ToolbarFolderPresentation.js +4 -0
  187. package/dist/esm/Toolbar/ToolbarFolderPresentation.js.map +1 -0
  188. package/dist/esm/Toolbar/index.d.ts +2 -0
  189. package/dist/esm/Toolbar/index.d.ts.map +1 -1
  190. package/dist/esm/configuration/CratisComponentsDefaults.d.ts.map +1 -1
  191. package/dist/esm/configuration/CratisComponentsDefaults.js +1 -0
  192. package/dist/esm/configuration/CratisComponentsDefaults.js.map +1 -1
  193. package/dist/esm/styles.ConfigurationEditor.css +710 -0
  194. package/dist/esm/styles.IconPicker.css +5 -0
  195. package/dist/esm/styles.Toolbar.css +174 -0
  196. package/dist/esm/styles.css +425 -0
  197. package/dist/esm/types/parts.d.ts +41 -1
  198. package/dist/esm/types/parts.d.ts.map +1 -1
  199. package/dist/esm/types/parts.js +41 -1
  200. package/dist/esm/types/parts.js.map +1 -1
  201. package/package.json +6 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConfigurationIconReference.js","sourceRoot":"","sources":["../../../ConfigurationEditor/ConfigurationIconReference.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * A qualified, renderer-neutral reference to one icon. Labels, display names, CSS classes, markup\n * and catalog order are never identity: two references are the same icon when `library`, `key` and\n * `variant` all match.\n *\n * The shape is structural, so a host can pass the reference its icon library produces straight\n * through without conversion.\n */\nexport interface ConfigurationIconReference {\n /** Stable identity of the icon library the icon belongs to. */\n library: string;\n\n /** Stable identity of the icon inside its library. */\n key: string;\n\n /** Optional style variant of the icon. */\n variant?: string;\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import type { ConfigurationIconReference } from './ConfigurationIconReference.js';
2
+ /**
3
+ * One entry of an ordered collection, such as an item of a navigation component. Hosts extend this
4
+ * with their own properties; the editor carries them through every proposal unchanged.
5
+ */
6
+ export interface OrderedItem {
7
+ /** Stable identity that survives rename and reorder. Assigned by the host, never by the editor. */
8
+ id: string;
9
+ /** Localizable text shown for the item. */
10
+ label: string;
11
+ /** The item's icon, if it has one. */
12
+ icon?: ConfigurationIconReference;
13
+ /** The id of the item's {@link ConfigurationDestination}, if it has one. */
14
+ destination?: string;
15
+ }
16
+ //# sourceMappingURL=OrderedItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItem.d.ts","sourceRoot":"","sources":["../../../ConfigurationEditor/OrderedItem.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAA8B,CAAC;AAE/E;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,mGAAmG;IACnG,EAAE,EAAE,MAAM,CAAC;IAEX,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IAEd,sCAAsC;IACtC,IAAI,CAAC,EAAE,0BAA0B,CAAC;IAElC,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ export {};
4
+ //# sourceMappingURL=OrderedItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItem.js","sourceRoot":"","sources":["../../../ConfigurationEditor/OrderedItem.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ConfigurationIconReference } from './ConfigurationIconReference';\n\n/**\n * One entry of an ordered collection, such as an item of a navigation component. Hosts extend this\n * with their own properties; the editor carries them through every proposal unchanged.\n */\nexport interface OrderedItem {\n /** Stable identity that survives rename and reorder. Assigned by the host, never by the editor. */\n id: string;\n\n /** Localizable text shown for the item. */\n label: string;\n\n /** The item's icon, if it has one. */\n icon?: ConfigurationIconReference;\n\n /** The id of the item's {@link ConfigurationDestination}, if it has one. */\n destination?: string;\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import type { OrderedItemField } from './OrderedItemField.js';
2
+ import type { OrderedItemFieldAccess } from './OrderedItemFieldAccess.js';
3
+ import type { OrderedItemOperation } from './OrderedItemOperation.js';
4
+ /**
5
+ * What the host allows on the collection. The editor enforces it twice: a restricted control is not
6
+ * offered, and a proposal for a restricted operation or field is never emitted. The host stays
7
+ * responsible for authoritative permission checks, persistence and template resolution.
8
+ */
9
+ export interface OrderedItemCapabilities {
10
+ /** Whether items can be added. */
11
+ add: boolean;
12
+ /** Whether items can be removed. */
13
+ remove: boolean;
14
+ /** Whether items can be reordered. */
15
+ reorder: boolean;
16
+ /** Access to each field. A field that is left out is hidden. */
17
+ fields: Partial<Record<OrderedItemField, OrderedItemFieldAccess>>;
18
+ /** The most items the collection may hold. Adding is unavailable once it is reached. */
19
+ maxItems?: number;
20
+ /** Why an operation or field is restricted. Shown as text next to the restricted control. */
21
+ reasons?: Partial<Record<OrderedItemOperation | OrderedItemField, string>>;
22
+ }
23
+ //# sourceMappingURL=OrderedItemCapabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItemCapabilities.d.ts","sourceRoot":"","sources":["../../../ConfigurationEditor/OrderedItemCapabilities.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAAwB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACpC,kCAAkC;IAClC,GAAG,EAAE,OAAO,CAAC;IAEb,oCAAoC;IACpC,MAAM,EAAE,OAAO,CAAC;IAEhB,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IAEjB,gEAAgE;IAChE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAElE,wFAAwF;IACxF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,6FAA6F;IAC7F,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,GAAG,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;CAC9E"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ export {};
4
+ //# sourceMappingURL=OrderedItemCapabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItemCapabilities.js","sourceRoot":"","sources":["../../../ConfigurationEditor/OrderedItemCapabilities.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { OrderedItemField } from './OrderedItemField';\nimport type { OrderedItemFieldAccess } from './OrderedItemFieldAccess';\nimport type { OrderedItemOperation } from './OrderedItemOperation';\n\n/**\n * What the host allows on the collection. The editor enforces it twice: a restricted control is not\n * offered, and a proposal for a restricted operation or field is never emitted. The host stays\n * responsible for authoritative permission checks, persistence and template resolution.\n */\nexport interface OrderedItemCapabilities {\n /** Whether items can be added. */\n add: boolean;\n\n /** Whether items can be removed. */\n remove: boolean;\n\n /** Whether items can be reordered. */\n reorder: boolean;\n\n /** Access to each field. A field that is left out is hidden. */\n fields: Partial<Record<OrderedItemField, OrderedItemFieldAccess>>;\n\n /** The most items the collection may hold. Adding is unavailable once it is reached. */\n maxItems?: number;\n\n /** Why an operation or field is restricted. Shown as text next to the restricted control. */\n reasons?: Partial<Record<OrderedItemOperation | OrderedItemField, string>>;\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import type { ConfigurationDestination } from './ConfigurationDestination.js';
2
+ import type { OrderedItem } from './OrderedItem.js';
3
+ import type { OrderedItemEditorParts } from './OrderedItemEditorParts.js';
4
+ import type { OrderedItemLabels } from './OrderedItemLabels.js';
5
+ interface DestinationFieldProps<TItem extends OrderedItem> {
6
+ item: TItem;
7
+ editable: boolean;
8
+ itemName: string;
9
+ labels: Required<OrderedItemLabels>;
10
+ destinations: ReadonlyArray<ConfigurationDestination>;
11
+ message: string | undefined;
12
+ messageId: string;
13
+ parts: OrderedItemEditorParts | undefined;
14
+ onChange: (destination: string | undefined) => void;
15
+ }
16
+ /**
17
+ * The destination field of one item: a select over the host's destinations, or the destination's
18
+ * name as text. A destination the host no longer lists stays selectable-as-current and is flagged.
19
+ */
20
+ export declare const OrderedItemDestinationField: <TItem extends OrderedItem>({ item, editable, itemName, labels, destinations, message, messageId, parts, onChange, }: DestinationFieldProps<TItem>) => import("react").JSX.Element;
21
+ export {};
22
+ //# sourceMappingURL=OrderedItemDestinationField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItemDestinationField.d.ts","sourceRoot":"","sources":["../../../ConfigurationEditor/OrderedItemDestinationField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,+BAA4B,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAe,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAE7D,UAAU,qBAAqB,CAAC,KAAK,SAAS,WAAW;IACrD,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IACpC,YAAY,EAAE,aAAa,CAAC,wBAAwB,CAAC,CAAC;IACtD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC1C,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CACvD;AAYD;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GAAI,KAAK,SAAS,WAAW,4FAUlE,qBAAqB,CAAC,KAAK,CAAC,gCAgD9B,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+
3
+ const groupDestinations = (destinations) => {
4
+ const ungrouped = destinations.filter((destination) => !destination.group);
5
+ const groups = new Map();
6
+ for (const destination of destinations) {
7
+ if (!destination.group)
8
+ continue;
9
+ groups.set(destination.group, [...(groups.get(destination.group) ?? []), destination]);
10
+ }
11
+ return { ungrouped, groups };
12
+ };
13
+ const OrderedItemDestinationField = ({ item, editable, itemName, labels, destinations, message, messageId, parts, onChange, }) => {
14
+ const current = destinations.find((destination) => destination.id === item.destination);
15
+ const missing = item.destination !== undefined && current === undefined;
16
+ const feedback = message ?? (missing ? labels.destinationUnavailable : undefined);
17
+ const accessibleName = `${labels.destinationField}: ${itemName}`;
18
+ const { ungrouped, groups } = groupDestinations(destinations);
19
+ return (jsxs("div", { className: 'cratis-ordered-item__destination', children: [editable ? (jsxs("select", { ...parts?.destination, value: item.destination ?? '', "aria-label": accessibleName, "aria-invalid": feedback ? true : undefined, "aria-describedby": feedback ? messageId : undefined, onChange: (event) => onChange(event.target.value === '' ? undefined : event.target.value), className: `cratis-ordered-item__input ${parts?.destination?.className ?? ''}`, "data-cratis-part": 'destination', "data-control": 'destination', "data-invalid": feedback ? true : undefined, children: [jsx("option", { value: '', children: labels.noDestination }), missing && jsx("option", { value: item.destination, children: labels.destinationUnavailable }), ungrouped.map((destination) => (jsx("option", { value: destination.id, children: destination.label }, destination.id))), [...groups.entries()].map(([group, members]) => (jsx("optgroup", { label: group, children: members.map((destination) => (jsx("option", { value: destination.id, children: destination.label }, destination.id))) }, group)))] })) : (jsxs("span", { className: 'cratis-ordered-item__text', "data-control": 'destination', children: [jsxs("span", { className: 'cratis-ordered-item__hidden', children: [accessibleName, ": "] }), current ? current.label : labels.noDestination] })), feedback && (jsx("p", { ...parts?.message, id: messageId, role: 'alert', className: `cratis-ordered-item__message ${parts?.message?.className ?? ''}`, "data-cratis-part": 'message', "data-invalid": true, children: feedback }))] }));
20
+ };
21
+
22
+ export { OrderedItemDestinationField };
23
+ //# sourceMappingURL=OrderedItemDestinationField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItemDestinationField.js","sources":["../../../ConfigurationEditor/OrderedItemDestinationField.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ConfigurationDestination } from './ConfigurationDestination';\nimport type { OrderedItem } from './OrderedItem';\nimport type { OrderedItemEditorParts } from './OrderedItemEditorParts';\nimport type { OrderedItemLabels } from './OrderedItemLabels';\n\ninterface DestinationFieldProps<TItem extends OrderedItem> {\n item: TItem;\n editable: boolean;\n itemName: string;\n labels: Required<OrderedItemLabels>;\n destinations: ReadonlyArray<ConfigurationDestination>;\n message: string | undefined;\n messageId: string;\n parts: OrderedItemEditorParts | undefined;\n onChange: (destination: string | undefined) => void;\n}\n\nconst groupDestinations = (destinations: ReadonlyArray<ConfigurationDestination>) => {\n const ungrouped = destinations.filter((destination) => !destination.group);\n const groups = new Map<string, ConfigurationDestination[]>();\n for (const destination of destinations) {\n if (!destination.group) continue;\n groups.set(destination.group, [...(groups.get(destination.group) ?? []), destination]);\n }\n return { ungrouped, groups };\n};\n\n/**\n * The destination field of one item: a select over the host's destinations, or the destination's\n * name as text. A destination the host no longer lists stays selectable-as-current and is flagged.\n */\nexport const OrderedItemDestinationField = <TItem extends OrderedItem>({\n item,\n editable,\n itemName,\n labels,\n destinations,\n message,\n messageId,\n parts,\n onChange,\n}: DestinationFieldProps<TItem>) => {\n const current = destinations.find((destination) => destination.id === item.destination);\n const missing = item.destination !== undefined && current === undefined;\n const feedback = message ?? (missing ? labels.destinationUnavailable : undefined);\n const accessibleName = `${labels.destinationField}: ${itemName}`;\n const { ungrouped, groups } = groupDestinations(destinations);\n\n return (\n <div className='cratis-ordered-item__destination'>\n {editable ? (\n <select\n {...parts?.destination}\n value={item.destination ?? ''}\n aria-label={accessibleName}\n aria-invalid={feedback ? true : undefined}\n aria-describedby={feedback ? messageId : undefined}\n onChange={(event) => onChange(event.target.value === '' ? undefined : event.target.value)}\n className={`cratis-ordered-item__input ${parts?.destination?.className ?? ''}`}\n data-cratis-part='destination'\n data-control='destination'\n data-invalid={feedback ? true : undefined}\n >\n <option value=''>{labels.noDestination}</option>\n {missing && <option value={item.destination}>{labels.destinationUnavailable}</option>}\n {ungrouped.map((destination) => (\n <option key={destination.id} value={destination.id}>{destination.label}</option>\n ))}\n {[...groups.entries()].map(([group, members]) => (\n <optgroup key={group} label={group}>\n {members.map((destination) => (\n <option key={destination.id} value={destination.id}>{destination.label}</option>\n ))}\n </optgroup>\n ))}\n </select>\n ) : (\n <span className='cratis-ordered-item__text' data-control='destination'>\n <span className='cratis-ordered-item__hidden'>{accessibleName}: </span>\n {current ? current.label : labels.noDestination}\n </span>\n )}\n {feedback && (\n <p {...parts?.message} id={messageId} role='alert' className={`cratis-ordered-item__message ${parts?.message?.className ?? ''}`} data-cratis-part='message' data-invalid>\n {feedback}\n </p>\n )}\n </div>\n );\n};\n"],"names":["_jsxs","_jsx"],"mappings":";;AAoBA,MAAM,iBAAiB,GAAG,CAAC,YAAqD,KAAI;AAChF,IAAA,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,WAAW,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC;AAC1E,IAAA,MAAM,MAAM,GAAG,IAAI,GAAG,EAAsC;AAC5D,IAAA,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;QACpC,IAAI,CAAC,WAAW,CAAC,KAAK;YAAE;QACxB,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC;IAC1F;AACA,IAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE;AAChC,CAAC;AAMM,MAAM,2BAA2B,GAAG,CAA4B,EACnE,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,OAAO,EACP,SAAS,EACT,KAAK,EACL,QAAQ,GACmB,KAAI;AAC/B,IAAA,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW,KAAK,WAAW,CAAC,EAAE,KAAK,IAAI,CAAC,WAAW,CAAC;IACvF,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS;AACvE,IAAA,MAAM,QAAQ,GAAG,OAAO,KAAK,OAAO,GAAG,MAAM,CAAC,sBAAsB,GAAG,SAAS,CAAC;IACjF,MAAM,cAAc,GAAG,CAAA,EAAG,MAAM,CAAC,gBAAgB,CAAA,EAAA,EAAK,QAAQ,CAAA,CAAE;IAChE,MAAM,EAAE,SA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AE,OAAO,CAAC,MACxCA,kBAAsB,KAAK,EAAE,KAAK,EAAA,QAAA,EAC7B,OAAO,CAAC,GAAG,CAAC,CAAC,WAAW,MACrBA,GAAA,CAAA,QAAA,EAAA,EAA6B,KAAK,EAAE,WAAW,CAAC,EAAE,EAAA,QAAA,EAAG,WAAW,CAAC,KAAK,EAAA,EAAzD,WAAW,CAAC,EAAE,CAAqD,CACnF,CAAC,EAAA,EAHS,KAAK,CAIT,CACd,CAAC,CAAA,EAAA,CACG,KAETD,IAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,2BAA2B,EAAA,cAAA,EAAc,aAAa,EAAA,QAAA,EAAA,CAClEA,IAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,6BAA6B,aAAE,cAAc,EAAA,IAAA,CAAA,EAAA,CAAU,EACtE,OAAO,GAAG,OAAO,CAAC,KAAK,GAAG,MAAM,CAAC,aAAa,CAAA,EAAA,CAC5C,CACV,EACA,QAAQ,KACLC,GAAA,CAAA,GAAA,EAAA,EAAA,GAAO,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAC,OAAO,EAAC,SAAS,EAAE,CAAA,6BAAA,EAAgC,KAAK,EAAE,OAAO,EAAE,SAAS,IAAI,EAAE,CAAA,CAAE,EAAA,kBAAA,EAAmB,SAAS,EAAA,cAAA,EAAA,IAAA,EAAA,QAAA,EACtJ,QAAQ,EAAA,CACT,CACP,CAAA,EAAA,CACC;AAEd;;"}
@@ -0,0 +1,74 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { IconPickerAllowed } from '../IconPicker/IconPickerAllowed.js';
3
+ import type { IconPickerCatalog } from '../IconPicker/IconPickerCatalog.js';
4
+ import type { IconPickerLabels } from '../IconPicker/IconPickerLabels.js';
5
+ import type { ConfigurationDestination } from './ConfigurationDestination.js';
6
+ import type { ConfigurationIconReference } from './ConfigurationIconReference.js';
7
+ import type { OrderedItem } from './OrderedItem.js';
8
+ import type { OrderedItemCapabilities } from './OrderedItemCapabilities.js';
9
+ import type { OrderedItemEditorParts } from './OrderedItemEditorParts.js';
10
+ import type { OrderedItemIconFieldProps } from './OrderedItemIconFieldProps.js';
11
+ import type { OrderedItemLabels } from './OrderedItemLabels.js';
12
+ import type { OrderedItemProposal } from './OrderedItemProposal.js';
13
+ import type { OrderedItemValidation } from './OrderedItemValidation.js';
14
+ /** Props for the {@link OrderedItemEditor} component. */
15
+ export interface OrderedItemEditorProps<TItem extends OrderedItem = OrderedItem> {
16
+ /** The configurable items, in order. The editor is controlled: it shows exactly these. */
17
+ items: ReadonlyArray<TItem>;
18
+ /** Fixed (inherited) items. Shown separately and locked: they have no controls and are never part of a proposal. */
19
+ fixedItems?: ReadonlyArray<TItem>;
20
+ /** What the host allows. Restricted controls are not offered and restricted proposals are never emitted. */
21
+ capabilities: OrderedItemCapabilities;
22
+ /**
23
+ * Receives a validated, permitted proposal. Apply it by passing new `items`; ignore it to cancel.
24
+ * The host remains responsible for authoritative permission checks and persistence.
25
+ */
26
+ onChange: (proposal: OrderedItemProposal<TItem>) => void;
27
+ /** The destinations offered by the destination field. */
28
+ destinations?: ReadonlyArray<ConfigurationDestination>;
29
+ /** Creates the item an add proposal carries. The host assigns its stable id. Without it, adding is unavailable. */
30
+ createItem?: () => TItem;
31
+ /**
32
+ * The icons the host offers, as an {@link IconPicker} catalog. When supplied, the icon field is the
33
+ * Components icon picker; there is no separate icon grid. Icon references are qualified
34
+ * `{ library, key, variant? }` identities, never names or markup.
35
+ */
36
+ iconCatalog?: IconPickerCatalog;
37
+ /** Restricts which catalog icons can be chosen. Other icons are listed but cannot be selected. */
38
+ allowedIcons?: IconPickerAllowed;
39
+ /** Overrides for the icon picker's own labels. */
40
+ iconPickerLabels?: IconPickerLabels;
41
+ /**
42
+ * Overrides the icon field with the host's own chooser, taking precedence over `iconCatalog`.
43
+ * Without it and without an `iconCatalog`, the icon is shown as text.
44
+ */
45
+ renderIconField?: (props: OrderedItemIconFieldProps<TItem>) => ReactNode;
46
+ /** Tells whether the host's catalog can still supply an icon. An unavailable icon is flagged in text. */
47
+ isIconAvailable?: (icon: ConfigurationIconReference) => boolean;
48
+ /** The host's validation rules, run on the item as it would be. A message blocks the proposal. */
49
+ validate?: (item: TItem, items: ReadonlyArray<TItem>) => OrderedItemValidation | undefined;
50
+ /** Validation feedback from the host, by item id, for example from a server-side check. */
51
+ validation?: Readonly<Record<string, OrderedItemValidation>>;
52
+ /** Overrides for the editor's strings. Unset fields fall back to English. */
53
+ labels?: OrderedItemLabels;
54
+ /** The editor's accessible name. */
55
+ 'aria-label'?: string;
56
+ /** The id of the element naming the editor. */
57
+ 'aria-labelledby'?: string;
58
+ /** Extra class name on the editor's root. */
59
+ className?: string;
60
+ /** Pass-through attributes for the editor's stable parts. */
61
+ pt?: OrderedItemEditorParts;
62
+ }
63
+ /**
64
+ * An ordered collection editor for configuring a component such as a navigation: labeled items with
65
+ * an icon and a destination, that can be added, removed and reordered.
66
+ *
67
+ * The editor is controlled and policy-free. The host says what is allowed through `capabilities`,
68
+ * supplies the destinations and the icon chooser, and receives validated proposals through
69
+ * `onChange`. Fixed items are listed separately and locked, in text as well as in state, so the
70
+ * difference never rests on opacity. Reordering works by dragging the handle, with the handle's
71
+ * arrow keys, and with labeled move-up and move-down buttons; focus follows the item that moved.
72
+ */
73
+ export declare const OrderedItemEditor: <TItem extends OrderedItem = OrderedItem>({ items, fixedItems, capabilities, onChange, destinations, createItem, renderIconField, isIconAvailable, iconCatalog, allowedIcons, iconPickerLabels, validate, validation, labels: suppliedLabels, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, pt, }: OrderedItemEditorProps<TItem>) => import("react").JSX.Element;
74
+ //# sourceMappingURL=OrderedItemEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItemEditor.d.ts","sourceRoot":"","sources":["../../../ConfigurationEditor/OrderedItemEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,EAQH,KAAK,SAAS,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;OAIG;IACH,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAEhC,kGAAkG;IAClG,YAAY,CAAC,EAAE,iBAAiB,CAAC;IAEjC,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,yBAAyB,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;IAEzE,yGAAyG;IACzG,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,0BAA0B,KAAK,OAAO,CAAC;IAEhE,kGAAkG;IAClG,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,KAAK,qBAAqB,GAAG,SAAS,CAAC;IAE3F,2FAA2F;IAC3F,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAE7D,6EAA6E;IAC7E,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAE3B,oCAAoC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,6DAA6D;IAC7D,EAAE,CAAC,EAAE,sBAAsB,CAAC;CAC/B;AA4BD;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,SAAS,WAAW,GAAG,WAAW,oRAmBtE,sBAAsB,CAAC,KAAK,CAAC,gCA0R/B,CAAC"}
@@ -0,0 +1,188 @@
1
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { useMemo, useId, useRef, useState, useLayoutEffect, useCallback } from 'react';
3
+ import { isIconPickerAllowed } from '../IconPicker/isIconPickerAllowed.js';
4
+ import { OrderedItemRow } from './OrderedItemRow.js';
5
+ import { moveOrderedItem } from './moveOrderedItem.js';
6
+ import { resolveOrderedItemFieldAccess } from './resolveOrderedItemFieldAccess.js';
7
+ import { resolveOrderedItemDropIndex } from './resolveOrderedItemDropIndex.js';
8
+ import { resolveOrderedItemLabels } from './resolveOrderedItemLabels.js';
9
+ import { validateOrderedItem, hasOrderedItemValidation } from './validateOrderedItem.js';
10
+
11
+ const dragType = 'application/x-cratis-ordered-item';
12
+ const sameIcon = (left, right) => left === right ||
13
+ (left !== undefined && right !== undefined && left.library === right.library && left.key === right.key && left.variant === right.variant);
14
+ const withField = (item, field, value) => {
15
+ const next = { ...item, [field]: value };
16
+ if (value === undefined)
17
+ delete next[field];
18
+ return next;
19
+ };
20
+ const OrderedItemEditor = ({ items, fixedItems = [], capabilities, onChange, destinations = [], createItem, renderIconField, isIconAvailable, iconCatalog, allowedIcons, iconPickerLabels, validate, validation, labels: suppliedLabels, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, pt, }) => {
21
+ const labels = useMemo(() => resolveOrderedItemLabels(suppliedLabels), [suppliedLabels]);
22
+ const baseId = useId();
23
+ const rootRef = useRef(null);
24
+ const pending = useRef(null);
25
+ const restoring = useRef(false);
26
+ const [localValidation, setLocalValidation] = useState({});
27
+ const [drag, setDrag] = useState(null);
28
+ const [announcement, setAnnouncement] = useState('');
29
+ const canAdd = capabilities.add &&
30
+ createItem !== undefined &&
31
+ (capabilities.maxItems === undefined || items.length < capabilities.maxItems);
32
+ const atMaximum = capabilities.add && capabilities.maxItems !== undefined && items.length >= capabilities.maxItems;
33
+ useLayoutEffect(() => {
34
+ const target = pending.current;
35
+ const root = rootRef.current;
36
+ if (!target || !root)
37
+ return;
38
+ const row = target.itemId === undefined
39
+ ? root
40
+ : Array.from(root.querySelectorAll('[data-item-id]')).find((element) => element.dataset.itemId === target.itemId);
41
+ if (!row)
42
+ return;
43
+ const control = Array.from(row.querySelectorAll('[data-control]')).find((element) => element.dataset.control === target.control);
44
+ const focusable = control ?? (target.itemId === undefined ? undefined : row);
45
+ if (!focusable)
46
+ return;
47
+ restoring.current = true;
48
+ focusable.focus();
49
+ restoring.current = false;
50
+ pending.current = null;
51
+ if (target.announce && target.itemId !== undefined) {
52
+ const index = items.findIndex((item) => item.id === target.itemId);
53
+ if (index >= 0)
54
+ setAnnouncement(labels.moved(items[index].label || labels.untitled, index + 1, items.length));
55
+ }
56
+ });
57
+ const move = useCallback((item, toIndex, control) => {
58
+ if (!capabilities.reorder)
59
+ return;
60
+ const fromIndex = items.findIndex((candidate) => candidate.id === item.id);
61
+ if (fromIndex < 0 || toIndex < 0 || toIndex >= items.length || toIndex === fromIndex)
62
+ return;
63
+ pending.current = { itemId: item.id, control, announce: true };
64
+ onChange({ kind: 'move', item: items[fromIndex], fromIndex, toIndex, items: moveOrderedItem(items, fromIndex, toIndex) });
65
+ }, [capabilities.reorder, items, onChange]);
66
+ const handleMove = (item, delta, control) => {
67
+ const index = items.findIndex((candidate) => candidate.id === item.id);
68
+ if (index >= 0)
69
+ move(item, index + delta, control);
70
+ };
71
+ const handleField = (item, field, value) => {
72
+ if (resolveOrderedItemFieldAccess(capabilities, field) !== 'editable')
73
+ return;
74
+ if (field === 'icon' && allowedIcons !== undefined && iconCatalog !== undefined && value !== undefined) {
75
+ const picked = value;
76
+ const entry = iconCatalog.icons.find((candidate) => candidate.library === picked.library && candidate.key === picked.key && candidate.variant === picked.variant);
77
+ if (entry !== undefined && !isIconPickerAllowed(entry, allowedIcons))
78
+ return;
79
+ }
80
+ const index = items.findIndex((candidate) => candidate.id === item.id);
81
+ if (index < 0)
82
+ return;
83
+ const previous = items[index];
84
+ const unchanged = field === 'icon'
85
+ ? sameIcon(previous.icon, value)
86
+ : previous[field] === value;
87
+ if (unchanged)
88
+ return;
89
+ const next = withField(previous, field, value);
90
+ const nextItems = items.map((candidate, position) => (position === index ? next : candidate));
91
+ const messages = validateOrderedItem(next, nextItems, capabilities, labels, validate);
92
+ if (hasOrderedItemValidation(messages)) {
93
+ setLocalValidation((current) => ({ ...current, [item.id]: messages }));
94
+ return;
95
+ }
96
+ setLocalValidation((current) => {
97
+ if (!(item.id in current))
98
+ return current;
99
+ const { [item.id]: _cleared, ...rest } = current;
100
+ return rest;
101
+ });
102
+ onChange({ kind: 'update', item: next, previous, field, items: nextItems });
103
+ };
104
+ const handleFieldBlur = (item) => {
105
+ setLocalValidation((current) => {
106
+ if (!(item.id in current))
107
+ return current;
108
+ const { [item.id]: _cleared, ...rest } = current;
109
+ return rest;
110
+ });
111
+ };
112
+ const handleRemove = (item) => {
113
+ if (!capabilities.remove)
114
+ return;
115
+ const index = items.findIndex((candidate) => candidate.id === item.id);
116
+ if (index < 0)
117
+ return;
118
+ const neighbor = items[index + 1] ?? items[index - 1];
119
+ pending.current = neighbor
120
+ ? { itemId: neighbor.id, control: 'remove', announce: false }
121
+ : { itemId: undefined, control: 'add', announce: false };
122
+ onChange({ kind: 'remove', item: items[index], index, items: items.filter((_, position) => position !== index) });
123
+ };
124
+ const handleAdd = () => {
125
+ if (!canAdd || !createItem)
126
+ return;
127
+ const item = createItem();
128
+ pending.current = { itemId: item.id, control: 'label', announce: false };
129
+ onChange({ kind: 'add', item, index: items.length, items: [...items, item] });
130
+ };
131
+ const handleDragStart = (item, event) => {
132
+ if (!capabilities.reorder) {
133
+ event.preventDefault();
134
+ return;
135
+ }
136
+ event.dataTransfer.setData(dragType, item.id);
137
+ event.dataTransfer.effectAllowed = 'move';
138
+ const row = event.currentTarget.closest('li');
139
+ if (row && typeof event.dataTransfer.setDragImage === 'function')
140
+ event.dataTransfer.setDragImage(row, 0, 0);
141
+ setDrag({ id: item.id });
142
+ };
143
+ const handleDragOver = (item, event) => {
144
+ if (!drag)
145
+ return;
146
+ event.preventDefault();
147
+ event.dataTransfer.dropEffect = 'move';
148
+ const rectangle = event.currentTarget.getBoundingClientRect();
149
+ const position = event.clientY < rectangle.top + rectangle.height / 2 ? 'before' : 'after';
150
+ setDrag((current) => current && (current.overId !== item.id || current.position !== position)
151
+ ? { ...current, overId: item.id, position }
152
+ : current);
153
+ };
154
+ const handleDrop = (item, event) => {
155
+ if (!drag)
156
+ return;
157
+ event.preventDefault();
158
+ const rectangle = event.currentTarget.getBoundingClientRect();
159
+ const position = event.clientY < rectangle.top + rectangle.height / 2 ? 'before' : 'after';
160
+ const fromIndex = items.findIndex((candidate) => candidate.id === drag.id);
161
+ const overIndex = items.findIndex((candidate) => candidate.id === item.id);
162
+ setDrag(null);
163
+ if (fromIndex < 0 || overIndex < 0)
164
+ return;
165
+ move(items[fromIndex], resolveOrderedItemDropIndex(fromIndex, overIndex, position), 'handle');
166
+ };
167
+ const restrictions = [
168
+ ['add', capabilities.add],
169
+ ['remove', capabilities.remove],
170
+ ['reorder', capabilities.reorder],
171
+ ['label', resolveOrderedItemFieldAccess(capabilities, 'label') === 'editable'],
172
+ ['icon', resolveOrderedItemFieldAccess(capabilities, 'icon') === 'editable'],
173
+ ['destination', resolveOrderedItemFieldAccess(capabilities, 'destination') === 'editable'],
174
+ ].flatMap(([key, allowed]) => (!allowed && capabilities.reasons?.[key] ? [capabilities.reasons[key]] : []));
175
+ const mergedValidation = (item) => {
176
+ const local = localValidation[item.id];
177
+ const supplied = validation?.[item.id];
178
+ return local || supplied ? { ...supplied, ...local } : undefined;
179
+ };
180
+ const renderRow = (item, index, count, locked) => (jsx(OrderedItemRow, { item: item, index: index, count: count, locked: locked, capabilities: capabilities, labels: labels, destinations: destinations, validation: locked ? validation?.[item.id] : mergedValidation(item), baseId: baseId, parts: pt, renderIconField: renderIconField, isIconAvailable: isIconAvailable, iconCatalog: iconCatalog, allowedIcons: allowedIcons, iconPickerLabels: iconPickerLabels, dragging: drag?.id === item.id, dropPosition: drag?.overId === item.id && drag.id !== item.id ? drag.position : undefined, onField: handleField, onFieldBlur: handleFieldBlur, onMove: handleMove, onRemove: handleRemove, onDragStart: handleDragStart, onDragOver: handleDragOver, onDrop: handleDrop, onDragEnd: () => setDrag(null) }, item.id));
181
+ const fixedTitleId = `${baseId}-fixed`;
182
+ const localTitleId = `${baseId}-local`;
183
+ return (jsxs("div", { ...pt?.root, ref: rootRef, role: 'group', "aria-label": ariaLabelledBy ? undefined : ariaLabel ?? labels.localItems, "aria-labelledby": ariaLabelledBy, className: ['cratis-ordered-item-editor', pt?.root?.className, className].filter(Boolean).join(' '), onKeyDownCapture: () => { pending.current = null; }, onPointerDownCapture: () => { pending.current = null; }, onFocusCapture: () => { if (!restoring.current)
184
+ pending.current = null; }, "data-cratis-part": 'root', children: [fixedItems.length > 0 && (jsxs("section", { ...pt?.section, "aria-labelledby": fixedTitleId, className: `cratis-ordered-item-editor__section ${pt?.section?.className ?? ''}`, "data-cratis-part": 'section', "data-section": 'fixed', children: [jsx("h3", { ...pt?.sectionTitle, id: fixedTitleId, className: `cratis-ordered-item-editor__title ${pt?.sectionTitle?.className ?? ''}`, "data-cratis-part": 'sectionTitle', children: labels.fixedItems }), jsx("ul", { ...pt?.list, className: `cratis-ordered-item-editor__list ${pt?.list?.className ?? ''}`, "data-cratis-part": 'list', children: fixedItems.map((item, index) => renderRow(item, index, fixedItems.length, true)) })] })), jsxs("section", { ...pt?.section, "aria-labelledby": localTitleId, className: `cratis-ordered-item-editor__section ${pt?.section?.className ?? ''}`, "data-cratis-part": 'section', "data-section": 'local', children: [jsx("h3", { ...pt?.sectionTitle, id: localTitleId, className: `cratis-ordered-item-editor__title ${pt?.sectionTitle?.className ?? ''}`, "data-cratis-part": 'sectionTitle', children: labels.localItems }), items.length === 0 ? (jsx("p", { ...pt?.empty, className: `cratis-ordered-item-editor__empty ${pt?.empty?.className ?? ''}`, "data-cratis-part": 'empty', children: labels.empty })) : (jsx("ul", { ...pt?.list, className: `cratis-ordered-item-editor__list ${pt?.list?.className ?? ''}`, "data-cratis-part": 'list', children: items.map((item, index) => renderRow(item, index, items.length, false)) })), restrictions.map((reason) => (jsx("p", { ...pt?.message, className: `cratis-ordered-item__message cratis-ordered-item__message--note ${pt?.message?.className ?? ''}`, "data-cratis-part": 'message', children: reason }, reason))), capabilities.add && createItem && (jsxs(Fragment, { children: [jsx("button", { ...pt?.add, type: 'button', "aria-disabled": !canAdd || undefined, onClick: handleAdd, className: `cratis-ordered-item__button cratis-ordered-item-editor__add ${pt?.add?.className ?? ''}`, "data-cratis-part": 'add', "data-control": 'add', children: labels.add }), atMaximum && (jsx("p", { ...pt?.message, className: `cratis-ordered-item__message cratis-ordered-item__message--note ${pt?.message?.className ?? ''}`, "data-cratis-part": 'message', children: capabilities.reasons?.add ?? labels.maxItemsReached }))] }))] }), jsx("div", { ...pt?.status, role: 'status', "aria-live": 'polite', className: `cratis-ordered-item__hidden ${pt?.status?.className ?? ''}`, "data-cratis-part": 'status', children: announcement })] }));
185
+ };
186
+
187
+ export { OrderedItemEditor };
188
+ //# sourceMappingURL=OrderedItemEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItemEditor.js","sources":["../../../ConfigurationEditor/OrderedItemEditor.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport {\n useCallback,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type DragEvent,\n type ReactNode,\n} from 'react';\nimport type { IconPickerAllowed } from '../IconPicker/IconPickerAllowed';\nimport type { IconPickerCatalog } from '../IconPicker/IconPickerCatalog';\nimport type { IconPickerLabels } from '../IconPicker/IconPickerLabels';\nimport { isIconPickerAllowed } from '../IconPicker/isIconPickerAllowed';\nimport type { ConfigurationDestination } from './ConfigurationDestination';\nimport type { ConfigurationIconReference } from './ConfigurationIconReference';\nimport type { OrderedItem } from './OrderedItem';\nimport type { OrderedItemCapabilities } from './OrderedItemCapabilities';\nimport type { OrderedItemEditorParts } from './OrderedItemEditorParts';\nimport type { OrderedItemField } from './OrderedItemField';\nimport type { OrderedItemIconFieldProps } from './OrderedItemIconFieldProps';\nimport type { OrderedItemLabels } from './OrderedItemLabels';\nimport type { OrderedItemProposal } from './OrderedItemProposal';\nimport type { OrderedItemValidation } from './OrderedItemValidation';\nimport { OrderedItemRow } from './OrderedItemRow';\nimport { moveOrderedItem } from './moveOrderedItem';\nimport { resolveOrderedItemFieldAccess } from './resolveOrderedItemFieldAccess';\nimport { resolveOrderedItemDropIndex } from './resolveOrderedItemDropIndex';\nimport { resolveOrderedItemLabels } from './resolveOrderedItemLabels';\nimport { hasOrderedItemValidation, validateOrderedItem } from './validateOrderedItem';\n\nconst dragType = 'application/x-cratis-ordered-item';\n\n/** Props for the {@link OrderedItemEditor} component. */\nexport interface OrderedItemEditorProps<TItem extends OrderedItem = OrderedItem> {\n /** The configurable items, in order. The editor is controlled: it shows exactly these. */\n items: ReadonlyArray<TItem>;\n\n /** Fixed (inherited) items. Shown separately and locked: they have no controls and are never part of a proposal. */\n fixedItems?: ReadonlyArray<TItem>;\n\n /** What the host allows. Restricted controls are not offered and restricted proposals are never emitted. */\n capabilities: OrderedItemCapabilities;\n\n /**\n * Receives a validated, permitted proposal. Apply it by passing new `items`; ignore it to cancel.\n * The host remains responsible for authoritative permission checks and persistence.\n */\n onChange: (proposal: OrderedItemProposal<TItem>) => void;\n\n /** The destinations offered by the destination field. */\n destinations?: ReadonlyArray<ConfigurationDestination>;\n\n /** Creates the item an add proposal carries. The host assigns its stable id. Without it, adding is unavailable. */\n createItem?: () => TItem;\n\n /**\n * The icons the host offers, as an {@link IconPicker} catalog. When supplied, the icon field is the\n * Components icon picker; there is no separate icon grid. Icon references are qualified\n * `{ library, key, variant? }` identities, never names or markup.\n */\n iconCatalog?: IconPickerCatalog;\n\n /** Restricts which catalog icons can be chosen. Other icons are listed but cannot be selected. */\n allowedIcons?: IconPickerAllowed;\n\n /** Overrides for the icon picker's own labels. */\n iconPickerLabels?: IconPickerLabels;\n\n /**\n * Overrides the icon field with the host's own chooser, taking precedence over `iconCatalog`.\n * Without it and without an `iconCatalog`, the icon is shown as text.\n */\n renderIconField?: (props: OrderedItemIconFieldProps<TItem>) => ReactNode;\n\n /** Tells whether the host's catalog can still supply an icon. An unavailable icon is flagged in text. */\n isIconAvailable?: (icon: ConfigurationIconReference) => boolean;\n\n /** The host's validation rules, run on the item as it would be. A message blocks the proposal. */\n validate?: (item: TItem, items: ReadonlyArray<TItem>) => OrderedItemValidation | undefined;\n\n /** Validation feedback from the host, by item id, for example from a server-side check. */\n validation?: Readonly<Record<string, OrderedItemValidation>>;\n\n /** Overrides for the editor's strings. Unset fields fall back to English. */\n labels?: OrderedItemLabels;\n\n /** The editor's accessible name. */\n 'aria-label'?: string;\n\n /** The id of the element naming the editor. */\n 'aria-labelledby'?: string;\n\n /** Extra class name on the editor's root. */\n className?: string;\n\n /** Pass-through attributes for the editor's stable parts. */\n pt?: OrderedItemEditorParts;\n}\n\ninterface PendingFocus {\n itemId: string | undefined;\n control: string;\n announce: boolean;\n}\n\ninterface DragState {\n id: string;\n overId?: string;\n position?: 'before' | 'after';\n}\n\nconst sameIcon = (left: ConfigurationIconReference | undefined, right: ConfigurationIconReference | undefined) =>\n left === right ||\n (left !== undefined && right !== undefined && left.library === right.library && left.key === right.key && left.variant === right.variant);\n\nconst withField = <TItem extends OrderedItem>(\n item: TItem,\n field: OrderedItemField,\n value: string | ConfigurationIconReference | undefined,\n): TItem => {\n const next = { ...item, [field]: value };\n if (value === undefined) delete (next as Record<string, unknown>)[field];\n return next;\n};\n\n/**\n * An ordered collection editor for configuring a component such as a navigation: labeled items with\n * an icon and a destination, that can be added, removed and reordered.\n *\n * The editor is controlled and policy-free. The host says what is allowed through `capabilities`,\n * supplies the destinations and the icon chooser, and receives validated proposals through\n * `onChange`. Fixed items are listed separately and locked, in text as well as in state, so the\n * difference never rests on opacity. Reordering works by dragging the handle, with the handle's\n * arrow keys, and with labeled move-up and move-down buttons; focus follows the item that moved.\n */\nexport const OrderedItemEditor = <TItem extends OrderedItem = OrderedItem>({\n items,\n fixedItems = [],\n capabilities,\n onChange,\n destinations = [],\n createItem,\n renderIconField,\n isIconAvailable,\n iconCatalog,\n allowedIcons,\n iconPickerLabels,\n validate,\n validation,\n labels: suppliedLabels,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n className,\n pt,\n}: OrderedItemEditorProps<TItem>) => {\n const labels = useMemo(() => resolveOrderedItemLabels(suppliedLabels), [suppliedLabels]);\n const baseId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const pending = useRef<PendingFocus | null>(null);\n const restoring = useRef(false);\n const [localValidation, setLocalValidation] = useState<Record<string, OrderedItemValidation>>({});\n const [drag, setDrag] = useState<DragState | null>(null);\n const [announcement, setAnnouncement] = useState('');\n\n const canAdd =\n capabilities.add &&\n createItem !== undefined &&\n (capabilities.maxItems === undefined || items.length < capabilities.maxItems);\n const atMaximum = capabilities.add && capabilities.maxItems !== undefined && items.length >= capabilities.maxItems;\n\n useLayoutEffect(() => {\n const target = pending.current;\n const root = rootRef.current;\n if (!target || !root) return;\n const row = target.itemId === undefined\n ? root\n : Array.from(root.querySelectorAll<HTMLElement>('[data-item-id]')).find((element) => element.dataset.itemId === target.itemId);\n if (!row) return;\n const control = Array.from(row.querySelectorAll<HTMLElement>('[data-control]')).find(\n (element) => element.dataset.control === target.control,\n );\n const focusable = control ?? (target.itemId === undefined ? undefined : row);\n if (!focusable) return;\n restoring.current = true;\n focusable.focus();\n restoring.current = false;\n pending.current = null;\n if (target.announce && target.itemId !== undefined) {\n const index = items.findIndex((item) => item.id === target.itemId);\n if (index >= 0) setAnnouncement(labels.moved(items[index].label || labels.untitled, index + 1, items.length));\n }\n });\n\n const move = useCallback((item: TItem, toIndex: number, control: string) => {\n if (!capabilities.reorder) return;\n const fromIndex = items.findIndex((candidate) => candidate.id === item.id);\n if (fromIndex < 0 || toIndex < 0 || toIndex >= items.length || toIndex === fromIndex) return;\n pending.current = { itemId: item.id, control, announce: true };\n onChange({ kind: 'move', item: items[fromIndex], fromIndex, toIndex, items: moveOrderedItem(items, fromIndex, toIndex) });\n }, [capabilities.reorder, items, onChange]);\n\n const handleMove = (item: TItem, delta: -1 | 1, control: string) => {\n const index = items.findIndex((candidate) => candidate.id === item.id);\n if (index >= 0) move(item, index + delta, control);\n };\n\n const handleField = (item: TItem, field: OrderedItemField, value: string | ConfigurationIconReference | undefined) => {\n if (resolveOrderedItemFieldAccess(capabilities, field) !== 'editable') return;\n if (field === 'icon' && allowedIcons !== undefined && iconCatalog !== undefined && value !== undefined) {\n const picked = value as ConfigurationIconReference;\n const entry = iconCatalog.icons.find(\n (candidate) => candidate.library === picked.library && candidate.key === picked.key && candidate.variant === picked.variant,\n );\n if (entry !== undefined && !isIconPickerAllowed(entry, allowedIcons)) return;\n }\n const index = items.findIndex((candidate) => candidate.id === item.id);\n if (index < 0) return;\n const previous = items[index];\n const unchanged = field === 'icon'\n ? sameIcon(previous.icon, value as ConfigurationIconReference | undefined)\n : previous[field] === value;\n if (unchanged) return;\n const next = withField(previous, field, value);\n const nextItems = items.map((candidate, position) => (position === index ? next : candidate));\n const messages = validateOrderedItem(next, nextItems, capabilities, labels, validate);\n if (hasOrderedItemValidation(messages)) {\n setLocalValidation((current) => ({ ...current, [item.id]: messages }));\n return;\n }\n setLocalValidation((current) => {\n if (!(item.id in current)) return current;\n const { [item.id]: _cleared, ...rest } = current;\n return rest;\n });\n onChange({ kind: 'update', item: next, previous, field, items: nextItems });\n };\n\n const handleFieldBlur = (item: TItem) => {\n setLocalValidation((current) => {\n if (!(item.id in current)) return current;\n const { [item.id]: _cleared, ...rest } = current;\n return rest;\n });\n };\n\n const handleRemove = (item: TItem) => {\n if (!capabilities.remove) return;\n const index = items.findIndex((candidate) => candidate.id === item.id);\n if (index < 0) return;\n const neighbor = items[index + 1] ?? items[index - 1];\n pending.current = neighbor\n ? { itemId: neighbor.id, control: 'remove', announce: false }\n : { itemId: undefined, control: 'add', announce: false };\n onChange({ kind: 'remove', item: items[index], index, items: items.filter((_, position) => position !== index) });\n };\n\n const handleAdd = () => {\n if (!canAdd || !createItem) return;\n const item = createItem();\n pending.current = { itemId: item.id, control: 'label', announce: false };\n onChange({ kind: 'add', item, index: items.length, items: [...items, item] });\n };\n\n const handleDragStart = (item: TItem, event: DragEvent<HTMLButtonElement>) => {\n if (!capabilities.reorder) {\n event.preventDefault();\n return;\n }\n event.dataTransfer.setData(dragType, item.id);\n event.dataTransfer.effectAllowed = 'move';\n const row = event.currentTarget.closest('li');\n if (row && typeof event.dataTransfer.setDragImage === 'function') event.dataTransfer.setDragImage(row, 0, 0);\n setDrag({ id: item.id });\n };\n\n const handleDragOver = (item: TItem, event: DragEvent<HTMLLIElement>) => {\n if (!drag) return;\n event.preventDefault();\n event.dataTransfer.dropEffect = 'move';\n const rectangle = event.currentTarget.getBoundingClientRect();\n const position = event.clientY < rectangle.top + rectangle.height / 2 ? 'before' : 'after';\n setDrag((current) =>\n current && (current.overId !== item.id || current.position !== position)\n ? { ...current, overId: item.id, position }\n : current,\n );\n };\n\n const handleDrop = (item: TItem, event: DragEvent<HTMLLIElement>) => {\n if (!drag) return;\n event.preventDefault();\n const rectangle = event.currentTarget.getBoundingClientRect();\n const position = event.clientY < rectangle.top + rectangle.height / 2 ? 'before' : 'after';\n const fromIndex = items.findIndex((candidate) => candidate.id === drag.id);\n const overIndex = items.findIndex((candidate) => candidate.id === item.id);\n setDrag(null);\n if (fromIndex < 0 || overIndex < 0) return;\n move(items[fromIndex], resolveOrderedItemDropIndex(fromIndex, overIndex, position), 'handle');\n };\n\n const restrictions = (\n [\n ['add', capabilities.add],\n ['remove', capabilities.remove],\n ['reorder', capabilities.reorder],\n ['label', resolveOrderedItemFieldAccess(capabilities, 'label') === 'editable'],\n ['icon', resolveOrderedItemFieldAccess(capabilities, 'icon') === 'editable'],\n ['destination', resolveOrderedItemFieldAccess(capabilities, 'destination') === 'editable'],\n ] as const\n ).flatMap(([key, allowed]) => (!allowed && capabilities.reasons?.[key] ? [capabilities.reasons[key] as string] : []));\n\n const mergedValidation = (item: TItem): OrderedItemValidation | undefined => {\n const local = localValidation[item.id];\n const supplied = validation?.[item.id];\n return local || supplied ? { ...supplied, ...local } : undefined;\n };\n\n const renderRow = (item: TItem, index: number, count: number, locked: boolean) => (\n <OrderedItemRow\n key={item.id}\n item={item}\n index={index}\n count={count}\n locked={locked}\n capabilities={capabilities}\n labels={labels}\n destinations={destinations}\n validation={locked ? validation?.[item.id] : mergedValidation(item)}\n baseId={baseId}\n parts={pt}\n renderIconField={renderIconField}\n isIconAvailable={isIconAvailable}\n iconCatalog={iconCatalog}\n allowedIcons={allowedIcons}\n iconPickerLabels={iconPickerLabels}\n dragging={drag?.id === item.id}\n dropPosition={drag?.overId === item.id && drag.id !== item.id ? drag.position : undefined}\n onField={handleField}\n onFieldBlur={handleFieldBlur}\n onMove={handleMove}\n onRemove={handleRemove}\n onDragStart={handleDragStart}\n onDragOver={handleDragOver}\n onDrop={handleDrop}\n onDragEnd={() => setDrag(null)}\n />\n );\n\n const fixedTitleId = `${baseId}-fixed`;\n const localTitleId = `${baseId}-local`;\n\n return (\n <div\n {...pt?.root}\n ref={rootRef}\n role='group'\n aria-label={ariaLabelledBy ? undefined : ariaLabel ?? labels.localItems}\n aria-labelledby={ariaLabelledBy}\n className={['cratis-ordered-item-editor', pt?.root?.className, className].filter(Boolean).join(' ')}\n onKeyDownCapture={() => { pending.current = null; }}\n onPointerDownCapture={() => { pending.current = null; }}\n onFocusCapture={() => { if (!restoring.current) pending.current = null; }}\n data-cratis-part='root'\n >\n {fixedItems.length > 0 && (\n <section\n {...pt?.section}\n aria-labelledby={fixedTitleId}\n className={`cratis-ordered-item-editor__section ${pt?.section?.className ?? ''}`}\n data-cratis-part='section'\n data-section='fixed'\n >\n <h3 {...pt?.sectionTitle} id={fixedTitleId} className={`cratis-ordered-item-editor__title ${pt?.sectionTitle?.className ?? ''}`} data-cratis-part='sectionTitle'>\n {labels.fixedItems}\n </h3>\n <ul {...pt?.list} className={`cratis-ordered-item-editor__list ${pt?.list?.className ?? ''}`} data-cratis-part='list'>\n {fixedItems.map((item, index) => renderRow(item, index, fixedItems.length, true))}\n </ul>\n </section>\n )}\n <section\n {...pt?.section}\n aria-labelledby={localTitleId}\n className={`cratis-ordered-item-editor__section ${pt?.section?.className ?? ''}`}\n data-cratis-part='section'\n data-section='local'\n >\n <h3 {...pt?.sectionTitle} id={localTitleId} className={`cratis-ordered-item-editor__title ${pt?.sectionTitle?.className ?? ''}`} data-cratis-part='sectionTitle'>\n {labels.localItems}\n </h3>\n {items.length === 0 ? (\n <p {...pt?.empty} className={`cratis-ordered-item-editor__empty ${pt?.empty?.className ?? ''}`} data-cratis-part='empty'>\n {labels.empty}\n </p>\n ) : (\n <ul {...pt?.list} className={`cratis-ordered-item-editor__list ${pt?.list?.className ?? ''}`} data-cratis-part='list'>\n {items.map((item, index) => renderRow(item, index, items.length, false))}\n </ul>\n )}\n {restrictions.map((reason) => (\n <p key={reason} {...pt?.message} className={`cratis-ordered-item__message cratis-ordered-item__message--note ${pt?.message?.className ?? ''}`} data-cratis-part='message'>\n {reason}\n </p>\n ))}\n {capabilities.add && createItem && (\n <>\n <button\n {...pt?.add}\n type='button'\n aria-disabled={!canAdd || undefined}\n onClick={handleAdd}\n className={`cratis-ordered-item__button cratis-ordered-item-editor__add ${pt?.add?.className ?? ''}`}\n data-cratis-part='add'\n data-control='add'\n >\n {labels.add}\n </button>\n {atMaximum && (\n <p {...pt?.message} className={`cratis-ordered-item__message cratis-ordered-item__message--note ${pt?.message?.className ?? ''}`} data-cratis-part='message'>\n {capabilities.reasons?.add ?? labels.maxItemsReached}\n </p>\n )}\n </>\n )}\n </section>\n <div\n {...pt?.status}\n role='status'\n aria-live='polite'\n className={`cratis-ordered-item__hidden ${pt?.status?.className ?? ''}`}\n data-cratis-part='status'\n >\n {announcement}\n </div>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AAkCA,MAAM,QAAQ,GAAG,mCAAmC;AAiFpD,MAAM,QAAQ,GAAG,CAAC,IAA4C,EAAE,KAA6C,KACzG,IAAI,KAAK,KAAK;AACd,KAAC,IAAI,KAAK,SAAS,IAAI,KAAK,KAAK,SAAS,IAAI,IAA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AAA,EAAA,EAAA,GAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,mEAAmE,EAAE,EAAE,OAAO,EAAE,SAAS,IAAI,EAAE,CAAA,CAAE,EAAA,kBAAA,EAAmB,SAAS,EAAA,QAAA,EACvJ,YAAY,CAAC,OAAO,EAAE,GAAG,IAAI,MAAM,CAAC,eAAe,EAAA,CACpD,CACP,CAAA,EAAA,CACF,CACN,IACK,EACVA,GAAA,CAAA,KAAA,EAAA,EAAA,GACQ,EAAE,EAAE,MAAM,EACd,IAAI,EAAC,QAAQ,eACH,QAAQ,EAClB,SAAS,EAAE,CAAA,4BAAA,EAA+B,EAAE,EAAE,MAAM,EAAE,SAAS,IAAI,EAAE,EAAE,EAAA,kBAAA,EACtD,QAAQ,YAExB,YAAY,EAAA,CACX,CAAA,EAAA,CACJ;AAEd;;"}
@@ -0,0 +1,43 @@
1
+ import type { ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes } from 'react';
2
+ import type { ConfigurationEditorPartAttributes } from './ConfigurationEditorPartAttributes.js';
3
+ /**
4
+ * Stable Cratis-owned parts for styling an {@link OrderedItemEditor}. Each is marked with a matching
5
+ * `data-cratis-part` attribute and receives what is passed here; the editor's own wiring wins.
6
+ */
7
+ export interface OrderedItemEditorParts {
8
+ /** The editor root. */
9
+ root?: ConfigurationEditorPartAttributes<HTMLDivElement>;
10
+ /** A section of items: the fixed items or the configurable items. Carries `data-section`. */
11
+ section?: ConfigurationEditorPartAttributes<HTMLElement>;
12
+ /** A section's heading. */
13
+ sectionTitle?: ConfigurationEditorPartAttributes<HTMLHeadingElement>;
14
+ /** A section's list of items. */
15
+ list?: ConfigurationEditorPartAttributes<HTMLUListElement>;
16
+ /** One item. Carries `data-locked`, `data-dragging` and `data-drop-position`. */
17
+ item?: ConfigurationEditorPartAttributes<HTMLLIElement>;
18
+ /** The control that starts a drag and reorders with the arrow keys. */
19
+ handle?: ButtonHTMLAttributes<HTMLButtonElement>;
20
+ /** The move-up action. */
21
+ moveUp?: ButtonHTMLAttributes<HTMLButtonElement>;
22
+ /** The move-down action. */
23
+ moveDown?: ButtonHTMLAttributes<HTMLButtonElement>;
24
+ /** The label input. */
25
+ label?: InputHTMLAttributes<HTMLInputElement>;
26
+ /** The wrapper of the icon field. Carries `data-unavailable` for an icon the catalog cannot supply. */
27
+ icon?: ConfigurationEditorPartAttributes<HTMLDivElement>;
28
+ /** The destination select. */
29
+ destination?: SelectHTMLAttributes<HTMLSelectElement>;
30
+ /** The remove action. */
31
+ remove?: ButtonHTMLAttributes<HTMLButtonElement>;
32
+ /** The add action. */
33
+ add?: ButtonHTMLAttributes<HTMLButtonElement>;
34
+ /** A validation message or a reason a control is restricted. */
35
+ message?: ConfigurationEditorPartAttributes<HTMLParagraphElement>;
36
+ /** The text that says an item is locked. */
37
+ state?: ConfigurationEditorPartAttributes<HTMLSpanElement>;
38
+ /** The text shown for an empty collection. */
39
+ empty?: ConfigurationEditorPartAttributes<HTMLParagraphElement>;
40
+ /** The live region that announces a move. */
41
+ status?: ConfigurationEditorPartAttributes<HTMLDivElement>;
42
+ }
43
+ //# sourceMappingURL=OrderedItemEditorParts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItemEditorParts.d.ts","sourceRoot":"","sources":["../../../ConfigurationEditor/OrderedItemEditorParts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wCAAqC,CAAC;AAE7F;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC,uBAAuB;IACvB,IAAI,CAAC,EAAE,iCAAiC,CAAC,cAAc,CAAC,CAAC;IAEzD,6FAA6F;IAC7F,OAAO,CAAC,EAAE,iCAAiC,CAAC,WAAW,CAAC,CAAC;IAEzD,2BAA2B;IAC3B,YAAY,CAAC,EAAE,iCAAiC,CAAC,kBAAkB,CAAC,CAAC;IAErE,iCAAiC;IACjC,IAAI,CAAC,EAAE,iCAAiC,CAAC,gBAAgB,CAAC,CAAC;IAE3D,iFAAiF;IACjF,IAAI,CAAC,EAAE,iCAAiC,CAAC,aAAa,CAAC,CAAC;IAExD,uEAAuE;IACvE,MAAM,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAEjD,0BAA0B;IAC1B,MAAM,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAEjD,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAEnD,uBAAuB;IACvB,KAAK,CAAC,EAAE,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAE9C,uGAAuG;IACvG,IAAI,CAAC,EAAE,iCAAiC,CAAC,cAAc,CAAC,CAAC;IAEzD,8BAA8B;IAC9B,WAAW,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAEtD,yBAAyB;IACzB,MAAM,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAEjD,sBAAsB;IACtB,GAAG,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAE9C,gEAAgE;IAChE,OAAO,CAAC,EAAE,iCAAiC,CAAC,oBAAoB,CAAC,CAAC;IAElE,4CAA4C;IAC5C,KAAK,CAAC,EAAE,iCAAiC,CAAC,eAAe,CAAC,CAAC;IAE3D,8CAA8C;IAC9C,KAAK,CAAC,EAAE,iCAAiC,CAAC,oBAAoB,CAAC,CAAC;IAEhE,6CAA6C;IAC7C,MAAM,CAAC,EAAE,iCAAiC,CAAC,cAAc,CAAC,CAAC;CAC9D"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ export {};
4
+ //# sourceMappingURL=OrderedItemEditorParts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItemEditorParts.js","sourceRoot":"","sources":["../../../ConfigurationEditor/OrderedItemEditorParts.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes } from 'react';\nimport type { ConfigurationEditorPartAttributes } from './ConfigurationEditorPartAttributes';\n\n/**\n * Stable Cratis-owned parts for styling an {@link OrderedItemEditor}. Each is marked with a matching\n * `data-cratis-part` attribute and receives what is passed here; the editor's own wiring wins.\n */\nexport interface OrderedItemEditorParts {\n /** The editor root. */\n root?: ConfigurationEditorPartAttributes<HTMLDivElement>;\n\n /** A section of items: the fixed items or the configurable items. Carries `data-section`. */\n section?: ConfigurationEditorPartAttributes<HTMLElement>;\n\n /** A section's heading. */\n sectionTitle?: ConfigurationEditorPartAttributes<HTMLHeadingElement>;\n\n /** A section's list of items. */\n list?: ConfigurationEditorPartAttributes<HTMLUListElement>;\n\n /** One item. Carries `data-locked`, `data-dragging` and `data-drop-position`. */\n item?: ConfigurationEditorPartAttributes<HTMLLIElement>;\n\n /** The control that starts a drag and reorders with the arrow keys. */\n handle?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The move-up action. */\n moveUp?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The move-down action. */\n moveDown?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The label input. */\n label?: InputHTMLAttributes<HTMLInputElement>;\n\n /** The wrapper of the icon field. Carries `data-unavailable` for an icon the catalog cannot supply. */\n icon?: ConfigurationEditorPartAttributes<HTMLDivElement>;\n\n /** The destination select. */\n destination?: SelectHTMLAttributes<HTMLSelectElement>;\n\n /** The remove action. */\n remove?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The add action. */\n add?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** A validation message or a reason a control is restricted. */\n message?: ConfigurationEditorPartAttributes<HTMLParagraphElement>;\n\n /** The text that says an item is locked. */\n state?: ConfigurationEditorPartAttributes<HTMLSpanElement>;\n\n /** The text shown for an empty collection. */\n empty?: ConfigurationEditorPartAttributes<HTMLParagraphElement>;\n\n /** The live region that announces a move. */\n status?: ConfigurationEditorPartAttributes<HTMLDivElement>;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ /** The fields of an {@link OrderedItem} the editor can expose. */
2
+ export type OrderedItemField = 'label' | 'icon' | 'destination';
3
+ //# sourceMappingURL=OrderedItemField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItemField.d.ts","sourceRoot":"","sources":["../../../ConfigurationEditor/OrderedItemField.ts"],"names":[],"mappings":"AAGA,kEAAkE;AAClE,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ export {};
4
+ //# sourceMappingURL=OrderedItemField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrderedItemField.js","sourceRoot":"","sources":["../../../ConfigurationEditor/OrderedItemField.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/** The fields of an {@link OrderedItem} the editor can expose. */\nexport type OrderedItemField = 'label' | 'icon' | 'destination';\n"]}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * What a host lets a person do with one field.
3
+ *
4
+ * - `'editable'` — the field has an input.
5
+ * - `'readonly'` — the value is shown as text and cannot change.
6
+ * - `'hidden'` — the field is not shown. This is also the meaning of a field the host leaves out.
7
+ */
8
+ export type OrderedItemFieldAccess = 'editable' | 'readonly' | 'hidden';
9
+ //# sourceMappingURL=OrderedItemFieldAccess.d.ts.map