@camunda/ccma-saas-frontend 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
  2. package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +40 -9
  3. package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +17 -0
  4. package/lib/esm/components/c4-cluster-settings/elements/danger-zone.js +9 -1
  5. package/lib/esm/components/c4-cluster-tag-selector/c4-cluster-tag-selector.js +5 -5
  6. package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.js +3 -3
  7. package/lib/esm/components/c4-convert-trial-organization-modal/c4-convert-trial-organization-modal.js +1 -11
  8. package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.js +1 -14
  9. package/lib/esm/components/c4-create-cluster/c4-create-cluster.d.ts +1 -1
  10. package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +188 -71
  11. package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +52 -0
  12. package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js +1 -11
  13. package/lib/esm/components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.js +6 -13
  14. package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js +1 -11
  15. package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.js +1 -18
  16. package/lib/esm/components/c4-create-trial-organization-modal/c4-create-trial-organization-modal.js +1 -11
  17. package/lib/esm/components/c4-delete-account-modal/c4-delete-account-modal.d.ts +0 -7
  18. package/lib/esm/components/c4-delete-account-modal/c4-delete-account-modal.js +1 -24
  19. package/lib/esm/components/c4-delete-organization-modal/c4-delete-organization-modal.js +1 -18
  20. package/lib/esm/components/c4-divider/c4-divider.js +12 -0
  21. package/lib/esm/components/c4-empty-state/c4-empty-state.d.ts +8 -0
  22. package/lib/esm/components/c4-empty-state/c4-empty-state.js +32 -8
  23. package/lib/esm/components/c4-file-uploader/c4-file-uploader.d.ts +36 -0
  24. package/lib/esm/components/c4-file-uploader/c4-file-uploader.js +43 -0
  25. package/lib/esm/components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.js +1 -11
  26. package/lib/esm/components/c4-leave-organization-modal/c4-leave-organization-modal.js +1 -11
  27. package/lib/esm/components/c4-rename-organization-modal/c4-rename-organization-modal.js +1 -11
  28. package/lib/esm/components/c4-segmented-control/c4-segmented-control.d.ts +46 -0
  29. package/lib/esm/components/c4-segmented-control/c4-segmented-control.js +117 -0
  30. package/lib/esm/externalUrls.const.d.ts +7 -0
  31. package/lib/esm/externalUrls.const.js +11 -1
  32. package/lib/esm/i18n/c4-console-i18n.js +3 -0
  33. package/lib/esm/i18n/en/modals/apiclients.json +2 -1
  34. package/lib/esm/i18n/en/modals/clusterclients.json +2 -1
  35. package/lib/esm/i18n/en/pages/clusterdetails.json +12 -1
  36. package/lib/esm/i18n/en/pages/clusters.json +1 -0
  37. package/lib/esm/i18n/en/pages/createcluster.json +43 -0
  38. package/lib/esm/i18n/en/pages/orgmanagement.json +3 -0
  39. package/lib/esm/index.d.ts +2 -0
  40. package/lib/esm/index.js +2 -0
  41. package/lib/esm/runtime/c4-console-runtime-context.d.ts +7 -0
  42. package/lib/esm/runtime/c4-console-runtime-context.js +130 -2
  43. package/lib/esm/runtime/c4-console-runtime.types.d.ts +22 -0
  44. package/lib/esm/runtime/cluster-creation-blocked.d.ts +16 -0
  45. package/lib/esm/runtime/cluster-creation-blocked.js +21 -0
  46. package/lib/esm/runtime/cluster-duplication.d.ts +10 -0
  47. package/lib/esm/runtime/cluster-duplication.js +15 -0
  48. package/lib/esm/ui/c4-password-input.js +1 -1
  49. package/lib/esm/ui/index.d.ts +1 -0
  50. package/lib/esm/ui/index.js +16 -2
  51. package/lib/esm/utils/role-labels.d.ts +1 -2
  52. package/lib/esm/utils/role-labels.js +1 -13
  53. package/lib/esm/utils/safe-translate.d.ts +4 -2
  54. package/lib/esm/utils/safe-translate.js +9 -2
  55. package/lib/esm/widgets/cluster-client-details/c4-cluster-client-details-app.js +2 -12
  56. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +34 -23
  57. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +6 -0
  58. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +7 -0
  59. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +3 -0
  60. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-activity-tab.js +1 -19
  61. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-alerts-tab.js +1 -14
  62. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-byom-clients-tab.js +1 -18
  63. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +1 -1
  64. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.d.ts +1 -0
  65. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +77 -28
  66. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +1 -6
  67. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-ip-whitelist-tab.js +1 -18
  68. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +31 -29
  69. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.js +1 -6
  70. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +1 -16
  71. package/lib/esm/widgets/clusters/c4-clusters-page.js +99 -103
  72. package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +9 -0
  73. package/lib/esm/widgets/connector-management/c4-connector-management-page.js +1 -9
  74. package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +1 -9
  75. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +88 -1
  76. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +285 -45
  77. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.types.d.ts +9 -0
  78. package/lib/esm/widgets/dashboard/c4-dashboard-app.js +10 -24
  79. package/lib/esm/widgets/environment/c4-cluster-connector-secrets-widget.js +1 -1
  80. package/lib/esm/widgets/group-details/c4-group-details-page.js +1 -9
  81. package/lib/esm/widgets/job-worker/c4-job-worker.helpers.d.ts +1 -0
  82. package/lib/esm/widgets/job-worker/c4-job-worker.helpers.js +4 -34
  83. package/lib/esm/widgets/management/c4-management-app.js +1 -20
  84. package/lib/esm/widgets/management/c4-management-page.js +1 -9
  85. package/lib/esm/widgets/management/tabs/c4-management-api-tab.js +1 -13
  86. package/lib/esm/widgets/management/tabs/c4-management-billing-tab.js +1 -9
  87. package/lib/esm/widgets/management/tabs/c4-management-overview-tab.js +1 -13
  88. package/lib/esm/widgets/management/tabs/c4-management-pricing-tab.js +1 -8
  89. package/lib/esm/widgets/management/tabs/c4-management-settings-tab.js +1 -24
  90. package/lib/esm/widgets/management/tabs/c4-management-users-tab.js +1 -13
  91. package/lib/esm/widgets/user-account/c4-delete-account-widget.js +2 -1
  92. package/lib/esm/widgets/user-details/c4-user-details-page.js +1 -9
  93. package/package.json +3 -3
@@ -7,6 +7,7 @@ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-run
7
7
  import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from 'react';
8
8
  import { useHubApiNaming } from '../../runtime/use-hub-api-naming.js';
9
9
  import { Form, Link, Modal, Stack, TextInput } from '../../ui/index.js';
10
+ import { safeTranslate } from '../../utils/safe-translate.js';
10
11
  import { C4ApiClientScopePicker } from '../c4-api-client-scope-picker/c4-api-client-scope-picker.js';
11
12
  import { C4ClusterClientCredentialsModal } from '../c4-cluster-client-credentials/c4-cluster-client-credentials.js';
12
13
  function isApiClientNameValid(name) {
@@ -40,17 +41,6 @@ function joinUrl(baseUrl, path) {
40
41
  function toAudienceFromApiBaseUrl(apiBaseUrl) {
41
42
  return apiBaseUrl.replace(/^https?:\/\//, '');
42
43
  }
43
- function safeTranslate(t, key, defaultValue, options) {
44
- if (!t)
45
- return defaultValue;
46
- try {
47
- const translated = t(key, options);
48
- return typeof translated === 'string' ? translated : defaultValue;
49
- }
50
- catch {
51
- return defaultValue;
52
- }
53
- }
54
44
  function renderInlineLink0(value, renderLink) {
55
45
  const match = value.match(/^(.*)<0>(.*)<\/0>(.*)$/);
56
46
  if (!match)
@@ -7,25 +7,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  import { normalizeCIDRList } from '@camunda/ccma-shared-types';
8
8
  import { forwardRef, useCallback, useImperativeHandle, useState, } from 'react';
9
9
  import { Form, Modal, Stack, TextInput } from '../../ui/index.js';
10
+ import { safeTranslate } from '../../utils/safe-translate.js';
10
11
  import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
11
- // Helper function to ensure translations work
12
- function safeTranslate(t, key, fallback) {
13
- if (!t)
14
- return fallback;
15
- const result = t(key);
16
- if (!result || result === key) {
17
- return fallback;
18
- }
19
- // i18next can return the key *without* the namespace when the namespace is missing.
20
- // Example: `ipwhitelist:data.title` -> `data.title`
21
- if (key.includes(':')) {
22
- const withoutNamespace = key.split(':').slice(1).join(':');
23
- if (result === withoutNamespace) {
24
- return fallback;
25
- }
26
- }
27
- return result;
28
- }
29
12
  export const C4CreateIpWhitelistModal = forwardRef(({ t, onCreateIpWhitelist, onCancel, onSubmitStart, onSubmitError }, ref) => {
30
13
  const [isOpen, setIsOpen] = useState(false);
31
14
  const [busy, setBusy] = useState(false);
@@ -6,18 +6,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  */
7
7
  import { useCallback, useRef } from 'react';
8
8
  import { Form, Stack, TextInput } from '../../ui/index.js';
9
+ import { safeTranslate } from '../../utils/safe-translate.js';
9
10
  import { C4AsyncModal } from '../c4-async-modal/c4-async-modal.js';
10
- function safeTranslate(t, key, defaultValue, options) {
11
- if (!t)
12
- return defaultValue;
13
- try {
14
- const translated = t(key, options);
15
- return typeof translated === 'string' ? translated : defaultValue;
16
- }
17
- catch {
18
- return defaultValue;
19
- }
20
- }
21
11
  export const C4CreateTrialOrganizationModal = ({ t, open, name, nameInvalid, nameInvalidText, error, onNameChange, onNameBlur, onRequestClose, onRequestSubmit, preventCloseOnClickOutside, }) => {
22
12
  const formContainerRef = useRef(null);
23
13
  const getForm = useCallback(() => {
@@ -1,10 +1,3 @@
1
1
  import { type JSX } from 'react';
2
2
  import { type C4DeleteAccountModalProps } from './c4-delete-account-modal.types.js';
3
- /**
4
- * Look up a translation, and fall back to English when the host has no
5
- * `t` function or no translation for `key`. Exported so the widget can use
6
- * the same fallback for copy that does not live inside this component (the
7
- * generic delete error).
8
- */
9
- export declare function safeTranslate(t: ((key: string, options?: Record<string, unknown>) => string) | undefined, key: string, fallback: string, options?: Record<string, unknown>): string;
10
3
  export declare const C4DeleteAccountModal: ({ t, open, isEnterpriseOwner, isEnterpriseAdmin, loading, onRequestClose, onRequestSubmit, preventCloseOnClickOutside, }: C4DeleteAccountModalProps) => JSX.Element;
@@ -8,33 +8,10 @@ import { useEffect, useState } from 'react';
8
8
  import { C4_EXTERNAL_URLS } from '../../externalUrls.const.js';
9
9
  import { Link, Modal, Stack, TextInput } from '../../ui/index.js';
10
10
  import { useRadioFamily } from '../../ui/families.js';
11
+ import { safeTranslate } from '../../utils/safe-translate.js';
11
12
  import { C4AsyncModal } from '../c4-async-modal/c4-async-modal.js';
12
13
  import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
13
14
  import { C4_DELETE_ACCOUNT_REASONS, } from './c4-delete-account-modal.types.js';
14
- /**
15
- * Look up a translation, and fall back to English when the host has no
16
- * `t` function or no translation for `key`. Exported so the widget can use
17
- * the same fallback for copy that does not live inside this component (the
18
- * generic delete error).
19
- */
20
- export function safeTranslate(t, key, fallback, options) {
21
- try {
22
- const translated = t?.(key, options);
23
- if (!translated || translated === key) {
24
- return fallback;
25
- }
26
- if (key.includes(':')) {
27
- const withoutNamespace = key.split(':').slice(1).join(':');
28
- if (translated === withoutNamespace) {
29
- return fallback;
30
- }
31
- }
32
- return translated;
33
- }
34
- catch {
35
- return fallback;
36
- }
37
- }
38
15
  export const C4DeleteAccountModal = ({ t, open, isEnterpriseOwner, isEnterpriseAdmin, loading, onRequestClose, onRequestSubmit, preventCloseOnClickOutside, }) => {
39
16
  const { RadioButton, RadioButtonGroup } = useRadioFamily();
40
17
  const [reason, setReason] = useState('');
@@ -6,25 +6,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  */
7
7
  import { useEffect, useState } from 'react';
8
8
  import { Modal, Stack, TextInput } from '../../ui/index.js';
9
+ import { safeTranslate } from '../../utils/safe-translate.js';
9
10
  import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
10
- function safeTranslate(t, key, fallback, options) {
11
- try {
12
- const translated = t?.(key, options);
13
- if (!translated || translated === key) {
14
- return fallback;
15
- }
16
- if (key.includes(':')) {
17
- const withoutNamespace = key.split(':').slice(1).join(':');
18
- if (translated === withoutNamespace) {
19
- return fallback;
20
- }
21
- }
22
- return translated;
23
- }
24
- catch {
25
- return fallback;
26
- }
27
- }
28
11
  export const C4DeleteOrganizationModal = ({ t, open, loading, error, errorMessage, organizationName, onRequestClose, onRequestSubmit, preventCloseOnClickOutside, }) => {
29
12
  const [confirmText, setConfirmText] = useState('');
30
13
  useEffect(() => {
@@ -1,11 +1,23 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
4
+ * under one or more contributor license agreements. Licensed under a commercial license.
5
+ * You may not use this file except in compliance with the commercial license.
6
+ */
7
+ import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
2
8
  export const C4Divider = ({ width }) => {
9
+ const designSystem = useC4DesignSystem();
3
10
  const divider = (_jsx("hr", { style: {
4
11
  width: width ?? '100%',
5
12
  borderTop: '1px solid var(--cds-border-subtle-01)',
6
13
  borderBottom: 'none',
7
14
  borderLeft: 'none',
8
15
  borderRight: 'none',
16
+ // ds-mode only. The DS stylesheet resets the margin of every element
17
+ // inside `.c4-ui`, thus the rule loses the vertical margin that a
18
+ // browser gives an `hr` and the sections on each side of it close up.
19
+ // Carbon keeps the browser default and does not change.
20
+ ...(designSystem === 'ds' ? { marginBlock: '0.5rem' } : {}),
9
21
  } }));
10
22
  return divider;
11
23
  };
@@ -42,6 +42,14 @@ export interface C4EmptyStateProps {
42
42
  * mode (the c3 empty state is unchanged).
43
43
  */
44
44
  card?: boolean;
45
+ /**
46
+ * ds-mode only. `'start'` puts the icon, the text and the actions on the
47
+ * left edge, and not in the center. It also makes the vertical padding
48
+ * smaller, thus the content starts near the top edge of its panel. Use it
49
+ * when the page content around the empty state is also left-aligned. Carbon
50
+ * mode ignores this prop: the c3 empty state does not change.
51
+ */
52
+ align?: 'center' | 'start';
45
53
  }
46
54
  export declare const C4EmptyState: (props: C4EmptyStateProps) => JSX.Element;
47
55
  export {};
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  /*
3
3
  * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
4
4
  * under one or more contributor license agreements. Licensed under a commercial license.
@@ -16,18 +16,42 @@ function renderAction(action, variant) {
16
16
  }
17
17
  export const C4EmptyState = (props) => {
18
18
  const designSystem = useC4DesignSystem();
19
- // `card` is a ds-only prop; strip it from the carbon passthrough so it never
20
- // reaches the c3 component (and the DOM).
21
- const { card, ...c3Props } = props;
19
+ // `card` and `align` are ds-only props; strip them from the carbon
20
+ // passthrough so they never reach the c3 component (and the DOM).
21
+ const { card, align, ...c3Props } = props;
22
22
  if (designSystem !== 'ds') {
23
23
  return _jsx(C3EmptyState, { ...c3Props });
24
24
  }
25
+ const alignStart = align === 'start';
25
26
  const actions = [props.button, ...(props.buttons ?? [])].filter((b) => Boolean(b));
26
- const action = actions[0] ? renderAction(actions[0], 'default') : undefined;
27
- const secondaryAction = actions[1] ? (renderAction(actions[1], 'secondary')) : props.link ? (_jsx(Button, { variant: 'link', asChild: true, children: _jsx("a", { href: props.link.href, onClick: props.link.onClick, children: props.link.label }) })) : undefined;
28
- const emptyState = (_jsx(EmptyState, { heading: props.heading, description: props.description, icon: props.icon ? (_jsx("img", { src: props.icon.path, alt: props.icon.altText, width: 48 })) : undefined, action: action, secondaryAction: secondaryAction }));
27
+ const primaryAction = actions[0]
28
+ ? renderAction(actions[0], 'default')
29
+ : undefined;
30
+ const secondaryActions = actions[1] || props.link ? (_jsxs(_Fragment, { children: [actions[1] ? renderAction(actions[1], 'secondary') : null, props.link ? (
31
+ // A link button keeps the horizontal padding of a button, which puts
32
+ // its label 10px off the edge that the text and the icon use. `px-0`
33
+ // gives the label the same edge.
34
+ _jsx(Button, { variant: 'link', asChild: true, className: alignStart ? 'px-0' : undefined, children: _jsx("a", { href: props.link.href, onClick: props.link.onClick, children: props.link.label }) })) : null] })) : undefined;
35
+ // The DS empty state centers its own content (`items-center text-center`) and
36
+ // gives it 4rem of vertical padding (`py-16`). tailwind-merge keeps the last
37
+ // class of a group, thus these three replace the centered defaults. Every
38
+ // class is in the DS stylesheet, which is the only Tailwind build that a c4
39
+ // consumer loads: a class that the DS components do not use themselves has no
40
+ // rule and does nothing here.
41
+ //
42
+ // `py-8` is the vertical padding of the compact DS size. A left-aligned empty
43
+ // state fills a panel that has navigation beside it, thus the content starts
44
+ // near the top edge and belongs to the panel. 4rem makes it float.
45
+ const alignClassName = alignStart ? 'items-start py-8 text-left' : undefined;
46
+ // The DS empty state puts the actions in a column of its own, and that column
47
+ // centers them (`flex flex-col items-center gap-2`). `className` reaches the
48
+ // root element only, thus `items-start` cannot move the actions. `align-self`
49
+ // of a child wins over `align-items` of its parent, thus `self-start` on the
50
+ // action nodes puts the buttons on the same edge as the text.
51
+ const alignAction = (action) => alignStart ? (_jsx("div", { className: 'flex flex-col items-start gap-2 self-start', children: action })) : (action);
52
+ const emptyState = (_jsx(EmptyState, { className: alignClassName, heading: props.heading, description: props.description, icon: props.icon ? (_jsx("img", { src: props.icon.path, alt: props.icon.altText, width: 48 })) : undefined, action: primaryAction ? alignAction(primaryAction) : undefined, secondaryAction: secondaryActions ? alignAction(secondaryActions) : undefined }));
29
53
  if (card) {
30
- return (_jsx("div", { className: 'flex items-center justify-center rounded-xl border bg-neutral-background-subtle p-12', style: { minHeight: '20rem' }, children: emptyState }));
54
+ return (_jsx("div", { className: `flex items-center rounded-xl border bg-neutral-background-subtle p-10 ${alignStart ? '' : 'justify-center'}`, style: { minHeight: '20rem' }, children: emptyState }));
31
55
  }
32
56
  return emptyState;
33
57
  };
@@ -0,0 +1,36 @@
1
+ import type { JSX } from 'react';
2
+ export interface C4FileUploaderProps {
3
+ labelTitle: string;
4
+ labelDescription: string;
5
+ buttonLabel: string;
6
+ /** The file types that the picker accepts, as extensions (`['.env']`). */
7
+ accept: string[];
8
+ multiple?: boolean;
9
+ disabled?: boolean;
10
+ /**
11
+ * carbon-mode only: the accessible name of the button that removes a
12
+ * selected file. The DS file uploader writes its own name for that button
13
+ * (`Remove <file name>`) and accepts no prop for it.
14
+ */
15
+ removeFileLabel?: string;
16
+ /**
17
+ * The files that the control holds now. An empty list means that the reader
18
+ * removed the last file, thus a caller that keeps state from a file must
19
+ * clear that state here.
20
+ */
21
+ onFilesChange: (files: File[]) => void;
22
+ }
23
+ /**
24
+ * A control that takes one or more files from the local disk.
25
+ *
26
+ * `@camunda/design-system/carbon-compat` ships no file-uploader adapter, thus
27
+ * the Carbon component stayed in ds mode and put a Carbon-blue button in the
28
+ * middle of a DS dialog. carbon mode renders the same Carbon component as
29
+ * before. ds mode renders the DS `FileUploader`, which also shows the selected
30
+ * files and lets the reader remove one.
31
+ *
32
+ * In single mode both modes report a removal as an empty list. Carbon has a
33
+ * second callback for it (`onDelete`), the DS component sends the new list to
34
+ * the one callback.
35
+ */
36
+ export declare const C4FileUploader: ({ labelTitle, labelDescription, buttonLabel, accept, multiple, disabled, removeFileLabel, onFilesChange, }: C4FileUploaderProps) => JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
4
+ * under one or more contributor license agreements. Licensed under a commercial license.
5
+ * You may not use this file except in compliance with the commercial license.
6
+ */
7
+ import { FileUploader as DsFileUploader } from '@camunda/design-system';
8
+ import { FileUploader as CarbonFileUploader } from '@carbon/react';
9
+ import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
10
+ /**
11
+ * A control that takes one or more files from the local disk.
12
+ *
13
+ * `@camunda/design-system/carbon-compat` ships no file-uploader adapter, thus
14
+ * the Carbon component stayed in ds mode and put a Carbon-blue button in the
15
+ * middle of a DS dialog. carbon mode renders the same Carbon component as
16
+ * before. ds mode renders the DS `FileUploader`, which also shows the selected
17
+ * files and lets the reader remove one.
18
+ *
19
+ * In single mode both modes report a removal as an empty list. Carbon has a
20
+ * second callback for it (`onDelete`), the DS component sends the new list to
21
+ * the one callback.
22
+ */
23
+ export const C4FileUploader = ({ labelTitle, labelDescription, buttonLabel, accept, multiple = false, disabled, removeFileLabel = 'Remove file', onFilesChange, }) => {
24
+ const designSystem = useC4DesignSystem();
25
+ if (designSystem === 'ds') {
26
+ return (_jsx(DsFileUploader, { mode: multiple ? 'multiple' : 'single', labelTitle: labelTitle, labelDescription: labelDescription, buttonLabel: buttonLabel,
27
+ // Carbon takes a list of extensions, the DS component takes the value
28
+ // of the `accept` attribute of the input element.
29
+ accept: accept.join(','), disabled: disabled, onFilesChange: onFilesChange }));
30
+ }
31
+ return (_jsx(CarbonFileUploader, { labelTitle: labelTitle, labelDescription: labelDescription, buttonLabel: buttonLabel, buttonKind: 'tertiary', size: 'md', filenameStatus: 'edit', accept: accept, multiple: multiple, disabled: disabled, iconDescription: removeFileLabel, onChange: (event) => {
32
+ // Carbon types the handler for its own wrapper element. The event
33
+ // comes from the hidden file input, thus the cast reads the files.
34
+ const files = event.target.files;
35
+ if (files && files.length > 0) {
36
+ onFilesChange(Array.from(files));
37
+ }
38
+ },
39
+ // In single mode a removal leaves no file, thus the new list is empty.
40
+ // Carbon keeps its file list to itself and names only the file that
41
+ // went, so multiple mode cannot report the rest and stays silent.
42
+ onDelete: multiple ? undefined : () => onFilesChange([]) }));
43
+ };
@@ -8,18 +8,8 @@ import { OrganizationRole } from '@camunda/ccma-shared-types';
8
8
  import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from 'react';
9
9
  import { Checkbox, Link, Modal, Stack, TextInput } from '../../ui/index.js';
10
10
  import { legacySectionRoles, orderPrimaryRoles, roleLabelDescription, } from '../../utils/role-labels.js';
11
+ import { safeTranslate } from '../../utils/safe-translate.js';
11
12
  import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
12
- function safeTranslate(t, key, defaultValue, options) {
13
- if (!t)
14
- return defaultValue;
15
- try {
16
- const translated = t(key, options);
17
- return typeof translated === 'string' ? translated : defaultValue;
18
- }
19
- catch {
20
- return defaultValue;
21
- }
22
- }
23
13
  function isValidEmail(email) {
24
14
  // Intentionally simple: enough for UI validation without being overly strict.
25
15
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(email);
@@ -1,16 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Modal, Stack } from '../../ui/index.js';
3
- function safeTranslate(t, key, defaultValue, options) {
4
- if (!t)
5
- return defaultValue;
6
- try {
7
- const translated = t(key, options);
8
- return typeof translated === 'string' ? translated : defaultValue;
9
- }
10
- catch {
11
- return defaultValue;
12
- }
13
- }
3
+ import { safeTranslate } from '../../utils/safe-translate.js';
14
4
  export const C4LeaveOrganizationModal = ({ t, open, onRequestClose, onRequestSubmit, preventCloseOnClickOutside, }) => {
15
5
  const modalHeading = safeTranslate(t, 'users:leaveOrg.heading', 'Leave organization');
16
6
  const primaryButtonText = safeTranslate(t, 'users:leaveOrg.buttons.primary', 'Leave');
@@ -6,17 +6,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  */
7
7
  import { forwardRef, useCallback, useImperativeHandle, useMemo, useState, } from 'react';
8
8
  import { Modal, Stack, TextInput } from '../../ui/index.js';
9
- function safeTranslate(t, key, defaultValue, options) {
10
- if (!t)
11
- return defaultValue;
12
- try {
13
- const translated = t(key, options);
14
- return typeof translated === 'string' ? translated : defaultValue;
15
- }
16
- catch {
17
- return defaultValue;
18
- }
19
- }
9
+ import { safeTranslate } from '../../utils/safe-translate.js';
20
10
  export const C4RenameOrganizationModal = forwardRef(({ t, onRenameOrganization }, ref) => {
21
11
  const [isOpen, setIsOpen] = useState(false);
22
12
  const [orgId, setOrgId] = useState('');
@@ -0,0 +1,46 @@
1
+ import { type CSSProperties, type JSX } from 'react';
2
+ export interface C4SegmentedControlOption {
3
+ id: string;
4
+ label: string;
5
+ disabled?: boolean;
6
+ }
7
+ export interface C4SegmentedControlProps {
8
+ options: C4SegmentedControlOption[];
9
+ /** The id of the selected option. */
10
+ value: string | undefined;
11
+ onChange: (id: string) => void;
12
+ /** Accessible name of the group. */
13
+ ariaLabel: string;
14
+ /**
15
+ * carbon-mode only: the style of the Carbon `ContentSwitcher`. The ds branch
16
+ * lets each option size to its own label, thus it has no equivalent.
17
+ */
18
+ carbonStyle?: CSSProperties;
19
+ /**
20
+ * ds-mode only: the style of the box around the strip and its arrow buttons.
21
+ *
22
+ * Each mode takes its own style, so that a call site gives spacing to both
23
+ * without a box of its own. A box around the Carbon branch would change the
24
+ * carbon render, which the coexistence rules do not permit.
25
+ */
26
+ dsStyle?: CSSProperties;
27
+ }
28
+ /**
29
+ * One-of-many selector for a small set of options (a cloud provider, a release
30
+ * channel).
31
+ *
32
+ * carbon mode renders the Carbon `ContentSwitcher` and its `Switch` children,
33
+ * unchanged.
34
+ *
35
+ * ds mode renders the DS `ToggleGroup` in its `outline` variant. It corrects
36
+ * three things that the carbon-compat `ContentSwitcher` adapter does not do:
37
+ *
38
+ * - The adapter takes `selectedIndex` as an initial value alone, so the strip
39
+ * keeps the first selection after the state moves. This group is controlled.
40
+ * - Its items are `flex-1`, so every option gets the same width and a long
41
+ * label is cut. Here each option sizes to its own label.
42
+ * - A strip that is wider than its space scrolls, and on a system that hides
43
+ * the scrollbar there was no sign of the options outside the view. This
44
+ * component shows an arrow button on each side that has more options.
45
+ */
46
+ export declare const C4SegmentedControl: ({ options, value, onChange, ariaLabel, carbonStyle, dsStyle, }: C4SegmentedControlProps) => JSX.Element;
@@ -0,0 +1,117 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
4
+ * under one or more contributor license agreements. Licensed under a commercial license.
5
+ * You may not use this file except in compliance with the commercial license.
6
+ */
7
+ import { ToggleGroup, ToggleGroupItem } from '@camunda/design-system';
8
+ import { ChevronLeft, ChevronRight } from '@carbon/react/icons/index.esm.js';
9
+ import { useCallback, useEffect, useRef, useState, } from 'react';
10
+ import { useC4DesignSystem } from '../../runtime/c4-console-runtime-context.js';
11
+ import { Button } from '../../ui/index.js';
12
+ import { useContentSwitcherFamily } from '../../ui/families.js';
13
+ /** How far one press of an arrow button moves the strip, in pixels. */
14
+ const MIN_SCROLL_STEP = 160;
15
+ /**
16
+ * One-of-many selector for a small set of options (a cloud provider, a release
17
+ * channel).
18
+ *
19
+ * carbon mode renders the Carbon `ContentSwitcher` and its `Switch` children,
20
+ * unchanged.
21
+ *
22
+ * ds mode renders the DS `ToggleGroup` in its `outline` variant. It corrects
23
+ * three things that the carbon-compat `ContentSwitcher` adapter does not do:
24
+ *
25
+ * - The adapter takes `selectedIndex` as an initial value alone, so the strip
26
+ * keeps the first selection after the state moves. This group is controlled.
27
+ * - Its items are `flex-1`, so every option gets the same width and a long
28
+ * label is cut. Here each option sizes to its own label.
29
+ * - A strip that is wider than its space scrolls, and on a system that hides
30
+ * the scrollbar there was no sign of the options outside the view. This
31
+ * component shows an arrow button on each side that has more options.
32
+ */
33
+ export const C4SegmentedControl = ({ options, value, onChange, ariaLabel, carbonStyle, dsStyle, }) => {
34
+ const designSystem = useC4DesignSystem();
35
+ // The family hook must run on every render (rules of hooks). Only the carbon
36
+ // branch below renders the result.
37
+ const { ContentSwitcher, Switch } = useContentSwitcherFamily();
38
+ const scrollRef = useRef(null);
39
+ const [hasMoreBefore, setHasMoreBefore] = useState(false);
40
+ const [hasMoreAfter, setHasMoreAfter] = useState(false);
41
+ const readOverflow = useCallback(() => {
42
+ const node = scrollRef.current;
43
+ if (!node) {
44
+ return;
45
+ }
46
+ // One pixel of tolerance: a fractional layout width otherwise reports an
47
+ // overflow of a fraction of a pixel that the reader cannot scroll to.
48
+ const maxScrollLeft = node.scrollWidth - node.clientWidth;
49
+ setHasMoreBefore(node.scrollLeft > 1);
50
+ setHasMoreAfter(node.scrollLeft < maxScrollLeft - 1);
51
+ }, []);
52
+ useEffect(() => {
53
+ const node = scrollRef.current;
54
+ if (!node) {
55
+ return;
56
+ }
57
+ readOverflow();
58
+ node.addEventListener('scroll', readOverflow, { passive: true });
59
+ const observer = typeof ResizeObserver === 'undefined'
60
+ ? undefined
61
+ : new ResizeObserver(readOverflow);
62
+ observer?.observe(node);
63
+ return () => {
64
+ node.removeEventListener('scroll', readOverflow);
65
+ observer?.disconnect();
66
+ };
67
+ }, [readOverflow, options.length]);
68
+ if (designSystem !== 'ds') {
69
+ return (_jsx(ContentSwitcher, { size: 'md', "aria-label": ariaLabel, style: carbonStyle, onChange: (data) => onChange(String(data.name ?? '')), selectedIndex: Math.max(options.findIndex((option) => option.id === value), 0), children: options.map((option) => (_jsx(Switch, { name: option.id, disabled: option.disabled, children: option.label }, option.id))) }));
70
+ }
71
+ const scrollByStep = (direction) => {
72
+ const node = scrollRef.current;
73
+ if (!node) {
74
+ return;
75
+ }
76
+ const step = Math.max(MIN_SCROLL_STEP, node.clientWidth * 0.6) * direction;
77
+ // jsdom has no `scrollBy`, and neither has an old browser. Move the
78
+ // position itself in that case.
79
+ if (typeof node.scrollBy === 'function') {
80
+ node.scrollBy({ left: step, behavior: 'smooth' });
81
+ return;
82
+ }
83
+ node.scrollLeft += step;
84
+ };
85
+ return (_jsxs("div", { style: {
86
+ display: 'flex',
87
+ alignItems: 'center',
88
+ gap: '0.25rem',
89
+ ...dsStyle,
90
+ }, children: [hasMoreBefore && (_jsx(Button, { kind: 'ghost', size: 'sm', type: 'button', "aria-label": `Scroll ${ariaLabel} to the left`, renderIcon: ChevronLeft, onClick: () => scrollByStep(-1) })), _jsx("div", { ref: scrollRef,
91
+ // `min-width: 0` and `flex` are necessary, and not decoration: the
92
+ // automatic minimum size of a flex item is its min-content width, thus
93
+ // this box would grow to the full width of the strip. `scrollWidth`
94
+ // would then be equal to `clientWidth`, the component would find no
95
+ // overflow, and the arrow buttons would never come.
96
+ style: {
97
+ flex: '1 1 auto',
98
+ minWidth: 0,
99
+ overflowX: 'auto',
100
+ scrollbarWidth: 'thin',
101
+ }, children: _jsx(ToggleGroup, { type: 'single', variant: 'outline',
102
+ // The page has a grey background, and an option of this group had a
103
+ // transparent one, thus the strip read as a row of labels and not as
104
+ // a control that the reader can press. `neutral-background-subtle`
105
+ // is the surface of `ChoiceCard`, so the options now look the same
106
+ // as the cards of the other sections, and the larger size gives them
107
+ // the same press target.
108
+ size: 'lg', className: 'bg-neutral-background-subtle', "aria-label": ariaLabel, value: value ?? '',
109
+ // Radix reports an empty string when the reader presses the selected
110
+ // option again. This control is one-of-many, thus that press keeps
111
+ // the current selection.
112
+ onValueChange: (next) => {
113
+ if (next) {
114
+ onChange(next);
115
+ }
116
+ }, children: options.map((option) => (_jsx(ToggleGroupItem, { value: option.id, disabled: option.disabled, style: { flex: '0 0 auto', minWidth: 'auto' }, children: option.label }, option.id))) }) }), hasMoreAfter && (_jsx(Button, { kind: 'ghost', size: 'sm', type: 'button', "aria-label": `Scroll ${ariaLabel} to the right`, renderIcon: ChevronRight, onClick: () => scrollByStep(1) }))] }));
117
+ };
@@ -11,12 +11,14 @@ export declare const C4_EXTERNAL_URLS: {
11
11
  readonly consoleClusterClients: "https://docs.camunda.io/docs/next/components/hub/organization/manage-clusters/manage-api-clients";
12
12
  readonly consoleManageConnectors: "https://docs.camunda.io/docs/components/console/manage-clusters/cluster-connectors/";
13
13
  readonly connectorSecrets: "https://docs.camunda.io/docs/next/components/connectors/use-connectors/#using-secrets";
14
+ readonly clusterSecrets: "https://docs.camunda.io/docs/next/components/hub/organization/manage-clusters/manage-secrets/";
14
15
  readonly consoleIpWhitelist: "https://docs.camunda.io/docs/next/components/console/manage-clusters/manage-ip-allowlists/";
15
16
  readonly conceptsRBA: "https://docs.camunda.io/docs/components/concepts/resource-authorizations/";
16
17
  readonly springZeebe: "https://docs.camunda.io/docs/apis-tools/spring-zeebe-sdk/getting-started/";
17
18
  readonly springZeebeConfig: "https://docs.camunda.io/docs/apis-tools/spring-zeebe-sdk/configuration/";
18
19
  readonly hotBackups: "https://docs.camunda.io/docs/components/saas/backups/";
19
20
  readonly earlyAccess: "https://docs.camunda.io/docs/next/components/early-access/overview/";
21
+ readonly createCluster: "https://docs.camunda.io/docs/components/console/manage-clusters/create-cluster/";
20
22
  readonly encryption: "https://docs.camunda.io/docs/components/console/manage-clusters/create-cluster/";
21
23
  readonly clusterLoad: "https://docs.camunda.io/docs/next/components/console/manage-clusters/cluster-capacity/";
22
24
  readonly identityAuthorizations: "https://docs.camunda.io/docs/next/components/concepts/access-control/authorizations/";
@@ -85,6 +87,11 @@ export declare function getC4DashboardUrls(params: {
85
87
  modeler: string;
86
88
  };
87
89
  export declare function getC4ClusterClientDetailsDocsUrl(url?: string): string;
90
+ /**
91
+ * The docs link of the clusters empty state. The empty state asks the reader to
92
+ * make a cluster, thus the link goes to the page about cluster creation. The
93
+ * general guides index made the reader look for that page again.
94
+ */
88
95
  export declare function getC4ClustersGettingStartedHref(href?: string): string;
89
96
  export declare function getC4ManagementUrls(params?: {
90
97
  email?: string;
@@ -10,12 +10,14 @@ export const C4_EXTERNAL_URLS = {
10
10
  consoleClusterClients: 'https://docs.camunda.io/docs/next/components/hub/organization/manage-clusters/manage-api-clients',
11
11
  consoleManageConnectors: 'https://docs.camunda.io/docs/components/console/manage-clusters/cluster-connectors/',
12
12
  connectorSecrets: 'https://docs.camunda.io/docs/next/components/connectors/use-connectors/#using-secrets',
13
+ clusterSecrets: 'https://docs.camunda.io/docs/next/components/hub/organization/manage-clusters/manage-secrets/',
13
14
  consoleIpWhitelist: 'https://docs.camunda.io/docs/next/components/console/manage-clusters/manage-ip-allowlists/',
14
15
  conceptsRBA: 'https://docs.camunda.io/docs/components/concepts/resource-authorizations/',
15
16
  springZeebe: 'https://docs.camunda.io/docs/apis-tools/spring-zeebe-sdk/getting-started/',
16
17
  springZeebeConfig: 'https://docs.camunda.io/docs/apis-tools/spring-zeebe-sdk/configuration/',
17
18
  hotBackups: 'https://docs.camunda.io/docs/components/saas/backups/',
18
19
  earlyAccess: 'https://docs.camunda.io/docs/next/components/early-access/overview/',
20
+ createCluster: 'https://docs.camunda.io/docs/components/console/manage-clusters/create-cluster/',
19
21
  encryption: 'https://docs.camunda.io/docs/components/console/manage-clusters/create-cluster/',
20
22
  clusterLoad: 'https://docs.camunda.io/docs/next/components/console/manage-clusters/cluster-capacity/',
21
23
  identityAuthorizations: 'https://docs.camunda.io/docs/next/components/concepts/access-control/authorizations/',
@@ -82,6 +84,9 @@ export function getC4ClusterDetailsUrls(urls) {
82
84
  ipWhitelist: urls.docs?.ipWhitelist ?? C4_EXTERNAL_URLS.docs.consoleIpWhitelist,
83
85
  clients: urls.docs?.clients ?? C4_EXTERNAL_URLS.docs.consoleClusterClients,
84
86
  connectorSecrets: urls.docs?.connectorSecrets ?? C4_EXTERNAL_URLS.docs.connectorSecrets,
87
+ clusterSecrets: urls.docs?.clusterSecrets ??
88
+ urls.docs?.connectorSecrets ??
89
+ C4_EXTERNAL_URLS.docs.clusterSecrets,
85
90
  mcpSetup: urls.docs?.mcpSetup ?? C4_EXTERNAL_URLS.docs.mcpSetup,
86
91
  upgrade: {
87
92
  whatsNewIn88: urls.docs?.upgrade?.whatsNewIn88 ??
@@ -150,8 +155,13 @@ export function getC4DashboardUrls(params) {
150
155
  export function getC4ClusterClientDetailsDocsUrl(url) {
151
156
  return url?.trim() || C4_EXTERNAL_URLS.docs.consoleClusterClients;
152
157
  }
158
+ /**
159
+ * The docs link of the clusters empty state. The empty state asks the reader to
160
+ * make a cluster, thus the link goes to the page about cluster creation. The
161
+ * general guides index made the reader look for that page again.
162
+ */
153
163
  export function getC4ClustersGettingStartedHref(href) {
154
- return href?.trim() || 'https://docs.camunda.io/docs/guides/';
164
+ return href?.trim() || C4_EXTERNAL_URLS.docs.createCluster;
155
165
  }
156
166
  export function getC4ManagementUrls(params) {
157
167
  const overrides = params?.overrides;
@@ -52,6 +52,8 @@ const resources = {
52
52
  delete: 'Delete',
53
53
  resume: 'Resume',
54
54
  failover: 'Failover',
55
+ duplicate: 'Duplicate',
56
+ duplicateUnavailableFailoverSource: 'Duplicate (unavailable — this cluster was failed over)',
55
57
  },
56
58
  },
57
59
  tags: {
@@ -85,6 +87,7 @@ const resources = {
85
87
  menu: {
86
88
  rename: 'Rename',
87
89
  delete: 'Delete',
90
+ duplicate: 'Duplicate',
88
91
  },
89
92
  banner: {
90
93
  unsupportedGeneration: {