Skip to content

Commit

Permalink
MUI Base. Fix and unify "classes" declarations #2
Browse files Browse the repository at this point in the history
  • Loading branch information
aerialist7 committed May 4, 2024
1 parent c282ea1 commit de43332
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 41 deletions.
9 changes: 3 additions & 6 deletions buildSrc/src/main/kotlin/karakum/mui/Converter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ internal fun convertClasses(
keys = slots,
comments = comments,
getValue = {
if (it in MUI_COMMON_CLASSES) {
"${MUI_BASE.lowercase()}-$it"
} else {
"${MUI_BASE.lowercase()}-$componentName-$it"
}
val name = if (it in MUI_COMMON_CLASS_MODIFIERS) "" else componentName
"base-$name-$it"
},
type = "ClassName",
)
Expand All @@ -74,7 +71,7 @@ internal fun convertClasses(

val muiContent = convertSealed(
name = muiName,
keys = slots.filter { it !in MUI_COMMON_CLASSES },
keys = slots.filter { it !in MUI_COMMON_CLASS_MODIFIERS },
getValue = { "$muiName-$it" },
type = "ClassName",
)
Expand Down
5 changes: 2 additions & 3 deletions buildSrc/src/main/kotlin/karakum/mui/Mui.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package karakum.mui

internal const val MUI = "Mui"
internal const val MUI_BASE = "Base"

internal val MUI_COMMON_CLASSES = listOf(
internal val MUI_COMMON_CLASS_MODIFIERS = listOf(
"active",
"checked",
"completed",
Expand All @@ -18,7 +17,7 @@ internal val MUI_COMMON_CLASSES = listOf(

internal val MUI_BODY = convertSealed(
name = MUI,
keys = MUI_COMMON_CLASSES,
keys = MUI_COMMON_CLASS_MODIFIERS,
getValue = { "$MUI-$it" },
type = "ClassName",
)
6 changes: 3 additions & 3 deletions mui-kotlin/src/jsMain/kotlin/mui/base/Button.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ sealed external interface ButtonClasses {
val root: ClassName

/** State class applied to the root `button` element if `active={true}`. */
@JsValue("base-active")
@JsValue("base--active")
val active: ClassName

/** State class applied to the root `button` element if `disabled={true}`. */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName

/** State class applied to the root `button` element if `focusVisible={true}`. */
@JsValue("base-focusVisible")
@JsValue("base--focusVisible")
val focusVisible: ClassName
}
}
8 changes: 4 additions & 4 deletions mui-kotlin/src/jsMain/kotlin/mui/base/FormControl.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ sealed external interface FormControlClasses {
val root: ClassName

/** State class applied to the root element if `disabled={true}`. */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName

/** State class applied to the root element if `error={true}`. */
@JsValue("base-error")
@JsValue("base--error")
val error: ClassName

/** State class applied to the root element if the inner input has value. */
@JsValue("base-FormControl-filled")
val filled: ClassName

/** State class applied to the root element if the inner input is focused. */
@JsValue("base-focused")
@JsValue("base--focused")
val focused: ClassName

/** State class applied to the root element if `required={true}`. */
@JsValue("base-required")
@JsValue("base--required")
val required: ClassName
}
}
6 changes: 3 additions & 3 deletions mui-kotlin/src/jsMain/kotlin/mui/base/Input.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ sealed external interface InputClasses {
val adornedEnd: ClassName

/** State class applied to the root element if the component is focused. */
@JsValue("base-focused")
@JsValue("base--focused")
val focused: ClassName

/** State class applied to the root element if `disabled={true}`. */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName

/** State class applied to the root element if `error={true}`. */
@JsValue("base-error")
@JsValue("base--error")
val error: ClassName

/** Class name applied to the root element if `multiline={true}`. */
Expand Down
2 changes: 1 addition & 1 deletion mui-kotlin/src/jsMain/kotlin/mui/base/Menu.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ sealed external interface MenuClasses {
val listbox: ClassName

/** State class applied to the root element if `open={true}`. */
@JsValue("base-expanded")
@JsValue("base--expanded")
val expanded: ClassName
}
}
6 changes: 3 additions & 3 deletions mui-kotlin/src/jsMain/kotlin/mui/base/MenuButton.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ sealed external interface MenuButtonClasses {
val root: ClassName

/** State class applied to the root element if `active={true}`. */
@JsValue("base-active")
@JsValue("base--active")
val active: ClassName

/** State class applied to the root element if `disabled={true}`. */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName

/** State class applied to the root element if the associated menu is open. */
@JsValue("base-expanded")
@JsValue("base--expanded")
val expanded: ClassName
}
}
4 changes: 2 additions & 2 deletions mui-kotlin/src/jsMain/kotlin/mui/base/MenuItem.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ sealed external interface MenuItemClasses {
val root: ClassName

/** State class applied to the root `button` element if `disabled={true}`. */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName

/** State class applied to the root `button` element if `focusVisible={true}`. */
@JsValue("base-focusVisible")
@JsValue("base--focusVisible")
val focusVisible: ClassName
}
}
4 changes: 2 additions & 2 deletions mui-kotlin/src/jsMain/kotlin/mui/base/Option.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ sealed external interface OptionClasses {
val root: ClassName

/** State class applied to the root `li` element if `disabled={true}`. */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName

/** State class applied to the root `li` element if `selected={true}`. */
@JsValue("base-selected")
@JsValue("base--selected")
val selected: ClassName

/** State class applied to the root `li` element if `highlighted={true}`. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sealed external interface OptionGroupClasses {
val root: ClassName

/** State class applied to the root `li` element if `disabled={true}`. */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName

/** Class name applied to the label element. */
Expand Down
8 changes: 4 additions & 4 deletions mui-kotlin/src/jsMain/kotlin/mui/base/Select.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ sealed external interface SelectClasses {
val popup: ClassName

/** State class applied to the root `button` element if `active={true}`. */
@JsValue("base-active")
@JsValue("base--active")
val active: ClassName

/** State class applied to the root `button` element if `expanded={true}`. */
@JsValue("base-expanded")
@JsValue("base--expanded")
val expanded: ClassName

/** State class applied to the root `button` element and the listbox 'ul' element if `disabled={true}`. */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName

/** State class applied to the root `button` element if `focusVisible={true}`. */
@JsValue("base-focusVisible")
@JsValue("base--focusVisible")
val focusVisible: ClassName
}
}
6 changes: 3 additions & 3 deletions mui-kotlin/src/jsMain/kotlin/mui/base/Slider.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sealed external interface SliderClasses {
val vertical: ClassName

/** State class applied to the root and thumb element if `disabled={true}`. */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName

/** State class applied to the root if a thumb is being dragged. */
Expand Down Expand Up @@ -50,11 +50,11 @@ sealed external interface SliderClasses {
val thumb: ClassName

/** State class applied to the thumb element if it's active. */
@JsValue("base-active")
@JsValue("base--active")
val active: ClassName

/** State class applied to the thumb element if keyboard focused. */
@JsValue("base-focusVisible")
@JsValue("base--focusVisible")
val focusVisible: ClassName

/** Class name applied to the mark element. */
Expand Down
6 changes: 3 additions & 3 deletions mui-kotlin/src/jsMain/kotlin/mui/base/Switch.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ sealed external interface SwitchClasses {
val thumb: ClassName

/** State class applied to the root element if the switch is checked */
@JsValue("base-checked")
@JsValue("base--checked")
val checked: ClassName

/** State class applied to the root element if the switch is disabled */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName

/** State class applied to the root element if the switch has visible focus */
@JsValue("base-focusVisible")
@JsValue("base--focusVisible")
val focusVisible: ClassName

/** Class applied to the root element if the switch is read-only */
Expand Down
4 changes: 2 additions & 2 deletions mui-kotlin/src/jsMain/kotlin/mui/base/Tab.classes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ sealed external interface TabClasses {
val root: ClassName

/** State class applied to the root `button` element if `selected={true}`. */
@JsValue("base-selected")
@JsValue("base--selected")
val selected: ClassName

/** State class applied to the root `button` element if `disabled={true}`. */
@JsValue("base-disabled")
@JsValue("base--disabled")
val disabled: ClassName
}
}
2 changes: 2 additions & 0 deletions mui-kotlin/src/jsMain/kotlin/mui/material/Grid.mui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ sealed external interface MuiGrid {

@JsValue("MuiGrid-zeroMinWidth")
val zeroMinWidth: ClassName


}
}
4 changes: 3 additions & 1 deletion mui-kotlin/src/jsMain/kotlin/mui/material/TouchRipple.ext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

package mui.material

import web.html.HTMLElement

external interface TouchRippleProps :
mui.system.StandardProps,
react.dom.html.HTMLAttributes<web.html.HTMLElement>
react.dom.html.HTMLAttributes<HTMLElement>

0 comments on commit de43332

Please sign in to comment.