@pushwoosh/dumb-components 1.0.16 → 1.0.18
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/DropdownMenu/components/DropdownMenu/DropdownMenu.js +5 -3
- package/DropdownMenu/components/DropdownMenu/styles.d.ts +1 -0
- package/DropdownMenu/components/DropdownMenu/styles.js +3 -1
- package/DropdownMenu/components/DropdownMenu/types.d.ts +3 -1
- package/DropdownMenu/components/DropdownMenuItem/styles.js +1 -1
- package/FieldBox/styles.d.ts +1 -1
- package/Table/hooks/helpers.d.ts +0 -1
- package/Table/hooks/helpers.js +0 -3
- package/Table/hooks/useDataTableGetParams.js +9 -5
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +1 -1
- package/ActionsGroup/ActionsGroup.d.ts +0 -3
- package/ActionsGroup/ActionsGroup.js +0 -18
- package/ActionsGroup/ActionsGroupItem.d.ts +0 -3
- package/ActionsGroup/ActionsGroupItem.js +0 -12
- package/ActionsGroup/index.d.ts +0 -3
- package/ActionsGroup/index.js +0 -2
- package/ActionsGroup/styles.d.ts +0 -7
- package/ActionsGroup/styles.js +0 -22
- package/ActionsGroup/types.d.ts +0 -12
- package/ActionsGroup/types.js +0 -1
|
@@ -5,17 +5,18 @@ import { DropdownContext } from '../../context';
|
|
|
5
5
|
const defaultPlacements = ['top-start', 'top-end', 'bottom-start', 'bottom-end'];
|
|
6
6
|
export const DropdownMenu = ({
|
|
7
7
|
renderHandler,
|
|
8
|
-
|
|
8
|
+
color,
|
|
9
9
|
isScrollable,
|
|
10
10
|
menuZIndex,
|
|
11
|
-
menuPlacement
|
|
11
|
+
menuPlacement,
|
|
12
|
+
children
|
|
12
13
|
}) => {
|
|
13
14
|
const [isOpen, setIsOpen] = useState(false);
|
|
14
15
|
const {
|
|
15
16
|
refs,
|
|
16
17
|
floatingStyles
|
|
17
18
|
} = useFloating({
|
|
18
|
-
middleware: [offset(
|
|
19
|
+
middleware: [offset(4), autoPlacement({
|
|
19
20
|
allowedPlacements: menuPlacement ? [menuPlacement] : defaultPlacements
|
|
20
21
|
})]
|
|
21
22
|
});
|
|
@@ -42,6 +43,7 @@ export const DropdownMenu = ({
|
|
|
42
43
|
}), isOpen && React.createElement(Place, {
|
|
43
44
|
ref: refs.setFloating,
|
|
44
45
|
style: floatingStyles,
|
|
46
|
+
"$color": color,
|
|
45
47
|
"$scrollable": isScrollable,
|
|
46
48
|
"$zIndex": menuZIndex
|
|
47
49
|
}, typeof children === 'function' ? children() : children));
|
|
@@ -5,7 +5,9 @@ const scrollableCss = css(["max-height:248px;overflow-y:auto;"]);
|
|
|
5
5
|
export const Place = styled(Vertical).withConfig({
|
|
6
6
|
displayName: "Place",
|
|
7
7
|
componentId: "sc-ij8wqc-0"
|
|
8
|
-
})(["border:1px solid ", ";background
|
|
8
|
+
})(["border:1px solid ", ";background:", ";min-width:140px;", " border-radius:", ";box-shadow:", ";z-index:", ";"], Color.FORM, ({
|
|
9
|
+
$color
|
|
10
|
+
}) => $color || Color.FROZEN, ({
|
|
9
11
|
$scrollable
|
|
10
12
|
}) => $scrollable && scrollableCss, ShapeRadius.CONTROL, Shadow.REGULAR, ({
|
|
11
13
|
$zIndex
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReferenceType, Placement } from '@floating-ui/react-dom';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
+
import type { Color } from '@pushwoosh/kit-constants';
|
|
3
4
|
export type HandlerProps = {
|
|
4
5
|
onClick: () => void;
|
|
5
6
|
ref: (el: ReferenceType | null) => void;
|
|
@@ -8,6 +9,7 @@ export type HandlerProps = {
|
|
|
8
9
|
export type DropdownMenuProps = {
|
|
9
10
|
renderHandler: (args: HandlerProps) => ReactNode;
|
|
10
11
|
children: (() => ReactNode) | ReactNode;
|
|
12
|
+
color?: Color.CLEAR | Color.FROZEN;
|
|
11
13
|
isScrollable?: boolean;
|
|
12
14
|
menuZIndex?: number;
|
|
13
15
|
menuPlacement?: Placement;
|
|
@@ -3,7 +3,7 @@ import { Color, Spacing, UnitSize } from '@pushwoosh/kit-constants';
|
|
|
3
3
|
export const DropdownMenuItemStyled = styled.button.withConfig({
|
|
4
4
|
displayName: "DropdownMenuItemStyled",
|
|
5
5
|
componentId: "sc-1wmyvxp-0"
|
|
6
|
-
})(["appearance:none;display:flex;align-items:center;padding:0 ", ";height:", ";border:none;color:", ";background:none;cursor:pointer;&:hover{background:", ";color:", ";}&:disabled{color:", ";cursor:not-allowed;}"], Spacing.S4, UnitSize.FIELD_HEIGHT, ({
|
|
6
|
+
})(["appearance:none;display:flex;align-items:center;padding:0 ", ";min-height:", ";border:none;color:", ";background:none;cursor:pointer;&:hover{background:", ";color:", ";}&:disabled{color:", ";cursor:not-allowed;}"], Spacing.S4, UnitSize.FIELD_HEIGHT, ({
|
|
7
7
|
$active,
|
|
8
8
|
$danger
|
|
9
9
|
}) => {
|
package/FieldBox/styles.d.ts
CHANGED
|
@@ -16,5 +16,5 @@ export declare const TitleBox: import("styled-components").StyledComponent<"div"
|
|
|
16
16
|
$alignItems: string;
|
|
17
17
|
$justifyContent: string;
|
|
18
18
|
$gap: Spacing;
|
|
19
|
-
}, "$
|
|
19
|
+
}, "$gridAutoFlow" | "$alignItems" | "$gap" | "$justifyContent">;
|
|
20
20
|
export declare const Link: import("styled-components").StyledComponent<typeof LinkBase, any, {}, never>;
|
package/Table/hooks/helpers.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export declare function pickBy<T extends Record<string, any>>(obj: T): Record<string, any>;
|
|
2
1
|
export declare function mapKeys<T extends Record<string, any>, K extends string>(obj: T, mapper: (key: string) => K): Record<K, T[keyof T]>;
|
|
3
2
|
export declare function shallowEqual<T extends Record<string, any>>(a: T, b: T): boolean;
|
package/Table/hooks/helpers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo, useRef } from 'react';
|
|
2
2
|
import { useHistory, useLocation } from 'react-router-dom';
|
|
3
3
|
import { usePersistentFunction } from '@pushwoosh/kit-helpers';
|
|
4
|
-
import { mapKeys,
|
|
4
|
+
import { mapKeys, shallowEqual } from './helpers';
|
|
5
5
|
export function useDataTableGetParams({
|
|
6
6
|
defaultOrder,
|
|
7
7
|
defaultDirection = 'asc',
|
|
@@ -37,10 +37,14 @@ export function useDataTableGetParams({
|
|
|
37
37
|
}, [locationSearch, defaultDirection, defaultOrder, defaultPerPage, prefix]);
|
|
38
38
|
const changeDataTableParams = usePersistentFunction(params => {
|
|
39
39
|
const searchParams = new URLSearchParams(locationSearch);
|
|
40
|
-
const paramsWithPrefix =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const paramsWithPrefix = mapKeys(params, key => `${prefix}${key}`);
|
|
41
|
+
for (const [key, value] of Object.entries(paramsWithPrefix)) {
|
|
42
|
+
if (value === undefined || value === null || value === '') {
|
|
43
|
+
searchParams.delete(key);
|
|
44
|
+
} else {
|
|
45
|
+
searchParams.set(key, String(value));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
44
48
|
history.push({
|
|
45
49
|
search: searchParams.toString()
|
|
46
50
|
});
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ActionsGroupBox, ActionsGroupInner } from './styles';
|
|
3
|
-
export function ActionsGroup(props) {
|
|
4
|
-
const {
|
|
5
|
-
boxRef,
|
|
6
|
-
align,
|
|
7
|
-
gap,
|
|
8
|
-
children,
|
|
9
|
-
...rest
|
|
10
|
-
} = props;
|
|
11
|
-
return React.createElement(ActionsGroupBox, {
|
|
12
|
-
...rest,
|
|
13
|
-
ref: boxRef
|
|
14
|
-
}, React.createElement(ActionsGroupInner, {
|
|
15
|
-
"$align": align,
|
|
16
|
-
"$gap": gap
|
|
17
|
-
}, children));
|
|
18
|
-
}
|
package/ActionsGroup/index.d.ts
DELETED
package/ActionsGroup/index.js
DELETED
package/ActionsGroup/styles.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ActionsGroupProps } from './types';
|
|
2
|
-
export declare const ActionsGroupBox: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
|
-
export declare const ActionsGroupItemBox: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export declare const ActionsGroupInner: import("styled-components").StyledComponent<"div", any, {
|
|
5
|
-
$align: ActionsGroupProps["align"];
|
|
6
|
-
$gap: ActionsGroupProps["gap"];
|
|
7
|
-
}, never>;
|
package/ActionsGroup/styles.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
export const ActionsGroupBox = styled.div.withConfig({
|
|
3
|
-
displayName: "ActionsGroupBox",
|
|
4
|
-
componentId: "sc-eb6b51-0"
|
|
5
|
-
})([""]);
|
|
6
|
-
export const ActionsGroupItemBox = styled.div.withConfig({
|
|
7
|
-
displayName: "ActionsGroupItemBox",
|
|
8
|
-
componentId: "sc-eb6b51-1"
|
|
9
|
-
})([""]);
|
|
10
|
-
export const ActionsGroupInner = styled.div.withConfig({
|
|
11
|
-
displayName: "ActionsGroupInner",
|
|
12
|
-
componentId: "sc-eb6b51-2"
|
|
13
|
-
})(["display:flex;flex-wrap:nowrap;align-items:center;justify-content:", ";margin:0 ", ";", "{padding:0 ", ";}"], ({
|
|
14
|
-
$align
|
|
15
|
-
}) => $align === 'end' ? 'flex-end' : 'flex-start', ({
|
|
16
|
-
$gap
|
|
17
|
-
}) => `calc(-${$gap}/2)`, ActionsGroupItemBox, ({
|
|
18
|
-
$gap
|
|
19
|
-
}) => `calc(${$gap}/2)`);
|
|
20
|
-
ActionsGroupBox.displayName = 'ActionsGroupBox';
|
|
21
|
-
ActionsGroupInner.displayName = 'ActionsGroupInner';
|
|
22
|
-
ActionsGroupItemBox.displayName = 'ActionsGroupBox';
|
package/ActionsGroup/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Ref, ReactNode } from 'react';
|
|
2
|
-
import type { Spacing } from '@pushwoosh/kit-constants';
|
|
3
|
-
export type ActionsGroupProps = Omit<JSX.IntrinsicElements['div'], 'ref'> & {
|
|
4
|
-
readonly boxRef?: Ref<HTMLDivElement>;
|
|
5
|
-
readonly align: 'start' | 'end';
|
|
6
|
-
readonly gap: Spacing;
|
|
7
|
-
readonly children: ReactNode;
|
|
8
|
-
};
|
|
9
|
-
export type ActionsGroupItemProps = Omit<JSX.IntrinsicElements['div'], 'ref'> & {
|
|
10
|
-
readonly boxRef?: Ref<HTMLDivElement>;
|
|
11
|
-
readonly children: ReactNode;
|
|
12
|
-
};
|
package/ActionsGroup/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|