@naptics/vue-collection 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -47,15 +47,9 @@ jobs:
|
|
|
47
47
|
id: nvm
|
|
48
48
|
- name: Setup node environment
|
|
49
49
|
uses: actions/setup-node@v4
|
|
50
|
-
env:
|
|
51
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
52
50
|
with:
|
|
53
51
|
node-version: ${{ steps.nvm.outputs.NVMRC }}
|
|
54
52
|
registry-url: https://registry.npmjs.org/
|
|
55
|
-
# Ensure npm 11.5.1 or later for trusted publishing
|
|
56
|
-
- name: Ensure latest npm version
|
|
57
|
-
run: npm --version
|
|
58
|
-
- run: npm install -g npm@latest --no-man
|
|
59
53
|
- name: Download library artifact
|
|
60
54
|
uses: actions/download-artifact@v4
|
|
61
55
|
with:
|
package/components/NLink.d.ts
CHANGED
|
@@ -29,6 +29,11 @@ export declare const nLinkProps: {
|
|
|
29
29
|
readonly type: NumberConstructor;
|
|
30
30
|
readonly default: 500;
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* If set to `true` the link is disabled and no interaction is possible.
|
|
34
|
+
* Note: If the `route` prop is set, the link will still be clickable, because it becomes a {@link RouterLink}.
|
|
35
|
+
*/
|
|
36
|
+
readonly disabled: BooleanConstructor;
|
|
32
37
|
/**
|
|
33
38
|
* This is called when the link is clicked but only, if the `route` prop is not set.
|
|
34
39
|
* If the `route` prop is not set, the link will act as a regular button.
|
package/components/NLink.js
CHANGED
|
@@ -30,6 +30,11 @@ export const nLinkProps = {
|
|
|
30
30
|
type: Number,
|
|
31
31
|
default: 500
|
|
32
32
|
},
|
|
33
|
+
/**
|
|
34
|
+
* If set to `true` the link is disabled and no interaction is possible.
|
|
35
|
+
* Note: If the `route` prop is set, the link will still be clickable, because it becomes a {@link RouterLink}.
|
|
36
|
+
*/
|
|
37
|
+
disabled: Boolean,
|
|
33
38
|
/**
|
|
34
39
|
* This is called when the link is clicked but only, if the `route` prop is not set.
|
|
35
40
|
* If the `route` prop is not set, the link will act as a regular button.
|
|
@@ -47,6 +52,7 @@ const Component = createComponent('NLink', nLinkProps, (props, {
|
|
|
47
52
|
if (shade <= 500) return shade + 100;else return shade - 200;
|
|
48
53
|
});
|
|
49
54
|
const classes = computed(() => ['font-medium focus:outline-none focus-visible:ring-2 rounded-sm ring-offset-2 hover:underline text-left', `${props.textSize} text-${props.color}-${props.shade} hover:text-${props.color}-${hoverShade.value} focus-visible:ring-${props.color}-${props.shade}`]);
|
|
55
|
+
const disabledClasses = computed(() => ['font-medium text-left cursor-not-allowed', `${props.textSize} text-${props.color}-200`]);
|
|
50
56
|
return () => props.route ? _createVNode(RouterLink, {
|
|
51
57
|
"to": props.route,
|
|
52
58
|
"class": classes.value
|
|
@@ -54,7 +60,8 @@ const Component = createComponent('NLink', nLinkProps, (props, {
|
|
|
54
60
|
default: () => [slots.default?.() || props.text]
|
|
55
61
|
}) : _createVNode("button", {
|
|
56
62
|
"onClick": props.onClick,
|
|
57
|
-
"class": classes.value
|
|
63
|
+
"class": props.disabled ? disabledClasses.value : classes.value,
|
|
64
|
+
"disabled": props.disabled
|
|
58
65
|
}, [slots.default?.() || props.text]);
|
|
59
66
|
});
|
|
60
67
|
export { Component as NLink, Component as default };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@naptics/vue-collection",
|
|
3
3
|
"author": "Timo Siegenthaler",
|
|
4
4
|
"description": "Vue Collection is a collection of styled and fully functional Vue components which can easily be integrated into our projects.",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.1",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -45,6 +45,16 @@ export default createView('LinkView', () => {
|
|
|
45
45
|
</div>
|
|
46
46
|
</ComponentGrid>
|
|
47
47
|
</VariantSection>
|
|
48
|
+
<VariantSection title="Disabled Links">
|
|
49
|
+
<ComponentGrid cols={4}>
|
|
50
|
+
<div>
|
|
51
|
+
<NLink text="Disabled Link" disabled />
|
|
52
|
+
</div>
|
|
53
|
+
<div>
|
|
54
|
+
<NLink text="Disabled Link" onClick={hi} color="secondary" disabled />
|
|
55
|
+
</div>
|
|
56
|
+
</ComponentGrid>
|
|
57
|
+
</VariantSection>
|
|
48
58
|
</ComponentSection>
|
|
49
59
|
)
|
|
50
60
|
})
|
|
@@ -31,6 +31,12 @@ export const nLinkProps = {
|
|
|
31
31
|
type: Number,
|
|
32
32
|
default: 500,
|
|
33
33
|
},
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* If set to `true` the link is disabled and no interaction is possible.
|
|
37
|
+
* Note: If the `route` prop is set, the link will still be clickable, because it becomes a {@link RouterLink}.
|
|
38
|
+
*/
|
|
39
|
+
disabled: Boolean,
|
|
34
40
|
/**
|
|
35
41
|
* This is called when the link is clicked but only, if the `route` prop is not set.
|
|
36
42
|
* If the `route` prop is not set, the link will act as a regular button.
|
|
@@ -52,6 +58,10 @@ const Component = createComponent('NLink', nLinkProps, (props, { slots }) => {
|
|
|
52
58
|
'font-medium focus:outline-none focus-visible:ring-2 rounded-sm ring-offset-2 hover:underline text-left',
|
|
53
59
|
`${props.textSize} text-${props.color}-${props.shade} hover:text-${props.color}-${hoverShade.value} focus-visible:ring-${props.color}-${props.shade}`,
|
|
54
60
|
])
|
|
61
|
+
const disabledClasses = computed(() => [
|
|
62
|
+
'font-medium text-left cursor-not-allowed',
|
|
63
|
+
`${props.textSize} text-${props.color}-200`,
|
|
64
|
+
])
|
|
55
65
|
|
|
56
66
|
return () =>
|
|
57
67
|
props.route ? (
|
|
@@ -59,7 +69,11 @@ const Component = createComponent('NLink', nLinkProps, (props, { slots }) => {
|
|
|
59
69
|
{slots.default?.() || props.text}
|
|
60
70
|
</RouterLink>
|
|
61
71
|
) : (
|
|
62
|
-
<button
|
|
72
|
+
<button
|
|
73
|
+
onClick={props.onClick}
|
|
74
|
+
class={props.disabled ? disabledClasses.value : classes.value}
|
|
75
|
+
disabled={props.disabled}
|
|
76
|
+
>
|
|
63
77
|
{slots.default?.() || props.text}
|
|
64
78
|
</button>
|
|
65
79
|
)
|