@topconsultnpm/sdkui-react-beta 6.9.34 → 6.9.35

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.
@@ -28,10 +28,6 @@ export declare const StyledEditorLabel: import("styled-components/dist/types").I
28
28
  $fontSize?: string;
29
29
  $color?: string;
30
30
  }>> & string;
31
- export declare const StyledEditorButtonIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
32
- $index: number;
33
- $transform: string;
34
- }>> & string;
35
31
  export declare const StyledTextareaEditor: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, {
36
32
  $vil: ValidationItem[];
37
33
  $width: string;
@@ -62,23 +62,9 @@ export const StyledEditorLabel = styled.div `
62
62
  position: relative;
63
63
  z-index: 1;
64
64
  `;
65
- export const StyledEditorButtonIcon = styled.div `
66
- color: ${TMColors.button_icon};
67
- position: absolute;
68
- right: ${(props) => (props.$index + 1) * 10 + (10 * props.$index)}px;
69
- font-size: 1rem;
70
- transform: ${props => `translateY(${props.$transform})`};
71
- cursor: pointer;
72
- &:focus{
73
- outline: none;
74
- background-image: linear-gradient(white, #E4E9F7);
75
- border-bottom: 2px solid;
76
- border-bottom-color: ${TMColors.primary};
77
- }
78
- `;
79
65
  export const StyledTextareaEditor = styled.textarea `
80
66
  width: ${props => props.$width};
81
- padding: 8px 13px;
67
+ padding: 5px 5px 5px 13px;
82
68
  border: 1px solid;
83
69
  border-color: ${props => props.$isModified ? TMColors.isModified : TMColors.border_normal};
84
70
  border-bottom: ${props => (props.$vil.length > 0) ? '3px' : '1px'} solid;
@@ -1,17 +1,32 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useRef } from 'react';
3
- import { StyledEditorButtonIcon, StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, StyledTextareaEditor } from './TMEditorStyled';
4
- import { FontSize } from '../../utils/theme';
3
+ import { StyledEditorContainer, StyledEditorIcon, StyledEditorLabel, StyledTextareaEditor } from './TMEditorStyled';
4
+ import { FontSize, TMColors } from '../../utils/theme';
5
5
  import TMContextMenu, { useContextMenu } from '../base/TMContextMenuOLD';
6
6
  import { TMExceptionBoxManager } from '../base/TMPopUp';
7
7
  import TMLayoutContainer, { TMLayoutItem } from '../base/TMLayout';
8
8
  import TMVilViewer from '../base/TMVilViewer';
9
9
  import TMTooltip from '../base/TMTooltip';
10
10
  import { DeviceType, useDeviceType } from '../base/TMDeviceProvider';
11
+ import { IconClearButton } from '../../helper';
12
+ import styled from 'styled-components';
13
+ const StyledTextAreaEditorButton = styled.div `
14
+ color: ${TMColors.button_icon};
15
+ display: flex;
16
+ align-items: center;
17
+ position: relative;
18
+ cursor: pointer;
19
+ &:focus{
20
+ outline: none;
21
+ background-image: linear-gradient(white, #E4E9F7);
22
+ border-bottom: 2px solid;
23
+ border-bottom-color: ${TMColors.primary};
24
+ }
25
+ `;
11
26
  // Define the TMTextArea component
12
27
  const TMTextArea = (props) => {
13
28
  // Extract properties from the props object
14
- const { label = '', value = '', width = '100%', height = 'auto', autoFocus = false, validationItems = [], disabled = false, isModifiedWhen = false, fontSize = FontSize.defaultFontSize, elementStyle = {}, icon = null, labelPosition = 'left', readOnly = false, onValueChanged, onBlur, placeHolder, formulaItems = [], buttons = [], maxHeight = 'auto', rows, maxLength, resize = true } = props;
29
+ const { label = '', value = '', width = '100%', height = 'auto', autoFocus = false, showClearButton, validationItems = [], disabled = false, isModifiedWhen = false, fontSize = FontSize.defaultFontSize, elementStyle = {}, icon = null, labelPosition = 'left', readOnly = false, onValueChanged, onBlur, placeHolder, formulaItems = [], buttons = [], maxHeight = 'auto', rows, maxLength, resize = true } = props;
15
30
  // Reference to the textarea DOM element
16
31
  const inputRef = useRef(null);
17
32
  // Stores the textarea is focused
@@ -119,9 +134,13 @@ const TMTextArea = (props) => {
119
134
  const y = e.clientY - bounds.top;
120
135
  // set the x and y coordinates of our users right click
121
136
  setPoints({ x, y });
122
- }, "$isMobile": deviceType === DeviceType.MOBILE, "$maxHeight": maxHeight, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$width": width, "$resize": resize }), buttons.map((buttonItem, index) => {
123
- return (_jsx(StyledEditorButtonIcon, { onClick: buttonItem.onClick, "$index": index, "$transform": '-26px', children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, index));
124
- }), formulaItems.length > 0 && clicked && (_jsx(TMContextMenu, { menuData: formulaMenuItems, top: points.y, left: points.x, onMenuItemClick: (formula) => insertText(formula) })), _jsx(TMVilViewer, { vil: validationItems })] });
137
+ }, "$isMobile": deviceType === DeviceType.MOBILE, "$maxHeight": maxHeight, "$disabled": disabled, "$vil": validationItems, "$isModified": isModifiedWhen, "$fontSize": fontSize, "$width": width, "$resize": resize }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', justifyContent: 'flex-start', alignItems: 'center', position: 'absolute', right: '6px', top: label.length > 0 ? '20px' : '7px', pointerEvents: disabled ? 'none' : 'auto', opacity: disabled ? 0.4 : 1 }, children: [showClearButton && currentValue &&
138
+ _jsx(StyledTextAreaEditorButton, { onClick: () => {
139
+ onValueChanged?.({ target: { value: undefined } });
140
+ onBlur?.(undefined);
141
+ }, children: _jsx(IconClearButton, {}) }), buttons.map((buttonItem, index) => {
142
+ return (_jsx(StyledTextAreaEditorButton, { onClick: buttonItem.onClick, children: _jsx(TMTooltip, { content: buttonItem.text, children: buttonItem.icon }) }, buttonItem.text));
143
+ })] }), formulaItems.length > 0 && clicked && (_jsx(TMContextMenu, { menuData: formulaMenuItems, top: points.y, left: points.x, onMenuItemClick: (formula) => insertText(formula) })), _jsx(TMVilViewer, { vil: validationItems })] });
125
144
  };
126
145
  // Layout for the textarea with a left-aligned label
127
146
  const renderedLeftLabelTextArea = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@topconsultnpm/sdkui-react-beta",
3
- "version": "6.9.34",
3
+ "version": "6.9.35",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",