@colixsystems/widget-sdk 0.362.0 → 0.363.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/README.md CHANGED
@@ -93,11 +93,15 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
93
93
 
94
94
  ## Status
95
95
 
96
- `v0.362.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
96
+ `v0.363.0` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
97
+
98
+ ### What's new in 0.363.0 (contract 1.299.0)
99
+
100
+ **The components' own texts ship in all nine app languages.** A text an SDK component shows when you pass none (`<Select>`'s "Select", `<Modal>`'s close label, `<Banner>`'s dismiss, the upload, filter, sort, move, emoji and rich-text editor texts) and every shared key (`cancel`, `save`, `loading`, `no_results`, …) now ship in English, Danish, German, Spanish, Finnish, French, Italian, Norwegian Bokmål and Swedish, with each language's singular and plural count forms. A Danish app's `<Select>` reads "Vælg" and its dialog's close button "Luk", where both used to read English. Only a language outside the nine still reads English. A workspace with one of these languages is seeded with the hand-written shared texts instead of a machine translation (existing workspaces are re-seeded once at deploy; an exported app picks them up at its next export), and a workspace's own wording still wins. A workspace language written `no` or `nn` is seeded with the Bokmål text, as the components read it. Behaviour change; minor bump.
97
101
 
98
102
  ### What's new in 0.362.0 (contract 1.298.0)
99
103
 
100
- **`localizedText(entry, locale, values)` reads a text in the app's language. It is for the platform's built-in widgets.** An entry holds one text per language, English required: `{ en: "Upload failed.", sv: "Uppladdningen misslyckades." }`. It reads the exact locale, then its primary language (`sv-SE` reads `sv`), then English, and fills each `{name}` slot from `values`. Norwegian written `no` or `nn` reads an entry's `nb` text. The SDK's own default texts ship only English and Swedish, so Norwegian still reads English there. A count text ships `{ one, other }` per language and takes the form `values.count` needs (`Intl.PluralRules`), `other` without a count. A plain string entry, such as a workspace's own wording, only has its slots filled. Text read through it never reaches the workspace's Translations admin, so a marketplace widget ships its text in `manifest.translations` and reads it with `useI18n().t()` instead. Additive.
104
+ **`localizedText(entry, locale, values)` reads a text in the app's language. It is for the platform's built-in widgets.** An entry holds one text per language, English required: `{ en: "Upload failed.", sv: "Uppladdningen misslyckades." }`. It reads the exact locale, then its primary language (`sv-SE` reads `sv`), then English, and fills each `{name}` slot from `values`. Norwegian written `no` or `nn` reads an entry's `nb` text, the SDK's own default texts included. A count text ships `{ one, other }` per language and takes the form `values.count` needs (`Intl.PluralRules`), `other` without a count. A plain string entry, such as a workspace's own wording, only has its slots filled. Text read through it never reaches the workspace's Translations admin, so a marketplace widget ships its text in `manifest.translations` and reads it with `useI18n().t()` instead. Additive.
101
105
 
102
106
  ### What's new in 0.361.0 (contract 1.297.0)
103
107
 
@@ -4223,6 +4227,8 @@ export default function ContactList({ tableId, pageSize }) {
4223
4227
  }
4224
4228
  ```
4225
4229
 
4230
+ **A relation cell is an object, never an id.** A RELATION column reads back as `{ id, label }` (an array of them for many-to-many, empty when nothing is linked), so a row's `Product` is never equal to a product's `id`. Compare and look up by `.id` (`const idOf = (v) => (v && typeof v === "object" ? v.id : v)`) and show `.label`. A write takes the bare id. A USER cell is `{ id, name }` and a FILE cell stays the file-id string.
4231
+
4226
4232
  ## Shop bag (cart)
4227
4233
 
4228
4234
  A shop's bag holds what the buyer means to buy until they pay. Build it the same way in every shop.
@@ -4231,7 +4237,7 @@ A shop's bag holds what the buyer means to buy until they pay. Build it the same
4231
4237
  - **A signed-in buyer's bag is a table.** One row per item: the product (a relation to the products table), its options, its quantity, and a buyer USER column that defaults to the signed-in user (`@currentUser`). Give the table creator-only access, so only that buyer can read or change their rows, and query it with the condition `{ column: "buyer", operator: "eq", valueMode: "currentUser" }` so a staff member's view never holds another buyer's rows. Adding a product creates a row, or raises the quantity of the row with the same product and options; changing the quantity updates the row, and Remove deletes it. A refresh, the menu and another device all show the same bag.
4232
4238
  - **A guest's bag exists only in a shop that takes guest payments.** There a visitor who is not signed in keeps the bag with `useDeviceStorage("bag", [])` as `[{ productId, options, qty }]`: product ids, options and quantities, never a price. Every widget uses that one key. When the guest signs in, the bag widget alone moves it: it copies the device bag, calls `remove()`, then adds each item to the buyer's bag table the way Add does. Other widgets, such as a header count, only read the bag. In a shop where only signed-in buyers pay there is no guest bag: Add shown to a signed-out visitor asks them to sign in with `useNavigation().signIn()`.
4233
4239
  - **Keep the bag out of the page address.** Never carry it in `useRouteParams()`, a navigation param, `useWidgetRoute` or a wire: the menu link and a refresh lose it, and Back after paying brings it back. Hand a product to the bag by its id.
4234
- - **Prices come from the products table.** Show each price and the total from the products table, never from the bag. An option that changes the price (a larger size) is its own product row; an option is only a choice that keeps the price. Checkout refuses to start while an item's product is no longer sold, so no order is created for it. It creates the order and one line per bag item with its product, quantity and options (a write-once options column on the lines), then calls `requestPayment({ description, kind, order })` (a guest: `requestGuestPayment({ description, order })`) with no `amount_cents`: the server prices the order from its lines. Pay stays disabled while a payment runs.
4240
+ - **Prices come from the products table.** Show each price and the total from the products table, never from the bag; match a bag row to its product by the relation's `.id`. An option that changes the price (a larger size) is its own product row; an option is only a choice that keeps the price. Checkout refuses to start while an item's product is no longer sold, so no order is created for it. It creates the order and one line per bag item with its product, quantity and options (a write-once options column on the lines), then calls `requestPayment({ description, kind, order })` (a guest: `requestGuestPayment({ description, order })`) with no `amount_cents`: the server prices the order from its lines. Pay stays disabled while a payment runs.
4235
4241
  - **Empty the bag only after a successful payment.** At checkout, tag each bag row with its order (a relation column on the bag table). Whenever the bag loads, delete the rows whose order reads paid, so Back, a refresh, another device and an old success address all show an empty bag. A guest's device bag is cleared with `remove()` once the payment reads `PAID`. A cancelled or failed payment leaves the bag as it was.
4236
4242
 
4237
4243
  ## Cross-platform widgets (single-file vs split)
package/dist/contract.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
  "use strict";
4
4
 
5
5
  const { COMPONENT_PROPS, COMPONENT_PROPS_ERROR_PREFIX, componentPropsError, tabItemKey } = require("./component-props.cjs");
6
- const { COMPONENT_TEXTS, fillSdkText, localizedText } = require("./sdk-texts.cjs");
6
+ const { COMPONENT_TEXTS, LANGUAGE_ALIASES, fillSdkText, localizedText } = require("./sdk-texts.cjs");
7
7
  const { formatDateForDisplay } = require("./date-label.cjs");
8
8
 
9
9
  // The widget SDK contract: the ONE source the linter, the AI agents, the
@@ -4073,7 +4073,7 @@ const PRIMITIVES = [
4073
4073
  {
4074
4074
  name: "Select",
4075
4075
  description:
4076
- 'Themed picker for ONE value of a known list, or several with `multiple`. `<Select label="Status" value={status} onValueChange={setStatus} options={[{ value: "open", label: "Open" }, { value: "done", label: "Done" }]} placeholder="Choose a status" />` — the default way to let the user pick ONE of a known list. The trigger is the app\'s input field (Design > Components > Inputs) showing the chosen label; pressing it opens the options at SCREEN level, in a sheet painted from Design > Components > Dropdown menus, so no card or scroll container can clip them, and a long list scrolls inside the sheet. The trigger is a button that opens a dialog (expanded state included) and each option carries the option role and its selected state on both hosts; the list around them is a listbox on the web only. On the web Enter, Space or an arrow key opens it, the arrow keys, Home and End move between options, Enter or Space chooses, Escape closes, and focus returns to the trigger; on Android the back button closes it. Props: `options` (`[{ value, label, disabled?, testID? }]`, `value` a string or number, unique), `value`, `onValueChange(value, option)`, `placeholder` (default "Select"; every default text here is in the app\'s language, English or Swedish), `title` (the sheet\'s heading; defaults to a text `label`), `emptyText` (default "No options"), `label`, `helper`, `error`, `disabled`, `accessibilityLabel`, `closeAccessibilityLabel`, `background` / `textColor` / `borderColor` / `radius` / `height` to override one field, `style` (the trigger), `containerStyle`, `testID`; any other prop lands on the trigger. Use it rather than a dropdown of your own; when the request needs options it cannot show (colour swatches, photos with two-line captions), put a small swatch or photo picker in a `<Popover>` at its button, or a long or full-screen option list in a `<Modal>` (an emoji choice is `<EmojiPicker>`) — never an absolutely positioned list, which the widget\'s container clips on both hosts. MULTIPLE: `<Select multiple label="Tags" values={tags} onValuesChange={setTags} options={tagOptions} />` — the default way to let the user pick SEVERAL of a known list. The same trigger and sheet; each option shows a tick box and toggles, the listbox is multiselectable on the web, and the sheet\'s Done button commits the choice through `onValuesChange(values, options)` (values in listed order, called only when they changed); closing the sheet any other way (backdrop, Escape, Android back) keeps the previous choice. Space toggles the focused option on the web. The trigger shows the picked labels as small chips while they fit on its one line, otherwise "N selected" (`selectedCountText(count)` to translate it), and `placeholder` while nothing is picked; `doneText` (default "Done") names the button. In this mode `value` / `onValueChange` are ignored. A handful of options always shown inline is a `<ChipGroup selection="multiple">` of `<Chip>`s instead. SEARCHABLE: a long list the user should type to narrow. `searchable` filters the given `options` by label as they type; `onSearch(query)` hands you the trimmed query when the sheet opens (\"\") and once typing pauses (`searchDebounceMs`, default 250), and you answer with new `options` and `loading` meanwhile (`optionsError` when it failed); or pass `options` as an async function of the query and Select fetches, keeping only the latest answer. The sheet then leads with the app\'s search field (Design > Components > Search fields), shows a spinner while loading, `noResultsText` (default \"No results\") when a query finds nothing and `loadErrorText` on failure, and its rows take the Lists row height and padding when the theme sets them. It remembers the label of every option it has shown; pass `selectedOptions` for a saved value the first page may not hold, or the trigger shows the placeholder. An option may carry `leading` (an `<Avatar>`, an icon) drawn before its label. Picking people, groups or a table\'s records is `<PeoplePicker>`, which does all of this for you.',
4076
+ 'Themed picker for ONE value of a known list, or several with `multiple`. `<Select label="Status" value={status} onValueChange={setStatus} options={[{ value: "open", label: "Open" }, { value: "done", label: "Done" }]} placeholder="Choose a status" />` — the default way to let the user pick ONE of a known list. The trigger is the app\'s input field (Design > Components > Inputs) showing the chosen label; pressing it opens the options at SCREEN level, in a sheet painted from Design > Components > Dropdown menus, so no card or scroll container can clip them, and a long list scrolls inside the sheet. The trigger is a button that opens a dialog (expanded state included) and each option carries the option role and its selected state on both hosts; the list around them is a listbox on the web only. On the web Enter, Space or an arrow key opens it, the arrow keys, Home and End move between options, Enter or Space chooses, Escape closes, and focus returns to the trigger; on Android the back button closes it. Props: `options` (`[{ value, label, disabled?, testID? }]`, `value` a string or number, unique), `value`, `onValueChange(value, option)`, `placeholder` (default "Select"; every default text here is in the app\'s language), `title` (the sheet\'s heading; defaults to a text `label`), `emptyText` (default "No options"), `label`, `helper`, `error`, `disabled`, `accessibilityLabel`, `closeAccessibilityLabel`, `background` / `textColor` / `borderColor` / `radius` / `height` to override one field, `style` (the trigger), `containerStyle`, `testID`; any other prop lands on the trigger. Use it rather than a dropdown of your own; when the request needs options it cannot show (colour swatches, photos with two-line captions), put a small swatch or photo picker in a `<Popover>` at its button, or a long or full-screen option list in a `<Modal>` (an emoji choice is `<EmojiPicker>`) — never an absolutely positioned list, which the widget\'s container clips on both hosts. MULTIPLE: `<Select multiple label="Tags" values={tags} onValuesChange={setTags} options={tagOptions} />` — the default way to let the user pick SEVERAL of a known list. The same trigger and sheet; each option shows a tick box and toggles, the listbox is multiselectable on the web, and the sheet\'s Done button commits the choice through `onValuesChange(values, options)` (values in listed order, called only when they changed); closing the sheet any other way (backdrop, Escape, Android back) keeps the previous choice. Space toggles the focused option on the web. The trigger shows the picked labels as small chips while they fit on its one line, otherwise "N selected" (`selectedCountText(count)` to translate it), and `placeholder` while nothing is picked; `doneText` (default "Done") names the button. In this mode `value` / `onValueChange` are ignored. A handful of options always shown inline is a `<ChipGroup selection="multiple">` of `<Chip>`s instead. SEARCHABLE: a long list the user should type to narrow. `searchable` filters the given `options` by label as they type; `onSearch(query)` hands you the trimmed query when the sheet opens (\"\") and once typing pauses (`searchDebounceMs`, default 250), and you answer with new `options` and `loading` meanwhile (`optionsError` when it failed); or pass `options` as an async function of the query and Select fetches, keeping only the latest answer. The sheet then leads with the app\'s search field (Design > Components > Search fields), shows a spinner while loading, `noResultsText` (default \"No results\") when a query finds nothing and `loadErrorText` on failure, and its rows take the Lists row height and padding when the theme sets them. It remembers the label of every option it has shown; pass `selectedOptions` for a saved value the first page may not hold, or the trigger shows the placeholder. An option may carry `leading` (an `<Avatar>`, an icon) drawn before its label. Picking people, groups or a table\'s records is `<PeoplePicker>`, which does all of this for you.',
4077
4077
  rnComponent: null,
4078
4078
  docsUrl: null,
4079
4079
  },
@@ -5621,33 +5621,235 @@ function sharedTranslationKey(key) {
5621
5621
  return `${SHARED_TRANSLATION_PREFIX}${key}`;
5622
5622
  }
5623
5623
 
5624
- // The predefined set. Map of bare key -> { en, sv }. Swedish is shipped by
5625
- // hand because a lone word machine-translates to the wrong sense ("Cancel" ->
5626
- // "Avboka"); other languages are translated in the Translations admin and
5627
- // every widget inherits them. Adding/removing a key is a CONTRACT change (it
5628
- // grows the dictionary every tenant gets), so the list lives with the contract
5629
- // and the seeder reads it from here — never a second copy.
5624
+ // The predefined set. Map of bare key -> its text in each of the nine app
5625
+ // languages, written by hand because a lone word machine-translates to the
5626
+ // wrong sense ("Cancel" -> "Avboka"). Outside the nine, a base language is
5627
+ // machine-translated at seeding and any other language gets no row, so it
5628
+ // reads the base.
5629
+ // Adding/removing a key is a CONTRACT change (it grows the dictionary every
5630
+ // tenant gets), so the list lives with the contract and the seeder reads it
5631
+ // from here — never a second copy.
5630
5632
  const SHARED_TRANSLATION_KEYS = Object.freeze({
5631
- submit: { en: "Submit", sv: "Skicka" },
5632
- cancel: { en: "Cancel", sv: "Avbryt" },
5633
- save: { en: "Save", sv: "Spara" },
5634
- delete: { en: "Delete", sv: "Ta bort" },
5635
- edit: { en: "Edit", sv: "Redigera" },
5636
- close: { en: "Close", sv: "Stäng" },
5637
- confirm: { en: "Confirm", sv: "Bekräfta" },
5638
- back: { en: "Back", sv: "Tillbaka" },
5639
- next: { en: "Next", sv: "Nästa" },
5640
- previous: { en: "Previous", sv: "Föregående" },
5641
- yes: { en: "Yes", sv: "Ja" },
5642
- no: { en: "No", sv: "Nej" },
5643
- ok: { en: "OK", sv: "OK" },
5644
- loading: { en: "Loading…", sv: "Laddar…" },
5645
- search: { en: "Search", sv: "Sök" },
5646
- no_results: { en: "No results", sv: "Inga resultat" },
5647
- required: { en: "Required", sv: "Obligatoriskt" },
5648
- retry: { en: "Retry", sv: "Försök igen" },
5649
- add: { en: "Add", sv: "Lägg till" },
5650
- remove: { en: "Remove", sv: "Ta bort" },
5633
+ submit: {
5634
+ en: "Submit",
5635
+ da: "Send",
5636
+ de: "Absenden",
5637
+ es: "Enviar",
5638
+ fi: "Lähetä",
5639
+ fr: "Envoyer",
5640
+ it: "Invia",
5641
+ nb: "Send",
5642
+ sv: "Skicka",
5643
+ },
5644
+ cancel: {
5645
+ en: "Cancel",
5646
+ da: "Annuller",
5647
+ de: "Abbrechen",
5648
+ es: "Cancelar",
5649
+ fi: "Peruuta",
5650
+ fr: "Annuler",
5651
+ it: "Annulla",
5652
+ nb: "Avbryt",
5653
+ sv: "Avbryt",
5654
+ },
5655
+ save: {
5656
+ en: "Save",
5657
+ da: "Gem",
5658
+ de: "Speichern",
5659
+ es: "Guardar",
5660
+ fi: "Tallenna",
5661
+ fr: "Enregistrer",
5662
+ it: "Salva",
5663
+ nb: "Lagre",
5664
+ sv: "Spara",
5665
+ },
5666
+ delete: {
5667
+ en: "Delete",
5668
+ da: "Slet",
5669
+ de: "Löschen",
5670
+ es: "Eliminar",
5671
+ fi: "Poista",
5672
+ fr: "Supprimer",
5673
+ it: "Elimina",
5674
+ nb: "Slett",
5675
+ sv: "Ta bort",
5676
+ },
5677
+ edit: {
5678
+ en: "Edit",
5679
+ da: "Rediger",
5680
+ de: "Bearbeiten",
5681
+ es: "Editar",
5682
+ fi: "Muokkaa",
5683
+ fr: "Modifier",
5684
+ it: "Modifica",
5685
+ nb: "Rediger",
5686
+ sv: "Redigera",
5687
+ },
5688
+ close: {
5689
+ en: "Close",
5690
+ da: "Luk",
5691
+ de: "Schließen",
5692
+ es: "Cerrar",
5693
+ fi: "Sulje",
5694
+ fr: "Fermer",
5695
+ it: "Chiudi",
5696
+ nb: "Lukk",
5697
+ sv: "Stäng",
5698
+ },
5699
+ confirm: {
5700
+ en: "Confirm",
5701
+ da: "Bekræft",
5702
+ de: "Bestätigen",
5703
+ es: "Confirmar",
5704
+ fi: "Vahvista",
5705
+ fr: "Confirmer",
5706
+ it: "Conferma",
5707
+ nb: "Bekreft",
5708
+ sv: "Bekräfta",
5709
+ },
5710
+ back: {
5711
+ en: "Back",
5712
+ da: "Tilbage",
5713
+ de: "Zurück",
5714
+ es: "Volver",
5715
+ fi: "Takaisin",
5716
+ fr: "Retour",
5717
+ it: "Indietro",
5718
+ nb: "Tilbake",
5719
+ sv: "Tillbaka",
5720
+ },
5721
+ next: {
5722
+ en: "Next",
5723
+ da: "Næste",
5724
+ de: "Weiter",
5725
+ es: "Siguiente",
5726
+ fi: "Seuraava",
5727
+ fr: "Suivant",
5728
+ it: "Avanti",
5729
+ nb: "Neste",
5730
+ sv: "Nästa",
5731
+ },
5732
+ previous: {
5733
+ en: "Previous",
5734
+ da: "Forrige",
5735
+ de: "Vorherige",
5736
+ es: "Anterior",
5737
+ fi: "Edellinen",
5738
+ fr: "Précédent",
5739
+ it: "Precedente",
5740
+ nb: "Forrige",
5741
+ sv: "Föregående",
5742
+ },
5743
+ yes: {
5744
+ en: "Yes",
5745
+ da: "Ja",
5746
+ de: "Ja",
5747
+ es: "Sí",
5748
+ fi: "Kyllä",
5749
+ fr: "Oui",
5750
+ it: "Sì",
5751
+ nb: "Ja",
5752
+ sv: "Ja",
5753
+ },
5754
+ no: {
5755
+ en: "No",
5756
+ da: "Nej",
5757
+ de: "Nein",
5758
+ es: "No",
5759
+ fi: "Ei",
5760
+ fr: "Non",
5761
+ it: "No",
5762
+ nb: "Nei",
5763
+ sv: "Nej",
5764
+ },
5765
+ ok: {
5766
+ en: "OK",
5767
+ da: "OK",
5768
+ de: "OK",
5769
+ es: "OK",
5770
+ fi: "OK",
5771
+ fr: "OK",
5772
+ it: "OK",
5773
+ nb: "OK",
5774
+ sv: "OK",
5775
+ },
5776
+ loading: {
5777
+ en: "Loading…",
5778
+ da: "Indlæser…",
5779
+ de: "Wird geladen…",
5780
+ es: "Cargando…",
5781
+ fi: "Ladataan…",
5782
+ fr: "Chargement…",
5783
+ it: "Caricamento…",
5784
+ nb: "Laster…",
5785
+ sv: "Laddar…",
5786
+ },
5787
+ search: {
5788
+ en: "Search",
5789
+ da: "Søg",
5790
+ de: "Suchen",
5791
+ es: "Buscar",
5792
+ fi: "Hae",
5793
+ fr: "Rechercher",
5794
+ it: "Cerca",
5795
+ nb: "Søk",
5796
+ sv: "Sök",
5797
+ },
5798
+ no_results: {
5799
+ en: "No results",
5800
+ da: "Ingen resultater",
5801
+ de: "Keine Ergebnisse",
5802
+ es: "Sin resultados",
5803
+ fi: "Ei tuloksia",
5804
+ fr: "Aucun résultat",
5805
+ it: "Nessun risultato",
5806
+ nb: "Ingen resultater",
5807
+ sv: "Inga resultat",
5808
+ },
5809
+ required: {
5810
+ en: "Required",
5811
+ da: "Påkrævet",
5812
+ de: "Erforderlich",
5813
+ es: "Obligatorio",
5814
+ fi: "Pakollinen",
5815
+ fr: "Obligatoire",
5816
+ it: "Obbligatorio",
5817
+ nb: "Obligatorisk",
5818
+ sv: "Obligatoriskt",
5819
+ },
5820
+ retry: {
5821
+ en: "Retry",
5822
+ da: "Prøv igen",
5823
+ de: "Erneut versuchen",
5824
+ es: "Reintentar",
5825
+ fi: "Yritä uudelleen",
5826
+ fr: "Réessayer",
5827
+ it: "Riprova",
5828
+ nb: "Prøv igjen",
5829
+ sv: "Försök igen",
5830
+ },
5831
+ add: {
5832
+ en: "Add",
5833
+ da: "Tilføj",
5834
+ de: "Hinzufügen",
5835
+ es: "Añadir",
5836
+ fi: "Lisää",
5837
+ fr: "Ajouter",
5838
+ it: "Aggiungi",
5839
+ nb: "Legg til",
5840
+ sv: "Lägg till",
5841
+ },
5842
+ remove: {
5843
+ en: "Remove",
5844
+ da: "Fjern",
5845
+ de: "Entfernen",
5846
+ es: "Quitar",
5847
+ fi: "Poista",
5848
+ fr: "Retirer",
5849
+ it: "Rimuovi",
5850
+ nb: "Fjern",
5851
+ sv: "Ta bort",
5852
+ },
5651
5853
  });
5652
5854
 
5653
5855
  // True when `key` is one of the predefined shared keys — the discriminator
@@ -7282,7 +7484,9 @@ const CONTRACT = deepFreeze({
7282
7484
  // column is `missing`, as the Studio and preview binders already showed.
7283
7485
  // 1.298.0 (sc-18635): additive — `localizedText(entry, locale, values)`
7284
7486
  // reads a nine-language text table; `no` and `nn` read `nb`.
7285
- version: "1.298.0",
7487
+ // 1.299.0: behaviour (sc-18751) — the components' default texts and the
7488
+ // shared keys ship all nine app languages, not English and Swedish only.
7489
+ version: "1.299.0",
7286
7490
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7287
7491
  hooks: HOOKS,
7288
7492
  primitives: PRIMITIVES,
@@ -7892,5 +8096,6 @@ module.exports = {
7892
8096
  sdkText,
7893
8097
  fillSdkText,
7894
8098
  localizedText,
8099
+ LANGUAGE_ALIASES,
7895
8100
  formatDateForDisplay,
7896
8101
  };
package/dist/contract.js CHANGED
@@ -9,7 +9,7 @@
9
9
  // the compiler's generated layout `elevationStyles`, and widgets reading
10
10
  // `useTheme().elevation` — so a widget shadow and a container shadow match.
11
11
  import { COMPONENT_PROPS, COMPONENT_PROPS_ERROR_PREFIX, componentPropsError, tabItemKey } from "./component-props.js";
12
- import { COMPONENT_TEXTS, fillSdkText, localizedText } from "./sdk-texts.js";
12
+ import { COMPONENT_TEXTS, LANGUAGE_ALIASES, fillSdkText, localizedText } from "./sdk-texts.js";
13
13
  import { formatDateForDisplay } from "./date-label.js";
14
14
 
15
15
  const ELEVATION = Object.freeze({
@@ -4068,7 +4068,7 @@ const PRIMITIVES = [
4068
4068
  {
4069
4069
  name: "Select",
4070
4070
  description:
4071
- 'Themed picker for ONE value of a known list, or several with `multiple`. `<Select label="Status" value={status} onValueChange={setStatus} options={[{ value: "open", label: "Open" }, { value: "done", label: "Done" }]} placeholder="Choose a status" />` — the default way to let the user pick ONE of a known list. The trigger is the app\'s input field (Design > Components > Inputs) showing the chosen label; pressing it opens the options at SCREEN level, in a sheet painted from Design > Components > Dropdown menus, so no card or scroll container can clip them, and a long list scrolls inside the sheet. The trigger is a button that opens a dialog (expanded state included) and each option carries the option role and its selected state on both hosts; the list around them is a listbox on the web only. On the web Enter, Space or an arrow key opens it, the arrow keys, Home and End move between options, Enter or Space chooses, Escape closes, and focus returns to the trigger; on Android the back button closes it. Props: `options` (`[{ value, label, disabled?, testID? }]`, `value` a string or number, unique), `value`, `onValueChange(value, option)`, `placeholder` (default "Select"; every default text here is in the app\'s language, English or Swedish), `title` (the sheet\'s heading; defaults to a text `label`), `emptyText` (default "No options"), `label`, `helper`, `error`, `disabled`, `accessibilityLabel`, `closeAccessibilityLabel`, `background` / `textColor` / `borderColor` / `radius` / `height` to override one field, `style` (the trigger), `containerStyle`, `testID`; any other prop lands on the trigger. Use it rather than a dropdown of your own; when the request needs options it cannot show (colour swatches, photos with two-line captions), put a small swatch or photo picker in a `<Popover>` at its button, or a long or full-screen option list in a `<Modal>` (an emoji choice is `<EmojiPicker>`) — never an absolutely positioned list, which the widget\'s container clips on both hosts. MULTIPLE: `<Select multiple label="Tags" values={tags} onValuesChange={setTags} options={tagOptions} />` — the default way to let the user pick SEVERAL of a known list. The same trigger and sheet; each option shows a tick box and toggles, the listbox is multiselectable on the web, and the sheet\'s Done button commits the choice through `onValuesChange(values, options)` (values in listed order, called only when they changed); closing the sheet any other way (backdrop, Escape, Android back) keeps the previous choice. Space toggles the focused option on the web. The trigger shows the picked labels as small chips while they fit on its one line, otherwise "N selected" (`selectedCountText(count)` to translate it), and `placeholder` while nothing is picked; `doneText` (default "Done") names the button. In this mode `value` / `onValueChange` are ignored. A handful of options always shown inline is a `<ChipGroup selection="multiple">` of `<Chip>`s instead. SEARCHABLE: a long list the user should type to narrow. `searchable` filters the given `options` by label as they type; `onSearch(query)` hands you the trimmed query when the sheet opens (\"\") and once typing pauses (`searchDebounceMs`, default 250), and you answer with new `options` and `loading` meanwhile (`optionsError` when it failed); or pass `options` as an async function of the query and Select fetches, keeping only the latest answer. The sheet then leads with the app\'s search field (Design > Components > Search fields), shows a spinner while loading, `noResultsText` (default \"No results\") when a query finds nothing and `loadErrorText` on failure, and its rows take the Lists row height and padding when the theme sets them. It remembers the label of every option it has shown; pass `selectedOptions` for a saved value the first page may not hold, or the trigger shows the placeholder. An option may carry `leading` (an `<Avatar>`, an icon) drawn before its label. Picking people, groups or a table\'s records is `<PeoplePicker>`, which does all of this for you.',
4071
+ 'Themed picker for ONE value of a known list, or several with `multiple`. `<Select label="Status" value={status} onValueChange={setStatus} options={[{ value: "open", label: "Open" }, { value: "done", label: "Done" }]} placeholder="Choose a status" />` — the default way to let the user pick ONE of a known list. The trigger is the app\'s input field (Design > Components > Inputs) showing the chosen label; pressing it opens the options at SCREEN level, in a sheet painted from Design > Components > Dropdown menus, so no card or scroll container can clip them, and a long list scrolls inside the sheet. The trigger is a button that opens a dialog (expanded state included) and each option carries the option role and its selected state on both hosts; the list around them is a listbox on the web only. On the web Enter, Space or an arrow key opens it, the arrow keys, Home and End move between options, Enter or Space chooses, Escape closes, and focus returns to the trigger; on Android the back button closes it. Props: `options` (`[{ value, label, disabled?, testID? }]`, `value` a string or number, unique), `value`, `onValueChange(value, option)`, `placeholder` (default "Select"; every default text here is in the app\'s language), `title` (the sheet\'s heading; defaults to a text `label`), `emptyText` (default "No options"), `label`, `helper`, `error`, `disabled`, `accessibilityLabel`, `closeAccessibilityLabel`, `background` / `textColor` / `borderColor` / `radius` / `height` to override one field, `style` (the trigger), `containerStyle`, `testID`; any other prop lands on the trigger. Use it rather than a dropdown of your own; when the request needs options it cannot show (colour swatches, photos with two-line captions), put a small swatch or photo picker in a `<Popover>` at its button, or a long or full-screen option list in a `<Modal>` (an emoji choice is `<EmojiPicker>`) — never an absolutely positioned list, which the widget\'s container clips on both hosts. MULTIPLE: `<Select multiple label="Tags" values={tags} onValuesChange={setTags} options={tagOptions} />` — the default way to let the user pick SEVERAL of a known list. The same trigger and sheet; each option shows a tick box and toggles, the listbox is multiselectable on the web, and the sheet\'s Done button commits the choice through `onValuesChange(values, options)` (values in listed order, called only when they changed); closing the sheet any other way (backdrop, Escape, Android back) keeps the previous choice. Space toggles the focused option on the web. The trigger shows the picked labels as small chips while they fit on its one line, otherwise "N selected" (`selectedCountText(count)` to translate it), and `placeholder` while nothing is picked; `doneText` (default "Done") names the button. In this mode `value` / `onValueChange` are ignored. A handful of options always shown inline is a `<ChipGroup selection="multiple">` of `<Chip>`s instead. SEARCHABLE: a long list the user should type to narrow. `searchable` filters the given `options` by label as they type; `onSearch(query)` hands you the trimmed query when the sheet opens (\"\") and once typing pauses (`searchDebounceMs`, default 250), and you answer with new `options` and `loading` meanwhile (`optionsError` when it failed); or pass `options` as an async function of the query and Select fetches, keeping only the latest answer. The sheet then leads with the app\'s search field (Design > Components > Search fields), shows a spinner while loading, `noResultsText` (default \"No results\") when a query finds nothing and `loadErrorText` on failure, and its rows take the Lists row height and padding when the theme sets them. It remembers the label of every option it has shown; pass `selectedOptions` for a saved value the first page may not hold, or the trigger shows the placeholder. An option may carry `leading` (an `<Avatar>`, an icon) drawn before its label. Picking people, groups or a table\'s records is `<PeoplePicker>`, which does all of this for you.',
4072
4072
  rnComponent: null,
4073
4073
  docsUrl: null,
4074
4074
  },
@@ -5616,33 +5616,235 @@ function sharedTranslationKey(key) {
5616
5616
  return `${SHARED_TRANSLATION_PREFIX}${key}`;
5617
5617
  }
5618
5618
 
5619
- // The predefined set. Map of bare key -> { en, sv }. Swedish is shipped by
5620
- // hand because a lone word machine-translates to the wrong sense ("Cancel" ->
5621
- // "Avboka"); other languages are translated in the Translations admin and
5622
- // every widget inherits them. Adding/removing a key is a CONTRACT change (it
5623
- // grows the dictionary every tenant gets), so the list lives with the contract
5624
- // and the seeder reads it from here — never a second copy.
5619
+ // The predefined set. Map of bare key -> its text in each of the nine app
5620
+ // languages, written by hand because a lone word machine-translates to the
5621
+ // wrong sense ("Cancel" -> "Avboka"). Outside the nine, a base language is
5622
+ // machine-translated at seeding and any other language gets no row, so it
5623
+ // reads the base.
5624
+ // Adding/removing a key is a CONTRACT change (it grows the dictionary every
5625
+ // tenant gets), so the list lives with the contract and the seeder reads it
5626
+ // from here — never a second copy.
5625
5627
  const SHARED_TRANSLATION_KEYS = Object.freeze({
5626
- submit: { en: "Submit", sv: "Skicka" },
5627
- cancel: { en: "Cancel", sv: "Avbryt" },
5628
- save: { en: "Save", sv: "Spara" },
5629
- delete: { en: "Delete", sv: "Ta bort" },
5630
- edit: { en: "Edit", sv: "Redigera" },
5631
- close: { en: "Close", sv: "Stäng" },
5632
- confirm: { en: "Confirm", sv: "Bekräfta" },
5633
- back: { en: "Back", sv: "Tillbaka" },
5634
- next: { en: "Next", sv: "Nästa" },
5635
- previous: { en: "Previous", sv: "Föregående" },
5636
- yes: { en: "Yes", sv: "Ja" },
5637
- no: { en: "No", sv: "Nej" },
5638
- ok: { en: "OK", sv: "OK" },
5639
- loading: { en: "Loading…", sv: "Laddar…" },
5640
- search: { en: "Search", sv: "Sök" },
5641
- no_results: { en: "No results", sv: "Inga resultat" },
5642
- required: { en: "Required", sv: "Obligatoriskt" },
5643
- retry: { en: "Retry", sv: "Försök igen" },
5644
- add: { en: "Add", sv: "Lägg till" },
5645
- remove: { en: "Remove", sv: "Ta bort" },
5628
+ submit: {
5629
+ en: "Submit",
5630
+ da: "Send",
5631
+ de: "Absenden",
5632
+ es: "Enviar",
5633
+ fi: "Lähetä",
5634
+ fr: "Envoyer",
5635
+ it: "Invia",
5636
+ nb: "Send",
5637
+ sv: "Skicka",
5638
+ },
5639
+ cancel: {
5640
+ en: "Cancel",
5641
+ da: "Annuller",
5642
+ de: "Abbrechen",
5643
+ es: "Cancelar",
5644
+ fi: "Peruuta",
5645
+ fr: "Annuler",
5646
+ it: "Annulla",
5647
+ nb: "Avbryt",
5648
+ sv: "Avbryt",
5649
+ },
5650
+ save: {
5651
+ en: "Save",
5652
+ da: "Gem",
5653
+ de: "Speichern",
5654
+ es: "Guardar",
5655
+ fi: "Tallenna",
5656
+ fr: "Enregistrer",
5657
+ it: "Salva",
5658
+ nb: "Lagre",
5659
+ sv: "Spara",
5660
+ },
5661
+ delete: {
5662
+ en: "Delete",
5663
+ da: "Slet",
5664
+ de: "Löschen",
5665
+ es: "Eliminar",
5666
+ fi: "Poista",
5667
+ fr: "Supprimer",
5668
+ it: "Elimina",
5669
+ nb: "Slett",
5670
+ sv: "Ta bort",
5671
+ },
5672
+ edit: {
5673
+ en: "Edit",
5674
+ da: "Rediger",
5675
+ de: "Bearbeiten",
5676
+ es: "Editar",
5677
+ fi: "Muokkaa",
5678
+ fr: "Modifier",
5679
+ it: "Modifica",
5680
+ nb: "Rediger",
5681
+ sv: "Redigera",
5682
+ },
5683
+ close: {
5684
+ en: "Close",
5685
+ da: "Luk",
5686
+ de: "Schließen",
5687
+ es: "Cerrar",
5688
+ fi: "Sulje",
5689
+ fr: "Fermer",
5690
+ it: "Chiudi",
5691
+ nb: "Lukk",
5692
+ sv: "Stäng",
5693
+ },
5694
+ confirm: {
5695
+ en: "Confirm",
5696
+ da: "Bekræft",
5697
+ de: "Bestätigen",
5698
+ es: "Confirmar",
5699
+ fi: "Vahvista",
5700
+ fr: "Confirmer",
5701
+ it: "Conferma",
5702
+ nb: "Bekreft",
5703
+ sv: "Bekräfta",
5704
+ },
5705
+ back: {
5706
+ en: "Back",
5707
+ da: "Tilbage",
5708
+ de: "Zurück",
5709
+ es: "Volver",
5710
+ fi: "Takaisin",
5711
+ fr: "Retour",
5712
+ it: "Indietro",
5713
+ nb: "Tilbake",
5714
+ sv: "Tillbaka",
5715
+ },
5716
+ next: {
5717
+ en: "Next",
5718
+ da: "Næste",
5719
+ de: "Weiter",
5720
+ es: "Siguiente",
5721
+ fi: "Seuraava",
5722
+ fr: "Suivant",
5723
+ it: "Avanti",
5724
+ nb: "Neste",
5725
+ sv: "Nästa",
5726
+ },
5727
+ previous: {
5728
+ en: "Previous",
5729
+ da: "Forrige",
5730
+ de: "Vorherige",
5731
+ es: "Anterior",
5732
+ fi: "Edellinen",
5733
+ fr: "Précédent",
5734
+ it: "Precedente",
5735
+ nb: "Forrige",
5736
+ sv: "Föregående",
5737
+ },
5738
+ yes: {
5739
+ en: "Yes",
5740
+ da: "Ja",
5741
+ de: "Ja",
5742
+ es: "Sí",
5743
+ fi: "Kyllä",
5744
+ fr: "Oui",
5745
+ it: "Sì",
5746
+ nb: "Ja",
5747
+ sv: "Ja",
5748
+ },
5749
+ no: {
5750
+ en: "No",
5751
+ da: "Nej",
5752
+ de: "Nein",
5753
+ es: "No",
5754
+ fi: "Ei",
5755
+ fr: "Non",
5756
+ it: "No",
5757
+ nb: "Nei",
5758
+ sv: "Nej",
5759
+ },
5760
+ ok: {
5761
+ en: "OK",
5762
+ da: "OK",
5763
+ de: "OK",
5764
+ es: "OK",
5765
+ fi: "OK",
5766
+ fr: "OK",
5767
+ it: "OK",
5768
+ nb: "OK",
5769
+ sv: "OK",
5770
+ },
5771
+ loading: {
5772
+ en: "Loading…",
5773
+ da: "Indlæser…",
5774
+ de: "Wird geladen…",
5775
+ es: "Cargando…",
5776
+ fi: "Ladataan…",
5777
+ fr: "Chargement…",
5778
+ it: "Caricamento…",
5779
+ nb: "Laster…",
5780
+ sv: "Laddar…",
5781
+ },
5782
+ search: {
5783
+ en: "Search",
5784
+ da: "Søg",
5785
+ de: "Suchen",
5786
+ es: "Buscar",
5787
+ fi: "Hae",
5788
+ fr: "Rechercher",
5789
+ it: "Cerca",
5790
+ nb: "Søk",
5791
+ sv: "Sök",
5792
+ },
5793
+ no_results: {
5794
+ en: "No results",
5795
+ da: "Ingen resultater",
5796
+ de: "Keine Ergebnisse",
5797
+ es: "Sin resultados",
5798
+ fi: "Ei tuloksia",
5799
+ fr: "Aucun résultat",
5800
+ it: "Nessun risultato",
5801
+ nb: "Ingen resultater",
5802
+ sv: "Inga resultat",
5803
+ },
5804
+ required: {
5805
+ en: "Required",
5806
+ da: "Påkrævet",
5807
+ de: "Erforderlich",
5808
+ es: "Obligatorio",
5809
+ fi: "Pakollinen",
5810
+ fr: "Obligatoire",
5811
+ it: "Obbligatorio",
5812
+ nb: "Obligatorisk",
5813
+ sv: "Obligatoriskt",
5814
+ },
5815
+ retry: {
5816
+ en: "Retry",
5817
+ da: "Prøv igen",
5818
+ de: "Erneut versuchen",
5819
+ es: "Reintentar",
5820
+ fi: "Yritä uudelleen",
5821
+ fr: "Réessayer",
5822
+ it: "Riprova",
5823
+ nb: "Prøv igjen",
5824
+ sv: "Försök igen",
5825
+ },
5826
+ add: {
5827
+ en: "Add",
5828
+ da: "Tilføj",
5829
+ de: "Hinzufügen",
5830
+ es: "Añadir",
5831
+ fi: "Lisää",
5832
+ fr: "Ajouter",
5833
+ it: "Aggiungi",
5834
+ nb: "Legg til",
5835
+ sv: "Lägg till",
5836
+ },
5837
+ remove: {
5838
+ en: "Remove",
5839
+ da: "Fjern",
5840
+ de: "Entfernen",
5841
+ es: "Quitar",
5842
+ fi: "Poista",
5843
+ fr: "Retirer",
5844
+ it: "Rimuovi",
5845
+ nb: "Fjern",
5846
+ sv: "Ta bort",
5847
+ },
5646
5848
  });
5647
5849
 
5648
5850
  // True when `key` is one of the predefined shared keys — the discriminator
@@ -7277,7 +7479,9 @@ const CONTRACT = deepFreeze({
7277
7479
  // column is `missing`, as the Studio and preview binders already showed.
7278
7480
  // 1.298.0 (sc-18635): additive — `localizedText(entry, locale, values)`
7279
7481
  // reads a nine-language text table; `no` and `nn` read `nb`.
7280
- version: "1.298.0",
7482
+ // 1.299.0: behaviour (sc-18751) — the components' default texts and the
7483
+ // shared keys ship all nine app languages, not English and Swedish only.
7484
+ version: "1.299.0",
7281
7485
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7282
7486
  hooks: HOOKS,
7283
7487
  primitives: PRIMITIVES,
@@ -7887,5 +8091,6 @@ export {
7887
8091
  sdkText,
7888
8092
  fillSdkText,
7889
8093
  localizedText,
8094
+ LANGUAGE_ALIASES,
7890
8095
  formatDateForDisplay,
7891
8096
  };