@box/metadata-template-editor 2.2.28 → 2.3.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as MetadataTemplateEditorMode}from"./types.js";import messages_default from"../esm/lib/messages.js";import{t as MetadataTemplateEditor}from"./metadata-template-editor.js";import{Modal}from"@box/blueprint-web";import{useIntl}from"react-intl";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{useCallback,useEffect,useId,useRef,useState}from"react";import clsx from"clsx";import '../styles/metadata-template-editor-modal.css';var metadata_template_editor_modal_module_default={modal:`
|
|
1
|
+
import{o as MetadataTemplateEditorMode}from"./types.js";import messages_default from"../esm/lib/messages.js";import{t as MetadataTemplateEditor}from"./metadata-template-editor.js";import{Modal}from"@box/blueprint-web";import{useIntl}from"react-intl";import{Fragment,jsx,jsxs}from"react/jsx-runtime";import{useCallback,useEffect,useId,useRef,useState}from"react";import clsx from"clsx";import '../styles/metadata-template-editor-modal.css';var metadata_template_editor_modal_module_default={modal:`_modal_7kuew_1`,modalScrollableContainer:`_modalScrollableContainer_7kuew_6`,modalBody:`_modalBody_7kuew_12`,modalBodyCentered:`_modalBodyCentered_7kuew_20`,modalContentWidth:`_modalContentWidth_7kuew_25`};function MetadataTemplateEditorModal({open,onOpenChange,onTemplateLoad,onValidationChange,onCancel,title,...editorProps}){let intl=useIntl(),formId=useId(),editorRef=useRef(null),[isSubmitting,setIsSubmitting]=useState(!1),[isDirty,setIsDirty]=useState(!1),[loadedTemplateName,setLoadedTemplateName]=useState(void 0),isEditMode=editorProps.mode===MetadataTemplateEditorMode.Edit,isReadOnlyMode=editorProps.mode===MetadataTemplateEditorMode.ReadOnly,closeEditor=useCallback(()=>{onCancel?.(),onOpenChange(!1)},[onCancel,onOpenChange]);useEffect(()=>{open||(setIsDirty(!1),setLoadedTemplateName(void 0))},[open]);let handleOpenChange=newOpen=>{newOpen?onOpenChange(newOpen):editorRef.current?.requestClose()},handleTemplateLoad=template=>{setLoadedTemplateName(template.displayName),onTemplateLoad?.(template)},wrapSubmit=callback=>async(...args)=>{setIsSubmitting(!0);try{await callback(...args),onOpenChange(!1)}finally{setIsSubmitting(!1)}},wrappedEditorProps;wrappedEditorProps=isEditMode?{...editorProps,onEditTemplate:wrapSubmit(editorProps.onEditTemplate)}:isReadOnlyMode?editorProps:{...editorProps,onCreateTemplate:wrapSubmit(editorProps.onCreateTemplate)};let isSaveDisabled=isSubmitting||isEditMode&&!isDirty,isBodyCentered=(isEditMode||isReadOnlyMode)&&!loadedTemplateName,defaultTitle;defaultTitle=isReadOnlyMode?loadedTemplateName?intl.formatMessage(messages_default.viewTitle,{templateName:loadedTemplateName}):``:isEditMode&&loadedTemplateName?intl.formatMessage(messages_default.editTitle,{templateName:loadedTemplateName}):intl.formatMessage(messages_default.createTitle);let modalTitle=title??defaultTitle;return jsx(Modal,{open,onOpenChange:handleOpenChange,children:jsxs(Modal.Content,{size:`large`,className:metadata_template_editor_modal_module_default.modal,children:[jsx(Modal.Header,{children:modalTitle}),jsx(Modal.ScrollableContainer,{className:metadata_template_editor_modal_module_default.modalScrollableContainer,children:jsx(Modal.Body,{className:clsx(metadata_template_editor_modal_module_default.modalBody,{[metadata_template_editor_modal_module_default.modalBodyCentered]:isBodyCentered}),children:jsx(`div`,{className:metadata_template_editor_modal_module_default.modalContentWidth,children:jsx(MetadataTemplateEditor,{...wrappedEditorProps,ref:editorRef,formId,hideActions:!0,onCancel:closeEditor,onDirtyStateChange:setIsDirty,onValidationChange,onTemplateLoad:handleTemplateLoad})})})}),jsx(Modal.Footer,{children:isReadOnlyMode?jsx(Modal.Footer.PrimaryButton,{onClick:closeEditor,size:`large`,children:intl.formatMessage(messages_default.close)}):jsxs(Fragment,{children:[jsx(Modal.Footer.SecondaryButton,{onClick:()=>editorRef.current?.requestClose(),size:`large`,children:intl.formatMessage(messages_default.cancel)}),jsx(Modal.Footer.PrimaryButton,{variant:`primary`,type:`submit`,form:formId,loading:isSubmitting,loadingAriaLabel:intl.formatMessage(messages_default.submitting),disabled:isSaveDisabled,children:intl.formatMessage(messages_default.save)})]})}),jsx(Modal.Close,{"aria-label":intl.formatMessage(messages_default.closeAriaLabel)})]})})}export{MetadataTemplateEditorModal as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._modal_7kuew_1{min-height:620px;max-height:620px}._modalScrollableContainer_7kuew_6{flex-direction:column;height:100%;display:flex}._modalBody_7kuew_12{flex-direction:column;flex:1;justify-content:flex-start;height:100%;display:flex}._modalBodyCentered_7kuew_20{justify-content:center;align-items:center}._modalContentWidth_7kuew_25{min-width:calc(620px - 2 * var(--bp-space-060))}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-template-editor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@box/blueprint-web": "^16.
|
|
7
|
-
"@box/blueprint-web-assets": "^5.
|
|
6
|
+
"@box/blueprint-web": "^16.14.1",
|
|
7
|
+
"@box/blueprint-web-assets": "^5.6.1",
|
|
8
8
|
"@dnd-kit/core": "^6.1.0",
|
|
9
9
|
"@dnd-kit/sortable": "^8.0.0",
|
|
10
10
|
"@dnd-kit/utilities": "^3.2.2",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"yup": "^1.6.1"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@box/blueprint-web": "^16.
|
|
21
|
-
"@box/blueprint-web-assets": "^5.
|
|
22
|
-
"@box/eslint-plugin-blueprint": "2.
|
|
23
|
-
"@box/storybook-utils": "1.1
|
|
20
|
+
"@box/blueprint-web": "^16.14.1",
|
|
21
|
+
"@box/blueprint-web-assets": "^5.6.1",
|
|
22
|
+
"@box/eslint-plugin-blueprint": "2.2.0",
|
|
23
|
+
"@box/storybook-utils": "1.2.1",
|
|
24
24
|
"@dnd-kit/core": "^6.1.0",
|
|
25
25
|
"@dnd-kit/sortable": "^8.0.0",
|
|
26
26
|
"@dnd-kit/utilities": "^3.2.2",
|