proje-react-panel 1.8.0 → 1.9.0
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/README.md +1 -0
- package/dist/__tests__/components/form/FormGroups.test.d.ts +1 -0
- package/dist/__tests__/components/form/RichTextField.test.d.ts +4 -0
- package/dist/__tests__/optionalTiptap.test.d.ts +4 -0
- package/dist/components/form/RichTextField.d.ts +7 -0
- package/dist/decorators/form/Form.d.ts +8 -0
- package/dist/decorators/form/Input.d.ts +5 -1
- package/dist/decorators/form/inputs/RichTextInput.d.ts +13 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +2 -2
- package/how_to.md +150 -32
- package/jest.config.js +1 -0
- package/package.json +13 -1
- package/src/__tests__/components/form/FormGroups.test.tsx +194 -0
- package/src/__tests__/components/form/RichTextField.test.tsx +181 -0
- package/src/__tests__/optionalTiptap.test.tsx +89 -0
- package/src/components/form/FormField.tsx +8 -1
- package/src/components/form/InnerForm.tsx +101 -19
- package/src/components/form/RichTextField.tsx +218 -0
- package/src/decorators/form/Form.ts +11 -0
- package/src/decorators/form/Input.ts +6 -1
- package/src/decorators/form/inputs/RichTextInput.ts +38 -0
- package/src/index.ts +8 -1
- package/src/styles/components/rich-text.scss +115 -0
- package/src/styles/form.scss +48 -0
- package/src/styles/index.scss +1 -0
- package/dist/components/DashboardContainer.d.ts +0 -7
- package/dist/components/DashboardGrid.d.ts +0 -9
- package/dist/components/DashboardItem.d.ts +0 -10
- package/dist/components/ThemeSwitcher.d.ts +0 -7
- package/dist/store/themeStore.d.ts +0 -23
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Colors mirror the react-select control (see SelectStyles.ts) so a richtext field and a
|
|
2
|
+
// select field sitting next to each other in the same form read as the same widget family.
|
|
3
|
+
$rich-text-surface: #1f2937;
|
|
4
|
+
$rich-text-border: #374151;
|
|
5
|
+
$rich-text-accent: #6366f1;
|
|
6
|
+
$rich-text-muted: #9ca3af;
|
|
7
|
+
|
|
8
|
+
.rich-text-field {
|
|
9
|
+
border: 1px solid $rich-text-border;
|
|
10
|
+
border-radius: 6px;
|
|
11
|
+
background-color: $rich-text-surface;
|
|
12
|
+
color: #ffffff;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
|
|
15
|
+
&:focus-within {
|
|
16
|
+
border-color: $rich-text-accent;
|
|
17
|
+
box-shadow: 0 0 0 1px $rich-text-accent;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.rich-text-toolbar {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-wrap: wrap;
|
|
23
|
+
gap: 4px;
|
|
24
|
+
padding: 6px;
|
|
25
|
+
border-bottom: 1px solid $rich-text-border;
|
|
26
|
+
background-color: $rich-text-surface;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.rich-text-toolbar-button {
|
|
30
|
+
min-width: 32px;
|
|
31
|
+
height: 28px;
|
|
32
|
+
padding: 0 8px;
|
|
33
|
+
font-size: 14px;
|
|
34
|
+
line-height: 1;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
color: #ffffff;
|
|
37
|
+
background-color: transparent;
|
|
38
|
+
border: 1px solid transparent;
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
transition:
|
|
41
|
+
background-color 0.2s,
|
|
42
|
+
border-color 0.2s;
|
|
43
|
+
|
|
44
|
+
&:hover:not(:disabled) {
|
|
45
|
+
background-color: $rich-text-border;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.is-active {
|
|
49
|
+
background-color: $rich-text-accent;
|
|
50
|
+
border-color: $rich-text-accent;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&:disabled {
|
|
54
|
+
opacity: 0.5;
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.rich-text-content {
|
|
60
|
+
position: relative;
|
|
61
|
+
padding: 10px;
|
|
62
|
+
font-size: 16px;
|
|
63
|
+
|
|
64
|
+
// The placeholder is CSS-only on purpose: @tiptap/extension-placeholder would be a third
|
|
65
|
+
// package for consumers to install, for one line of grey text.
|
|
66
|
+
&.is-empty::before {
|
|
67
|
+
content: attr(data-placeholder);
|
|
68
|
+
position: absolute;
|
|
69
|
+
top: 10px;
|
|
70
|
+
left: 10px;
|
|
71
|
+
color: $rich-text-muted;
|
|
72
|
+
pointer-events: none;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.ProseMirror {
|
|
76
|
+
outline: none;
|
|
77
|
+
min-height: inherit;
|
|
78
|
+
|
|
79
|
+
> * + * {
|
|
80
|
+
margin-top: 0.6em;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
p,
|
|
84
|
+
h1,
|
|
85
|
+
h2,
|
|
86
|
+
h3 {
|
|
87
|
+
margin: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
ul,
|
|
91
|
+
ol {
|
|
92
|
+
padding-left: 1.4em;
|
|
93
|
+
margin: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
a {
|
|
97
|
+
color: $rich-text-accent;
|
|
98
|
+
text-decoration: underline;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.rich-text-loading,
|
|
105
|
+
.rich-text-missing {
|
|
106
|
+
padding: 10px;
|
|
107
|
+
border: 1px dashed $rich-text-border;
|
|
108
|
+
border-radius: 6px;
|
|
109
|
+
color: $rich-text-muted;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.rich-text-missing {
|
|
113
|
+
color: var(--prp-color-error);
|
|
114
|
+
border-color: var(--prp-color-error);
|
|
115
|
+
}
|
package/src/styles/form.scss
CHANGED
|
@@ -90,6 +90,54 @@
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
.form-group-section {
|
|
94
|
+
border: 1px solid var(--prp-border-primary);
|
|
95
|
+
border-radius: 6px;
|
|
96
|
+
background-color: var(--prp-bg-secondary);
|
|
97
|
+
padding: 16px;
|
|
98
|
+
margin: 0 0 20px 0;
|
|
99
|
+
min-width: 0;
|
|
100
|
+
|
|
101
|
+
.form-group-legend,
|
|
102
|
+
.form-group-summary {
|
|
103
|
+
font-weight: bold;
|
|
104
|
+
font-size: 15px;
|
|
105
|
+
color: var(--prp-text-primary);
|
|
106
|
+
padding: 0 6px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.form-group-summary {
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
list-style: none;
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
gap: 6px;
|
|
115
|
+
padding: 0;
|
|
116
|
+
|
|
117
|
+
&::-webkit-details-marker {
|
|
118
|
+
display: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&:before {
|
|
122
|
+
content: '▾';
|
|
123
|
+
color: var(--prp-text-muted);
|
|
124
|
+
transition: transform 0.2s;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
details:not([open]) > .form-group-summary:before {
|
|
129
|
+
transform: rotate(-90deg);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.form-group-fields {
|
|
133
|
+
margin-top: 12px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.form-field:last-child {
|
|
137
|
+
margin-bottom: 0;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
93
141
|
.submit-button {
|
|
94
142
|
padding: 12px;
|
|
95
143
|
font-size: 18px;
|
package/src/styles/index.scss
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface DashboardGridProps {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
columns?: number;
|
|
5
|
-
gap?: string;
|
|
6
|
-
className?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function DashboardGrid({ children, columns, gap, className, }: DashboardGridProps): React.JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface DashboardItemProps {
|
|
3
|
-
targetNumber: number;
|
|
4
|
-
duration?: number;
|
|
5
|
-
image: React.ReactNode;
|
|
6
|
-
text: string;
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function DashboardItem({ targetNumber, duration, image, text, className, }: DashboardItemProps): React.JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type ThemeMode = 'light' | 'dark' | 'automatic';
|
|
2
|
-
interface ThemeState {
|
|
3
|
-
theme: ThemeMode;
|
|
4
|
-
resolvedTheme: 'light' | 'dark';
|
|
5
|
-
setTheme: (theme: ThemeMode) => void;
|
|
6
|
-
initializeTheme: () => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const useThemeStore: import("zustand/traditional").UseBoundStoreWithEqualityFn<Omit<import("zustand/vanilla").StoreApi<ThemeState>, "persist"> & {
|
|
9
|
-
persist: {
|
|
10
|
-
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<ThemeState, unknown>>) => void;
|
|
11
|
-
clearStorage: () => void;
|
|
12
|
-
rehydrate: () => Promise<void> | void;
|
|
13
|
-
hasHydrated: () => boolean;
|
|
14
|
-
onHydrate: (fn: (state: ThemeState) => void) => () => void;
|
|
15
|
-
onFinishHydration: (fn: (state: ThemeState) => void) => () => void;
|
|
16
|
-
getOptions: () => Partial<import("zustand/middleware").PersistOptions<ThemeState, unknown>>;
|
|
17
|
-
};
|
|
18
|
-
}>;
|
|
19
|
-
export declare const getTheme: () => ThemeMode;
|
|
20
|
-
export declare const getResolvedTheme: () => "light" | "dark";
|
|
21
|
-
export declare const setTheme: (theme: ThemeMode) => void;
|
|
22
|
-
export declare const initializeTheme: () => void;
|
|
23
|
-
export {};
|