@pushwoosh/dumb-components 1.0.15 → 1.0.17
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/FieldBox.js +35 -4
- package/FieldBox/styles.d.ts +20 -0
- package/FieldBox/styles.js +16 -0
- package/FieldBox/types.d.ts +4 -0
- 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/FieldBox.js
CHANGED
|
@@ -1,19 +1,50 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { Color, Spacing } from '@pushwoosh/kit-constants';
|
|
3
|
-
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
2
|
+
import { Color, Spacing, Tag } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { OpenIcon, InfoRoundIcon } from '@pushwoosh/kit-icons';
|
|
4
5
|
import { Text } from '@pushwoosh/kit-typography';
|
|
6
|
+
import { Tooltip } from '../Tooltip';
|
|
7
|
+
import { TitleBox, Link } from './styles';
|
|
5
8
|
export function FieldBox(props) {
|
|
6
9
|
const {
|
|
7
10
|
title,
|
|
8
11
|
description,
|
|
12
|
+
isOptional,
|
|
13
|
+
link,
|
|
14
|
+
tooltip,
|
|
15
|
+
actions,
|
|
9
16
|
error,
|
|
10
17
|
children
|
|
11
18
|
} = props;
|
|
12
19
|
return React.createElement(Vertical, {
|
|
13
20
|
"$gap": Spacing.S1
|
|
14
|
-
}, React.createElement(
|
|
21
|
+
}, React.createElement(Horizontal, {
|
|
22
|
+
"$alignItems": "center",
|
|
23
|
+
"$justifyContent": "space-between"
|
|
24
|
+
}, React.createElement(TitleBox, null, React.createElement(Text, {
|
|
15
25
|
"$variant": "h5"
|
|
16
|
-
}, title),
|
|
26
|
+
}, title), isOptional && React.createElement(Text, {
|
|
27
|
+
"$color": Color.LOCKED,
|
|
28
|
+
"$variant": "footnote"
|
|
29
|
+
}, "(optional)"), tooltip && React.createElement(Tooltip, {
|
|
30
|
+
content: tooltip,
|
|
31
|
+
position: "right-middle"
|
|
32
|
+
}, React.createElement("div", null, React.createElement(InfoRoundIcon, {
|
|
33
|
+
color: Color.LOCKED,
|
|
34
|
+
size: "small",
|
|
35
|
+
view: "lined"
|
|
36
|
+
}))), link && React.createElement(Link, {
|
|
37
|
+
as: Tag.A,
|
|
38
|
+
href: link,
|
|
39
|
+
target: "_blank",
|
|
40
|
+
rel: "noopener noreferrer"
|
|
41
|
+
}, React.createElement(OpenIcon, {
|
|
42
|
+
size: "small",
|
|
43
|
+
view: "lined"
|
|
44
|
+
}))), actions && React.createElement(Horizontal, {
|
|
45
|
+
"$alignItems": "center",
|
|
46
|
+
"$gap": Spacing.S1
|
|
47
|
+
}, actions)), children, description && !error && React.createElement(Text, {
|
|
17
48
|
"$variant": "h5",
|
|
18
49
|
"$color": Color.LOCKED
|
|
19
50
|
}, description), error && React.createElement(Text, {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Spacing } from '@pushwoosh/kit-constants';
|
|
2
|
+
import { Link as LinkBase } from '../Link';
|
|
3
|
+
export declare const TitleBox: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
$alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
5
|
+
$alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
6
|
+
$gap?: string | number | undefined;
|
|
7
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
8
|
+
$justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
9
|
+
$justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
10
|
+
$margin?: string | number | undefined;
|
|
11
|
+
$padding?: string | number | undefined;
|
|
12
|
+
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
13
|
+
} & {
|
|
14
|
+
$gridAutoFlow: string;
|
|
15
|
+
} & {
|
|
16
|
+
$alignItems: string;
|
|
17
|
+
$justifyContent: string;
|
|
18
|
+
$gap: Spacing;
|
|
19
|
+
}, "$gridAutoFlow" | "$alignItems" | "$gap" | "$justifyContent">;
|
|
20
|
+
export declare const Link: import("styled-components").StyledComponent<typeof LinkBase, any, {}, never>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color, Spacing } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { Link as LinkBase } from '../Link';
|
|
5
|
+
export const TitleBox = styled(Horizontal).attrs({
|
|
6
|
+
$alignItems: 'center',
|
|
7
|
+
$justifyContent: 'start',
|
|
8
|
+
$gap: Spacing.S1
|
|
9
|
+
}).withConfig({
|
|
10
|
+
displayName: "TitleBox",
|
|
11
|
+
componentId: "sc-lzrphm-0"
|
|
12
|
+
})(["text-transform:uppercase;"]);
|
|
13
|
+
export const Link = styled(LinkBase).withConfig({
|
|
14
|
+
displayName: "Link",
|
|
15
|
+
componentId: "sc-lzrphm-1"
|
|
16
|
+
})(["color:", ";&:hover{color:", ";}&:active{opacity:0.5;}"], Color.SOFT, Color.PRIMARY_HOVER);
|
package/FieldBox/types.d.ts
CHANGED
|
@@ -2,5 +2,9 @@ import { type PropsWithChildren, type ReactNode } from 'react';
|
|
|
2
2
|
export type FieldBoxProps = PropsWithChildren<{
|
|
3
3
|
title: ReactNode;
|
|
4
4
|
description?: ReactNode;
|
|
5
|
+
isOptional?: boolean;
|
|
6
|
+
link?: string;
|
|
7
|
+
tooltip?: string;
|
|
8
|
+
actions?: ReactNode;
|
|
5
9
|
error?: ReactNode;
|
|
6
10
|
}>;
|
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 {};
|