@nmorph/nmorph-ui-kit 2.2.24 → 2.2.25
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/dist/components/data/nmorph-badge/NmorphBadge.css +1 -1
- package/dist/components/data/nmorph-badge/NmorphBadge.vue.js +18 -18
- package/dist/components/data/nmorph-badge/NmorphBadge.vue2.js +35 -33
- package/dist/index.umd.js +6 -6
- package/dist/package.json.js +1 -1
- package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +7 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.nmorph-badge{position:relative;display:inline-block;height:fit-content;--dot-size: 4px;--nmorph-badge-ribbon-height: 24px;--nmorph-badge-ribbon-corner-size: 62px;--nmorph-badge-ribbon-width: 116px;--nmorph-badge-ribbon-offset-x: 0px;--nmorph-badge-ribbon-offset-y: 0px}.nmorph-badge .nmorph-badge__container{position:absolute;display:inline-flex;justify-content:center;align-items:center;background:var(--nmorph-badge-color);border-radius:var(--default-border-radius);opacity:1}.nmorph-badge.nmorph-badge--tag{position:static;display:inline-flex}.nmorph-badge .nmorph-badge__container--tag{position:static}.nmorph-badge .nmorph-badge__content{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;min-width:calc(1em * var(--line-height-regular) + 4px);padding:2px 4px;color:var(--nmorph-light-shade-color);font-size:var(--font-size-base);line-height:var(--line-height-regular);text-align:center}.nmorph-badge.nmorph-badge--tiny .nmorph-badge__content{font-size:var(--font-size-tiny)}.nmorph-badge.nmorph-badge--extra-small .nmorph-badge__content{font-size:var(--font-size-extra-small)}.nmorph-badge .nmorph-badge__container--hidden{opacity:0}.nmorph-badge .nmorph-badge__ribbon-frame{position:absolute;inset:0;overflow:hidden;border-radius:var(--default-border-radius);pointer-events:none}.nmorph-badge .nmorph-badge__ribbon-corner{position:absolute;width:var(--nmorph-badge-ribbon-corner-size);height:var(--nmorph-badge-ribbon-corner-size)}.nmorph-badge .nmorph-badge__container--ribbon{top:50%;left:50%;width:var(--nmorph-badge-ribbon-width);height:var(--nmorph-badge-ribbon-height);border-radius:0;box-shadow:var(--nmorph-shadow-outset)}.nmorph-badge .nmorph-badge__container--ribbon .nmorph-badge__content{width:100%;min-width:0;padding:0 var(--indentation-03);overflow:hidden;font-weight:600;font-size:var(--font-size-extra-small);white-space:nowrap;text-overflow:ellipsis;transform:translateY(-1px)}.nmorph-badge .nmorph-badge__ribbon-corner--top-left{top:var(--nmorph-badge-ribbon-offset-y);left:var(--nmorph-badge-ribbon-offset-x)}.nmorph-badge .nmorph-badge__ribbon-corner--top-left .nmorph-badge__container--ribbon{transform:translate(-50%,-50%) rotate(-45deg)}.nmorph-badge .nmorph-badge__ribbon-corner--top-right{top:var(--nmorph-badge-ribbon-offset-y);right:var(--nmorph-badge-ribbon-offset-x)}.nmorph-badge .nmorph-badge__ribbon-corner--top-right .nmorph-badge__container--ribbon{transform:translate(-50%,-50%) rotate(45deg)}.nmorph-badge .nmorph-badge__ribbon-corner--bottom-left{bottom:var(--nmorph-badge-ribbon-offset-y);left:var(--nmorph-badge-ribbon-offset-x)}.nmorph-badge .nmorph-badge__ribbon-corner--bottom-left .nmorph-badge__container--ribbon{transform:translate(-50%,-50%) rotate(45deg)}.nmorph-badge .nmorph-badge__ribbon-corner--bottom-right{right:var(--nmorph-badge-ribbon-offset-x);bottom:var(--nmorph-badge-ribbon-offset-y)}.nmorph-badge .nmorph-badge__ribbon-corner--bottom-right .nmorph-badge__container--ribbon{transform:translate(-50%,-50%) rotate(-45deg)}.nmorph-badge .nmorph-badge__dot{width:var(--dot-size);height:var(--dot-size);border-radius:var(--border-radius-circular)}.nmorph-badge.nmorph-badge--tiny{--nmorph-badge-ribbon-height: 18px;--nmorph-badge-ribbon-corner-size: 50px;--nmorph-badge-ribbon-width: 92px}.nmorph-badge.nmorph-badge--extra-small{--nmorph-badge-ribbon-height: 20px;--nmorph-badge-ribbon-corner-size: 56px;--nmorph-badge-ribbon-width: 104px}
|
|
1
|
+
.nmorph-badge{position:relative;display:inline-block;height:fit-content;--nmorph-badge-dot-size: 4px;--nmorph-badge-ribbon-height: 24px;--nmorph-badge-ribbon-corner-size: 62px;--nmorph-badge-ribbon-width: 116px;--nmorph-badge-ribbon-offset-x: 0px;--nmorph-badge-ribbon-offset-y: 0px}.nmorph-badge .nmorph-badge__container{position:absolute;display:inline-flex;justify-content:center;align-items:center;background:var(--nmorph-badge-color);border-radius:var(--default-border-radius);opacity:1}.nmorph-badge.nmorph-badge--tag{position:static;display:inline-flex}.nmorph-badge .nmorph-badge__container--tag{position:static}.nmorph-badge .nmorph-badge__content{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;min-width:calc(1em * var(--line-height-regular) + 4px);padding:2px 4px;color:var(--nmorph-light-shade-color);font-size:var(--font-size-base);line-height:var(--line-height-regular);text-align:center}.nmorph-badge.nmorph-badge--tiny .nmorph-badge__content{font-size:var(--font-size-tiny)}.nmorph-badge.nmorph-badge--extra-small .nmorph-badge__content{font-size:var(--font-size-extra-small)}.nmorph-badge .nmorph-badge__container--hidden{opacity:0}.nmorph-badge .nmorph-badge__ribbon-frame{position:absolute;inset:0;overflow:hidden;border-radius:var(--default-border-radius);pointer-events:none}.nmorph-badge .nmorph-badge__ribbon-corner{position:absolute;width:var(--nmorph-badge-ribbon-corner-size);height:var(--nmorph-badge-ribbon-corner-size)}.nmorph-badge .nmorph-badge__container--ribbon{top:50%;left:50%;width:var(--nmorph-badge-ribbon-width);height:var(--nmorph-badge-ribbon-height);border-radius:0;box-shadow:var(--nmorph-shadow-outset)}.nmorph-badge .nmorph-badge__container--ribbon .nmorph-badge__content{width:100%;min-width:0;padding:0 var(--indentation-03);overflow:hidden;font-weight:600;font-size:var(--font-size-extra-small);white-space:nowrap;text-overflow:ellipsis;transform:translateY(-1px)}.nmorph-badge .nmorph-badge__ribbon-corner--top-left{top:var(--nmorph-badge-ribbon-offset-y);left:var(--nmorph-badge-ribbon-offset-x)}.nmorph-badge .nmorph-badge__ribbon-corner--top-left .nmorph-badge__container--ribbon{transform:translate(-50%,-50%) rotate(-45deg)}.nmorph-badge .nmorph-badge__ribbon-corner--top-right{top:var(--nmorph-badge-ribbon-offset-y);right:var(--nmorph-badge-ribbon-offset-x)}.nmorph-badge .nmorph-badge__ribbon-corner--top-right .nmorph-badge__container--ribbon{transform:translate(-50%,-50%) rotate(45deg)}.nmorph-badge .nmorph-badge__ribbon-corner--bottom-left{bottom:var(--nmorph-badge-ribbon-offset-y);left:var(--nmorph-badge-ribbon-offset-x)}.nmorph-badge .nmorph-badge__ribbon-corner--bottom-left .nmorph-badge__container--ribbon{transform:translate(-50%,-50%) rotate(45deg)}.nmorph-badge .nmorph-badge__ribbon-corner--bottom-right{right:var(--nmorph-badge-ribbon-offset-x);bottom:var(--nmorph-badge-ribbon-offset-y)}.nmorph-badge .nmorph-badge__ribbon-corner--bottom-right .nmorph-badge__container--ribbon{transform:translate(-50%,-50%) rotate(-45deg)}.nmorph-badge .nmorph-badge__dot{width:var(--nmorph-badge-dot-size);height:var(--nmorph-badge-dot-size);border-radius:var(--border-radius-circular)}.nmorph-badge.nmorph-badge--tiny{--nmorph-badge-ribbon-height: 18px;--nmorph-badge-ribbon-corner-size: 50px;--nmorph-badge-ribbon-width: 92px}.nmorph-badge.nmorph-badge--extra-small{--nmorph-badge-ribbon-height: 20px;--nmorph-badge-ribbon-corner-size: 56px;--nmorph-badge-ribbon-width: 104px}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './NmorphBadge.css';
|
|
2
|
-
import
|
|
3
|
-
import { openBlock as o, createElementBlock as a, normalizeStyle as
|
|
2
|
+
import c from "./NmorphBadge.vue2.js";
|
|
3
|
+
import { openBlock as o, createElementBlock as a, normalizeStyle as r, normalizeClass as i, renderSlot as d, createCommentVNode as s, createElementVNode as n, createTextVNode as t, toDisplayString as y, Fragment as m } from "vue";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import f from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
6
6
|
const _ = { class: "nmorph-badge__content" }, b = {
|
|
@@ -10,22 +10,22 @@ const _ = { class: "nmorph-badge__content" }, b = {
|
|
|
10
10
|
key: 1,
|
|
11
11
|
class: "nmorph-badge__content"
|
|
12
12
|
};
|
|
13
|
-
function h(
|
|
14
|
-
return !e.props.disabled && (!e.
|
|
13
|
+
function h(l, v, p, e, k, T) {
|
|
14
|
+
return !e.props.disabled && (!e.isTagType || e.shouldShowBadge) ? (o(), a(
|
|
15
15
|
"div",
|
|
16
16
|
{
|
|
17
17
|
key: 0,
|
|
18
18
|
class: i(e.modifiers),
|
|
19
|
-
style:
|
|
19
|
+
style: r(e.styles)
|
|
20
20
|
},
|
|
21
21
|
[
|
|
22
|
-
e.
|
|
22
|
+
e.isTagType ? s("v-if", !0) : d(l.$slots, "default", { key: 0 }),
|
|
23
23
|
e.shouldShowBadge && e.isRibbon ? (o(), a(
|
|
24
24
|
"div",
|
|
25
25
|
{
|
|
26
26
|
key: 1,
|
|
27
27
|
class: "nmorph-badge__ribbon-frame",
|
|
28
|
-
style:
|
|
28
|
+
style: r(e.ribbonFrameStyle)
|
|
29
29
|
},
|
|
30
30
|
[
|
|
31
31
|
n(
|
|
@@ -39,16 +39,16 @@ function h(r, p, v, e, k, V) {
|
|
|
39
39
|
{
|
|
40
40
|
ref: "badge",
|
|
41
41
|
class: i(e.containerModifiers),
|
|
42
|
-
style:
|
|
42
|
+
style: r(e.containerStyle)
|
|
43
43
|
},
|
|
44
44
|
[
|
|
45
45
|
n("div", _, [
|
|
46
|
-
|
|
46
|
+
d(l.$slots, "value", {
|
|
47
47
|
value: e.props.value,
|
|
48
48
|
displayValue: e.displayValue
|
|
49
49
|
}, () => [
|
|
50
50
|
t(
|
|
51
|
-
|
|
51
|
+
y(e.displayValue),
|
|
52
52
|
1
|
|
53
53
|
/* TEXT */
|
|
54
54
|
)
|
|
@@ -71,29 +71,29 @@ function h(r, p, v, e, k, V) {
|
|
|
71
71
|
key: 2,
|
|
72
72
|
ref: "badge",
|
|
73
73
|
class: i(e.containerModifiers),
|
|
74
|
-
style:
|
|
74
|
+
style: r(e.containerStyle)
|
|
75
75
|
},
|
|
76
76
|
[
|
|
77
77
|
e.isDotType ? (o(), a("div", b)) : (o(), a("div", g, [
|
|
78
|
-
e.
|
|
78
|
+
e.isTagType ? (o(), a(
|
|
79
79
|
m,
|
|
80
80
|
{ key: 0 },
|
|
81
81
|
[
|
|
82
82
|
t(
|
|
83
|
-
|
|
83
|
+
y(e.displayValue),
|
|
84
84
|
1
|
|
85
85
|
/* TEXT */
|
|
86
86
|
)
|
|
87
87
|
],
|
|
88
88
|
64
|
|
89
89
|
/* STABLE_FRAGMENT */
|
|
90
|
-
)) :
|
|
90
|
+
)) : d(l.$slots, "value", {
|
|
91
91
|
key: 1,
|
|
92
92
|
value: e.props.value,
|
|
93
93
|
displayValue: e.displayValue
|
|
94
94
|
}, () => [
|
|
95
95
|
t(
|
|
96
|
-
|
|
96
|
+
y(e.displayValue),
|
|
97
97
|
1
|
|
98
98
|
/* TEXT */
|
|
99
99
|
)
|
|
@@ -102,13 +102,13 @@ function h(r, p, v, e, k, V) {
|
|
|
102
102
|
],
|
|
103
103
|
6
|
|
104
104
|
/* CLASS, STYLE */
|
|
105
|
-
)) :
|
|
105
|
+
)) : s("v-if", !0)
|
|
106
106
|
],
|
|
107
107
|
6
|
|
108
108
|
/* CLASS, STYLE */
|
|
109
|
-
)) : e.
|
|
109
|
+
)) : e.isTagType ? s("v-if", !0) : d(l.$slots, "default", { key: 1 });
|
|
110
110
|
}
|
|
111
|
-
const w = /* @__PURE__ */ f(
|
|
111
|
+
const w = /* @__PURE__ */ f(c, [["render", h], ["__file", "/builds/ketjo/nmorph/library/src/components/data/nmorph-badge/NmorphBadge.vue"]]);
|
|
112
112
|
export {
|
|
113
113
|
w as default
|
|
114
114
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './NmorphBadge.css';
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
const
|
|
2
|
+
import { defineComponent as C, computed as t, ref as b, onMounted as B, watch as I, nextTick as T } from "vue";
|
|
3
|
+
import { useModifiers as p } from "../../../utils/create-modifiers.js";
|
|
4
|
+
const X = /* @__PURE__ */ C({
|
|
5
5
|
__name: "NmorphBadge",
|
|
6
6
|
props: {
|
|
7
7
|
value: { type: [Number, String], required: !1, default: void 0 },
|
|
@@ -19,56 +19,58 @@ const H = /* @__PURE__ */ T({
|
|
|
19
19
|
disabled: { type: Boolean, required: !1, default: !1 },
|
|
20
20
|
dotSize: { type: [Number, String], required: !1, default: void 0 }
|
|
21
21
|
},
|
|
22
|
-
setup(
|
|
23
|
-
|
|
24
|
-
const e =
|
|
25
|
-
() =>
|
|
22
|
+
setup(m, { expose: g }) {
|
|
23
|
+
g();
|
|
24
|
+
const e = m, a = t(() => e.type !== "default" ? e.type : e.isDot ? "dot" : e.isTag ? "tag" : "default"), c = t(() => a.value === "dot"), n = t(() => a.value === "tag"), r = t(() => a.value === "ribbon"), y = t(
|
|
25
|
+
() => p({
|
|
26
26
|
"nmorph-badge": [
|
|
27
27
|
`${e.hidden && "hidden"}`,
|
|
28
|
-
`${
|
|
29
|
-
`${
|
|
30
|
-
`${
|
|
28
|
+
`${n.value && "tag"}`,
|
|
29
|
+
`${r.value && "ribbon"}`,
|
|
30
|
+
`${r.value && `ribbon-${e.ribbonCorner}`}`,
|
|
31
31
|
e.size
|
|
32
32
|
]
|
|
33
33
|
})
|
|
34
|
-
),
|
|
35
|
-
() =>
|
|
34
|
+
), h = t(
|
|
35
|
+
() => p({
|
|
36
36
|
"nmorph-badge__container": [
|
|
37
37
|
`${e.hidden && "hidden"}`,
|
|
38
|
-
`${
|
|
39
|
-
`${
|
|
40
|
-
`${
|
|
38
|
+
`${n.value && "tag"}`,
|
|
39
|
+
`${r.value && "ribbon"}`,
|
|
40
|
+
`${r.value && `ribbon-${e.ribbonCorner}`}`
|
|
41
41
|
]
|
|
42
42
|
})
|
|
43
|
-
), x =
|
|
44
|
-
() =>
|
|
43
|
+
), x = t(
|
|
44
|
+
() => p({
|
|
45
45
|
"nmorph-badge__ribbon-corner": [`${e.ribbonCorner}`]
|
|
46
46
|
})
|
|
47
|
-
),
|
|
48
|
-
const
|
|
47
|
+
), z = t(() => typeof Number(e.value) == "number" && Number(e.value) > e.max ? `${e.max}+` : e.value), S = t(() => c.value || e.value !== void 0), d = t(() => {
|
|
48
|
+
const o = `${(l?.value / 2 + e.offsetX) * -1}px`, N = `${(s?.value / 2 + e.offsetY) * -1}px`;
|
|
49
49
|
return {
|
|
50
|
-
x:
|
|
51
|
-
y:
|
|
50
|
+
x: o,
|
|
51
|
+
y: N
|
|
52
52
|
};
|
|
53
|
-
}),
|
|
53
|
+
}), $ = t(() => n.value || r.value ? {
|
|
54
54
|
zIndex: e.zIndex
|
|
55
55
|
} : {
|
|
56
|
-
right:
|
|
57
|
-
top:
|
|
56
|
+
right: d.value.x,
|
|
57
|
+
top: d.value.y,
|
|
58
58
|
zIndex: e.zIndex
|
|
59
|
-
}),
|
|
59
|
+
}), i = (o) => typeof o == "number" ? `${o}px` : o, u = b(null), l = b(0), s = b(0), q = t(() => ({
|
|
60
60
|
"--nmorph-badge-color": e.color,
|
|
61
|
-
...e.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
61
|
+
...e.offsetX !== 0 && { "--nmorph-badge-ribbon-offset-x": i(e.offsetX) },
|
|
62
|
+
...e.offsetY !== 0 && { "--nmorph-badge-ribbon-offset-y": i(e.offsetY) },
|
|
63
|
+
...e.dotSize !== void 0 && { "--nmorph-badge-dot-size": i(e.dotSize) }
|
|
64
|
+
})), f = async () => {
|
|
65
|
+
await T(), !(!u.value || n.value || r.value) && (l.value = u.value.clientWidth, s.value = u.value.clientHeight);
|
|
66
|
+
}, _ = t(() => ({
|
|
65
67
|
zIndex: e.zIndex
|
|
66
68
|
}));
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
return Object.defineProperty(
|
|
69
|
+
B(f), I(() => [e.value, e.max, a.value, e.ribbonCorner, e.size], f);
|
|
70
|
+
const v = { props: e, resolvedType: a, isDotType: c, isTagType: n, isRibbon: r, modifiers: y, containerModifiers: h, ribbonCornerModifiers: x, displayValue: z, shouldShowBadge: S, appliedOffset: d, containerStyle: $, getCssSize: i, badge: u, badgeWidth: l, badgeHeight: s, styles: q, updateBadgeSize: f, ribbonFrameStyle: _ };
|
|
71
|
+
return Object.defineProperty(v, "__isScriptSetup", { enumerable: !1, value: !0 }), v;
|
|
70
72
|
}
|
|
71
73
|
});
|
|
72
74
|
export {
|
|
73
|
-
|
|
75
|
+
X as default
|
|
74
76
|
};
|