cozy-ui 122.3.0 → 122.4.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,10 @@
1
+ # [122.4.0](https://github.com/cozy/cozy-ui/compare/v122.3.0...v122.4.0) (2025-04-11)
2
+
3
+
4
+ ### Features
5
+
6
+ * Add typing for IconButton, ListItemIcon, ListItemText & Switch ([2bd8ae5](https://github.com/cozy/cozy-ui/commit/2bd8ae5))
7
+
1
8
  # [122.3.0](https://github.com/cozy/cozy-ui/compare/v122.2.0...v122.3.0) (2025-04-10)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "122.3.0",
3
+ "version": "122.4.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,
@@ -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,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,