@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
@@ -1 +1 @@
1
- "use strict";var e=require("../_virtual/_tslib.js"),t=require("react"),r=require("react-popper"),o=require("clsx"),n=require("../node_modules/lodash/throttle.js"),a=require("rooks"),s=require("./Tooltip.module.css.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=u(t),l=u(o),d={subtree:!0,childList:!0,attributes:!1,characterData:!1};module.exports=function(o){var u,c=o.id,p=o.wrapper,f=void 0===p?"span":p,m=o.mutationsListenerElement,v=o.popupClassName,b=o.placement,y=void 0===b?"auto":b,_=o.alwaysVisible,M=void 0!==_&&_,h=o.text,q=o.children,w=e.__rest(o,["id","wrapper","mutationsListenerElement","popupClassName","placement","alwaysVisible","text","children"]),g=t.useMemo((function(){return"tooltip-".concat(c||Math.random().toString(36).substr(2,9))}),[c]),E=t.useMemo((function(){return m||("undefined"!=typeof document&&"body"in document?document.body:null)}),[m]),x=t.useRef(null),j=t.useRef(null),L=t.useRef(E),N=t.useState(M),C=N[0],R=N[1],S=t.useState(),k=S[0],V=S[1],B=t.useCallback((function(e){V(e)}),[]),D=t.useMemo((function(){return[{name:"offset",options:{offset:[20,0]}},{name:"arrow",options:{padding:6}}]}),[]),F=r.usePopper(null==j?void 0:j.current,k,{placement:y,modifiers:D,strategy:"fixed"}),O=F.styles,P=F.attributes,T=F.update,z=n((function(){var e;null===(e=null==T?void 0:T())||void 0===e||e.catch((function(e){console.error(e)}))}),250);a.useMutationObserver(L,z,d);var A=function(e){M||(R(!0),z())},G=function(e){M||(R(!1),z())};return i.default.createElement(f,e.__assign({id:c,ref:j},w,{onFocus:A,onBlur:G,onMouseEnter:A,onMouseMove:A,onMouseLeave:G,"aria-describedby":g}),q,i.default.createElement("div",e.__assign({id:g,ref:B,className:l.default(v,s.tooltip,(u={"lds-only-aria":!C},u[s.visible]=C,u)),style:e.__assign({},O.popper)},P.popper),i.default.createElement("div",{"data-popper-arrow":!0,ref:x,className:s.caret,style:O.arrow}),h))};
1
+ "use strict";var e=require("../_virtual/_tslib.js"),t=require("react"),r=require("react-popper"),o=require("clsx"),n=require("../node_modules/lodash/throttle.js"),a=require("rooks"),s=require("./Tooltip.module.css.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=u(t),l=u(o),d={subtree:!0,childList:!0,attributes:!1,characterData:!1};module.exports=function(o){var u,c=o.id,p=o.wrapper,f=void 0===p?"span":p,m=o.mutationsListenerElement,v=o.popupClassName,b=o.placement,y=void 0===b?"auto":b,_=o.alwaysVisible,M=void 0!==_&&_,h=o.text,q=o.children,w=e.__rest(o,["id","wrapper","mutationsListenerElement","popupClassName","placement","alwaysVisible","text","children"]),g=t.useMemo(function(){return"tooltip-".concat(c||Math.random().toString(36).substr(2,9))},[c]),E=t.useMemo(function(){return m||("undefined"!=typeof document&&"body"in document?document.body:null)},[m]),x=t.useRef(null),j=t.useRef(null),L=t.useRef(E),N=t.useState(M),C=N[0],R=N[1],S=t.useState(),k=S[0],V=S[1],B=t.useCallback(function(e){V(e)},[]),D=t.useMemo(function(){return[{name:"offset",options:{offset:[20,0]}},{name:"arrow",options:{padding:6}}]},[]),F=r.usePopper(null==j?void 0:j.current,k,{placement:y,modifiers:D,strategy:"fixed"}),O=F.styles,P=F.attributes,T=F.update,z=n(function(){var e;null===(e=null==T?void 0:T())||void 0===e||e.catch(function(e){console.error(e)})},250);a.useMutationObserver(L,z,d);var A=function(e){M||(R(!0),z())},G=function(e){M||(R(!1),z())};return i.default.createElement(f,e.__assign({id:c,ref:j},w,{onFocus:A,onBlur:G,onMouseEnter:A,onMouseMove:A,onMouseLeave:G,"aria-describedby":g}),q,i.default.createElement("div",e.__assign({id:g,ref:B,className:l.default(v,s.tooltip,(u={"lds-only-aria":!C},u[s.visible]=C,u)),style:e.__assign({},O.popper)},P.popper),i.default.createElement("div",{"data-popper-arrow":!0,ref:x,className:s.caret,style:O.arrow}),h))};
@@ -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
- "use strict";var e=require("../_virtual/_tslib.js"),t=require("react"),r=require("clsx"),n=require("@headlessui/react"),a=require("@k8slens/lds-icons"),o=require("../ProfileBlock/ProfileBlock.js"),u=require("./default-items.js"),l=require("./UserMenuDropdown.js"),i=require("./UserMenu.module.css.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(t),d=s(r),f=a.navigation.ArrowDownIcon,m=a.navigation.ArrowUpIcon;module.exports=function(r){var a=r.user,s=r.header,g=r.footer,p=r.origin,v=void 0===p?u.defaultOrigin:p,b=r.className,q=r.onLogoutClick,k=r.loading,_=e.__rest(r,["user","header","footer","origin","className","onLogoutClick","loading"]),E=t.useRef(null),M=_.buttonRef?_.buttonRef:E,N=t.useMemo((function(){return("items"in _?_.items:u.defaultItems).map((function(t){return{children:t.children.map((function(t){return"logout"===t.key?e.__assign(e.__assign({},t),{onClick:q}):t}))}}))}),[_,q]),h=t.useMemo((function(){return{avatar:a.avatar,avatarTitle:a.name,title:"@".concat(a.username),subtitle:a.name}}),[a]);return c.default.createElement(n.Menu,null,(function(e){var t,r=e.open;return c.default.createElement("div",{className:d.default(i.userMenu,b)},c.default.createElement(n.MenuButton,{className:d.default(i.button,(t={},t[i.open]=r,t[i.disabled]=k,t)),ref:M,disabled:k},c.default.createElement(o,{item:h,loading:k,className:i.profileBlock}),r?c.default.createElement(m,{className:i.dropDownIcon}):c.default.createElement(f,{className:i.dropDownIcon})),c.default.createElement(l,{open:r,header:s,footer:g,origin:v,groups:N,buttonRef:M}))}))};
1
+ "use strict";var e=require("../_virtual/_tslib.js"),t=require("react"),r=require("clsx"),n=require("@headlessui/react"),a=require("@k8slens/lds-icons"),o=require("../ProfileBlock/ProfileBlock.js"),u=require("./default-items.js"),l=require("./UserMenuDropdown.js"),i=require("./UserMenu.module.css.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=s(t),d=s(r),f=a.navigation.ArrowDownIcon,m=a.navigation.ArrowUpIcon;module.exports=function(r){var a=r.user,s=r.header,g=r.footer,p=r.origin,v=void 0===p?u.defaultOrigin:p,b=r.className,q=r.onLogoutClick,k=r.loading,_=e.__rest(r,["user","header","footer","origin","className","onLogoutClick","loading"]),E=t.useRef(null),M=_.buttonRef?_.buttonRef:E,N=t.useMemo(function(){return("items"in _?_.items:u.defaultItems).map(function(t){return{children:t.children.map(function(t){return"logout"===t.key?e.__assign(e.__assign({},t),{onClick:q}):t})}})},[_,q]),h=t.useMemo(function(){return{avatar:a.avatar,avatarTitle:a.name,title:"@".concat(a.username),subtitle:a.name}},[a]);return c.default.createElement(n.Menu,null,function(e){var t,r=e.open;return c.default.createElement("div",{className:d.default(i.userMenu,b)},c.default.createElement(n.MenuButton,{className:d.default(i.button,(t={},t[i.open]=r,t[i.disabled]=k,t)),ref:M,disabled:k},c.default.createElement(o,{item:h,loading:k,className:i.profileBlock}),r?c.default.createElement(m,{className:i.dropDownIcon}):c.default.createElement(f,{className:i.dropDownIcon})),c.default.createElement(l,{open:r,header:s,footer:g,origin:v,groups:N,buttonRef:M}))})};
@@ -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
- "use strict";var e=require("../_virtual/_tslib.js"),t=require("react"),n=require("@headlessui/react"),o=require("react-popper"),r=require("clsx"),i=require("../node_modules/@k8slens/lds-tokens/lib/web/tokens.base.js"),a=require("../helpers.js"),s=require("./UserMenuItem.js"),l=require("./UserMenuDropdown.module.css.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(t),p=u(r),d=a.convertRemToPixels(i.SpacingLg),m={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 n=t.state;if(void 0!==d&&"undefined"!=typeof window&&"undefined"!=typeof document){var o=n.elements.reference.getBoundingClientRect(),r=document.documentElement,i=n.placement.endsWith("start")?Math.min(r.clientWidth,window.innerWidth)-o.left-d:o.right-d,a=n.placement.startsWith("bottom")?Math.min(r.clientHeight,window.innerHeight)-o.bottom-d:o.top-d;n.styles.popper=e.__assign(e.__assign({},n.styles.popper),{maxWidth:"".concat(i,"px"),maxHeight:"".concat(a,"px")})}}};module.exports=function(r){var a,u,d=r.header,v=r.footer,h=r.origin,g=r.className,y=r.groups,b=r.open,_=r.buttonRef,w=t.useRef(null),k=o.usePopper(null==_?void 0:_.current,null==w?void 0:w.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}},m,f]}),x=k.styles,q=k.attributes;return c.default.createElement(n.Transition,e.__assign({show:b,enter:"transition duration-[".concat(i.TransitionDurationDefault,"] ease-in-out"),enterFrom:"transform opacity-0",enterTo:"transform opacity-100",leave:"transition duration-[".concat(i.TransitionDurationDefault,"] ease-in-out"),leaveFrom:"transform opacity-100",leaveTo:"transform opacity-0",as:"div",className:p.default(l.userMenuDropdown,g),ref:w,style:e.__assign(e.__assign({},x.popper),{minWidth:null===(u=null==_?void 0:_.current)||void 0===u?void 0:u.offsetWidth})},q.popper),c.default.createElement(n.MenuItems,{className:p.default(l.content,(a={},a[l.open]=b,a))},d,y.map((function(e,t){var n,o=e.children;return c.default.createElement("div",{className:p.default(l.group,(n={},n[l.last]=t===y.length-1,n)),key:"group-".concat(t),role:"navigation"},o.map((function(e,t){return c.default.createElement(s,{key:"key"in e?e.key:"item-".concat(t),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:h})})))})),v))};
1
+ "use strict";var e=require("../_virtual/_tslib.js"),t=require("react"),n=require("@headlessui/react"),o=require("react-popper"),r=require("clsx"),i=require("../node_modules/@k8slens/lds-tokens/lib/web/tokens.base.js"),a=require("../helpers.js"),s=require("./UserMenuItem.js"),l=require("./UserMenuDropdown.module.css.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(t),p=u(r),d=a.convertRemToPixels(i.SpacingLg),m={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 n=t.state;if(void 0!==d&&"undefined"!=typeof window&&"undefined"!=typeof document){var o=n.elements.reference.getBoundingClientRect(),r=document.documentElement,i=n.placement.endsWith("start")?Math.min(r.clientWidth,window.innerWidth)-o.left-d:o.right-d,a=n.placement.startsWith("bottom")?Math.min(r.clientHeight,window.innerHeight)-o.bottom-d:o.top-d;n.styles.popper=e.__assign(e.__assign({},n.styles.popper),{maxWidth:"".concat(i,"px"),maxHeight:"".concat(a,"px")})}}};module.exports=function(r){var a,u,d=r.header,v=r.footer,h=r.origin,g=r.className,y=r.groups,b=r.open,_=r.buttonRef,w=t.useRef(null),k=o.usePopper(null==_?void 0:_.current,null==w?void 0:w.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}},m,f]}),x=k.styles,q=k.attributes;return c.default.createElement(n.Transition,e.__assign({show:b,enter:"transition duration-[".concat(i.TransitionDurationDefault,"] ease-in-out"),enterFrom:"transform opacity-0",enterTo:"transform opacity-100",leave:"transition duration-[".concat(i.TransitionDurationDefault,"] ease-in-out"),leaveFrom:"transform opacity-100",leaveTo:"transform opacity-0",as:"div",className:p.default(l.userMenuDropdown,g),ref:w,style:e.__assign(e.__assign({},x.popper),{minWidth:null===(u=null==_?void 0:_.current)||void 0===u?void 0:u.offsetWidth})},q.popper),c.default.createElement(n.MenuItems,{className:p.default(l.content,(a={},a[l.open]=b,a))},d,y.map(function(e,t){var n,o=e.children;return c.default.createElement("div",{className:p.default(l.group,(n={},n[l.last]=t===y.length-1,n)),key:"group-".concat(t),role:"navigation"},o.map(function(e,t){return c.default.createElement(s,{key:"key"in e?e.key:"item-".concat(t),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:h})}))}),v))};
@@ -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
- "use strict";var e=require("../_virtual/_tslib.js"),t=require("react"),n=require("@headlessui/react"),l=require("clsx"),a=require("./UserMenuItem.module.css.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=r(t),c=r(l),i=function(e,t){return new URL(e,t).pathname},o=function(e){var t=e.Icon,n=e.title;return u.default.createElement(u.default.Fragment,null,t?u.default.createElement(t,{className:a.icon,size:"sm"}):null,u.default.createElement("span",{className:a.title},n))};module.exports=function(l){var r=l.type,d=void 0===r?"default":r,s=l.title,f=l.icon,m=l.disabled,E=l.external,b=l.onClick,p=l.selected,v=l.href,w=l.origin,I=l.className,M=t.useMemo((function(){return E||!v?v:w?"".concat(w).concat((null==v?void 0:v.startsWith("/"))?v:"/".concat(v)):v}),[v,w,E]),h=t.useMemo((function(){return"boolean"==typeof p?p:!(!M||"undefined"==typeof window)&&i(window.location.href,"undefined"!=typeof window?window.location.origin:void 0)===i(M,M)}),[M,p]),N=t.useMemo((function(){var e;return c.default(a.userMenuItem,((e={})[a[d]]=d&&"default"!==d,e[a.disabled]=m,e[a.external]=E,e[a.selected]=h,e),I)}),[d,m,E,I,h]);return m||p||!M?m||p||!b?u.default.createElement(n.MenuItem,{disabled:!0},u.default.createElement("span",{className:c.default(N,a.disabled)},u.default.createElement(o,{Icon:f,title:s}))):u.default.createElement(n.MenuItem,null,u.default.createElement("button",{className:c.default(a.button,N),onClick:b},u.default.createElement(o,{Icon:f,title:s}))):u.default.createElement(n.MenuItem,null,u.default.createElement("a",e.__assign({className:N,onClick:b,href:M},E?{target:"_blank"}:{},{rel:"noopener noreferrer"}),u.default.createElement(o,{Icon:f,title:s})))};
1
+ "use strict";var e=require("../_virtual/_tslib.js"),t=require("react"),n=require("@headlessui/react"),l=require("clsx"),a=require("./UserMenuItem.module.css.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=r(t),c=r(l),i=function(e,t){return new URL(e,t).pathname},o=function(e){var t=e.Icon,n=e.title;return u.default.createElement(u.default.Fragment,null,t?u.default.createElement(t,{className:a.icon,size:"sm"}):null,u.default.createElement("span",{className:a.title},n))};module.exports=function(l){var r=l.type,d=void 0===r?"default":r,s=l.title,f=l.icon,m=l.disabled,E=l.external,b=l.onClick,p=l.selected,v=l.href,w=l.origin,I=l.className,M=t.useMemo(function(){return E||!v?v:w?"".concat(w).concat((null==v?void 0:v.startsWith("/"))?v:"/".concat(v)):v},[v,w,E]),h=t.useMemo(function(){return"boolean"==typeof p?p:!(!M||"undefined"==typeof window)&&i(window.location.href,"undefined"!=typeof window?window.location.origin:void 0)===i(M,M)},[M,p]),N=t.useMemo(function(){var e;return c.default(a.userMenuItem,((e={})[a[d]]=d&&"default"!==d,e[a.disabled]=m,e[a.external]=E,e[a.selected]=h,e),I)},[d,m,E,I,h]);return m||p||!M?m||p||!b?u.default.createElement(n.MenuItem,{disabled:!0},u.default.createElement("span",{className:c.default(N,a.disabled)},u.default.createElement(o,{Icon:f,title:s}))):u.default.createElement(n.MenuItem,null,u.default.createElement("button",{className:c.default(a.button,N),onClick:b},u.default.createElement(o,{Icon:f,title:s}))):u.default.createElement(n.MenuItem,null,u.default.createElement("a",e.__assign({className:N,onClick:b,href:M},E?{target:"_blank"}:{},{rel:"noopener noreferrer"}),u.default.createElement(o,{Icon:f,title:s})))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.__assign=function(){return exports.__assign=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},exports.__assign.apply(this,arguments)},exports.__rest=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.__assign=function(){return exports.__assign=Object.assign||function(r){for(var e,t=1,o=arguments.length;t<o;t++)for(var n in e=arguments[t])Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r},exports.__assign.apply(this,arguments)},"function"==typeof SuppressedError&&SuppressedError,exports.__rest=function(r,e){var t={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&e.indexOf(o)<0&&(t[o]=r[o]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(r);n<o.length;n++)e.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(r,o[n])&&(t[o[n]]=r[o[n]])}return t};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./_basePickBy.js"),r=require("./hasIn.js"),s=e._basePickBy,t=r.hasIn_1;var i=function(e,r){return s(e,r,(function(r,s){return t(e,s)}))};exports._basePick=i;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./_basePickBy.js"),r=require("./hasIn.js"),s=e._basePickBy,t=r.hasIn_1;var i=function(e,r){return s(e,r,function(r,s){return t(e,s)})};exports._basePick=i;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("./_Symbol.js"),e=require("./_arrayMap.js"),i=require("./isArray.js"),t=require("./isSymbol.js"),o=r._Symbol,s=e._arrayMap,a=i.isArray_1,n=t.isSymbol_1,u=o?o.prototype:void 0,y=u?u.toString:void 0;var _=function r(e){if("string"==typeof e)return e;if(a(e))return s(e,r)+"";if(n(e))return y?y.call(e):"";var i=e+"";return"0"==i&&1/e==-Infinity?"-0":i};exports._baseToString=_;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("./_Symbol.js"),e=require("./_arrayMap.js"),i=require("./isArray.js"),t=require("./isSymbol.js"),o=r._Symbol,s=e._arrayMap,a=i.isArray_1,u=t.isSymbol_1,y=o?o.prototype:void 0,n=y?y.toString:void 0;var _=function r(e){if("string"==typeof e)return e;if(a(e))return s(e,r)+"";if(u(e))return n?n.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i};exports._baseToString=_;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./memoize.js").memoize_1;var r=function(r){var t=e(r,(function(e){return 500===i.size&&i.clear(),e})),i=t.cache;return t};exports._memoizeCapped=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./memoize.js").memoize_1;var r=function(r){var t=e(r,function(e){return 500===i.size&&i.clear(),e}),i=t.cache;return t};exports._memoizeCapped=r;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./_memoizeCapped.js")._memoizeCapped,r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,p=e((function(e){var p=[];return 46===e.charCodeAt(0)&&p.push(""),e.replace(r,(function(e,r,o,a){p.push(o?a.replace(t,"$1"):r||e)})),p}));exports._stringToPath=p;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./_memoizeCapped.js")._memoizeCapped,r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,p=e(function(e){var p=[];return 46===e.charCodeAt(0)&&p.push(""),e.replace(r,function(e,r,o,a){p.push(o?a.replace(t,"$1"):r||e)}),p});exports._stringToPath=p;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./isSymbol.js").isSymbol_1;var r=function(r){if("string"==typeof r||e(r))return r;var t=r+"";return"0"==t&&1/r==-Infinity?"-0":t};exports._toKey=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./isSymbol.js").isSymbol_1;var r=function(r){if("string"==typeof r||e(r))return r;var t=r+"";return"0"==t&&1/r==-1/0?"-0":t};exports._toKey=r;
@@ -1 +1 @@
1
- "use strict";var e=require("../../_virtual/_commonjsHelpers.js"),r=require("./_basePick.js"),s=require("./_flatRest.js"),t=r._basePick,u=(0,s._flatRest)((function(e,r){return null==e?{}:t(e,r)})),i=e.getDefaultExportFromCjs(u);module.exports=i;
1
+ "use strict";var e=require("../../_virtual/_commonjsHelpers.js"),r=require("./_basePick.js"),s=require("./_flatRest.js"),t=r._basePick,u=(0,s._flatRest)(function(e,r){return null==e?{}:t(e,r)}),i=e.getDefaultExportFromCjs(u);module.exports=i;
@@ -1,5 +1,6 @@
1
1
  import React, { type HTMLAttributes } from "react";
2
2
  import { type Icon } from "@k8slens/lds-icons/lib/es/Icon/Icon";
3
+ /** Props for the Avatar component. */
3
4
  export interface AvatarProps extends Pick<HTMLAttributes<HTMLDivElement>, "aria-hidden" | "aria-label"> {
4
5
  /**
5
6
  * Full name of the user. Initials will be generated from this value and shown if no image is provided.
@@ -14,7 +15,8 @@ export interface AvatarProps extends Pick<HTMLAttributes<HTMLDivElement>, "aria-
14
15
  */
15
16
  image?: string | Icon | null;
16
17
  /**
17
- * Size of the avatar. Defaults to "md"
18
+ * Size of the avatar.
19
+ * @default "md"
18
20
  */
19
21
  size?: "sm" | "md" | "xl";
20
22
  }
@@ -1 +1 @@
1
- import{__rest as r}from"../_virtual/_tslib.js";import e,{useState as a,useMemo as t}from"react";import o from"clsx";import n from"initialism";import i from"randomcolor";import l from"./Avatar.module.css.js";function m(m){var s,c=m.name,u=m.className,d=m.image,f=m.size,p=void 0===f?"md":f,v=r(m,["name","className","image","size"]),g=a(void 0),b=g[0],x=g[1],y=t((function(){return n(c,2)}),[c]),E=t((function(){switch(typeof d){case"string":return{backgroundColor:"var(--color-background-avatar)"};case"function":return{};default:return{backgroundColor:i({seed:c,luminosity:"dark"})}}}),[c,d]);return e.createElement("div",{className:o(l.avatar,u,(s={},s[l[p]]="md"!==p,s[l.error]=b,s)),style:E,title:c,"aria-label":"aria-label"in v?v["aria-label"]:c},d&&"string"==typeof d&&e.createElement("img",{src:d,alt:y,role:"presentation","aria-hidden":!0,onLoad:function(){return x(!1)},onError:function(){return x(!0)}}),d&&"function"==typeof d&&e.createElement(d,{size:"xxl",color:"accent"}),!d&&e.createElement("span",{className:l.avatarText,role:"presentation","aria-hidden":!0},y))}export{m as default};
1
+ import{__rest as r}from"../_virtual/_tslib.js";import e,{useState as a,useMemo as t}from"react";import o from"clsx";import n from"initialism";import i from"randomcolor";import l from"./Avatar.module.css.js";function m(m){var s,c=m.name,u=m.className,d=m.image,f=m.size,p=void 0===f?"md":f,v=r(m,["name","className","image","size"]),g=a(void 0),b=g[0],x=g[1],y=t(function(){return n(c,2)},[c]),E=t(function(){switch(typeof d){case"string":return{backgroundColor:"var(--color-background-avatar)"};case"function":return{};default:return{backgroundColor:i({seed:c,luminosity:"dark"})}}},[c,d]);return e.createElement("div",{className:o(l.avatar,u,(s={},s[l[p]]="md"!==p,s[l.error]=b,s)),style:E,title:c,"aria-label":"aria-label"in v?v["aria-label"]:c},d&&"string"==typeof d&&e.createElement("img",{src:d,alt:y,role:"presentation","aria-hidden":!0,onLoad:function(){return x(!1)},onError:function(){return x(!0)}}),d&&"function"==typeof d&&e.createElement(d,{size:"xxl",color:"accent"}),!d&&e.createElement("span",{className:l.avatarText,role:"presentation","aria-hidden":!0},y))}export{m as default};
@@ -1,16 +1,18 @@
1
1
  import React, { HTMLAttributes } from "react";
2
+ /** Props for the Badge component. */
2
3
  export interface BadgeProps extends Pick<HTMLAttributes<HTMLSpanElement>, "id" | "className" | "title" | "aria-label" | "aria-hidden" | "role"> {
3
4
  /**
4
- * If no title has not been provided, the badge will be hidden from screen readers.
5
+ * If no title is provided, the badge will be hidden from screen readers.
5
6
  */
6
7
  title?: string;
7
8
  /**
8
- * Defines the color of the lozenge.
9
- * @default secondary
9
+ * Defines the color of the badge.
10
+ * @default "secondary"
10
11
  */
11
12
  type?: "primary" | "secondary" | "success" | "error" | "warning";
12
13
  /**
13
- * @default sm
14
+ * Size of the badge.
15
+ * @default "sm"
14
16
  */
15
17
  size?: "sm" | "md" | "lg";
16
18
  }
@@ -1,41 +1,65 @@
1
1
  import React, { ButtonHTMLAttributes, ReactNode } from "react";
2
2
  import { Props } from "./shared";
3
+ /** Props for the Button component. */
3
4
  export interface ButtonProps extends Props, Pick<ButtonHTMLAttributes<HTMLButtonElement>, "id" | "className" | "aria-label" | "title"> {
5
+ /**
6
+ * The HTML `type` attribute for the underlying `<button>` element.
7
+ * @default "button"
8
+ */
4
9
  buttonType?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
5
10
  /**
6
- * Specify the the initial value of the button element, used when the button is inside a form.
11
+ * Specify the initial value of the button element, used when the button is inside a form.
7
12
  */
8
13
  buttonValue?: ButtonHTMLAttributes<HTMLButtonElement>["value"];
9
14
  /**
10
- * Specify the the name of the button element, used when the button is inside a form.
15
+ * Specify the name of the button element, used when the button is inside a form.
11
16
  */
12
17
  buttonName?: ButtonHTMLAttributes<HTMLButtonElement>["name"];
18
+ /**
19
+ * Whether to show the loading activity indicator.
20
+ * @default false
21
+ */
13
22
  loading?: boolean;
14
23
  /**
15
- * When set to true true, if the onClick callback returns a promise,
24
+ * When set to true, if the onClick callback returns a promise,
16
25
  * loading activity indicator will be shown until the promise has been resolved/rejected.
26
+ * @default false
17
27
  */
18
28
  loadingStateOnPromise?: boolean;
29
+ /** Click handler. May return a promise when used with `loadingStateOnPromise`. */
19
30
  onClick?(e: React.MouseEvent<HTMLButtonElement, MouseEvent>): Promise<unknown> | unknown;
20
31
  }
32
+ /** Props for the Button component when `label` is a ReactNode (requires explicit `aria-label`). */
21
33
  export interface ButtonPropsWithLabelNode extends Omit<Props, "label">, Pick<ButtonHTMLAttributes<HTMLButtonElement>, "id" | "className" | "title"> {
34
+ /**
35
+ * The HTML `type` attribute for the underlying `<button>` element.
36
+ * @default "button"
37
+ */
22
38
  buttonType?: ButtonHTMLAttributes<HTMLButtonElement>["type"];
23
39
  /**
24
- * Specify the the initial value of the button element, used when the button is inside a form.
40
+ * Specify the initial value of the button element, used when the button is inside a form.
25
41
  */
26
42
  buttonValue?: ButtonHTMLAttributes<HTMLButtonElement>["value"];
27
43
  /**
28
- * Specify the the name of the button element, used when the button is inside a form.
44
+ * Specify the name of the button element, used when the button is inside a form.
29
45
  */
30
46
  buttonName?: ButtonHTMLAttributes<HTMLButtonElement>["name"];
47
+ /**
48
+ * Whether to show the loading activity indicator.
49
+ * @default false
50
+ */
31
51
  loading?: boolean;
32
52
  /**
33
- * When set to true true, if the onClick callback returns a promise,
53
+ * When set to true, if the onClick callback returns a promise,
34
54
  * loading activity indicator will be shown until the promise has been resolved/rejected.
55
+ * @default false
35
56
  */
36
57
  loadingStateOnPromise?: boolean;
58
+ /** Required accessible label when `label` is a ReactNode. */
37
59
  "aria-label": string;
60
+ /** Button label content, accepts ReactNode. */
38
61
  label: ReactNode;
62
+ /** Click handler. May return a promise when used with `loadingStateOnPromise`. */
39
63
  onClick?(e: React.MouseEvent<HTMLButtonElement, MouseEvent>): Promise<unknown> | unknown;
40
64
  }
41
65
  /**
@@ -44,6 +68,10 @@ export interface ButtonPropsWithLabelNode extends Omit<Props, "label">, Pick<But
44
68
  * from `onClick` will show a loading indicator until the promise has been resolved/rejected.
45
69
  *
46
70
  * Usage: `import { Button } from "@k8slens/lds"`
71
+ *
72
+ * ```tsx
73
+ * <Button label="Save" type="primary" onClick={handleSave} />
74
+ * ```
47
75
  */
48
76
  declare const Button: React.ForwardRefExoticComponent<(ButtonProps | ButtonPropsWithLabelNode) & React.RefAttributes<HTMLButtonElement>>;
49
77
  export default Button;
@@ -1 +1 @@
1
- import e,{forwardRef as t,useRef as a,useEffect as n,useState as i,useCallback as o}from"react";import r from"clsx";import l from"./Button.module.css.js";var c=t((function(t,c){var s,d=t.label,u=t.primary,m=t.discreet,p=t.case,f=t.textTransform,v=t.disabled,b=void 0!==v&&v,y=t.loading,N=void 0!==y&&y,E=t.className,g=t["aria-label"],h=t.id,x=t.type,z=void 0===x?"default":x,T=t.size,j=void 0===T?"md":T,k=t.buttonType,B=void 0===k?"button":k,C=t.buttonValue,O=t.buttonName,P=t.icon,V=t.iconPosition,w=void 0===V?"left":V,D=t.loadingStateOnPromise,L=void 0!==D&&D,S=t.onClick,U=t.title,_=t.children,q=z,A=a(!0);n((function(){return A.current=!0,function(){A.current=!1}}),[]);var F=i(!1),G=F[0],H=F[1],I=N||G,J=o((function(e){if("function"==typeof S&&!I){var t,a=S(e);L&&("object"==typeof(t=a)&&null!==t&&"then"in t&&"function"==typeof t.then)&&(H(!0),a.finally((function(){A.current&&H(!1)})))}}),[S,I,L]);u&&(q="primary");var K=f;return p&&(K=K||p,"development"===process.env.NODE_ENV&&console.warn("Button: `case` prop is deprecated. Use `textTransform` instead.")),e.createElement("button",{ref:c,id:h,type:B,value:C,name:O,onClick:J,className:r(l.button,E,q,(s={},s[l.uppercase]="uppercase"===K,s[l.capitalize]="capitalize"===K,s[l.discreet]=m,s[l.loading]=I,s[l[j]]="md"!==j,s)),"aria-label":g||("string"==typeof d?d:""),disabled:b||G,title:U},P&&"left"===w&&e.createElement(P,{className:l.icon}),e.createElement("span",{className:l.label},d),_,P&&"right"===w&&e.createElement(P,{className:l.icon}),I&&e.createElement("span",{className:"lds-only-aria","aria-live":"polite","aria-busy":"true"}," ","Loading"))}));export{c as default};
1
+ import e,{forwardRef as t,useRef as a,useEffect as n,useState as i,useCallback as o}from"react";import r from"clsx";import l from"./Button.module.css.js";var c=t(function(t,c){var s,d=t.label,u=t.primary,m=t.discreet,p=t.case,f=t.textTransform,v=t.disabled,b=void 0!==v&&v,y=t.loading,N=void 0!==y&&y,E=t.className,g=t["aria-label"],h=t.id,x=t.type,z=void 0===x?"default":x,T=t.size,j=void 0===T?"md":T,k=t.buttonType,B=void 0===k?"button":k,C=t.buttonValue,O=t.buttonName,P=t.icon,V=t.iconPosition,w=void 0===V?"left":V,D=t.loadingStateOnPromise,L=void 0!==D&&D,S=t.onClick,U=t.title,_=t.children,q=z,A=a(!0);n(function(){return A.current=!0,function(){A.current=!1}},[]);var F=i(!1),G=F[0],H=F[1],I=N||G,J=o(function(e){if("function"==typeof S&&!I){var t,a=S(e);L&&("object"==typeof(t=a)&&null!==t&&"then"in t&&"function"==typeof t.then)&&(H(!0),a.finally(function(){A.current&&H(!1)}))}},[S,I,L]);u&&(q="primary");var K=f;return p&&(K=K||p,"development"===process.env.NODE_ENV&&console.warn("Button: `case` prop is deprecated. Use `textTransform` instead.")),e.createElement("button",{ref:c,id:h,type:B,value:C,name:O,onClick:J,className:r(l.button,E,q,(s={},s[l.uppercase]="uppercase"===K,s[l.capitalize]="capitalize"===K,s[l.discreet]=m,s[l.loading]=I,s[l[j]]="md"!==j,s)),"aria-label":g||("string"==typeof d?d:""),disabled:b||G,title:U},P&&"left"===w&&e.createElement(P,{className:l.icon}),e.createElement("span",{className:l.label},d),_,P&&"right"===w&&e.createElement(P,{className:l.icon}),I&&e.createElement("span",{className:"lds-only-aria","aria-live":"polite","aria-busy":"true"}," ","Loading"))});export{c as default};
@@ -4,17 +4,46 @@ export declare type Type = "default" | "primary" | "ok" | "danger" | "caution";
4
4
  export declare type Size = "xxs" | "xs" | "sm" | "md";
5
5
  export declare type IconPosition = "right" | "left";
6
6
  export declare type TextTransform = "uppercase" | "capitalize";
7
+ /** Shared props for the Button component variants. */
7
8
  export interface Props {
9
+ /** Text label rendered inside the button. */
8
10
  label: string;
11
+ /** Icon component rendered alongside the label. */
9
12
  icon?: Icon;
13
+ /**
14
+ * Which side of the label the icon is rendered on.
15
+ * @default "left"
16
+ */
10
17
  iconPosition?: IconPosition;
18
+ /**
19
+ * Visual style variant of the button.
20
+ * @default "default"
21
+ */
11
22
  type?: Type;
23
+ /**
24
+ * Size of the button.
25
+ * @default "md"
26
+ */
12
27
  size?: Size;
28
+ /**
29
+ * Shorthand for `type="primary"`.
30
+ * @deprecated Use `type="primary"` instead.
31
+ */
13
32
  primary?: boolean;
33
+ /**
34
+ * Whether the button is disabled.
35
+ * @default false
36
+ */
14
37
  disabled?: boolean;
38
+ /** Whether the button uses the discreet (low-emphasis) style. */
15
39
  discreet?: boolean;
16
- /** @deprecated Use `case: "textTransform"` instead */
40
+ /**
41
+ * Text transform applied to the label.
42
+ * @deprecated Use `textTransform` instead.
43
+ */
17
44
  case?: TextTransform;
45
+ /** Text transform applied to the label. */
18
46
  textTransform?: TextTransform;
47
+ /** Additional content rendered after the label. */
19
48
  children?: React.ReactNode;
20
49
  }
@@ -3,15 +3,32 @@ declare type ExtractIntrinsicElementProps<Element extends keyof JSX.IntrinsicEle
3
3
  declare type ExtractComponentProps<TComponentOrTProps> = TComponentOrTProps extends React.ComponentType<infer TProps> ? TProps : TComponentOrTProps;
4
4
  declare type ExtractProps<TComponentOrTProps> = TComponentOrTProps extends keyof JSX.IntrinsicElements ? ExtractIntrinsicElementProps<TComponentOrTProps> : ExtractComponentProps<TComponentOrTProps>;
5
5
  export declare type Type = "default" | "centered" | "stacked" | "grid";
6
+ /** Props for the ButtonBar component. */
6
7
  export declare type ButtonBarProps<ElementType extends JSX.IntrinsicElements | React.ElementType<any>> = Partial<Omit<ExtractProps<ElementType>, "children" | "as" | "type" | "gridSize">> & {
8
+ /**
9
+ * Element or component to render as the container.
10
+ * @default "div"
11
+ */
7
12
  as?: keyof JSX.IntrinsicElements | React.ElementType<any> | undefined;
13
+ /**
14
+ * Layout type for the button arrangement.
15
+ * @default "default"
16
+ */
8
17
  type?: Type;
18
+ /** Override the grid column count (only used when `type` is `"grid"`). */
9
19
  gridSize?: Number;
10
20
  };
11
21
  /**
12
22
  * A container for buttons. Set `type` prop to change the layout of the buttons.
13
23
  *
14
24
  * Usage: `import { ButtonBar } from "@k8slens/lds"`
25
+ *
26
+ * ```tsx
27
+ * <ButtonBar>
28
+ * <Button label="Cancel" />
29
+ * <Button label="Save" type="primary" />
30
+ * </ButtonBar>
31
+ * ```
15
32
  */
16
33
  declare function ButtonBar<ElementType extends JSX.IntrinsicElements | React.ElementType<any>>({ as: Component, type, gridSize, children, ...props }: PropsWithChildren<ButtonBarProps<ElementType>>): React.JSX.Element;
17
34
  export default ButtonBar;
@@ -1 +1 @@
1
- import{__rest as r,__assign as t}from"../_virtual/_tslib.js";import e,{useMemo as i,Children as o,isValidElement as a}from"react";import n from"clsx";import d from"./ButtonBar.module.css.js";function l(l){var u,c=l.as,m=void 0===c?"div":c,s=l.type,f=void 0===s?"default":s,p=l.gridSize,g=l.children,v=r(l,["as","type","gridSize","children"]),b=i((function(){return"number"==typeof p?p:o.toArray(g).filter((function(r){return a(r)})).length}),[p,g]);return e.createElement(m,t({},v,{className:n(d.buttonBar,v.className||"",(u={},u[d[f]]="default"!==f&&"grid"!==f,u[d.bGrid]="grid"===f,u[d["grid-".concat(b)]]="grid"===f,u))}),g)}export{l as default};
1
+ import{__rest as r,__assign as t}from"../_virtual/_tslib.js";import e,{useMemo as i,Children as o,isValidElement as a}from"react";import n from"clsx";import d from"./ButtonBar.module.css.js";function l(l){var u,c=l.as,m=void 0===c?"div":c,s=l.type,f=void 0===s?"default":s,p=l.gridSize,g=l.children,v=r(l,["as","type","gridSize","children"]),b=i(function(){return"number"==typeof p?p:o.toArray(g).filter(function(r){return a(r)}).length},[p,g]);return e.createElement(m,t({},v,{className:n(d.buttonBar,v.className||"",(u={},u[d[f]]="default"!==f&&"grid"!==f,u[d.bGrid]="grid"===f,u[d["grid-".concat(b)]]="grid"===f,u))}),g)}export{l as default};
@@ -1,7 +1,14 @@
1
1
  import React from "react";
2
+ /** Props for the Checkbox component. */
2
3
  export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "onChange" | "value" | "disabled"> {
4
+ /** Whether the checkbox is checked. */
3
5
  value: boolean;
6
+ /** Change handler receiving the new value and the original event. */
4
7
  onChange(value: boolean, evt: React.ChangeEvent<HTMLInputElement>): void;
8
+ /**
9
+ * Whether the checkbox is disabled.
10
+ * @default false
11
+ */
5
12
  disabled?: boolean;
6
13
  }
7
14
  /**
@@ -1,15 +1,31 @@
1
1
  import React, { type ReactNode } from "react";
2
2
  import { type ButtonProps } from "../Button/Button";
3
3
  declare type AllowedButtonProps = Pick<ButtonProps, "type" | "size" | "discreet" | "icon" | "iconPosition" | "textTransform">;
4
+ /** Props for the ConfirmDialog component. */
4
5
  export declare type ConfirmDialogProps = {
6
+ /** Title displayed in the confirm dialog header. */
5
7
  title: string;
8
+ /** Optional message body rendered below the title. */
6
9
  message?: string | ReactNode;
10
+ /**
11
+ * Label for the confirm button.
12
+ * @default "Ok"
13
+ */
7
14
  confirmText?: string;
15
+ /**
16
+ * Label for the cancel button.
17
+ * @default "Cancel"
18
+ */
8
19
  cancelLabel?: string;
20
+ /** Additional Button props forwarded to the confirm button. */
9
21
  confirmButtonProps?: Partial<AllowedButtonProps>;
22
+ /** Additional Button props forwarded to the cancel button. */
10
23
  cancelButtonProps?: Partial<AllowedButtonProps>;
24
+ /** Called when the dialog is dismissed (overlay click or escape key). */
11
25
  handleClose: () => void;
26
+ /** Called when the user clicks the confirm button. */
12
27
  handleConfirm: () => void;
28
+ /** Called when the user clicks the cancel button. */
13
29
  handleCancel: () => void;
14
30
  };
15
31
  /**
@@ -1 +1 @@
1
- import{__assign as e}from"../_virtual/_tslib.js";import n,{useState as o,useCallback as t,useMemo as l}from"react";import r from"clsx";import i from"../Button/Button.js";import a from"../Modal/Modal.js";import m from"./ConfirmDialog.module.css.js";var c={size:"md",isOpen:!0,buttonBarProps:{type:"grid",gridSize:3}},s=function(o){var t,l=o.title,s=o.message,u=o.confirmText,f=void 0===u?"Ok":u,d=o.cancelLabel,p=void 0===d?"Cancel":d,C=o.confirmButtonProps,g=o.cancelButtonProps,v=o.handleClose,h=o.handleConfirm,B=o.handleCancel;return n.createElement(a,e({className:r(m.confirmDialog,(t={},t[m.withoutMessage]=!Boolean(s),t))},c,{title:l,onClose:function(){return v()},footer:n.createElement(n.Fragment,null,n.createElement(i,e({label:p,loadingStateOnPromise:!0,onClick:B},g)),n.createElement("span",null),n.createElement(i,e({label:f,type:"primary",loadingStateOnPromise:!0,onClick:h},C)))}),s)},u=function(){var r=o(null),i=r[0],a=r[1],m=o(""),c=m[0],u=m[1],f=o({}),d=f[0],p=f[1],C=o(""),g=C[0],v=C[1],h=o(!1),B=h[0],E=h[1],P=t((function(e,n,o){return void 0===o&&(o={}),E(!0),u(e),v(n||""),p(o),new Promise((function(e){a({resolve:e})}))}),[a,E]),b=t((function(){a(null),E(!1),u(""),v(""),p({})}),[a,E,v,u,p]);return{ConfirmDialog:l((function(){return B?n.createElement(s,e({title:c,message:g,handleClose:b,handleConfirm:function(){null==i||i.resolve(!0),b()},handleCancel:function(){null==i||i.resolve(!1),b()}},d)):null}),[B,c,g,i,d,b]),confirm:P}};export{s as default,u as useConfirmDialog};
1
+ import{__assign as e}from"../_virtual/_tslib.js";import n,{useState as o,useCallback as t,useMemo as l}from"react";import r from"clsx";import i from"../Button/Button.js";import a from"../Modal/Modal.js";import m from"./ConfirmDialog.module.css.js";var c={size:"md",isOpen:!0,buttonBarProps:{type:"grid",gridSize:3}},s=function(o){var t,l=o.title,s=o.message,u=o.confirmText,f=void 0===u?"Ok":u,d=o.cancelLabel,p=void 0===d?"Cancel":d,C=o.confirmButtonProps,g=o.cancelButtonProps,v=o.handleClose,h=o.handleConfirm,B=o.handleCancel;return n.createElement(a,e({className:r(m.confirmDialog,(t={},t[m.withoutMessage]=!Boolean(s),t))},c,{title:l,onClose:function(){return v()},footer:n.createElement(n.Fragment,null,n.createElement(i,e({label:p,loadingStateOnPromise:!0,onClick:B},g)),n.createElement("span",null),n.createElement(i,e({label:f,type:"primary",loadingStateOnPromise:!0,onClick:h},C)))}),s)},u=function(){var r=o(null),i=r[0],a=r[1],m=o(""),c=m[0],u=m[1],f=o({}),d=f[0],p=f[1],C=o(""),g=C[0],v=C[1],h=o(!1),B=h[0],E=h[1],P=t(function(e,n,o){return void 0===o&&(o={}),E(!0),u(e),v(n||""),p(o),new Promise(function(e){a({resolve:e})})},[a,E]),b=t(function(){a(null),E(!1),u(""),v(""),p({})},[a,E,v,u,p]);return{ConfirmDialog:l(function(){return B?n.createElement(s,e({title:c,message:g,handleClose:b,handleConfirm:function(){null==i||i.resolve(!0),b()},handleCancel:function(){null==i||i.resolve(!1),b()}},d)):null},[B,c,g,i,d,b]),confirm:P}};export{s as default,u as useConfirmDialog};
@@ -1 +1 @@
1
- import{__rest as e,__assign as t}from"../_virtual/_tslib.js";import r from"react";import o from"clsx";import{Menu as a,MenuButton as i,MenuItems as l}from"@headlessui/react";import{navigation as n}from"@k8slens/lds-icons";import s from"./ContextMenuItem.js";import m from"./ContextMenu.module.css.js";var c=n.ContextMenuIcon,d=Object.assign((function(n){var s,d=n.children,u=n.icon,f=n.position,p=void 0===f?"right":f,b=n.disabled,x=void 0!==b&&b,v=n.className,E=e(n,["children","icon","position","disabled","className"]),N=u||c;return r.createElement("div",t({},E,{className:o(m.contextMenu,v)}),r.createElement(a,null,r.createElement(i,{className:m.trigger,disabled:x,"aria-label":E["aria-label"]||"Context menu"},r.createElement(N,null)),r.createElement(l,{transition:!0,className:o(m.dropdown,(s={},s[m.left]="left"===p,s))},d)))}),{Item:s});export{d as default};
1
+ import{__rest as e,__assign as t}from"../_virtual/_tslib.js";import r from"react";import o from"clsx";import{Menu as a,MenuButton as i,MenuItems as l}from"@headlessui/react";import{navigation as n}from"@k8slens/lds-icons";import s from"./ContextMenuItem.js";import m from"./ContextMenu.module.css.js";var c=n.ContextMenuIcon,d=Object.assign(function(n){var s,d=n.children,u=n.icon,f=n.position,p=void 0===f?"right":f,b=n.disabled,x=void 0!==b&&b,v=n.className,E=e(n,["children","icon","position","disabled","className"]),N=u||c;return r.createElement("div",t({},E,{className:o(m.contextMenu,v)}),r.createElement(a,null,r.createElement(i,{className:m.trigger,disabled:x,"aria-label":E["aria-label"]||"Context menu"},r.createElement(N,null)),r.createElement(l,{transition:!0,className:o(m.dropdown,(s={},s[m.left]="left"===p,s))},d)))},{Item:s});export{d as default};
@@ -1,10 +1,30 @@
1
1
  import React, { PropsWithChildren } from "react";
2
+ /** Props for the DrawerTransition component. */
2
3
  export interface DrawerTransitionProps extends React.HTMLAttributes<HTMLDivElement> {
4
+ /** Whether the drawer is open. */
3
5
  open: boolean;
6
+ /**
7
+ * Transition duration in milliseconds.
8
+ * @default 250
9
+ */
4
10
  duration?: number;
11
+ /** Callback fired after the enter transition completes. */
5
12
  afterEnter?: () => void;
13
+ /** Callback fired after the exit transition completes. */
6
14
  afterExit?: () => void;
15
+ /** Changes in dependencies trigger re-calculation of the drawer dimensions. */
7
16
  deps?: object;
8
17
  }
18
+ /**
19
+ * An animated drawer that expands and collapses content with a height transition.
20
+ *
21
+ * Usage: `import { DrawerTransition } from "@k8slens/lds"`
22
+ *
23
+ * ```tsx
24
+ * <DrawerTransition open={isOpen}>
25
+ * <p>Collapsible content here</p>
26
+ * </DrawerTransition>
27
+ * ```
28
+ */
9
29
  declare const DrawerTransition: React.FC<PropsWithChildren<DrawerTransitionProps>>;
10
30
  export default DrawerTransition;
@@ -1 +1 @@
1
- import{__rest as e,__assign as t}from"../_virtual/_tslib.js";import n,{useRef as i,useState as r,useMemo as o,useCallback as a,useEffect as c}from"react";import u from"clsx";var d=function(d){var f=d.open,s=d.deps,l=void 0===s?{}:s,m=d.duration,v=void 0===m?250:m,p=d.afterEnter,x=d.afterExit,g=d.children,h=e(d,["open","deps","duration","afterEnter","afterExit","children"]),E=i(null),T=r(null),w=T[0],y=T[1],z=r(f?"entered":"exited"),L=z[0],N=z[1],_=r(f?"auto":""),b=_[0],j=_[1],D=o((function(){return{transitionDuration:"entered"===L?void 0:"".concat(v,"ms"),transitionTimingFunction:"entered"===L?void 0:"ease-in-out",height:"entering"===L||"entered"===L?b:"0px",opacity:"entering"===L||"entered"===L?1:0}}),[v,L,b]),F=a((function(){E.current&&j("".concat(E.current.clientHeight,"px"))}),[E]),H=a((function(){return N("entering"),setTimeout((function(){try{N("entered"),p&&p()}catch(e){}}),v)}),[v,p]),k=a((function(){return N("exiting"),setTimeout((function(){try{N("exited"),x&&x()}catch(e){}}),v)}),[v,x]);return c((function(){!f||"exited"!==L&&"exiting"!==L?f||"entering"!==L&&"entered"!==L||(w&&clearTimeout(w),y(k())):(w&&clearTimeout(w),y(H()))}),[f,L,H,k]),c((function(){return window.addEventListener("resize",F),function(){window.removeEventListener("resize",F)}}),[F]),c((function(){var e;return e=setTimeout((function(){F(),e=void 0}),10),function(){e&&clearTimeout(e)}}),[E,F,l]),n.createElement("div",t({"aria-hidden":!f},h,{style:D,className:u("transition-all overflow-y-hidden",h.className)}),n.createElement("div",{ref:E},g))};export{d as default};
1
+ import{__rest as e,__assign as t}from"../_virtual/_tslib.js";import n,{useRef as i,useState as r,useMemo as o,useCallback as a,useEffect as c}from"react";import u from"clsx";var d=function(d){var f=d.open,s=d.deps,l=void 0===s?{}:s,m=d.duration,v=void 0===m?250:m,p=d.afterEnter,x=d.afterExit,g=d.children,h=e(d,["open","deps","duration","afterEnter","afterExit","children"]),E=i(null),T=r(null),w=T[0],y=T[1],z=r(f?"entered":"exited"),L=z[0],N=z[1],_=r(f?"auto":""),b=_[0],j=_[1],D=o(function(){return{transitionDuration:"entered"===L?void 0:"".concat(v,"ms"),transitionTimingFunction:"entered"===L?void 0:"ease-in-out",height:"entering"===L||"entered"===L?b:"0px",opacity:"entering"===L||"entered"===L?1:0}},[v,L,b]),F=a(function(){E.current&&j("".concat(E.current.clientHeight,"px"))},[E]),H=a(function(){return N("entering"),setTimeout(function(){try{N("entered"),p&&p()}catch(e){}},v)},[v,p]),k=a(function(){return N("exiting"),setTimeout(function(){try{N("exited"),x&&x()}catch(e){}},v)},[v,x]);return c(function(){!f||"exited"!==L&&"exiting"!==L?f||"entering"!==L&&"entered"!==L||(w&&clearTimeout(w),y(k())):(w&&clearTimeout(w),y(H()))},[f,L,H,k]),c(function(){return window.addEventListener("resize",F),function(){window.removeEventListener("resize",F)}},[F]),c(function(){var e;return e=setTimeout(function(){F(),e=void 0},10),function(){e&&clearTimeout(e)}},[E,F,l]),n.createElement("div",t({"aria-hidden":!f},h,{style:D,className:u("transition-all overflow-y-hidden",h.className)}),n.createElement("div",{ref:E},g))};export{d as default};
@@ -1,15 +1,23 @@
1
1
  import React, { HTMLInputTypeAttribute } from "react";
2
2
  import { type Icon } from "@k8slens/lds-icons/lib/es/Icon/Icon";
3
3
  export declare type InputType = Exclude<HTMLInputTypeAttribute, "button" | "checkbox" | "radio" | "number">;
4
+ /** Props for the Input component. */
4
5
  export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> {
6
+ /** Icon component displayed on the right side of the input. */
5
7
  icon?: Icon;
8
+ /** HTML input type (excludes button, checkbox, radio, number). */
6
9
  type?: InputType;
10
+ /** Props forwarded to the wrapping `div` element. */
7
11
  wrapperProps?: React.HTMLAttributes<HTMLDivElement>;
8
12
  }
9
13
  /**
10
14
  * A simple input component. Set `icon` prop to show an icon on the right side of the input.
11
15
  *
12
16
  * Usage: `import { Input } from "@k8slens/lds"`
17
+ *
18
+ * ```tsx
19
+ * <Input placeholder="Enter text" onChange={handleChange} />
20
+ * ```
13
21
  */
14
22
  declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
15
23
  export default Input;
@@ -1 +1 @@
1
- import{__rest as r,__assign as e}from"../_virtual/_tslib.js";import a,{forwardRef as t}from"react";import o from"clsx";import s from"./Input.module.css.js";var l=t((function(t,l){var m,c=t.icon,i=t.wrapperProps,p=r(t,["icon","wrapperProps"]);return a.createElement("div",e({},i,{className:o(s.wrapper,null==i?void 0:i.className,(m={},m[s.withIcon]=c,m))}),a.createElement("input",e({ref:l},p,{className:o(s.input,(null==p?void 0:p.className)||"")})),c&&a.createElement(c,{className:s.icon}))}));export{l as default};
1
+ import{__rest as r,__assign as e}from"../_virtual/_tslib.js";import a,{forwardRef as t}from"react";import o from"clsx";import s from"./Input.module.css.js";var l=t(function(t,l){var m,c=t.icon,i=t.wrapperProps,p=r(t,["icon","wrapperProps"]);return a.createElement("div",e({},i,{className:o(s.wrapper,null==i?void 0:i.className,(m={},m[s.withIcon]=c,m))}),a.createElement("input",e({ref:l},p,{className:o(s.input,(null==p?void 0:p.className)||"")})),c&&a.createElement(c,{className:s.icon}))});export{l as default};