@inf-monkeys-tech/monkeys-design 2.0.435 → 2.0.436

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.
@@ -8307,47 +8307,49 @@ const RecordEditor = ({
8307
8307
  ))}
8308
8308
  </ul>
8309
8309
  ) : null;
8310
- const actions = (
8310
+ const cancelAction = model.showCancel !== false
8311
+ ? actionHint(
8312
+ <BaseButton
8313
+ variant={model.cancelButtonVariant === 'ghost' ? 'ghost' : actionButtonVariant}
8314
+ className={model.cancelButtonVariant === 'ghost' ? 'border-0 bg-transparent shadow-none' : actionButtonClassName}
8315
+ label={cancelLabel}
8316
+ iconOnly={iconActions}
8317
+ size={iconActions ? 'md' : undefined}
8318
+ icon={iconActions ? <X className="h-4 w-4" /> : undefined}
8319
+ disabled={editorLocked}
8320
+ onClick={cancel}
8321
+ />,
8322
+ cancelLabel,
8323
+ )
8324
+ : null;
8325
+ const submitAction = model.showSubmit !== false
8326
+ ? actionHint(
8327
+ <BaseButton
8328
+ variant={model.submitButtonVariant === 'solid' ? 'solid' : actionButtonVariant}
8329
+ className={actionButtonClassName}
8330
+ label={submitLabel}
8331
+ style={model.submitButtonVariant === 'solid' ? { backgroundColor: 'hsl(var(--primary))', color: 'hsl(var(--primary-foreground))', borderColor: 'transparent' } : undefined}
8332
+ classNames={model.submitButtonVariant === 'solid' ? { label: '!text-inherit', icon: '!text-inherit' } : undefined}
8333
+ iconOnly={iconActions}
8334
+ size={iconActions ? 'md' : undefined}
8335
+ icon={model.submitIcon === 'check' ? <Check className="h-4 w-4" /> : iconActions || model.submitIcon === 'save' ? <Save className="h-4 w-4" /> : undefined}
8336
+ tone={model.submitDestructive === true ? 'danger' : model.submitTone === 'primary' ? 'primary' : 'default'}
8337
+ loading={model.submitting === true && !auxPending}
8338
+ disabled={Boolean(cannotSubmit || draftInvalid || fieldErrors.length)}
8339
+ onClick={() => submit()}
8340
+ />,
8341
+ submitLabel,
8342
+ )
8343
+ : null;
8344
+ const actions = (primaryFirst = false) => (
8311
8345
  <>
8312
8346
  {resetButton}
8313
8347
  {errorSummary}
8314
8348
  {stringValue(model.errorCode) ? (
8315
8349
  <CapabilityStatus kind="error" code={String(model.errorCode)} translate={translate} />
8316
8350
  ) : null}
8317
- {model.showCancel !== false
8318
- ? actionHint(
8319
- <BaseButton
8320
- variant={model.cancelButtonVariant === 'ghost' ? 'ghost' : actionButtonVariant}
8321
- className={model.cancelButtonVariant === 'ghost' ? 'border-0 bg-transparent shadow-none' : actionButtonClassName}
8322
- label={cancelLabel}
8323
- iconOnly={iconActions}
8324
- size={iconActions ? 'md' : undefined}
8325
- icon={iconActions ? <X className="h-4 w-4" /> : undefined}
8326
- disabled={editorLocked}
8327
- onClick={cancel}
8328
- />,
8329
- cancelLabel,
8330
- )
8331
- : null}
8332
- {model.showSubmit !== false
8333
- ? actionHint(
8334
- <BaseButton
8335
- variant={model.submitButtonVariant === 'solid' ? 'solid' : actionButtonVariant}
8336
- className={actionButtonClassName}
8337
- label={submitLabel}
8338
- style={model.submitButtonVariant === 'solid' ? { backgroundColor: 'hsl(var(--primary))', color: 'hsl(var(--primary-foreground))', borderColor: 'transparent' } : undefined}
8339
- classNames={model.submitButtonVariant === 'solid' ? { label: '!text-inherit', icon: '!text-inherit' } : undefined}
8340
- iconOnly={iconActions}
8341
- size={iconActions ? 'md' : undefined}
8342
- icon={model.submitIcon === 'check' ? <Check className="h-4 w-4" /> : iconActions || model.submitIcon === 'save' ? <Save className="h-4 w-4" /> : undefined}
8343
- tone={model.submitDestructive === true ? 'danger' : model.submitTone === 'primary' ? 'primary' : 'default'}
8344
- loading={model.submitting === true && !auxPending}
8345
- disabled={Boolean(cannotSubmit || draftInvalid || fieldErrors.length)}
8346
- onClick={() => submit()}
8347
- />,
8348
- submitLabel,
8349
- )
8350
- : null}
8351
+ {primaryFirst ? submitAction : cancelAction}
8352
+ {primaryFirst ? cancelAction : submitAction}
8351
8353
  </>
8352
8354
  );
8353
8355
  const renderAuxiliaryAction = (action: JsonObject, disabled = false) => (
@@ -8392,7 +8394,7 @@ const RecordEditor = ({
8392
8394
  loading={model.submitting === true && !auxPending} disabled={Boolean(cannotSubmit || draftInvalid || fieldErrors.length)}
8393
8395
  onClick={() => submit()}>{submitLabel}</UIButton> : null}
8394
8396
  </>;
8395
- const renderActionBar = () =>
8397
+ const renderActionBar = (primaryFirst = false) =>
8396
8398
  model.actionBarChrome === 'plain' ? (
8397
8399
  <div
8398
8400
  data-record-editor-actions
@@ -8400,7 +8402,7 @@ const RecordEditor = ({
8400
8402
  className={cn('flex flex-wrap items-center gap-token-sm', model.actionBarAlign === 'end' && 'justify-end')}
8401
8403
  >
8402
8404
  {auxiliaryButtons}
8403
- {model.presentation === 'embedded' && model.pageLayout === 'workspace' ? embeddedWorkspaceActions : actions}
8405
+ {model.presentation === 'embedded' && model.pageLayout === 'workspace' ? embeddedWorkspaceActions : actions(primaryFirst)}
8404
8406
  {childrenBySlot.footer}
8405
8407
  </div>
8406
8408
  ) : (
@@ -8409,7 +8411,7 @@ const RecordEditor = ({
8409
8411
  actions={childrenBySlot.footer}
8410
8412
  >
8411
8413
  {auxiliaryButtons}
8412
- {model.presentation === 'embedded' && model.pageLayout === 'workspace' ? embeddedWorkspaceActions : actions}
8414
+ {model.presentation === 'embedded' && model.pageLayout === 'workspace' ? embeddedWorkspaceActions : actions(primaryFirst)}
8413
8415
  </BaseToolbar>
8414
8416
  );
8415
8417
  if (fieldsOnly) return renderFields(false);
@@ -8568,7 +8570,7 @@ const RecordEditor = ({
8568
8570
  }
8569
8571
  >
8570
8572
  {auxiliaryButtons}
8571
- {actions}
8573
+ {actions()}
8572
8574
  {childrenBySlot.footer}
8573
8575
  </div>
8574
8576
  </div>
@@ -8584,26 +8586,42 @@ const RecordEditor = ({
8584
8586
  {renderFields(false)}
8585
8587
  <BaseInline gap="var(--global-spacing)">
8586
8588
  {auxiliaryButtons}
8587
- {actions}
8589
+ {actions()}
8588
8590
  {childrenBySlot.footer}
8589
8591
  </BaseInline>
8590
8592
  </div>
8591
8593
  );
8592
- if (model.presentation === 'sections')
8594
+ if (model.presentation === 'sections') {
8595
+ const fixedFooter = model.actionBarPlacement === 'footer';
8596
+ const sections = (
8597
+ <>
8598
+ {helpInTooltip && description !== null ? <div>{titleWithHelp}</div> : null}
8599
+ {!helpInTooltip && description !== null ? <p className="text-sm text-muted-foreground">{description}</p> : null}
8600
+ {renderFields(false)}
8601
+ {childrenBySlot.beforeActions}
8602
+ </>
8603
+ );
8593
8604
  return (
8594
- <BaseStack gap="var(--global-spacing)" data-record-editor-sections
8605
+ <BaseStack gap={fixedFooter ? 0 : 'var(--global-spacing)'} data-record-editor-sections
8606
+ className={fixedFooter ? 'h-full min-h-0' : undefined}
8595
8607
  data-control-height={typeof model.controlHeight === 'number' || undefined}
8596
8608
  data-textarea-height={typeof model.textareaMinHeight === 'number' || undefined}
8597
8609
  style={{ '--monkeys-editor-control-height': typeof model.controlHeight === 'number' ? `${model.controlHeight}px` : undefined,
8598
8610
  '--monkeys-editor-textarea-height': typeof model.textareaMinHeight === 'number' ? `${model.textareaMinHeight}px` : undefined } as CSSProperties}>
8599
8611
  {childrenBySlot.header}
8600
- {helpInTooltip && description !== null ? <div>{titleWithHelp}</div> : null}
8601
- {!helpInTooltip && description !== null ? <p className="text-sm text-muted-foreground">{description}</p> : null}
8602
- {renderFields(false)}
8603
- {childrenBySlot.beforeActions}
8604
- {renderActionBar()}
8612
+ {fixedFooter ? (
8613
+ <>
8614
+ <div data-record-editor-scroll-body className="flex min-h-0 flex-1 flex-col gap-token-md overflow-y-auto">
8615
+ {sections}
8616
+ </div>
8617
+ <div data-record-editor-fixed-footer className="shrink-0">
8618
+ {renderActionBar(true)}
8619
+ </div>
8620
+ </>
8621
+ ) : <>{sections}{renderActionBar()}</>}
8605
8622
  </BaseStack>
8606
8623
  );
8624
+ }
8607
8625
  if (model.presentation === 'data-explorer-dialog' || model.presentation === 'dialog') {
8608
8626
  return (
8609
8627
  <Dialog open onOpenChange={(open) => !open && cancel()}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inf-monkeys-tech/monkeys-design",
3
- "version": "2.0.435",
3
+ "version": "2.0.436",
4
4
  "description": "Monkeys Design Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -380,5 +380,5 @@
380
380
  ],
381
381
  "license": "MIT",
382
382
  "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
383
- "monkeysReleaseCommit": "cea2b4c2c496d655b4050338c42c213be2c5bfb5"
383
+ "monkeysReleaseCommit": "1f9d1cf20a4fa5823fd7fe0d5edcbb3651d234ad"
384
384
  }