@happyvertical/smrt-fields 0.60.15 → 0.60.17
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/smrt-knowledge.json +3 -3
- package/dist/svelte/components/FieldInput.svelte +11 -2
- package/dist/svelte/components/FieldPolicyControlPanel.svelte +45 -15
- package/dist/svelte/components/FieldPolicyEditor.svelte +49 -15
- package/dist/svelte/components/FieldPolicyGearButton.svelte +14 -2
- package/dist/svelte/components/FieldPolicyGearProvider.svelte +16 -4
- package/dist/svelte/components/FieldPolicySuggestionQueue.svelte +55 -14
- package/dist/svelte/components/FormHelp.svelte +48 -44
- package/dist/svelte/components/ObjectForm.svelte +37 -10
- package/dist/svelte/components/PolicyField.svelte +18 -13
- package/dist/svelte/playground/FieldPolicyFormPreview.svelte +31 -31
- package/dist/svelte/playground/ObjectFormPreview.svelte +21 -5
- package/package.json +10 -10
package/dist/manifest.json
CHANGED
package/dist/smrt-knowledge.json
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"sensitiveFieldsExcluded": true,
|
|
4
4
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
5
5
|
"packageName": "@happyvertical/smrt-fields",
|
|
6
|
-
"packageVersion": "0.60.
|
|
6
|
+
"packageVersion": "0.60.17",
|
|
7
7
|
"sourceManifestPath": "dist/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
10
|
+
"manifest": "88f8fff4453f5c9256a078a36a25c91fb92dd2696a26e5aa336cf0878e9d1951",
|
|
11
|
+
"packageJson": "4e95036fbda083e4eaa807f9515a8edf26043c558ee57ba72df19a2c506b9430",
|
|
12
12
|
"agents": "ae4bf7b69ae3b28a7900b590dd21b53ea0dfc5fd6778f858ceac97dfd8654187"
|
|
13
13
|
},
|
|
14
14
|
"exports": [
|
|
@@ -121,7 +121,7 @@ function setDateTime(event: Event): void {
|
|
|
121
121
|
oninput={setJson}
|
|
122
122
|
/>
|
|
123
123
|
{#if jsonError}
|
|
124
|
-
<p id={`${id}-json-error`} class="field-input__error"
|
|
124
|
+
<p id={`${id}-json-error`} class="smrt-field-input__error" role="alert" data-smrt-component="FieldInput">{jsonError}</p>
|
|
125
125
|
{/if}
|
|
126
126
|
{:else if field.definition.type === 'integer' || field.definition.type === 'decimal'}
|
|
127
127
|
<Input
|
|
@@ -158,7 +158,16 @@ function setDateTime(event: Event): void {
|
|
|
158
158
|
|
|
159
159
|
<style>
|
|
160
160
|
@layer smrt.reset, smrt.structure, smrt.theme;
|
|
161
|
+
@layer smrt.structure {
|
|
162
|
+
.smrt-field-input__error {
|
|
163
|
+
margin: 0;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
161
167
|
@layer smrt.theme {
|
|
162
|
-
.field-input__error {
|
|
168
|
+
.smrt-field-input__error {
|
|
169
|
+
color: var(--smrt-color-error);
|
|
170
|
+
}
|
|
163
171
|
}
|
|
172
|
+
|
|
164
173
|
</style>
|
|
@@ -223,19 +223,19 @@ async function suggestionChanged(): Promise<void> {
|
|
|
223
223
|
</script>
|
|
224
224
|
|
|
225
225
|
{#if canManage}
|
|
226
|
-
<section class="field-policy-control-
|
|
226
|
+
<section class="smrt-field-policy-control-panel__root" aria-label={heading} data-smrt-component="FieldPolicyControlPanel">
|
|
227
227
|
<header>
|
|
228
228
|
<h1>{heading}</h1>
|
|
229
229
|
<p>Manage inherited defaults, visibility, help, labels, order, and locks for every registered field.</p>
|
|
230
230
|
</header>
|
|
231
|
-
{#if error}<p class="field-policy-control-panel__error" role="alert">{error}</p>{/if}
|
|
231
|
+
{#if error}<p class="smrt-field-policy-control-panel__error" data-smrt-part="error" role="alert">{error}</p>{/if}
|
|
232
232
|
<Catalog page={decoratedPage} {baseUrl} {preservedParams} searchPlaceholder="Search fields">
|
|
233
233
|
{#snippet detail({ item }: { item: FieldPolicyDetailItem })}
|
|
234
234
|
{@const rollup = fieldPolicyRollup(visibleAudit, item.objectRef, item.fieldName)}
|
|
235
|
-
<article class="field-policy-control-panel__detail">
|
|
235
|
+
<article class="smrt-field-policy-control-panel__detail" data-smrt-part="body">
|
|
236
236
|
<h2>{rollup.resolved?.label ?? item.label}</h2>
|
|
237
237
|
<p>{rollup.resolved?.help ?? item.description ?? 'No help text.'}</p>
|
|
238
|
-
<dl class="field-policy-control-panel__layers">
|
|
238
|
+
<dl class="smrt-field-policy-control-panel__layers" data-smrt-part="group">
|
|
239
239
|
<div><dt>Code {rollup.code.contributed ? 'override' : 'inherited'}</dt><dd><code>{valueText(rollup.code)}</code> · {rollup.code.visibility}{rollup.code.locked ? ' · locked' : ''}</dd></div>
|
|
240
240
|
<div><dt>App {rollup.app.contributed ? 'override' : 'inherited'}</dt><dd><code>{valueText(rollup.app)}</code> · {rollup.app.visibility}{rollup.app.locked ? ' · locked' : ''}</dd></div>
|
|
241
241
|
<div><dt>Organization {rollup.org.contributed ? 'override' : 'inherited'}</dt><dd><code>{valueText(rollup.org)}</code> · {rollup.org.visibility}{rollup.org.locked ? ' · locked' : ''}</dd></div>
|
|
@@ -243,7 +243,7 @@ async function suggestionChanged(): Promise<void> {
|
|
|
243
243
|
</dl>
|
|
244
244
|
{#if rollup.orgRow}<p>Organization row last changed {rollup.orgRow.updatedAt ?? 'unknown'}{rollup.orgRow.updatedBy ? ` by ${rollup.orgRow.updatedBy}` : ''}.</p>{/if}
|
|
245
245
|
{#if rollup.appRow}<p>App row is read-only{rollup.appRow.updatedBy ? ` (last changed by ${rollup.appRow.updatedBy})` : ''}.</p>{/if}
|
|
246
|
-
<div class="field-policy-control-panel__actions">
|
|
246
|
+
<div class="smrt-field-policy-control-panel__actions" data-smrt-part="actions">
|
|
247
247
|
<Button type="button" disabled={busy || loadingEditor || !editorState} onclick={() => editorOpen = true}>Edit settings</Button>
|
|
248
248
|
<Button type="button" variant="ghost" disabled={busy || orgRowIdsForObject(visibleAudit, item.objectRef).length === 0} onclick={resetOrganization}>Reset all organization overrides for this object</Button>
|
|
249
249
|
</div>
|
|
@@ -267,7 +267,7 @@ async function suggestionChanged(): Promise<void> {
|
|
|
267
267
|
/>
|
|
268
268
|
{/if}
|
|
269
269
|
{#if prunableDriftRows(visibleAudit).length}
|
|
270
|
-
<section class="field-policy-control-panel__drift" aria-label="Manifest drift">
|
|
270
|
+
<section class="smrt-field-policy-control-panel__drift" data-smrt-part="group" aria-label="Manifest drift">
|
|
271
271
|
<h2>Manifest drift</h2>
|
|
272
272
|
<p>These policy rows no longer match a registered field and are ignored by the resolver.</p>
|
|
273
273
|
<ul>
|
|
@@ -282,15 +282,45 @@ async function suggestionChanged(): Promise<void> {
|
|
|
282
282
|
|
|
283
283
|
<style>
|
|
284
284
|
@layer smrt.reset, smrt.structure, smrt.theme;
|
|
285
|
+
@layer smrt.structure {
|
|
286
|
+
.smrt-field-policy-control-panel__root {
|
|
287
|
+
display: grid;
|
|
288
|
+
gap: var(--smrt-spacing-4);
|
|
289
|
+
}
|
|
290
|
+
.smrt-field-policy-control-panel__layers {
|
|
291
|
+
display: grid;
|
|
292
|
+
gap: var(--smrt-spacing-2);
|
|
293
|
+
}
|
|
294
|
+
.smrt-field-policy-control-panel__layers div {
|
|
295
|
+
display: grid;
|
|
296
|
+
grid-template-columns: 10rem minmax(0, 1fr);
|
|
297
|
+
gap: var(--smrt-spacing-2);
|
|
298
|
+
}
|
|
299
|
+
.smrt-field-policy-control-panel__layers dd {
|
|
300
|
+
margin: 0;
|
|
301
|
+
}
|
|
302
|
+
.smrt-field-policy-control-panel__actions {
|
|
303
|
+
display: flex;
|
|
304
|
+
flex-wrap: wrap;
|
|
305
|
+
gap: var(--smrt-spacing-2);
|
|
306
|
+
}
|
|
307
|
+
.smrt-field-policy-control-panel__drift ul {
|
|
308
|
+
display: grid;
|
|
309
|
+
gap: var(--smrt-spacing-2);
|
|
310
|
+
padding-inline-start: var(--smrt-spacing-5);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
285
314
|
@layer smrt.theme {
|
|
286
|
-
.field-policy-control-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
.field-policy-control-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
.field-policy-control-panel__layers
|
|
293
|
-
|
|
294
|
-
|
|
315
|
+
.smrt-field-policy-control-panel__root header p, .smrt-field-policy-control-panel__detail > p {
|
|
316
|
+
color: var(--smrt-color-on-surface-variant);
|
|
317
|
+
}
|
|
318
|
+
.smrt-field-policy-control-panel__error {
|
|
319
|
+
color: var(--smrt-color-error);
|
|
320
|
+
}
|
|
321
|
+
.smrt-field-policy-control-panel__layers dt {
|
|
322
|
+
font-weight: 600;
|
|
323
|
+
}
|
|
295
324
|
}
|
|
325
|
+
|
|
296
326
|
</style>
|
|
@@ -291,10 +291,10 @@ async function reset(fieldName: string): Promise<void> {
|
|
|
291
291
|
</script>
|
|
292
292
|
|
|
293
293
|
<Modal open={true} onClose={onclose} title="Field settings" size="xl" ariaDescribedBy="field-policy-editor-description">
|
|
294
|
-
<div class="field-policy-
|
|
294
|
+
<div class="smrt-field-policy-editor__root" data-smrt-part="body">
|
|
295
295
|
<p id="field-policy-editor-description">Overrides are sparse. Reset removes this scope’s row and inherits the effective policy.</p>
|
|
296
296
|
|
|
297
|
-
<div class="field-policy-editor__tabs" role="tablist" aria-label="Field policy scope">
|
|
297
|
+
<div class="smrt-field-policy-editor__tabs" data-smrt-part="list" role="tablist" aria-label="Field policy scope">
|
|
298
298
|
{#if editorState.capabilities.manage}
|
|
299
299
|
<Button
|
|
300
300
|
type="button"
|
|
@@ -326,7 +326,7 @@ async function reset(fieldName: string): Promise<void> {
|
|
|
326
326
|
</div>
|
|
327
327
|
|
|
328
328
|
{#if error}
|
|
329
|
-
<p class="field-policy-editor__error" role="alert">{error}</p>
|
|
329
|
+
<p class="smrt-field-policy-editor__error" data-smrt-part="error" role="alert">{error}</p>
|
|
330
330
|
{/if}
|
|
331
331
|
|
|
332
332
|
<div
|
|
@@ -340,13 +340,13 @@ async function reset(fieldName: string): Promise<void> {
|
|
|
340
340
|
{@const defaultScope = scope}
|
|
341
341
|
{@const draft = draftFor(fieldName)}
|
|
342
342
|
{@const InputComponent = inputFor(fieldName)}
|
|
343
|
-
<fieldset class="field-policy-editor__field" disabled={userLocked(fieldName) || saving === fieldName}>
|
|
343
|
+
<fieldset class="smrt-field-policy-editor__field" data-smrt-part="field" disabled={userLocked(fieldName) || saving === fieldName}>
|
|
344
344
|
<legend>{policyField.label ?? fieldName}</legend>
|
|
345
345
|
{#if userLocked(fieldName)}
|
|
346
|
-
<p class="field-policy-editor__notice">This field is locked by your organization and cannot be personalized.</p>
|
|
346
|
+
<p class="smrt-field-policy-editor__notice" data-smrt-part="meta">This field is locked by your organization and cannot be personalized.</p>
|
|
347
347
|
{/if}
|
|
348
348
|
{#if policyField.required}
|
|
349
|
-
<p id={`${fieldName}-required-invariant`} class="field-policy-editor__notice">
|
|
349
|
+
<p id={`${fieldName}-required-invariant`} class="smrt-field-policy-editor__notice" data-smrt-part="meta">
|
|
350
350
|
Required fields without a usable default must remain Basic.
|
|
351
351
|
</p>
|
|
352
352
|
{/if}
|
|
@@ -364,7 +364,7 @@ async function reset(fieldName: string): Promise<void> {
|
|
|
364
364
|
</Select>
|
|
365
365
|
</label>
|
|
366
366
|
{#if invalidRequiredDemotion(fieldName)}
|
|
367
|
-
<p class="field-policy-editor__error" role="status">Add a usable default before making this required field advanced or hidden.</p>
|
|
367
|
+
<p class="smrt-field-policy-editor__error" data-smrt-part="error" role="status">Add a usable default before making this required field advanced or hidden.</p>
|
|
368
368
|
{/if}
|
|
369
369
|
<Toggle
|
|
370
370
|
checked={draft.defaultEnabled}
|
|
@@ -390,7 +390,7 @@ async function reset(fieldName: string): Promise<void> {
|
|
|
390
390
|
/>
|
|
391
391
|
{/key}
|
|
392
392
|
{#if defaultSerializationError(fieldName)}
|
|
393
|
-
<p class="field-policy-editor__error" role="status">
|
|
393
|
+
<p class="smrt-field-policy-editor__error" data-smrt-part="error" role="status">
|
|
394
394
|
{defaultSerializationError(fieldName)}
|
|
395
395
|
</p>
|
|
396
396
|
{/if}
|
|
@@ -402,7 +402,7 @@ async function reset(fieldName: string): Promise<void> {
|
|
|
402
402
|
<Toggle checked={draft.locked === true} ariaLabel={`Lock ${policyField.label ?? fieldName}`} onchange={(value) => setDraft(fieldName, { locked: value ? true : null })} />
|
|
403
403
|
<span>Lock personal overrides</span>
|
|
404
404
|
{/if}
|
|
405
|
-
<div class="field-policy-editor__actions">
|
|
405
|
+
<div class="smrt-field-policy-editor__actions" data-smrt-part="actions">
|
|
406
406
|
<Button type="button" onclick={() => save(fieldName)} disabled={invalidRequiredDemotion(fieldName) || !!defaultSerializationError(fieldName)}>{saving === fieldName ? 'Saving…' : 'Save'}</Button>
|
|
407
407
|
{#if rowForScope(editorState, fieldName, scope)}
|
|
408
408
|
<Button type="button" variant="ghost" onclick={() => reset(fieldName)}>Reset to inherited</Button>
|
|
@@ -416,12 +416,46 @@ async function reset(fieldName: string): Promise<void> {
|
|
|
416
416
|
|
|
417
417
|
<style>
|
|
418
418
|
@layer smrt.reset, smrt.structure, smrt.theme;
|
|
419
|
+
@layer smrt.structure {
|
|
420
|
+
.smrt-field-policy-editor__root {
|
|
421
|
+
display: grid;
|
|
422
|
+
gap: var(--smrt-spacing-4, 1rem);
|
|
423
|
+
max-block-size: min(90vh, 56rem);
|
|
424
|
+
overflow: auto;
|
|
425
|
+
padding: var(--smrt-spacing-5, 1.25rem);
|
|
426
|
+
}
|
|
427
|
+
.smrt-field-policy-editor__actions, .smrt-field-policy-editor__tabs {
|
|
428
|
+
align-items: center;
|
|
429
|
+
display: flex;
|
|
430
|
+
gap: var(--smrt-spacing-2, .5rem);
|
|
431
|
+
justify-content: space-between;
|
|
432
|
+
}
|
|
433
|
+
.smrt-field-policy-editor__field {
|
|
434
|
+
display: grid;
|
|
435
|
+
gap: var(--smrt-spacing-3, .75rem);
|
|
436
|
+
margin: 0 0 var(--smrt-spacing-3, .75rem);
|
|
437
|
+
padding: var(--smrt-spacing-3, .75rem);
|
|
438
|
+
}
|
|
439
|
+
.smrt-field-policy-editor__field label {
|
|
440
|
+
display: grid;
|
|
441
|
+
gap: var(--smrt-spacing-1, .25rem);
|
|
442
|
+
}
|
|
443
|
+
.smrt-field-policy-editor__notice {
|
|
444
|
+
margin: 0;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
419
448
|
@layer smrt.theme {
|
|
420
|
-
.field-policy-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
.field-policy-
|
|
425
|
-
|
|
449
|
+
.smrt-field-policy-editor__root {
|
|
450
|
+
background: var(--smrt-color-surface, white);
|
|
451
|
+
color: var(--smrt-color-on-surface);
|
|
452
|
+
}
|
|
453
|
+
.smrt-field-policy-editor__field {
|
|
454
|
+
border: var(--smrt-hairline-strong);
|
|
455
|
+
}
|
|
456
|
+
.smrt-field-policy-editor__error {
|
|
457
|
+
color: var(--smrt-color-error);
|
|
458
|
+
}
|
|
426
459
|
}
|
|
460
|
+
|
|
427
461
|
</style>
|
|
@@ -14,14 +14,26 @@ const gear = getFieldPolicyGearContext();
|
|
|
14
14
|
<span aria-hidden="true">⚙</span>
|
|
15
15
|
<span>{label}</span>
|
|
16
16
|
{#if gear.pendingSuggestionCount > 0}
|
|
17
|
-
<span class="field-policy-gear-button__badge" aria-hidden="true">{gear.pendingSuggestionCount}</span>
|
|
17
|
+
<span class="smrt-field-policy-gear-button__badge" data-smrt-part="count" aria-hidden="true">{gear.pendingSuggestionCount}</span>
|
|
18
18
|
{/if}
|
|
19
19
|
</Button>
|
|
20
20
|
{/if}
|
|
21
21
|
|
|
22
22
|
<style>
|
|
23
23
|
@layer smrt.reset, smrt.structure, smrt.theme;
|
|
24
|
+
@layer smrt.structure {
|
|
25
|
+
.smrt-field-policy-gear-button__badge {
|
|
26
|
+
min-inline-size: 1.25rem;
|
|
27
|
+
padding-inline: 0.25rem;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
24
31
|
@layer smrt.theme {
|
|
25
|
-
.field-policy-gear-button__badge {
|
|
32
|
+
.smrt-field-policy-gear-button__badge {
|
|
33
|
+
border-radius: 999px;
|
|
34
|
+
background: var(--smrt-color-secondary-container);
|
|
35
|
+
text-align: center;
|
|
36
|
+
}
|
|
26
37
|
}
|
|
38
|
+
|
|
27
39
|
</style>
|
|
@@ -158,19 +158,31 @@ $effect(() => {
|
|
|
158
158
|
|
|
159
159
|
{@render children?.()}
|
|
160
160
|
{#if error && !open}
|
|
161
|
-
<p class="field-policy-
|
|
161
|
+
<p class="smrt-field-policy-gear-provider__error" role="alert" data-smrt-component="FieldPolicyGearProvider">{error}</p>
|
|
162
162
|
{/if}
|
|
163
163
|
{#if open && editorState}
|
|
164
164
|
<FieldPolicyEditor state={editorState} {adapter} {fields} {inputRegistry} {organizationScope} onclose={() => controller.hide()} onmutated={reload} />
|
|
165
165
|
{/if}
|
|
166
166
|
{#if loading}
|
|
167
|
-
<span class="field-policy-
|
|
167
|
+
<span class="smrt-field-policy-gear-provider__loading" aria-live="polite" data-smrt-component="FieldPolicyGearProvider">Loading field settings…</span>
|
|
168
168
|
{/if}
|
|
169
169
|
|
|
170
170
|
<style>
|
|
171
171
|
@layer smrt.reset, smrt.structure, smrt.theme;
|
|
172
|
+
@layer smrt.structure {
|
|
173
|
+
.smrt-field-policy-gear-provider__loading {
|
|
174
|
+
position: absolute;
|
|
175
|
+
inline-size: 1px;
|
|
176
|
+
block-size: 1px;
|
|
177
|
+
overflow: hidden;
|
|
178
|
+
clip-path: inset(50%);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
172
182
|
@layer smrt.theme {
|
|
173
|
-
.field-policy-
|
|
174
|
-
|
|
183
|
+
.smrt-field-policy-gear-provider__error {
|
|
184
|
+
color: var(--smrt-color-error);
|
|
185
|
+
}
|
|
175
186
|
}
|
|
187
|
+
|
|
176
188
|
</style>
|
|
@@ -97,10 +97,10 @@ function description(suggestion: FieldPolicySuggestion): string {
|
|
|
97
97
|
}
|
|
98
98
|
</script>
|
|
99
99
|
|
|
100
|
-
<section class="field-policy-suggestion-
|
|
101
|
-
<header>
|
|
100
|
+
<section class="smrt-field-policy-suggestion-queue__root" aria-label={heading} data-smrt-component="FieldPolicySuggestionQueue">
|
|
101
|
+
<header data-smrt-part="header">
|
|
102
102
|
<h2>{heading}</h2>
|
|
103
|
-
{#if !loading}<span class="field-policy-suggestion-queue__count">{total}</span>{/if}
|
|
103
|
+
{#if !loading}<span class="smrt-field-policy-suggestion-queue__count" data-smrt-part="count">{total}</span>{/if}
|
|
104
104
|
</header>
|
|
105
105
|
{#if loading}
|
|
106
106
|
<p role="status" aria-live="polite">Loading pending suggestions…</p>
|
|
@@ -109,14 +109,14 @@ function description(suggestion: FieldPolicySuggestion): string {
|
|
|
109
109
|
{:else if suggestions.length === 0}
|
|
110
110
|
<p>No pending field suggestions.</p>
|
|
111
111
|
{:else}
|
|
112
|
-
<ul>
|
|
112
|
+
<ul data-smrt-part="list">
|
|
113
113
|
{#each suggestions as suggestion (suggestion.id)}
|
|
114
|
-
<li>
|
|
114
|
+
<li data-smrt-part="row">
|
|
115
115
|
<article>
|
|
116
116
|
<h3>{suggestion.objectRef} · {suggestion.fieldName}</h3>
|
|
117
117
|
<p>{description(suggestion)}</p>
|
|
118
118
|
<p>{fieldPolicySuggestionEvidence(suggestion)}</p>
|
|
119
|
-
<div class="field-policy-suggestion-queue__actions">
|
|
119
|
+
<div class="smrt-field-policy-suggestion-queue__actions" data-smrt-part="actions">
|
|
120
120
|
<Button type="button" disabled={busyId !== null} onclick={() => decide(suggestion, 'approve')}>Approve</Button>
|
|
121
121
|
<Button type="button" variant="ghost" disabled={busyId !== null} onclick={() => decide(suggestion, 'dismiss')}>Dismiss</Button>
|
|
122
122
|
</div>
|
|
@@ -129,14 +129,55 @@ function description(suggestion: FieldPolicySuggestion): string {
|
|
|
129
129
|
|
|
130
130
|
<style>
|
|
131
131
|
@layer smrt.reset, smrt.structure, smrt.theme;
|
|
132
|
+
@layer smrt.structure {
|
|
133
|
+
.smrt-field-policy-suggestion-queue__root {
|
|
134
|
+
display: grid;
|
|
135
|
+
gap: var(--smrt-spacing-3, 0.75rem);
|
|
136
|
+
}
|
|
137
|
+
.smrt-field-policy-suggestion-queue__root header {
|
|
138
|
+
align-items: center;
|
|
139
|
+
display: flex;
|
|
140
|
+
gap: var(--smrt-spacing-2, 0.5rem);
|
|
141
|
+
}
|
|
142
|
+
.smrt-field-policy-suggestion-queue__root h2, .smrt-field-policy-suggestion-queue__root h3 {
|
|
143
|
+
margin: 0;
|
|
144
|
+
}
|
|
145
|
+
.smrt-field-policy-suggestion-queue__count {
|
|
146
|
+
min-inline-size: 1.5rem;
|
|
147
|
+
padding: 0.125rem 0.4rem;
|
|
148
|
+
}
|
|
149
|
+
.smrt-field-policy-suggestion-queue__root ul {
|
|
150
|
+
display: grid;
|
|
151
|
+
gap: var(--smrt-spacing-3, 0.75rem);
|
|
152
|
+
list-style: none;
|
|
153
|
+
margin: 0;
|
|
154
|
+
padding: 0;
|
|
155
|
+
}
|
|
156
|
+
.smrt-field-policy-suggestion-queue__root article {
|
|
157
|
+
display: grid;
|
|
158
|
+
gap: var(--smrt-spacing-2, 0.5rem);
|
|
159
|
+
padding: var(--smrt-spacing-3, 0.75rem);
|
|
160
|
+
}
|
|
161
|
+
.smrt-field-policy-suggestion-queue__root article p {
|
|
162
|
+
margin: 0;
|
|
163
|
+
}
|
|
164
|
+
.smrt-field-policy-suggestion-queue__actions {
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-wrap: wrap;
|
|
167
|
+
gap: var(--smrt-spacing-2, 0.5rem);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
132
171
|
@layer smrt.theme {
|
|
133
|
-
.field-policy-suggestion-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
.field-policy-suggestion-
|
|
139
|
-
|
|
140
|
-
|
|
172
|
+
.smrt-field-policy-suggestion-queue__count {
|
|
173
|
+
border-radius: 999px;
|
|
174
|
+
background: var(--smrt-color-secondary-container);
|
|
175
|
+
text-align: center;
|
|
176
|
+
}
|
|
177
|
+
.smrt-field-policy-suggestion-queue__root article {
|
|
178
|
+
border: var(--smrt-hairline);
|
|
179
|
+
border-radius: var(--smrt-radius-small, 0.25rem);
|
|
180
|
+
}
|
|
141
181
|
}
|
|
182
|
+
|
|
142
183
|
</style>
|
|
@@ -79,97 +79,101 @@ const glossary = $derived.by(() => {
|
|
|
79
79
|
});
|
|
80
80
|
</script>
|
|
81
81
|
|
|
82
|
-
<details class="form-
|
|
83
|
-
<summary class="form-help__toggle">
|
|
84
|
-
<span class="form-help__icon" aria-hidden="true">?</span>
|
|
85
|
-
<span class="form-help__label">{label}</span>
|
|
82
|
+
<details class="smrt-form-help__root {className}" data-smrt-component="FormHelp">
|
|
83
|
+
<summary class="smrt-form-help__toggle" data-smrt-part="trigger">
|
|
84
|
+
<span class="smrt-form-help__icon" data-smrt-part="icon" aria-hidden="true">?</span>
|
|
85
|
+
<span class="smrt-form-help__label" data-smrt-part="label">{label}</span>
|
|
86
86
|
</summary>
|
|
87
|
-
<div class="form-help__panel">
|
|
87
|
+
<div class="smrt-form-help__panel" data-smrt-part="panel">
|
|
88
88
|
{#if objectDescription}
|
|
89
|
-
<p class="form-help__description">{objectDescription}</p>
|
|
89
|
+
<p class="smrt-form-help__description" data-smrt-part="meta">{objectDescription}</p>
|
|
90
90
|
{/if}
|
|
91
91
|
{#if glossary.length > 0}
|
|
92
|
-
<dl class="form-help__glossary">
|
|
92
|
+
<dl class="smrt-form-help__glossary" data-smrt-part="list">
|
|
93
93
|
{#each glossary as entry}
|
|
94
|
-
<dt class="form-help__term">{entry.label}</dt>
|
|
95
|
-
<dd class="form-help__definition">{entry.help}</dd>
|
|
94
|
+
<dt class="smrt-form-help__term" data-smrt-part="label">{entry.label}</dt>
|
|
95
|
+
<dd class="smrt-form-help__definition" data-smrt-part="value">{entry.help}</dd>
|
|
96
96
|
{/each}
|
|
97
97
|
</dl>
|
|
98
98
|
{:else}
|
|
99
|
-
<p class="form-help__empty">No field help available.</p>
|
|
99
|
+
<p class="smrt-form-help__empty" data-smrt-part="empty">No field help available.</p>
|
|
100
100
|
{/if}
|
|
101
101
|
</div>
|
|
102
102
|
</details>
|
|
103
103
|
|
|
104
104
|
<style>
|
|
105
105
|
@layer smrt.reset, smrt.structure, smrt.theme;
|
|
106
|
-
@layer smrt.
|
|
107
|
-
.form-
|
|
106
|
+
@layer smrt.structure {
|
|
107
|
+
.smrt-form-help__root {
|
|
108
108
|
display: inline-block;
|
|
109
109
|
}
|
|
110
|
-
|
|
111
|
-
.form-help__toggle {
|
|
110
|
+
.smrt-form-help__toggle {
|
|
112
111
|
display: inline-flex;
|
|
113
112
|
align-items: center;
|
|
114
113
|
gap: var(--smrt-spacing-1, 0.25rem);
|
|
115
114
|
cursor: pointer;
|
|
116
115
|
list-style: none;
|
|
117
|
-
font: var(--smrt-typography-label-medium-font, inherit);
|
|
118
|
-
color: var(--smrt-color-on-surface-variant, currentColor);
|
|
119
116
|
}
|
|
120
|
-
|
|
121
|
-
.form-help__toggle::-webkit-details-marker {
|
|
117
|
+
.smrt-form-help__toggle::-webkit-details-marker {
|
|
122
118
|
display: none;
|
|
123
119
|
}
|
|
124
|
-
|
|
125
|
-
.form-help__toggle:focus-visible {
|
|
126
|
-
outline: 2px solid var(--smrt-color-primary);
|
|
127
|
-
outline-offset: 2px;
|
|
128
|
-
border-radius: var(--smrt-radius-sm);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.form-help__icon {
|
|
120
|
+
.smrt-form-help__icon {
|
|
132
121
|
display: inline-flex;
|
|
133
122
|
align-items: center;
|
|
134
123
|
justify-content: center;
|
|
135
124
|
width: 1.25em;
|
|
136
125
|
height: 1.25em;
|
|
137
|
-
border-radius: 50%;
|
|
138
|
-
border: 1px solid currentColor;
|
|
139
|
-
font: var(--smrt-typography-label-small-font, inherit);
|
|
140
|
-
line-height: 1;
|
|
141
126
|
}
|
|
142
|
-
|
|
143
|
-
.form-help__panel {
|
|
127
|
+
.smrt-form-help__panel {
|
|
144
128
|
padding: var(--smrt-spacing-3, 0.75rem) 0;
|
|
145
|
-
color: var(--smrt-color-on-surface, currentColor);
|
|
146
129
|
}
|
|
147
|
-
|
|
148
|
-
.form-help__description {
|
|
130
|
+
.smrt-form-help__description {
|
|
149
131
|
margin: 0 0 var(--smrt-spacing-2, 0.5rem);
|
|
150
|
-
font: var(--smrt-typography-body-medium-font, inherit);
|
|
151
132
|
}
|
|
152
|
-
|
|
153
|
-
.form-help__glossary {
|
|
133
|
+
.smrt-form-help__glossary {
|
|
154
134
|
margin: 0;
|
|
155
135
|
display: grid;
|
|
156
136
|
gap: var(--smrt-spacing-1, 0.25rem);
|
|
157
137
|
}
|
|
138
|
+
.smrt-form-help__definition {
|
|
139
|
+
margin: 0 0 var(--smrt-spacing-2, 0.5rem);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
158
142
|
|
|
159
|
-
|
|
143
|
+
@layer smrt.theme {
|
|
144
|
+
.smrt-form-help__toggle {
|
|
145
|
+
font: var(--smrt-typography-label-medium-font, inherit);
|
|
146
|
+
color: var(--smrt-color-on-surface-variant, currentColor);
|
|
147
|
+
}
|
|
148
|
+
.smrt-form-help__toggle:focus-visible {
|
|
149
|
+
outline: 2px solid var(--smrt-color-primary);
|
|
150
|
+
outline-offset: 2px;
|
|
151
|
+
border-radius: var(--smrt-radius-sm);
|
|
152
|
+
}
|
|
153
|
+
.smrt-form-help__icon {
|
|
154
|
+
border-radius: 50%;
|
|
155
|
+
border: 1px solid currentColor;
|
|
156
|
+
font: var(--smrt-typography-label-small-font, inherit);
|
|
157
|
+
line-height: 1;
|
|
158
|
+
}
|
|
159
|
+
.smrt-form-help__panel {
|
|
160
|
+
color: var(--smrt-color-on-surface, currentColor);
|
|
161
|
+
}
|
|
162
|
+
.smrt-form-help__description {
|
|
163
|
+
font: var(--smrt-typography-body-medium-font, inherit);
|
|
164
|
+
}
|
|
165
|
+
.smrt-form-help__term {
|
|
160
166
|
font: var(--smrt-typography-label-medium-font, inherit);
|
|
161
167
|
font-weight: 600;
|
|
162
168
|
}
|
|
163
|
-
|
|
164
|
-
.form-help__definition {
|
|
165
|
-
margin: 0 0 var(--smrt-spacing-2, 0.5rem);
|
|
169
|
+
.smrt-form-help__definition {
|
|
166
170
|
font: var(--smrt-typography-body-small-font, inherit);
|
|
167
171
|
color: var(--smrt-color-on-surface-variant, currentColor);
|
|
168
172
|
}
|
|
169
|
-
|
|
170
|
-
.form-help__empty {
|
|
173
|
+
.smrt-form-help__empty {
|
|
171
174
|
font: var(--smrt-typography-body-small-font, inherit);
|
|
172
175
|
color: var(--smrt-color-on-surface-variant, currentColor);
|
|
173
176
|
}
|
|
174
177
|
}
|
|
178
|
+
|
|
175
179
|
</style>
|
|
@@ -396,7 +396,7 @@ function inputFor(field: ObjectFormField): FieldInputComponent {
|
|
|
396
396
|
{#snippet renderGroups(groups: Array<[string | null, ObjectFormField[]]>)}
|
|
397
397
|
{#each groups as [groupName, groupFields] (groupName ?? '__ungrouped__')}
|
|
398
398
|
{#if groupName}
|
|
399
|
-
<fieldset class="object-form__group">
|
|
399
|
+
<fieldset class="smrt-object-form__group" data-smrt-part="group">
|
|
400
400
|
<legend>{groupName}</legend>
|
|
401
401
|
{#each groupFields as field (field.name)}
|
|
402
402
|
{@render renderField(field)}
|
|
@@ -411,17 +411,17 @@ function inputFor(field: ObjectFormField): FieldInputComponent {
|
|
|
411
411
|
{/snippet}
|
|
412
412
|
|
|
413
413
|
{#if sourceLoading}
|
|
414
|
-
<div class="object-form__status" role="status" aria-live="polite" data-smrt-component="ObjectForm">Loading form…</div>
|
|
414
|
+
<div class="smrt-object-form__status" role="status" aria-live="polite" data-smrt-component="ObjectForm">Loading form…</div>
|
|
415
415
|
{:else if sourceError}
|
|
416
|
-
<div class="object-form__status" role="alert" data-smrt-component="ObjectForm">{sourceError}</div>
|
|
416
|
+
<div class="smrt-object-form__status" role="alert" data-smrt-component="ObjectForm">{sourceError}</div>
|
|
417
417
|
{:else if resolvedPolicy}
|
|
418
418
|
<FieldPolicyProvider policy={resolvedPolicy}>
|
|
419
419
|
{#if showModeSwitch || (showPolicyGear && fieldPolicyGear)}
|
|
420
420
|
{#if showModeSwitch}
|
|
421
|
-
<div class="object-form__mode" data-smrt-component="ObjectForm"><ModeSwitch /></div>
|
|
421
|
+
<div class="smrt-object-form__mode" data-smrt-component="ObjectForm"><ModeSwitch /></div>
|
|
422
422
|
{/if}
|
|
423
423
|
{#if showPolicyGear && fieldPolicyGear}
|
|
424
|
-
<div class="object-form__gear" data-smrt-component="ObjectForm"><FieldPolicyGearButton /></div>
|
|
424
|
+
<div class="smrt-object-form__gear" data-smrt-component="ObjectForm"><FieldPolicyGearButton /></div>
|
|
425
425
|
{/if}
|
|
426
426
|
{/if}
|
|
427
427
|
<Form class="object-form {className}" onsubmit={handleSubmit}>
|
|
@@ -438,11 +438,38 @@ function inputFor(field: ObjectFormField): FieldInputComponent {
|
|
|
438
438
|
|
|
439
439
|
<style>
|
|
440
440
|
@layer smrt.reset, smrt.structure, smrt.theme;
|
|
441
|
+
@layer smrt.structure {
|
|
442
|
+
:global(.object-form) {
|
|
443
|
+
display: grid;
|
|
444
|
+
gap: var(--smrt-spacing-4, 1rem);
|
|
445
|
+
}
|
|
446
|
+
.smrt-object-form__mode, .smrt-object-form__gear {
|
|
447
|
+
display: inline-flex;
|
|
448
|
+
justify-content: flex-end;
|
|
449
|
+
margin-bottom: var(--smrt-spacing-3, 0.75rem);
|
|
450
|
+
}
|
|
451
|
+
.smrt-object-form__group {
|
|
452
|
+
display: grid;
|
|
453
|
+
gap: var(--smrt-spacing-3, 0.75rem);
|
|
454
|
+
margin: 0;
|
|
455
|
+
min-inline-size: 0;
|
|
456
|
+
padding: 0;
|
|
457
|
+
}
|
|
458
|
+
.smrt-object-form__group legend {
|
|
459
|
+
margin-bottom: var(--smrt-spacing-2, 0.5rem);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
441
463
|
@layer smrt.theme {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
.object-form__group legend {
|
|
446
|
-
|
|
464
|
+
.smrt-object-form__group {
|
|
465
|
+
border: 0;
|
|
466
|
+
}
|
|
467
|
+
.smrt-object-form__group legend {
|
|
468
|
+
font: var(--smrt-typography-title-small-font, inherit);
|
|
469
|
+
}
|
|
470
|
+
.smrt-object-form__status {
|
|
471
|
+
color: var(--smrt-color-on-surface-variant, currentColor);
|
|
472
|
+
}
|
|
447
473
|
}
|
|
474
|
+
|
|
448
475
|
</style>
|