@synerise/ds-inline-edit 0.9.8 → 0.10.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
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.10.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-inline-edit@0.9.8...@synerise/ds-inline-edit@0.10.0) (2025-01-29)
7
+
8
+
9
+ ### Features
10
+
11
+ * antd@4.24 react@18 ([d97a667](https://github.com/Synerise/synerise-design/commit/d97a667b1f33aed3177e1851de3b6f60be2d46a6))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [0.9.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-inline-edit@0.9.7...@synerise/ds-inline-edit@0.9.8) (2025-01-21)
7
18
 
8
19
  **Note:** Version bump only for package @synerise/ds-inline-edit
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import { InlineEditProps } from './InlineEdit.types';
3
- declare const InlineEdit: ({ className, style, size, disabled, autoFocus, hideIcon, tooltipTitle, error, input, }: InlineEditProps) => React.JSX.Element;
3
+ declare const InlineEdit: ({ className, style, size, disabled, autoFocus, hideIcon, customIcon, tooltipTitle, error, input, }: InlineEditProps) => React.JSX.Element;
4
4
  export default InlineEdit;
@@ -1,8 +1,10 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
1
2
  import React, { useCallback, useRef, useState, useEffect } from 'react';
2
3
  import Tooltip from '@synerise/ds-tooltip';
3
4
  import Icon, { EditS } from '@synerise/ds-icon';
4
5
  import { toCamelCase } from '@synerise/ds-utils';
5
6
  import { AutosizeInput } from '@synerise/ds-input';
7
+ import { theme } from '@synerise/ds-core';
6
8
  import * as S from './InlineEdit.styles';
7
9
  var InlineEdit = function InlineEdit(_ref) {
8
10
  var className = _ref.className,
@@ -12,6 +14,7 @@ var InlineEdit = function InlineEdit(_ref) {
12
14
  disabled = _ref.disabled,
13
15
  autoFocus = _ref.autoFocus,
14
16
  hideIcon = _ref.hideIcon,
17
+ customIcon = _ref.customIcon,
15
18
  tooltipTitle = _ref.tooltipTitle,
16
19
  error = _ref.error,
17
20
  input = _ref.input;
@@ -63,32 +66,29 @@ var InlineEdit = function InlineEdit(_ref) {
63
66
  placeholder: input.placeholder,
64
67
  placeholderIsMinWidth: false,
65
68
  wrapperClassName: "autosize-input"
66
- }, /*#__PURE__*/React.createElement("input", {
67
- itemRef: "",
69
+ }, /*#__PURE__*/React.createElement("input", _extends({
68
70
  onScroll: handleScroll,
69
- id: input.name ? toCamelCase(input.name) : 'id',
71
+ id: input.name ? toCamelCase(input.name) : 'id'
72
+ }, input, {
70
73
  className: "autosize-input",
71
74
  "data-testid": "inline-edit-autosize-input",
72
- placeholder: input.placeholder,
73
- maxLength: input.maxLength,
74
75
  onKeyPress: handleKeyPress,
75
76
  disabled: disabled,
76
- name: input.name,
77
77
  onChange: handleChange,
78
78
  onBlur: handleBlur,
79
- readOnly: input.readOnly,
80
79
  value: input.value || '',
81
- autoComplete: input.autoComplete,
82
80
  ref: inputRef
83
- })), !hideIcon && /*#__PURE__*/React.createElement(Tooltip, {
81
+ }))), !hideIcon && /*#__PURE__*/React.createElement(Tooltip, {
84
82
  "data-testid": "inline-edit-icon",
85
83
  title: tooltipTitle
86
84
  }, /*#__PURE__*/React.createElement(S.IconWrapper, {
85
+ customIcon: Boolean(customIcon),
87
86
  disabled: disabled,
88
87
  onClick: handleFocusInput,
89
88
  size: size
90
89
  }, /*#__PURE__*/React.createElement(Icon, {
91
- component: /*#__PURE__*/React.createElement(EditS, null),
90
+ color: theme.palette["grey-600"],
91
+ component: customIcon || /*#__PURE__*/React.createElement(EditS, null),
92
92
  size: 24
93
93
  }))));
94
94
  };
@@ -10,6 +10,7 @@ export declare const FontStyleWatcher: import("styled-components").StyledCompone
10
10
  export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {
11
11
  size: string;
12
12
  disabled?: boolean | undefined;
13
+ customIcon?: boolean | undefined;
13
14
  } & ThemeProps, never>;
14
15
  export declare const InPlaceEditableInputContainer: import("styled-components").StyledComponent<"div", any, InPlaceEditableInputContainerProps, never>;
15
16
  export {};
@@ -28,18 +28,20 @@ export var FontStyleWatcher = styled.div.withConfig({
28
28
  export var IconWrapper = styled.div.withConfig({
29
29
  displayName: "InlineEditstyles__IconWrapper",
30
30
  componentId: "sc-1itw4az-1"
31
- })(["display:", ";border-radius:24px;color:", ";background:", ";margin:0;font-size:11px;justify-content:center;align-items:center;margin-left:", ";width:24px;height:24px;line-height:inherit;cursor:pointer;&:hover{background-color:", ";}div:active{border-radius:24px;background-color:", ";}"], function (props) {
31
+ })(["display:", ";border-radius:24px;color:", ";background:", ";margin:0;font-size:11px;justify-content:center;align-items:center;margin-left:", ";width:24px;height:24px;line-height:inherit;cursor:pointer;&&&:hover{background-color:", ";}div:active{border-radius:", ";background-color:", ";}"], function (props) {
32
32
  return props.disabled ? 'none' : 'flex';
33
33
  }, function (props) {
34
34
  return props.theme.palette['grey-600'];
35
35
  }, function (props) {
36
- return props.theme.palette['grey-100'];
36
+ return props.customIcon ? undefined : props.theme.palette['grey-100'];
37
37
  }, function (props) {
38
38
  return props.size === 'small' ? '4px' : '8px';
39
39
  }, function (props) {
40
40
  return props.theme.palette.white;
41
41
  }, function (props) {
42
- return props.theme.palette['grey-300'];
42
+ return props.customIcon ? '0px' : '24px';
43
+ }, function (props) {
44
+ return props.customIcon ? undefined : props.theme.palette['grey-300'];
43
45
  });
44
46
  export var InPlaceEditableInputContainer = styled.div.withConfig({
45
47
  displayName: "InlineEditstyles__InPlaceEditableInputContainer",
@@ -1,15 +1,15 @@
1
- import React from 'react';
1
+ import type { ReactNode, ChangeEvent, CSSProperties, FocusEventHandler, InputHTMLAttributes, KeyboardEventHandler } from 'react';
2
2
  export type InputProps = {
3
3
  name?: string;
4
4
  value: string | number;
5
5
  disabled?: boolean;
6
- onBlur?: React.FocusEventHandler<HTMLInputElement>;
7
- onEnterPress?: React.KeyboardEventHandler<HTMLInputElement>;
8
- onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
6
+ onBlur?: FocusEventHandler<HTMLInputElement>;
7
+ onEnterPress?: KeyboardEventHandler<HTMLInputElement>;
8
+ onChange: (event: ChangeEvent<HTMLInputElement>) => void;
9
9
  placeholder?: string;
10
10
  maxLength?: number;
11
- autoComplete?: string;
12
11
  readOnly?: boolean;
12
+ autoComplete?: InputHTMLAttributes<HTMLInputElement>['autoComplete'];
13
13
  };
14
14
  export interface InlineEditProps {
15
15
  size?: 'large' | 'normal' | 'small';
@@ -17,8 +17,9 @@ export interface InlineEditProps {
17
17
  className?: string;
18
18
  disabled?: boolean;
19
19
  input: InputProps;
20
- style?: React.CSSProperties;
20
+ style?: CSSProperties;
21
21
  autoFocus?: boolean;
22
22
  error?: boolean;
23
23
  hideIcon?: boolean;
24
+ customIcon?: ReactNode;
24
25
  }
@@ -1,6 +1,5 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
  import React, { useState, useCallback } from 'react';
3
- import ListItem from '@synerise/ds-list-item';
4
3
  import { SearchItems } from '@synerise/ds-search/dist/Elements';
5
4
  import * as S from './SelectDropdown.style';
6
5
  var DEFAULT_ROW_HEIGHT = 32;
@@ -19,6 +18,7 @@ var SelectDropdown = function SelectDropdown(_ref) {
19
18
  setScrollTop = _useState[1];
20
19
  var handleItemClick = useCallback(function (item) {
21
20
  onSelect(item);
21
+ // @ts-ignore TODO expects ItemData from @synerise/ds-list-item
22
22
  // eslint-disable-next-line no-unused-expressions
23
23
  item.onClick == null || item.onClick(item);
24
24
  closeDropdown();
@@ -36,7 +36,7 @@ var SelectDropdown = function SelectDropdown(_ref) {
36
36
  // eslint-disable-next-line react/jsx-handler-names
37
37
  ,
38
38
  itemRender: function itemRender(item) {
39
- return /*#__PURE__*/React.createElement(ListItem, _extends({
39
+ return /*#__PURE__*/React.createElement(S.ListItem, _extends({
40
40
  key: item == null ? void 0 : item.text
41
41
  }, item));
42
42
  },
@@ -5,3 +5,4 @@ export declare const ListWrapper: import("styled-components").StyledComponent<"d
5
5
  export declare const StyledScrollbar: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<(ScrollbarProps | import("@synerise/ds-scrollbar").VirtualScrollbarProps) & import("react").RefAttributes<HTMLElement>>, any, import("@synerise/ds-scrollbar").ScrollbarAdditionalProps & {
6
6
  children?: import("react").ReactNode;
7
7
  }, never>;
8
+ export declare const ListItem: import("styled-components").StyledComponent<(props: import("@synerise/ds-list-item").ListItemProps) => import("react").JSX.Element, any, {}, never>;
@@ -1,5 +1,6 @@
1
1
  import styled from 'styled-components';
2
2
  import Scrollbar from '@synerise/ds-scrollbar';
3
+ import DSListItem from '@synerise/ds-list-item';
3
4
  export var DropdownWrapper = styled.div.withConfig({
4
5
  displayName: "SelectDropdownstyle__DropdownWrapper",
5
6
  componentId: "sc-1c17xkc-0"
@@ -14,4 +15,8 @@ export var ListWrapper = styled.div.withConfig({
14
15
  export var StyledScrollbar = styled(Scrollbar).withConfig({
15
16
  displayName: "SelectDropdownstyle__StyledScrollbar",
16
17
  componentId: "sc-1c17xkc-2"
17
- })(["&&{.scrollbar-container{padding-right:8px;}}"]);
18
+ })(["&&{.scrollbar-container{padding-right:8px;}}"]);
19
+ export var ListItem = styled(DSListItem).withConfig({
20
+ displayName: "SelectDropdownstyle__ListItem",
21
+ componentId: "sc-1c17xkc-3"
22
+ })(["min-width:auto;"]);
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-inline-edit",
3
- "version": "0.9.8",
3
+ "version": "0.10.0",
4
4
  "description": "InlineEdit UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -34,20 +34,20 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-dropdown": "^0.18.31",
38
- "@synerise/ds-icon": "^0.70.0",
39
- "@synerise/ds-input": "^0.24.21",
40
- "@synerise/ds-list-item": "^0.6.3",
41
- "@synerise/ds-scrollbar": "^0.11.24",
42
- "@synerise/ds-search": "^0.9.25",
43
- "@synerise/ds-tooltip": "^0.14.55",
44
- "@synerise/ds-typography": "^0.16.12",
45
- "@synerise/ds-utils": "^0.31.2"
37
+ "@synerise/ds-dropdown": "^0.19.0",
38
+ "@synerise/ds-icon": "^0.71.0",
39
+ "@synerise/ds-input": "^0.25.0",
40
+ "@synerise/ds-list-item": "^0.7.0",
41
+ "@synerise/ds-scrollbar": "^0.12.0",
42
+ "@synerise/ds-search": "^0.10.0",
43
+ "@synerise/ds-tooltip": "^0.15.0",
44
+ "@synerise/ds-typography": "^0.17.0",
45
+ "@synerise/ds-utils": "^0.32.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@synerise/ds-core": "*",
49
- "react": ">=16.9.0 <= 17.0.2",
50
- "styled-components": "5.0.1"
49
+ "react": ">=16.9.0 <= 18.3.1",
50
+ "styled-components": "^5.3.3"
51
51
  },
52
- "gitHead": "56e23cda61b7ddfe7da4669307183b105a500e1a"
52
+ "gitHead": "fbde34e126b492edaf148e469ab96247a891d6df"
53
53
  }