@naptics/vue-collection 0.2.15 → 0.3.1
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/.github/workflows/build.yml +26 -0
- package/.github/workflows/deploy-demo.yml +46 -0
- package/.github/workflows/deploy-lib.yml +59 -0
- package/.gitlab-ci.yml +57 -0
- package/.nvmrc +1 -0
- package/.prettierrc +8 -0
- package/.vscode/extensions.json +10 -0
- package/.vscode/launch.json +23 -0
- package/.vscode/settings.json +13 -0
- package/babel.config.json +3 -0
- package/components/NAlert.d.ts +1 -44
- package/components/NBadge.d.ts +1 -133
- package/components/NBreadcrub.d.ts +2 -106
- package/components/NBreadcrub.js +1 -1
- package/components/NButton.d.ts +2 -118
- package/components/NCheckbox.d.ts +1 -32
- package/components/NCheckboxLabel.d.ts +1 -45
- package/components/NCheckboxLabel.js +1 -1
- package/components/NCrudModal.d.ts +7 -251
- package/components/NCrudModal.js +1 -1
- package/components/NDialog.d.ts +1 -110
- package/components/NDialog.js +1 -1
- package/components/NDropdown.d.ts +1 -69
- package/components/NDropdown.js +1 -1
- package/components/NDropzone.d.ts +1 -115
- package/components/NDropzone.js +1 -1
- package/components/NForm.d.ts +1 -23
- package/components/NFormModal.d.ts +7 -151
- package/components/NIconButton.d.ts +3 -159
- package/components/NIconButton.js +1 -1
- package/components/NIconCircle.d.ts +1 -87
- package/components/NInput.d.ts +1 -164
- package/components/NInput.js +1 -1
- package/components/NInputPhone.d.ts +2 -114
- package/components/NInputPhone.js +1 -1
- package/components/NInputSelect.d.ts +2 -187
- package/components/NInputSelect.js +1 -1
- package/components/NInputSuggestion.d.ts +2 -155
- package/components/NInputSuggestion.js +1 -1
- package/components/NLink.d.ts +6 -70
- package/components/NLink.js +8 -1
- package/components/NList.d.ts +1 -43
- package/components/NList.js +1 -1
- package/components/NLoadingIndicator.d.ts +1 -49
- package/components/NModal.d.ts +12 -250
- package/components/NModal.js +15 -9
- package/components/NPagination.d.ts +1 -63
- package/components/NSearchbar.d.ts +1 -56
- package/components/NSearchbarList.d.ts +3 -63
- package/components/NSearchbarList.js +1 -1
- package/components/NSelect.d.ts +2 -148
- package/components/NSelect.js +1 -1
- package/components/NSuggestionList.d.ts +3 -126
- package/components/NSuggestionList.js +5 -2
- package/components/NTable.d.ts +1 -85
- package/components/NTable.js +12 -6
- package/components/NTableAction.d.ts +2 -46
- package/components/NTableAction.js +1 -1
- package/components/NTextArea.d.ts +2 -181
- package/components/NTextArea.js +1 -1
- package/components/NTooltip.d.ts +1 -105
- package/components/NTooltip.js +1 -1
- package/components/NValInput.d.ts +7 -182
- package/components/NValInput.js +1 -1
- package/env.d.ts +15 -0
- package/eslint.config.cjs +29 -0
- package/index.html +13 -0
- package/package.json +21 -19
- package/postcss.config.js +6 -0
- package/public/favicon.ico +0 -0
- package/scripts/build-lib.sh +52 -0
- package/scripts/sync-node-types.js +70 -0
- package/src/demo/App.css +9 -0
- package/src/demo/App.tsx +5 -0
- package/src/demo/components/ColorGrid.tsx +26 -0
- package/src/demo/components/ComponentGrid.tsx +26 -0
- package/src/demo/components/ComponentSection.tsx +30 -0
- package/src/demo/components/VariantSection.tsx +18 -0
- package/src/demo/i18n/de.ts +7 -0
- package/src/demo/i18n/en.ts +7 -0
- package/src/demo/i18n/index.ts +24 -0
- package/src/demo/main.ts +13 -0
- package/src/demo/router/index.ts +21 -0
- package/src/demo/views/HomeView.tsx +94 -0
- package/src/demo/views/NavigationView.tsx +43 -0
- package/src/demo/views/presentation/AlertView.tsx +40 -0
- package/src/demo/views/presentation/BadgeView.tsx +61 -0
- package/src/demo/views/presentation/BreadcrumbView.tsx +52 -0
- package/src/demo/views/presentation/ButtonView.tsx +49 -0
- package/src/demo/views/presentation/CheckboxView.tsx +59 -0
- package/src/demo/views/presentation/DropdownView.tsx +59 -0
- package/src/demo/views/presentation/DropzoneView.tsx +39 -0
- package/src/demo/views/presentation/IconButtonView.tsx +47 -0
- package/src/demo/views/presentation/IconCircleView.tsx +38 -0
- package/src/demo/views/presentation/InputView.tsx +179 -0
- package/src/demo/views/presentation/LinkView.tsx +60 -0
- package/src/demo/views/presentation/ListView.tsx +29 -0
- package/src/demo/views/presentation/LoadingIndicatorView.tsx +38 -0
- package/src/demo/views/presentation/ModalView.tsx +210 -0
- package/src/demo/views/presentation/PaginationView.tsx +25 -0
- package/src/demo/views/presentation/SearchbarView.tsx +80 -0
- package/src/demo/views/presentation/TableView.tsx +146 -0
- package/src/demo/views/presentation/TooltipView.tsx +86 -0
- package/src/lib/components/NAlert.tsx +85 -0
- package/src/lib/components/NBadge.tsx +75 -0
- package/src/lib/components/NBreadcrub.tsx +97 -0
- package/src/lib/components/NButton.tsx +80 -0
- package/src/lib/components/NCheckbox.tsx +55 -0
- package/src/lib/components/NCheckboxLabel.tsx +51 -0
- package/src/lib/components/NCrudModal.tsx +133 -0
- package/src/lib/components/NDialog.tsx +182 -0
- package/src/lib/components/NDropdown.tsx +167 -0
- package/src/lib/components/NDropzone.tsx +265 -0
- package/src/lib/components/NForm.tsx +32 -0
- package/src/lib/components/NFormModal.tsx +66 -0
- package/src/lib/components/NIconButton.tsx +92 -0
- package/src/lib/components/NIconCircle.tsx +78 -0
- package/src/lib/components/NInput.css +11 -0
- package/src/lib/components/NInput.tsx +139 -0
- package/src/lib/components/NInputPhone.tsx +53 -0
- package/src/lib/components/NInputSelect.tsx +126 -0
- package/src/lib/components/NInputSuggestion.tsx +80 -0
- package/src/lib/components/NLink.tsx +82 -0
- package/src/lib/components/NList.tsx +67 -0
- package/src/lib/components/NLoadingIndicator.css +46 -0
- package/src/lib/components/NLoadingIndicator.tsx +63 -0
- package/src/lib/components/NModal.tsx +243 -0
- package/src/lib/components/NPagination.css +15 -0
- package/src/lib/components/NPagination.tsx +131 -0
- package/src/lib/components/NSearchbar.tsx +78 -0
- package/src/lib/components/NSearchbarList.tsx +47 -0
- package/src/lib/components/NSelect.tsx +128 -0
- package/src/lib/components/NSuggestionList.tsx +216 -0
- package/src/lib/components/NTable.css +3 -0
- package/src/lib/components/NTable.tsx +247 -0
- package/src/lib/components/NTableAction.tsx +49 -0
- package/src/lib/components/NTextArea.tsx +159 -0
- package/src/lib/components/NTooltip.css +37 -0
- package/src/lib/components/NTooltip.tsx +250 -0
- package/src/lib/components/NValInput.tsx +163 -0
- package/src/lib/components/ValidatedForm.ts +71 -0
- package/src/lib/components/__tests__/NButton.spec.tsx +26 -0
- package/src/lib/components/__tests__/NCheckbox.spec.tsx +39 -0
- package/src/lib/i18n/de/vue-collection.json +58 -0
- package/src/lib/i18n/en/vue-collection.json +58 -0
- package/src/lib/i18n/index.ts +54 -0
- package/src/lib/index.ts +2 -0
- package/src/lib/jsx.d.ts +13 -0
- package/src/lib/utils/__tests__/identifiable.spec.ts +72 -0
- package/src/lib/utils/__tests__/validation.spec.ts +92 -0
- package/src/lib/utils/breakpoints.ts +47 -0
- package/src/lib/utils/component.tsx +131 -0
- package/src/lib/utils/deferred.ts +28 -0
- package/src/lib/utils/identifiable.ts +87 -0
- package/src/lib/utils/stringMaxLength.ts +25 -0
- package/src/lib/utils/tailwind.ts +41 -0
- package/src/lib/utils/utils.ts +90 -0
- package/src/lib/utils/vModel.ts +260 -0
- package/src/lib/utils/validation.ts +189 -0
- package/src/lib/utils/vue.ts +25 -0
- package/tailwind.config.js +38 -0
- package/tsconfig.config.json +9 -0
- package/tsconfig.demo.json +19 -0
- package/tsconfig.json +16 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.vitest.json +8 -0
- package/utils/breakpoints.d.ts +1 -1
- package/utils/component.d.ts +3 -7
- package/utils/component.js +5 -2
- package/utils/identifiable.js +5 -1
- package/vite.config.ts +28 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@naptics/vue-collection",
|
|
3
3
|
"author": "Timo Siegenthaler",
|
|
4
4
|
"description": "Vue Collection is a collection of styled and fully functional Vue components which can easily be integrated into our projects.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.3.1",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "vite",
|
|
13
|
-
"lint": "eslint . --
|
|
13
|
+
"lint": "eslint . --fix --ignore-pattern=.gitignore",
|
|
14
14
|
"type-check": "run-p type-check-lib type-check-demo",
|
|
15
15
|
"type-check-demo": "vue-tsc --noEmit -p tsconfig.demo.json --composite false",
|
|
16
16
|
"type-check-lib": "vue-tsc --noEmit -p tsconfig.lib.json --composite false",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
"build-demo": "run-p type-check-demo build-only-demo",
|
|
19
19
|
"build-lib": "run-p type-check-lib build-only-lib",
|
|
20
20
|
"build-only-demo": "vite build",
|
|
21
|
-
"build-only-lib": "bash ./scripts/build-lib.sh"
|
|
21
|
+
"build-only-lib": "bash ./scripts/build-lib.sh",
|
|
22
|
+
"preinstall": "node ./scripts/sync-node-types.js"
|
|
22
23
|
},
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"@headlessui/vue": "^1.7.10",
|
|
@@ -27,36 +28,37 @@
|
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"@heroicons/vue": "^2.0.16",
|
|
30
|
-
"vue": "^3.
|
|
31
|
+
"vue": "^3.5.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@babel/cli": "^7.21.0",
|
|
34
35
|
"@babel/core": "^7.21.3",
|
|
35
|
-
"@intlify/unplugin-vue-i18n": "^0.
|
|
36
|
-
"@rushstack/eslint-patch": "^1.
|
|
36
|
+
"@intlify/unplugin-vue-i18n": "^11.0.3",
|
|
37
|
+
"@rushstack/eslint-patch": "^1.15.0",
|
|
37
38
|
"@tailwindcss/forms": "^0.5.3",
|
|
38
39
|
"@types/jsdom": "^21.1.0",
|
|
39
|
-
"@types/node": "^
|
|
40
|
-
"@vitejs/plugin-vue": "^
|
|
41
|
-
"@vitejs/plugin-vue-jsx": "^
|
|
40
|
+
"@types/node": "^24",
|
|
41
|
+
"@vitejs/plugin-vue": "^6.0.3",
|
|
42
|
+
"@vitejs/plugin-vue-jsx": "^5.1.2",
|
|
42
43
|
"@vue/babel-plugin-jsx": "^1.1.1",
|
|
43
|
-
"@vue/eslint-config-prettier": "^
|
|
44
|
-
"@vue/eslint-config-typescript": "^
|
|
44
|
+
"@vue/eslint-config-prettier": "^10.2.0",
|
|
45
|
+
"@vue/eslint-config-typescript": "^14.6.0",
|
|
45
46
|
"@vue/test-utils": "^2.3.0",
|
|
46
|
-
"@vue/tsconfig": "^0.1
|
|
47
|
+
"@vue/tsconfig": "^0.5.1",
|
|
47
48
|
"autoprefixer": "^10.4.13",
|
|
48
|
-
"eslint": "^
|
|
49
|
-
"eslint-plugin-vue": "^
|
|
49
|
+
"eslint": "^9.17.0",
|
|
50
|
+
"eslint-plugin-vue": "^10.6.2",
|
|
50
51
|
"jsdom": "^21.1.0",
|
|
51
52
|
"npm-run-all": "^4.1.5",
|
|
52
53
|
"postcss": "^8.4.21",
|
|
53
|
-
"prettier": "^
|
|
54
|
+
"prettier": "^3.0.0",
|
|
54
55
|
"tailwindcss": "^3.2.7",
|
|
55
|
-
"typescript": "
|
|
56
|
-
"vite": "^
|
|
57
|
-
"vitest": "^0.
|
|
56
|
+
"typescript": "~5.5.4",
|
|
57
|
+
"vite": "^7.3.0",
|
|
58
|
+
"vitest": "^4.0.15",
|
|
59
|
+
"vue": "^3.5.25",
|
|
58
60
|
"vue-i18n": "^9.2.2",
|
|
59
61
|
"vue-router": "^4.1.6",
|
|
60
|
-
"vue-tsc": "^
|
|
62
|
+
"vue-tsc": "^3.1.8"
|
|
61
63
|
}
|
|
62
64
|
}
|
|
Binary file
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Exit on error
|
|
3
|
+
set -e
|
|
4
|
+
# Remove lib folder
|
|
5
|
+
echo "Removing ./lib folder."
|
|
6
|
+
rm -rf ./lib
|
|
7
|
+
|
|
8
|
+
# Compile typescript code to javascript code
|
|
9
|
+
echo "Compiling typescript code with tsconfig.lib.json."
|
|
10
|
+
tsc --project tsconfig.lib.json
|
|
11
|
+
|
|
12
|
+
# Move lib two directories up
|
|
13
|
+
echo "Cleaning up ./lib directory."
|
|
14
|
+
if [ ! -d "./lib/src/lib" ]; then
|
|
15
|
+
echo "Error: ./lib/src/lib directory not found after compilation"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
mv ./lib/src/lib/* ./lib
|
|
19
|
+
|
|
20
|
+
# Remove unused files
|
|
21
|
+
rm -rf ./lib/src
|
|
22
|
+
rm -f ./lib/tsconfig.lib.tsbuildinfo
|
|
23
|
+
|
|
24
|
+
# Move all css files from components to lib
|
|
25
|
+
echo "Copying .css files from the components folder."
|
|
26
|
+
if ls ./src/lib/components/*.css 1> /dev/null 2>&1; then
|
|
27
|
+
cp ./src/lib/components/*.css ./lib/components
|
|
28
|
+
else
|
|
29
|
+
echo "Warning: No CSS files found in ./src/lib/components/"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Transpile jsx files to js with babel
|
|
33
|
+
echo "Using Babel to transpile jsx."
|
|
34
|
+
BABEL_OUTPUT=$(./node_modules/.bin/babel lib --out-dir lib 2>&1)
|
|
35
|
+
BABEL_EXIT_CODE=$?
|
|
36
|
+
echo "$BABEL_OUTPUT"
|
|
37
|
+
|
|
38
|
+
# Check if Babel command succeeded
|
|
39
|
+
if [ $BABEL_EXIT_CODE -ne 0 ]; then
|
|
40
|
+
echo "Error: Babel transpilation failed with exit code $BABEL_EXIT_CODE"
|
|
41
|
+
exit $BABEL_EXIT_CODE
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Optionally, check if any .js files were produced
|
|
45
|
+
if ! find ./lib -name "*.js" -type f | grep -q .; then
|
|
46
|
+
echo "Error: No .js files produced by Babel transpilation"
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
find ./lib -name "*.jsx" -type f -delete
|
|
51
|
+
|
|
52
|
+
echo "Build completed successfully!"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
|
|
6
|
+
const rootDir = path.join(__dirname, '..')
|
|
7
|
+
const nvmrcPath = path.join(rootDir, '.nvmrc')
|
|
8
|
+
const packageJsonPath = path.join(rootDir, 'package.json')
|
|
9
|
+
|
|
10
|
+
// Read .nvmrc
|
|
11
|
+
if (!fs.existsSync(nvmrcPath)) {
|
|
12
|
+
console.error('Error: .nvmrc file not found')
|
|
13
|
+
process.exit(1)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const nvmrcContent = fs.readFileSync(nvmrcPath, 'utf8').trim()
|
|
17
|
+
|
|
18
|
+
// Extract major version from .nvmrc
|
|
19
|
+
// Supports formats like: "24", "v24", "24.12.0", "lts/iron", etc.
|
|
20
|
+
let nodeMajorVersion
|
|
21
|
+
|
|
22
|
+
if (nvmrcContent.startsWith('lts/')) {
|
|
23
|
+
// Map LTS names to major versions
|
|
24
|
+
const ltsMap = {
|
|
25
|
+
krypton: '24',
|
|
26
|
+
jod: '22',
|
|
27
|
+
iron: '20',
|
|
28
|
+
hydrogen: '18',
|
|
29
|
+
gallium: '16',
|
|
30
|
+
fermium: '14',
|
|
31
|
+
}
|
|
32
|
+
const ltsName = nvmrcContent.replace('lts/', '').toLowerCase()
|
|
33
|
+
nodeMajorVersion = ltsMap[ltsName]
|
|
34
|
+
if (!nodeMajorVersion) {
|
|
35
|
+
console.error(`Error: Unknown LTS name "${ltsName}"`)
|
|
36
|
+
process.exit(1)
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
// Extract numeric version
|
|
40
|
+
const versionMatch = nvmrcContent.match(/^v?(\d+)/)
|
|
41
|
+
if (!versionMatch) {
|
|
42
|
+
console.error(`Error: Could not extract Node version from .nvmrc: "${nvmrcContent}"`)
|
|
43
|
+
process.exit(1)
|
|
44
|
+
}
|
|
45
|
+
nodeMajorVersion = versionMatch[1]
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
console.log(`Node version from .nvmrc: ${nodeMajorVersion}`)
|
|
49
|
+
|
|
50
|
+
// Read package.json
|
|
51
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
52
|
+
|
|
53
|
+
// Check current @types/node version
|
|
54
|
+
const currentTypesNode = packageJson.devDependencies?.['@types/node']
|
|
55
|
+
const desiredTypesNode = `^${nodeMajorVersion}`
|
|
56
|
+
|
|
57
|
+
if (currentTypesNode === desiredTypesNode) {
|
|
58
|
+
console.log(`✓ @types/node is already set to ${desiredTypesNode}`)
|
|
59
|
+
process.exit(0)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
console.log(`Updating @types/node from ${currentTypesNode} to ${desiredTypesNode}`)
|
|
63
|
+
|
|
64
|
+
// Update package.json
|
|
65
|
+
packageJson.devDependencies['@types/node'] = desiredTypesNode
|
|
66
|
+
|
|
67
|
+
// Write back to package.json
|
|
68
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf8')
|
|
69
|
+
|
|
70
|
+
console.log('✓ package.json updated. Run `npm install` to install the correct @types/node version.')
|
package/src/demo/App.css
ADDED
package/src/demo/App.tsx
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createComponent } from '@/lib/utils/component'
|
|
2
|
+
import { computed, type PropType } from 'vue'
|
|
3
|
+
import ComponentGrid, { componentGridProps } from '@/demo/components/ComponentGrid'
|
|
4
|
+
|
|
5
|
+
export const colorGridProps = {
|
|
6
|
+
...componentGridProps,
|
|
7
|
+
colors: {
|
|
8
|
+
type: Number,
|
|
9
|
+
default: 6,
|
|
10
|
+
},
|
|
11
|
+
item: Function as PropType<(color: string, index: number) => JSX.Element>,
|
|
12
|
+
} as const
|
|
13
|
+
|
|
14
|
+
export default createComponent('ColorGrid', colorGridProps, props => {
|
|
15
|
+
const colors = ['primary', 'secondary', 'green', 'red', 'yellow', 'default']
|
|
16
|
+
|
|
17
|
+
const selectedColors = computed(() => colors.slice(0, props.colors))
|
|
18
|
+
|
|
19
|
+
return () => (
|
|
20
|
+
<ComponentGrid cols={props.cols}>
|
|
21
|
+
{selectedColors.value.map((color, index) => (
|
|
22
|
+
<div class="flex">{props.item?.(color, index)}</div>
|
|
23
|
+
))}
|
|
24
|
+
</ComponentGrid>
|
|
25
|
+
)
|
|
26
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createComponent } from '@/lib/utils/component'
|
|
2
|
+
import { computed, type PropType } from 'vue'
|
|
3
|
+
|
|
4
|
+
export const componentGridProps = {
|
|
5
|
+
cols: {
|
|
6
|
+
type: Number as PropType<2 | 4 | 6 | 8>,
|
|
7
|
+
default: 6,
|
|
8
|
+
},
|
|
9
|
+
} as const
|
|
10
|
+
|
|
11
|
+
export default createComponent('ComponentGrid', componentGridProps, (props, { slots }) => {
|
|
12
|
+
const classes = computed(() => {
|
|
13
|
+
switch (props.cols) {
|
|
14
|
+
case 2:
|
|
15
|
+
return 'grid-cols-1 sm:grid-cols-2'
|
|
16
|
+
case 4:
|
|
17
|
+
return 'grid-cols-2 sm:grid-cols-4'
|
|
18
|
+
case 8:
|
|
19
|
+
return 'grid-cols-4 sm:grid-cols-8'
|
|
20
|
+
default:
|
|
21
|
+
return 'grid-cols-3 sm:grid-cols-6'
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
return () => <div class={`grid gap-4 ${classes.value}`}>{slots.default?.()}</div>
|
|
26
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createComponent } from '@/lib/utils/component'
|
|
2
|
+
import { LinkIcon } from '@heroicons/vue/24/solid'
|
|
3
|
+
import { RouterLink } from 'vue-router'
|
|
4
|
+
|
|
5
|
+
export const componentSectionProps = {
|
|
6
|
+
id: String,
|
|
7
|
+
title: String,
|
|
8
|
+
subtitle: String,
|
|
9
|
+
} as const
|
|
10
|
+
|
|
11
|
+
export default createComponent('ComponentSection', componentSectionProps, (props, { slots }) => {
|
|
12
|
+
return () => (
|
|
13
|
+
<div class="border-b-2 border-default-200" id={props.id}>
|
|
14
|
+
<div>
|
|
15
|
+
<div class="px-8 py-10 max-w-4xl mx-auto">
|
|
16
|
+
<RouterLink to={{ hash: props.id ? `#${props.id}` : undefined }} class="group outline-none">
|
|
17
|
+
<h2 class="font-bold text-4xl mb-2 flex items-center space-x-2 ">
|
|
18
|
+
<span>{props.title}</span>
|
|
19
|
+
<LinkIcon class="h-8 w-8 text-default-900 opacity-30 hidden group-hover:block group-focus-visible:block" />
|
|
20
|
+
</h2>
|
|
21
|
+
</RouterLink>
|
|
22
|
+
<p class="text-default-500 text-xl font-light">{props.subtitle}</p>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="bg-default-50">
|
|
26
|
+
<div class="px-8 pt-10 pb-20 space-y-8 max-w-4xl mx-auto">{slots.default?.()}</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
)
|
|
30
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createComponent } from '@/lib/utils/component'
|
|
2
|
+
|
|
3
|
+
export const variantSectionProps = {
|
|
4
|
+
title: String,
|
|
5
|
+
subtitle: String,
|
|
6
|
+
} as const
|
|
7
|
+
|
|
8
|
+
export default createComponent('VariantSection', variantSectionProps, (props, { slots }) => {
|
|
9
|
+
return () => (
|
|
10
|
+
<div>
|
|
11
|
+
<div class="mb-6">
|
|
12
|
+
<h3 class="text-lg font-medium text-default-700"> {props.title} </h3>
|
|
13
|
+
{props.subtitle && <p class="text-default-500 text-sm"> {props.subtitle} </p>}
|
|
14
|
+
</div>
|
|
15
|
+
<div class="border-2 border-dashed rounded-lg p-8 border-default-200 bg-white">{slots.default?.()}</div>
|
|
16
|
+
</div>
|
|
17
|
+
)
|
|
18
|
+
})
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import en from './en'
|
|
2
|
+
import de from './de'
|
|
3
|
+
import { createI18n } from 'vue-i18n'
|
|
4
|
+
import { registerTranslationProvider } from '@/lib/i18n'
|
|
5
|
+
|
|
6
|
+
export const i18n = createI18n({
|
|
7
|
+
legacy: false,
|
|
8
|
+
locale: 'en',
|
|
9
|
+
messages: {
|
|
10
|
+
en,
|
|
11
|
+
de,
|
|
12
|
+
},
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
registerTranslationProvider({
|
|
16
|
+
trsl(key, params) {
|
|
17
|
+
return i18n.global.t(key, params == null ? {} : params)
|
|
18
|
+
},
|
|
19
|
+
trslc(key, count, params) {
|
|
20
|
+
const newCount = count ?? 0
|
|
21
|
+
const newParams = { n: newCount, ...params }
|
|
22
|
+
return i18n.global.t(key, newParams, { plural: newCount })
|
|
23
|
+
},
|
|
24
|
+
})
|
package/src/demo/main.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createApp } from 'vue'
|
|
2
|
+
import App from './App'
|
|
3
|
+
import router from './router'
|
|
4
|
+
import { addDocumentResizeEventListener } from '@/lib/utils/breakpoints'
|
|
5
|
+
import { i18n } from './i18n'
|
|
6
|
+
|
|
7
|
+
addDocumentResizeEventListener()
|
|
8
|
+
|
|
9
|
+
const app = createApp(App)
|
|
10
|
+
app.use(router)
|
|
11
|
+
app.use(i18n)
|
|
12
|
+
|
|
13
|
+
app.mount('#app')
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
|
2
|
+
|
|
3
|
+
const router = createRouter({
|
|
4
|
+
history: createWebHistory(import.meta.env.BASE_URL),
|
|
5
|
+
scrollBehavior: to => {
|
|
6
|
+
if (to.hash) {
|
|
7
|
+
return {
|
|
8
|
+
el: to.hash,
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
routes: [
|
|
13
|
+
{
|
|
14
|
+
path: '/',
|
|
15
|
+
name: 'home',
|
|
16
|
+
component: () => import('../views/HomeView'),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export default router
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import ModalView from './presentation/ModalView'
|
|
2
|
+
import { createView } from '@/lib/utils/component'
|
|
3
|
+
import AlertView from './presentation/AlertView'
|
|
4
|
+
import BadgeView from './presentation/BadgeView'
|
|
5
|
+
import ButtonView from './presentation/ButtonView'
|
|
6
|
+
import CheckboxView from './presentation/CheckboxView'
|
|
7
|
+
import IconButtonView from './presentation/IconButtonView'
|
|
8
|
+
import DropdownView from './presentation/DropdownView'
|
|
9
|
+
import IconCircleView from './presentation/IconCircleView'
|
|
10
|
+
import InputView from './presentation/InputView'
|
|
11
|
+
import ListView from './presentation/ListView'
|
|
12
|
+
import LoadingIndicatorView from './presentation/LoadingIndicatorView'
|
|
13
|
+
import PaginationView from './presentation/PaginationView'
|
|
14
|
+
import SearchbarView from './presentation/SearchbarView'
|
|
15
|
+
import TableView from './presentation/TableView'
|
|
16
|
+
import NavigationView from './NavigationView'
|
|
17
|
+
import { RouterLink } from 'vue-router'
|
|
18
|
+
import { ChevronDoubleUpIcon } from '@heroicons/vue/24/solid'
|
|
19
|
+
import { ref, Transition } from 'vue'
|
|
20
|
+
import NBadge from '@/lib/components/NBadge'
|
|
21
|
+
import LinkView from './presentation/LinkView'
|
|
22
|
+
import BreadcrumbView from './presentation/BreadcrumbView'
|
|
23
|
+
import TooltipView from './presentation/TooltipView'
|
|
24
|
+
import DropzoneView from './presentation/DropzoneView'
|
|
25
|
+
|
|
26
|
+
export default createView('HomeView', () => {
|
|
27
|
+
const showButton = ref(false)
|
|
28
|
+
window.onscroll = () => {
|
|
29
|
+
const treshhold = 1000
|
|
30
|
+
showButton.value = document.documentElement.scrollTop > treshhold || document.body.scrollTop > treshhold
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return () => (
|
|
34
|
+
<div>
|
|
35
|
+
<div class="bg-gradient-to-r from-primary-500/70 to-white">
|
|
36
|
+
<div
|
|
37
|
+
class="bg-gradient-to-b from-default-300/80 to-default-50 border-b-2 border-default-200 z-50"
|
|
38
|
+
id="overview"
|
|
39
|
+
>
|
|
40
|
+
<div class="px-8 py-20 min-h-screen m-auto text-center max-w-4xl flex items-center justify-center flex-col">
|
|
41
|
+
<h1 class="text-6xl font-semibold mb-8">Vue Collection</h1>
|
|
42
|
+
<p class="text-3xl font-light text-default-500">
|
|
43
|
+
Styled and fully functional components created by naptics.
|
|
44
|
+
</p>
|
|
45
|
+
<NavigationView class="mt-16" />
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="space-y-10">
|
|
51
|
+
<AlertView />
|
|
52
|
+
<ButtonView />
|
|
53
|
+
<IconButtonView />
|
|
54
|
+
<LinkView />
|
|
55
|
+
<IconCircleView />
|
|
56
|
+
<BadgeView />
|
|
57
|
+
<BreadcrumbView />
|
|
58
|
+
<CheckboxView />
|
|
59
|
+
<DropdownView />
|
|
60
|
+
<InputView />
|
|
61
|
+
<SearchbarView />
|
|
62
|
+
<LoadingIndicatorView />
|
|
63
|
+
<ModalView />
|
|
64
|
+
<ListView />
|
|
65
|
+
<TableView />
|
|
66
|
+
<TooltipView />
|
|
67
|
+
<PaginationView />
|
|
68
|
+
<DropzoneView />
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<Transition
|
|
72
|
+
enterActiveClass="transition duration-400"
|
|
73
|
+
enterFromClass="opacity-0"
|
|
74
|
+
enterToClass="opacity-100"
|
|
75
|
+
leaveActiveClass="transition duration-400"
|
|
76
|
+
leaveFromClass="opacity-100"
|
|
77
|
+
leaveToClass="opacity-0"
|
|
78
|
+
>
|
|
79
|
+
{showButton.value && (
|
|
80
|
+
<div class="fixed z-20 bottom-4 right-4">
|
|
81
|
+
<RouterLink to={{ hash: '#overview' }}>
|
|
82
|
+
<NBadge textSize="text-base" allCaps={false}>
|
|
83
|
+
<div class="flex items-center space-x-2">
|
|
84
|
+
<span>Overview</span>
|
|
85
|
+
<ChevronDoubleUpIcon class="h-5 w-5" />
|
|
86
|
+
</div>
|
|
87
|
+
</NBadge>
|
|
88
|
+
</RouterLink>
|
|
89
|
+
</div>
|
|
90
|
+
)}
|
|
91
|
+
</Transition>
|
|
92
|
+
</div>
|
|
93
|
+
)
|
|
94
|
+
})
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import NBadge from '@/lib/components/NBadge'
|
|
2
|
+
import { createView } from '@/lib/utils/component'
|
|
3
|
+
import { RouterLink } from 'vue-router'
|
|
4
|
+
|
|
5
|
+
export default createView('NavigationView', () => {
|
|
6
|
+
const sections = [
|
|
7
|
+
{ hash: 'alerts', label: 'Alerts' },
|
|
8
|
+
{ hash: 'buttons', label: 'Buttons' },
|
|
9
|
+
{ hash: 'icon-buttons', label: 'Icon Buttons' },
|
|
10
|
+
{ hash: 'links', label: 'Links' },
|
|
11
|
+
{ hash: 'icon-circles', label: 'Icon Circles' },
|
|
12
|
+
{ hash: 'badges', label: 'Badges' },
|
|
13
|
+
{ hash: 'breadcrumbs', label: 'Breadcrumbs' },
|
|
14
|
+
{ hash: 'checkboxes', label: 'Checkboxes' },
|
|
15
|
+
{ hash: 'dropdowns', label: 'Dropdowns' },
|
|
16
|
+
{ hash: 'inputs', label: 'Inputs and Forms' },
|
|
17
|
+
{ hash: 'searchbars', label: 'Searchbars' },
|
|
18
|
+
{ hash: 'loading-indicators', label: 'Loading Indicators' },
|
|
19
|
+
{ hash: 'modals', label: 'Modals' },
|
|
20
|
+
{ hash: 'lists', label: 'Lists' },
|
|
21
|
+
{ hash: 'tables', label: 'Tables' },
|
|
22
|
+
{ hash: 'tooltips', label: 'Tooltips' },
|
|
23
|
+
{ hash: 'pagination', label: 'Pagination' },
|
|
24
|
+
{ hash: 'dropzones', label: 'Dropzones' },
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
return () => (
|
|
28
|
+
<div>
|
|
29
|
+
<div class="flex flex-wrap gap-6 justify-center">
|
|
30
|
+
{sections.map(section => (
|
|
31
|
+
<RouterLink
|
|
32
|
+
to={{ hash: `#${section.hash}` }}
|
|
33
|
+
class="outline-none focus-visible:ring-2 focus-visible ring-primary-500 rounded-md"
|
|
34
|
+
>
|
|
35
|
+
<NBadge color="primary" allCaps={false} textSize="text-2xl">
|
|
36
|
+
{section.label}
|
|
37
|
+
</NBadge>
|
|
38
|
+
</RouterLink>
|
|
39
|
+
))}
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { AlertVariant } from '@/lib/components/NAlert'
|
|
2
|
+
import NAlert from '@/lib/components/NAlert'
|
|
3
|
+
import ComponentGrid from '@/demo/components/ComponentGrid'
|
|
4
|
+
import ComponentSection from '@/demo/components/ComponentSection'
|
|
5
|
+
import VariantSection from '@/demo/components/VariantSection'
|
|
6
|
+
import { createView } from '@/lib/utils/component'
|
|
7
|
+
|
|
8
|
+
export default createView('AlertView', () => {
|
|
9
|
+
const variants: AlertVariant[] = ['success', 'info', 'warning', 'error']
|
|
10
|
+
|
|
11
|
+
return () => (
|
|
12
|
+
<ComponentSection
|
|
13
|
+
title="Alerts"
|
|
14
|
+
id="alerts"
|
|
15
|
+
subtitle="Alerts can be used directly in a view or they can appear at a fixed position as a notification."
|
|
16
|
+
>
|
|
17
|
+
<VariantSection title="Normal Alerts">
|
|
18
|
+
<ComponentGrid cols={2}>
|
|
19
|
+
{variants.map(variant => (
|
|
20
|
+
<NAlert variant={variant} text="Hello, this is an important Alert." />
|
|
21
|
+
))}
|
|
22
|
+
</ComponentGrid>
|
|
23
|
+
</VariantSection>
|
|
24
|
+
|
|
25
|
+
<VariantSection title="Hide Dismiss Button">
|
|
26
|
+
<ComponentGrid cols={2}>
|
|
27
|
+
{variants.slice(0, 2).map(variant => (
|
|
28
|
+
<NAlert variant={variant} hideX text="This is undismissable." />
|
|
29
|
+
))}
|
|
30
|
+
</ComponentGrid>
|
|
31
|
+
</VariantSection>
|
|
32
|
+
|
|
33
|
+
<VariantSection title="Loading Alert">
|
|
34
|
+
<ComponentGrid cols={2}>
|
|
35
|
+
<NAlert variant="loading">The file is currently downloading...</NAlert>
|
|
36
|
+
</ComponentGrid>
|
|
37
|
+
</VariantSection>
|
|
38
|
+
</ComponentSection>
|
|
39
|
+
)
|
|
40
|
+
})
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import NBadge from '@/lib/components/NBadge'
|
|
2
|
+
import ColorGrid from '@/demo/components/ColorGrid'
|
|
3
|
+
import ComponentGrid from '@/demo/components/ComponentGrid'
|
|
4
|
+
import ComponentSection from '@/demo/components/ComponentSection'
|
|
5
|
+
import VariantSection from '@/demo/components/VariantSection'
|
|
6
|
+
import { createView } from '@/lib/utils/component'
|
|
7
|
+
|
|
8
|
+
export default createView('BadgeView', () => {
|
|
9
|
+
const textSizes = ['text-xs', 'text-sm', 'text-base', 'text-lg', 'text-xl', 'text-2xl']
|
|
10
|
+
const shades = [100, 200, 400, 600, 800, 900]
|
|
11
|
+
const textShades = [900, 900, 900, 50, 50, 50]
|
|
12
|
+
|
|
13
|
+
return () => (
|
|
14
|
+
<ComponentSection
|
|
15
|
+
title="Badges"
|
|
16
|
+
subtitle="Badges wrap a small text. They come in multiple sizes, colors and shades."
|
|
17
|
+
id="badges"
|
|
18
|
+
>
|
|
19
|
+
<VariantSection title="Default Size">
|
|
20
|
+
<ColorGrid item={color => <NBadge color={color}>naptics</NBadge>} />
|
|
21
|
+
</VariantSection>
|
|
22
|
+
|
|
23
|
+
<VariantSection title="With lowercase">
|
|
24
|
+
<ColorGrid
|
|
25
|
+
item={color => (
|
|
26
|
+
<NBadge color={color} allCaps={false}>
|
|
27
|
+
Hello World
|
|
28
|
+
</NBadge>
|
|
29
|
+
)}
|
|
30
|
+
/>
|
|
31
|
+
</VariantSection>
|
|
32
|
+
|
|
33
|
+
<VariantSection
|
|
34
|
+
title="Different Text Sizes"
|
|
35
|
+
subtitle="All text-sizes from text-xs to text-2xl are available."
|
|
36
|
+
>
|
|
37
|
+
<ComponentGrid>
|
|
38
|
+
{textSizes.map(size => (
|
|
39
|
+
<div class="flex justify-start items-center">
|
|
40
|
+
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
|
|
41
|
+
<NBadge text="Sizes" textSize={size as any} />
|
|
42
|
+
</div>
|
|
43
|
+
))}
|
|
44
|
+
</ComponentGrid>
|
|
45
|
+
</VariantSection>
|
|
46
|
+
|
|
47
|
+
<VariantSection
|
|
48
|
+
title="Different Shades"
|
|
49
|
+
subtitle="The shade of the background and the shade of the text can be adjusted individually."
|
|
50
|
+
>
|
|
51
|
+
<ComponentGrid>
|
|
52
|
+
{shades.map((shade, index) => (
|
|
53
|
+
<div class="flex">
|
|
54
|
+
<NBadge text="Shades" color="secondary" shade={shade} textShade={textShades[index]} />
|
|
55
|
+
</div>
|
|
56
|
+
))}
|
|
57
|
+
</ComponentGrid>
|
|
58
|
+
</VariantSection>
|
|
59
|
+
</ComponentSection>
|
|
60
|
+
)
|
|
61
|
+
})
|