@camunda/ccma-saas-frontend 0.11.0 → 0.13.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 (116) hide show
  1. package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.d.ts +1 -1
  2. package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.js +11 -1
  3. package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.mocks.js +2 -0
  4. package/lib/esm/components/c4-cluster-details-clients/c4-cluster-details-clients.types.d.ts +2 -0
  5. package/lib/esm/components/c4-cluster-list/c4-cluster-list.d.ts +1 -1
  6. package/lib/esm/components/c4-cluster-list/c4-cluster-list.js +24 -2
  7. package/lib/esm/components/c4-cluster-list/c4-cluster-list.types.d.ts +9 -0
  8. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.d.ts +1 -1
  9. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.js +2 -4
  10. package/lib/esm/components/c4-cluster-settings/c4-cluster-settings.types.d.ts +0 -4
  11. package/lib/esm/components/c4-cluster-settings/elements/danger-zone.js +9 -1
  12. package/lib/esm/components/c4-cluster-tag-selector/c4-cluster-tag-selector.js +5 -5
  13. package/lib/esm/components/c4-clusters-empty-state/c4-clusters-empty-state.js +3 -3
  14. package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.d.ts +1 -1
  15. package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.js +2 -2
  16. package/lib/esm/components/c4-console-dashboard/c4-console-dashboard.types.d.ts +5 -0
  17. package/lib/esm/components/c4-convert-trial-organization-modal/c4-convert-trial-organization-modal.js +1 -11
  18. package/lib/esm/components/c4-create-alert-modal/c4-create-alert-modal.js +1 -14
  19. package/lib/esm/components/c4-create-cluster/c4-create-cluster.d.ts +1 -1
  20. package/lib/esm/components/c4-create-cluster/c4-create-cluster.js +188 -71
  21. package/lib/esm/components/c4-create-cluster/c4-create-cluster.types.d.ts +52 -0
  22. package/lib/esm/components/c4-create-cluster-api-client-modal/c4-create-cluster-api-client-modal.js +1 -11
  23. package/lib/esm/components/c4-create-connector-secret-modal/c4-create-connector-secret-modal.js +6 -13
  24. package/lib/esm/components/c4-create-console-api-client-modal/c4-create-console-api-client-modal.js +1 -11
  25. package/lib/esm/components/c4-create-ip-whitelist-modal/c4-create-ip-whitelist-modal.js +1 -18
  26. package/lib/esm/components/c4-create-trial-organization-modal/c4-create-trial-organization-modal.js +1 -11
  27. package/lib/esm/components/c4-delete-account-modal/c4-delete-account-modal.d.ts +0 -7
  28. package/lib/esm/components/c4-delete-account-modal/c4-delete-account-modal.js +1 -24
  29. package/lib/esm/components/c4-delete-organization-modal/c4-delete-organization-modal.js +1 -18
  30. package/lib/esm/components/c4-divider/c4-divider.js +12 -0
  31. package/lib/esm/components/c4-empty-state/c4-empty-state.d.ts +8 -0
  32. package/lib/esm/components/c4-empty-state/c4-empty-state.js +32 -8
  33. package/lib/esm/components/c4-file-uploader/c4-file-uploader.d.ts +36 -0
  34. package/lib/esm/components/c4-file-uploader/c4-file-uploader.js +43 -0
  35. package/lib/esm/components/c4-invite-user-to-organization-modal/c4-invite-user-to-organization-modal.js +1 -11
  36. package/lib/esm/components/c4-leave-organization-modal/c4-leave-organization-modal.js +1 -11
  37. package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.d.ts +10 -0
  38. package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.js +96 -0
  39. package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.types.d.ts +22 -0
  40. package/lib/esm/components/c4-org-cluster-defaults/c4-org-cluster-defaults.types.js +6 -0
  41. package/lib/esm/components/c4-rename-organization-modal/c4-rename-organization-modal.js +1 -11
  42. package/lib/esm/components/c4-segmented-control/c4-segmented-control.d.ts +50 -0
  43. package/lib/esm/components/c4-segmented-control/c4-segmented-control.js +130 -0
  44. package/lib/esm/externalUrls.const.d.ts +7 -0
  45. package/lib/esm/externalUrls.const.js +11 -1
  46. package/lib/esm/i18n/c4-console-i18n.js +3 -0
  47. package/lib/esm/i18n/en/modals/apiclients.json +2 -1
  48. package/lib/esm/i18n/en/modals/clusterclients.json +18 -1
  49. package/lib/esm/i18n/en/pages/clusterdetails.json +12 -7
  50. package/lib/esm/i18n/en/pages/createcluster.json +43 -0
  51. package/lib/esm/i18n/en/pages/orgmanagement.json +6 -0
  52. package/lib/esm/index.d.ts +4 -0
  53. package/lib/esm/index.js +3 -0
  54. package/lib/esm/runtime/c4-console-runtime-context.d.ts +1 -1
  55. package/lib/esm/runtime/c4-console-runtime-context.js +2 -2
  56. package/lib/esm/runtime/cluster-duplication.d.ts +10 -0
  57. package/lib/esm/runtime/cluster-duplication.js +15 -0
  58. package/lib/esm/runtime/org-cluster-defaults.d.ts +14 -0
  59. package/lib/esm/runtime/org-cluster-defaults.js +19 -0
  60. package/lib/esm/ui/c4-password-input.js +1 -1
  61. package/lib/esm/ui/index.d.ts +1 -0
  62. package/lib/esm/ui/index.js +16 -2
  63. package/lib/esm/utils/role-labels.d.ts +1 -2
  64. package/lib/esm/utils/role-labels.js +1 -13
  65. package/lib/esm/utils/safe-translate.d.ts +4 -2
  66. package/lib/esm/utils/safe-translate.js +9 -2
  67. package/lib/esm/widgets/cluster-client-details/c4-cluster-client-details-app.js +80 -23
  68. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.js +34 -23
  69. package/lib/esm/widgets/cluster-details/c4-cluster-details-app.types.d.ts +6 -0
  70. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.js +7 -0
  71. package/lib/esm/widgets/cluster-details/c4-cluster-details-page.types.d.ts +3 -0
  72. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-activity-tab.js +1 -19
  73. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-alerts-tab.js +1 -14
  74. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-byom-clients-tab.js +1 -18
  75. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-clients-tab.js +57 -2
  76. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.d.ts +1 -0
  77. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-connector-secrets-tab.js +77 -28
  78. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-hot-backups-tab.js +1 -6
  79. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-ip-whitelist-tab.js +1 -18
  80. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-overview-tab.js +12 -22
  81. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-secure-connectivity-tab.js +1 -6
  82. package/lib/esm/widgets/cluster-details/tabs/c4-cluster-details-settings-tab.js +3 -86
  83. package/lib/esm/widgets/clusters/c4-clusters-page.js +72 -100
  84. package/lib/esm/widgets/clusters/c4-clusters-page.types.d.ts +7 -0
  85. package/lib/esm/widgets/connector-management/c4-connector-management-page.js +1 -9
  86. package/lib/esm/widgets/connector-management/c4-connector-management.shared.js +1 -9
  87. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.d.ts +88 -1
  88. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.js +285 -45
  89. package/lib/esm/widgets/create-cluster/c4-create-cluster-page.types.d.ts +9 -0
  90. package/lib/esm/widgets/dashboard/c4-dashboard-app.js +3 -20
  91. package/lib/esm/widgets/dashboard/c4-dashboard-app.types.d.ts +6 -0
  92. package/lib/esm/widgets/environment/c4-cluster-connector-secrets-widget.js +1 -1
  93. package/lib/esm/widgets/group-details/c4-group-details-page.js +1 -9
  94. package/lib/esm/widgets/job-worker/c4-job-worker.helpers.d.ts +1 -0
  95. package/lib/esm/widgets/job-worker/c4-job-worker.helpers.js +4 -34
  96. package/lib/esm/widgets/management/c4-management-app.d.ts +1 -1
  97. package/lib/esm/widgets/management/c4-management-app.js +99 -23
  98. package/lib/esm/widgets/management/c4-management-app.types.d.ts +6 -0
  99. package/lib/esm/widgets/management/c4-management-page.d.ts +1 -1
  100. package/lib/esm/widgets/management/c4-management-page.js +7 -13
  101. package/lib/esm/widgets/management/c4-management-page.types.d.ts +1 -0
  102. package/lib/esm/widgets/management/management-tabs.d.ts +1 -1
  103. package/lib/esm/widgets/management/management-tabs.js +5 -0
  104. package/lib/esm/widgets/management/tabs/c4-management-api-tab.js +1 -13
  105. package/lib/esm/widgets/management/tabs/c4-management-billing-tab.js +1 -9
  106. package/lib/esm/widgets/management/tabs/c4-management-cluster-defaults-tab.d.ts +5 -0
  107. package/lib/esm/widgets/management/tabs/c4-management-cluster-defaults-tab.js +5 -0
  108. package/lib/esm/widgets/management/tabs/c4-management-overview-tab.js +1 -13
  109. package/lib/esm/widgets/management/tabs/c4-management-pricing-tab.js +1 -8
  110. package/lib/esm/widgets/management/tabs/c4-management-settings-tab.js +1 -24
  111. package/lib/esm/widgets/management/tabs/c4-management-users-tab.js +1 -13
  112. package/lib/esm/widgets/user-account/c4-delete-account-widget.js +2 -1
  113. package/lib/esm/widgets/user-details/c4-user-details-page.js +1 -9
  114. package/package.json +3 -3
  115. package/lib/esm/components/c4-cluster-settings/elements/optional-telemetry-toggle.d.ts +0 -14
  116. package/lib/esm/components/c4-cluster-settings/elements/optional-telemetry-toggle.js +0 -12
@@ -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');
@@ -0,0 +1,10 @@
1
+ import { type JSX } from 'react';
2
+ import type { C4OrgClusterDefaultsProps } from './c4-org-cluster-defaults.types.js';
3
+ /**
4
+ * Default settings for the next cluster of an organization (#9732).
5
+ *
6
+ * The values here seed a cluster at creation. They change no cluster that
7
+ * exists, thus the page never removes a setting that somebody made on a
8
+ * cluster.
9
+ */
10
+ export declare const C4OrgClusterDefaults: ({ defaults, loading, error, saveError, permissions, onSave, }: C4OrgClusterDefaultsProps) => JSX.Element;
@@ -0,0 +1,96 @@
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 { CLUSTER_CREATION_DEFAULT_FIELDS, } from '@camunda/ccma-shared-types';
8
+ import { useEffect, useState } from 'react';
9
+ import { Button, Stack } from '../../ui/index.js';
10
+ import { C4InlineNotification } from '../c4-inline-notification/c4-inline-notification.js';
11
+ import { C4NumberInput } from '../c4-number-input/c4-number-input.js';
12
+ import { C4StructuredListSkeleton } from '../c4-structured-list/c4-structured-list.js';
13
+ /**
14
+ * Copy for each field that the organization may set itself.
15
+ *
16
+ * The registry in `@camunda/ccma-shared-types` says which fields those are;
17
+ * the words for them belong here, because the registry also serves the
18
+ * internal tool, where the audience is another one. A field of the
19
+ * availability `customer` without an entry renders nothing, thus a backend
20
+ * change alone never puts unreviewed words in front of a customer.
21
+ */
22
+ const FIELD_COPY = {
23
+ sessionMaxInactiveIntervalMinutes: {
24
+ label: 'Idle session timeout (minutes)',
25
+ helper: 'How long a web session may sit idle before Camunda signs the user out. New clusters start with this value. Existing clusters keep the timeout they have, and you can change it on each cluster at any time.',
26
+ },
27
+ };
28
+ const helperTextStyle = {
29
+ color: 'var(--cds-text-secondary)',
30
+ fontSize: 'var(--cds-body-compact-01-font-size)',
31
+ maxWidth: '650px',
32
+ };
33
+ const CUSTOMER_FIELDS = CLUSTER_CREATION_DEFAULT_FIELDS.filter((field) => field.availability === 'customer' && FIELD_COPY[field.key]);
34
+ /**
35
+ * Default settings for the next cluster of an organization (#9732).
36
+ *
37
+ * The values here seed a cluster at creation. They change no cluster that
38
+ * exists, thus the page never removes a setting that somebody made on a
39
+ * cluster.
40
+ */
41
+ export const C4OrgClusterDefaults = ({ defaults, loading, error, saveError, permissions, onSave, }) => {
42
+ const [draft, setDraft] = useState(defaults);
43
+ const [invalid, setInvalid] = useState(undefined);
44
+ const [saving, setSaving] = useState(false);
45
+ // Take the server values again after a save or a reload, so that the Save
46
+ // button shows up for an unsaved edit alone.
47
+ useEffect(() => {
48
+ setDraft(defaults);
49
+ setInvalid(undefined);
50
+ }, [defaults]);
51
+ if (loading) {
52
+ return _jsx(C4StructuredListSkeleton, {});
53
+ }
54
+ const dirty = CUSTOMER_FIELDS.some((field) => draft[field.key] !== defaults[field.key]);
55
+ const mayChange = permissions.mayChange && !error && !saving;
56
+ const handleSave = async () => {
57
+ setSaving(true);
58
+ try {
59
+ // The fields of this form alone. The record can hold fields that only
60
+ // a Camundi writes, and sending those back would ask the route for a
61
+ // change that it refuses.
62
+ const mine = {};
63
+ for (const field of CUSTOMER_FIELDS) {
64
+ const value = draft[field.key];
65
+ if (value !== undefined) {
66
+ ;
67
+ mine[field.key] = value;
68
+ }
69
+ }
70
+ await onSave(mine);
71
+ }
72
+ finally {
73
+ setSaving(false);
74
+ }
75
+ };
76
+ return (_jsxs(Stack, { gap: 6, children: [_jsx("p", { style: helperTextStyle, children: "These values apply to clusters you create from now on. Clusters you already have keep their own settings." }), error && (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, hideCloseButton: true, title: 'Settings unavailable', subtitle: error, style: { maxWidth: '650px' } })), saveError && (_jsx(C4InlineNotification, { kind: 'error', lowContrast: true, hideCloseButton: true, title: 'The settings were not saved', subtitle: saveError, style: { maxWidth: '650px' } })), CUSTOMER_FIELDS.map((field) => {
77
+ const copy = FIELD_COPY[field.key];
78
+ if (!copy || field.kind !== 'number') {
79
+ return undefined;
80
+ }
81
+ const value = draft[field.key];
82
+ return (_jsxs(Stack, { gap: 4, style: { maxWidth: '350px' }, children: [_jsx(C4NumberInput, { label: copy.label, min: field.min, max: field.max, step: 1, value: typeof value === 'number' ? value : Number(field.fallback), invalid: !!invalid, invalidText: invalid, disabled: !mayChange, onChange: (next) => {
83
+ const minutes = Number(next);
84
+ setDraft({ ...draft, [field.key]: minutes });
85
+ setInvalid(!Number.isInteger(minutes) ||
86
+ (field.min !== undefined && minutes < field.min) ||
87
+ (field.max !== undefined && minutes > field.max)
88
+ ? `Enter a whole number between ${field.min} and ${field.max}.`
89
+ : undefined);
90
+ } }), _jsx("p", { style: helperTextStyle, children: copy.helper }), value !== undefined && mayChange && (_jsx("div", { children: _jsxs(Button, { size: 'md', kind: 'ghost', onClick: () => {
91
+ const { [field.key]: _removed, ...rest } = draft;
92
+ setDraft(rest);
93
+ setInvalid(undefined);
94
+ }, children: ["Use the Camunda default (", field.fallback, ")"] }) }))] }, field.key));
95
+ }), mayChange && dirty && !invalid && (_jsx("div", { children: _jsx(Button, { size: 'md', kind: 'primary', onClick: handleSave, children: "Save" }) }))] }));
96
+ };
@@ -0,0 +1,22 @@
1
+ import type { ClusterCreationDefaults } from '@camunda/ccma-shared-types';
2
+ export interface C4OrgClusterDefaultsProps {
3
+ /** The values that the organization holds now. */
4
+ defaults: ClusterCreationDefaults;
5
+ loading?: boolean;
6
+ /** Message of a failed read. The form stays read-only while it is there. */
7
+ error?: string;
8
+ /**
9
+ * Message of a failed write. The form stays editable, because the member
10
+ * has to be able to try again — a failed save is not a broken page.
11
+ */
12
+ saveError?: string;
13
+ permissions: {
14
+ mayChange: boolean;
15
+ };
16
+ /**
17
+ * Writes the fields of this form alone. The route keeps every other field
18
+ * of the record, thus the organization never sends back a field that a
19
+ * Camundi changed in the meantime, and never gets a 403 for it.
20
+ */
21
+ onSave: (defaults: ClusterCreationDefaults) => Promise<void>;
22
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
3
+ * under one or more contributor license agreements. Licensed under a commercial license.
4
+ * You may not use this file except in compliance with the commercial license.
5
+ */
6
+ export {};
@@ -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,50 @@
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
+ * The ds branch takes its width from its container and none from its options.
47
+ * In a box that shrinks to its content the row has a width of zero, thus a
48
+ * block or a grid column must give it one.
49
+ */
50
+ export declare const C4SegmentedControl: ({ options, value, onChange, ariaLabel, carbonStyle, dsStyle, }: C4SegmentedControlProps) => JSX.Element;