@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 +5 -1
- package/dist/contract.cjs +1 -1
- package/dist/contract.js +1 -1
- package/dist/datetimepicker-cells.js +1 -1
- package/dist/datetimepicker-names.js +6 -5
- package/dist/datetimepicker-sheet-header.js +1 -1
- package/dist/datetimepicker-sheet-parts.js +2 -2
- package/dist/datetimepicker-sheet-state.js +1 -1
- package/dist/datetimepicker-sheet.js +8 -7
- package/dist/datetimepicker-time-columns.js +2 -2
- package/dist/datetimepicker-view.js +1 -2
- package/dist/datetimepicker.native.js +24 -6
- package/dist/primitives.native.js +2 -6
- package/dist/sdk-texts.cjs +5 -0
- package/dist/sdk-texts.js +5 -0
- package/package.json +1 -1
- package/src/contract.js +1 -1
- package/src/sdk-texts.js +5 -0
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.
|
|
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
|
|
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
|
|
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,8 +1,9 @@
|
|
|
1
|
-
// REQ-WSDK-PLATFORM §6 — the names the
|
|
2
|
-
//
|
|
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" ? "
|
|
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
|
|
93
|
+
// Older engines and Hermes lack `dateTimeField`.
|
|
93
94
|
}
|
|
94
|
-
return field === "hour" ? "
|
|
95
|
+
return textInLanguage(COMPONENT_TEXTS[field === "hour" ? "picker_hour" : "picker_minute"], locale);
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
export function twoDigits(value) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// REQ-WSDK-PLATFORM §6 — the grids of the
|
|
2
|
-
// month's days, and the months or years of the jump. Bound
|
|
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
|
|
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
|
|
2
|
-
// themed calendar and time sheet in `<Overlay>`. The browser's
|
|
3
|
-
// cannot be themed
|
|
4
|
-
//
|
|
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
|
-
|
|
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
|
|
2
|
-
// `<DateTimePicker>` sheet. Bound
|
|
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
|
|
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
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
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
|
-
|
|
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)
|
|
28
|
-
//
|
|
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.
|
package/dist/sdk-texts.cjs
CHANGED
|
@@ -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
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
|
|
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" },
|