@povio/ui 2.1.9 → 2.1.11
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/dist/components/Menu/Menu.d.ts +2 -1
- package/dist/components/Menu/MenuDesktop.d.ts +1 -1
- package/dist/components/Menu/MenuDesktop.js +8 -2
- package/dist/components/Menu/MenuItem.d.ts +1 -2
- package/dist/components/Menu/MenuItem.js +7 -14
- package/dist/components/Menu/MenuMobile.d.ts +1 -1
- package/dist/components/Menu/MenuMobile.js +9 -4
- package/dist/components/Menu/MenuPopover.d.ts +1 -1
- package/dist/components/Menu/MenuPopover.js +9 -4
- package/dist/components/Menu/menu.cva.d.ts +17 -0
- package/dist/components/Menu/menu.cva.js +45 -0
- package/dist/components/buttons/Button/button.cva.js +505 -485
- package/dist/components/inputs/File/FileUpload.js +1 -1
- package/dist/components/inputs/Input/shared/InputContent.js +2 -2
- package/dist/components/inputs/Slider/Slider.js +1 -1
- package/dist/components/inputs/shared/label.cva.js +2 -2
- package/dist/components/overlays/Modal/Modal.js +8 -3
- package/dist/components/segment/Segment.js +5 -6
- package/dist/components/segment/SegmentItem.js +6 -15
- package/dist/components/segment/segment.cva.d.ts +9 -0
- package/dist/components/segment/segment.cva.js +35 -0
- package/dist/components/segment/segment.types.d.ts +3 -2
- package/dist/components/text/Tag/Tag.d.ts +1 -1
- package/dist/components/text/Tag/Tag.js +2 -2
- package/dist/config/uiStyle.context.d.ts +18 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
2
|
import { MenuItemProps } from 'react-aria-components';
|
|
3
|
-
|
|
3
|
+
import { MenuCvaVariantProps, MenuItemVariantProps, MenuPopoverVariantProps, MenuPopoverWrapperVariantProps } from './menu.cva';
|
|
4
|
+
export interface MenuItem extends Omit<MenuItemProps, "aria-label" | "textValue" | "children">, MenuItemVariantProps, MenuCvaVariantProps, MenuPopoverVariantProps, MenuPopoverWrapperVariantProps {
|
|
4
5
|
label: string;
|
|
5
6
|
content?: string | ReactElement;
|
|
6
7
|
children?: MenuItem[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MenuProps } from './Menu';
|
|
2
|
-
export declare const MenuDesktop: ({ trigger, items, closeDelay, triggerOnHover }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const MenuDesktop: ({ trigger, items, closeDelay, triggerOnHover, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,7 +4,13 @@ import { useHover } from "react-aria";
|
|
|
4
4
|
import { MenuTrigger } from "react-aria-components";
|
|
5
5
|
import { MenuPopover } from "./MenuPopover.js";
|
|
6
6
|
const CLOSE_DELAY = 100;
|
|
7
|
-
const MenuDesktop = ({
|
|
7
|
+
const MenuDesktop = ({
|
|
8
|
+
trigger,
|
|
9
|
+
items,
|
|
10
|
+
closeDelay = CLOSE_DELAY,
|
|
11
|
+
triggerOnHover = false,
|
|
12
|
+
...props
|
|
13
|
+
}) => {
|
|
8
14
|
const [isOpen, setIsOpen] = useState(false);
|
|
9
15
|
const timeoutRef = useRef(null);
|
|
10
16
|
const isHoveringTrigger = useRef(false);
|
|
@@ -50,8 +56,8 @@ const MenuDesktop = ({ trigger, items, closeDelay = CLOSE_DELAY, triggerOnHover
|
|
|
50
56
|
/* @__PURE__ */ jsx(
|
|
51
57
|
MenuPopover,
|
|
52
58
|
{
|
|
59
|
+
...props,
|
|
53
60
|
offset: 0,
|
|
54
|
-
className: "pt-2",
|
|
55
61
|
items,
|
|
56
62
|
isOpen: triggerOnHover ? isOpen : void 0,
|
|
57
63
|
isNonModal: triggerOnHover,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { MenuItem as MenuItemType } from './Menu';
|
|
2
2
|
type MenuListItemProps = MenuItemType;
|
|
3
|
-
export declare const MenuItem: ({ label, content, children, ...item }: MenuListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
-
export declare const menuItemClass: string;
|
|
3
|
+
export declare const MenuItem: ({ label, content, children, className, ...item }: MenuListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
export {};
|
|
@@ -2,15 +2,19 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { clsx } from "clsx";
|
|
3
3
|
import { MenuItem as MenuItem$1 } from "react-aria-components";
|
|
4
4
|
import { ArrowRightIcon } from "../../assets/icons/ArrowRight.js";
|
|
5
|
-
|
|
5
|
+
import { menuItemCva } from "./menu.cva.js";
|
|
6
|
+
import { UIStyle } from "../../config/uiStyle.context.js";
|
|
7
|
+
const MenuItem = ({ label, content, children, className, ...item }) => {
|
|
6
8
|
const hasSubmenu = !!children && children?.length > 0;
|
|
9
|
+
const uiStyle = UIStyle.useConfig();
|
|
10
|
+
const menuItemCva$1 = uiStyle?.menu?.itemCva ?? menuItemCva;
|
|
7
11
|
return /* @__PURE__ */ jsxs(
|
|
8
12
|
MenuItem$1,
|
|
9
13
|
{
|
|
10
14
|
...item,
|
|
11
15
|
textValue: label,
|
|
12
16
|
"aria-label": label,
|
|
13
|
-
className: clsx(
|
|
17
|
+
className: clsx(menuItemCva$1({ ...item, isMobile: false }), className),
|
|
14
18
|
children: [
|
|
15
19
|
content ?? label,
|
|
16
20
|
hasSubmenu && /* @__PURE__ */ jsx(ArrowRightIcon, { className: "size-6" })
|
|
@@ -18,17 +22,6 @@ const MenuItem = ({ label, content, children, ...item }) => {
|
|
|
18
22
|
}
|
|
19
23
|
);
|
|
20
24
|
};
|
|
21
|
-
const menuItemClass = clsx(
|
|
22
|
-
"flex cursor-pointer items-center justify-between gap-list-gap-checkbox-to-label px-list-side-item py-list-height-item",
|
|
23
|
-
"border-b border-b-elevation-outline-default-1 outline-none last:border-b-0",
|
|
24
|
-
"bg-elevation-fill-default-1 text-interactive-text-secondary-idle",
|
|
25
|
-
"disabled:cursor-default disabled:text-interactive-text-secondary-disabled",
|
|
26
|
-
"hover:bg-elevation-fill-default-1 hover:text-interactive-text-secondary-hover",
|
|
27
|
-
"open:bg-interactive-contained-primary-idle open:text-interactive-contained-primary-on-idle",
|
|
28
|
-
"open:hover:bg-interactive-contained-primary-hover open:hover:text-interactive-contained-primary-on-hover",
|
|
29
|
-
"focus-visible:bg-elevation-fill-default-1 focus-visible:text-interactive-text-secondary-hover"
|
|
30
|
-
);
|
|
31
25
|
export {
|
|
32
|
-
MenuItem
|
|
33
|
-
menuItemClass
|
|
26
|
+
MenuItem
|
|
34
27
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { MenuProps } from './Menu';
|
|
2
|
-
export declare const MenuMobile: ({ trigger, items }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const MenuMobile: ({ trigger, items, ...props }: MenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,9 +3,14 @@ import { clsx } from "clsx";
|
|
|
3
3
|
import { useRef, useState } from "react";
|
|
4
4
|
import { Button, Menu } from "react-aria-components";
|
|
5
5
|
import { ArrowLeftIcon } from "../../assets/icons/ArrowLeft.js";
|
|
6
|
-
import {
|
|
6
|
+
import { MenuItem } from "./MenuItem.js";
|
|
7
|
+
import { menuItemCva, menuCva } from "./menu.cva.js";
|
|
7
8
|
import { BottomSheet } from "../overlays/BottomSheet/BottomSheet.js";
|
|
8
|
-
|
|
9
|
+
import { UIStyle } from "../../config/uiStyle.context.js";
|
|
10
|
+
const MenuMobile = ({ trigger, items, ...props }) => {
|
|
11
|
+
const uiStyle = UIStyle.useConfig();
|
|
12
|
+
const menuItemCva$1 = uiStyle?.menu?.itemCva ?? menuItemCva;
|
|
13
|
+
const menuCva$1 = uiStyle?.menu?.cva ?? menuCva;
|
|
9
14
|
const activeItemRef = useRef(null);
|
|
10
15
|
const activeItemParentsRef = useRef([]);
|
|
11
16
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -45,7 +50,7 @@ const MenuMobile = ({ trigger, items }) => {
|
|
|
45
50
|
activeItem && /* @__PURE__ */ jsxs(
|
|
46
51
|
Button,
|
|
47
52
|
{
|
|
48
|
-
className: clsx(
|
|
53
|
+
className: clsx(menuItemCva$1({ ...props, isMobile: true })),
|
|
49
54
|
onPress: onBack,
|
|
50
55
|
children: [
|
|
51
56
|
/* @__PURE__ */ jsx(ArrowLeftIcon, { className: "size-6" }),
|
|
@@ -58,7 +63,7 @@ const MenuMobile = ({ trigger, items }) => {
|
|
|
58
63
|
{
|
|
59
64
|
autoFocus: true,
|
|
60
65
|
onClose,
|
|
61
|
-
className:
|
|
66
|
+
className: menuCva$1({ ...props, isMobile: true }),
|
|
62
67
|
children: (activeItem?.children ?? items).map((item, index) => /* @__PURE__ */ jsx(
|
|
63
68
|
MenuItem,
|
|
64
69
|
{
|
|
@@ -2,4 +2,4 @@ import { PopoverProps as AriaPopoverProps } from 'react-aria-components';
|
|
|
2
2
|
import { MenuProps } from './Menu';
|
|
3
3
|
export interface MenuPopoverProps extends Pick<MenuProps, "items">, AriaPopoverProps {
|
|
4
4
|
}
|
|
5
|
-
export declare const MenuPopover: ({ items, ...props }: MenuPopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const MenuPopover: ({ items, className, ...props }: MenuPopoverProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,13 +2,19 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { clsx } from "clsx";
|
|
3
3
|
import { Popover, Menu, SubmenuTrigger } from "react-aria-components";
|
|
4
4
|
import { MenuItem } from "./MenuItem.js";
|
|
5
|
-
|
|
5
|
+
import { menuPopoverCva, menuPopoverWrapperCva, menuCva } from "./menu.cva.js";
|
|
6
|
+
import { UIStyle } from "../../config/uiStyle.context.js";
|
|
7
|
+
const MenuPopover = ({ items, className, ...props }) => {
|
|
8
|
+
const uiStyle = UIStyle.useConfig();
|
|
9
|
+
const menuPopoverCva$1 = uiStyle?.menu?.popoverCva ?? menuPopoverCva;
|
|
10
|
+
const menuPopoverWrapperCva$1 = uiStyle?.menu?.popoverWrapperCva ?? menuPopoverWrapperCva;
|
|
11
|
+
const menuCva$1 = uiStyle?.menu?.cva ?? menuCva;
|
|
6
12
|
return /* @__PURE__ */ jsx(
|
|
7
13
|
Popover,
|
|
8
14
|
{
|
|
9
15
|
...props,
|
|
10
|
-
className: clsx(
|
|
11
|
-
children: /* @__PURE__ */ jsx("div", { className:
|
|
16
|
+
className: clsx(menuPopoverCva$1({ ...props }), className),
|
|
17
|
+
children: /* @__PURE__ */ jsx("div", { className: menuPopoverWrapperCva$1({ ...props }), children: /* @__PURE__ */ jsx(Menu, { className: menuCva$1({ ...props, isMobile: false }), children: items.map(
|
|
12
18
|
(item, index) => !item.children || item.children.length === 0 ? /* @__PURE__ */ jsx(
|
|
13
19
|
MenuItem,
|
|
14
20
|
{
|
|
@@ -23,7 +29,6 @@ const MenuPopover = ({ items, ...props }) => {
|
|
|
23
29
|
MenuPopover,
|
|
24
30
|
{
|
|
25
31
|
offset: 0,
|
|
26
|
-
className: "pl-2",
|
|
27
32
|
items: item.children
|
|
28
33
|
}
|
|
29
34
|
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const menuCva: (props?: ({
|
|
3
|
+
isMobile?: boolean | null | undefined;
|
|
4
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
5
|
+
export interface MenuCvaVariantProps extends VariantProps<typeof menuCva> {
|
|
6
|
+
}
|
|
7
|
+
export declare const menuItemCva: (props?: ({
|
|
8
|
+
isMobile?: boolean | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
+
export interface MenuItemVariantProps extends VariantProps<typeof menuItemCva> {
|
|
11
|
+
}
|
|
12
|
+
export declare const menuPopoverCva: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
13
|
+
export interface MenuPopoverVariantProps extends VariantProps<typeof menuPopoverCva> {
|
|
14
|
+
}
|
|
15
|
+
export declare const menuPopoverWrapperCva: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
16
|
+
export interface MenuPopoverWrapperVariantProps extends VariantProps<typeof menuPopoverWrapperCva> {
|
|
17
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
const menuCva = cva(["outline-none"], {
|
|
3
|
+
variants: {
|
|
4
|
+
isMobile: {
|
|
5
|
+
true: [],
|
|
6
|
+
false: []
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
defaultVariants: {
|
|
10
|
+
isMobile: false
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const menuItemCva = cva(
|
|
14
|
+
[
|
|
15
|
+
"flex cursor-pointer items-center justify-between gap-list-gap-checkbox-to-label px-list-side-item py-list-height-item",
|
|
16
|
+
"border-b border-b-elevation-outline-default-1 outline-none last:border-b-0",
|
|
17
|
+
"bg-elevation-fill-default-1 text-interactive-text-secondary-idle",
|
|
18
|
+
"disabled:cursor-default disabled:text-interactive-text-secondary-disabled",
|
|
19
|
+
"hover:bg-elevation-fill-default-1 hover:text-interactive-text-secondary-hover",
|
|
20
|
+
"open:bg-interactive-contained-primary-idle open:text-interactive-contained-primary-on-idle",
|
|
21
|
+
"open:hover:bg-interactive-contained-primary-hover open:hover:text-interactive-contained-primary-on-hover",
|
|
22
|
+
"focus-visible:bg-elevation-fill-default-1 focus-visible:text-interactive-text-secondary-hover"
|
|
23
|
+
],
|
|
24
|
+
{
|
|
25
|
+
variants: {
|
|
26
|
+
isMobile: {
|
|
27
|
+
true: ["justify-start! w-full font-labels-default"],
|
|
28
|
+
false: []
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {
|
|
32
|
+
isMobile: false
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
const menuPopoverCva = cva(["pt-2 outline-none"]);
|
|
37
|
+
const menuPopoverWrapperCva = cva([
|
|
38
|
+
"overflow-hidden rounded-list-rounding-dropdown border border-elevation-outline-default-1 shadow-5 outline-none"
|
|
39
|
+
]);
|
|
40
|
+
export {
|
|
41
|
+
menuCva,
|
|
42
|
+
menuItemCva,
|
|
43
|
+
menuPopoverCva,
|
|
44
|
+
menuPopoverWrapperCva
|
|
45
|
+
};
|