@mailstep/design-system 0.8.40 → 0.8.43-beta.1
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/package.json +3 -2
- package/ui/Blocks/CommonGrid/components/GridModals/index.js +1 -0
- package/ui/Blocks/CommonGrid/hooks/useCreatePreset.d.ts +3 -2
- package/ui/Blocks/CommonGrid/hooks/useCreatePreset.js +3 -2
- package/ui/Elements/Avatar/Avatar.js +2 -2
- package/ui/Elements/Avatar/types.d.ts +2 -0
- package/ui/Forms/Input/Input.js +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailstep/design-system",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.43-beta.1",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./ui/index.js",
|
|
@@ -16,11 +16,12 @@
|
|
|
16
16
|
"build:win": "tsdown && tsc --emitDeclarationOnly && copy package.json build && copy README.md build",
|
|
17
17
|
"build-storybook": "storybook build",
|
|
18
18
|
"deploy": "npm run build && npm publish ./build",
|
|
19
|
+
"deploy:beta": "npm run build && npm publish ./build --tag beta",
|
|
19
20
|
"deploy:win": "npm run build:win && npm publish ./build",
|
|
20
21
|
"dev": "yarn storybook",
|
|
21
22
|
"test": "echo \"The tests are still waiting to be written, but it seems like they're really good at procrastinating!\"",
|
|
22
23
|
"lint": "eslint ./packages/ui/**/*.{ts,tsx}",
|
|
23
|
-
"prepare": "husky
|
|
24
|
+
"prepare": "husky"
|
|
24
25
|
},
|
|
25
26
|
"lint-staged": {
|
|
26
27
|
"*.{js,ts,tsx}": "yarn eslint --fix"
|
|
@@ -104,6 +104,7 @@ const GridModals = ({ manageColumnFormVisible, onCloseForm, resetColumnConfig, o
|
|
|
104
104
|
type: "text",
|
|
105
105
|
onChange: handleChangePresetName,
|
|
106
106
|
value: presetName,
|
|
107
|
+
maxLength: 40,
|
|
107
108
|
label: /* @__PURE__ */ jsx(Trans, {
|
|
108
109
|
id: "dataGrid.presetName.title",
|
|
109
110
|
message: "Preset name"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChangeEvent } from 'react';
|
|
2
|
-
import { Filtering, GridActionsType } from '../types';
|
|
1
|
+
import { type ChangeEvent } from 'react';
|
|
2
|
+
import { type Filtering, type GridActionsType } from '../types';
|
|
3
3
|
type Props = {
|
|
4
4
|
gridName?: string;
|
|
5
5
|
filters?: Filtering;
|
|
@@ -15,5 +15,6 @@ type HookType = (props: Props) => {
|
|
|
15
15
|
handleChangePresetName: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
16
16
|
handleCreatePreset: () => void;
|
|
17
17
|
};
|
|
18
|
+
export declare const maxPresetNameLength = 40;
|
|
18
19
|
export declare const useCreatePreset: HookType;
|
|
19
20
|
export {};
|
|
@@ -3,11 +3,12 @@ import { useEvent } from "./useEvent.js";
|
|
|
3
3
|
import { useCallback, useState } from "react";
|
|
4
4
|
import isEmpty from "lodash/isEmpty";
|
|
5
5
|
//#region packages/ui/Blocks/CommonGrid/hooks/useCreatePreset.ts
|
|
6
|
+
const maxPresetNameLength = 40;
|
|
6
7
|
const useCreatePreset = ({ gridName, filters, onClosePresetsModal, setSelectedPresetName, gridActions }) => {
|
|
7
8
|
const { isOpen: isCreatePresetModalOpen, onOpen: onOpenCreatePresetModal, onClose: onCloseCreatePresetModal } = useModal();
|
|
8
9
|
const [presetName, setPresetName] = useState("");
|
|
9
10
|
const handleChangePresetName = useCallback((event) => {
|
|
10
|
-
setPresetName(event.target.value);
|
|
11
|
+
setPresetName(event.target.value.slice(0, 40));
|
|
11
12
|
}, []);
|
|
12
13
|
return {
|
|
13
14
|
isCreatePresetModalOpen,
|
|
@@ -29,4 +30,4 @@ const useCreatePreset = ({ gridName, filters, onClosePresetsModal, setSelectedPr
|
|
|
29
30
|
};
|
|
30
31
|
};
|
|
31
32
|
//#endregion
|
|
32
|
-
export { useCreatePreset };
|
|
33
|
+
export { maxPresetNameLength, useCreatePreset };
|
|
@@ -9,7 +9,7 @@ const getInitials = (user) => {
|
|
|
9
9
|
if (initials) return initials;
|
|
10
10
|
return (user?.username ?? "?").slice(0, 2).toUpperCase();
|
|
11
11
|
};
|
|
12
|
-
const Avatar = ({ user, src, size = 34, colorFront, colorBack, className, hoverColorBack, onClick, withInitials, withChevron, withName }) => {
|
|
12
|
+
const Avatar = ({ user, src, size = 34, colorFront, colorBack, className, hoverColorBack, onClick, withInitials, withChevron, withName, children }) => {
|
|
13
13
|
return /* @__PURE__ */ jsxs(AvatarWrap, {
|
|
14
14
|
onClick,
|
|
15
15
|
children: [
|
|
@@ -29,7 +29,7 @@ const Avatar = ({ user, src, size = 34, colorFront, colorBack, className, hoverC
|
|
|
29
29
|
!src && !withInitials && /* @__PURE__ */ jsx(Profile, { stroke: colorFront })
|
|
30
30
|
]
|
|
31
31
|
}),
|
|
32
|
-
withName && user?.username,
|
|
32
|
+
/* @__PURE__ */ jsxs("div", { children: [withName && user?.username, children] }),
|
|
33
33
|
withChevron && /* @__PURE__ */ jsx(Chevron, { children: /* @__PURE__ */ jsx(Icon, {
|
|
34
34
|
icon: "goDown",
|
|
35
35
|
fill: "white",
|
package/ui/Forms/Input/Input.js
CHANGED
|
@@ -39,7 +39,11 @@ const Input = ({ appearance = "primary", type, name, label, value, icon, variant
|
|
|
39
39
|
]);
|
|
40
40
|
const handleBlur = useCallback((event) => {
|
|
41
41
|
onBlur?.(event);
|
|
42
|
-
if (forceFocus
|
|
42
|
+
if (forceFocus) {
|
|
43
|
+
const relatedTag = event.relatedTarget?.tagName?.toLowerCase();
|
|
44
|
+
const relatedType = event.relatedTarget?.type?.toLowerCase();
|
|
45
|
+
if (!(relatedTag === "input" && allowedInputTypes.includes(relatedType)) && !(relatedTag === "textarea")) event.target?.focus();
|
|
46
|
+
}
|
|
43
47
|
}, [forceFocus, onBlur]);
|
|
44
48
|
const handleKeyDown = useCallback((event) => {
|
|
45
49
|
if (event.key === "Enter") onEnter?.();
|