@povio/ui 2.1.15 → 2.1.17
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.
- package/README.md +6 -0
- package/dist/BottomSheet.js +2 -1
- package/dist/DatePicker.js +9 -3
- package/dist/DateTimePicker.js +13 -4
- package/dist/Drawer.js +10 -2
- package/dist/MenuDesktop.js +2 -1
- package/dist/MenuMobile.js +25 -13
- package/dist/MenuPopover.js +22 -10
- package/dist/Modal.js +5 -1
- package/dist/components/Menu/Menu.d.ts +2 -1
- package/dist/components/Menu/MenuDesktop.d.ts +1 -1
- package/dist/components/Menu/MenuMobile.d.ts +1 -1
- package/dist/components/Menu/MenuPopover.d.ts +2 -2
- package/dist/components/overlays/BottomSheet/BottomSheet.d.ts +1 -0
- package/dist/components/overlays/Drawer/Drawer.d.ts +3 -1
- package/dist/components/overlays/Modal/Modal.d.ts +2 -1
- package/dist/config/i18n.d.ts +1 -0
- package/dist/error-handling.js +14 -2
- package/dist/translation.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,12 @@ Tailwind version 4 also defaults to `cursor: default` for buttons which differs
|
|
|
29
29
|
|
|
30
30
|
This is required for buttons to behave as expected. It is based on [Tailwind Upgrade Guide](https://tailwindcss.com/docs/upgrade-guide#buttons-use-the-default-cursor).
|
|
31
31
|
|
|
32
|
+
In order for Tailwind to also compile classes for @povio/ui package, you need to include @source directive in Tailwind config.
|
|
33
|
+
In your globals.css add (make sure path is correct):
|
|
34
|
+
```css
|
|
35
|
+
@source "../../node-modules/@povio/ui/dist";
|
|
36
|
+
```
|
|
37
|
+
|
|
32
38
|
### React Aria
|
|
33
39
|
|
|
34
40
|
We are using `react-aria-components` for our UI components including their plugin for Tailwind that makes classes for modifiers a bit shorter. As such, make sure to install and setup [`tailwindcss-react-aria-components`](https://www.npmjs.com/package/tailwindcss-react-aria-components)
|
package/dist/BottomSheet.js
CHANGED
|
@@ -22,7 +22,7 @@ var staticTransition = {
|
|
|
22
22
|
1
|
|
23
23
|
]
|
|
24
24
|
};
|
|
25
|
-
var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = false, isScrollable = true, height = "full", label, portalContainerRef, children, footer, sheetMarginTop = 96, sheetMarginBottom = 128 }) => {
|
|
25
|
+
var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = false, isScrollable = true, height = "full", label, portalContainerRef, children, footer, sheetMarginTop = 96, sheetMarginBottom = 128, shouldCloseOnInteractOutside }) => {
|
|
26
26
|
const viewport = useViewportSize();
|
|
27
27
|
const { sheetHeight, windowHeight } = useMemo(() => {
|
|
28
28
|
return {
|
|
@@ -65,6 +65,7 @@ var BottomSheetBase = ({ isOpen, onOpenChange, onStateChange, isDismissable = fa
|
|
|
65
65
|
isDismissable,
|
|
66
66
|
style: { height: viewport.height },
|
|
67
67
|
ref: overlayRef,
|
|
68
|
+
shouldCloseOnInteractOutside,
|
|
68
69
|
children: [/* @__PURE__ */ jsx(react_exports.motion.div, {
|
|
69
70
|
className: "pointer-events-none absolute inset-0 bg-support-overlay",
|
|
70
71
|
animate: { opacity: 1 },
|
package/dist/DatePicker.js
CHANGED
|
@@ -8,7 +8,7 @@ import { TooltipWrapper } from "./TooltipWrapper.js";
|
|
|
8
8
|
import { DateTimeUtils } from "./date-time.utils.js";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { clsx } from "clsx";
|
|
11
|
-
import { useRef } from "react";
|
|
11
|
+
import { useImperativeHandle, useMemo, useRef } from "react";
|
|
12
12
|
import { useDatePicker, useLocale } from "react-aria";
|
|
13
13
|
import { mergeRefs } from "@react-aria/utils";
|
|
14
14
|
import { Controller } from "react-hook-form";
|
|
@@ -32,6 +32,13 @@ var DatePickerBase = (props) => {
|
|
|
32
32
|
headerClassName,
|
|
33
33
|
errorClassName
|
|
34
34
|
};
|
|
35
|
+
const datePickerInputRef = useRef(null);
|
|
36
|
+
const datePickerRef = useMemo(() => ({ get current() {
|
|
37
|
+
return datePickerInputRef.current?.getContainer?.() || null;
|
|
38
|
+
} }), []);
|
|
39
|
+
useImperativeHandle(ref, () => ({ clear: () => {
|
|
40
|
+
datePickerInputRef.current?.clear();
|
|
41
|
+
} }));
|
|
35
42
|
const dialogState = useDatePickerState({
|
|
36
43
|
...rest,
|
|
37
44
|
defaultValue: value || rest.defaultValue,
|
|
@@ -53,7 +60,6 @@ var DatePickerBase = (props) => {
|
|
|
53
60
|
},
|
|
54
61
|
shouldCloseOnSelect: false
|
|
55
62
|
});
|
|
56
|
-
const datePickerRef = useRef(null);
|
|
57
63
|
const { groupProps, labelProps, fieldProps, buttonProps, dialogProps } = useDatePicker({
|
|
58
64
|
...rest,
|
|
59
65
|
label,
|
|
@@ -105,7 +111,7 @@ var DatePickerBase = (props) => {
|
|
|
105
111
|
className: clsx("relative inline-flex w-full flex-col text-left", className),
|
|
106
112
|
tabIndex: as === "inline" ? -1 : void 0,
|
|
107
113
|
children: [/* @__PURE__ */ jsx(DatePickerInput, {
|
|
108
|
-
ref: mergeRefs(ref,
|
|
114
|
+
ref: mergeRefs(ref, datePickerInputRef),
|
|
109
115
|
as,
|
|
110
116
|
groupProps,
|
|
111
117
|
fieldProps: {
|
package/dist/DateTimePicker.js
CHANGED
|
@@ -7,7 +7,7 @@ import { FormField } from "./FormField.js";
|
|
|
7
7
|
import { TooltipWrapper } from "./TooltipWrapper.js";
|
|
8
8
|
import { DateTimeUtils } from "./date-time.utils.js";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { useEffect, useRef } from "react";
|
|
10
|
+
import { useEffect, useImperativeHandle, useMemo, useRef } from "react";
|
|
11
11
|
import { useDatePicker, useLocale } from "react-aria";
|
|
12
12
|
import { mergeRefs } from "@react-aria/utils";
|
|
13
13
|
import { Controller } from "react-hook-form";
|
|
@@ -30,6 +30,13 @@ var DateTimePickerBase = (props) => {
|
|
|
30
30
|
headerClassName,
|
|
31
31
|
errorClassName
|
|
32
32
|
};
|
|
33
|
+
const datePickerInputRef = useRef(null);
|
|
34
|
+
const datePickerRef = useMemo(() => ({ get current() {
|
|
35
|
+
return datePickerInputRef.current?.getContainer?.() || null;
|
|
36
|
+
} }), []);
|
|
37
|
+
useImperativeHandle(ref, () => ({ clear: () => {
|
|
38
|
+
datePickerInputRef.current?.clear();
|
|
39
|
+
} }));
|
|
33
40
|
const dialogState = useDatePickerState({
|
|
34
41
|
...rest,
|
|
35
42
|
defaultValue: value || rest.defaultValue,
|
|
@@ -54,7 +61,6 @@ var DateTimePickerBase = (props) => {
|
|
|
54
61
|
granularity: "minute",
|
|
55
62
|
hideTimeZone: true
|
|
56
63
|
});
|
|
57
|
-
const datePickerRef = useRef(null);
|
|
58
64
|
const { groupProps, labelProps, fieldProps, buttonProps, dialogProps } = useDatePicker({
|
|
59
65
|
...rest,
|
|
60
66
|
label,
|
|
@@ -110,13 +116,15 @@ var DateTimePickerBase = (props) => {
|
|
|
110
116
|
return /* @__PURE__ */ jsx(TooltipWrapper, {
|
|
111
117
|
as,
|
|
112
118
|
error,
|
|
119
|
+
triggerTabIndex: as === "inline" ? -1 : void 0,
|
|
113
120
|
children: /* @__PURE__ */ jsxs(FormField, {
|
|
114
121
|
...formFieldProps,
|
|
115
122
|
as,
|
|
116
123
|
labelProps,
|
|
117
124
|
className: "relative inline-flex w-full flex-col text-left",
|
|
125
|
+
tabIndex: as === "inline" ? -1 : void 0,
|
|
118
126
|
children: [/* @__PURE__ */ jsx(DatePickerInput, {
|
|
119
|
-
ref: mergeRefs(ref,
|
|
127
|
+
ref: mergeRefs(ref, datePickerInputRef),
|
|
120
128
|
as,
|
|
121
129
|
groupProps,
|
|
122
130
|
fieldProps: {
|
|
@@ -180,12 +188,13 @@ const DateTimePicker = ({ fullIso = true,...props }) => {
|
|
|
180
188
|
return /* @__PURE__ */ jsx(Controller, {
|
|
181
189
|
control: formControl.control,
|
|
182
190
|
name: formControl.name,
|
|
183
|
-
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
191
|
+
render: ({ field, fieldState: { error, isDirty } }) => /* @__PURE__ */ jsx(DateTimePickerBase, {
|
|
184
192
|
...innerProps,
|
|
185
193
|
ref: mergeRefs(ref, field.ref),
|
|
186
194
|
value: parseDateValue(field.value),
|
|
187
195
|
onChange: (value) => field.onChange(formatDateValue(value)),
|
|
188
196
|
onBlur: field.onBlur,
|
|
197
|
+
isDirty,
|
|
189
198
|
isDisabled: field.disabled || props.isDisabled,
|
|
190
199
|
error: props.error ?? error?.message
|
|
191
200
|
})
|
package/dist/Drawer.js
CHANGED
|
@@ -2,16 +2,18 @@ import { modalOverlay } from "./modal.cva.js";
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { clsx } from "clsx";
|
|
4
4
|
import { Dialog, DialogTrigger, Modal, ModalOverlay } from "react-aria-components";
|
|
5
|
-
const Drawer = ({ isOpen, portalContainerRef, onOpenChange, trigger, children, isDismissable, overlayClassName, dialogClassName, className }) => {
|
|
5
|
+
const Drawer = ({ label, isOpen, portalContainerRef, onOpenChange, trigger, children, isDismissable, overlayClassName, dialogClassName, className, shouldCloseOnInteractOutside }) => {
|
|
6
6
|
if (trigger) return /* @__PURE__ */ jsxs(DialogTrigger, {
|
|
7
7
|
isOpen,
|
|
8
8
|
onOpenChange,
|
|
9
9
|
children: [trigger, /* @__PURE__ */ jsx(DrawerOverlay, {
|
|
10
|
+
label,
|
|
10
11
|
portalContainerRef,
|
|
11
12
|
isDismissable,
|
|
12
13
|
overlayClassName,
|
|
13
14
|
dialogClassName,
|
|
14
15
|
className,
|
|
16
|
+
shouldCloseOnInteractOutside,
|
|
15
17
|
children
|
|
16
18
|
})]
|
|
17
19
|
});
|
|
@@ -20,20 +22,26 @@ const Drawer = ({ isOpen, portalContainerRef, onOpenChange, trigger, children, i
|
|
|
20
22
|
onOpenChange,
|
|
21
23
|
portalContainerRef,
|
|
22
24
|
isDismissable,
|
|
25
|
+
overlayClassName,
|
|
26
|
+
dialogClassName,
|
|
23
27
|
className,
|
|
28
|
+
label,
|
|
29
|
+
shouldCloseOnInteractOutside,
|
|
24
30
|
children
|
|
25
31
|
});
|
|
26
32
|
};
|
|
27
|
-
var DrawerOverlay = ({ isOpen, onOpenChange, portalContainerRef, children, isDismissable, overlayClassName, dialogClassName, className }) => {
|
|
33
|
+
var DrawerOverlay = ({ label, isOpen, onOpenChange, portalContainerRef, children, isDismissable, overlayClassName, dialogClassName, className, shouldCloseOnInteractOutside }) => {
|
|
28
34
|
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
29
35
|
isOpen,
|
|
30
36
|
onOpenChange,
|
|
31
37
|
UNSTABLE_portalContainer: portalContainerRef?.current,
|
|
32
38
|
className: clsx(modalOverlay(), overlayClassName),
|
|
33
39
|
isDismissable,
|
|
40
|
+
shouldCloseOnInteractOutside,
|
|
34
41
|
children: /* @__PURE__ */ jsx(Modal, {
|
|
35
42
|
className: clsx("fixed inset-y-0 right-0 z-10 w-fit entering:animate-drawer-enter-right exiting:animate-drawer-exit-right bg-elevation-fill-default-1", className),
|
|
36
43
|
children: /* @__PURE__ */ jsx(Dialog, {
|
|
44
|
+
"aria-label": label,
|
|
37
45
|
className: clsx("outline-none", dialogClassName),
|
|
38
46
|
children: ({ close }) => children(close)
|
|
39
47
|
})
|
package/dist/MenuDesktop.js
CHANGED
|
@@ -4,7 +4,7 @@ import { MenuTrigger } from "react-aria-components";
|
|
|
4
4
|
import React, { useRef, useState } from "react";
|
|
5
5
|
import { useHover } from "react-aria";
|
|
6
6
|
var CLOSE_DELAY = 100;
|
|
7
|
-
const MenuDesktop = ({ trigger, items, closeDelay = CLOSE_DELAY, triggerOnHover = false,...props }) => {
|
|
7
|
+
const MenuDesktop = ({ trigger, items, closeDelay = CLOSE_DELAY, triggerOnHover = false, onAction,...props }) => {
|
|
8
8
|
const [isOpen, setIsOpen] = useState(false);
|
|
9
9
|
const timeoutRef = useRef(null);
|
|
10
10
|
const isHoveringTrigger = useRef(false);
|
|
@@ -43,6 +43,7 @@ const MenuDesktop = ({ trigger, items, closeDelay = CLOSE_DELAY, triggerOnHover
|
|
|
43
43
|
...props,
|
|
44
44
|
offset: 0,
|
|
45
45
|
items,
|
|
46
|
+
onAction,
|
|
46
47
|
isOpen: triggerOnHover ? isOpen : void 0,
|
|
47
48
|
isNonModal: triggerOnHover,
|
|
48
49
|
onMouseEnter: triggerOnHover ? openMenu : void 0,
|
package/dist/MenuMobile.js
CHANGED
|
@@ -7,20 +7,24 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { Button, Menu } from "react-aria-components";
|
|
9
9
|
import { useRef, useState } from "react";
|
|
10
|
-
const MenuMobile = ({ trigger, items,...props }) => {
|
|
10
|
+
const MenuMobile = ({ trigger, items, onAction,...props }) => {
|
|
11
11
|
const uiStyle = UIStyle.useConfig();
|
|
12
12
|
const menuItemCva$1 = uiStyle?.menu?.itemCva ?? menuItemCva;
|
|
13
13
|
const menuCva$1 = uiStyle?.menu?.cva ?? menuCva;
|
|
14
14
|
const activeItemRef = useRef(null);
|
|
15
15
|
const activeItemParentsRef = useRef([]);
|
|
16
|
+
const lastEventRef = useRef(null);
|
|
16
17
|
const [isOpen, setIsOpen] = useState(false);
|
|
17
18
|
const [activeItem, setActiveItem] = useState(null);
|
|
18
|
-
const
|
|
19
|
+
const handleAction = (item) => {
|
|
19
20
|
if (!item.children) {
|
|
20
21
|
activeItemRef.current = null;
|
|
21
22
|
activeItemParentsRef.current = [];
|
|
22
23
|
setActiveItem(null);
|
|
23
24
|
setIsOpen(false);
|
|
25
|
+
item.onAction?.();
|
|
26
|
+
onAction?.(item.id, lastEventRef.current);
|
|
27
|
+
lastEventRef.current = null;
|
|
24
28
|
return;
|
|
25
29
|
}
|
|
26
30
|
if (activeItemRef.current) activeItemParentsRef.current.push(activeItemRef.current);
|
|
@@ -47,17 +51,25 @@ const MenuMobile = ({ trigger, items,...props }) => {
|
|
|
47
51
|
})),
|
|
48
52
|
onPress: onBack,
|
|
49
53
|
children: [/* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-6" }), activeItem.label]
|
|
50
|
-
}), /* @__PURE__ */ jsx(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
children:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
55
|
+
onClickCapture: (e) => {
|
|
56
|
+
lastEventRef.current = e;
|
|
57
|
+
},
|
|
58
|
+
onKeyDownCapture: (e) => {
|
|
59
|
+
lastEventRef.current = e;
|
|
60
|
+
},
|
|
61
|
+
children: /* @__PURE__ */ jsx(Menu, {
|
|
62
|
+
autoFocus: true,
|
|
63
|
+
onClose,
|
|
64
|
+
className: menuCva$1({
|
|
65
|
+
...props,
|
|
66
|
+
isMobile: true
|
|
67
|
+
}),
|
|
68
|
+
children: (activeItem?.children ?? items).map((item, index) => /* @__PURE__ */ jsx(MenuItem$1, {
|
|
69
|
+
...item,
|
|
70
|
+
onAction: () => handleAction(item)
|
|
71
|
+
}, index))
|
|
72
|
+
})
|
|
61
73
|
})] })
|
|
62
74
|
});
|
|
63
75
|
};
|
package/dist/MenuPopover.js
CHANGED
|
@@ -4,7 +4,9 @@ import { MenuItem as MenuItem$1 } from "./MenuItem.js";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { clsx } from "clsx";
|
|
6
6
|
import { Menu, Popover, SubmenuTrigger } from "react-aria-components";
|
|
7
|
-
|
|
7
|
+
import { useRef } from "react";
|
|
8
|
+
const MenuPopover = ({ items, className, onAction,...props }) => {
|
|
9
|
+
const lastEventRef = useRef(null);
|
|
8
10
|
const uiStyle = UIStyle.useConfig();
|
|
9
11
|
const menuPopoverCva$1 = uiStyle?.menu?.popoverCva ?? menuPopoverCva;
|
|
10
12
|
const menuPopoverWrapperCva$1 = uiStyle?.menu?.popoverWrapperCva ?? menuPopoverWrapperCva;
|
|
@@ -14,15 +16,25 @@ const MenuPopover = ({ items, className,...props }) => {
|
|
|
14
16
|
className: clsx(menuPopoverCva$1({ ...props }), className),
|
|
15
17
|
children: /* @__PURE__ */ jsx("div", {
|
|
16
18
|
className: menuPopoverWrapperCva$1({ ...props }),
|
|
17
|
-
children: /* @__PURE__ */ jsx(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
20
|
+
onClickCapture: (e) => {
|
|
21
|
+
lastEventRef.current = e;
|
|
22
|
+
},
|
|
23
|
+
onKeyDownCapture: (e) => {
|
|
24
|
+
lastEventRef.current = e;
|
|
25
|
+
},
|
|
26
|
+
children: /* @__PURE__ */ jsx(Menu, {
|
|
27
|
+
onAction: (key) => onAction?.(key, lastEventRef.current),
|
|
28
|
+
className: menuCva$1({
|
|
29
|
+
...props,
|
|
30
|
+
isMobile: false
|
|
31
|
+
}),
|
|
32
|
+
children: items.map((item, index) => !item.children || item.children.length === 0 ? /* @__PURE__ */ jsx(MenuItem$1, { ...item }, index) : /* @__PURE__ */ jsxs(SubmenuTrigger, { children: [/* @__PURE__ */ jsx(MenuItem$1, { ...item }), /* @__PURE__ */ jsx(MenuPopover, {
|
|
33
|
+
offset: 0,
|
|
34
|
+
onAction,
|
|
35
|
+
items: item.children
|
|
36
|
+
})] }, index))
|
|
37
|
+
})
|
|
26
38
|
})
|
|
27
39
|
})
|
|
28
40
|
});
|
package/dist/Modal.js
CHANGED
|
@@ -7,7 +7,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
7
7
|
import { clsx } from "clsx";
|
|
8
8
|
import { Dialog, Modal, ModalOverlay } from "react-aria-components";
|
|
9
9
|
import { useTranslation } from "react-i18next";
|
|
10
|
-
const Modal$1 = ({ isOpen, portalContainerRef, onClose, aside, children, modalClassName, closeIconClassName, overlayClassName, showCloseIcon, isDismissable = true }) => {
|
|
10
|
+
const Modal$1 = ({ isOpen, portalContainerRef, onClose, aside, children, modalClassName, closeIconClassName, overlayClassName, showCloseIcon, isDismissable = true, shouldCloseOnInteractOutside }) => {
|
|
11
11
|
const { t } = useTranslation("ui");
|
|
12
12
|
const uiStyle = UIStyle.useConfig();
|
|
13
13
|
const modalMainCva = uiStyle?.modal?.mainCva ?? modalMain;
|
|
@@ -22,6 +22,10 @@ const Modal$1 = ({ isOpen, portalContainerRef, onClose, aside, children, modalCl
|
|
|
22
22
|
isDismissable,
|
|
23
23
|
isOpen,
|
|
24
24
|
shouldCloseOnInteractOutside: () => {
|
|
25
|
+
if (shouldCloseOnInteractOutside) {
|
|
26
|
+
if (portalContainerRef?.current) return false;
|
|
27
|
+
return shouldCloseOnInteractOutside();
|
|
28
|
+
}
|
|
25
29
|
return !portalContainerRef?.current;
|
|
26
30
|
},
|
|
27
31
|
onOpenChange: (open) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
1
|
+
import { Key, ReactElement } from 'react';
|
|
2
2
|
import { MenuItemProps } from 'react-aria-components';
|
|
3
3
|
import { MenuCvaVariantProps, MenuItemVariantProps, MenuPopoverVariantProps, MenuPopoverWrapperVariantProps } from './menu.cva';
|
|
4
4
|
export interface MenuItem extends Omit<MenuItemProps, "aria-label" | "textValue" | "children">, MenuItemVariantProps, MenuCvaVariantProps, MenuPopoverVariantProps, MenuPopoverWrapperVariantProps {
|
|
@@ -11,5 +11,6 @@ export interface MenuProps {
|
|
|
11
11
|
items: MenuItem[];
|
|
12
12
|
triggerOnHover?: boolean;
|
|
13
13
|
closeDelay?: number;
|
|
14
|
+
onAction?: (key: Key, e: any) => void;
|
|
14
15
|
}
|
|
15
16
|
export declare const Menu: (props: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MenuProps } from './Menu';
|
|
2
|
-
export declare const MenuDesktop: ({ trigger, items, closeDelay, triggerOnHover, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const MenuDesktop: ({ trigger, items, closeDelay, triggerOnHover, onAction, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MenuProps } from './Menu';
|
|
2
|
-
export declare const MenuMobile: ({ trigger, items, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const MenuMobile: ({ trigger, items, onAction, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PopoverProps as AriaPopoverProps } from 'react-aria-components';
|
|
2
2
|
import { MenuProps } from './Menu';
|
|
3
|
-
export interface MenuPopoverProps extends Pick<MenuProps, "items">, AriaPopoverProps {
|
|
3
|
+
export interface MenuPopoverProps extends Pick<MenuProps, "items" | "onAction">, AriaPopoverProps {
|
|
4
4
|
}
|
|
5
|
-
export declare const MenuPopover: ({ items, className, ...props }: MenuPopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const MenuPopover: ({ items, className, onAction, ...props }: MenuPopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode, RefObject } from 'react';
|
|
2
2
|
export interface DrawerProps {
|
|
3
|
+
label: string;
|
|
3
4
|
isOpen?: boolean;
|
|
4
5
|
portalContainerRef?: RefObject<HTMLElement>;
|
|
5
6
|
onOpenChange?: (isOpen: boolean) => void;
|
|
@@ -9,5 +10,6 @@ export interface DrawerProps {
|
|
|
9
10
|
overlayClassName?: string;
|
|
10
11
|
dialogClassName?: string;
|
|
11
12
|
className?: string;
|
|
13
|
+
shouldCloseOnInteractOutside?: () => boolean;
|
|
12
14
|
}
|
|
13
|
-
export declare const Drawer: ({ isOpen, portalContainerRef, onOpenChange, trigger, children, isDismissable, overlayClassName, dialogClassName, className, }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const Drawer: ({ label, isOpen, portalContainerRef, onOpenChange, trigger, children, isDismissable, overlayClassName, dialogClassName, className, shouldCloseOnInteractOutside, }: DrawerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -9,5 +9,6 @@ export interface ModalProps extends ModalVariantProps {
|
|
|
9
9
|
overlayClassName?: string;
|
|
10
10
|
showCloseIcon?: boolean;
|
|
11
11
|
isDismissable?: boolean;
|
|
12
|
+
shouldCloseOnInteractOutside?: () => boolean;
|
|
12
13
|
}
|
|
13
|
-
export declare const Modal: ({ isOpen, portalContainerRef, onClose, aside, children, modalClassName, closeIconClassName, overlayClassName, showCloseIcon, isDismissable, }: PropsWithChildren<ModalProps>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const Modal: ({ isOpen, portalContainerRef, onClose, aside, children, modalClassName, closeIconClassName, overlayClassName, showCloseIcon, isDismissable, shouldCloseOnInteractOutside, }: PropsWithChildren<ModalProps>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/config/i18n.d.ts
CHANGED
package/dist/error-handling.js
CHANGED
|
@@ -50,7 +50,13 @@ var ErrorHandler = class {
|
|
|
50
50
|
const unknownError = {
|
|
51
51
|
code: "UNKNOWN_ERROR",
|
|
52
52
|
condition: () => true,
|
|
53
|
-
getMessage: () =>
|
|
53
|
+
getMessage: (e) => {
|
|
54
|
+
if (axios.isAxiosError(e) && e.response?.data?.code) return i18next.t(($) => $.sharedErrors.unknownErrorWithCode, {
|
|
55
|
+
ns: "ui",
|
|
56
|
+
code: e.response.data.code
|
|
57
|
+
});
|
|
58
|
+
return i18next.t(($) => $.sharedErrors.unknownError, { ns: "ui" });
|
|
59
|
+
}
|
|
54
60
|
};
|
|
55
61
|
this.entries = [
|
|
56
62
|
...entries,
|
|
@@ -79,7 +85,13 @@ var ErrorHandler = class {
|
|
|
79
85
|
if (typeof error === "string") return error;
|
|
80
86
|
if (error instanceof Error) return error.message;
|
|
81
87
|
if (error instanceof ApplicationException) return error.message;
|
|
82
|
-
if (fallbackToUnknown)
|
|
88
|
+
if (fallbackToUnknown) {
|
|
89
|
+
if (error && typeof error === "object" && "code" in error) return i18next.t(($) => $.sharedErrors.unknownErrorWithCode, {
|
|
90
|
+
ns: "ui",
|
|
91
|
+
code: error.code
|
|
92
|
+
});
|
|
93
|
+
return i18next.t(($) => $.sharedErrors.unknownError, { ns: "ui" });
|
|
94
|
+
}
|
|
83
95
|
return null;
|
|
84
96
|
}
|
|
85
97
|
};
|
package/dist/translation.js
CHANGED
|
@@ -141,7 +141,8 @@ var translation_default = {
|
|
|
141
141
|
"internalError": "An internal error occurred. This is most likely a bug on our end. Please try again later.",
|
|
142
142
|
"networkError": "A network error occurred. Are you connected to the internet?",
|
|
143
143
|
"canceledError": "The request was canceled.",
|
|
144
|
-
"unknownError": "An unknown error occurred.
|
|
144
|
+
"unknownError": "An unknown error occurred.",
|
|
145
|
+
"unknownErrorWithCode": "An unknown error occurred. Error code: \"{{code}}\""
|
|
145
146
|
}
|
|
146
147
|
};
|
|
147
148
|
export { translation_default as default };
|