openproject-primer_view_components 0.52.4 → 0.53.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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/app/assets/javascripts/components/primer/open_project/danger_dialog_form_helper.d.ts +13 -0
  4. data/app/assets/javascripts/components/primer/primer.d.ts +1 -1
  5. data/app/assets/javascripts/primer_view_components.js +1 -1
  6. data/app/assets/javascripts/primer_view_components.js.map +1 -1
  7. data/app/components/primer/open_project/{danger_confirmation_dialog → danger_dialog}/confirmation_check_box.rb +5 -5
  8. data/app/components/primer/open_project/{danger_confirmation_dialog → danger_dialog}/form_wrapper.rb +2 -2
  9. data/app/components/primer/open_project/{danger_confirmation_dialog.html.erb → danger_dialog.html.erb} +2 -2
  10. data/app/components/primer/open_project/{danger_confirmation_dialog.rb → danger_dialog.rb} +13 -14
  11. data/app/components/primer/open_project/danger_dialog_form_helper.d.ts +13 -0
  12. data/app/components/primer/open_project/{danger_confirmation_dialog_form_helper.js → danger_dialog_form_helper.js} +19 -14
  13. data/app/components/primer/open_project/danger_dialog_form_helper.ts +41 -0
  14. data/app/components/primer/primer.d.ts +1 -1
  15. data/app/components/primer/primer.js +1 -1
  16. data/app/components/primer/primer.ts +1 -1
  17. data/lib/primer/view_components/version.rb +2 -2
  18. data/previews/primer/open_project/danger_dialog_preview/deletion_form.rb +23 -0
  19. data/previews/primer/open_project/{danger_confirmation_dialog_preview → danger_dialog_preview}/playground.html.erb +3 -3
  20. data/previews/primer/open_project/{danger_confirmation_dialog_preview → danger_dialog_preview}/with_additional_details.html.erb +1 -1
  21. data/previews/primer/open_project/{danger_confirmation_dialog_preview → danger_dialog_preview}/with_form.html.erb +2 -2
  22. data/previews/primer/open_project/danger_dialog_preview/with_form_builder_form.html.erb +18 -0
  23. data/previews/primer/open_project/danger_dialog_preview/with_form_builder_form_test.html.erb +17 -0
  24. data/previews/primer/open_project/{danger_confirmation_dialog_preview → danger_dialog_preview}/with_form_test.html.erb +2 -2
  25. data/previews/primer/open_project/{danger_confirmation_dialog_preview.rb → danger_dialog_preview.rb} +18 -6
  26. data/static/arguments.json +24 -12
  27. data/static/audited_at.json +3 -3
  28. data/static/constants.json +8 -8
  29. data/static/info_arch.json +51 -26
  30. data/static/previews.json +24 -11
  31. data/static/statuses.json +3 -3
  32. metadata +19 -18
  33. data/app/assets/javascripts/components/primer/open_project/danger_confirmation_dialog_form_helper.d.ts +0 -13
  34. data/app/components/primer/open_project/danger_confirmation_dialog_form_helper.d.ts +0 -13
  35. data/app/components/primer/open_project/danger_confirmation_dialog_form_helper.ts +0 -36
  36. data/previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form.html.erb +0 -14
  37. data/previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form_test.html.erb +0 -13
  38. /data/app/components/primer/open_project/{danger_confirmation_dialog → danger_dialog}/form_wrapper.html.erb +0 -0
@@ -17507,18 +17507,18 @@
17507
17507
  ]
17508
17508
  },
17509
17509
  {
17510
- "fully_qualified_name": "Primer::OpenProject::DangerConfirmationDialog",
17510
+ "fully_qualified_name": "Primer::OpenProject::DangerDialog",
17511
17511
  "description": "A pre-configured dialog for destructive/\"potentially dangerous\" actions",
17512
17512
  "accessibility_docs": null,
17513
17513
  "is_form_component": false,
17514
17514
  "is_published": true,
17515
17515
  "requires_js": false,
17516
- "component": "OpenProject::DangerConfirmationDialog",
17516
+ "component": "OpenProject::DangerDialog",
17517
17517
  "status": "open_project",
17518
17518
  "a11y_reviewed": false,
17519
- "short_name": "OpenProjectDangerConfirmationDialog",
17520
- "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/danger_confirmation_dialog.rb",
17521
- "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/danger_confirmation_dialog/default/",
17519
+ "short_name": "OpenProjectDangerDialog",
17520
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/danger_dialog.rb",
17521
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/danger_dialog/default/",
17522
17522
  "parameters": [
17523
17523
  {
17524
17524
  "name": "form_arguments",
@@ -17532,6 +17532,18 @@
17532
17532
  "default": "`self.class.generate_id`",
17533
17533
  "description": "The id of the dialog."
17534
17534
  },
17535
+ {
17536
+ "name": "confirm_button_text",
17537
+ "type": "String",
17538
+ "default": "`nil`",
17539
+ "description": "The text of the confirm button. Will default to `I18n.t(\"button_delete\")`, or `I18n.t(\"button_delete_permanently\")` if `confirmation_check_box` slot has been passed to the component."
17540
+ },
17541
+ {
17542
+ "name": "cancel_button_text",
17543
+ "type": "String",
17544
+ "default": "`nil`",
17545
+ "description": "The text of the cancel button. Will default to `I18n.t(\"button_cancel\")`."
17546
+ },
17535
17547
  {
17536
17548
  "name": "system_arguments",
17537
17549
  "type": "Hash",
@@ -17560,7 +17572,7 @@
17560
17572
  },
17561
17573
  {
17562
17574
  "name": "confirmation_check_box",
17563
- "description": "A checkbox that the user is required to check in order to continue with the destructive action.\n\nTo render the checkbox label (required), pass a block that returns a String.",
17575
+ "description": "An optional checkbox that the user is required to check in order to continue with the destructive action.\n\nTo render the checkbox label (required), pass a block that returns a String.",
17564
17576
  "parameters": [
17565
17577
  {
17566
17578
  "name": "system_arguments",
@@ -17597,7 +17609,7 @@
17597
17609
  ],
17598
17610
  "previews": [
17599
17611
  {
17600
- "preview_path": "primer/open_project/danger_confirmation_dialog/default",
17612
+ "preview_path": "primer/open_project/danger_dialog/default",
17601
17613
  "name": "default",
17602
17614
  "snapshot": "interactive",
17603
17615
  "skip_rules": {
@@ -17610,7 +17622,20 @@
17610
17622
  }
17611
17623
  },
17612
17624
  {
17613
- "preview_path": "primer/open_project/danger_confirmation_dialog/playground",
17625
+ "preview_path": "primer/open_project/danger_dialog/with_confirmation_check_box",
17626
+ "name": "with_confirmation_check_box",
17627
+ "snapshot": "interactive",
17628
+ "skip_rules": {
17629
+ "wont_fix": [
17630
+ "region"
17631
+ ],
17632
+ "will_fix": [
17633
+ "color-contrast"
17634
+ ]
17635
+ }
17636
+ },
17637
+ {
17638
+ "preview_path": "primer/open_project/danger_dialog/playground",
17614
17639
  "name": "playground",
17615
17640
  "snapshot": "false",
17616
17641
  "skip_rules": {
@@ -17623,7 +17648,7 @@
17623
17648
  }
17624
17649
  },
17625
17650
  {
17626
- "preview_path": "primer/open_project/danger_confirmation_dialog/with_form_builder_form",
17651
+ "preview_path": "primer/open_project/danger_dialog/with_form_builder_form",
17627
17652
  "name": "with_form_builder_form",
17628
17653
  "snapshot": "false",
17629
17654
  "skip_rules": {
@@ -17636,7 +17661,7 @@
17636
17661
  }
17637
17662
  },
17638
17663
  {
17639
- "preview_path": "primer/open_project/danger_confirmation_dialog/with_form",
17664
+ "preview_path": "primer/open_project/danger_dialog/with_form",
17640
17665
  "name": "with_form",
17641
17666
  "snapshot": "false",
17642
17667
  "skip_rules": {
@@ -17649,7 +17674,7 @@
17649
17674
  }
17650
17675
  },
17651
17676
  {
17652
- "preview_path": "primer/open_project/danger_confirmation_dialog/with_additional_details",
17677
+ "preview_path": "primer/open_project/danger_dialog/with_additional_details",
17653
17678
  "name": "with_additional_details",
17654
17679
  "snapshot": "false",
17655
17680
  "skip_rules": {
@@ -17662,7 +17687,7 @@
17662
17687
  }
17663
17688
  },
17664
17689
  {
17665
- "preview_path": "primer/open_project/danger_confirmation_dialog/custom_icon",
17690
+ "preview_path": "primer/open_project/danger_dialog/custom_icon",
17666
17691
  "name": "custom_icon",
17667
17692
  "snapshot": "false",
17668
17693
  "skip_rules": {
@@ -17675,7 +17700,7 @@
17675
17700
  }
17676
17701
  },
17677
17702
  {
17678
- "preview_path": "primer/open_project/danger_confirmation_dialog/with_form_builder_form_test",
17703
+ "preview_path": "primer/open_project/danger_dialog/with_form_builder_form_test",
17679
17704
  "name": "with_form_builder_form_test",
17680
17705
  "snapshot": "false",
17681
17706
  "skip_rules": {
@@ -17688,7 +17713,7 @@
17688
17713
  }
17689
17714
  },
17690
17715
  {
17691
- "preview_path": "primer/open_project/danger_confirmation_dialog/with_form_test",
17716
+ "preview_path": "primer/open_project/danger_dialog/with_form_test",
17692
17717
  "name": "with_form_test",
17693
17718
  "snapshot": "false",
17694
17719
  "skip_rules": {
@@ -17706,18 +17731,18 @@
17706
17731
  ]
17707
17732
  },
17708
17733
  {
17709
- "fully_qualified_name": "Primer::OpenProject::DangerConfirmationDialog::ConfirmationCheckBox",
17710
- "description": "This component is part of `Primer::OpenProject::DangerConfirmationDialog`\nand should not be used as a standalone component.",
17734
+ "fully_qualified_name": "Primer::OpenProject::DangerDialog::ConfirmationCheckBox",
17735
+ "description": "This component is part of `Primer::OpenProject::DangerDialog`\nand should not be used as a standalone component.",
17711
17736
  "accessibility_docs": null,
17712
17737
  "is_form_component": false,
17713
17738
  "is_published": true,
17714
17739
  "requires_js": false,
17715
- "component": "OpenProject::DangerConfirmationDialog::ConfirmationCheckBox",
17740
+ "component": "OpenProject::DangerDialog::ConfirmationCheckBox",
17716
17741
  "status": "open_project",
17717
17742
  "a11y_reviewed": false,
17718
- "short_name": "OpenProjectDangerConfirmationDialogConfirmationCheckBox",
17719
- "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/danger_confirmation_dialog/confirmation_check_box.rb",
17720
- "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/danger_confirmation_dialog/confirmation_check_box/default/",
17743
+ "short_name": "OpenProjectDangerDialogConfirmationCheckBox",
17744
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/danger_dialog/confirmation_check_box.rb",
17745
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/danger_dialog/confirmation_check_box/default/",
17721
17746
  "parameters": [
17722
17747
  {
17723
17748
  "name": "check_box_id",
@@ -17752,18 +17777,18 @@
17752
17777
  ]
17753
17778
  },
17754
17779
  {
17755
- "fully_qualified_name": "Primer::OpenProject::DangerConfirmationDialog::FormWrapper",
17756
- "description": "Utility component for wrapping DangerConfirmationDialog in a form",
17780
+ "fully_qualified_name": "Primer::OpenProject::DangerDialog::FormWrapper",
17781
+ "description": "Utility component for wrapping DangerDialog in a form",
17757
17782
  "accessibility_docs": null,
17758
17783
  "is_form_component": false,
17759
17784
  "is_published": true,
17760
17785
  "requires_js": false,
17761
- "component": "OpenProject::DangerConfirmationDialog::FormWrapper",
17786
+ "component": "OpenProject::DangerDialog::FormWrapper",
17762
17787
  "status": "open_project",
17763
17788
  "a11y_reviewed": false,
17764
- "short_name": "OpenProjectDangerConfirmationDialogFormWrapper",
17765
- "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.rb",
17766
- "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/danger_confirmation_dialog/form_wrapper/default/",
17789
+ "short_name": "OpenProjectDangerDialogFormWrapper",
17790
+ "source": "https://github.com/primer/view_components/tree/main/app/components/primer/open_project/danger_dialog/form_wrapper.rb",
17791
+ "lookbook": "https://primer.style/view-components/lookbook/inspect/primer/open_project/danger_dialog/form_wrapper/default/",
17767
17792
  "parameters": [
17768
17793
 
17769
17794
  ],
data/static/previews.json CHANGED
@@ -3109,13 +3109,13 @@
3109
3109
  ]
3110
3110
  },
3111
3111
  {
3112
- "name": "danger_confirmation_dialog",
3113
- "component": "OpenProject::DangerConfirmationDialog",
3112
+ "name": "danger_dialog",
3113
+ "component": "OpenProject::DangerDialog",
3114
3114
  "status": "open_project",
3115
- "lookup_path": "primer/open_project/danger_confirmation_dialog",
3115
+ "lookup_path": "primer/open_project/danger_dialog",
3116
3116
  "examples": [
3117
3117
  {
3118
- "preview_path": "primer/open_project/danger_confirmation_dialog/default",
3118
+ "preview_path": "primer/open_project/danger_dialog/default",
3119
3119
  "name": "default",
3120
3120
  "snapshot": "interactive",
3121
3121
  "skip_rules": {
@@ -3128,7 +3128,20 @@
3128
3128
  }
3129
3129
  },
3130
3130
  {
3131
- "preview_path": "primer/open_project/danger_confirmation_dialog/playground",
3131
+ "preview_path": "primer/open_project/danger_dialog/with_confirmation_check_box",
3132
+ "name": "with_confirmation_check_box",
3133
+ "snapshot": "interactive",
3134
+ "skip_rules": {
3135
+ "wont_fix": [
3136
+ "region"
3137
+ ],
3138
+ "will_fix": [
3139
+ "color-contrast"
3140
+ ]
3141
+ }
3142
+ },
3143
+ {
3144
+ "preview_path": "primer/open_project/danger_dialog/playground",
3132
3145
  "name": "playground",
3133
3146
  "snapshot": "false",
3134
3147
  "skip_rules": {
@@ -3141,7 +3154,7 @@
3141
3154
  }
3142
3155
  },
3143
3156
  {
3144
- "preview_path": "primer/open_project/danger_confirmation_dialog/with_form_builder_form",
3157
+ "preview_path": "primer/open_project/danger_dialog/with_form_builder_form",
3145
3158
  "name": "with_form_builder_form",
3146
3159
  "snapshot": "false",
3147
3160
  "skip_rules": {
@@ -3154,7 +3167,7 @@
3154
3167
  }
3155
3168
  },
3156
3169
  {
3157
- "preview_path": "primer/open_project/danger_confirmation_dialog/with_form",
3170
+ "preview_path": "primer/open_project/danger_dialog/with_form",
3158
3171
  "name": "with_form",
3159
3172
  "snapshot": "false",
3160
3173
  "skip_rules": {
@@ -3167,7 +3180,7 @@
3167
3180
  }
3168
3181
  },
3169
3182
  {
3170
- "preview_path": "primer/open_project/danger_confirmation_dialog/with_additional_details",
3183
+ "preview_path": "primer/open_project/danger_dialog/with_additional_details",
3171
3184
  "name": "with_additional_details",
3172
3185
  "snapshot": "false",
3173
3186
  "skip_rules": {
@@ -3180,7 +3193,7 @@
3180
3193
  }
3181
3194
  },
3182
3195
  {
3183
- "preview_path": "primer/open_project/danger_confirmation_dialog/custom_icon",
3196
+ "preview_path": "primer/open_project/danger_dialog/custom_icon",
3184
3197
  "name": "custom_icon",
3185
3198
  "snapshot": "false",
3186
3199
  "skip_rules": {
@@ -3193,7 +3206,7 @@
3193
3206
  }
3194
3207
  },
3195
3208
  {
3196
- "preview_path": "primer/open_project/danger_confirmation_dialog/with_form_builder_form_test",
3209
+ "preview_path": "primer/open_project/danger_dialog/with_form_builder_form_test",
3197
3210
  "name": "with_form_builder_form_test",
3198
3211
  "snapshot": "false",
3199
3212
  "skip_rules": {
@@ -3206,7 +3219,7 @@
3206
3219
  }
3207
3220
  },
3208
3221
  {
3209
- "preview_path": "primer/open_project/danger_confirmation_dialog/with_form_test",
3222
+ "preview_path": "primer/open_project/danger_dialog/with_form_test",
3210
3223
  "name": "with_form_test",
3211
3224
  "snapshot": "false",
3212
3225
  "skip_rules": {
data/static/statuses.json CHANGED
@@ -118,9 +118,9 @@
118
118
  "Primer::Navigation::TabComponent": "deprecated",
119
119
  "Primer::OpenProject::BorderGrid": "open_project",
120
120
  "Primer::OpenProject::BorderGrid::Cell": "open_project",
121
- "Primer::OpenProject::DangerConfirmationDialog": "open_project",
122
- "Primer::OpenProject::DangerConfirmationDialog::ConfirmationCheckBox": "open_project",
123
- "Primer::OpenProject::DangerConfirmationDialog::FormWrapper": "open_project",
121
+ "Primer::OpenProject::DangerDialog": "open_project",
122
+ "Primer::OpenProject::DangerDialog::ConfirmationCheckBox": "open_project",
123
+ "Primer::OpenProject::DangerDialog::FormWrapper": "open_project",
124
124
  "Primer::OpenProject::DragHandle": "open_project",
125
125
  "Primer::OpenProject::FeedbackDialog": "open_project",
126
126
  "Primer::OpenProject::FeedbackMessage": "open_project",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openproject-primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.52.4
4
+ version: 0.53.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-01-30 00:00:00.000000000 Z
12
+ date: 2025-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -103,7 +103,7 @@ files:
103
103
  - app/assets/javascripts/components/primer/beta/relative_time.d.ts
104
104
  - app/assets/javascripts/components/primer/dialog_helper.d.ts
105
105
  - app/assets/javascripts/components/primer/focus_group.d.ts
106
- - app/assets/javascripts/components/primer/open_project/danger_confirmation_dialog_form_helper.d.ts
106
+ - app/assets/javascripts/components/primer/open_project/danger_dialog_form_helper.d.ts
107
107
  - app/assets/javascripts/components/primer/open_project/page_header_element.d.ts
108
108
  - app/assets/javascripts/components/primer/open_project/sub_header_element.d.ts
109
109
  - app/assets/javascripts/components/primer/open_project/zen_mode_button.d.ts
@@ -493,14 +493,14 @@ files:
493
493
  - app/components/primer/open_project/border_grid.rb
494
494
  - app/components/primer/open_project/border_grid/cell.html.erb
495
495
  - app/components/primer/open_project/border_grid/cell.rb
496
- - app/components/primer/open_project/danger_confirmation_dialog.html.erb
497
- - app/components/primer/open_project/danger_confirmation_dialog.rb
498
- - app/components/primer/open_project/danger_confirmation_dialog/confirmation_check_box.rb
499
- - app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.html.erb
500
- - app/components/primer/open_project/danger_confirmation_dialog/form_wrapper.rb
501
- - app/components/primer/open_project/danger_confirmation_dialog_form_helper.d.ts
502
- - app/components/primer/open_project/danger_confirmation_dialog_form_helper.js
503
- - app/components/primer/open_project/danger_confirmation_dialog_form_helper.ts
496
+ - app/components/primer/open_project/danger_dialog.html.erb
497
+ - app/components/primer/open_project/danger_dialog.rb
498
+ - app/components/primer/open_project/danger_dialog/confirmation_check_box.rb
499
+ - app/components/primer/open_project/danger_dialog/form_wrapper.html.erb
500
+ - app/components/primer/open_project/danger_dialog/form_wrapper.rb
501
+ - app/components/primer/open_project/danger_dialog_form_helper.d.ts
502
+ - app/components/primer/open_project/danger_dialog_form_helper.js
503
+ - app/components/primer/open_project/danger_dialog_form_helper.ts
504
504
  - app/components/primer/open_project/drag_handle.css
505
505
  - app/components/primer/open_project/drag_handle.css.json
506
506
  - app/components/primer/open_project/drag_handle.css.map
@@ -1027,13 +1027,14 @@ files:
1027
1027
  - previews/primer/forms_preview/submit_button_form.html.erb
1028
1028
  - previews/primer/forms_preview/text_field_and_checkbox_form.html.erb
1029
1029
  - previews/primer/open_project/border_grid_preview.rb
1030
- - previews/primer/open_project/danger_confirmation_dialog_preview.rb
1031
- - previews/primer/open_project/danger_confirmation_dialog_preview/playground.html.erb
1032
- - previews/primer/open_project/danger_confirmation_dialog_preview/with_additional_details.html.erb
1033
- - previews/primer/open_project/danger_confirmation_dialog_preview/with_form.html.erb
1034
- - previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form.html.erb
1035
- - previews/primer/open_project/danger_confirmation_dialog_preview/with_form_builder_form_test.html.erb
1036
- - previews/primer/open_project/danger_confirmation_dialog_preview/with_form_test.html.erb
1030
+ - previews/primer/open_project/danger_dialog_preview.rb
1031
+ - previews/primer/open_project/danger_dialog_preview/deletion_form.rb
1032
+ - previews/primer/open_project/danger_dialog_preview/playground.html.erb
1033
+ - previews/primer/open_project/danger_dialog_preview/with_additional_details.html.erb
1034
+ - previews/primer/open_project/danger_dialog_preview/with_form.html.erb
1035
+ - previews/primer/open_project/danger_dialog_preview/with_form_builder_form.html.erb
1036
+ - previews/primer/open_project/danger_dialog_preview/with_form_builder_form_test.html.erb
1037
+ - previews/primer/open_project/danger_dialog_preview/with_form_test.html.erb
1037
1038
  - previews/primer/open_project/drag_handle_preview.rb
1038
1039
  - previews/primer/open_project/feedback_dialog_preview.rb
1039
1040
  - previews/primer/open_project/feedback_dialog_preview/playground.html.erb
@@ -1,13 +0,0 @@
1
- declare class DangerConfirmationDialogFormHelperElement extends HTMLElement {
2
- #private;
3
- checkbox: HTMLInputElement;
4
- get submitButton(): HTMLButtonElement | HTMLInputElement;
5
- connectedCallback(): void;
6
- toggle(): void;
7
- }
8
- declare global {
9
- interface Window {
10
- DangerConfirmationDialogFormHelperElement: typeof DangerConfirmationDialogFormHelperElement;
11
- }
12
- }
13
- export {};
@@ -1,13 +0,0 @@
1
- declare class DangerConfirmationDialogFormHelperElement extends HTMLElement {
2
- #private;
3
- checkbox: HTMLInputElement;
4
- get submitButton(): HTMLInputElement | HTMLButtonElement;
5
- connectedCallback(): void;
6
- toggle(): void;
7
- }
8
- declare global {
9
- interface Window {
10
- DangerConfirmationDialogFormHelperElement: typeof DangerConfirmationDialogFormHelperElement;
11
- }
12
- }
13
- export {};
@@ -1,36 +0,0 @@
1
- import {controller, target} from '@github/catalyst'
2
-
3
- const SUBMIT_BUTTON_SELECTOR = 'input[type=submit],button[type=submit],button[data-submit-dialog-id]'
4
-
5
- @controller
6
- class DangerConfirmationDialogFormHelperElement extends HTMLElement {
7
- @target checkbox: HTMLInputElement
8
-
9
- get submitButton() {
10
- return this.querySelector<HTMLInputElement | HTMLButtonElement>(SUBMIT_BUTTON_SELECTOR)!
11
- }
12
-
13
- connectedCallback() {
14
- this.#reset()
15
- }
16
-
17
- toggle(): void {
18
- this.submitButton.disabled = !this.checkbox.checked
19
- }
20
-
21
- #reset(): void {
22
- this.checkbox.checked = false
23
- this.toggle()
24
- }
25
- }
26
-
27
- declare global {
28
- interface Window {
29
- DangerConfirmationDialogFormHelperElement: typeof DangerConfirmationDialogFormHelperElement
30
- }
31
- }
32
-
33
- if (!window.customElements.get('danger-confirmation-dialog-form-helper')) {
34
- window.DangerConfirmationDialogFormHelperElement = DangerConfirmationDialogFormHelperElement
35
- window.customElements.define('danger-confirmation-dialog-form-helper', DangerConfirmationDialogFormHelperElement)
36
- }
@@ -1,14 +0,0 @@
1
- <!-- Use the correct form URL here. -->
2
- <%= form_with(url: "") do |f| %>
3
- <%= render(Primer::OpenProject::DangerConfirmationDialog.new(
4
- title: "Delete dialog",
5
- form_arguments: { builder: f, name: "confirm_very_dangerous_action" }
6
- )) do |dialog| %>
7
- <% dialog.with_show_button { "Click me" } %>
8
- <% dialog.with_confirmation_message do |message|
9
- message.with_heading(tag: :h2).with_content("Permanently delete?")
10
- message.with_description_content("This action is not reversible. Please proceed with caution.")
11
- end %>
12
- <% dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed") %>
13
- <% end %>
14
- <% end %>
@@ -1,13 +0,0 @@
1
- <%= form_with(url: generic_form_submission_path(route_format)) do |f| %>
2
- <%= render(Primer::OpenProject::DangerConfirmationDialog.new(
3
- title: "Delete dialog",
4
- form_arguments: { builder: f, name: "confirm_very_dangerous_action" }
5
- )) do |dialog| %>
6
- <% dialog.with_show_button { "Click me" } %>
7
- <% dialog.with_confirmation_message do |message|
8
- message.with_heading(tag: :h2).with_content("Permanently delete?")
9
- message.with_description_content("This action is not reversible. Please proceed with caution.")
10
- end %>
11
- <% dialog.with_confirmation_check_box_content("I understand that this deletion cannot be reversed") %>
12
- <% end %>
13
- <% end %>