@astral/ui 4.36.0 → 4.37.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.
Files changed (110) hide show
  1. package/components/Autocomplete/Autocomplete.d.ts +1 -1
  2. package/components/Autocomplete/Autocomplete.js +53 -15
  3. package/components/Autocomplete/constants.d.ts +6 -0
  4. package/components/Autocomplete/constants.js +7 -0
  5. package/components/Autocomplete/styles.js +15 -1
  6. package/components/Autocomplete/useLogic/useLogic.d.ts +2 -1
  7. package/components/Autocomplete/useLogic/useLogic.js +11 -2
  8. package/components/TagsList/Tag/Tag.d.ts +1 -1
  9. package/components/TagsList/Tag/constants.d.ts +1 -0
  10. package/components/TagsList/Tag/constants.js +1 -0
  11. package/components/TagsList/Tag/index.d.ts +1 -0
  12. package/components/TagsList/Tag/index.js +1 -0
  13. package/components/TagsList/Tag/styles.js +2 -0
  14. package/components/TagsList/TagsList.js +6 -6
  15. package/components/TagsList/constants.d.ts +2 -0
  16. package/components/TagsList/constants.js +2 -0
  17. package/components/TagsList/styles.js +5 -1
  18. package/components/TagsList/types.d.ts +14 -5
  19. package/components/TagsList/useLogic/useLogic.d.ts +5 -5
  20. package/components/TagsList/useLogic/useLogic.js +70 -110
  21. package/components/TagsList/utils/calculateVisibleTagsCount/calculateVisibleTagsCount.d.ts +6 -0
  22. package/components/TagsList/utils/calculateVisibleTagsCount/calculateVisibleTagsCount.js +35 -0
  23. package/components/TagsList/utils/calculateVisibleTagsCount/index.d.ts +1 -0
  24. package/components/TagsList/utils/calculateVisibleTagsCount/index.js +1 -0
  25. package/components/TagsList/utils/getAvailableWidth/getAvailableWidth.d.ts +1 -0
  26. package/components/TagsList/utils/getAvailableWidth/getAvailableWidth.js +7 -0
  27. package/components/TagsList/utils/getAvailableWidth/index.d.ts +1 -0
  28. package/components/TagsList/utils/getAvailableWidth/index.js +1 -0
  29. package/components/TagsList/utils/getKey/getKey.d.ts +1 -1
  30. package/components/TagsList/utils/getKey/getKey.js +6 -3
  31. package/components/TagsList/utils/getTagWidth/getTagWidth.d.ts +2 -0
  32. package/components/TagsList/utils/getTagWidth/getTagWidth.js +21 -0
  33. package/components/TagsList/utils/getTagWidth/index.d.ts +1 -0
  34. package/components/TagsList/utils/getTagWidth/index.js +1 -0
  35. package/components/TagsList/utils/index.d.ts +3 -0
  36. package/components/TagsList/utils/index.js +3 -0
  37. package/components/TextField/TextField.js +6 -5
  38. package/components/TextField/constants.d.ts +1 -0
  39. package/components/TextField/constants.js +1 -0
  40. package/components/TextField/styles.js +4 -0
  41. package/components/TreeAsyncAutocomplete/OptionsModal/styles.js +1 -1
  42. package/components/TreeAutocomplete/OptionsModal/OptionsModal.js +1 -1
  43. package/components/TreeAutocomplete/OptionsModal/styles.d.ts +4 -0
  44. package/components/TreeAutocomplete/OptionsModal/styles.js +10 -3
  45. package/components/TreeAutocomplete/OptionsModal/useLogic/useLogic.d.ts +5 -3
  46. package/components/TreeAutocomplete/OptionsModal/useLogic/useLogic.js +2 -1
  47. package/components/TreeLikeAsyncAutocomplete/Input/Input.js +1 -1
  48. package/components/TreeLikeAsyncAutocomplete/OptionsModal/styles.js +1 -1
  49. package/components/TreeLikeAutocomplete/OptionsModal/OptionsModal.js +1 -1
  50. package/components/TreeLikeAutocomplete/OptionsModal/styles.d.ts +4 -0
  51. package/components/TreeLikeAutocomplete/OptionsModal/styles.js +10 -3
  52. package/components/TreeLikeAutocomplete/OptionsModal/useLogic/useLogic.d.ts +5 -3
  53. package/components/TreeLikeAutocomplete/OptionsModal/useLogic/useLogic.js +2 -1
  54. package/node/components/Autocomplete/Autocomplete.d.ts +1 -1
  55. package/node/components/Autocomplete/Autocomplete.js +51 -13
  56. package/node/components/Autocomplete/constants.d.ts +6 -0
  57. package/node/components/Autocomplete/constants.js +8 -1
  58. package/node/components/Autocomplete/styles.js +15 -1
  59. package/node/components/Autocomplete/useLogic/useLogic.d.ts +2 -1
  60. package/node/components/Autocomplete/useLogic/useLogic.js +10 -1
  61. package/node/components/TagsList/Tag/Tag.d.ts +1 -1
  62. package/node/components/TagsList/Tag/constants.d.ts +1 -0
  63. package/node/components/TagsList/Tag/constants.js +4 -0
  64. package/node/components/TagsList/Tag/index.d.ts +1 -0
  65. package/node/components/TagsList/Tag/index.js +1 -0
  66. package/node/components/TagsList/Tag/styles.js +2 -0
  67. package/node/components/TagsList/TagsList.js +6 -6
  68. package/node/components/TagsList/constants.d.ts +2 -0
  69. package/node/components/TagsList/constants.js +5 -0
  70. package/node/components/TagsList/styles.js +5 -1
  71. package/node/components/TagsList/types.d.ts +14 -5
  72. package/node/components/TagsList/useLogic/useLogic.d.ts +5 -5
  73. package/node/components/TagsList/useLogic/useLogic.js +70 -110
  74. package/node/components/TagsList/utils/calculateVisibleTagsCount/calculateVisibleTagsCount.d.ts +6 -0
  75. package/node/components/TagsList/utils/calculateVisibleTagsCount/calculateVisibleTagsCount.js +39 -0
  76. package/node/components/TagsList/utils/calculateVisibleTagsCount/index.d.ts +1 -0
  77. package/node/components/TagsList/utils/calculateVisibleTagsCount/index.js +5 -0
  78. package/node/components/TagsList/utils/getAvailableWidth/getAvailableWidth.d.ts +1 -0
  79. package/node/components/TagsList/utils/getAvailableWidth/getAvailableWidth.js +11 -0
  80. package/node/components/TagsList/utils/getAvailableWidth/index.d.ts +1 -0
  81. package/node/components/TagsList/utils/getAvailableWidth/index.js +5 -0
  82. package/node/components/TagsList/utils/getKey/getKey.d.ts +1 -1
  83. package/node/components/TagsList/utils/getKey/getKey.js +6 -3
  84. package/node/components/TagsList/utils/getTagWidth/getTagWidth.d.ts +2 -0
  85. package/node/components/TagsList/utils/getTagWidth/getTagWidth.js +25 -0
  86. package/node/components/TagsList/utils/getTagWidth/index.d.ts +1 -0
  87. package/node/components/TagsList/{public.js → utils/getTagWidth/index.js} +1 -2
  88. package/node/components/TagsList/utils/index.d.ts +3 -0
  89. package/node/components/TagsList/utils/index.js +7 -1
  90. package/node/components/TextField/TextField.js +6 -5
  91. package/node/components/TextField/constants.d.ts +1 -0
  92. package/node/components/TextField/constants.js +1 -0
  93. package/node/components/TextField/styles.js +4 -0
  94. package/node/components/TreeAsyncAutocomplete/OptionsModal/styles.js +1 -1
  95. package/node/components/TreeAutocomplete/OptionsModal/OptionsModal.js +1 -1
  96. package/node/components/TreeAutocomplete/OptionsModal/styles.d.ts +4 -0
  97. package/node/components/TreeAutocomplete/OptionsModal/styles.js +10 -3
  98. package/node/components/TreeAutocomplete/OptionsModal/useLogic/useLogic.d.ts +5 -3
  99. package/node/components/TreeAutocomplete/OptionsModal/useLogic/useLogic.js +2 -1
  100. package/node/components/TreeLikeAsyncAutocomplete/Input/Input.js +1 -1
  101. package/node/components/TreeLikeAsyncAutocomplete/OptionsModal/styles.js +1 -1
  102. package/node/components/TreeLikeAutocomplete/OptionsModal/OptionsModal.js +1 -1
  103. package/node/components/TreeLikeAutocomplete/OptionsModal/styles.d.ts +4 -0
  104. package/node/components/TreeLikeAutocomplete/OptionsModal/styles.js +10 -3
  105. package/node/components/TreeLikeAutocomplete/OptionsModal/useLogic/useLogic.d.ts +5 -3
  106. package/node/components/TreeLikeAutocomplete/OptionsModal/useLogic/useLogic.js +2 -1
  107. package/package.json +1 -1
  108. package/components/TagsList/public.d.ts +0 -2
  109. package/components/TagsList/public.js +0 -2
  110. package/node/components/TagsList/public.d.ts +0 -2
@@ -1,15 +1,17 @@
1
1
  import { type ButtonProps } from '../../../Button';
2
- import { type DialogProps } from '../../../Dialog';
2
+ import { type DialogProps, type DialogSize } from '../../../Dialog';
3
3
  import { type SearchFieldProps } from '../../../SearchField';
4
4
  import { type TreeListProps } from '../../../Tree';
5
5
  import { type OptionsModalProps } from '../types';
6
6
  type UseLogicResult = {
7
7
  isNoResult: boolean;
8
8
  searchFieldProps: SearchFieldProps;
9
- modalProps: Partial<DialogProps>;
9
+ modalProps: Partial<DialogProps> & {
10
+ size: DialogSize;
11
+ };
10
12
  treeListProps: TreeListProps;
11
13
  cancelButtonProps: ButtonProps;
12
14
  confirmButtonProps: ButtonProps;
13
15
  };
14
- export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }: OptionsModalProps) => UseLogicResult;
16
+ export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size, }: OptionsModalProps) => UseLogicResult;
15
17
  export {};
@@ -4,7 +4,7 @@ exports.useLogic = void 0;
4
4
  const react_1 = require("react");
5
5
  const array_1 = require("../../../utils/array");
6
6
  const utils_1 = require("./utils");
7
- const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }) => {
7
+ const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size = 'md', }) => {
8
8
  const [value, setValue] = (0, react_1.useState)(initialValue);
9
9
  const [searchValue, setSearchValue] = (0, react_1.useState)();
10
10
  (0, react_1.useEffect)(() => {
@@ -50,6 +50,7 @@ const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, fi
50
50
  isNoResult,
51
51
  modalProps: {
52
52
  onClose: handleClose,
53
+ size,
53
54
  },
54
55
  searchFieldProps: {
55
56
  value: searchValue,
@@ -12,7 +12,7 @@ const styles_1 = require("./styles");
12
12
  const useLogic_1 = require("./useLogic");
13
13
  const ClearButton = ({ disabled, onClick }) => ((0, jsx_runtime_1.jsx)(IconButton_1.IconButton, { variant: "text", color: "grey", disabled: disabled, onClick: onClick, title: constants_1.CLEAR_TEXT, "aria-label": constants_1.CLEAR_TEXT, children: (0, jsx_runtime_1.jsx)(CrossOutlineMd_1.CrossOutlineMd, {}) }));
14
14
  exports.Input = (0, react_1.forwardRef)(({ disabled, onChange: propsOnChange, value, inputRef, hideHelperText = false, onClick, isLoading, ...restProps }, forwardedRef) => {
15
- const { isVisibleClearButton, onChange, isVisibleTagsList, textFieldProps, onClearAll, } = (0, useLogic_1.useLogic)({
15
+ const { isVisibleClearButton, isVisibleTagsList, onChange, textFieldProps, onClearAll, } = (0, useLogic_1.useLogic)({
16
16
  inputRef,
17
17
  value,
18
18
  onChange: propsOnChange,
@@ -16,7 +16,7 @@ exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent
16
16
  gap: ${({ theme }) => theme.spacing(4)};
17
17
 
18
18
  width: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
19
- height: ${({ $size }) => ($size === 'md' ? '500px' : `calc(${Dialog_1.DIALOG_SIZES[$size].minWidth} - 50px)`)};
19
+ height: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
20
20
 
21
21
  ${({ theme }) => theme.breakpoints.down('sm')} {
22
22
  width: auto;
@@ -28,6 +28,6 @@ const OptionsModal = (props) => {
28
28
  }
29
29
  return ((0, jsx_runtime_1.jsx)(TreeLikeList_1.TreeLikeList, { isConfirmChildrenSelection: isConfirmChildrenSelection, ...treeProps, ...treeLikeListProps }));
30
30
  };
31
- return ((0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { ...externalDialogProps, disableRestoreFocus: true, open: isOpen, ...modalProps, children: [(0, jsx_runtime_1.jsxs)(styles_1.StyledDialogContent, { children: [(0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { fullWidth: true, ...searchFieldProps }), (0, jsx_runtime_1.jsx)(Paper_1.Paper, { variant: "outlined", children: (0, jsx_runtime_1.jsx)(styles_1.TreeListWrapper, { children: renderComponent() }) })] }), (0, jsx_runtime_1.jsxs)(DialogActions_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { ...confirmButtonProps, children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" })] })] }));
31
+ return ((0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { ...externalDialogProps, disableRestoreFocus: true, open: isOpen, ...modalProps, children: [(0, jsx_runtime_1.jsxs)(styles_1.StyledDialogContent, { "$size": modalProps.size, children: [(0, jsx_runtime_1.jsx)(SearchField_1.SearchField, { fullWidth: true, ...searchFieldProps }), (0, jsx_runtime_1.jsx)(Paper_1.Paper, { variant: "outlined", children: (0, jsx_runtime_1.jsx)(styles_1.TreeListWrapper, { children: renderComponent() }) })] }), (0, jsx_runtime_1.jsxs)(DialogActions_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", ...cancelButtonProps, children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { ...confirmButtonProps, children: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C" })] })] }));
32
32
  };
33
33
  exports.OptionsModal = OptionsModal;
@@ -1,8 +1,12 @@
1
1
  /// <reference types="react" />
2
+ type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
2
3
  export declare const StyledDialogContent: import("@emotion/styled/dist/declarations/src/types").StyledComponent<import("../../DialogContent").DialogContentProps & {
3
4
  theme?: import("@emotion/react").Theme | undefined;
5
+ } & {
6
+ $size: Size;
4
7
  }, {}, {}>;
5
8
  export declare const TreeListWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
6
9
  theme?: import("@emotion/react").Theme | undefined;
7
10
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
8
11
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
12
+ export {};
@@ -1,16 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TreeListWrapper = exports.StyledDialogContent = void 0;
4
+ const Dialog_1 = require("../../Dialog");
4
5
  const DialogContent_1 = require("../../DialogContent");
5
6
  const styled_1 = require("../../styled");
6
- exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent) `
7
+ exports.StyledDialogContent = (0, styled_1.styled)(DialogContent_1.DialogContent, {
8
+ shouldForwardProp: (prop) => !['$size'].includes(prop),
9
+ }) `
7
10
  display: grid;
8
11
  grid-template-columns: 100%;
9
12
  grid-template-rows: max-content 1fr;
10
13
  gap: ${({ theme }) => theme.spacing(4)};
11
14
 
12
- width: 100%;
13
- height: 500px;
15
+ width: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
16
+ height: ${({ $size }) => Dialog_1.DIALOG_SIZES[$size].minWidth};
17
+
18
+ ${({ theme }) => theme.breakpoints.down('sm')} {
19
+ width: auto;
20
+ }
14
21
  `;
15
22
  exports.TreeListWrapper = styled_1.styled.div `
16
23
  overflow: auto;
@@ -1,5 +1,5 @@
1
1
  import { type ButtonProps } from '../../../Button';
2
- import { type DialogProps } from '../../../Dialog';
2
+ import { type DialogProps, type DialogSize } from '../../../Dialog';
3
3
  import { type SearchFieldProps } from '../../../SearchField';
4
4
  import { type TreeLikeListProps } from '../../../TreeLikeList';
5
5
  import { type OptionsModalProps } from '../types';
@@ -7,10 +7,12 @@ type UseLogicParams = OptionsModalProps;
7
7
  type UseLogicResult = {
8
8
  isNoResult: boolean;
9
9
  searchFieldProps: SearchFieldProps;
10
- modalProps: Partial<DialogProps>;
10
+ modalProps: Partial<DialogProps> & {
11
+ size: DialogSize;
12
+ };
11
13
  treeLikeListProps: TreeLikeListProps;
12
14
  cancelButtonProps: ButtonProps;
13
15
  confirmButtonProps: ButtonProps;
14
16
  };
15
- export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }: UseLogicParams) => UseLogicResult;
17
+ export declare const useLogic: ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size, }: UseLogicParams) => UseLogicResult;
16
18
  export {};
@@ -4,7 +4,7 @@ exports.useLogic = void 0;
4
4
  const react_1 = require("react");
5
5
  const array_1 = require("../../../utils/array");
6
6
  const utils_1 = require("./utils");
7
- const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, }) => {
7
+ const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, filterOptions, onChange, onClose, size = 'md', }) => {
8
8
  const [value, setValue] = (0, react_1.useState)(initialValue);
9
9
  const [searchValue, setSearchValue] = (0, react_1.useState)();
10
10
  (0, react_1.useEffect)(() => {
@@ -50,6 +50,7 @@ const useLogic = ({ isOpen, isLoading, isLoadingError, initialValue, options, fi
50
50
  isNoResult,
51
51
  modalProps: {
52
52
  onClose: handleClose,
53
+ size,
53
54
  },
54
55
  searchFieldProps: {
55
56
  value: searchValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.36.0",
3
+ "version": "4.37.0",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {
@@ -1,2 +0,0 @@
1
- export * from './TagsList';
2
- export * from './types';
@@ -1,2 +0,0 @@
1
- export * from './TagsList';
2
- export * from './types';
@@ -1,2 +0,0 @@
1
- export * from './TagsList';
2
- export * from './types';