Skip to content

Commit e288edb

Browse files
committed
Merge branch 'dev'
2 parents 1989739 + 899867e commit e288edb

24 files changed

+5579
-2270
lines changed

.eslintrc.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/ci-cd.yml

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,57 @@
11
name: CI/CD Pipeline
22

33
on:
4+
push:
5+
branches:
6+
- master
47
pull_request:
58
branches:
69
- master
710

811
jobs:
9-
build_and_test:
12+
test:
1013
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: "22"
21+
cache: "npm"
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Type check
27+
run: npm run typecheck
28+
29+
- name: Run ESLint
30+
run: npm run lint
31+
32+
- name: Run tests with coverage
33+
run: npm run test:ci
1134

35+
build:
36+
needs: test
37+
runs-on: ubuntu-latest
1238
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@v2
39+
- uses: actions/checkout@v4
1540

1641
- name: Set up Node.js
17-
uses: actions/setup-node@v2
42+
uses: actions/setup-node@v4
1843
with:
19-
node-version: "18"
44+
node-version: "22"
45+
cache: "npm"
2046

2147
- name: Install dependencies
22-
run: npm install --also=peer
48+
run: npm ci
49+
50+
- name: Build package
51+
run: npm run build
2352

24-
- name: Run tests
25-
run: npm run test:unit:once
53+
- name: Upload build artifacts
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: dist
57+
path: dist/

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,23 @@ pnpm-debug.log*
88
lerna-debug.log*
99

1010
node_modules
11+
.DS_Store
1112
dist
1213
dist-ssr
14+
coverage
1315
*.local
1416

17+
/cypress/videos/
18+
/cypress/screenshots/
19+
1520
# Editor directories and files
1621
.vscode/*
1722
!.vscode/extensions.json
1823
.idea
19-
.DS_Store
2024
*.suo
2125
*.ntvs*
2226
*.njsproj
2327
*.sln
2428
*.sw?
29+
30+
*.tsbuildinfo

.prettierrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "https://json.schemastore.org/prettierrc",
3+
"printWidth": 100,
4+
"singleQuote": false
5+
}

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"recommendations": [
33
"Vue.volar",
4-
"Vue.vscode-typescript-vue-plugin",
54
"dbaeumer.vscode-eslint",
65
"esbenp.prettier-vscode"
76
]

README.md

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A highly customizable and accessible toggle component for Vue 3.
88
</p>
99

1010
<p align="center">
11-
<img src="./public/vue-toggles.jpg" alt="Vue Toggles Logo"/>
11+
<img src="https://raw.githubusercontent.com/juliandreas/vue-toggles/master/public/vue-toggles.jpg" alt="Vue Toggles Logo"/>
1212
</p>
1313

1414
## Introduction
@@ -26,7 +26,7 @@ What's left for you, when it comes to accessibility, is labeling the toggle corr
2626
- A `<label for="example-id">Toggle description</label>` followed by the toggle component `<VueToggles id="example-id" />`
2727
- Or an `aria-label`, for example `<VueToggles aria-label="Toggle description" />`. Remember, you still need a visual text description of what the toggle does
2828

29-
The `focus`-style is also left up to you which you shouldn't remove. If you think the default is ugly, style it yourself!
29+
The `focus`-style is also left up to you - which you shouldn't remove. If you think the default is ugly, style it yourself!
3030

3131
## Installation
3232

@@ -43,21 +43,25 @@ import { VueToggles } from "vue-toggles";
4343
### Import types
4444

4545
```javascript
46-
import { type VueTogglesProps } from "vue-toggles";
46+
import type { VueTogglesProps } from "vue-toggles";
47+
```
48+
49+
```javascript
50+
import VueToggles, { type VueTogglesProps } from "vue-toggles";
4751
```
4852

4953
## Usage
5054

5155
The toggle is very easy to use out of the box. The bare minimum for it to work is a `@click`-function and a `:value`-prop.
5256

5357
```html
54-
<VueToggles :value="example" @click="example = !example" />
58+
<VueToggles :value="isChecked" @click="isChecked = !isChecked" />
5559
```
5660

5761
Or if you prefer the `v-model`-syntax:
5862

5963
```html
60-
<VueToggles v-model="example" />
64+
<VueToggles v-model="isChecked" />
6165
```
6266

6367
## Options
@@ -79,22 +83,23 @@ You can also add more props to customize things like color and width/height.
7983

8084
## Properties
8185

82-
| Name | Type | Default | Description |
83-
| ------------------ | ---------------- | --------- | ------------------------------------------------- |
84-
| value | Boolean | `false` | Initial state of the toggle button |
85-
| disabled | Boolean | `false` | Toggle does not react on mouse or keyboard events |
86-
| reverse | Boolean | `false` | Reverse toggle to Right to Left |
87-
| height | [String, Number] | `25` | Height of the toggle in `px` |
88-
| width | [String, Number] | `75` | Width of the toggle in `px` |
89-
| dotColor | String | `#ffffff` | Color of the toggle dot |
90-
| uncheckedBg | String | `#939393` | Background color when the toggle is unchecked |
91-
| checkedBg | String | `#5850ec` | Background color when the toggle is checked |
92-
| uncheckedTextColor | String | `#ffffff` | Text color when the toggle is unchecked |
93-
| checkedTextColor | String | `#ffffff` | Text color when the toggle is checked |
94-
| uncheckedText | String | `""` | Optional text when the toggle is unchecked |
95-
| checkedText | String | `""` | Optional text when the toggle is checked |
96-
| fontSize | String | `12` | Font size in `px` |
97-
| fontWeight | String | `normal` | Font weight |
86+
| Name | Type | Default | Description |
87+
| ------------------ | ------- | --------- | ------------------------------------------------- |
88+
| value | Boolean | `false` | Initial state of the toggle button |
89+
| disabled | Boolean | `false` | Toggle does not react on mouse or keyboard events |
90+
| reverse | Boolean | `false` | Reverse toggle to Right to Left |
91+
| width | Number | `75` | Width of the toggle in `px` |
92+
| height | Number | `25` | Height of the toggle in `px` |
93+
| dotColor | String | `#ffffff` | Color of the toggle dot |
94+
| dotSize | Number | `0` | Dot size in `px` |
95+
| checkedBg | String | `#5850ec` | Background color when the toggle is checked |
96+
| uncheckedBg | String | `#939393` | Background color when the toggle is unchecked |
97+
| checkedTextColor | String | `#ffffff` | Text color when the toggle is checked |
98+
| uncheckedTextColor | String | `#ffffff` | Text color when the toggle is unchecked |
99+
| uncheckedText | String | `""` | Optional text when the toggle is unchecked |
100+
| checkedText | String | `""` | Optional text when the toggle is checked |
101+
| fontSize | Number | `12` | Font size in `px` |
102+
| fontWeight | String | `normal` | Font weight |
98103

99104
## Vue 2 support
100105

src/App.vue renamed to dev/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import { ref } from "vue";
3-
import VueToggles from "./components/VueToggles.vue";
3+
import VueToggles from "../src/components/VueToggles.vue";
44
55
const isChecked = ref(false);
66
</script>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
@@ -8,6 +8,6 @@
88
</head>
99
<body>
1010
<div id="app"></div>
11-
<script type="module" src="/src/main.ts"></script>
11+
<script type="module" src="./main.ts"></script>
1212
</body>
1313
</html>

src/main.ts renamed to dev/main.ts

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)