@aotearoan/neon 28.1.0 → 28.1.2
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/presentation/header/NeonHeader.vue.cjs.js +1 -1
- package/dist/components/presentation/header/NeonHeader.vue.cjs.js.map +1 -1
- package/dist/components/presentation/header/NeonHeader.vue.es.js +12 -10
- package/dist/components/presentation/header/NeonHeader.vue.es.js.map +1 -1
- package/dist/components/user-input/field/NeonField.cjs.js +1 -1
- package/dist/components/user-input/field/NeonField.cjs.js.map +1 -1
- package/dist/components/user-input/field/NeonField.es.js +1 -1
- package/dist/components/user-input/field/NeonField.es.js.map +1 -1
- package/dist/components/user-input/field/NeonField.vue.cjs.js +1 -1
- package/dist/components/user-input/field/NeonField.vue.cjs.js.map +1 -1
- package/dist/components/user-input/field/NeonField.vue.es.js +14 -13
- package/dist/components/user-input/field/NeonField.vue.es.js.map +1 -1
- package/dist/components/user-input/number/NeonNumber.cjs.js +1 -1
- package/dist/components/user-input/number/NeonNumber.cjs.js.map +1 -1
- package/dist/components/user-input/number/NeonNumber.es.js +23 -26
- package/dist/components/user-input/number/NeonNumber.es.js.map +1 -1
- package/dist/src/components/user-input/field/NeonField.d.ts +0 -2
- package/package.json +1 -1
- package/src/sass/components/_button.scss +17 -17
- package/src/sass/components/_header.scss +1 -1
- package/src/sass/components/_input.scss +5 -1
- package/src/sass/components/_skeleton-loader.scss +1 -1
- package/src/sass/variables-global.scss +4 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const l=require("./NeonHeader.cjs.js"),e=require("vue"),r=require("../../../_virtual/_plugin-vue_export-helper.cjs.js"),s={key:0,class:"neon-header__subtitle"};function c(t,u,i,p,b,_){const a=e.resolveComponent("neon-breadcrumbs"),o=e.resolveComponent("neon-inline"),n=e.resolveComponent("neon-stack");return e.openBlock(),e.createBlock(n,{class:e.normalizeClass([`neon-header--${t.level}`,"neon-header"])},{default:e.withCtx(()=>[t.level===t.NeonHeaderLevel.Page&&(t.backButton||t.breadcrumbs.length!==0)?(e.openBlock(),e.createBlock(a,{key:0,"back-button":t.backButton,"back-label":t.backLabel,breadcrumbs:t.breadcrumbs},null,8,["back-button","back-label","breadcrumbs"])):e.createCommentVNode("",!0),e.createVNode(o,{class:"neon-header__content"},{default:e.withCtx(()=>[e.createVNode(n,{class:"neon-header__content-copy",gap:"s"},{default:e.withCtx(()=>[e.createVNode(o,{class:"neon-header__title-wrapper",gap:"m"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.titleLevel),{class:"neon-header__title"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1})),t.slots.labels?(e.openBlock(),e.createBlock(o,{key:0,class:"neon-header__labels",gap:"m"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"labels")]),_:3})):e.createCommentVNode("",!0)]),_:3}),t.subtitle?(e.openBlock(),e.createElementBlock("span",s,e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)]),_:3}),t.slots.actions?(e.openBlock(),e.createBlock(o,{key:0,class:"neon-header__actions",gap:"s"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"actions")]),_:3})):e.createCommentVNode("",!0)]),_:3})]),_:3},8,["class"])}const d=r(l,[["render",c]]);module.exports=d;
|
|
1
|
+
"use strict";const l=require("./NeonHeader.cjs.js"),e=require("vue"),r=require("../../../_virtual/_plugin-vue_export-helper.cjs.js"),s={key:0,class:"neon-header__subtitle"};function c(t,u,i,p,b,_){const a=e.resolveComponent("neon-breadcrumbs"),o=e.resolveComponent("neon-inline"),n=e.resolveComponent("neon-stack");return e.openBlock(),e.createBlock(n,{class:e.normalizeClass([`neon-header--${t.level}`,"neon-header"])},{default:e.withCtx(()=>[t.level===t.NeonHeaderLevel.Page&&(t.backButton||t.breadcrumbs.length!==0)?(e.openBlock(),e.createBlock(a,{key:0,"back-button":t.backButton,"back-label":t.backLabel,breadcrumbs:t.breadcrumbs},null,8,["back-button","back-label","breadcrumbs"])):e.createCommentVNode("",!0),e.createVNode(o,{class:"neon-header__content"},{default:e.withCtx(()=>[e.createVNode(n,{class:"neon-header__content-copy",gap:"s"},{default:e.withCtx(()=>[e.createVNode(o,{class:"neon-header__title-wrapper",gap:"m"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.titleLevel),{class:"neon-header__title"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1})),t.slots.labels?(e.openBlock(),e.createBlock(o,{key:0,class:"neon-header__labels",gap:"m"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"labels")]),_:3})):e.createCommentVNode("",!0)]),_:3}),e.renderSlot(t.$slots,"subtitle",{},()=>[t.subtitle?(e.openBlock(),e.createElementBlock("span",s,e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)])]),_:3}),t.slots.actions?(e.openBlock(),e.createBlock(o,{key:0,class:"neon-header__actions",gap:"s"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"actions")]),_:3})):e.createCommentVNode("",!0)]),_:3})]),_:3},8,["class"])}const d=r(l,[["render",c]]);module.exports=d;
|
|
2
2
|
//# sourceMappingURL=NeonHeader.vue.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonHeader.vue.cjs.js","sources":["../../../../src/components/presentation/header/NeonHeader.vue"],"sourcesContent":["<template>\n <neon-stack :class=\"`neon-header--${level}`\" class=\"neon-header\">\n <neon-breadcrumbs\n v-if=\"level === NeonHeaderLevel.Page && (backButton || breadcrumbs.length !== 0)\"\n :back-button=\"backButton\"\n :back-label=\"backLabel\"\n :breadcrumbs=\"breadcrumbs\"\n />\n <neon-inline class=\"neon-header__content\">\n <neon-stack class=\"neon-header__content-copy\" gap=\"s\">\n <neon-inline class=\"neon-header__title-wrapper\" gap=\"m\">\n <component :is=\"titleLevel\" class=\"neon-header__title\">{{ title }}</component>\n <neon-inline v-if=\"slots.labels\" class=\"neon-header__labels\" gap=\"m\">\n <!-- @slot a slot for adding labels/info popovers next to the title. NOTE: these are rendered in reverse order on mobile -->\n <slot name=\"labels\"></slot>\n </neon-inline>\n </neon-inline>\n <span v-if=\"subtitle\" class=\"neon-header__subtitle\">{{ subtitle }}</span>\n </neon-stack>\n <neon-inline v-if=\"slots.actions\" class=\"neon-header__actions\" gap=\"s\">\n <!-- @slot a slot for adding contextual action buttons to the header. The wrapper is provided, just add the buttons here in order to apply the correct spacings -->\n <slot name=\"actions\"></slot>\n </neon-inline>\n </neon-inline>\n </neon-stack>\n</template>\n\n<script lang=\"ts\" src=\"./NeonHeader.ts\" />\n"],"names":["_createBlock","_component_neon_stack","_normalizeClass","_ctx","_component_neon_breadcrumbs","_createVNode","_component_neon_inline","_openBlock","_resolveDynamicComponent","_renderSlot","_createElementBlock","_hoisted_1","_toDisplayString"],"mappings":"
|
|
1
|
+
{"version":3,"file":"NeonHeader.vue.cjs.js","sources":["../../../../src/components/presentation/header/NeonHeader.vue"],"sourcesContent":["<template>\n <neon-stack :class=\"`neon-header--${level}`\" class=\"neon-header\">\n <neon-breadcrumbs\n v-if=\"level === NeonHeaderLevel.Page && (backButton || breadcrumbs.length !== 0)\"\n :back-button=\"backButton\"\n :back-label=\"backLabel\"\n :breadcrumbs=\"breadcrumbs\"\n />\n <neon-inline class=\"neon-header__content\">\n <neon-stack class=\"neon-header__content-copy\" gap=\"s\">\n <neon-inline class=\"neon-header__title-wrapper\" gap=\"m\">\n <component :is=\"titleLevel\" class=\"neon-header__title\">{{ title }}</component>\n <neon-inline v-if=\"slots.labels\" class=\"neon-header__labels\" gap=\"m\">\n <!-- @slot a slot for adding labels/info popovers next to the title. NOTE: these are rendered in reverse order on mobile -->\n <slot name=\"labels\"></slot>\n </neon-inline>\n </neon-inline>\n <!-- @slot a slot for overriding the default subtitle styling and proving richer content -->\n <slot name=\"subtitle\">\n <span v-if=\"subtitle\" class=\"neon-header__subtitle\">{{ subtitle }}</span>\n </slot>\n </neon-stack>\n <neon-inline v-if=\"slots.actions\" class=\"neon-header__actions\" gap=\"s\">\n <!-- @slot a slot for adding contextual action buttons to the header. The wrapper is provided, just add the buttons here in order to apply the correct spacings -->\n <slot name=\"actions\"></slot>\n </neon-inline>\n </neon-inline>\n </neon-stack>\n</template>\n\n<script lang=\"ts\" src=\"./NeonHeader.ts\" />\n"],"names":["_createBlock","_component_neon_stack","_normalizeClass","_ctx","_component_neon_breadcrumbs","_createVNode","_component_neon_inline","_openBlock","_resolveDynamicComponent","_renderSlot","_createElementBlock","_hoisted_1","_toDisplayString"],"mappings":"8IAmBgC,MAAM,4LAlBpCA,EAAAA,YA0BaC,EAAA,CA1BA,MAAKC,EAAAA,eAAA,CAAA,gBAAkBC,EAAA,KAAK,GAAU,aAAa,CAAA,sBAC9D,IAKE,CAJMA,EAAA,QAAUA,kBAAgB,OAASA,EAAA,YAAcA,EAAA,YAAY,SAAM,kBAD3EH,EAAAA,YAKEI,EAAA,OAHC,cAAaD,EAAA,WACb,aAAYA,EAAA,UACZ,YAAaA,EAAA,6FAEhBE,EAAAA,YAkBcC,EAAA,CAlBD,MAAM,sBAAsB,EAAA,mBACvC,IAYa,CAZbD,EAAAA,YAYaJ,EAAA,CAZD,MAAM,4BAA4B,IAAI,wBAChD,IAMc,CANdI,EAAAA,YAMcC,EAAA,CAND,MAAM,6BAA6B,IAAI,wBAClD,IAA8E,EAA9EC,YAAA,EAAAP,EAAAA,YAA8EQ,0BAA9DL,EAAA,UAAU,EAAA,CAAE,MAAM,sBAAoB,mBAAC,IAAW,qCAARA,EAAA,KAAK,EAAA,CAAA,WAC5CA,EAAA,MAAM,sBAAzBH,EAAAA,YAGcM,EAAA,OAHmB,MAAM,sBAAsB,IAAI,wBAE/D,IAA2B,CAA3BG,aAA2BN,EAAA,OAAA,QAAA,+CAI/BM,EAAAA,WAEON,uBAFP,IAEO,CADOA,EAAA,wBAAZO,EAAAA,mBAAyE,OAAzEC,EAAyEC,EAAAA,gBAAlBT,EAAA,QAAQ,EAAA,CAAA,yCAGhDA,EAAA,MAAM,uBAAzBH,EAAAA,YAGcM,EAAA,OAHoB,MAAM,uBAAuB,IAAI,wBAEjE,IAA4B,CAA5BG,aAA4BN,EAAA,OAAA,SAAA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import i from "./NeonHeader.es.js";
|
|
2
|
-
import { resolveComponent as l, openBlock as a, createBlock as o, normalizeClass as m, withCtx as n, createCommentVNode as s, createVNode as r, resolveDynamicComponent as p, createTextVNode as _, toDisplayString as
|
|
2
|
+
import { resolveComponent as l, openBlock as a, createBlock as o, normalizeClass as m, withCtx as n, createCommentVNode as s, createVNode as r, resolveDynamicComponent as p, createTextVNode as _, toDisplayString as b, renderSlot as c, createElementBlock as k } from "vue";
|
|
3
3
|
import f from "../../../_virtual/_plugin-vue_export-helper.es.js";
|
|
4
4
|
const h = {
|
|
5
5
|
key: 0,
|
|
6
6
|
class: "neon-header__subtitle"
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
const u = l("neon-breadcrumbs"), t = l("neon-inline"),
|
|
10
|
-
return a(), o(
|
|
8
|
+
function $(e, g, y, v, B, C) {
|
|
9
|
+
const u = l("neon-breadcrumbs"), t = l("neon-inline"), d = l("neon-stack");
|
|
10
|
+
return a(), o(d, {
|
|
11
11
|
class: m([`neon-header--${e.level}`, "neon-header"])
|
|
12
12
|
}, {
|
|
13
13
|
default: n(() => [
|
|
@@ -19,7 +19,7 @@ function g(e, y, $, v, B, C) {
|
|
|
19
19
|
}, null, 8, ["back-button", "back-label", "breadcrumbs"])) : s("", !0),
|
|
20
20
|
r(t, { class: "neon-header__content" }, {
|
|
21
21
|
default: n(() => [
|
|
22
|
-
r(
|
|
22
|
+
r(d, {
|
|
23
23
|
class: "neon-header__content-copy",
|
|
24
24
|
gap: "s"
|
|
25
25
|
}, {
|
|
@@ -31,7 +31,7 @@ function g(e, y, $, v, B, C) {
|
|
|
31
31
|
default: n(() => [
|
|
32
32
|
(a(), o(p(e.titleLevel), { class: "neon-header__title" }, {
|
|
33
33
|
default: n(() => [
|
|
34
|
-
_(
|
|
34
|
+
_(b(e.title), 1)
|
|
35
35
|
]),
|
|
36
36
|
_: 1
|
|
37
37
|
})),
|
|
@@ -41,14 +41,16 @@ function g(e, y, $, v, B, C) {
|
|
|
41
41
|
gap: "m"
|
|
42
42
|
}, {
|
|
43
43
|
default: n(() => [
|
|
44
|
-
|
|
44
|
+
c(e.$slots, "labels")
|
|
45
45
|
]),
|
|
46
46
|
_: 3
|
|
47
47
|
})) : s("", !0)
|
|
48
48
|
]),
|
|
49
49
|
_: 3
|
|
50
50
|
}),
|
|
51
|
-
e
|
|
51
|
+
c(e.$slots, "subtitle", {}, () => [
|
|
52
|
+
e.subtitle ? (a(), k("span", h, b(e.subtitle), 1)) : s("", !0)
|
|
53
|
+
])
|
|
52
54
|
]),
|
|
53
55
|
_: 3
|
|
54
56
|
}),
|
|
@@ -58,7 +60,7 @@ function g(e, y, $, v, B, C) {
|
|
|
58
60
|
gap: "s"
|
|
59
61
|
}, {
|
|
60
62
|
default: n(() => [
|
|
61
|
-
|
|
63
|
+
c(e.$slots, "actions")
|
|
62
64
|
]),
|
|
63
65
|
_: 3
|
|
64
66
|
})) : s("", !0)
|
|
@@ -69,7 +71,7 @@ function g(e, y, $, v, B, C) {
|
|
|
69
71
|
_: 3
|
|
70
72
|
}, 8, ["class"]);
|
|
71
73
|
}
|
|
72
|
-
const w = /* @__PURE__ */ f(i, [["render",
|
|
74
|
+
const w = /* @__PURE__ */ f(i, [["render", $]]);
|
|
73
75
|
export {
|
|
74
76
|
w as default
|
|
75
77
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonHeader.vue.es.js","sources":["../../../../src/components/presentation/header/NeonHeader.vue"],"sourcesContent":["<template>\n <neon-stack :class=\"`neon-header--${level}`\" class=\"neon-header\">\n <neon-breadcrumbs\n v-if=\"level === NeonHeaderLevel.Page && (backButton || breadcrumbs.length !== 0)\"\n :back-button=\"backButton\"\n :back-label=\"backLabel\"\n :breadcrumbs=\"breadcrumbs\"\n />\n <neon-inline class=\"neon-header__content\">\n <neon-stack class=\"neon-header__content-copy\" gap=\"s\">\n <neon-inline class=\"neon-header__title-wrapper\" gap=\"m\">\n <component :is=\"titleLevel\" class=\"neon-header__title\">{{ title }}</component>\n <neon-inline v-if=\"slots.labels\" class=\"neon-header__labels\" gap=\"m\">\n <!-- @slot a slot for adding labels/info popovers next to the title. NOTE: these are rendered in reverse order on mobile -->\n <slot name=\"labels\"></slot>\n </neon-inline>\n </neon-inline>\n <span v-if=\"subtitle\" class=\"neon-header__subtitle\">{{ subtitle }}</span>\n </neon-stack>\n <neon-inline v-if=\"slots.actions\" class=\"neon-header__actions\" gap=\"s\">\n <!-- @slot a slot for adding contextual action buttons to the header. The wrapper is provided, just add the buttons here in order to apply the correct spacings -->\n <slot name=\"actions\"></slot>\n </neon-inline>\n </neon-inline>\n </neon-stack>\n</template>\n\n<script lang=\"ts\" src=\"./NeonHeader.ts\" />\n"],"names":["_createBlock","_component_neon_stack","_normalizeClass","_ctx","_component_neon_breadcrumbs","_createVNode","_component_neon_inline","_openBlock","_resolveDynamicComponent","_renderSlot","_createElementBlock","_hoisted_1","_toDisplayString"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"NeonHeader.vue.es.js","sources":["../../../../src/components/presentation/header/NeonHeader.vue"],"sourcesContent":["<template>\n <neon-stack :class=\"`neon-header--${level}`\" class=\"neon-header\">\n <neon-breadcrumbs\n v-if=\"level === NeonHeaderLevel.Page && (backButton || breadcrumbs.length !== 0)\"\n :back-button=\"backButton\"\n :back-label=\"backLabel\"\n :breadcrumbs=\"breadcrumbs\"\n />\n <neon-inline class=\"neon-header__content\">\n <neon-stack class=\"neon-header__content-copy\" gap=\"s\">\n <neon-inline class=\"neon-header__title-wrapper\" gap=\"m\">\n <component :is=\"titleLevel\" class=\"neon-header__title\">{{ title }}</component>\n <neon-inline v-if=\"slots.labels\" class=\"neon-header__labels\" gap=\"m\">\n <!-- @slot a slot for adding labels/info popovers next to the title. NOTE: these are rendered in reverse order on mobile -->\n <slot name=\"labels\"></slot>\n </neon-inline>\n </neon-inline>\n <!-- @slot a slot for overriding the default subtitle styling and proving richer content -->\n <slot name=\"subtitle\">\n <span v-if=\"subtitle\" class=\"neon-header__subtitle\">{{ subtitle }}</span>\n </slot>\n </neon-stack>\n <neon-inline v-if=\"slots.actions\" class=\"neon-header__actions\" gap=\"s\">\n <!-- @slot a slot for adding contextual action buttons to the header. The wrapper is provided, just add the buttons here in order to apply the correct spacings -->\n <slot name=\"actions\"></slot>\n </neon-inline>\n </neon-inline>\n </neon-stack>\n</template>\n\n<script lang=\"ts\" src=\"./NeonHeader.ts\" />\n"],"names":["_createBlock","_component_neon_stack","_normalizeClass","_ctx","_component_neon_breadcrumbs","_createVNode","_component_neon_inline","_openBlock","_resolveDynamicComponent","_renderSlot","_createElementBlock","_hoisted_1","_toDisplayString"],"mappings":";;;;;EAmBgC,OAAM;;;;cAlBpCA,EA0BaC,GAAA;AAAA,IA1BA,OAAKC,EAAA,CAAA,gBAAkBC,EAAA,KAAK,IAAU,aAAa,CAAA;AAAA;eAC9D,MAKE;AAAA,MAJMA,EAAA,UAAUA,kBAAgB,SAASA,EAAA,cAAcA,EAAA,YAAY,WAAM,WAD3EH,EAKEI,GAAA;AAAA;QAHC,eAAaD,EAAA;AAAA,QACb,cAAYA,EAAA;AAAA,QACZ,aAAaA,EAAA;AAAA;MAEhBE,EAkBcC,GAAA,EAlBD,OAAM,uBAAsB,GAAA;AAAA,mBACvC,MAYa;AAAA,UAZbD,EAYaJ,GAAA;AAAA,YAZD,OAAM;AAAA,YAA4B,KAAI;AAAA;uBAChD,MAMc;AAAA,cANdI,EAMcC,GAAA;AAAA,gBAND,OAAM;AAAA,gBAA6B,KAAI;AAAA;2BAClD,MAA8E;AAAA,mBAA9EC,EAAA,GAAAP,EAA8EQ,EAA9DL,EAAA,UAAU,GAAA,EAAE,OAAM,wBAAoB;AAAA,+BAAC,MAAW;AAAA,0BAARA,EAAA,KAAK,GAAA,CAAA;AAAA;;;kBAC5CA,EAAA,MAAM,eAAzBH,EAGcM,GAAA;AAAA;oBAHmB,OAAM;AAAA,oBAAsB,KAAI;AAAA;+BAE/D,MAA2B;AAAA,sBAA3BG,EAA2BN,EAAA,QAAA,QAAA;AAAA;;;;;;cAI/BM,EAEON,0BAFP,MAEO;AAAA,gBADOA,EAAA,iBAAZO,EAAyE,QAAzEC,GAAyEC,EAAlBT,EAAA,QAAQ,GAAA,CAAA;;;;;UAGhDA,EAAA,MAAM,gBAAzBH,EAGcM,GAAA;AAAA;YAHoB,OAAM;AAAA,YAAuB,KAAI;AAAA;uBAEjE,MAA4B;AAAA,cAA5BG,EAA4BN,EAAA,QAAA,SAAA;AAAA;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),t=require("../../../model/common/color/NeonFunctionalColor.cjs.js"),o=e.defineComponent({name:"NeonField",props:{label:{type:String
|
|
1
|
+
"use strict";const e=require("vue"),t=require("../../../model/common/color/NeonFunctionalColor.cjs.js"),o=e.defineComponent({name:"NeonField",props:{label:{type:String},labelFor:{type:String,default:null},optional:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},optionalLabel:{type:String,default:"Optional"},noMessage:{type:Boolean,default:!1},message:{type:String,default:""},messageColor:{type:String,default:t.NeonFunctionalColor.LowContrast}}});module.exports=o;
|
|
2
2
|
//# sourceMappingURL=NeonField.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonField.cjs.js","sources":["../../../../src/components/user-input/field/NeonField.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { defineComponent } from 'vue';\nimport { NeonFunctionalColor } from '@/model/common/color/NeonFunctionalColor';\n\n/**\n * An HTML label implementation supporting optional labels. Use in the same way as an HTML label either wrapping the input\n * or using the label alongside the input.\n */\nexport default defineComponent({\n name: 'NeonField',\n props: {\n /**\n * The label text to render.\n */\n label: { type: String
|
|
1
|
+
{"version":3,"file":"NeonField.cjs.js","sources":["../../../../src/components/user-input/field/NeonField.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { defineComponent } from 'vue';\nimport { NeonFunctionalColor } from '@/model/common/color/NeonFunctionalColor';\n\n/**\n * An HTML label implementation supporting optional labels. Use in the same way as an HTML label either wrapping the input\n * or using the label alongside the input.\n */\nexport default defineComponent({\n name: 'NeonField',\n props: {\n /**\n * The label text to render.\n */\n label: { type: String },\n /**\n * The equivalent of the <em>for</em> attribute on an HTML label.\n */\n labelFor: { type: String, default: null },\n /**\n * Display an \"optional\" indicator with the label.\n */\n optional: { type: Boolean, default: false },\n /**\n * Display label with disabled state.\n */\n disabled: { type: Boolean, default: false },\n /**\n * The default \"optional\" label text.\n */\n optionalLabel: { type: String, default: 'Optional' },\n /**\n * Remove empty message space below input. By default, a blank message will be displayed below each input which\n * helps simplify form layouts.\n */\n noMessage: { type: Boolean, default: false },\n /**\n * Message to display below the input field.\n */\n message: { type: String, default: '' },\n /**\n * The color of message displayed under input. Can be any functional color.\n */\n messageColor: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonFunctionalColor"],"mappings":"wGAOAA,EAAeC,kBAAgB,CAC7B,KAAM,YACN,MAAO,CAIL,MAAO,CAAE,KAAM,MAAA,EAIf,SAAU,CAAE,KAAM,OAAQ,QAAS,IAAA,EAInC,SAAU,CAAE,KAAM,QAAS,QAAS,EAAA,EAIpC,SAAU,CAAE,KAAM,QAAS,QAAS,EAAA,EAIpC,cAAe,CAAE,KAAM,OAAQ,QAAS,UAAA,EAKxC,UAAW,CAAE,KAAM,QAAS,QAAS,EAAA,EAIrC,QAAS,CAAE,KAAM,OAAQ,QAAS,EAAA,EAIlC,aAAc,CAAE,KAAM,OAAqC,QAASC,EAAAA,oBAAoB,WAAA,CAAY,CAExG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonField.es.js","sources":["../../../../src/components/user-input/field/NeonField.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { defineComponent } from 'vue';\nimport { NeonFunctionalColor } from '@/model/common/color/NeonFunctionalColor';\n\n/**\n * An HTML label implementation supporting optional labels. Use in the same way as an HTML label either wrapping the input\n * or using the label alongside the input.\n */\nexport default defineComponent({\n name: 'NeonField',\n props: {\n /**\n * The label text to render.\n */\n label: { type: String
|
|
1
|
+
{"version":3,"file":"NeonField.es.js","sources":["../../../../src/components/user-input/field/NeonField.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { defineComponent } from 'vue';\nimport { NeonFunctionalColor } from '@/model/common/color/NeonFunctionalColor';\n\n/**\n * An HTML label implementation supporting optional labels. Use in the same way as an HTML label either wrapping the input\n * or using the label alongside the input.\n */\nexport default defineComponent({\n name: 'NeonField',\n props: {\n /**\n * The label text to render.\n */\n label: { type: String },\n /**\n * The equivalent of the <em>for</em> attribute on an HTML label.\n */\n labelFor: { type: String, default: null },\n /**\n * Display an \"optional\" indicator with the label.\n */\n optional: { type: Boolean, default: false },\n /**\n * Display label with disabled state.\n */\n disabled: { type: Boolean, default: false },\n /**\n * The default \"optional\" label text.\n */\n optionalLabel: { type: String, default: 'Optional' },\n /**\n * Remove empty message space below input. By default, a blank message will be displayed below each input which\n * helps simplify form layouts.\n */\n noMessage: { type: Boolean, default: false },\n /**\n * Message to display below the input field.\n */\n message: { type: String, default: '' },\n /**\n * The color of message displayed under input. Can be any functional color.\n */\n messageColor: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.LowContrast },\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonFunctionalColor"],"mappings":";;AAOA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,OAAO,EAAE,MAAM,OAAA;AAAA;AAAA;AAAA;AAAA,IAIf,UAAU,EAAE,MAAM,QAAQ,SAAS,KAAA;AAAA;AAAA;AAAA;AAAA,IAInC,UAAU,EAAE,MAAM,SAAS,SAAS,GAAA;AAAA;AAAA;AAAA;AAAA,IAIpC,UAAU,EAAE,MAAM,SAAS,SAAS,GAAA;AAAA;AAAA;AAAA;AAAA,IAIpC,eAAe,EAAE,MAAM,QAAQ,SAAS,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKxC,WAAW,EAAE,MAAM,SAAS,SAAS,GAAA;AAAA;AAAA;AAAA;AAAA,IAIrC,SAAS,EAAE,MAAM,QAAQ,SAAS,GAAA;AAAA;AAAA;AAAA;AAAA,IAIlC,cAAc,EAAE,MAAM,QAAqC,SAASC,EAAoB,YAAA;AAAA,EAAY;AAExG,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const l=require("./NeonField.cjs.js"),e=require("vue"),s=require("../../../_virtual/_plugin-vue_export-helper.cjs.js"),t={class:"neon-field__label-wrapper"},a=["for"],r={key:
|
|
1
|
+
"use strict";const l=require("./NeonField.cjs.js"),e=require("vue"),s=require("../../../_virtual/_plugin-vue_export-helper.cjs.js"),t={class:"neon-field__label-wrapper"},a=["for"],r={key:1,class:"neon-field__optional"},i={class:"neon-field__contents"};function d(o,n,c,m,_,u){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([{"neon-field--optional":o.optional,"neon-field--disabled":o.disabled,"neon-field--with-message":!o.noMessage},"neon-field"])},[e.createElementVNode("span",t,[o.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:o.labelFor,class:"neon-field__label"},e.toDisplayString(o.label),9,a)):e.createCommentVNode("",!0),o.optional?(e.openBlock(),e.createElementBlock("span",r,e.toDisplayString(o.optionalLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",i,[e.renderSlot(o.$slots,"default"),o.noMessage?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass([`neon-color-${o.messageColor}`,"neon-field__message"]),onClick:n[0]||(n[0]=e.withModifiers(()=>{},["prevent","stop"]))},e.toDisplayString(o.message),3))])],2)}const p=s(l,[["render",d]]);module.exports=p;
|
|
2
2
|
//# sourceMappingURL=NeonField.vue.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonField.vue.cjs.js","sources":["../../../../src/components/user-input/field/NeonField.vue"],"sourcesContent":["<template>\n <div\n :class=\"{\n 'neon-field--optional': optional,\n 'neon-field--disabled': disabled,\n 'neon-field--with-message': !noMessage,\n }\"\n class=\"neon-field\"\n >\n <span class=\"neon-field__label-wrapper\">\n <label :for=\"labelFor\" class=\"neon-field__label\">{{ label }}</label>\n <span v-if=\"optional\" class=\"neon-field__optional\">{{ optionalLabel }}</span>\n </span>\n <div class=\"neon-field__contents\">\n <!-- @slot optionally wrap the field with the label -->\n <slot></slot>\n <span v-if=\"!noMessage\" :class=\"`neon-color-${messageColor}`\" class=\"neon-field__message\" @click.prevent.stop=\"\">\n {{ message }}\n </span>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" src=\"./NeonField.ts\"></script>\n"],"names":["_hoisted_1","_hoisted_4","_createElementBlock","_normalizeClass","_ctx","_createElementVNode","_hoisted_2","_hoisted_3","_toDisplayString","_renderSlot"],"mappings":"oIASUA,EAAA,CAAA,MAAM,2BAA2B,qBAEf,MAAM,wBAEzBC,EAAA,CAAA,MAAM,sBAAsB,+CAZnCC,EAAAA,mBAmBM,MAAA,CAlBH,MAAKC,EAAAA,eAAA,CAAA,wBAAkCC,EAAA,gCAAwCA,EAAA,qCAA6CA,EAAA,WAKvH,YAAY,CAAA,IAElBC,EAAAA,mBAGO,OAHPL,EAGO,
|
|
1
|
+
{"version":3,"file":"NeonField.vue.cjs.js","sources":["../../../../src/components/user-input/field/NeonField.vue"],"sourcesContent":["<template>\n <div\n :class=\"{\n 'neon-field--optional': optional,\n 'neon-field--disabled': disabled,\n 'neon-field--with-message': !noMessage,\n }\"\n class=\"neon-field\"\n >\n <span class=\"neon-field__label-wrapper\">\n <label v-if=\"label\" :for=\"labelFor\" class=\"neon-field__label\">{{ label }}</label>\n <span v-if=\"optional\" class=\"neon-field__optional\">{{ optionalLabel }}</span>\n </span>\n <div class=\"neon-field__contents\">\n <!-- @slot optionally wrap the field with the label -->\n <slot></slot>\n <span v-if=\"!noMessage\" :class=\"`neon-color-${messageColor}`\" class=\"neon-field__message\" @click.prevent.stop=\"\">\n {{ message }}\n </span>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" src=\"./NeonField.ts\"></script>\n"],"names":["_hoisted_1","_hoisted_4","_createElementBlock","_normalizeClass","_ctx","_createElementVNode","_hoisted_2","_hoisted_3","_toDisplayString","_renderSlot"],"mappings":"oIASUA,EAAA,CAAA,MAAM,2BAA2B,qBAEf,MAAM,wBAEzBC,EAAA,CAAA,MAAM,sBAAsB,+CAZnCC,EAAAA,mBAmBM,MAAA,CAlBH,MAAKC,EAAAA,eAAA,CAAA,wBAAkCC,EAAA,gCAAwCA,EAAA,qCAA6CA,EAAA,WAKvH,YAAY,CAAA,IAElBC,EAAAA,mBAGO,OAHPL,EAGO,CAFQI,EAAA,qBAAbF,EAAAA,mBAAiF,QAAA,OAA5D,IAAKE,EAAA,SAAU,MAAM,uCAAuBA,EAAA,KAAK,EAAA,EAAAE,CAAA,+BAC1DF,EAAA,wBAAZF,EAAAA,mBAA6E,OAA7EK,EAA6EC,EAAAA,gBAAvBJ,EAAA,aAAa,EAAA,CAAA,iCAErEC,EAAAA,mBAMM,MANNJ,EAMM,CAJJQ,aAAaL,EAAA,OAAA,SAAA,EACAA,EAAA,qDAAbF,EAAAA,mBAEO,OAAA,OAFkB,MAAKC,EAAAA,eAAA,CAAA,cAAgBC,EAAA,YAAY,GAAU,qBAAqB,CAAA,EAAE,oCAAD,IAAA,CAAA,EAAsB,CAAA,UAAA,MAAA,CAAA,sBAC3GA,EAAA,OAAO,EAAA,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { openBlock as o, createElementBlock as n, normalizeClass as i, createElementVNode as
|
|
1
|
+
import t from "./NeonField.es.js";
|
|
2
|
+
import { openBlock as o, createElementBlock as n, normalizeClass as i, createElementVNode as r, toDisplayString as s, createCommentVNode as l, renderSlot as d, withModifiers as p } from "vue";
|
|
3
3
|
import f from "../../../_virtual/_plugin-vue_export-helper.es.js";
|
|
4
4
|
const m = { class: "neon-field__label-wrapper" }, _ = ["for"], c = {
|
|
5
|
-
key:
|
|
5
|
+
key: 1,
|
|
6
6
|
class: "neon-field__optional"
|
|
7
7
|
}, b = { class: "neon-field__contents" };
|
|
8
|
-
function
|
|
8
|
+
function u(e, a, g, k, $, h) {
|
|
9
9
|
return o(), n("div", {
|
|
10
10
|
class: i([{
|
|
11
11
|
"neon-field--optional": e.optional,
|
|
@@ -13,26 +13,27 @@ function g(e, a, u, $, h, k) {
|
|
|
13
13
|
"neon-field--with-message": !e.noMessage
|
|
14
14
|
}, "neon-field"])
|
|
15
15
|
}, [
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
r("span", m, [
|
|
17
|
+
e.label ? (o(), n("label", {
|
|
18
|
+
key: 0,
|
|
18
19
|
for: e.labelFor,
|
|
19
20
|
class: "neon-field__label"
|
|
20
|
-
},
|
|
21
|
-
e.optional ? (o(), n("span", c,
|
|
21
|
+
}, s(e.label), 9, _)) : l("", !0),
|
|
22
|
+
e.optional ? (o(), n("span", c, s(e.optionalLabel), 1)) : l("", !0)
|
|
22
23
|
]),
|
|
23
|
-
|
|
24
|
+
r("div", b, [
|
|
24
25
|
d(e.$slots, "default"),
|
|
25
|
-
e.noMessage ?
|
|
26
|
+
e.noMessage ? l("", !0) : (o(), n("span", {
|
|
26
27
|
key: 0,
|
|
27
28
|
class: i([`neon-color-${e.messageColor}`, "neon-field__message"]),
|
|
28
29
|
onClick: a[0] || (a[0] = p(() => {
|
|
29
30
|
}, ["prevent", "stop"]))
|
|
30
|
-
},
|
|
31
|
+
}, s(e.message), 3))
|
|
31
32
|
])
|
|
32
33
|
], 2);
|
|
33
34
|
}
|
|
34
|
-
const
|
|
35
|
+
const w = /* @__PURE__ */ f(t, [["render", u]]);
|
|
35
36
|
export {
|
|
36
|
-
|
|
37
|
+
w as default
|
|
37
38
|
};
|
|
38
39
|
//# sourceMappingURL=NeonField.vue.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonField.vue.es.js","sources":["../../../../src/components/user-input/field/NeonField.vue"],"sourcesContent":["<template>\n <div\n :class=\"{\n 'neon-field--optional': optional,\n 'neon-field--disabled': disabled,\n 'neon-field--with-message': !noMessage,\n }\"\n class=\"neon-field\"\n >\n <span class=\"neon-field__label-wrapper\">\n <label :for=\"labelFor\" class=\"neon-field__label\">{{ label }}</label>\n <span v-if=\"optional\" class=\"neon-field__optional\">{{ optionalLabel }}</span>\n </span>\n <div class=\"neon-field__contents\">\n <!-- @slot optionally wrap the field with the label -->\n <slot></slot>\n <span v-if=\"!noMessage\" :class=\"`neon-color-${messageColor}`\" class=\"neon-field__message\" @click.prevent.stop=\"\">\n {{ message }}\n </span>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" src=\"./NeonField.ts\"></script>\n"],"names":["_hoisted_1","_hoisted_4","_createElementBlock","_normalizeClass","_ctx","_createElementVNode","_hoisted_2","_hoisted_3","_toDisplayString","_renderSlot"],"mappings":";;;AASU,MAAAA,IAAA,EAAA,OAAM,4BAA2B;;EAEf,OAAM;GAEzBC,IAAA,EAAA,OAAM,uBAAsB;;cAZnCC,EAmBM,OAAA;AAAA,IAlBH,OAAKC,EAAA,CAAA;AAAA,8BAAkCC,EAAA;AAAA,8BAAwCA,EAAA;AAAA,mCAA6CA,EAAA;AAAA,OAKvH,YAAY,CAAA;AAAA;IAElBC,EAGO,QAHPL,GAGO;AAAA,
|
|
1
|
+
{"version":3,"file":"NeonField.vue.es.js","sources":["../../../../src/components/user-input/field/NeonField.vue"],"sourcesContent":["<template>\n <div\n :class=\"{\n 'neon-field--optional': optional,\n 'neon-field--disabled': disabled,\n 'neon-field--with-message': !noMessage,\n }\"\n class=\"neon-field\"\n >\n <span class=\"neon-field__label-wrapper\">\n <label v-if=\"label\" :for=\"labelFor\" class=\"neon-field__label\">{{ label }}</label>\n <span v-if=\"optional\" class=\"neon-field__optional\">{{ optionalLabel }}</span>\n </span>\n <div class=\"neon-field__contents\">\n <!-- @slot optionally wrap the field with the label -->\n <slot></slot>\n <span v-if=\"!noMessage\" :class=\"`neon-color-${messageColor}`\" class=\"neon-field__message\" @click.prevent.stop=\"\">\n {{ message }}\n </span>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" src=\"./NeonField.ts\"></script>\n"],"names":["_hoisted_1","_hoisted_4","_createElementBlock","_normalizeClass","_ctx","_createElementVNode","_hoisted_2","_hoisted_3","_toDisplayString","_renderSlot"],"mappings":";;;AASU,MAAAA,IAAA,EAAA,OAAM,4BAA2B;;EAEf,OAAM;GAEzBC,IAAA,EAAA,OAAM,uBAAsB;;cAZnCC,EAmBM,OAAA;AAAA,IAlBH,OAAKC,EAAA,CAAA;AAAA,8BAAkCC,EAAA;AAAA,8BAAwCA,EAAA;AAAA,mCAA6CA,EAAA;AAAA,OAKvH,YAAY,CAAA;AAAA;IAElBC,EAGO,QAHPL,GAGO;AAAA,MAFQI,EAAA,cAAbF,EAAiF,SAAA;AAAA;QAA5D,KAAKE,EAAA;AAAA,QAAU,OAAM;AAAA,WAAuBA,EAAA,KAAK,GAAA,GAAAE,CAAA;MAC1DF,EAAA,iBAAZF,EAA6E,QAA7EK,GAA6EC,EAAvBJ,EAAA,aAAa,GAAA,CAAA;;IAErEC,EAMM,OANNJ,GAMM;AAAA,MAJJQ,EAAaL,EAAA,QAAA,SAAA;AAAA,MACAA,EAAA,8BAAbF,EAEO,QAAA;AAAA;QAFkB,OAAKC,EAAA,CAAA,cAAgBC,EAAA,YAAY,IAAU,qBAAqB,CAAA;AAAA,QAAE,2BAAD,MAAA;AAAA,QAAA,GAAsB,CAAA,WAAA,MAAA,CAAA;AAAA,WAC3GA,EAAA,OAAO,GAAA,CAAA;AAAA;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const u=require("vue"),g=require("../../../model/common/color/NeonFunctionalColor.cjs.js"),S=require("../../../model/common/size/NeonSize.cjs.js"),q=require("../../../model/user-input/input/NeonInputMode.cjs.js"),F=require("../button/NeonButton.vue.cjs.js"),B=require("../field-group/NeonFieldGroup.vue.cjs.js"),
|
|
1
|
+
"use strict";const u=require("vue"),g=require("../../../model/common/color/NeonFunctionalColor.cjs.js"),S=require("../../../model/common/size/NeonSize.cjs.js"),q=require("../../../model/user-input/input/NeonInputMode.cjs.js"),F=require("../button/NeonButton.vue.cjs.js"),B=require("../field-group/NeonFieldGroup.vue.cjs.js"),x=require("../input/NeonInput.vue.cjs.js"),s=require("../../../utils/common/number/NeonNumberUtils.cjs.js"),M=u.defineComponent({name:"NeonNumber",components:{NeonButton:F,NeonFieldGroup:B,NeonInput:x},props:{id:{type:String,default:null},modelValue:{type:Number,default:null},min:{type:Number,required:!1},max:{type:Number,required:!1},step:{type:Number,required:!1},color:{type:String,default:g.NeonFunctionalColor.Primary},size:{type:String,default:S.NeonSize.Medium},locale:{type:String,default:null},placeholder:{type:String,default:null},disabled:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},spinButtons:{type:Boolean,default:!1},percentage:{type:Boolean,default:!1},decimals:{type:Number,required:!1},valueTemplate:{type:String,required:!1},inputmode:{type:String,default:q.NeonInputMode.Numeric},incrementLabel:{type:String,default:"Increment"},decrementLabel:{type:String,default:"Decrement"}},emits:["update:modelValue"],setup(e,{emit:f}){const N=u.useAttrs(),o=u.ref(!1),i=t=>{e.disabled||f("update:modelValue",t)},v=u.computed(()=>{const{onBlur:t,onFocus:l,...d}=N;return d}),V=t=>{const l=s.NeonNumberUtils.parseNumber(t),d=t!==""&&t!==null?Math.max(Math.min(l,e.max??Number.MAX_SAFE_INTEGER),e.min??Number.MIN_SAFE_INTEGER):null;(d===null||!isNaN(l))&&i(d)},n=u.computed(()=>e.decimals??(e.percentage?0:void 0)),a=u.computed(()=>e.percentage&&n.value!==void 0?n.value+2:n.value),m=u.computed(()=>{const t=e.modelValue!==null?+e.modelValue:e.min??0;return a.value!==void 0?Number(t.toFixed(a.value)):t}),b=u.computed(()=>e.modelValue!==null&&(e.valueTemplate!==void 0||n.value!==void 0||e.percentage!==void 0)?s.NeonNumberUtils.formatNumber(e.modelValue,{decimals:n.value,format:e.valueTemplate,percentage:e.percentage},e.locale):e.modelValue),c=u.computed(()=>a.value!==void 0&&e.modelValue!==null?e.modelValue.toFixed(a.value):e.modelValue===null?"":`${e.modelValue}`),y=u.computed(()=>o.value?c.value!==void 0?`${c.value}`:"":b.value),r=u.computed(()=>e.step??(e.percentage?.01:1));return{focus:o,sanitizedAttributes:v,computedDecimals:n,computedRawDecimals:a,computedValue:m,computedStep:r,displayValue:y,valueChanged:V,increment:()=>{const t=m.value+r.value,l=e.max!==void 0?Math.min(e.max,t):t;l!==e.modelValue&&i(l)},decrement:()=>{const t=m.value-r.value,l=e.min!==void 0?Math.max(e.min,t):t;l!==e.modelValue&&i(l)},onFocus:()=>o.value=!0,onBlur:()=>o.value=!1}}});module.exports=M;
|
|
2
2
|
//# sourceMappingURL=NeonNumber.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonNumber.cjs.js","sources":["../../../../src/components/user-input/number/NeonNumber.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, ref, useAttrs } from 'vue';\nimport { NeonFunctionalColor } from '@/model/common/color/NeonFunctionalColor';\nimport { NeonSize } from '@/model/common/size/NeonSize';\nimport { NeonInputMode } from '@/model/user-input/input/NeonInputMode';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonFieldGroup from '@/components/user-input/field-group/NeonFieldGroup.vue';\nimport NeonInput from '@/components/user-input/input/NeonInput.vue';\nimport { NeonNumberUtils } from '@/utils/common/number/NeonNumberUtils';\n\n/**\n * <p>\n * The <strong>NeonNumber</strong> component is the equivalent of an <strong><input type=\"number\" /></strong>\n * with -/+ spin buttons. In addition, it supports formatting as a percentage or with a provided custom template and\n * also pasting of values in the user's locale, e.g. 6,543.12.\n * </p>\n * <p><strong>NeonNumber</strong> supports all the properties found on an HTML <input>.</p>\n */\nexport default defineComponent({\n name: 'NeonNumber',\n components: {\n NeonButton,\n NeonFieldGroup,\n NeonInput,\n },\n props: {\n /**\n * The id the input\n */\n id: { type: String, default: null },\n /**\n * The value of the number input. Either a valid number or null.\n */\n modelValue: { type: Number, default: null },\n /**\n * The minimum value the input can accept.\n */\n min: { type: Number, required: false },\n /**\n * The maximum value the input can accept.\n */\n max: { type: Number, required: false },\n /**\n * The step value for the spin buttons.\n */\n step: { type: Number, required: false },\n /**\n * The component color.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Primary },\n /**\n * The component size.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The locale used for display purposes. This defaults to the browser's locale if none is provided.\n */\n locale: { type: String, default: null },\n /**\n * Placeholder text to display in the input\n */\n placeholder: { type: String, default: null },\n /**\n * Whether the component is disabled.\n */\n disabled: { type: Boolean, default: false },\n /**\n * Enable/disable direct editing of the value.\n */\n editable: { type: Boolean, default: true },\n /**\n * Show/hide spin buttons. NOTE: The user can still use up/down arrow keys when the input has focus.\n */\n spinButtons: { type: Boolean, default: false },\n /**\n * Automatically applies % formatting, e.g. if the value = 0.15 it will be displayed as 15%.\n */\n percentage: { type: Boolean, default: false },\n /**\n * The rounding precision for display formatting.\n */\n decimals: { type: Number, required: false },\n /**\n * A template string used for formatting the value for display. Use the placeholder {value} to reference the value in\n * the template string. e.g. value = 90, ${value} => $90.\n */\n valueTemplate: { type: String, required: false },\n /**\n * The HTML inputmode of the component. Either 'numeric' or 'decimal'.\n */\n inputmode: { type: String as () => NeonInputMode, default: NeonInputMode.Numeric },\n /**\n * ARIA label for the increment spinner button.\n */\n incrementLabel: { type: String, default: 'Increment' },\n /**\n * ARIA label for the decrement spinner button.\n */\n decrementLabel: { type: String, default: 'Decrement' },\n },\n emits: [\n /**\n * Emitted when the user changes the value of the number via the increment/decrement buttons or manually entering\n * the value.\n * @type {number | null} the current value or null if the value has been cleared.\n */\n 'update:modelValue',\n ],\n setup(props, { emit }) {\n const attrs = useAttrs();\n const focus = ref(false);\n\n const emitValue = (value: number | null) => {\n if (!props.disabled) {\n emit('update:modelValue', value);\n }\n };\n\n const sanitizedAttributes = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onBlur, onFocus, ...sanitized } = attrs;\n return sanitized;\n });\n\n const valueChanged = (value: string) => {\n const parsedValue = NeonNumberUtils.parseNumber(value);\n const newValue =\n value !== '' && value !== null\n ? Math.max(Math.min(parsedValue, props.max ?? Number.MAX_SAFE_INTEGER), props.min ?? Number.MIN_SAFE_INTEGER)\n : null;\n if (newValue === null || !isNaN(parsedValue)) {\n emitValue(newValue);\n }\n };\n\n const computedDecimals = computed(() => {\n return props.decimals ?? (props.percentage ? 0 : undefined);\n });\n\n const computedRawDecimals = computed(() => {\n return props.percentage && computedDecimals.value !== undefined\n ? computedDecimals.value + 2\n : computedDecimals.value;\n });\n\n const computedValue = computed(() => {\n const newValue = props.modelValue !== null ? +props.modelValue : props.min || 0;\n return computedRawDecimals.value !== undefined ? Number(newValue.toFixed(computedRawDecimals.value)) : newValue;\n });\n\n const formattedValue = computed(() => {\n return props.modelValue !== null &&\n (props.valueTemplate !== undefined || computedDecimals.value !== undefined || props.percentage !== undefined)\n ? NeonNumberUtils.formatNumber(\n props.modelValue,\n {\n decimals: computedDecimals.value,\n format: props.valueTemplate,\n percentage: props.percentage,\n },\n props.locale,\n )\n : props.modelValue;\n });\n\n const rawValue = computed(() => {\n return computedRawDecimals.value ? props.modelValue?.toFixed(computedRawDecimals.value) : props.modelValue;\n });\n\n const displayValue = computed(() => {\n return focus.value ? (rawValue.value ? `${rawValue.value}` : '') : formattedValue.value;\n });\n\n const computedStep = computed(() => {\n return props.step ?? (props.percentage ? 0.01 : 1);\n });\n\n const decrement = () => {\n const newValue = computedValue.value - computedStep.value;\n const emittedValue = props.min !== undefined ? Math.max(props.min, newValue) : newValue;\n if (emittedValue !== props.modelValue) {\n emitValue(emittedValue);\n }\n };\n\n const increment = () => {\n const newValue = computedValue.value + computedStep.value;\n const emittedValue = props.max !== undefined ? Math.min(props.max, newValue) : newValue;\n if (emittedValue !== props.modelValue) {\n emitValue(emittedValue);\n }\n };\n\n const onFocus = () => (focus.value = true);\n const onBlur = () => (focus.value = false);\n\n return {\n focus,\n sanitizedAttributes,\n computedDecimals,\n computedRawDecimals,\n computedValue,\n computedStep,\n displayValue,\n valueChanged,\n increment,\n decrement,\n onFocus,\n onBlur,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonButton","NeonFieldGroup","NeonInput","NeonFunctionalColor","NeonSize","NeonInputMode","props","emit","attrs","useAttrs","focus","ref","emitValue","value","sanitizedAttributes","computed","onBlur","onFocus","sanitized","valueChanged","parsedValue","NeonNumberUtils","newValue","computedDecimals","computedRawDecimals","computedValue","formattedValue","rawValue","_a","displayValue","computedStep","emittedValue"],"mappings":"ibAiBAA,EAAeC,kBAAgB,CAC7B,KAAM,aACN,WAAY,CACV,WAAAC,EACA,eAAAC,EACA,UAAAC,CAAA,EAEF,MAAO,CAIL,GAAI,CAAE,KAAM,OAAQ,QAAS,IAAA,EAI7B,WAAY,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIrC,IAAK,CAAE,KAAM,OAAQ,SAAU,EAAA,EAI/B,IAAK,CAAE,KAAM,OAAQ,SAAU,EAAA,EAI/B,KAAM,CAAE,KAAM,OAAQ,SAAU,EAAA,EAIhC,MAAO,CAAE,KAAM,OAAqC,QAASC,EAAAA,oBAAoB,OAAA,EAIjF,KAAM,CAAE,KAAM,OAA0B,QAASC,EAAAA,SAAS,MAAA,EA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A,EAAM,IAAKgB,CAAQ,EAAIA,EAC3ES,IAAiBzB,EAAM,YACzBM,EAAUmB,CAAY,CAE1B,EAwBE,QAdc,IAAOrB,EAAM,MAAQ,GAenC,OAda,IAAOA,EAAM,MAAQ,EAclC,CAEJ,CACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"NeonNumber.cjs.js","sources":["../../../../src/components/user-input/number/NeonNumber.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, ref, useAttrs } from 'vue';\nimport { NeonFunctionalColor } from '@/model/common/color/NeonFunctionalColor';\nimport { NeonSize } from '@/model/common/size/NeonSize';\nimport { NeonInputMode } from '@/model/user-input/input/NeonInputMode';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonFieldGroup from '@/components/user-input/field-group/NeonFieldGroup.vue';\nimport NeonInput from '@/components/user-input/input/NeonInput.vue';\nimport { NeonNumberUtils } from '@/utils/common/number/NeonNumberUtils';\n\n/**\n * <p>\n * The <strong>NeonNumber</strong> component is the equivalent of an <strong><input type=\"number\" /></strong>\n * with -/+ spin buttons. In addition, it supports formatting as a percentage or with a provided custom template and\n * also pasting of values in the user's locale, e.g. 6,543.12.\n * </p>\n * <p><strong>NeonNumber</strong> supports all the properties found on an HTML <input>.</p>\n */\nexport default defineComponent({\n name: 'NeonNumber',\n components: {\n NeonButton,\n NeonFieldGroup,\n NeonInput,\n },\n props: {\n /**\n * The id the input\n */\n id: { type: String, default: null },\n /**\n * The value of the number input. Either a valid number or null.\n */\n modelValue: { type: Number, default: null },\n /**\n * The minimum value the input can accept.\n */\n min: { type: Number, required: false },\n /**\n * The maximum value the input can accept.\n */\n max: { type: Number, required: false },\n /**\n * The step value for the spin buttons.\n */\n step: { type: Number, required: false },\n /**\n * The component color.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Primary },\n /**\n * The component size.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The locale used for display purposes. This defaults to the browser's locale if none is provided.\n */\n locale: { type: String, default: null },\n /**\n * Placeholder text to display in the input\n */\n placeholder: { type: String, default: null },\n /**\n * Whether the component is disabled.\n */\n disabled: { type: Boolean, default: false },\n /**\n * Enable/disable direct editing of the value.\n */\n editable: { type: Boolean, default: true },\n /**\n * Show/hide spin buttons. NOTE: The user can still use up/down arrow keys when the input has focus.\n */\n spinButtons: { type: Boolean, default: false },\n /**\n * Automatically applies % formatting, e.g. if the value = 0.15 it will be displayed as 15%.\n */\n percentage: { type: Boolean, default: false },\n /**\n * The rounding precision for display formatting.\n */\n decimals: { type: Number, required: false },\n /**\n * A template string used for formatting the value for display. Use the placeholder {value} to reference the value in\n * the template string. e.g. value = 90, ${value} => $90.\n */\n valueTemplate: { type: String, required: false },\n /**\n * The HTML inputmode of the component. Either 'numeric' or 'decimal'.\n */\n inputmode: { type: String as () => NeonInputMode, default: NeonInputMode.Numeric },\n /**\n * ARIA label for the increment spinner button.\n */\n incrementLabel: { type: String, default: 'Increment' },\n /**\n * ARIA label for the decrement spinner button.\n */\n decrementLabel: { type: String, default: 'Decrement' },\n },\n emits: [\n /**\n * Emitted when the user changes the value of the number via the increment/decrement buttons or manually entering\n * the value.\n * @type {number | null} the current value or null if the value has been cleared.\n */\n 'update:modelValue',\n ],\n setup(props, { emit }) {\n const attrs = useAttrs();\n const focus = ref(false);\n\n const emitValue = (value: number | null) => {\n if (!props.disabled) {\n emit('update:modelValue', value);\n }\n };\n\n const sanitizedAttributes = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onBlur, onFocus, ...sanitized } = attrs;\n return sanitized;\n });\n\n const valueChanged = (value: string) => {\n const parsedValue = NeonNumberUtils.parseNumber(value);\n const newValue =\n value !== '' && value !== null\n ? Math.max(Math.min(parsedValue, props.max ?? Number.MAX_SAFE_INTEGER), props.min ?? Number.MIN_SAFE_INTEGER)\n : null;\n if (newValue === null || !isNaN(parsedValue)) {\n emitValue(newValue);\n }\n };\n\n const computedDecimals = computed(() => {\n return props.decimals ?? (props.percentage ? 0 : undefined);\n });\n\n const computedRawDecimals = computed(() => {\n return props.percentage && computedDecimals.value !== undefined\n ? computedDecimals.value + 2\n : computedDecimals.value;\n });\n\n const computedValue = computed(() => {\n const newValue = props.modelValue !== null ? +props.modelValue : props.min ?? 0;\n return computedRawDecimals.value !== undefined ? Number(newValue.toFixed(computedRawDecimals.value)) : newValue;\n });\n\n const formattedValue = computed(() => {\n return props.modelValue !== null &&\n (props.valueTemplate !== undefined || computedDecimals.value !== undefined || props.percentage !== undefined)\n ? NeonNumberUtils.formatNumber(\n props.modelValue,\n {\n decimals: computedDecimals.value,\n format: props.valueTemplate,\n percentage: props.percentage,\n },\n props.locale,\n )\n : props.modelValue;\n });\n\n const rawValue = computed(() => {\n return computedRawDecimals.value !== undefined && props.modelValue !== null\n ? props.modelValue.toFixed(computedRawDecimals.value)\n : props.modelValue === null\n ? ''\n : `${props.modelValue}`;\n });\n\n const displayValue = computed(() => {\n return focus.value ? (rawValue.value !== undefined ? `${rawValue.value}` : '') : formattedValue.value;\n });\n\n const computedStep = computed(() => {\n return props.step ?? (props.percentage ? 0.01 : 1);\n });\n\n const decrement = () => {\n const newValue = computedValue.value - computedStep.value;\n const emittedValue = props.min !== undefined ? Math.max(props.min, newValue) : newValue;\n if (emittedValue !== props.modelValue) {\n emitValue(emittedValue);\n }\n };\n\n const increment = () => {\n const newValue = computedValue.value + computedStep.value;\n const emittedValue = props.max !== undefined ? Math.min(props.max, newValue) : newValue;\n if (emittedValue !== props.modelValue) {\n emitValue(emittedValue);\n }\n };\n\n const onFocus = () => (focus.value = true);\n const onBlur = () => (focus.value = false);\n\n return {\n focus,\n sanitizedAttributes,\n computedDecimals,\n computedRawDecimals,\n computedValue,\n computedStep,\n displayValue,\n valueChanged,\n increment,\n decrement,\n onFocus,\n onBlur,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonButton","NeonFieldGroup","NeonInput","NeonFunctionalColor","NeonSize","NeonInputMode","props","emit","attrs","useAttrs","focus","ref","emitValue","value","sanitizedAttributes","computed","onBlur","onFocus","sanitized","valueChanged","parsedValue","NeonNumberUtils","newValue","computedDecimals","computedRawDecimals","computedValue","formattedValue","rawValue","displayValue","computedStep","emittedValue"],"mappings":"ibAiBAA,EAAeC,kBAAgB,CAC7B,KAAM,aACN,WAAY,CACV,WAAAC,EACA,eAAAC,EACA,UAAAC,CAAA,EAEF,MAAO,CAIL,GAAI,CAAE,KAAM,OAAQ,QAAS,IAAA,EAI7B,WAAY,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIrC,IAAK,CAAE,KAAM,OAAQ,SAAU,EAAA,EAI/B,IAAK,CAAE,KAAM,OAAQ,SAAU,EAAA,EAI/B,KAAM,CAAE,KAAM,OAAQ,SAAU,EAAA,EAIhC,MAAO,CAAE,KAAM,OAAqC,QAASC,EAAAA,oBAAoB,OAAA,EAIjF,KAAM,CAAE,KAAM,OAA0B,QAASC,EAAAA,SAAS,MAAA,EAI1D,OAAQ,CAAE,KAAM,OAAQ,QAAS,IAAA,EAIjC,YAAa,CAAE,KAAM,OAAQ,QAAS,IAAA,EAItC,SAAU,CAAE,KAAM,QAAS,QAAS,EAAA,EAIpC,SAAU,CAAE,KAAM,QAAS,QAAS,EAAA,EAIpC,YAAa,CAAE,KAAM,QAAS,QAAS,EAAA,EAIvC,WAAY,CAAE,KAAM,QAAS,QAAS,EAAA,EAItC,SAAU,CAAE,KAAM,OAAQ,SAAU,EAAA,EAKpC,cAAe,CAAE,KAAM,OAAQ,SAAU,EAAA,EAIzC,UAAW,CAAE,KAAM,OAA+B,QAASC,EAAAA,cAAc,OAAA,EAIzE,eAAgB,CAAE,KAAM,OAAQ,QAAS,WAAA,EAIzC,eAAgB,CAAE,KAAM,OAAQ,QAAS,WAAA,CAAY,EAEvD,MAAO,CAML,mBAAA,EAEF,MAAMC,EAAO,CAAE,KAAAC,GAAQ,CACrB,MAAMC,EAAQC,EAAAA,SAAA,EACRC,EAAQC,EAAAA,IAAI,E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AM,aAAe,KACrB,GACA,GAAGA,EAAM,UAAU,EACxB,EAEKsB,EAAeb,EAAAA,SAAS,IACrBL,EAAM,MAASiB,EAAS,QAAU,OAAY,GAAGA,EAAS,KAAK,GAAK,GAAMD,EAAe,KACjG,EAEKG,EAAed,EAAAA,SAAS,IACrBT,EAAM,OAASA,EAAM,WAAa,IAAO,EACjD,EAqBD,MAAO,CACL,MAAAI,EACA,oBAAAI,EACA,iBAAAS,EACA,oBAAAC,EACA,cAAAC,EACA,aAAAI,EACA,aAAAD,EACA,aAAAT,EACA,UApBgB,IAAM,CACtB,MAAMG,EAAWG,EAAc,MAAQI,EAAa,MAC9CC,EAAexB,EAAM,MAAQ,OAAY,KAAK,IAAIA,EAAM,IAAKgB,CAAQ,EAAIA,EAC3EQ,IAAiBxB,EAAM,YACzBM,EAAUkB,CAAY,CAE1B,EAeE,UA7BgB,IAAM,CACtB,MAAMR,EAAWG,EAAc,MAAQI,EAAa,MAC9CC,EAAexB,EAAM,MAAQ,OAAY,KAAK,IAAIA,EAAM,IAAKgB,CAAQ,EAAIA,EAC3EQ,IAAiBxB,EAAM,YACzBM,EAAUkB,CAAY,CAE1B,EAwBE,QAdc,IAAOpB,EAAM,MAAQ,GAenC,OAda,IAAOA,EAAM,MAAQ,EAclC,CAEJ,CACF,CAAC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { defineComponent as g, useAttrs as S, ref as B, computed as a } from "vue";
|
|
2
2
|
import { NeonFunctionalColor as F } from "../../../model/common/color/NeonFunctionalColor.es.js";
|
|
3
|
-
import { NeonSize as
|
|
4
|
-
import { NeonInputMode as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
3
|
+
import { NeonSize as x } from "../../../model/common/size/NeonSize.es.js";
|
|
4
|
+
import { NeonInputMode as M } from "../../../model/user-input/input/NeonInputMode.es.js";
|
|
5
|
+
import h from "../button/NeonButton.vue.es.js";
|
|
6
|
+
import w from "../field-group/NeonFieldGroup.vue.es.js";
|
|
7
|
+
import E from "../input/NeonInput.vue.es.js";
|
|
8
8
|
import { NeonNumberUtils as f } from "../../../utils/common/number/NeonNumberUtils.es.js";
|
|
9
|
-
const
|
|
9
|
+
const $ = g({
|
|
10
10
|
name: "NeonNumber",
|
|
11
11
|
components: {
|
|
12
|
-
NeonButton:
|
|
13
|
-
NeonFieldGroup:
|
|
14
|
-
NeonInput:
|
|
12
|
+
NeonButton: h,
|
|
13
|
+
NeonFieldGroup: w,
|
|
14
|
+
NeonInput: E
|
|
15
15
|
},
|
|
16
16
|
props: {
|
|
17
17
|
/**
|
|
@@ -41,7 +41,7 @@ const P = g({
|
|
|
41
41
|
/**
|
|
42
42
|
* The component size.
|
|
43
43
|
*/
|
|
44
|
-
size: { type: String, default:
|
|
44
|
+
size: { type: String, default: x.Medium },
|
|
45
45
|
/**
|
|
46
46
|
* The locale used for display purposes. This defaults to the browser's locale if none is provided.
|
|
47
47
|
*/
|
|
@@ -78,7 +78,7 @@ const P = g({
|
|
|
78
78
|
/**
|
|
79
79
|
* The HTML inputmode of the component. Either 'numeric' or 'decimal'.
|
|
80
80
|
*/
|
|
81
|
-
inputmode: { type: String, default:
|
|
81
|
+
inputmode: { type: String, default: M.Numeric },
|
|
82
82
|
/**
|
|
83
83
|
* ARIA label for the increment spinner button.
|
|
84
84
|
*/
|
|
@@ -97,16 +97,16 @@ const P = g({
|
|
|
97
97
|
"update:modelValue"
|
|
98
98
|
],
|
|
99
99
|
setup(e, { emit: s }) {
|
|
100
|
-
const v = S(), o = B(!1),
|
|
100
|
+
const v = S(), o = B(!1), i = (t) => {
|
|
101
101
|
e.disabled || s("update:modelValue", t);
|
|
102
102
|
}, N = a(() => {
|
|
103
103
|
const { onBlur: t, onFocus: l, ...m } = v;
|
|
104
104
|
return m;
|
|
105
105
|
}), V = (t) => {
|
|
106
106
|
const l = f.parseNumber(t), m = t !== "" && t !== null ? Math.max(Math.min(l, e.max ?? Number.MAX_SAFE_INTEGER), e.min ?? Number.MIN_SAFE_INTEGER) : null;
|
|
107
|
-
(m === null || !isNaN(l)) &&
|
|
108
|
-
}, u = a(() => e.decimals ?? (e.percentage ? 0 : void 0)), n = a(() => e.percentage && u.value !== void 0 ? u.value + 2 : u.value),
|
|
109
|
-
const t = e.modelValue !== null ? +e.modelValue : e.min
|
|
107
|
+
(m === null || !isNaN(l)) && i(m);
|
|
108
|
+
}, u = a(() => e.decimals ?? (e.percentage ? 0 : void 0)), n = a(() => e.percentage && u.value !== void 0 ? u.value + 2 : u.value), d = a(() => {
|
|
109
|
+
const t = e.modelValue !== null ? +e.modelValue : e.min ?? 0;
|
|
110
110
|
return n.value !== void 0 ? Number(t.toFixed(n.value)) : t;
|
|
111
111
|
}), y = a(() => e.modelValue !== null && (e.valueTemplate !== void 0 || u.value !== void 0 || e.percentage !== void 0) ? f.formatNumber(
|
|
112
112
|
e.modelValue,
|
|
@@ -116,26 +116,23 @@ const P = g({
|
|
|
116
116
|
percentage: e.percentage
|
|
117
117
|
},
|
|
118
118
|
e.locale
|
|
119
|
-
) : e.modelValue), c = a(() => {
|
|
120
|
-
var t;
|
|
121
|
-
return n.value ? (t = e.modelValue) == null ? void 0 : t.toFixed(n.value) : e.modelValue;
|
|
122
|
-
}), b = a(() => o.value ? c.value ? `${c.value}` : "" : y.value), d = a(() => e.step ?? (e.percentage ? 0.01 : 1));
|
|
119
|
+
) : e.modelValue), c = a(() => n.value !== void 0 && e.modelValue !== null ? e.modelValue.toFixed(n.value) : e.modelValue === null ? "" : `${e.modelValue}`), b = a(() => o.value ? c.value !== void 0 ? `${c.value}` : "" : y.value), r = a(() => e.step ?? (e.percentage ? 0.01 : 1));
|
|
123
120
|
return {
|
|
124
121
|
focus: o,
|
|
125
122
|
sanitizedAttributes: N,
|
|
126
123
|
computedDecimals: u,
|
|
127
124
|
computedRawDecimals: n,
|
|
128
|
-
computedValue:
|
|
129
|
-
computedStep:
|
|
125
|
+
computedValue: d,
|
|
126
|
+
computedStep: r,
|
|
130
127
|
displayValue: b,
|
|
131
128
|
valueChanged: V,
|
|
132
129
|
increment: () => {
|
|
133
|
-
const t =
|
|
134
|
-
l !== e.modelValue &&
|
|
130
|
+
const t = d.value + r.value, l = e.max !== void 0 ? Math.min(e.max, t) : t;
|
|
131
|
+
l !== e.modelValue && i(l);
|
|
135
132
|
},
|
|
136
133
|
decrement: () => {
|
|
137
|
-
const t =
|
|
138
|
-
l !== e.modelValue &&
|
|
134
|
+
const t = d.value - r.value, l = e.min !== void 0 ? Math.max(e.min, t) : t;
|
|
135
|
+
l !== e.modelValue && i(l);
|
|
139
136
|
},
|
|
140
137
|
onFocus: () => o.value = !0,
|
|
141
138
|
onBlur: () => o.value = !1
|
|
@@ -143,6 +140,6 @@ const P = g({
|
|
|
143
140
|
}
|
|
144
141
|
});
|
|
145
142
|
export {
|
|
146
|
-
|
|
143
|
+
$ as default
|
|
147
144
|
};
|
|
148
145
|
//# sourceMappingURL=NeonNumber.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonNumber.es.js","sources":["../../../../src/components/user-input/number/NeonNumber.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, ref, useAttrs } from 'vue';\nimport { NeonFunctionalColor } from '@/model/common/color/NeonFunctionalColor';\nimport { NeonSize } from '@/model/common/size/NeonSize';\nimport { NeonInputMode } from '@/model/user-input/input/NeonInputMode';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonFieldGroup from '@/components/user-input/field-group/NeonFieldGroup.vue';\nimport NeonInput from '@/components/user-input/input/NeonInput.vue';\nimport { NeonNumberUtils } from '@/utils/common/number/NeonNumberUtils';\n\n/**\n * <p>\n * The <strong>NeonNumber</strong> component is the equivalent of an <strong><input type=\"number\" /></strong>\n * with -/+ spin buttons. In addition, it supports formatting as a percentage or with a provided custom template and\n * also pasting of values in the user's locale, e.g. 6,543.12.\n * </p>\n * <p><strong>NeonNumber</strong> supports all the properties found on an HTML <input>.</p>\n */\nexport default defineComponent({\n name: 'NeonNumber',\n components: {\n NeonButton,\n NeonFieldGroup,\n NeonInput,\n },\n props: {\n /**\n * The id the input\n */\n id: { type: String, default: null },\n /**\n * The value of the number input. Either a valid number or null.\n */\n modelValue: { type: Number, default: null },\n /**\n * The minimum value the input can accept.\n */\n min: { type: Number, required: false },\n /**\n * The maximum value the input can accept.\n */\n max: { type: Number, required: false },\n /**\n * The step value for the spin buttons.\n */\n step: { type: Number, required: false },\n /**\n * The component color.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Primary },\n /**\n * The component size.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The locale used for display purposes. This defaults to the browser's locale if none is provided.\n */\n locale: { type: String, default: null },\n /**\n * Placeholder text to display in the input\n */\n placeholder: { type: String, default: null },\n /**\n * Whether the component is disabled.\n */\n disabled: { type: Boolean, default: false },\n /**\n * Enable/disable direct editing of the value.\n */\n editable: { type: Boolean, default: true },\n /**\n * Show/hide spin buttons. NOTE: The user can still use up/down arrow keys when the input has focus.\n */\n spinButtons: { type: Boolean, default: false },\n /**\n * Automatically applies % formatting, e.g. if the value = 0.15 it will be displayed as 15%.\n */\n percentage: { type: Boolean, default: false },\n /**\n * The rounding precision for display formatting.\n */\n decimals: { type: Number, required: false },\n /**\n * A template string used for formatting the value for display. Use the placeholder {value} to reference the value in\n * the template string. e.g. value = 90, ${value} => $90.\n */\n valueTemplate: { type: String, required: false },\n /**\n * The HTML inputmode of the component. Either 'numeric' or 'decimal'.\n */\n inputmode: { type: String as () => NeonInputMode, default: NeonInputMode.Numeric },\n /**\n * ARIA label for the increment spinner button.\n */\n incrementLabel: { type: String, default: 'Increment' },\n /**\n * ARIA label for the decrement spinner button.\n */\n decrementLabel: { type: String, default: 'Decrement' },\n },\n emits: [\n /**\n * Emitted when the user changes the value of the number via the increment/decrement buttons or manually entering\n * the value.\n * @type {number | null} the current value or null if the value has been cleared.\n */\n 'update:modelValue',\n ],\n setup(props, { emit }) {\n const attrs = useAttrs();\n const focus = ref(false);\n\n const emitValue = (value: number | null) => {\n if (!props.disabled) {\n emit('update:modelValue', value);\n }\n };\n\n const sanitizedAttributes = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onBlur, onFocus, ...sanitized } = attrs;\n return sanitized;\n });\n\n const valueChanged = (value: string) => {\n const parsedValue = NeonNumberUtils.parseNumber(value);\n const newValue =\n value !== '' && value !== null\n ? Math.max(Math.min(parsedValue, props.max ?? Number.MAX_SAFE_INTEGER), props.min ?? Number.MIN_SAFE_INTEGER)\n : null;\n if (newValue === null || !isNaN(parsedValue)) {\n emitValue(newValue);\n }\n };\n\n const computedDecimals = computed(() => {\n return props.decimals ?? (props.percentage ? 0 : undefined);\n });\n\n const computedRawDecimals = computed(() => {\n return props.percentage && computedDecimals.value !== undefined\n ? computedDecimals.value + 2\n : computedDecimals.value;\n });\n\n const computedValue = computed(() => {\n const newValue = props.modelValue !== null ? +props.modelValue : props.min || 0;\n return computedRawDecimals.value !== undefined ? Number(newValue.toFixed(computedRawDecimals.value)) : newValue;\n });\n\n const formattedValue = computed(() => {\n return props.modelValue !== null &&\n (props.valueTemplate !== undefined || computedDecimals.value !== undefined || props.percentage !== undefined)\n ? NeonNumberUtils.formatNumber(\n props.modelValue,\n {\n decimals: computedDecimals.value,\n format: props.valueTemplate,\n percentage: props.percentage,\n },\n props.locale,\n )\n : props.modelValue;\n });\n\n const rawValue = computed(() => {\n return computedRawDecimals.value ? props.modelValue?.toFixed(computedRawDecimals.value) : props.modelValue;\n });\n\n const displayValue = computed(() => {\n return focus.value ? (rawValue.value ? `${rawValue.value}` : '') : formattedValue.value;\n });\n\n const computedStep = computed(() => {\n return props.step ?? (props.percentage ? 0.01 : 1);\n });\n\n const decrement = () => {\n const newValue = computedValue.value - computedStep.value;\n const emittedValue = props.min !== undefined ? Math.max(props.min, newValue) : newValue;\n if (emittedValue !== props.modelValue) {\n emitValue(emittedValue);\n }\n };\n\n const increment = () => {\n const newValue = computedValue.value + computedStep.value;\n const emittedValue = props.max !== undefined ? Math.min(props.max, newValue) : newValue;\n if (emittedValue !== props.modelValue) {\n emitValue(emittedValue);\n }\n };\n\n const onFocus = () => (focus.value = true);\n const onBlur = () => (focus.value = false);\n\n return {\n focus,\n sanitizedAttributes,\n computedDecimals,\n computedRawDecimals,\n computedValue,\n computedStep,\n displayValue,\n valueChanged,\n increment,\n decrement,\n onFocus,\n onBlur,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonButton","NeonFieldGroup","NeonInput","NeonFunctionalColor","NeonSize","NeonInputMode","props","emit","attrs","useAttrs","focus","ref","emitValue","value","sanitizedAttributes","computed","onBlur","onFocus","sanitized","valueChanged","parsedValue","NeonNumberUtils","newValue","computedDecimals","computedRawDecimals","computedValue","formattedValue","rawValue","_a","displayValue","computedStep","emittedValue"],"mappings":";;;;;;;;AAiBA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,IACV,YAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,WAAAC;AAAA,EAAA;AAAA,EAEF,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,IAAI,EAAE,MAAM,QAAQ,SAAS,KAAA;AAAA;AAAA;AAAA;AAAA,IAI7B,YAAY,EAAE,MAAM,QAAQ,SAAS,KAAA;AAAA;AAAA;AAAA;AAAA,IAIrC,KAAK,EAAE,MAAM,QAAQ,UAAU,GAAA;AAAA;AAAA;AAAA;AAAA,IAI/B,KAAK,EAAE,MAAM,QAAQ,UAAU,GAAA;AAAA;AAAA;AAAA;AAAA,IAI/B,MAAM,EAAE,MAAM,QAAQ,UAAU,GAAA;AAAA;AAAA;AAAA;AAAA,IAIhC,OAAO,EAAE,MAAM,QAAqC,SAASC,EAAoB,QAAA;AAAA;AAAA;AAAA;AAAA,IAIjF,MAAM,EAAE,MAAM,QAA0B,SAASC,EAAS,OAAA;AAAA;AAAA;AAAA;AAAA,IAI1D,QAAQ,EAAE,MA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MACA,cAAAK;AAAA,MACA,cAAAD;AAAA,MACA,cAAAV;AAAA,MACA,WApBgB,MAAM;AACtB,cAAMG,IAAWG,EAAc,QAAQK,EAAa,OAC9CC,IAAezB,EAAM,QAAQ,SAAY,KAAK,IAAIA,EAAM,KAAKgB,CAAQ,IAAIA;AAC/E,QAAIS,MAAiBzB,EAAM,cACzBM,EAAUmB,CAAY;AAAA,MAE1B;AAAA,MAeE,WA7BgB,MAAM;AACtB,cAAMT,IAAWG,EAAc,QAAQK,EAAa,OAC9CC,IAAezB,EAAM,QAAQ,SAAY,KAAK,IAAIA,EAAM,KAAKgB,CAAQ,IAAIA;AAC/E,QAAIS,MAAiBzB,EAAM,cACzBM,EAAUmB,CAAY;AAAA,MAE1B;AAAA,MAwBE,SAdc,MAAOrB,EAAM,QAAQ;AAAA,MAenC,QAda,MAAOA,EAAM,QAAQ;AAAA,IAclC;AAAA,EAEJ;AACF,CAAC;"}
|
|
1
|
+
{"version":3,"file":"NeonNumber.es.js","sources":["../../../../src/components/user-input/number/NeonNumber.ts?vue&type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, ref, useAttrs } from 'vue';\nimport { NeonFunctionalColor } from '@/model/common/color/NeonFunctionalColor';\nimport { NeonSize } from '@/model/common/size/NeonSize';\nimport { NeonInputMode } from '@/model/user-input/input/NeonInputMode';\nimport NeonButton from '@/components/user-input/button/NeonButton.vue';\nimport NeonFieldGroup from '@/components/user-input/field-group/NeonFieldGroup.vue';\nimport NeonInput from '@/components/user-input/input/NeonInput.vue';\nimport { NeonNumberUtils } from '@/utils/common/number/NeonNumberUtils';\n\n/**\n * <p>\n * The <strong>NeonNumber</strong> component is the equivalent of an <strong><input type=\"number\" /></strong>\n * with -/+ spin buttons. In addition, it supports formatting as a percentage or with a provided custom template and\n * also pasting of values in the user's locale, e.g. 6,543.12.\n * </p>\n * <p><strong>NeonNumber</strong> supports all the properties found on an HTML <input>.</p>\n */\nexport default defineComponent({\n name: 'NeonNumber',\n components: {\n NeonButton,\n NeonFieldGroup,\n NeonInput,\n },\n props: {\n /**\n * The id the input\n */\n id: { type: String, default: null },\n /**\n * The value of the number input. Either a valid number or null.\n */\n modelValue: { type: Number, default: null },\n /**\n * The minimum value the input can accept.\n */\n min: { type: Number, required: false },\n /**\n * The maximum value the input can accept.\n */\n max: { type: Number, required: false },\n /**\n * The step value for the spin buttons.\n */\n step: { type: Number, required: false },\n /**\n * The component color.\n */\n color: { type: String as () => NeonFunctionalColor, default: NeonFunctionalColor.Primary },\n /**\n * The component size.\n */\n size: { type: String as () => NeonSize, default: NeonSize.Medium },\n /**\n * The locale used for display purposes. This defaults to the browser's locale if none is provided.\n */\n locale: { type: String, default: null },\n /**\n * Placeholder text to display in the input\n */\n placeholder: { type: String, default: null },\n /**\n * Whether the component is disabled.\n */\n disabled: { type: Boolean, default: false },\n /**\n * Enable/disable direct editing of the value.\n */\n editable: { type: Boolean, default: true },\n /**\n * Show/hide spin buttons. NOTE: The user can still use up/down arrow keys when the input has focus.\n */\n spinButtons: { type: Boolean, default: false },\n /**\n * Automatically applies % formatting, e.g. if the value = 0.15 it will be displayed as 15%.\n */\n percentage: { type: Boolean, default: false },\n /**\n * The rounding precision for display formatting.\n */\n decimals: { type: Number, required: false },\n /**\n * A template string used for formatting the value for display. Use the placeholder {value} to reference the value in\n * the template string. e.g. value = 90, ${value} => $90.\n */\n valueTemplate: { type: String, required: false },\n /**\n * The HTML inputmode of the component. Either 'numeric' or 'decimal'.\n */\n inputmode: { type: String as () => NeonInputMode, default: NeonInputMode.Numeric },\n /**\n * ARIA label for the increment spinner button.\n */\n incrementLabel: { type: String, default: 'Increment' },\n /**\n * ARIA label for the decrement spinner button.\n */\n decrementLabel: { type: String, default: 'Decrement' },\n },\n emits: [\n /**\n * Emitted when the user changes the value of the number via the increment/decrement buttons or manually entering\n * the value.\n * @type {number | null} the current value or null if the value has been cleared.\n */\n 'update:modelValue',\n ],\n setup(props, { emit }) {\n const attrs = useAttrs();\n const focus = ref(false);\n\n const emitValue = (value: number | null) => {\n if (!props.disabled) {\n emit('update:modelValue', value);\n }\n };\n\n const sanitizedAttributes = computed(() => {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { onBlur, onFocus, ...sanitized } = attrs;\n return sanitized;\n });\n\n const valueChanged = (value: string) => {\n const parsedValue = NeonNumberUtils.parseNumber(value);\n const newValue =\n value !== '' && value !== null\n ? Math.max(Math.min(parsedValue, props.max ?? Number.MAX_SAFE_INTEGER), props.min ?? Number.MIN_SAFE_INTEGER)\n : null;\n if (newValue === null || !isNaN(parsedValue)) {\n emitValue(newValue);\n }\n };\n\n const computedDecimals = computed(() => {\n return props.decimals ?? (props.percentage ? 0 : undefined);\n });\n\n const computedRawDecimals = computed(() => {\n return props.percentage && computedDecimals.value !== undefined\n ? computedDecimals.value + 2\n : computedDecimals.value;\n });\n\n const computedValue = computed(() => {\n const newValue = props.modelValue !== null ? +props.modelValue : props.min ?? 0;\n return computedRawDecimals.value !== undefined ? Number(newValue.toFixed(computedRawDecimals.value)) : newValue;\n });\n\n const formattedValue = computed(() => {\n return props.modelValue !== null &&\n (props.valueTemplate !== undefined || computedDecimals.value !== undefined || props.percentage !== undefined)\n ? NeonNumberUtils.formatNumber(\n props.modelValue,\n {\n decimals: computedDecimals.value,\n format: props.valueTemplate,\n percentage: props.percentage,\n },\n props.locale,\n )\n : props.modelValue;\n });\n\n const rawValue = computed(() => {\n return computedRawDecimals.value !== undefined && props.modelValue !== null\n ? props.modelValue.toFixed(computedRawDecimals.value)\n : props.modelValue === null\n ? ''\n : `${props.modelValue}`;\n });\n\n const displayValue = computed(() => {\n return focus.value ? (rawValue.value !== undefined ? `${rawValue.value}` : '') : formattedValue.value;\n });\n\n const computedStep = computed(() => {\n return props.step ?? (props.percentage ? 0.01 : 1);\n });\n\n const decrement = () => {\n const newValue = computedValue.value - computedStep.value;\n const emittedValue = props.min !== undefined ? Math.max(props.min, newValue) : newValue;\n if (emittedValue !== props.modelValue) {\n emitValue(emittedValue);\n }\n };\n\n const increment = () => {\n const newValue = computedValue.value + computedStep.value;\n const emittedValue = props.max !== undefined ? Math.min(props.max, newValue) : newValue;\n if (emittedValue !== props.modelValue) {\n emitValue(emittedValue);\n }\n };\n\n const onFocus = () => (focus.value = true);\n const onBlur = () => (focus.value = false);\n\n return {\n focus,\n sanitizedAttributes,\n computedDecimals,\n computedRawDecimals,\n computedValue,\n computedStep,\n displayValue,\n valueChanged,\n increment,\n decrement,\n onFocus,\n onBlur,\n };\n },\n});\n"],"names":["_sfc_main","defineComponent","NeonButton","NeonFieldGroup","NeonInput","NeonFunctionalColor","NeonSize","NeonInputMode","props","emit","attrs","useAttrs","focus","ref","emitValue","value","sanitizedAttributes","computed","onBlur","onFocus","sanitized","valueChanged","parsedValue","NeonNumberUtils","newValue","computedDecimals","computedRawDecimals","computedValue","formattedValue","rawValue","displayValue","computedStep","emittedValue"],"mappings":";;;;;;;;AAiBA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,YAAY;AAAA,IACV,YAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,WAAAC;AAAA,EAAA;AAAA,EAEF,OAAO;AAAA;AAAA;AAAA;AAAA,IAIL,IAAI,EAAE,MAAM,QAAQ,SAAS,KAAA;AAAA;AAAA;AAAA;AAAA,IAI7B,YAAY,EAAE,MAAM,QAAQ,SAAS,KAAA;AAAA;AAAA;AAAA;AAAA,IAIrC,KAAK,EAAE,MAAM,QAAQ,UAAU,GAAA;AAAA;AAAA;AAAA;AAAA,IAI/B,KAAK,EAAE,MAAM,QAAQ,UAAU,GAAA;AAAA;AAAA;AAAA;AAAA,IAI/B,MAAM,EAAE,MAAM,QAAQ,UAAU,GAAA;AAAA;AAAA;AAAA;AAAA,IAIhC,OAAO,EAAE,MAAM,QAAqC,SAASC,EAAoB,QAAA;AAAA;AAAA;AAAA;AAAA,IAIjF,MAAM,EAAE,MAAM,QAA0B,SAASC,EAAS,OAAA;AAAA;AAAA;AAAA;AAAA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AS;AAAA,MACA,qBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,cAAAI;AAAA,MACA,cAAAD;AAAA,MACA,cAAAT;AAAA,MACA,WApBgB,MAAM;AACtB,cAAMG,IAAWG,EAAc,QAAQI,EAAa,OAC9CC,IAAexB,EAAM,QAAQ,SAAY,KAAK,IAAIA,EAAM,KAAKgB,CAAQ,IAAIA;AAC/E,QAAIQ,MAAiBxB,EAAM,cACzBM,EAAUkB,CAAY;AAAA,MAE1B;AAAA,MAeE,WA7BgB,MAAM;AACtB,cAAMR,IAAWG,EAAc,QAAQI,EAAa,OAC9CC,IAAexB,EAAM,QAAQ,SAAY,KAAK,IAAIA,EAAM,KAAKgB,CAAQ,IAAIA;AAC/E,QAAIQ,MAAiBxB,EAAM,cACzBM,EAAUkB,CAAY;AAAA,MAE1B;AAAA,MAwBE,SAdc,MAAOpB,EAAM,QAAQ;AAAA,MAenC,QAda,MAAOA,EAAM,QAAQ;AAAA,IAclC;AAAA,EAEJ;AACF,CAAC;"}
|
|
@@ -9,7 +9,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
9
9
|
*/
|
|
10
10
|
label: {
|
|
11
11
|
type: StringConstructor;
|
|
12
|
-
required: true;
|
|
13
12
|
};
|
|
14
13
|
/**
|
|
15
14
|
* The equivalent of the <em>for</em> attribute on an HTML label.
|
|
@@ -67,7 +66,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
66
|
*/
|
|
68
67
|
label: {
|
|
69
68
|
type: StringConstructor;
|
|
70
|
-
required: true;
|
|
71
69
|
};
|
|
72
70
|
/**
|
|
73
71
|
* The equivalent of the <em>for</em> attribute on an HTML label.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aotearoan/neon",
|
|
3
3
|
"description": "Neon is a lightweight design library of Vue 3 components with minimal dependencies.",
|
|
4
|
-
"version": "28.1.
|
|
4
|
+
"version": "28.1.2",
|
|
5
5
|
"main": "./dist/neon.cjs.js",
|
|
6
6
|
"module": "./dist/neon.es.js",
|
|
7
7
|
"types": "./dist/src/neon.d.ts",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
transition: all ease-in-out var(--neon-animation-speed-fast);
|
|
16
16
|
transition: background ease-in-out 0ms;
|
|
17
17
|
|
|
18
|
-
&:active:not(
|
|
19
|
-
&:hover:not(
|
|
18
|
+
&:active:not(.neon-button--disabled),
|
|
19
|
+
&:hover:not(.neon-button--disabled) {
|
|
20
20
|
background: linear-gradient(
|
|
21
21
|
var(--neon-background-gradient-angle),
|
|
22
22
|
var(--neon-gradient-button-c1) var(--neon-background-gradient-offset-hover),
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
&:focus:not(
|
|
27
|
+
&:focus:not(.neon-button--disabled):not(.neon-button--no-outline) {
|
|
28
28
|
@include outline.box-shadow-outline(var(--neon-rgb-#{$from-color}));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
var(--neon-background-solid-button-dark-#{$color})
|
|
38
38
|
);
|
|
39
39
|
|
|
40
|
-
&:hover:not(
|
|
40
|
+
&:hover:not(.neon-button--disabled) {
|
|
41
41
|
background: linear-gradient(
|
|
42
42
|
var(--neon-background-solid-button-light-#{$color}),
|
|
43
43
|
var(--neon-background-solid-button-light-#{$color})
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
&:active:not(
|
|
47
|
+
&:active:not(.neon-button--disabled) {
|
|
48
48
|
background: var(--neon-background-solid-button-dark-#{$color});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
&:focus:not(
|
|
51
|
+
&:focus:not(.neon-button--disabled):not(.neon-button--no-outline) {
|
|
52
52
|
@include outline.box-shadow-outline(var(--neon-background-rgb-solid-button-dark-#{$color}));
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
@include svg.svg-colors(var(--neon-background-outline-button-active-#{$color}));
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
&:hover:not(
|
|
66
|
-
&:active:not(
|
|
65
|
+
&:hover:not(.neon-button--disabled),
|
|
66
|
+
&:active:not(.neon-button--disabled) {
|
|
67
67
|
@if ($color == 'inverse') {
|
|
68
68
|
@include svg.color-with-svg(var(--neon-color-text-secondary));
|
|
69
69
|
} @else {
|
|
@@ -71,17 +71,17 @@
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
&:hover:not(
|
|
74
|
+
&:hover:not(.neon-button--disabled) {
|
|
75
75
|
background: var(--neon-background-outline-button-hover-#{$color});
|
|
76
76
|
border-color: var(--neon-background-outline-button-hover-#{$color});
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
&:active:not(
|
|
79
|
+
&:active:not(.neon-button--disabled) {
|
|
80
80
|
background: var(--neon-background-outline-button-active-#{$color});
|
|
81
81
|
border-color: var(--neon-background-outline-button-active-#{$color});
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
&:focus:not(
|
|
84
|
+
&:focus:not(.neon-button--disabled):not(.neon-button--no-outline) {
|
|
85
85
|
@include outline.box-shadow-outline(var(--neon-rgb-#{$color}));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -94,19 +94,19 @@
|
|
|
94
94
|
background: var(--neon-background-color-text-button);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
&:hover:not(
|
|
98
|
-
&:focus:not(
|
|
97
|
+
&:hover:not(.neon-button--disabled),
|
|
98
|
+
&:focus:not(.neon-button--disabled) {
|
|
99
99
|
background: var(--neon-background-color-text-button-hover);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
&:active:not(
|
|
102
|
+
&:active:not(.neon-button--disabled) {
|
|
103
103
|
background: var(--neon-background-color-text-button-active);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
@mixin input-button($color) {
|
|
108
|
-
&:active:not(
|
|
109
|
-
&:focus:not(
|
|
108
|
+
&:active:not(.neon-button--disabled),
|
|
109
|
+
&:focus:not(.neon-button--disabled) {
|
|
110
110
|
background-color: rgba(var(--neon-rgb-#{$color}), var(--neon-opacity-input-background-active));
|
|
111
111
|
border: var(--neon-border-width-input) var(--neon-border-style) var(--neon-color-#{$color});
|
|
112
112
|
}
|
|
@@ -265,7 +265,7 @@
|
|
|
265
265
|
text-align: left;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
&:active:not(
|
|
268
|
+
&:active:not(.neon-button--disabled) {
|
|
269
269
|
.neon-button__label,
|
|
270
270
|
.neon-icon {
|
|
271
271
|
position: relative;
|
|
@@ -34,7 +34,11 @@
|
|
|
34
34
|
top: calc(1.5 * var(--neon-base-space));
|
|
35
35
|
right: calc(1.5 * var(--neon-base-space));
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
@if ($size == 'l') {
|
|
38
|
+
padding: calc(2.25 * var(--neon-base-space));
|
|
39
|
+
} @else {
|
|
40
|
+
padding: calc(1 * var(--neon-base-space));
|
|
41
|
+
}
|
|
38
42
|
|
|
39
43
|
&.neon-icon--name-close {
|
|
40
44
|
@if ($size == 'l') {
|
|
@@ -224,12 +224,12 @@
|
|
|
224
224
|
--neon-z-index-top: 9999;
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
* The default font size for the page.
|
|
228
|
+
*/
|
|
229
229
|
--neon-base-font-size: 16rem;
|
|
230
230
|
/**
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
* Typography scale multiplier (See <a href="https://type-scale.com/">Major second</a>)
|
|
232
|
+
*/
|
|
233
233
|
--neon-typography-scale: 1.225;
|
|
234
234
|
/**
|
|
235
235
|
* The base typography bottom margin unit used in the typography scale (H*)
|
|
@@ -253,11 +253,6 @@
|
|
|
253
253
|
*/
|
|
254
254
|
--neon-font-size-m: var(--neon-base-font-size);
|
|
255
255
|
|
|
256
|
-
@include responsive.responsive(mobile-large) {
|
|
257
|
-
--neon-font-size-m: 17rem;
|
|
258
|
-
--neon-base-font-size: 17rem;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
256
|
/**
|
|
262
257
|
* The large font size
|
|
263
258
|
*/
|