@colixsystems/widget-sdk 0.342.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 +10 -2
- package/dist/contract.cjs +9 -4
- package/dist/contract.js +9 -4
- 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/index.d.ts +4 -3
- 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 +9 -4
- package/src/sdk-texts.js +5 -0
package/README.md
CHANGED
|
@@ -91,7 +91,15 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
91
91
|
|
|
92
92
|
## Status
|
|
93
93
|
|
|
94
|
-
`v0.
|
|
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.
|
|
99
|
+
|
|
100
|
+
### What's new in 0.343.0 (contract 1.280.0)
|
|
101
|
+
|
|
102
|
+
**A tools server whose sign-in is not set up yet says so.** Some servers let people sign in only through an app the app's administrator registers first, such as one that signs in with Microsoft Entra ID. Until that is done, `connections.add` and `connections.signIn` reject with an `AgentError` whose `code` is `SIGN_IN_NEEDS_SETUP` (422). Tell the person to ask the app's administrator to set the sign-in up; no access token fixes it, so do not open the token field for it. `SIGN_IN_NOT_SUPPORTED` keeps its meaning: the server takes an access token. Additive.
|
|
95
103
|
|
|
96
104
|
### What's new in 0.342.0 (contract 1.279.0)
|
|
97
105
|
|
|
@@ -136,7 +144,7 @@ A template never carries a credential (a token, password, API key value or clien
|
|
|
136
144
|
|
|
137
145
|
### What's new in 0.337.0 (contract 1.275.0)
|
|
138
146
|
|
|
139
|
-
**An app user can sign in to a tools server that asks for it.** Call `connections.add({ name, server_url, token: "" })` for a server that asks people to sign in and the item comes back with `auth_kind: "oauth"` and `status: "needs_sign_in"`. Offer a "Sign in" action on an `oauth` item whose `status` is not `connected`, and only when `connections.signIn` is a function: the host runs the sign-in, and it is absent on the Studio canvas and on older hosts, so a widget never shows a dead button. `signIn(id)` resolves to the connected item, or rejects with an `AgentError` whose `code` is `SIGN_IN_CANCELLED`, `SIGN_IN_FAILED`, `CONFIRM_INVALID`, `NOT_A_SIGN_IN_SERVER`, `SERVER_UNREACHABLE` or `RATE_LIMITED`. In a phone app the sign-in opens in the in-app browser and the call settles when it closes. On the web the page itself goes to the sign-in, so the call never settles; when the page loads again, `connections.signInResult` is `{ connection, error }` for that sign-in (otherwise `null`), and the item is already connected. A server whose sign-in this app cannot use is refused on `add` with `SIGN_IN_NOT_SUPPORTED`. Additive.
|
|
147
|
+
**An app user can sign in to a tools server that asks for it.** Call `connections.add({ name, server_url, token: "" })` for a server that asks people to sign in and the item comes back with `auth_kind: "oauth"` and `status: "needs_sign_in"`. Offer a "Sign in" action on an `oauth` item whose `status` is not `connected`, and only when `connections.signIn` is a function: the host runs the sign-in, and it is absent on the Studio canvas and on older hosts, so a widget never shows a dead button. `signIn(id)` resolves to the connected item, or rejects with an `AgentError` whose `code` is `SIGN_IN_CANCELLED`, `SIGN_IN_FAILED`, `CONFIRM_INVALID`, `NOT_A_SIGN_IN_SERVER`, `SIGN_IN_NEEDS_SETUP`, `SERVER_UNREACHABLE` or `RATE_LIMITED`. In a phone app the sign-in opens in the in-app browser and the call settles when it closes. On the web the page itself goes to the sign-in, so the call never settles; when the page loads again, `connections.signInResult` is `{ connection, error }` for that sign-in (otherwise `null`), and the item is already connected. A server whose sign-in this app cannot use is refused on `add` with `SIGN_IN_NOT_SUPPORTED`. Additive.
|
|
140
148
|
|
|
141
149
|
```jsx
|
|
142
150
|
const { connections } = useAgent(props.agentId, { connections: true });
|
package/dist/contract.cjs
CHANGED
|
@@ -2292,13 +2292,15 @@ const HOOKS = [
|
|
|
2292
2292
|
"false on a 403 — APP_USER_SESSION_REQUIRED (the studio canvas, a preview or a signed-out visitor) or " +
|
|
2293
2293
|
"TOOLS_NOT_ENABLED (the author has not let app users connect tools to this agent). add, test and " +
|
|
2294
2294
|
"remove reject with AgentError: TOO_MANY_CONNECTIONS and NAME_IN_USE (409), INVALID_SERVER_URL, " +
|
|
2295
|
-
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN
|
|
2295
|
+
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN, SIGN_IN_NOT_SUPPORTED and " +
|
|
2296
|
+
"SIGN_IN_NEEDS_SETUP (422). SIGN_IN_NEEDS_SETUP means the server's sign-in needs the app's " +
|
|
2297
|
+
"administrator to register it first: tell the user to ask them, and do NOT open a token field for it. " +
|
|
2296
2298
|
"SIGN-IN (sc-17590): add with an empty token to a server that asks people to sign in answers " +
|
|
2297
2299
|
"auth_kind 'oauth', status 'needs_sign_in'. Offer a Sign in action on an 'oauth' item whose status is " +
|
|
2298
2300
|
"not 'connected', and ONLY when `connections.signIn` is a function (the host runs the sign-in; it is " +
|
|
2299
2301
|
"absent on the studio canvas and on older hosts, so never show a dead button). signIn(id) resolves to " +
|
|
2300
2302
|
"the connected item or rejects AgentError: SIGN_IN_CANCELLED, SIGN_IN_FAILED, CONFIRM_INVALID, " +
|
|
2301
|
-
"NOT_A_SIGN_IN_SERVER, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2303
|
+
"NOT_A_SIGN_IN_SERVER, SIGN_IN_NEEDS_SETUP, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2302
2304
|
"the call never settles; when the page loads again `connections.signInResult` is " +
|
|
2303
2305
|
"{ connection, error } for that sign-in (null otherwise): show the outcome from it. " +
|
|
2304
2306
|
"A turn that used one of them carries an activity entry { tool: 'mcp', ok, server } " +
|
|
@@ -3688,7 +3690,7 @@ const PRIMITIVES = [
|
|
|
3688
3690
|
{
|
|
3689
3691
|
name: "DateTimePicker",
|
|
3690
3692
|
description:
|
|
3691
|
-
'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`.',
|
|
3692
3694
|
rnComponent: "@react-native-community/datetimepicker",
|
|
3693
3695
|
docsUrl: "https://github.com/react-native-datetimepicker/datetimepicker",
|
|
3694
3696
|
},
|
|
@@ -7144,7 +7146,10 @@ const CONTRACT = deepFreeze({
|
|
|
7144
7146
|
// contract is shared with the action SDK (`./connector-template`).
|
|
7145
7147
|
// 1.279.0: additive (sc-18049) — useI18n() returns formatDate(value, { time }?),
|
|
7146
7148
|
// a date in the app's language with its month named; "—" when empty.
|
|
7147
|
-
|
|
7149
|
+
// 1.280.0: additive (sc-18010) — connections.add and connections.signIn
|
|
7150
|
+
// may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
|
|
7151
|
+
// app's administrator to register it first. No token fixes it.
|
|
7152
|
+
version: "1.280.0",
|
|
7148
7153
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7149
7154
|
hooks: HOOKS,
|
|
7150
7155
|
primitives: PRIMITIVES,
|
package/dist/contract.js
CHANGED
|
@@ -2287,13 +2287,15 @@ const HOOKS = [
|
|
|
2287
2287
|
"false on a 403 — APP_USER_SESSION_REQUIRED (the studio canvas, a preview or a signed-out visitor) or " +
|
|
2288
2288
|
"TOOLS_NOT_ENABLED (the author has not let app users connect tools to this agent). add, test and " +
|
|
2289
2289
|
"remove reject with AgentError: TOO_MANY_CONNECTIONS and NAME_IN_USE (409), INVALID_SERVER_URL, " +
|
|
2290
|
-
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN
|
|
2290
|
+
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN, SIGN_IN_NOT_SUPPORTED and " +
|
|
2291
|
+
"SIGN_IN_NEEDS_SETUP (422). SIGN_IN_NEEDS_SETUP means the server's sign-in needs the app's " +
|
|
2292
|
+
"administrator to register it first: tell the user to ask them, and do NOT open a token field for it. " +
|
|
2291
2293
|
"SIGN-IN (sc-17590): add with an empty token to a server that asks people to sign in answers " +
|
|
2292
2294
|
"auth_kind 'oauth', status 'needs_sign_in'. Offer a Sign in action on an 'oauth' item whose status is " +
|
|
2293
2295
|
"not 'connected', and ONLY when `connections.signIn` is a function (the host runs the sign-in; it is " +
|
|
2294
2296
|
"absent on the studio canvas and on older hosts, so never show a dead button). signIn(id) resolves to " +
|
|
2295
2297
|
"the connected item or rejects AgentError: SIGN_IN_CANCELLED, SIGN_IN_FAILED, CONFIRM_INVALID, " +
|
|
2296
|
-
"NOT_A_SIGN_IN_SERVER, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2298
|
+
"NOT_A_SIGN_IN_SERVER, SIGN_IN_NEEDS_SETUP, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2297
2299
|
"the call never settles; when the page loads again `connections.signInResult` is " +
|
|
2298
2300
|
"{ connection, error } for that sign-in (null otherwise): show the outcome from it. " +
|
|
2299
2301
|
"A turn that used one of them carries an activity entry { tool: 'mcp', ok, server } " +
|
|
@@ -3683,7 +3685,7 @@ const PRIMITIVES = [
|
|
|
3683
3685
|
{
|
|
3684
3686
|
name: "DateTimePicker",
|
|
3685
3687
|
description:
|
|
3686
|
-
'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`.',
|
|
3687
3689
|
rnComponent: "@react-native-community/datetimepicker",
|
|
3688
3690
|
docsUrl: "https://github.com/react-native-datetimepicker/datetimepicker",
|
|
3689
3691
|
},
|
|
@@ -7139,7 +7141,10 @@ const CONTRACT = deepFreeze({
|
|
|
7139
7141
|
// contract is shared with the action SDK (`./connector-template`).
|
|
7140
7142
|
// 1.279.0: additive (sc-18049) — useI18n() returns formatDate(value, { time }?),
|
|
7141
7143
|
// a date in the app's language with its month named; "—" when empty.
|
|
7142
|
-
|
|
7144
|
+
// 1.280.0: additive (sc-18010) — connections.add and connections.signIn
|
|
7145
|
+
// may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
|
|
7146
|
+
// app's administrator to register it first. No token fixes it.
|
|
7147
|
+
version: "1.280.0",
|
|
7143
7148
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7144
7149
|
hooks: HOOKS,
|
|
7145
7150
|
primitives: PRIMITIVES,
|
|
@@ -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 });
|
package/dist/index.d.ts
CHANGED
|
@@ -2249,8 +2249,9 @@ export interface AgentConnections {
|
|
|
2249
2249
|
error: AgentError | null;
|
|
2250
2250
|
/**
|
|
2251
2251
|
* Rejects AgentError: TOO_MANY_CONNECTIONS, NAME_IN_USE, INVALID_SERVER_URL, SERVER_UNREACHABLE,
|
|
2252
|
-
* NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN, SIGN_IN_NOT_SUPPORTED
|
|
2253
|
-
*
|
|
2252
|
+
* NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN, SIGN_IN_NOT_SUPPORTED, SIGN_IN_NEEDS_SETUP (the server's
|
|
2253
|
+
* sign-in needs the app's administrator to register it first; no token fixes it). An empty token to a
|
|
2254
|
+
* server that asks people to sign in answers an `oauth` item with status `needs_sign_in`.
|
|
2254
2255
|
*/
|
|
2255
2256
|
add(body: { name: string; server_url: string; token: string }): Promise<AgentMcpConnection>;
|
|
2256
2257
|
/** Reconnects and re-reads the server's tools. */
|
|
@@ -2260,7 +2261,7 @@ export interface AgentConnections {
|
|
|
2260
2261
|
/**
|
|
2261
2262
|
* sc-17590 — signs the person in to an `oauth` server, run by the host. Absent where the host
|
|
2262
2263
|
* cannot (the studio canvas, older hosts): offer no Sign in action then. Rejects AgentError:
|
|
2263
|
-
* SIGN_IN_CANCELLED, SIGN_IN_FAILED, CONFIRM_INVALID, NOT_A_SIGN_IN_SERVER, SERVER_UNREACHABLE,
|
|
2264
|
+
* SIGN_IN_CANCELLED, SIGN_IN_FAILED, CONFIRM_INVALID, NOT_A_SIGN_IN_SERVER, SIGN_IN_NEEDS_SETUP, SERVER_UNREACHABLE,
|
|
2264
2265
|
* RATE_LIMITED. On web the page leaves for the sign-in and the promise never settles.
|
|
2265
2266
|
*/
|
|
2266
2267
|
signIn?(id: string): Promise<AgentMcpConnection>;
|
|
@@ -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
|
@@ -2287,13 +2287,15 @@ const HOOKS = [
|
|
|
2287
2287
|
"false on a 403 — APP_USER_SESSION_REQUIRED (the studio canvas, a preview or a signed-out visitor) or " +
|
|
2288
2288
|
"TOOLS_NOT_ENABLED (the author has not let app users connect tools to this agent). add, test and " +
|
|
2289
2289
|
"remove reject with AgentError: TOO_MANY_CONNECTIONS and NAME_IN_USE (409), INVALID_SERVER_URL, " +
|
|
2290
|
-
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN
|
|
2290
|
+
"SERVER_UNREACHABLE, NOT_AN_MCP_SERVER, SERVER_REQUIRES_SIGN_IN, SIGN_IN_NOT_SUPPORTED and " +
|
|
2291
|
+
"SIGN_IN_NEEDS_SETUP (422). SIGN_IN_NEEDS_SETUP means the server's sign-in needs the app's " +
|
|
2292
|
+
"administrator to register it first: tell the user to ask them, and do NOT open a token field for it. " +
|
|
2291
2293
|
"SIGN-IN (sc-17590): add with an empty token to a server that asks people to sign in answers " +
|
|
2292
2294
|
"auth_kind 'oauth', status 'needs_sign_in'. Offer a Sign in action on an 'oauth' item whose status is " +
|
|
2293
2295
|
"not 'connected', and ONLY when `connections.signIn` is a function (the host runs the sign-in; it is " +
|
|
2294
2296
|
"absent on the studio canvas and on older hosts, so never show a dead button). signIn(id) resolves to " +
|
|
2295
2297
|
"the connected item or rejects AgentError: SIGN_IN_CANCELLED, SIGN_IN_FAILED, CONFIRM_INVALID, " +
|
|
2296
|
-
"NOT_A_SIGN_IN_SERVER, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2298
|
+
"NOT_A_SIGN_IN_SERVER, SIGN_IN_NEEDS_SETUP, SERVER_UNREACHABLE, RATE_LIMITED. On web the page leaves for the sign-in and " +
|
|
2297
2299
|
"the call never settles; when the page loads again `connections.signInResult` is " +
|
|
2298
2300
|
"{ connection, error } for that sign-in (null otherwise): show the outcome from it. " +
|
|
2299
2301
|
"A turn that used one of them carries an activity entry { tool: 'mcp', ok, server } " +
|
|
@@ -3683,7 +3685,7 @@ const PRIMITIVES = [
|
|
|
3683
3685
|
{
|
|
3684
3686
|
name: "DateTimePicker",
|
|
3685
3687
|
description:
|
|
3686
|
-
'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`.',
|
|
3687
3689
|
rnComponent: "@react-native-community/datetimepicker",
|
|
3688
3690
|
docsUrl: "https://github.com/react-native-datetimepicker/datetimepicker",
|
|
3689
3691
|
},
|
|
@@ -7139,7 +7141,10 @@ const CONTRACT = deepFreeze({
|
|
|
7139
7141
|
// contract is shared with the action SDK (`./connector-template`).
|
|
7140
7142
|
// 1.279.0: additive (sc-18049) — useI18n() returns formatDate(value, { time }?),
|
|
7141
7143
|
// a date in the app's language with its month named; "—" when empty.
|
|
7142
|
-
|
|
7144
|
+
// 1.280.0: additive (sc-18010) — connections.add and connections.signIn
|
|
7145
|
+
// may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
|
|
7146
|
+
// app's administrator to register it first. No token fixes it.
|
|
7147
|
+
version: "1.280.0",
|
|
7143
7148
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7144
7149
|
hooks: HOOKS,
|
|
7145
7150
|
primitives: PRIMITIVES,
|
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" },
|