@uipath/apollo-react 6.42.0 → 6.43.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 (42) hide show
  1. package/dist/canvas/components/CanvasTakeoverModal/CanvasTakeoverModal.cjs +21 -104
  2. package/dist/canvas/components/CanvasTakeoverModal/CanvasTakeoverModal.d.ts +1 -1
  3. package/dist/canvas/components/CanvasTakeoverModal/CanvasTakeoverModal.d.ts.map +1 -1
  4. package/dist/canvas/components/CanvasTakeoverModal/CanvasTakeoverModal.js +24 -97
  5. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  6. package/dist/material/components/ap-chat/locales/de.cjs +1 -1
  7. package/dist/material/components/ap-chat/locales/de.d.ts.map +1 -1
  8. package/dist/material/components/ap-chat/locales/de.js +1 -1
  9. package/dist/material/components/ap-chat/locales/es-MX.cjs +1 -1
  10. package/dist/material/components/ap-chat/locales/es-MX.d.ts.map +1 -1
  11. package/dist/material/components/ap-chat/locales/es-MX.js +1 -1
  12. package/dist/material/components/ap-chat/locales/es.cjs +1 -1
  13. package/dist/material/components/ap-chat/locales/es.d.ts.map +1 -1
  14. package/dist/material/components/ap-chat/locales/es.js +1 -1
  15. package/dist/material/components/ap-chat/locales/fr.cjs +1 -1
  16. package/dist/material/components/ap-chat/locales/fr.d.ts.map +1 -1
  17. package/dist/material/components/ap-chat/locales/fr.js +1 -1
  18. package/dist/material/components/ap-chat/locales/ja.cjs +1 -1
  19. package/dist/material/components/ap-chat/locales/ja.d.ts.map +1 -1
  20. package/dist/material/components/ap-chat/locales/ja.js +1 -1
  21. package/dist/material/components/ap-chat/locales/ko.cjs +1 -1
  22. package/dist/material/components/ap-chat/locales/ko.d.ts.map +1 -1
  23. package/dist/material/components/ap-chat/locales/ko.js +1 -1
  24. package/dist/material/components/ap-chat/locales/pt-BR.cjs +1 -1
  25. package/dist/material/components/ap-chat/locales/pt-BR.d.ts.map +1 -1
  26. package/dist/material/components/ap-chat/locales/pt-BR.js +1 -1
  27. package/dist/material/components/ap-chat/locales/pt.cjs +1 -1
  28. package/dist/material/components/ap-chat/locales/pt.d.ts.map +1 -1
  29. package/dist/material/components/ap-chat/locales/pt.js +1 -1
  30. package/dist/material/components/ap-chat/locales/ro.cjs +1 -1
  31. package/dist/material/components/ap-chat/locales/ro.d.ts.map +1 -1
  32. package/dist/material/components/ap-chat/locales/ro.js +1 -1
  33. package/dist/material/components/ap-chat/locales/tr.cjs +1 -1
  34. package/dist/material/components/ap-chat/locales/tr.d.ts.map +1 -1
  35. package/dist/material/components/ap-chat/locales/tr.js +1 -1
  36. package/dist/material/components/ap-chat/locales/zh-CN.cjs +1 -1
  37. package/dist/material/components/ap-chat/locales/zh-CN.d.ts.map +1 -1
  38. package/dist/material/components/ap-chat/locales/zh-CN.js +1 -1
  39. package/dist/material/components/ap-chat/locales/zh-TW.cjs +1 -1
  40. package/dist/material/components/ap-chat/locales/zh-TW.d.ts.map +1 -1
  41. package/dist/material/components/ap-chat/locales/zh-TW.js +1 -1
  42. package/package.json +3 -3
@@ -1,14 +1,5 @@
1
1
  "use strict";
2
2
  var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
3
  (()=>{
13
4
  __webpack_require__.d = (exports1, definition)=>{
14
5
  for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
@@ -37,113 +28,39 @@ __webpack_require__.d(__webpack_exports__, {
37
28
  });
38
29
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
39
30
  const apollo_wind_namespaceObject = require("@uipath/apollo-wind");
40
- const external_lucide_react_namespaceObject = require("lucide-react");
41
31
  const external_react_namespaceObject = require("react");
42
- const external_react_focus_lock_namespaceObject = require("react-focus-lock");
43
- var external_react_focus_lock_default = /*#__PURE__*/ __webpack_require__.n(external_react_focus_lock_namespaceObject);
44
- function CanvasTakeoverModal({ open, onOpenChange, title, headerActions, sidebar, children, expanded: controlledExpanded, defaultExpanded = false, onExpandedChange, className, sidebarClassName, closeOnBackdropClick = true }) {
45
- const titleId = (0, external_react_namespaceObject.useId)();
46
- const expandButtonRef = (0, external_react_namespaceObject.useRef)(null);
32
+ function CanvasTakeoverModal({ open, onOpenChange, title, headerActions, sidebar, children, expanded, defaultExpanded, onExpandedChange, className, sidebarClassName, closeOnBackdropClick = true }) {
47
33
  const previouslyFocusedElementRef = (0, external_react_namespaceObject.useRef)(null);
48
- const [uncontrolledExpanded, setUncontrolledExpanded] = (0, external_react_namespaceObject.useState)(defaultExpanded);
49
- const expanded = controlledExpanded ?? uncontrolledExpanded;
50
34
  (0, external_react_namespaceObject.useEffect)(()=>{
51
35
  if (!open) return;
52
36
  previouslyFocusedElementRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
53
- const animationFrame = requestAnimationFrame(()=>expandButtonRef.current?.focus());
54
- const handleKeyDown = (event)=>{
55
- if ('Escape' === event.key) onOpenChange?.(false);
56
- };
57
- document.addEventListener('keydown', handleKeyDown);
58
37
  return ()=>{
59
- cancelAnimationFrame(animationFrame);
60
- document.removeEventListener('keydown', handleKeyDown);
61
38
  previouslyFocusedElementRef.current?.focus();
62
39
  previouslyFocusedElementRef.current = null;
63
40
  };
64
41
  }, [
65
- onOpenChange,
66
42
  open
67
43
  ]);
68
- if (!open) return null;
69
- const setExpanded = (nextExpanded)=>{
70
- if (void 0 === controlledExpanded) setUncontrolledExpanded(nextExpanded);
71
- onExpandedChange?.(nextExpanded);
72
- };
73
- const handleBackdropClick = (event)=>{
74
- if (closeOnBackdropClick && event.target === event.currentTarget) onOpenChange?.(false);
75
- };
76
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
77
- className: (0, apollo_wind_namespaceObject.cn)('absolute inset-0 z-50 flex items-center justify-center bg-black/60', expanded ? 'p-0' : 'p-3'),
78
- onMouseDown: handleBackdropClick,
79
- "data-testid": "canvas-takeover-backdrop",
80
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_focus_lock_default(), {
81
- autoFocus: false,
82
- className: "contents",
83
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("section", {
84
- role: "dialog",
85
- "aria-modal": "true",
86
- "aria-labelledby": titleId,
87
- "data-expanded": expanded,
88
- className: (0, apollo_wind_namespaceObject.cn)('flex min-h-0 flex-col overflow-hidden border border-border-subtle bg-surface-raised text-foreground shadow-xl transition-[width,height,border-radius] duration-200', expanded ? 'h-full w-full rounded-none' : 'h-[95%] w-[95%] rounded-2xl', className),
89
- children: [
90
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("header", {
91
- className: "flex h-12 shrink-0 items-center gap-3 border-b border-border-subtle px-4",
92
- children: [
93
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h2", {
94
- id: titleId,
95
- className: "min-w-0 flex-1 truncate text-sm font-semibold",
96
- children: title
97
- }),
98
- headerActions,
99
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
100
- className: "-mr-1 flex shrink-0 items-center gap-1",
101
- children: [
102
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
103
- ref: expandButtonRef,
104
- type: "button",
105
- onClick: ()=>setExpanded(!expanded),
106
- className: "grid size-8 place-items-center rounded-md text-foreground-muted transition-colors hover:bg-surface-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
107
- "aria-label": expanded ? 'Collapse modal' : 'Expand modal',
108
- title: expanded ? 'Collapse modal' : 'Expand modal',
109
- children: expanded ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Minimize2, {
110
- size: 16,
111
- strokeWidth: 1.75
112
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Maximize2, {
113
- size: 16,
114
- strokeWidth: 1.75
115
- })
116
- }),
117
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
118
- type: "button",
119
- onClick: ()=>onOpenChange?.(false),
120
- className: "grid size-8 place-items-center rounded-md text-foreground-muted transition-colors hover:bg-surface-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
121
- "aria-label": "Close modal",
122
- title: "Close modal",
123
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.X, {
124
- size: 16,
125
- strokeWidth: 1.75
126
- })
127
- })
128
- ]
129
- })
130
- ]
131
- }),
132
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
133
- className: "flex min-h-0 flex-1",
134
- children: [
135
- null != sidebar && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("aside", {
136
- className: (0, apollo_wind_namespaceObject.cn)('w-64 shrink-0 overflow-auto border-r border-border-subtle', sidebarClassName),
137
- children: sidebar
138
- }),
139
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("main", {
140
- className: "min-w-0 flex-1 overflow-auto",
141
- children: children
142
- })
143
- ]
144
- })
145
- ]
146
- })
44
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.Modal, {
45
+ open: open,
46
+ onOpenChange: onOpenChange,
47
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(apollo_wind_namespaceObject.ModalContent, {
48
+ variant: "takeover",
49
+ headerTitle: title,
50
+ headerActions: headerActions,
51
+ sidebar: sidebar,
52
+ expanded: expanded,
53
+ defaultExpanded: defaultExpanded,
54
+ onExpandedChange: onExpandedChange,
55
+ className: className,
56
+ sidebarClassName: sidebarClassName,
57
+ closeOnBackdropClick: closeOnBackdropClick,
58
+ overlayTestId: "canvas-takeover-backdrop",
59
+ onOpenAutoFocus: (event)=>{
60
+ event.preventDefault();
61
+ event.currentTarget.querySelector('[aria-label="Expand modal"], [aria-label="Collapse modal"]')?.focus();
62
+ },
63
+ children: children
147
64
  })
148
65
  });
149
66
  }
@@ -13,5 +13,5 @@ export interface CanvasTakeoverModalProps {
13
13
  sidebarClassName?: string;
14
14
  closeOnBackdropClick?: boolean;
15
15
  }
16
- export declare function CanvasTakeoverModal({ open, onOpenChange, title, headerActions, sidebar, children, expanded: controlledExpanded, defaultExpanded, onExpandedChange, className, sidebarClassName, closeOnBackdropClick, }: CanvasTakeoverModalProps): import("react/jsx-runtime").JSX.Element | null;
16
+ export declare function CanvasTakeoverModal({ open, onOpenChange, title, headerActions, sidebar, children, expanded, defaultExpanded, onExpandedChange, className, sidebarClassName, closeOnBackdropClick, }: CanvasTakeoverModalProps): import("react/jsx-runtime").JSX.Element;
17
17
  //# sourceMappingURL=CanvasTakeoverModal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasTakeoverModal.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/CanvasTakeoverModal/CanvasTakeoverModal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,SAAS,EAAsC,MAAM,OAAO,CAAC;AAG5F,MAAM,WAAW,wBAAwB;IAEvC,IAAI,EAAE,OAAO,CAAC;IAEd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAEvC,KAAK,EAAE,SAAS,CAAC;IAEjB,aAAa,CAAC,EAAE,SAAS,CAAC;IAE1B,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB,QAAQ,EAAE,SAAS,CAAC;IAEpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAE/C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAMD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,aAAa,EACb,OAAO,EACP,QAAQ,EACR,QAAQ,EAAE,kBAAkB,EAC5B,eAAuB,EACvB,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,oBAA2B,GAC5B,EAAE,wBAAwB,kDA2G1B"}
1
+ {"version":3,"file":"CanvasTakeoverModal.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/CanvasTakeoverModal/CanvasTakeoverModal.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAE1D,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAGD,wBAAgB,mBAAmB,CAAC,EAClC,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,aAAa,EACb,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,oBAA2B,GAC5B,EAAE,wBAAwB,2CAwC1B"}
@@ -1,111 +1,38 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { cn } from "@uipath/apollo-wind";
3
- import { Maximize2, Minimize2, X } from "lucide-react";
4
- import { useEffect, useId, useRef, useState } from "react";
5
- import react_focus_lock from "react-focus-lock";
6
- function CanvasTakeoverModal({ open, onOpenChange, title, headerActions, sidebar, children, expanded: controlledExpanded, defaultExpanded = false, onExpandedChange, className, sidebarClassName, closeOnBackdropClick = true }) {
7
- const titleId = useId();
8
- const expandButtonRef = useRef(null);
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Modal, ModalContent } from "@uipath/apollo-wind";
3
+ import { useEffect, useRef } from "react";
4
+ function CanvasTakeoverModal({ open, onOpenChange, title, headerActions, sidebar, children, expanded, defaultExpanded, onExpandedChange, className, sidebarClassName, closeOnBackdropClick = true }) {
9
5
  const previouslyFocusedElementRef = useRef(null);
10
- const [uncontrolledExpanded, setUncontrolledExpanded] = useState(defaultExpanded);
11
- const expanded = controlledExpanded ?? uncontrolledExpanded;
12
6
  useEffect(()=>{
13
7
  if (!open) return;
14
8
  previouslyFocusedElementRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
15
- const animationFrame = requestAnimationFrame(()=>expandButtonRef.current?.focus());
16
- const handleKeyDown = (event)=>{
17
- if ('Escape' === event.key) onOpenChange?.(false);
18
- };
19
- document.addEventListener('keydown', handleKeyDown);
20
9
  return ()=>{
21
- cancelAnimationFrame(animationFrame);
22
- document.removeEventListener('keydown', handleKeyDown);
23
10
  previouslyFocusedElementRef.current?.focus();
24
11
  previouslyFocusedElementRef.current = null;
25
12
  };
26
13
  }, [
27
- onOpenChange,
28
14
  open
29
15
  ]);
30
- if (!open) return null;
31
- const setExpanded = (nextExpanded)=>{
32
- if (void 0 === controlledExpanded) setUncontrolledExpanded(nextExpanded);
33
- onExpandedChange?.(nextExpanded);
34
- };
35
- const handleBackdropClick = (event)=>{
36
- if (closeOnBackdropClick && event.target === event.currentTarget) onOpenChange?.(false);
37
- };
38
- return /*#__PURE__*/ jsx("div", {
39
- className: cn('absolute inset-0 z-50 flex items-center justify-center bg-black/60', expanded ? 'p-0' : 'p-3'),
40
- onMouseDown: handleBackdropClick,
41
- "data-testid": "canvas-takeover-backdrop",
42
- children: /*#__PURE__*/ jsx(react_focus_lock, {
43
- autoFocus: false,
44
- className: "contents",
45
- children: /*#__PURE__*/ jsxs("section", {
46
- role: "dialog",
47
- "aria-modal": "true",
48
- "aria-labelledby": titleId,
49
- "data-expanded": expanded,
50
- className: cn('flex min-h-0 flex-col overflow-hidden border border-border-subtle bg-surface-raised text-foreground shadow-xl transition-[width,height,border-radius] duration-200', expanded ? 'h-full w-full rounded-none' : 'h-[95%] w-[95%] rounded-2xl', className),
51
- children: [
52
- /*#__PURE__*/ jsxs("header", {
53
- className: "flex h-12 shrink-0 items-center gap-3 border-b border-border-subtle px-4",
54
- children: [
55
- /*#__PURE__*/ jsx("h2", {
56
- id: titleId,
57
- className: "min-w-0 flex-1 truncate text-sm font-semibold",
58
- children: title
59
- }),
60
- headerActions,
61
- /*#__PURE__*/ jsxs("div", {
62
- className: "-mr-1 flex shrink-0 items-center gap-1",
63
- children: [
64
- /*#__PURE__*/ jsx("button", {
65
- ref: expandButtonRef,
66
- type: "button",
67
- onClick: ()=>setExpanded(!expanded),
68
- className: "grid size-8 place-items-center rounded-md text-foreground-muted transition-colors hover:bg-surface-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
69
- "aria-label": expanded ? 'Collapse modal' : 'Expand modal',
70
- title: expanded ? 'Collapse modal' : 'Expand modal',
71
- children: expanded ? /*#__PURE__*/ jsx(Minimize2, {
72
- size: 16,
73
- strokeWidth: 1.75
74
- }) : /*#__PURE__*/ jsx(Maximize2, {
75
- size: 16,
76
- strokeWidth: 1.75
77
- })
78
- }),
79
- /*#__PURE__*/ jsx("button", {
80
- type: "button",
81
- onClick: ()=>onOpenChange?.(false),
82
- className: "grid size-8 place-items-center rounded-md text-foreground-muted transition-colors hover:bg-surface-hover hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-focus",
83
- "aria-label": "Close modal",
84
- title: "Close modal",
85
- children: /*#__PURE__*/ jsx(X, {
86
- size: 16,
87
- strokeWidth: 1.75
88
- })
89
- })
90
- ]
91
- })
92
- ]
93
- }),
94
- /*#__PURE__*/ jsxs("div", {
95
- className: "flex min-h-0 flex-1",
96
- children: [
97
- null != sidebar && /*#__PURE__*/ jsx("aside", {
98
- className: cn('w-64 shrink-0 overflow-auto border-r border-border-subtle', sidebarClassName),
99
- children: sidebar
100
- }),
101
- /*#__PURE__*/ jsx("main", {
102
- className: "min-w-0 flex-1 overflow-auto",
103
- children: children
104
- })
105
- ]
106
- })
107
- ]
108
- })
16
+ return /*#__PURE__*/ jsx(Modal, {
17
+ open: open,
18
+ onOpenChange: onOpenChange,
19
+ children: /*#__PURE__*/ jsx(ModalContent, {
20
+ variant: "takeover",
21
+ headerTitle: title,
22
+ headerActions: headerActions,
23
+ sidebar: sidebar,
24
+ expanded: expanded,
25
+ defaultExpanded: defaultExpanded,
26
+ onExpandedChange: onExpandedChange,
27
+ className: className,
28
+ sidebarClassName: sidebarClassName,
29
+ closeOnBackdropClick: closeOnBackdropClick,
30
+ overlayTestId: "canvas-takeover-backdrop",
31
+ onOpenAutoFocus: (event)=>{
32
+ event.preventDefault();
33
+ event.currentTarget.querySelector('[aria-label="Expand modal"], [aria-label="Collapse modal"]')?.focus();
34
+ },
35
+ children: children
109
36
  })
110
37
  });
111
38
  }