@naptics/vue-collection 0.2.15 → 0.3.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/.github/workflows/build.yml +26 -0
- package/.github/workflows/deploy-demo.yml +46 -0
- package/.github/workflows/deploy-lib.yml +65 -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 +1 -70
- 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 +50 -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 +68 -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/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
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import NBreadcrub, { type BreadcrumbItem } from '@/lib/components/NBreadcrub'
|
|
2
|
+
import ComponentSection from '@/demo/components/ComponentSection'
|
|
3
|
+
import VariantSection from '@/demo/components/VariantSection'
|
|
4
|
+
import { createView } from '@/lib/utils/component'
|
|
5
|
+
import { ChevronDoubleRightIcon } from '@heroicons/vue/24/solid'
|
|
6
|
+
|
|
7
|
+
export default createView('BreadcrumbView', () => {
|
|
8
|
+
const breadcrumbItems: BreadcrumbItem[] = [
|
|
9
|
+
{ label: 'Overview', route: '/' },
|
|
10
|
+
{ label: 'Customers', route: '/' },
|
|
11
|
+
{ label: 'Customer Details', route: '/' },
|
|
12
|
+
{ label: 'Edit Customer', route: '/' },
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
return () => (
|
|
16
|
+
<ComponentSection
|
|
17
|
+
id="breadcrumbs"
|
|
18
|
+
title="Breadcrumbs"
|
|
19
|
+
subtitle="Breadcrumbs can be used as a navigation in hierarchical views."
|
|
20
|
+
>
|
|
21
|
+
<VariantSection
|
|
22
|
+
title="Default Breadcrumb"
|
|
23
|
+
subtitle="Without any customization the default breadcrumb looks like this."
|
|
24
|
+
>
|
|
25
|
+
<NBreadcrub items={breadcrumbItems} />
|
|
26
|
+
</VariantSection>
|
|
27
|
+
|
|
28
|
+
<VariantSection title="Different Icon" subtitle="Any icon can be chosen as the sepeartor.">
|
|
29
|
+
<NBreadcrub items={breadcrumbItems} iconSize={4} icon={ChevronDoubleRightIcon} />
|
|
30
|
+
</VariantSection>
|
|
31
|
+
|
|
32
|
+
<VariantSection
|
|
33
|
+
title="Customize everthing"
|
|
34
|
+
subtitle="The color and size of the text and icons can be customized. Additionally the items and the sepeators have custom slots."
|
|
35
|
+
>
|
|
36
|
+
<NBreadcrub
|
|
37
|
+
items={breadcrumbItems}
|
|
38
|
+
color="secondary"
|
|
39
|
+
textSize="text-lg"
|
|
40
|
+
seperator={() => (
|
|
41
|
+
<button
|
|
42
|
+
class="text-secondary-500 text-sm font-semibold mx-3"
|
|
43
|
+
onClick={() => window.alert('You found the custom button seperator 🕵🏽♂️')}
|
|
44
|
+
>
|
|
45
|
+
/
|
|
46
|
+
</button>
|
|
47
|
+
)}
|
|
48
|
+
/>
|
|
49
|
+
</VariantSection>
|
|
50
|
+
</ComponentSection>
|
|
51
|
+
)
|
|
52
|
+
})
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createView } from '@/lib/utils/component'
|
|
2
|
+
import NButton from '@/lib/components/NButton'
|
|
3
|
+
import ComponentSection from '@/demo/components/ComponentSection'
|
|
4
|
+
import VariantSection from '@/demo/components/VariantSection'
|
|
5
|
+
import ColorGrid from '@/demo/components/ColorGrid'
|
|
6
|
+
|
|
7
|
+
export default createView('ButtonView', () => {
|
|
8
|
+
return () => (
|
|
9
|
+
<ComponentSection
|
|
10
|
+
title="Buttons"
|
|
11
|
+
subtitle="The basic building block of all our apps. They can have two sizes and different colors."
|
|
12
|
+
id="buttons"
|
|
13
|
+
>
|
|
14
|
+
<VariantSection title="Normal">
|
|
15
|
+
<ColorGrid item={color => <NButton color={color}>Click me</NButton>} />
|
|
16
|
+
</VariantSection>
|
|
17
|
+
|
|
18
|
+
<VariantSection title="Small">
|
|
19
|
+
<ColorGrid
|
|
20
|
+
item={color => (
|
|
21
|
+
<NButton color={color} small>
|
|
22
|
+
Click me
|
|
23
|
+
</NButton>
|
|
24
|
+
)}
|
|
25
|
+
/>
|
|
26
|
+
</VariantSection>
|
|
27
|
+
|
|
28
|
+
<VariantSection title="Disabled">
|
|
29
|
+
<ColorGrid
|
|
30
|
+
item={color => (
|
|
31
|
+
<NButton color={color} disabled>
|
|
32
|
+
Click me
|
|
33
|
+
</NButton>
|
|
34
|
+
)}
|
|
35
|
+
/>
|
|
36
|
+
</VariantSection>
|
|
37
|
+
|
|
38
|
+
<VariantSection title="Loading">
|
|
39
|
+
<ColorGrid
|
|
40
|
+
item={color => (
|
|
41
|
+
<NButton color={color} loading>
|
|
42
|
+
Click me
|
|
43
|
+
</NButton>
|
|
44
|
+
)}
|
|
45
|
+
/>
|
|
46
|
+
</VariantSection>
|
|
47
|
+
</ComponentSection>
|
|
48
|
+
)
|
|
49
|
+
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import NCheckbox from '@/lib/components/NCheckbox'
|
|
2
|
+
import NCheckboxLabel from '@/lib/components/NCheckboxLabel'
|
|
3
|
+
import ColorGrid from '@/demo/components/ColorGrid'
|
|
4
|
+
import ComponentSection from '@/demo/components/ComponentSection'
|
|
5
|
+
import VariantSection from '@/demo/components/VariantSection'
|
|
6
|
+
import { createView } from '@/lib/utils/component'
|
|
7
|
+
import { ref } from 'vue'
|
|
8
|
+
import { vModelForRef } from '@/lib/utils/vModel'
|
|
9
|
+
|
|
10
|
+
export default createView('CheckboxView', () => {
|
|
11
|
+
const refs = Array.from({ length: 6 }, () => ref(true))
|
|
12
|
+
|
|
13
|
+
return () => (
|
|
14
|
+
<ComponentSection
|
|
15
|
+
title="Checkboxes"
|
|
16
|
+
subtitle="Checkboxes come in different colors and can be used on their own or together with labels."
|
|
17
|
+
id="checkboxes"
|
|
18
|
+
>
|
|
19
|
+
<VariantSection title="On their own">
|
|
20
|
+
<ColorGrid item={(color, idx) => <NCheckbox color={color} {...vModelForRef(refs[idx])} />} />
|
|
21
|
+
</VariantSection>
|
|
22
|
+
|
|
23
|
+
<VariantSection title="Disabled">
|
|
24
|
+
<ColorGrid item={(color, idx) => <NCheckbox color={color} {...vModelForRef(refs[idx])} disabled />} />
|
|
25
|
+
</VariantSection>
|
|
26
|
+
|
|
27
|
+
<VariantSection title="With labels" subtitle="Checkboxes can also be toggled by clicking on the texts.">
|
|
28
|
+
<ColorGrid
|
|
29
|
+
colors={2}
|
|
30
|
+
cols={2}
|
|
31
|
+
item={(color, idx) => (
|
|
32
|
+
<NCheckboxLabel
|
|
33
|
+
color={color}
|
|
34
|
+
{...vModelForRef(refs[idx])}
|
|
35
|
+
title="Choose Option"
|
|
36
|
+
description="This option will provide many advantages. For example the checkbox will be very beautifully enlightened."
|
|
37
|
+
/>
|
|
38
|
+
)}
|
|
39
|
+
/>
|
|
40
|
+
</VariantSection>
|
|
41
|
+
|
|
42
|
+
<VariantSection title="Disabled with labels">
|
|
43
|
+
<ColorGrid
|
|
44
|
+
colors={2}
|
|
45
|
+
cols={2}
|
|
46
|
+
item={(color, idx) => (
|
|
47
|
+
<NCheckboxLabel
|
|
48
|
+
color={color}
|
|
49
|
+
{...vModelForRef(refs[idx])}
|
|
50
|
+
title="Choose Option"
|
|
51
|
+
description="This option will provide many advantages."
|
|
52
|
+
disabled
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
/>
|
|
56
|
+
</VariantSection>
|
|
57
|
+
</ComponentSection>
|
|
58
|
+
)
|
|
59
|
+
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import NDropdown, { type DropdownItem } from '@/lib/components/NDropdown'
|
|
2
|
+
import ComponentGrid from '@/demo/components/ComponentGrid'
|
|
3
|
+
import ComponentSection from '@/demo/components/ComponentSection'
|
|
4
|
+
import VariantSection from '@/demo/components/VariantSection'
|
|
5
|
+
import { createView } from '@/lib/utils/component'
|
|
6
|
+
import { ArrowDownOnSquareIcon, ShareIcon } from '@heroicons/vue/24/solid'
|
|
7
|
+
|
|
8
|
+
export default createView('DropdownView', () => {
|
|
9
|
+
const base: DropdownItem[] = [{ label: 'Save File' }, { label: 'Share File' }]
|
|
10
|
+
const multiple: DropdownItem[][] = [base, [{ label: 'Logout', route: '/logout' }, { label: 'Profile' }]]
|
|
11
|
+
const icons: DropdownItem[] = [
|
|
12
|
+
{ label: 'Save File', icon: ArrowDownOnSquareIcon },
|
|
13
|
+
{ label: 'Share File', icon: ShareIcon, route: '/share' },
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
const links: DropdownItem[][] = [
|
|
17
|
+
[{ label: 'Normal Action' }],
|
|
18
|
+
[
|
|
19
|
+
{ label: 'Route', route: '/link' },
|
|
20
|
+
{ label: 'Other Route', route: '/link2' },
|
|
21
|
+
],
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
return () => (
|
|
25
|
+
<ComponentSection
|
|
26
|
+
title="Dropdowns"
|
|
27
|
+
subtitle="Dropdowns can be used to group multiple actions together."
|
|
28
|
+
id="dropdowns"
|
|
29
|
+
>
|
|
30
|
+
<VariantSection
|
|
31
|
+
title="Different Contents"
|
|
32
|
+
subtitle="The content can be selected using the mouse or the arrow keys. The items can either trigger an action or be a router link."
|
|
33
|
+
>
|
|
34
|
+
<ComponentGrid cols={4}>
|
|
35
|
+
<NDropdown title="Basic Dropdown" items={base} />
|
|
36
|
+
<NDropdown title="Multiple Sections" items={multiple} />
|
|
37
|
+
<NDropdown title="Action Icons" items={icons} />
|
|
38
|
+
<NDropdown title="Router Links" items={links} />
|
|
39
|
+
</ComponentGrid>
|
|
40
|
+
</VariantSection>
|
|
41
|
+
|
|
42
|
+
<VariantSection
|
|
43
|
+
title="Customization"
|
|
44
|
+
subtitle="Dropdowns can be disabled and configured to be right aligned. For further customized there is a slot for a custom button."
|
|
45
|
+
>
|
|
46
|
+
<ComponentGrid cols={4}>
|
|
47
|
+
<NDropdown title="Disabled" disabled />
|
|
48
|
+
<NDropdown title="Right Aligned" right items={base} />
|
|
49
|
+
<div class="flex items-center justify-center">
|
|
50
|
+
<NDropdown
|
|
51
|
+
items={base}
|
|
52
|
+
button={HeadlessButton => <HeadlessButton> Custom Button</HeadlessButton>}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</ComponentGrid>
|
|
56
|
+
</VariantSection>
|
|
57
|
+
</ComponentSection>
|
|
58
|
+
)
|
|
59
|
+
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import NDropzone from '@/lib/components/NDropzone'
|
|
2
|
+
import ComponentSection from '@/demo/components/ComponentSection'
|
|
3
|
+
import VariantSection from '@/demo/components/VariantSection'
|
|
4
|
+
import { createView } from '@/lib/utils/component'
|
|
5
|
+
import { ref } from 'vue'
|
|
6
|
+
import { vModelForRef } from '@/lib/utils/vModel'
|
|
7
|
+
|
|
8
|
+
export default createView('DropzoneView', () => {
|
|
9
|
+
const fileRefs = Array.from({ length: 5 }).map(() => ref<File[]>([]))
|
|
10
|
+
|
|
11
|
+
return () => (
|
|
12
|
+
<ComponentSection
|
|
13
|
+
title="Dropzones"
|
|
14
|
+
subtitle="Dropzones are a simple way for the user to provide files to the application."
|
|
15
|
+
id="dropzones"
|
|
16
|
+
>
|
|
17
|
+
<VariantSection title="Basic" subtitle="Files can be added by clicking on the area or by dropping them.">
|
|
18
|
+
<NDropzone {...vModelForRef(fileRefs[0])} maxLengthFileNames={50} />
|
|
19
|
+
</VariantSection>
|
|
20
|
+
|
|
21
|
+
<VariantSection title="Multiple files">
|
|
22
|
+
<NDropzone {...vModelForRef(fileRefs[1])} maxFiles={10} />
|
|
23
|
+
</VariantSection>
|
|
24
|
+
|
|
25
|
+
<VariantSection
|
|
26
|
+
title="File Type and Size"
|
|
27
|
+
subtitle="The allowed file types and their maximum size can be specified."
|
|
28
|
+
>
|
|
29
|
+
<NDropzone
|
|
30
|
+
{...vModelForRef(fileRefs[2])}
|
|
31
|
+
maxFiles={5}
|
|
32
|
+
accept="image/*, .pdf, .zip"
|
|
33
|
+
maxFileSize={5 * 1024 * 1024}
|
|
34
|
+
description="Files of type .pdf or .zip and all image files with a max size of 5 MB are allowed."
|
|
35
|
+
/>
|
|
36
|
+
</VariantSection>
|
|
37
|
+
</ComponentSection>
|
|
38
|
+
)
|
|
39
|
+
})
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import NIconButton from '@/lib/components/NIconButton'
|
|
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
|
+
import {
|
|
8
|
+
CogIcon,
|
|
9
|
+
CreditCardIcon,
|
|
10
|
+
EyeIcon,
|
|
11
|
+
KeyIcon,
|
|
12
|
+
PencilIcon,
|
|
13
|
+
RssIcon,
|
|
14
|
+
ArrowTopRightOnSquareIcon,
|
|
15
|
+
ChevronDoubleRightIcon,
|
|
16
|
+
} from '@heroicons/vue/24/solid'
|
|
17
|
+
|
|
18
|
+
export default createView('IconButtonView', () => {
|
|
19
|
+
const icons = [CogIcon, RssIcon, KeyIcon, CreditCardIcon, PencilIcon, EyeIcon]
|
|
20
|
+
const sizes = [4, 5, 6, 7, 8, 10]
|
|
21
|
+
|
|
22
|
+
return () => (
|
|
23
|
+
<ComponentSection
|
|
24
|
+
title="Icon Buttons"
|
|
25
|
+
subtitle="Icon Buttons are regular buttons which just have an icon and no text."
|
|
26
|
+
id="icon-buttons"
|
|
27
|
+
>
|
|
28
|
+
<VariantSection title="Different Colors">
|
|
29
|
+
<ColorGrid item={(color, index) => <NIconButton icon={icons[index]} color={color} />} />
|
|
30
|
+
</VariantSection>
|
|
31
|
+
|
|
32
|
+
<VariantSection title="Different Sizes">
|
|
33
|
+
<ComponentGrid>
|
|
34
|
+
{sizes.map(size => (
|
|
35
|
+
<div class="flex items-center justify-start">
|
|
36
|
+
<NIconButton icon={ChevronDoubleRightIcon} size={size} />
|
|
37
|
+
</div>
|
|
38
|
+
))}
|
|
39
|
+
</ComponentGrid>
|
|
40
|
+
</VariantSection>
|
|
41
|
+
|
|
42
|
+
<VariantSection title="Router Links" subtitle="The Icon Button can also be used as a regular router link.">
|
|
43
|
+
<ColorGrid item={color => <NIconButton icon={ArrowTopRightOnSquareIcon} route="/" color={color} />} />
|
|
44
|
+
</VariantSection>
|
|
45
|
+
</ComponentSection>
|
|
46
|
+
)
|
|
47
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import NIconCircle from '@/lib/components/NIconCircle'
|
|
2
|
+
import ComponentGrid from '@/demo/components/ComponentGrid'
|
|
3
|
+
import ComponentSection from '@/demo/components/ComponentSection'
|
|
4
|
+
import VariantSection from '@/demo/components/VariantSection'
|
|
5
|
+
import { createView } from '@/lib/utils/component'
|
|
6
|
+
import { FireIcon } from '@heroicons/vue/24/solid'
|
|
7
|
+
|
|
8
|
+
export default createView('IconCircleView', () => {
|
|
9
|
+
return () => (
|
|
10
|
+
<ComponentSection title="Icon Circles" subtitle="Just a regular icon in a circle." id="icon-circles">
|
|
11
|
+
<VariantSection
|
|
12
|
+
title="Unlimited possibilities"
|
|
13
|
+
subtitle="The color, circle size, icon size and the shades of icon and background can be customized."
|
|
14
|
+
>
|
|
15
|
+
<ComponentGrid>
|
|
16
|
+
<div class="flex items-center">
|
|
17
|
+
<NIconCircle icon={FireIcon} />
|
|
18
|
+
</div>
|
|
19
|
+
<div class="flex items-center">
|
|
20
|
+
<NIconCircle icon={FireIcon} color="red" />
|
|
21
|
+
</div>
|
|
22
|
+
<div class="flex items-center">
|
|
23
|
+
<NIconCircle icon={FireIcon} color="red" bgShade={700} iconShade={50} />
|
|
24
|
+
</div>
|
|
25
|
+
<div class="flex items-center">
|
|
26
|
+
<NIconCircle icon={FireIcon} color="red" circleSize={16} iconSize={4} />
|
|
27
|
+
</div>
|
|
28
|
+
<div class="flex items-center">
|
|
29
|
+
<NIconCircle icon={FireIcon} color="red" circleSize={16} iconSize={14} />
|
|
30
|
+
</div>
|
|
31
|
+
<div class="flex items-center">
|
|
32
|
+
<NIconCircle icon={FireIcon} color="red" iconSize={6} />
|
|
33
|
+
</div>
|
|
34
|
+
</ComponentGrid>
|
|
35
|
+
</VariantSection>
|
|
36
|
+
</ComponentSection>
|
|
37
|
+
)
|
|
38
|
+
})
|