@synerise/ds-subtle-form 1.1.59 → 1.1.60
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 +6 -0
- package/dist/Elements/DatePicker/DatePicker.js +5 -5
- package/dist/Elements/Field/Field.js +3 -3
- package/dist/Elements/Input/Input.js +6 -6
- package/dist/Elements/Select/Select.js +4 -4
- package/dist/Elements/TextArea/TextArea.d.ts +1 -1
- package/dist/Elements/TextArea/TextArea.js +32 -10
- package/dist/Elements/TextArea/TextArea.types.d.ts +3 -2
- package/dist/SubtleForm.d.ts +1 -1
- package/dist/SubtleForm.styles.d.ts +17 -10
- package/dist/SubtleForm.styles.js +31 -11
- package/dist/SubtleForm.types.d.ts +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
## [1.1.60](https://github.com/Synerise/synerise-design/compare/@synerise/ds-subtle-form@1.1.59...@synerise/ds-subtle-form@1.1.60) (2026-04-01)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **subtle-form:** enable control component from outside ([7a7f585](https://github.com/Synerise/synerise-design/commit/7a7f5854a4c0dc128f4f16f4b076e42aa7bcd6ae))
|
|
11
|
+
|
|
6
12
|
## [1.1.59](https://github.com/Synerise/synerise-design/compare/@synerise/ds-subtle-form@1.1.58...@synerise/ds-subtle-form@1.1.59) (2026-03-24)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @synerise/ds-subtle-form
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useMemo, useCallback, useEffect } from "react";
|
|
3
3
|
import { useTheme } from "@synerise/ds-core";
|
|
4
|
-
import DatePicker from "@synerise/ds-date-picker";
|
|
4
|
+
import { DatePicker } from "@synerise/ds-date-picker";
|
|
5
5
|
import format from "@synerise/ds-date-picker/dist/format";
|
|
6
6
|
import Icon, { CalendarM } from "@synerise/ds-icon";
|
|
7
7
|
import Tooltip from "@synerise/ds-tooltip";
|
|
@@ -10,7 +10,7 @@ import { SelectContainer, MaskedDatePlaceholder } from "./DatePicker.styles.js";
|
|
|
10
10
|
import { getFormattingString, replaceLettersWithUnderscore } from "./utils.js";
|
|
11
11
|
const SubtleDatePicker = ({
|
|
12
12
|
value,
|
|
13
|
-
suffix,
|
|
13
|
+
suffix = true,
|
|
14
14
|
suffixTooltip,
|
|
15
15
|
format: dateFormat,
|
|
16
16
|
label,
|
|
@@ -58,7 +58,7 @@ const SubtleDatePicker = ({
|
|
|
58
58
|
setActive(false);
|
|
59
59
|
setBlurred(true);
|
|
60
60
|
}, []);
|
|
61
|
-
return /* @__PURE__ */ jsx(Subtle, { className: "ds-subtle-form", children: /* @__PURE__ */ jsx(SubtleFormField, { active: active || hasError, label, tooltip: labelTooltip, children: /* @__PURE__ */ jsx(SelectContainer, { disabled: !!disabled, ref: containerRef, className: "ds-subtle-date-picker", active: active || hasError, children: active && !blurred || hasError ? /* @__PURE__ */ jsx(DatePicker, { ...rest, value, onApply: (date) => {
|
|
61
|
+
return /* @__PURE__ */ jsx(Subtle, { className: "ds-subtle-form", children: /* @__PURE__ */ jsx(SubtleFormField, { $active: active || hasError, label, tooltip: labelTooltip, children: /* @__PURE__ */ jsx(SelectContainer, { disabled: !!disabled, ref: containerRef, className: "ds-subtle-date-picker", active: active || hasError, children: active && !blurred || hasError ? /* @__PURE__ */ jsx(DatePicker, { ...rest, value, onApply: (date) => {
|
|
62
62
|
handleDeactivate();
|
|
63
63
|
onApply && onApply(date);
|
|
64
64
|
}, onClear: !disabled ? () => {
|
|
@@ -68,12 +68,12 @@ const SubtleDatePicker = ({
|
|
|
68
68
|
setActive(visible);
|
|
69
69
|
setBlurred(!visible);
|
|
70
70
|
onDropdownVisibleChange && onDropdownVisibleChange(visible);
|
|
71
|
-
} }) : /* @__PURE__ */ jsxs(Inactive, { disabled, onClick: !disabled ? handleActivate : void 0, blurred, mask: !value, children: [
|
|
71
|
+
} }) : /* @__PURE__ */ jsxs(Inactive, { $disabled: disabled, onClick: !disabled ? handleActivate : void 0, $blurred: blurred, $mask: !value, children: [
|
|
72
72
|
/* @__PURE__ */ jsxs(MainContent, { hasMargin: true, children: [
|
|
73
73
|
getDisplayText(),
|
|
74
74
|
!disabled && /* @__PURE__ */ jsx(MaskedDatePlaceholder, { children: replaceLettersWithUnderscore(dateFormattingString) })
|
|
75
75
|
] }),
|
|
76
|
-
!active && /* @__PURE__ */ jsx(Suffix, { select: true, children: /* @__PURE__ */ jsx(Tooltip, { title: suffixTooltip, children:
|
|
76
|
+
!active && suffix && /* @__PURE__ */ jsx(Suffix, { select: true, children: /* @__PURE__ */ jsx(Tooltip, { title: suffixTooltip, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CalendarM, {}), color: theme.palette["grey-600"] }) }) })
|
|
77
77
|
] }) }) }) });
|
|
78
78
|
};
|
|
79
79
|
SubtleDatePicker.displayName = "SubtleDatePicker";
|
|
@@ -8,7 +8,7 @@ import { Subtle, SubtleFormField, Container, Inactive, MainContent, Suffix } fro
|
|
|
8
8
|
import { MaskedDatePlaceholder } from "../DatePicker/DatePicker.styles.js";
|
|
9
9
|
const SubtleField = ({
|
|
10
10
|
disabled,
|
|
11
|
-
suffix,
|
|
11
|
+
suffix = true,
|
|
12
12
|
suffixTooltip,
|
|
13
13
|
label,
|
|
14
14
|
labelTooltip,
|
|
@@ -36,12 +36,12 @@ const SubtleField = ({
|
|
|
36
36
|
useOnClickOutside(containerRef, () => {
|
|
37
37
|
handleDeactivate();
|
|
38
38
|
});
|
|
39
|
-
return /* @__PURE__ */ jsx(Subtle, { className: "ds-subtle-form", disabled, children: /* @__PURE__ */ jsx(SubtleFormField, { active: isActive, label, tooltip: labelTooltip, children: /* @__PURE__ */ jsx(Container, { ref: containerRef, className: "ds-subtle-field", active, children: isActive && activeElement ? activeElement() : /* @__PURE__ */ jsxs(Inactive, { tabIndex: 0, onFocus: !disabled ? handleActivate : void 0, onClick: !disabled ? handleActivate : void 0, onBlur: handleDeactivate, blurred, disabled, mask: maskVisible, children: [
|
|
39
|
+
return /* @__PURE__ */ jsx(Subtle, { className: "ds-subtle-form", $disabled: disabled, children: /* @__PURE__ */ jsx(SubtleFormField, { $active: isActive, label, tooltip: labelTooltip, children: /* @__PURE__ */ jsx(Container, { ref: containerRef, className: "ds-subtle-field", active, children: isActive && activeElement ? activeElement() : /* @__PURE__ */ jsxs(Inactive, { tabIndex: 0, onFocus: !disabled ? handleActivate : void 0, onClick: !disabled ? handleActivate : void 0, onBlur: handleDeactivate, $blurred: blurred, $disabled: disabled, $mask: maskVisible, children: [
|
|
40
40
|
/* @__PURE__ */ jsxs(MainContent, { hasMargin: true, children: [
|
|
41
41
|
inactiveElement && inactiveElement(),
|
|
42
42
|
!disabled && maskVisible && /* @__PURE__ */ jsx(MaskedDatePlaceholder, { children: mask })
|
|
43
43
|
] }),
|
|
44
|
-
!active && !disabled && /* @__PURE__ */ jsx(Suffix, { select: true, children: /* @__PURE__ */ jsx(Tooltip, { title: suffixTooltip, children:
|
|
44
|
+
!active && !disabled && suffix && /* @__PURE__ */ jsx(Suffix, { select: true, children: /* @__PURE__ */ jsx(Tooltip, { title: suffixTooltip, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(EditS, {}), color: theme.palette["grey-600"] }) }) })
|
|
45
45
|
] }) }) }) });
|
|
46
46
|
};
|
|
47
47
|
SubtleField.displayName = "SubtleField";
|
|
@@ -4,7 +4,7 @@ import { useTheme } from "@synerise/ds-core";
|
|
|
4
4
|
import Icon, { EditS } from "@synerise/ds-icon";
|
|
5
5
|
import { Input } from "@synerise/ds-input";
|
|
6
6
|
import Tooltip from "@synerise/ds-tooltip";
|
|
7
|
-
import { Subtle, SubtleFormField, Container,
|
|
7
|
+
import { Subtle, SubtleFormField, Container, Inactive, MainContent, Suffix } from "../../SubtleForm.styles.js";
|
|
8
8
|
const SubtleInput = ({
|
|
9
9
|
disabled,
|
|
10
10
|
value,
|
|
@@ -13,7 +13,7 @@ const SubtleInput = ({
|
|
|
13
13
|
label,
|
|
14
14
|
labelTooltip,
|
|
15
15
|
suffixTooltip,
|
|
16
|
-
suffix,
|
|
16
|
+
suffix = true,
|
|
17
17
|
error,
|
|
18
18
|
errorText,
|
|
19
19
|
inputProps,
|
|
@@ -38,14 +38,14 @@ const SubtleInput = ({
|
|
|
38
38
|
setActive(true);
|
|
39
39
|
setBlurred(false);
|
|
40
40
|
}, []);
|
|
41
|
-
return /* @__PURE__ */ jsx(Subtle, { className: "ds-subtle-form", children: /* @__PURE__ */ jsx(SubtleFormField, { active, label, tooltip: labelTooltip, children: /* @__PURE__ */ jsx(Container, { ref: containerRef, className: "ds-subtle-input", active, disabled, children: (active || hasError) && !disabled ? /* @__PURE__ */ jsx(Input, { autoFocus: !hasError && !disabled, disabled, onChange: (event) => {
|
|
41
|
+
return /* @__PURE__ */ jsx(Subtle, { className: "ds-subtle-form", children: /* @__PURE__ */ jsx(SubtleFormField, { $active: active, label, tooltip: labelTooltip, children: /* @__PURE__ */ jsx(Container, { ref: containerRef, className: "ds-subtle-input", active, disabled, children: (active || hasError) && !disabled ? /* @__PURE__ */ jsx(Input, { autoFocus: !hasError && !disabled, disabled, onChange: (event) => {
|
|
42
42
|
onChange && onChange(event.currentTarget.value);
|
|
43
43
|
}, onBlur: !disabled ? handleDeactivate : void 0, value, style: {
|
|
44
44
|
margin: 0,
|
|
45
|
-
|
|
46
|
-
}, placeholder, error, errorText, ...rest, ...inputProps }) : /* @__PURE__ */ jsxs(Inactive, { onClick: !disabled ? handleActivate : void 0, blurred, disabled, children: [
|
|
45
|
+
paddingRight: suffix ? "28px" : "12px"
|
|
46
|
+
}, placeholder, error, errorText, ...rest, ...inputProps }) : /* @__PURE__ */ jsxs(Inactive, { onClick: !disabled ? handleActivate : void 0, $blurred: blurred, $disabled: disabled, children: [
|
|
47
47
|
/* @__PURE__ */ jsx(MainContent, { children: value && !!value.trim() ? value : placeholder }),
|
|
48
|
-
/* @__PURE__ */ jsx(Suffix, { children: /* @__PURE__ */ jsx(Tooltip, { title: suffixTooltip, children:
|
|
48
|
+
suffix && /* @__PURE__ */ jsx(Suffix, { children: /* @__PURE__ */ jsx(Tooltip, { title: suffixTooltip, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(EditS, {}), color: theme.palette["grey-600"] }) }) })
|
|
49
49
|
] }) }) }) });
|
|
50
50
|
};
|
|
51
51
|
SubtleInput.displayName = "SubtleInput";
|
|
@@ -9,7 +9,7 @@ import { SelectContainer } from "./Select.styles.js";
|
|
|
9
9
|
const SubtleSelect = ({
|
|
10
10
|
disabled,
|
|
11
11
|
value,
|
|
12
|
-
suffix,
|
|
12
|
+
suffix = true,
|
|
13
13
|
suffixTooltip,
|
|
14
14
|
label,
|
|
15
15
|
children,
|
|
@@ -33,12 +33,12 @@ const SubtleSelect = ({
|
|
|
33
33
|
setBlurred(false);
|
|
34
34
|
}, []);
|
|
35
35
|
const theme = useTheme();
|
|
36
|
-
return /* @__PURE__ */ jsx(Subtle, { className: "ds-subtle-form", disabled, children: /* @__PURE__ */ jsx(SubtleFormField, { active, label, tooltip: labelTooltip, children: /* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, className: "ds-subtle-select", active, children: active && !blurred || hasError ? /* @__PURE__ */ jsx(Select, { disabled, autoFocus: !hasError, size: "middle", onBlur: handleDeactivate, value, placeholder, errorText, error, defaultOpen: !hasError, dropdownAlign: {
|
|
36
|
+
return /* @__PURE__ */ jsx(Subtle, { className: "ds-subtle-form", $disabled: disabled, children: /* @__PURE__ */ jsx(SubtleFormField, { $active: active, label, tooltip: labelTooltip, children: /* @__PURE__ */ jsx(SelectContainer, { ref: containerRef, className: "ds-subtle-select", active, children: active && !blurred || hasError ? /* @__PURE__ */ jsx(Select, { disabled, autoFocus: !hasError, size: "middle", onBlur: handleDeactivate, value, placeholder, errorText, error, defaultOpen: !hasError, dropdownAlign: {
|
|
37
37
|
offset: [0, 8],
|
|
38
38
|
...dropdownAlign
|
|
39
|
-
}, ...rest, children }) : /* @__PURE__ */ jsxs(Inactive, { className: "inactive-content", onClick: !disabled ? handleActivate : void 0, blurred, disabled, children: [
|
|
39
|
+
}, ...rest, children }) : /* @__PURE__ */ jsxs(Inactive, { className: "inactive-content", onClick: !disabled ? handleActivate : void 0, $blurred: blurred, $disabled: disabled, children: [
|
|
40
40
|
/* @__PURE__ */ jsx(MainContent, { className: "main-content", hasMargin: true, children: /* @__PURE__ */ jsx(Fragment, { children: value && !!String(value).trim() ? value : placeholder }) }),
|
|
41
|
-
!active && !disabled && /* @__PURE__ */ jsx(Suffix, { select: true, children: /* @__PURE__ */ jsx(Tooltip, { title: suffixTooltip, children:
|
|
41
|
+
!active && !disabled && suffix && /* @__PURE__ */ jsx(Suffix, { select: true, children: /* @__PURE__ */ jsx(Tooltip, { title: suffixTooltip, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AngleDownS, {}), color: theme.palette["grey-600"] }) }) })
|
|
42
42
|
] }) }) }) });
|
|
43
43
|
};
|
|
44
44
|
SubtleSelect.displayName = "SubtleSelect";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { SubtleTextAreaProps } from './TextArea.types';
|
|
3
3
|
declare const SubtleTextArea: {
|
|
4
|
-
({ disabled, minRows, maxRows, value, onChange, placeholder, label, labelTooltip, suffixTooltip, suffix, error, errorText, textAreaProps, ...rest }: SubtleTextAreaProps): React.JSX.Element;
|
|
4
|
+
({ disabled, minRows, maxRows, value, onChange, placeholder, label, labelTooltip, suffixTooltip, suffix, error, errorText, textAreaProps, active: activeProp, onActivate, ...rest }: SubtleTextAreaProps): React.JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
export default SubtleTextArea;
|
|
@@ -5,7 +5,7 @@ import { useTheme } from "@synerise/ds-core";
|
|
|
5
5
|
import Icon, { EditS } from "@synerise/ds-icon";
|
|
6
6
|
import { TextArea } from "@synerise/ds-input";
|
|
7
7
|
import Tooltip from "@synerise/ds-tooltip";
|
|
8
|
-
import { Subtle, SubtleFormField, Container,
|
|
8
|
+
import { Subtle, SubtleFormField, Container, getFocusPadding, Inactive, MainContent, ValueArea, Suffix } from "../../SubtleForm.styles.js";
|
|
9
9
|
const FONT = "Graphik LCG Web";
|
|
10
10
|
const FONT_SIZE = "13px";
|
|
11
11
|
const ROW_HEIGHT_PX = 17;
|
|
@@ -25,9 +25,11 @@ const SubtleTextArea = ({
|
|
|
25
25
|
error,
|
|
26
26
|
errorText,
|
|
27
27
|
textAreaProps,
|
|
28
|
+
active: activeProp,
|
|
29
|
+
onActivate,
|
|
28
30
|
...rest
|
|
29
31
|
}) => {
|
|
30
|
-
const [active, setActive] = useState(false);
|
|
32
|
+
const [active, setActive] = useState(activeProp ?? false);
|
|
31
33
|
const [blurred, setBlurred] = useState(false);
|
|
32
34
|
const containerRef = useRef(null);
|
|
33
35
|
const [visibleRows, setVisibleRows] = useState(minRows);
|
|
@@ -63,6 +65,11 @@ const SubtleTextArea = ({
|
|
|
63
65
|
setVisibleRows(lines);
|
|
64
66
|
}
|
|
65
67
|
}, [minRows, maxRows, value, calculateTextHeight]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (activeProp !== void 0) {
|
|
70
|
+
setActive(activeProp);
|
|
71
|
+
}
|
|
72
|
+
}, [activeProp]);
|
|
66
73
|
const handleDeactivate = useCallback((event) => {
|
|
67
74
|
if (textAreaProps) {
|
|
68
75
|
const {
|
|
@@ -70,23 +77,38 @@ const SubtleTextArea = ({
|
|
|
70
77
|
} = textAreaProps;
|
|
71
78
|
onBlur && onBlur(event);
|
|
72
79
|
}
|
|
80
|
+
if (activeProp === false) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
73
83
|
setActive(false);
|
|
74
84
|
setBlurred(true);
|
|
75
|
-
}, [textAreaProps]);
|
|
85
|
+
}, [textAreaProps, activeProp]);
|
|
76
86
|
const handleActivate = useCallback(() => {
|
|
77
87
|
setActive(true);
|
|
78
88
|
setBlurred(false);
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
onActivate?.();
|
|
90
|
+
}, [onActivate]);
|
|
91
|
+
const handleFocus = useCallback((event) => {
|
|
92
|
+
if (textAreaProps) {
|
|
93
|
+
const {
|
|
94
|
+
onFocus
|
|
95
|
+
} = textAreaProps;
|
|
96
|
+
onFocus && onFocus(event);
|
|
97
|
+
}
|
|
98
|
+
}, [textAreaProps]);
|
|
99
|
+
return /* @__PURE__ */ jsx(Subtle, { className: "ds-subtle-form", hasError: error, children: /* @__PURE__ */ jsx(SubtleFormField, { $active: active, label, tooltip: labelTooltip, children: /* @__PURE__ */ jsx(Container, { ref: containerRef, className: "ds-subtle-textarea", active, disabled, children: (active || hasError) && !disabled ? /* @__PURE__ */ jsx(TextArea, { autoFocus: !hasError && !disabled, onChange: !disabled ? (event) => {
|
|
81
100
|
onChange && onChange(event.currentTarget.value);
|
|
82
|
-
} : void 0, onBlur: !disabled ? handleDeactivate : void 0, value, rows: visibleRows + 1, style: {
|
|
101
|
+
} : void 0, onBlur: !disabled ? handleDeactivate : void 0, onFocus: !disabled ? handleFocus : void 0, value, rows: visibleRows + 1, style: {
|
|
83
102
|
margin: 0,
|
|
84
|
-
padding:
|
|
103
|
+
padding: getFocusPadding({
|
|
104
|
+
hasSuffix: suffix,
|
|
105
|
+
state: "focused"
|
|
106
|
+
})
|
|
85
107
|
}, placeholder, error, errorText, wrapperStyle: {
|
|
86
108
|
margin: 0
|
|
87
|
-
}, ...rest, ...textAreaProps }) : /* @__PURE__ */ jsxs(Inactive, { rows: visibleRows, onClick: !disabled ? handleActivate : void 0, blurred, disabled, children: [
|
|
88
|
-
/* @__PURE__ */ jsx(MainContent, { breakWord: true, children: /* @__PURE__ */ jsx(ValueArea, { disabled, value: value && !!value.trim() ? value : placeholder, onBlur: !disabled ? handleDeactivate : void 0,
|
|
89
|
-
/* @__PURE__ */ jsx(Suffix, { children: /* @__PURE__ */ jsx(Tooltip, { title: suffixTooltip, children:
|
|
109
|
+
}, ...rest, ...textAreaProps }) : /* @__PURE__ */ jsxs(Inactive, { $rows: visibleRows, onClick: !disabled ? handleActivate : void 0, $blurred: blurred, $disabled: disabled, isSuffixVisible: suffix, children: [
|
|
110
|
+
/* @__PURE__ */ jsx(MainContent, { breakWord: true, children: /* @__PURE__ */ jsx(ValueArea, { disabled, value: value && !!value.trim() ? value : placeholder, onBlur: !disabled ? handleDeactivate : void 0, isPlaceholder: !value && !!placeholder }) }),
|
|
111
|
+
suffix && /* @__PURE__ */ jsx(Suffix, { children: /* @__PURE__ */ jsx(Tooltip, { title: suffixTooltip, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(EditS, {}), color: theme.palette["grey-600"] }) }) })
|
|
90
112
|
] }) }) }) });
|
|
91
113
|
};
|
|
92
114
|
SubtleTextArea.displayName = "SubtleTextArea";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RawTextAreaProps } from '@synerise/ds-input/dist/Textarea/Textarea.types';
|
|
2
2
|
import { SubtleFieldProps } from '../../SubtleForm.types';
|
|
3
3
|
export type SubtleTextAreaProps = {
|
|
4
4
|
minRows?: number;
|
|
@@ -8,7 +8,8 @@ export type SubtleTextAreaProps = {
|
|
|
8
8
|
placeholder?: string;
|
|
9
9
|
autoSize?: TextareaAutosize;
|
|
10
10
|
error?: boolean;
|
|
11
|
-
|
|
11
|
+
onActivate?: () => void;
|
|
12
|
+
textAreaProps?: RawTextAreaProps;
|
|
12
13
|
} & SubtleFieldProps;
|
|
13
14
|
export type TextareaAutosize = {
|
|
14
15
|
minRows: number;
|
package/dist/SubtleForm.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare const SubtleForm: {
|
|
2
2
|
(): null;
|
|
3
3
|
TextArea: {
|
|
4
|
-
({ disabled, minRows, maxRows, value, onChange, placeholder, label, labelTooltip, suffixTooltip, suffix, error, errorText, textAreaProps, ...rest }: import('./Elements/TextArea/TextArea.types').SubtleTextAreaProps): import("react").JSX.Element;
|
|
4
|
+
({ disabled, minRows, maxRows, value, onChange, placeholder, label, labelTooltip, suffixTooltip, suffix, error, errorText, textAreaProps, active: activeProp, onActivate, ...rest }: import('./Elements/TextArea/TextArea.types').SubtleTextAreaProps): import("react").JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
Select: {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
type PaddingProps = {
|
|
2
|
+
hasSuffix?: boolean;
|
|
3
|
+
state?: 'hovered' | 'focused';
|
|
4
|
+
};
|
|
5
|
+
export declare const getFocusPadding: ({ hasSuffix, state, }: PaddingProps) => string;
|
|
6
|
+
export declare const getBlurPadding: ({ hasSuffix }: PaddingProps) => "8px 16px 8px 0" | "8px 40px 8px 0";
|
|
4
7
|
export declare const MainContent: import('styled-components').StyledComponent<"div", any, {
|
|
5
8
|
hasMargin?: boolean;
|
|
6
9
|
breakWord?: boolean;
|
|
@@ -9,21 +12,25 @@ export declare const Suffix: import('styled-components').StyledComponent<"div",
|
|
|
9
12
|
select?: boolean;
|
|
10
13
|
}, never>;
|
|
11
14
|
export declare const Inactive: import('styled-components').StyledComponent<"div", any, {
|
|
12
|
-
rows?: number;
|
|
13
|
-
blurred: boolean;
|
|
14
|
-
mask?: boolean;
|
|
15
|
-
disabled?: boolean;
|
|
15
|
+
$rows?: number;
|
|
16
|
+
$blurred: boolean;
|
|
17
|
+
$mask?: boolean;
|
|
18
|
+
$disabled?: boolean;
|
|
19
|
+
isSuffixVisible?: boolean;
|
|
20
|
+
isTextareaComponent?: boolean;
|
|
16
21
|
}, never>;
|
|
17
22
|
export declare const ValueArea: import('styled-components').StyledComponent<"textarea", any, {
|
|
18
|
-
|
|
23
|
+
isPlaceholder: boolean;
|
|
19
24
|
}, never>;
|
|
20
25
|
export declare const Container: import('styled-components').StyledComponent<"div", any, {
|
|
21
26
|
active?: boolean;
|
|
22
27
|
disabled?: boolean;
|
|
23
28
|
}, never>;
|
|
24
29
|
export declare const Subtle: import('styled-components').StyledComponent<"div", any, {
|
|
25
|
-
disabled?: boolean;
|
|
30
|
+
$disabled?: boolean;
|
|
31
|
+
hasError?: boolean;
|
|
26
32
|
}, never>;
|
|
27
33
|
export declare const SubtleFormField: import('styled-components').StyledComponent<({ label, tooltip, id, rightSide, tooltipConfig, description, errorText, children, ...rest }: import('@synerise/ds-form-field').FormFieldProps) => React.JSX.Element, any, {
|
|
28
|
-
active: boolean;
|
|
34
|
+
$active: boolean;
|
|
29
35
|
}, never>;
|
|
36
|
+
export {};
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import styled, { css, keyframes } from "styled-components";
|
|
2
2
|
import FormField from "@synerise/ds-form-field";
|
|
3
|
+
import { TextareaWrapper } from "@synerise/ds-input/dist/Textarea/Textarea.styles";
|
|
4
|
+
import { hexToRgba } from "@synerise/ds-utils";
|
|
3
5
|
import { MaskedDatePlaceholder } from "./Elements/DatePicker/DatePicker.styles.js";
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const VERTICAL_PADDING = "8px";
|
|
7
|
+
const VERTICAL_PADDING_TEXTAREA = "6px";
|
|
8
|
+
const getFocusPadding = ({
|
|
9
|
+
hasSuffix = true,
|
|
10
|
+
state = "hovered"
|
|
11
|
+
}) => {
|
|
12
|
+
const verticalPadding = state === "focused" ? VERTICAL_PADDING_TEXTAREA : VERTICAL_PADDING;
|
|
13
|
+
return `${verticalPadding} ${hasSuffix ? "28px" : "8px"} ${verticalPadding} ${state === "focused" ? "8px" : "7px"}`;
|
|
14
|
+
};
|
|
15
|
+
const getBlurPadding = ({
|
|
16
|
+
hasSuffix = true
|
|
17
|
+
}) => {
|
|
18
|
+
return hasSuffix ? `8px 16px 8px 0` : `8px 40px 8px 0`;
|
|
19
|
+
};
|
|
20
|
+
const getBlurAnimation = (props) => {
|
|
21
|
+
return keyframes(["0%{padding:", ";}100%{padding:", "}"], getFocusPadding(props), getBlurPadding(props));
|
|
22
|
+
};
|
|
8
23
|
const MainContent = /* @__PURE__ */ styled.div.withConfig({
|
|
9
24
|
displayName: "SubtleFormstyles__MainContent",
|
|
10
25
|
componentId: "sc-1wunvof-0"
|
|
@@ -17,11 +32,17 @@ const Suffix = /* @__PURE__ */ styled.div.withConfig({
|
|
|
17
32
|
const Inactive = /* @__PURE__ */ styled.div.withConfig({
|
|
18
33
|
displayName: "SubtleFormstyles__Inactive",
|
|
19
34
|
componentId: "sc-1wunvof-2"
|
|
20
|
-
})(["position:relative;width:100%;height:32px;display:flex;", " align-items:flex-start;background:
|
|
35
|
+
})(["position:relative;width:100%;height:32px;display:flex;", " align-items:flex-start;background:transparent;padding:", ";opacity:", ";border-radius:3px;transition:padding 0.1s ease-in,background 0.1s ease-in;transition-delay:0.2s;&&{", "}", " ", ""], (props) => !!props.$rows && `height: ${props.$rows * 17 + 17}px;`, (props) => getBlurPadding({
|
|
36
|
+
hasSuffix: props.isSuffixVisible
|
|
37
|
+
}), (props) => props.$disabled ? `0.5` : `1`, (props) => !!props.$disabled && css(["animation:none;textarea{cursor:not-allowed;}"]), (props) => props.$blurred && !props.$disabled && css(["animation:", " 0.1s ease-in;"], getBlurAnimation({
|
|
38
|
+
hasSuffix: props.isSuffixVisible
|
|
39
|
+
})), (props) => !props.$disabled && css(["&:hover{padding:", ";background:", ";", "{", " ", "{left:12px;", "}}", "{opacity:1;}}"], getFocusPadding({
|
|
40
|
+
hasSuffix: props.isSuffixVisible
|
|
41
|
+
}), hexToRgba(props.theme.palette["grey-300"], 0.4), MainContent, props.$mask && `color: transparent;`, MaskedDatePlaceholder, props.$mask && `color: ${props.theme.palette["grey-600"]};`, Suffix));
|
|
21
42
|
const ValueArea = /* @__PURE__ */ styled.textarea.withConfig({
|
|
22
43
|
displayName: "SubtleFormstyles__ValueArea",
|
|
23
44
|
componentId: "sc-1wunvof-3"
|
|
24
|
-
})(["&&{font-variant-numeric:normal;word-wrap:break-word;overflow-wrap:break-word;", "
|
|
45
|
+
})(["&&{font-variant-numeric:normal;word-wrap:break-word;overflow-wrap:break-word;color:transparent;text-shadow:0 1px ", ";width:100%;height:100%;background:transparent;border:none;padding:0;margin:0;overflow:auto;outline:none;box-shadow:none;resize:none;-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}}"], (props) => props.isPlaceholder ? props.theme.palette["grey-500"] : props.theme.palette["grey-600"]);
|
|
25
46
|
const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
26
47
|
displayName: "SubtleFormstyles__Container",
|
|
27
48
|
componentId: "sc-1wunvof-4"
|
|
@@ -29,11 +50,11 @@ const Container = /* @__PURE__ */ styled.div.withConfig({
|
|
|
29
50
|
const Subtle = /* @__PURE__ */ styled.div.withConfig({
|
|
30
51
|
displayName: "SubtleFormstyles__Subtle",
|
|
31
52
|
componentId: "sc-1wunvof-5"
|
|
32
|
-
})(["", ""], (props) => !!props
|
|
53
|
+
})(["", " ", "{", "}"], (props) => !!props.$disabled && css(["&&{cursor:not-allowed;}"]), TextareaWrapper, (props) => props.hasError ? `background-color: ${hexToRgba(props.theme.palette["red-100"], 0.4)};` : `background-color: ${hexToRgba(props.theme.palette["blue-100"], 0.4)};`);
|
|
33
54
|
const SubtleFormField = /* @__PURE__ */ styled(FormField).withConfig({
|
|
34
55
|
displayName: "SubtleFormstyles__SubtleFormField",
|
|
35
56
|
componentId: "sc-1wunvof-6"
|
|
36
|
-
})(["gap:", ";"], (props) => props
|
|
57
|
+
})(["gap:", ";"], (props) => props.$active ? `9px` : `8px`);
|
|
37
58
|
export {
|
|
38
59
|
Container,
|
|
39
60
|
Inactive,
|
|
@@ -42,7 +63,6 @@ export {
|
|
|
42
63
|
SubtleFormField,
|
|
43
64
|
Suffix,
|
|
44
65
|
ValueArea,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
focusPadding
|
|
66
|
+
getBlurPadding,
|
|
67
|
+
getFocusPadding
|
|
48
68
|
};
|
|
@@ -4,7 +4,7 @@ export type SubtleFieldProps = {
|
|
|
4
4
|
active?: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
6
|
labelTooltip?: FormFieldCommonProps['tooltip'];
|
|
7
|
-
suffix?:
|
|
7
|
+
suffix?: boolean;
|
|
8
8
|
suffixTooltip?: ReactNode;
|
|
9
9
|
activeElement?: () => ReactElement;
|
|
10
10
|
inactiveElement?: () => ReactElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-subtle-form",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.60",
|
|
4
4
|
"description": "SubtleForm UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
],
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@synerise/ds-date-picker": "^1.4.
|
|
39
|
-
"@synerise/ds-form-field": "^1.3.
|
|
40
|
-
"@synerise/ds-icon": "^1.15.
|
|
41
|
-
"@synerise/ds-input": "^1.6.
|
|
42
|
-
"@synerise/ds-select": "^1.3.
|
|
43
|
-
"@synerise/ds-tooltip": "^1.4.
|
|
38
|
+
"@synerise/ds-date-picker": "^1.4.3",
|
|
39
|
+
"@synerise/ds-form-field": "^1.3.11",
|
|
40
|
+
"@synerise/ds-icon": "^1.15.2",
|
|
41
|
+
"@synerise/ds-input": "^1.6.11",
|
|
42
|
+
"@synerise/ds-select": "^1.3.21",
|
|
43
|
+
"@synerise/ds-tooltip": "^1.4.11",
|
|
44
44
|
"@synerise/ds-utils": "^1.7.1",
|
|
45
45
|
"calculate-size": "^1.1.1"
|
|
46
46
|
},
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"react": ">=16.9.0 <= 18.3.1",
|
|
51
51
|
"styled-components": "^5.3.3"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "c2384982c3533a31eb5e5e0408f8dcecb2b0f399"
|
|
54
54
|
}
|