@mailstep/design-system 0.8.47 → 0.8.48

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.8.47",
3
+ "version": "0.8.48",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -40,10 +40,10 @@
40
40
  "@lingui/core": "^5.0.0",
41
41
  "@lingui/react": "^5.0.0",
42
42
  "@popperjs/core": "^2.11.8",
43
- "@storybook/addon-designs": "^11.1.3",
44
- "@storybook/addon-docs": "10.4.2",
45
- "@storybook/addon-links": "10.4.2",
46
- "@storybook/react-webpack5": "10.4.2",
43
+ "@storybook/addon-designs": "^11.1.2",
44
+ "@storybook/addon-docs": "10.2.8",
45
+ "@storybook/addon-links": "10.2.8",
46
+ "@storybook/react-webpack5": "10.2.8",
47
47
  "@svgr/rollup": "^8.0.1",
48
48
  "@swc/core": "^1.15.30",
49
49
  "@trivago/prettier-plugin-sort-imports": "^4.3.0",
@@ -73,7 +73,7 @@
73
73
  "eslint-plugin-react": "^7.35.0",
74
74
  "eslint-plugin-react-hooks": "^4.6.2",
75
75
  "eslint-plugin-react-perf": "^3.3.2",
76
- "eslint-plugin-storybook": "10.4.2",
76
+ "eslint-plugin-storybook": "10.2.8",
77
77
  "faker": "^5.1.0",
78
78
  "husky": "^9.1.7",
79
79
  "immer": "^9.0.19",
@@ -96,7 +96,7 @@
96
96
  "react-use-draggable-scroll": "^0.4.7",
97
97
  "redux": ">=4.0.5",
98
98
  "reselect": "5.0.0-alpha.2",
99
- "storybook": "10.4.2",
99
+ "storybook": "10.2.8",
100
100
  "string-width": "6.1.0",
101
101
  "styled-components": "^5.3.10",
102
102
  "swiper": "^11.0.3",
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
- export type FlagAppearanceType = 'neutralBold' | 'neutralMedium' | 'neutralSubtle' | 'blueBold' | 'blueSubtle' | 'tealBold' | 'tealSubtle' | 'greenBold' | 'greenSubtle' | 'orangeBold' | 'orangeSubtle' | 'yellowBold' | 'yellowSubtle' | 'pinkBold' | 'pinkSubtle' | 'purpleBold' | 'purpleSubtle' | 'redBold' | 'redSubtle';
2
+ export type FlagAppearanceType = 'neutralBold' | 'neutralSubtle' | 'blueBold' | 'blueSubtle' | 'tealBold' | 'tealSubtle' | 'greenBold' | 'greenSubtle' | 'orangeBold' | 'orangeSubtle' | 'yellowBold' | 'yellowSubtle' | 'pinkBold' | 'pinkSubtle' | 'purpleBold' | 'purpleSubtle' | 'redBold' | 'redSubtle';
3
3
  export declare const flagAppearanceToColorMap: {
4
4
  neutralBold: string;
5
- neutralMedium: string;
6
5
  neutralSubtle: string;
7
6
  blueBold: string;
8
7
  blueSubtle: string;
@@ -23,7 +22,6 @@ export declare const flagAppearanceToColorMap: {
23
22
  };
24
23
  export declare const flagAppearanceToFontColorMap: {
25
24
  neutralBold: string;
26
- neutralMedium: string;
27
25
  neutralSubtle: string;
28
26
  blueBold: string;
29
27
  blueSubtle: string;
@@ -48,7 +48,6 @@ const OverflowWrap = styled$1.span`
48
48
  `;
49
49
  const flagAppearanceToColorMap = {
50
50
  neutralBold: "neutral300",
51
- neutralMedium: "#D2D8DF",
52
51
  neutralSubtle: "bgLightGray2",
53
52
  blueBold: "blue70",
54
53
  blueSubtle: "blue20",
@@ -69,7 +68,6 @@ const flagAppearanceToColorMap = {
69
68
  };
70
69
  const flagAppearanceToFontColorMap = {
71
70
  neutralBold: "white",
72
- neutralMedium: "#22394E",
73
71
  neutralSubtle: "#22394E",
74
72
  blueBold: "#ffffff",
75
73
  blueSubtle: "blue80",
@@ -18,6 +18,7 @@ declare const meta: {
18
18
  }>;
19
19
  tags: string[];
20
20
  argTypes: {};
21
+ decorators: never[];
21
22
  };
22
23
  export default meta;
23
24
  type Story = StoryObj<typeof meta>;
@@ -5,7 +5,7 @@ import "../Label/index.js";
5
5
  import SpaceAround_default from "../SpaceAround/index.js";
6
6
  import { StyledAsyncSelect, StyledReactSelect, Wrapper } from "./styles.js";
7
7
  import { useStylesAndComponents } from "./themes/index.js";
8
- import { useCallback, useMemo } from "react";
8
+ import { useCallback, useMemo, useRef } from "react";
9
9
  import { useTheme } from "@xstyled/styled-components";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { i18n } from "@lingui/core";
@@ -22,9 +22,41 @@ const loadingMessage = () => i18n._({
22
22
  const Select = ({ label, name, value = "", options = emptyOptions, defaultOptions, loadOptions, onChange, onBlur, error, isInvalid, isLoading, isDarkPlaceholderText, spaceAround = false, disabled, onInputChange, isSearchable, isMulti, className, useSimplifiedOptions = false, showSelectAllButton = false, shortValues = true, shortVariant = "block", style, optionVariant, multiLabelVariant, containerVariant, placeholder, placeholderIcon, innerRef, maxMenuHeight, getOptionValue, onIconClick, title, ...passTroughProps }) => {
23
23
  const isAsync = !!loadOptions;
24
24
  if (showSelectAllButton && !isMulti) console.error("CheckboxSelect incompatible props");
25
- const setAllOptions = useCallback(({ options }) => {
26
- onChange?.(options || []);
27
- }, [onChange, options]);
25
+ const localGetOptionValue = useMemo(() => getOptionValue || ((option) => option?.value), [getOptionValue]);
26
+ const availableOptionsByValue = useMemo(() => {
27
+ const map = /* @__PURE__ */ new Map();
28
+ for (const option of [...defaultOptions || [], ...options || []]) map.set(localGetOptionValue(option), option);
29
+ return map;
30
+ }, [
31
+ defaultOptions,
32
+ options,
33
+ localGetOptionValue
34
+ ]);
35
+ const selectedHistoryRef = useRef(/* @__PURE__ */ new Map());
36
+ const resolveOption = useCallback((optionValue) => availableOptionsByValue.get(optionValue) || selectedHistoryRef.current.get(optionValue), [availableOptionsByValue]);
37
+ let selectedOption = null;
38
+ if (Array.isArray(value)) {
39
+ const resolved = value.map(resolveOption).filter((option) => Boolean(option));
40
+ selectedOption = resolved.length ? resolved : null;
41
+ } else if (value !== void 0) selectedOption = resolveOption(value) || null;
42
+ const handleChange = useCallback((newValue) => {
43
+ (Array.isArray(newValue) ? newValue : newValue ? [newValue] : []).forEach((option) => option && selectedHistoryRef.current.set(localGetOptionValue(option), option));
44
+ onChange?.(newValue);
45
+ }, [onChange, localGetOptionValue]);
46
+ const setAllOptions = useCallback(({ options: optionsToAdd }) => {
47
+ const merged = [...Array.isArray(selectedOption) ? selectedOption : selectedOption ? [selectedOption] : []];
48
+ const visibleOptions = optionsToAdd || [];
49
+ for (const option of visibleOptions) {
50
+ const optionValue = localGetOptionValue(option);
51
+ if (!merged.some((selected) => localGetOptionValue(selected) === optionValue)) merged.push(resolveOption(optionValue) || option);
52
+ }
53
+ handleChange(merged);
54
+ }, [
55
+ handleChange,
56
+ selectedOption,
57
+ localGetOptionValue,
58
+ resolveOption
59
+ ]);
28
60
  const unsetAllOptions = useCallback(() => {
29
61
  if (typeof onChange === "function") onChange?.(emptyOptions);
30
62
  }, [onChange]);
@@ -32,12 +64,6 @@ const Select = ({ label, name, value = "", options = emptyOptions, defaultOption
32
64
  const modifiedMaxMenuHeight = showSelectAllButton && maxMenuHeight ? maxMenuHeight - 30 : maxMenuHeight;
33
65
  const [customComponents, customTheme, customStyles] = useStylesAndComponents(style, optionVariant, multiLabelVariant, containerVariant, useSimplifiedOptions, showSelectAllButton);
34
66
  const RenderComponent = isAsync ? StyledAsyncSelect : StyledReactSelect;
35
- let selectedOption;
36
- const localGetOptionValue = useMemo(() => getOptionValue || ((option) => option?.value), [getOptionValue]);
37
- if (Array.isArray(value)) {
38
- selectedOption = (defaultOptions || options).filter((option) => value.includes(localGetOptionValue(option)));
39
- selectedOption = selectedOption?.length ? selectedOption : null;
40
- } else if (value !== void 0) selectedOption = (defaultOptions || options).find((option) => localGetOptionValue(option) === value) || null;
41
67
  const theme = useTheme();
42
68
  const handleLoadOptions = useMemo(() => {
43
69
  return loadOptions ? async (fulltext) => await loadOptions(fulltext) : void 0;
@@ -56,7 +82,7 @@ const Select = ({ label, name, value = "", options = emptyOptions, defaultOption
56
82
  loadOptions: handleLoadOptions,
57
83
  defaultOptions,
58
84
  value: selectedOption,
59
- onChange,
85
+ onChange: handleChange,
60
86
  onBlur,
61
87
  isDisabled: disabled || isLoading,
62
88
  isLoading,
@@ -1,12 +0,0 @@
1
- import type { StoryObj } from '@storybook/react-webpack5';
2
- declare const meta: {
3
- title: string;
4
- component: import("react").FC<{
5
- children: React.ReactNode;
6
- }>;
7
- tags: string[];
8
- argTypes: {};
9
- };
10
- export default meta;
11
- type Story = StoryObj<typeof meta>;
12
- export declare const Default: Story;
@@ -1,16 +0,0 @@
1
- import { type FC } from 'react';
2
- declare const meta: {
3
- title: string;
4
- component: FC<{
5
- parentRef: React.MutableRefObject<HTMLDivElement | null | undefined>;
6
- onClose?: () => void;
7
- children: React.ReactNode;
8
- placement?: import("@popperjs/core").Placement;
9
- wrapper?: import("styled-components").StyledComponent<any, any>;
10
- ignoreClickOutsideClosest?: string;
11
- }>;
12
- tags: string[];
13
- argTypes: {};
14
- };
15
- export default meta;
16
- export declare const Default: FC;
@@ -1,11 +0,0 @@
1
- import { type FC } from 'react';
2
- declare const meta: {
3
- title: string;
4
- component: import("react").NamedExoticComponent<import("../DatePicker").DatePickerType>;
5
- tags: string[];
6
- argTypes: {};
7
- };
8
- export default meta;
9
- export declare const Default: FC;
10
- export declare const WithTime: FC;
11
- export declare const Disabled: FC;
@@ -1,10 +0,0 @@
1
- import { type FC } from 'react';
2
- declare const meta: {
3
- title: string;
4
- component: <T extends import("../types").Item>({ items, showMenu, className, ItemComponent, header, footer, ...rest }: import("../types").DropdownMenuProps<T>) => import("react").ReactElement;
5
- tags: string[];
6
- argTypes: {};
7
- };
8
- export default meta;
9
- export declare const Default: FC;
10
- export declare const WithCounts: FC;
@@ -1,22 +0,0 @@
1
- import type { StoryObj } from '@storybook/react-webpack5';
2
- declare const meta: {
3
- title: string;
4
- component: import("react").FC<{
5
- label: string | import("react").ReactNode;
6
- appearance?: import("../../Button").AppearanceValue;
7
- variant?: import("../../Button/types").VariantValue;
8
- options: import("../DropdownSelect").DropdownSelectItem[];
9
- showChevron?: boolean;
10
- onSelect?: (value: import("../DropdownSelect").DropdownSelectItem["value"]) => void;
11
- icon?: import("react").ReactNode;
12
- disabled?: boolean;
13
- ButtonComponent?: React.FC;
14
- }>;
15
- tags: string[];
16
- argTypes: {};
17
- };
18
- export default meta;
19
- type Story = StoryObj<typeof meta>;
20
- export declare const Default: Story;
21
- export declare const WithoutChevron: Story;
22
- export declare const Disabled: Story;
@@ -1,31 +0,0 @@
1
- import type { StoryObj } from '@storybook/react-webpack5';
2
- declare const meta: {
3
- title: string;
4
- component: import("react").FC<{
5
- children: React.ReactNode;
6
- appearance: import("../HighlightBox").FlagAppearanceType;
7
- size?: "default" | "small" | "wide" | "fitContent";
8
- className?: string;
9
- cursor?: string;
10
- prefix?: string;
11
- }>;
12
- tags: string[];
13
- argTypes: {
14
- appearance: {
15
- control: "select";
16
- options: string[];
17
- };
18
- size: {
19
- control: "select";
20
- options: string[];
21
- };
22
- };
23
- };
24
- export default meta;
25
- type Story = StoryObj<typeof meta>;
26
- export declare const Default: Story;
27
- export declare const Subtle: Story;
28
- export declare const Small: Story;
29
- export declare const Wide: Story;
30
- export declare const FitContent: Story;
31
- export declare const AllAppearances: Story;
@@ -1,11 +0,0 @@
1
- import { type FC } from 'react';
2
- declare const meta: {
3
- title: string;
4
- component: FC<{
5
- children?: import("react").ReactNode;
6
- }>;
7
- tags: string[];
8
- argTypes: {};
9
- };
10
- export default meta;
11
- export declare const Default: FC;
@@ -1,13 +0,0 @@
1
- import type { StoryObj } from '@storybook/react-webpack5';
2
- declare const meta: {
3
- title: string;
4
- component: import("styled-components").StyledComponent<typeof import("react-router-dom").Link, import("@xstyled/styled-components").Theme, import("../SimpleLink").Props, never>;
5
- tags: string[];
6
- argTypes: {};
7
- };
8
- export default meta;
9
- type Story = StoryObj<typeof meta>;
10
- export declare const Default: Story;
11
- export declare const Decorated: Story;
12
- export declare const Disabled: Story;
13
- export declare const External: Story;
@@ -1,10 +0,0 @@
1
- import { type FC } from 'react';
2
- declare const meta: {
3
- title: string;
4
- component: FC<import("../SingleSelect").Props>;
5
- tags: string[];
6
- argTypes: {};
7
- };
8
- export default meta;
9
- export declare const Default: FC;
10
- export declare const Searchable: FC;