@pushwoosh/dumb-components 1.0.14 → 1.0.16
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 +2 -0
- package/DropdownMenu/components/DropdownMenu/styles.d.ts +1 -0
- package/DropdownMenu/components/DropdownMenu/styles.js +5 -2
- package/DropdownMenu/components/DropdownMenu/types.d.ts +1 -0
- package/DropdownMenu/components/DropdownMenuButton/DropdownMenuButton.js +2 -0
- package/DropdownMenu/components/DropdownMenuButton/types.d.ts +1 -0
- 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/package.json +1 -1
|
@@ -6,6 +6,7 @@ const defaultPlacements = ['top-start', 'top-end', 'bottom-start', 'bottom-end']
|
|
|
6
6
|
export const DropdownMenu = ({
|
|
7
7
|
renderHandler,
|
|
8
8
|
children,
|
|
9
|
+
isScrollable,
|
|
9
10
|
menuZIndex,
|
|
10
11
|
menuPlacement
|
|
11
12
|
}) => {
|
|
@@ -41,6 +42,7 @@ export const DropdownMenu = ({
|
|
|
41
42
|
}), isOpen && React.createElement(Place, {
|
|
42
43
|
ref: refs.setFloating,
|
|
43
44
|
style: floatingStyles,
|
|
45
|
+
"$scrollable": isScrollable,
|
|
44
46
|
"$zIndex": menuZIndex
|
|
45
47
|
}, typeof children === 'function' ? children() : children));
|
|
46
48
|
};
|
|
@@ -12,6 +12,7 @@ export declare const Place: import("styled-components").StyledComponent<"div", a
|
|
|
12
12
|
$gridAutoFlow: string;
|
|
13
13
|
} & {
|
|
14
14
|
$zIndex?: number;
|
|
15
|
+
$scrollable?: boolean;
|
|
15
16
|
}, "$gridAutoFlow">;
|
|
16
17
|
export declare const DropdownMenuSection: import("styled-components").StyledComponent<"div", any, {
|
|
17
18
|
$alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
2
|
import { Color, Shadow, ShapeRadius, Spacing } from '@pushwoosh/kit-constants';
|
|
3
3
|
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
const scrollableCss = css(["max-height:248px;overflow-y:auto;"]);
|
|
4
5
|
export const Place = styled(Vertical).withConfig({
|
|
5
6
|
displayName: "Place",
|
|
6
7
|
componentId: "sc-ij8wqc-0"
|
|
7
|
-
})(["border:1px solid ", ";background-color:", ";min-width:
|
|
8
|
+
})(["border:1px solid ", ";background-color:", ";min-width:140px;", " border-radius:", ";box-shadow:", ";z-index:", ";"], Color.FORM, Color.FROZEN, ({
|
|
9
|
+
$scrollable
|
|
10
|
+
}) => $scrollable && scrollableCss, ShapeRadius.CONTROL, Shadow.REGULAR, ({
|
|
8
11
|
$zIndex
|
|
9
12
|
}) => $zIndex || 10);
|
|
10
13
|
export const DropdownMenuSection = styled(Vertical).withConfig({
|
|
@@ -3,12 +3,14 @@ import { Button } from '../../../Button';
|
|
|
3
3
|
import { DropdownMenu } from '../DropdownMenu';
|
|
4
4
|
export const DropdownMenuButton = ({
|
|
5
5
|
label,
|
|
6
|
+
isScrollable,
|
|
6
7
|
menuZIndex,
|
|
7
8
|
menuPlacement,
|
|
8
9
|
children,
|
|
9
10
|
...buttonProps
|
|
10
11
|
}) => {
|
|
11
12
|
return React.createElement(DropdownMenu, {
|
|
13
|
+
isScrollable: isScrollable,
|
|
12
14
|
menuZIndex: menuZIndex,
|
|
13
15
|
menuPlacement: menuPlacement,
|
|
14
16
|
renderHandler: ({
|
|
@@ -3,6 +3,7 @@ import { type ReactNode } from 'react';
|
|
|
3
3
|
import { type RequiredButtonProps } from '../../../Button';
|
|
4
4
|
export type DropdownMenuButtonProps = {
|
|
5
5
|
label: ReactNode;
|
|
6
|
+
isScrollable?: boolean;
|
|
6
7
|
menuZIndex?: number;
|
|
7
8
|
menuPlacement?: Placement;
|
|
8
9
|
color: RequiredButtonProps['color'];
|
|
@@ -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.
|
|
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, ({
|
|
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
|
+
}, "$gap" | "$gridAutoFlow" | "$alignItems" | "$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
|
}>;
|