Skip to content

Commit

Permalink
rebase on master, update missing replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
ByScripts committed Dec 20, 2024
1 parent 2429098 commit 208ad3a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@

<script lang="ts" setup>
import UiUserLogo from '@core/components/ui/user-logo/UiUserLogo.vue'
import { useContext } from '@core/composables/context.composable'
import { DisabledContext } from '@core/context'
import { useDisabled } from '@core/composables/disabled.composable'

defineProps<{
size: 'small' | 'medium'
selected?: boolean
}>()

const isDisabled = useContext(DisabledContext)
const isDisabled = useDisabled()
</script>

<style lang="postcss" scoped>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- v3 -->
<template>
<button type="button" class="ui-dropdown-item" :class="{ selected }" :disabled="isDisabled">
<button :class="{ selected }" :disabled="isDisabled" class="ui-dropdown-item" type="button">
<VtsIcon :icon accent="current" class="left-icon" fixed-width />
<span class="typo p1-regular label">
<slot />
Expand All @@ -11,24 +11,20 @@

<script lang="ts" setup>
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import { useContext } from '@core/composables/context.composable'
import { DisabledContext } from '@core/context'
import { useDisabled } from '@core/composables/disabled.composable'
import type { IconDefinition } from '@fortawesome/fontawesome-common-types'
import { faAngleDown } from '@fortawesome/free-solid-svg-icons'

const props = withDefaults(
defineProps<{
disabled?: boolean
selected?: boolean
icon?: IconDefinition
}>(),
{ disabled: undefined }
)
const { disabled, selected, icon } = defineProps<{
disabled?: boolean
selected?: boolean
icon?: IconDefinition
}>()

const isDisabled = useContext(DisabledContext, () => props.disabled)
const isDisabled = useDisabled(() => disabled)
</script>

<style scoped lang="postcss">
<style lang="postcss" scoped>
.ui-dropdown-item {
display: inline-flex;
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<template>
<label :class="variant" class="ui-radio-button typo p1-regular">
<span class="radio-container">
<input v-model="model" :value :disabled="isDisabled" class="input" type="radio" />
<input v-model="model" :disabled="isDisabled" :value class="input" type="radio" />
<VtsIcon :icon="faCircle" accent="current" class="radio-icon" />
</span>
<slot />
Expand All @@ -11,31 +11,26 @@

<script lang="ts" setup>
import VtsIcon from '@core/components/icon/VtsIcon.vue'
import { useContext } from '@core/composables/context.composable'
import { DisabledContext } from '@core/context'
import { useDisabled } from '@core/composables/disabled.composable'
import { toVariants } from '@core/utils/to-variants.util'
import { faCircle } from '@fortawesome/free-solid-svg-icons'
import { computed } from 'vue'

const props = withDefaults(
defineProps<{
accent: 'info' | 'success' | 'warning' | 'danger'
value: any
disabled?: boolean
}>(),
{
disabled: undefined,
}
)
const { accent, value, disabled } = defineProps<{
accent: 'info' | 'success' | 'warning' | 'danger'
value: any
disabled?: boolean
}>()

const model = defineModel<boolean>()

defineSlots<{
default(): any
}>()

const variant = computed(() => toVariants({ accent: props.accent }))
const variant = computed(() => toVariants({ accent }))

const isDisabled = useContext(DisabledContext, () => props.disabled)
const isDisabled = useDisabled(() => disabled)
</script>

<style lang="postcss" scoped>
Expand All @@ -60,6 +55,7 @@ const isDisabled = useContext(DisabledContext, () => props.disabled)

&:has(input:focus-visible) {
outline: none;

&::after {
position: absolute;
content: '';
Expand All @@ -68,6 +64,7 @@ const isDisabled = useContext(DisabledContext, () => props.disabled)
border-radius: 0.4rem;
}
}

&:has(.input:disabled) {
cursor: not-allowed;

Expand Down
16 changes: 6 additions & 10 deletions @xen-orchestra/web-core/lib/components/ui/toggle/UiToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,20 @@

<script lang="ts" setup>
import UiLoader from '@core/components/ui/loader/UiLoader.vue'
import { useContext } from '@core/composables/context.composable'
import { DisabledContext } from '@core/context'
import { useDisabled } from '@core/composables/disabled.composable'

const props = withDefaults(
defineProps<{
disabled?: boolean
busy?: boolean
}>(),
{ disabled: undefined }
)
const { busy, disabled } = defineProps<{
disabled?: boolean
busy?: boolean
}>()

const checked = defineModel<boolean>()

defineSlots<{
default(): any
}>()

const isDisabled = useContext(DisabledContext, () => props.disabled)
const isDisabled = useDisabled(() => disabled)
</script>

<style lang="postcss" scoped>
Expand Down

0 comments on commit 208ad3a

Please sign in to comment.