this repo has no description
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

Rename LabelledBy variants

+64 -64
+2 -2
formz_demo/src/formz_demo/examples/custom_output.gleam
··· 46 46 username_state, 47 47 widget.Args( 48 48 "username", 49 - widget.LabelledByLabelFor, 49 + widget.LabelledByLabelElement, 50 50 widget.DescribedByNone, 51 51 ), 52 52 ), ··· 58 58 password_state, 59 59 widget.Args( 60 60 "username", 61 - widget.LabelledByLabelFor, 61 + widget.LabelledByLabelElement, 62 62 widget.DescribedByNone, 63 63 ), 64 64 ),
+1 -1
formz_lustre/src/formz_lustre/generator.gleam
··· 36 36 state, 37 37 widget.Args( 38 38 id: id, 39 - labelled_by: widget.LabelledByLabelFor, 39 + labelled_by: widget.LabelledByLabelElement, 40 40 described_by: widget.DescribedByElementsWithIds([ 41 41 help_text.id, 42 42 error.id,
+4 -4
formz_lustre/src/formz_lustre/widget.gleam
··· 35 35 /// The input is labelled by a `<label>` element with a `for` attribute 36 36 /// pointing to this input's id. This has the best accessibility support 37 37 /// and should be [preferred when possible](https://www.w3.org/WAI/tutorials/forms/labels/). 38 - LabelledByLabelFor 38 + LabelledByLabelElement 39 39 /// The input should be labelled using the `formz.Config`'s `label` field. 40 - LabelledByFieldValue 40 + LabelledByConfigValue 41 41 /// The input is labelled by elements with the specified ids. 42 42 LabelledByElementsWithIds(ids: List(String)) 43 43 } ··· 68 68 label: String, 69 69 ) -> attribute.Attribute(msg) { 70 70 case labelled_by { 71 - LabelledByLabelFor -> attribute.none() 71 + LabelledByLabelElement -> attribute.none() 72 72 LabelledByElementsWithIds(ids) -> 73 73 attribute.attribute("aria-labelledby", string.join(ids, " ")) 74 - LabelledByFieldValue -> 74 + LabelledByConfigValue -> 75 75 case label { 76 76 "" -> attribute.none() 77 77 _ -> attribute.attribute("aria-label", label)
+16 -16
formz_lustre/test/formz_lustre/widgets_test.gleam
··· 16 16 17 17 pub fn to_string_args(args: widget.Args) { 18 18 let labelled_by = case args.labelled_by { 19 - widget.LabelledByFieldValue -> string_widget.LabelledByFieldValue 19 + widget.LabelledByConfigValue -> string_widget.LabelledByConfigValue 20 20 widget.LabelledByElementsWithIds(ids) -> 21 21 string_widget.LabelledByElementsWithIds(ids) 22 - widget.LabelledByLabelFor -> string_widget.LabelledByLabelFor 22 + widget.LabelledByLabelElement -> string_widget.LabelledByLabelElement 23 23 } 24 24 25 25 let described_by = case args.described_by { ··· 77 77 value: "", 78 78 args: widget.Args( 79 79 "id", 80 - labelled_by: widget.LabelledByLabelFor, 80 + labelled_by: widget.LabelledByLabelElement, 81 81 described_by: widget.DescribedByNone, 82 82 ), 83 83 ) ··· 93 93 value: "", 94 94 args: widget.Args( 95 95 "id", 96 - labelled_by: widget.LabelledByLabelFor, 96 + labelled_by: widget.LabelledByLabelElement, 97 97 described_by: widget.DescribedByNone, 98 98 ), 99 99 ) ··· 109 109 value: "val", 110 110 args: widget.Args( 111 111 "id", 112 - labelled_by: widget.LabelledByLabelFor, 112 + labelled_by: widget.LabelledByLabelElement, 113 113 described_by: widget.DescribedByNone, 114 114 ), 115 115 ) ··· 125 125 value: "", 126 126 args: widget.Args( 127 127 "id", 128 - labelled_by: widget.LabelledByFieldValue, 128 + labelled_by: widget.LabelledByConfigValue, 129 129 described_by: widget.DescribedByNone, 130 130 ), 131 131 ) ··· 158 158 value: "on", 159 159 args: widget.Args( 160 160 "id", 161 - labelled_by: widget.LabelledByFieldValue, 161 + labelled_by: widget.LabelledByConfigValue, 162 162 described_by: widget.DescribedByNone, 163 163 ), 164 164 ) ··· 174 174 value: "on", 175 175 args: widget.Args( 176 176 "id", 177 - labelled_by: widget.LabelledByLabelFor, 177 + labelled_by: widget.LabelledByLabelElement, 178 178 described_by: widget.DescribedByNone, 179 179 ), 180 180 ) ··· 207 207 value: "xxxx", 208 208 args: widget.Args( 209 209 "id", 210 - labelled_by: widget.LabelledByFieldValue, 210 + labelled_by: widget.LabelledByConfigValue, 211 211 described_by: widget.DescribedByNone, 212 212 ), 213 213 ) ··· 223 223 value: "xxxx", 224 224 args: widget.Args( 225 225 "id", 226 - labelled_by: widget.LabelledByLabelFor, 226 + labelled_by: widget.LabelledByLabelElement, 227 227 described_by: widget.DescribedByNone, 228 228 ), 229 229 ) ··· 256 256 value: "1", 257 257 args: widget.Args( 258 258 "id", 259 - labelled_by: widget.LabelledByFieldValue, 259 + labelled_by: widget.LabelledByConfigValue, 260 260 described_by: widget.DescribedByNone, 261 261 ), 262 262 ) ··· 272 272 value: "1", 273 273 args: widget.Args( 274 274 "id", 275 - labelled_by: widget.LabelledByLabelFor, 275 + labelled_by: widget.LabelledByLabelElement, 276 276 described_by: widget.DescribedByNone, 277 277 ), 278 278 ) ··· 305 305 value: "1", 306 306 args: widget.Args( 307 307 "id", 308 - labelled_by: widget.LabelledByFieldValue, 308 + labelled_by: widget.LabelledByConfigValue, 309 309 described_by: widget.DescribedByNone, 310 310 ), 311 311 ) ··· 321 321 value: "1", 322 322 args: widget.Args( 323 323 "id", 324 - labelled_by: widget.LabelledByLabelFor, 324 + labelled_by: widget.LabelledByLabelElement, 325 325 described_by: widget.DescribedByNone, 326 326 ), 327 327 ) ··· 355 355 value: "1", 356 356 args: widget.Args( 357 357 "id", 358 - labelled_by: widget.LabelledByFieldValue, 358 + labelled_by: widget.LabelledByConfigValue, 359 359 described_by: widget.DescribedByNone, 360 360 ), 361 361 ) ··· 371 371 value: "1", 372 372 args: widget.Args( 373 373 "id", 374 - labelled_by: widget.LabelledByLabelFor, 374 + labelled_by: widget.LabelledByLabelElement, 375 375 described_by: widget.DescribedByNone, 376 376 ), 377 377 )
+1 -1
formz_nakai/src/formz_nakai/generator.gleam
··· 33 33 state, 34 34 widget.Args( 35 35 id: id, 36 - labelled_by: widget.LabelledByLabelFor, 36 + labelled_by: widget.LabelledByLabelElement, 37 37 described_by: widget.DescribedByElementsWithIds([ 38 38 help_text.id, 39 39 error.id,
+4 -4
formz_nakai/src/formz_nakai/widget.gleam
··· 34 34 /// The input is labelled by a `<label>` element with a `for` attribute 35 35 /// pointing to this input's id. This has the best accessibility support 36 36 /// and should be [preferred when possible](https://www.w3.org/WAI/tutorials/forms/labels/). 37 - LabelledByLabelFor 37 + LabelledByLabelElement 38 38 /// The input should be labelled using the `formz.Config`'s `label`. 39 - LabelledByFieldValue 39 + LabelledByConfigValue 40 40 /// The input is labelled by elements with the specified ids. 41 41 LabelledByElementsWithIds(ids: List(String)) 42 42 } ··· 64 64 65 65 fn aria_label_attr(labelled_by: LabelledBy, label: String) -> List(attr.Attr) { 66 66 case labelled_by { 67 - LabelledByLabelFor -> [] 67 + LabelledByLabelElement -> [] 68 68 LabelledByElementsWithIds(ids) -> [ 69 69 attr.aria_labelledby(string.join(ids, " ")), 70 70 ] 71 - LabelledByFieldValue -> 71 + LabelledByConfigValue -> 72 72 case label { 73 73 "" -> [] 74 74 _ -> [attr.aria_label(label)]
+16 -16
formz_nakai/test/formz_nakai/widgets_test.gleam
··· 12 12 13 13 pub fn to_string_args(args: widget.Args) { 14 14 let labelled_by = case args.labelled_by { 15 - widget.LabelledByFieldValue -> string_widget.LabelledByFieldValue 15 + widget.LabelledByConfigValue -> string_widget.LabelledByConfigValue 16 16 widget.LabelledByElementsWithIds(ids) -> 17 17 string_widget.LabelledByElementsWithIds(ids) 18 - widget.LabelledByLabelFor -> string_widget.LabelledByLabelFor 18 + widget.LabelledByLabelElement -> string_widget.LabelledByLabelElement 19 19 } 20 20 21 21 let described_by = case args.described_by { ··· 95 95 value: "", 96 96 args: widget.Args( 97 97 "id", 98 - labelled_by: widget.LabelledByLabelFor, 98 + labelled_by: widget.LabelledByLabelElement, 99 99 described_by: widget.DescribedByNone, 100 100 ), 101 101 ) ··· 111 111 value: "", 112 112 args: widget.Args( 113 113 "id", 114 - labelled_by: widget.LabelledByLabelFor, 114 + labelled_by: widget.LabelledByLabelElement, 115 115 described_by: widget.DescribedByNone, 116 116 ), 117 117 ) ··· 127 127 value: "val", 128 128 args: widget.Args( 129 129 "id", 130 - labelled_by: widget.LabelledByLabelFor, 130 + labelled_by: widget.LabelledByLabelElement, 131 131 described_by: widget.DescribedByNone, 132 132 ), 133 133 ) ··· 143 143 value: "", 144 144 args: widget.Args( 145 145 "id", 146 - labelled_by: widget.LabelledByFieldValue, 146 + labelled_by: widget.LabelledByConfigValue, 147 147 described_by: widget.DescribedByNone, 148 148 ), 149 149 ) ··· 176 176 value: "on", 177 177 args: widget.Args( 178 178 "id", 179 - labelled_by: widget.LabelledByFieldValue, 179 + labelled_by: widget.LabelledByConfigValue, 180 180 described_by: widget.DescribedByNone, 181 181 ), 182 182 ) ··· 192 192 value: "on", 193 193 args: widget.Args( 194 194 "id", 195 - labelled_by: widget.LabelledByLabelFor, 195 + labelled_by: widget.LabelledByLabelElement, 196 196 described_by: widget.DescribedByNone, 197 197 ), 198 198 ) ··· 225 225 value: "xxxx", 226 226 args: widget.Args( 227 227 "id", 228 - labelled_by: widget.LabelledByFieldValue, 228 + labelled_by: widget.LabelledByConfigValue, 229 229 described_by: widget.DescribedByNone, 230 230 ), 231 231 ) ··· 241 241 value: "xxxx", 242 242 args: widget.Args( 243 243 "id", 244 - labelled_by: widget.LabelledByLabelFor, 244 + labelled_by: widget.LabelledByLabelElement, 245 245 described_by: widget.DescribedByNone, 246 246 ), 247 247 ) ··· 274 274 value: "1", 275 275 args: widget.Args( 276 276 "id", 277 - labelled_by: widget.LabelledByFieldValue, 277 + labelled_by: widget.LabelledByConfigValue, 278 278 described_by: widget.DescribedByNone, 279 279 ), 280 280 ) ··· 290 290 value: "1", 291 291 args: widget.Args( 292 292 "id", 293 - labelled_by: widget.LabelledByLabelFor, 293 + labelled_by: widget.LabelledByLabelElement, 294 294 described_by: widget.DescribedByNone, 295 295 ), 296 296 ) ··· 323 323 value: "1", 324 324 args: widget.Args( 325 325 "id", 326 - labelled_by: widget.LabelledByFieldValue, 326 + labelled_by: widget.LabelledByConfigValue, 327 327 described_by: widget.DescribedByNone, 328 328 ), 329 329 ) ··· 339 339 value: "1", 340 340 args: widget.Args( 341 341 "id", 342 - labelled_by: widget.LabelledByLabelFor, 342 + labelled_by: widget.LabelledByLabelElement, 343 343 described_by: widget.DescribedByNone, 344 344 ), 345 345 ) ··· 373 373 value: "1", 374 374 args: widget.Args( 375 375 "id", 376 - labelled_by: widget.LabelledByFieldValue, 376 + labelled_by: widget.LabelledByConfigValue, 377 377 described_by: widget.DescribedByNone, 378 378 ), 379 379 ) ··· 389 389 value: "1", 390 390 args: widget.Args( 391 391 "id", 392 - labelled_by: widget.LabelledByLabelFor, 392 + labelled_by: widget.LabelledByLabelElement, 393 393 described_by: widget.DescribedByNone, 394 394 ), 395 395 )
+1 -1
formz_string/src/formz_string/generator.gleam
··· 28 28 let args = 29 29 widget.Args( 30 30 id, 31 - widget.LabelledByLabelFor, 31 + widget.LabelledByLabelElement, 32 32 widget.DescribedByElementsWithIds([help_text.id, error.id]), 33 33 ) 34 34 let widget_el = make_widget(config, state, args)
+4 -4
formz_string/src/formz_string/widget.gleam
··· 32 32 /// The input is labelled by a `<label>` element with a `for` attribute 33 33 /// pointing to this input's id. This has the best accessibility support 34 34 /// and should be [preferred when possible](https://www.w3.org/WAI/tutorials/forms/labels/). 35 - LabelledByLabelFor 35 + LabelledByLabelElement 36 36 /// The input should be labelled using the `formz.Config`'s `label`. 37 - LabelledByFieldValue 37 + LabelledByConfigValue 38 38 /// The input is labelled by elements with the specified ids. 39 39 LabelledByElementsWithIds(ids: List(String)) 40 40 } ··· 82 82 // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby 83 83 case labelled_by { 84 84 // there should be a label with a for attribute pointing to this id 85 - LabelledByLabelFor -> "" 85 + LabelledByLabelElement -> "" 86 86 87 87 // we have the id of the element that labels this input 88 88 LabelledByElementsWithIds(ids) -> ··· 91 91 }) 92 92 93 93 // we'll use the label value as the aria-label 94 - LabelledByFieldValue -> { 94 + LabelledByConfigValue -> { 95 95 case label { 96 96 "" -> "" 97 97 _ -> " aria-label=\"" <> sanitize_attr(label) <> "\""
+15 -15
formz_string/test/formz_string/widgets_test.gleam
··· 18 18 get_make_fun(widget.input_widget("text"))( 19 19 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 20 20 formz.Valid("hello", formz.Optional), 21 - widget.Args("", widget.LabelledByFieldValue, widget.DescribedByNone), 21 + widget.Args("", widget.LabelledByConfigValue, widget.DescribedByNone), 22 22 ) 23 23 |> birdie.snap(title: "input labelled by field value") 24 24 } ··· 40 40 get_make_fun(widget.input_widget("text"))( 41 41 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 42 42 formz.Valid("hello", formz.Optional), 43 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 43 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 44 44 ) 45 45 |> birdie.snap(title: "input labelled by label/for") 46 46 } ··· 51 51 formz.Valid("hello", formz.Optional), 52 52 widget.Args( 53 53 "", 54 - widget.LabelledByLabelFor, 54 + widget.LabelledByLabelElement, 55 55 widget.DescribedByElementsWithIds(["id1", "id2"]), 56 56 ), 57 57 ) ··· 64 64 formz.Valid("hello", formz.Optional), 65 65 widget.Args( 66 66 "", 67 - widget.LabelledByLabelFor, 67 + widget.LabelledByLabelElement, 68 68 widget.DescribedByElementsWithIds(["", ""]), 69 69 ), 70 70 ) ··· 75 75 get_make_fun(widget.input_widget("text"))( 76 76 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 77 77 formz.Valid("hello", formz.Required), 78 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 78 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 79 79 ) 80 80 |> birdie.snap(title: "input required") 81 81 } ··· 84 84 get_make_fun(widget.input_widget("text"))( 85 85 formz.Config(name: "name", label: "Label", help_text: "", disabled: True), 86 86 formz.Valid("hello", formz.Optional), 87 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 87 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 88 88 ) 89 89 |> birdie.snap(title: "input disabled") 90 90 } ··· 93 93 get_make_fun(widget.input_widget("text"))( 94 94 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 95 95 formz.Valid("hello\"<-_=>", formz.Optional), 96 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 96 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 97 97 ) 98 98 |> birdie.snap(title: "input sanitized value") 99 99 } ··· 102 102 get_make_fun(widget.checkbox_widget())( 103 103 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 104 104 formz.Valid("on", formz.Optional), 105 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 105 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 106 106 ) 107 107 |> birdie.snap(title: "checkbox checked") 108 108 } ··· 111 111 get_make_fun(widget.checkbox_widget())( 112 112 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 113 113 formz.Valid("", formz.Optional), 114 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 114 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 115 115 ) 116 116 |> birdie.snap(title: "checkbox unchecked") 117 117 } ··· 120 120 get_make_fun(widget.password_widget())( 121 121 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 122 122 formz.Valid("pass", formz.Optional), 123 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 123 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 124 124 ) 125 125 |> birdie.snap(title: "password ignores input") 126 126 } ··· 129 129 get_make_fun(widget.number_widget(""))( 130 130 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 131 131 formz.Valid("1", formz.Optional), 132 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 132 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 133 133 ) 134 134 |> birdie.snap(title: "number input with no step") 135 135 } ··· 138 138 get_make_fun(widget.number_widget("0.1"))( 139 139 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 140 140 formz.Valid("1.0", formz.Optional), 141 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 141 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 142 142 ) 143 143 |> birdie.snap(title: "number input with step") 144 144 } ··· 149 149 )( 150 150 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 151 151 formz.Valid("", formz.Optional), 152 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 152 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 153 153 ) 154 154 |> birdie.snap(title: "basic select") 155 155 } ··· 160 160 )( 161 161 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 162 162 formz.Valid("1", formz.Optional), 163 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 163 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 164 164 ) 165 165 |> birdie.snap(title: "select selected") 166 166 } ··· 171 171 )( 172 172 formz.Config(name: "name", label: "Label", help_text: "", disabled: False), 173 173 formz.Valid("", formz.Required), 174 - widget.Args("", widget.LabelledByLabelFor, widget.DescribedByNone), 174 + widget.Args("", widget.LabelledByLabelElement, widget.DescribedByNone), 175 175 ) 176 176 |> birdie.snap(title: "required select") 177 177 }