@max-ts/components 0.2.2 → 0.2.4

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 (64) hide show
  1. package/lib/components/Autocomplete/Autocomplete.mjs +53 -53
  2. package/lib/components/DataGrid/Body/Body.d.ts +1 -29
  3. package/lib/components/DataGrid/Body/Body.mjs +26 -29
  4. package/lib/components/DataGrid/DataGrid.d.ts +0 -53
  5. package/lib/components/DataGrid/DataGrid.mjs +49 -71
  6. package/lib/components/DataGrid/HeadCell/HeadCell.mjs +21 -20
  7. package/lib/components/DataGrid/HeadCell/styles.mjs +3 -2
  8. package/lib/components/DataGrid/Row/Row.d.ts +1 -38
  9. package/lib/components/DataGrid/Row/Row.mjs +55 -147
  10. package/lib/components/DataGrid/Row/constants.d.ts +0 -1
  11. package/lib/components/DataGrid/Row/constants.mjs +2 -3
  12. package/lib/components/DataGrid/Row/index.d.ts +0 -1
  13. package/lib/components/DataGrid/Row/styles.d.ts +0 -22
  14. package/lib/components/DataGrid/Row/styles.mjs +11 -78
  15. package/lib/components/DataGrid/Row/useLogic/useLogic.d.ts +2 -10
  16. package/lib/components/DataGrid/Row/useLogic/useLogic.mjs +36 -67
  17. package/lib/components/DataGrid/constants.d.ts +0 -3
  18. package/lib/components/DataGrid/constants.mjs +3 -6
  19. package/lib/components/DataGrid/enums.d.ts +0 -4
  20. package/lib/components/DataGrid/enums.mjs +2 -3
  21. package/lib/components/DataGrid/faker.d.ts +1 -1
  22. package/lib/components/DataGrid/types.d.ts +2 -7
  23. package/lib/components/DataGrid/useLogic/useLogic.d.ts +1 -6
  24. package/lib/components/DataGrid/useLogic/useLogic.mjs +31 -36
  25. package/lib/components/DataGridActionCell/useLogic/useLogic.mjs +13 -42
  26. package/lib/components/DataGridPagination/DataGridPagination.mjs +9 -9
  27. package/lib/components/DataGridPagination/faker.d.ts +1 -1
  28. package/lib/components/SearchField/SearchField.d.ts +3 -1
  29. package/lib/components/SearchField/SearchField.mjs +40 -37
  30. package/lib/components/SearchField/styles.mjs +7 -9
  31. package/lib/components/Select/Select.d.ts +1 -1
  32. package/lib/components/Select/Select.mjs +1 -1
  33. package/lib/components/TextField/TextField.d.ts +1 -1
  34. package/lib/components/TextField/TextField.mjs +26 -26
  35. package/lib/index.mjs +189 -197
  36. package/lib/theme/components/MuiAutocomplete.mjs +1 -2
  37. package/package.json +13 -13
  38. package/lib/components/DataGrid/DataGridContext/DataGridContext.d.ts +0 -7
  39. package/lib/components/DataGrid/DataGridContext/DataGridContext.mjs +0 -12
  40. package/lib/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.d.ts +0 -6
  41. package/lib/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.mjs +0 -41
  42. package/lib/components/DataGrid/DataGridContext/DataGridProvider/index.d.ts +0 -1
  43. package/lib/components/DataGrid/DataGridContext/index.d.ts +0 -2
  44. package/lib/components/DataGrid/Row/NestedChildren/NestedChildren.d.ts +0 -55
  45. package/lib/components/DataGrid/Row/NestedChildren/NestedChildren.mjs +0 -72
  46. package/lib/components/DataGrid/Row/NestedChildren/index.d.ts +0 -1
  47. package/lib/components/DataGrid/Row/NestedChildren/styles.d.ts +0 -20
  48. package/lib/components/DataGrid/Row/NestedChildren/styles.mjs +0 -68
  49. package/lib/components/DataGrid/Row/NestedChildren/useLogic/index.d.ts +0 -1
  50. package/lib/components/DataGrid/Row/NestedChildren/useLogic/useLogic.d.ts +0 -18
  51. package/lib/components/DataGrid/Row/NestedChildren/useLogic/useLogic.mjs +0 -27
  52. package/lib/components/DataGrid/Row/RowContext/RowContext.d.ts +0 -7
  53. package/lib/components/DataGrid/Row/RowContext/RowContext.mjs +0 -11
  54. package/lib/components/DataGrid/Row/RowContext/RowProvider/RowProvider.d.ts +0 -6
  55. package/lib/components/DataGrid/Row/RowContext/RowProvider/RowProvider.mjs +0 -25
  56. package/lib/components/DataGrid/Row/RowContext/RowProvider/index.d.ts +0 -1
  57. package/lib/components/DataGrid/Row/RowContext/index.d.ts +0 -2
  58. package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/getColumnsMap.d.ts +0 -4
  59. package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/getColumnsMap.mjs +0 -8
  60. package/lib/components/DataGrid/Row/useLogic/utils/getColumnsMap/index.d.ts +0 -1
  61. package/lib/components/DataGrid/Row/useLogic/utils/index.d.ts +0 -2
  62. package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/index.d.ts +0 -1
  63. package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/mergeColumnsOptions.d.ts +0 -2
  64. package/lib/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/mergeColumnsOptions.mjs +0 -14
@@ -1,72 +0,0 @@
1
- import { j as e } from "../../../../_virtual/jsx-runtime.mjs";
2
- import { memo as f } from "react";
3
- import { Collapse as a } from "../../../Collapse/Collapse.mjs";
4
- import { HIDDEN_CHILDREN_ROW_CLASSNAME as g } from "../constants.mjs";
5
- import { NestedRows as x, MoreButtonRow as E, MoreButton as N } from "./styles.mjs";
6
- import { useLogic as R } from "./useLogic/useLogic.mjs";
7
- const O = f(
8
- (s) => {
9
- const {
10
- isShowAllChildren: m,
11
- isShowMoreButton: w,
12
- isShowConnector: o,
13
- nextLevel: r,
14
- initialVisibleChildren: p,
15
- otherChildren: j,
16
- handleToggleShowAllChildren: S
17
- } = R(s), {
18
- isOpen: d,
19
- data: h,
20
- keyId: u,
21
- level: c,
22
- gridColumns: v,
23
- moreButtonColumnPosition: $,
24
- renderRow: C
25
- } = s;
26
- return !h || !h.length ? null : /* @__PURE__ */ e.jsx(a, { in: d, unmountOnExit: !0, children: /* @__PURE__ */ e.jsxs(x, { $level: c, $isShowConnector: o, children: [
27
- p.map(({ children: t, options: i, ...n }) => {
28
- const l = n[u];
29
- return C({
30
- key: l,
31
- row: n,
32
- options: i,
33
- nestedChildren: t,
34
- level: r
35
- });
36
- }),
37
- d && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
38
- /* @__PURE__ */ e.jsx(a, { in: m, component: "li", unmountOnExit: !0, children: /* @__PURE__ */ e.jsx(x, { $level: c, $isShowConnector: o, children: j.map(({ children: t, options: i, ...n }) => {
39
- const l = n[u];
40
- return C({
41
- key: l,
42
- row: n,
43
- options: i,
44
- nestedChildren: t,
45
- level: r,
46
- className: g
47
- });
48
- }) }) }),
49
- w && /* @__PURE__ */ e.jsx(
50
- E,
51
- {
52
- $level: r,
53
- $isShowConnector: o,
54
- $gridColumns: v,
55
- children: /* @__PURE__ */ e.jsx(
56
- N,
57
- {
58
- $moreButtonColumnPosition: $,
59
- variant: "link",
60
- onClick: S,
61
- children: m ? "Скрыть" : "Показать все"
62
- }
63
- )
64
- }
65
- )
66
- ] })
67
- ] }) });
68
- }
69
- );
70
- export {
71
- O as NestedChildren
72
- };
@@ -1 +0,0 @@
1
- export * from './NestedChildren';
@@ -1,20 +0,0 @@
1
- export declare const NestedRows: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & {
2
- $level: number;
3
- $isShowConnector: boolean;
4
- }, import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
5
- export declare const MoreButtonRow: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & {
6
- $level: number;
7
- $isShowConnector: boolean;
8
- $gridColumns: string;
9
- }, import('react').DetailedHTMLProps<import('react').LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
10
- export declare const MoreButton: import('@emotion/styled').StyledComponent<Omit<import('../../../types').WithoutEmotionSpecific<import('@mui/material').ButtonProps<import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements>>>, "color" | "variant"> & {
11
- variant?: `${import('../../../Button').ButtonVariants}`;
12
- loading?: boolean;
13
- loadingIndicator?: import('react').ReactNode;
14
- loadingPosition?: "start" | "end" | "center";
15
- color?: `${import('../../../Button').ButtonColors}`;
16
- component?: import('react').ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
17
- selected?: boolean;
18
- } & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & {
19
- $moreButtonColumnPosition: number;
20
- }, {}, {}>;
@@ -1,68 +0,0 @@
1
- import { styled as e } from "@mui/material";
2
- import { Button as i } from "../../../Button/Button.mjs";
3
- import { ROOT_ACTION_CELL_WIDTH as r, TREE_LINE_WIDTH as t } from "../../constants.mjs";
4
- const p = e("ul", {
5
- shouldForwardProp: (o) => !["$level", "$isShowConnector"].includes(o.toString())
6
- })`
7
- position: relative;
8
-
9
- margin: 0;
10
- padding: 0;
11
-
12
- list-style: none;
13
-
14
- &::before {
15
- content: '';
16
-
17
- position: absolute;
18
- z-index: 2;
19
- top: 0;
20
- transform: ${({ $level: o }) => `translateX(calc(${r}px * ${o} - ${t}px))`};
21
-
22
- display: ${({ $isShowConnector: o }) => o ? "block" : "none"};
23
-
24
- width: 0;
25
- height: 100%;
26
-
27
- border-left: 1px solid ${({ theme: o }) => o.palette.grey[400]};
28
- }
29
- `, d = e("li", {
30
- shouldForwardProp: (o) => !["$level", "$isShowConnector", "$gridColumns"].includes(o.toString())
31
- })`
32
- position: relative;
33
-
34
- display: grid;
35
- grid-template-columns: ${({ $gridColumns: o }) => o};
36
-
37
- height: 36px;
38
- margin-left: ${({ $level: o }) => `${o * r}px`};
39
-
40
- &::before {
41
- content: '';
42
-
43
- position: absolute;
44
- top: 0;
45
- left: -${t}px;
46
-
47
- display: ${({ $isShowConnector: o }) => o ? "block" : "none"};
48
-
49
- width: ${t}px;
50
- height: 50%;
51
-
52
- border-bottom: 1px solid ${({ theme: o }) => o.palette.grey[400]};
53
- border-left: 1px solid ${({ theme: o }) => o.palette.grey[400]};
54
- border-radius: 0 0 0 ${({ theme: o }) => o.shape.small};
55
- }
56
- `, a = e(i, {
57
- shouldForwardProp: (o) => !["$moreButtonColumnPosition"].includes(o.toString())
58
- })`
59
- grid-column: ${({ $moreButtonColumnPosition: o }) => o};
60
- justify-self: start;
61
-
62
- margin: ${({ theme: o }) => o.spacing(0, 2)};
63
- `;
64
- export {
65
- a as MoreButton,
66
- d as MoreButtonRow,
67
- p as NestedRows
68
- };
@@ -1 +0,0 @@
1
- export * from './useLogic';
@@ -1,18 +0,0 @@
1
- import { MouseEvent } from 'react';
2
- import { CellValue } from '../../../types';
3
- import { NestedChildrenProps } from '../NestedChildren';
4
- type UseLogicParams<TData extends Record<string, CellValue>> = NestedChildrenProps<TData>;
5
- export declare const useLogic: <TData extends Record<string, CellValue>>({ rowId, data, level, variant, initialVisibleChildrenCount, }: UseLogicParams<TData>) => {
6
- isShowAllChildren: boolean;
7
- isShowMoreButton: boolean;
8
- isShowConnector: boolean;
9
- initialVisibleChildren: (TData & {
10
- options?: import('../../../types').DataGridRowOptions<TData> | undefined;
11
- })[];
12
- otherChildren: (TData & {
13
- options?: import('../../../types').DataGridRowOptions<TData> | undefined;
14
- })[];
15
- nextLevel: number;
16
- handleToggleShowAllChildren: (event: MouseEvent<HTMLElement>) => void;
17
- };
18
- export {};
@@ -1,27 +0,0 @@
1
- import { useContext as d } from "react";
2
- import { DataGridContext as C } from "../../../DataGridContext/DataGridContext.mjs";
3
- import "../../../../../_virtual/jsx-runtime.mjs";
4
- import { Variant as S } from "../../../enums.mjs";
5
- const A = ({
6
- rowId: o,
7
- data: e,
8
- level: s,
9
- variant: i,
10
- initialVisibleChildrenCount: t
11
- }) => {
12
- const { checkIsMoreOpened: l, toggleOpenMoreItems: c } = d(C), n = Object.is(i, S.Tree), h = n ? s + 1 : 0, a = e?.slice(0, t), r = e?.slice(t), g = l(o), p = !!r?.length;
13
- return {
14
- isShowAllChildren: g,
15
- isShowMoreButton: p,
16
- isShowConnector: n,
17
- initialVisibleChildren: a,
18
- otherChildren: r,
19
- nextLevel: h,
20
- handleToggleShowAllChildren: (m) => {
21
- m.stopPropagation(), c(o);
22
- }
23
- };
24
- };
25
- export {
26
- A as useLogic
27
- };
@@ -1,7 +0,0 @@
1
- export type RowContextProps = {
2
- isDisabled: boolean;
3
- disabledReason?: string;
4
- addDisabledRow: (disabledReason?: string) => void;
5
- removeDisabledRow: () => void;
6
- };
7
- export declare const RowContext: import('react').Context<RowContextProps>;
@@ -1,11 +0,0 @@
1
- import { createContext as e } from "react";
2
- const t = e({
3
- isDisabled: !1,
4
- addDisabledRow: () => {
5
- },
6
- removeDisabledRow: () => {
7
- }
8
- });
9
- export {
10
- t as RowContext
11
- };
@@ -1,6 +0,0 @@
1
- import { ReactNode } from 'react';
2
- type RowContextProviderProps = {
3
- children: ReactNode;
4
- };
5
- export declare const RowContextProvider: ({ children }: RowContextProviderProps) => import("react/jsx-runtime").JSX.Element;
6
- export {};
@@ -1,25 +0,0 @@
1
- import { j as l } from "../../../../../_virtual/jsx-runtime.mjs";
2
- import { useState as s } from "react";
3
- import { RowContext as m } from "../RowContext.mjs";
4
- const c = ({ children: t }) => {
5
- const [r, e] = s(!1), [a, o] = s(), i = (n) => {
6
- e(!0), o(n);
7
- }, d = () => {
8
- e(!1), o(void 0);
9
- };
10
- return /* @__PURE__ */ l.jsx(
11
- m.Provider,
12
- {
13
- value: {
14
- isDisabled: r,
15
- disabledReason: a,
16
- addDisabledRow: i,
17
- removeDisabledRow: d
18
- },
19
- children: t
20
- }
21
- );
22
- };
23
- export {
24
- c as RowContextProvider
25
- };
@@ -1 +0,0 @@
1
- export * from './RowProvider';
@@ -1,2 +0,0 @@
1
- export * from './RowContext';
2
- export * from './RowProvider';
@@ -1,4 +0,0 @@
1
- import { CellValue, DataGridRowOptionColumns } from '../../../../types';
2
- type GetColumnsMapResult<TData> = Record<keyof TData, Omit<TData, 'field'>> | object;
3
- export declare const getColumnsMap: <TData extends Record<string, CellValue>>(columns: DataGridRowOptionColumns<TData>[]) => GetColumnsMapResult<TData>;
4
- export {};
@@ -1,8 +0,0 @@
1
- const u = (t) => t.reduce((r, { field: e, ...n }) => e ? {
2
- // biome-ignore lint/performance/noAccumulatingSpread: <explanation>
3
- ...r,
4
- [e]: n
5
- } : r, {});
6
- export {
7
- u as getColumnsMap
8
- };
@@ -1 +0,0 @@
1
- export * from './getColumnsMap';
@@ -1,2 +0,0 @@
1
- export { getColumnsMap } from './getColumnsMap';
2
- export { mergeColumnsOptions } from './mergeColumnsOptions';
@@ -1 +0,0 @@
1
- export * from './mergeColumnsOptions';
@@ -1,2 +0,0 @@
1
- import { CellValue, DataGridColumns, DataGridRowOptionColumns } from '../../../../types';
2
- export declare const mergeColumnsOptions: <TData extends Record<string, CellValue>>(columns: DataGridColumns<TData>[], childrenColumns: DataGridRowOptionColumns<TData>[] | undefined) => any[];
@@ -1,14 +0,0 @@
1
- import { getColumnsMap as n } from "../getColumnsMap/getColumnsMap.mjs";
2
- const f = (e, t) => {
3
- if (!t)
4
- return e;
5
- const i = n(t);
6
- return Object.keys(i).length ? e.map((r) => r.hasOwnProperty("field") ? {
7
- ...r,
8
- // @ts-ignore
9
- ...i[r.field] || {}
10
- } : r) : e;
11
- };
12
- export {
13
- f as mergeColumnsOptions
14
- };