proje-react-panel 1.8.0 → 1.10.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.
Files changed (40) hide show
  1. package/README.md +1 -0
  2. package/dist/__tests__/components/form/FormGroups.test.d.ts +1 -0
  3. package/dist/__tests__/components/form/RichTextField.test.d.ts +4 -0
  4. package/dist/__tests__/components/list/CellField.test.d.ts +1 -0
  5. package/dist/__tests__/optionalTiptap.test.d.ts +4 -0
  6. package/dist/components/form/RichTextField.d.ts +7 -0
  7. package/dist/decorators/form/Form.d.ts +8 -0
  8. package/dist/decorators/form/Input.d.ts +5 -1
  9. package/dist/decorators/form/inputs/RichTextInput.d.ts +13 -0
  10. package/dist/decorators/list/Cell.d.ts +9 -0
  11. package/dist/index.cjs.js +1 -1
  12. package/dist/index.d.ts +2 -1
  13. package/dist/index.esm.js +2 -2
  14. package/how_to.md +150 -32
  15. package/jest.config.js +1 -0
  16. package/package.json +13 -1
  17. package/src/__tests__/components/form/FormGroups.test.tsx +194 -0
  18. package/src/__tests__/components/form/RichTextField.test.tsx +181 -0
  19. package/src/__tests__/components/list/CellField.test.tsx +67 -0
  20. package/src/__tests__/optionalTiptap.test.tsx +89 -0
  21. package/src/components/form/FormField.tsx +8 -1
  22. package/src/components/form/InnerForm.tsx +101 -19
  23. package/src/components/form/RichTextField.tsx +218 -0
  24. package/src/components/list/CellField.tsx +24 -0
  25. package/src/components/list/Datagrid.tsx +11 -2
  26. package/src/components/list/cells/ImageCell.tsx +4 -1
  27. package/src/decorators/form/Form.ts +11 -0
  28. package/src/decorators/form/Input.ts +6 -1
  29. package/src/decorators/form/inputs/RichTextInput.ts +38 -0
  30. package/src/decorators/list/Cell.ts +9 -0
  31. package/src/index.ts +8 -1
  32. package/src/styles/components/rich-text.scss +115 -0
  33. package/src/styles/form.scss +48 -0
  34. package/src/styles/index.scss +1 -0
  35. package/src/styles/list.scss +19 -1
  36. package/dist/components/DashboardContainer.d.ts +0 -7
  37. package/dist/components/DashboardGrid.d.ts +0 -9
  38. package/dist/components/DashboardItem.d.ts +0 -10
  39. package/dist/components/ThemeSwitcher.d.ts +0 -7
  40. package/dist/store/themeStore.d.ts +0 -23
@@ -8,7 +8,7 @@ const isFieldSensitive = (fieldName: string): boolean => {
8
8
  };
9
9
 
10
10
  export type InputTypes = 'input' | 'textarea' | 'file-upload' | 'checkbox' | 'hidden' | 'nested';
11
- export type ExtendedInputTypes = InputTypes | 'select' | 'custom';
11
+ export type ExtendedInputTypes = InputTypes | 'select' | 'custom' | 'richtext';
12
12
 
13
13
  export interface InputOptions {
14
14
  type?: InputTypes;
@@ -19,6 +19,9 @@ export interface InputOptions {
19
19
  defaultValue?: string;
20
20
  includeInCSV?: boolean;
21
21
  includeInJSON?: boolean;
22
+ //NOTE: the visual section this field belongs to, matched against @Form({ groups }) by key.
23
+ group?: string;
24
+ rows?: number;
22
25
  }
23
26
 
24
27
  export interface ExtendedInputOptions extends Omit<InputOptions, 'type'> {
@@ -36,6 +39,8 @@ export interface InputConfiguration {
36
39
  defaultValue?: string;
37
40
  includeInCSV: boolean;
38
41
  includeInJSON: boolean;
42
+ group?: string;
43
+ rows?: number;
39
44
  }
40
45
 
41
46
  export function Input(options?: InputOptions): PropertyDecorator {
@@ -0,0 +1,38 @@
1
+ import { ExtendedInput, ExtendedInputOptions, InputConfiguration, InputOptions } from '../Input';
2
+
3
+ export type RichTextToolbarItem =
4
+ | 'bold'
5
+ | 'italic'
6
+ | 'heading'
7
+ | 'bulletList'
8
+ | 'orderedList'
9
+ | 'link';
10
+
11
+ export const DEFAULT_RICH_TEXT_TOOLBAR: RichTextToolbarItem[] = [
12
+ 'bold',
13
+ 'italic',
14
+ 'heading',
15
+ 'bulletList',
16
+ 'orderedList',
17
+ 'link',
18
+ ];
19
+
20
+ export interface RichTextInputOptions extends InputOptions {
21
+ toolbar?: RichTextToolbarItem[];
22
+ minHeight?: number;
23
+ }
24
+
25
+ export interface RichTextInputConfiguration extends InputConfiguration {
26
+ type: 'richtext';
27
+ toolbar?: RichTextToolbarItem[];
28
+ minHeight?: number;
29
+ }
30
+
31
+ //NOTE: the editor itself lives behind a lazy import in FormField, because @tiptap/* is an
32
+ // optional peer dependency — this decorator is safe to import without it installed.
33
+ export function RichTextInput(options?: RichTextInputOptions): PropertyDecorator {
34
+ return ExtendedInput({
35
+ ...options,
36
+ type: 'richtext',
37
+ } as ExtendedInputOptions);
38
+ }
@@ -23,7 +23,16 @@ export interface CellOptions {
23
23
  placeHolder?: string;
24
24
  filter?: Filter | StaticSelectFilter;
25
25
  style?: {
26
+ /**
27
+ * @deprecated Tablo `table-layout: fixed` kullaniyor; sabit duzende hucre
28
+ * `min-width`'i kolon genisligini etkilemiyor (CSS 2.1 17.5.2.1). Bunun
29
+ * yerine `width` verin.
30
+ */
26
31
  minWidth?: string;
32
+ /**
33
+ * Kolon genisligi. Sabit duzende birebir uygulanir; yuzde vermek tabloyu
34
+ * konteynere sigdirir, px vermek toplam konteyneri asarsa yatay scroll acar.
35
+ */
27
36
  width?: string;
28
37
  };
29
38
  }
package/src/index.ts CHANGED
@@ -18,9 +18,16 @@ export { LinkCell } from './decorators/list/cells/LinkCell';
18
18
 
19
19
  //FORM
20
20
  export { FormPage } from './components/form/FormPage';
21
- export { Form, type OnSubmitFN } from './decorators/form/Form';
21
+ export { Form, type OnSubmitFN, type FormGroup } from './decorators/form/Form';
22
22
  export { Input } from './decorators/form/Input';
23
23
  export { SelectInput } from './decorators/form/inputs/SelectInput';
24
+ export {
25
+ RichTextInput,
26
+ DEFAULT_RICH_TEXT_TOOLBAR,
27
+ type RichTextInputOptions,
28
+ type RichTextInputConfiguration,
29
+ type RichTextToolbarItem,
30
+ } from './decorators/form/inputs/RichTextInput';
24
31
  export {
25
32
  CustomInput,
26
33
  type CustomInputOptions,
@@ -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
+ }
@@ -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;
@@ -12,6 +12,7 @@
12
12
  @import './components/uploader.scss';
13
13
  @import './components/checkbox';
14
14
  @import './components/form-header';
15
+ @import './components/rich-text';
15
16
  @import './components/button';
16
17
  @import './details';
17
18
  @import './dashboard';
@@ -86,8 +86,17 @@ $datagrid-height: calc(100vh - #{$header-height} - #{$footer-height});
86
86
  @include custom-scrollbar;
87
87
  }
88
88
 
89
+ // `width` sart: `table-layout: fixed`, genislik `auto` kaldigi surece devreye
90
+ // girmiyor (CSS 2.1 17.5.2.1) ve tarayici otomatik duzene doner. Burada eskiden
91
+ // sadece `min-width: 100%` vardi, yani sabit duzen hic calismiyordu: nowrap
92
+ // hucreler kolonu icerik kadar sisiriyor, tablo konteyneri asiyor ve uzun
93
+ // metin tasiyan her liste yatay scroll aciyordu.
94
+ //
95
+ // Kolonlarina px genislik veren tuketiciler genis tabloyu kaybetmiyor: sabit
96
+ // duzende kullanilan tablo genisligi, belirtilen kolon genisliklerinin toplami
97
+ // ile bu %100 degerinin buyugudur.
89
98
  .datagrid-table {
90
- min-width: 100%;
99
+ width: 100%;
91
100
  table-layout: fixed;
92
101
  border-collapse: collapse;
93
102
  position: relative;
@@ -97,10 +106,19 @@ $datagrid-height: calc(100vh - #{$header-height} - #{$footer-height});
97
106
  padding: 12px 16px;
98
107
  text-align: left;
99
108
  border-bottom: 1px solid var(--prp-border-primary);
109
+ // `text-overflow` yalnizca tasma kirpildiginda is goruyor; `overflow`
110
+ // olmadan ellipsis hicbir zaman cizilmiyordu.
111
+ overflow: hidden;
100
112
  text-overflow: ellipsis;
101
113
  white-space: nowrap;
102
114
  }
103
115
 
116
+ // Actions hucresindeki acilir liste `position: absolute`; kirpilirsa menu
117
+ // gorunmez oluyor. Kirpma sadece metin kolonlari icin gerekli.
118
+ .util-cell-actions-cell {
119
+ overflow: visible;
120
+ }
121
+
104
122
  th {
105
123
  color: var(--prp-text-primary);
106
124
  background-color: var(--prp-bg-tertiary);
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- interface DashboardContainerProps {
3
- children: React.ReactNode;
4
- className?: string;
5
- }
6
- export declare function DashboardContainer({ children, className }: DashboardContainerProps): React.JSX.Element;
7
- export {};
@@ -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,7 +0,0 @@
1
- import React from 'react';
2
- interface ThemeSwitcherProps {
3
- variant?: 'button' | 'dropdown';
4
- className?: string;
5
- }
6
- export declare function ThemeSwitcher({ variant, className }: ThemeSwitcherProps): React.JSX.Element;
7
- 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 {};