Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit df04323

Browse files
authored
Merge pull request bootstrap-vue-next#1065 from VividLemon/main
feat(BButton): add prop block
2 parents b2ddee6 + 67d46fe commit df04323

File tree

124 files changed

+29219
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+29219
-89
lines changed

apps/nuxt-docs/.eslintrc.cjs

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/* eslint-env node */
2+
require('@rushstack/eslint-patch/modern-module-resolution')
3+
4+
// eslint-disable-next-line @typescript-eslint/no-var-requires
5+
const {defineConfig} = require('eslint-define-config')
6+
7+
module.exports = defineConfig({
8+
root: true,
9+
env: {
10+
browser: true,
11+
node: true,
12+
},
13+
parser: 'vue-eslint-parser',
14+
parserOptions: {
15+
parser: '@typescript-eslint/parser',
16+
ecmaVersion: 'latest',
17+
},
18+
extends: [
19+
'eslint:recommended',
20+
'plugin:vue/vue3-recommended',
21+
'@nuxtjs/eslint-config-typescript',
22+
'@vue/eslint-config-prettier',
23+
'plugin:vuejs-accessibility/recommended',
24+
],
25+
plugins: ['vuejs-accessibility'],
26+
rules: {
27+
'prettier/prettier': [
28+
'warn',
29+
{
30+
endOfLine: 'auto',
31+
},
32+
],
33+
'no-alert': 'warn',
34+
'no-console': 'warn',
35+
'no-debugger': 'warn',
36+
'arrow-body-style': 'warn',
37+
'eqeqeq': 'error',
38+
'generator-star-spacing': 'warn',
39+
'grouped-accessor-pairs': 'warn',
40+
'no-caller': 'error',
41+
'no-duplicate-imports': 'error',
42+
'no-else-return': 'warn',
43+
'no-eval': 'error',
44+
'no-extra-bind': 'warn',
45+
'no-implied-eval': 'error',
46+
'no-labels': 'warn',
47+
'no-lone-blocks': 'warn',
48+
'no-new-func': 'error',
49+
'no-new-wrappers': 'error',
50+
'no-return-await': 'warn',
51+
'no-template-curly-in-string': 'warn',
52+
'no-throw-literal': 'error',
53+
'no-undef-init': 'warn',
54+
'no-useless-call': 'warn',
55+
'no-useless-constructor': 'warn',
56+
'no-useless-rename': 'warn',
57+
'no-useless-return': 'warn',
58+
'no-var': 'error',
59+
'object-shorthand': 'warn',
60+
'prefer-const': 'warn',
61+
'prefer-destructuring': 'warn',
62+
'prefer-numeric-literals': 'warn',
63+
'prefer-rest-params': 'warn',
64+
'prefer-spread': 'warn',
65+
'prefer-template': 'warn',
66+
'require-atomic-updates': 'warn',
67+
'rest-spread-spacing': 'warn',
68+
'sort-imports': [
69+
'warn',
70+
{
71+
ignoreCase: true,
72+
ignoreDeclarationSort: true,
73+
},
74+
],
75+
'template-curly-spacing': 'warn',
76+
'yield-star-spacing': 'warn',
77+
'yoda': 'warn',
78+
'vue/html-self-closing': [
79+
'error',
80+
{
81+
html: {
82+
void: 'always',
83+
normal: 'always',
84+
component: 'always',
85+
},
86+
svg: 'always',
87+
math: 'always',
88+
},
89+
],
90+
'vue/eqeqeq': 'error',
91+
},
92+
})

apps/nuxt-docs/app.vue

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
<template>
2-
<div>
2+
<NuxtLayout>
33
<NuxtPage />
4-
</div>
4+
</NuxtLayout>
55
</template>
6+
7+
<script setup lang="ts">
8+
provide(appInfoKey, {
9+
githubUrl: 'https://github.com/bootstrap-vue/bootstrap-vue-next',
10+
discordUrl: 'https://discord.gg/j2Mtcny',
11+
})
12+
</script>
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<template>
2+
<code>
3+
<pre>
4+
<slot />
5+
</pre>
6+
</code>
7+
</template>
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<template>
2+
<!-- TODO implement 'null' options globally -->
3+
<BDropdown :variant="variant" lazy>
4+
<!-- TODO there's no way to adjust these options, say if you wanted to remove the padding -->
5+
<template #button-content>
6+
<component :is="currentIcon" v-if="show" :aria-label="`Toggle theme (${proxy})`" />
7+
</template>
8+
<b-dropdown-item v-for="el in options" :key="el" :active="proxy === el" @click="set(el)">
9+
<component :is="map[el]" /> {{ el }}
10+
</b-dropdown-item>
11+
</BDropdown>
12+
</template>
13+
14+
<script setup lang="ts">
15+
import MoonStarsFill from '~icons/bi/moon-stars-fill'
16+
import SunFill from '~icons/bi/sun-fill'
17+
import CircleHalf from '~icons/bi/circle-half'
18+
19+
const show = ref(false)
20+
21+
onMounted(() => {
22+
show.value = true
23+
})
24+
25+
const dark = useColorMode({
26+
persist: true,
27+
})
28+
29+
const proxy = toRef(dark, 'value')
30+
31+
const map = {
32+
dark: MoonStarsFill,
33+
light: SunFill,
34+
auto: CircleHalf,
35+
}
36+
37+
const options = Object.keys(map) as (keyof typeof map)[]
38+
39+
const currentIcon = computed(() => map[dark.value])
40+
41+
const set = (newValue: keyof typeof map) => (dark.value = newValue)
42+
43+
const variant = null as any
44+
</script>
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<template>
2+
<BLink @click.prevent="open = true">
3+
<slot />
4+
</BLink>
5+
<BModal v-model="open" title="Visit External Link?" lazy cancel-variant="danger">
6+
You are about open a link to <HighlightedText>{{ href }}</HighlightedText
7+
>. Are you sure you want to do this?
8+
<template #ok>
9+
<BButton :ref="rel" variant="success" :href="href" :target="target" @click="open = false"
10+
>Go</BButton
11+
>
12+
</template>
13+
</BModal>
14+
</template>
15+
16+
<script setup lang="ts">
17+
import type {LinkTarget} from 'bootstrap-vue-next'
18+
19+
withDefaults(defineProps<{href: string; target?: LinkTarget; rel?: string}>(), {
20+
target: '_blank',
21+
rel: 'noopener',
22+
})
23+
24+
const open = ref(false)
25+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<template>
2+
<i class="text-info-emphasis">
3+
<slot />
4+
</i>
5+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<template>
2+
<BCard>
3+
<template #header>
4+
<h3>
5+
<span class="text-primary">{{ component }}</span
6+
>: {{ title }}
7+
</h3>
8+
</template>
9+
<BCardSubtitle>
10+
Rationale:
11+
{{ rationale }}
12+
</BCardSubtitle>
13+
<h4>Resolution</h4>
14+
<BCardText>
15+
{{ text }}
16+
</BCardText>
17+
<template #footer>
18+
Difficulty:
19+
<span class="text-decoration-underline" :class="`text-${textColor}`"> {{ difficulty }} </span>
20+
</template>
21+
</BCard>
22+
</template>
23+
24+
<script setup lang="ts">
25+
const props = withDefaults(
26+
defineProps<{
27+
difficulty: 'easy' | 'medium' | 'hard'
28+
rationale: string
29+
component: string
30+
title: string
31+
text: string
32+
}>(),
33+
{text: '', rationale: ''}
34+
)
35+
36+
const textColor = computed(() =>
37+
props.difficulty === 'easy' ? 'success' : props.difficulty === 'medium' ? 'warning' : 'danger'
38+
)
39+
</script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export const useSourceLink = () => {
2+
const appInfo = inject(appInfoKey, null)
3+
4+
const {path} = useRoute()
5+
6+
const component = path.slice(path.lastIndexOf('/') + 1)
7+
8+
const location = 'tree/main/packages/bootstrap-vue-next/src/components'
9+
10+
return computed(() => `${appInfo?.githubUrl}/${location}/${component}`)
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"$schema": "./schema.json",
3+
"name": "@bootstrap-vue-next/accordion",
4+
"version": "Alpha",
5+
"meta": {
6+
"title": "Accordion",
7+
"description": "Build vertically collapsing accordions in combination with <b-collapse> component.",
8+
"components": [
9+
{
10+
"component": "BAccordion",
11+
"props": [
12+
{
13+
"prop": "flush",
14+
"type": "Booleanish",
15+
"description": "remove the default background-color, some borders, and some rounded corners to render accordions edge-to-edge with their parent container"
16+
},
17+
{
18+
"prop": "free",
19+
"type": "Booleanish",
20+
"description": "accordion items stay open when another item is opened"
21+
},
22+
{
23+
"prop": "id",
24+
"type": "string",
25+
"description": "The Id to be injected to accordian items and used to in b-collaspe for state managment"
26+
}
27+
],
28+
"emits": [],
29+
"slots": [
30+
{
31+
"scope": [],
32+
"name": "default",
33+
"description": "Content to place in the Accordion"
34+
}
35+
]
36+
},
37+
{
38+
"component": "BAccordionItem",
39+
"props": [
40+
{
41+
"prop": "id",
42+
"type": "string"
43+
},
44+
{
45+
"prop": "title",
46+
"type": "string"
47+
},
48+
{
49+
"prop": "visible",
50+
"type": "Booleanish"
51+
}
52+
],
53+
"emits": [],
54+
"slots": []
55+
}
56+
]
57+
}
58+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"$schema": "./schema.json",
3+
"name": "@bootstrap-vue-next/alert",
4+
"version": "Alpha",
5+
"meta": {
6+
"title": "Alert",
7+
"description": "Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.",
8+
"components": [
9+
{
10+
"component": "BAlert",
11+
"props": [
12+
{
13+
"prop": "dismissLabel",
14+
"type": "string",
15+
"description": "Value for the 'aria-label' attribute on the dismiss button"
16+
},
17+
{
18+
"prop": "dismissible",
19+
"type": "Booleanish",
20+
"description": "When set, enables the dismiss close button",
21+
"default": "abc"
22+
},
23+
{
24+
"description": "",
25+
"prop": "modelValue",
26+
"type": "boolean | number"
27+
},
28+
{
29+
"prop": "fade",
30+
"type": "Booleanish",
31+
"description": "When set to true, enables the fade animation/transition on the component"
32+
},
33+
{
34+
"prop": "variant",
35+
"type": "ColorVariant",
36+
"description": "Applies one of the Bootstrap theme color variants to the component"
37+
}
38+
],
39+
"slots": [],
40+
"emits": [
41+
{
42+
"args": [],
43+
"emit": "dismissed",
44+
"description": "Alert dismissed either via the dismiss close button or when the dismiss countdown has expired"
45+
},
46+
{
47+
"emit": "close-countdown",
48+
"description": "Content to place in the alert",
49+
"args": [
50+
{
51+
"arg": "closeCountdown",
52+
"description": "Time remaining on the timer",
53+
"type": "number"
54+
}
55+
]
56+
},
57+
{
58+
"emit": "update:modelValue",
59+
"description": "Standard event to update the v-model",
60+
"args": [
61+
{
62+
"arg": "update:modelValue",
63+
"description": "modelValue",
64+
"type": "boolean | number"
65+
}
66+
]
67+
}
68+
]
69+
}
70+
]
71+
}
72+
}

0 commit comments

Comments
 (0)