cozy-ui 122.3.0 → 122.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [122.5.0](https://github.com/cozy/cozy-ui/compare/v122.4.0...v122.5.0) (2025-04-14)
2
+
3
+
4
+ ### Features
5
+
6
+ * **Nav:** Spread classname on NavItem, NavText and NavIcon ([2396f11](https://github.com/cozy/cozy-ui/commit/2396f11))
7
+
8
+ # [122.4.0](https://github.com/cozy/cozy-ui/compare/v122.3.0...v122.4.0) (2025-04-11)
9
+
10
+
11
+ ### Features
12
+
13
+ * Add typing for IconButton, ListItemIcon, ListItemText & Switch ([2bd8ae5](https://github.com/cozy/cozy-ui/commit/2bd8ae5))
14
+
1
15
  # [122.3.0](https://github.com/cozy/cozy-ui/compare/v122.2.0...v122.3.0) (2025-04-10)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "122.3.0",
3
+ "version": "122.5.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -5,6 +5,16 @@ import React, { forwardRef } from 'react'
5
5
 
6
6
  const muiSupportedColors = ['default', 'inherit', 'primary', 'secondary']
7
7
 
8
+ /**
9
+ * @typedef {Object} IconButtonPropTypes
10
+ * @property {React.ReactNode} children - The content of the button, typically an icon.
11
+ * @property {'default' | 'inherit' | 'primary' | 'secondary' | 'error'} [color='default'] - The color of the button.
12
+ * @property {'small' | 'medium' | 'large' | 'xlarge'} [size='large'] - The size of the button.
13
+ */
14
+
15
+ /**
16
+ * @type React.ForwardRefRenderFunction<HTMLDivElement, IconButtonPropTypes & import('@material-ui/core/IconButton').IconButtonProps>
17
+ */
8
18
  const IconButton = forwardRef(
9
19
  ({ size = 'large', className, children, color, ...props }, ref) => {
10
20
  const selfColor = muiSupportedColors.includes(color) ? color : 'default'
@@ -7,6 +7,10 @@ export const mediumSize = 24
7
7
  export const largeSize = 32
8
8
 
9
9
  // We add a specific class to be able to override the style in makeOverride when used in an other component
10
+
11
+ /**
12
+ * @type React.ForwardRefRenderFunction<HTMLDivElement, import('@material-ui/core/ListItemIcon').ListItemIconProps>
13
+ */
10
14
  const ListItemIcon = forwardRef(({ className, ...props }, ref) => {
11
15
  return (
12
16
  <MuiListItemIcon
@@ -22,6 +22,9 @@ const getTypographyProp = (props, className, ellipsis) => {
22
22
  }
23
23
  }
24
24
 
25
+ /**
26
+ * @type React.ForwardRefRenderFunction<HTMLDivElement, import('@material-ui/core/ListItemText').ListItemTextProps>
27
+ */
25
28
  const ListItemText = forwardRef((props, ref) => {
26
29
  const {
27
30
  primaryText,
@@ -9,10 +9,11 @@ import TopIcon from '../Icons/Top'
9
9
  import useBreakpoints from '../providers/Breakpoints'
10
10
  import { useI18n } from '../providers/I18n'
11
11
 
12
- export const NavItem = ({ children, secondary, ...restProps }) => (
12
+ export const NavItem = ({ className, children, secondary, ...restProps }) => (
13
13
  <li
14
14
  className={cx(
15
15
  styles['c-nav-item'],
16
+ className,
16
17
  secondary ? styles['c-nav-item-secondary'] : null
17
18
  )}
18
19
  {...restProps}
@@ -21,8 +22,8 @@ export const NavItem = ({ children, secondary, ...restProps }) => (
21
22
  </li>
22
23
  )
23
24
 
24
- export const NavText = ({ children }) => (
25
- <span className={styles['c-nav-text']}>{children}</span>
25
+ export const NavText = ({ className, children }) => (
26
+ <span className={cx(styles['c-nav-text'], className)}>{children}</span>
26
27
  )
27
28
 
28
29
  export const NavLink = {
@@ -57,16 +58,16 @@ export const genNavLinkForV6 = RRNavLink =>
57
58
  />
58
59
  ))
59
60
 
60
- export const NavIcon = ({ icon }) => (
61
- <span className={cx(styles['c-nav-icon'])}>
61
+ export const NavIcon = ({ className, icon }) => (
62
+ <span className={cx(styles['c-nav-icon'], className)}>
62
63
  <Icon icon={icon} aria-hidden="true" focusable="false" />
63
64
  </span>
64
65
  )
65
66
 
66
- const Nav = ({ children }) => {
67
+ const Nav = ({ className, children }) => {
67
68
  return (
68
69
  <nav role="navigation">
69
- <ul className={styles['c-nav']}>{children}</ul>
70
+ <ul className={cx(styles['c-nav'], className)}>{children}</ul>
70
71
  </nav>
71
72
  )
72
73
  }
@@ -4,6 +4,9 @@ import React from 'react'
4
4
  import Icon from '../Icon'
5
5
  import { isTwakeTheme } from '../helpers/isTwakeTheme'
6
6
 
7
+ /**
8
+ * @type JSX.Element<HTMLDivElement, import('@material-ui/core/Switch').SwitchProps>
9
+ */
7
10
  const Switch = ({ icon, ...props }) => {
8
11
  const _icon = (
9
12
  <span className="cozySwitchThumb">
@@ -1,3 +1,46 @@
1
1
  export default IconButton;
2
- declare const IconButton: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
+ export type IconButtonPropTypes = {
3
+ /**
4
+ * - The content of the button, typically an icon.
5
+ */
6
+ children: React.ReactNode;
7
+ /**
8
+ * - The color of the button.
9
+ */
10
+ color?: "default" | "error" | "primary" | "secondary" | "inherit" | undefined;
11
+ /**
12
+ * - The size of the button.
13
+ */
14
+ size?: "small" | "large" | "medium" | "xlarge" | undefined;
15
+ };
16
+ /**
17
+ * @typedef {Object} IconButtonPropTypes
18
+ * @property {React.ReactNode} children - The content of the button, typically an icon.
19
+ * @property {'default' | 'inherit' | 'primary' | 'secondary' | 'error'} [color='default'] - The color of the button.
20
+ * @property {'small' | 'medium' | 'large' | 'xlarge'} [size='large'] - The size of the button.
21
+ */
22
+ /**
23
+ * @type React.ForwardRefRenderFunction<HTMLDivElement, IconButtonPropTypes & import('@material-ui/core/IconButton').IconButtonProps>
24
+ */
25
+ declare const IconButton: React.ForwardRefRenderFunction<HTMLDivElement, IconButtonPropTypes & {
26
+ color?: import("@material-ui/core").PropTypes.Color | undefined;
27
+ disableFocusRipple?: boolean | undefined;
28
+ edge?: false | "end" | "start" | undefined;
29
+ size?: "small" | "medium" | undefined;
30
+ } & {
31
+ action?: React.Ref<import("@material-ui/core").ButtonBaseActions> | undefined;
32
+ buttonRef?: React.Ref<unknown> | undefined;
33
+ centerRipple?: boolean | undefined;
34
+ children?: React.ReactNode;
35
+ disabled?: boolean | undefined;
36
+ disableRipple?: boolean | undefined;
37
+ disableTouchRipple?: boolean | undefined;
38
+ focusRipple?: boolean | undefined;
39
+ focusVisibleClassName?: string | undefined;
40
+ onFocusVisible?: React.FocusEventHandler<any> | undefined;
41
+ tabIndex?: string | number | undefined;
42
+ TouchRippleProps?: Partial<import("@material-ui/core/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
43
+ } & import("@material-ui/core/OverridableComponent").CommonProps<import("@material-ui/core/IconButton").IconButtonTypeMap<{}, "button">> & Pick<Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof React.ButtonHTMLAttributes<HTMLButtonElement>> & {
44
+ ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
45
+ }, "color" | "ref" | "form" | "title" | "children" | "disabled" | "aria-busy" | "aria-disabled" | "onClick" | "type" | "hidden" | "role" | "dir" | "slot" | "id" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "draggable" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "inputMode" | "is" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "name" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value">>;
3
46
  import React from "react";
@@ -6,6 +6,17 @@ import cx from 'classnames';
6
6
  import PropTypes from 'prop-types';
7
7
  import React, { forwardRef } from 'react';
8
8
  var muiSupportedColors = ['default', 'inherit', 'primary', 'secondary'];
9
+ /**
10
+ * @typedef {Object} IconButtonPropTypes
11
+ * @property {React.ReactNode} children - The content of the button, typically an icon.
12
+ * @property {'default' | 'inherit' | 'primary' | 'secondary' | 'error'} [color='default'] - The color of the button.
13
+ * @property {'small' | 'medium' | 'large' | 'xlarge'} [size='large'] - The size of the button.
14
+ */
15
+
16
+ /**
17
+ * @type React.ForwardRefRenderFunction<HTMLDivElement, IconButtonPropTypes & import('@material-ui/core/IconButton').IconButtonProps>
18
+ */
19
+
9
20
  var IconButton = /*#__PURE__*/forwardRef(function (_ref, ref) {
10
21
  var _ref$size = _ref.size,
11
22
  size = _ref$size === void 0 ? 'large' : _ref$size,
@@ -2,5 +2,7 @@ export const smallSize: 16;
2
2
  export const mediumSize: 24;
3
3
  export const largeSize: 32;
4
4
  export default ListItemIcon;
5
- declare const ListItemIcon: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
6
- import React from "react";
5
+ /**
6
+ * @type React.ForwardRefRenderFunction<HTMLDivElement, import('@material-ui/core/ListItemIcon').ListItemIconProps>
7
+ */
8
+ declare const ListItemIcon: React.ForwardRefRenderFunction<HTMLDivElement, import("@material-ui/core/ListItemIcon").ListItemIconProps>;
@@ -8,6 +8,10 @@ export var smallSize = 16;
8
8
  export var mediumSize = 24;
9
9
  export var largeSize = 32; // We add a specific class to be able to override the style in makeOverride when used in an other component
10
10
 
11
+ /**
12
+ * @type React.ForwardRefRenderFunction<HTMLDivElement, import('@material-ui/core/ListItemIcon').ListItemIconProps>
13
+ */
14
+
11
15
  var ListItemIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
12
16
  var className = _ref.className,
13
17
  props = _objectWithoutProperties(_ref, _excluded);
@@ -1,3 +1,5 @@
1
1
  export default ListItemText;
2
- declare const ListItemText: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
- import React from "react";
2
+ /**
3
+ * @type React.ForwardRefRenderFunction<HTMLDivElement, import('@material-ui/core/ListItemText').ListItemTextProps>
4
+ */
5
+ declare const ListItemText: React.ForwardRefRenderFunction<HTMLDivElement, import("@material-ui/core/ListItemText").ListItemTextProps<"span", "p">>;
@@ -26,6 +26,10 @@ var getTypographyProp = function getTypographyProp(props, className, ellipsis) {
26
26
  }
27
27
  }, props);
28
28
  };
29
+ /**
30
+ * @type React.ForwardRefRenderFunction<HTMLDivElement, import('@material-ui/core/ListItemText').ListItemTextProps>
31
+ */
32
+
29
33
 
30
34
  var ListItemText = /*#__PURE__*/forwardRef(function (props, ref) {
31
35
  var primaryText = props.primaryText,
@@ -1,9 +1,11 @@
1
- export function NavItem({ children, secondary, ...restProps }: {
1
+ export function NavItem({ className, children, secondary, ...restProps }: {
2
2
  [x: string]: any;
3
+ className: any;
3
4
  children: any;
4
5
  secondary: any;
5
6
  }): JSX.Element;
6
- export function NavText({ children }: {
7
+ export function NavText({ className, children }: {
8
+ className: any;
7
9
  children: any;
8
10
  }): JSX.Element;
9
11
  export namespace NavLink {
@@ -16,13 +18,15 @@ export function genNavLink(RRNavLink: any): ({ to, children, ...rest }: {
16
18
  children: any;
17
19
  }) => JSX.Element;
18
20
  export function genNavLinkForV6(RRNavLink: any): React.ForwardRefExoticComponent<React.RefAttributes<any>>;
19
- export function NavIcon({ icon }: {
21
+ export function NavIcon({ className, icon }: {
22
+ className: any;
20
23
  icon: any;
21
24
  }): JSX.Element;
22
25
  export const NavDesktopLimiter: any;
23
26
  export default Nav;
24
27
  import React from "react";
25
- declare function Nav({ children }: {
28
+ declare function Nav({ className, children }: {
29
+ className: any;
26
30
  children: any;
27
31
  }): JSX.Element;
28
32
  declare namespace Nav {
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["children", "secondary"],
4
+ var _excluded = ["className", "children", "secondary"],
5
5
  _excluded2 = ["to", "children"];
6
6
  import cx from 'classnames';
7
7
  import React, { Children, isValidElement, useState, forwardRef } from 'react';
@@ -22,18 +22,20 @@ import TopIcon from "cozy-ui/transpiled/react/Icons/Top";
22
22
  import useBreakpoints from "cozy-ui/transpiled/react/providers/Breakpoints";
23
23
  import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
24
24
  export var NavItem = function NavItem(_ref) {
25
- var children = _ref.children,
25
+ var className = _ref.className,
26
+ children = _ref.children,
26
27
  secondary = _ref.secondary,
27
28
  restProps = _objectWithoutProperties(_ref, _excluded);
28
29
 
29
30
  return /*#__PURE__*/React.createElement("li", _extends({
30
- className: cx(styles['c-nav-item'], secondary ? styles['c-nav-item-secondary'] : null)
31
+ className: cx(styles['c-nav-item'], className, secondary ? styles['c-nav-item-secondary'] : null)
31
32
  }, restProps), children);
32
33
  };
33
34
  export var NavText = function NavText(_ref2) {
34
- var children = _ref2.children;
35
+ var className = _ref2.className,
36
+ children = _ref2.children;
35
37
  return /*#__PURE__*/React.createElement("span", {
36
- className: styles['c-nav-text']
38
+ className: cx(styles['c-nav-text'], className)
37
39
  }, children);
38
40
  };
39
41
  export var NavLink = {
@@ -67,9 +69,10 @@ export var genNavLinkForV6 = function genNavLinkForV6(RRNavLink) {
67
69
  });
68
70
  };
69
71
  export var NavIcon = function NavIcon(_ref5) {
70
- var icon = _ref5.icon;
72
+ var className = _ref5.className,
73
+ icon = _ref5.icon;
71
74
  return /*#__PURE__*/React.createElement("span", {
72
- className: cx(styles['c-nav-icon'])
75
+ className: cx(styles['c-nav-icon'], className)
73
76
  }, /*#__PURE__*/React.createElement(Icon, {
74
77
  icon: icon,
75
78
  "aria-hidden": "true",
@@ -78,11 +81,12 @@ export var NavIcon = function NavIcon(_ref5) {
78
81
  };
79
82
 
80
83
  var Nav = function Nav(_ref6) {
81
- var children = _ref6.children;
84
+ var className = _ref6.className,
85
+ children = _ref6.children;
82
86
  return /*#__PURE__*/React.createElement("nav", {
83
87
  role: "navigation"
84
88
  }, /*#__PURE__*/React.createElement("ul", {
85
- className: styles['c-nav']
89
+ className: cx(styles['c-nav'], className)
86
90
  }, children));
87
91
  };
88
92
  /**
@@ -1,5 +1,5 @@
1
1
  export default Switch;
2
- declare function Switch({ icon, ...props }: {
3
- [x: string]: any;
4
- icon: any;
5
- }): JSX.Element;
2
+ /**
3
+ * @type JSX.Element<HTMLDivElement, import('@material-ui/core/Switch').SwitchProps>
4
+ */
5
+ declare const Switch: any;
@@ -5,6 +5,9 @@ import MuiSwitch from '@material-ui/core/Switch';
5
5
  import React from 'react';
6
6
  import Icon from "cozy-ui/transpiled/react/Icon";
7
7
  import { isTwakeTheme } from "cozy-ui/transpiled/react/helpers/isTwakeTheme";
8
+ /**
9
+ * @type JSX.Element<HTMLDivElement, import('@material-ui/core/Switch').SwitchProps>
10
+ */
8
11
 
9
12
  var Switch = function Switch(_ref) {
10
13
  var icon = _ref.icon,