{"id":26322952,"url":"https://github.com/devlop/dialog","last_synced_at":"2025-03-15T17:16:01.950Z","repository":{"id":57107956,"uuid":"396617434","full_name":"devlop/dialog","owner":"devlop","description":"Lightweight and accessible drop-in replacement for the built-in browser dialog methods alert, confirm and prompt.","archived":false,"fork":false,"pushed_at":"2023-04-08T08:12:41.000Z","size":1122,"stargazers_count":6,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T04:37:01.558Z","etag":null,"topics":["accessibility","alert","confirm","dialog","no-dependencies","prompt","typescript"],"latest_commit_sha":null,"homepage":"https://devlop.github.io/dialog","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devlop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-16T04:30:42.000Z","updated_at":"2023-04-08T05:28:34.000Z","dependencies_parsed_at":"2022-08-20T17:11:19.245Z","dependency_job_id":null,"html_url":"https://github.com/devlop/dialog","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlop%2Fdialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlop%2Fdialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlop%2Fdialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlop%2Fdialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlop","download_url":"https://codeload.github.com/devlop/dialog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243652702,"owners_count":20325612,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["accessibility","alert","confirm","dialog","no-dependencies","prompt","typescript"],"created_at":"2025-03-15T17:16:01.091Z","updated_at":"2025-03-15T17:16:01.932Z","avatar_url":"https://github.com/devlop.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.org/package/@devlop-ab/dialog\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@devlop-ab/dialog.svg\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/devlop/komponent/blob/main/LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-MIT-green\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"/assets/animation.gif\" alt=\"Example of a confirm dialog\" width=\"488\" height=\"228\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://devlop.github.io/dialog\"\u003eSee examples\u003c/a\u003e\n\u003c/p\u003e\n\n# dialog\n\nLightweight and accessible drop-in replacement for the built-in browser dialog methods \n[alert](https://developer.mozilla.org/en-US/docs/Web/API/Window/alert), \n[confirm](https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm) and \n[prompt](https://developer.mozilla.org/en-US/docs/Web/API/Window/prompt).\n\n# Installing\n\nusing npm\n\n```bash\nnpm install @devlop-ab/dialog\n```\n\n# Usage\n\nAll methods are compatible with the standard dialog methods and accept the same arguments, \nplus an additional `options` argument to change basic dialog appearance and behaviour.\n\nAll methods returns a promise, so by using await we can mimic the built in behaviour of \nhalting execution of the current function while waiting for the dialog response.\n\n```javascript\nimport { dialog } from '@devlop-ab/dialog';\n\n// alert (no return value)\nawait dialog.alert('Hello world!');\n\n// confirm (returns true or false)\nconst result = await dialog.confirm('Do you really want to leave?');\n\n// prompt (returns string or null if cancelled)\nconst result = await dialog.prompt('Are you feeling lucky?', 'sure');\n```\n\n## Dialog options\n\nAll dialog methods accept an (optional) options argument where you can do basic configuration changes.\n\nSee [https://devlop.github.io/dialog for more examples](https://devlop.github.io/dialog).\n\n```javascript\n// all options are optional\n{\n    'title': 'Title of the dialog',\n    'okText': 'Yes',\n    'cancelText': 'No',\n    'focus': 'cancel',\n}\n\n// examples\nawait dialog.alert('I\\'m afraid i can\\'t do that Dave.', {\n    'title': 'HAL',\n});\n\nconst result = await dialog.confirm('Do you really want to leave?', {\n    'okText': 'Yes', \n    'cancelText': 'No',\n});\n```\n\n## Styles \n\nThe javascript does not output any styles, you must include them in your css/sass build.\n\n**Using SASS** \n\n```scss\n// importing the theme \"sky\".\n@import '@devlop-ab/dialog/dist/css/sky.css';\n```\n\nSee [https://devlop.github.io/dialog for all available themes](https://devlop.github.io/dialog).\n\n**Using vanilla CSS** \n\nCopy the css file for the theme you want to use from `node_modules/@devlop-ab/dialog/dist/css` directory and put it with your other assets.\n\n## Customizing the CSS\n\nEach theme exposes a plethora of css variables allowing you to change colors, fonts and padding without overriding any css selectors.\n\n```scss\n// importing using sass\n@import '@devlop-ab/dialog/dist/css/sky.css';\n\n[data-dialog] {\n    --theme-color-hue: 310;\n}\n```\n\nSee [https://devlop.github.io/dialog for all variables](https://devlop.github.io/dialog).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlop%2Fdialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlop%2Fdialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlop%2Fdialog/lists"}