@_linked/shape-ui 2.0.0 → 2.3.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/lib/esm/columns.d.ts +58 -0
- package/lib/esm/columns.js +173 -0
- package/lib/esm/columns.js.map +1 -0
- package/lib/esm/components/AddInstanceForms.d.ts +38 -0
- package/lib/esm/components/AddInstanceForms.js +143 -0
- package/lib/esm/components/AddInstanceForms.js.map +1 -0
- package/lib/esm/components/AddInstanceForms.module.css +12 -0
- package/lib/esm/components/BatchEditDrawer.d.ts +13 -0
- package/lib/esm/components/BatchEditDrawer.js +122 -0
- package/lib/esm/components/BatchEditDrawer.js.map +1 -0
- package/lib/esm/components/BatchEditDrawer.module.css +193 -0
- package/lib/esm/components/CustomMultiSelect.d.ts +26 -0
- package/lib/esm/components/CustomMultiSelect.js +344 -0
- package/lib/esm/components/CustomMultiSelect.js.map +1 -0
- package/lib/esm/components/CustomMultiSelect.module.css +291 -0
- package/lib/esm/components/DynamicFormField.d.ts +21 -0
- package/lib/esm/components/DynamicFormField.js +149 -0
- package/lib/esm/components/DynamicFormField.js.map +1 -0
- package/lib/esm/components/DynamicFormField.module.css +169 -0
- package/lib/esm/components/EditInstanceForms.d.ts +15 -0
- package/lib/esm/components/EditInstanceForms.js +118 -0
- package/lib/esm/components/EditInstanceForms.js.map +1 -0
- package/lib/esm/components/FilterBadge.d.ts +20 -0
- package/lib/esm/components/FilterBadge.js +26 -0
- package/lib/esm/components/FilterBadge.js.map +1 -0
- package/lib/esm/components/FilterBadge.module.css +25 -0
- package/lib/esm/components/FormField.d.ts +18 -0
- package/lib/esm/components/FormField.js +9 -0
- package/lib/esm/components/FormField.js.map +1 -0
- package/lib/esm/components/FormField.module.css +57 -0
- package/lib/esm/components/InstanceDeletionDialog.d.ts +17 -0
- package/lib/esm/components/InstanceDeletionDialog.js +83 -0
- package/lib/esm/components/InstanceDeletionDialog.js.map +1 -0
- package/lib/esm/components/InstanceDeletionDialog.module.css +59 -0
- package/lib/esm/components/InstanceOverview.d.ts +43 -0
- package/lib/esm/components/InstanceOverview.js +236 -0
- package/lib/esm/components/InstanceOverview.js.map +1 -0
- package/lib/esm/components/InstanceOverview.module.css +35 -0
- package/lib/esm/components/InstanceView.d.ts +29 -0
- package/lib/esm/components/InstanceView.js +97 -0
- package/lib/esm/components/InstanceView.js.map +1 -0
- package/lib/esm/components/InstanceView.module.css +157 -0
- package/lib/esm/components/NodeBadge.d.ts +25 -0
- package/lib/esm/components/NodeBadge.js +29 -0
- package/lib/esm/components/NodeBadge.js.map +1 -0
- package/lib/esm/components/NodeValuesEditor.d.ts +15 -0
- package/lib/esm/components/NodeValuesEditor.js +29 -0
- package/lib/esm/components/NodeValuesEditor.js.map +1 -0
- package/lib/esm/components/NodeValuesEditor.module.css +4 -0
- package/lib/esm/components/ReactTable.d.ts +59 -0
- package/lib/esm/components/ReactTable.js +378 -0
- package/lib/esm/components/ReactTable.js.map +1 -0
- package/lib/esm/components/ReactTable.module.css +950 -0
- package/lib/esm/components/TextfieldEditor.d.ts +1 -2
- package/lib/esm/components/TextfieldEditor.js +2 -2
- package/lib/esm/components/TextfieldEditor.js.map +1 -1
- package/lib/esm/components/forms.module.css +96 -0
- package/lib/esm/host.d.ts +196 -0
- package/lib/esm/host.js +25 -0
- package/lib/esm/host.js.map +1 -0
- package/lib/esm/hostContext.d.ts +34 -0
- package/lib/esm/hostContext.js +95 -0
- package/lib/esm/hostContext.js.map +1 -0
- package/lib/esm/index.d.ts +60 -10
- package/lib/esm/index.js +60 -14
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/read.d.ts +48 -0
- package/lib/esm/read.js +96 -0
- package/lib/esm/read.js.map +1 -0
- package/lib/esm/search.d.ts +32 -0
- package/lib/esm/search.js +87 -0
- package/lib/esm/search.js.map +1 -0
- package/lib/esm/shape/contracts.d.ts +58 -0
- package/lib/esm/shape/contracts.js +15 -0
- package/lib/esm/shape/contracts.js.map +1 -0
- package/lib/esm/shape/naming.d.ts +30 -0
- package/lib/esm/shape/naming.js +52 -0
- package/lib/esm/shape/naming.js.map +1 -0
- package/lib/esm/shape/nodeDisplay.d.ts +36 -0
- package/lib/esm/shape/nodeDisplay.js +117 -0
- package/lib/esm/shape/nodeDisplay.js.map +1 -0
- package/lib/esm/shape/propertyTypes.d.ts +12 -0
- package/lib/esm/shape/propertyTypes.js +60 -0
- package/lib/esm/shape/propertyTypes.js.map +1 -0
- package/lib/esm/shape/propertyVisibility.d.ts +56 -0
- package/lib/esm/shape/propertyVisibility.js +112 -0
- package/lib/esm/shape/propertyVisibility.js.map +1 -0
- package/lib/esm/shape/shapeDependencies.d.ts +41 -0
- package/lib/esm/shape/shapeDependencies.js +141 -0
- package/lib/esm/shape/shapeDependencies.js.map +1 -0
- package/lib/esm/shape/tableFilters.d.ts +35 -0
- package/lib/esm/shape/tableFilters.js +171 -0
- package/lib/esm/shape/tableFilters.js.map +1 -0
- package/lib/esm/shape/useFormDependencies.d.ts +38 -0
- package/lib/esm/shape/useFormDependencies.js +178 -0
- package/lib/esm/shape/useFormDependencies.js.map +1 -0
- package/lib/esm/shape/validation.d.ts +15 -0
- package/lib/esm/shape/validation.js +106 -0
- package/lib/esm/shape/validation.js.map +1 -0
- package/lib/esm/tokens.css +25 -0
- package/lib/esm/types.d.ts +22 -0
- package/lib/esm/types.js +1 -0
- package/lib/esm/types.js.map +1 -0
- package/lib/esm/write.d.ts +51 -0
- package/lib/esm/write.js +99 -0
- package/lib/esm/write.js.map +1 -0
- package/package.json +44 -18
- package/src/backend.ts +1 -0
- package/src/columns.regression.test.ts +143 -0
- package/src/columns.test.ts +200 -0
- package/src/columns.ts +228 -0
- package/src/components/AddInstanceForms.module.css +12 -0
- package/src/components/AddInstanceForms.tsx +321 -0
- package/src/components/AvatarEditor.tsx +34 -0
- package/src/components/BatchEditDrawer.module.css +193 -0
- package/src/components/BatchEditDrawer.tsx +295 -0
- package/src/components/CheckboxEditor.module.css +6 -0
- package/src/components/CheckboxEditor.tsx +86 -0
- package/src/components/CustomMultiSelect.module.css +291 -0
- package/src/components/CustomMultiSelect.tsx +527 -0
- package/src/components/DateEditor.tsx +50 -0
- package/src/components/DynamicFormField.module.css +169 -0
- package/src/components/DynamicFormField.tsx +357 -0
- package/src/components/EditInstanceForms.tsx +260 -0
- package/src/components/FilterBadge.module.css +25 -0
- package/src/components/FilterBadge.tsx +70 -0
- package/src/components/FormField.module.css +57 -0
- package/src/components/FormField.tsx +59 -0
- package/src/components/ImageValueEditor.module.css +3 -0
- package/src/components/ImageValueEditor.tsx +82 -0
- package/src/components/InstanceDeletionDialog.module.css +59 -0
- package/src/components/InstanceDeletionDialog.tsx +175 -0
- package/src/components/InstanceOverview.module.css +35 -0
- package/src/components/InstanceOverview.tsx +385 -0
- package/src/components/InstanceView.module.css +157 -0
- package/src/components/InstanceView.tsx +212 -0
- package/src/components/NodeBadge.tsx +60 -0
- package/src/components/NodeValuesEditor.module.css +4 -0
- package/src/components/NodeValuesEditor.tsx +64 -0
- package/src/components/RadioButtonEditor.module.css +22 -0
- package/src/components/RadioButtonEditor.tsx +96 -0
- package/src/components/ReactTable.module.css +950 -0
- package/src/components/ReactTable.tsx +1013 -0
- package/src/components/SelectEditor.tsx +85 -0
- package/src/components/ShapeTable.module.css +394 -0
- package/src/components/SwitchEditor.tsx +60 -0
- package/src/components/TextareaEditor.tsx +55 -0
- package/src/components/TextfieldEditor.tsx +67 -0
- package/src/components/ToggleEditor.tsx +63 -0
- package/src/components/forms.module.css +96 -0
- package/src/host.ts +226 -0
- package/src/hostContext.tsx +114 -0
- package/src/index.ts +93 -0
- package/src/package.ts +21 -0
- package/src/read.ts +148 -0
- package/src/search.test.ts +174 -0
- package/src/search.ts +108 -0
- package/src/shape/contracts.ts +66 -0
- package/src/shape/naming.ts +52 -0
- package/src/shape/nodeDisplay.ts +114 -0
- package/src/shape/propertyTypes.ts +86 -0
- package/src/shape/propertyVisibility.ts +180 -0
- package/src/shape/shapeDependencies.ts +183 -0
- package/src/shape/tableFilters.ts +223 -0
- package/src/shape/types.ts +1158 -0
- package/src/shape/useFormDependencies.ts +257 -0
- package/src/shape/validation.ts +121 -0
- package/src/tokens.css +25 -0
- package/src/types.ts +20 -0
- package/src/utils/helper.ts +35 -0
- package/src/write.test.ts +174 -0
- package/src/write.ts +114 -0
- package/.changeset/README.md +0 -20
- package/.changeset/config.json +0 -14
- package/.github/workflows/changeset-check.yml +0 -44
- package/.github/workflows/ci.yml +0 -43
- package/.github/workflows/publish.yml +0 -158
- package/CHANGELOG.md +0 -30
- package/lib/esm/components/AvatarEditor.d.ts +0 -20
- package/lib/esm/components/AvatarEditor.js +0 -7
- package/lib/esm/components/AvatarEditor.js.map +0 -1
- package/lib/esm/components/CheckboxEditor.d.ts +0 -21
- package/lib/esm/components/CheckboxEditor.js +0 -44
- package/lib/esm/components/CheckboxEditor.js.map +0 -1
- package/lib/esm/components/DateEditor.d.ts +0 -20
- package/lib/esm/components/DateEditor.js +0 -22
- package/lib/esm/components/DateEditor.js.map +0 -1
- package/lib/esm/components/RadioButtonEditor.d.ts +0 -23
- package/lib/esm/components/RadioButtonEditor.js +0 -41
- package/lib/esm/components/RadioButtonEditor.js.map +0 -1
- package/lib/esm/components/SelectEditor.d.ts +0 -21
- package/lib/esm/components/SelectEditor.js +0 -30
- package/lib/esm/components/SelectEditor.js.map +0 -1
- package/lib/esm/components/SwitchEditor.d.ts +0 -21
- package/lib/esm/components/SwitchEditor.js +0 -23
- package/lib/esm/components/SwitchEditor.js.map +0 -1
- package/lib/esm/components/TextareaEditor.d.ts +0 -23
- package/lib/esm/components/TextareaEditor.js +0 -15
- package/lib/esm/components/TextareaEditor.js.map +0 -1
- package/lib/esm/components/ToggleEditor.d.ts +0 -22
- package/lib/esm/components/ToggleEditor.js +0 -23
- package/lib/esm/components/ToggleEditor.js.map +0 -1
- package/lib/esm/ontologies/lincd-ui.d.ts +0 -6
- package/lib/esm/ontologies/lincd-ui.js +0 -18
- package/lib/esm/ontologies/lincd-ui.js.map +0 -1
- package/tsconfig-cjs.json +0 -8
- package/tsconfig-esm.json +0 -9
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
CustomMultiSelect.module.css
|
|
3
|
+
|
|
4
|
+
Multi-select dropdown with search and create new functionality.
|
|
5
|
+
Uses semantic tokens from theme.css.
|
|
6
|
+
============================================================================ */
|
|
7
|
+
|
|
8
|
+
/* === Root Container === */
|
|
9
|
+
.Root {
|
|
10
|
+
display: flex;
|
|
11
|
+
gap: var(--space-sm);
|
|
12
|
+
align-items: center;
|
|
13
|
+
position: relative;
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* === Table icon === */
|
|
18
|
+
.tableIcon {
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
color: var(--custom-multi-select-gray-500, var(--color-gray-500));
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
transition: color var(--transition-fast);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.tableIcon:hover {
|
|
28
|
+
color: var(--custom-multi-select-tertiary-500, var(--color-tertiary-500));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* === Selected Options Container === */
|
|
32
|
+
.selectedOptionsAndChevronIconContainer {
|
|
33
|
+
display: flex;
|
|
34
|
+
gap: var(--space-sm);
|
|
35
|
+
align-items: center;
|
|
36
|
+
width: 100%;
|
|
37
|
+
padding: var(--surface-gap) 0;
|
|
38
|
+
overflow-x: hidden;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.selectedOptionsContainer {
|
|
42
|
+
position: relative;
|
|
43
|
+
border: 1px solid var(--field-border);
|
|
44
|
+
border-radius: var(--radius-field);
|
|
45
|
+
width: 100%;
|
|
46
|
+
padding: 0;
|
|
47
|
+
background-color: var(--field-bg);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.selectedOptionsContainer.expanded {
|
|
51
|
+
overflow-y: scroll;
|
|
52
|
+
flex-wrap: wrap;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* === Chips Container === */
|
|
56
|
+
.noBorderContainer {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
max-height: 196px;
|
|
60
|
+
padding: var(--space-sm) 0 var(--space-sm) var(--space-sm);
|
|
61
|
+
gap: var(--space-sm);
|
|
62
|
+
width: 93%;
|
|
63
|
+
overflow-y: hidden;
|
|
64
|
+
border-color: transparent;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.noBorderContainer.expanded {
|
|
68
|
+
overflow-y: scroll;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* === Chevron Icon === */
|
|
72
|
+
.chevronDownIcon {
|
|
73
|
+
opacity: 0.4;
|
|
74
|
+
transition: transform var(--transition-fast), opacity var(--transition-fast);
|
|
75
|
+
position: absolute;
|
|
76
|
+
right: 0.25rem;
|
|
77
|
+
top: 51%;
|
|
78
|
+
transform: translate(-40px, -50%);
|
|
79
|
+
color: var(--custom-multi-select-gray-500, var(--color-gray-500));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.chevronDownIcon.open {
|
|
83
|
+
opacity: 0.7;
|
|
84
|
+
transform: rotate(180deg) translate(40px, 0.75rem);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* === Option chips (selected values) === */
|
|
88
|
+
.optionButton {
|
|
89
|
+
border-radius: var(--radius-full);
|
|
90
|
+
display: inline-flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
gap: var(--space-xs);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/* === Selector placeholder === */
|
|
96
|
+
.selectorButton {
|
|
97
|
+
color: var(--field-text-placeholder);
|
|
98
|
+
font-size: var(--typography-small-size);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* ============================================================================
|
|
102
|
+
Dropdown (Popover.Content)
|
|
103
|
+
============================================================================ */
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
.options {
|
|
107
|
+
width: 100%;
|
|
108
|
+
padding: 0;
|
|
109
|
+
background-color: var(--surface-bg);
|
|
110
|
+
border: 1px solid var(--surface-border);
|
|
111
|
+
border-radius: var(--radius-field);
|
|
112
|
+
overflow: hidden;
|
|
113
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* === Search wrapper === */
|
|
117
|
+
.searchWrapper {
|
|
118
|
+
position: relative;
|
|
119
|
+
border-bottom: 1px solid var(--surface-border);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/* === Command input === */
|
|
123
|
+
input[cmdk-input] {
|
|
124
|
+
width: 100%;
|
|
125
|
+
background-color: var(--field-bg);
|
|
126
|
+
color: var(--field-text);
|
|
127
|
+
border: none;
|
|
128
|
+
padding: var(--space-sm-plus) var(--space-xl) var(--space-sm-plus) var(--space-md);
|
|
129
|
+
font-size: var(--typography-small-size);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
input[cmdk-input]::placeholder {
|
|
133
|
+
color: var(--field-text-placeholder);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* === Reset search icon === */
|
|
137
|
+
.resetSearchInputIcon {
|
|
138
|
+
position: absolute;
|
|
139
|
+
right: var(--space-md);
|
|
140
|
+
top: 50%;
|
|
141
|
+
transform: translateY(-50%);
|
|
142
|
+
opacity: 0.5;
|
|
143
|
+
color: var(--custom-multi-select-gray-500, var(--color-gray-500));
|
|
144
|
+
cursor: pointer;
|
|
145
|
+
transition: all var(--transition-fast);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.resetSearchInputIcon:hover {
|
|
149
|
+
opacity: 1;
|
|
150
|
+
color: var(--custom-multi-select-tertiary-500, var(--color-tertiary-500));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* === Command root / list === */
|
|
154
|
+
.commandRoot {
|
|
155
|
+
position: relative;
|
|
156
|
+
max-height: 220px;
|
|
157
|
+
overflow-y: auto;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* === Options group === */
|
|
161
|
+
.commandGroup {
|
|
162
|
+
padding: var(--space-xs) 0;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/* === Individual option item === */
|
|
166
|
+
.option {
|
|
167
|
+
display: flex;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: space-between;
|
|
170
|
+
padding: var(--space-sm-plus) var(--space-md);
|
|
171
|
+
font-size: var(--typography-small-size);
|
|
172
|
+
cursor: pointer;
|
|
173
|
+
gap: var(--space-sm);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.optionLabel {
|
|
177
|
+
flex: 1;
|
|
178
|
+
overflow: hidden;
|
|
179
|
+
text-overflow: ellipsis;
|
|
180
|
+
white-space: nowrap;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.optionCheck {
|
|
184
|
+
flex-shrink: 0;
|
|
185
|
+
color: var(--custom-multi-select-tertiary-500, var(--color-tertiary-500));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.optionSelected {
|
|
189
|
+
opacity: 0.6;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* === Empty result === */
|
|
193
|
+
.emptyResult {
|
|
194
|
+
text-align: left;
|
|
195
|
+
padding: var(--space-sm-plus) var(--space-md);
|
|
196
|
+
font-size: var(--typography-small-size);
|
|
197
|
+
color: var(--custom-multi-select-gray-500, var(--color-gray-500));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* === Load More sentinel (infinite scroll) === */
|
|
201
|
+
.loadMoreSentinel {
|
|
202
|
+
display: flex;
|
|
203
|
+
justify-content: center;
|
|
204
|
+
align-items: center;
|
|
205
|
+
padding: var(--space-sm) 0;
|
|
206
|
+
min-height: 32px;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* === "Create New" section === */
|
|
210
|
+
.createNewContainer {
|
|
211
|
+
border-top: 1px solid var(--surface-border);
|
|
212
|
+
padding: 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.modalButton {
|
|
216
|
+
display: flex;
|
|
217
|
+
align-items: center;
|
|
218
|
+
gap: var(--space-sm);
|
|
219
|
+
width: 100%;
|
|
220
|
+
border: none;
|
|
221
|
+
background: transparent;
|
|
222
|
+
padding: var(--space-sm-plus) var(--space-md);
|
|
223
|
+
font-size: var(--typography-small-size);
|
|
224
|
+
color: var(--custom-multi-select-tertiary-500, var(--color-tertiary-500));
|
|
225
|
+
cursor: pointer;
|
|
226
|
+
text-align: left;
|
|
227
|
+
transition: background var(--transition-fast);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.modalButton:hover {
|
|
231
|
+
background: color-mix(in srgb, var(--custom-multi-select-tertiary-500, var(--color-tertiary-500)) 8%, transparent);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* === View Less text (expand/collapse) === */
|
|
235
|
+
.viewLessText {
|
|
236
|
+
color: var(--custom-multi-select-gray-500, var(--color-gray-500));
|
|
237
|
+
font-size: var(--typography-small-size);
|
|
238
|
+
padding: 0 var(--space-sm);
|
|
239
|
+
position: absolute;
|
|
240
|
+
bottom: 3px;
|
|
241
|
+
left: 15px;
|
|
242
|
+
border-radius: var(--radius-full);
|
|
243
|
+
background: var(--surface-bg);
|
|
244
|
+
cursor: pointer;
|
|
245
|
+
transition: all var(--transition-fast);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.viewLessText:hover {
|
|
249
|
+
color: var(--custom-multi-select-tertiary-500, var(--color-tertiary-500));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* === Dialog === */
|
|
253
|
+
.dialogRoot {
|
|
254
|
+
background-color: var(--modal-bg, var(--surface-bg));
|
|
255
|
+
border: 1px solid var(--modal-border, var(--surface-border));
|
|
256
|
+
border-radius: var(--radius-modal);
|
|
257
|
+
min-width: min(90vw, 680px);
|
|
258
|
+
max-height: 90vh;
|
|
259
|
+
display: flex;
|
|
260
|
+
flex-direction: column;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.dialogHeader {
|
|
264
|
+
padding: var(--space-xl) var(--space-xl) var(--space-md);
|
|
265
|
+
border-bottom: 1px solid var(--surface-border);
|
|
266
|
+
flex-shrink: 0;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.dialogContent {
|
|
270
|
+
overflow-y: auto;
|
|
271
|
+
flex: 1;
|
|
272
|
+
padding: 0 var(--space-md) var(--space-md);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* ============================================================================
|
|
276
|
+
Dark Mode
|
|
277
|
+
============================================================================ */
|
|
278
|
+
|
|
279
|
+
/* All surfaces use semantic tokens that auto-switch in dark mode */
|
|
280
|
+
|
|
281
|
+
[data-theme='dark'] .modalButton {
|
|
282
|
+
color: var(--custom-multi-select-tertiary-400, var(--color-tertiary-400));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
[data-theme='dark'] .viewLessText {
|
|
286
|
+
color: var(--custom-multi-select-gray-400, var(--color-gray-400));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
[data-theme='dark'] .options {
|
|
290
|
+
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
|
|
291
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PropertyShapeWire } from '@_linked/core/shapes/nodeShapeWire';
|
|
2
|
+
import { Shape } from '@_linked/core/shapes/Shape';
|
|
3
|
+
import type { FieldDependencyState } from '../shape/useFormDependencies.js';
|
|
4
|
+
interface DynamicFormProps {
|
|
5
|
+
dataType?: any;
|
|
6
|
+
formName: string;
|
|
7
|
+
label: string;
|
|
8
|
+
placeholder: string;
|
|
9
|
+
required: boolean;
|
|
10
|
+
value?: any;
|
|
11
|
+
shape: any;
|
|
12
|
+
of: Shape;
|
|
13
|
+
property: PropertyShapeWire;
|
|
14
|
+
onBeforeNavigate?: () => Promise<string | void> | string | void;
|
|
15
|
+
/** External error from submit-time validation */
|
|
16
|
+
error?: string;
|
|
17
|
+
/** Dependency state from parent fields (visibility + narrowing) */
|
|
18
|
+
dependencyState?: FieldDependencyState;
|
|
19
|
+
}
|
|
20
|
+
declare function DynamicForm({ dataType, formName, label, placeholder, required, value, shape, of, property, onBeforeNavigate, error: externalError, dependencyState, }: DynamicFormProps): import("react").JSX.Element;
|
|
21
|
+
export { DynamicForm };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip } from '@_linked/primitives/components/Tooltip';
|
|
3
|
+
import { shacl } from '@_linked/core/ontologies/shacl';
|
|
4
|
+
import { xsd } from '@_linked/core/ontologies/xsd';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
import { Icons } from '@_linked/icons';
|
|
7
|
+
import { getNodeDisplay, enumOptions } from '../shape/nodeDisplay.js';
|
|
8
|
+
import { validateField } from '../shape/validation.js';
|
|
9
|
+
import style from './DynamicFormField.module.css';
|
|
10
|
+
import { FormField } from './FormField.js';
|
|
11
|
+
import NodeValuesEditor from './NodeValuesEditor.js';
|
|
12
|
+
// Helper: format a Date or ISO string for <input type="date">
|
|
13
|
+
function toDateInputValue(val) {
|
|
14
|
+
if (!val)
|
|
15
|
+
return '';
|
|
16
|
+
if (val instanceof Date)
|
|
17
|
+
return val.toISOString().split('T')[0];
|
|
18
|
+
if (typeof val === 'string')
|
|
19
|
+
return val.split('T')[0];
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
// Helper: format a Date or ISO string for <input type="datetime-local">
|
|
23
|
+
function toDateTimeInputValue(val) {
|
|
24
|
+
if (!val)
|
|
25
|
+
return '';
|
|
26
|
+
if (val instanceof Date)
|
|
27
|
+
return val.toISOString().slice(0, 16);
|
|
28
|
+
if (typeof val === 'string')
|
|
29
|
+
return val.slice(0, 16);
|
|
30
|
+
return '';
|
|
31
|
+
}
|
|
32
|
+
/** Compute HTML min/max attrs from SHACL inclusive/exclusive constraints */
|
|
33
|
+
function computeNumericBounds(property, isInteger) {
|
|
34
|
+
const attrs = {};
|
|
35
|
+
if (property.minInclusive != null) {
|
|
36
|
+
attrs.min = property.minInclusive;
|
|
37
|
+
}
|
|
38
|
+
else if (property.minExclusive != null) {
|
|
39
|
+
// The metamodel types the bound as `string | number` — a SHACL literal can be either —
|
|
40
|
+
// where the DTO had already coerced it to a number.
|
|
41
|
+
const bound = Number(property.minExclusive);
|
|
42
|
+
attrs.min = isInteger ? bound + 1 : bound;
|
|
43
|
+
}
|
|
44
|
+
if (property.maxInclusive != null) {
|
|
45
|
+
attrs.max = property.maxInclusive;
|
|
46
|
+
}
|
|
47
|
+
else if (property.maxExclusive != null) {
|
|
48
|
+
attrs.max = isInteger ? property.maxExclusive - 1 : property.maxExclusive;
|
|
49
|
+
}
|
|
50
|
+
return attrs;
|
|
51
|
+
}
|
|
52
|
+
function FieldWrapper({ label, required, error, description, children, }) {
|
|
53
|
+
return (_jsxs("div", { className: style.form, children: [_jsx("div", { className: style.label, children: _jsxs("label", { children: [label, " ", required && _jsx("sup", { children: "*" }), description && (_jsxs(Tooltip.Root, { children: [_jsx(Tooltip.Trigger, { asChild: true, children: _jsx("button", { type: "button", className: style.infoIcon, "aria-label": `Info about ${label}`, children: _jsx(Icons.Info, { width: 14, height: 14 }) }) }), _jsxs(Tooltip.Content, { side: "top", sideOffset: 4, className: style.tooltipContent, children: [description, _jsx(Tooltip.Arrow, {})] })] }))] }) }), _jsxs("div", { className: style.value, children: [children, error && _jsx("span", { className: style.fieldError, children: error })] })] }));
|
|
54
|
+
}
|
|
55
|
+
function DynamicForm({ dataType, formName, label, placeholder = 'Type here', required = false, value, shape, of, property, onBeforeNavigate, error: externalError, dependencyState, }) {
|
|
56
|
+
var _a, _b, _c, _d;
|
|
57
|
+
const [localError, setLocalError] = useState('');
|
|
58
|
+
const displayError = externalError || localError;
|
|
59
|
+
const datatype = property.datatype;
|
|
60
|
+
const nodeKind = property.nodeKind;
|
|
61
|
+
const valueShape = property.valueShape;
|
|
62
|
+
const handleBlur = (val) => {
|
|
63
|
+
const err = validateField(property, val);
|
|
64
|
+
setLocalError(err);
|
|
65
|
+
};
|
|
66
|
+
// Guard: skip properties without nodeKind (incomplete shape data)
|
|
67
|
+
if (!nodeKind)
|
|
68
|
+
return null;
|
|
69
|
+
// ── sh:in enumeration → render as <select> dropdown (both literal and IRI) ──
|
|
70
|
+
//
|
|
71
|
+
// `enumOptions` derives the label. `sh:in` carries members, not names — the DTO's `inValues`
|
|
72
|
+
// looked like it carried names but they were the IRI's local part, computed at projection
|
|
73
|
+
// time. Same answer, computed in one place.
|
|
74
|
+
const choices = enumOptions(property);
|
|
75
|
+
if (choices.length > 0) {
|
|
76
|
+
const currentValue = value !== undefined && value !== null
|
|
77
|
+
? typeof value === 'object' && value.id
|
|
78
|
+
? value.id
|
|
79
|
+
: String(value)
|
|
80
|
+
: '';
|
|
81
|
+
return (_jsx(FieldWrapper, { label: label, required: required, error: displayError, description: property.description, children: _jsxs("select", { className: style.selectField, required: required, defaultValue: currentValue, onChange: (e) => {
|
|
82
|
+
of[property.label] = e.target.value || undefined;
|
|
83
|
+
}, onBlur: (e) => handleBlur(e.target.value), children: [_jsx("option", { value: "", children: "\u2014 Select \u2014" }), choices.map((opt) => (_jsx("option", { value: opt.id, children: opt.label }, opt.id)))] }) }));
|
|
84
|
+
}
|
|
85
|
+
// Object / IRI properties — rendered by NodeValuesEditor (CustomMultiSelect)
|
|
86
|
+
if (nodeKind.id === shacl.IRI.id ||
|
|
87
|
+
nodeKind.id === shacl.BlankNode.id ||
|
|
88
|
+
nodeKind.id === shacl.BlankNodeOrIRI.id) {
|
|
89
|
+
// Dependency hint: show subtle text when parent field can narrow this field
|
|
90
|
+
const narrowingHint = dependencyState && !dependencyState.parentHasValue
|
|
91
|
+
? dependencyState.parentLabels
|
|
92
|
+
.map((l) => l.replace(/([A-Z])/g, ' $1').replace(/^./, (c) => c.toUpperCase()).trim())
|
|
93
|
+
.join(' or ')
|
|
94
|
+
: null;
|
|
95
|
+
return (_jsxs(FieldWrapper, { label: label, required: required, error: displayError, description: property.description, children: [narrowingHint && (_jsxs("span", { className: style.narrowingHint, children: ["Select ", narrowingHint, " to narrow options"] })), _jsx(NodeValuesEditor, { sourceShape: shape, of: of, property: property, onBeforeNavigate: onBeforeNavigate, narrowedIds: dependencyState === null || dependencyState === void 0 ? void 0 : dependencyState.narrowedIds, isNarrowing: dependencyState === null || dependencyState === void 0 ? void 0 : dependencyState.loading })] }));
|
|
96
|
+
}
|
|
97
|
+
// Literal properties
|
|
98
|
+
if (nodeKind.id === shacl.Literal.id) {
|
|
99
|
+
const dt = datatype === null || datatype === void 0 ? void 0 : datatype.id;
|
|
100
|
+
// Boolean → native checkbox
|
|
101
|
+
if (dt === xsd.boolean.id) {
|
|
102
|
+
return (_jsx(FieldWrapper, { label: label, required: required, error: displayError, description: property.description, children: _jsx("input", { type: "checkbox", className: style.checkboxField, defaultChecked: !!value, onChange: (e) => { of[property.label] = e.target.checked; } }) }));
|
|
103
|
+
}
|
|
104
|
+
// Date
|
|
105
|
+
if (dt === xsd.date.id) {
|
|
106
|
+
return (_jsx(FieldWrapper, { label: label, required: required, error: displayError, description: property.description, children: _jsx("input", { type: "date", className: style.textFormField, required: required, defaultValue: toDateInputValue(value), onChange: (e) => { of[property.label] = e.target.value; }, onBlur: (e) => handleBlur(e.target.value) }) }));
|
|
107
|
+
}
|
|
108
|
+
// DateTime
|
|
109
|
+
if (dt === xsd.dateTime.id) {
|
|
110
|
+
return (_jsx(FieldWrapper, { label: label, required: required, error: displayError, description: property.description, children: _jsx("input", { type: "datetime-local", className: style.textFormField, required: required, defaultValue: toDateTimeInputValue(value), onChange: (e) => { of[property.label] = e.target.value; }, onBlur: (e) => handleBlur(e.target.value) }) }));
|
|
111
|
+
}
|
|
112
|
+
// Integer / long
|
|
113
|
+
if (dt === xsd.integer.id ||
|
|
114
|
+
dt === ((_a = xsd.long) === null || _a === void 0 ? void 0 : _a.id)) {
|
|
115
|
+
const bounds = computeNumericBounds(property, true);
|
|
116
|
+
return (_jsx(FieldWrapper, { label: label, required: required, error: displayError, description: property.description, children: _jsx("input", { type: "number", step: "1", className: style.textFormField, required: required, defaultValue: value !== undefined && value !== null ? Number(value) : '', ...bounds, onChange: (e) => { of[property.label] = parseInt(e.target.value, 10); }, onBlur: (e) => handleBlur(parseInt(e.target.value, 10)) }) }));
|
|
117
|
+
}
|
|
118
|
+
// Decimal / float / double
|
|
119
|
+
if (dt === ((_b = xsd.decimal) === null || _b === void 0 ? void 0 : _b.id) ||
|
|
120
|
+
dt === ((_c = xsd.float) === null || _c === void 0 ? void 0 : _c.id) ||
|
|
121
|
+
dt === ((_d = xsd.double) === null || _d === void 0 ? void 0 : _d.id)) {
|
|
122
|
+
const bounds = computeNumericBounds(property, false);
|
|
123
|
+
return (_jsx(FieldWrapper, { label: label, required: required, error: displayError, description: property.description, children: _jsx("input", { type: "number", step: "any", className: style.textFormField, required: required, defaultValue: value !== undefined && value !== null ? Number(value) : '', ...bounds, onChange: (e) => { of[property.label] = parseFloat(e.target.value); }, onBlur: (e) => handleBlur(parseFloat(e.target.value)) }) }));
|
|
124
|
+
}
|
|
125
|
+
// URI / anyURI
|
|
126
|
+
if (dt === 'http://www.w3.org/2001/XMLSchema#anyURI') {
|
|
127
|
+
return (_jsx(FieldWrapper, { label: label, required: required, error: displayError, description: property.description, children: _jsx(FormField, { name: formName, type: "url", placeholder: placeholder, className: style.textFormField, required: required, defaultValue: typeof value === 'string' ? value : '', onChange: (e) => { of[property.label] = e.target.value; }, onBlur: (e) => handleBlur(e.target.value) }) }));
|
|
128
|
+
}
|
|
129
|
+
// String (default) — also catches unknown datatypes
|
|
130
|
+
const strAttrs = {};
|
|
131
|
+
if (property.minLength != null)
|
|
132
|
+
strAttrs.minLength = property.minLength;
|
|
133
|
+
if (property.maxLength != null)
|
|
134
|
+
strAttrs.maxLength = property.maxLength;
|
|
135
|
+
if (property.pattern)
|
|
136
|
+
strAttrs.pattern = property.pattern;
|
|
137
|
+
return (_jsx(FieldWrapper, { label: label, required: required, error: displayError, description: property.description, children: _jsx(FormField, { name: formName, type: "text", placeholder: placeholder, className: style.textFormField, required: required, defaultValue: value !== undefined && value !== null
|
|
138
|
+
? typeof value === 'object'
|
|
139
|
+
? getNodeDisplay(value)
|
|
140
|
+
: String(value)
|
|
141
|
+
: '', ...strAttrs, onChange: (e) => { of[property.label] = e.target.value; }, onBlur: (e) => {
|
|
142
|
+
of[property.label] = e.target.value;
|
|
143
|
+
handleBlur(e.target.value);
|
|
144
|
+
} }) }));
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
export { DynamicForm };
|
|
149
|
+
//# sourceMappingURL=DynamicFormField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DynamicFormField.js","sourceRoot":"","sources":["../../../src/components/DynamicFormField.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAEjE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,MAAM,+BAA+B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAmBrD,8DAA8D;AAC9D,SAAS,gBAAgB,CAAC,GAAQ;IAChC,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE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,CAChB,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
DynamicFormField.module.css
|
|
3
|
+
|
|
4
|
+
Dynamic form field component for various input types.
|
|
5
|
+
Uses semantic tokens from theme.css.
|
|
6
|
+
============================================================================ */
|
|
7
|
+
|
|
8
|
+
/* === Form Row === */
|
|
9
|
+
.form {
|
|
10
|
+
display: flex;
|
|
11
|
+
min-height: 3.75rem;
|
|
12
|
+
align-items: center;
|
|
13
|
+
border-top: 1px solid var(--table-row-border);
|
|
14
|
+
justify-content: flex-start;
|
|
15
|
+
padding: var(--space-sm) 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.form:first-child {
|
|
19
|
+
border-top: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* === Label Column === */
|
|
23
|
+
.label {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
width: 30%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.label label {
|
|
32
|
+
font-weight: 400;
|
|
33
|
+
color: var(--text-auxiliary);
|
|
34
|
+
font-size: var(--typography-font-size);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.label p {
|
|
38
|
+
color: var(--table-cell-text);
|
|
39
|
+
color: var(--text-auxiliary);
|
|
40
|
+
font-size: var(--typography-small-size);
|
|
41
|
+
margin-top: 0.25rem;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.label sup {
|
|
45
|
+
color: var(--intent-danger-icon);
|
|
46
|
+
margin-left: var(--space-2xs);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* === Value Column === */
|
|
50
|
+
.value {
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: var(--space-sm-plus);
|
|
53
|
+
width: 70%;
|
|
54
|
+
height: 100%;
|
|
55
|
+
align-items: center;
|
|
56
|
+
flex-wrap: wrap;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* === Text Form Field === */
|
|
60
|
+
.textFormField {
|
|
61
|
+
box-shadow: none;
|
|
62
|
+
border: 1px solid var(--field-border);
|
|
63
|
+
border-radius: var(--radius-field);
|
|
64
|
+
margin: var(--space-sm) 0;
|
|
65
|
+
padding: var(--space-sm-plus) var(--field-padding-x);
|
|
66
|
+
background-color: var(--field-bg);
|
|
67
|
+
color: var(--field-text);
|
|
68
|
+
font-size: var(--typography-small-size);
|
|
69
|
+
width: 100%;
|
|
70
|
+
transition: all var(--transition-fast);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.textFormField:focus {
|
|
74
|
+
outline: none;
|
|
75
|
+
border-color: var(--field-border-focus);
|
|
76
|
+
box-shadow: 0 0 0 3px
|
|
77
|
+
color-mix(in srgb, var(--dynamic-form-field-tertiary-500, var(--color-tertiary-500)) 15%, transparent);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.textFormField::placeholder {
|
|
81
|
+
color: var(--field-text-placeholder);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* === Select Field (sh:in dropdown) === */
|
|
85
|
+
.selectField {
|
|
86
|
+
box-shadow: none;
|
|
87
|
+
border: 1px solid var(--field-border);
|
|
88
|
+
border-radius: var(--radius-field);
|
|
89
|
+
margin: var(--space-sm) 0;
|
|
90
|
+
padding: var(--space-sm-plus) var(--field-padding-x);
|
|
91
|
+
background-color: var(--field-bg);
|
|
92
|
+
color: var(--field-text);
|
|
93
|
+
font-size: var(--typography-small-size);
|
|
94
|
+
width: 100%;
|
|
95
|
+
transition: all var(--transition-fast);
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.selectField:focus {
|
|
100
|
+
outline: none;
|
|
101
|
+
border-color: var(--field-border-focus);
|
|
102
|
+
box-shadow: 0 0 0 3px
|
|
103
|
+
color-mix(in srgb, var(--dynamic-form-field-tertiary-500, var(--color-tertiary-500)) 15%, transparent);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* === Field Error === */
|
|
107
|
+
.fieldError {
|
|
108
|
+
display: block;
|
|
109
|
+
width: 100%;
|
|
110
|
+
color: var(--intent-danger-text);
|
|
111
|
+
font-size: var(--typography-small-size);
|
|
112
|
+
margin-top: -0.25rem;
|
|
113
|
+
padding-bottom: var(--space-2xs);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* === Date Form Field === */
|
|
117
|
+
.dateFormField {
|
|
118
|
+
background-color: var(--field-bg);
|
|
119
|
+
border: 1px solid var(--field-border);
|
|
120
|
+
border-radius: var(--radius-field);
|
|
121
|
+
padding: var(--space-sm-plus) var(--field-padding-x);
|
|
122
|
+
color: var(--field-text);
|
|
123
|
+
font-size: var(--typography-small-size);
|
|
124
|
+
width: 100%;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.dateFormField:focus {
|
|
128
|
+
outline: none;
|
|
129
|
+
border-color: var(--field-border-focus);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* === Info Icon (tooltip trigger) === */
|
|
133
|
+
.infoIcon {
|
|
134
|
+
display: inline-flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
margin-left: var(--space-2xs);
|
|
137
|
+
color: var(--text-auxiliary);
|
|
138
|
+
cursor: help;
|
|
139
|
+
vertical-align: middle;
|
|
140
|
+
background: none;
|
|
141
|
+
border: none;
|
|
142
|
+
padding: 0;
|
|
143
|
+
line-height: 1;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.infoIcon:hover,
|
|
147
|
+
.infoIcon:focus-visible {
|
|
148
|
+
color: var(--dynamic-form-field-tertiary-500, var(--color-tertiary-500));
|
|
149
|
+
outline: none;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* === Narrowing Hint (shown when parent field can narrow this field's options) === */
|
|
153
|
+
.narrowingHint {
|
|
154
|
+
display: block;
|
|
155
|
+
width: 100%;
|
|
156
|
+
color: var(--text-auxiliary);
|
|
157
|
+
font-size: var(--typography-small-size);
|
|
158
|
+
font-style: italic;
|
|
159
|
+
margin-bottom: var(--space-2xs);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* === Tooltip Content (ensure it appears above form fields) === */
|
|
163
|
+
.tooltipContent {
|
|
164
|
+
z-index: var(--layer-tooltip);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/* All tokens used above (--text-secondary, --text-auxiliary, --input-*,
|
|
168
|
+
--intent-danger-*) are semantic and auto-switch in dark mode. */
|
|
169
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PropertyShapeWire, NodeShapeWire } from '@_linked/core/shapes/nodeShapeWire';
|
|
2
|
+
import { type CodeUsageData, type PropertyUsageData } from '../shape/propertyVisibility.js';
|
|
3
|
+
interface EditInstanceFormsProps {
|
|
4
|
+
of: Record<string, any>;
|
|
5
|
+
onSave?: (data: Record<string, any>) => Promise<void>;
|
|
6
|
+
onCancel?: () => void;
|
|
7
|
+
shape: NodeShapeWire;
|
|
8
|
+
properties: Record<string, PropertyShapeWire>;
|
|
9
|
+
allShapes?: Record<string, NodeShapeWire>;
|
|
10
|
+
projectId?: string;
|
|
11
|
+
propertyUsage?: Record<string, PropertyUsageData> | null;
|
|
12
|
+
codeUsage?: Record<string, CodeUsageData> | null;
|
|
13
|
+
}
|
|
14
|
+
declare function EditInstanceForms({ of, onSave, onCancel, shape, properties, allShapes, projectId, propertyUsage, codeUsage, }: EditInstanceFormsProps): import("react").JSX.Element;
|
|
15
|
+
export default EditInstanceForms;
|