@pushwoosh/dumb-components 1.1.206 → 1.1.208
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/Button/styles.js +3 -3
- package/DateTimePicker/components/Input/styles.js +1 -1
- package/NumberPicker/styles.js +1 -1
- package/SplitButton/SplitButton.d.ts +5 -0
- package/SplitButton/SplitButton.js +63 -0
- package/SplitButton/index.d.ts +2 -0
- package/SplitButton/index.js +1 -0
- package/SplitButton/styles.d.ts +7 -0
- package/SplitButton/styles.js +28 -0
- package/SplitButton/types.d.ts +26 -0
- package/SplitButton/types.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/native/Input.js +2 -2
- package/native/Textarea.js +2 -2
- package/package.json +1 -1
package/Button/styles.js
CHANGED
|
@@ -40,7 +40,7 @@ const dangerShapeColors = createColors(colors.danger.shape);
|
|
|
40
40
|
export const ButtonBoxDangerShapeCompact = styled(ButtonBox).withConfig({
|
|
41
41
|
displayName: "ButtonBoxDangerShapeCompact",
|
|
42
42
|
componentId: "sc-qltvdl-6"
|
|
43
|
-
})(["height:28px;padding:0 calc(6px - 1px);font-size:", ";font-weight:", ";text-transform:uppercase;", ";"], FontSize.SMALL, FontWeight.BOLD, /* sc-custom "display: none;" */dangerShapeColors);
|
|
43
|
+
})(["height:28px;padding:0 calc(6px - 1px);font-size:", ";line-height:", ";font-weight:", ";text-transform:uppercase;", ";"], FontSize.SMALL, LineHeight.SMALL, FontWeight.BOLD, /* sc-custom "display: none;" */dangerShapeColors);
|
|
44
44
|
export const ButtonBoxDangerShapeField = styled(ButtonBox).withConfig({
|
|
45
45
|
displayName: "ButtonBoxDangerShapeField",
|
|
46
46
|
componentId: "sc-qltvdl-7"
|
|
@@ -50,7 +50,7 @@ const primaryShapeColors = createColors(colors.primary.shape);
|
|
|
50
50
|
export const ButtonBoxPrimaryShapeCompact = styled(ButtonBox).withConfig({
|
|
51
51
|
displayName: "ButtonBoxPrimaryShapeCompact",
|
|
52
52
|
componentId: "sc-qltvdl-8"
|
|
53
|
-
})(["height:28px;padding:0 calc(6px - 1px);font-size:", ";font-weight:", ";text-transform:uppercase;", ";"], FontSize.SMALL, FontWeight.BOLD, /* sc-custom "display: none;" */primaryShapeColors);
|
|
53
|
+
})(["height:28px;padding:0 calc(6px - 1px);font-size:", ";line-height:", ";font-weight:", ";text-transform:uppercase;", ";"], FontSize.SMALL, LineHeight.SMALL, FontWeight.BOLD, /* sc-custom "display: none;" */primaryShapeColors);
|
|
54
54
|
export const ButtonBoxPrimaryShapeField = styled(ButtonBox).withConfig({
|
|
55
55
|
displayName: "ButtonBoxPrimaryShapeField",
|
|
56
56
|
componentId: "sc-qltvdl-9"
|
|
@@ -80,7 +80,7 @@ const secondaryShapeColors = createColors(colors.secondary.shape);
|
|
|
80
80
|
export const ButtonBoxSecondaryShapeCompact = styled(ButtonBox).withConfig({
|
|
81
81
|
displayName: "ButtonBoxSecondaryShapeCompact",
|
|
82
82
|
componentId: "sc-qltvdl-14"
|
|
83
|
-
})(["height:28px;padding:0 calc(6px - 1px);font-size:", ";font-weight:", ";text-transform:uppercase;", ";"], FontSize.SMALL, FontWeight.MEDIUM, /* sc-custom "display: none;" */secondaryShapeColors);
|
|
83
|
+
})(["height:28px;padding:0 calc(6px - 1px);font-size:", ";line-height:", ";font-weight:", ";text-transform:uppercase;", ";"], FontSize.SMALL, LineHeight.SMALL, FontWeight.MEDIUM, /* sc-custom "display: none;" */secondaryShapeColors);
|
|
84
84
|
export const ButtonBoxSecondaryShapeField = styled(ButtonBox).withConfig({
|
|
85
85
|
displayName: "ButtonBoxSecondaryShapeField",
|
|
86
86
|
componentId: "sc-qltvdl-15"
|
|
@@ -3,4 +3,4 @@ import { Color } from '@pushwoosh/kit-constants';
|
|
|
3
3
|
export const InputStyled = styled.input.withConfig({
|
|
4
4
|
displayName: "InputStyled",
|
|
5
5
|
componentId: "sc-17gtn04-0"
|
|
6
|
-
})(["color:", ";-webkit-text-fill-color:", ";background-color:transparent;&::placeholder{color:", ";}&:disabled{background-color:", ";-webkit-text-fill-color:", ";}"], Color.MAIN, Color.MAIN, Color.PHANTOM, Color.FROZEN, Color.LOCKED);
|
|
6
|
+
})(["color:", ";-webkit-text-fill-color:", ";background-color:transparent;&::placeholder{color:", ";-webkit-text-fill-color:", ";}&:disabled{background-color:", ";-webkit-text-fill-color:", ";}"], Color.MAIN, Color.MAIN, Color.PHANTOM, Color.PHANTOM, Color.FROZEN, Color.LOCKED);
|
package/NumberPicker/styles.js
CHANGED
|
@@ -5,7 +5,7 @@ export const InputStyled = styled.input.attrs({
|
|
|
5
5
|
}).withConfig({
|
|
6
6
|
displayName: "InputStyled",
|
|
7
7
|
componentId: "sc-vq8xnz-0"
|
|
8
|
-
})(["width:100%;color:", ";-webkit-text-fill-color:", ";background-color:transparent;&::placeholder{color:", ";}&:disabled{background-color:", ";-webkit-text-fill-color:", ";}"], Color.MAIN, Color.MAIN, Color.PHANTOM, Color.FROZEN, Color.LOCKED);
|
|
8
|
+
})(["width:100%;color:", ";-webkit-text-fill-color:", ";background-color:transparent;&::placeholder{color:", ";-webkit-text-fill-color:", ";}&:disabled{background-color:", ";-webkit-text-fill-color:", ";}"], Color.MAIN, Color.MAIN, Color.PHANTOM, Color.PHANTOM, Color.FROZEN, Color.LOCKED);
|
|
9
9
|
export const Hint = styled.div.withConfig({
|
|
10
10
|
displayName: "Hint",
|
|
11
11
|
componentId: "sc-vq8xnz-1"
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type FC } from 'react';
|
|
2
|
+
import { type SplitButtonProps } from './types';
|
|
3
|
+
/** Main action button joined with a chevron half that opens a {@link DropdownMenu} of secondary actions;
|
|
4
|
+
* the menu defaults to `bottom-end`, so it opens leftwards from the chevron. */
|
|
5
|
+
export declare const SplitButton: FC<SplitButtonProps>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronIcon } from '@pushwoosh/kit-icons';
|
|
3
|
+
import { SplitButtonAction, SplitButtonBox, SplitButtonMenuHandler } from './styles';
|
|
4
|
+
import { DropdownMenu } from '../DropdownMenu';
|
|
5
|
+
/** Main action button joined with a chevron half that opens a {@link DropdownMenu} of secondary actions;
|
|
6
|
+
* the menu defaults to `bottom-end`, so it opens leftwards from the chevron. */
|
|
7
|
+
export const SplitButton = ({
|
|
8
|
+
label,
|
|
9
|
+
color,
|
|
10
|
+
size = 'field',
|
|
11
|
+
icon,
|
|
12
|
+
className,
|
|
13
|
+
isDisabled,
|
|
14
|
+
isMenuDisabled,
|
|
15
|
+
isLoading,
|
|
16
|
+
menuAriaLabel = 'More actions',
|
|
17
|
+
onClick,
|
|
18
|
+
isScrollable,
|
|
19
|
+
openOnMount,
|
|
20
|
+
menuZIndex,
|
|
21
|
+
menuPlacement = 'bottom-end',
|
|
22
|
+
onClose,
|
|
23
|
+
children
|
|
24
|
+
}) => {
|
|
25
|
+
return _jsxs(SplitButtonBox, {
|
|
26
|
+
className: className,
|
|
27
|
+
"$color": color,
|
|
28
|
+
"$size": size,
|
|
29
|
+
children: [_jsx(SplitButtonAction, {
|
|
30
|
+
color: color,
|
|
31
|
+
size: size,
|
|
32
|
+
icon: icon,
|
|
33
|
+
isDisabled: isDisabled,
|
|
34
|
+
isLoading: isLoading,
|
|
35
|
+
onClick: onClick,
|
|
36
|
+
children: label
|
|
37
|
+
}), _jsx(DropdownMenu, {
|
|
38
|
+
isScrollable: isScrollable,
|
|
39
|
+
openOnMount: openOnMount,
|
|
40
|
+
menuZIndex: menuZIndex,
|
|
41
|
+
menuPlacement: menuPlacement,
|
|
42
|
+
onClose: onClose,
|
|
43
|
+
renderHandler: ({
|
|
44
|
+
ref,
|
|
45
|
+
onClick: onToggle,
|
|
46
|
+
isOpen
|
|
47
|
+
}) => _jsx(SplitButtonMenuHandler, {
|
|
48
|
+
color: color,
|
|
49
|
+
size: size,
|
|
50
|
+
"aria-label": menuAriaLabel,
|
|
51
|
+
icon: _jsx(ChevronIcon, {
|
|
52
|
+
direction: isOpen ? 'up' : 'down',
|
|
53
|
+
size: "small"
|
|
54
|
+
}),
|
|
55
|
+
isDisabled: isDisabled || isMenuDisabled,
|
|
56
|
+
isOpen: isOpen,
|
|
57
|
+
boxRef: ref,
|
|
58
|
+
onClick: onToggle
|
|
59
|
+
}),
|
|
60
|
+
children: children
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SplitButton } from './SplitButton';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Button } from '../Button';
|
|
2
|
+
export declare const SplitButtonBox: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
$color: "primary" | "secondary";
|
|
4
|
+
$size: "field" | "compact";
|
|
5
|
+
}, never>;
|
|
6
|
+
export declare const SplitButtonAction: typeof Button;
|
|
7
|
+
export declare const SplitButtonMenuHandler: typeof Button;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Button } from '../Button';
|
|
4
|
+
const dividerColorByColor = {
|
|
5
|
+
primary: Color.CLEAR,
|
|
6
|
+
secondary: Color.FORM
|
|
7
|
+
};
|
|
8
|
+
const menuHandlerPaddingBySize = {
|
|
9
|
+
field: 'calc(6px - 1px)',
|
|
10
|
+
compact: '2px'
|
|
11
|
+
};
|
|
12
|
+
export const SplitButtonBox = styled.div.withConfig({
|
|
13
|
+
displayName: "SplitButtonBox",
|
|
14
|
+
componentId: "sc-19s68pa-0"
|
|
15
|
+
})(["display:inline-flex;align-items:stretch;--split-button-divider-color:", ";--split-button-menu-padding:", ";"], ({
|
|
16
|
+
$color
|
|
17
|
+
}) => dividerColorByColor[$color], ({
|
|
18
|
+
$size
|
|
19
|
+
}) => menuHandlerPaddingBySize[$size]);
|
|
20
|
+
export const SplitButtonAction = styled(Button).withConfig({
|
|
21
|
+
displayName: "SplitButtonAction",
|
|
22
|
+
componentId: "sc-19s68pa-1"
|
|
23
|
+
})(["&,&:hover:not([disabled]),&:active:not([disabled]),&:disabled{border-top-right-radius:0;border-bottom-right-radius:0;border-right-width:0;}"]);
|
|
24
|
+
export const SplitButtonMenuHandler = styled(Button).withConfig({
|
|
25
|
+
displayName: "SplitButtonMenuHandler",
|
|
26
|
+
componentId: "sc-19s68pa-2"
|
|
27
|
+
})(["&,&:hover:not([disabled]),&:active:not([disabled]),&:disabled{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:var(--split-button-divider-color);padding:0 var(--split-button-menu-padding);}"]);
|
|
28
|
+
SplitButtonBox.displayName = 'SplitButtonBox';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type RequiredButtonProps } from '../Button';
|
|
3
|
+
import { type DropdownMenuProps } from '../DropdownMenu/components/DropdownMenu/types';
|
|
4
|
+
/** Props of {@link SplitButton} — a main action button joined with a chevron that opens a {@link DropdownMenu}. */
|
|
5
|
+
export type SplitButtonProps = Pick<DropdownMenuProps, 'isScrollable' | 'openOnMount' | 'menuZIndex' | 'menuPlacement' | 'onClose' | 'children'> & {
|
|
6
|
+
/** Label of the main action button. */
|
|
7
|
+
label?: ReactNode;
|
|
8
|
+
/** Visual intent of both halves: `primary` or `secondary`. */
|
|
9
|
+
color: 'primary' | 'secondary';
|
|
10
|
+
/** Height preset of both halves. */
|
|
11
|
+
size?: RequiredButtonProps['size'];
|
|
12
|
+
/** Icon before the label; use kit-icons `size="medium"` for `field` and `size="small"` for `compact`. */
|
|
13
|
+
icon?: RequiredButtonProps['icon'];
|
|
14
|
+
/** Extra CSS class applied to the group element. */
|
|
15
|
+
className?: string;
|
|
16
|
+
/** Disable both halves. */
|
|
17
|
+
isDisabled?: boolean;
|
|
18
|
+
/** Disable only the chevron half. */
|
|
19
|
+
isMenuDisabled?: boolean;
|
|
20
|
+
/** Show the loading state on the main action button. */
|
|
21
|
+
isLoading?: boolean;
|
|
22
|
+
/** Accessible label of the chevron half. */
|
|
23
|
+
menuAriaLabel?: string;
|
|
24
|
+
/** Fires when the main action button is clicked. */
|
|
25
|
+
onClick: () => void;
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { RadioCard } from './RadioCard';
|
|
|
21
21
|
export { ReCaptcha, useRecaptcha, asyncScriptLoad } from './ReCaptcha';
|
|
22
22
|
export { Spinner } from './Spinner';
|
|
23
23
|
export { SortButton, type SortButtonParams } from './SortButton';
|
|
24
|
+
export { SplitButton, type SplitButtonProps } from './SplitButton';
|
|
24
25
|
export { Select, SelectAsync, SelectComponents, CLASS_NAME_PREFIX, type SelectBase, type SelectOption, type MultiSelectOptions, type SingleValue, type MultiValue, } from './Select';
|
|
25
26
|
export { Combobox, type ComboboxProps, type ComboboxChangeSource, type ComboboxChangeMeta, type FreeComboboxProps, type SelectComboboxProps, } from './Combobox';
|
|
26
27
|
export { ComboboxMulti, type ComboboxMultiProps } from './ComboboxMulti';
|
package/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { RadioCard } from './RadioCard';
|
|
|
21
21
|
export { ReCaptcha, useRecaptcha, asyncScriptLoad } from './ReCaptcha';
|
|
22
22
|
export { Spinner } from './Spinner';
|
|
23
23
|
export { SortButton } from './SortButton';
|
|
24
|
+
export { SplitButton } from './SplitButton';
|
|
24
25
|
export { Select, SelectAsync, SelectComponents, CLASS_NAME_PREFIX } from './Select';
|
|
25
26
|
export { Combobox } from './Combobox';
|
|
26
27
|
export { ComboboxMulti } from './ComboboxMulti';
|
package/native/Input.js
CHANGED
|
@@ -4,6 +4,6 @@ import { Color, FontSize, LineHeight, ShapeRadius, UnitSize } from '@pushwoosh/k
|
|
|
4
4
|
export const NativeInput = styled.input.withConfig({
|
|
5
5
|
displayName: "NativeInput",
|
|
6
6
|
componentId: "sc-oqkcxd-0"
|
|
7
|
-
})(["height:", ";padding:0 calc(12px - 1px);border:1px solid ", ";border-radius:", ";font-size:", ";line-height:", ";color:", ";-webkit-text-fill-color:", ";background-color:", ";&:focus{outline:none;border-color:", ";}&:disabled{background-color:", ";-webkit-text-fill-color:", ";}&::placeholder{color:", ";}"], UnitSize.FIELD_HEIGHT, ({
|
|
7
|
+
})(["height:", ";padding:0 calc(12px - 1px);border:1px solid ", ";border-radius:", ";font-size:", ";line-height:", ";color:", ";-webkit-text-fill-color:", ";background-color:", ";&:focus{outline:none;border-color:", ";}&:disabled{background-color:", ";-webkit-text-fill-color:", ";}&::placeholder{color:", ";-webkit-text-fill-color:", ";}"], UnitSize.FIELD_HEIGHT, ({
|
|
8
8
|
$isErrored
|
|
9
|
-
}) => $isErrored ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, FontSize.REGULAR, LineHeight.REGULAR, Color.MAIN, Color.MAIN, Color.CLEAR, Color.BRIGHT, Color.FROZEN, Color.LOCKED, Color.PHANTOM);
|
|
9
|
+
}) => $isErrored ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, FontSize.REGULAR, LineHeight.REGULAR, Color.MAIN, Color.MAIN, Color.CLEAR, Color.BRIGHT, Color.FROZEN, Color.LOCKED, Color.PHANTOM, Color.PHANTOM);
|
package/native/Textarea.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Color, FontSize, LineHeight, ShapeRadius } from '@pushwoosh/kit-constan
|
|
|
4
4
|
export const NativeTextarea = styled.textarea.withConfig({
|
|
5
5
|
displayName: "NativeTextarea",
|
|
6
6
|
componentId: "sc-1xe83i4-0"
|
|
7
|
-
})(["width:", ";min-width:", ";max-width:", ";min-height:56px;padding:8px 12px;border:1px solid ", ";border-radius:", ";font-size:", ";line-height:", ";color:", ";-webkit-text-fill-color:", ";background-color:", ";&:focus{outline:none;border-color:", ";}&:disabled{background-color:", ";-webkit-text-fill-color:", ";}&::placeholder{color:", ";}"], ({
|
|
7
|
+
})(["width:", ";min-width:", ";max-width:", ";min-height:56px;padding:8px 12px;border:1px solid ", ";border-radius:", ";font-size:", ";line-height:", ";color:", ";-webkit-text-fill-color:", ";background-color:", ";&:focus{outline:none;border-color:", ";}&:disabled{background-color:", ";-webkit-text-fill-color:", ";}&::placeholder{color:", ";-webkit-text-fill-color:", ";}"], ({
|
|
8
8
|
$width
|
|
9
9
|
}) => $width || '100%', ({
|
|
10
10
|
$width
|
|
@@ -12,4 +12,4 @@ export const NativeTextarea = styled.textarea.withConfig({
|
|
|
12
12
|
$width
|
|
13
13
|
}) => $width || '100%', ({
|
|
14
14
|
$isErrored
|
|
15
|
-
}) => $isErrored ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, FontSize.REGULAR, LineHeight.REGULAR, Color.MAIN, Color.MAIN, Color.CLEAR, Color.BRIGHT, Color.FROZEN, Color.LOCKED, Color.PHANTOM);
|
|
15
|
+
}) => $isErrored ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, FontSize.REGULAR, LineHeight.REGULAR, Color.MAIN, Color.MAIN, Color.CLEAR, Color.BRIGHT, Color.FROZEN, Color.LOCKED, Color.PHANTOM, Color.PHANTOM);
|