@k8slens/lds 0.58.2 → 0.58.4

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 (135) hide show
  1. package/lib/cjs/Avatar/Avatar.d.ts +3 -1
  2. package/lib/cjs/Avatar/Avatar.js +1 -1
  3. package/lib/cjs/Badge/Badge.d.ts +6 -4
  4. package/lib/cjs/Button/Button.d.ts +34 -6
  5. package/lib/cjs/Button/Button.js +1 -1
  6. package/lib/cjs/Button/shared.d.ts +30 -1
  7. package/lib/cjs/ButtonBar/ButtonBar.d.ts +17 -0
  8. package/lib/cjs/ButtonBar/ButtonBar.js +1 -1
  9. package/lib/cjs/Checkbox/Checkbox.d.ts +7 -0
  10. package/lib/cjs/ConfirmDialog/ConfirmDialog.d.ts +16 -0
  11. package/lib/cjs/ConfirmDialog/ConfirmDialog.js +1 -1
  12. package/lib/cjs/ContextMenu/ContextMenu.js +1 -1
  13. package/lib/cjs/DrawerTransition/DrawerTransition.d.ts +20 -0
  14. package/lib/cjs/DrawerTransition/DrawerTransition.js +1 -1
  15. package/lib/cjs/Input/Input.d.ts +8 -0
  16. package/lib/cjs/Input/Input.js +1 -1
  17. package/lib/cjs/LinkButton/LinkButton.d.ts +7 -0
  18. package/lib/cjs/LinkButton/LinkButton.js +1 -1
  19. package/lib/cjs/LoadingIndicator/LoadingIndicator.d.ts +8 -2
  20. package/lib/cjs/Lozenge/Lozenge.d.ts +4 -2
  21. package/lib/cjs/Lozenge/Lozenge.js +1 -1
  22. package/lib/cjs/Modal/Modal.d.ts +26 -0
  23. package/lib/cjs/Modal/Modal.js +1 -1
  24. package/lib/cjs/Notification/Notification.d.ts +18 -2
  25. package/lib/cjs/Notification/Notification.js +1 -1
  26. package/lib/cjs/NumberBadge/NumberBadge.d.ts +1 -1
  27. package/lib/cjs/Panel/Panel.d.ts +28 -0
  28. package/lib/cjs/Panel/Panel.js +1 -1
  29. package/lib/cjs/ProfileBlock/ProfileBlock.d.ts +8 -0
  30. package/lib/cjs/ProgressBar/ProgressBar.d.ts +11 -0
  31. package/lib/cjs/ProgressBar/ProgressBar.js +1 -1
  32. package/lib/cjs/RadioCard/RadioCard.d.ts +27 -1
  33. package/lib/cjs/RadioCard/RadioCard.js +1 -1
  34. package/lib/cjs/Select/MultiOption.d.ts +14 -4
  35. package/lib/cjs/Select/MultiOption.js +1 -1
  36. package/lib/cjs/Select/Option.d.ts +6 -0
  37. package/lib/cjs/Select/Option.js +1 -1
  38. package/lib/cjs/Select/Select.d.ts +39 -5
  39. package/lib/cjs/Select/Select.js +1 -1
  40. package/lib/cjs/Select/SelectDropdown.js +1 -1
  41. package/lib/cjs/SideNav/SideNav.d.ts +9 -3
  42. package/lib/cjs/SideNav/SideNav.js +1 -1
  43. package/lib/cjs/SideNav/SideNavGroup.d.ts +13 -5
  44. package/lib/cjs/SideNav/SideNavGroup.js +1 -1
  45. package/lib/cjs/SideNav/SideNavItem.d.ts +22 -5
  46. package/lib/cjs/SideNav/SideNavItem.js +1 -1
  47. package/lib/cjs/Switch/Switch.d.ts +2 -0
  48. package/lib/cjs/Table/Table.js +1 -1
  49. package/lib/cjs/Textarea/Textarea.js +1 -1
  50. package/lib/cjs/Tooltip/Tooltip.d.ts +15 -3
  51. package/lib/cjs/Tooltip/Tooltip.js +1 -1
  52. package/lib/cjs/UserMenu/UserMenu.d.ts +9 -2
  53. package/lib/cjs/UserMenu/UserMenu.js +1 -1
  54. package/lib/cjs/UserMenu/UserMenuDropdown.d.ts +10 -6
  55. package/lib/cjs/UserMenu/UserMenuDropdown.js +1 -1
  56. package/lib/cjs/UserMenu/UserMenuItem.d.ts +22 -1
  57. package/lib/cjs/UserMenu/UserMenuItem.js +1 -1
  58. package/lib/cjs/_virtual/_tslib.js +1 -1
  59. package/lib/cjs/node_modules/lodash/_basePick.js +1 -1
  60. package/lib/cjs/node_modules/lodash/_baseToString.js +1 -1
  61. package/lib/cjs/node_modules/lodash/_memoizeCapped.js +1 -1
  62. package/lib/cjs/node_modules/lodash/_stringToPath.js +1 -1
  63. package/lib/cjs/node_modules/lodash/_toKey.js +1 -1
  64. package/lib/cjs/node_modules/lodash/pick.js +1 -1
  65. package/lib/es/Avatar/Avatar.d.ts +3 -1
  66. package/lib/es/Avatar/Avatar.js +1 -1
  67. package/lib/es/Badge/Badge.d.ts +6 -4
  68. package/lib/es/Button/Button.d.ts +34 -6
  69. package/lib/es/Button/Button.js +1 -1
  70. package/lib/es/Button/shared.d.ts +30 -1
  71. package/lib/es/ButtonBar/ButtonBar.d.ts +17 -0
  72. package/lib/es/ButtonBar/ButtonBar.js +1 -1
  73. package/lib/es/Checkbox/Checkbox.d.ts +7 -0
  74. package/lib/es/ConfirmDialog/ConfirmDialog.d.ts +16 -0
  75. package/lib/es/ConfirmDialog/ConfirmDialog.js +1 -1
  76. package/lib/es/ContextMenu/ContextMenu.js +1 -1
  77. package/lib/es/DrawerTransition/DrawerTransition.d.ts +20 -0
  78. package/lib/es/DrawerTransition/DrawerTransition.js +1 -1
  79. package/lib/es/Input/Input.d.ts +8 -0
  80. package/lib/es/Input/Input.js +1 -1
  81. package/lib/es/LinkButton/LinkButton.d.ts +7 -0
  82. package/lib/es/LinkButton/LinkButton.js +1 -1
  83. package/lib/es/LoadingIndicator/LoadingIndicator.d.ts +8 -2
  84. package/lib/es/Lozenge/Lozenge.d.ts +4 -2
  85. package/lib/es/Lozenge/Lozenge.js +1 -1
  86. package/lib/es/Modal/Modal.d.ts +26 -0
  87. package/lib/es/Modal/Modal.js +1 -1
  88. package/lib/es/Notification/Notification.d.ts +18 -2
  89. package/lib/es/Notification/Notification.js +1 -1
  90. package/lib/es/NumberBadge/NumberBadge.d.ts +1 -1
  91. package/lib/es/Panel/Panel.d.ts +28 -0
  92. package/lib/es/Panel/Panel.js +1 -1
  93. package/lib/es/ProfileBlock/ProfileBlock.d.ts +8 -0
  94. package/lib/es/ProgressBar/ProgressBar.d.ts +11 -0
  95. package/lib/es/ProgressBar/ProgressBar.js +1 -1
  96. package/lib/es/RadioCard/RadioCard.d.ts +27 -1
  97. package/lib/es/RadioCard/RadioCard.js +1 -1
  98. package/lib/es/Select/MultiOption.d.ts +14 -4
  99. package/lib/es/Select/MultiOption.js +1 -1
  100. package/lib/es/Select/Option.d.ts +6 -0
  101. package/lib/es/Select/Option.js +1 -1
  102. package/lib/es/Select/Select.d.ts +39 -5
  103. package/lib/es/Select/Select.js +1 -1
  104. package/lib/es/Select/SelectDropdown.js +1 -1
  105. package/lib/es/SideNav/SideNav.d.ts +9 -3
  106. package/lib/es/SideNav/SideNav.js +1 -1
  107. package/lib/es/SideNav/SideNavGroup.d.ts +13 -5
  108. package/lib/es/SideNav/SideNavGroup.js +1 -1
  109. package/lib/es/SideNav/SideNavItem.d.ts +22 -5
  110. package/lib/es/SideNav/SideNavItem.js +1 -1
  111. package/lib/es/Switch/Switch.d.ts +2 -0
  112. package/lib/es/Table/Table.js +1 -1
  113. package/lib/es/Textarea/Textarea.js +1 -1
  114. package/lib/es/Tooltip/Tooltip.d.ts +15 -3
  115. package/lib/es/Tooltip/Tooltip.js +1 -1
  116. package/lib/es/UserMenu/UserMenu.d.ts +9 -2
  117. package/lib/es/UserMenu/UserMenu.js +1 -1
  118. package/lib/es/UserMenu/UserMenuDropdown.d.ts +10 -6
  119. package/lib/es/UserMenu/UserMenuDropdown.js +1 -1
  120. package/lib/es/UserMenu/UserMenuItem.d.ts +22 -1
  121. package/lib/es/UserMenu/UserMenuItem.js +1 -1
  122. package/lib/es/_virtual/_tslib.js +1 -1
  123. package/lib/es/node_modules/lodash/_basePick.js +1 -1
  124. package/lib/es/node_modules/lodash/_baseToString.js +1 -1
  125. package/lib/es/node_modules/lodash/_memoizeCapped.js +1 -1
  126. package/lib/es/node_modules/lodash/_stringToPath.js +1 -1
  127. package/lib/es/node_modules/lodash/_toKey.js +1 -1
  128. package/lib/es/node_modules/lodash/pick.js +1 -1
  129. package/lib/es/node_modules/lodash/throttle.js +1 -1
  130. package/lib/web/lds-v0-58-3/index.js +28 -0
  131. package/llms.txt +262 -102
  132. package/package.json +4 -4
  133. package/lib/web/lds-v0-58-1/index.js +0 -28
  134. /package/lib/web/{lds-v0-58-1 → lds-v0-58-3}/index.css +0 -0
  135. /package/lib/web/{lds-v0-58-1 → lds-v0-58-3}/typography.css +0 -0
@@ -5,17 +5,20 @@ import type { ExtractProps } from "../types/ExtractProps.d";
5
5
  */
6
6
  export declare type ChildKey = "__isChildOfSideNavGroup";
7
7
  export declare const CHILD_KEY: ChildKey;
8
+ /** Props for the SideNavGroup component. */
8
9
  export interface SideNavGroupProps<Component extends React.ElementType | keyof JSX.IntrinsicElements = "nav"> {
9
10
  /**
10
- * Component to be used instead of nav
11
+ * Component to be used instead of nav.
12
+ * @default "nav"
11
13
  */
12
14
  component?: Component;
13
- /**
14
- * Props for the component passed as `component` prop
15
- */
15
+ /** Props forwarded to the component passed as `component` prop. */
16
16
  componentProps?: Omit<ExtractProps<Component>, "id" | "className" | "children" | "aria-labelledby" | "aria-label">;
17
+ /** HTML `id` attribute. */
17
18
  id?: string;
19
+ /** Optional class name. */
18
20
  className?: string;
21
+ /** Child elements, should be `SideNavItem` components. */
19
22
  children?: React.ReactNode;
20
23
  }
21
24
  export interface SideNavGroupPropsWithLabel<Component extends React.ElementType | keyof JSX.IntrinsicElements = "nav"> extends SideNavGroupProps<Component> {
@@ -27,8 +30,13 @@ export interface SideNavGroupPropsWithoutLabel<Component extends React.ElementTy
27
30
  /**
28
31
  * Side navigation group, use as a direct child of `SideNav`.
29
32
  *
33
+ * Usage: `import { SideNavGroup } from "@k8slens/lds"`
34
+ *
30
35
  * ```tsx
31
- * import { SideNavGroup } from @k8slens/lds
36
+ * <SideNavGroup label="Settings">
37
+ * <SideNavItem href="/general">General</SideNavItem>
38
+ * <SideNavItem href="/security">Security</SideNavItem>
39
+ * </SideNavGroup>
32
40
  * ```
33
41
  */
34
42
  declare function SideNavGroup<C extends keyof JSX.IntrinsicElements | React.ElementType = "nav">({ component, componentProps, id, className, children, ...props }: SideNavGroupPropsWithLabel<C> | SideNavGroupPropsWithoutLabel<C>): React.JSX.Element;
@@ -1 +1 @@
1
- import{__rest as e,__assign as a}from"../_virtual/_tslib.js";import r,{useMemo as o,isValidElement as i,cloneElement as l}from"react";import n from"clsx";import{CHILD_KEY as t}from"./SideNav.js";import d from"./unique-id.js";import s from"./SideNavGroup.module.css.js";var m="__isChildOfSideNavGroup";function c(c){var p=c.component,v=c.componentProps,u=c.id,N=c.className,f=c.children,b=e(c,["component","componentProps","id","className","children"]),h=p||"nav",S="label"in b?b.label:void 0,y=o((function(){return u?"".concat(u,"-label"):"lds-nav-group-label-".concat(d())}),[u]);t in b&&!0===b[t]||"development"!==process.env.NODE_ENV||console.warn("SideNavGroup should be a direct child of SideNav");var E=o((function(){return"development"===process.env.NODE_ENV?r.Children.map(f,(function(e){var a;return i(e)&&"SideNavItem"===e.type.displayName?l(e,((a={})[m]=!0,a)):(i(e)&&"SideNavItem"!==e.type.displayName&&console.warn("SideNavGroup should only have SideNavItem as direct children"),e)})):f}),[f]);return r.createElement(h,a({},v,{id:u,className:n(s.sideNavGroup,N)},S?{"aria-labelledby":y}:{},"aria-label"in b?{"aria-label":b["aria-label"]}:{}),S&&r.createElement("span",{id:y,className:n("lds-h3",s.label)},S),E)}c.displayName="SideNavGroup";export{m as CHILD_KEY,c as default};
1
+ import{__rest as e,__assign as a}from"../_virtual/_tslib.js";import r,{useMemo as o,isValidElement as i,cloneElement as l}from"react";import n from"clsx";import{CHILD_KEY as t}from"./SideNav.js";import d from"./unique-id.js";import s from"./SideNavGroup.module.css.js";var m="__isChildOfSideNavGroup";function c(c){var p=c.component,v=c.componentProps,u=c.id,N=c.className,f=c.children,b=e(c,["component","componentProps","id","className","children"]),h=p||"nav",S="label"in b?b.label:void 0,y=o(function(){return u?"".concat(u,"-label"):"lds-nav-group-label-".concat(d())},[u]);t in b&&!0===b[t]||"development"!==process.env.NODE_ENV||console.warn("SideNavGroup should be a direct child of SideNav");var E=o(function(){return"development"===process.env.NODE_ENV?r.Children.map(f,function(e){var a;return i(e)&&"SideNavItem"===e.type.displayName?l(e,((a={})[m]=!0,a)):(i(e)&&"SideNavItem"!==e.type.displayName&&console.warn("SideNavGroup should only have SideNavItem as direct children"),e)}):f},[f]);return r.createElement(h,a({},v,{id:u,className:n(s.sideNavGroup,N)},S?{"aria-labelledby":y}:{},"aria-label"in b?{"aria-label":b["aria-label"]}:{}),S&&r.createElement("span",{id:y,className:n("lds-h3",s.label)},S),E)}c.displayName="SideNavGroup";export{m as CHILD_KEY,c as default};
@@ -1,30 +1,47 @@
1
1
  import React from "react";
2
2
  import type { ExtractProps } from "../types/ExtractProps.d";
3
3
  export declare type Type = "default" | "danger";
4
+ /** Props for the SideNavItem component. */
4
5
  export interface SideNavItemProps<Component extends React.ElementType | keyof JSX.IntrinsicElements = "a"> {
5
6
  /**
6
- * Component to be used instead of anchor, for example `Link` when used with [react-router](https://reactrouter.com/en/main/components/link)
7
+ * Component to be used instead of anchor, for example `Link` when used with [react-router](https://reactrouter.com/en/main/components/link).
8
+ * @default "a"
7
9
  */
8
10
  component?: Component;
11
+ /** Props forwarded to the component passed as `component` prop. */
12
+ componentProps?: Omit<ExtractProps<Component>, "children" | "className" | "aria-disabled">;
9
13
  /**
10
- * Props for the component passed as `component` prop
14
+ * Whether the item is disabled.
15
+ * @default false
11
16
  */
12
- componentProps?: Omit<ExtractProps<Component>, "children" | "className" | "aria-disabled">;
13
17
  disabled?: boolean;
18
+ /**
19
+ * Whether the item is currently active (sets `aria-current="page"`).
20
+ * @default false
21
+ */
14
22
  active?: boolean;
23
+ /** Child content. */
15
24
  children?: React.ReactNode;
25
+ /** Optional class name. */
16
26
  className?: string;
27
+ /**
28
+ * Visual style type.
29
+ * @default "default"
30
+ */
17
31
  type?: Type;
18
32
  /**
19
- * If true, renders a visual indication of an external link
33
+ * If true, renders a visual indication of an external link.
34
+ * @default false
20
35
  */
21
36
  externalLink?: boolean;
22
37
  }
23
38
  /**
24
39
  * Side navigation item, use as a direct child of `SideNavGroup`.
25
40
  *
41
+ * Usage: `import { SideNavItem } from "@k8slens/lds"`
42
+ *
26
43
  * ```tsx
27
- * import { SideNavItem } from @k8slens/lds
44
+ * <SideNavItem active href="/settings">Settings</SideNavItem>
28
45
  * ```
29
46
  */
30
47
  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;
@@ -1 +1 @@
1
- import{__rest as e,__assign as a}from"../_virtual/_tslib.js";import t,{useMemo as r}from"react";import i from"clsx";import n from"./SideNavItem.module.css.js";function o(o){var l,m=o.component,s=o.componentProps,c=o.active,d=o.disabled,p=o.className,u=o.children,v=o.type,f=void 0===v?"default":v,N=o.externalLink;e(o,["component","componentProps","active","disabled","className","children","type","externalLink"]);var b=m||"a",x=r((function(){return s&&"aria-current"in s||!c?{}:{"aria-current":"page"}}),[c,s]);return t.createElement(b,a({},s,{className:i(n.sideNavItem,p,(l={},l[n.disabled]=d,l[n.active]=c,l[n.external]=N,l[n[f]]="default"!==f,l)),"aria-disabled":d},x),u)}o.displayName="SideNavItem";export{o as default};
1
+ import{__rest as e,__assign as a}from"../_virtual/_tslib.js";import t,{useMemo as r}from"react";import i from"clsx";import n from"./SideNavItem.module.css.js";function o(o){var l,m=o.component,s=o.componentProps,c=o.active,d=o.disabled,p=o.className,u=o.children,v=o.type,f=void 0===v?"default":v,N=o.externalLink;e(o,["component","componentProps","active","disabled","className","children","type","externalLink"]);var b=m||"a",x=r(function(){return s&&"aria-current"in s||!c?{}:{"aria-current":"page"}},[c,s]);return t.createElement(b,a({},s,{className:i(n.sideNavItem,p,(l={},l[n.disabled]=d,l[n.active]=c,l[n.external]=N,l[n[f]]="default"!==f,l)),"aria-disabled":d},x),u)}o.displayName="SideNavItem";export{o as default};
@@ -1,6 +1,8 @@
1
1
  import type { ChangeEvent, HTMLProps } from "react";
2
2
  import React from "react";
3
+ /** Props for the Switch component. */
3
4
  export interface SwitchProps extends Omit<HTMLProps<HTMLInputElement>, "onChange"> {
5
+ /** Change handler receiving the new checked state and the original event. */
4
6
  onChange?: (checked: boolean, event: ChangeEvent<HTMLInputElement>) => void;
5
7
  }
6
8
  /**
@@ -1 +1 @@
1
- import{__rest as e,__assign as r}from"../_virtual/_tslib.js";import a,{createContext as t,useContext as n}from"react";import l from"clsx";import{navigation as c}from"@k8slens/lds-icons";import s from"./Table.module.css.js";var i=c.ArrowUpIcon,o=c.ArrowDownIcon,d=t({responsive:!0}),m=function(t){var n=t.visibility,c=void 0===n?"sr-only":n,i=t.className,o=t.children,d=e(t,["visibility","className","children"]);return a.createElement("caption",r({},d,{className:l(s.caption,i,{"lds-only-aria":"sr-only"===c}),hidden:"hidden"===c||void 0}),o)},v=function(t){var n=t.children,l=e(t,["children"]);return a.createElement("thead",r({},l),n)},u=function(t){var n=t.loading,l=void 0!==n&&n,c=t.children,s=e(t,["loading","children"]);return a.createElement("tbody",r({},s,{"aria-busy":l||void 0}),c)},p=function(t){var n,c=t.error,i=void 0!==c&&c,o=t.className,d=t.children,m=e(t,["error","className","children"]);return a.createElement("tr",r({},m,{className:l(s.row,o,(n={},n[s.rowError]=i,n))}),d)},h=function(t){var n,c,d,m=t.align,v=t.sortable,u=void 0!==v&&v,p=t.sorted,h=void 0!==p&&p,N=t.className,y=t.children,b=e(t,["align","sortable","sorted","className","children"]),f="center"===m?s.center:"end"===m?s.end:void 0;return a.createElement("th",r({},b,{scope:null!==(d=b.scope)&&void 0!==d?d:"col","aria-sort":"asc"===h?"ascending":"desc"===h?"descending":void 0,className:l(s.tableHeader,N,f,(n={},n[s.sortable]=u,n))}),a.createElement("span",null,y,u&&("asc"===h?a.createElement(i,{className:s.sortIcon}):a.createElement(o,{className:l(s.sortIcon,(c={},c[s.inactive]=!h,c))}))))},N={accent:s.textAccent,secondary:s.textSecondary,tertiary:s.textTertiary,quarternary:s.textQuarternary,default:s.textDefault},y=function(t){var c=t.primary,i=void 0!==c&&c,o=t.align,m=t.textStyle,v=t.responsiveHeader,u=t.className,p=t.children,h=e(t,["primary","align","textStyle","responsiveHeader","className","children"]),y=n(d).responsive,b=i?"th":"td",f="center"===o?s.center:"end"===o?s.end:void 0,E=m?N[m]:void 0;return a.createElement(b,r({},h,i?{scope:"row"}:{},{className:l(s.tableCell,u,f,E)}),y&&null!=v&&a.createElement("div",{"aria-hidden":!0,className:s.cellHeader},v),p)},b=function(t){var n=t.colSpan,l=t.children,c=e(t,["colSpan","children"]);return a.createElement("tr",r({},c),a.createElement("td",{colSpan:n},a.createElement("div",{className:s.noData},l)))},f=Object.assign((function(t){var n,c=t.responsive,i=void 0===c||c,o=t.bordered,m=void 0!==o&&o,v=t.className,u=t.children,p=e(t,["responsive","bordered","className","children"]);return a.createElement(d.Provider,{value:{responsive:i}},a.createElement("table",r({},p,{className:l(s.table,v,(n={},n[s.bordered]=m,n[s.responsive]=i,n))}),u))}),{Caption:m,Head:v,Body:u,Row:p,HeaderCell:h,Cell:y,StatusRow:b});export{u as TableBody,m as TableCaption,y as TableCell,v as TableHead,h as TableHeaderCell,p as TableRow,b as TableStatusRow,f as default};
1
+ import{__rest as e,__assign as r}from"../_virtual/_tslib.js";import a,{createContext as t,useContext as n}from"react";import l from"clsx";import{navigation as c}from"@k8slens/lds-icons";import s from"./Table.module.css.js";var i=c.ArrowUpIcon,o=c.ArrowDownIcon,d=t({responsive:!0}),m=function(t){var n=t.visibility,c=void 0===n?"sr-only":n,i=t.className,o=t.children,d=e(t,["visibility","className","children"]);return a.createElement("caption",r({},d,{className:l(s.caption,i,{"lds-only-aria":"sr-only"===c}),hidden:"hidden"===c||void 0}),o)},v=function(t){var n=t.children,l=e(t,["children"]);return a.createElement("thead",r({},l),n)},u=function(t){var n=t.loading,l=void 0!==n&&n,c=t.children,s=e(t,["loading","children"]);return a.createElement("tbody",r({},s,{"aria-busy":l||void 0}),c)},p=function(t){var n,c=t.error,i=void 0!==c&&c,o=t.className,d=t.children,m=e(t,["error","className","children"]);return a.createElement("tr",r({},m,{className:l(s.row,o,(n={},n[s.rowError]=i,n))}),d)},h=function(t){var n,c,d,m=t.align,v=t.sortable,u=void 0!==v&&v,p=t.sorted,h=void 0!==p&&p,N=t.className,y=t.children,b=e(t,["align","sortable","sorted","className","children"]),f="center"===m?s.center:"end"===m?s.end:void 0;return a.createElement("th",r({},b,{scope:null!==(d=b.scope)&&void 0!==d?d:"col","aria-sort":"asc"===h?"ascending":"desc"===h?"descending":void 0,className:l(s.tableHeader,N,f,(n={},n[s.sortable]=u,n))}),a.createElement("span",null,y,u&&("asc"===h?a.createElement(i,{className:s.sortIcon}):a.createElement(o,{className:l(s.sortIcon,(c={},c[s.inactive]=!h,c))}))))},N={accent:s.textAccent,secondary:s.textSecondary,tertiary:s.textTertiary,quarternary:s.textQuarternary,default:s.textDefault},y=function(t){var c=t.primary,i=void 0!==c&&c,o=t.align,m=t.textStyle,v=t.responsiveHeader,u=t.className,p=t.children,h=e(t,["primary","align","textStyle","responsiveHeader","className","children"]),y=n(d).responsive,b=i?"th":"td",f="center"===o?s.center:"end"===o?s.end:void 0,E=m?N[m]:void 0;return a.createElement(b,r({},h,i?{scope:"row"}:{},{className:l(s.tableCell,u,f,E)}),y&&null!=v&&a.createElement("div",{"aria-hidden":!0,className:s.cellHeader},v),p)},b=function(t){var n=t.colSpan,l=t.children,c=e(t,["colSpan","children"]);return a.createElement("tr",r({},c),a.createElement("td",{colSpan:n},a.createElement("div",{className:s.noData},l)))},f=Object.assign(function(t){var n,c=t.responsive,i=void 0===c||c,o=t.bordered,m=void 0!==o&&o,v=t.className,u=t.children,p=e(t,["responsive","bordered","className","children"]);return a.createElement(d.Provider,{value:{responsive:i}},a.createElement("table",r({},p,{className:l(s.table,v,(n={},n[s.bordered]=m,n[s.responsive]=i,n))}),u))},{Caption:m,Head:v,Body:u,Row:p,HeaderCell:h,Cell:y,StatusRow:b});export{u as TableBody,m as TableCaption,y as TableCell,v as TableHead,h as TableHeaderCell,p as TableRow,b as TableStatusRow,f as default};
@@ -1 +1 @@
1
- import{__rest as e,__assign as t}from"../_virtual/_tslib.js";import a,{forwardRef as n,useRef as l,useState as r,useCallback as o,useEffect as u}from"react";import c from"clsx";import i from"./Textarea.module.css.js";var s=n((function(n,s){var m,f,p=n.icon,g=n.autoResize,h=void 0!==g&&g,v=n.wrapperProps,x=n.maxLength,d=n.className,N=n.onChange,y=n.value,w=n.defaultValue,E=e(n,["icon","autoResize","wrapperProps","maxLength","className","onChange","value","defaultValue"]),z=l(null),C=r((function(){return"string"==typeof y?y.length:"string"==typeof w?w.length:0})),L=C[0],R=C[1],V=o((function(e){z.current=e,"function"==typeof s?s(e):s&&(s.current=e)}),[s]),j=o((function(){var e=z.current;e&&h&&(e.style.height="auto",e.style.height="".concat(e.scrollHeight,"px"))}),[h]);u((function(){j()}),[y,j]),u((function(){"string"==typeof y&&null!=x&&R(y.length)}),[y,x]);var P=o((function(e){null!=x&&R(e.target.value.length),j(),null==N||N(e)}),[N,j,x]);return a.createElement("div",t({},v,{className:c(i.wrapper,null==v?void 0:v.className,(m={},m[i.withIcon]=p,m))}),a.createElement("textarea",t({ref:V},E,{value:y,defaultValue:w,maxLength:x,onChange:P,className:c(i.textarea,d,(f={},f[i.autoResize]=h,f))})),p&&a.createElement(p,{className:i.icon}),null!=x&&a.createElement("span",{className:i.counter,"aria-live":"polite"},L,"/",x))}));export{s as default};
1
+ import{__rest as e,__assign as t}from"../_virtual/_tslib.js";import a,{forwardRef as n,useRef as l,useState as r,useCallback as o,useEffect as u}from"react";import c from"clsx";import i from"./Textarea.module.css.js";var s=n(function(n,s){var m,f,p=n.icon,g=n.autoResize,h=void 0!==g&&g,v=n.wrapperProps,x=n.maxLength,d=n.className,N=n.onChange,y=n.value,w=n.defaultValue,E=e(n,["icon","autoResize","wrapperProps","maxLength","className","onChange","value","defaultValue"]),z=l(null),C=r(function(){return"string"==typeof y?y.length:"string"==typeof w?w.length:0}),L=C[0],R=C[1],V=o(function(e){z.current=e,"function"==typeof s?s(e):s&&(s.current=e)},[s]),j=o(function(){var e=z.current;e&&h&&(e.style.height="auto",e.style.height="".concat(e.scrollHeight,"px"))},[h]);u(function(){j()},[y,j]),u(function(){"string"==typeof y&&null!=x&&R(y.length)},[y,x]);var P=o(function(e){null!=x&&R(e.target.value.length),j(),null==N||N(e)},[N,j,x]);return a.createElement("div",t({},v,{className:c(i.wrapper,null==v?void 0:v.className,(m={},m[i.withIcon]=p,m))}),a.createElement("textarea",t({ref:V},E,{value:y,defaultValue:w,maxLength:x,onChange:P,className:c(i.textarea,d,(f={},f[i.autoResize]=h,f))})),p&&a.createElement(p,{className:i.icon}),null!=x&&a.createElement("span",{className:i.counter,"aria-live":"polite"},L,"/",x))});export{s as default};
@@ -1,25 +1,37 @@
1
1
  import React, { type HTMLAttributes, type ReactElement } from "react";
2
2
  import { type Placement } from "@popperjs/core";
3
+ /** Props for the Tooltip component. */
3
4
  export interface TooltipProps {
4
5
  /**
5
- * Popper placement. Defaults to `auto`
6
+ * Popper placement of the tooltip popup.
7
+ * @default "auto"
6
8
  */
7
9
  placement?: Placement;
8
10
  /**
9
- * Which element to listen for mutations on. Defaults to document.body
11
+ * Which element to listen for DOM mutations on to reposition the tooltip.
12
+ * @default document.body
10
13
  */
11
14
  mutationsListenerElement?: HTMLElement;
12
15
  /**
13
- * Wrapper element type, div or span, defaults to span
16
+ * Wrapper element type used around the children.
17
+ * @default "span"
14
18
  */
15
19
  wrapper?: "span" | "div";
20
+ /** Additional class name for the tooltip popup element. */
16
21
  popupClassName?: string;
22
+ /** Content displayed inside the tooltip popup. */
17
23
  text?: ReactElement | string;
24
+ /**
25
+ * Whether the tooltip is always visible (ignores hover/focus).
26
+ * @default false
27
+ */
18
28
  alwaysVisible?: boolean;
19
29
  }
30
+ /** Props when the Tooltip wrapper is a `<span>` element (default). */
20
31
  export interface SpanTooltipProps extends Omit<HTMLAttributes<HTMLSpanElement>, "onFocus" | "onBlur" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "aria-describedby">, TooltipProps {
21
32
  wrapper?: "span";
22
33
  }
34
+ /** Props when the Tooltip wrapper is a `<div>` element. */
23
35
  export interface DivTooltipProps extends Omit<HTMLAttributes<HTMLDivElement>, "onFocus" | "onBlur" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "aria-describedby">, TooltipProps {
24
36
  wrapper: "div";
25
37
  }
@@ -1 +1 @@
1
- import{__rest as e,__assign as t}from"../_virtual/_tslib.js";import o,{useMemo as r,useRef as n,useState as i,useCallback as a}from"react";import{usePopper as s}from"react-popper";import l from"clsx";import u from"../node_modules/lodash/throttle.js";import{useMutationObserver as p}from"rooks";import c from"./Tooltip.module.css.js";var d={subtree:!0,childList:!0,attributes:!1,characterData:!1};function m(m){var f,v=m.id,b=m.wrapper,y=void 0===b?"span":b,h=m.mutationsListenerElement,w=m.popupClassName,E=m.placement,x=void 0===E?"auto":E,M=m.alwaysVisible,L=void 0!==M&&M,N=m.text,g=m.children,j=e(m,["id","wrapper","mutationsListenerElement","popupClassName","placement","alwaysVisible","text","children"]),_=r((function(){return"tooltip-".concat(v||Math.random().toString(36).substr(2,9))}),[v]),C=r((function(){return h||("undefined"!=typeof document&&"body"in document?document.body:null)}),[h]),V=n(null),k=n(null),B=n(C),D=i(L),F=D[0],S=D[1],T=i(),q=T[0],z=T[1],A=a((function(e){z(e)}),[]),G=r((function(){return[{name:"offset",options:{offset:[20,0]}},{name:"arrow",options:{padding:6}}]}),[]),H=s(null==k?void 0:k.current,q,{placement:x,modifiers:G,strategy:"fixed"}),I=H.styles,J=H.attributes,K=H.update,O=u((function(){var e;null===(e=null==K?void 0:K())||void 0===e||e.catch((function(e){console.error(e)}))}),250);p(B,O,d);var P=function(e){L||(S(!0),O())},Q=function(e){L||(S(!1),O())};return o.createElement(y,t({id:v,ref:k},j,{onFocus:P,onBlur:Q,onMouseEnter:P,onMouseMove:P,onMouseLeave:Q,"aria-describedby":_}),g,o.createElement("div",t({id:_,ref:A,className:l(w,c.tooltip,(f={"lds-only-aria":!F},f[c.visible]=F,f)),style:t({},I.popper)},J.popper),o.createElement("div",{"data-popper-arrow":!0,ref:V,className:c.caret,style:I.arrow}),N))}export{m as default};
1
+ import{__rest as e,__assign as t}from"../_virtual/_tslib.js";import o,{useMemo as r,useRef as n,useState as i,useCallback as a}from"react";import{usePopper as s}from"react-popper";import l from"clsx";import u from"../node_modules/lodash/throttle.js";import{useMutationObserver as p}from"rooks";import c from"./Tooltip.module.css.js";var d={subtree:!0,childList:!0,attributes:!1,characterData:!1};function m(m){var f,v=m.id,b=m.wrapper,y=void 0===b?"span":b,h=m.mutationsListenerElement,w=m.popupClassName,E=m.placement,x=void 0===E?"auto":E,M=m.alwaysVisible,L=void 0!==M&&M,N=m.text,g=m.children,j=e(m,["id","wrapper","mutationsListenerElement","popupClassName","placement","alwaysVisible","text","children"]),_=r(function(){return"tooltip-".concat(v||Math.random().toString(36).substr(2,9))},[v]),C=r(function(){return h||("undefined"!=typeof document&&"body"in document?document.body:null)},[h]),V=n(null),k=n(null),B=n(C),D=i(L),F=D[0],S=D[1],T=i(),q=T[0],z=T[1],A=a(function(e){z(e)},[]),G=r(function(){return[{name:"offset",options:{offset:[20,0]}},{name:"arrow",options:{padding:6}}]},[]),H=s(null==k?void 0:k.current,q,{placement:x,modifiers:G,strategy:"fixed"}),I=H.styles,J=H.attributes,K=H.update,O=u(function(){var e;null===(e=null==K?void 0:K())||void 0===e||e.catch(function(e){console.error(e)})},250);p(B,O,d);var P=function(e){L||(S(!0),O())},Q=function(e){L||(S(!1),O())};return o.createElement(y,t({id:v,ref:k},j,{onFocus:P,onBlur:Q,onMouseEnter:P,onMouseMove:P,onMouseLeave:Q,"aria-describedby":_}),g,o.createElement("div",t({id:_,ref:A,className:l(w,c.tooltip,(f={"lds-only-aria":!F},f[c.visible]=F,f)),style:t({},I.popper)},J.popper),o.createElement("div",{"data-popper-arrow":!0,ref:V,className:c.caret,style:I.arrow}),N))}export{m as default};
@@ -1,6 +1,7 @@
1
1
  import React, { ReactNode } from "react";
2
2
  import { type MenuItemGroup } from "./default-items";
3
3
  import type { MenuItem } from "./UserMenuItem";
4
+ /** Base props shared by default and custom UserMenu variants. */
4
5
  export interface BaseUserMenuProps {
5
6
  /**
6
7
  * Optional header to display in the User Menu.
@@ -23,21 +24,26 @@ export interface BaseUserMenuProps {
23
24
  */
24
25
  className?: string;
25
26
  /**
26
- * Origin of the menu item hrefs. Defaults to https://app.k8slens.dev
27
+ * Origin of the menu item hrefs.
28
+ * @default "https://app.k8slens.dev"
27
29
  */
28
30
  origin?: string;
31
+ /** Ref forwarded to the menu trigger button. */
29
32
  buttonRef?: React.MutableRefObject<HTMLButtonElement | null>;
30
33
  /**
31
- * Loading state of the User Menu. Defaults to false.
34
+ * Loading state of the User Menu.
35
+ * @default false
32
36
  */
33
37
  loading?: boolean;
34
38
  }
39
+ /** Props for UserMenu when using built-in default menu items. */
35
40
  export interface DefaultUserMenuProps extends BaseUserMenuProps {
36
41
  /**
37
42
  * Callback to call when the user clicks the Logout button. Required if using the default items.
38
43
  */
39
44
  onLogoutClick: MenuItem["onClick"];
40
45
  }
46
+ /** Props for UserMenu when providing custom menu items. */
41
47
  export interface CustomUserMenuProps extends BaseUserMenuProps {
42
48
  /**
43
49
  * Data to display in the User Menu
@@ -48,6 +54,7 @@ export interface CustomUserMenuProps extends BaseUserMenuProps {
48
54
  */
49
55
  onLogoutClick?: MenuItem["onClick"];
50
56
  }
57
+ /** Props for the UserMenu component (discriminated union of default and custom variants). */
51
58
  export declare type UserMenuProps = DefaultUserMenuProps | CustomUserMenuProps;
52
59
  /**
53
60
  * Displays user info with dropdown menu for account actions. Uses default menu items if `items` prop is not provided.
@@ -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,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
+ 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,5 +1,6 @@
1
1
  import React, { ReactNode, RefObject } from "react";
2
2
  import { MenuItemGroup } from "./default-items";
3
+ /** Props for the UserMenuDropdown component. */
3
4
  export interface UserMenuDropdownProps {
4
5
  /**
5
6
  * Optional header to display in the User Menu.
@@ -10,27 +11,30 @@ export interface UserMenuDropdownProps {
10
11
  */
11
12
  footer?: ReactNode;
12
13
  /**
13
- * Is the User Menu open
14
+ * Whether the User Menu dropdown is open.
14
15
  */
15
16
  open: boolean;
16
17
  /**
17
- * Data to display in the User Menu
18
+ * Menu item groups to display in the dropdown.
18
19
  */
19
20
  groups: Array<MenuItemGroup>;
20
21
  /**
21
- * Optional class name to apply to the User Menu button
22
+ * Optional class name to apply to the dropdown wrapper.
22
23
  */
23
24
  className?: string;
24
25
  /**
25
- * Origin of the menu item hrefs. Defaults to https://app.k8slens.dev
26
+ * Origin of the menu item hrefs.
27
+ * @default "https://app.k8slens.dev"
26
28
  */
27
29
  origin?: string;
28
30
  /**
29
- * Ref to the button that opens the dropdown
31
+ * Ref to the button that opens the dropdown, used for Popper positioning.
30
32
  */
31
33
  buttonRef?: RefObject<HTMLButtonElement>;
32
34
  }
33
35
  /**
34
- * UserMenuDropdown is a component that displays a dropdown menu of links. Uses Popper.js for positioning.
36
+ * Dropdown panel for the UserMenu that displays grouped menu items. Uses Popper.js for positioning.
37
+ *
38
+ * Usage: `import { UserMenuDropdown } from "@k8slens/lds"`
35
39
  */
36
40
  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,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
+ 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,22 +1,43 @@
1
1
  import React from "react";
2
2
  import type { MouseEvent } from "react";
3
3
  import { type Icon } from "@k8slens/lds-icons/lib/es/Icon/Icon";
4
+ /** Data shape for a single menu item in UserMenu. */
4
5
  export declare type MenuItem = {
6
+ /** Unique key for the menu item, used for identification (e.g. "logout"). */
5
7
  key?: string;
8
+ /**
9
+ * Visual style of the menu item.
10
+ * @default "default"
11
+ */
6
12
  type?: "default" | "danger";
13
+ /** Icon component rendered before the title. */
7
14
  icon?: Icon;
15
+ /** Display text of the menu item. */
8
16
  title: string;
17
+ /** Whether the menu item is disabled. */
9
18
  disabled?: boolean;
19
+ /** Whether the link opens in a new tab. */
10
20
  external?: boolean;
21
+ /** URL or path the menu item links to. */
11
22
  href?: string;
23
+ /** Click handler for the menu item. */
12
24
  onClick?: (e: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void;
13
25
  };
26
+ /** Props for the UserMenuItem component. */
14
27
  export interface UserMenuItemProps extends MenuItem {
28
+ /** Base URL prepended to relative `href` values. */
15
29
  origin?: string;
30
+ /** Whether the menu item is visually selected. */
16
31
  selected?: boolean;
17
32
  /**
18
- * Optional class name to apply to the avatar
33
+ * Optional class name to apply to the menu item.
19
34
  */
20
35
  className?: string;
21
36
  }
37
+ /**
38
+ * Individual menu item rendered within a UserMenuDropdown. Renders as a link, button, or disabled span
39
+ * depending on `href`, `onClick`, and `disabled` props.
40
+ *
41
+ * Usage: `import { UserMenuItem } from "@k8slens/lds"`
42
+ */
22
43
  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{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};
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};
@@ -1 +1 @@
1
- var r=function(){return r=Object.assign||function(r){for(var t,e=1,n=arguments.length;e<n;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o]);return r},r.apply(this,arguments)};function t(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(r);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(e[n[o]]=r[n[o]])}return e}export{r as __assign,t as __rest};
1
+ var r=function(){return r=Object.assign||function(r){for(var t,e=1,o=arguments.length;e<o;e++)for(var n in t=arguments[e])Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return r},r.apply(this,arguments)};function t(r,t){var e={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&t.indexOf(o)<0&&(e[o]=r[o]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(r);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(e[o[n]]=r[o[n]])}return e}"function"==typeof SuppressedError&&SuppressedError;export{r as __assign,t as __rest};
@@ -1 +1 @@
1
- import{_ as r}from"./_basePickBy.js";import{h as a}from"./hasIn.js";var n=r,o=a;var s=function(r,a){return n(r,a,(function(a,n){return o(r,n)}))};export{s as _};
1
+ import{_ as r}from"./_basePickBy.js";import{h as a}from"./hasIn.js";var n=r,o=a;var s=function(r,a){return n(r,a,function(a,n){return o(r,n)})};export{s as _};
@@ -1 +1 @@
1
- import{_ as r}from"./_Symbol.js";import{_ as i}from"./_arrayMap.js";import{i as o}from"./isArray.js";import{i as t}from"./isSymbol.js";var a=i,s=o,f=t,m=r?r.prototype:void 0,n=m?m.toString:void 0;var p=function r(i){if("string"==typeof i)return i;if(s(i))return a(i,r)+"";if(f(i))return n?n.call(i):"";var o=i+"";return"0"==o&&1/i==-Infinity?"-0":o};export{p as _};
1
+ import{_ as r}from"./_Symbol.js";import{_ as o}from"./_arrayMap.js";import{i}from"./isArray.js";import{i as t}from"./isSymbol.js";var a=o,s=i,m=t,f=r?r.prototype:void 0,p=f?f.toString:void 0;var n=function r(o){if("string"==typeof o)return o;if(s(o))return a(o,r)+"";if(m(o))return p?p.call(o):"";var i=o+"";return"0"==i&&1/o==-1/0?"-0":i};export{n as _};
@@ -1 +1 @@
1
- import{m as r}from"./memoize.js";var e=r;var a=function(r){var a=e(r,(function(r){return 500===n.size&&n.clear(),r})),n=a.cache;return a};export{a as _};
1
+ import{m as r}from"./memoize.js";var e=r;var a=function(r){var a=e(r,function(r){return 500===n.size&&n.clear(),r}),n=a.cache;return a};export{a as _};
@@ -1 +1 @@
1
- import{_ as e}from"./_memoizeCapped.js";var r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,p=e((function(e){var p=[];return 46===e.charCodeAt(0)&&p.push(""),e.replace(r,(function(e,r,o,t){p.push(o?t.replace(a,"$1"):r||e)})),p}));export{p as _};
1
+ import{_ as e}from"./_memoizeCapped.js";var r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,a=/\\(\\)?/g,p=e(function(e){var p=[];return 46===e.charCodeAt(0)&&p.push(""),e.replace(r,function(e,r,o,t){p.push(o?t.replace(a,"$1"):r||e)}),p});export{p as _};
@@ -1 +1 @@
1
- import{i as r}from"./isSymbol.js";var i=r;var t=function(r){if("string"==typeof r||i(r))return r;var t=r+"";return"0"==t&&1/r==-Infinity?"-0":t};export{t as _};
1
+ import{i as r}from"./isSymbol.js";var t=r;var i=function(r){if("string"==typeof r||t(r))return r;var i=r+"";return"0"==i&&1/r==-1/0?"-0":i};export{i as _};
@@ -1 +1 @@
1
- import{getDefaultExportFromCjs as r}from"../../_virtual/_commonjsHelpers.js";import{_ as o}from"./_basePick.js";import{_ as s}from"./_flatRest.js";var t=o,a=r(s((function(r,o){return null==r?{}:t(r,o)})));export{a as default};
1
+ import{getDefaultExportFromCjs as r}from"../../_virtual/_commonjsHelpers.js";import{_ as o}from"./_basePick.js";import{_ as s}from"./_flatRest.js";var t=o,a=r(s(function(r,o){return null==r?{}:t(r,o)}));export{a as default};
@@ -1 +1 @@
1
- import{getDefaultExportFromCjs as i}from"../../_virtual/_commonjsHelpers.js";import{d as r}from"./debounce.js";import{i as n}from"./isObject.js";var t=r,a=n;var e=i((function(i,r,n){var e=!0,o=!0;if("function"!=typeof i)throw new TypeError("Expected a function");return a(n)&&(e="leading"in n?!!n.leading:e,o="trailing"in n?!!n.trailing:o),t(i,r,{leading:e,maxWait:r,trailing:o})}));export{e as default};
1
+ import{getDefaultExportFromCjs as i}from"../../_virtual/_commonjsHelpers.js";import{d as r}from"./debounce.js";import{i as n}from"./isObject.js";var t=r,a=n;var e=i(function(i,r,n){var e=!0,o=!0;if("function"!=typeof i)throw new TypeError("Expected a function");return a(n)&&(e="leading"in n?!!n.leading:e,o="trailing"in n?!!n.trailing:o),t(i,r,{leading:e,maxWait:r,trailing:o})});export{e as default};