@pushwoosh/dumb-components 1.0.28 → 1.0.30
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/CodeEditor/CodeEditor.d.ts +3 -0
- package/CodeEditor/CodeEditor.js +29 -0
- package/CodeEditor/constants.d.ts +1 -0
- package/CodeEditor/constants.js +25 -0
- package/CodeEditor/index.d.ts +2 -0
- package/CodeEditor/index.js +2 -0
- package/CodeEditor/languages/html.d.ts +1 -0
- package/CodeEditor/languages/html.js +2 -0
- package/CodeEditor/languages/index.d.ts +3 -0
- package/CodeEditor/languages/index.js +3 -0
- package/CodeEditor/languages/json.d.ts +1 -0
- package/CodeEditor/languages/json.js +2 -0
- package/CodeEditor/languages/liquid.d.ts +1 -0
- package/CodeEditor/languages/liquid.js +2 -0
- package/CodeEditor/styles.d.ts +3 -0
- package/CodeEditor/styles.js +9 -0
- package/CodeEditor/types.d.ts +15 -0
- package/CodeEditor/types.js +1 -0
- package/PushPreview/components/NoPushPreview/NoPushPreview.d.ts +2 -0
- package/PushPreview/components/NoPushPreview/NoPushPreview.js +14 -0
- package/PushPreview/components/NoPushPreview/index.d.ts +1 -0
- package/PushPreview/components/NoPushPreview/index.js +1 -0
- package/PushPreview/components/NoPushPreview/styles.d.ts +14 -0
- package/PushPreview/components/NoPushPreview/styles.js +11 -0
- package/PushPreview/components/SilentPushPreview/SilentPushPreview.d.ts +2 -0
- package/PushPreview/components/SilentPushPreview/SilentPushPreview.js +20 -0
- package/PushPreview/components/SilentPushPreview/index.d.ts +1 -0
- package/PushPreview/components/SilentPushPreview/index.js +1 -0
- package/PushPreview/components/SilentPushPreview/styles.d.ts +14 -0
- package/PushPreview/components/SilentPushPreview/styles.js +11 -0
- package/PushPreview/index.d.ts +3 -1
- package/PushPreview/index.js +3 -1
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/package.json +8 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import createTheme from '@uiw/codemirror-themes';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { defaultTheme } from './constants';
|
|
4
|
+
import { CodeMirrorStyled } from './styles';
|
|
5
|
+
export const CodeEditor = ({
|
|
6
|
+
value,
|
|
7
|
+
onChange,
|
|
8
|
+
readOnly,
|
|
9
|
+
width,
|
|
10
|
+
height,
|
|
11
|
+
onBlur,
|
|
12
|
+
extensions,
|
|
13
|
+
themeOptions,
|
|
14
|
+
hasError,
|
|
15
|
+
placeholder
|
|
16
|
+
}) => {
|
|
17
|
+
return React.createElement(CodeMirrorStyled, {
|
|
18
|
+
value: value,
|
|
19
|
+
theme: themeOptions ? createTheme(themeOptions) : defaultTheme,
|
|
20
|
+
readOnly: readOnly,
|
|
21
|
+
onChange: onChange,
|
|
22
|
+
onBlur: onBlur,
|
|
23
|
+
width: width,
|
|
24
|
+
height: height,
|
|
25
|
+
extensions: extensions,
|
|
26
|
+
placeholder: placeholder,
|
|
27
|
+
"$danger": hasError
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const defaultTheme: import("@codemirror/state").Extension;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { tags } from '@lezer/highlight';
|
|
2
|
+
import createTheme from '@uiw/codemirror-themes';
|
|
3
|
+
import { Color, FontFamily, FontSize } from '@pushwoosh/kit-constants';
|
|
4
|
+
export const defaultTheme = createTheme({
|
|
5
|
+
theme: 'light',
|
|
6
|
+
settings: {
|
|
7
|
+
background: Color.CLEAR,
|
|
8
|
+
backgroundImage: '',
|
|
9
|
+
foreground: Color.MAIN,
|
|
10
|
+
caret: Color.BRIGHT,
|
|
11
|
+
selection: Color.BRIGHT_LIGHT,
|
|
12
|
+
selectionMatch: Color.BRIGHT_LIGHT,
|
|
13
|
+
gutterBackground: Color.SOFT_LIGHT,
|
|
14
|
+
gutterForeground: Color.PHANTOM,
|
|
15
|
+
gutterBorder: Color.FORM,
|
|
16
|
+
gutterActiveForeground: Color.MAIN,
|
|
17
|
+
lineHighlight: Color.SOFT_LIGHT,
|
|
18
|
+
fontFamily: FontFamily.MONO,
|
|
19
|
+
fontSize: FontSize.REGULAR
|
|
20
|
+
},
|
|
21
|
+
styles: [{
|
|
22
|
+
tag: tags.invalid,
|
|
23
|
+
color: Color.PRIMARY
|
|
24
|
+
}]
|
|
25
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const html: import("@codemirror/language").LanguageSupport[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const json: import("@codemirror/language").LanguageSupport[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const liquid: import("@codemirror/language").LanguageSupport[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const CodeMirrorStyled: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@uiw/react-codemirror").ReactCodeMirrorProps & import("react").RefAttributes<import("@uiw/react-codemirror").ReactCodeMirrorRef>>, any, {
|
|
2
|
+
$danger?: boolean;
|
|
3
|
+
}, never>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import CodeMirror from '@uiw/react-codemirror';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
4
|
+
export const CodeMirrorStyled = styled(CodeMirror).withConfig({
|
|
5
|
+
displayName: "CodeMirrorStyled",
|
|
6
|
+
componentId: "sc-3i4lgt-0"
|
|
7
|
+
})([".cm-editor{border:1px solid ", ";outline:none;border-radius:", ";overflow:hidden;&.cm-focused{border-color:", ";}}"], ({
|
|
8
|
+
$danger
|
|
9
|
+
}) => $danger ? Color.DANGER : Color.FORM, ShapeRadius.CONTROL, Color.BRIGHT);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CreateThemeOptions } from '@uiw/codemirror-themes';
|
|
2
|
+
import { type ViewUpdate, type Extension } from '@uiw/react-codemirror';
|
|
3
|
+
export type Language = 'json' | 'html' | 'liquid';
|
|
4
|
+
export type CodeEditorProps = {
|
|
5
|
+
value: string;
|
|
6
|
+
readOnly?: boolean;
|
|
7
|
+
width?: string;
|
|
8
|
+
height?: string;
|
|
9
|
+
hasError?: boolean;
|
|
10
|
+
extensions: Extension[];
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
themeOptions?: CreateThemeOptions;
|
|
13
|
+
onChange?: (value: string, viewUpdate: ViewUpdate) => void;
|
|
14
|
+
onBlur?: () => void;
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
3
|
+
import { Container, IconMock } from './styles';
|
|
4
|
+
import { LockedText, LockedTitle } from '../../../common';
|
|
5
|
+
export function NoPushPreview() {
|
|
6
|
+
return React.createElement(Container, {
|
|
7
|
+
"$gap": "10px",
|
|
8
|
+
"$padding": "10px",
|
|
9
|
+
"$alignItems": "center",
|
|
10
|
+
"$justifyContent": "start"
|
|
11
|
+
}, React.createElement(IconMock, null), React.createElement(Vertical, null, React.createElement(LockedTitle, null, "Content missed..."), React.createElement(LockedText, {
|
|
12
|
+
"$small": true
|
|
13
|
+
}, "Might be old data or deleted presets")));
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NoPushPreview } from './NoPushPreview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NoPushPreview } from './NoPushPreview';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const IconMock: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
$alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
4
|
+
$alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
5
|
+
$gap?: string | number | undefined;
|
|
6
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
7
|
+
$justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
8
|
+
$justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
9
|
+
$margin?: string | number | undefined;
|
|
10
|
+
$padding?: string | number | undefined;
|
|
11
|
+
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
12
|
+
} & {
|
|
13
|
+
$gridAutoFlow: string;
|
|
14
|
+
}, "$gridAutoFlow">;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
4
|
+
export const IconMock = styled.div.withConfig({
|
|
5
|
+
displayName: "IconMock",
|
|
6
|
+
componentId: "sc-mvf0fq-0"
|
|
7
|
+
})(["width:36px;height:36px;border-radius:", ";border:1px dashed ", ";background:", ";"], ShapeRadius.CONTROL, Color.SOFT_LIGHT_HOVER, Color.BRIGHT_LIGHT);
|
|
8
|
+
export const Container = styled(Horizontal).withConfig({
|
|
9
|
+
displayName: "Container",
|
|
10
|
+
componentId: "sc-mvf0fq-1"
|
|
11
|
+
})(["background:", ";border-radius:", ";border:1px dashed ", ";max-width:350px;"], Color.CLEAR, ShapeRadius.SECTION, Color.SOFT_LIGHT_HOVER);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
3
|
+
import { NotificationIcon } from '@pushwoosh/kit-icons';
|
|
4
|
+
import { Container, IconContainer } from './styles';
|
|
5
|
+
import { LockedText, LockedTitle } from '../../../common';
|
|
6
|
+
export function SilentPushPreview() {
|
|
7
|
+
return React.createElement(Container, {
|
|
8
|
+
"$gap": "10px",
|
|
9
|
+
"$padding": "10px",
|
|
10
|
+
"$alignItems": "center",
|
|
11
|
+
"$justifyContent": "start"
|
|
12
|
+
}, React.createElement(IconContainer, null, React.createElement(NotificationIcon, {
|
|
13
|
+
size: "medium",
|
|
14
|
+
type: "disabled",
|
|
15
|
+
view: "lined",
|
|
16
|
+
color: "#FFD600"
|
|
17
|
+
})), React.createElement(Vertical, null, React.createElement(LockedTitle, null, "Silent push"), React.createElement(LockedText, {
|
|
18
|
+
"$small": true
|
|
19
|
+
}, "There is no content to preview")));
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SilentPushPreview } from './SilentPushPreview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SilentPushPreview } from './SilentPushPreview';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const IconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
$alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
4
|
+
$alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
5
|
+
$gap?: string | number | undefined;
|
|
6
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
7
|
+
$justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
8
|
+
$justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
9
|
+
$margin?: string | number | undefined;
|
|
10
|
+
$padding?: string | number | undefined;
|
|
11
|
+
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
12
|
+
} & {
|
|
13
|
+
$gridAutoFlow: string;
|
|
14
|
+
}, "$gridAutoFlow">;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
4
|
+
export const IconContainer = styled.div.withConfig({
|
|
5
|
+
displayName: "IconContainer",
|
|
6
|
+
componentId: "sc-fgx4rs-0"
|
|
7
|
+
})(["width:36px;height:36px;padding:6px;border-radius:", ";opacity:0.5;background:", ";"], ShapeRadius.CONTROL, Color.MAIN);
|
|
8
|
+
export const Container = styled(Horizontal).withConfig({
|
|
9
|
+
displayName: "Container",
|
|
10
|
+
componentId: "sc-fgx4rs-1"
|
|
11
|
+
})(["background:", ";border-radius:", ";border:1px dashed ", ";max-width:350px;"], Color.CLEAR, ShapeRadius.SECTION, Color.SOFT_LIGHT_HOVER);
|
package/PushPreview/index.d.ts
CHANGED
package/PushPreview/index.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export { Tab, TabBar, TabPanel, Tabs, type TabCode } from './Tabs';
|
|
|
24
24
|
export { Link } from './Link';
|
|
25
25
|
export { StatisticCard } from './StatisticCard';
|
|
26
26
|
export { EmailTemplatePreview, NoEmailTemplatePreview } from './EmailTemplatePreview';
|
|
27
|
-
export { PushPreview } from './PushPreview';
|
|
27
|
+
export { PushPreview, NoPushPreview, SilentPushPreview } from './PushPreview';
|
|
28
28
|
export { Toast, ToastProvider, useToast } from './Toast';
|
|
29
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';
|
|
30
30
|
export { AutosizeInput, PageHeader, PageHeaderEditable } from './PageHeader';
|
|
@@ -32,4 +32,5 @@ export { ExportResult } from './ExportResult';
|
|
|
32
32
|
export { NativeInput, NativeTextarea, NativeSelect } from './native';
|
|
33
33
|
export { FieldBox } from './FieldBox';
|
|
34
34
|
export { NumberPicker } from './NumberPicker';
|
|
35
|
+
export { CodeEditor } from './CodeEditor';
|
|
35
36
|
export { EnhancedInput, SearchInput } from './EnhancedInput';
|
package/index.js
CHANGED
|
@@ -24,7 +24,7 @@ export { Tab, TabBar, TabPanel, Tabs } from './Tabs';
|
|
|
24
24
|
export { Link } from './Link';
|
|
25
25
|
export { StatisticCard } from './StatisticCard';
|
|
26
26
|
export { EmailTemplatePreview, NoEmailTemplatePreview } from './EmailTemplatePreview';
|
|
27
|
-
export { PushPreview } from './PushPreview';
|
|
27
|
+
export { PushPreview, NoPushPreview, SilentPushPreview } from './PushPreview';
|
|
28
28
|
export { Toast, ToastProvider, useToast } from './Toast';
|
|
29
29
|
export { DataTable, DataTableList, DataTableGetContext, DataTablePagination, DataTableSearchInput, DataTableSortableCell, Loading, TableList, TablePagination, useDataTableContext, useDataTableGetParams, Table, Td, Tr, Th, ElementHover, ItemDetailLink, ItemName, LockedText, Description } from './Table';
|
|
30
30
|
export { AutosizeInput, PageHeader, PageHeaderEditable } from './PageHeader';
|
|
@@ -32,4 +32,5 @@ export { ExportResult } from './ExportResult';
|
|
|
32
32
|
export { NativeInput, NativeTextarea, NativeSelect } from './native';
|
|
33
33
|
export { FieldBox } from './FieldBox';
|
|
34
34
|
export { NumberPicker } from './NumberPicker';
|
|
35
|
+
export { CodeEditor } from './CodeEditor';
|
|
35
36
|
export { EnhancedInput, SearchInput } from './EnhancedInput';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushwoosh/dumb-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.30",
|
|
4
4
|
"description": "React components to build Pushwoosh products",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@pushwoosh/frontend-builder-engine": "^1.0.16",
|
|
24
|
-
"@pushwoosh/kit-constants": "^1.6.
|
|
24
|
+
"@pushwoosh/kit-constants": "^1.6.8",
|
|
25
25
|
"@svgr/webpack": "^8.1.0",
|
|
26
26
|
"@types/lodash": "^4.17.13",
|
|
27
27
|
"@types/react": "^18.2.69",
|
|
@@ -35,11 +35,17 @@
|
|
|
35
35
|
"styled-components": "^5.3.11"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
+
"@codemirror/lang-html": "^6.4.9",
|
|
39
|
+
"@codemirror/lang-json": "^6.0.1",
|
|
40
|
+
"@codemirror/lang-liquid": "^6.2.2",
|
|
38
41
|
"@floating-ui/react-dom": "^2.1.2",
|
|
42
|
+
"@lezer/highlight": "^1.2.1",
|
|
39
43
|
"@pushwoosh/kit-helpers": "^4.6.2",
|
|
40
44
|
"@pushwoosh/kit-icons": "^2.1.1",
|
|
41
45
|
"@pushwoosh/kit-typography": "^1.7.1",
|
|
42
46
|
"@tippyjs/react": "^4.2.6",
|
|
47
|
+
"@uiw/codemirror-themes": "^4.23.8",
|
|
48
|
+
"@uiw/react-codemirror": "^4.23.8",
|
|
43
49
|
"liquidjs": "^10.18.0",
|
|
44
50
|
"lodash": "^4.17.21",
|
|
45
51
|
"polished": "^4.3.1",
|