@_linked/shape-ui 2.0.0 → 2.2.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 (210) hide show
  1. package/lib/esm/columns.d.ts +58 -0
  2. package/lib/esm/columns.js +173 -0
  3. package/lib/esm/columns.js.map +1 -0
  4. package/lib/esm/components/AddInstanceForms.d.ts +38 -0
  5. package/lib/esm/components/AddInstanceForms.js +143 -0
  6. package/lib/esm/components/AddInstanceForms.js.map +1 -0
  7. package/lib/esm/components/AddInstanceForms.module.css +12 -0
  8. package/lib/esm/components/BatchEditDrawer.d.ts +13 -0
  9. package/lib/esm/components/BatchEditDrawer.js +122 -0
  10. package/lib/esm/components/BatchEditDrawer.js.map +1 -0
  11. package/lib/esm/components/BatchEditDrawer.module.css +193 -0
  12. package/lib/esm/components/CustomMultiSelect.d.ts +26 -0
  13. package/lib/esm/components/CustomMultiSelect.js +344 -0
  14. package/lib/esm/components/CustomMultiSelect.js.map +1 -0
  15. package/lib/esm/components/CustomMultiSelect.module.css +291 -0
  16. package/lib/esm/components/DynamicFormField.d.ts +21 -0
  17. package/lib/esm/components/DynamicFormField.js +149 -0
  18. package/lib/esm/components/DynamicFormField.js.map +1 -0
  19. package/lib/esm/components/DynamicFormField.module.css +169 -0
  20. package/lib/esm/components/EditInstanceForms.d.ts +15 -0
  21. package/lib/esm/components/EditInstanceForms.js +118 -0
  22. package/lib/esm/components/EditInstanceForms.js.map +1 -0
  23. package/lib/esm/components/FilterBadge.d.ts +20 -0
  24. package/lib/esm/components/FilterBadge.js +26 -0
  25. package/lib/esm/components/FilterBadge.js.map +1 -0
  26. package/lib/esm/components/FilterBadge.module.css +25 -0
  27. package/lib/esm/components/FormField.d.ts +18 -0
  28. package/lib/esm/components/FormField.js +9 -0
  29. package/lib/esm/components/FormField.js.map +1 -0
  30. package/lib/esm/components/FormField.module.css +57 -0
  31. package/lib/esm/components/InstanceDeletionDialog.d.ts +17 -0
  32. package/lib/esm/components/InstanceDeletionDialog.js +83 -0
  33. package/lib/esm/components/InstanceDeletionDialog.js.map +1 -0
  34. package/lib/esm/components/InstanceDeletionDialog.module.css +59 -0
  35. package/lib/esm/components/InstanceOverview.d.ts +37 -0
  36. package/lib/esm/components/InstanceOverview.js +233 -0
  37. package/lib/esm/components/InstanceOverview.js.map +1 -0
  38. package/lib/esm/components/InstanceOverview.module.css +35 -0
  39. package/lib/esm/components/InstanceView.d.ts +29 -0
  40. package/lib/esm/components/InstanceView.js +97 -0
  41. package/lib/esm/components/InstanceView.js.map +1 -0
  42. package/lib/esm/components/InstanceView.module.css +157 -0
  43. package/lib/esm/components/NodeBadge.d.ts +25 -0
  44. package/lib/esm/components/NodeBadge.js +29 -0
  45. package/lib/esm/components/NodeBadge.js.map +1 -0
  46. package/lib/esm/components/NodeValuesEditor.d.ts +15 -0
  47. package/lib/esm/components/NodeValuesEditor.js +29 -0
  48. package/lib/esm/components/NodeValuesEditor.js.map +1 -0
  49. package/lib/esm/components/NodeValuesEditor.module.css +4 -0
  50. package/lib/esm/components/ReactTable.d.ts +50 -0
  51. package/lib/esm/components/ReactTable.js +370 -0
  52. package/lib/esm/components/ReactTable.js.map +1 -0
  53. package/lib/esm/components/ReactTable.module.css +950 -0
  54. package/lib/esm/components/TextfieldEditor.d.ts +1 -2
  55. package/lib/esm/components/TextfieldEditor.js +2 -2
  56. package/lib/esm/components/TextfieldEditor.js.map +1 -1
  57. package/lib/esm/components/forms.module.css +96 -0
  58. package/lib/esm/host.d.ts +196 -0
  59. package/lib/esm/host.js +25 -0
  60. package/lib/esm/host.js.map +1 -0
  61. package/lib/esm/hostContext.d.ts +34 -0
  62. package/lib/esm/hostContext.js +95 -0
  63. package/lib/esm/hostContext.js.map +1 -0
  64. package/lib/esm/index.d.ts +64 -10
  65. package/lib/esm/index.js +63 -14
  66. package/lib/esm/index.js.map +1 -1
  67. package/lib/esm/read.d.ts +48 -0
  68. package/lib/esm/read.js +96 -0
  69. package/lib/esm/read.js.map +1 -0
  70. package/lib/esm/search.d.ts +32 -0
  71. package/lib/esm/search.js +87 -0
  72. package/lib/esm/search.js.map +1 -0
  73. package/lib/esm/shape/contracts.d.ts +58 -0
  74. package/lib/esm/shape/contracts.js +15 -0
  75. package/lib/esm/shape/contracts.js.map +1 -0
  76. package/lib/esm/shape/naming.d.ts +30 -0
  77. package/lib/esm/shape/naming.js +52 -0
  78. package/lib/esm/shape/naming.js.map +1 -0
  79. package/lib/esm/shape/nodeDisplay.d.ts +36 -0
  80. package/lib/esm/shape/nodeDisplay.js +117 -0
  81. package/lib/esm/shape/nodeDisplay.js.map +1 -0
  82. package/lib/esm/shape/propertyTypes.d.ts +12 -0
  83. package/lib/esm/shape/propertyTypes.js +60 -0
  84. package/lib/esm/shape/propertyTypes.js.map +1 -0
  85. package/lib/esm/shape/propertyVisibility.d.ts +56 -0
  86. package/lib/esm/shape/propertyVisibility.js +112 -0
  87. package/lib/esm/shape/propertyVisibility.js.map +1 -0
  88. package/lib/esm/shape/shapeDependencies.d.ts +41 -0
  89. package/lib/esm/shape/shapeDependencies.js +141 -0
  90. package/lib/esm/shape/shapeDependencies.js.map +1 -0
  91. package/lib/esm/shape/tableFilters.d.ts +35 -0
  92. package/lib/esm/shape/tableFilters.js +171 -0
  93. package/lib/esm/shape/tableFilters.js.map +1 -0
  94. package/lib/esm/shape/useFormDependencies.d.ts +38 -0
  95. package/lib/esm/shape/useFormDependencies.js +178 -0
  96. package/lib/esm/shape/useFormDependencies.js.map +1 -0
  97. package/lib/esm/shape/validation.d.ts +15 -0
  98. package/lib/esm/shape/validation.js +106 -0
  99. package/lib/esm/shape/validation.js.map +1 -0
  100. package/lib/esm/tokens.css +25 -0
  101. package/lib/esm/types.d.ts +22 -0
  102. package/lib/esm/types.js +1 -0
  103. package/lib/esm/types.js.map +1 -0
  104. package/lib/esm/write.d.ts +51 -0
  105. package/lib/esm/write.js +99 -0
  106. package/lib/esm/write.js.map +1 -0
  107. package/package.json +44 -18
  108. package/src/backend.ts +1 -0
  109. package/src/columns.regression.test.ts +143 -0
  110. package/src/columns.test.ts +200 -0
  111. package/src/columns.ts +228 -0
  112. package/src/components/AddInstanceForms.module.css +12 -0
  113. package/src/components/AddInstanceForms.tsx +321 -0
  114. package/src/components/AvatarEditor.tsx +34 -0
  115. package/src/components/BatchEditDrawer.module.css +193 -0
  116. package/src/components/BatchEditDrawer.tsx +295 -0
  117. package/src/components/CheckboxEditor.module.css +6 -0
  118. package/src/components/CheckboxEditor.tsx +86 -0
  119. package/src/components/CustomMultiSelect.module.css +291 -0
  120. package/src/components/CustomMultiSelect.tsx +527 -0
  121. package/src/components/DateEditor.tsx +50 -0
  122. package/src/components/DynamicFormField.module.css +169 -0
  123. package/src/components/DynamicFormField.tsx +357 -0
  124. package/src/components/EditInstanceForms.tsx +260 -0
  125. package/src/components/FilterBadge.module.css +25 -0
  126. package/src/components/FilterBadge.tsx +70 -0
  127. package/src/components/FormField.module.css +57 -0
  128. package/src/components/FormField.tsx +59 -0
  129. package/src/components/ImageValueEditor.module.css +3 -0
  130. package/src/components/ImageValueEditor.tsx +82 -0
  131. package/src/components/InstanceDeletionDialog.module.css +59 -0
  132. package/src/components/InstanceDeletionDialog.tsx +175 -0
  133. package/src/components/InstanceOverview.module.css +35 -0
  134. package/src/components/InstanceOverview.tsx +374 -0
  135. package/src/components/InstanceView.module.css +157 -0
  136. package/src/components/InstanceView.tsx +212 -0
  137. package/src/components/NodeBadge.tsx +60 -0
  138. package/src/components/NodeValuesEditor.module.css +4 -0
  139. package/src/components/NodeValuesEditor.tsx +64 -0
  140. package/src/components/RadioButtonEditor.module.css +22 -0
  141. package/src/components/RadioButtonEditor.tsx +96 -0
  142. package/src/components/ReactTable.module.css +950 -0
  143. package/src/components/ReactTable.tsx +991 -0
  144. package/src/components/SelectEditor.tsx +85 -0
  145. package/src/components/ShapeTable.module.css +394 -0
  146. package/src/components/SwitchEditor.tsx +60 -0
  147. package/src/components/TextareaEditor.tsx +55 -0
  148. package/src/components/TextfieldEditor.tsx +67 -0
  149. package/src/components/ToggleEditor.tsx +63 -0
  150. package/src/components/forms.module.css +96 -0
  151. package/src/host.ts +226 -0
  152. package/src/hostContext.tsx +114 -0
  153. package/src/index.ts +99 -0
  154. package/src/package.ts +21 -0
  155. package/src/read.ts +148 -0
  156. package/src/search.test.ts +174 -0
  157. package/src/search.ts +108 -0
  158. package/src/shape/contracts.ts +66 -0
  159. package/src/shape/naming.ts +52 -0
  160. package/src/shape/nodeDisplay.ts +114 -0
  161. package/src/shape/propertyTypes.ts +86 -0
  162. package/src/shape/propertyVisibility.ts +180 -0
  163. package/src/shape/shapeDependencies.ts +183 -0
  164. package/src/shape/tableFilters.ts +223 -0
  165. package/src/shape/types.ts +1158 -0
  166. package/src/shape/useFormDependencies.ts +257 -0
  167. package/src/shape/validation.ts +121 -0
  168. package/src/tokens.css +25 -0
  169. package/src/types.ts +20 -0
  170. package/src/utils/helper.ts +35 -0
  171. package/src/write.test.ts +174 -0
  172. package/src/write.ts +114 -0
  173. package/.changeset/README.md +0 -20
  174. package/.changeset/config.json +0 -14
  175. package/.github/workflows/changeset-check.yml +0 -44
  176. package/.github/workflows/ci.yml +0 -43
  177. package/.github/workflows/publish.yml +0 -158
  178. package/CHANGELOG.md +0 -30
  179. package/lib/esm/components/AvatarEditor.d.ts +0 -20
  180. package/lib/esm/components/AvatarEditor.js +0 -7
  181. package/lib/esm/components/AvatarEditor.js.map +0 -1
  182. package/lib/esm/components/CheckboxEditor.d.ts +0 -21
  183. package/lib/esm/components/CheckboxEditor.js +0 -44
  184. package/lib/esm/components/CheckboxEditor.js.map +0 -1
  185. package/lib/esm/components/DateEditor.d.ts +0 -20
  186. package/lib/esm/components/DateEditor.js +0 -22
  187. package/lib/esm/components/DateEditor.js.map +0 -1
  188. package/lib/esm/components/RadioButtonEditor.d.ts +0 -23
  189. package/lib/esm/components/RadioButtonEditor.js +0 -41
  190. package/lib/esm/components/RadioButtonEditor.js.map +0 -1
  191. package/lib/esm/components/SelectEditor.d.ts +0 -21
  192. package/lib/esm/components/SelectEditor.js +0 -30
  193. package/lib/esm/components/SelectEditor.js.map +0 -1
  194. package/lib/esm/components/SwitchEditor.d.ts +0 -21
  195. package/lib/esm/components/SwitchEditor.js +0 -23
  196. package/lib/esm/components/SwitchEditor.js.map +0 -1
  197. package/lib/esm/components/TextareaEditor.d.ts +0 -23
  198. package/lib/esm/components/TextareaEditor.js +0 -15
  199. package/lib/esm/components/TextareaEditor.js.map +0 -1
  200. package/lib/esm/components/ToggleEditor.d.ts +0 -22
  201. package/lib/esm/components/ToggleEditor.js +0 -23
  202. package/lib/esm/components/ToggleEditor.js.map +0 -1
  203. package/lib/esm/ontologies/lincd-ui.d.ts +0 -6
  204. package/lib/esm/ontologies/lincd-ui.js +0 -18
  205. package/lib/esm/ontologies/lincd-ui.js.map +0 -1
  206. package/lib/esm/package.d.ts +0 -3
  207. package/lib/esm/package.js +0 -4
  208. package/lib/esm/package.js.map +0 -1
  209. package/tsconfig-cjs.json +0 -8
  210. package/tsconfig-esm.json +0 -9
@@ -0,0 +1,85 @@
1
+ import React, { useState } from 'react';
2
+ import type { PropertyShapeWire } from '@_linked/core/shapes/nodeShapeWire';
3
+ import {
4
+ Root,
5
+ Group,
6
+ Value,
7
+ Trigger,
8
+ Content,
9
+ Label,
10
+ Item,
11
+ Separator,
12
+ ScrollUpButton,
13
+ ScrollDownButton,
14
+ } from '@_linked/primitives/components/Select';
15
+
16
+ export interface SelectEditorProps {
17
+ onValueChange?: (e) => void;
18
+ of?: Record<string, any>;
19
+ property?: PropertyShapeWire;
20
+ /**
21
+ * Converts the value returned by the shape, to the input string for the select
22
+ * @param shapePropertyValue
23
+ * @returns
24
+ */
25
+ preConvertValueFn?: (shapePropertyValue: any) => string;
26
+ /**
27
+ * Converts the value of the select to a value that can be provided to the set method of the shape
28
+ * @param inputValue
29
+ * @returns
30
+ */
31
+ postConvertValueFn?: (inputValue: string) => any;
32
+ }
33
+
34
+ // interface RootSelectProps extend {
35
+ // of?: Record<string, any>;
36
+ // property?: PropertyShapeWire;
37
+ // }
38
+ // const RootSelect = () => {
39
+ // return <Root></Root>;
40
+ // };
41
+
42
+ export const SelectEditor = ({
43
+ onValueChange,
44
+ of,
45
+ property,
46
+ preConvertValueFn,
47
+ postConvertValueFn,
48
+ ...restProps
49
+ }: SelectEditorProps) => {
50
+ const onChangeHandler = (value) => {
51
+ console.log(value, 'value select');
52
+ if (!of) return;
53
+ if (postConvertValueFn) {
54
+ value = postConvertValueFn(value);
55
+ }
56
+ of[property.label] = value;
57
+ console.log(of[property.label], 'of[property.label] switch');
58
+
59
+ if (onValueChange) {
60
+ onValueChange(value);
61
+ }
62
+ };
63
+
64
+ return (
65
+ <Root
66
+ value={of[property.label]}
67
+ onValueChange={onChangeHandler}
68
+ defaultValue={
69
+ of
70
+ ? preConvertValueFn
71
+ ? preConvertValueFn(of[property.label])
72
+ : of[property.label]
73
+ : ''
74
+ }
75
+ {...restProps}
76
+ >
77
+ {/* <Trigger className="SelectTrigger" aria-label="Food">
78
+ <Select.Value placeholder="Select a fruit…" />
79
+ <Select.Icon className="SelectIcon">
80
+ <ChevronDownIcon />
81
+ </Select.Icon>
82
+ </Trigger> */}
83
+ </Root>
84
+ );
85
+ };
@@ -0,0 +1,394 @@
1
+ .action {
2
+ display: flex;
3
+ justify-content: flex-start;
4
+ gap: 10px;
5
+ margin: 20px 0;
6
+ }
7
+
8
+ .filterButton {
9
+ justify-content: flex-start !important;
10
+ width: fit-content !important;
11
+ }
12
+
13
+ .tableWrapper {
14
+ display: flex;
15
+ flex-direction: column;
16
+
17
+ .deleteDataButton {
18
+ display: flex;
19
+ justify-content: center;
20
+ align-items: center;
21
+ gap: 3px;
22
+ width: auto;
23
+ border-radius: 0;
24
+ padding: none;
25
+ --ld-button-filled-primary-background-color: #eb3223;
26
+ --ld-button-filled-primary-hover-background-color: #eb3223;
27
+ --ld-button-filled-primary-border-color: none;
28
+ --ld-button-filled-primary-font-color: rgb(255, 255, 255);
29
+ }
30
+
31
+ .tableBar {
32
+ display: flex;
33
+ align-items: center;
34
+ justify-content: space-between;
35
+ gap: 10px;
36
+ border-top: 1px solid #d6d6d6;
37
+ border-bottom: 1px solid #d6d6d6;
38
+ padding: 15px 0;
39
+ /* height: 200px;*/
40
+
41
+ .filterBar {
42
+ display: flex;
43
+ gap: 10px;
44
+ align-items: center;
45
+ width: 85%;
46
+ height: 100%;
47
+ /* flex: 1;*/
48
+ }
49
+ }
50
+ }
51
+
52
+ .actionTableButton {
53
+ --ld-button-filled-primary-background-color: transparent;
54
+ --ld-button-filled-primary-hover-background-color: transparent;
55
+ --ld-button-filled-primary-border-color: none;
56
+ --ld-button-filled-primary-font-color: black;
57
+ }
58
+
59
+ .pagination {
60
+ display: flex;
61
+ justify-content: flex-end;
62
+ align-items: center;
63
+ gap: 15px;
64
+ margin: 10px 0;
65
+
66
+ .pageInfo {
67
+ display: flex;
68
+ align-items: center;
69
+ justify-content: flex-end;
70
+ gap: 5px;
71
+
72
+ .goToPageForm {
73
+ box-shadow: none;
74
+ width: 80px;
75
+ border: 1px solid var(--ld-input-placeholder);
76
+ --ld-input-border-radius: 5px;
77
+ }
78
+ }
79
+
80
+ .selectPageRows {
81
+ position: relative;
82
+ width: 120px; /* Adjust width as needed */
83
+ padding: 11px 10px;
84
+ border-radius: 5px;
85
+ appearance: none; /* Remove default arrow appearance */
86
+ -webkit-appearance: none; /* Remove default arrow appearance for Safari */
87
+ -moz-appearance: none; /* Remove default arrow appearance for Firefox */
88
+ background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24"><path d="M7 10l5 5 5-5z"/></svg>')
89
+ no-repeat;
90
+ background-position: right 3px center; /* Adjust right position to move arrow left */
91
+ background-size: 30px 30px;
92
+ border: 1px solid var(--ld-input-placeholder);
93
+ background-color: white; /* Adjust as needed */
94
+ cursor: pointer;
95
+ }
96
+ }
97
+
98
+ .paginationButton {
99
+ display: flex;
100
+ justify-content: center;
101
+ align-items: center;
102
+ background-color: transparent;
103
+ border-radius: 5px;
104
+ --ld-button-border-radius: 5px;
105
+ }
106
+
107
+ .content {
108
+ display: flex;
109
+ justify-content: center;
110
+ align-items: center;
111
+ }
112
+
113
+ .tableContainer {
114
+ width: 100%; /* Adjust as needed */
115
+ max-height: 450px; /* Set the height you need */
116
+ overflow: auto;
117
+ }
118
+
119
+ .table {
120
+ width: 100%;
121
+ table-layout: auto;
122
+ border-collapse: collapse;
123
+ border-spacing: 0;
124
+ }
125
+ .th,
126
+ .td {
127
+ border-bottom: 1px solid #d6d6d6;
128
+ /* vertical-align: middle;*/
129
+ padding: 8px; /* Adjust padding as needed */
130
+ white-space: nowrap; /* Prevents text wrapping, ensuring the content fits in the cell */
131
+ /* display: flex;*/
132
+ /* flex-direction: row;*/
133
+ /* align-items: center;*/
134
+ /* justify-content: center;*/
135
+ }
136
+
137
+ thead th {
138
+ position: sticky;
139
+ top: 0;
140
+ }
141
+
142
+ .tbodyContainer {
143
+ display: block;
144
+ max-height: 350px; /* Adjust as needed */
145
+ overflow-y: auto;
146
+ }
147
+
148
+ .tbodyContainer tbody {
149
+ display: block;
150
+ }
151
+
152
+ .tbodyContainer tr {
153
+ display: table;
154
+ width: 100%;
155
+ table-layout: fixed;
156
+ }
157
+
158
+ .tbodyContainer td {
159
+ display: table-cell;
160
+ }
161
+
162
+ .th:first-child {
163
+ z-index: 1;
164
+ }
165
+
166
+ .th:last-child {
167
+ z-index: 1;
168
+ }
169
+
170
+ .th:first-child,
171
+ .td:first-child {
172
+ text-align: center;
173
+ vertical-align: middle;
174
+ }
175
+
176
+ .th:last-child,
177
+ .td:last-child {
178
+ width: 120px;
179
+ }
180
+
181
+ /* .th:first-child,*/
182
+ /* .td:first-child {*/
183
+ /* width: 50px;*/
184
+ /* }*/
185
+
186
+ .th {
187
+ text-align: left;
188
+ background-color: #ffffff;
189
+ cursor: pointer;
190
+
191
+ .canSort {
192
+ display: flex;
193
+ justify-content: flex-start;
194
+ align-items: center;
195
+ gap: 10px;
196
+ }
197
+ }
198
+ .tr {
199
+ background-color: #f7f7f7;
200
+ height: 40px;
201
+ }
202
+
203
+ .sticky {
204
+ position: -webkit-sticky; /* For Safari */
205
+ position: sticky;
206
+ background: white; /* Or the background color of your table */
207
+ /* z-index: 1; /* Ensure it stays above other content */
208
+ }
209
+
210
+ .stickyLeft {
211
+ left: 0;
212
+ }
213
+
214
+ .stickyRight {
215
+ right: 0;
216
+ }
217
+
218
+ .modalContainer {
219
+ right: 0;
220
+ min-height: 100vh;
221
+ background-color: #ffffff;
222
+ z-index: 1;
223
+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
224
+ --dialog-animation-name: none;
225
+ --dialog-position-left: auto;
226
+ --dialog-transform: translate(0, -50%);
227
+ --dialog-width: 300px;
228
+ --ld-border-radius: 5px;
229
+ }
230
+
231
+ .modalHeader {
232
+ border-bottom: 1px solid #ddd;
233
+ padding-bottom: 10px;
234
+ margin-bottom: 10px;
235
+
236
+ h1 {
237
+ font-size: 25px;
238
+ font-weight: 500;
239
+ }
240
+ }
241
+
242
+ .modalHeader h2 {
243
+ margin: 0;
244
+ }
245
+
246
+ .modalBody {
247
+ display: flex;
248
+ flex-direction: column;
249
+ justify-content: center;
250
+ align-items: center;
251
+ padding-bottom: 20px;
252
+
253
+ img {
254
+ width: 80%;
255
+ }
256
+
257
+ .form {
258
+ display: flex;
259
+ flex-direction: column;
260
+ width: 100%;
261
+ gap: 20px;
262
+
263
+ .formSection {
264
+ display: flex;
265
+ flex-direction: column;
266
+ gap: 8px;
267
+
268
+ p {
269
+ text-align: center;
270
+ }
271
+
272
+ .formFilter {
273
+ border: 1px solid var(--ld-input-placeholder);
274
+ --ld-input-border-radius: 5px;
275
+ }
276
+ }
277
+
278
+ .filter {
279
+ display: flex;
280
+ flex-direction: column;
281
+ gap: 10px;
282
+
283
+ button {
284
+ padding: 8px 20px;
285
+ background-color: #007bff;
286
+ color: #fff;
287
+ border: none;
288
+ border-radius: 3px;
289
+ cursor: pointer;
290
+ width: 100%;
291
+ }
292
+ }
293
+ /* justify-content: center;*/
294
+
295
+ /* .input {*/
296
+ /* width: 100%;*/
297
+ /* }*/
298
+ }
299
+ }
300
+
301
+ .modalFooter {
302
+ display: flex;
303
+ text-align: right;
304
+ }
305
+
306
+ .buttonFilter {
307
+ width: 100%;
308
+ }
309
+
310
+ .modalFooter button {
311
+ padding: 8px 20px;
312
+ background-color: #007bff;
313
+ color: #fff;
314
+ border: none;
315
+ border-radius: 3px;
316
+ cursor: pointer;
317
+ width: 100%;
318
+ }
319
+
320
+ .modalFooter button:hover {
321
+ background-color: #0056b3;
322
+ }
323
+
324
+ .badge {
325
+ display: inline-flex;
326
+ align-items: center;
327
+ background-color: transparent;
328
+ color: #007bff; /* Text color*/
329
+ border: 1px solid #007bff;
330
+ padding: 4px 8px;
331
+ border-radius: 5px;
332
+ font-size: 14px;
333
+ padding: 10px 12px;
334
+ /* margin-right: 8px;*/
335
+
336
+ .badgeText {
337
+ margin-right: 4px;
338
+ }
339
+
340
+ .badgeCloseButton {
341
+ border: none;
342
+ background: none;
343
+ color: inherit;
344
+ font-size: inherit;
345
+ cursor: pointer;
346
+ margin-left: 4px;
347
+
348
+ &:hover {
349
+ color: #ff0000; /* Change color on hover*/
350
+ }
351
+ }
352
+ }
353
+
354
+ /* Hide the default checkbox */
355
+ input[type='checkbox'] {
356
+ position: relative;
357
+ appearance: none;
358
+ width: 22px;
359
+ height: 22px;
360
+ background-color: #eee;
361
+ border: 2px solid #ddd;
362
+ border-radius: 4px;
363
+ cursor: pointer;
364
+ transition: all 0.3s ease;
365
+ }
366
+
367
+ /* Custom checkmark */
368
+ input[type='checkbox']:after {
369
+ content: '';
370
+ position: absolute;
371
+ display: none;
372
+ left: 7px;
373
+ top: 2px;
374
+ width: 6px;
375
+ height: 12px;
376
+ border: solid white;
377
+ border-width: 0 2px 2px 0;
378
+ transform: rotate(45deg);
379
+ }
380
+
381
+ /* Show the checkmark when checked */
382
+ input[type='checkbox']:checked {
383
+ background-color: #4caf50;
384
+ border-color: #4caf50;
385
+ }
386
+
387
+ input[type='checkbox']:checked:after {
388
+ display: block;
389
+ }
390
+
391
+ /* Hover effect */
392
+ input[type='checkbox']:hover {
393
+ background-color: #ccc;
394
+ }
@@ -0,0 +1,60 @@
1
+ import React, { useState } from 'react';
2
+ import type { PropertyShapeWire } from '@_linked/core/shapes/nodeShapeWire';
3
+ import { Switch } from '@_linked/primitives/components/Switch';
4
+
5
+ export interface SwitchEditorProps {
6
+ onCheckedChange?: (e) => void;
7
+ of?: Record<string, any>;
8
+ property?: PropertyShapeWire;
9
+
10
+ /**
11
+ * Converts the value returned by the shape, to the input string for the switch
12
+ * @param shapePropertyValue
13
+ * @returns
14
+ */
15
+ preConvertValueFn?: (shapePropertyValue: any) => string;
16
+ /**
17
+ * Converts the value of the switch to a value that can be provided to the set method of the shape
18
+ * @param inputValue
19
+ * @returns
20
+ */
21
+ postConvertValueFn?: (inputValue: string) => any;
22
+ }
23
+
24
+ export const SwitchEditor = ({
25
+ onCheckedChange,
26
+ of,
27
+ property,
28
+ preConvertValueFn,
29
+ postConvertValueFn,
30
+ ...restProps
31
+ }: SwitchEditorProps) => {
32
+ const onChangeHandler = (value) => {
33
+ console.log(value, 'value switch');
34
+ if (!of) return;
35
+ if (postConvertValueFn) {
36
+ value = postConvertValueFn(value);
37
+ }
38
+ of[property.label] = value;
39
+ console.log(of[property.label], 'of[property.label] switch');
40
+
41
+ if (onCheckedChange) {
42
+ onCheckedChange(value);
43
+ }
44
+ };
45
+
46
+ return (
47
+ <Switch
48
+ value={of[property.label]}
49
+ onCheckedChange={onChangeHandler}
50
+ defaultChecked={
51
+ of
52
+ ? preConvertValueFn
53
+ ? preConvertValueFn(of[property.label])
54
+ : of[property.label]
55
+ : ''
56
+ }
57
+ {...restProps}
58
+ />
59
+ );
60
+ };
@@ -0,0 +1,55 @@
1
+ import React, { useState } from 'react';
2
+ import { Textarea } from '@_linked/primitives/components/Textarea';
3
+
4
+ export interface TextareaEditorProps {
5
+ onChange?: (e) => void;
6
+ value?: string[];
7
+ of?: Record<string, any>;
8
+ property?: string;
9
+ children?;
10
+ className?;
11
+ /**
12
+ * Converts the value returned by the shape, to the text area string for the text area
13
+ * @param shapePropertyValue
14
+ * @returns
15
+ */
16
+ preConvertValueFn?: (shapePropertyValue: any) => string;
17
+ /**
18
+ * Converts the value of the text area to a value that can be provided to the set method of the shape
19
+ * @param textAreaValue
20
+ * @returns
21
+ */
22
+ postConvertValueFn?: (textAreaValue: string) => any;
23
+ }
24
+ export const TextareaEditor = ({
25
+ onChange,
26
+ value,
27
+ of,
28
+ property,
29
+ preConvertValueFn,
30
+ postConvertValueFn,
31
+ children,
32
+ className,
33
+ ...props
34
+ }: TextareaEditorProps) => {
35
+ const onChangeHandler = (e) => {
36
+ if (onChange) {
37
+ onChange(e);
38
+ }
39
+ };
40
+
41
+ return (
42
+ <Textarea
43
+ onChange={onChangeHandler}
44
+ defaultValue={
45
+ of
46
+ ? preConvertValueFn
47
+ ? preConvertValueFn(of[property])
48
+ : of[property]
49
+ : ''
50
+ }
51
+ value={value}
52
+ {...props}
53
+ />
54
+ );
55
+ };
@@ -0,0 +1,67 @@
1
+ import React, { useState } from 'react';
2
+ import { Input, InputProps } from '@_linked/primitives/components/Input';
3
+
4
+ export interface TextfieldProps extends InputProps {
5
+ onChange?: (e) => void;
6
+ value?: number | string;
7
+ helperText?: string;
8
+ of?: Record<string, any>;
9
+ valueProperty?: string;
10
+ property?;
11
+
12
+ /**
13
+ * Converts the value returned by the shape, to the input string for the input field
14
+ * @param shapePropertyValue
15
+ * @returns
16
+ */
17
+ preConvertValueFn?: (shapePropertyValue: any) => string;
18
+ /**
19
+ * Converts the value of the input field to a value that can be provided to the set method of the shape
20
+ * @param inputValue
21
+ * @returns
22
+ */
23
+ postConvertValueFn?: (inputValue: string) => any;
24
+ }
25
+ export const TextfieldEditor = ({
26
+ onChange,
27
+ value,
28
+ of,
29
+ property,
30
+ valueProperty,
31
+ preConvertValueFn,
32
+ postConvertValueFn,
33
+ ...restProps
34
+ }: TextfieldProps) => {
35
+ const onBlur = (e) => {
36
+ let value = e.currentTarget.value;
37
+ if (!of) return;
38
+ if (postConvertValueFn) {
39
+ value = postConvertValueFn(value);
40
+ }
41
+ of[property.label] = value;
42
+ console.log('of', of);
43
+ console.log('value', value);
44
+ };
45
+
46
+ const onChangeHandler = (e) => {
47
+ if (onChange) {
48
+ onChange(e);
49
+ }
50
+ };
51
+
52
+ return (
53
+ <Input
54
+ value={value}
55
+ onChange={onChangeHandler}
56
+ defaultValue={
57
+ of
58
+ ? preConvertValueFn
59
+ ? preConvertValueFn(of[property.label])
60
+ : of[property.label]
61
+ : ''
62
+ }
63
+ onBlur={onBlur}
64
+ {...restProps}
65
+ />
66
+ );
67
+ };
@@ -0,0 +1,63 @@
1
+ import React, { useState } from 'react';
2
+ import type { PropertyShapeWire } from '@_linked/core/shapes/nodeShapeWire';
3
+ import { Root as Toggle } from '@_linked/primitives/components/Toggle';
4
+
5
+ export interface ToggleEditorProps {
6
+ onPressedChange?: (e) => void;
7
+ of?: Record<string, any>;
8
+ property?: PropertyShapeWire;
9
+ children: React.ReactNode;
10
+ /**
11
+ * Converts the value returned by the shape, to the input string for the toggle
12
+ * @param shapePropertyValue
13
+ * @returns
14
+ */
15
+ preConvertValueFn?: (shapePropertyValue: any) => string;
16
+ /**
17
+ * Converts the value of the toggle to a value that can be provided to the set method of the shape
18
+ * @param inputValue
19
+ * @returns
20
+ */
21
+ postConvertValueFn?: (inputValue: string) => any;
22
+ }
23
+
24
+ export const ToggleEditor = ({
25
+ onPressedChange,
26
+ of,
27
+ property,
28
+ children,
29
+ preConvertValueFn,
30
+ postConvertValueFn,
31
+ ...restProps
32
+ }: ToggleEditorProps) => {
33
+ const onChangeHandler = (value) => {
34
+ console.log(value, 'value toggle');
35
+ if (!of) return;
36
+ if (postConvertValueFn) {
37
+ value = postConvertValueFn(value);
38
+ }
39
+ of[property.label] = value;
40
+ console.log(of[property.label], 'of[property.label] toggle');
41
+
42
+ if (onPressedChange) {
43
+ onPressedChange(value);
44
+ }
45
+ };
46
+
47
+ return (
48
+ <Toggle
49
+ pressed={of[property.label]}
50
+ onPressedChange={onChangeHandler}
51
+ defaultPressed={
52
+ of
53
+ ? preConvertValueFn
54
+ ? preConvertValueFn(of[property.label])
55
+ : of[property.label]
56
+ : ''
57
+ }
58
+ {...restProps}
59
+ >
60
+ {children}
61
+ </Toggle>
62
+ );
63
+ };