@colixsystems/widget-sdk 0.326.1 → 0.327.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
@@ -91,7 +91,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
91
91
 
92
92
  ## Status
93
93
 
94
- `v0.326.1` — 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**.
94
+ `v0.327.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**.
95
+
96
+ ### What's new in 0.327.0 (contract 1.266.0)
97
+
98
+ **Components show their own texts in the app's language.** A component you give no text now shows its built-in one in the language the app runs in (`useI18n().locale`), on the web and in the exported app: a Swedish app's `<Select>` without a `placeholder` reads "Välj", not "Select". This covers every default text: `Select` (`placeholder`, `doneText`, `emptyText`, the search texts, "N selected"), `SearchField`, `PeoplePicker`, `FileUpload`, `DateTimePicker`, `FilterBar`, `EmojiPicker`, `Banner`'s dismiss, `Modal`'s and `Overlay`'s close, `DataTable`'s and `SortableList`/`Board`'s spoken sort and move words, and `MarkdownInput`'s toolbar and link form. A count takes its language's singular or plural form ("1 vald", "2 valda"). English and Swedish ship; an app in any other language reads English, so pass your own translated text there. A text you pass is shown unchanged, and a workspace's own wording of a shared key (`Search`, `Loading…`, `No results`, `Required`, …) in the Translations admin still wins.
95
99
 
96
100
  ### What's new in 0.326.1 (contract 1.265.1)
97
101
 
@@ -6,7 +6,7 @@
6
6
  // different in every widget. This one reads the theme's `alert` scope.
7
7
 
8
8
  import React from "react";
9
- import { useHostTheme, useStrictProps } from "./hooks.js";
9
+ import { useHostTheme, useSdkTextDefaults, useStrictProps } from "./hooks.js";
10
10
  import { DEFAULT_THEME_TOKENS } from "./_theme-tokens.js";
11
11
  import { Icon } from "./icon.js";
12
12
  import { resolveBannerTokens } from "./banner-tokens.js";
@@ -17,6 +17,7 @@ const LINE_MIN_HEIGHT = 24;
17
17
  // A real 36px target: the web host ignores hitSlop, so size carries it.
18
18
  const CONTROL_MIN_SIZE = 36;
19
19
  const CONTROL_HIT_SLOP = 4;
20
+ const BANNER_TEXT_KEYS = Object.freeze({ dismissAccessibilityLabel: "dismiss" });
20
21
 
21
22
  const h = React.createElement;
22
23
 
@@ -105,8 +106,9 @@ export function makeBanner(rn) {
105
106
  );
106
107
  }
107
108
 
108
- function Banner(props) {
109
- useStrictProps("Banner", props);
109
+ function Banner(ownProps) {
110
+ useStrictProps("Banner", ownProps);
111
+ const props = useSdkTextDefaults(ownProps, BANNER_TEXT_KEYS);
110
112
  const {
111
113
  tone,
112
114
  title,
@@ -114,7 +116,7 @@ export function makeBanner(rn) {
114
116
  icon,
115
117
  action,
116
118
  onDismiss,
117
- dismissAccessibilityLabel = "Dismiss",
119
+ dismissAccessibilityLabel,
118
120
  theme: explicitTheme,
119
121
  style,
120
122
  testID,
@@ -4,7 +4,7 @@
4
4
  // `card` scope. On a narrow box the columns scroll sideways.
5
5
 
6
6
  import React from "react";
7
- import { useContainerWidth, useHostTheme, useStrictProps } from "./hooks.js";
7
+ import { useContainerWidth, useHostLocale, useHostTheme, useStrictProps } from "./hooks.js";
8
8
  import { DEFAULT_THEME_TOKENS } from "./_theme-tokens.js";
9
9
  import { widthTier } from "./container-width.js";
10
10
  import { textRoleStyle } from "./text-roles.js";
@@ -125,7 +125,7 @@ export function makeBoard(rn, kit) {
125
125
  } = props;
126
126
  const theme = useHostTheme() || DEFAULT_THEME_TOKENS;
127
127
  const tokens = resolveSortableTokens(theme);
128
- const words = resolveSortableLabels(labels);
128
+ const words = resolveSortableLabels(labels, useHostLocale());
129
129
  const specs = Array.isArray(columns) ? columns : [];
130
130
  const lanes = boardLanes(specs, Array.isArray(items) ? items : [], getColumn, keyExtractor);
131
131
  const order = lanes.map((lane) => lane.map((card) => card.key).join("\u0000")).join("\u0001");
@@ -6,9 +6,8 @@
6
6
  // and empty state. This one reads the theme's `chart` scope.
7
7
 
8
8
  import React from "react";
9
- import { useHostLocale, useHostTheme, useHostSharedText } from "./hooks.js";
9
+ import { useHostLocale, useHostTheme, useSdkText } from "./hooks.js";
10
10
  import { DEFAULT_THEME_TOKENS } from "./_theme-tokens.js";
11
- import { CONTRACT } from "./contract.js";
12
11
  import { textRoleStyle } from "./text-roles.js";
13
12
  import { resolveChartTokens, chartSeriesPaint } from "./chart-tokens.js";
14
13
  import {
@@ -24,7 +23,6 @@ import {
24
23
  } from "./chart-logic.js";
25
24
 
26
25
  const h = React.createElement;
27
- const NO_RESULTS_FALLBACK = CONTRACT.sharedTranslationKeys.no_results.en;
28
26
  const AREA_OPACITY = 0.18;
29
27
  const LINE_WIDTH = 2;
30
28
  const DOT_RADIUS = 3;
@@ -195,7 +193,7 @@ export function makeChart(rn) {
195
193
  const hostTheme = useHostTheme();
196
194
  // A host drawing outside a widget context passes its own theme.
197
195
  const theme = explicitTheme || hostTheme || DEFAULT_THEME_TOKENS;
198
- const noResults = useHostSharedText("no_results", NO_RESULTS_FALLBACK);
196
+ const noResults = useSdkText()("no_results");
199
197
  const locale = useHostLocale();
200
198
  const [width, setWidth] = React.useState(0);
201
199
  const kind = normaliseChartType(type);
@@ -5,7 +5,7 @@
5
5
  // only in where the primitives come from, so the two hosts cannot drift.
6
6
 
7
7
  import React from "react";
8
- import { useHostSharedText, useHostTheme, useStrictProps } from "./hooks.js";
8
+ import { useHostTheme, useSdkText, useStrictProps } from "./hooks.js";
9
9
  import { DEFAULT_THEME_TOKENS } from "./_theme-tokens.js";
10
10
  import { textRoleStyle } from "./text-roles.js";
11
11
 
@@ -78,9 +78,10 @@ export function makeConfirmDialog(rn, Modal, Button, Spinner) {
78
78
  closeAccessibilityLabel,
79
79
  testID,
80
80
  } = props;
81
- const sharedConfirm = useHostSharedText("confirm", "Confirm");
82
- const sharedCancel = useHostSharedText("cancel", "Cancel");
83
- const sharedClose = useHostSharedText("close", "Close");
81
+ const text = useSdkText();
82
+ const sharedConfirm = text("confirm");
83
+ const sharedCancel = text("cancel");
84
+ const sharedClose = text("close");
84
85
  const [pending, setPending] = React.useState(false);
85
86
  // Set before the re-render, so a second press in the same frame is ignored.
86
87
  const inFlight = React.useRef(false);
package/dist/contract.cjs CHANGED
@@ -3,6 +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, textInLanguage } = require("./sdk-texts.cjs");
6
7
 
7
8
  // The widget SDK contract: the ONE source the linter, the AI agents, the
8
9
  // compiler and both hosts read. `contract.cjs` is GENERATED from `contract.js`
@@ -3957,7 +3958,7 @@ const PRIMITIVES = [
3957
3958
  {
3958
3959
  name: "Select",
3959
3960
  description:
3960
- '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"), `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.',
3961
+ '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.',
3961
3962
  rnComponent: null,
3962
3963
  docsUrl: null,
3963
3964
  },
@@ -5527,6 +5528,16 @@ function isSharedTranslationKey(key) {
5527
5528
  );
5528
5529
  }
5529
5530
 
5531
+ // sc-16877 — every default text an SDK component shows: the shared keys a
5532
+ // workspace's dictionary can reword, plus the component texts in sdk-texts.js.
5533
+ const SDK_TEXTS = Object.freeze({ ...SHARED_TRANSLATION_KEYS, ...COMPONENT_TEXTS });
5534
+
5535
+ /** `key`'s built-in text in `locale`, English when that language ships none. */
5536
+ function sdkText(key, locale, values) {
5537
+ const entry = SDK_TEXTS[key];
5538
+ return entry ? textInLanguage(entry, locale, values) : key;
5539
+ }
5540
+
5530
5541
  const CONTRACT = deepFreeze({
5531
5542
  // REQ-WSDK-PLATFORM bump:
5532
5543
  // - `vettedImports` is a new field (rich allowlist with platforms +
@@ -7034,7 +7045,10 @@ const CONTRACT = deepFreeze({
7034
7045
  // `no-hardcoded-design` with no licence (sc-17364).
7035
7046
  // 1.265.1: narrower lint — `group-ids-as-text` passes a group's name,
7036
7047
  // prefix, description, mode, size, count, colour, icon or type.
7037
- version: "1.265.1",
7048
+ // 1.266.0: behaviour (sc-16877) — a component's default texts (Select's
7049
+ // "Select", "Done", "No options", …) are in the app's language: English
7050
+ // and Swedish ship, any other language reads English.
7051
+ version: "1.266.0",
7038
7052
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7039
7053
  hooks: HOOKS,
7040
7054
  primitives: PRIMITIVES,
@@ -7640,4 +7654,7 @@ module.exports = {
7640
7654
  sharedTranslationKey,
7641
7655
  isSharedTranslationKey,
7642
7656
  SHARED_TRANSLATION_KEYS,
7657
+ SDK_TEXTS,
7658
+ sdkText,
7659
+ fillSdkText,
7643
7660
  };
package/dist/contract.js CHANGED
@@ -9,6 +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, textInLanguage } from "./sdk-texts.js";
12
13
 
13
14
  const ELEVATION = Object.freeze({
14
15
  none: Object.freeze({}),
@@ -3952,7 +3953,7 @@ const PRIMITIVES = [
3952
3953
  {
3953
3954
  name: "Select",
3954
3955
  description:
3955
- '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"), `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.',
3956
+ '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.',
3956
3957
  rnComponent: null,
3957
3958
  docsUrl: null,
3958
3959
  },
@@ -5522,6 +5523,16 @@ function isSharedTranslationKey(key) {
5522
5523
  );
5523
5524
  }
5524
5525
 
5526
+ // sc-16877 — every default text an SDK component shows: the shared keys a
5527
+ // workspace's dictionary can reword, plus the component texts in sdk-texts.js.
5528
+ const SDK_TEXTS = Object.freeze({ ...SHARED_TRANSLATION_KEYS, ...COMPONENT_TEXTS });
5529
+
5530
+ /** `key`'s built-in text in `locale`, English when that language ships none. */
5531
+ function sdkText(key, locale, values) {
5532
+ const entry = SDK_TEXTS[key];
5533
+ return entry ? textInLanguage(entry, locale, values) : key;
5534
+ }
5535
+
5525
5536
  const CONTRACT = deepFreeze({
5526
5537
  // REQ-WSDK-PLATFORM bump:
5527
5538
  // - `vettedImports` is a new field (rich allowlist with platforms +
@@ -7029,7 +7040,10 @@ const CONTRACT = deepFreeze({
7029
7040
  // `no-hardcoded-design` with no licence (sc-17364).
7030
7041
  // 1.265.1: narrower lint — `group-ids-as-text` passes a group's name,
7031
7042
  // prefix, description, mode, size, count, colour, icon or type.
7032
- version: "1.265.1",
7043
+ // 1.266.0: behaviour (sc-16877) — a component's default texts (Select's
7044
+ // "Select", "Done", "No options", …) are in the app's language: English
7045
+ // and Swedish ship, any other language reads English.
7046
+ version: "1.266.0",
7033
7047
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7034
7048
  hooks: HOOKS,
7035
7049
  primitives: PRIMITIVES,
@@ -7635,4 +7649,7 @@ export {
7635
7649
  sharedTranslationKey,
7636
7650
  isSharedTranslationKey,
7637
7651
  SHARED_TRANSLATION_KEYS,
7652
+ SDK_TEXTS,
7653
+ sdkText,
7654
+ fillSdkText,
7638
7655
  };
@@ -3,6 +3,7 @@
3
3
  // own tests share one answer.
4
4
 
5
5
  import { widthTier } from "./container-width.js";
6
+ import { sdkText } from "./contract.js";
6
7
 
7
8
  /** The rows' scroll box stops here unless `maxHeight` says otherwise. */
8
9
  export const DATA_TABLE_DEFAULT_MAX_HEIGHT = 480;
@@ -16,12 +17,15 @@ export const DATA_TABLE_LAYOUTS = Object.freeze({
16
17
  medium: "cards",
17
18
  wide: "columns",
18
19
  });
19
- /** The English words a sort is spoken with; a widget passes its own language. */
20
- export const DEFAULT_SORT_LABELS = Object.freeze({
21
- sort: "Sort",
22
- ascending: "sorted ascending",
23
- descending: "sorted descending",
24
- });
20
+ /** The words a sort is spoken with in `locale`; a widget's `sortLabels` win. */
21
+ export function defaultSortLabels(locale) {
22
+ return {
23
+ sort: sdkText("sort", locale),
24
+ ascending: sdkText("sorted_ascending", locale),
25
+ descending: sdkText("sorted_descending", locale),
26
+ };
27
+ }
28
+ export const DEFAULT_SORT_LABELS = Object.freeze(defaultSortLabels("en"));
25
29
 
26
30
  const JUSTIFY = Object.freeze({ left: "flex-start", center: "center", right: "flex-end" });
27
31
 
@@ -8,16 +8,15 @@
8
8
  // the theme's `list` scope (and `card` scope for the cards) styles it.
9
9
 
10
10
  import React from "react";
11
- import { useContainerWidth, useHostTheme, useHostSharedText } from "./hooks.js";
11
+ import { useContainerWidth, useHostLocale, useHostTheme, useSdkText } from "./hooks.js";
12
12
  import { DEFAULT_THEME_TOKENS } from "./_theme-tokens.js";
13
- import { CONTRACT } from "./contract.js";
14
13
  import { Icon } from "./icon.js";
15
14
  import { LIST_TOKEN_NAMES, resolveListTokens } from "./list-tokens.js";
16
15
  import { textRoleStyle } from "./text-roles.js";
17
16
  import {
18
17
  DATA_TABLE_HEADER_TARGET,
19
18
  DATA_TABLE_SKELETON_ROWS,
20
- DEFAULT_SORT_LABELS,
19
+ defaultSortLabels,
21
20
  ariaSortFor,
22
21
  cellText,
23
22
  dataTableLayout,
@@ -34,7 +33,6 @@ import {
34
33
  } from "./data-table-logic.js";
35
34
 
36
35
  const h = React.createElement;
37
- const EMPTY_FALLBACK = CONTRACT.sharedTranslationKeys.no_results.en;
38
36
  const SORT_ICON_SIZE = 14;
39
37
  const SORT_GLYPHS = Object.freeze({
40
38
  none: "chevrons-up-down",
@@ -354,10 +352,10 @@ export function makeDataTable(rn, parts) {
354
352
  const [width, onLayout] = useContainerWidth();
355
353
  const layout = dataTableLayout(width);
356
354
  const columns = normaliseColumns(props.columns);
357
- const labels = { ...DEFAULT_SORT_LABELS, ...sortLabels };
355
+ const labels = { ...defaultSortLabels(useHostLocale()), ...sortLabels };
358
356
  const [current, onSort, spoken] = useSort({ sort, defaultSort, onSortChange, labels, columns });
359
357
  const given = Array.isArray(rows) ? rows : [];
360
- const emptyFallback = useHostSharedText("no_results", EMPTY_FALLBACK);
358
+ const emptyFallback = useSdkText()("no_results");
361
359
  const table = {
362
360
  columns,
363
361
  rows: sortsClientSide(onSortChange) ? sortRows(given, current) : given,
@@ -3,6 +3,8 @@
3
3
  // Split out of the primitive so the ISO and label contract can be unit-tested
4
4
  // without a renderer. No React, no RN here — just Date math and Intl.
5
5
 
6
+ import { sdkText } from "./contract.js";
7
+
6
8
  const DATE_ONLY = /^(\d{4})-(\d{2})-(\d{2})/;
7
9
  const TIME_ONLY = /^(\d{2}):(\d{2})/;
8
10
 
@@ -127,14 +129,14 @@ const TIME_LABEL = { hour: "2-digit", minute: "2-digit" };
127
129
  /**
128
130
  * The text on the picker's field: the value in the viewer's language
129
131
  * (`28 maj 2026`, `May 28, 2026, 2:30 PM`), or a mode-specific placeholder
130
- * when empty. An unreadable value is shown as stored rather than hidden.
132
+ * in that language when empty. An unreadable value is shown as stored rather than hidden.
131
133
  */
132
134
  export function formatDisplayLabel(value, mode, locale) {
133
135
  const effectiveMode = normaliseMode(mode);
134
136
  if (value == null || value === "") {
135
- if (effectiveMode === "time") return "Select time";
136
- if (effectiveMode === "datetime") return "Select date & time";
137
- return "Select date";
137
+ if (effectiveMode === "time") return sdkText("select_time", locale);
138
+ if (effectiveMode === "datetime") return sdkText("select_date_time", locale);
139
+ return sdkText("select_date", locale);
138
140
  }
139
141
  const parts = valueToParts(value, effectiveMode);
140
142
  if (!parts) return String(value);
@@ -4,7 +4,7 @@
4
4
  // sheet on the web, the operating system's own picker on a device.
5
5
 
6
6
  import React from "react";
7
- import { useHostLocale, useHostTheme } from "./hooks.js";
7
+ import { useHostLocale, useHostTheme, useSdkTextDefaults } from "./hooks.js";
8
8
  import { DEFAULT_THEME_TOKENS } from "./_theme-tokens.js";
9
9
  import { Icon } from "./icon.js";
10
10
  import { FIELD_OUTLINE_OFF, fieldStateStyle, resolveFormControlTokens } from "./form-control-tokens.js";
@@ -115,13 +115,14 @@ export function makeDateTimePicker(rn) {
115
115
  disabled = false,
116
116
  accessibilityLabel,
117
117
  placeholder,
118
- clearLabel = "Clear",
119
- doneLabel = "Done",
118
+ clearLabel,
119
+ doneLabel,
120
120
  closeAccessibilityLabel,
121
121
  testID,
122
122
  }) {
123
123
  const theme = useHostTheme() || DEFAULT_THEME_TOKENS;
124
124
  const t = resolveFormControlTokens(theme);
125
+ const labels = useSdkTextDefaults({ clearLabel, doneLabel }, { clearLabel: "clear", doneLabel: "done" });
125
126
  const appLocale = useHostLocale();
126
127
  const locale = React.useMemo(() => resolvePickerLocale(appLocale), [appLocale]);
127
128
  const effectiveMode = normaliseMode(mode);
@@ -182,7 +183,7 @@ export function makeDateTimePicker(rn) {
182
183
  hasValue && canEdit
183
184
  ? h(ClearButton, {
184
185
  t,
185
- label: clearLabel,
186
+ label: labels.clearLabel,
186
187
  testID,
187
188
  onPress: () => {
188
189
  emit(null);
@@ -208,7 +209,7 @@ export function makeDateTimePicker(rn) {
208
209
  onPick: emit,
209
210
  title: accessibilityLabel || shown,
210
211
  heading: accessibilityLabel,
211
- doneLabel,
212
+ doneLabel: labels.doneLabel,
212
213
  closeAccessibilityLabel,
213
214
  testID,
214
215
  t,
@@ -10,11 +10,21 @@
10
10
  // on both hosts, so a picker opened from a card is never cut off.
11
11
 
12
12
  import React from "react";
13
- import { useHostTheme } from "./hooks.js";
13
+ import { useHostTheme, useSdkText, useSdkTextDefaults } from "./hooks.js";
14
14
  import { resolveEmojiPickerTokens, EMOJI_PICKER_DEFAULTS, pushRecentEmoji } from "./emoji-picker-tokens.js";
15
15
  import { EMOJI_CATEGORIES, emojiForCategory, searchEmoji } from "./emoji-data.js";
16
16
 
17
17
  const RECENTS_KEY = "recent";
18
+ const PICKER_TEXT_KEYS = Object.freeze({
19
+ accessibilityLabel: "choose_emoji",
20
+ closeAccessibilityLabel: "close_emoji_picker",
21
+ searchPlaceholder: "search_emoji",
22
+ });
23
+
24
+ /** A category tab's name in the SDK text table. */
25
+ function emojiTabTextKey(key) {
26
+ return `emoji_${key}`;
27
+ }
18
28
 
19
29
  /**
20
30
  * Bind the shared emoji picker to one platform's primitives.
@@ -24,16 +34,18 @@ const RECENTS_KEY = "recent";
24
34
  export function makeEmojiPicker(rn) {
25
35
  const { Overlay, View, Text, Pressable, ScrollView, TextInput } = rn;
26
36
 
27
- function EmojiPicker({
28
- visible = false,
29
- onSelect,
30
- onRequestClose,
31
- recents,
32
- onRecentsChange,
33
- accessibilityLabel = "Choose an emoji",
34
- closeAccessibilityLabel = "Close the emoji picker",
35
- searchPlaceholder = "Search emoji",
36
- }) {
37
+ function EmojiPicker(ownProps) {
38
+ const {
39
+ visible = false,
40
+ onSelect,
41
+ onRequestClose,
42
+ recents,
43
+ onRecentsChange,
44
+ accessibilityLabel,
45
+ closeAccessibilityLabel,
46
+ searchPlaceholder,
47
+ } = useSdkTextDefaults(ownProps, PICKER_TEXT_KEYS);
48
+ const text = useSdkText();
37
49
  const theme = useHostTheme();
38
50
  const tokens = React.useMemo(() => resolveEmojiPickerTokens(theme), [theme]);
39
51
  const [query, setQuery] = React.useState("");
@@ -68,9 +80,9 @@ export function makeEmojiPicker(rn) {
68
80
  [onSelect, onRecentsChange, safeRecents],
69
81
  );
70
82
 
71
- const tabs = safeRecents.length
72
- ? [{ key: RECENTS_KEY, label: "Recent" }, ...EMOJI_CATEGORIES]
73
- : EMOJI_CATEGORIES;
83
+ const tabs = (safeRecents.length ? [{ key: RECENTS_KEY }, ...EMOJI_CATEGORIES] : EMOJI_CATEGORIES).map(
84
+ (tab) => ({ key: tab.key, label: text(emojiTabTextKey(tab.key)) }),
85
+ );
74
86
 
75
87
  return React.createElement(
76
88
  Overlay,
@@ -181,7 +193,7 @@ export function makeEmojiPicker(rn) {
181
193
  testID: "emoji-picker-empty",
182
194
  style: { color: tokens.onSurfaceMuted, fontSize: 13, padding: tokens.padding },
183
195
  },
184
- "No emoji found",
196
+ text("no_emoji_found"),
185
197
  ),
186
198
  ),
187
199
  ),
@@ -8,7 +8,7 @@
8
8
  // passes a `DropZone`, so files can also be dropped onto the field there.
9
9
 
10
10
  import React from "react";
11
- import { useHostSharedText, useHostTheme } from "./hooks.js";
11
+ import { useHostTheme, useSdkText, useSdkTextDefaults } from "./hooks.js";
12
12
  import { DEFAULT_THEME_TOKENS } from "./_theme-tokens.js";
13
13
  import { Icon } from "./icon.js";
14
14
  import { focusHaloStyle, resolveFormControlTokens } from "./form-control-tokens.js";
@@ -17,6 +17,26 @@ import { makeFieldFrame } from "./form-control-view.js";
17
17
  import { fileKey, formatFileSize, pickPayload, planPick } from "./file-upload-logic.js";
18
18
 
19
19
  const h = React.createElement;
20
+
21
+ const COMMON_FILE_TEXT_KEYS = {
22
+ uploadingLabel: "uploading",
23
+ rejectedMessage: "file_type_rejected",
24
+ singleFileMessage: "single_file_kept",
25
+ unsupportedMessage: "file_choice_unavailable",
26
+ };
27
+ const FILE_TEXT_KEYS = Object.freeze({
28
+ ...COMMON_FILE_TEXT_KEYS,
29
+ buttonLabel: "choose_file",
30
+ emptyLabel: "no_file_chosen",
31
+ dropLabel: "drop_file",
32
+ });
33
+ const FILES_TEXT_KEYS = Object.freeze({
34
+ ...COMMON_FILE_TEXT_KEYS,
35
+ buttonLabel: "choose_files",
36
+ emptyLabel: "no_files_chosen",
37
+ dropLabel: "drop_files",
38
+ });
39
+
20
40
  // The remove control's real size; a web host ignores hitSlop.
21
41
  const REMOVE_TARGET = 36;
22
42
  const HIDDEN = {
@@ -108,9 +128,10 @@ export function makeFileUpload(rn, extras) {
108
128
  }
109
129
 
110
130
  /**
111
- * @param {object} props — see `FileUploadProps` in index.d.ts.
131
+ * @param {object} ownProps — see `FileUploadProps` in index.d.ts.
112
132
  */
113
- function FileUpload(props) {
133
+ function FileUpload(ownProps) {
134
+ const props = useSdkTextDefaults(ownProps, ownProps.multiple ? FILES_TEXT_KEYS : FILE_TEXT_KEYS);
114
135
  const {
115
136
  accept,
116
137
  multiple = false,
@@ -125,14 +146,14 @@ export function makeFileUpload(rn, extras) {
125
146
  error,
126
147
  disabled = false,
127
148
  required = false,
128
- buttonLabel = multiple ? "Choose files" : "Choose file",
149
+ buttonLabel,
129
150
  buttonVariant = "outlined",
130
- uploadingLabel = "Uploading…",
131
- emptyLabel = multiple ? "No files chosen" : "No file chosen",
132
- dropLabel = multiple ? "or drop files here" : "or drop a file here",
133
- rejectedMessage = "That file type isn't accepted here.",
134
- singleFileMessage = "Only one file can be added here, so the first was kept.",
135
- unsupportedMessage = "Choosing files isn't available here.",
151
+ uploadingLabel,
152
+ emptyLabel,
153
+ dropLabel,
154
+ rejectedMessage,
155
+ singleFileMessage,
156
+ unsupportedMessage,
136
157
  removeAccessibilityLabel,
137
158
  accessibilityLabel,
138
159
  style,
@@ -141,8 +162,9 @@ export function makeFileUpload(rn, extras) {
141
162
  } = props;
142
163
  const theme = useHostTheme() || DEFAULT_THEME_TOKENS;
143
164
  const t = resolveFormControlTokens(theme);
144
- const sharedRemove = useHostSharedText("remove", "Remove");
145
- const requiredWord = useHostSharedText("required", "Required");
165
+ const text = useSdkText();
166
+ const sharedRemove = text("remove");
167
+ const requiredWord = text("required");
146
168
  const [ownFiles, setOwnFiles] = React.useState([]);
147
169
  const [rejection, setRejection] = React.useState(null);
148
170
  const [focused, setFocused] = React.useState(false);