@fuf-stack/pixels 0.0.8 → 0.1.1
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/Button/Button.cjs +3 -1
- package/dist/Button/Button.cjs.map +1 -1
- package/dist/Button/Button.d.cts +1 -1
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/Button.js +1 -1
- package/dist/Button/index.cjs +3 -1
- package/dist/Button/index.cjs.map +1 -1
- package/dist/Button/index.js +3 -5
- package/dist/Button/index.js.map +1 -1
- package/dist/Label/Label.cjs +58 -0
- package/dist/Label/Label.cjs.map +1 -0
- package/dist/Label/Label.d.cts +24 -0
- package/dist/Label/Label.d.ts +24 -0
- package/dist/Label/Label.js +7 -0
- package/dist/Label/Label.js.map +1 -0
- package/dist/Label/index.cjs +63 -0
- package/dist/Label/index.cjs.map +1 -0
- package/dist/Label/index.d.cts +8 -0
- package/dist/Label/index.d.ts +8 -0
- package/dist/Label/index.js +10 -0
- package/dist/Label/index.js.map +1 -0
- package/dist/Menu/Menu.cjs +184 -0
- package/dist/Menu/Menu.cjs.map +1 -0
- package/dist/Menu/Menu.d.cts +55 -0
- package/dist/Menu/Menu.d.ts +55 -0
- package/dist/Menu/Menu.js +10 -0
- package/dist/Menu/Menu.js.map +1 -0
- package/dist/Menu/index.cjs +189 -0
- package/dist/Menu/index.cjs.map +1 -0
- package/dist/Menu/index.d.cts +7 -0
- package/dist/Menu/index.d.ts +7 -0
- package/dist/Menu/index.js +13 -0
- package/dist/Menu/index.js.map +1 -0
- package/dist/Modal/Modal.cjs +86 -0
- package/dist/Modal/Modal.cjs.map +1 -0
- package/dist/Modal/Modal.d.cts +29 -0
- package/dist/Modal/Modal.d.ts +29 -0
- package/dist/Modal/Modal.js +9 -0
- package/dist/Modal/Modal.js.map +1 -0
- package/dist/Modal/index.cjs +85 -0
- package/dist/Modal/index.cjs.map +1 -0
- package/dist/Modal/index.d.cts +7 -0
- package/dist/Modal/index.d.ts +7 -0
- package/dist/Modal/index.js +10 -0
- package/dist/Modal/index.js.map +1 -0
- package/dist/Popover/Popover.cjs +72 -0
- package/dist/Popover/Popover.cjs.map +1 -0
- package/dist/Popover/Popover.d.cts +31 -0
- package/dist/Popover/Popover.d.ts +31 -0
- package/dist/Popover/Popover.js +7 -0
- package/dist/Popover/Popover.js.map +1 -0
- package/dist/Popover/index.cjs +77 -0
- package/dist/Popover/index.cjs.map +1 -0
- package/dist/Popover/index.d.cts +8 -0
- package/dist/Popover/index.d.ts +8 -0
- package/dist/Popover/index.js +10 -0
- package/dist/Popover/index.js.map +1 -0
- package/dist/Tooltip/Tooltip.cjs +68 -0
- package/dist/Tooltip/Tooltip.cjs.map +1 -0
- package/dist/Tooltip/Tooltip.d.cts +27 -0
- package/dist/Tooltip/Tooltip.d.ts +27 -0
- package/dist/Tooltip/Tooltip.js +9 -0
- package/dist/Tooltip/Tooltip.js.map +1 -0
- package/dist/Tooltip/index.cjs +67 -0
- package/dist/Tooltip/index.cjs.map +1 -0
- package/dist/Tooltip/index.d.cts +7 -0
- package/dist/Tooltip/index.d.ts +7 -0
- package/dist/Tooltip/index.js +10 -0
- package/dist/Tooltip/index.js.map +1 -0
- package/dist/{chunk-ZXTDGCUF.js → chunk-6QVKZ4AT.js} +4 -2
- package/dist/{chunk-ZXTDGCUF.js.map → chunk-6QVKZ4AT.js.map} +1 -1
- package/dist/chunk-CEUL4NWH.js +28 -0
- package/dist/chunk-CEUL4NWH.js.map +1 -0
- package/dist/chunk-EYUTNORZ.js +58 -0
- package/dist/chunk-EYUTNORZ.js.map +1 -0
- package/dist/chunk-K3QI56MF.js +80 -0
- package/dist/chunk-K3QI56MF.js.map +1 -0
- package/dist/chunk-NFWS2SSN.js +11 -0
- package/dist/chunk-NFWS2SSN.js.map +1 -0
- package/dist/chunk-ONXXZTZY.js +34 -0
- package/dist/chunk-ONXXZTZY.js.map +1 -0
- package/dist/chunk-SGAWYTO7.js +42 -0
- package/dist/chunk-SGAWYTO7.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/Modal/Modal.tsx
|
|
2
|
+
import {
|
|
3
|
+
Modal as NextModal,
|
|
4
|
+
ModalBody as NextModalBody,
|
|
5
|
+
ModalContent as NextModalContent,
|
|
6
|
+
ModalFooter as NextModalFooter,
|
|
7
|
+
ModalHeader as NextModalHeader
|
|
8
|
+
} from "@nextui-org/modal";
|
|
9
|
+
import cn from "classnames";
|
|
10
|
+
import createDebug from "debug";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var debug = createDebug("component:Modal");
|
|
13
|
+
var ModalSizeOptions = ["sm", "md", "lg"];
|
|
14
|
+
var Modal = ({
|
|
15
|
+
children = null,
|
|
16
|
+
className = void 0,
|
|
17
|
+
footer = void 0,
|
|
18
|
+
isOpen,
|
|
19
|
+
onClose,
|
|
20
|
+
size = "md",
|
|
21
|
+
testId = void 0,
|
|
22
|
+
title = void 0
|
|
23
|
+
}) => {
|
|
24
|
+
debug("Modal", { size });
|
|
25
|
+
return /* @__PURE__ */ jsx("div", { className: cn(className), "data-testid": testId, children: /* @__PURE__ */ jsx(
|
|
26
|
+
NextModal,
|
|
27
|
+
{
|
|
28
|
+
backdrop: "opaque",
|
|
29
|
+
classNames: {
|
|
30
|
+
base: cn(
|
|
31
|
+
{
|
|
32
|
+
"lg:w-11/12": size === "lg",
|
|
33
|
+
"w-2/12": size === "sm",
|
|
34
|
+
"w-6/12": size === "md"
|
|
35
|
+
},
|
|
36
|
+
// overwrite !rounded-none from nextui
|
|
37
|
+
"!rounded-lg"
|
|
38
|
+
)
|
|
39
|
+
},
|
|
40
|
+
isOpen,
|
|
41
|
+
onClose,
|
|
42
|
+
scrollBehavior: "inside",
|
|
43
|
+
size: "full",
|
|
44
|
+
children: /* @__PURE__ */ jsx(NextModalContent, { "data-testid": testId ? `${testId}_modal` : "modal", children: () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
|
+
title && /* @__PURE__ */ jsx(NextModalHeader, { children: title }),
|
|
46
|
+
/* @__PURE__ */ jsx(NextModalBody, { className: "bg-ex-background", children }),
|
|
47
|
+
footer && /* @__PURE__ */ jsx(NextModalFooter, { children: footer })
|
|
48
|
+
] }) })
|
|
49
|
+
}
|
|
50
|
+
) });
|
|
51
|
+
};
|
|
52
|
+
var Modal_default = Modal;
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
ModalSizeOptions,
|
|
56
|
+
Modal_default
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=chunk-EYUTNORZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Modal/Modal.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {\n Modal as NextModal,\n ModalBody as NextModalBody,\n ModalContent as NextModalContent,\n ModalFooter as NextModalFooter,\n ModalHeader as NextModalHeader,\n} from '@nextui-org/modal';\nimport cn from 'classnames';\nimport createDebug from 'debug';\n\nconst debug = createDebug('component:Modal');\n\nexport const ModalSizeOptions = ['sm', 'md', 'lg'] as const;\ntype ModalSize = (typeof ModalSizeOptions)[number];\n\nexport interface ModalProps {\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string | string[];\n /** HTML data-testid attribute used in e2e tests */\n footer?: ReactNode;\n /** open state (controlled) */\n isOpen: boolean;\n /** close event handler */\n onClose: () => void;\n /** modal size */\n size?: ModalSize;\n /** e2e test id */\n testId?: string;\n /** modal header */\n title?: ReactNode;\n}\n\n/**\n * Modal component based on [NextUI Modal](https://nextui.org/docs/components/modal)\n */\nconst Modal = ({\n children = null,\n className = undefined,\n footer = undefined,\n isOpen,\n onClose,\n size = 'md',\n testId = undefined,\n title = undefined,\n}: ModalProps) => {\n debug('Modal', { size });\n return (\n <div className={cn(className)} data-testid={testId}>\n <NextModal\n backdrop=\"opaque\"\n classNames={{\n base: cn(\n {\n 'lg:w-11/12': size === 'lg',\n 'w-2/12': size === 'sm',\n 'w-6/12': size === 'md',\n },\n // overwrite !rounded-none from nextui\n '!rounded-lg',\n ),\n }}\n isOpen={isOpen}\n onClose={onClose}\n scrollBehavior=\"inside\"\n size=\"full\"\n >\n <NextModalContent data-testid={testId ? `${testId}_modal` : 'modal'}>\n {() => (\n <>\n {title && <NextModalHeader>{title}</NextModalHeader>}\n <NextModalBody className=\"bg-ex-background\">\n {children}\n </NextModalBody>\n {footer && <NextModalFooter>{footer}</NextModalFooter>}\n </>\n )}\n </NextModalContent>\n </NextModal>\n </div>\n );\n};\n\nexport default Modal;\n"],"mappings":";AAEA;AAAA,EACE,SAAS;AAAA,EACT,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,eAAe;AAAA,OACV;AACP,OAAO,QAAQ;AACf,OAAO,iBAAiB;AA8DZ,mBACY,KADZ;AA5DZ,IAAM,QAAQ,YAAY,iBAAiB;AAEpC,IAAM,mBAAmB,CAAC,MAAM,MAAM,IAAI;AAyBjD,IAAM,QAAQ,CAAC;AAAA,EACb,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ;AACV,MAAkB;AAChB,QAAM,SAAS,EAAE,KAAK,CAAC;AACvB,SACE,oBAAC,SAAI,WAAW,GAAG,SAAS,GAAG,eAAa,QAC1C;AAAA,IAAC;AAAA;AAAA,MACC,UAAS;AAAA,MACT,YAAY;AAAA,QACV,MAAM;AAAA,UACJ;AAAA,YACE,cAAc,SAAS;AAAA,YACvB,UAAU,SAAS;AAAA,YACnB,UAAU,SAAS;AAAA,UACrB;AAAA;AAAA,UAEA;AAAA,QACF;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,MACA,gBAAe;AAAA,MACf,MAAK;AAAA,MAEL,8BAAC,oBAAiB,eAAa,SAAS,GAAG,MAAM,WAAW,SACzD,gBACC,iCACG;AAAA,iBAAS,oBAAC,mBAAiB,iBAAM;AAAA,QAClC,oBAAC,iBAAc,WAAU,oBACtB,UACH;AAAA,QACC,UAAU,oBAAC,mBAAiB,kBAAO;AAAA,SACtC,GAEJ;AAAA;AAAA,EACF,GACF;AAEJ;AAEA,IAAO,gBAAQ;","names":[]}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Button_default
|
|
3
|
+
} from "./chunk-NFWS2SSN.js";
|
|
4
|
+
|
|
5
|
+
// src/Menu/Menu.tsx
|
|
6
|
+
import { FaEllipsisVertical } from "react-icons/fa6";
|
|
7
|
+
import {
|
|
8
|
+
Dropdown as NextDropdown,
|
|
9
|
+
DropdownItem as NextDropdownItem,
|
|
10
|
+
DropdownMenu as NextDropdownMenu,
|
|
11
|
+
DropdownSection as NextDropdownSection,
|
|
12
|
+
DropdownTrigger as NextDropdownTrigger
|
|
13
|
+
} from "@nextui-org/dropdown";
|
|
14
|
+
import cn from "classnames";
|
|
15
|
+
import createDebug from "debug";
|
|
16
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
var debug = createDebug("component:Menu");
|
|
18
|
+
var getDisabledKeys = (items) => {
|
|
19
|
+
return items.map((item) => typeof item?.items === "undefined" ? item : item.items).flat().filter((item) => {
|
|
20
|
+
return Object.hasOwn(item, "disabled") && item.disabled === true;
|
|
21
|
+
}).map((item) => item.key);
|
|
22
|
+
};
|
|
23
|
+
var renderMenuItem = (item) => /* @__PURE__ */ jsx(
|
|
24
|
+
NextDropdownItem,
|
|
25
|
+
{
|
|
26
|
+
className: item.className,
|
|
27
|
+
"data-testid": item.testId || item.key,
|
|
28
|
+
description: item.description,
|
|
29
|
+
onClick: item.onClick,
|
|
30
|
+
startContent: item.icon,
|
|
31
|
+
children: item.label
|
|
32
|
+
},
|
|
33
|
+
item.key
|
|
34
|
+
);
|
|
35
|
+
var Menu = ({
|
|
36
|
+
children = null,
|
|
37
|
+
className = void 0,
|
|
38
|
+
onAction = void 0,
|
|
39
|
+
testId = void 0,
|
|
40
|
+
isDisabled = false,
|
|
41
|
+
items
|
|
42
|
+
}) => {
|
|
43
|
+
debug("Menu", { items });
|
|
44
|
+
return /* @__PURE__ */ jsxs(NextDropdown, { isDisabled, children: [
|
|
45
|
+
/* @__PURE__ */ jsx(NextDropdownTrigger, { className: cn(className), "data-testid": testId, children: children ? (
|
|
46
|
+
// eslint-disable-next-line react/button-has-type
|
|
47
|
+
/* @__PURE__ */ jsx("button", { children })
|
|
48
|
+
) : /* @__PURE__ */ jsx(Button_default, { size: "sm", variant: "bordered", className: "min-w-0", children: /* @__PURE__ */ jsx(FaEllipsisVertical, {}) }) }),
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
NextDropdownMenu,
|
|
51
|
+
{
|
|
52
|
+
items,
|
|
53
|
+
disabledKeys: getDisabledKeys(items),
|
|
54
|
+
onAction,
|
|
55
|
+
children: (item) => {
|
|
56
|
+
if ("items" in item) {
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
NextDropdownSection,
|
|
59
|
+
{
|
|
60
|
+
items: item.items,
|
|
61
|
+
title: item.label,
|
|
62
|
+
children: (sectionItem) => {
|
|
63
|
+
return renderMenuItem(sectionItem);
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
item.key
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return renderMenuItem(item);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] });
|
|
74
|
+
};
|
|
75
|
+
var Menu_default = Menu;
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
Menu_default
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=chunk-K3QI56MF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Menu/Menu.tsx"],"sourcesContent":["import type { DropdownSectionProps } from '@nextui-org/dropdown';\nimport type { Key, MouseEventHandler, ReactNode } from 'react';\n\nimport { FaEllipsisVertical } from 'react-icons/fa6';\n\nimport {\n Dropdown as NextDropdown,\n DropdownItem as NextDropdownItem,\n DropdownMenu as NextDropdownMenu,\n DropdownSection as NextDropdownSection,\n DropdownTrigger as NextDropdownTrigger,\n} from '@nextui-org/dropdown';\nimport cn from 'classnames';\nimport createDebug from 'debug';\n\nimport Button from '../Button';\n\nconst debug = createDebug('component:Menu');\n\n/**\n * Menu item type\n */\nexport interface MenuItem {\n /** unique identifier */\n key: string;\n /** CSS class name */\n className?: string;\n /** additional description shown under the label */\n description?: string;\n /** disables the menu item */\n disabled?: boolean;\n /** menu item icon */\n icon?: ReactNode;\n /** menu item name */\n label: ReactNode;\n /** click event handler */\n onClick?: MouseEventHandler<HTMLLIElement>;\n /** e2e test identifier */\n testId?: string;\n}\n\n/**\n * Menu section type\n */\nexport interface MenuSection {\n /** unique identifier */\n key: string;\n /** section label */\n label: ReactNode;\n /** section items (array of MenuItem) */\n items: MenuItem[];\n}\n\nexport interface MenuProps {\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string | string[];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** menu item structure */\n items: (MenuSection | MenuItem)[];\n /** disable menu trigger */\n isDisabled?: boolean;\n /** called if item is selected */\n onAction?: (key: Key) => void;\n}\n\n/** returns String[] of disabled items/keys */\nconst getDisabledKeys = (items: (MenuSection | MenuItem)[]) => {\n return (\n items\n // @ts-expect-error typing issue with MenuSection | MenuItem\n .map((item) => (typeof item?.items === 'undefined' ? item : item.items))\n .flat<MenuItem[]>()\n .filter((item) => {\n return Object.hasOwn(item, 'disabled') && item.disabled === true;\n })\n .map((item) => item.key)\n );\n};\n\nconst renderMenuItem = (item: MenuItem) => (\n <NextDropdownItem\n className={item.className}\n data-testid={item.testId || item.key}\n description={item.description}\n key={item.key}\n onClick={item.onClick}\n startContent={item.icon}\n >\n {item.label}\n </NextDropdownItem>\n);\n\n/**\n * Dropdown menu component based on [NextUI Dropdown](https://nextui.org/docs/components/dropdown)\n */\nconst Menu = ({\n children = null,\n className = undefined,\n onAction = undefined,\n testId = undefined,\n isDisabled = false,\n items,\n}: MenuProps) => {\n debug('Menu', { items });\n\n return (\n <NextDropdown isDisabled={isDisabled}>\n <NextDropdownTrigger className={cn(className)} data-testid={testId}>\n {children ? (\n // eslint-disable-next-line react/button-has-type\n <button>{children}</button>\n ) : (\n <Button size=\"sm\" variant=\"bordered\" className=\"min-w-0\">\n <FaEllipsisVertical />\n </Button>\n )}\n </NextDropdownTrigger>\n <NextDropdownMenu\n // aria-label=\"Dynamic Actions\"\n items={items}\n disabledKeys={getDisabledKeys(items)}\n onAction={onAction}\n >\n {(item) => {\n if ('items' in item) {\n return (\n <NextDropdownSection\n items={item.items as MenuSection['items']}\n title={item.label as DropdownSectionProps['title']}\n key={item.key}\n >\n {/* @ts-expect-error ts problem here with render fn */}\n {(sectionItem) => {\n return renderMenuItem(sectionItem);\n }}\n </NextDropdownSection>\n );\n }\n return renderMenuItem(item);\n }}\n </NextDropdownMenu>\n </NextDropdown>\n );\n};\n\nexport default Menu;\n"],"mappings":";;;;;AAGA,SAAS,0BAA0B;AAEnC;AAAA,EACE,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,OACd;AACP,OAAO,QAAQ;AACf,OAAO,iBAAiB;AAsEtB,cA0BE,YA1BF;AAlEF,IAAM,QAAQ,YAAY,gBAAgB;AAoD1C,IAAM,kBAAkB,CAAC,UAAsC;AAC7D,SACE,MAEG,IAAI,CAAC,SAAU,OAAO,MAAM,UAAU,cAAc,OAAO,KAAK,KAAM,EACtE,KAAiB,EACjB,OAAO,CAAC,SAAS;AAChB,WAAO,OAAO,OAAO,MAAM,UAAU,KAAK,KAAK,aAAa;AAAA,EAC9D,CAAC,EACA,IAAI,CAAC,SAAS,KAAK,GAAG;AAE7B;AAEA,IAAM,iBAAiB,CAAC,SACtB;AAAA,EAAC;AAAA;AAAA,IACC,WAAW,KAAK;AAAA,IAChB,eAAa,KAAK,UAAU,KAAK;AAAA,IACjC,aAAa,KAAK;AAAA,IAElB,SAAS,KAAK;AAAA,IACd,cAAc,KAAK;AAAA,IAElB,eAAK;AAAA;AAAA,EAJD,KAAK;AAKZ;AAMF,IAAM,OAAO,CAAC;AAAA,EACZ,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,aAAa;AAAA,EACb;AACF,MAAiB;AACf,QAAM,QAAQ,EAAE,MAAM,CAAC;AAEvB,SACE,qBAAC,gBAAa,YACZ;AAAA,wBAAC,uBAAoB,WAAW,GAAG,SAAS,GAAG,eAAa,QACzD;AAAA;AAAA,MAEC,oBAAC,YAAQ,UAAS;AAAA,QAElB,oBAAC,kBAAO,MAAK,MAAK,SAAQ,YAAW,WAAU,WAC7C,8BAAC,sBAAmB,GACtB,GAEJ;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QAEC;AAAA,QACA,cAAc,gBAAgB,KAAK;AAAA,QACnC;AAAA,QAEC,WAAC,SAAS;AACT,cAAI,WAAW,MAAM;AACnB,mBACE;AAAA,cAAC;AAAA;AAAA,gBACC,OAAO,KAAK;AAAA,gBACZ,OAAO,KAAK;AAAA,gBAIX,WAAC,gBAAgB;AAChB,yBAAO,eAAe,WAAW;AAAA,gBACnC;AAAA;AAAA,cALK,KAAK;AAAA,YAMZ;AAAA,UAEJ;AACA,iBAAO,eAAe,IAAI;AAAA,QAC5B;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAEA,IAAO,eAAQ;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Button/index.ts"],"sourcesContent":["import type { ButtonProps } from './Button';\n\nimport Button from './Button';\n\nexport default Button;\n\nexport type { ButtonProps };\n"],"mappings":";;;;;AAIA,IAAOA,kBAAQ;","names":["Button_default"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/Tooltip/Tooltip.tsx
|
|
2
|
+
import { Tooltip as NextTooltip } from "@nextui-org/tooltip";
|
|
3
|
+
import cn from "classnames";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var PlacementOptions = ["top", "bottom", "left", "right"];
|
|
6
|
+
var Tooltip = ({
|
|
7
|
+
children,
|
|
8
|
+
className = void 0,
|
|
9
|
+
content,
|
|
10
|
+
placement = "top",
|
|
11
|
+
defaultOpen = false,
|
|
12
|
+
onOpenChange = void 0,
|
|
13
|
+
containerPadding = 0
|
|
14
|
+
}) => /* @__PURE__ */ jsx(
|
|
15
|
+
NextTooltip,
|
|
16
|
+
{
|
|
17
|
+
className: cn(className),
|
|
18
|
+
containerPadding,
|
|
19
|
+
content,
|
|
20
|
+
defaultOpen,
|
|
21
|
+
onOpenChange,
|
|
22
|
+
placement,
|
|
23
|
+
shouldFlip: true,
|
|
24
|
+
showArrow: true,
|
|
25
|
+
children: /* @__PURE__ */ jsx("span", { className: "cursor-pointer", children })
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
var Tooltip_default = Tooltip;
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
PlacementOptions,
|
|
32
|
+
Tooltip_default
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=chunk-ONXXZTZY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Tooltip/Tooltip.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Tooltip as NextTooltip } from '@nextui-org/tooltip';\nimport cn from 'classnames';\n\nexport const PlacementOptions = ['top', 'bottom', 'left', 'right'] as const;\nexport type Placement = (typeof PlacementOptions)[number];\n\nexport interface TooltipProps {\n /** trigger child components */\n children: ReactNode;\n /** CSS class name */\n className?: string;\n /** placement padding in px */\n containerPadding?: number;\n /** content displayed in the tooltip */\n content: ReactNode;\n /** open overlay initially when uncontrolled */\n defaultOpen?: boolean;\n /** handler that is called when the overlay's open state changes */\n onOpenChange?: (isOpen: boolean) => void;\n /** placement if the tooltip */\n placement?: Placement;\n}\n\n/**\n * Tooltip component based on [NextUI Tooltip](https://nextui.org/docs/components/tooltip)\n */\nconst Tooltip = ({\n children,\n className = undefined,\n content,\n placement = 'top',\n defaultOpen = false,\n onOpenChange = undefined,\n containerPadding = 0,\n}: TooltipProps) => (\n <NextTooltip\n className={cn(className)}\n containerPadding={containerPadding}\n content={content}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n placement={placement}\n shouldFlip\n showArrow\n >\n <span className=\"cursor-pointer\">{children}</span>\n </NextTooltip>\n);\n\nexport default Tooltip;\n"],"mappings":";AAEA,SAAS,WAAW,mBAAmB;AACvC,OAAO,QAAQ;AA4CX;AA1CG,IAAM,mBAAmB,CAAC,OAAO,UAAU,QAAQ,OAAO;AAuBjE,IAAM,UAAU,CAAC;AAAA,EACf;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,eAAe;AAAA,EACf,mBAAmB;AACrB,MACE;AAAA,EAAC;AAAA;AAAA,IACC,WAAW,GAAG,SAAS;AAAA,IACvB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAU;AAAA,IACV,WAAS;AAAA,IAET,8BAAC,UAAK,WAAU,kBAAkB,UAAS;AAAA;AAC7C;AAGF,IAAO,kBAAQ;","names":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// src/Popover/Popover.tsx
|
|
2
|
+
import { Popover, PopoverContent, PopoverTrigger } from "@nextui-org/popover";
|
|
3
|
+
import cn from "classnames";
|
|
4
|
+
import createDebug from "debug";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
var debug = createDebug("component:Popover");
|
|
7
|
+
var Popover_default = ({
|
|
8
|
+
children = null,
|
|
9
|
+
className = void 0,
|
|
10
|
+
content,
|
|
11
|
+
contentTestId = void 0,
|
|
12
|
+
placement = "top",
|
|
13
|
+
openControlled = void 0,
|
|
14
|
+
testId = void 0,
|
|
15
|
+
title = void 0
|
|
16
|
+
}) => {
|
|
17
|
+
debug("Popover");
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
Popover,
|
|
20
|
+
{
|
|
21
|
+
placement,
|
|
22
|
+
radius: "sm",
|
|
23
|
+
showArrow: true,
|
|
24
|
+
...openControlled ? { isOpen: openControlled.open, onOpenChange: openControlled.setOpen } : {},
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { className: cn(className), "data-testid": testId, children: /* @__PURE__ */ jsx("button", { children }) }),
|
|
27
|
+
/* @__PURE__ */ jsx(PopoverContent, { "data-testid": contentTestId, children: /* @__PURE__ */ jsxs("div", { className: "max-h-[80vh] overflow-y-auto", children: [
|
|
28
|
+
title && /* @__PURE__ */ jsxs("div", { children: [
|
|
29
|
+
title,
|
|
30
|
+
/* @__PURE__ */ jsx("hr", {})
|
|
31
|
+
] }),
|
|
32
|
+
content
|
|
33
|
+
] }) })
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
Popover_default
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=chunk-SGAWYTO7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Popover/Popover.tsx"],"sourcesContent":["import type { PopoverProps as NextPopoverProps } from '@nextui-org/popover';\nimport type { ReactNode } from 'react';\n\nimport { Popover, PopoverContent, PopoverTrigger } from '@nextui-org/popover';\nimport cn from 'classnames';\nimport createDebug from 'debug';\n\nconst debug = createDebug('component:Popover');\n\nexport interface PopoverProps {\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string | string[];\n /** content of the popover */\n content: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n contentTestId?: string;\n /** placement of the popover relative to its trigger reference */\n placement?: NextPopoverProps['placement'];\n /** use as controlled component */\n openControlled?: { open: boolean; setOpen: (open: boolean) => void };\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** popover title */\n title?: ReactNode;\n}\n\n/**\n * Popover component based on [NextUI Card](https://nextui.org/docs/components/popover)\n */\nexport default ({\n children = null,\n className = undefined,\n content,\n contentTestId = undefined,\n placement = 'top',\n openControlled = undefined,\n testId = undefined,\n title = undefined,\n}: PopoverProps) => {\n debug('Popover');\n\n return (\n <Popover\n placement={placement}\n radius=\"sm\"\n showArrow\n {...(openControlled\n ? { isOpen: openControlled.open, onOpenChange: openControlled.setOpen }\n : {})}\n >\n <PopoverTrigger className={cn(className)} data-testid={testId}>\n {/* NOTE: type and aria properties are injected by PopoverTrigger */}\n {/* eslint-disable-next-line react/button-has-type */}\n <button>{children}</button>\n </PopoverTrigger>\n <PopoverContent data-testid={contentTestId}>\n <div className=\"max-h-[80vh] overflow-y-auto\">\n {title && (\n <div>\n {title}\n <hr />\n </div>\n )}\n {content}\n </div>\n </PopoverContent>\n </Popover>\n );\n};\n"],"mappings":";AAGA,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,OAAO,QAAQ;AACf,OAAO,iBAAiB;AAkDhB,cAKI,YALJ;AAhDR,IAAM,QAAQ,YAAY,mBAAmB;AAwB7C,IAAO,kBAAQ,CAAC;AAAA,EACd,WAAW;AAAA,EACX,YAAY;AAAA,EACZ;AAAA,EACA,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,QAAQ;AACV,MAAoB;AAClB,QAAM,SAAS;AAEf,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,QAAO;AAAA,MACP,WAAS;AAAA,MACR,GAAI,iBACD,EAAE,QAAQ,eAAe,MAAM,cAAc,eAAe,QAAQ,IACpE,CAAC;AAAA,MAEL;AAAA,4BAAC,kBAAe,WAAW,GAAG,SAAS,GAAG,eAAa,QAGrD,8BAAC,YAAQ,UAAS,GACpB;AAAA,QACA,oBAAC,kBAAe,eAAa,eAC3B,+BAAC,SAAI,WAAU,gCACZ;AAAA,mBACC,qBAAC,SACE;AAAA;AAAA,YACD,oBAAC,QAAG;AAAA,aACN;AAAA,UAED;AAAA,WACH,GACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|