@colixsystems/widget-sdk 0.345.0 → 0.346.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,19 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
91
91
 
92
92
  ## Status
93
93
 
94
- `v0.345.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.346.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.346.0 (contract 1.283.0)
97
+
98
+ **A `<Popover>` can open a dialog of its own.** The `close` a popover hands its children now takes what to run next: `close(then)` closes the popover and runs `then` once it has left the screen. Open a dialog, a `<Modal>` or an `<EmojiPicker>` from a button inside the popover that way. iOS cannot show a dialog while another is still leaving the screen, so one opened in the same press that closed the popover never appeared there. The new `onDismiss` prop runs at the same moment after every close, the backdrop and Escape included. `<Menu>` already runs a picked item's `onPress` this way. Additive.
99
+
100
+ ```jsx
101
+ <Popover trigger={trigger}>
102
+ {({ close }) => (
103
+ <Button title={t("more", "More")} onPress={() => close(() => setPickerOpen(true))} />
104
+ )}
105
+ </Popover>
106
+ ```
95
107
 
96
108
  ### What's new in 0.345.0 (contract 1.282.0)
97
109
 
package/dist/contract.cjs CHANGED
@@ -4077,7 +4077,7 @@ const PRIMITIVES = [
4077
4077
  {
4078
4078
  name: "Popover",
4079
4079
  description:
4080
- 'Themed popover: free content beside a trigger. `<Popover trigger={<Button variant="secondary" title={t("filters", "Filters")} />} accessibilityLabel={t("filters", "Filters")}>{({ close }) => <View style={{ gap: theme.spacing.sm }}>…<Button title={t("apply", "Apply")} onPress={() => { apply(); close(); }} /></View>}</Popover>`. Use it by default for a small panel that belongs to one control and should open next to it — quick filters, a small colour-swatch or photo picker that opens at its button, a short detail card (an emoji choice is `<EmojiPicker>`; a long or full-screen option list is a `<Modal>`). It opens beside the trigger on a wide screen and as a bottom sheet on a phone, is drawn over the screen so no card or list clips it, and closes on the backdrop press, the Escape key on web and the Android back button. `children` is the content, or a function given `{ close }`. To open or close it from your own code, pass `visible` with `onVisibleChange`. Other props: `trigger` (ONE pressable element; its own `onPress` still runs first), `placement` ("bottom" default | "top"; it flips at the screen edge), `accessibilityLabel`, `closeAccessibilityLabel`, `testID`. A list of actions is `<Menu>`; a form with a title and Save / Cancel is `<Modal>`. Its panel follows the theme (Design > Components > Dropdown menus), and components inside it read a theme inked for that panel. When the request needs what a popover cannot do — a panel that stays open while the user works elsewhere on the page, or one pinned to a spot that is not a pressable control — build your own in the app\'s look.',
4080
+ 'Themed popover: free content beside a trigger. `<Popover trigger={<Button variant="secondary" title={t("filters", "Filters")} />} accessibilityLabel={t("filters", "Filters")}>{({ close }) => <View style={{ gap: theme.spacing.sm }}>…<Button title={t("apply", "Apply")} onPress={() => { apply(); close(); }} /></View>}</Popover>`. Use it by default for a small panel that belongs to one control and should open next to it — quick filters, a small colour-swatch or photo picker that opens at its button, a short detail card (an emoji choice is `<EmojiPicker>`; a long or full-screen option list is a `<Modal>`). It opens beside the trigger on a wide screen and as a bottom sheet on a phone, is drawn over the screen so no card or list clips it, and closes on the backdrop press, the Escape key on web and the Android back button. `children` is the content, or a function given `{ close }`. To open or close it from your own code, pass `visible` with `onVisibleChange`. A dialog or `<EmojiPicker>` opened from inside it waits until the popover has left the screen: call `close(() => setPickerOpen(true))`, or open it in `onDismiss`, which runs then too; opened in the same press that closes it, it fails to show on iOS. Other props: `trigger` (ONE pressable element; its own `onPress` still runs first), `placement` ("bottom" default | "top"; it flips at the screen edge), `accessibilityLabel`, `closeAccessibilityLabel`, `onDismiss`, `testID`. A list of actions is `<Menu>`; a form with a title and Save / Cancel is `<Modal>`. Its panel follows the theme (Design > Components > Dropdown menus), and components inside it read a theme inked for that panel. When the request needs what a popover cannot do — a panel that stays open while the user works elsewhere on the page, or one pinned to a spot that is not a pressable control — build your own in the app\'s look.',
4081
4081
  rnComponent: null,
4082
4082
  docsUrl: null,
4083
4083
  },
@@ -7156,7 +7156,10 @@ const CONTRACT = deepFreeze({
7156
7156
  // 1.282.0: additive (sc-18485) — useAccessPlans() plans and
7157
7157
  // useAppSubscription() subscription carry member_since, the member's start
7158
7158
  // date: first paid charge, else when access was granted (null when not held).
7159
- version: "1.282.0",
7159
+ // 1.283.0: additive (sc-17852) — `<Popover onDismiss>` and the children's
7160
+ // `close(then)` run once the closed popover has left the screen, so a
7161
+ // dialog it opens presents on iOS.
7162
+ version: "1.283.0",
7160
7163
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7161
7164
  hooks: HOOKS,
7162
7165
  primitives: PRIMITIVES,
package/dist/contract.js CHANGED
@@ -4072,7 +4072,7 @@ const PRIMITIVES = [
4072
4072
  {
4073
4073
  name: "Popover",
4074
4074
  description:
4075
- 'Themed popover: free content beside a trigger. `<Popover trigger={<Button variant="secondary" title={t("filters", "Filters")} />} accessibilityLabel={t("filters", "Filters")}>{({ close }) => <View style={{ gap: theme.spacing.sm }}>…<Button title={t("apply", "Apply")} onPress={() => { apply(); close(); }} /></View>}</Popover>`. Use it by default for a small panel that belongs to one control and should open next to it — quick filters, a small colour-swatch or photo picker that opens at its button, a short detail card (an emoji choice is `<EmojiPicker>`; a long or full-screen option list is a `<Modal>`). It opens beside the trigger on a wide screen and as a bottom sheet on a phone, is drawn over the screen so no card or list clips it, and closes on the backdrop press, the Escape key on web and the Android back button. `children` is the content, or a function given `{ close }`. To open or close it from your own code, pass `visible` with `onVisibleChange`. Other props: `trigger` (ONE pressable element; its own `onPress` still runs first), `placement` ("bottom" default | "top"; it flips at the screen edge), `accessibilityLabel`, `closeAccessibilityLabel`, `testID`. A list of actions is `<Menu>`; a form with a title and Save / Cancel is `<Modal>`. Its panel follows the theme (Design > Components > Dropdown menus), and components inside it read a theme inked for that panel. When the request needs what a popover cannot do — a panel that stays open while the user works elsewhere on the page, or one pinned to a spot that is not a pressable control — build your own in the app\'s look.',
4075
+ 'Themed popover: free content beside a trigger. `<Popover trigger={<Button variant="secondary" title={t("filters", "Filters")} />} accessibilityLabel={t("filters", "Filters")}>{({ close }) => <View style={{ gap: theme.spacing.sm }}>…<Button title={t("apply", "Apply")} onPress={() => { apply(); close(); }} /></View>}</Popover>`. Use it by default for a small panel that belongs to one control and should open next to it — quick filters, a small colour-swatch or photo picker that opens at its button, a short detail card (an emoji choice is `<EmojiPicker>`; a long or full-screen option list is a `<Modal>`). It opens beside the trigger on a wide screen and as a bottom sheet on a phone, is drawn over the screen so no card or list clips it, and closes on the backdrop press, the Escape key on web and the Android back button. `children` is the content, or a function given `{ close }`. To open or close it from your own code, pass `visible` with `onVisibleChange`. A dialog or `<EmojiPicker>` opened from inside it waits until the popover has left the screen: call `close(() => setPickerOpen(true))`, or open it in `onDismiss`, which runs then too; opened in the same press that closes it, it fails to show on iOS. Other props: `trigger` (ONE pressable element; its own `onPress` still runs first), `placement` ("bottom" default | "top"; it flips at the screen edge), `accessibilityLabel`, `closeAccessibilityLabel`, `onDismiss`, `testID`. A list of actions is `<Menu>`; a form with a title and Save / Cancel is `<Modal>`. Its panel follows the theme (Design > Components > Dropdown menus), and components inside it read a theme inked for that panel. When the request needs what a popover cannot do — a panel that stays open while the user works elsewhere on the page, or one pinned to a spot that is not a pressable control — build your own in the app\'s look.',
4076
4076
  rnComponent: null,
4077
4077
  docsUrl: null,
4078
4078
  },
@@ -7151,7 +7151,10 @@ const CONTRACT = deepFreeze({
7151
7151
  // 1.282.0: additive (sc-18485) — useAccessPlans() plans and
7152
7152
  // useAppSubscription() subscription carry member_since, the member's start
7153
7153
  // date: first paid charge, else when access was granted (null when not held).
7154
- version: "1.282.0",
7154
+ // 1.283.0: additive (sc-17852) — `<Popover onDismiss>` and the children's
7155
+ // `close(then)` run once the closed popover has left the screen, so a
7156
+ // dialog it opens presents on iOS.
7157
+ version: "1.283.0",
7155
7158
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7156
7159
  hooks: HOOKS,
7157
7160
  primitives: PRIMITIVES,
@@ -191,12 +191,15 @@ export function makePopover(rn, Overlay) {
191
191
  *
192
192
  * @param {object} props
193
193
  * @param {any} props.trigger — the pressable element that opens it.
194
- * @param {any|((api: {close: () => void}) => any)} props.children
194
+ * @param {any|((api: {close: (then?: () => void) => void}) => any)} props.children
195
+ * — `close(then)` runs `then` once the popover has left the screen.
195
196
  * @param {boolean} [props.visible] — set it to control the popover.
196
197
  * @param {(visible: boolean) => void} [props.onVisibleChange]
197
198
  * @param {"bottom"|"top"} [props.placement] — default "bottom"; flips.
198
199
  * @param {string} [props.accessibilityLabel] — names the panel.
199
200
  * @param {string} [props.closeAccessibilityLabel] — the sheet backdrop's name.
201
+ * @param {() => void} [props.onDismiss] — runs once a closed popover has
202
+ * left the screen, so a dialog it opens presents on every host.
200
203
  * @param {string} [props.testID] — on the panel.
201
204
  */
202
205
  function Popover({
@@ -207,6 +210,7 @@ export function makePopover(rn, Overlay) {
207
210
  placement = "bottom",
208
211
  accessibilityLabel,
209
212
  closeAccessibilityLabel,
213
+ onDismiss,
210
214
  testID,
211
215
  }) {
212
216
  const theme = useHostTheme() || DEFAULT_THEME_TOKENS;
@@ -218,7 +222,18 @@ export function makePopover(rn, Overlay) {
218
222
  if (!controlled) setOwnOpen(next);
219
223
  if (typeof onVisibleChange === "function") onVisibleChange(next);
220
224
  };
221
- const close = () => setOpen(false);
225
+ // What `close(then)` asked to run once the popover has left the screen.
226
+ const afterClose = React.useRef(null);
227
+ const close = (then) => {
228
+ afterClose.current = typeof then === "function" ? then : null;
229
+ setOpen(false);
230
+ };
231
+ const dismissed = () => {
232
+ const run = afterClose.current;
233
+ afterClose.current = null;
234
+ if (run) run();
235
+ if (typeof onDismiss === "function") onDismiss();
236
+ };
222
237
  const spacing = theme.spacing || DEFAULT_THEME_TOKENS.spacing;
223
238
 
224
239
  return h(
@@ -233,7 +248,8 @@ export function makePopover(rn, Overlay) {
233
248
  AnchoredSurface,
234
249
  {
235
250
  visible: open,
236
- onRequestClose: close,
251
+ onRequestClose: () => close(),
252
+ onDismiss: dismissed,
237
253
  anchorRef,
238
254
  placement,
239
255
  padding: spacing.md,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.345.0",
3
+ "version": "0.346.0",
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
@@ -4072,7 +4072,7 @@ const PRIMITIVES = [
4072
4072
  {
4073
4073
  name: "Popover",
4074
4074
  description:
4075
- 'Themed popover: free content beside a trigger. `<Popover trigger={<Button variant="secondary" title={t("filters", "Filters")} />} accessibilityLabel={t("filters", "Filters")}>{({ close }) => <View style={{ gap: theme.spacing.sm }}>…<Button title={t("apply", "Apply")} onPress={() => { apply(); close(); }} /></View>}</Popover>`. Use it by default for a small panel that belongs to one control and should open next to it — quick filters, a small colour-swatch or photo picker that opens at its button, a short detail card (an emoji choice is `<EmojiPicker>`; a long or full-screen option list is a `<Modal>`). It opens beside the trigger on a wide screen and as a bottom sheet on a phone, is drawn over the screen so no card or list clips it, and closes on the backdrop press, the Escape key on web and the Android back button. `children` is the content, or a function given `{ close }`. To open or close it from your own code, pass `visible` with `onVisibleChange`. Other props: `trigger` (ONE pressable element; its own `onPress` still runs first), `placement` ("bottom" default | "top"; it flips at the screen edge), `accessibilityLabel`, `closeAccessibilityLabel`, `testID`. A list of actions is `<Menu>`; a form with a title and Save / Cancel is `<Modal>`. Its panel follows the theme (Design > Components > Dropdown menus), and components inside it read a theme inked for that panel. When the request needs what a popover cannot do — a panel that stays open while the user works elsewhere on the page, or one pinned to a spot that is not a pressable control — build your own in the app\'s look.',
4075
+ 'Themed popover: free content beside a trigger. `<Popover trigger={<Button variant="secondary" title={t("filters", "Filters")} />} accessibilityLabel={t("filters", "Filters")}>{({ close }) => <View style={{ gap: theme.spacing.sm }}>…<Button title={t("apply", "Apply")} onPress={() => { apply(); close(); }} /></View>}</Popover>`. Use it by default for a small panel that belongs to one control and should open next to it — quick filters, a small colour-swatch or photo picker that opens at its button, a short detail card (an emoji choice is `<EmojiPicker>`; a long or full-screen option list is a `<Modal>`). It opens beside the trigger on a wide screen and as a bottom sheet on a phone, is drawn over the screen so no card or list clips it, and closes on the backdrop press, the Escape key on web and the Android back button. `children` is the content, or a function given `{ close }`. To open or close it from your own code, pass `visible` with `onVisibleChange`. A dialog or `<EmojiPicker>` opened from inside it waits until the popover has left the screen: call `close(() => setPickerOpen(true))`, or open it in `onDismiss`, which runs then too; opened in the same press that closes it, it fails to show on iOS. Other props: `trigger` (ONE pressable element; its own `onPress` still runs first), `placement` ("bottom" default | "top"; it flips at the screen edge), `accessibilityLabel`, `closeAccessibilityLabel`, `onDismiss`, `testID`. A list of actions is `<Menu>`; a form with a title and Save / Cancel is `<Modal>`. Its panel follows the theme (Design > Components > Dropdown menus), and components inside it read a theme inked for that panel. When the request needs what a popover cannot do — a panel that stays open while the user works elsewhere on the page, or one pinned to a spot that is not a pressable control — build your own in the app\'s look.',
4076
4076
  rnComponent: null,
4077
4077
  docsUrl: null,
4078
4078
  },
@@ -7151,7 +7151,10 @@ const CONTRACT = deepFreeze({
7151
7151
  // 1.282.0: additive (sc-18485) — useAccessPlans() plans and
7152
7152
  // useAppSubscription() subscription carry member_since, the member's start
7153
7153
  // date: first paid charge, else when access was granted (null when not held).
7154
- version: "1.282.0",
7154
+ // 1.283.0: additive (sc-17852) — `<Popover onDismiss>` and the children's
7155
+ // `close(then)` run once the closed popover has left the screen, so a
7156
+ // dialog it opens presents on iOS.
7157
+ version: "1.283.0",
7155
7158
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7156
7159
  hooks: HOOKS,
7157
7160
  primitives: PRIMITIVES,