@k8slens/lds 0.55.13 → 0.57.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 (65) hide show
  1. package/lib/cjs/Avatar/Avatar.d.ts +2 -2
  2. package/lib/cjs/Badge/Badge.d.ts +2 -2
  3. package/lib/cjs/ButtonBar/ButtonBar.d.ts +1 -1
  4. package/lib/cjs/Checkbox/Checkbox.d.ts +1 -1
  5. package/lib/cjs/ConfirmDialog/ConfirmDialog.d.ts +3 -3
  6. package/lib/cjs/Modal/Modal.d.ts +1 -1
  7. package/lib/cjs/Modal/Modal.js +1 -1
  8. package/lib/cjs/NumberBadge/NumberBadge.d.ts +2 -2
  9. package/lib/cjs/Panel/Panel.d.ts +1 -1
  10. package/lib/cjs/ProfileBlock/ProfileBlock.d.ts +2 -2
  11. package/lib/cjs/ProgressBar/ProgressBar.d.ts +1 -1
  12. package/lib/cjs/RadioCard/RadioCard.d.ts +2 -2
  13. package/lib/cjs/RadioCard/RadioCard.js +1 -1
  14. package/lib/cjs/Select/Option.d.ts +2 -2
  15. package/lib/cjs/Select/Option.js +1 -1
  16. package/lib/cjs/Select/Select.d.ts +1 -1
  17. package/lib/cjs/Select/Select.js +1 -1
  18. package/lib/cjs/Select/SelectDropdown.d.ts +2 -2
  19. package/lib/cjs/Select/SelectDropdown.js +1 -1
  20. package/lib/cjs/SideNav/SideNavGroup.d.ts +1 -1
  21. package/lib/cjs/SideNav/SideNavItem.d.ts +1 -1
  22. package/lib/cjs/Switch/Switch.d.ts +2 -1
  23. package/lib/cjs/Tooltip/Tooltip.d.ts +2 -2
  24. package/lib/cjs/UserMenu/DefaultHeader.d.ts +1 -1
  25. package/lib/cjs/UserMenu/UserMenu.d.ts +1 -1
  26. package/lib/cjs/UserMenu/UserMenu.js +1 -1
  27. package/lib/cjs/UserMenu/UserMenuDropdown.d.ts +2 -2
  28. package/lib/cjs/UserMenu/UserMenuDropdown.js +1 -1
  29. package/lib/cjs/UserMenu/UserMenuItem.d.ts +2 -1
  30. package/lib/cjs/UserMenu/UserMenuItem.js +1 -1
  31. package/lib/es/Avatar/Avatar.d.ts +2 -2
  32. package/lib/es/Badge/Badge.d.ts +2 -2
  33. package/lib/es/ButtonBar/ButtonBar.d.ts +1 -1
  34. package/lib/es/Checkbox/Checkbox.d.ts +1 -1
  35. package/lib/es/ConfirmDialog/ConfirmDialog.d.ts +3 -3
  36. package/lib/es/Modal/Modal.d.ts +1 -1
  37. package/lib/es/Modal/Modal.js +1 -1
  38. package/lib/es/NumberBadge/NumberBadge.d.ts +2 -2
  39. package/lib/es/Panel/Panel.d.ts +1 -1
  40. package/lib/es/ProfileBlock/ProfileBlock.d.ts +2 -2
  41. package/lib/es/ProgressBar/ProgressBar.d.ts +1 -1
  42. package/lib/es/RadioCard/RadioCard.d.ts +2 -2
  43. package/lib/es/RadioCard/RadioCard.js +1 -1
  44. package/lib/es/Select/Option.d.ts +2 -2
  45. package/lib/es/Select/Option.js +1 -1
  46. package/lib/es/Select/Select.d.ts +1 -1
  47. package/lib/es/Select/Select.js +1 -1
  48. package/lib/es/Select/SelectDropdown.d.ts +2 -2
  49. package/lib/es/Select/SelectDropdown.js +1 -1
  50. package/lib/es/SideNav/SideNavGroup.d.ts +1 -1
  51. package/lib/es/SideNav/SideNavItem.d.ts +1 -1
  52. package/lib/es/Switch/Switch.d.ts +2 -1
  53. package/lib/es/Tooltip/Tooltip.d.ts +2 -2
  54. package/lib/es/UserMenu/DefaultHeader.d.ts +1 -1
  55. package/lib/es/UserMenu/UserMenu.d.ts +1 -1
  56. package/lib/es/UserMenu/UserMenu.js +1 -1
  57. package/lib/es/UserMenu/UserMenuDropdown.d.ts +2 -2
  58. package/lib/es/UserMenu/UserMenuDropdown.js +1 -1
  59. package/lib/es/UserMenu/UserMenuItem.d.ts +2 -1
  60. package/lib/es/UserMenu/UserMenuItem.js +1 -1
  61. package/lib/web/lds-v0-56-0/index.js +28 -0
  62. package/package.json +9 -6
  63. package/lib/web/lds-v0-55-12/index.js +0 -19
  64. /package/lib/web/{lds-v0-55-12 → lds-v0-56-0}/index.css +0 -0
  65. /package/lib/web/{lds-v0-55-12 → lds-v0-56-0}/typography.css +0 -0
@@ -1,4 +1,4 @@
1
- import { PropsWithChildren, RefObject } from "react";
1
+ import React, { PropsWithChildren, RefObject } from "react";
2
2
  export interface SelectDropdownProps {
3
3
  /**
4
4
  * Ref to the button that opens the dropdown
@@ -26,4 +26,4 @@ export interface SelectDropdownProps {
26
26
  /**
27
27
  * SelectDropdown is a component that displays a dropdown menu of links. Uses Popper.js for positioning.
28
28
  */
29
- export default function SelectDropdown({ buttonRef, listRef, openingDirection, maxHeight, children, grouped, }: PropsWithChildren<SelectDropdownProps>): JSX.Element;
29
+ export default function SelectDropdown({ buttonRef, listRef, openingDirection, maxHeight, children, grouped, }: PropsWithChildren<SelectDropdownProps>): React.JSX.Element;
@@ -1 +1 @@
1
- import t,{useCallback as e,useEffect as n,Fragment as r}from"react";import{Transition as o}from"@headlessui/react";import{SpacingMd as a}from"../node_modules/@k8slens/lds-tokens/lib/web/tokens.base.js";import{convertRemToPixels as i,getScrollableContainer as u}from"../helpers.js";var c=i(a)||0;function l(a){var i=a.buttonRef,l=a.listRef,d=a.openingDirection,s=void 0===d?"auto":d,m=a.maxHeight,v=a.children,p=a.grouped,g=e((function(){var t;if((null==l?void 0:l.current)&&i.current&&null===l.current.getAttribute("data-placement")){var e=u(i.current),n=window.getComputedStyle(e),r=parseFloat(n.paddingTop),o=parseFloat(n.paddingBottom),a=i.current.getBoundingClientRect().height||0,d=i.current.getBoundingClientRect().width||0,v=(e.getBoundingClientRect().height||0)-r-o,p=e.getBoundingClientRect().top||0,g=(i.current.getBoundingClientRect().top||0)-p||p,f=g,b=v-g-a,h=(null===(t=l.current)||void 0===t?void 0:t.getBoundingClientRect().height)||0;if("auto"===s?"above"===(!(b>=h)&&f>1.5*b?"above":"below"):"above"===s){var y=f-c;l.current.setAttribute("data-placement","top"),l.current.style.top="auto",l.current.style.bottom="".concat(a,"px"),l.current.style.maxHeight="".concat(void 0!==m?Math.min(m,y):y,"px")}else{var x=b-c;l.current.setAttribute("data-placement","bottom"),l.current.style.bottom="auto",l.current.style.top="".concat(a,"px"),l.current.style.maxHeight="".concat(void 0!==m?Math.min(m,x):x,"px")}l.current.style.maxWidth="".concat(d,"px")}}),[i,l,s,m]);n((function(){var t,e=l.current;if(e){var n=new MutationObserver((function(){var t;null===(t=null==l?void 0:l.current)||void 0===t||t.removeAttribute("data-placement"),g()}));return n.observe(e,{childList:!0,subtree:null!=p&&p}),null===(t=null==l?void 0:l.current)||void 0===t||t.removeAttribute("data-placement"),g(),function(){n.disconnect()}}}),[p,l,null==l?void 0:l.current,g]);return t.createElement(o,{as:r,beforeEnter:function(){g()},afterLeave:function(){var t;null===(t=null==l?void 0:l.current)||void 0===t||t.removeAttribute("data-placement")},enter:"transition duration-75 ease-in-out",enterFrom:"transform scale-95 opacity-0",enterTo:"transform scale-100 opacity-100",leave:"transition duration-100 ease-in-out",leaveFrom:"transform scale-100 opacity-100",leaveTo:"transform scale-95 opacity-0"},v)}export{l as default};
1
+ import t,{useCallback as e,useEffect as n}from"react";import{Transition as r}from"@headlessui/react";import{SpacingMd as o}from"../node_modules/@k8slens/lds-tokens/lib/web/tokens.base.js";import{convertRemToPixels as a,getScrollableContainer as i}from"../helpers.js";var u=a(o)||0;function c(o){var a=o.buttonRef,c=o.listRef,l=o.openingDirection,d=void 0===l?"auto":l,s=o.maxHeight,m=o.children,v=o.grouped,p=e((function(){var t;if((null==c?void 0:c.current)&&a.current&&null===c.current.getAttribute("data-placement")){var e=i(a.current),n=window.getComputedStyle(e),r=parseFloat(n.paddingTop),o=parseFloat(n.paddingBottom),l=a.current.getBoundingClientRect().height||0,m=a.current.getBoundingClientRect().width||0,v=(e.getBoundingClientRect().height||0)-r-o,p=e.getBoundingClientRect().top||0,g=(a.current.getBoundingClientRect().top||0)-p||p,f=g,b=v-g-l,h=(null===(t=c.current)||void 0===t?void 0:t.getBoundingClientRect().height)||0;if("auto"===d?"above"===(!(b>=h)&&f>1.5*b?"above":"below"):"above"===d){var y=f-u;c.current.setAttribute("data-placement","top"),c.current.style.top="auto",c.current.style.bottom="".concat(l,"px"),c.current.style.maxHeight="".concat(void 0!==s?Math.min(s,y):y,"px")}else{var x=b-u;c.current.setAttribute("data-placement","bottom"),c.current.style.bottom="auto",c.current.style.top="".concat(l,"px"),c.current.style.maxHeight="".concat(void 0!==s?Math.min(s,x):x,"px")}c.current.style.maxWidth="".concat(m,"px")}}),[a,c,d,s]);n((function(){var t,e=c.current;if(e){var n=new MutationObserver((function(){var t;null===(t=null==c?void 0:c.current)||void 0===t||t.removeAttribute("data-placement"),p()}));return n.observe(e,{childList:!0,subtree:null!=v&&v}),null===(t=null==c?void 0:c.current)||void 0===t||t.removeAttribute("data-placement"),p(),function(){n.disconnect()}}}),[v,c,null==c?void 0:c.current,p]);return t.createElement(r,{beforeEnter:function(){p()},afterLeave:function(){var t;null===(t=null==c?void 0:c.current)||void 0===t||t.removeAttribute("data-placement")},enter:"transition duration-75 ease-in-out",enterFrom:"transform scale-95 opacity-0",enterTo:"transform scale-100 opacity-100",leave:"transition duration-100 ease-in-out",leaveFrom:"transform scale-100 opacity-100",leaveTo:"transform scale-95 opacity-0"},m)}export{c as default};
@@ -31,7 +31,7 @@ export interface SideNavGroupPropsWithoutLabel<Component extends React.ElementTy
31
31
  * import { SideNavGroup } from @k8slens/lds
32
32
  * ```
33
33
  */
34
- declare function SideNavGroup<C extends keyof JSX.IntrinsicElements | React.ElementType = "nav">({ component, componentProps, id, className, children, ...props }: SideNavGroupPropsWithLabel<C> | SideNavGroupPropsWithoutLabel<C>): JSX.Element;
34
+ declare function SideNavGroup<C extends keyof JSX.IntrinsicElements | React.ElementType = "nav">({ component, componentProps, id, className, children, ...props }: SideNavGroupPropsWithLabel<C> | SideNavGroupPropsWithoutLabel<C>): React.JSX.Element;
35
35
  declare namespace SideNavGroup {
36
36
  var displayName: string;
37
37
  }
@@ -27,7 +27,7 @@ export interface SideNavItemProps<Component extends React.ElementType | keyof JS
27
27
  * import { SideNavItem } from @k8slens/lds
28
28
  * ```
29
29
  */
30
- declare function SideNavItem<C extends keyof JSX.IntrinsicElements | React.ElementType = "a">({ component, componentProps, active, disabled, className, children, type, externalLink, ...props }: SideNavItemProps<C>): JSX.Element;
30
+ declare function SideNavItem<C extends keyof JSX.IntrinsicElements | React.ElementType = "a">({ component, componentProps, active, disabled, className, children, type, externalLink, ...props }: SideNavItemProps<C>): React.JSX.Element;
31
31
  declare namespace SideNavItem {
32
32
  var displayName: string;
33
33
  }
@@ -1,5 +1,6 @@
1
1
  import type { ChangeEvent, HTMLProps } from "react";
2
+ import React from "react";
2
3
  export interface SwitchProps extends Omit<HTMLProps<HTMLInputElement>, "onChange"> {
3
4
  onChange?: (checked: boolean, event: ChangeEvent<HTMLInputElement>) => void;
4
5
  }
5
- export declare function Switch({ className, children, disabled, onChange, ...props }: SwitchProps): JSX.Element;
6
+ export declare function Switch({ className, children, disabled, onChange, ...props }: SwitchProps): React.JSX.Element;
@@ -1,4 +1,4 @@
1
- import { type HTMLAttributes, type ReactElement } from "react";
1
+ import React, { type HTMLAttributes, type ReactElement } from "react";
2
2
  import { type Placement } from "@popperjs/core";
3
3
  export interface TooltipProps {
4
4
  /**
@@ -23,4 +23,4 @@ export interface SpanTooltipProps extends Omit<HTMLAttributes<HTMLSpanElement>,
23
23
  export interface DivTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, "onFocus" | "onBlur" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "aria-describedby">, TooltipProps {
24
24
  wrapper: "div";
25
25
  }
26
- export default function Tooltip({ id, wrapper: Wrapper, mutationsListenerElement: initialMutationsListenerElement, popupClassName, placement, alwaysVisible, text, children, ...props }: SpanTooltipProps | DivTooltipProps): JSX.Element;
26
+ export default function Tooltip({ id, wrapper: Wrapper, mutationsListenerElement: initialMutationsListenerElement, popupClassName, placement, alwaysVisible, text, children, ...props }: SpanTooltipProps | DivTooltipProps): React.JSX.Element;
@@ -4,4 +4,4 @@ export declare const DefaultHeader: ({ licenseText, noLicenseText, onClick, disa
4
4
  noLicenseText?: string | undefined;
5
5
  onClick?: ((e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void) | undefined;
6
6
  disabled?: boolean | undefined;
7
- }) => JSX.Element;
7
+ }) => React.JSX.Element;
@@ -52,4 +52,4 @@ export declare type UserMenuProps = DefaultUserMenuProps | CustomUserMenuProps;
52
52
  /**
53
53
  * UserMenu is a component that displays a user's information and a dropdown menu of links.
54
54
  */
55
- export default function UserMenu({ user, header, footer, origin, className, onLogoutClick, loading, ...props }: UserMenuProps): JSX.Element;
55
+ export default function UserMenu({ user, header, footer, origin, className, onLogoutClick, loading, ...props }: UserMenuProps): React.JSX.Element;
@@ -1 +1 @@
1
- import{__rest as e,__assign as o}from"../_virtual/_tslib.js";import r,{useRef as t,useMemo as n}from"react";import a from"clsx";import{Menu as i}from"@headlessui/react";import{navigation as l}from"@k8slens/lds-icons";import s from"../ProfileBlock/ProfileBlock.js";import{defaultItems as m,defaultOrigin as c}from"./default-items.js";import u from"./UserMenuDropdown.js";import f from"./UserMenu.module.css.js";var d=l.ArrowDownIcon,p=l.ArrowUpIcon;function g(l){var g=l.user,v=l.header,b=l.footer,k=l.origin,E=void 0===k?c:k,N=l.className,h=l.onLogoutClick,w=l.loading,j=e(l,["user","header","footer","origin","className","onLogoutClick","loading"]),B=t(null),D=j.buttonRef?j.buttonRef:B,I=n((function(){return("items"in j?j.items:m).map((function(e){return{children:e.children.map((function(e){return"logout"===e.key?o(o({},e),{onClick:h}):e}))}}))}),[j,h]),C=n((function(){return{avatar:g.avatar,avatarTitle:g.name,title:"@".concat(g.username),subtitle:g.name}}),[g]);return r.createElement(i,null,(function(e){var o,t=e.open;return r.createElement("div",{className:a(f.userMenu,N)},r.createElement(i.Button,{className:a(f.button,(o={},o[f.open]=t,o[f.disabled]=w,o)),ref:D,disabled:w},r.createElement(s,{item:C,loading:w,className:f.profileBlock}),t?r.createElement(p,{className:f.dropDownIcon}):r.createElement(d,{className:f.dropDownIcon})),r.createElement(u,{open:t,header:v,footer:b,origin:E,groups:I,buttonRef:D}))}))}export{g as default};
1
+ import{__rest as e,__assign as o}from"../_virtual/_tslib.js";import r,{useRef as t,useMemo as n}from"react";import a from"clsx";import{Menu as i,MenuButton as l}from"@headlessui/react";import{navigation as s}from"@k8slens/lds-icons";import m from"../ProfileBlock/ProfileBlock.js";import{defaultItems as c,defaultOrigin as u}from"./default-items.js";import f from"./UserMenuDropdown.js";import d from"./UserMenu.module.css.js";var p=s.ArrowDownIcon,g=s.ArrowUpIcon;function v(s){var v=s.user,b=s.header,k=s.footer,E=s.origin,N=void 0===E?u:E,h=s.className,w=s.onLogoutClick,j=s.loading,D=e(s,["user","header","footer","origin","className","onLogoutClick","loading"]),I=t(null),B=D.buttonRef?D.buttonRef:I,C=n((function(){return("items"in D?D.items:c).map((function(e){return{children:e.children.map((function(e){return"logout"===e.key?o(o({},e),{onClick:w}):e}))}}))}),[D,w]),M=n((function(){return{avatar:v.avatar,avatarTitle:v.name,title:"@".concat(v.username),subtitle:v.name}}),[v]);return r.createElement(i,null,(function(e){var o,t=e.open;return r.createElement("div",{className:a(d.userMenu,h)},r.createElement(l,{className:a(d.button,(o={},o[d.open]=t,o[d.disabled]=j,o)),ref:B,disabled:j},r.createElement(m,{item:M,loading:j,className:d.profileBlock}),t?r.createElement(g,{className:d.dropDownIcon}):r.createElement(p,{className:d.dropDownIcon})),r.createElement(f,{open:t,header:b,footer:k,origin:N,groups:C,buttonRef:B}))}))}export{v as default};
@@ -1,4 +1,4 @@
1
- import { ReactNode, RefObject } from "react";
1
+ import React, { ReactNode, RefObject } from "react";
2
2
  import { MenuItemGroup } from "./default-items";
3
3
  export interface UserMenuDropdownProps {
4
4
  /**
@@ -33,4 +33,4 @@ export interface UserMenuDropdownProps {
33
33
  /**
34
34
  * UserMenuDropdown is a component that displays a dropdown menu of links. Uses Popper.js for positioning.
35
35
  */
36
- export default function UserMenuDropdown({ header, footer, origin, className, groups, open, buttonRef, }: UserMenuDropdownProps): JSX.Element;
36
+ export default function UserMenuDropdown({ header, footer, origin, className, groups, open, buttonRef, }: UserMenuDropdownProps): React.JSX.Element;
@@ -1 +1 @@
1
- import{__assign as e}from"../_virtual/_tslib.js";import t,{useRef as o}from"react";import{Transition as n,Menu as r}from"@headlessui/react";import{usePopper as i}from"react-popper";import a from"clsx";import{SpacingLg as s,TransitionDurationDefault as m}from"../node_modules/@k8slens/lds-tokens/lib/web/tokens.base.js";import{convertRemToPixels as l}from"../helpers.js";import p from"./UserMenuItem.js";import c from"./UserMenuDropdown.module.css.js";var d=l(s),u={name:"offset",options:{offset:function(e){var t=e.placement;return t.startsWith("top")||t.startsWith("bottom")?[0,-1]:[0,0]}}},f={name:"maxSize",enabled:!0,phase:"main",fn:function(t){var o=t.state;if(void 0!==d&&"undefined"!=typeof window&&"undefined"!=typeof document){var n=o.elements.reference.getBoundingClientRect(),r=document.documentElement,i=o.placement.endsWith("start")?Math.min(r.clientWidth,window.innerWidth)-n.left-d:n.right-d,a=o.placement.startsWith("bottom")?Math.min(r.clientHeight,window.innerHeight)-n.bottom-d:n.top-d;o.styles.popper=e(e({},o.styles.popper),{maxWidth:"".concat(i,"px"),maxHeight:"".concat(a,"px")})}}};function h(s){var l,d,h=s.header,v=s.footer,y=s.origin,b=s.className,g=s.groups,w=s.open,k=s.buttonRef,x=o(null),W=i(null==k?void 0:k.current,null==x?void 0:x.current,{placement:"bottom-start",modifiers:[{name:"flip",options:{fallbackPlacements:["top-start","bottom-end","top-end"]}},{name:"preventOverflow",options:{boundary:"viewport"}},{name:"computeStyles",options:{adaptive:!0}},u,f]}),j=W.styles,E=W.attributes;return t.createElement(n,e({show:w,enter:"transition duration-[".concat(m,"] ease-in-out"),enterFrom:"transform opacity-0",enterTo:"transform opacity-100",leave:"transition duration-[".concat(m,"] ease-in-out"),leaveFrom:"transform opacity-100",leaveTo:"transform opacity-0",className:a(c.userMenuDropdown,b),ref:x,style:e(e({},j.popper),{minWidth:null===(d=null==k?void 0:k.current)||void 0===d?void 0:d.offsetWidth})},E.popper),t.createElement(r.Items,{className:a(c.content,(l={},l[c.open]=w,l))},h,g.map((function(e,o){var n,r=e.children;return t.createElement("div",{className:a(c.group,(n={},n[c.last]=o===g.length-1,n)),key:"group-".concat(o),role:"navigation"},r.map((function(e,o){return t.createElement(p,{key:"key"in e?e.key:"item-".concat(o),title:e.title,icon:e.icon,type:e.type,disabled:e.disabled,external:e.external,href:e.href,onClick:"onClick"in e?e.onClick:void 0,origin:y})})))})),v))}export{h as default};
1
+ import{__assign as e}from"../_virtual/_tslib.js";import t,{useRef as o}from"react";import{Transition as n,MenuItems as r}from"@headlessui/react";import{usePopper as i}from"react-popper";import a from"clsx";import{SpacingLg as s,TransitionDurationDefault as m}from"../node_modules/@k8slens/lds-tokens/lib/web/tokens.base.js";import{convertRemToPixels as l}from"../helpers.js";import p from"./UserMenuItem.js";import c from"./UserMenuDropdown.module.css.js";var d=l(s),u={name:"offset",options:{offset:function(e){var t=e.placement;return t.startsWith("top")||t.startsWith("bottom")?[0,-1]:[0,0]}}},f={name:"maxSize",enabled:!0,phase:"main",fn:function(t){var o=t.state;if(void 0!==d&&"undefined"!=typeof window&&"undefined"!=typeof document){var n=o.elements.reference.getBoundingClientRect(),r=document.documentElement,i=o.placement.endsWith("start")?Math.min(r.clientWidth,window.innerWidth)-n.left-d:n.right-d,a=o.placement.startsWith("bottom")?Math.min(r.clientHeight,window.innerHeight)-n.bottom-d:n.top-d;o.styles.popper=e(e({},o.styles.popper),{maxWidth:"".concat(i,"px"),maxHeight:"".concat(a,"px")})}}};function h(s){var l,d,h=s.header,v=s.footer,y=s.origin,b=s.className,g=s.groups,w=s.open,k=s.buttonRef,x=o(null),W=i(null==k?void 0:k.current,null==x?void 0:x.current,{placement:"bottom-start",modifiers:[{name:"flip",options:{fallbackPlacements:["top-start","bottom-end","top-end"]}},{name:"preventOverflow",options:{boundary:"viewport"}},{name:"computeStyles",options:{adaptive:!0}},u,f]}),j=W.styles,E=W.attributes;return t.createElement(n,e({show:w,enter:"transition duration-[".concat(m,"] ease-in-out"),enterFrom:"transform opacity-0",enterTo:"transform opacity-100",leave:"transition duration-[".concat(m,"] ease-in-out"),leaveFrom:"transform opacity-100",leaveTo:"transform opacity-0",as:"div",className:a(c.userMenuDropdown,b),ref:x,style:e(e({},j.popper),{minWidth:null===(d=null==k?void 0:k.current)||void 0===d?void 0:d.offsetWidth})},E.popper),t.createElement(r,{className:a(c.content,(l={},l[c.open]=w,l))},h,g.map((function(e,o){var n,r=e.children;return t.createElement("div",{className:a(c.group,(n={},n[c.last]=o===g.length-1,n)),key:"group-".concat(o),role:"navigation"},r.map((function(e,o){return t.createElement(p,{key:"key"in e?e.key:"item-".concat(o),title:e.title,icon:e.icon,type:e.type,disabled:e.disabled,external:e.external,href:e.href,onClick:"onClick"in e?e.onClick:void 0,origin:y})})))})),v))}export{h as default};
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import type { MouseEvent } from "react";
2
3
  import { type Icon } from "@k8slens/lds-icons/lib/es/Icon/Icon";
3
4
  export declare type MenuItem = {
@@ -18,4 +19,4 @@ export interface UserMenuItemProps extends MenuItem {
18
19
  */
19
20
  className?: string;
20
21
  }
21
- export default function UserMenuItem({ type, title, icon: Icon, disabled, external, onClick, selected, href: path, origin, className: cls, }: UserMenuItemProps): JSX.Element;
22
+ export default function UserMenuItem({ type, title, icon: Icon, disabled, external, onClick, selected, href: path, origin, className: cls, }: UserMenuItemProps): React.JSX.Element;
@@ -1 +1 @@
1
- import{__assign as e}from"../_virtual/_tslib.js";import t,{useMemo as n}from"react";import{Menu as r}from"@headlessui/react";import l from"clsx";import a from"./UserMenuItem.module.css.js";var o=function(e,t){return new URL(e,t).pathname},c=function(e){var n=e.Icon,r=e.title;return t.createElement(t.Fragment,null,n?t.createElement(n,{className:a.icon,size:"sm"}):null,t.createElement("span",{className:a.title},r))};function i(i){var m=i.type,s=void 0===m?"default":m,u=i.title,d=i.icon,f=i.disabled,p=i.external,E=i.onClick,b=i.selected,w=i.href,I=i.origin,v=i.className,h=n((function(){return p||!w?w:I?"".concat(I).concat((null==w?void 0:w.startsWith("/"))?w:"/".concat(w)):w}),[w,I,p]),N=n((function(){return"boolean"==typeof b?b:!(!h||"undefined"==typeof window)&&o(window.location.href,"undefined"!=typeof window?window.location.origin:void 0)===o(h,h)}),[h,b]),g=n((function(){var e;return l(a.userMenuItem,((e={})[a[s]]=s&&"default"!==s,e[a.disabled]=f,e[a.external]=p,e[a.selected]=N,e),v)}),[s,f,p,v,N]);return f||b||!h?f||b||!E?t.createElement(r.Item,{disabled:!0},t.createElement("span",{className:l(g,a.disabled)},t.createElement(c,{Icon:d,title:u}))):t.createElement(r.Item,null,t.createElement("button",{className:l(a.button,g),onClick:E},t.createElement(c,{Icon:d,title:u}))):t.createElement(r.Item,null,t.createElement("a",e({className:g,onClick:E,href:h},p?{target:"_blank"}:{},{rel:"noopener noreferrer"}),t.createElement(c,{Icon:d,title:u})))}export{i as default};
1
+ import{__assign as e}from"../_virtual/_tslib.js";import t,{useMemo as n}from"react";import{MenuItem as r}from"@headlessui/react";import l from"clsx";import a from"./UserMenuItem.module.css.js";var o=function(e,t){return new URL(e,t).pathname},c=function(e){var n=e.Icon,r=e.title;return t.createElement(t.Fragment,null,n?t.createElement(n,{className:a.icon,size:"sm"}):null,t.createElement("span",{className:a.title},r))};function i(i){var s=i.type,m=void 0===s?"default":s,u=i.title,d=i.icon,f=i.disabled,p=i.external,E=i.onClick,b=i.selected,w=i.href,v=i.origin,h=i.className,I=n((function(){return p||!w?w:v?"".concat(v).concat((null==w?void 0:w.startsWith("/"))?w:"/".concat(w)):w}),[w,v,p]),N=n((function(){return"boolean"==typeof b?b:!(!I||"undefined"==typeof window)&&o(window.location.href,"undefined"!=typeof window?window.location.origin:void 0)===o(I,I)}),[I,b]),g=n((function(){var e;return l(a.userMenuItem,((e={})[a[m]]=m&&"default"!==m,e[a.disabled]=f,e[a.external]=p,e[a.selected]=N,e),h)}),[m,f,p,h,N]);return f||b||!I?f||b||!E?t.createElement(r,{disabled:!0},t.createElement("span",{className:l(g,a.disabled)},t.createElement(c,{Icon:d,title:u}))):t.createElement(r,null,t.createElement("button",{className:l(a.button,g),onClick:E},t.createElement(c,{Icon:d,title:u}))):t.createElement(r,null,t.createElement("a",e({className:g,onClick:E,href:I},p?{target:"_blank"}:{},{rel:"noopener noreferrer"}),t.createElement(c,{Icon:d,title:u})))}export{i as default};