@naptics/vue-collection 0.3.1 → 1.0.0-beta.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/eslint.config.cjs +0 -2
- package/package.json +32 -31
- package/postcss.config.js +1 -4
- package/src/demo/App.css +47 -3
- package/src/demo/components/ComponentSection.tsx +1 -1
- package/src/demo/views/NavigationView.tsx +1 -1
- package/src/demo/views/presentation/TooltipView.tsx +8 -2
- package/src/lib/components/NAlert.tsx +3 -3
- package/src/lib/components/NBadge.tsx +1 -1
- package/src/lib/components/NButton.tsx +6 -4
- package/src/lib/components/NCheckbox.tsx +2 -2
- package/src/lib/components/NDialog.tsx +2 -2
- package/src/lib/components/NDropdown.tsx +11 -9
- package/src/lib/components/NDropzone.tsx +4 -4
- package/src/lib/components/NIconButton.tsx +2 -2
- package/src/lib/components/NInput.tsx +1 -1
- package/src/lib/components/NLink.tsx +1 -1
- package/src/lib/components/NModal.tsx +4 -4
- package/src/lib/components/NPagination.css +4 -2
- package/src/lib/components/NPagination.tsx +1 -1
- package/src/lib/components/NSearchbar.tsx +1 -1
- package/src/lib/components/NSelect.tsx +1 -1
- package/src/lib/components/NSuggestionList.tsx +1 -1
- package/src/lib/components/NTable.css +2 -0
- package/src/lib/components/NTableAction.tsx +1 -1
- package/src/lib/components/NTextArea.tsx +1 -1
- package/src/lib/components/NTooltip.css +2 -0
- package/src/lib/components/NTooltip.tsx +42 -3
- package/src/lib/utils/component.tsx +1 -1
- package/tsconfig.lib.json +1 -0
- package/vite.config.ts +2 -0
- package/components/NAlert.d.ts +0 -29
- package/components/NAlert.js +0 -84
- package/components/NBadge.d.ts +0 -69
- package/components/NBadge.js +0 -64
- package/components/NBreadcrub.d.ts +0 -69
- package/components/NBreadcrub.js +0 -71
- package/components/NButton.d.ts +0 -60
- package/components/NButton.js +0 -72
- package/components/NCheckbox.d.ts +0 -20
- package/components/NCheckbox.js +0 -43
- package/components/NCheckboxLabel.d.ts +0 -26
- package/components/NCheckboxLabel.js +0 -42
- package/components/NCrudModal.d.ts +0 -118
- package/components/NCrudModal.js +0 -120
- package/components/NDialog.d.ts +0 -81
- package/components/NDialog.js +0 -161
- package/components/NDropdown.d.ts +0 -67
- package/components/NDropdown.js +0 -115
- package/components/NDropzone.d.ts +0 -61
- package/components/NDropzone.js +0 -218
- package/components/NForm.d.ts +0 -21
- package/components/NForm.js +0 -29
- package/components/NFormModal.d.ts +0 -75
- package/components/NFormModal.js +0 -59
- package/components/NIconButton.d.ts +0 -79
- package/components/NIconButton.js +0 -88
- package/components/NIconCircle.d.ts +0 -49
- package/components/NIconCircle.js +0 -67
- package/components/NInput.css +0 -11
- package/components/NInput.d.ts +0 -90
- package/components/NInput.js +0 -110
- package/components/NInputPhone.d.ts +0 -54
- package/components/NInputPhone.js +0 -47
- package/components/NInputSelect.d.ts +0 -99
- package/components/NInputSelect.js +0 -115
- package/components/NInputSuggestion.d.ts +0 -75
- package/components/NInputSuggestion.js +0 -64
- package/components/NLink.d.ts +0 -47
- package/components/NLink.js +0 -67
- package/components/NList.d.ts +0 -37
- package/components/NList.js +0 -40
- package/components/NLoadingIndicator.css +0 -46
- package/components/NLoadingIndicator.d.ts +0 -29
- package/components/NLoadingIndicator.js +0 -54
- package/components/NModal.d.ts +0 -133
- package/components/NModal.js +0 -232
- package/components/NPagination.css +0 -15
- package/components/NPagination.d.ts +0 -37
- package/components/NPagination.js +0 -105
- package/components/NSearchbar.d.ts +0 -39
- package/components/NSearchbar.js +0 -64
- package/components/NSearchbarList.d.ts +0 -33
- package/components/NSearchbarList.js +0 -41
- package/components/NSelect.d.ts +0 -78
- package/components/NSelect.js +0 -101
- package/components/NSuggestionList.d.ts +0 -153
- package/components/NSuggestionList.js +0 -160
- package/components/NTable.css +0 -3
- package/components/NTable.d.ts +0 -97
- package/components/NTable.js +0 -128
- package/components/NTableAction.d.ts +0 -30
- package/components/NTableAction.js +0 -50
- package/components/NTextArea.d.ts +0 -92
- package/components/NTextArea.js +0 -133
- package/components/NTooltip.css +0 -37
- package/components/NTooltip.d.ts +0 -136
- package/components/NTooltip.js +0 -207
- package/components/NValInput.d.ts +0 -155
- package/components/NValInput.js +0 -113
- package/components/ValidatedForm.d.ts +0 -39
- package/components/ValidatedForm.js +0 -35
- package/i18n/de/vue-collection.json +0 -58
- package/i18n/en/vue-collection.json +0 -58
- package/i18n/index.d.ts +0 -40
- package/i18n/index.js +0 -31
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/tailwind.config.js +0 -38
- package/utils/breakpoints.d.ts +0 -18
- package/utils/breakpoints.js +0 -40
- package/utils/component.d.ts +0 -57
- package/utils/component.js +0 -79
- package/utils/deferred.d.ts +0 -13
- package/utils/deferred.js +0 -17
- package/utils/identifiable.d.ts +0 -56
- package/utils/identifiable.js +0 -81
- package/utils/stringMaxLength.d.ts +0 -14
- package/utils/stringMaxLength.js +0 -23
- package/utils/tailwind.d.ts +0 -4
- package/utils/tailwind.js +0 -1
- package/utils/utils.d.ts +0 -47
- package/utils/utils.js +0 -56
- package/utils/vModel.d.ts +0 -182
- package/utils/vModel.js +0 -224
- package/utils/validation.d.ts +0 -90
- package/utils/validation.js +0 -147
- package/utils/vue.d.ts +0 -13
- package/utils/vue.js +0 -21
package/eslint.config.cjs
CHANGED
|
@@ -3,8 +3,6 @@ const { defineConfigWithVueTs, vueTsConfigs } = require('@vue/eslint-config-type
|
|
|
3
3
|
const js = require('@eslint/js')
|
|
4
4
|
const prettierConfig = require('@vue/eslint-config-prettier')
|
|
5
5
|
|
|
6
|
-
require('@rushstack/eslint-patch/modern-module-resolution')
|
|
7
|
-
|
|
8
6
|
module.exports = defineConfigWithVueTs(
|
|
9
7
|
{
|
|
10
8
|
ignores: ['node_modules/**', 'dist/**', 'dist-ssr/**', 'lib/**', 'coverage/**', 'scripts/*.js'],
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naptics/vue-collection",
|
|
3
|
-
"author": "Timo Siegenthaler",
|
|
3
|
+
"author": "Timo Siegenthaler and Jonas Schoch",
|
|
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": "1.0.0-beta.1",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -22,43 +22,44 @@
|
|
|
22
22
|
"preinstall": "node ./scripts/sync-node-types.js"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@headlessui/vue": "^1.7.
|
|
26
|
-
"@popperjs/core": "^2.11.
|
|
27
|
-
"awesome-phonenumber": "^
|
|
25
|
+
"@headlessui/vue": "^1.7.23",
|
|
26
|
+
"@popperjs/core": "^2.11.8",
|
|
27
|
+
"awesome-phonenumber": "^7.8.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@heroicons/vue": "^2.0.16",
|
|
31
31
|
"vue": "^3.5.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@babel/cli": "^7.
|
|
35
|
-
"@babel/core": "^7.
|
|
36
|
-
"@
|
|
37
|
-
"@
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
34
|
+
"@babel/cli": "^7.28.6",
|
|
35
|
+
"@babel/core": "^7.29.0",
|
|
36
|
+
"@eslint/js": "^10.0.1",
|
|
37
|
+
"@intlify/unplugin-vue-i18n": "^11.2.3",
|
|
38
|
+
"@rushstack/eslint-patch": "^1.16.1",
|
|
39
|
+
"@tailwindcss/forms": "^0.5.11",
|
|
40
|
+
"@tailwindcss/vite": "^4.3.0",
|
|
41
|
+
"@types/jsdom": "^28.0.3",
|
|
40
42
|
"@types/node": "^24",
|
|
41
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
42
|
-
"@vitejs/plugin-vue-jsx": "^5.1.
|
|
43
|
-
"@vue/babel-plugin-jsx": "^
|
|
43
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
44
|
+
"@vitejs/plugin-vue-jsx": "^5.1.5",
|
|
45
|
+
"@vue/babel-plugin-jsx": "^2.0.1",
|
|
44
46
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
45
|
-
"@vue/eslint-config-typescript": "^14.
|
|
46
|
-
"@vue/test-utils": "^2.
|
|
47
|
-
"@vue/tsconfig": "^0.
|
|
48
|
-
"
|
|
49
|
-
"eslint": "^9.
|
|
50
|
-
"
|
|
51
|
-
"jsdom": "^21.1.0",
|
|
47
|
+
"@vue/eslint-config-typescript": "^14.7.0",
|
|
48
|
+
"@vue/test-utils": "^2.4.10",
|
|
49
|
+
"@vue/tsconfig": "^0.8.1",
|
|
50
|
+
"eslint": "^10.4.0",
|
|
51
|
+
"eslint-plugin-vue": "^10.9.1",
|
|
52
|
+
"jsdom": "^29.1.1",
|
|
52
53
|
"npm-run-all": "^4.1.5",
|
|
53
|
-
"postcss": "^8.
|
|
54
|
-
"prettier": "^3.
|
|
55
|
-
"tailwindcss": "^3.
|
|
56
|
-
"typescript": "~5.
|
|
57
|
-
"vite": "^
|
|
58
|
-
"vitest": "^4.
|
|
59
|
-
"vue": "^3.5.
|
|
60
|
-
"vue-i18n": "^
|
|
61
|
-
"vue-router": "^
|
|
62
|
-
"vue-tsc": "^3.1
|
|
54
|
+
"postcss": "^8.5.15",
|
|
55
|
+
"prettier": "^3.8.3",
|
|
56
|
+
"tailwindcss": "^4.3.0",
|
|
57
|
+
"typescript": "~5.8.3",
|
|
58
|
+
"vite": "^8.0.14",
|
|
59
|
+
"vitest": "^4.1.7",
|
|
60
|
+
"vue": "^3.5.34",
|
|
61
|
+
"vue-i18n": "^11.4.4",
|
|
62
|
+
"vue-router": "^5.0.7",
|
|
63
|
+
"vue-tsc": "^3.3.1"
|
|
63
64
|
}
|
|
64
65
|
}
|
package/postcss.config.js
CHANGED
package/src/demo/App.css
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
|
-
@
|
|
2
|
-
@
|
|
3
|
-
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
@plugin "@tailwindcss/forms";
|
|
3
|
+
|
|
4
|
+
@theme {
|
|
5
|
+
--color-default-50: var(--color-slate-50);
|
|
6
|
+
--color-default-100: var(--color-slate-100);
|
|
7
|
+
--color-default-200: var(--color-slate-200);
|
|
8
|
+
--color-default-300: var(--color-slate-300);
|
|
9
|
+
--color-default-400: var(--color-slate-400);
|
|
10
|
+
--color-default-500: var(--color-slate-500);
|
|
11
|
+
--color-default-600: var(--color-slate-600);
|
|
12
|
+
--color-default-700: var(--color-slate-700);
|
|
13
|
+
--color-default-800: var(--color-slate-800);
|
|
14
|
+
--color-default-900: var(--color-slate-900);
|
|
15
|
+
--color-default-950: var(--color-slate-950);
|
|
16
|
+
|
|
17
|
+
--color-primary-50: var(--color-violet-50);
|
|
18
|
+
--color-primary-100: var(--color-violet-100);
|
|
19
|
+
--color-primary-200: var(--color-violet-200);
|
|
20
|
+
--color-primary-300: var(--color-violet-300);
|
|
21
|
+
--color-primary-400: var(--color-violet-400);
|
|
22
|
+
--color-primary-500: var(--color-violet-500);
|
|
23
|
+
--color-primary-600: var(--color-violet-600);
|
|
24
|
+
--color-primary-700: var(--color-violet-700);
|
|
25
|
+
--color-primary-800: var(--color-violet-800);
|
|
26
|
+
--color-primary-900: var(--color-violet-900);
|
|
27
|
+
--color-primary-950: var(--color-violet-950);
|
|
28
|
+
|
|
29
|
+
--color-secondary-50: var(--color-fuchsia-50);
|
|
30
|
+
--color-secondary-100: var(--color-fuchsia-100);
|
|
31
|
+
--color-secondary-200: var(--color-fuchsia-200);
|
|
32
|
+
--color-secondary-300: var(--color-fuchsia-300);
|
|
33
|
+
--color-secondary-400: var(--color-fuchsia-400);
|
|
34
|
+
--color-secondary-500: var(--color-fuchsia-500);
|
|
35
|
+
--color-secondary-600: var(--color-fuchsia-600);
|
|
36
|
+
--color-secondary-700: var(--color-fuchsia-700);
|
|
37
|
+
--color-secondary-800: var(--color-fuchsia-800);
|
|
38
|
+
--color-secondary-900: var(--color-fuchsia-900);
|
|
39
|
+
--color-secondary-950: var(--color-fuchsia-950);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Safelist dynamic color/size classes used in components */
|
|
43
|
+
@source inline("{bg,text}-{default,primary,secondary,green,red,yellow,blue}-{50,100,200,300,400,500,600,700,800,900}");
|
|
44
|
+
@source inline("hover:{bg,text}-{default,primary,secondary,green,red,yellow,blue}-{50,100,200,300,400,500,600,700,800,900}");
|
|
45
|
+
@source inline("ring-{default,primary,secondary,green,red,yellow,blue}-{50,100,200,300,400,500,600,700,800,900}");
|
|
46
|
+
@source inline("focus-visible:ring-{default,primary,secondary,green,red,yellow,blue}-{50,100,200,300,400,500,600,700,800,900}");
|
|
47
|
+
@source inline("{w,h}-{1,2,3,4,5,6,7,8,9,10,11,12,14,16,18,20}");
|
|
4
48
|
|
|
5
49
|
@layer base {
|
|
6
50
|
body {
|
|
@@ -13,7 +13,7 @@ export default createComponent('ComponentSection', componentSectionProps, (props
|
|
|
13
13
|
<div class="border-b-2 border-default-200" id={props.id}>
|
|
14
14
|
<div>
|
|
15
15
|
<div class="px-8 py-10 max-w-4xl mx-auto">
|
|
16
|
-
<RouterLink to={{ hash: props.id ? `#${props.id}` : undefined }} class="group outline-
|
|
16
|
+
<RouterLink to={{ hash: props.id ? `#${props.id}` : undefined }} class="group outline-hidden">
|
|
17
17
|
<h2 class="font-bold text-4xl mb-2 flex items-center space-x-2 ">
|
|
18
18
|
<span>{props.title}</span>
|
|
19
19
|
<LinkIcon class="h-8 w-8 text-default-900 opacity-30 hidden group-hover:block group-focus-visible:block" />
|
|
@@ -30,7 +30,7 @@ export default createView('NavigationView', () => {
|
|
|
30
30
|
{sections.map(section => (
|
|
31
31
|
<RouterLink
|
|
32
32
|
to={{ hash: `#${section.hash}` }}
|
|
33
|
-
class="outline-
|
|
33
|
+
class="outline-hidden focus-visible:ring-2 focus-visible ring-primary-500 rounded-md"
|
|
34
34
|
>
|
|
35
35
|
<NBadge color="primary" allCaps={false} textSize="text-2xl">
|
|
36
36
|
{section.label}
|
|
@@ -20,9 +20,9 @@ export default createView('TooltipView', () => {
|
|
|
20
20
|
title="Customization"
|
|
21
21
|
subtitle="The content of a tooltip can be a simple text or there is a slot available for customization. More properties like placement, maximum width and more can be configured."
|
|
22
22
|
>
|
|
23
|
-
<ComponentGrid cols={
|
|
23
|
+
<ComponentGrid cols={5}>
|
|
24
24
|
<div class="flex">
|
|
25
|
-
<NTooltip text="Hello tooltip!">
|
|
25
|
+
<NTooltip text="Hello tooltip!" placement="bottom">
|
|
26
26
|
<NBadge text="Hover me" />
|
|
27
27
|
</NTooltip>
|
|
28
28
|
</div>
|
|
@@ -57,6 +57,12 @@ export default createView('TooltipView', () => {
|
|
|
57
57
|
<NBadge text="Hover me" />
|
|
58
58
|
</NTooltip>
|
|
59
59
|
</div>
|
|
60
|
+
|
|
61
|
+
<div class="flex">
|
|
62
|
+
<NTooltip text="I'm delayed 500ms, sorry." delay={500}>
|
|
63
|
+
<NBadge text="Delay" />
|
|
64
|
+
</NTooltip>
|
|
65
|
+
</div>
|
|
60
66
|
</ComponentGrid>
|
|
61
67
|
</VariantSection>
|
|
62
68
|
|
|
@@ -39,16 +39,16 @@ const Component = createComponent('NAlert', nAlertProps, (props, { slots }) => {
|
|
|
39
39
|
return () => (
|
|
40
40
|
<div class={`rounded-md p-3 shadow-lg bg-${variant.value.color}-50`}>
|
|
41
41
|
<div class="flex items-center">
|
|
42
|
-
<div class="flex
|
|
42
|
+
<div class="flex shrink-0 items-center">{variant.value.icon()}</div>
|
|
43
43
|
|
|
44
|
-
<div class="ml-3
|
|
44
|
+
<div class="ml-3 grow">
|
|
45
45
|
<p class={`text-sm font-medium text-${variant.value.color}-900`}>
|
|
46
46
|
{slots.default?.() ?? props.text}
|
|
47
47
|
</p>
|
|
48
48
|
</div>
|
|
49
49
|
|
|
50
50
|
{!props.hideX && (
|
|
51
|
-
<div class="flex items-center
|
|
51
|
+
<div class="flex items-center shrink-0 ml-3">
|
|
52
52
|
<NIconButton color={variant.value.color} size={5} icon={XMarkIcon} onClick={props.onDismiss} />
|
|
53
53
|
</div>
|
|
54
54
|
)}
|
|
@@ -60,7 +60,7 @@ const Component = createComponent('NBadge', nBadgeProps, (props, { slots }) => {
|
|
|
60
60
|
<NTooltip {...mapTooltipProps(props)}>
|
|
61
61
|
<div
|
|
62
62
|
class={[
|
|
63
|
-
'px-2 py-1 rounded-md font-semibold shadow',
|
|
63
|
+
'px-2 py-1 rounded-md font-semibold shadow-sm',
|
|
64
64
|
`${props.textSize} bg-${props.color}-${props.shade} text-${props.color}-${props.textShade}`,
|
|
65
65
|
props.allCaps ? 'uppercase' : '',
|
|
66
66
|
props.badgeClass,
|
|
@@ -56,17 +56,19 @@ const Component = createComponent('NButton', nButtonProps, (props, { slots }) =>
|
|
|
56
56
|
disabled={isDisabled.value}
|
|
57
57
|
type={props.type}
|
|
58
58
|
class={[
|
|
59
|
-
`block w-full font-medium rounded-md focus:outline-
|
|
59
|
+
`block w-full font-medium rounded-md focus:outline-hidden focus-visible:ring-2 shadow-sm text-${props.color}-900 relative`,
|
|
60
60
|
isDisabled.value
|
|
61
|
-
? `bg-${props.color}-100
|
|
62
|
-
: `bg-${props.color}-200 hover:bg-${props.color}-300 focus-visible:ring-${props.color}-500`,
|
|
61
|
+
? `bg-${props.color}-100 cursor-default`
|
|
62
|
+
: `bg-${props.color}-200 hover:bg-${props.color}-300 focus-visible:ring-${props.color}-500 cursor-pointer`,
|
|
63
63
|
|
|
64
64
|
props.small ? 'py-1 px-2 text-xs' : 'py-2 px-4 text-sm',
|
|
65
65
|
props.buttonClass,
|
|
66
66
|
]}
|
|
67
67
|
onClick={props.onClick}
|
|
68
68
|
>
|
|
69
|
-
<span class={
|
|
69
|
+
<span class={props.loading ? 'opacity-0' : isDisabled.value ? 'opacity-20' : undefined}>
|
|
70
|
+
{slots.default?.()}
|
|
71
|
+
</span>
|
|
70
72
|
{props.loading && (
|
|
71
73
|
<div class="absolute inset-0 flex items-center justify-center opacity-50">
|
|
72
74
|
<NLoadingIndicator color={props.color} size={props.small ? 4 : 6} shade={600} />
|
|
@@ -43,9 +43,9 @@ const Component = createComponent('NCheckbox', nCheckboxProps, props => {
|
|
|
43
43
|
onClick={toggle}
|
|
44
44
|
key={updateKey.value}
|
|
45
45
|
class={[
|
|
46
|
-
`h-5 w-5 border-default-300 rounded focus:outline-
|
|
46
|
+
`h-5 w-5 border-default-300 rounded-sm focus:outline-hidden focus:ring-0 focus-visible:ring-2 focus-visible:ring-${props.color}-500`,
|
|
47
47
|
props.disabled
|
|
48
|
-
? `cursor-default bg-default-100 text-${props.color}-
|
|
48
|
+
? `cursor-default opacity-50 bg-default-100 checked:bg-current text-${props.color}-400`
|
|
49
49
|
: `cursor-pointer text-${props.color}-400`,
|
|
50
50
|
]}
|
|
51
51
|
/>
|
|
@@ -127,7 +127,7 @@ const Component = createComponent('NDialog', nDialogProps, (props, context) => {
|
|
|
127
127
|
hideHeader
|
|
128
128
|
>
|
|
129
129
|
<div class="flex space-x-4 py-2">
|
|
130
|
-
<div class="
|
|
130
|
+
<div class="grow-0">
|
|
131
131
|
<NIconCircle
|
|
132
132
|
icon={props.icon || defaults.value.icon}
|
|
133
133
|
iconSize={6}
|
|
@@ -135,7 +135,7 @@ const Component = createComponent('NDialog', nDialogProps, (props, context) => {
|
|
|
135
135
|
/>
|
|
136
136
|
</div>
|
|
137
137
|
|
|
138
|
-
<div class="
|
|
138
|
+
<div class="grow">
|
|
139
139
|
<DialogTitle as="h4" class="font-medium text-lg text-default-700 mb-1">
|
|
140
140
|
{props.title}
|
|
141
141
|
</DialogTitle>
|
|
@@ -89,28 +89,30 @@ const Component = createComponentWithSlots('NDropdown', nDropdownProps, ['button
|
|
|
89
89
|
<MenuButton
|
|
90
90
|
disabled={props.disabled}
|
|
91
91
|
class={[
|
|
92
|
-
'shadow w-full flex justify-between items-center
|
|
93
|
-
props.disabled
|
|
92
|
+
'shadow-sm w-full flex justify-between items-center rounded-md border bg-white border-default-300 px-4 py-2 text-sm font-medium focus:outline-hidden focus:ring-offset-2 focus-visible:ring-2 focus-visible:ring-primary-500',
|
|
93
|
+
props.disabled
|
|
94
|
+
? 'text-default-700/20 cursor-default'
|
|
95
|
+
: 'hover:bg-default-100 text-default-700 cursor-pointer',
|
|
94
96
|
props.buttonClass,
|
|
95
97
|
]}
|
|
96
98
|
>
|
|
97
99
|
<span>{props.title}</span>
|
|
98
|
-
<ChevronDownIcon class="-mr-1 ml-2 h-5 w-5
|
|
100
|
+
<ChevronDownIcon class="-mr-1 ml-2 h-5 w-5 shrink-0" aria-hidden="true" />
|
|
99
101
|
</MenuButton>
|
|
100
102
|
)}
|
|
101
103
|
</div>
|
|
102
104
|
|
|
103
105
|
<Transition
|
|
104
106
|
enterActiveClass="transition ease-out duration-100"
|
|
105
|
-
enterFromClass="
|
|
106
|
-
enterToClass="
|
|
107
|
+
enterFromClass="opacity-0 scale-95"
|
|
108
|
+
enterToClass="opacity-100 scale-100"
|
|
107
109
|
leaveActiveClass="transition ease-in duration-75"
|
|
108
|
-
leaveFromClass="
|
|
109
|
-
leaveToClass="
|
|
110
|
+
leaveFromClass="opacity-100 scale-100"
|
|
111
|
+
leaveToClass="opacity-0 scale-95"
|
|
110
112
|
>
|
|
111
113
|
<MenuItems
|
|
112
114
|
class={[
|
|
113
|
-
'z-10 absolute w-56 mt-2 rounded-md shadow-lg bg-white ring-1 ring-black
|
|
115
|
+
'z-10 absolute w-56 mt-2 rounded-md shadow-lg bg-white ring-1 ring-black/5 focus:outline-hidden',
|
|
114
116
|
props.right ? 'origin-top-right right-0' : 'origin-top-left left-0',
|
|
115
117
|
]}
|
|
116
118
|
>
|
|
@@ -142,7 +144,7 @@ const Component = createComponentWithSlots('NDropdown', nDropdownProps, ['button
|
|
|
142
144
|
type="button"
|
|
143
145
|
onClick={item.onClick}
|
|
144
146
|
class={[
|
|
145
|
-
'w-full text-left px-4 py-2 text-sm',
|
|
147
|
+
'w-full text-left px-4 py-2 text-sm cursor-pointer',
|
|
146
148
|
active
|
|
147
149
|
? 'bg-default-100 text-default-900'
|
|
148
150
|
: 'text-default-700',
|
|
@@ -168,7 +168,7 @@ const Component = createComponent('NDropzone', nDropzoneProps, props => {
|
|
|
168
168
|
<div>
|
|
169
169
|
<button
|
|
170
170
|
class={[
|
|
171
|
-
'block w-full rounded-md border-dashed border-2 focus-visible:border-primary-500 focus:outline-
|
|
171
|
+
'block w-full rounded-md border-dashed border-2 focus-visible:border-primary-500 focus:outline-hidden ',
|
|
172
172
|
'flex flex-col items-center justify-center text-center text-sm select-none p-4',
|
|
173
173
|
!props.disabled ? 'hover:border-primary-300 hover:bg-primary-50 hover:text-primary-700' : '',
|
|
174
174
|
props.disabled
|
|
@@ -196,14 +196,14 @@ const Component = createComponent('NDropzone', nDropzoneProps, props => {
|
|
|
196
196
|
/>
|
|
197
197
|
|
|
198
198
|
{/* Counterweight */}
|
|
199
|
-
<div class="
|
|
199
|
+
<div class="grow mb-2" />
|
|
200
200
|
|
|
201
201
|
<span class="font-medium">
|
|
202
202
|
{trslc('vue-collection.text.drag-n-drop-files', props.maxFiles, { n: props.maxFiles })}
|
|
203
203
|
</span>
|
|
204
204
|
<span>{props.description}</span>
|
|
205
205
|
|
|
206
|
-
<div class="
|
|
206
|
+
<div class="grow mt-2 flex items-end justify-center text-red-500 font-medium">
|
|
207
207
|
<span>{fileError.value}</span>
|
|
208
208
|
</div>
|
|
209
209
|
</button>
|
|
@@ -224,7 +224,7 @@ const Component = createComponent('NDropzone', nDropzoneProps, props => {
|
|
|
224
224
|
</NBadge>
|
|
225
225
|
))}
|
|
226
226
|
|
|
227
|
-
<div class="
|
|
227
|
+
<div class="grow text-sm text-default-500 flex items-end justify-end text-right">
|
|
228
228
|
<span>
|
|
229
229
|
<span>
|
|
230
230
|
{trslc('vue-collection.text.files-selected', files.value.length, {
|
|
@@ -65,10 +65,10 @@ export const nIconButtonProps = {
|
|
|
65
65
|
*/
|
|
66
66
|
const Component = createComponent('NIconButton', nIconButtonProps, props => {
|
|
67
67
|
const classes = () => [
|
|
68
|
-
'block p-0.5 rounded-md focus:outline-
|
|
68
|
+
'block p-0.5 rounded-md focus:outline-hidden focus-visible:ring-2 -m-1',
|
|
69
69
|
props.disabled
|
|
70
70
|
? `text-${props.color}-200 cursor-default`
|
|
71
|
-
: `hover:bg
|
|
71
|
+
: `hover:bg-current/10 text-${props.color}-${props.shade} focus-visible:ring-${props.color}-${props.shade} cursor-pointer`,
|
|
72
72
|
props.buttonClass,
|
|
73
73
|
]
|
|
74
74
|
|
|
@@ -112,7 +112,7 @@ const Component = createComponent('NInput', nInputProps, (props, context) => {
|
|
|
112
112
|
onBlur={() => props.onBlur?.()}
|
|
113
113
|
onInvalid={event => event.preventDefault()}
|
|
114
114
|
class={[
|
|
115
|
-
'block w-full rounded-md border focus:outline-
|
|
115
|
+
'block w-full rounded-md border focus:outline-hidden focus:ring-1 ',
|
|
116
116
|
props.small ? 'text-xs py-0.5 px-2' : 'py-2 px-4',
|
|
117
117
|
props.disabled
|
|
118
118
|
? 'text-default-500 placeholder-default-300 bg-default-50'
|
|
@@ -55,7 +55,7 @@ const Component = createComponent('NLink', nLinkProps, (props, { slots }) => {
|
|
|
55
55
|
})
|
|
56
56
|
|
|
57
57
|
const classes = computed(() => [
|
|
58
|
-
'font-medium focus:outline-
|
|
58
|
+
'font-medium focus:outline-hidden focus-visible:ring-2 rounded-xs ring-offset-2 hover:underline text-left cursor-pointer',
|
|
59
59
|
`${props.textSize} text-${props.color}-${props.shade} hover:text-${props.color}-${hoverShade.value} focus-visible:ring-${props.color}-${props.shade}`,
|
|
60
60
|
])
|
|
61
61
|
const disabledClasses = computed(() => [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createComponentWithSlots } from '../utils/component'
|
|
2
2
|
import type { PropType } from 'vue'
|
|
3
|
-
import { Dialog,
|
|
3
|
+
import { Dialog, DialogTitle, TransitionRoot, TransitionChild } from '@headlessui/vue'
|
|
4
4
|
import NButton from './NButton'
|
|
5
5
|
import NIconButton from './NIconButton'
|
|
6
6
|
import { XMarkIcon } from '@heroicons/vue/24/solid'
|
|
@@ -160,9 +160,9 @@ const Component = createComponentWithSlots('NModal', nModalProps, ['modal', 'hea
|
|
|
160
160
|
leave-to="opacity-0"
|
|
161
161
|
>
|
|
162
162
|
{props.closeOnBackground ? (
|
|
163
|
-
<
|
|
163
|
+
<div class="fixed inset-0 bg-default-700/75" aria-hidden="true" onClick={cancel} />
|
|
164
164
|
) : (
|
|
165
|
-
<div class="fixed inset-0 bg-default-700
|
|
165
|
+
<div class="fixed inset-0 bg-default-700/75" aria-hidden="true" />
|
|
166
166
|
)}
|
|
167
167
|
</TransitionChild>
|
|
168
168
|
|
|
@@ -180,7 +180,7 @@ const Component = createComponentWithSlots('NModal', nModalProps, ['modal', 'hea
|
|
|
180
180
|
leave-from="opacity-100 translate-y-0 sm:scale-100"
|
|
181
181
|
leave-to="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
182
182
|
>
|
|
183
|
-
<div class={['
|
|
183
|
+
<div class={['relative m-4 w-full align-middle', props.maxWidth]}>
|
|
184
184
|
{props.modal?.({ ok, cancel }) || (
|
|
185
185
|
<div
|
|
186
186
|
class={[
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@reference "../../demo/App.css";
|
|
2
|
+
|
|
1
3
|
.pagination-item {
|
|
2
4
|
@apply h-9 w-9 text-sm inline-flex items-center justify-center border font-medium border-default-300 text-default-500;
|
|
3
5
|
}
|
|
@@ -7,9 +9,9 @@
|
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
.pagination-item.selectable {
|
|
10
|
-
@apply hover:bg-default-50 focus:outline-
|
|
12
|
+
@apply cursor-pointer hover:bg-default-50 focus:outline-hidden focus-visible:border-primary-500 focus-visible:ring-primary-500 focus-visible:ring-1 focus-visible:z-2;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
.pagination-item.selectable.selected {
|
|
14
|
-
@apply border-primary-500 bg-primary-100 hover:bg-primary-100 text-primary-600 z-
|
|
16
|
+
@apply border-primary-500 bg-primary-100 hover:bg-primary-100 text-primary-600 z-1;
|
|
15
17
|
}
|
|
@@ -86,7 +86,7 @@ const Component = createComponent('NPagination', nPaginationProps, props => {
|
|
|
86
86
|
]
|
|
87
87
|
|
|
88
88
|
return () => (
|
|
89
|
-
<nav class="inline-flex rounded-md shadow -space-x-px">
|
|
89
|
+
<nav class="inline-flex rounded-md shadow-sm -space-x-px">
|
|
90
90
|
<button
|
|
91
91
|
class={['pagination-item selectable rounded-l-md', props.small ? '' : 'not-small']}
|
|
92
92
|
onClick={previous}
|
|
@@ -64,7 +64,7 @@ const Component = createComponent('NSearchbar', nSearchbarProps, (props, context
|
|
|
64
64
|
placeholder={props.placeholder}
|
|
65
65
|
autocomplete="off"
|
|
66
66
|
class={[
|
|
67
|
-
'block w-full pl-10 pr-4 rounded-md border focus:outline-
|
|
67
|
+
'block w-full pl-10 pr-4 rounded-md border focus:outline-hidden focus:ring-1 transition placeholder-default-400 border-default-300 focus:border-primary-500 focus:ring-primary-500',
|
|
68
68
|
props.small ? 'py-1' : 'py-2',
|
|
69
69
|
props.inputClass,
|
|
70
70
|
]}
|
|
@@ -101,7 +101,7 @@ const Component = createComponent('NSelect', nSelectProps, (props, context) => {
|
|
|
101
101
|
onChange={event => slotProps.onUpdateValue((event.target as HTMLInputElement).value)}
|
|
102
102
|
onBlur={slotProps.onBlur}
|
|
103
103
|
class={[
|
|
104
|
-
'block w-full py-2 pl-4 pr-10 rounded-md border focus:outline-
|
|
104
|
+
'block w-full py-2 pl-4 pr-10 rounded-md border focus:outline-hidden focus:ring-1',
|
|
105
105
|
props.disabled ? 'text-default-300 ' : 'text-default-900 ',
|
|
106
106
|
slotProps.error
|
|
107
107
|
? 'border-red-500 focus:border-red-500 focus:ring-red-500'
|
|
@@ -179,7 +179,7 @@ const Component = createComponentWithSlots('NSuggestionList', nSuggestionListPro
|
|
|
179
179
|
<li
|
|
180
180
|
key={item.id}
|
|
181
181
|
class={[
|
|
182
|
-
'focus:outline-
|
|
182
|
+
'focus:outline-hidden hover:bg-default-50 rounded-md select-none p-2 cursor-pointer',
|
|
183
183
|
selectedIndex.value === index ? 'bg-default-50' : '',
|
|
184
184
|
]}
|
|
185
185
|
onMousedown={onListMouseDown}
|
|
@@ -31,7 +31,7 @@ const Component = createComponent('NTableAction', nTableActionProps, (props, { s
|
|
|
31
31
|
const content = () => slots.default?.() || <>{props.text}</>
|
|
32
32
|
|
|
33
33
|
const classes = [
|
|
34
|
-
'text-left font-medium focus:outline-
|
|
34
|
+
'text-left font-medium focus:outline-hidden focus-visible:ring-2 focus-visible:ring-default-900 rounded-xs ring-offset-2 text-default-900 hover:underline hover:text-default-700 cursor-pointer',
|
|
35
35
|
]
|
|
36
36
|
|
|
37
37
|
return () =>
|
|
@@ -134,7 +134,7 @@ const NTextAreaBase = createComponent('NTextAreaBase', nTextAreaBaseProps, (prop
|
|
|
134
134
|
onBlur={() => props.onBlur?.()}
|
|
135
135
|
onInvalid={event => event.preventDefault()}
|
|
136
136
|
class={[
|
|
137
|
-
'block w-full rounded-md border focus:outline-
|
|
137
|
+
'block w-full rounded-md border focus:outline-hidden focus:ring-1 ',
|
|
138
138
|
props.disabled
|
|
139
139
|
? 'text-default-500 placeholder-default-300 bg-default-50'
|
|
140
140
|
: 'text-default-900 placeholder-default-400 ',
|
|
@@ -55,6 +55,14 @@ export const nTooltipProps = {
|
|
|
55
55
|
* to target the arrow (which is the before element).
|
|
56
56
|
*/
|
|
57
57
|
arrowClass: String,
|
|
58
|
+
/**
|
|
59
|
+
* The delay in milliseconds before the tooltip is shown.
|
|
60
|
+
* @default 0
|
|
61
|
+
*/
|
|
62
|
+
delay: {
|
|
63
|
+
type: Number,
|
|
64
|
+
default: 0,
|
|
65
|
+
},
|
|
58
66
|
} as const
|
|
59
67
|
|
|
60
68
|
/**
|
|
@@ -103,6 +111,10 @@ export const nToolTipPropsForImplementor = {
|
|
|
103
111
|
* @see {@link nTooltipProps.arrowClass}
|
|
104
112
|
*/
|
|
105
113
|
tooltipArrowClass: nTooltipProps.arrowClass,
|
|
114
|
+
/**
|
|
115
|
+
* @see {@link nTooltipProps.delay}
|
|
116
|
+
*/
|
|
117
|
+
tooltipDelay: nTooltipProps.delay,
|
|
106
118
|
}
|
|
107
119
|
|
|
108
120
|
/**
|
|
@@ -120,6 +132,7 @@ export function mapTooltipProps(props: ExtractedProps<typeof nToolTipPropsForImp
|
|
|
120
132
|
wrapperClass: props.tooltipWrapperClass,
|
|
121
133
|
contentClass: props.tooltipContentClass,
|
|
122
134
|
arrowClass: props.tooltipArrowClass,
|
|
135
|
+
delay: props.tooltipDelay,
|
|
123
136
|
}
|
|
124
137
|
}
|
|
125
138
|
|
|
@@ -179,7 +192,12 @@ const NTooltipBase = createComponent('NTooltipBase', nTooltipProps, (props, { sl
|
|
|
179
192
|
}
|
|
180
193
|
|
|
181
194
|
onMounted(createTooltip)
|
|
182
|
-
onUnmounted(
|
|
195
|
+
onUnmounted(() => {
|
|
196
|
+
if (hoverTimeout) {
|
|
197
|
+
clearTimeout(hoverTimeout)
|
|
198
|
+
}
|
|
199
|
+
destroyTooltip()
|
|
200
|
+
})
|
|
183
201
|
|
|
184
202
|
watch(
|
|
185
203
|
() => props.placement,
|
|
@@ -189,14 +207,35 @@ const NTooltipBase = createComponent('NTooltipBase', nTooltipProps, (props, { sl
|
|
|
189
207
|
const isHoveringContent = ref(false)
|
|
190
208
|
const isHoveringTooltip = ref(false)
|
|
191
209
|
const isHovering = computed(() => isHoveringContent.value || isHoveringTooltip.value)
|
|
192
|
-
const
|
|
210
|
+
const delayedIsHovering = ref(false)
|
|
211
|
+
let hoverTimeout: ReturnType<typeof setTimeout> | null = null
|
|
212
|
+
|
|
213
|
+
const showTooltip = computed(
|
|
214
|
+
() => props.show || (!props.hide && (props.delay > 0 ? delayedIsHovering.value : isHovering.value))
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
watch(isHovering, hovering => {
|
|
218
|
+
if (hoverTimeout) {
|
|
219
|
+
clearTimeout(hoverTimeout)
|
|
220
|
+
hoverTimeout = null
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (hovering && props.delay > 0) {
|
|
224
|
+
hoverTimeout = setTimeout(() => {
|
|
225
|
+
delayedIsHovering.value = true
|
|
226
|
+
hoverTimeout = null
|
|
227
|
+
}, props.delay)
|
|
228
|
+
} else {
|
|
229
|
+
delayedIsHovering.value = hovering
|
|
230
|
+
}
|
|
231
|
+
})
|
|
193
232
|
|
|
194
233
|
watchRef(showTooltip, () => popperInstance?.update())
|
|
195
234
|
|
|
196
235
|
return () => (
|
|
197
236
|
<>
|
|
198
237
|
<div
|
|
199
|
-
class="p-[10px]
|
|
238
|
+
class="p-[10px] m-[-10px]"
|
|
200
239
|
onMouseleave={() => setTimeout(() => (isHoveringContent.value = false), 10)}
|
|
201
240
|
>
|
|
202
241
|
<div id={contentId} onMouseenter={() => (isHoveringContent.value = true)}>
|