@pushwoosh/dumb-components 1.0.60 → 1.0.62

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 (62) hide show
  1. package/CardMetric/CardMetric.d.ts +1 -1
  2. package/CardMetric/CardMetric.js +15 -16
  3. package/CodeEditor/types.d.ts +0 -1
  4. package/DateTimePicker/components/DatePickerField/DatePickerField.d.ts +1 -1
  5. package/DateTimePicker/components/DatePickerField/DatePickerField.js +7 -8
  6. package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.d.ts +1 -1
  7. package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +7 -8
  8. package/DateTimePicker/components/NumberPicker/NumberPicker.d.ts +1 -1
  9. package/DateTimePicker/components/NumberPicker/NumberPicker.js +13 -14
  10. package/Drawer/components/Drawer/Drawer.d.ts +1 -1
  11. package/Drawer/components/Drawer/Drawer.js +9 -10
  12. package/EditableField/EditableField.d.ts +1 -1
  13. package/EditableField/EditableField.js +13 -14
  14. package/InputFile/InputFile.d.ts +1 -1
  15. package/InputFile/InputFile.js +17 -18
  16. package/Link/index.d.ts +1 -0
  17. package/NumberPicker/NumberPicker.d.ts +1 -1
  18. package/NumberPicker/NumberPicker.js +13 -14
  19. package/Pagination/Pagination.d.ts +1 -1
  20. package/Pagination/Pagination.js +9 -10
  21. package/Popover/Popover.d.ts +1 -1
  22. package/Popover/Popover.js +10 -11
  23. package/Popover/index.d.ts +1 -1
  24. package/Popover/index.js +1 -1
  25. package/Popover/types.d.ts +1 -1
  26. package/ProgressBar/ProgressBar.d.ts +2 -2
  27. package/ProgressBar/ProgressBar.js +8 -9
  28. package/ProgressBar/types.d.ts +1 -1
  29. package/PushPreview/PushPreview.d.ts +1 -1
  30. package/PushPreview/PushPreview.js +9 -10
  31. package/RichMessageEditor/EmojiPicker.js +3 -2
  32. package/RichMessageEditor/EmojiPicker.styled.d.ts +1 -0
  33. package/RichMessageEditor/EmojiPicker.styled.js +5 -0
  34. package/RichMessageEditor/RichMessageEditor.js +20 -20
  35. package/RichMessageEditor/RichMessageEditor.styled.d.ts +0 -1
  36. package/RichMessageEditor/RichMessageEditor.styled.js +1 -5
  37. package/RichMessageEditor/RichMessageEditor.types.d.ts +1 -6
  38. package/RichMessageEditor/RichMessageViewer.d.ts +3 -2
  39. package/RichMessageEditor/slate/DynamicContentElement.js +3 -3
  40. package/Skeleton/styles.js +4 -2
  41. package/Switch/Switch.d.ts +2 -2
  42. package/Switch/Switch.js +7 -8
  43. package/Switch/types.d.ts +1 -1
  44. package/Table/components/TablePagination/TablePagination.d.ts +1 -1
  45. package/Table/components/TablePagination/TablePagination.js +10 -11
  46. package/Table/index.d.ts +0 -2
  47. package/Table/index.js +0 -2
  48. package/Table/styles.d.ts +5 -4
  49. package/Tooltip/Tooltip.d.ts +1 -1
  50. package/Tooltip/Tooltip.js +10 -11
  51. package/Tooltip/maps.d.ts +1 -14
  52. package/index.d.ts +1 -1
  53. package/index.js +1 -1
  54. package/package.json +1 -1
  55. package/RichMessageEditor/DropContent.d.ts +0 -5
  56. package/RichMessageEditor/DropContent.js +0 -14
  57. package/Table/components/TableList/TableList.d.ts +0 -3
  58. package/Table/components/TableList/TableList.js +0 -15
  59. package/Table/components/TableList/index.d.ts +0 -1
  60. package/Table/components/TableList/index.js +0 -1
  61. package/Table/components/TableList/types.d.ts +0 -9
  62. package/Table/components/TableList/types.js +0 -1
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { CardMetricProps } from './types';
3
- export declare function CardMetric(props: CardMetricProps): ReactElement;
3
+ export declare function CardMetric({ view, focus, title, tooltip, description, loading, collapse, metric, extraMetric, extraMetricColor, headerExtra, children, ...otherProps }: CardMetricProps): ReactElement;
@@ -5,22 +5,21 @@ import { Spinner } from '../Spinner';
5
5
  import { Tooltip } from '../Tooltip';
6
6
  import { CardChildren } from './CardChildren';
7
7
  import { CardContainer, CardHeader, CardTitle, CardInfo, CardMetricValue, CardExtraMetric, CardDescription, CardHeaderLeft } from './styles';
8
- export function CardMetric(props) {
9
- const {
10
- view = 'rounded',
11
- focus = false,
12
- title = '',
13
- tooltip = '',
14
- description = '',
15
- loading = false,
16
- collapse = undefined,
17
- metric = undefined,
18
- extraMetric = undefined,
19
- extraMetricColor = Color.MAIN,
20
- headerExtra = undefined,
21
- children,
22
- ...otherProps
23
- } = props;
8
+ export function CardMetric({
9
+ view = 'rounded',
10
+ focus = false,
11
+ title = '',
12
+ tooltip = '',
13
+ description = '',
14
+ loading = false,
15
+ collapse = undefined,
16
+ metric = undefined,
17
+ extraMetric = undefined,
18
+ extraMetricColor = Color.MAIN,
19
+ headerExtra = undefined,
20
+ children,
21
+ ...otherProps
22
+ }) {
24
23
  const [visibleInfo, setVisibleInfo] = useState(false);
25
24
  const [isCollapsed, setIsCollapsed] = useState(!!(collapse !== null && collapse !== void 0 && collapse.isCollapsed));
26
25
  const onMouseOver = () => setVisibleInfo(true);
@@ -1,6 +1,5 @@
1
1
  import { type CreateThemeOptions } from '@uiw/codemirror-themes';
2
2
  import { type ViewUpdate, type Extension } from '@uiw/react-codemirror';
3
- export type Language = 'json' | 'html' | 'liquid';
4
3
  export type CodeEditorProps = {
5
4
  value: string;
6
5
  readOnly?: boolean;
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { DatePickerFieldProps } from './types';
3
- export declare function DatePickerField(props: DatePickerFieldProps): ReactElement;
3
+ export declare function DatePickerField({ value, error, allowedPlacements, zIndex, onChange, }: DatePickerFieldProps): ReactElement;
@@ -4,14 +4,13 @@ import { CalendarIcon } from '@pushwoosh/kit-icons';
4
4
  import { format, monthName, get } from '../../helpers';
5
5
  import { InputFrame } from '../../styles';
6
6
  import { DatePicker } from '../DatePicker';
7
- export function DatePickerField(props) {
8
- const {
9
- value,
10
- error,
11
- allowedPlacements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
12
- zIndex = 1000,
13
- onChange
14
- } = props;
7
+ export function DatePickerField({
8
+ value,
9
+ error,
10
+ allowedPlacements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
11
+ zIndex = 1000,
12
+ onChange
13
+ }) {
15
14
  const [showPicker, setShowPicker] = useState(false);
16
15
  const {
17
16
  refs,
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { DateTimePickerFieldProps } from './types';
3
- export declare function DateTimePickerField(props: DateTimePickerFieldProps): ReactElement;
3
+ export declare function DateTimePickerField({ value, error, allowedPlacements, zIndex, onChange, }: DateTimePickerFieldProps): ReactElement;
@@ -5,14 +5,13 @@ import { CalendarIcon } from '@pushwoosh/kit-icons';
5
5
  import { useUTCDate } from './helpers';
6
6
  import { InputFrame } from '../../styles';
7
7
  import { DateTimePicker } from '../DateTimePicker';
8
- export function DateTimePickerField(props) {
9
- const {
10
- value,
11
- error,
12
- allowedPlacements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
13
- zIndex = 1000,
14
- onChange
15
- } = props;
8
+ export function DateTimePickerField({
9
+ value,
10
+ error,
11
+ allowedPlacements = ['bottom-start', 'bottom-end', 'top-start', 'top-end'],
12
+ zIndex = 1000,
13
+ onChange
14
+ }) {
16
15
  const [showPicker, setShowPicker] = useState(false);
17
16
  const {
18
17
  refs,
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { NumberPickerProps } from './types';
3
- export declare function NumberPicker(props: NumberPickerProps): ReactElement;
3
+ export declare function NumberPicker({ value, hint, step, placeholder, focusOnMount, minValue, maxValue, autoSize, isDisabled, onChange, onSubmit, }: NumberPickerProps): ReactElement;
@@ -6,20 +6,19 @@ import { SingleInputFrame } from '../../styles';
6
6
  import { AutosizeInput } from '../AutosizeInput';
7
7
  import { Input } from '../Input';
8
8
  import { Hint } from './styles';
9
- export function NumberPicker(props) {
10
- const {
11
- value,
12
- hint,
13
- step = 1,
14
- placeholder,
15
- focusOnMount,
16
- minValue,
17
- maxValue,
18
- autoSize,
19
- isDisabled,
20
- onChange,
21
- onSubmit
22
- } = props;
9
+ export function NumberPicker({
10
+ value,
11
+ hint,
12
+ step = 1,
13
+ placeholder,
14
+ focusOnMount,
15
+ minValue,
16
+ maxValue,
17
+ autoSize,
18
+ isDisabled,
19
+ onChange,
20
+ onSubmit
21
+ }) {
23
22
  const ref = useRef(null);
24
23
  const [autoDiff, setAutoDiff] = useState(0);
25
24
  const [localValue, setLocalValue] = useState(value.toString() || '');
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { DrawerProps } from './types';
3
- export declare function Drawer(props: DrawerProps): ReactElement;
3
+ export declare function Drawer({ size, isOpen, zIndex, onClose, children, withoutLockScreen, closeOnClickOutside, }: DrawerProps): ReactElement;
@@ -5,16 +5,15 @@ import { DrawerBoxTrans, DrawerBox, LockBody, DrawerInner, DrawerContainer } fro
5
5
  function createDivElement() {
6
6
  return document.createElement('div');
7
7
  }
8
- export function Drawer(props) {
9
- const {
10
- size,
11
- isOpen,
12
- zIndex = 10000,
13
- onClose,
14
- children,
15
- withoutLockScreen = false,
16
- closeOnClickOutside = true
17
- } = props;
8
+ export function Drawer({
9
+ size,
10
+ isOpen,
11
+ zIndex = 10000,
12
+ onClose,
13
+ children,
14
+ withoutLockScreen = false,
15
+ closeOnClickOutside = true
16
+ }) {
18
17
  const ref = useRef();
19
18
  const [element] = useState(createDivElement);
20
19
  useEffect(() => {
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { EditableFieldProps } from './types';
3
- export declare function EditableField(props: EditableFieldProps): ReactElement;
3
+ export declare function EditableField({ value, title, open, loading, width, position, zIndex, onToggleOpen, onSubmit, onCancel, children, }: EditableFieldProps): ReactElement;
@@ -5,20 +5,19 @@ import { Button } from '../Button';
5
5
  import { useOnClickOutside } from '../hooks';
6
6
  import { Popover, PopoverContainer } from '../Popover';
7
7
  import { FieldBox, TitleBox, ButtonsGroup } from './styles';
8
- export function EditableField(props) {
9
- const {
10
- value,
11
- title = '',
12
- open = false,
13
- loading = false,
14
- width = 332,
15
- position = 'right-start',
16
- zIndex = 1000,
17
- onToggleOpen,
18
- onSubmit,
19
- onCancel,
20
- children
21
- } = props;
8
+ export function EditableField({
9
+ value,
10
+ title = '',
11
+ open = false,
12
+ loading = false,
13
+ width = 332,
14
+ position = 'right-start',
15
+ zIndex = 1000,
16
+ onToggleOpen,
17
+ onSubmit,
18
+ onCancel,
19
+ children
20
+ }) {
22
21
  const rootRef = useRef(null);
23
22
  const buttonRef = useRef(null);
24
23
  useOnClickOutside(rootRef, onCancel);
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { InputFileProps } from './types';
3
- export declare function InputFile(props: InputFileProps): ReactElement;
3
+ export declare function InputFile({ fileId, textId, buttonId, label, buttonText, accept, placeholder, disabled, fileName, errorText, name, maxSize, onError, onChange, isIgnoreFileSize, }: InputFileProps): ReactElement;
@@ -4,24 +4,23 @@ import { AttachmentIcon } from '@pushwoosh/kit-icons';
4
4
  import { Button } from '../Button';
5
5
  import { FieldBox } from '../FieldBox';
6
6
  import { InputFileFieldsStyled, InputFileButtonStyled, InputFileInputStyled, InputFileInputHiddenStyled, InputFileErrorStyled } from './styles';
7
- export function InputFile(props) {
8
- const {
9
- fileId,
10
- textId,
11
- buttonId,
12
- label,
13
- buttonText,
14
- accept,
15
- placeholder,
16
- disabled,
17
- fileName,
18
- errorText,
19
- name,
20
- maxSize,
21
- onError = () => {},
22
- onChange,
23
- isIgnoreFileSize = false
24
- } = props;
7
+ export function InputFile({
8
+ fileId,
9
+ textId,
10
+ buttonId,
11
+ label,
12
+ buttonText,
13
+ accept,
14
+ placeholder,
15
+ disabled,
16
+ fileName,
17
+ errorText,
18
+ name,
19
+ maxSize,
20
+ onError = () => {},
21
+ onChange,
22
+ isIgnoreFileSize = false
23
+ }) {
25
24
  const fieldRef = useRef(null);
26
25
  const uploadFile = event => {
27
26
  var _event$target$files;
package/Link/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { Link } from './Link';
2
+ export type { LinkPropsWithoutAs, LinkPropsWithAsTag, LinkPropsWithAsComponent } from './types';
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { NumberPickerProps } from './types';
3
- export declare function NumberPicker(props: NumberPickerProps): ReactElement;
3
+ export declare function NumberPicker({ value, hint, step, placeholder, focusOnMount, minValue, maxValue, autoSize, isDisabled, onChange, onSubmit, }: NumberPickerProps): ReactElement;
@@ -4,20 +4,19 @@ import { ChevronIcon } from '@pushwoosh/kit-icons';
4
4
  import { AutosizeInput } from './components/AutosizeInput';
5
5
  import { intVal, isStringInteger } from './helpers';
6
6
  import { Hint, SingleInputFrame, InputStyled } from './styles';
7
- export function NumberPicker(props) {
8
- const {
9
- value,
10
- hint,
11
- step = 1,
12
- placeholder,
13
- focusOnMount,
14
- minValue,
15
- maxValue,
16
- autoSize,
17
- isDisabled,
18
- onChange,
19
- onSubmit
20
- } = props;
7
+ export function NumberPicker({
8
+ value,
9
+ hint,
10
+ step = 1,
11
+ placeholder,
12
+ focusOnMount,
13
+ minValue,
14
+ maxValue,
15
+ autoSize,
16
+ isDisabled,
17
+ onChange,
18
+ onSubmit
19
+ }) {
21
20
  const ref = useRef(null);
22
21
  const [autoDiff, setAutoDiff] = useState(0);
23
22
  const [localValue, setLocalValue] = useState('');
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { PaginationProps } from './types';
3
- export declare function Pagination(props: PaginationProps): ReactElement | null;
3
+ export declare function Pagination({ boxRef, activePage, totalPages, adjacentPagesCount, isLoading, onChangePage, ...rest }: PaginationProps): ReactElement | null;
@@ -2,16 +2,15 @@ import React, { useCallback } from 'react';
2
2
  import { ArrowIcon } from '@pushwoosh/kit-icons';
3
3
  import { getSafelyNumber } from './helpers';
4
4
  import { PaginationBox, PaginationArrow, PaginationDivider, PaginationButton } from './styles';
5
- export function Pagination(props) {
6
- const {
7
- boxRef,
8
- activePage,
9
- totalPages,
10
- adjacentPagesCount = 2,
11
- isLoading = false,
12
- onChangePage,
13
- ...rest
14
- } = props;
5
+ export function Pagination({
6
+ boxRef,
7
+ activePage,
8
+ totalPages,
9
+ adjacentPagesCount = 2,
10
+ isLoading = false,
11
+ onChangePage,
12
+ ...rest
13
+ }) {
15
14
  const safelyActivePageNumber = getSafelyNumber(activePage);
16
15
  const safelyTotalPagesNumber = getSafelyNumber(totalPages);
17
16
  const handleChangePage = useCallback(event => {
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { PopoverProps } from './types';
3
- export declare function Popover(props: PopoverProps): ReactElement;
3
+ export declare function Popover({ open, anchorEl, internalWindowRef, loading, position, zIndex, windowWidth, children, }: PopoverProps): ReactElement;
@@ -1,16 +1,15 @@
1
1
  import React from 'react';
2
2
  import { PopoverContainerPortal, PopoverContainerWindow } from './styles';
3
- export function Popover(props) {
4
- const {
5
- open,
6
- anchorEl,
7
- internalWindowRef = null,
8
- loading = false,
9
- position = 'right-start',
10
- zIndex = 1000,
11
- windowWidth,
12
- children
13
- } = props;
3
+ export function Popover({
4
+ open,
5
+ anchorEl,
6
+ internalWindowRef = null,
7
+ loading = false,
8
+ position = 'right-start',
9
+ zIndex = 1000,
10
+ windowWidth,
11
+ children
12
+ }) {
14
13
  return React.createElement(PopoverContainerPortal, {
15
14
  animation: false,
16
15
  delay: 0,
@@ -1,4 +1,4 @@
1
1
  export type { Placement } from 'tippy.js';
2
2
  export { Popover } from './Popover';
3
- export { PopoverContainer, PopoverContainerPortal, PopoverContainerWindow } from './styles';
3
+ export { PopoverContainer } from './styles';
4
4
  export type { PopoverProps } from './types';
package/Popover/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export { Popover } from './Popover';
2
- export { PopoverContainer, PopoverContainerPortal, PopoverContainerWindow } from './styles';
2
+ export { PopoverContainer } from './styles';
@@ -2,7 +2,7 @@ import type { RefObject, ReactNode } from 'react';
2
2
  import type { Placement } from 'tippy.js';
3
3
  export interface PopoverProps {
4
4
  readonly anchorEl: RefObject<HTMLElement>;
5
- readonly internalWindowRef?: RefObject<HTMLDivElement>;
5
+ readonly internalWindowRef?: RefObject<HTMLDivElement> | null;
6
6
  readonly position?: Placement;
7
7
  readonly open: boolean;
8
8
  readonly loading?: boolean;
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
- import { type ProgressBoxProps } from './types';
3
- export declare function ProgressBar(props: ProgressBoxProps): ReactElement;
2
+ import { type ProgressBarProps } from './types';
3
+ export declare function ProgressBar({ percentValue, title, rightSlot, color, backgroundColor, }: ProgressBarProps): ReactElement;
@@ -2,20 +2,19 @@ import React from 'react';
2
2
  import { Color } from '@pushwoosh/kit-constants';
3
3
  import { Spinner } from '../Spinner';
4
4
  import { Container, LoadingHeader, LoadingText, ProgressLine, ProgressBarActive, ProgressBoxContainer, RightSlotContainer, SpinnerContainer, ProgressLineContainer } from './styles';
5
- export function ProgressBar(props) {
6
- const {
7
- percentValue,
8
- title,
9
- rightSlot,
10
- color = Color.BRIGHT,
11
- backgroundColor = Color.BRIGHT_LIGHT
12
- } = props;
5
+ export function ProgressBar({
6
+ percentValue,
7
+ title,
8
+ rightSlot,
9
+ color = Color.BRIGHT,
10
+ backgroundColor = Color.BRIGHT_LIGHT
11
+ }) {
13
12
  return React.createElement(Container, null, React.createElement(SpinnerContainer, {
14
13
  "$backgroundColor": backgroundColor
15
14
  }, React.createElement(Spinner, {
16
15
  color: color,
17
16
  size: "medium"
18
- })), React.createElement(ProgressBoxContainer, null, React.createElement(LoadingHeader, null, React.createElement(LoadingText, null, title, ' ', `${percentValue}%`), rightSlot && React.createElement(RightSlotContainer, null, rightSlot)), React.createElement(ProgressLineContainer, null, React.createElement(ProgressLine, null, React.createElement(ProgressBarActive, {
17
+ })), React.createElement(ProgressBoxContainer, null, React.createElement(LoadingHeader, null, React.createElement(LoadingText, null, `${title} ${percentValue}%`), rightSlot && React.createElement(RightSlotContainer, null, rightSlot)), React.createElement(ProgressLineContainer, null, React.createElement(ProgressLine, null, React.createElement(ProgressBarActive, {
19
18
  "$width": percentValue,
20
19
  "$color": color
21
20
  })))));
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
- export type ProgressBoxProps = {
2
+ export type ProgressBarProps = {
3
3
  percentValue: number;
4
4
  title: string;
5
5
  rightSlot?: ReactNode;
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { PushBasicData, PushPreviewProps } from './types';
3
- export declare function PushPreview<T extends PushBasicData>(props: PushPreviewProps<T>): ReactElement;
3
+ export declare function PushPreview<T extends PushBasicData>({ pushPreset, language, view, appTitle, appIcon, isLoading, width, }: PushPreviewProps<T>): ReactElement;
@@ -6,16 +6,15 @@ import { PREVIEW_ICON_URL } from './constants';
6
6
  import { getLocalizedContent } from './helpers';
7
7
  import { PushBox, PushIcon, PushTitle, PushDescription } from './styles';
8
8
  import { RichMessageViewer } from '../RichMessageEditor';
9
- export function PushPreview(props) {
10
- const {
11
- pushPreset,
12
- language,
13
- view = 'compact',
14
- appTitle = '',
15
- appIcon = PREVIEW_ICON_URL,
16
- isLoading = false,
17
- width
18
- } = props;
9
+ export function PushPreview({
10
+ pushPreset,
11
+ language,
12
+ view = 'compact',
13
+ appTitle = '',
14
+ appIcon = PREVIEW_ICON_URL,
15
+ isLoading = false,
16
+ width
17
+ }) {
19
18
  const title = getLocalizedContent((pushPreset === null || pushPreset === void 0 ? void 0 : pushPreset.title) || (pushPreset === null || pushPreset === void 0 ? void 0 : pushPreset.localizedTitle), language) || appTitle;
20
19
  const content = getLocalizedContent((pushPreset === null || pushPreset === void 0 ? void 0 : pushPreset.content) || (pushPreset === null || pushPreset === void 0 ? void 0 : pushPreset.localizedContent), language);
21
20
  const icon = (pushPreset === null || pushPreset === void 0 ? void 0 : pushPreset.icon) || appIcon || PREVIEW_ICON_URL;
@@ -1,5 +1,6 @@
1
1
  import Picker from '@emoji-mart/react';
2
2
  import React from 'react';
3
+ import { EmojiPickerStyled } from './EmojiPicker.styled';
3
4
  async function data() {
4
5
  const response = await fetch('https://cdn.jsdelivr.net/npm/@emoji-mart/data');
5
6
  return response.json();
@@ -7,11 +8,11 @@ async function data() {
7
8
  export const EmojiPicker = ({
8
9
  onEmojiSelect
9
10
  }) => {
10
- return React.createElement(Picker, {
11
+ return React.createElement(EmojiPickerStyled, null, React.createElement(Picker, {
11
12
  data: data,
12
13
  onEmojiSelect: emoji => {
13
14
  onEmojiSelect(emoji.native);
14
15
  },
15
16
  theme: "light"
16
- });
17
+ }));
17
18
  };
@@ -0,0 +1 @@
1
+ export declare const EmojiPickerStyled: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,5 @@
1
+ import styled from 'styled-components';
2
+ export const EmojiPickerStyled = styled.div.withConfig({
3
+ displayName: "EmojiPickerStyled",
4
+ componentId: "sc-1bxjwgk-0"
5
+ })(["min-width:352px;"]);
@@ -1,11 +1,11 @@
1
+ import { autoPlacement, offset, useFloating } from '@floating-ui/react-dom';
1
2
  import { isEqual } from 'es-toolkit';
2
- import React, { useEffect, useRef, useState } from 'react';
3
+ import React, { useEffect, useState } from 'react';
3
4
  import { Transforms } from 'slate';
4
5
  import { Collapse, elementAddListener, Horizontal, usePersistentFunction } from '@pushwoosh/kit-helpers';
5
6
  import { FieldBox } from '../FieldBox';
6
7
  import EmojiIcon from './assets/EmojiIcon.svg';
7
8
  import PersonalizationIcon from './assets/PersonalizationIcon.svg';
8
- import { DropContent } from './DropContent';
9
9
  import { EmojiPicker } from './EmojiPicker';
10
10
  import { ImSpan } from './RichMessageEditor.styled';
11
11
  import { getDcByPath } from './slate/helpers';
@@ -21,24 +21,23 @@ export const RichMessageEditor = ({
21
21
  onBlur,
22
22
  renderDynamicContent
23
23
  }) => {
24
- const rootRef = useRef(null);
25
24
  const [showDrop, setShowDrop] = useState();
26
25
  const [isFocused, setIsFocused] = useState(false);
27
- const showDropArea = val => {
28
- const rect = rootRef.current.getBoundingClientRect();
29
- setShowDrop({
30
- ...val,
31
- xValue: rect.right + 8,
32
- yValue: rect.top
33
- });
34
- };
26
+ const {
27
+ refs,
28
+ floatingStyles
29
+ } = useFloating({
30
+ middleware: [offset(8), autoPlacement({
31
+ allowedPlacements: ['left', 'left-start', 'left-end', 'right', 'right-start', 'right-end']
32
+ })]
33
+ });
35
34
  const onSelectionChange = selection => {
36
35
  if (isEqual(selection.anchor, selection.focus)) {
37
36
  const {
38
37
  path
39
38
  } = selection.anchor;
40
39
  if (path.length > 2) {
41
- showDropArea({
40
+ setShowDrop({
42
41
  type: 'personalization',
43
42
  path: path.slice(0, -1)
44
43
  });
@@ -69,11 +68,11 @@ export const RichMessageEditor = ({
69
68
  return;
70
69
  }
71
70
  return elementAddListener(document, ['mousedown', 'touchstart', 'focusin'], event => {
72
- if (rootRef.current && !rootRef.current.contains(event.target)) {
71
+ if (refs.reference.current instanceof HTMLElement && !refs.reference.current.contains(event.target)) {
73
72
  clickAwayHandler();
74
73
  }
75
74
  });
76
- }, [clickAwayHandler, isFocused]);
75
+ }, [clickAwayHandler, isFocused, refs.reference]);
77
76
  return React.createElement(SlateEditor, {
78
77
  initialValue: initialValue,
79
78
  onChange: onChange,
@@ -84,18 +83,18 @@ export const RichMessageEditor = ({
84
83
  var _getDcByPath;
85
84
  return React.createElement(FieldBox, {
86
85
  title: title,
87
- boxRef: rootRef,
86
+ boxRef: refs.setReference,
88
87
  error: error,
89
88
  actions: React.createElement(Collapse, {
90
89
  expanded: isFocused
91
90
  }, React.createElement(Horizontal, {
92
91
  "$gap": 8
93
92
  }, canUsePersonalization && React.createElement(ImSpan, {
94
- onClick: () => showDropArea({
93
+ onClick: () => setShowDrop({
95
94
  type: 'personalization'
96
95
  })
97
96
  }, React.createElement(PersonalizationIcon, null), "Personalization"), canUseEmoji && React.createElement(ImSpan, {
98
- onClick: () => showDropArea({
97
+ onClick: () => setShowDrop({
99
98
  type: 'emoji'
100
99
  })
101
100
  }, React.createElement(EmojiIcon, null), "Emoji")))
@@ -110,9 +109,10 @@ export const RichMessageEditor = ({
110
109
  onSelectionChange(selection);
111
110
  }
112
111
  }
113
- }), showDrop && React.createElement(DropContent, {
114
- top: showDrop.yValue,
115
- left: showDrop.xValue
112
+ }), showDrop && React.createElement("div", {
113
+ style: floatingStyles,
114
+ ref: refs.setFloating,
115
+ key: showDrop.type
116
116
  }, showDrop.type === 'personalization' && (renderDynamicContent === null || renderDynamicContent === void 0 ? void 0 : renderDynamicContent({
117
117
  dc: showDrop.path ? (_getDcByPath = getDcByPath(editor.children, showDrop.path)) === null || _getDcByPath === void 0 ? void 0 : _getDcByPath.dc : undefined,
118
118
  onChange: newDC => {
@@ -1,2 +1 @@
1
1
  export declare const ImSpan: import("styled-components").StyledComponent<"span", any, {}, never>;
2
- export declare const DropContentStyled: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -3,8 +3,4 @@ import { Color } from '@pushwoosh/kit-constants';
3
3
  export const ImSpan = styled.span.withConfig({
4
4
  displayName: "ImSpan",
5
5
  componentId: "sc-kdvgj9-0"
6
- })(["color:", ";position:relative;padding-left:20px;font-size:12px;font-style:normal;font-weight:500;line-height:130%;text-transform:uppercase;cursor:pointer;> svg{position:absolute;left:0;top:-1px;}"], Color.SOFT);
7
- export const DropContentStyled = styled.div.withConfig({
8
- displayName: "DropContentStyled",
9
- componentId: "sc-kdvgj9-1"
10
- })(["position:fixed;z-index:10;"]);
6
+ })(["color:", ";position:relative;padding-left:20px;font-size:12px;font-style:normal;font-weight:500;line-height:130%;text-transform:uppercase;cursor:pointer;> svg{position:absolute;left:0;top:-1px;}"], Color.SOFT);
@@ -1,9 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { DynamicContent } from './slate/types';
3
- type DropValueCommon = {
4
- xValue: number;
5
- yValue: number;
6
- };
7
3
  export type DropValuePersonalization = {
8
4
  type: 'personalization';
9
5
  path?: number[];
@@ -11,7 +7,7 @@ export type DropValuePersonalization = {
11
7
  export type DropValueEmoji = {
12
8
  type: 'emoji';
13
9
  };
14
- export type DropValue = DropValueCommon & DropValueEmoji | DropValueCommon & DropValuePersonalization;
10
+ export type DropValue = DropValueEmoji | DropValuePersonalization;
15
11
  export type RichMessageEditorProps = {
16
12
  title: ReactNode;
17
13
  initialValue: string;
@@ -26,4 +22,3 @@ export type RichMessageEditorProps = {
26
22
  onChange: (newDC: DynamicContent) => void;
27
23
  }) => ReactNode;
28
24
  };
29
- export {};
@@ -1,6 +1,7 @@
1
1
  import { type FC } from 'react';
2
2
  import { type RichMessageEditorContent } from './types';
3
- export declare const RichMessageViewer: FC<{
3
+ export type RichMessageViewerProps = {
4
4
  value: RichMessageEditorContent | string;
5
5
  flat?: boolean;
6
- }>;
6
+ };
7
+ export declare const RichMessageViewer: FC<RichMessageViewerProps>;
@@ -23,6 +23,9 @@ const DynamicContentElementComponent = ({
23
23
  event.preventDefault();
24
24
  event.stopPropagation();
25
25
  const [paragraphIndex, elementIndex] = findPath(editor.children, element);
26
+ Transforms.delete(editor, {
27
+ at: [paragraphIndex, elementIndex]
28
+ });
26
29
  if (selected) {
27
30
  var _editor$children$para;
28
31
  const prevOffset = ((_editor$children$para = editor.children[paragraphIndex].children[elementIndex - 1]) === null || _editor$children$para === void 0 ? void 0 : _editor$children$para.text.length) || 0;
@@ -35,9 +38,6 @@ const DynamicContentElementComponent = ({
35
38
  focus: point
36
39
  });
37
40
  }
38
- Transforms.delete(editor, {
39
- at: [paragraphIndex, elementIndex]
40
- });
41
41
  }
42
42
  }, React.createElement("span", null, tagName || 'Not set'), children);
43
43
  };
@@ -26,8 +26,10 @@ export const CircularSkeleton = styled.div.withConfig({
26
26
  export const TextSkeletonTag = styled.div.withConfig({
27
27
  displayName: "TextSkeletonTag",
28
28
  componentId: "sc-mdyfd6-2"
29
- })(["", " color:", ";border-radius:4px;", ""], ({
29
+ })(["", " color:", ";border-radius:", ";", ""], ({
30
30
  width
31
31
  }) => width ? `width: ${toCssValue(width)};` : '', ({
32
32
  color
33
- }) => color || '#ddd', skeletonCommonCss);
33
+ }) => color || '#ddd', ({
34
+ borderRadius
35
+ }) => borderRadius || '4px', skeletonCommonCss);
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
- import type { TProps } from './types';
3
- export declare function Switch(props: TProps): ReactElement;
2
+ import type { SwitchProps } from './types';
3
+ export declare function Switch({ labelPosition, enabled, isDisabled, children, onChange, }: SwitchProps): ReactElement;
package/Switch/Switch.js CHANGED
@@ -1,13 +1,12 @@
1
1
  import React from 'react';
2
2
  import { Container, Box, Circle, Label } from './styles';
3
- export function Switch(props) {
4
- const {
5
- labelPosition = 'right',
6
- enabled = false,
7
- isDisabled = false,
8
- children,
9
- onChange
10
- } = props;
3
+ export function Switch({
4
+ labelPosition = 'right',
5
+ enabled = false,
6
+ isDisabled = false,
7
+ children,
8
+ onChange
9
+ }) {
11
10
  return React.createElement(Container, {
12
11
  labelPosition: labelPosition
13
12
  }, React.createElement(Box, {
package/Switch/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- export interface TProps {
2
+ export interface SwitchProps {
3
3
  labelPosition?: 'left' | 'right';
4
4
  enabled?: boolean;
5
5
  isDisabled?: boolean;
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { TablePaginationProps } from './types';
3
- export declare function TablePagination(props: TablePaginationProps): ReactElement;
3
+ export declare function TablePagination({ activePage, totalPages, limit, allLimits, padding, onChangePage, onChangeLimit, children, }: TablePaginationProps): ReactElement;
@@ -2,17 +2,16 @@ import React from 'react';
2
2
  import { Horizontal } from '@pushwoosh/kit-helpers';
3
3
  import { NativeSelect } from '../../../native';
4
4
  import { Pagination } from '../../../Pagination';
5
- export function TablePagination(props) {
6
- const {
7
- activePage,
8
- totalPages,
9
- limit,
10
- allLimits,
11
- padding = 24,
12
- onChangePage,
13
- onChangeLimit,
14
- children
15
- } = props;
5
+ export function TablePagination({
6
+ activePage,
7
+ totalPages,
8
+ limit,
9
+ allLimits,
10
+ padding = 24,
11
+ onChangePage,
12
+ onChangeLimit,
13
+ children
14
+ }) {
16
15
  return React.createElement(Horizontal, {
17
16
  "$alignItems": "center",
18
17
  "$justifyContent": "space-between",
package/Table/index.d.ts CHANGED
@@ -1,11 +1,9 @@
1
1
  export { DataTable } from './components/DataTable';
2
- export { DataTableList } from './components/DataTableList';
3
2
  export { DataTableGetContext } from './components/DataTableGetContext';
4
3
  export { DataTablePagination } from './components/DataTablePagination';
5
4
  export { DataTableSearchInput } from './components/DataTableSearchInput';
6
5
  export { DataTableSortableCell } from './components/DataTableSortableCell';
7
6
  export { Loading } from './components/Loading';
8
- export { TableList } from './components/TableList';
9
7
  export { TablePagination } from './components/TablePagination';
10
8
  export { useDataTableContext, useDataTableGetParams } from './hooks';
11
9
  export { Table, Td, Tr, Th, ElementHover, ItemDetailLink, ItemName, LockedText, Description, } from './styles';
package/Table/index.js CHANGED
@@ -1,11 +1,9 @@
1
1
  export { DataTable } from './components/DataTable';
2
- export { DataTableList } from './components/DataTableList';
3
2
  export { DataTableGetContext } from './components/DataTableGetContext';
4
3
  export { DataTablePagination } from './components/DataTablePagination';
5
4
  export { DataTableSearchInput } from './components/DataTableSearchInput';
6
5
  export { DataTableSortableCell } from './components/DataTableSortableCell';
7
6
  export { Loading } from './components/Loading';
8
- export { TableList } from './components/TableList';
9
7
  export { TablePagination } from './components/TablePagination';
10
8
  export { useDataTableContext, useDataTableGetParams } from './hooks';
11
9
  export { Table, Td, Tr, Th, ElementHover, ItemDetailLink, ItemName, LockedText, Description } from './styles';
package/Table/styles.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  import { FontSize, FontWeight } from '@pushwoosh/kit-constants';
2
+ export type TableProps = {
3
+ columns: string;
4
+ width?: string | number;
5
+ };
2
6
  export declare const Table: import("styled-components").StyledComponent<"div", any, {
3
7
  $alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
4
8
  $alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
@@ -54,10 +58,7 @@ export declare const Table: import("styled-components").StyledComponent<"div", a
54
58
  $placeItems?: "end" | "start" | "center" | "stretch" | undefined;
55
59
  } & {
56
60
  $gridAutoFlow: string;
57
- } & {
58
- columns: string;
59
- width?: string | number;
60
- }, "$gridAutoFlow">;
61
+ } & TableProps, "$gridAutoFlow">;
61
62
  export declare const Td: import("styled-components").StyledComponent<"div", any, {
62
63
  $alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
63
64
  $alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
@@ -1,3 +1,3 @@
1
1
  import { type ReactElement } from 'react';
2
2
  import type { TooltipProps } from './types';
3
- export declare function Tooltip(props: TooltipProps): ReactElement;
3
+ export declare function Tooltip({ position, arrowOffset, offset, maxWidth, zIndex, isDisabled, isVisible, ...rest }: TooltipProps): ReactElement;
@@ -1,17 +1,16 @@
1
1
  import React from 'react';
2
2
  import { TooltipPositionToArrowOffsetMap, TooltipPositionToTippyOffsetMap, TooltipPositionToTippyPlacementMap } from './maps';
3
3
  import { TooltipBox } from './styles';
4
- export function Tooltip(props) {
5
- const {
6
- position = 'top-start',
7
- arrowOffset = TooltipPositionToArrowOffsetMap[position],
8
- offset = TooltipPositionToTippyOffsetMap[position],
9
- maxWidth = 240,
10
- zIndex = 999999,
11
- isDisabled,
12
- isVisible,
13
- ...rest
14
- } = props;
4
+ export function Tooltip({
5
+ position = 'top-start',
6
+ arrowOffset = TooltipPositionToArrowOffsetMap[position],
7
+ offset = TooltipPositionToTippyOffsetMap[position],
8
+ maxWidth = 240,
9
+ zIndex = 999999,
10
+ isDisabled,
11
+ isVisible,
12
+ ...rest
13
+ }) {
15
14
  return React.createElement(TooltipBox, {
16
15
  animation: false,
17
16
  delay: 0,
package/Tooltip/maps.d.ts CHANGED
@@ -13,20 +13,7 @@ export declare const TooltipPositionToTippyPlacementMap: {
13
13
  'left-middle': "left";
14
14
  'left-end': "left-end";
15
15
  };
16
- export declare const TooltipPositionToTippyOffsetMap: {
17
- 'top-start': number[];
18
- 'top-middle': number[];
19
- 'top-end': number[];
20
- 'right-start': number[];
21
- 'right-middle': number[];
22
- 'right-end': number[];
23
- 'bottom-start': number[];
24
- 'bottom-middle': number[];
25
- 'bottom-end': number[];
26
- 'left-start': number[];
27
- 'left-middle': number[];
28
- 'left-end': number[];
29
- };
16
+ export declare const TooltipPositionToTippyOffsetMap: Record<TooltipPosition, [number, number]>;
30
17
  export declare const TooltipPositionToArrowOffsetMap: {
31
18
  'top-start': string;
32
19
  'top-middle': string;
package/index.d.ts CHANGED
@@ -26,7 +26,7 @@ export { StatisticCard } from './StatisticCard';
26
26
  export { EmailTemplatePreview, NoEmailTemplatePreview } from './EmailTemplatePreview';
27
27
  export { PushPreview } from './PushPreview';
28
28
  export { Toast, ToastProvider, useToast } from './Toast';
29
- export { DataTable, DataTableList, DataTableGetContext, DataTablePagination, DataTableSearchInput, DataTableSortableCell, Loading, TableList, TablePagination, useDataTableContext, useDataTableGetParams, Table, Td, Tr, Th, ElementHover, ItemDetailLink, ItemName, LockedText, Description, type DataTableParams, type DataTableData, type DataTableContextType, } from './Table';
29
+ export { DataTable, DataTableGetContext, DataTablePagination, DataTableSearchInput, DataTableSortableCell, Loading, TablePagination, useDataTableContext, useDataTableGetParams, Table, Td, Tr, Th, ElementHover, ItemDetailLink, ItemName, LockedText, Description, type DataTableParams, type DataTableData, type DataTableContextType, } from './Table';
30
30
  export { AutosizeInput, PageHeader, PageHeaderEditable } from './PageHeader';
31
31
  export { ExportResult } from './ExportResult';
32
32
  export { NativeInput, NativeTextarea, NativeSelect } from './native';
package/index.js CHANGED
@@ -26,7 +26,7 @@ export { StatisticCard } from './StatisticCard';
26
26
  export { EmailTemplatePreview, NoEmailTemplatePreview } from './EmailTemplatePreview';
27
27
  export { PushPreview } from './PushPreview';
28
28
  export { Toast, ToastProvider, useToast } from './Toast';
29
- export { DataTable, DataTableList, DataTableGetContext, DataTablePagination, DataTableSearchInput, DataTableSortableCell, Loading, TableList, TablePagination, useDataTableContext, useDataTableGetParams, Table, Td, Tr, Th, ElementHover, ItemDetailLink, ItemName, LockedText, Description } from './Table';
29
+ export { DataTable, DataTableGetContext, DataTablePagination, DataTableSearchInput, DataTableSortableCell, Loading, TablePagination, useDataTableContext, useDataTableGetParams, Table, Td, Tr, Th, ElementHover, ItemDetailLink, ItemName, LockedText, Description } from './Table';
30
30
  export { AutosizeInput, PageHeader, PageHeaderEditable } from './PageHeader';
31
31
  export { ExportResult } from './ExportResult';
32
32
  export { NativeInput, NativeTextarea, NativeSelect } from './native';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.0.60",
3
+ "version": "1.0.62",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -1,5 +0,0 @@
1
- import { type FC, type PropsWithChildren } from 'react';
2
- export declare const DropContent: FC<PropsWithChildren<{
3
- top: number;
4
- left: number;
5
- }>>;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { DropContentStyled } from './RichMessageEditor.styled';
3
- export const DropContent = ({
4
- top,
5
- left,
6
- children
7
- }) => {
8
- return React.createElement(DropContentStyled, {
9
- style: {
10
- top,
11
- left
12
- }
13
- }, children);
14
- };
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import type { TableListProps } from './types';
3
- export declare function TableList<I>(props: TableListProps<I>): React.JSX.Element;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import { Table } from '../../styles';
3
- export function TableList(props) {
4
- const {
5
- columns,
6
- items,
7
- renderHead,
8
- renderItem,
9
- renderTableTop,
10
- renderTableBottom
11
- } = props;
12
- return React.createElement(Table, {
13
- columns: columns
14
- }, renderTableTop === null || renderTableTop === void 0 ? void 0 : renderTableTop(), renderHead(), items.map(renderItem), renderTableBottom === null || renderTableBottom === void 0 ? void 0 : renderTableBottom());
15
- }
@@ -1 +0,0 @@
1
- export { TableList } from './TableList';
@@ -1 +0,0 @@
1
- export { TableList } from './TableList';
@@ -1,9 +0,0 @@
1
- import type { ReactNode } from 'react';
2
- export type TableListProps<I> = {
3
- columns: string;
4
- items: I[];
5
- renderTableTop?: () => ReactNode;
6
- renderHead: () => ReactNode;
7
- renderItem: (item: I) => ReactNode;
8
- renderTableBottom?: () => ReactNode;
9
- };
@@ -1 +0,0 @@
1
- export {};