Skip to content

Commit

Permalink
fix(enhanced-readabilities): use plain CSS styles to prevent outline …
Browse files Browse the repository at this point in the history
…class overrides (#315) (#320)

Signed-off-by: Neko Ayaka <[email protected]>
  • Loading branch information
nekomeowww authored Oct 11, 2024
1 parent 6beb3a2 commit a3057fc
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 99 deletions.
2 changes: 1 addition & 1 deletion docs/pages/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Nólëbase Integrations project provides a variety of integrations, plugins, com
💕 Thanks to all the contributors!
</h2>

<a href="https://github.com/nolebase/integrations/graphs/contributors">
<a href="https://github.com/nolebase/integrations/graphs/contributors" flex justify-center>
<img src="https://contrib.rocks/image?repo=nolebase/integrations" />
</a>
</div>
Expand Down
12 changes: 0 additions & 12 deletions docs/pages/en/ui/input-horizontal-radio-group/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ This package is still in the Alpha test stage and is not recommended for use in
v-model="value1"
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions1"
/>

Expand All @@ -130,8 +128,6 @@ This package is still in the Alpha test stage and is not recommended for use in
v-model="value2"
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions2"
/>

Expand All @@ -141,8 +137,6 @@ This package is still in the Alpha test stage and is not recommended for use in
v-model="value3"
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions3"
/>

Expand All @@ -153,8 +147,6 @@ This package is still in the Alpha test stage and is not recommended for use in
<NuInputHorizontalRadioGroup
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions1"
:disabled="true"
/>
Expand All @@ -164,8 +156,6 @@ This package is still in the Alpha test stage and is not recommended for use in
<NuInputHorizontalRadioGroup
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions2"
:disabled="true"
/>
Expand All @@ -175,8 +165,6 @@ This package is still in the Alpha test stage and is not recommended for use in
<NuInputHorizontalRadioGroup
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions3"
:disabled="true"
/>
2 changes: 1 addition & 1 deletion docs/pages/zh-CN/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Nólëbase 集成项目提供多种不同的集成、插件、组件和库来方
💕 感谢所有贡献者!
</h2>

<a href="https://github.com/nolebase/integrations/graphs/contributors">
<a href="https://github.com/nolebase/integrations/graphs/contributors" flex justify-center>
<img src="https://contrib.rocks/image?repo=nolebase/integrations" />
</a>
</div>
Expand Down
12 changes: 0 additions & 12 deletions docs/pages/zh-CN/ui/input-horizontal-radio-group/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ const fieldOptions3 = [
v-model="value1"
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions1"
/>

Expand All @@ -130,8 +128,6 @@ const fieldOptions3 = [
v-model="value2"
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions2"
/>

Expand All @@ -141,8 +137,6 @@ const fieldOptions3 = [
v-model="value3"
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions3"
/>

Expand All @@ -153,8 +147,6 @@ const fieldOptions3 = [
<NuInputHorizontalRadioGroup
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions1"
:disabled="true"
/>
Expand All @@ -164,8 +156,6 @@ const fieldOptions3 = [
<NuInputHorizontalRadioGroup
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions2"
:disabled="true"
/>
Expand All @@ -175,8 +165,6 @@ const fieldOptions3 = [
<NuInputHorizontalRadioGroup
bg="zinc-200/50 dark:zinc-800/50"
text="sm zinc-100"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:options="fieldOptions3"
:disabled="true"
/>
30 changes: 30 additions & 0 deletions packages/ui/src/components/NuInputHighlight.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script setup lang="ts">
defineProps<{
active: boolean
}>()
</script>

<template>
<div
class="input-highlight"
transition="outline duration-200 ease"
:class="{
active: Boolean(active),
}"
>
<slot />
</div>
</template>

<style lang="css" scoped>
.input-highlight {
outline-width: 2px;
outline-color: transparent;
outline-offset: 4px;
outline-style: dashed;
}
.input-highlight.active {
outline-color: var(--vp-c-brand-1);
}
</style>
2 changes: 0 additions & 2 deletions packages/ui/src/components/NuInputSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ watch(inputValue, () => {
bg="zinc-200/50 dark:zinc-800/50"
w-full appearance-none rounded-lg border-none p-1 space-x-2
text="sm zinc-300"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
>
<label
class="nolebase-ui-slider nolebase-ui-slider"
Expand Down
2 changes: 2 additions & 0 deletions packages/ui/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import NuButton from './components/NuButton.vue'
import NuInputHighlight from './components/NuInputHighlight.vue'
import NuInputHorizontalRadioGroup from './components/NuInputHorizontalRadioGroup/index.vue'
import NuInputSlider from './components/NuInputSlider.vue'
import NuTag from './components/NuTag/index.vue'
Expand All @@ -9,6 +10,7 @@ import { createI18n } from './composables/i18n'
export {
createI18n,
NuButton,
NuInputHighlight,
NuInputHorizontalRadioGroup,
NuInputSlider,
NuTag,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { NuInputHorizontalRadioGroup } from '@nolebase/ui'
import { NuInputHighlight, NuInputHorizontalRadioGroup } from '@nolebase/ui'
import { useLocalStorage, useMediaQuery, useMounted } from '@vueuse/core'
import { useRoute } from 'vitepress'
import { computed, inject, onMounted, ref, watch } from 'vue'
Expand Down Expand Up @@ -165,18 +165,15 @@ onMounted(() => {
</div>
</MenuHelp>
</div>
<NuInputHorizontalRadioGroup
v-model="layoutMode"
bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:class="{
'outline-$vp-c-brand-1!': isMenuHelpPoppedUp,
}"
:options="fieldOptions"
:disabled="disabled"
/>
<NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md">
<NuInputHorizontalRadioGroup
v-model="layoutMode"
bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
:options="fieldOptions"
:disabled="disabled"
/>
</NuInputHighlight>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { NuInputSlider, NuVerticalTransition } from '@nolebase/ui'
import { NuInputHighlight, NuInputSlider, NuVerticalTransition } from '@nolebase/ui'
import { useDebounceFn, useLocalStorage, useMediaQuery, useMounted, useStorage } from '@vueuse/core'
import { computed, inject, onMounted, ref, watch } from 'vue'
Expand Down Expand Up @@ -141,21 +141,19 @@ watch(maxWidthValue, (val) => {
</div>
</MenuHelp>
</div>
<NuInputSlider
v-model="maxWidthValue"
bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
name="VitePress Nolebase Enhanced Readabilities content layout max width range slider"
:class="{
'outline-$vp-c-brand-1!': isMenuHelpPoppedUp,
'rounded-md': isMenuHelpPoppedUp,
}"
:aria-label="t('layoutSwitch.contentLayoutMaxWidth.optionFullWidthAriaLabel')"
:disabled="disabled"
:min="minScaled"
:max="maxScaled"
:formatter="(val) => `${Math.ceil(val / 100)}%`"
/>
<NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md">
<NuInputSlider
v-model="maxWidthValue"
bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
name="VitePress Nolebase Enhanced Readabilities content layout max width range slider"
:aria-label="t('layoutSwitch.contentLayoutMaxWidth.optionFullWidthAriaLabel')"
:disabled="disabled"
:min="minScaled"
:max="maxScaled"
:formatter="(val) => `${Math.ceil(val / 100)}%`"
/>
</NuInputHighlight>
</div>
</NuVerticalTransition>
</template>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { NuInputSlider, NuVerticalTransition } from '@nolebase/ui'
import { NuInputHighlight, NuInputSlider, NuVerticalTransition } from '@nolebase/ui'
import { useDebounceFn, useLocalStorage, useMediaQuery, useMounted, useStorage } from '@vueuse/core'
import { computed, inject, onMounted, ref, watch } from 'vue'
Expand Down Expand Up @@ -138,21 +138,19 @@ watch(maxWidthValue, (val) => {
</div>
</MenuHelp>
</div>
<NuInputSlider
v-model="maxWidthValue"
bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
name="VitePress Nolebase Enhanced Readabilities page layout max width range slider"
:class="{
'outline-$vp-c-brand-1!': isMenuHelpPoppedUp,
'rounded-md': isMenuHelpPoppedUp,
}"
:aria-label="t('layoutSwitch.pageLayoutMaxWidth.sliderAriaLabel')"
:disabled="disabled"
:min="minScaled"
:max="maxScaled"
:formatter="(val) => `${Math.ceil(val / 100)}%`"
/>
<NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md">
<NuInputSlider
v-model="maxWidthValue"
bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
name="VitePress Nolebase Enhanced Readabilities page layout max width range slider"
:aria-label="t('layoutSwitch.pageLayoutMaxWidth.sliderAriaLabel')"
:disabled="disabled"
:min="minScaled"
:max="maxScaled"
:formatter="(val) => `${Math.ceil(val / 100)}%`"
/>
</NuInputHighlight>
</div>
</NuVerticalTransition>
</template>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { NuInputHorizontalRadioGroup } from '@nolebase/ui'
import { NuInputHighlight, NuInputHorizontalRadioGroup } from '@nolebase/ui'
import { useMediaQuery, useMounted, useStorage } from '@vueuse/core'
import { computed, inject, onMounted, ref, watch } from 'vue'
Expand Down Expand Up @@ -93,17 +93,14 @@ watch(isTouchScreen, () => {
</div>
</MenuHelp>
</div>
<NuInputHorizontalRadioGroup
v-model="spotlightToggledOn"
bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:class="{
'outline-$vp-c-brand-1!': isMenuHelpPoppedUp,
}"
:options="fieldOptions"
:disabled="disabled"
/>
<NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md">
<NuInputHorizontalRadioGroup
v-model="spotlightToggledOn"
bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
:options="fieldOptions"
:disabled="disabled"
/>
</NuInputHighlight>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { NuInputHorizontalRadioGroup } from '@nolebase/ui'
import { NuInputHighlight, NuInputHorizontalRadioGroup } from '@nolebase/ui'
import { useMediaQuery, useStorage } from '@vueuse/core'
import { computed, inject, onMounted, ref, watch } from 'vue'
Expand Down Expand Up @@ -95,18 +95,15 @@ watch(isTouchScreen, () => {
</div>
</MenuHelp>
</div>
<NuInputHorizontalRadioGroup
v-model="spotlightStyle"
bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
outline="transparent 2px offset-4px dashed"
transition="outline duration-200 ease"
:class="{
'outline-$vp-c-brand-1!': isMenuHelpPoppedUp,
}"
:options="fieldOptions"
:disabled="disabled"
/>
<NuInputHighlight :active="isMenuHelpPoppedUp" class="rounded-md">
<NuInputHorizontalRadioGroup
v-model="spotlightStyle"
bg="$vp-nolebase-enhanced-readabilities-menu-background-color"
text="sm $vp-nolebase-enhanced-readabilities-menu-text-color"
:options="fieldOptions"
:disabled="disabled"
/>
</NuInputHighlight>
</div>
</Transition>
</template>
Expand Down

0 comments on commit a3057fc

Please sign in to comment.