@cratis/components 4.26.1 → 4.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,7 +68,7 @@
68
68
  {
69
69
  "name": "@cratis/components",
70
70
  "role": "core",
71
- "version": "4.26.1",
71
+ "version": "4.26.2",
72
72
  "releaseMajorRange": ">=4 <5",
73
73
  "independentRelease": false,
74
74
  "private": false,
@@ -92,7 +92,7 @@
92
92
  {
93
93
  "name": "@cratis/eslint-plugin-components",
94
94
  "role": "eslint",
95
- "version": "4.26.1",
95
+ "version": "4.26.2",
96
96
  "releaseMajorRange": ">=4 <5",
97
97
  "independentRelease": false,
98
98
  "private": false,
@@ -105,7 +105,7 @@
105
105
  {
106
106
  "name": "@cratis/components.migrator",
107
107
  "role": "migrator",
108
- "version": "4.26.1",
108
+ "version": "4.26.2",
109
109
  "releaseMajorRange": ">=4 <5",
110
110
  "independentRelease": false,
111
111
  "private": false,
@@ -116,13 +116,13 @@
116
116
  {
117
117
  "name": "@cratis/components.conformance",
118
118
  "role": "conformance",
119
- "version": "4.26.1",
119
+ "version": "4.26.2",
120
120
  "releaseMajorRange": ">=4 <5",
121
121
  "independentRelease": false,
122
122
  "private": false,
123
123
  "packageAccess": "public",
124
124
  "peerDependencies": {
125
- "@cratis/components": "4.26.1",
125
+ "@cratis/components": "4.26.2",
126
126
  "react": "^19.0.0",
127
127
  "react-dom": "^19.0.0"
128
128
  },
@@ -132,13 +132,13 @@
132
132
  {
133
133
  "name": "@cratis/components.mui",
134
134
  "role": "renderer-adapter",
135
- "version": "4.26.1",
135
+ "version": "4.26.2",
136
136
  "releaseMajorRange": ">=4 <5",
137
137
  "independentRelease": false,
138
138
  "private": false,
139
139
  "packageAccess": "public",
140
140
  "peerDependencies": {
141
- "@cratis/components": "4.26.1",
141
+ "@cratis/components": "4.26.2",
142
142
  "@emotion/react": ">=11.5 <12",
143
143
  "@emotion/styled": ">=11.11 <12",
144
144
  "@mui/material": ">=9 <10",
@@ -188,13 +188,13 @@
188
188
  {
189
189
  "name": "@cratis/components.primereact",
190
190
  "role": "renderer-adapter",
191
- "version": "4.26.1",
191
+ "version": "4.26.2",
192
192
  "releaseMajorRange": ">=4 <5",
193
193
  "independentRelease": false,
194
194
  "private": false,
195
195
  "packageAccess": "public",
196
196
  "peerDependencies": {
197
- "@cratis/components": "4.26.1",
197
+ "@cratis/components": "4.26.2",
198
198
  "@primereact/core": ">=11 <12",
199
199
  "@primereact/ui": ">=11 <12",
200
200
  "@primeuix/themes": ">=3 <4",
@@ -256,13 +256,13 @@
256
256
  {
257
257
  "name": "@cratis/components.primereact10",
258
258
  "role": "renderer-adapter",
259
- "version": "4.26.1",
259
+ "version": "4.26.2",
260
260
  "releaseMajorRange": ">=4 <5",
261
261
  "independentRelease": false,
262
262
  "private": false,
263
263
  "packageAccess": "public",
264
264
  "peerDependencies": {
265
- "@cratis/components": "4.26.1",
265
+ "@cratis/components": "4.26.2",
266
266
  "primereact": ">=10.9.9 <11",
267
267
  "react": "^19.0.0",
268
268
  "react-dom": "^19.0.0"
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyTypeMenu.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/PropertyTypeMenu.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAgD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAQrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAO7D,iGAAiG;AACjG,MAAM,WAAW,qBAAqB;IAClC,2BAA2B;IAC3B,MAAM,EAAE,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAErC,kJAAkJ;IAClJ,QAAQ,EAAE,eAAe,EAAE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AAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5D;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,+EAAgF,qBAAqB,gCA0GjI,CAAC"}
@@ -2,7 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import { useMemo } from 'react';
3
3
  import { UNSAFE_PortalProvider } from 'react-aria';
4
4
  import { Button } from 'react-aria-components/Button';
5
- import { MenuTrigger, Popover, Menu, MenuSection, Header, MenuItem, Separator } from 'react-aria-components/Menu';
5
+ import { MenuTrigger, Popover, Menu, SubmenuTrigger, MenuItem, Separator } from 'react-aria-components/Menu';
6
6
  import { asReactAriaButtonProps } from '../../Common/reactAriaProps.js';
7
7
  import { zIndexAboveDialog, OVERLAY_OFFSET } from '../../renderer/dialogStack.js';
8
8
  import { useNearestDialogZIndex } from '../../renderer/DialogStackContext.js';
@@ -31,7 +31,7 @@ const PropertyTypeMenu = ({ labels, concepts, triggerPart, triggerLabel, childre
31
31
  };
32
32
  const typeItem = (type) => (jsxs(MenuItem, { id: `${typePrefix}${type}`, textValue: propertyTypeName(type, labels), className: `cratis-schema-editor__menu-item ${parts?.menuItem?.className ?? ''}`, "data-cratis-part": 'menuItem', children: [jsx(PropertyTypeGlyph, { type: type }), propertyTypeName(type, labels)] }, type));
33
33
  const triggerAttributes = parts?.[triggerPart];
34
- return (jsx(UNSAFE_PortalProvider, { getContainer: overlayEnvironment.getContainer, children: jsxs(MenuTrigger, { children: [jsx(Button, { ...asReactAriaButtonProps(triggerAttributes), "aria-label": triggerLabel, className: `cratis-schema-editor__${triggerPart === 'add' ? 'add' : 'type-button'} ${triggerAttributes?.className ?? ''}`, "data-cratis-part": triggerPart === 'add' ? 'add' : 'typeButton', children: children }), jsx(Popover, { ...parts?.menu, className: `cratis-schema-editor__menu ${parts?.menu?.className ?? ''}`, style: { zIndex, ...parts?.menu?.style }, "data-cratis-part": 'menu', children: jsxs(Menu, { "aria-label": labels.propertyTypes, onAction: handleAction, className: 'cratis-schema-editor__menu-list', children: [primitivePropertyTypes.map(typeItem), concepts !== undefined && (jsxs(MenuSection, { className: 'cratis-schema-editor__menu-section', children: [jsx(Header, { className: 'cratis-schema-editor__menu-heading', children: labels.concepts }), sortedConcepts.length === 0 && (jsx(MenuItem, { id: 'concept-hint', isDisabled: true, textValue: labels.noConcepts, className: `cratis-schema-editor__menu-item cratis-schema-editor__menu-hint ${parts?.menuItem?.className ?? ''}`, "data-cratis-part": 'menuItem', children: labels.noConcepts })), sortedConcepts.map(concept => (jsxs(MenuItem, { id: `${conceptPrefix}${concept.name}`, textValue: concept.name, className: `cratis-schema-editor__menu-item ${parts?.menuItem?.className ?? ''}`, "data-cratis-part": 'menuItem', children: [jsx(PropertyTypeGlyph, { type: concept.type }), concept.name] }, concept.name)))] })), jsx(Separator, { className: 'cratis-schema-editor__menu-separator' }), compositePropertyTypes.map(typeItem)] }) })] }) }));
34
+ return (jsx(UNSAFE_PortalProvider, { getContainer: overlayEnvironment.getContainer, children: jsxs(MenuTrigger, { children: [jsx(Button, { ...asReactAriaButtonProps(triggerAttributes), "aria-label": triggerLabel, className: `cratis-schema-editor__${triggerPart === 'add' ? 'add' : 'type-button'} ${triggerAttributes?.className ?? ''}`, "data-cratis-part": triggerPart === 'add' ? 'add' : 'typeButton', children: children }), jsx(Popover, { ...parts?.menu, className: `cratis-schema-editor__menu ${parts?.menu?.className ?? ''}`, style: { zIndex, ...parts?.menu?.style }, "data-cratis-part": 'menu', children: jsxs(Menu, { "aria-label": labels.propertyTypes, onAction: handleAction, className: 'cratis-schema-editor__menu-list', children: [primitivePropertyTypes.map(typeItem), concepts !== undefined && (jsxs(SubmenuTrigger, { children: [jsxs(MenuItem, { id: 'concepts', textValue: labels.concepts, className: `cratis-schema-editor__menu-item ${parts?.menuItem?.className ?? ''}`, "data-cratis-part": 'menuItem', children: [jsx("span", { className: 'cratis-schema-editor__menu-label', children: labels.concepts }), jsx("span", { className: 'cratis-schema-editor__menu-arrow', "aria-hidden": 'true', children: "\u203A" })] }), jsx(Popover, { className: `cratis-schema-editor__menu ${parts?.menu?.className ?? ''}`, style: { zIndex }, "data-cratis-part": 'menu', children: jsxs(Menu, { "aria-label": labels.concepts, onAction: handleAction, className: 'cratis-schema-editor__menu-list', children: [sortedConcepts.length === 0 && (jsx(MenuItem, { id: 'concept-hint', isDisabled: true, textValue: labels.noConcepts, className: `cratis-schema-editor__menu-item cratis-schema-editor__menu-hint ${parts?.menuItem?.className ?? ''}`, "data-cratis-part": 'menuItem', children: labels.noConcepts })), sortedConcepts.map(concept => (jsxs(MenuItem, { id: `${conceptPrefix}${concept.name}`, textValue: concept.name, className: `cratis-schema-editor__menu-item ${parts?.menuItem?.className ?? ''}`, "data-cratis-part": 'menuItem', children: [jsx(PropertyTypeGlyph, { type: concept.type }), concept.name] }, concept.name)))] }) })] })), jsx(Separator, { className: 'cratis-schema-editor__menu-separator' }), compositePropertyTypes.map(typeItem)] }) })] }) }));
35
35
  };
36
36
 
37
37
  export { PropertyTypeMenu };
@@ -1 +1 @@
1
- {"version":3,"file":"PropertyTypeMenu.js","sources":["../../../../SchemaEditor/Tree/PropertyTypeMenu.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 { useMemo, type ButtonHTMLAttributes, type Key, type ReactNode } from 'react';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport { Button as AriaButton } from 'react-aria-components/Button';\nimport { Header, Menu, MenuItem, MenuSection, MenuTrigger, Popover, Separator } from 'react-aria-components/Menu';\nimport { asReactAriaButtonProps } from '../../Common/reactAriaProps';\nimport { OVERLAY_OFFSET, zIndexAboveDialog } from '../../renderer/dialogStack';\nimport { useNearestDialogZIndex } from '../../renderer/DialogStackContext';\nimport { unstable_useOverlayEnvironment } from '../../renderer/RendererContext';\nimport type { PropertyConcept } from './PropertyConcept';\nimport type { PropertyType } from './PropertyType';\nimport type { SchemaEditorLabels } from '../SchemaEditorLabels';\nimport type { SchemaEditorParts } from './SchemaEditorParts';\nimport { compositePropertyTypes, primitivePropertyTypes, propertyTypeName } from './propertyTypeDisplay';\nimport { PropertyTypeGlyph } from './PropertyTypeGlyph';\n\nconst typePrefix = 'type:';\nconst conceptPrefix = 'concept:';\n\n/** Props for the menu of types the editor offers when adding a property or changing its type. */\nexport interface PropertyTypeMenuProps {\n /** The resolved labels. */\n labels: Required<SchemaEditorLabels>;\n\n /** The concepts offered after the primitive types. `undefined` when the host has not opted into concepts; an empty list shows a disabled hint. */\n concepts: PropertyConcept[] | undefined;\n\n /** The part of the editor the trigger button is: the add button or the row's type button. */\n triggerPart: 'add' | 'typeButton';\n\n /** The accessible name of the trigger. */\n triggerLabel: string;\n\n /** The content of the trigger. */\n children: ReactNode;\n\n /** The parts the host styles. */\n parts: SchemaEditorParts | undefined;\n\n /** Called with the chosen type, and the concept's name when a concept was chosen. */\n onSelect: (type: PropertyType, concept?: string) => void;\n}\n\n/**\n * The accessible menu of types: the primitives, the concepts of the domain, then the composite types. It is a\n * React Aria menu in a popover, so it handles keyboard navigation, typeahead, focus return and dismissal.\n */\nexport const PropertyTypeMenu = ({ labels, concepts, triggerPart, triggerLabel, children, parts, onSelect }: PropertyTypeMenuProps) => {\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const nearestDialogZIndex = useNearestDialogZIndex();\n const zIndex = nearestDialogZIndex === null\n ? 'var(--cratis-z-index-overlay)'\n : zIndexAboveDialog(nearestDialogZIndex, OVERLAY_OFFSET);\n\n const sortedConcepts = useMemo(\n () => [...(concepts ?? [])].sort((left, right) => left.name.localeCompare(right.name)),\n [concepts]);\n\n const handleAction = (key: Key) => {\n const identifier = String(key);\n if (identifier.startsWith(conceptPrefix)) {\n const concept = sortedConcepts.find(candidate => candidate.name === identifier.slice(conceptPrefix.length));\n if (concept) onSelect(concept.type, concept.name);\n return;\n }\n onSelect(identifier.slice(typePrefix.length) as PropertyType);\n };\n\n const typeItem = (type: PropertyType) => (\n <MenuItem\n key={type}\n id={`${typePrefix}${type}`}\n textValue={propertyTypeName(type, labels)}\n className={`cratis-schema-editor__menu-item ${parts?.menuItem?.className ?? ''}`}\n data-cratis-part='menuItem'\n >\n <PropertyTypeGlyph type={type} />\n {propertyTypeName(type, labels)}\n </MenuItem>\n );\n\n const triggerAttributes: ButtonHTMLAttributes<HTMLButtonElement> | undefined = parts?.[triggerPart];\n\n return (\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <MenuTrigger>\n <AriaButton\n {...asReactAriaButtonProps(triggerAttributes)}\n aria-label={triggerLabel}\n className={`cratis-schema-editor__${triggerPart === 'add' ? 'add' : 'type-button'} ${triggerAttributes?.className ?? ''}`}\n data-cratis-part={triggerPart === 'add' ? 'add' : 'typeButton'}\n >\n {children}\n </AriaButton>\n <Popover\n {...parts?.menu}\n className={`cratis-schema-editor__menu ${parts?.menu?.className ?? ''}`}\n style={{ zIndex, ...parts?.menu?.style } as React.CSSProperties}\n data-cratis-part='menu'\n >\n <Menu aria-label={labels.propertyTypes} onAction={handleAction} className='cratis-schema-editor__menu-list'>\n {primitivePropertyTypes.map(typeItem)}\n {concepts !== undefined && (\n <MenuSection className='cratis-schema-editor__menu-section'>\n <Header className='cratis-schema-editor__menu-heading'>{labels.concepts}</Header>\n {sortedConcepts.length === 0 && (\n <MenuItem\n id='concept-hint'\n isDisabled\n textValue={labels.noConcepts}\n className={`cratis-schema-editor__menu-item cratis-schema-editor__menu-hint ${parts?.menuItem?.className ?? ''}`}\n data-cratis-part='menuItem'\n >\n {labels.noConcepts}\n </MenuItem>\n )}\n {sortedConcepts.map(concept => (\n <MenuItem\n key={concept.name}\n id={`${conceptPrefix}${concept.name}`}\n textValue={concept.name}\n className={`cratis-schema-editor__menu-item ${parts?.menuItem?.className ?? ''}`}\n data-cratis-part='menuItem'\n >\n <PropertyTypeGlyph type={concept.type} />\n {concept.name}\n </MenuItem>\n ))}\n </MenuSection>\n )}\n <Separator className='cratis-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,EAAA,EAPR,OAAO,CAAC,IAAI,CAQV,CACd,CAAC,CAAA,EAAA,CACQ,CACjB,EACDA,GAAA,CAAC,SAAS,EAAA,EAAC,SAAS,EAAC,sCAAsC,EAAA,CAAG,EAC7D,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA,EAAA,CAClC,EAAA,CACD,CAAA,EAAA,CACA,EAAA,CACM;AAEhC;;"}
1
+ {"version":3,"file":"PropertyTypeMenu.js","sources":["../../../../SchemaEditor/Tree/PropertyTypeMenu.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 { useMemo, type ButtonHTMLAttributes, type Key, type ReactNode } from 'react';\nimport { UNSAFE_PortalProvider } from 'react-aria';\nimport { Button as AriaButton } from 'react-aria-components/Button';\nimport { Menu, MenuItem, MenuTrigger, SubmenuTrigger, Popover, Separator } from 'react-aria-components/Menu';\nimport { asReactAriaButtonProps } from '../../Common/reactAriaProps';\nimport { OVERLAY_OFFSET, zIndexAboveDialog } from '../../renderer/dialogStack';\nimport { useNearestDialogZIndex } from '../../renderer/DialogStackContext';\nimport { unstable_useOverlayEnvironment } from '../../renderer/RendererContext';\nimport type { PropertyConcept } from './PropertyConcept';\nimport type { PropertyType } from './PropertyType';\nimport type { SchemaEditorLabels } from '../SchemaEditorLabels';\nimport type { SchemaEditorParts } from './SchemaEditorParts';\nimport { compositePropertyTypes, primitivePropertyTypes, propertyTypeName } from './propertyTypeDisplay';\nimport { PropertyTypeGlyph } from './PropertyTypeGlyph';\n\nconst typePrefix = 'type:';\nconst conceptPrefix = 'concept:';\n\n/** Props for the menu of types the editor offers when adding a property or changing its type. */\nexport interface PropertyTypeMenuProps {\n /** The resolved labels. */\n labels: Required<SchemaEditorLabels>;\n\n /** The concepts offered after the primitive types. `undefined` when the host has not opted into concepts; an empty list shows a disabled hint. */\n concepts: PropertyConcept[] | undefined;\n\n /** The part of the editor the trigger button is: the add button or the row's type button. */\n triggerPart: 'add' | 'typeButton';\n\n /** The accessible name of the trigger. */\n triggerLabel: string;\n\n /** The content of the trigger. */\n children: ReactNode;\n\n /** The parts the host styles. */\n parts: SchemaEditorParts | undefined;\n\n /** Called with the chosen type, and the concept's name when a concept was chosen. */\n onSelect: (type: PropertyType, concept?: string) => void;\n}\n\n/**\n * The accessible menu of types: the primitives, the concepts of the domain, then the composite types. It is a\n * React Aria menu in a popover, so it handles keyboard navigation, typeahead, focus return and dismissal.\n */\nexport const PropertyTypeMenu = ({ labels, concepts, triggerPart, triggerLabel, children, parts, onSelect }: PropertyTypeMenuProps) => {\n const overlayEnvironment = unstable_useOverlayEnvironment();\n const nearestDialogZIndex = useNearestDialogZIndex();\n const zIndex = nearestDialogZIndex === null\n ? 'var(--cratis-z-index-overlay)'\n : zIndexAboveDialog(nearestDialogZIndex, OVERLAY_OFFSET);\n\n const sortedConcepts = useMemo(\n () => [...(concepts ?? [])].sort((left, right) => left.name.localeCompare(right.name)),\n [concepts]);\n\n const handleAction = (key: Key) => {\n const identifier = String(key);\n if (identifier.startsWith(conceptPrefix)) {\n const concept = sortedConcepts.find(candidate => candidate.name === identifier.slice(conceptPrefix.length));\n if (concept) onSelect(concept.type, concept.name);\n return;\n }\n onSelect(identifier.slice(typePrefix.length) as PropertyType);\n };\n\n const typeItem = (type: PropertyType) => (\n <MenuItem\n key={type}\n id={`${typePrefix}${type}`}\n textValue={propertyTypeName(type, labels)}\n className={`cratis-schema-editor__menu-item ${parts?.menuItem?.className ?? ''}`}\n data-cratis-part='menuItem'\n >\n <PropertyTypeGlyph type={type} />\n {propertyTypeName(type, labels)}\n </MenuItem>\n );\n\n const triggerAttributes: ButtonHTMLAttributes<HTMLButtonElement> | undefined = parts?.[triggerPart];\n\n return (\n <UNSAFE_PortalProvider getContainer={overlayEnvironment.getContainer}>\n <MenuTrigger>\n <AriaButton\n {...asReactAriaButtonProps(triggerAttributes)}\n aria-label={triggerLabel}\n className={`cratis-schema-editor__${triggerPart === 'add' ? 'add' : 'type-button'} ${triggerAttributes?.className ?? ''}`}\n data-cratis-part={triggerPart === 'add' ? 'add' : 'typeButton'}\n >\n {children}\n </AriaButton>\n <Popover\n {...parts?.menu}\n className={`cratis-schema-editor__menu ${parts?.menu?.className ?? ''}`}\n style={{ zIndex, ...parts?.menu?.style } as React.CSSProperties}\n data-cratis-part='menu'\n >\n <Menu aria-label={labels.propertyTypes} onAction={handleAction} className='cratis-schema-editor__menu-list'>\n {primitivePropertyTypes.map(typeItem)}\n {concepts !== undefined && (\n <SubmenuTrigger>\n <MenuItem\n id='concepts'\n textValue={labels.concepts}\n className={`cratis-schema-editor__menu-item ${parts?.menuItem?.className ?? ''}`}\n data-cratis-part='menuItem'\n >\n <span className='cratis-schema-editor__menu-label'>{labels.concepts}</span>\n <span className='cratis-schema-editor__menu-arrow' aria-hidden='true'>›</span>\n </MenuItem>\n <Popover\n className={`cratis-schema-editor__menu ${parts?.menu?.className ?? ''}`}\n style={{ zIndex } as React.CSSProperties}\n data-cratis-part='menu'\n >\n <Menu aria-label={labels.concepts} onAction={handleAction} className='cratis-schema-editor__menu-list'>\n {sortedConcepts.length === 0 && (\n <MenuItem\n id='concept-hint'\n isDisabled\n textValue={labels.noConcepts}\n className={`cratis-schema-editor__menu-item cratis-schema-editor__menu-hint ${parts?.menuItem?.className ?? ''}`}\n data-cratis-part='menuItem'\n >\n {labels.noConcepts}\n </MenuItem>\n )}\n {sortedConcepts.map(concept => (\n <MenuItem\n key={concept.name}\n id={`${conceptPrefix}${concept.name}`}\n textValue={concept.name}\n className={`cratis-schema-editor__menu-item ${parts?.menuItem?.className ?? ''}`}\n data-cratis-part='menuItem'\n >\n <PropertyTypeGlyph type={concept.type} />\n {concept.name}\n </MenuItem>\n ))}\n </Menu>\n </Popover>\n </SubmenuTrigger>\n )}\n <Separator className='cratis-schema-editor__menu-separator' />\n {compositePropertyTypes.map(typeItem)}\n </Menu>\n </Popover>\n </MenuTrigger>\n </UNSAFE_PortalProvider>\n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AE1B,MAAM,CAAC,UAAU,GACX,CACd,EACA,cAAc,CAAC,GAAG,CAAC,OAAO,KACvBD,IAAA,CAAC,QAAQ,EAAA,EAEL,EAAE,EAAE,CAAA,EAAG,aAAa,CAAA,EAAG,OAAO,CAAC,IAAI,CAAA,CAAE,EACrC,SAAS,EAAE,OAAO,CAAC,IAAI,EACvB,SAAS,EAAE,CAAA,gCAAA,EAAmC,KAAK,EAAE,QAAQ,EAAE,SAAS,IAAI,EAAE,CAAA,CAAE,sBAC/D,UAAU,EAAA,QAAA,EAAA,CAE3BC,IAAC,iBAAiB,EAAA,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAA,CAAI,EACxC,OAAO,CAAC,IAAI,CAAA,EAAA,EAPR,OAAO,CAAC,IAAI,CAQV,CACd,CAAC,CAAA,EAAA,CACC,GACD,CAAA,EAAA,CACG,CACpB,EACDA,GAAA,CAAC,SAAS,EAAA,EAAC,SAAS,EAAC,sCAAsC,EAAA,CAAG,EAC7D,sBAAsB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA,EAAA,CAClC,GACD,CAAA,EAAA,CACA,EAAA,CACM;AAEhC;;"}
@@ -2264,6 +2264,14 @@
2264
2264
  text-transform: uppercase;
2265
2265
  }
2266
2266
 
2267
+ .cratis-schema-editor__menu-label {
2268
+ flex: 1;
2269
+ }
2270
+
2271
+ .cratis-schema-editor__menu-arrow {
2272
+ opacity: 0.6;
2273
+ }
2274
+
2267
2275
  .cratis-schema-editor__menu-hint {
2268
2276
  color: var(--cratis-text-color-secondary);
2269
2277
  font-style: italic;
@@ -7835,6 +7835,14 @@
7835
7835
  text-transform: uppercase;
7836
7836
  }
7837
7837
 
7838
+ .cratis-schema-editor__menu-label {
7839
+ flex: 1;
7840
+ }
7841
+
7842
+ .cratis-schema-editor__menu-arrow {
7843
+ opacity: 0.6;
7844
+ }
7845
+
7838
7846
  .cratis-schema-editor__menu-hint {
7839
7847
  color: var(--cratis-text-color-secondary);
7840
7848
  font-style: italic;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cratis/components",
3
- "version": "4.26.1",
3
+ "version": "4.26.2",
4
4
  "description": "React components for CQRS and event-sourced apps — command dialogs, typed forms, and query-backed data tables for Cratis Arc",
5
5
  "keywords": [
6
6
  "react",