@aiaiai-pt/design-system 0.63.0 → 0.64.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.
@@ -415,6 +415,14 @@
415
415
  return String(parameter.source_field_path ?? parameter.key ?? "");
416
416
  }
417
417
 
418
+ /** atelier#2905 — the parameter's help line (`hint`: the form-surface.v1
419
+ * field summary's, already in the reader's language), shown under the field
420
+ * as its help text. Absent or blank → none. */
421
+ function parameterHelp(parameter: Entity): string | undefined {
422
+ const hint = parameter.hint;
423
+ return typeof hint === "string" && hint.trim() ? hint : undefined;
424
+ }
425
+
418
426
  function parameterType(parameter: Entity): string {
419
427
  return String(parameter.type ?? "string");
420
428
  }
@@ -848,6 +856,9 @@
848
856
  yet); `fieldError` is the per-field server-error binding. -->
849
857
  {@const fieldDisabled = parameter.disabled === true || parameter.loading === true}
850
858
  {@const fieldError = fieldErrors?.[key]}
859
+ <!-- atelier#2905 — the declared help line, on the field's own `help` slot
860
+ (an error, when there is one, takes that slot as before). -->
861
+ {@const fieldHelp = parameterHelp(parameter)}
851
862
  {#if kind === "currency"}
852
863
  <!-- #35 — money: the bag carries the RAW number ("" when empty — the
853
864
  number-field empty sentinel); formatting is display-only. -->
@@ -858,6 +869,7 @@
858
869
  readonly={!editable}
859
870
  disabled={fieldDisabled}
860
871
  error={fieldError}
872
+ help={fieldHelp}
861
873
  onchange={(amount: number | null) => setValue(key, amount === null ? "" : amount)}
862
874
  aria-required={ariaRequired}
863
875
  />
@@ -871,6 +883,7 @@
871
883
  readonly={!editable}
872
884
  disabled={fieldDisabled}
873
885
  error={fieldError}
886
+ help={fieldHelp}
874
887
  oninput={(event: Event) =>
875
888
  setValue(key, (event.target as HTMLTextAreaElement).value)}
876
889
  aria-required={ariaRequired}
@@ -886,6 +899,9 @@
886
899
  onchange={(checked: boolean) => setValue(key, checked)}
887
900
  aria-required={ariaRequired}
888
901
  />
902
+ <!-- The DS Toggle has no help slot: the line sits under it, in the
903
+ field-help style. -->
904
+ {#if fieldHelp}<span class="afr-param-help">{fieldHelp}</span>{/if}
889
905
  {:else if kind === "slug"}
890
906
  <!-- #36 — slug input-type refinement: machine-name typing affordances;
891
907
  the value stays whatever the operator types (validation is the
@@ -897,6 +913,7 @@
897
913
  readonly={!editable}
898
914
  disabled={fieldDisabled}
899
915
  error={fieldError}
916
+ help={fieldHelp}
900
917
  spellcheck="false"
901
918
  autocapitalize="none"
902
919
  autocorrect="off"
@@ -913,6 +930,7 @@
913
930
  readonly={!editable}
914
931
  disabled={fieldDisabled}
915
932
  error={fieldError}
933
+ help={fieldHelp}
916
934
  onchange={(value: unknown) => setValue(key, value)}
917
935
  oninvalid={(message: string | null) =>
918
936
  (jsonInvalid = { ...jsonInvalid, [key]: message })}
@@ -926,6 +944,7 @@
926
944
  readonly={!editable}
927
945
  disabled={fieldDisabled}
928
946
  error={fieldError}
947
+ help={fieldHelp}
929
948
  onchange={(date: Date | null) => setValue(key, date ? dateToDateOnly(date) : "")}
930
949
  />
931
950
  {:else if type === "enum" || type === "select" || enumOptions(parameter).length}
@@ -944,7 +963,7 @@
944
963
  ? loadingOptionsLabel
945
964
  : options.length === 0
946
965
  ? noOptionsLabel
947
- : undefined}
966
+ : fieldHelp}
948
967
  onchange={(value: string) => setValue(key, value)}
949
968
  aria-required={ariaRequired}
950
969
  />
@@ -957,6 +976,7 @@
957
976
  readonly={!editable}
958
977
  disabled={fieldDisabled}
959
978
  error={fieldError}
979
+ help={fieldHelp}
960
980
  oninput={(event: Event) => {
961
981
  const value = (event.target as HTMLInputElement).value;
962
982
  setValue(key, value === "" ? "" : Number(value));
@@ -974,6 +994,7 @@
974
994
  ]}
975
995
  disabled={fieldDisabled || !editable}
976
996
  error={fieldError}
997
+ help={fieldHelp}
977
998
  onchange={(value: string) => setValue(key, value === "true")}
978
999
  aria-required={ariaRequired}
979
1000
  />
@@ -987,6 +1008,7 @@
987
1008
  readonly={!editable}
988
1009
  disabled={fieldDisabled}
989
1010
  error={fieldError}
1011
+ help={fieldHelp}
990
1012
  onchange={(date: Date) => setValue(key, date.toISOString())}
991
1013
  />
992
1014
  {:else if isRelationshipParam(parameter)}
@@ -1014,6 +1036,7 @@
1014
1036
  disabled={!searchEntities || !editable || fieldDisabled}
1015
1037
  loading={(referenceLoading[key] ?? false) || parameter.loading === true}
1016
1038
  error={fieldError}
1039
+ help={fieldHelp}
1017
1040
  {noResultsLabel}
1018
1041
  {searchingLabel}
1019
1042
  requiredLabel={requiredLabel}
@@ -1030,6 +1053,7 @@
1030
1053
  disabled={!searchEntities || !editable || fieldDisabled}
1031
1054
  loading={(referenceLoading[key] ?? false) || parameter.loading === true}
1032
1055
  error={fieldError}
1056
+ help={fieldHelp}
1033
1057
  {noResultsLabel}
1034
1058
  {searchingLabel}
1035
1059
  onsearch={(query: string) => handleReferenceSearch(parameter, query)}
@@ -1095,6 +1119,8 @@
1095
1119
  <p class="afr-file-error" role="alert">{fileError[key]}</p>
1096
1120
  {:else if fieldError}
1097
1121
  <p class="afr-file-error" role="alert">{fieldError}</p>
1122
+ {:else if fieldHelp}
1123
+ <span class="afr-param-help">{fieldHelp}</span>
1098
1124
  {/if}
1099
1125
  </div>
1100
1126
  {:else if kind === "geometry"}
@@ -1126,6 +1152,7 @@
1126
1152
  {layers}
1127
1153
  {onoutofbounds}
1128
1154
  error={fieldError ?? plan.error ?? geoError}
1155
+ help={fieldHelp}
1129
1156
  label={String(parameter.label ?? key)}
1130
1157
  center={mapInitialCenter(parameter)}
1131
1158
  searchProviderUrl={geocoderFor(parameter)}
@@ -1140,6 +1167,7 @@
1140
1167
  {boundary}
1141
1168
  {layers}
1142
1169
  error={fieldError ?? plan.error ?? geoError}
1170
+ help={fieldHelp}
1143
1171
  label={String(parameter.label ?? key)}
1144
1172
  center={mapInitialCenter(parameter)}
1145
1173
  searchProviderUrl={geocoderFor(parameter)}
@@ -1162,6 +1190,7 @@
1162
1190
  {layers}
1163
1191
  {onoutofbounds}
1164
1192
  error={fieldError ?? geoError}
1193
+ help={fieldHelp}
1165
1194
  label={String(parameter.label ?? key)}
1166
1195
  center={mapInitialCenter(parameter) ??
1167
1196
  (Array.isArray(parameter.default_value)
@@ -1182,6 +1211,7 @@
1182
1211
  readonly={!editable}
1183
1212
  disabled={fieldDisabled}
1184
1213
  error={fieldError}
1214
+ help={fieldHelp}
1185
1215
  oninput={(event: Event) => setValue(key, (event.target as HTMLInputElement).value)}
1186
1216
  aria-required={ariaRequired}
1187
1217
  />
@@ -1411,6 +1441,13 @@
1411
1441
  color: var(--color-text);
1412
1442
  }
1413
1443
 
1444
+ .afr-param-help {
1445
+ display: block;
1446
+ font-family: var(--input-help-font);
1447
+ font-size: var(--input-help-size);
1448
+ color: var(--input-help-color);
1449
+ }
1450
+
1414
1451
  .afr-file-current-hint {
1415
1452
  font-family: var(--input-help-font);
1416
1453
  font-size: var(--input-help-size);
@@ -296,12 +296,17 @@
296
296
  // address on open).
297
297
  /** @type {string | null} */
298
298
  let initialReverseKey = null;
299
+ // The person placed a point (a map click or a search/geolocation pick). From then on a
300
+ // `value` is theirs, never an initial one: a create form opens with no value and its host
301
+ // feeds the placed point straight back as `value`, whose reverse geocode must fill the
302
+ // address (Atelier A5 on DEV, 2026-12-01: 0.63.0 dropped it).
303
+ let personPlaced = false;
299
304
 
300
305
  // Set searchCoords from initial value (triggers reverse geocode in GeoSearch)
301
306
  $effect(() => {
302
307
  if (!initialReverseDone && value) {
303
308
  searchCoords = /** @type {[number, number]} */ ([...value]);
304
- initialReverseKey = `${value[0]},${value[1]}`;
309
+ if (!personPlaced) initialReverseKey = `${value[0]},${value[1]}`;
305
310
  initialReverseDone = true;
306
311
  }
307
312
  });
@@ -320,6 +325,7 @@
320
325
  }
321
326
 
322
327
  function handleGeoLocation(lon, lat) {
328
+ personPlaced = true;
323
329
  if (!_map) return;
324
330
  const view = _map.getView();
325
331
  if (view) view.animate({ center: fromLonLat([lon, lat]), zoom: 16, duration: 400 });
@@ -336,6 +342,7 @@
336
342
 
337
343
  /** Called by MapPicker when user clicks to place a point — triggers reverse geocoding */
338
344
  function handleMapPointPlaced(lon, lat) {
345
+ personPlaced = true;
339
346
  searchCoords = [lon, lat];
340
347
  }
341
348
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiaiai-pt/design-system",
3
- "version": "0.63.0",
3
+ "version": "0.64.0",
4
4
  "description": "Design system tokens and Svelte components for aiaiai products",
5
5
  "license": "MIT",
6
6
  "type": "module",