@fuf-stack/pixels 0.3.0 → 0.3.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/Menu/index.cjs +2 -2
- package/dist/Menu/index.d.cts +2 -2
- package/dist/Menu/index.d.ts +2 -2
- package/dist/Menu/index.js +1 -1
- package/dist/{Menu-D50c3gIq.d.cts → Menu-CG5mVVnv.d.cts} +2 -2
- package/dist/{Menu-D50c3gIq.d.ts → Menu-CG5mVVnv.d.ts} +2 -2
- package/dist/{chunk-DSSM3ANE.cjs → chunk-L5OZDDU7.cjs} +1 -1
- package/dist/{chunk-DSSM3ANE.cjs.map → chunk-L5OZDDU7.cjs.map} +1 -1
- package/dist/{chunk-J4OGTE6Z.js → chunk-VZW4TVTX.js} +1 -1
- package/dist/{chunk-J4OGTE6Z.js.map → chunk-VZW4TVTX.js.map} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -4
package/dist/Menu/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkL5OZDDU7cjs = require('../chunk-L5OZDDU7.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.Menu =
|
|
8
|
+
exports.Menu = _chunkL5OZDDU7cjs.Menu_default; exports.default = _chunkL5OZDDU7cjs.Menu_default2;
|
|
9
9
|
//# sourceMappingURL=index.cjs.map
|
package/dist/Menu/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Menu } from '../Menu-
|
|
2
|
-
export { a as MenuProps } from '../Menu-
|
|
1
|
+
import { M as Menu } from '../Menu-CG5mVVnv.cjs';
|
|
2
|
+
export { b as MenuItem, a as MenuProps, c as MenuSection } from '../Menu-CG5mVVnv.cjs';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
package/dist/Menu/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as Menu } from '../Menu-
|
|
2
|
-
export { a as MenuProps } from '../Menu-
|
|
1
|
+
import { M as Menu } from '../Menu-CG5mVVnv.js';
|
|
2
|
+
export { b as MenuItem, a as MenuProps, c as MenuSection } from '../Menu-CG5mVVnv.js';
|
|
3
3
|
import 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
package/dist/Menu/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode,
|
|
2
|
+
import { ReactNode, MouseEventHandler, Key } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Menu item type
|
|
@@ -52,4 +52,4 @@ interface MenuProps {
|
|
|
52
52
|
*/
|
|
53
53
|
declare const Menu: ({ children, className, onAction, testId, isDisabled, items, }: MenuProps) => react_jsx_runtime.JSX.Element;
|
|
54
54
|
|
|
55
|
-
export { Menu as M, type MenuProps as a };
|
|
55
|
+
export { Menu as M, type MenuProps as a, type MenuItem as b, type MenuSection as c };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode,
|
|
2
|
+
import { ReactNode, MouseEventHandler, Key } from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Menu item type
|
|
@@ -52,4 +52,4 @@ interface MenuProps {
|
|
|
52
52
|
*/
|
|
53
53
|
declare const Menu: ({ children, className, onAction, testId, isDisabled, items, }: MenuProps) => react_jsx_runtime.JSX.Element;
|
|
54
54
|
|
|
55
|
-
export { Menu as M, type MenuProps as a };
|
|
55
|
+
export { Menu as M, type MenuProps as a, type MenuItem as b, type MenuSection as c };
|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AmB,GACtB;AAAA,OAEJ;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;;;AC9If,IAAOA,gBAAQ","sourcesContent":["import type { DropdownSectionProps } from '@nextui-org/dropdown';\nimport type { Key, MouseEventHandler, ReactNode } from 'react';\n\nimport { FaEllipsisVertical } from 'react-icons/fa6';\n\nimport { Button } from '@nextui-org/button';\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\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 // INFO: we use next button here so that ref passing works\n <Button size=\"sm\" variant=\"flat\" 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","import Menu from './Menu';\n\nexport type { MenuProps } from './Menu';\n\nexport { Menu };\n\nexport default Menu;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/Menu/Menu.tsx","../src/Menu/index.ts"],"names":["Menu_default"],"mappings":";AAGA,SAAS,0BAA0B;AAEnC,SAAS,cAAc;AACvB;AAAA,EACE,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,OACd;AACP,OAAO,QAAQ;AACf,OAAO,iBAAiB;AAoEtB,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;AAAA;AAAA,MAGlB,oBAAC,UAAO,MAAK,MAAK,SAAQ,QAAO,WAAU,WACzC,8BAAC,sBAAmB,GACtB;AAAA,OAEJ;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;;;AC9If,IAAOA,gBAAQ","sourcesContent":["import type { DropdownSectionProps } from '@nextui-org/dropdown';\nimport type { Key, MouseEventHandler, ReactNode } from 'react';\n\nimport { FaEllipsisVertical } from 'react-icons/fa6';\n\nimport { Button } from '@nextui-org/button';\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\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 // INFO: we use next button here so that ref passing works\n <Button size=\"sm\" variant=\"flat\" 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","import Menu from './Menu';\n\nexport type { MenuProps, MenuItem, MenuSection } from './Menu';\n\nexport { Menu };\n\nexport default Menu;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Menu/Menu.tsx","../src/Menu/index.ts"],"sourcesContent":["import type { DropdownSectionProps } from '@nextui-org/dropdown';\nimport type { Key, MouseEventHandler, ReactNode } from 'react';\n\nimport { FaEllipsisVertical } from 'react-icons/fa6';\n\nimport { Button } from '@nextui-org/button';\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\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 // INFO: we use next button here so that ref passing works\n <Button size=\"sm\" variant=\"flat\" 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","import Menu from './Menu';\n\nexport type { MenuProps } from './Menu';\n\nexport { Menu };\n\nexport default Menu;\n"],"mappings":";AAGA,SAAS,0BAA0B;AAEnC,SAAS,cAAc;AACvB;AAAA,EACE,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB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AIX,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;;;AC9If,IAAOA,gBAAQ;","names":["Menu_default"]}
|
|
1
|
+
{"version":3,"sources":["../src/Menu/Menu.tsx","../src/Menu/index.ts"],"sourcesContent":["import type { DropdownSectionProps } from '@nextui-org/dropdown';\nimport type { Key, MouseEventHandler, ReactNode } from 'react';\n\nimport { FaEllipsisVertical } from 'react-icons/fa6';\n\nimport { Button } from '@nextui-org/button';\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\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 // INFO: we use next button here so that ref passing works\n <Button size=\"sm\" variant=\"flat\" 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","import Menu from './Menu';\n\nexport type { MenuProps, MenuItem, MenuSection } from './Menu';\n\nexport { Menu };\n\nexport default Menu;\n"],"mappings":";AAGA,SAAS,0BAA0B;AAEnC,SAAS,cAAc;AACvB;AAAA,EACE,YAAY;AAAA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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;;;AC9If,IAAOA,gBAAQ;","names":["Menu_default"]}
|
package/dist/index.cjs
CHANGED
|
@@ -12,7 +12,7 @@ var _chunkI76NWOB3cjs = require('./chunk-I76NWOB3.cjs');
|
|
|
12
12
|
var _chunkBMKGS5PKcjs = require('./chunk-BMKGS5PK.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkL5OZDDU7cjs = require('./chunk-L5OZDDU7.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
var _chunkSTEC6TAQcjs = require('./chunk-STEC6TAQ.cjs');
|
|
@@ -98,5 +98,5 @@ var useLocalStorage_default = useLocalStorage;
|
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
|
|
101
|
-
exports.Button = _chunkI76NWOB3cjs.Button_default; exports.Card = _chunkWTKZJFQVcjs.Card_default; exports.Json = _chunkPI7CBPUScjs.Json_default; exports.Label = _chunkBMKGS5PKcjs.Label_default; exports.Menu =
|
|
101
|
+
exports.Button = _chunkI76NWOB3cjs.Button_default; exports.Card = _chunkWTKZJFQVcjs.Card_default; exports.Json = _chunkPI7CBPUScjs.Json_default; exports.Label = _chunkBMKGS5PKcjs.Label_default; exports.Menu = _chunkL5OZDDU7cjs.Menu_default; exports.Modal = _chunkSTEC6TAQcjs.Modal_default; exports.Popover = _chunkYUOFNPJOcjs.Popover_default; exports.useDebounce = useDebounce_default; exports.useLocalStorage = useLocalStorage_default;
|
|
102
102
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ export { B as Button, a as ButtonProps } from './Button-B0H0w1eR.cjs';
|
|
|
3
3
|
export { C as Card, a as CardProps } from './Card-Cl_I4L8G.cjs';
|
|
4
4
|
export { J as Json, a as JsonProps } from './Json-ClGDcbcp.cjs';
|
|
5
5
|
export { L as Label, a as LabelProps } from './Label-DzZDW95M.cjs';
|
|
6
|
-
export { M as Menu, a as MenuProps } from './Menu-
|
|
6
|
+
export { M as Menu, b as MenuItem, a as MenuProps, c as MenuSection } from './Menu-CG5mVVnv.cjs';
|
|
7
7
|
export { M as Modal, a as ModalProps } from './Modal-CSxNe0bS.cjs';
|
|
8
8
|
export { _ as Popover, P as PopoverProps } from './Popover-DbTTk7_N.cjs';
|
|
9
9
|
export { a as TooltipProps } from './Tooltip-D0yEMBnv.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { B as Button, a as ButtonProps } from './Button-B0H0w1eR.js';
|
|
|
3
3
|
export { C as Card, a as CardProps } from './Card-Cl_I4L8G.js';
|
|
4
4
|
export { J as Json, a as JsonProps } from './Json-ClGDcbcp.js';
|
|
5
5
|
export { L as Label, a as LabelProps } from './Label-DzZDW95M.js';
|
|
6
|
-
export { M as Menu, a as MenuProps } from './Menu-
|
|
6
|
+
export { M as Menu, b as MenuItem, a as MenuProps, c as MenuSection } from './Menu-CG5mVVnv.js';
|
|
7
7
|
export { M as Modal, a as ModalProps } from './Modal-CSxNe0bS.js';
|
|
8
8
|
export { _ as Popover, P as PopoverProps } from './Popover-DbTTk7_N.js';
|
|
9
9
|
export { a as TooltipProps } from './Tooltip-D0yEMBnv.js';
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@fuf-stack/pixels",
|
|
3
3
|
"description": "fuf react component library",
|
|
4
4
|
"author": "Hannes Tiede",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.1",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"module": "./dist/index.cjs",
|
|
@@ -98,10 +98,10 @@
|
|
|
98
98
|
"@types/debug": "4.1.12",
|
|
99
99
|
"@types/react": "18.2.69",
|
|
100
100
|
"@types/react-dom": "18.2.22",
|
|
101
|
-
"@repo/tailwind-config": "0.0.1",
|
|
102
101
|
"@repo/storybook-config": "0.0.1",
|
|
103
|
-
"@repo/
|
|
104
|
-
"@repo/tsup-config": "0.0.1"
|
|
102
|
+
"@repo/tailwind-config": "0.0.1",
|
|
103
|
+
"@repo/tsup-config": "0.0.1",
|
|
104
|
+
"@repo/vite-config": "0.0.1"
|
|
105
105
|
},
|
|
106
106
|
"scripts": {
|
|
107
107
|
"build": "tsup --config node_modules/@repo/tsup-config/config.ts",
|