Skip to content

Commit c872bbc

Browse files
authored
Merge pull request #532 from VividLemon/main
feat: more booleanish additions
2 parents 535fdcc + 99d271f commit c872bbc

File tree

18 files changed

+282
-156
lines changed

18 files changed

+282
-156
lines changed

.github/workflows/npm-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ jobs:
3939
run: pnpm test
4040

4141
- name: Publish
42-
run: pnpm publish --tag develop --filter bootstrap-vue-3
42+
run: pnpm publish --filter bootstrap-vue-3
4343
env:
4444
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
# This workflow is for the release please action. It automates releases when using conventional commit messages
2-
# It also auto publishes releases to npm
2+
# It also auto publishes releases to npm under the @develop tag
33
# For more information see: https://github.com/google-github-actions/release-please-action
44

5-
name: release-please
5+
name: release-dev
66

77
on:
88
push:
9-
paths:
10-
- 'packages/bootstrap-vue-3/**'
11-
- '.github/workflows/release-please.yaml'
129
branches:
13-
- main
10+
- dev
1411

1512
jobs:
1613
release-please:
17-
env:
18-
path: packages/bootstrap-vue-3
1914
runs-on: ${{ matrix.os }}
2015

2116
strategy:
@@ -29,45 +24,46 @@ jobs:
2924
id: release
3025
with:
3126
release-type: node
32-
path: ${{ env.path }}
27+
path: packages/bootstrap-vue-3
3328
package-name: bootstrap-vue-3
3429
bump-minor-pre-major: true
3530
bump-patch-for-minor-pre-major: true
31+
default-branch: dev
3632

3733
# The logic below handles the npm publication:
3834

3935
- name: Clone repository
4036
uses: actions/checkout@v3
4137
# these if statements ensure that a publication only occurs when
4238
# a new release is created:
43-
if: ${{ contains(steps.release.outputs.paths_released, env.path) }}
39+
if: ${{ steps.release.outputs.releases_created }}
4440

4541
- name: Install pnpm
4642
uses: pnpm/[email protected]
47-
if: ${{ contains(steps.release.outputs.paths_released, env.path) }}
43+
if: ${{ steps.release.outputs.releases_created }}
4844

4945
- name: Set node version to 16
5046
uses: actions/setup-node@v2
5147
with:
5248
node-version: 16
5349
cache: 'pnpm'
5450
registry-url: 'https://registry.npmjs.org'
55-
if: ${{ contains(steps.release.outputs.paths_released, env.path) }}
51+
if: ${{ steps.release.outputs.releases_created }}
5652

5753
- name: Install dependencies
5854
run: pnpm install --ignore-scripts
59-
if: ${{ contains(steps.release.outputs.paths_released, env.path) }}
55+
if: ${{ steps.release.outputs.releases_created }}
6056

6157
- name: Build library
6258
run: pnpm run build
63-
if: ${{ contains(steps.release.outputs.paths_released, env.path) }}
59+
if: ${{ steps.release.outputs.releases_created }}
6460

6561
- name: Test library
6662
run: pnpm test
67-
if: ${{ contains(steps.release.outputs.paths_released, env.path) }}
63+
if: ${{ steps.release.outputs.releases_created }}
6864

6965
- name: Publish
7066
run: pnpm publish --tag develop --filter bootstrap-vue-3
7167
env:
7268
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
73-
if: ${{ contains(steps.release.outputs.paths_released, env.path) }}
69+
if: ${{ steps.release.outputs.releases_created }}

.github/workflows/release-main.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This workflow is for the release please action. It automates releases when using conventional commit messages
2+
# It also auto publishes releases to npm under the @latest tag
3+
# For more information see: https://github.com/google-github-actions/release-please-action
4+
5+
name: release-main
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
release-please:
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest]
19+
node-version: [16.x]
20+
21+
steps:
22+
- name: Use release please
23+
uses: google-github-actions/release-please-action@v3
24+
id: release
25+
with:
26+
release-type: node
27+
path: packages/bootstrap-vue-3
28+
package-name: bootstrap-vue-3
29+
bump-minor-pre-major: true
30+
bump-patch-for-minor-pre-major: true
31+
default-branch: main
32+
33+
# The logic below handles the npm publication:
34+
35+
- name: Clone repository
36+
uses: actions/checkout@v3
37+
# these if statements ensure that a publication only occurs when
38+
# a new release is created:
39+
if: ${{ steps.release.outputs.releases_created }}
40+
41+
- name: Install pnpm
42+
uses: pnpm/[email protected]
43+
if: ${{ steps.release.outputs.releases_created }}
44+
45+
- name: Set node version to 16
46+
uses: actions/setup-node@v2
47+
with:
48+
node-version: 16
49+
cache: 'pnpm'
50+
registry-url: 'https://registry.npmjs.org'
51+
if: ${{ steps.release.outputs.releases_created }}
52+
53+
- name: Install dependencies
54+
run: pnpm install --ignore-scripts
55+
if: ${{ steps.release.outputs.releases_created }}
56+
57+
- name: Build library
58+
run: pnpm run build
59+
if: ${{ steps.release.outputs.releases_created }}
60+
61+
- name: Test library
62+
run: pnpm test
63+
if: ${{ steps.release.outputs.releases_created }}
64+
65+
- name: Publish
66+
run: pnpm publish --tag latest --filter bootstrap-vue-3
67+
env:
68+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
69+
if: ${{ steps.release.outputs.releases_created }}

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ As you may suppose, this library is heavily inspired by **BootstrapVue**, as wel
4444

4545
```console
4646
# NPM
47-
npm i --save bootstrap bootstrap-vue-3
47+
npm i --save bootstrap bootstrap-vue-3 @popperjs/core
4848

4949
# Yarn
50-
yarn add bootstrap bootstrap-vue-3
50+
yarn add bootstrap bootstrap-vue-3 @popperjs/core
5151

5252
# PNPM
53-
pnpm add bootstrap bootstrap-vue-3
53+
pnpm add bootstrap bootstrap-vue-3 @popperjs/core
5454
```
5555

5656
# Contribute & support 🙌

apps/docs/docs/getting-started/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,23 @@ To install this library you can use Yarn or NPM:
4848
<CodeGroupItem title="YARN" active>
4949

5050
```bash
51-
yarn add bootstrap bootstrap-vue-3
51+
yarn add bootstrap bootstrap-vue-3 @popperjs/core
5252
```
5353

5454
</CodeGroupItem>
5555

5656
<CodeGroupItem title="NPM">
5757

5858
```bash
59-
npm install bootstrap bootstrap-vue-3
59+
npm install bootstrap bootstrap-vue-3 @popperjs/core
6060
```
6161

6262
</CodeGroupItem>
6363

6464
<CodeGroupItem title="PNPM">
6565

6666
```bash
67-
pnpm add bootstrap bootstrap-vue-3
67+
pnpm add bootstrap bootstrap-vue-3 @popperjs/core
6868
```
6969

7070
</CodeGroupItem>
@@ -98,23 +98,23 @@ In your Nuxt3 application, install `bootstrap-vue-3`
9898
<CodeGroupItem title="YARN" active>
9999

100100
```bash
101-
yarn add bootstrap bootstrap-vue-3
101+
yarn add bootstrap bootstrap-vue-3 @popperjs/core
102102
```
103103

104104
</CodeGroupItem>
105105

106106
<CodeGroupItem title="NPM">
107107

108108
```bash
109-
npm install bootstrap bootstrap-vue-3
109+
npm install bootstrap bootstrap-vue-3 @popperjs/core
110110
```
111111

112112
</CodeGroupItem>
113113

114114
<CodeGroupItem title="PNPM">
115115

116116
```bash
117-
pnpm add bootstrap bootstrap-vue-3
117+
pnpm add bootstrap bootstrap-vue-3 @popperjs/core
118118
```
119119

120120
</CodeGroupItem>

packages/bootstrap-vue-3/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
},
3535
"peerDependencies": {
3636
"bootstrap": "5.x.x",
37+
"@popperjs/core": "^2.x.x",
3738
"vue": "3.x.x"
3839
},
3940
"devDependencies": {
@@ -44,15 +45,15 @@
4445
"@vue/shared": "^3.2.37",
4546
"@vue/test-utils": "^2.0.0-rc.18",
4647
"bootstrap": "5.x.x",
47-
"jsdom": "^19.0.0",
48+
"jsdom": "^20.0.0",
4849
"rollup": "^2.76.0",
4950
"rollup-plugin-visualizer": "5.x.x",
5051
"sass": "1.x.x",
5152
"tsconfig": "workspace:*",
5253
"typescript": "4.x.x",
5354
"vite": "2.x.x",
5455
"vite-plugin-dts": "1.x.x",
55-
"vitest": "^0.10.4",
56+
"vitest": "^0.20.3",
5657
"vue": "3.x.x",
5758
"vue-router": "4.x.x",
5859
"vue-tsc": "^0.37.2"

packages/bootstrap-vue-3/src/components/BAccordion/BAccordion.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ const props = withDefaults(defineProps<BAccordionProps>(), {
2525
})
2626
2727
const computedId = useId(props.id, 'accordion')
28-
const booleanFlush = computed(() => resolveBooleanish(props.flush))
29-
const booleanFree = computed(() => resolveBooleanish(props.free))
28+
29+
const flushBoolean = computed<boolean>(() => resolveBooleanish(props.flush))
30+
const freeBoolean = computed<boolean>(() => resolveBooleanish(props.free))
3031
3132
const classes = computed(() => ({
32-
'accordion-flush': booleanFlush.value,
33+
'accordion-flush': flushBoolean.value,
3334
}))
3435
35-
if (!booleanFree.value) {
36+
if (!freeBoolean.value) {
3637
provide(injectionKey, computedId.value.toString())
3738
}
3839
</script>

packages/bootstrap-vue-3/src/components/BAccordion/BAccordionItem.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
<button
55
v-b-toggle:[computedId]
66
class="accordion-button"
7-
:class="{collapsed: !visible}"
7+
:class="{collapsed: !visibleBoolean}"
88
type="button"
9-
:aria-expanded="visible ? 'true' : 'false'"
9+
:aria-expanded="visibleBoolean ? 'true' : 'false'"
1010
:aria-controls="computedId"
1111
>
1212
<slot name="title">
@@ -17,7 +17,7 @@
1717
<b-collapse
1818
:id="computedId"
1919
class="accordion-collapse"
20-
:visible="booleanVisible"
20+
:visible="visibleBoolean"
2121
:accordion="parent"
2222
:aria-labelledby="`heading${computedId}`"
2323
>
@@ -46,7 +46,7 @@ interface BAccordionItemProps {
4646
4747
const props = withDefaults(defineProps<BAccordionItemProps>(), {visible: false})
4848
49-
const booleanVisible = computed(() => resolveBooleanish(props.visible))
49+
const visibleBoolean = computed<boolean>(() => resolveBooleanish(props.visible))
5050
5151
const computedId = useId(props.id, 'accordion_item')
5252
const parent = inject(injectionKey, '')

packages/bootstrap-vue-3/src/components/BAvatar/BAvatar.vue

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ const props = withDefaults(defineProps<BAvatarProps>(), {
6969
variant: 'secondary',
7070
})
7171
72-
const booleanBadgeLeft = computed(() => resolveBooleanish(props.badgeLeft))
73-
const booleanBadgeTop = computed(() => resolveBooleanish(props.badgeTop))
74-
const booleanButton = computed(() => resolveBooleanish(props.button))
75-
const booleanDisabled = computed(() => resolveBooleanish(props.disabled))
76-
const booleanSquare = computed(() => resolveBooleanish(props.square))
72+
const badgeLeftBoolean = computed<boolean>(() => resolveBooleanish(props.badgeLeft))
73+
const badgeTopBoolean = computed<boolean>(() => resolveBooleanish(props.badgeTop))
74+
const buttonBoolean = computed<boolean>(() => resolveBooleanish(props.button))
75+
const disabledBoolean = computed<boolean>(() => resolveBooleanish(props.disabled))
76+
const squareBoolean = computed<boolean>(() => resolveBooleanish(props.square))
7777
7878
interface BAvatarEmits {
7979
(e: 'click', value: MouseEvent): void
@@ -118,7 +118,7 @@ const computedRounded = computed<string | boolean>(() =>
118118
119119
const attrs = computed(() => ({
120120
'aria-label': props.ariaLabel || null,
121-
'disabled': booleanDisabled.value || null,
121+
'disabled': disabledBoolean.value || null,
122122
}))
123123
124124
const badgeClasses = computed(() => ({
@@ -134,18 +134,18 @@ const badgeTextClasses = computed<string>(() => {
134134
const classes = computed(() => ({
135135
[`b-avatar-${props.size}`]: props.size && SIZES.indexOf(computeSize(props.size)) !== -1,
136136
[`bg-${computedVariant.value}`]: computedVariant.value,
137-
[`badge`]: !booleanButton.value && computedVariant.value && hasDefaultSlot.value,
137+
[`badge`]: !buttonBoolean.value && computedVariant.value && hasDefaultSlot.value,
138138
rounded: computedRounded.value === '' || computedRounded.value === true,
139-
[`rounded-circle`]: !booleanSquare.value && computedRounded.value === 'circle',
140-
[`rounded-0`]: booleanSquare.value || computedRounded.value === '0',
141-
[`rounded-1`]: !booleanSquare.value && computedRounded.value === 'sm',
142-
[`rounded-3`]: !booleanSquare.value && computedRounded.value === 'lg',
143-
[`rounded-top`]: !booleanSquare.value && computedRounded.value === 'top',
144-
[`rounded-bottom`]: !booleanSquare.value && computedRounded.value === 'bottom',
145-
[`rounded-start`]: !booleanSquare.value && computedRounded.value === 'left',
146-
[`rounded-end`]: !booleanSquare.value && computedRounded.value === 'right',
147-
btn: booleanButton.value,
148-
[`btn-${computedVariant.value}`]: booleanButton.value ? computedVariant.value : null,
139+
[`rounded-circle`]: !squareBoolean.value && computedRounded.value === 'circle',
140+
[`rounded-0`]: squareBoolean.value || computedRounded.value === '0',
141+
[`rounded-1`]: !squareBoolean.value && computedRounded.value === 'sm',
142+
[`rounded-3`]: !squareBoolean.value && computedRounded.value === 'lg',
143+
[`rounded-top`]: !squareBoolean.value && computedRounded.value === 'top',
144+
[`rounded-bottom`]: !squareBoolean.value && computedRounded.value === 'bottom',
145+
[`rounded-start`]: !squareBoolean.value && computedRounded.value === 'left',
146+
[`rounded-end`]: !squareBoolean.value && computedRounded.value === 'right',
147+
btn: buttonBoolean.value,
148+
[`btn-${computedVariant.value}`]: buttonBoolean.value ? computedVariant.value : null,
149149
}))
150150
151151
const textClasses = computed<string>(() => {
@@ -161,10 +161,10 @@ const badgeStyle = computed<StyleValue>(() => {
161161
: ''
162162
return {
163163
fontSize: fontSize || '',
164-
top: booleanBadgeTop.value ? offset : '',
165-
bottom: booleanBadgeTop.value ? '' : offset,
166-
left: booleanBadgeLeft.value ? offset : '',
167-
right: booleanBadgeLeft.value ? '' : offset,
164+
top: badgeTopBoolean.value ? offset : '',
165+
bottom: badgeTopBoolean.value ? '' : offset,
166+
left: badgeLeftBoolean.value ? offset : '',
167+
right: badgeLeftBoolean.value ? '' : offset,
168168
}
169169
})
170170
@@ -184,15 +184,15 @@ const marginStyle = computed(() => {
184184
return value ? {marginLeft: value, marginRight: value} : {}
185185
})
186186
187-
const tag = computed<string>(() => (booleanButton.value ? props.buttonType : 'span'))
187+
const tag = computed<string>(() => (buttonBoolean.value ? props.buttonType : 'span'))
188188
const tagStyle = computed(() => ({
189189
...marginStyle.value,
190190
width: computedSize.value,
191191
height: computedSize.value,
192192
}))
193193
194194
const clicked = (e: MouseEvent): void => {
195-
if (!booleanDisabled.value && booleanButton.value) emit('click', e)
195+
if (!disabledBoolean.value && buttonBoolean.value) emit('click', e)
196196
}
197197
const onImgError = (e: Event): void => emit('img-error', e)
198198
</script>

0 commit comments

Comments
 (0)