@startupjs-ui/dialogs 0.1.22 → 0.2.0-alpha.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/CHANGELOG.md +22 -0
- package/DialogsProvider.tsx +7 -7
- package/README.mdx +2 -0
- package/alert.tsx +1 -0
- package/confirm.tsx +1 -0
- package/package.json +7 -7
- package/prompt.tsx +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.2.0-alpha.1](https://github.com/startupjs/startupjs-ui/compare/v0.2.0-alpha.0...v0.2.0-alpha.1) (2026-04-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **dialogs:** use 'alertdialog' role for confirm(), prompt(), alert() ([ae2989f](https://github.com/startupjs/startupjs-ui/commit/ae2989fd6cf7b19a189330b3a180226727efc3fe))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [0.2.0-alpha.0](https://github.com/startupjs/startupjs-ui/compare/v0.1.22...v0.2.0-alpha.0) (2026-03-27)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* fix and improve accessibility of various components. Add storybook with tests. ([#21](https://github.com/startupjs/startupjs-ui/issues/21)) ([83b6576](https://github.com/startupjs/startupjs-ui/commit/83b65767ed61b24209f71b143ba1c2986170ab58))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
## [0.1.22](https://github.com/startupjs/startupjs-ui/compare/v0.1.21...v0.1.22) (2026-03-25)
|
|
7
29
|
|
|
8
30
|
**Note:** Version bump only for package @startupjs-ui/dialogs
|
package/DialogsProvider.tsx
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { useEffect, useState, type ReactNode } from 'react'
|
|
2
2
|
import { pug, observer } from 'startupjs'
|
|
3
3
|
import Modal from '@startupjs-ui/modal'
|
|
4
|
-
import { setUpdateDialogState } from './helpers'
|
|
4
|
+
import { setUpdateDialogState, updateDialogState } from './helpers'
|
|
5
5
|
|
|
6
6
|
export const _PropsJsonSchema = {/* DialogsProviderProps */}
|
|
7
7
|
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
9
9
|
export interface DialogsProviderProps {}
|
|
10
10
|
|
|
11
11
|
function DialogsProviderRoot (): ReactNode {
|
|
12
12
|
const [dialog = {}, setDialog] = useState<any>()
|
|
13
13
|
|
|
14
|
-
// used by alert/confirm/prompt to show a dialog
|
|
15
|
-
setUpdateDialogState(setDialog)
|
|
16
|
-
|
|
17
14
|
useEffect(() => {
|
|
15
|
+
// Keep the latest mounted provider registered across route remounts.
|
|
16
|
+
setUpdateDialogState(setDialog)
|
|
17
|
+
|
|
18
18
|
return () => {
|
|
19
|
-
setUpdateDialogState(undefined)
|
|
19
|
+
if (updateDialogState === setDialog) setUpdateDialogState(undefined)
|
|
20
20
|
}
|
|
21
|
-
}, [])
|
|
21
|
+
}, [setDialog])
|
|
22
22
|
|
|
23
23
|
return pug`
|
|
24
24
|
if dialog.visible
|
package/README.mdx
CHANGED
|
@@ -21,6 +21,8 @@ import './index.mdx.cssx.styl'
|
|
|
21
21
|
|
|
22
22
|
Dialogs provide three imperative functions for displaying dialog boxes: `alert`, `confirm`, and `prompt`. Each function is async and returns a Promise that resolves when the user dismisses the dialog.
|
|
23
23
|
|
|
24
|
+
On web, these dialogs render with `role="alertdialog"` so they can be distinguished from ordinary modals.
|
|
25
|
+
|
|
24
26
|
```js
|
|
25
27
|
import { DialogsProvider, alert, confirm, prompt } from 'startupjs-ui'
|
|
26
28
|
```
|
package/alert.tsx
CHANGED
|
@@ -33,6 +33,7 @@ export default async function alert (options: string | AlertOptions): Promise<vo
|
|
|
33
33
|
await new Promise<void>(resolve => {
|
|
34
34
|
openDialog({
|
|
35
35
|
title: normalizedTitle,
|
|
36
|
+
role: 'alertdialog',
|
|
36
37
|
children: message,
|
|
37
38
|
cancelLabel: 'OK',
|
|
38
39
|
onCancel: () => { resolve() },
|
package/confirm.tsx
CHANGED
|
@@ -33,6 +33,7 @@ export default async function confirm (options: string | ConfirmOptions): Promis
|
|
|
33
33
|
const result = await new Promise<boolean>(resolve => {
|
|
34
34
|
openDialog({
|
|
35
35
|
title: normalizedTitle,
|
|
36
|
+
role: 'alertdialog',
|
|
36
37
|
children: message,
|
|
37
38
|
cancelLabel: 'Cancel',
|
|
38
39
|
confirmLabel: 'OK',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs-ui/dialogs",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.0-alpha.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"./prompt": "./prompt.tsx"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@startupjs-ui/br": "^0.1
|
|
19
|
-
"@startupjs-ui/core": "^0.1
|
|
20
|
-
"@startupjs-ui/modal": "^0.1
|
|
21
|
-
"@startupjs-ui/span": "^0.1
|
|
22
|
-
"@startupjs-ui/text-input": "^0.1
|
|
18
|
+
"@startupjs-ui/br": "^0.2.0-alpha.1",
|
|
19
|
+
"@startupjs-ui/core": "^0.2.0-alpha.1",
|
|
20
|
+
"@startupjs-ui/modal": "^0.2.0-alpha.1",
|
|
21
|
+
"@startupjs-ui/span": "^0.2.0-alpha.1",
|
|
22
|
+
"@startupjs-ui/text-input": "^0.2.0-alpha.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "*",
|
|
26
26
|
"react-native": "*",
|
|
27
27
|
"startupjs": "*"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "b48004779559b16c96a2a1995dab13b998eafce9"
|
|
30
30
|
}
|