@naptics/vue-collection 0.2.14 → 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 +9 -221
- 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 +9 -127
- 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 +15 -227
- package/components/NModal.js +16 -2
- 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
|
@@ -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
|
+
})
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import NButton from '@/lib/components/NButton'
|
|
2
|
+
import NForm from '@/lib/components/NForm'
|
|
3
|
+
import NInput from '@/lib/components/NInput'
|
|
4
|
+
import NSelect from '@/lib/components/NSelect'
|
|
5
|
+
import NValInput from '@/lib/components/NValInput'
|
|
6
|
+
import { createValidatedForm } from '@/lib/components/ValidatedForm'
|
|
7
|
+
import ComponentGrid from '@/demo/components/ComponentGrid'
|
|
8
|
+
import ComponentSection from '@/demo/components/ComponentSection'
|
|
9
|
+
import VariantSection from '@/demo/components/VariantSection'
|
|
10
|
+
import { email, matches, password, regex, integer, numberRange, length } from '@/lib/utils/validation'
|
|
11
|
+
import { createView } from '@/lib/utils/component'
|
|
12
|
+
import { ref } from 'vue'
|
|
13
|
+
import NInputSelect from '@/lib/components/NInputSelect'
|
|
14
|
+
import NInputSuggestion from '@/lib/components/NInputSuggestion'
|
|
15
|
+
import NInputPhone from '@/lib/components/NInputPhone'
|
|
16
|
+
import { vModelForRef } from '@/lib/utils/vModel'
|
|
17
|
+
import NTextArea from '@/lib/components/NTextArea'
|
|
18
|
+
|
|
19
|
+
export default createView('InputView', () => {
|
|
20
|
+
const suggestions = [
|
|
21
|
+
{ id: '1', label: 'Heidi Klum' },
|
|
22
|
+
{ id: '2', label: 'Frida Kahlo' },
|
|
23
|
+
{ id: '3', label: 'Berta Meier' },
|
|
24
|
+
{ id: '4', label: 'Mike Müller' },
|
|
25
|
+
{ id: '5', label: 'Hans Peter' },
|
|
26
|
+
{ id: '6', label: 'Franz Weber' },
|
|
27
|
+
{ id: '7', label: 'Franziska Weberin' },
|
|
28
|
+
{ id: '8', label: 'Angela Merkel' },
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
const refs = Array.from({ length: 21 }, () => ref(''))
|
|
32
|
+
|
|
33
|
+
function vModel(n: number) {
|
|
34
|
+
return vModelForRef(refs[n])
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const form = createValidatedForm()
|
|
38
|
+
const onSubmit = () => alert('Form was submitted!')
|
|
39
|
+
|
|
40
|
+
const showDynamicInput = ref(true)
|
|
41
|
+
|
|
42
|
+
return () => (
|
|
43
|
+
<ComponentSection
|
|
44
|
+
title="Inputs and Forms"
|
|
45
|
+
subtitle="Handle user input well with these inputs and forms."
|
|
46
|
+
id="inputs"
|
|
47
|
+
>
|
|
48
|
+
<VariantSection
|
|
49
|
+
title="Plain HTML"
|
|
50
|
+
subtitle="Wherever it is possible, the html features are used. The inputs can be selected by specifying the type attribute."
|
|
51
|
+
>
|
|
52
|
+
<NForm>
|
|
53
|
+
<ComponentGrid cols={2}>
|
|
54
|
+
<NInput {...vModel(0)} name="Name" />
|
|
55
|
+
<NInput {...vModel(1)} name="Age" type="number" />
|
|
56
|
+
<NInput {...vModel(2)} name="Password" type="password" />
|
|
57
|
+
<div class="space-y-2">
|
|
58
|
+
<NSelect
|
|
59
|
+
{...vModel(3)}
|
|
60
|
+
name="Country"
|
|
61
|
+
optional
|
|
62
|
+
options={[
|
|
63
|
+
{ id: 'ch', label: 'Switzerland' },
|
|
64
|
+
{ id: 'de', label: 'Germany' },
|
|
65
|
+
{ id: 'au', label: 'Austria' },
|
|
66
|
+
]}
|
|
67
|
+
/>
|
|
68
|
+
<p class="text-xs text-default-500">{`Value of the field: ${vModel(3).value}`}</p>
|
|
69
|
+
</div>
|
|
70
|
+
<div class="space-y-2">
|
|
71
|
+
<NInput {...vModel(4)} name="Date" type="date" />
|
|
72
|
+
<p class="text-xs text-default-500">{`Value of the field: ${vModel(4).value}`}</p>
|
|
73
|
+
</div>
|
|
74
|
+
<div class="space-y-2">
|
|
75
|
+
<NInput {...vModel(5)} name="Time" type="time" />
|
|
76
|
+
<p class="text-xs text-default-500">{`Value of the field: ${vModel(5).value}`}</p>
|
|
77
|
+
</div>
|
|
78
|
+
</ComponentGrid>
|
|
79
|
+
</NForm>
|
|
80
|
+
</VariantSection>
|
|
81
|
+
|
|
82
|
+
<VariantSection
|
|
83
|
+
title="Input Validation"
|
|
84
|
+
subtitle="Inputs can be validated using different rules. Some inputs also implement a custom formatter, like the input for phone numbers."
|
|
85
|
+
>
|
|
86
|
+
<NForm>
|
|
87
|
+
<ComponentGrid cols={2}>
|
|
88
|
+
<NValInput {...vModel(15)} name="First Name" />
|
|
89
|
+
<NValInput {...vModel(16)} name="Last Name" rules={length(2, undefined)} />
|
|
90
|
+
<NValInput {...vModel(6)} name="Age" type="number" rules={[integer, numberRange(0, 120)]} />
|
|
91
|
+
<NValInput {...vModel(7)} name="Email" type="email" rules={email} />
|
|
92
|
+
<NValInput {...vModel(8)} name="Password" type="password" rules={password} />
|
|
93
|
+
<NValInput
|
|
94
|
+
{...vModel(9)}
|
|
95
|
+
name="Repeat Password"
|
|
96
|
+
type="password"
|
|
97
|
+
rules={[matches(refs[8].value)]}
|
|
98
|
+
/>
|
|
99
|
+
<NValInput
|
|
100
|
+
{...vModel(10)}
|
|
101
|
+
name="Regex"
|
|
102
|
+
rules={regex(/^foo.*bar$/)}
|
|
103
|
+
placeholder="Try foo...bar"
|
|
104
|
+
/>
|
|
105
|
+
<div class="space-y-2">
|
|
106
|
+
<NInputPhone {...vModel(11)} name="Mobile" />
|
|
107
|
+
<p class="text-xs text-default-500">{`Value of the field: ${vModel(11).value}`}</p>
|
|
108
|
+
</div>
|
|
109
|
+
</ComponentGrid>
|
|
110
|
+
</NForm>
|
|
111
|
+
</VariantSection>
|
|
112
|
+
|
|
113
|
+
<VariantSection
|
|
114
|
+
title="Text Areas"
|
|
115
|
+
subtitle="If longer text is needed, the text area can be used. It provides most of the feature of a validated input."
|
|
116
|
+
>
|
|
117
|
+
<div class="space-y-4">
|
|
118
|
+
<NTextArea
|
|
119
|
+
{...vModel(17)}
|
|
120
|
+
name="Resizable Text Area"
|
|
121
|
+
placeholder="This text area can be resized with the handle with max 100 characters, which is required to fill out."
|
|
122
|
+
maxLength={100}
|
|
123
|
+
/>
|
|
124
|
+
<NTextArea
|
|
125
|
+
{...vModel(18)}
|
|
126
|
+
name="Larger Text Area"
|
|
127
|
+
placeholder="This is a larger non-resizable optional text area."
|
|
128
|
+
rows={5}
|
|
129
|
+
resizable={false}
|
|
130
|
+
optional
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
</VariantSection>
|
|
134
|
+
|
|
135
|
+
<VariantSection
|
|
136
|
+
title="Suggestion Lists"
|
|
137
|
+
subtitle="The left input just shows filtered suggestions and allows any input. The right input expects the user to pick an item from the list."
|
|
138
|
+
>
|
|
139
|
+
<ComponentGrid cols={2}>
|
|
140
|
+
<div class="space-y-2">
|
|
141
|
+
<NInputSuggestion
|
|
142
|
+
{...vModel(12)}
|
|
143
|
+
suggestions={suggestions.map(sugg => sugg.label)}
|
|
144
|
+
name="Any Person"
|
|
145
|
+
/>
|
|
146
|
+
<p class="text-xs text-default-500">{`Value of the field: ${vModel(12).value}`}</p>
|
|
147
|
+
</div>
|
|
148
|
+
<div class="space-y-2">
|
|
149
|
+
<NInputSelect {...vModel(19)} options={suggestions} name="Choose Person" />
|
|
150
|
+
<p class="text-xs text-default-500">{`Value of the field: ${vModel(19).value}`}</p>
|
|
151
|
+
</div>
|
|
152
|
+
</ComponentGrid>
|
|
153
|
+
</VariantSection>
|
|
154
|
+
|
|
155
|
+
<VariantSection
|
|
156
|
+
title="Forms"
|
|
157
|
+
subtitle="Validated Inputs can be added to forms. When trying to submit the form, all inputs are validated first and only if the validation succeeds, the form is submitted."
|
|
158
|
+
>
|
|
159
|
+
<NForm form={form} onSubmit={onSubmit}>
|
|
160
|
+
<ComponentGrid cols={2}>
|
|
161
|
+
<NValInput name="First Name" form={form} {...vModel(13)} />
|
|
162
|
+
<NValInput name="Last name" form={form} {...vModel(14)} />
|
|
163
|
+
{showDynamicInput.value && <NValInput name="Hello World" form={form} {...vModel(20)} />}
|
|
164
|
+
|
|
165
|
+
<div class="flex space-x-2 items-end">
|
|
166
|
+
<NButton
|
|
167
|
+
color="secondary"
|
|
168
|
+
onClick={() => (showDynamicInput.value = !showDynamicInput.value)}
|
|
169
|
+
>
|
|
170
|
+
Toggle Input
|
|
171
|
+
</NButton>
|
|
172
|
+
<NButton type="submit">Submit Form</NButton>
|
|
173
|
+
</div>
|
|
174
|
+
</ComponentGrid>
|
|
175
|
+
</NForm>
|
|
176
|
+
</VariantSection>
|
|
177
|
+
</ComponentSection>
|
|
178
|
+
)
|
|
179
|
+
})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import NLink from '@/lib/components/NLink'
|
|
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
|
+
|
|
7
|
+
export default createView('LinkView', () => {
|
|
8
|
+
const hi = () => window.alert('hello')
|
|
9
|
+
|
|
10
|
+
return () => (
|
|
11
|
+
<ComponentSection
|
|
12
|
+
id="links"
|
|
13
|
+
title="Links"
|
|
14
|
+
subtitle="Links are styled texts which can be used as links or regular buttons."
|
|
15
|
+
>
|
|
16
|
+
<VariantSection title="Normal Links">
|
|
17
|
+
<ComponentGrid cols={4}>
|
|
18
|
+
<div>
|
|
19
|
+
<NLink text="Privacy Policy" route="/" />
|
|
20
|
+
</div>
|
|
21
|
+
<div>
|
|
22
|
+
<NLink text="Privacy Policy" route="/" shade={200} />
|
|
23
|
+
</div>
|
|
24
|
+
<div>
|
|
25
|
+
<NLink text="Privacy Policy" route="/" color="secondary" shade={200} />
|
|
26
|
+
</div>
|
|
27
|
+
<div>
|
|
28
|
+
<NLink text="Privacy Policy" route="/" color="secondary" />
|
|
29
|
+
</div>
|
|
30
|
+
</ComponentGrid>
|
|
31
|
+
</VariantSection>
|
|
32
|
+
<VariantSection title="Button Links" subtitle="Sometimes it can be useful to style a button as a link.">
|
|
33
|
+
<ComponentGrid cols={4}>
|
|
34
|
+
<div>
|
|
35
|
+
<NLink text="Fake Link" onClick={hi} />
|
|
36
|
+
</div>
|
|
37
|
+
<div>
|
|
38
|
+
<NLink text="Fake Link" onClick={hi} shade={200} />
|
|
39
|
+
</div>
|
|
40
|
+
<div>
|
|
41
|
+
<NLink text="Fake Link" onClick={hi} color="secondary" shade={200} />
|
|
42
|
+
</div>
|
|
43
|
+
<div>
|
|
44
|
+
<NLink text="Fake Link" onClick={hi} color="secondary" />
|
|
45
|
+
</div>
|
|
46
|
+
</ComponentGrid>
|
|
47
|
+
</VariantSection>
|
|
48
|
+
</ComponentSection>
|
|
49
|
+
)
|
|
50
|
+
})
|