@synerise/ds-inline-edit 2.0.12 → 2.1.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
|
+
# [2.1.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-inline-edit@2.0.12...@synerise/ds-inline-edit@2.1.0) (2026-10-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* integrate Token Studio design tokens across the design system ([aabb447](https://github.com/Synerise/synerise-design/commit/aabb447edfb2d0c85e3de1f07e809ef84083453b))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.0.12](https://github.com/Synerise/synerise-design/compare/@synerise/ds-inline-edit@2.0.11...@synerise/ds-inline-edit@2.0.12) (2026-10-28)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @synerise/ds-inline-edit
|
package/CLAUDE.md
CHANGED
|
@@ -33,7 +33,7 @@ Functional component. Not forwardRef.
|
|
|
33
33
|
| `input` | `InputProps` | — | **Required.** Value, event handlers, and native input attributes |
|
|
34
34
|
| `size` | `'large' \| 'normal' \| 'small'` | `'normal'` | Controls font size via `@synerise/ds-typography` macros |
|
|
35
35
|
| `disabled` | `boolean` | `undefined` | Disables input and hides the icon via `pointer-events: none` |
|
|
36
|
-
| `error` | `boolean` | `undefined` | Switches underline/text colour to
|
|
36
|
+
| `error` | `boolean` | `undefined` | Switches underline/text colour to the error tokens (`--ds-inline-edit-text-error`, `--ds-color-text-danger-default` dots) |
|
|
37
37
|
| `hideIcon` | `boolean` | `undefined` | Hides the edit icon entirely |
|
|
38
38
|
| `customIcon` | `ReactNode` | `undefined` | Replaces the default `EditS` icon |
|
|
39
39
|
| `tooltipTitle` | `string` | `undefined` | Tooltip shown on hover over the icon |
|
|
@@ -72,7 +72,7 @@ Generic component: `InlineSelect<ItemType extends ListItemProps>`. Functional, n
|
|
|
72
72
|
| `size` | `'normal' \| 'small'` | `'normal'` | Font size via typography macros (no `'large'` unlike `InlineEdit`) |
|
|
73
73
|
| `expanded` | `boolean` | `undefined` | Sets initial open state of the dropdown |
|
|
74
74
|
| `disabled` | `boolean` | `undefined` | Disables interaction; adds 0.4 opacity |
|
|
75
|
-
| `error` | `boolean` | `undefined` | Switches underline/text colour to
|
|
75
|
+
| `error` | `boolean` | `undefined` | Switches underline/text colour to `--ds-inline-select-text-error` |
|
|
76
76
|
| `hideIcon` | `boolean` | `undefined` | Hides the `AngleDownS` chevron icon |
|
|
77
77
|
| `dropdownProps` | `Partial<Omit<DropdownSharedProps, 'open' \| 'onOpenChange' \| 'children' \| 'overlay' \| 'disabled'>>` | `{}` | Extra props forwarded to `@synerise/ds-dropdown` |
|
|
78
78
|
| `dropdownOverlayStyle` | `CSSProperties` | `{}` | Style applied to the dropdown overlay wrapper |
|
|
@@ -125,13 +125,13 @@ import InlineEdit, { InlineSelect } from '@synerise/ds-inline-edit';
|
|
|
125
125
|
|
|
126
126
|
**`InlineEdit`** styles in `InlineEdit.styles.ts`:
|
|
127
127
|
- No visible border; uses a CSS dashed `background-image` gradient as an underline
|
|
128
|
-
- On hover/focus:
|
|
129
|
-
- On focus:
|
|
128
|
+
- On hover/focus: `--ds-color-icon-base-muted` dots underline (or `--ds-color-text-danger-default` if `error`); text is `--ds-inline-edit-text-default` / `-error`
|
|
129
|
+
- On focus: `--ds-color-focus-base-default` dots underline (or `--ds-color-text-danger-default` if `error`)
|
|
130
130
|
- Font size driven by `size` prop: `large` → `macro.h600`, `normal` → `macro.h400`, `small` → `macro.small`
|
|
131
131
|
- Disabled: `pointer-events: none` + icon hidden via `display: none`
|
|
132
132
|
|
|
133
133
|
**`InlineSelect`** styles in `InlineSelect.style.ts`:
|
|
134
|
-
- Text colour rendered via CSS `text-shadow` trick: input `color: transparent`, shadow is `
|
|
134
|
+
- Text colour rendered via CSS `text-shadow` trick: input `color: transparent`, shadow is `--ds-inline-select-text-default` / `-hover` / `-selected` per state, or `--ds-inline-select-text-error` if `error`
|
|
135
135
|
- Icon animates 180° rotation when dropdown is open
|
|
136
136
|
- Disabled: 0.4 opacity + `pointer-events: none`
|
|
137
137
|
- Has a `// todo: set type` comment next to font size for `normal`/`small` sizes
|
package/dist/InlineEdit.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef, useState, useCallback, useEffect } from "react";
|
|
3
|
-
import { useTheme } from "@synerise/ds-core";
|
|
4
3
|
import Icon, { EditS } from "@synerise/ds-icon";
|
|
5
4
|
import { AutosizeInput } from "@synerise/ds-input";
|
|
6
5
|
import Tooltip from "@synerise/ds-tooltip";
|
|
@@ -20,7 +19,6 @@ const InlineEdit = ({
|
|
|
20
19
|
}) => {
|
|
21
20
|
const inputRef = useRef(null);
|
|
22
21
|
const [focused, setFocused] = useState();
|
|
23
|
-
const theme = useTheme();
|
|
24
22
|
const handleChange = useCallback((event) => {
|
|
25
23
|
input.onChange?.(event);
|
|
26
24
|
}, [input]);
|
|
@@ -48,7 +46,7 @@ const InlineEdit = ({
|
|
|
48
46
|
}, [autoFocus]);
|
|
49
47
|
return /* @__PURE__ */ jsxs(InPlaceEditableInputContainer, { className: `ds-inline-edit ${className || ""}`, style, size, disabled, error, scrolled: focused, children: [
|
|
50
48
|
/* @__PURE__ */ jsx(AutosizeInput, { extraWidth: 2, placeholderIsMinWidth: false, wrapperClassName: "autosize-input", autoComplete: "off", id: input.name ? toCamelCase(input.name) : "id", ...input, className: "autosize-input", "data-testid": "inline-edit-autosize-input", onKeyPress: handleKeyPress, disabled, onChange: handleChange, onBlur: handleBlur, onFocus: handleFocus, value: input.value, ref: inputRef }),
|
|
51
|
-
!hideIcon && /* @__PURE__ */ jsx(Tooltip, { "data-testid": "inline-edit-icon", title: tooltipTitle, children: /* @__PURE__ */ jsx(IconWrapper, { customIcon: Boolean(customIcon), disabled, onClick: handleFocusInput, size, children: /* @__PURE__ */ jsx(Icon, {
|
|
49
|
+
!hideIcon && /* @__PURE__ */ jsx(Tooltip, { "data-testid": "inline-edit-icon", title: tooltipTitle, children: /* @__PURE__ */ jsx(IconWrapper, { customIcon: Boolean(customIcon), disabled, onClick: handleFocusInput, size, children: /* @__PURE__ */ jsx(Icon, { component: customIcon || /* @__PURE__ */ jsx(EditS, {}), size: 24 }) }) })
|
|
52
50
|
] });
|
|
53
51
|
};
|
|
54
52
|
export {
|
|
@@ -2,25 +2,31 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { macro } from "@synerise/ds-typography";
|
|
3
3
|
const applyColor = (props) => {
|
|
4
4
|
if (props.error) {
|
|
5
|
-
return
|
|
5
|
+
return "var(--ds-inline-edit-text-error)";
|
|
6
6
|
}
|
|
7
|
-
return
|
|
7
|
+
return "var(--ds-inline-edit-text-default)";
|
|
8
|
+
};
|
|
9
|
+
const applyIconColor = (props) => {
|
|
10
|
+
if (props.error) {
|
|
11
|
+
return "var(--ds-color-icon-danger-default)";
|
|
12
|
+
}
|
|
13
|
+
return "var(--ds-inline-edit-icon-btn-icon-default)";
|
|
8
14
|
};
|
|
9
15
|
const applyColorFocus = (props) => {
|
|
10
16
|
if (props.error) {
|
|
11
|
-
return
|
|
17
|
+
return "var(--ds-color-text-danger-default)";
|
|
12
18
|
}
|
|
13
|
-
return
|
|
19
|
+
return "var(--ds-color-focus-base-default)";
|
|
14
20
|
};
|
|
15
21
|
const applyDots = (props) => {
|
|
16
22
|
if (props.error) {
|
|
17
|
-
return
|
|
23
|
+
return "var(--ds-color-text-danger-default)";
|
|
18
24
|
}
|
|
19
|
-
return
|
|
25
|
+
return "var(--ds-color-icon-base-muted)";
|
|
20
26
|
};
|
|
21
27
|
const applyDotsOnError = (props) => {
|
|
22
28
|
if (props.error) {
|
|
23
|
-
return `background-image: linear-gradient(to right, ${applyDots(props)} 20%,
|
|
29
|
+
return `background-image: linear-gradient(to right, ${applyDots(props)} 20%, transparent 10%);
|
|
24
30
|
background-color: transparent;
|
|
25
31
|
background-position: bottom left;
|
|
26
32
|
background-size: 5px 1px;
|
|
@@ -40,15 +46,13 @@ const FontStyleWatcher = /* @__PURE__ */ styled.div.withConfig({
|
|
|
40
46
|
const IconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
41
47
|
displayName: "InlineEditstyles__IconWrapper",
|
|
42
48
|
componentId: "sc-1itw4az-1"
|
|
43
|
-
})(["display:", ";border-radius:24px;color:
|
|
49
|
+
})(["display:", ";border-radius:24px;color:var(--ds-inline-edit-icon-btn-icon-default);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:var(--ds-color-background-base-default);}div :active{border-radius:", ";background-color:", ";}"], (props) => props.disabled ? "none" : "flex", (props) => props.customIcon ? void 0 : "var(--ds-inline-edit-icon-btn-bg-default)", (props) => props.size === "small" ? "4px" : "8px", (props) => props.customIcon ? "0px" : "24px", (props) => props.customIcon ? void 0 : "var(--ds-inline-edit-icon-btn-bg-active)");
|
|
44
50
|
const InPlaceEditableInputContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
45
51
|
displayName: "InlineEditstyles__InPlaceEditableInputContainer",
|
|
46
52
|
componentId: "sc-1itw4az-2"
|
|
47
|
-
})(["display:flex;max-width:100%;align-items:center;pointer-events:", ";", "{
|
|
53
|
+
})(["display:flex;max-width:100%;align-items:center;pointer-events:", ";", "{color:", ";}input{", "}&:hover{input{color:var(--ds-inline-edit-text-default);background-image:linear-gradient( to right,", " 20%,transparent 10% );}", "{background-color:var(--ds-inline-edit-icon-btn-bg-hover);}}", " > .autosize-input{display:inline-block;overflow:hidden;}> .autosize-input > input,> ", "{border:none;background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;", " overflow:hidden;text-overflow:", ";max-width:100%;padding-bottom:", ";margin:0;vertical-align:top;color:", ";::placeholder{color:", ";}}"], ({
|
|
48
54
|
disabled
|
|
49
|
-
}) => disabled ? "none" : "all", IconWrapper, (props) =>
|
|
50
|
-
theme
|
|
51
|
-
}) => theme.palette["grey-200"], (props) => !props.pressed && css(["&&&{&:focus:not(:active),&:focus-within{input{cursor:pointer;background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;background-image:linear-gradient( to right,", " 20%,rgba(255,255,255,0) 10% );}}}"], applyColorFocus(props)), FontStyleWatcher, (props) => fontSize[props.size], (props) => props.scrolled ? "initial" : "ellipsis", (props) => props.size === "small" ? "2px" : "0", (props) => applyColor(props), (props) => props.theme.palette[props.error ? "red-600" : "grey-400"]);
|
|
55
|
+
}) => disabled ? "none" : "all", IconWrapper, (props) => applyIconColor(props), (props) => applyDotsOnError(props), (props) => applyDots(props), IconWrapper, (props) => !props.pressed && css(["&&&{&:focus:not(:active),&:focus-within{input{cursor:pointer;background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;background-image:linear-gradient( to right,", " 20%,transparent 10% );}}}"], applyColorFocus(props)), FontStyleWatcher, (props) => fontSize[props.size], (props) => props.scrolled ? "initial" : "ellipsis", (props) => props.size === "small" ? "2px" : "0", (props) => applyColor(props), (props) => props.error ? "var(--ds-inline-edit-text-error)" : "var(--ds-color-text-base-disabled)");
|
|
52
56
|
export {
|
|
53
57
|
FontStyleWatcher,
|
|
54
58
|
IconWrapper,
|
|
@@ -2,25 +2,25 @@ import styled, { css } from "styled-components";
|
|
|
2
2
|
import { macro } from "@synerise/ds-typography";
|
|
3
3
|
const applyColor = (props) => {
|
|
4
4
|
if (props.error) {
|
|
5
|
-
return
|
|
5
|
+
return "var(--ds-inline-select-text-error)";
|
|
6
6
|
}
|
|
7
|
-
return
|
|
7
|
+
return "var(--ds-inline-select-text-default)";
|
|
8
8
|
};
|
|
9
9
|
const applyColorHover = (props) => {
|
|
10
10
|
if (props.error) {
|
|
11
|
-
return
|
|
11
|
+
return "var(--ds-inline-select-text-error)";
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return "var(--ds-inline-select-text-hover)";
|
|
14
14
|
};
|
|
15
15
|
const applyColorActive = (props) => {
|
|
16
16
|
if (props.error) {
|
|
17
|
-
return
|
|
17
|
+
return "var(--ds-inline-select-text-error)";
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return "var(--ds-inline-select-text-selected)";
|
|
20
20
|
};
|
|
21
21
|
const applyDotsOnError = (props) => {
|
|
22
22
|
if (props.error) {
|
|
23
|
-
return `background-image: linear-gradient(to right, ${applyColor(props)} 20%,
|
|
23
|
+
return `background-image: linear-gradient(to right, ${applyColor(props)} 20%, transparent 10%);
|
|
24
24
|
background-color: transparent;
|
|
25
25
|
background-position: bottom left;
|
|
26
26
|
background-size: 5px 1px;
|
|
@@ -35,17 +35,17 @@ const FontStyleWatcher = /* @__PURE__ */ styled.div.withConfig({
|
|
|
35
35
|
const IconWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
36
36
|
displayName: "InlineSelectstyle__IconWrapper",
|
|
37
37
|
componentId: "sc-188pn99-1"
|
|
38
|
-
})(["margin:0;font-size:11px;display:flex;justify-content:center;align-items:center;width:24px;height:24px;line-height:inherit;cursor:pointer;&:hover{background-color:
|
|
38
|
+
})(["margin:0;font-size:11px;display:flex;justify-content:center;align-items:center;width:24px;height:24px;line-height:inherit;cursor:pointer;&:hover{background-color:var(--ds-color-background-base-default);}&&&{svg{transition:transform 0.1s linear;transform:rotateZ( ", " );}}"], (props) => props.expanded ? "180deg" : "0deg");
|
|
39
39
|
const InPlaceEditableInputContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
40
40
|
displayName: "InlineSelectstyle__InPlaceEditableInputContainer",
|
|
41
41
|
componentId: "sc-188pn99-2"
|
|
42
42
|
})(["display:flex;padding-bottom:2px;max-width:100%;align-items:center;opacity:", ";pointer-events:", ";", "{margin-right:-3px;svg{color:", ";fill:", ";}}", " &&:hover{input{color:transparent;cursor:pointer;text-shadow:0 0 0 ", ";}", "{background-color:transparent;svg{fill:", ";}}}", " ", " > .autosize-input{display:inline-block;overflow:hidden;}> .autosize-input > input,> ", "{border:none;background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;", ";overflow:hidden;text-overflow:ellipsis;max-width:100%;padding:0;margin:0;vertical-align:top;font-weight:500;color:transparent;text-shadow:0 0 0 ", ";::placeholder{color:", ";}}"], ({
|
|
43
43
|
disabled
|
|
44
|
-
}) => disabled ?
|
|
44
|
+
}) => disabled ? "var(--ds-opacity-disabled)" : "1", ({
|
|
45
45
|
disabled
|
|
46
|
-
}) => disabled ? "none" : "all", IconWrapper, (props) => applyColor(props), (props) => applyColor(props), (props) => applyDotsOnError(props), (props) => applyColorHover(props), IconWrapper, (props) => applyColorHover(props), (props) => !props.pressed && !props.dropdownOpened && css(["&&&{&:focus:not(:active),&:focus-within{background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;background-image:linear-gradient( to right,", " 20%,
|
|
46
|
+
}) => disabled ? "none" : "all", IconWrapper, (props) => applyColor(props), (props) => applyColor(props), (props) => applyDotsOnError(props), (props) => applyColorHover(props), IconWrapper, (props) => applyColorHover(props), (props) => !props.pressed && !props.dropdownOpened && css(["&&&{&:focus:not(:active),&:focus-within{background-color:transparent;background-position:bottom left;background-size:5px 1px;background-repeat:repeat-x;background-image:linear-gradient( to right,", " 20%,transparent 10% );input{color:transparent;cursor:pointer;text-shadow:0 0 0 ", ";}", "{background-color:transparent;svg{fill:", ";}}}}"], applyColor(props), applyColor(props), IconWrapper, applyColor(props)), (props) => (props.dropdownOpened || props.pressed) && css(["&&&:active,&&&{input{color:transparent;cursor:pointer;text-shadow:0 0 0 ", ";}", "{background-color:transparent;svg{fill:", ";}}}"], applyColorActive(props), IconWrapper, applyColorActive(props)), FontStyleWatcher, ({
|
|
47
47
|
size
|
|
48
|
-
}) => size === "normal" ? macro.h500 : macro.small, (props) => applyColor(props), (props) => props.
|
|
48
|
+
}) => size === "normal" ? macro.h500 : macro.small, (props) => applyColor(props), (props) => props.error ? "var(--ds-inline-select-text-error)" : "var(--ds-inline-select-text-disabled)");
|
|
49
49
|
export {
|
|
50
50
|
FontStyleWatcher,
|
|
51
51
|
IconWrapper,
|
|
@@ -8,9 +8,7 @@ const DropdownWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
|
8
8
|
const ListWrapper = /* @__PURE__ */ styled.div.withConfig({
|
|
9
9
|
displayName: "SelectDropdownstyle__ListWrapper",
|
|
10
10
|
componentId: "sc-1c17xkc-1"
|
|
11
|
-
})(["display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;padding:8px;background:
|
|
12
|
-
theme
|
|
13
|
-
}) => theme.palette.white);
|
|
11
|
+
})(["display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;padding:8px;background:var(--ds-color-background-base-default);"]);
|
|
14
12
|
const StyledScrollbar = /* @__PURE__ */ styled(Scrollbar).withConfig({
|
|
15
13
|
displayName: "SelectDropdownstyle__StyledScrollbar",
|
|
16
14
|
componentId: "sc-1c17xkc-2"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-inline-edit",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "InlineEdit UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
],
|
|
43
43
|
"types": "dist/index.d.ts",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@synerise/ds-dropdown": "^2.
|
|
46
|
-
"@synerise/ds-icon": "^2.
|
|
47
|
-
"@synerise/ds-input": "^2.0
|
|
48
|
-
"@synerise/ds-list-item": "^2.
|
|
49
|
-
"@synerise/ds-scrollbar": "^2.0
|
|
50
|
-
"@synerise/ds-search": "^2.0
|
|
51
|
-
"@synerise/ds-tooltip": "^2.0
|
|
52
|
-
"@synerise/ds-typography": "^2.0
|
|
53
|
-
"@synerise/ds-utils": "^2.
|
|
45
|
+
"@synerise/ds-dropdown": "^2.2.0",
|
|
46
|
+
"@synerise/ds-icon": "^2.3.0",
|
|
47
|
+
"@synerise/ds-input": "^2.1.0",
|
|
48
|
+
"@synerise/ds-list-item": "^2.3.0",
|
|
49
|
+
"@synerise/ds-scrollbar": "^2.1.0",
|
|
50
|
+
"@synerise/ds-search": "^2.1.0",
|
|
51
|
+
"@synerise/ds-tooltip": "^2.1.0",
|
|
52
|
+
"@synerise/ds-typography": "^2.1.0",
|
|
53
|
+
"@synerise/ds-utils": "^2.3.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"vitest": "4"
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": ">=16.9.0 <= 18.3.1",
|
|
61
61
|
"styled-components": "^5.3.3"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "5c3d61e30289486d14c7d6becb682e2d4a08ce41"
|
|
64
64
|
}
|