bonkers-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +14 -0
- package/.eslintrc.js +70 -0
- package/.github/workflows/deploy-beta.yaml +31 -0
- package/.github/workflows/deploy.yaml +28 -0
- package/.github/workflows/linting.yaml +28 -0
- package/.husky/pre-commit +5 -0
- package/.storybook/main.js +31 -0
- package/.storybook/preview-head.html +3 -0
- package/.storybook/preview.js +13 -0
- package/.stylelintrc +23 -0
- package/LICENCE +21 -0
- package/README.md +34 -0
- package/package.json +77 -0
- package/postcss.config.js +5 -0
- package/src/_colors.json +11 -0
- package/src/_font-sizes.json +3 -0
- package/src/assets/logo.png +0 -0
- package/src/components/ui-button/_typings.ts +11 -0
- package/src/components/ui-button/index.ts +3 -0
- package/src/components/ui-button/ui-button.stories.ts +56 -0
- package/src/components/ui-button/ui-button.test.ts +13 -0
- package/src/components/ui-button/ui-button.vue +28 -0
- package/src/main.css +24 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/stories/Introduction.stories.mdx +129 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/colors/colors.stories.ts +13 -0
- package/src/stories/colors/ui-colors.vue +42 -0
- package/tailwind.config.js +13 -0
- package/tsconfig.json +46 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +15 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# http://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
indent_style = tab
|
|
6
|
+
indent_size = tab
|
|
7
|
+
tab_width = 4
|
|
8
|
+
end_of_line = lf
|
|
9
|
+
charset = utf-8
|
|
10
|
+
trim_trailing_whitespace = true
|
|
11
|
+
insert_final_newline = true
|
|
12
|
+
|
|
13
|
+
[*.md]
|
|
14
|
+
trim_trailing_whitespace = false
|
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"root": true,
|
|
3
|
+
"env": {
|
|
4
|
+
"browser": true,
|
|
5
|
+
"es2021": true,
|
|
6
|
+
"node": true
|
|
7
|
+
},
|
|
8
|
+
"extends": [
|
|
9
|
+
"plugin:vue/vue3-recommended",
|
|
10
|
+
"eslint:recommended",
|
|
11
|
+
"@vue/typescript/recommended",
|
|
12
|
+
],
|
|
13
|
+
"parserOptions": {
|
|
14
|
+
"ecmaVersion": 2021
|
|
15
|
+
},
|
|
16
|
+
"parser": "vue-eslint-parser",
|
|
17
|
+
"plugins": [],
|
|
18
|
+
"overrides": [
|
|
19
|
+
{
|
|
20
|
+
"files": ["*.vue"],
|
|
21
|
+
"rules": {
|
|
22
|
+
"indent": "off"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"rules": {
|
|
27
|
+
"indent": ["error", "tab", { "VariableDeclarator": "first", "MemberExpression": 1, "ObjectExpression": 1 }],
|
|
28
|
+
"vue/html-indent": [
|
|
29
|
+
"error",
|
|
30
|
+
"tab",
|
|
31
|
+
{
|
|
32
|
+
"attribute": 1,
|
|
33
|
+
"baseIndent": 1,
|
|
34
|
+
"closeBracket": 0,
|
|
35
|
+
"alignAttributesVertically": true
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"vue/script-indent": [
|
|
39
|
+
"error",
|
|
40
|
+
"tab",
|
|
41
|
+
{
|
|
42
|
+
"baseIndent": 1,
|
|
43
|
+
"switchCase": 1,
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"eol-last": [
|
|
47
|
+
"error",
|
|
48
|
+
"always"
|
|
49
|
+
],
|
|
50
|
+
"no-console": "warn",
|
|
51
|
+
"no-debugger": "warn",
|
|
52
|
+
"vue/multi-word-component-names": 0,
|
|
53
|
+
"object-curly-spacing": ["error", "always"],
|
|
54
|
+
"quotes": [
|
|
55
|
+
"error",
|
|
56
|
+
"double",
|
|
57
|
+
{
|
|
58
|
+
"avoidEscape": true,
|
|
59
|
+
"allowTemplateLiterals": true
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"no-multiple-empty-lines": [
|
|
63
|
+
"error",
|
|
64
|
+
{
|
|
65
|
+
"max": 1,
|
|
66
|
+
"maxEOF": 0
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
name: Deploy beta
|
|
2
|
+
# site:
|
|
3
|
+
# use_directory_urls: false
|
|
4
|
+
# siteUrl: https://bonkers-ie.github.io/bonkers-ui/
|
|
5
|
+
# site_url: https://bonkers-ie.github.io/bonkers-ui/
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- develop
|
|
10
|
+
jobs:
|
|
11
|
+
lint:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [16.x]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
- uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: ${{ matrix.node-version }}
|
|
21
|
+
- run: yarn install --frozen-lockfile
|
|
22
|
+
- run: yarn lint:script
|
|
23
|
+
- run: yarn lint:style
|
|
24
|
+
- run: yarn test
|
|
25
|
+
- run: yarn build-storybook
|
|
26
|
+
- name: Deploy
|
|
27
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
28
|
+
with:
|
|
29
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
30
|
+
publish_dir: ./storybook-static
|
|
31
|
+
cname: https://bonkers-ie.github.io/bonkers-ui/
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Deploy
|
|
2
|
+
# site:
|
|
3
|
+
# use_directory_urls: false
|
|
4
|
+
# siteUrl: https://bonkers-ie.github.io/bonkers-ui/
|
|
5
|
+
# site_url: https://bonkers-ie.github.io/bonkers-ui/
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches:
|
|
9
|
+
- master
|
|
10
|
+
jobs:
|
|
11
|
+
lint:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [16.x]
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
- uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: ${{ matrix.node-version }}
|
|
21
|
+
- run: yarn install --frozen-lockfile
|
|
22
|
+
- run: yarn lint:script
|
|
23
|
+
- run: yarn lint:style
|
|
24
|
+
- run: yarn test
|
|
25
|
+
- uses: mikeal/merge-release@master
|
|
26
|
+
env:
|
|
27
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Linting
|
|
2
|
+
# site:
|
|
3
|
+
# use_directory_urls: false
|
|
4
|
+
# siteUrl: https://bonkers-ie.github.io/bonkers-ui/
|
|
5
|
+
# site_url: https://bonkers-ie.github.io/bonkers-ui/
|
|
6
|
+
on:
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- develop
|
|
10
|
+
- master
|
|
11
|
+
jobs:
|
|
12
|
+
lint:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
node-version: [16.x]
|
|
17
|
+
env:
|
|
18
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
19
|
+
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v3
|
|
22
|
+
- uses: actions/setup-node@v3
|
|
23
|
+
with:
|
|
24
|
+
node-version: ${{ matrix.node-version }}
|
|
25
|
+
- run: yarn install --frozen-lockfile
|
|
26
|
+
- run: yarn lint:script
|
|
27
|
+
- run: yarn lint:style
|
|
28
|
+
- run: yarn test
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const {mergeConfig} = require('vite');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
"stories": [
|
|
5
|
+
"../src/**/*.stories.mdx",
|
|
6
|
+
"../src/**/*.stories.@(js|jsx|ts|tsx)"
|
|
7
|
+
],
|
|
8
|
+
"addons": [
|
|
9
|
+
"@storybook/addon-links",
|
|
10
|
+
"@storybook/addon-essentials",
|
|
11
|
+
{
|
|
12
|
+
name: "@storybook/addon-postcss",
|
|
13
|
+
options: {
|
|
14
|
+
postcssLoaderOptions: {
|
|
15
|
+
implementation: require("postcss")
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
'storybook-tailwind-dark-mode',
|
|
20
|
+
],
|
|
21
|
+
"framework": "@storybook/vue3",
|
|
22
|
+
"core": {
|
|
23
|
+
"builder": "@storybook/builder-vite"
|
|
24
|
+
},
|
|
25
|
+
async viteFinal(config, {configType}) {
|
|
26
|
+
// return the customized config
|
|
27
|
+
return mergeConfig(config, {
|
|
28
|
+
base: "https://bonkers-ie.github.io/bonkers-ui/",
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
}
|
package/.stylelintrc
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": [
|
|
3
|
+
"stylelint-config-recommended",
|
|
4
|
+
"stylelint-config-standard",
|
|
5
|
+
"stylelint-config-recommended-vue"
|
|
6
|
+
],
|
|
7
|
+
"rules": {
|
|
8
|
+
"at-rule-no-unknown": [
|
|
9
|
+
true,
|
|
10
|
+
{
|
|
11
|
+
"ignoreAtRules": [
|
|
12
|
+
"extends",
|
|
13
|
+
"tailwind"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"indentation": [
|
|
18
|
+
"tab", {
|
|
19
|
+
"baseIndentLevel": 1
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
package/LICENCE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 bonkers.ie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Vue 3 + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
|
|
4
|
+
|
|
5
|
+
## Recommended IDE Setup
|
|
6
|
+
- [webstorm](https://www.jetbrains.com/webstorm/)
|
|
7
|
+
- [VS Code](https://code.visualstudio.com/)
|
|
8
|
+
- [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)
|
|
9
|
+
- [editorconfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
|
|
10
|
+
|
|
11
|
+
## Setup project
|
|
12
|
+
- `yarn i` to install all dependencies
|
|
13
|
+
- `yarn storybook` just run
|
|
14
|
+
- open [http://localhost:6006/](http://localhost:6006/)
|
|
15
|
+
|
|
16
|
+
## Flow to develop
|
|
17
|
+
- We use only develop to create branch from
|
|
18
|
+
- First pull all changes and create branch
|
|
19
|
+
- Preferred naming of branches
|
|
20
|
+
- `feature/[feature-name]`
|
|
21
|
+
- `hotfix/[fix-name]`
|
|
22
|
+
- Preferred commit message
|
|
23
|
+
- `update([file[s]-name]): [message]` for example - `update(main.css, header.vue): change header to .header`
|
|
24
|
+
- `fix([file[s]-name]): [message]`
|
|
25
|
+
- `add([file[s]-name]): [message]`
|
|
26
|
+
- After you ready to push just `merge`(not `rebase`) develop to current branch
|
|
27
|
+
- Fix merge conflicts if you have
|
|
28
|
+
- Next create pull request to develop (you can do squash when merging)
|
|
29
|
+
- After pull request is merged to develop you can see it in staging [-----]()
|
|
30
|
+
- Only after test staging you can create merge request from `develop` to `master`
|
|
31
|
+
- After merge to master patch version will up x.x.^x and you can use this version in package
|
|
32
|
+
|
|
33
|
+
## Flow to deploy github
|
|
34
|
+
- To deploy github-pages use `yarn build-storybook` + `yarn deploy`
|
package/package.json
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "bonkers-ui",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"storybook": "start-storybook -p 6006",
|
|
6
|
+
"build-storybook": "build-storybook",
|
|
7
|
+
"lint:script": "eslint --ext .ts,vue,js --ignore-path .gitignore .",
|
|
8
|
+
"lint:style": "stylelint ./src/**/*.{css,scss,vue}",
|
|
9
|
+
"lint:markup": "vue-tsc --noEmit",
|
|
10
|
+
"test": "jest",
|
|
11
|
+
"deploy": "gh-pages -d storybook-static",
|
|
12
|
+
"typecheck": "tsc --noEmit",
|
|
13
|
+
"i": "yarn install --frozen-lockfile"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"vue": "^3.2.37"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@storybook/addon-actions": "^6.5.9",
|
|
20
|
+
"@storybook/addon-essentials": "^6.5.9",
|
|
21
|
+
"@storybook/addon-links": "^6.5.9",
|
|
22
|
+
"@storybook/addon-postcss": "^2.0.0",
|
|
23
|
+
"@storybook/builder-vite": "^0.1.36",
|
|
24
|
+
"@storybook/vue3": "^6.5.9",
|
|
25
|
+
"@types/jest": "^28.1.3",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
|
27
|
+
"@typescript-eslint/parser": "^5.29.0",
|
|
28
|
+
"@vitejs/plugin-vue": "^2.3.3",
|
|
29
|
+
"@vue/eslint-config-typescript": "^11.0.0",
|
|
30
|
+
"@vue/test-utils": "^2.0.0",
|
|
31
|
+
"@vue/vue3-jest": "^27.0.0",
|
|
32
|
+
"babel-jest": "27",
|
|
33
|
+
"eslint": "^8.18.0",
|
|
34
|
+
"eslint-plugin-vue": "^9.1.1",
|
|
35
|
+
"gh-pages": "^4.0.0",
|
|
36
|
+
"husky": "^8.0.1",
|
|
37
|
+
"jest": "27.3.1",
|
|
38
|
+
"lint-staged": "^13.0.2",
|
|
39
|
+
"postcss": "^8.4.14",
|
|
40
|
+
"postcss-html": "^1.4.1",
|
|
41
|
+
"storybook-tailwind-dark-mode": "^1.0.12",
|
|
42
|
+
"stylelint": "^14.9.1",
|
|
43
|
+
"stylelint-config-recommended": "^8.0.0",
|
|
44
|
+
"stylelint-config-recommended-vue": "^1.4.0",
|
|
45
|
+
"stylelint-config-standard": "^26.0.0",
|
|
46
|
+
"tailwindcss": "^3.1.4",
|
|
47
|
+
"ts-jest": "^27.0.7",
|
|
48
|
+
"typescript": "^4.7.4",
|
|
49
|
+
"vite": "^2.9.12",
|
|
50
|
+
"vue-eslint-parser": "^9.0.3",
|
|
51
|
+
"vue-loader": "^17.0.0",
|
|
52
|
+
"vue-tsc": "^0.38.1"
|
|
53
|
+
},
|
|
54
|
+
"jest": {
|
|
55
|
+
"preset": "ts-jest",
|
|
56
|
+
"moduleFileExtensions": [
|
|
57
|
+
"vue",
|
|
58
|
+
"js",
|
|
59
|
+
"jsx",
|
|
60
|
+
"ts"
|
|
61
|
+
],
|
|
62
|
+
"testEnvironment": "jsdom",
|
|
63
|
+
"moduleNameMapper": {
|
|
64
|
+
"^@/(.*)$": "<rootDir>/src/$1"
|
|
65
|
+
},
|
|
66
|
+
"transform": {
|
|
67
|
+
".*\\.(js)$": "babel-jest",
|
|
68
|
+
"^.+\\.tsx?$": "ts-jest",
|
|
69
|
+
".*\\.(vue)$": "@vue/vue3-jest"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"lint-staged": {
|
|
73
|
+
"*.{ts,vue}": "eslint --fix && typecheck && test",
|
|
74
|
+
"*.{css,scss,vue,ts}": "stylelint --fix"
|
|
75
|
+
},
|
|
76
|
+
"license": "MIT"
|
|
77
|
+
}
|
package/src/_colors.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"white": "var(--color-white)",
|
|
3
|
+
"black": "var(--color-black)",
|
|
4
|
+
"primary": "var(--color-primary)",
|
|
5
|
+
"secondary": "var(--color-secondary)",
|
|
6
|
+
"warning": "var(--color-warning)",
|
|
7
|
+
"error": "var(--color-error)",
|
|
8
|
+
"transparent": "var(--color-transparent)",
|
|
9
|
+
"current": "var(--color-current)"
|
|
10
|
+
}
|
|
11
|
+
|
|
Binary file
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import UiButton from "./ui-button.vue";
|
|
2
|
+
import { EButtonSizes, EButtonTypes } from "./_typings";
|
|
3
|
+
import { Story } from "@storybook/vue3"
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/ui-button",
|
|
7
|
+
component: UiButton,
|
|
8
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
9
|
+
argTypes: {
|
|
10
|
+
classes: {
|
|
11
|
+
control: { type: "select" },
|
|
12
|
+
options: ["small", "medium", "large"],
|
|
13
|
+
description: "The button size",
|
|
14
|
+
},
|
|
15
|
+
kind: {
|
|
16
|
+
control: { type: "select" },
|
|
17
|
+
options: Object.values(EButtonTypes),
|
|
18
|
+
description: "The button kinds",
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
control: { type: "select" },
|
|
22
|
+
options: Object.values(EButtonSizes),
|
|
23
|
+
description: "The button sizes",
|
|
24
|
+
},
|
|
25
|
+
slot: {
|
|
26
|
+
control: { type: "text" },
|
|
27
|
+
description: "The slot text or component",
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
args:{
|
|
31
|
+
slot: "default text",
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type MyComponentProps = InstanceType<typeof UiButton>["$props"];
|
|
36
|
+
|
|
37
|
+
const Template: Story<MyComponentProps> = (args) => ({
|
|
38
|
+
// Components used in your story `template` are defined in the `components` object
|
|
39
|
+
components: { UiButton },
|
|
40
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
41
|
+
setup() {
|
|
42
|
+
return { args };
|
|
43
|
+
},
|
|
44
|
+
// And then the `args` are bound to your component with `v-bind="args"`
|
|
45
|
+
template: `<ui-button v-bind="args">${args.slot}</ui-button>`,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const Primary = Template.bind({});
|
|
49
|
+
// More on args: https://storybook.js.org/docs/vue/writing-stories/args
|
|
50
|
+
|
|
51
|
+
Primary.args = {
|
|
52
|
+
...Primary,
|
|
53
|
+
classes: "medium",
|
|
54
|
+
kind: EButtonTypes.PRIMARY,
|
|
55
|
+
size: EButtonSizes.MEDIUM
|
|
56
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { mount } from "@vue/test-utils"
|
|
2
|
+
import UiButton from "./ui-button.vue";
|
|
3
|
+
|
|
4
|
+
describe("VButton.test.ts", () => {
|
|
5
|
+
it("renders props.msg when passed", () => {
|
|
6
|
+
const classes = "message";
|
|
7
|
+
const wrapper = mount(UiButton, {
|
|
8
|
+
props: { classes }
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
expect(wrapper.classes()).toContain(classes);
|
|
12
|
+
})
|
|
13
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
class="text-base text-white rounded-md"
|
|
4
|
+
:class="[
|
|
5
|
+
(!kind || kind === EButtonTypes.PRIMARY) && 'bg-primary',
|
|
6
|
+
kind === EButtonTypes.SECONDARY && 'bg-secondary',
|
|
7
|
+
kind === EButtonTypes.WARNING && 'bg-warning',
|
|
8
|
+
kind === EButtonTypes.ERROR && 'bg-error',
|
|
9
|
+
(!size || size === EButtonSizes.MEDIUM) && 'py-2.5 px-5',
|
|
10
|
+
size === EButtonSizes.LARGE && 'py-2.5 px-6',
|
|
11
|
+
classes
|
|
12
|
+
]"
|
|
13
|
+
>
|
|
14
|
+
{{ kind }}
|
|
15
|
+
<slot />
|
|
16
|
+
</button>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import { EButtonSizes, EButtonTypes } from "./_typings";
|
|
21
|
+
|
|
22
|
+
type TProps = {
|
|
23
|
+
classes?: string;
|
|
24
|
+
kind?: EButtonTypes;
|
|
25
|
+
size?: EButtonSizes
|
|
26
|
+
}
|
|
27
|
+
defineProps<TProps>();
|
|
28
|
+
</script>
|
package/src/main.css
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
5
|
+
@layer base {
|
|
6
|
+
:root {
|
|
7
|
+
--color-white: white;
|
|
8
|
+
--color-black: black;
|
|
9
|
+
--color-current: currentcolor;
|
|
10
|
+
--color-transparent: transparent;
|
|
11
|
+
--color-error: #e05f5f;
|
|
12
|
+
--color-primary: #75c46a;
|
|
13
|
+
--color-secondary: #313449;
|
|
14
|
+
--color-warning: #f09664;
|
|
15
|
+
|
|
16
|
+
/* text */
|
|
17
|
+
--base-font-size: 1rem;
|
|
18
|
+
--base-line-height: 1.6;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
body * {
|
|
23
|
+
line-height: var(--base-line-height);
|
|
24
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
|
2
|
+
import Code from './assets/code-brackets.svg';
|
|
3
|
+
|
|
4
|
+
<Meta title="Example/Introduction" />
|
|
5
|
+
|
|
6
|
+
<style>{`
|
|
7
|
+
.subheading {
|
|
8
|
+
--mediumdark: '#999999';
|
|
9
|
+
font-weight: 900;
|
|
10
|
+
font-size: 13px;
|
|
11
|
+
color: #999;
|
|
12
|
+
letter-spacing: 6px;
|
|
13
|
+
line-height: 24px;
|
|
14
|
+
text-transform: uppercase;
|
|
15
|
+
margin-bottom: 12px;
|
|
16
|
+
margin-top: 40px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.link-list {
|
|
20
|
+
display: grid;
|
|
21
|
+
grid-template-columns: 1fr;
|
|
22
|
+
grid-template-rows: 1fr 1fr;
|
|
23
|
+
row-gap: 10px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@media (min-width: 620px) {
|
|
27
|
+
.link-list {
|
|
28
|
+
row-gap: 20px;
|
|
29
|
+
column-gap: 20px;
|
|
30
|
+
grid-template-columns: 1fr 1fr;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@media all and (-ms-high-contrast:none) {
|
|
35
|
+
.link-list {
|
|
36
|
+
display: -ms-grid;
|
|
37
|
+
-ms-grid-columns: 1fr 1fr;
|
|
38
|
+
-ms-grid-rows: 1fr 1fr;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.link-item {
|
|
43
|
+
display: block;
|
|
44
|
+
padding: 20px 30px 20px 15px;
|
|
45
|
+
border: 1px solid #00000010;
|
|
46
|
+
border-radius: 5px;
|
|
47
|
+
transition: background 150ms ease-out, border 150ms ease-out, transform 150ms ease-out;
|
|
48
|
+
color: #333333;
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: flex-start;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.link-item:hover {
|
|
54
|
+
border-color: #1EA7FD50;
|
|
55
|
+
transform: translate3d(0, -3px, 0);
|
|
56
|
+
box-shadow: rgba(0, 0, 0, 0.08) 0 3px 10px 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.link-item:active {
|
|
60
|
+
border-color: #1EA7FD;
|
|
61
|
+
transform: translate3d(0, 0, 0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.link-item strong {
|
|
65
|
+
font-weight: 700;
|
|
66
|
+
display: block;
|
|
67
|
+
margin-bottom: 2px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.link-item img {
|
|
71
|
+
height: 40px;
|
|
72
|
+
width: 40px;
|
|
73
|
+
margin-right: 15px;
|
|
74
|
+
flex: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.link-item span {
|
|
78
|
+
font-size: 14px;
|
|
79
|
+
line-height: 20px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.tip {
|
|
83
|
+
display: inline-block;
|
|
84
|
+
border-radius: 1em;
|
|
85
|
+
font-size: 11px;
|
|
86
|
+
line-height: 12px;
|
|
87
|
+
font-weight: 700;
|
|
88
|
+
background: #E7FDD8;
|
|
89
|
+
color: #66BF3C;
|
|
90
|
+
padding: 4px 12px;
|
|
91
|
+
margin-right: 10px;
|
|
92
|
+
vertical-align: top;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.tip-wrapper {
|
|
96
|
+
font-size: 13px;
|
|
97
|
+
line-height: 20px;
|
|
98
|
+
margin-top: 40px;
|
|
99
|
+
margin-bottom: 40px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.tip-wrapper code {
|
|
103
|
+
font-size: 12px;
|
|
104
|
+
display: inline-block;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
`}</style>
|
|
109
|
+
|
|
110
|
+
# Welcome to Bonkers.ie UI Storybook
|
|
111
|
+
|
|
112
|
+
Storybook helps you build UI components in isolation from your app's business logic, data, and context.
|
|
113
|
+
That makes it easy to develop hard-to-reach states. Save these UI states as **stories** to revisit during development, testing, or QA.
|
|
114
|
+
|
|
115
|
+
Browse example stories now by navigating to them in the sidebar.
|
|
116
|
+
View their code in the `src/components` directory to learn how they work.
|
|
117
|
+
We recommend building UIs with a [**component-driven**](https://componentdriven.org) process starting with atomic components.
|
|
118
|
+
|
|
119
|
+
<div className="subheading">Configure</div>
|
|
120
|
+
|
|
121
|
+
<div className="tip-wrapper">
|
|
122
|
+
<span className="tip">Tip</span>
|
|
123
|
+
<a href='https://storybook.js.org/docs/vue/essentials/controls#annotation'>#Controls argument types here!</a>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<div className="tip-wrapper">
|
|
127
|
+
<span className="tip">Tip</span>Edit the Markdown in{' '}
|
|
128
|
+
<code>src/stories/Introduction.stories.mdx</code>
|
|
129
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48" version="1.1" viewBox="0 0 48 48"><title>illustration/code-brackets</title><g id="illustration/code-brackets" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><path id="Combined-Shape" fill="#87E6E5" d="M11.4139325,12 C11.7605938,12 12,12.5059743 12,13.3779712 L12,17.4951758 L6.43502246,23.3839989 C5.85499251,23.9978337 5.85499251,25.0021663 6.43502246,25.6160011 L12,31.5048242 L12,35.6220288 C12,36.4939606 11.7605228,37 11.4139325,37 C11.2725831,37 11.1134406,36.9158987 10.9453839,36.7379973 L0.435022463,25.6160011 C-0.145007488,25.0021663 -0.145007488,23.9978337 0.435022463,23.3839989 L10.9453839,12.2620027 C11.1134051,12.0841663 11.2725831,12 11.4139325,12 Z M36.5860675,12 C36.7274169,12 36.8865594,12.0841013 37.0546161,12.2620027 L47.5649775,23.3839989 C48.1450075,23.9978337 48.1450075,25.0021663 47.5649775,25.6160011 L37.0546161,36.7379973 C36.8865949,36.9158337 36.7274169,37 36.5860675,37 C36.2394062,37 36,36.4940257 36,35.6220288 L36,31.5048242 L41.5649775,25.6160011 C42.1450075,25.0021663 42.1450075,23.9978337 41.5649775,23.3839989 L36,17.4951758 L36,13.3779712 C36,12.5060394 36.2394772,12 36.5860675,12 Z"/><rect id="Rectangle-7-Copy-5" width="35.57" height="4" x="5.009" y="22.662" fill="#A0DB77" rx="2" transform="translate(22.793959, 24.662305) rotate(-75.000000) translate(-22.793959, -24.662305)"/></g></svg>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul class="colors grid gap-4">
|
|
3
|
+
<li
|
|
4
|
+
v-for="(value, key, index) in colors"
|
|
5
|
+
:key="key"
|
|
6
|
+
class="grid"
|
|
7
|
+
>
|
|
8
|
+
<span
|
|
9
|
+
ref="colorRefs"
|
|
10
|
+
:class="`h-24 rounded-md`"
|
|
11
|
+
:style="{
|
|
12
|
+
backgroundColor: value
|
|
13
|
+
}"
|
|
14
|
+
/>
|
|
15
|
+
{{ key }}
|
|
16
|
+
<br>
|
|
17
|
+
{{ getBackgroundColor(index) }}
|
|
18
|
+
<br>
|
|
19
|
+
{{ value }}
|
|
20
|
+
</li>
|
|
21
|
+
</ul>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import { ref } from "vue";
|
|
26
|
+
import colors from "../../_colors.json";
|
|
27
|
+
|
|
28
|
+
const colorRefs = ref<Array<Element | null>>([]);
|
|
29
|
+
|
|
30
|
+
const getBackgroundColor = (index: number) => {
|
|
31
|
+
const element = colorRefs.value[index];
|
|
32
|
+
if (element) {
|
|
33
|
+
return window.getComputedStyle(element, null).getPropertyValue("background-color");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<style scoped>
|
|
39
|
+
.colors {
|
|
40
|
+
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
|
|
41
|
+
}
|
|
42
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const colors = require("./src/_colors.json");
|
|
2
|
+
const fontSize = require("./src/_font-sizes.json");
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
darkMode: "class",
|
|
6
|
+
content: ["**/*.{vue, css, js, ts}"],
|
|
7
|
+
theme: {
|
|
8
|
+
colors,
|
|
9
|
+
fontSize,
|
|
10
|
+
extend: {},
|
|
11
|
+
},
|
|
12
|
+
plugins: [],
|
|
13
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"types": [
|
|
4
|
+
"vite/client",
|
|
5
|
+
"jest"
|
|
6
|
+
],
|
|
7
|
+
"target": "esnext",
|
|
8
|
+
"module": "esnext",
|
|
9
|
+
"strict": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"useDefineForClassFields": true,
|
|
12
|
+
"jsx": "preserve",
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"importHelpers": true,
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"esModuleInterop": true,
|
|
18
|
+
"allowSyntheticDefaultImports": true,
|
|
19
|
+
"sourceMap": true,
|
|
20
|
+
"baseUrl": ".",
|
|
21
|
+
"paths": {
|
|
22
|
+
"@/*": [
|
|
23
|
+
"src/*"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"lib": [
|
|
27
|
+
"esnext",
|
|
28
|
+
"dom",
|
|
29
|
+
"dom.iterable",
|
|
30
|
+
"scripthost"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"include": [
|
|
34
|
+
"src/**/*.ts",
|
|
35
|
+
"src/**/*.tsx",
|
|
36
|
+
"src/**/*.vue"
|
|
37
|
+
],
|
|
38
|
+
"exclude": [
|
|
39
|
+
"node_modules"
|
|
40
|
+
],
|
|
41
|
+
"references": [
|
|
42
|
+
{
|
|
43
|
+
"path": "./tsconfig.node.json"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from "vite"
|
|
2
|
+
import vue from "@vitejs/plugin-vue"
|
|
3
|
+
import { resolve } from "path"
|
|
4
|
+
|
|
5
|
+
// https://vitejs.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
resolve: {
|
|
8
|
+
alias: {
|
|
9
|
+
"@": resolve(__dirname, "src")
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
plugins: [vue({
|
|
13
|
+
reactivityTransform: true
|
|
14
|
+
})]
|
|
15
|
+
})
|