project_note
Clone
https://git.tahinli.com/Tahinli/project_note.git
0 watching0 forksRust3.6 MiBc49f5e7Tahinli1 month ago2 commits
| 1 | use |
| 2 | |
| 3 | |
| 4 | |
| 5 | ; |
| 6 | |
| 7 | /// Classes for the overlay that covers the viewport. |
| 8 | /// |
| 9 | /// Set `display` only for the open state so the native closed state remains hidden. |
| 10 | const OVERLAY: StaticClass = class! |
| 11 | |
| 12 | |
| 13 | |
| 14 | ; |
| 15 | |
| 16 | /// Classes that fade the overlay in and out. |
| 17 | /// |
| 18 | /// `allow-discrete` keeps it displayed through the exit transition. `@starting-style` |
| 19 | /// supplies the entry transition's initial opacity. |
| 20 | const FADE: StaticClass = class! |
| 21 | |
| 22 | |
| 23 | ; |
| 24 | |
| 25 | /// A panel displayed over the page. |
| 26 | /// |
| 27 | /// Pass a boolean to `open` for a fixed state, or a runtime expression to control it in |
| 28 | /// the browser. The overlay blocks clicks on the page behind it. Focus trapping and |
| 29 | /// Escape dismissal require application scripting. |
| 30 | /// |
| 31 | /// Pass a `dialog_content` panel as child content. `attrs` are forwarded to the |
| 32 | /// `<dialog>`, with extra classes added to its classes. |
| 33 | /// Give the dialog an accessible name with `aria-label`, or use `aria-labelledby` |
| 34 | /// to reference its title's ID. |
| 35 | /// |
| 36 | /// ```ignore |
| 37 | /// view! { |
| 38 | /// dialog( |
| 39 | /// open: confirming, |
| 40 | /// dialog_content( |
| 41 | /// dialog_header( |
| 42 | /// dialog_title("Delete workspace") |
| 43 | /// dialog_description("This cannot be undone.") |
| 44 | /// ) |
| 45 | /// dialog_footer( |
| 46 | /// // Closing the dialog is navigating to a page that |
| 47 | /// // renders it closed. |
| 48 | /// <a |
| 49 | /// href="/workspace" |
| 50 | /// class=(button_variants(ButtonVariant::Ghost, ButtonSize::Md)) |
| 51 | /// > |
| 52 | /// "Cancel" |
| 53 | /// </a> |
| 54 | /// button(variant: ButtonVariant::Destructive, "Delete") |
| 55 | /// ) |
| 56 | /// ) |
| 57 | /// ) |
| 58 | /// } |
| 59 | /// ``` |
| 60 | |
| 61 | pub async |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | /// Classes for the dialog panel. Automatic vertical margins center short panels while |
| 84 | /// keeping the top of an oversized panel reachable by scrolling. |
| 85 | const CONTENT: StaticClass = class! |
| 86 | |
| 87 | |
| 88 | ; |
| 89 | |
| 90 | /// Classes that scale and fade the panel as the dialog opens or closes. |
| 91 | const MOTION: StaticClass = class! |
| 92 | |
| 93 | |
| 94 | |
| 95 | ; |
| 96 | |
| 97 | /// The content panel inside a dialog. |
| 98 | /// |
| 99 | /// Pass the dialog's sections as children. To override its maximum width, use a more |
| 100 | /// specific class such as `[&]:max-w-xl` in `attrs`, or edit the component's classes. |
| 101 | |
| 102 | pub async |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | /// The opening section of a [`dialog_content`], stacking a [`dialog_title`] |
| 114 | /// and an optional [`dialog_description`]. |
| 115 | |
| 116 | pub async |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | /// The heading of a [`dialog`], rendered as an `<h2>`. |
| 128 | |
| 129 | pub async |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | /// Text that explains the dialog's purpose or requested action. |
| 144 | |
| 145 | pub async |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | /// A row of actions aligned to the right of the dialog. Actions wrap when they do not |
| 160 | /// fit. |
| 161 | |
| 162 | pub async |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 |