@colixsystems/widget-sdk 0.343.0 → 0.343.1

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.343.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**.
94
+ `v0.343.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**.
95
+
96
+ ### What's new in 0.343.1 (contract 1.280.0)
97
+
98
+ **`<DateTimePicker>` opens its calendar on the first tap on iOS.** iOS's own picker opened as a compact date chip below the field, and only a second tap on the chip showed the calendar. The field now opens the same themed calendar and time sheet the web shows: in the app's language and theme, with its bounds. The sheet scrolls when the calendar and the time columns stack taller than a small phone, and a keyboard left up by a text field closes as it opens. Android keeps its own date and time dialogs, which already open on the first tap. Fix-only: no prop or export changed.
95
99
 
96
100
  ### What's new in 0.343.0 (contract 1.280.0)
97
101
 
package/dist/contract.cjs CHANGED
@@ -3690,7 +3690,7 @@ const PRIMITIVES = [
3690
3690
  {
3691
3691
  name: "DateTimePicker",
3692
3692
  description:
3693
- 'Cross-platform date / time / datetime field. `<DateTimePicker value={iso} onChange={iso => …} mode="date" | "time" | "datetime" accessibilityLabel="Due" />`. The value prop and the onChange callback both speak ISO 8601 strings (the datastore wire format): `YYYY-MM-DD` for date, `HH:mm` for time, a full UTC instant for datetime — authors never round-trip through `new Date()`. Clearing emits "". The field shows the value in the app user\'s language beside a calendar (or clock) icon, with a clear button once it holds a value. Web opens a themed calendar sheet in `<Overlay>`: a month grid (keyboard: arrows, Home/End, PageUp/PageDown), a month and year jump, hour and minute columns for time, and a Today / Now button. Native opens the operating system\'s own picker (@react-native-community/datetimepicker). `minimumDate` / `maximumDate` (ISO, `HH:mm` in time mode) bound what can be picked; `disabled` locks the field. Optional copy: `placeholder`, `clearLabel` (default "Clear"), `doneLabel` (default "Done", closes the web time sheet), `closeAccessibilityLabel`; `testID` names the field. Colours come from the workspace theme — the field from the text-field tokens, the sheet from the popover scope, the chosen day from `colors.primary`; never style it with raw CSS or `document`.',
3693
+ 'Cross-platform date / time / datetime field. `<DateTimePicker value={iso} onChange={iso => …} mode="date" | "time" | "datetime" accessibilityLabel="Due" />`. The value prop and the onChange callback both speak ISO 8601 strings (the datastore wire format): `YYYY-MM-DD` for date, `HH:mm` for time, a full UTC instant for datetime — authors never round-trip through `new Date()`. Clearing emits "". The field shows the value in the app user\'s language beside a calendar (or clock) icon, with a clear button once it holds a value. Web and iOS open a themed calendar sheet in `<Overlay>`: a month grid (keyboard: arrows, Home/End, PageUp/PageDown), a month and year jump, hour and minute columns for time, and a Today / Now button. Android opens the operating system\'s own date and time dialogs (@react-native-community/datetimepicker). `minimumDate` / `maximumDate` (ISO, `HH:mm` in time mode) bound what can be picked; `disabled` locks the field. Optional copy: `placeholder`, `clearLabel` (default "Clear"), `doneLabel` (default "Done", closes the time sheet), `closeAccessibilityLabel`; `testID` names the field. Colours come from the workspace theme — the field from the text-field tokens, the sheet from the popover scope, the chosen day from `colors.primary`; never style it with raw CSS or `document`.',
3694
3694
  rnComponent: "@react-native-community/datetimepicker",
3695
3695
  docsUrl: "https://github.com/react-native-datetimepicker/datetimepicker",
3696
3696
  },
package/dist/contract.js CHANGED
@@ -3685,7 +3685,7 @@ const PRIMITIVES = [
3685
3685
  {
3686
3686
  name: "DateTimePicker",
3687
3687
  description:
3688
- 'Cross-platform date / time / datetime field. `<DateTimePicker value={iso} onChange={iso => …} mode="date" | "time" | "datetime" accessibilityLabel="Due" />`. The value prop and the onChange callback both speak ISO 8601 strings (the datastore wire format): `YYYY-MM-DD` for date, `HH:mm` for time, a full UTC instant for datetime — authors never round-trip through `new Date()`. Clearing emits "". The field shows the value in the app user\'s language beside a calendar (or clock) icon, with a clear button once it holds a value. Web opens a themed calendar sheet in `<Overlay>`: a month grid (keyboard: arrows, Home/End, PageUp/PageDown), a month and year jump, hour and minute columns for time, and a Today / Now button. Native opens the operating system\'s own picker (@react-native-community/datetimepicker). `minimumDate` / `maximumDate` (ISO, `HH:mm` in time mode) bound what can be picked; `disabled` locks the field. Optional copy: `placeholder`, `clearLabel` (default "Clear"), `doneLabel` (default "Done", closes the web time sheet), `closeAccessibilityLabel`; `testID` names the field. Colours come from the workspace theme — the field from the text-field tokens, the sheet from the popover scope, the chosen day from `colors.primary`; never style it with raw CSS or `document`.',
3688
+ 'Cross-platform date / time / datetime field. `<DateTimePicker value={iso} onChange={iso => …} mode="date" | "time" | "datetime" accessibilityLabel="Due" />`. The value prop and the onChange callback both speak ISO 8601 strings (the datastore wire format): `YYYY-MM-DD` for date, `HH:mm` for time, a full UTC instant for datetime — authors never round-trip through `new Date()`. Clearing emits "". The field shows the value in the app user\'s language beside a calendar (or clock) icon, with a clear button once it holds a value. Web and iOS open a themed calendar sheet in `<Overlay>`: a month grid (keyboard: arrows, Home/End, PageUp/PageDown), a month and year jump, hour and minute columns for time, and a Today / Now button. Android opens the operating system\'s own date and time dialogs (@react-native-community/datetimepicker). `minimumDate` / `maximumDate` (ISO, `HH:mm` in time mode) bound what can be picked; `disabled` locks the field. Optional copy: `placeholder`, `clearLabel` (default "Clear"), `doneLabel` (default "Done", closes the time sheet), `closeAccessibilityLabel`; `testID` names the field. Colours come from the workspace theme — the field from the text-field tokens, the sheet from the popover scope, the chosen day from `colors.primary`; never style it with raw CSS or `document`.',
3689
3689
  rnComponent: "@react-native-community/datetimepicker",
3690
3690
  docsUrl: "https://github.com/react-native-datetimepicker/datetimepicker",
3691
3691
  },
@@ -1,4 +1,4 @@
1
- // REQ-WSDK-PLATFORM §6 — what every pickable cell of the web
1
+ // REQ-WSDK-PLATFORM §6 — what every pickable cell of the
2
2
  // `<DateTimePicker>` sheet shares: its look, and how keyboard focus reaches it.
3
3
 
4
4
  import React from "react";
@@ -1,8 +1,9 @@
1
- // REQ-WSDK-PLATFORM §6 — the names the web `<DateTimePicker>` sheet shows,
2
- // in the viewer's language through Intl, with English when an engine refuses.
1
+ // REQ-WSDK-PLATFORM §6 — the names the `<DateTimePicker>` sheet shows, in the
2
+ // viewer's language through Intl, with the SDK's own texts when an engine refuses.
3
3
 
4
4
  import { normaliseMode, partsToDate } from "./datetimepicker-format.js";
5
5
  import { WEEK_LENGTH } from "./datetimepicker-calendar.js";
6
+ import { COMPONENT_TEXTS, textInLanguage } from "./sdk-texts.js";
6
7
 
7
8
  const ENGLISH_MONTHS = [
8
9
  "January", "February", "March", "April", "May", "June",
@@ -79,7 +80,7 @@ export function relativeNowLabel(locale, mode) {
79
80
  const text = new Intl.RelativeTimeFormat(locale || undefined, { numeric: "auto" }).format(0, unit);
80
81
  return capitalise(text, locale);
81
82
  } catch {
82
- return unit === "day" ? "Today" : "Now";
83
+ return textInLanguage(COMPONENT_TEXTS[unit === "day" ? "picker_today" : "picker_now"], locale);
83
84
  }
84
85
  }
85
86
 
@@ -89,9 +90,9 @@ export function fieldName(locale, field) {
89
90
  const name = new Intl.DisplayNames(locale || undefined, { type: "dateTimeField" }).of(field);
90
91
  if (name) return capitalise(name, locale);
91
92
  } catch {
92
- // Older engines lack `dateTimeField`; the English name stands in.
93
+ // Older engines and Hermes lack `dateTimeField`.
93
94
  }
94
- return field === "hour" ? "Hour" : "Minute";
95
+ return textInLanguage(COMPONENT_TEXTS[field === "hour" ? "picker_hour" : "picker_minute"], locale);
95
96
  }
96
97
 
97
98
  export function twoDigits(value) {
@@ -1,4 +1,4 @@
1
- // REQ-WSDK-PLATFORM §6 — the controls of the web `<DateTimePicker>` sheet:
1
+ // REQ-WSDK-PLATFORM §6 — the controls of the `<DateTimePicker>` sheet:
2
2
  // the header that pages and zooms the calendar, its buttons, and the items of
3
3
  // the month and year grids.
4
4
 
@@ -1,5 +1,5 @@
1
- // REQ-WSDK-PLATFORM §6 — the grids of the web `<DateTimePicker>` sheet: the
2
- // month's days, and the months or years of the jump. Bound to react-native-web
1
+ // REQ-WSDK-PLATFORM §6 — the grids of the `<DateTimePicker>` sheet: the
2
+ // month's days, and the months or years of the jump. Bound
3
3
  // by ./datetimepicker-sheet.js.
4
4
 
5
5
  import React from "react";
@@ -1,4 +1,4 @@
1
- // REQ-WSDK-PLATFORM §6 — the state of an open web `<DateTimePicker>` sheet:
1
+ // REQ-WSDK-PLATFORM §6 — the state of an open `<DateTimePicker>` sheet:
2
2
  // the draft value, the month or period on show, the day holding keyboard
3
3
  // focus, and every way the viewer changes them.
4
4
 
@@ -1,7 +1,7 @@
1
- // REQ-WSDK-PLATFORM §6 — the web `<DateTimePicker>`'s picking surface: a
2
- // themed calendar and time sheet in `<Overlay>`. The browser's own date popup
3
- // cannot be themed or styled, so the web draws its own; a device keeps the
4
- // operating system's picker (./datetimepicker.native.js).
1
+ // REQ-WSDK-PLATFORM §6 — the `<DateTimePicker>`'s picking surface on the web
2
+ // and iOS: a themed calendar and time sheet in `<Overlay>`. The browser's date
3
+ // popup cannot be themed, and iOS's opens as a chip needing a second tap;
4
+ // Android keeps its OS dialog (./datetimepicker.native.js).
5
5
 
6
6
  import React from "react";
7
7
  import { GRID_ROWS, firstDayOfWeek, isHourAllowed, isTimeAllowed } from "./datetimepicker-calendar.js";
@@ -20,7 +20,7 @@ const SHEET_PADDING = 16;
20
20
 
21
21
  /** @param {{View: any, Text: any, Pressable: any, ScrollView: any, Platform: any, Overlay: any}} rn */
22
22
  export function makeDateTimeSheet(rn) {
23
- const { View, Text, Overlay } = rn;
23
+ const { View, Text, ScrollView, Overlay } = rn;
24
24
  const { DayGrid, PeriodGrid } = makeSheetParts(rn);
25
25
  const TimeColumns = makeTimeColumns(rn);
26
26
  const { Header, TextButton } = makeSheetControls(rn);
@@ -66,9 +66,10 @@ export function makeDateTimeSheet(rn) {
66
66
  function SheetBody({ t, mode, parts, bounds, locale, heading, onPick, onClose, doneLabel, testID }) {
67
67
  const state = useSheetState({ mode, parts, bounds, onPick, onClose });
68
68
  const shared = { t, state, bounds, locale, testID };
69
+ // Scrolls where calendar and time stack taller than a small phone.
69
70
  return h(
70
- View,
71
- { style: { gap: 16, alignItems: "center" } },
71
+ ScrollView,
72
+ { style: { flexShrink: 1 }, contentContainerStyle: { gap: 16, alignItems: "center" } },
72
73
  // The sheet covers its field, so it names the field it edits.
73
74
  heading
74
75
  ? h(Text, { style: { alignSelf: "stretch", fontFamily: t.fontFamily, fontSize: t.labelSize, fontWeight: "500", color: t.helperColor } }, heading)
@@ -1,5 +1,5 @@
1
- // REQ-WSDK-PLATFORM §6 — the hour and minute columns of the web
2
- // `<DateTimePicker>` sheet. Bound to react-native-web by ./datetimepicker-sheet.js.
1
+ // REQ-WSDK-PLATFORM §6 — the hour and minute columns of the
2
+ // `<DateTimePicker>` sheet. Bound by ./datetimepicker-sheet.js.
3
3
 
4
4
  import React from "react";
5
5
  import { nextOptionIndex } from "./form-control-tokens.js";
@@ -1,7 +1,7 @@
1
1
  // REQ-WSDK-PLATFORM §6 — the ONE `<DateTimePicker>` field both hosts render.
2
2
  // The field (icon, value in the viewer's language, clear button) is shared;
3
3
  // what opens when it is pressed is the host's `Surface`: a themed calendar
4
- // sheet on the web, the operating system's own picker on a device.
4
+ // sheet on the web and iOS, the operating system's own dialog on Android.
5
5
 
6
6
  import React from "react";
7
7
  import { useHostLocale, useHostTheme, useSdkTextDefaults } from "./hooks.js";
@@ -194,7 +194,6 @@ export function makeDateTimePicker(rn) {
194
194
  : null,
195
195
  );
196
196
 
197
- // A sibling of the field: iOS draws its picker inline, below it.
198
197
  return h(
199
198
  React.Fragment,
200
199
  null,
@@ -1,14 +1,17 @@
1
- // `<DateTimePicker>` (native). Binds ./datetimepicker-view.js to React Native
2
- // with the operating system's own picker as its surface, via
3
- // `@react-native-community/datetimepicker`. That library is imperative on
4
- // Android — rendering it opens the dialog — so it mounts only while open.
1
+ // `<DateTimePicker>` (native). Binds ./datetimepicker-view.js to React Native.
2
+ // iOS opens the web's themed calendar sheet: its own picker opens as a compact
3
+ // chip that takes a second tap. Android keeps its OS dialog, via
4
+ // `@react-native-community/datetimepicker`, which is imperative there —
5
+ // rendering it opens the dialog — so it mounts only while open.
5
6
 
6
7
  import React from "react";
7
8
  // eslint-disable-next-line no-restricted-syntax
8
9
  import RNDateTimePicker from "@react-native-community/datetimepicker";
9
- import { View, Pressable, Platform } from "react-native";
10
+ import { View, Pressable, ScrollView, Platform, Keyboard } from "react-native";
10
11
  import { Text } from "./bounded-text.native.js";
11
12
  import { makeDateTimePicker } from "./datetimepicker-view.js";
13
+ import { makeDateTimeSheet } from "./datetimepicker-sheet.js";
14
+ import { Overlay } from "./overlay.native.js";
12
15
  import { nowParts, partsToDate } from "./datetimepicker-format.js";
13
16
  import { osDialogModes, applyDialogPick } from "./datetimepicker-os-steps.js";
14
17
  import { clampToBounds } from "./datetimepicker-calendar.js";
@@ -62,4 +65,19 @@ function dropEmpty(parts) {
62
65
  return Object.fromEntries(Object.entries(parts).filter(([, v]) => v != null));
63
66
  }
64
67
 
65
- export const DateTimePicker = makeDateTimePicker({ View, Text, Pressable, Platform, Surface: OsPicker });
68
+ const primitives = { View, Text, Pressable, ScrollView, Platform };
69
+ const Sheet = makeDateTimeSheet({ ...primitives, Overlay });
70
+
71
+ function IosSheet(props) {
72
+ // iOS keeps a focused input's keyboard up over the sheet, hiding its lower half.
73
+ React.useEffect(() => {
74
+ if (props.open) Keyboard.dismiss();
75
+ }, [props.open]);
76
+ return React.createElement(Sheet, props);
77
+ }
78
+
79
+ function Surface(props) {
80
+ return React.createElement(Platform.OS === "ios" ? IosSheet : OsPicker, props);
81
+ }
82
+
83
+ export const DateTimePicker = makeDateTimePicker({ ...primitives, Surface });
@@ -24,12 +24,8 @@ export { Text, TextInput } from "./bounded-text.native.js";
24
24
  // REQ-WSDK-PLATFORM §6 — `<Icon>` is implemented in one file that runs on
25
25
  // both platforms (lucide-react-native ships a working build for both).
26
26
  export { Icon } from "./icon.js";
27
- // REQ-WSDK-PLATFORM §6 — `<DateTimePicker>` (native). Wraps
28
- // @react-native-community/datetimepicker, which ships iOS / Android only
29
- // and has no react-native-web mapping, so the web build uses a separate
30
- // implementation backed by `<input type="date|time|datetime-local">` in
31
- // `./datetimepicker.js`. Both files honour the same ISO 8601 value /
32
- // onChange contract.
27
+ // REQ-WSDK-PLATFORM §6 — `<DateTimePicker>` (native): the shared field with
28
+ // the themed sheet on iOS and the OS dialogs on Android.
33
29
  export { DateTimePicker } from "./datetimepicker.native.js";
34
30
  // sc-1378 — `<FilePicker>` (native). Opens the OS document picker
35
31
  // (expo-document-picker); the web counterpart wraps a hidden file input.
@@ -20,6 +20,11 @@ const COMPONENT_TEXTS = Object.freeze({
20
20
  select_placeholder: { en: "Select", sv: "Välj" },
21
21
  no_options: { en: "No options", sv: "Inga alternativ" },
22
22
  done: { en: "Done", sv: "Klar" },
23
+ // The DateTimePicker sheet's fallbacks where an engine lacks the Intl names (Hermes).
24
+ picker_today: { en: "Today", sv: "I dag" },
25
+ picker_now: { en: "Now", sv: "Nu" },
26
+ picker_hour: { en: "Hour", sv: "Timme" },
27
+ picker_minute: { en: "Minute", sv: "Minut" },
23
28
  selected_count: {
24
29
  en: { one: "{count} selected", other: "{count} selected" },
25
30
  sv: { one: "{count} vald", other: "{count} valda" },
package/dist/sdk-texts.js CHANGED
@@ -16,6 +16,11 @@ export const COMPONENT_TEXTS = Object.freeze({
16
16
  select_placeholder: { en: "Select", sv: "Välj" },
17
17
  no_options: { en: "No options", sv: "Inga alternativ" },
18
18
  done: { en: "Done", sv: "Klar" },
19
+ // The DateTimePicker sheet's fallbacks where an engine lacks the Intl names (Hermes).
20
+ picker_today: { en: "Today", sv: "I dag" },
21
+ picker_now: { en: "Now", sv: "Nu" },
22
+ picker_hour: { en: "Hour", sv: "Timme" },
23
+ picker_minute: { en: "Minute", sv: "Minut" },
19
24
  selected_count: {
20
25
  en: { one: "{count} selected", other: "{count} selected" },
21
26
  sv: { one: "{count} vald", other: "{count} valda" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.343.0",
3
+ "version": "0.343.1",
4
4
  "description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/contract.js CHANGED
@@ -3685,7 +3685,7 @@ const PRIMITIVES = [
3685
3685
  {
3686
3686
  name: "DateTimePicker",
3687
3687
  description:
3688
- 'Cross-platform date / time / datetime field. `<DateTimePicker value={iso} onChange={iso => …} mode="date" | "time" | "datetime" accessibilityLabel="Due" />`. The value prop and the onChange callback both speak ISO 8601 strings (the datastore wire format): `YYYY-MM-DD` for date, `HH:mm` for time, a full UTC instant for datetime — authors never round-trip through `new Date()`. Clearing emits "". The field shows the value in the app user\'s language beside a calendar (or clock) icon, with a clear button once it holds a value. Web opens a themed calendar sheet in `<Overlay>`: a month grid (keyboard: arrows, Home/End, PageUp/PageDown), a month and year jump, hour and minute columns for time, and a Today / Now button. Native opens the operating system\'s own picker (@react-native-community/datetimepicker). `minimumDate` / `maximumDate` (ISO, `HH:mm` in time mode) bound what can be picked; `disabled` locks the field. Optional copy: `placeholder`, `clearLabel` (default "Clear"), `doneLabel` (default "Done", closes the web time sheet), `closeAccessibilityLabel`; `testID` names the field. Colours come from the workspace theme — the field from the text-field tokens, the sheet from the popover scope, the chosen day from `colors.primary`; never style it with raw CSS or `document`.',
3688
+ 'Cross-platform date / time / datetime field. `<DateTimePicker value={iso} onChange={iso => …} mode="date" | "time" | "datetime" accessibilityLabel="Due" />`. The value prop and the onChange callback both speak ISO 8601 strings (the datastore wire format): `YYYY-MM-DD` for date, `HH:mm` for time, a full UTC instant for datetime — authors never round-trip through `new Date()`. Clearing emits "". The field shows the value in the app user\'s language beside a calendar (or clock) icon, with a clear button once it holds a value. Web and iOS open a themed calendar sheet in `<Overlay>`: a month grid (keyboard: arrows, Home/End, PageUp/PageDown), a month and year jump, hour and minute columns for time, and a Today / Now button. Android opens the operating system\'s own date and time dialogs (@react-native-community/datetimepicker). `minimumDate` / `maximumDate` (ISO, `HH:mm` in time mode) bound what can be picked; `disabled` locks the field. Optional copy: `placeholder`, `clearLabel` (default "Clear"), `doneLabel` (default "Done", closes the time sheet), `closeAccessibilityLabel`; `testID` names the field. Colours come from the workspace theme — the field from the text-field tokens, the sheet from the popover scope, the chosen day from `colors.primary`; never style it with raw CSS or `document`.',
3689
3689
  rnComponent: "@react-native-community/datetimepicker",
3690
3690
  docsUrl: "https://github.com/react-native-datetimepicker/datetimepicker",
3691
3691
  },
package/src/sdk-texts.js CHANGED
@@ -16,6 +16,11 @@ export const COMPONENT_TEXTS = Object.freeze({
16
16
  select_placeholder: { en: "Select", sv: "Välj" },
17
17
  no_options: { en: "No options", sv: "Inga alternativ" },
18
18
  done: { en: "Done", sv: "Klar" },
19
+ // The DateTimePicker sheet's fallbacks where an engine lacks the Intl names (Hermes).
20
+ picker_today: { en: "Today", sv: "I dag" },
21
+ picker_now: { en: "Now", sv: "Nu" },
22
+ picker_hour: { en: "Hour", sv: "Timme" },
23
+ picker_minute: { en: "Minute", sv: "Minut" },
19
24
  selected_count: {
20
25
  en: { one: "{count} selected", other: "{count} selected" },
21
26
  sv: { one: "{count} vald", other: "{count} valda" },