@pushwoosh/dumb-components 2.9.8 → 2.9.9
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/Calendar/CalendarMonth/styles.js +2 -2
- package/Calendar/__tests__/CellBox.test.d.ts +1 -0
- package/Calendar/__tests__/CellBox.test.js +34 -0
- package/RichMessageEditor/{EditorEmojiPicker.js → EditorEmojiPicker/EditorEmojiPicker.js} +3 -3
- package/RichMessageEditor/EditorEmojiPicker/index.d.ts +1 -0
- package/RichMessageEditor/EditorEmojiPicker/index.js +1 -0
- package/RichMessageEditor/{EditorEmojiPicker.styles.js → EditorEmojiPicker/styles.js} +1 -1
- package/RichMessageEditor/RichMessageEditor.js +1 -1
- package/RichMessageEditor/slate/SlateEditor.js +1 -1
- package/RichMessageEditor/slate/{SlateEditor.styles.js → styles.js} +1 -1
- package/RichMessageEditor/{RichMessageEditor.styles.js → styles.js} +4 -4
- package/package.json +1 -1
- /package/RichMessageEditor/{EditorEmojiPicker.d.ts → EditorEmojiPicker/EditorEmojiPicker.d.ts} +0 -0
- /package/RichMessageEditor/{EditorEmojiPicker.helpers.d.ts → EditorEmojiPicker/EditorEmojiPicker.helpers.d.ts} +0 -0
- /package/RichMessageEditor/{EditorEmojiPicker.helpers.js → EditorEmojiPicker/EditorEmojiPicker.helpers.js} +0 -0
- /package/RichMessageEditor/{EditorEmojiPicker.styles.d.ts → EditorEmojiPicker/styles.d.ts} +0 -0
- /package/RichMessageEditor/slate/{SlateEditor.styles.d.ts → styles.d.ts} +0 -0
- /package/RichMessageEditor/{RichMessageEditor.styles.d.ts → styles.d.ts} +0 -0
|
@@ -8,8 +8,8 @@ const periodToCss = css(["border-top-left-radius:0;border-bottom-left-radius:0;"
|
|
|
8
8
|
const disabledCss = css(["font-weight:", ";color:", ";border:1px solid ", ";background:linear-gradient( to top left,rgba(0,0,0,0) 0%,rgba(0,0,0,0) calc(50% - 0.8px),", " 50%,rgba(0,0,0,0) calc(50% + 0.8px),rgba(0,0,0,0) 100% );pointer-events:none;"], FontWeight.REGULAR, Color.PHANTOM, Color.DIVIDER, Color.DIVIDER);
|
|
9
9
|
const outdatedCss = css(["opacity:0;pointer-events:none;"]);
|
|
10
10
|
const highlightedCss = css(["outline:1px solid ", ";"], Color.SOFT_LIGHT);
|
|
11
|
-
const periodCss = css(["position:relative;z-index:0
|
|
12
|
-
const periodOutdatedCss = css(["position:relative;z-index:0;color:transparent;pointer-events:none
|
|
11
|
+
const periodCss = css(["position:relative;z-index:0;&:before{content:'';position:absolute;top:0;left:-1px;right:-1px;bottom:0;background:", ";z-index:-1;}"], Color.SOFT_LIGHT);
|
|
12
|
+
const periodOutdatedCss = css(["position:relative;z-index:0;color:transparent;pointer-events:none;&:before{content:'';position:absolute;top:0;left:-1px;right:-1px;bottom:0;background:", ";z-index:-1;}"], Color.SOFT_LIGHT);
|
|
13
13
|
const cssMap = {
|
|
14
14
|
selected: selectedCss,
|
|
15
15
|
selectedDisabled: selectedDisabledCss,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { CellBox } from '../CalendarMonth/styles';
|
|
4
|
+
const PERIOD_VARIANTS = ['period', 'periodOutdated'];
|
|
5
|
+
function variantCss(variant) {
|
|
6
|
+
const {
|
|
7
|
+
rules
|
|
8
|
+
} = CellBox.componentStyle;
|
|
9
|
+
const flatten = part => {
|
|
10
|
+
if (Array.isArray(part)) return part.map(flatten).join('');
|
|
11
|
+
return typeof part === 'string' ? part : '';
|
|
12
|
+
};
|
|
13
|
+
return rules.filter(rule => typeof rule === 'function').map(rule => flatten(rule({
|
|
14
|
+
$variant: variant
|
|
15
|
+
}))).join('');
|
|
16
|
+
}
|
|
17
|
+
describe('CellBox period variants', () => {
|
|
18
|
+
it.each(PERIOD_VARIANTS)('anchors :before of %s to the cell with &, so stylis 4 does not turn it into a descendant selector', variant => {
|
|
19
|
+
const css = variantCss(variant);
|
|
20
|
+
expect(css).toContain('&:before');
|
|
21
|
+
expect(css).not.toMatch(/(^|[\s;{}])::?before/);
|
|
22
|
+
});
|
|
23
|
+
it.each(PERIOD_VARIANTS)('paints the %s background on the cell pseudo-element', variant => {
|
|
24
|
+
render(_jsx(CellBox, {
|
|
25
|
+
"data-testid": "cell",
|
|
26
|
+
"$variant": variant,
|
|
27
|
+
children: "1"
|
|
28
|
+
}));
|
|
29
|
+
const [className] = [...screen.getByTestId('cell').classList].slice(-1);
|
|
30
|
+
const styles = [...document.querySelectorAll('style')].map(node => node.textContent).join('');
|
|
31
|
+
expect(styles).toMatch(new RegExp(`\\.${className}:before\\{[^}]*background:`));
|
|
32
|
+
expect(styles).not.toContain(`.${className} :before`);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useRef } from 'react';
|
|
3
|
-
import { EditorEmojiPickerStyled } from './
|
|
4
|
-
import { EmojiPicker } from '
|
|
5
|
-
import { useThemeName } from '
|
|
3
|
+
import { EditorEmojiPickerStyled } from './styles';
|
|
4
|
+
import { EmojiPicker } from '../../EmojiPicker';
|
|
5
|
+
import { useThemeName } from '../../hooks';
|
|
6
6
|
export const EditorEmojiPicker = ({
|
|
7
7
|
onEmojiSelect
|
|
8
8
|
}) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './EditorEmojiPicker';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './EditorEmojiPicker';
|
|
@@ -3,7 +3,7 @@ import { Color, getThemeColors, Shadow, ShapeRadius } from '@pushwoosh/kit-const
|
|
|
3
3
|
import { rgbChannels } from './EditorEmojiPicker.helpers';
|
|
4
4
|
export const EditorEmojiPickerStyled = styled.div.withConfig({
|
|
5
5
|
displayName: "EditorEmojiPickerStyled",
|
|
6
|
-
componentId: "sc-
|
|
6
|
+
componentId: "sc-1y0c927-0"
|
|
7
7
|
})(["min-width:352px;em-emoji-picker{border:1px solid ", ";--border-radius:", ";--shadow:", ";background-color:", ";--rgb-background:", ";}"], Color.FORM, ShapeRadius.CONTROL, Shadow.REGULAR, Color.FROZEN, ({
|
|
8
8
|
$theme
|
|
9
9
|
}) => rgbChannels(getThemeColors($theme).FROZEN));
|
|
@@ -10,9 +10,9 @@ import EmojiIcon from './assets/EmojiIcon.svg';
|
|
|
10
10
|
import PersonalizationIcon from './assets/PersonalizationIcon.svg';
|
|
11
11
|
import { EditorEmojiPicker } from './EditorEmojiPicker';
|
|
12
12
|
import { placementToDirection } from './RichMessageEditor.helpers';
|
|
13
|
-
import { Arrow, DropArea, DropContent, ImSpan } from './RichMessageEditor.styles';
|
|
14
13
|
import { getDcByPath } from './slate/helpers';
|
|
15
14
|
import { SlateEditable, SlateEditor } from './slate/SlateEditor';
|
|
15
|
+
import { Arrow, DropArea, DropContent, ImSpan } from './styles';
|
|
16
16
|
/**
|
|
17
17
|
* Slate-based message editor with optional personalization (dynamic-content) tokens
|
|
18
18
|
* and an emoji picker; serializes to a string via `onChange`. Render the result with
|
|
@@ -4,8 +4,8 @@ import { Slate } from 'slate-react';
|
|
|
4
4
|
import { usePersistentFunction } from '@pushwoosh/kit-helpers';
|
|
5
5
|
import { renderElement } from './DynamicContentElement';
|
|
6
6
|
import { content2string, string2content } from './helpers';
|
|
7
|
-
import { EditableStyled } from './SlateEditor.styles';
|
|
8
7
|
import { createMKEditor } from './SlateEditor.utils';
|
|
8
|
+
import { EditableStyled } from './styles';
|
|
9
9
|
export const SlateEditor = ({
|
|
10
10
|
initialValue: initialValueString,
|
|
11
11
|
onChange,
|
|
@@ -3,7 +3,7 @@ import styled from 'styled-components';
|
|
|
3
3
|
import { Color, FontSize, FontWeight, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
4
4
|
export const EditableStyled = styled(Editable).withConfig({
|
|
5
5
|
displayName: "EditableStyled",
|
|
6
|
-
componentId: "sc-
|
|
6
|
+
componentId: "sc-16lukqt-0"
|
|
7
7
|
})(["font-weight:", ";font-size:", ";line-height:140%;padding:8px;color:", ";background:", ";caret-color:", ";border:1px solid ", ";border-radius:", ";overflow-x:auto;& [data-slate-placeholder='true']{color:", ";opacity:1 !important;}&:focus{border-color:", ";outline:none;}& > p{position:relative;margin:4px 0;&:first-child{margin-top:0;}&:last-child{margin-bottom:0;}}"], FontWeight.REGULAR, FontSize.REGULAR, Color.MAIN, Color.CLEAR, Color.BRIGHT, ({
|
|
8
8
|
$isErrored
|
|
9
9
|
}) => $isErrored ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, Color.PHANTOM, Color.BRIGHT);
|
|
@@ -3,15 +3,15 @@ import { Color, Shadow, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
|
3
3
|
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
4
4
|
export const ImSpan = styled.span.withConfig({
|
|
5
5
|
displayName: "ImSpan",
|
|
6
|
-
componentId: "sc-
|
|
6
|
+
componentId: "sc-1n9vpwc-0"
|
|
7
7
|
})(["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);
|
|
8
8
|
export const DropArea = styled.div.withConfig({
|
|
9
9
|
displayName: "DropArea",
|
|
10
|
-
componentId: "sc-
|
|
10
|
+
componentId: "sc-1n9vpwc-1"
|
|
11
11
|
})(["z-index:1000;"]);
|
|
12
12
|
export const DropContent = styled.div.withConfig({
|
|
13
13
|
displayName: "DropContent",
|
|
14
|
-
componentId: "sc-
|
|
14
|
+
componentId: "sc-1n9vpwc-2"
|
|
15
15
|
})(["border:1px solid ", ";border-radius:", ";box-shadow:", ";background-color:", ";"], Color.FORM, ShapeRadius.CONTROL, Shadow.REGULAR, Color.FROZEN);
|
|
16
16
|
const transforms = {
|
|
17
17
|
left: 'scaleX(-1)',
|
|
@@ -23,7 +23,7 @@ export const Arrow = styled(Horizontal).attrs({
|
|
|
23
23
|
$placeItems: 'center'
|
|
24
24
|
}).withConfig({
|
|
25
25
|
displayName: "Arrow",
|
|
26
|
-
componentId: "sc-
|
|
26
|
+
componentId: "sc-1n9vpwc-3"
|
|
27
27
|
})(["position:absolute;width:20px;height:20px;transform:", " translateX(11px);", ":0;"], ({
|
|
28
28
|
$direction
|
|
29
29
|
}) => transforms[$direction], ({
|
package/package.json
CHANGED
/package/RichMessageEditor/{EditorEmojiPicker.d.ts → EditorEmojiPicker/EditorEmojiPicker.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|