@camunda/camunda-composite-components 0.2.18-rc.6 → 0.3.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.
@@ -73,9 +73,6 @@ export const HelpCenter = ({ configuration, persona, email, audience, flags = []
73
73
  }, [showTabId]);
74
74
  if (activeTab === "feedback") {
75
75
  header = "Share your feedback";
76
- content = (React.createElement(Feedback, { audience: audience, theme: theme, mixpanelTrack: mixpanelTrack, setHeader: (head) => {
77
- header = head;
78
- }, salesPlanType: organization?.salesPlan?.type ?? "" }));
79
76
  }
80
77
  else if (activeTab === "recommendations" &&
81
78
  Object.keys(tabTiles).length === 0 &&
@@ -152,31 +149,39 @@ export const HelpCenter = ({ configuration, persona, email, audience, flags = []
152
149
  React.createElement(SideNavItems, null,
153
150
  React.createElement(SideNavMenuItem, null,
154
151
  React.createElement("h5", null, "Help Center")),
155
- React.createElement("div", { style: { marginTop: "4px" } },
156
- React.createElement(Stack, null, tabBar.map(({ name, id, text }) => {
157
- const active = activeTab === name;
158
- let tabBackgroundColor = theme === "light" ? "#F4F4F4" : "#161616";
159
- let tabButtonColor = theme === "light" ? "#525252" : "#f4f4f4";
160
- if (active) {
161
- tabBackgroundColor =
162
- theme === "light" ? "#E5E5E5" : "#8D8D8D3D";
163
- tabButtonColor = theme === "light" ? "#161616" : "#f4f4f4";
164
- }
165
- return (React.createElement(Button, { className: active ? "active" : "", kind: "secondary", onClick: () => {
166
- setActiveTab(name);
167
- mixpanelTrack?.("helpcenter:open", {
168
- to: id,
169
- from: origin,
170
- });
171
- }, style: {
172
- width: "100%",
173
- backgroundColor: tabBackgroundColor,
174
- color: tabButtonColor,
175
- }, key: name, "aria-label": text }, text));
176
- }))),
177
- React.createElement("div", { style: { position: "absolute", bottom: "20px" } }, configuration.links.map((link) => (React.createElement(SideNavMenuItem, { key: link.label.split(" ").join("-").toLowerCase(), href: link.link, target: "_blank" },
178
- React.createElement("span", { className: "cds--link" }, link.label))))))),
179
- content)),
152
+ React.createElement("li", { style: { marginTop: "4px" } },
153
+ React.createElement(Stack, null,
154
+ React.createElement("ul", null, tabBar.map(({ name, id, text }) => {
155
+ const active = activeTab === name;
156
+ let tabBackgroundColor = theme === "light" ? "#F4F4F4" : "#161616";
157
+ let tabButtonColor = theme === "light" ? "#525252" : "#f4f4f4";
158
+ if (active) {
159
+ tabBackgroundColor =
160
+ theme === "light" ? "#E5E5E5" : "#8D8D8D3D";
161
+ tabButtonColor =
162
+ theme === "light" ? "#161616" : "#f4f4f4";
163
+ }
164
+ return (React.createElement("li", { key: name },
165
+ React.createElement(Button, { className: active ? "active" : "", kind: "secondary", onClick: () => {
166
+ setActiveTab(name);
167
+ mixpanelTrack?.("helpcenter:open", {
168
+ to: id,
169
+ from: origin,
170
+ });
171
+ }, style: {
172
+ width: "100%",
173
+ backgroundColor: tabBackgroundColor,
174
+ color: tabButtonColor,
175
+ }, "aria-label": text }, text)));
176
+ })))),
177
+ React.createElement("li", { style: { position: "absolute", bottom: "20px" } },
178
+ React.createElement("ul", null, configuration.links.map((link) => (React.createElement(SideNavMenuItem, { key: link.label.split(" ").join("-").toLowerCase(), href: link.link, target: "_blank" },
179
+ React.createElement("span", { className: "cds--link" }, link.label)))))))),
180
+ content,
181
+ React.createElement("div", { style: { display: activeTab === "feedback" ? "block" : "none" } },
182
+ React.createElement(Feedback, { audience: audience, theme: theme, mixpanelTrack: mixpanelTrack, setHeader: (head) => {
183
+ header = head;
184
+ }, salesPlanType: organization?.salesPlan?.type ?? "" })))),
180
185
  persona.complete && activeTab === "recommendations" && (React.createElement(ModalFooter, { style: {
181
186
  height: "62px",
182
187
  paddingRight: "16px",
@@ -157,13 +157,12 @@ export const Feedback = (props) => {
157
157
  // eslint-disable-next-line
158
158
  // @ts-ignore
159
159
  align: "bottom" },
160
- React.createElement("span", { className: "upload-file" },
161
- React.createElement(Button, { kind: "ghost", renderIcon: Information, iconDescription: "Information", style: {
162
- marginTop: "-10px",
163
- backgroundColor: props.theme === "light" ? "#FFFFFF" : "#161616",
164
- color: props.theme === "light" ? "#161616" : "#F4F4F4",
165
- paddingLeft: "0px",
166
- } })))),
160
+ React.createElement(Button, { kind: "ghost", "aria-label": "Information", renderIcon: Information, iconDescription: "Information", style: {
161
+ marginTop: "-10px",
162
+ backgroundColor: props.theme === "light" ? "#FFFFFF" : "#161616",
163
+ color: props.theme === "light" ? "#161616" : "#F4F4F4",
164
+ paddingLeft: "0px",
165
+ } }))),
167
166
  React.createElement("p", { className: "cds--label-description", style: { marginTop: "-24px" } }, "Max. file size is 5MB. Supported file types are .jpg and .png."))),
168
167
  !orgIsEnterPriseOrPaidCC &&
169
168
  (() => {
@@ -21,7 +21,7 @@ export const C3NavigationAppBar = ({ appBar, forwardRef, navbar, }) => {
21
21
  const [appBarOpen, setAppBarOpen] = useState(appBar.isOpen);
22
22
  const [panelRef, iconRef] = useOnClickOutside(() => setAppBarOpen(false));
23
23
  return (React.createElement(React.Fragment, null,
24
- React.createElement(HeaderGlobalAction, { ref: iconRef, "aria-label": "Camunda apps", isActive: appBarOpen, onClick: () => {
24
+ React.createElement(HeaderGlobalAction, { ref: iconRef, "aria-label": "Camunda components", isActive: appBarOpen, onClick: () => {
25
25
  setAppBarOpen(!appBarOpen);
26
26
  }, tooltipAlignment: "start",
27
27
  /* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
@@ -9,8 +9,8 @@ import { useC3UserConfiguration } from "../../c3-user-configuration/c3-user-conf
9
9
  const C3OrgSidebar = ({ sideBar }) => {
10
10
  const { customElements, switchToOrg, elements, ...sideBarProps } = sideBar;
11
11
  const { isOpen, setIsOpen } = useOrgSidebarState();
12
- const { decodedAudience, analyticsTrack } = useC3UserConfiguration();
13
- const { activeOrg, orgs, setActiveOrg } = useC3Profile();
12
+ const { decodedAudience, analyticsTrack, setActiveOrgId } = useC3UserConfiguration();
13
+ const { activeOrg, orgs } = useC3Profile();
14
14
  const isCustomized = Boolean(customElements?.activeOrganization);
15
15
  const onManageOrg = () => {
16
16
  if (!isCustomized) {
@@ -29,7 +29,7 @@ const C3OrgSidebar = ({ sideBar }) => {
29
29
  otherLabel: "Other Organizations",
30
30
  };
31
31
  const switchOrg = (orgId) => {
32
- setActiveOrg(orgId);
32
+ setActiveOrgId(orgId);
33
33
  analyticsTrack?.("navBar:orgSwitch:click", { orgId });
34
34
  switchToOrg?.(orgId);
35
35
  setIsOpen(false);
@@ -1,5 +1,6 @@
1
1
  import { Select, SelectItem, Stack, TextInput } from "@carbon/react";
2
2
  import React, { useState } from "react";
3
+ import { getTitleId } from "../helpers";
3
4
  export const DropdownSelect = ({ title, label, elements, selectedElement, setSelectedElement, exceptionTitle, exceptionLabel, exceptionValue, }) => {
4
5
  let showSuggestion = false;
5
6
  const [suggestion, setSuggestion] = useState((selectedElement ?? "").split(" - ").length > 0
@@ -22,6 +23,8 @@ export const DropdownSelect = ({ title, label, elements, selectedElement, setSel
22
23
  setSuggestion(input);
23
24
  setElement(rawElement);
24
25
  };
26
+ const titleId = getTitleId(title);
27
+ const exceptionTitleId = getTitleId(exceptionTitle);
25
28
  return (React.createElement(React.Fragment, null,
26
29
  React.createElement(Stack, null, (() => {
27
30
  return (React.createElement(React.Fragment, null,
@@ -30,7 +33,7 @@ export const DropdownSelect = ({ title, label, elements, selectedElement, setSel
30
33
  gridTemplateColumns: "58% 42%",
31
34
  } },
32
35
  React.createElement(Stack, { gap: 1 },
33
- React.createElement("h4", null, title),
36
+ React.createElement("h4", { id: titleId }, title),
34
37
  (() => {
35
38
  if (label) {
36
39
  return React.createElement("p", { className: "cds--modal-header__label" }, label);
@@ -38,7 +41,7 @@ export const DropdownSelect = ({ title, label, elements, selectedElement, setSel
38
41
  return React.createElement(React.Fragment, null);
39
42
  })(),
40
43
  " "),
41
- React.createElement(Select, { key: `select-${Math.random() * 10000}`, id: `select-${Math.random() * 10000}`, size: "lg", defaultValue: elements[0].value, labelText: "", onChange: (event) => {
44
+ React.createElement(Select, { key: `select-${Math.random() * 10000}`, id: `select-${Math.random() * 10000}`, size: "lg", defaultValue: elements[0].value, "aria-labelledby": titleId, labelText: "", onChange: (event) => {
42
45
  const element = elements.find((e) => e.value === event.target.value);
43
46
  if (element)
44
47
  setElement(element.value);
@@ -49,11 +52,11 @@ export const DropdownSelect = ({ title, label, elements, selectedElement, setSel
49
52
  React.createElement("div", { style: { marginTop: "24px" } }),
50
53
  React.createElement("div", { style: { marginTop: "24px" } }),
51
54
  React.createElement(Stack, { gap: 1 },
52
- React.createElement("h4", null, exceptionTitle),
55
+ React.createElement("h4", { id: exceptionTitleId }, exceptionTitle),
53
56
  React.createElement("p", { className: "cds--modal-header__label" }, exceptionLabel)),
54
57
  React.createElement(TextInput, { style: { height: "48px" }, id: `text-input-element-${Math.random() * 1000}`, placeholder: "Enter your suggestion", labelText: "", value: suggestion, onChange: (event) => {
55
58
  calculateSuggestion(event.target.value);
56
- } })));
59
+ }, "aria-labelledby": exceptionTitleId, "aria-label": exceptionTitle })));
57
60
  }
58
61
  return React.createElement(React.Fragment, null);
59
62
  })())));
@@ -1,10 +1,14 @@
1
1
  import { TextInput, Stack } from "@carbon/react";
2
2
  import React from "react";
3
- export const TextInputElement = ({ title, label, preFiledValue, setValue, placeholder }) => (React.createElement(React.Fragment, null,
4
- React.createElement(Stack, { orientation: "horizontal" },
5
- React.createElement(Stack, { gap: 1 },
6
- React.createElement("h4", null, title),
7
- label && React.createElement("p", { className: "cds--modal-header__label" }, label)),
8
- React.createElement(TextInput, { id: `text-input-element-${Math.random() * 1000}`, placeholder: placeholder ?? "", labelText: "", value: preFiledValue ?? "", onChange: (event) => {
9
- setValue(event.target.value);
10
- } }))));
3
+ import { getTitleId } from "../helpers";
4
+ export const TextInputElement = ({ title, label, preFiledValue, setValue, placeholder }) => {
5
+ const titleId = getTitleId(title);
6
+ return (React.createElement(React.Fragment, null,
7
+ React.createElement(Stack, { orientation: "horizontal" },
8
+ React.createElement(Stack, { gap: 1 },
9
+ React.createElement("h4", { id: titleId }, title),
10
+ label && React.createElement("p", { className: "cds--modal-header__label" }, label)),
11
+ React.createElement(TextInput, { id: `text-input-element-${Math.random() * 1000}`, placeholder: placeholder ?? "", labelText: "", value: preFiledValue ?? "", onChange: (event) => {
12
+ setValue(event.target.value);
13
+ }, "aria-labelledby": titleId }))));
14
+ };
@@ -0,0 +1 @@
1
+ export declare const getTitleId: (title: string) => string;
@@ -0,0 +1,5 @@
1
+ export const getTitleId = (title) => title
2
+ .toLowerCase()
3
+ .replace(/[^a-zA-Z0-9]+/g, "-")
4
+ .replace(/^-/, "")
5
+ .replace(/-$/, "");
@@ -8,7 +8,6 @@ export type C3ProfileContextValue = {
8
8
  theme: Theme;
9
9
  orgs: Organization[] | null;
10
10
  activeOrg: Organization | null;
11
- setActiveOrg: (orgId: string) => void;
12
11
  reloadOrgs: () => void;
13
12
  clusters: Cluster[] | null;
14
13
  reloadClusters: () => void;
@@ -8,7 +8,6 @@ export const C3ProfileContext = createContext({
8
8
  theme: defaultTheme,
9
9
  orgs: null,
10
10
  activeOrg: null,
11
- setActiveOrg: () => undefined,
12
11
  reloadOrgs: () => undefined,
13
12
  clusters: null,
14
13
  reloadClusters: () => undefined,
@@ -40,7 +39,15 @@ export const C3ProfileProvider = ({ children }) => {
40
39
  });
41
40
  };
42
41
  useEffect(() => {
43
- loadOrgs();
42
+ if (config?.activeOrganizationId) {
43
+ const org = orgs?.find((org) => org.uuid === config.activeOrganizationId);
44
+ if (org) {
45
+ setActiveOrg(org);
46
+ }
47
+ else {
48
+ loadOrgs();
49
+ }
50
+ }
44
51
  loadClusters();
45
52
  }, [
46
53
  config?.activeOrganizationId,
@@ -86,13 +93,6 @@ export const C3ProfileProvider = ({ children }) => {
86
93
  resolvedTheme,
87
94
  orgs,
88
95
  activeOrg,
89
- setActiveOrg: (orgId) => {
90
- if (orgs) {
91
- const org = orgs.find((org) => org.uuid === orgId);
92
- if (org)
93
- setActiveOrg(org);
94
- }
95
- },
96
96
  reloadOrgs: loadOrgs,
97
97
  clusters,
98
98
  reloadClusters: loadClusters,
@@ -21,6 +21,7 @@ export type C3UserConfiguration = C3UserConfigurationWithEndpoints | C3UserConfi
21
21
  export type C3UserConfigurationContextValue = C3UserConfiguration & {
22
22
  decodedToken: DecodedToken | null;
23
23
  decodedAudience: string | null;
24
+ setActiveOrgId: (id: string) => void;
24
25
  analyticsTrack?: MixPanelTrack;
25
26
  };
26
27
  export declare const C3UserConfigurationContext: React.Context<C3UserConfigurationContextValue>;
@@ -5,6 +5,7 @@ import { C3HelpCenterProvider } from "../c3-help-center/c3-help-center-provider"
5
5
  export const C3UserConfigurationContext = React.createContext({
6
6
  stage: "dev",
7
7
  activeOrganizationId: "",
8
+ setActiveOrgId: () => undefined,
8
9
  userToken: "",
9
10
  decodedToken: null,
10
11
  decodedAudience: null,
@@ -28,6 +29,7 @@ const C3UserConfigurationProvider = ({ children, activeOrganizationId, ...config
28
29
  return (React.createElement(C3UserConfigurationContext.Provider, { value: {
29
30
  ...config,
30
31
  activeOrganizationId: activeOrgId,
32
+ setActiveOrgId,
31
33
  decodedToken,
32
34
  decodedAudience,
33
35
  } },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda/camunda-composite-components",
3
- "version": "0.2.18-rc.6",
3
+ "version": "0.3.0",
4
4
  "scripts": {
5
5
  "clean": "rimraf lib/",
6
6
  "build": "yarn clean && tsc",
@@ -33,22 +33,22 @@
33
33
  "@carbon/react": "1.37.0",
34
34
  "@mdx-js/react": "2.3.0",
35
35
  "@playwright/test": "1.37.1",
36
- "@storybook/addon-a11y": "7.5.1",
37
- "@storybook/addon-actions": "7.5.1",
38
- "@storybook/addon-docs": "7.5.1",
39
- "@storybook/addon-essentials": "7.5.1",
40
- "@storybook/addon-interactions": "7.5.1",
41
- "@storybook/addon-links": "7.5.1",
42
- "@storybook/blocks": "7.5.1",
36
+ "@storybook/addon-a11y": "7.5.2",
37
+ "@storybook/addon-actions": "7.5.2",
38
+ "@storybook/addon-docs": "7.5.2",
39
+ "@storybook/addon-essentials": "7.5.2",
40
+ "@storybook/addon-interactions": "7.5.2",
41
+ "@storybook/addon-links": "7.5.2",
42
+ "@storybook/blocks": "7.5.2",
43
43
  "@storybook/preset-scss": "1.0.3",
44
- "@storybook/react": "7.5.1",
45
- "@storybook/react-webpack5": "7.5.1",
44
+ "@storybook/react": "7.5.2",
45
+ "@storybook/react-webpack5": "7.5.2",
46
46
  "@storybook/test-runner": "0.13.0",
47
47
  "@storybook/testing-library": "0.2.2",
48
48
  "@types/carbon-components-react": "7.55.3",
49
49
  "@types/event-source-polyfill": "1.0.1",
50
50
  "@types/mixpanel-browser": "2.47.1",
51
- "@types/node": "18.17.15",
51
+ "@types/node": "20.9.0",
52
52
  "@types/react": "18.2.21",
53
53
  "@types/react-dom": "18.2.7",
54
54
  "@types/styled-components": "5.1.27",
@@ -76,7 +76,7 @@
76
76
  "sass": "1.66.1",
77
77
  "sass-loader": "13.3.2",
78
78
  "serve": "14.2.1",
79
- "storybook": "7.5.1",
79
+ "storybook": "7.5.2",
80
80
  "style-loader": "3.3.3",
81
81
  "styled-components": "6.0.7",
82
82
  "typescript": "5.2.2",