8000 feat!: remove html props -- use equivalent slots fixes #1930 by VividLemon · Pull Request #2311 · bootstrap-vue-next/bootstrap-vue-next · GitHub
[go: up one dir, main page]

Skip to content

feat!: remove html props -- use equivalent slots fixes #1930 #2311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
10000 File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions apps/docs/src/data/components/card.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,13 @@ export default {
'footerBgVariant',
'footerBorderVariant',
'footerClass',
'footerHtml',
'footerTag',
'footerTextVariant',
'footerVariant',
'header',
'headerBgVariant',
'headerBorderVariant',
'headerClass',
'headerHtml',
'headerTag',
'headerTextVariant',
'headerVariant',
Expand Down Expand Up @@ -163,12 +161,6 @@ export default {
emits: [],
props: {
'': {
html: {
type: 'string',
default: undefined,
description:
'HTML content to place in the card footer, takes precednce over text prop and default slot',
},
text: {
type: 'string',
default: undefined,
Expand Down Expand Up @@ -222,12 +214,6 @@ export default {
emits: [],
props: {
'': {
html: {
type: 'string',
default: undefined,
description:
'HTML content to place in the card header, takes precednce over text prop and default slot',
},
text: {
type: 'string',
default: undefined,
Expand Down
10 changes: 0 additions & 10 deletions apps/docs/src/data/components/carousel.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,6 @@ export default {
default: undefined,
description: 'Text content to place in the caption',
},
captionHtml: {
type: 'string',
default: undefined,
description: 'HTML string content to place in the caption',
},
captionTag: {
type: 'string',
default: 'h3',
Expand Down Expand Up @@ -253,11 +248,6 @@ export default {
default: undefined,
description: 'Text content to place in the text of the slide',
},
textHtml: {
type: 'string',
default: undefined,
description: 'HTML string content to place in the text of the slide',
},
textTag: {
type: 'string',
default: 'p',
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/data/components/form.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default {
'Array of items to render in the component. Note that BFormDatalist only supports Options, not OptionsGroups',
},
}),
['disabledField', 'htmlField', 'id', 'options', 'textField', 'valueField']
['disabledField', 'id', 'options', 'textField', 'valueField']
),
} satisfies Record<keyof BvnComponentProps['BFormDatalist'], PropertyReference>,
},
Expand Down
25 changes: 23 additions & 2 deletions apps/docs/src/data/components/formCheckbox.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
type: 'boolean',
default: false,
description:
"When set, renders the checkbox as part of a button group (it doesn't enclose the checkbox and label with a div). It is not necessary to set this to true if this is part of a RadioGroup as it is handled internally",
"When set, renders the checkbox as part of a button group (it doesn't enclose the checkbox and label with a div). It is not necessary to set this to true if this is part of a CheckboxGroup as it is handled internally",
},
buttonVariant: {
type: 'ButtonVariant | null',
Expand Down Expand Up @@ -170,7 +170,6 @@ export default {
'disabled',
'disabledField',
'form',
'htmlField',
'id',
'name',
'plain',
Expand Down Expand Up @@ -208,6 +207,28 @@ export default {
'Slot to place for checkboxes so that they appear before checks generated from options prop',
scope: [],
},
{
name: 'option',
description:
'Use this slot to have finer control over the content render inside each checkbox button.',
scope: [
{
prop: 'value',
type: 'string | number | undefined',
description: 'The value of the checkbox button',
},
{
prop: 'disabled',
type: 'boolean | undefined',
description: 'Whether the checkbox button is disabled',
},
{
prop: 'text',
type: 'string | undefined',
description: 'The text to display for the checkbox button',
},
],
},
],
},
],
Expand Down
23 changes: 22 additions & 1 deletion apps/docs/src/data/components/formRadio.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export default {
'disabled',
'disabledField',
'form',
'htmlField',
'id',
'name',
'options',
Expand Down Expand Up @@ -165,6 +164,28 @@ export default {
'Slot to place for radio buttons so that they appear before radios generated from options prop',
scope: [],
},
{
name: 'option',
description:
'Use this slot to have finer control over the content render inside each radio button',
scope: [
{
prop: 'value',
type: 'string | number | undefined',
description: 'The value of the radio button',
},
{
prop: 'disabled',
type: 'boolean | undefined',
description: 'Whether the radio button is disabled',
},
{
prop: 'text',
type: 'string | undefined',
description: 'The text to display for the radio button',
},
],
},
],
},
],
Expand Down
3 changes: 1 addition & 2 deletions apps/docs/src/data/components/formSelect.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export default {
'disabled',
'disabledField',
'form',
'htmlField',
'id',
'name',
'options',
Expand Down Expand Up @@ -124,7 +123,7 @@ export default {
buildCommonProps({
options: {type: 'readonly (unknown | Record<string, unknown>)[]'},
}),
['disabledField', 'htmlField', 'options', 'textField', 'valueField']
['disabledField', 'options', 'textField', 'valueField']
),
} satisfies Record<keyof BvnComponentProps['BFormSelectOptionGroup'], PropertyReference>,
},
Expand Down
12 changes: 0 additions & 12 deletions apps/docs/src/data/components/inputGroup.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,11 @@ export default {
default: undefined,
description: 'Text to append to the input group',
},
appendHtml: {
type: 'string',
default: undefined,
description:
"HTML string to append to the input group. Has precedence over 'append' prop",
},
prepend: {
type: 'string',
default: undefined,
description: 'Text to prepend to the input group',
},
prependHtml: {
type: 'string',
default: undefined,
description:
"HTML string to prepend to the input group. Has precedence over 'prepend' prop",
},
...pick(buildCommonProps(buildCommonProps()), ['id', 'size', 'tag']),
} satisfies Record<keyof BvnComponentProps['BInputGroup'], PropertyReference>,
},
Expand Down
4 changes: 0 additions & 4 deletions apps/docs/src/data/components/popover.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ export default {
type: 'Middleware[]',
default: undefined,
},
html: {
type: 'boolean',
default: false,
},
id: {
type: 'string',
default: undefined,
Expand Down
4 changes: 0 additions & 4 deletions apps/docs/src/data/components/progress.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ export default {
type: 'string',
default: undefined,
},
labelHtml: {
type: 'string',
default: undefined,
},
max: {
type: 'Numberish',
default: undefined,
Expand Down
4 changes: 0 additions & 4 deletions apps/docs/src/data/components/table.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,6 @@ export default {
type: 'string',
default: undefined,
},
captionHtml: {
type: 'string',
default: undefined,
},
d 10000 etailsTdClass: {
type: 'ClassValue',
default: undefined,
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/data/components/toast.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default {
default: undefined,
},
progressProps: {
type: "Omit<BProgressBarProps, 'label' | 'labelHtml' | 'max' | 'value'>",
type: "Omit<BProgressBarProps, 'label' | 'max' | 'value'>",
default: undefined,
description:
'The properties to define the progress bar in the toast. No progress will be shown if left undefined',
Expand Down
6 changes: 1 addition & 5 deletions apps/docs/src/docs/components/demo/CarouselCaptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
<!-- #region template -->
<BCarousel controls indicators>
<BCarouselSlide img-src="https://picsum.photos/1024/480/?image=7" caption="First Caption" />
<BCarouselSlide
img-src="https://picsum.photos/1024/480/?image=8"
caption-html="<h1>Second Caption</h1>"
/>
<BCarouselSlide img-src="https://picsum.photos/1024/480/?image=9">
<template #caption> Third Caption </template>
<template #caption> Second Caption </template>
</BCarouselSlide>
</BCarousel>
<!-- #endregion template -->
Expand Down
24 changes: 24 additions & 0 deletions apps/docs/src/docs/components/form-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,30 @@ You can also apply additional classes to the label via the `label-class` prop, s
padding and text alignment utility classes. The `label-class` prop accepts either a string or array
of strings.

### Automatic Inheriting of id

The `BFormGroup` component automatically inherits the id of its child input components, such as BFormInput and BFormTextarea. This functionality ensures that the label element's for attribute is correctly set to match the id of the input component, providing proper association between the label and the input field.

<HighlightCard>
<BFormGroup
label="Enter your name"
>
<BFormInput id="this-id-will-be-automatically-applied-to-the-label" />
</BFormGroup>

<template #html>

```vue-html
<BFormGroup
label="Enter your name"
>
<BFormInput id="this-id-will-be-automatically-applied-to-the-label" />
</BFormGroup>
```

</template>
</HighlightCard>

### Horizontal layout

By default, the label appears above the input element(s), but you may optionally render horizontal
Expand Down
8 changes: 6 additions & 2 deletions apps/docs/src/docs/components/progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ Need more control over the label? Provide your own label by using the default sl
</BProgress>
<h5 class="mt-3">Custom label via property (HTML support)</h5>
<BProgress :max="50">
<BProgressBar :value="33.333333" :label-html="`<del>${33.333333}</del>`" />
<BProgressBar :value="33.333333">
<del>{{33.333333}}</del>
</BProgressBar>
</BProgress>
</BCard>
<template #html>
Expand All @@ -117,7 +119,9 @@ Need more control over the label? Provide your own label by using the default sl

<h5 class="mt-3">Custom label via property (HTML support)</h5>
<BProgress :max="50">
<BProgressBar :value="33.333333" :label-html="`<del>${33.333333}</del>`" />
<BProgressBar :value="33.333333">
<del>{{33.333333}}</del>
</BProgressBar>
</BProgress>
```

Expand Down
1 change: 0 additions & 1 deletion apps/playground/src/components/Comps/TFormCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ const checkboxes = reactive({
{text: 'Apple', value: 'apple'},
{text: 'Pineapple', value: 'pineapple'},
{text: 'Object', value: {foo: 1}},
{html: '<b>Grape</b> (html content)', value: 'grape'},
],
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const checkboxes = reactive({
{text: 'Apple', value: 'apple'},
{text: 'Pineapple', value: 'pineapple'},
{text: 'Object', value: {foo: 1}},
{html: '<b>Grape</b> (html content)', value: 'grape'},
],
})
</script>
1 change: 0 additions & 1 deletion apps/playground/src/components/Comps/TFormSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const formSelectOptions = [
{value: null, text: 'Please select an option'},
{text: 'Item 1', value: 'first'},
{text: 'Item 2', value: 'second'},
{html: '<b>Item</b> 3', value: 'third', disabled: true},
{text: 'Item 4'},
{text: 'Item 5', value: {foo: 'item 5', baz: true}},
{text: 'Item 6', value: {foo: 'item 6', baz: false}},
Expand Down
4 changes: 2 additions & 2 deletions packages/bootstrap-vue-next/src/components/BAlert/BAlert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import BTransition from '../BTransition.vue'
import BCloseButton from '../BButton/BCloseButton.vue'
import BButton from '../BButton/BButton.vue'
import type {BAlertProps} from '../../types/ComponentProps'
import {computed, ref, watchEffect} from 'vue'
import {computed, useTemplateRef, watchEffect} from 'vue'
import {useCountdown} from '../../composables/useCountdown'
import {useDefaults} from '../../composables/useDefaults'
import {isEmptySlot} from '../../utils/dom'
Expand Down Expand Up @@ -63,7 +63,7 @@ const slots = defineSlots<{
default?: (props: Record<string, never>) => any
}>()

const element = ref<HTMLElement | null>(null)
const element = useTemplateRef('element')

const modelValue = defineModel<Exclude<BAlertProps['modelValue'], undefined>>({default: false})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</template>

<script setup lang="ts">
import {computed, ref} from 'vue'
import {computed, useTemplateRef} from 'vue'
import BSpinner from '../BSpinner/BSpinner.vue'
import {useBLinkHelper} from '../../composables/useBLinkHelper'
import BLink from '../BLink/BLink.vue'
Expand Down Expand Up @@ -97,7 +97,7 @@ const emit = defineEmits<{
click: [value: MouseEvent]
}>()

const element = ref<HTMLElement | null>(null)
const element = useTemplateRef<HTMLElement | null>('element')

const pressedValue = defineModel<BButtonProps['pressed']>('pressed', {default: undefined})

Expand Down
Loading
Loading
0