Skip to content

Commit

Permalink
fixed dsl operators with PhoneNumberInput
Browse files Browse the repository at this point in the history
  • Loading branch information
iHoonter committed Nov 8, 2024
1 parent 928eb09 commit 7bc3214
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package com.lightningkite.mppexampleapp

import com.lightningkite.kiteui.Routable
import com.lightningkite.kiteui.models.rem
import com.lightningkite.kiteui.navigation.Screen
import com.lightningkite.kiteui.reactive.Property
import com.lightningkite.kiteui.reactive.bind
import com.lightningkite.kiteui.reactive.invoke
import com.lightningkite.kiteui.views.ViewWriter
import com.lightningkite.kiteui.views.bold
import com.lightningkite.kiteui.views.direct.*
import com.lightningkite.kiteui.views.expanding
import com.lightningkite.kiteui.views.l2.field

@Routable("test/formatted-input")
Expand Down Expand Up @@ -36,7 +38,7 @@ class FormattedInputTests : Screen {
space()

field("US Phone Number") {
phoneNumberInput {
sizeConstraints(height = 3.rem) - phoneNumberInput {
format = PhoneNumberFormat.USA
hint = "(123) 456-7890"
content bind phone
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.lightningkite.kiteui.views.direct

import com.lightningkite.kiteui.ViewWrapper
import com.lightningkite.kiteui.models.Align
import com.lightningkite.kiteui.models.Dimension
import com.lightningkite.kiteui.models.KeyboardHints
Expand Down Expand Up @@ -66,4 +67,10 @@ class PhoneNumberInput(container: ViewWriter) {
var hint: String by input::hint
var align: Align by input::align
var textSize: Dimension by input::textSize
}
}

operator fun ViewWrapper.minus(view: PhoneNumberInput): ViewWrapper { return ViewWrapper }
operator fun Boolean.minus(view: PhoneNumberInput): Boolean { return true }

operator fun ViewWrapper.contains(view: PhoneNumberInput): Boolean { return true }
operator fun Boolean.contains(view: PhoneNumberInput): Boolean { return true }

0 comments on commit 7bc3214

Please sign in to comment.