@aotearoan/neon 23.2.5 → 23.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/enums/NeonFunctionalColor.cjs.js +1 -1
- package/dist/common/enums/NeonFunctionalColor.cjs.js.map +1 -1
- package/dist/common/enums/NeonFunctionalColor.es.js +1 -1
- package/dist/common/enums/NeonFunctionalColor.es.js.map +1 -1
- package/dist/common/utils/NeonClosableUtils.cjs.js +1 -1
- package/dist/common/utils/NeonClosableUtils.cjs.js.map +1 -1
- package/dist/common/utils/NeonClosableUtils.es.js +1 -1
- package/dist/common/utils/NeonClosableUtils.es.js.map +1 -1
- package/dist/components/layout/modal/NeonModal.cjs.js +1 -1
- package/dist/components/layout/modal/NeonModal.cjs.js.map +1 -1
- package/dist/components/layout/modal/NeonModal.es.js +26 -20
- package/dist/components/layout/modal/NeonModal.es.js.map +1 -1
- package/dist/components/layout/modal/NeonModal.vue.cjs.js +1 -1
- package/dist/components/layout/modal/NeonModal.vue.cjs.js.map +1 -1
- package/dist/components/layout/modal/NeonModal.vue.es.js +9 -9
- package/dist/components/layout/modal/NeonModal.vue.es.js.map +1 -1
- package/dist/components/presentation/image-carousel/NeonImageCarousel.vue.cjs.js +1 -1
- package/dist/components/presentation/image-carousel/NeonImageCarousel.vue.cjs.js.map +1 -1
- package/dist/components/presentation/image-carousel/NeonImageCarousel.vue.es.js +15 -15
- package/dist/components/presentation/image-carousel/NeonImageCarousel.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 +13 -9
- package/dist/components/user-input/number/NeonNumber.es.js.map +1 -1
- package/dist/components/user-input/number/NeonNumber.vue.cjs.js +1 -1
- package/dist/components/user-input/number/NeonNumber.vue.cjs.js.map +1 -1
- package/dist/components/user-input/number/NeonNumber.vue.es.js +7 -6
- package/dist/components/user-input/number/NeonNumber.vue.es.js.map +1 -1
- package/dist/src/common/enums/NeonFunctionalColor.d.ts +2 -0
- package/dist/src/common/models/NeonCarouselImage.d.ts +4 -0
- package/dist/src/components/feedback/dialog/NeonDialog.d.ts +11 -6
- package/dist/src/components/layout/modal/NeonModal.d.ts +38 -16
- package/dist/src/components/user-input/number/NeonNumber.d.ts +85 -104
- package/package.json +1 -1
- package/src/sass/color-variables.scss +11 -0
- package/src/sass/components/_button.scss +4 -1
- package/src/sass/components/_date-picker.scss +2 -0
- package/src/sass/components/_field-group.scss +8 -1
- package/src/sass/components/_input-indicator.scss +2 -0
- package/src/sass/components/_menu.scss +17 -10
- package/src/sass/components/_mobile-menu.scss +6 -6
- package/src/sass/components/_modal.scss +73 -53
- package/src/sass/components/_select.scss +2 -0
- package/src/sass/components/_stepper.scss +0 -7
- package/src/sass/global/_base-html.scss +4 -0
- package/src/sass/global/_typography.scss +4 -0
- package/src/sass/includes/_palettes.scss +2 -0
- package/src/sass/palette.scss +10 -0
- package/src/sass/theme.scss +1 -0
- package/src/sass/variables.scss +41 -6
|
@@ -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 '@/common/enums/NeonFunctionalColor';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonInputMode } from '@/common/enums/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 '@/common/utils/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 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":"qZAiBAA,EAAeC,kBAAgB,CAC7B,KAAM,aACN,WAAY,CACV,WAAAC,EACA,eAAAC,EACA,UAAAC,CAAA,EAEF,MAAO,CAIL,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,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type=script&src=true&lang.ts"],"sourcesContent":["import { computed, defineComponent, ref, useAttrs } from 'vue';\nimport { NeonFunctionalColor } from '@/common/enums/NeonFunctionalColor';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonInputMode } from '@/common/enums/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 '@/common/utils/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":"qZAiBAA,EAAeC,kBAAgB,CAC7B,KAAM,aACN,WAAY,CACV,WAAAC,EACA,eAAAC,EACA,UAAAC,CAAA,EAEF,MAAO,CAIL,GAAI,CAAE,KAAM,OAAQ,QAAS,IAAA,EAI7B,WA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UApBgB,IAAM,CACtB,MAAMG,EAAWG,EAAc,MAAQK,EAAa,MAC9CC,EAAezB,EAAM,MAAQ,OAAY,KAAK,IAAIA,EAAM,IAAKgB,CAAQ,EAAIA,EAC3ES,IAAiBzB,EAAM,YACzBM,EAAUmB,CAAY,CAE1B,EAeE,UA7BgB,IAAM,CACtB,MAAMT,EAAWG,EAAc,MAAQK,EAAa,MAC9CC,EAAezB,EAAM,MAAQ,OAAY,KAAK,IAAIA,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,11 +1,11 @@
|
|
|
1
1
|
import { defineComponent as g, useAttrs as S, ref as B, computed as a } from "vue";
|
|
2
2
|
import { NeonFunctionalColor as F } from "../../../common/enums/NeonFunctionalColor.es.js";
|
|
3
|
-
import { NeonSize as
|
|
4
|
-
import { NeonInputMode as
|
|
3
|
+
import { NeonSize as p } from "../../../common/enums/NeonSize.es.js";
|
|
4
|
+
import { NeonInputMode as x } from "../../../common/enums/NeonInputMode.es.js";
|
|
5
5
|
import M from "../button/NeonButton.vue.es.js";
|
|
6
6
|
import h from "../field-group/NeonFieldGroup.vue.es.js";
|
|
7
7
|
import w from "../input/NeonInput.vue.es.js";
|
|
8
|
-
import { NeonNumberUtils as
|
|
8
|
+
import { NeonNumberUtils as f } from "../../../common/utils/NeonNumberUtils.es.js";
|
|
9
9
|
const P = g({
|
|
10
10
|
name: "NeonNumber",
|
|
11
11
|
components: {
|
|
@@ -14,6 +14,10 @@ const P = g({
|
|
|
14
14
|
NeonInput: w
|
|
15
15
|
},
|
|
16
16
|
props: {
|
|
17
|
+
/**
|
|
18
|
+
* The id the input
|
|
19
|
+
*/
|
|
20
|
+
id: { type: String, default: null },
|
|
17
21
|
/**
|
|
18
22
|
* The value of the number input. Either a valid number or null.
|
|
19
23
|
*/
|
|
@@ -37,7 +41,7 @@ const P = g({
|
|
|
37
41
|
/**
|
|
38
42
|
* The component size.
|
|
39
43
|
*/
|
|
40
|
-
size: { type: String, default:
|
|
44
|
+
size: { type: String, default: p.Medium },
|
|
41
45
|
/**
|
|
42
46
|
* The locale used for display purposes. This defaults to the browser's locale if none is provided.
|
|
43
47
|
*/
|
|
@@ -74,7 +78,7 @@ const P = g({
|
|
|
74
78
|
/**
|
|
75
79
|
* The HTML inputmode of the component. Either 'numeric' or 'decimal'.
|
|
76
80
|
*/
|
|
77
|
-
inputmode: { type: String, default:
|
|
81
|
+
inputmode: { type: String, default: x.Numeric },
|
|
78
82
|
/**
|
|
79
83
|
* ARIA label for the increment spinner button.
|
|
80
84
|
*/
|
|
@@ -92,19 +96,19 @@ const P = g({
|
|
|
92
96
|
*/
|
|
93
97
|
"update:modelValue"
|
|
94
98
|
],
|
|
95
|
-
setup(e, { emit:
|
|
99
|
+
setup(e, { emit: s }) {
|
|
96
100
|
const v = S(), o = B(!1), r = (t) => {
|
|
97
|
-
e.disabled ||
|
|
101
|
+
e.disabled || s("update:modelValue", t);
|
|
98
102
|
}, N = a(() => {
|
|
99
103
|
const { onBlur: t, onFocus: l, ...m } = v;
|
|
100
104
|
return m;
|
|
101
105
|
}), V = (t) => {
|
|
102
|
-
const l =
|
|
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;
|
|
103
107
|
(m === null || !isNaN(l)) && r(m);
|
|
104
108
|
}, u = a(() => e.decimals ?? (e.percentage ? 0 : void 0)), n = a(() => e.percentage && u.value !== void 0 ? u.value + 2 : u.value), i = a(() => {
|
|
105
109
|
const t = e.modelValue !== null ? +e.modelValue : e.min || 0;
|
|
106
110
|
return n.value !== void 0 ? Number(t.toFixed(n.value)) : t;
|
|
107
|
-
}), y = a(() => e.modelValue !== null && (e.valueTemplate !== void 0 || u.value !== void 0 || e.percentage !== void 0) ?
|
|
111
|
+
}), y = a(() => e.modelValue !== null && (e.valueTemplate !== void 0 || u.value !== void 0 || e.percentage !== void 0) ? f.formatNumber(
|
|
108
112
|
e.modelValue,
|
|
109
113
|
{
|
|
110
114
|
decimals: u.value,
|
|
@@ -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 '@/common/enums/NeonFunctionalColor';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonInputMode } from '@/common/enums/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 '@/common/utils/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 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,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,MAAM,QAAQ,SAAS,KAAA;AAAA;AAAA;AAAA;AAAA,IAIjC,aAAa,EAAE,MAAM,QAAQ,SAAS,KAAA;AAAA;AAAA;AAAA;AAAA,IAItC,UAAU,EAAE,MAAM,SAAS,SAAS,GAAA;AAAA;AAAA;AAAA;AAAA,IAIpC,UAAU,EAAE,MAAM,SAAS,SAAS,GAAA;AAAA;AAAA;AAAA;AAAA,IAIpC,aAAa,EAAE,MAAM,SAAS,SAAS,GAAA;AAAA;AAAA;AAAA;AAAA,IAIvC,YAAY,EAAE,MAAM,SAAS,SAAS,GAAA;AAAA;AAAA;AAAA;AAAA,IAItC,UAAU,EAAE,MAAM,QAAQ,UAAU,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKpC,eAAe,EAAE,MAAM,QAAQ,UAAU,GAAA;A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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 '@/common/enums/NeonFunctionalColor';\nimport { NeonSize } from '@/common/enums/NeonSize';\nimport { NeonInputMode } from '@/common/enums/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 '@/common/utils/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":";;;;;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;AAAA,IAclC;AAAA,EAEJ;AACF,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const s=require("./NeonNumber.cjs.js"),n=require("vue"),u=require("../../../_virtual/_plugin-vue_export-helper.cjs.js");function d(e,o,m,p,b,v){const i=n.resolveComponent("neon-button"),r=n.resolveComponent("neon-input"),a=n.resolveComponent("neon-field-group");return n.openBlock(),n.createBlock(a,{class:n.normalizeClass([[`neon-number--${e.size}`,`neon-number--${e.color}`,{"neon-number--disabled":e.disabled,"neon-number--editable":e.editable,"neon-number--with-buttons":e.spinButtons}],"neon-number"]),"indicator-style":"external"},{default:n.withCtx(()=>[e.spinButtons?(n.openBlock(),n.createBlock(i,{key:0,"aria-label":e.decrementLabel,color:e.color,disabled:e.disabled||e.min!==void 0&&e.min===e.modelValue,size:e.size,"button-style":"outline",class:"neon-number__decrement",icon:"minus",onClick:o[0]||(o[0]=l=>e.decrement())},null,8,["aria-label","color","disabled","size"])):n.createCommentVNode("",!0),n.createVNode(r,n.mergeProps({"aria-valuemax":e.max,"aria-valuemin":e.min,"aria-valuenow":e.modelValue,color:e.color,disabled:e.disabled||!e.editable,inputmode:e.inputmode,max:e.max,min:e.min,"model-value":e.displayValue,placeholder:e.placeholder,size:e.size,step:e.computedStep,class:"neon-number__input",role:"spinbutton",type:"text"},e.sanitizedAttributes,{onBlur:o[1]||(o[1]=l=>e.onBlur()),onFocus:o[2]||(o[2]=l=>e.onFocus()),"onUpdate:modelValue":e.valueChanged,onKeydown:[o[3]||(o[3]=n.withKeys(n.withModifiers(l=>e.increment(),["prevent"]),["up"])),o[4]||(o[4]=n.withKeys(n.withModifiers(l=>e.decrement(),["prevent"]),["down"]))]}),null,16,["aria-valuemax","aria-valuemin","aria-valuenow","color","disabled","inputmode","max","min","model-value","placeholder","size","step","onUpdate:modelValue"]),e.spinButtons?(n.openBlock(),n.createBlock(i,{key:1,"aria-label":e.incrementLabel,color:e.color,disabled:e.disabled||e.max!==void 0&&e.max===e.modelValue,size:e.size,"button-style":"outline",class:"neon-number__increment",icon:"plus",onClick:o[5]||(o[5]=l=>e.increment())},null,8,["aria-label","color","disabled","size"])):n.createCommentVNode("",!0)]),_:1},8,["class"])}const t=u(s,[["render",d]]);module.exports=t;
|
|
1
|
+
"use strict";const s=require("./NeonNumber.cjs.js"),n=require("vue"),u=require("../../../_virtual/_plugin-vue_export-helper.cjs.js");function d(e,o,m,p,b,v){const i=n.resolveComponent("neon-button"),r=n.resolveComponent("neon-input"),a=n.resolveComponent("neon-field-group");return n.openBlock(),n.createBlock(a,{class:n.normalizeClass([[`neon-number--${e.size}`,`neon-number--${e.color}`,{"neon-number--disabled":e.disabled,"neon-number--editable":e.editable,"neon-number--with-buttons":e.spinButtons}],"neon-number"]),"indicator-style":"external"},{default:n.withCtx(()=>[e.spinButtons?(n.openBlock(),n.createBlock(i,{key:0,"aria-label":e.decrementLabel,color:e.color,disabled:e.disabled||e.min!==void 0&&e.min===e.modelValue,size:e.size,"button-style":"outline",class:"neon-number__decrement",icon:"minus",onClick:o[0]||(o[0]=l=>e.decrement())},null,8,["aria-label","color","disabled","size"])):n.createCommentVNode("",!0),n.createVNode(r,n.mergeProps({id:e.id,"aria-valuemax":e.max,"aria-valuemin":e.min,"aria-valuenow":e.modelValue,color:e.color,disabled:e.disabled||!e.editable,inputmode:e.inputmode,max:e.max,min:e.min,"model-value":e.displayValue,placeholder:e.placeholder,size:e.size,step:e.computedStep,class:"neon-number__input",role:"spinbutton",type:"text"},e.sanitizedAttributes,{onBlur:o[1]||(o[1]=l=>e.onBlur()),onFocus:o[2]||(o[2]=l=>e.onFocus()),"onUpdate:modelValue":e.valueChanged,onKeydown:[o[3]||(o[3]=n.withKeys(n.withModifiers(l=>e.increment(),["prevent"]),["up"])),o[4]||(o[4]=n.withKeys(n.withModifiers(l=>e.decrement(),["prevent"]),["down"]))]}),null,16,["id","aria-valuemax","aria-valuemin","aria-valuenow","color","disabled","inputmode","max","min","model-value","placeholder","size","step","onUpdate:modelValue"]),e.spinButtons?(n.openBlock(),n.createBlock(i,{key:1,"aria-label":e.incrementLabel,color:e.color,disabled:e.disabled||e.max!==void 0&&e.max===e.modelValue,size:e.size,"button-style":"outline",class:"neon-number__increment",icon:"plus",onClick:o[5]||(o[5]=l=>e.increment())},null,8,["aria-label","color","disabled","size"])):n.createCommentVNode("",!0)]),_:1},8,["class"])}const t=u(s,[["render",d]]);module.exports=t;
|
|
2
2
|
//# sourceMappingURL=NeonNumber.vue.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonNumber.vue.cjs.js","sources":["../../../../src/components/user-input/number/NeonNumber.vue"],"sourcesContent":["<template>\n <neon-field-group\n :class=\"[\n `neon-number--${size}`,\n `neon-number--${color}`,\n {\n 'neon-number--disabled': disabled,\n 'neon-number--editable': editable,\n 'neon-number--with-buttons': spinButtons,\n },\n ]\"\n class=\"neon-number\"\n indicator-style=\"external\"\n >\n <neon-button\n v-if=\"spinButtons\"\n :aria-label=\"decrementLabel\"\n :color=\"color\"\n :disabled=\"disabled || (min !== undefined && min === modelValue)\"\n :size=\"size\"\n button-style=\"outline\"\n class=\"neon-number__decrement\"\n icon=\"minus\"\n @click=\"decrement()\"\n />\n <neon-input\n :aria-valuemax=\"max\"\n :aria-valuemin=\"min\"\n :aria-valuenow=\"modelValue\"\n :color=\"color\"\n :disabled=\"disabled || !editable\"\n :inputmode=\"inputmode\"\n :max=\"max\"\n :min=\"min\"\n :model-value=\"displayValue\"\n :placeholder=\"placeholder\"\n :size=\"size\"\n :step=\"computedStep\"\n class=\"neon-number__input\"\n role=\"spinbutton\"\n type=\"text\"\n v-bind=\"sanitizedAttributes\"\n @blur=\"onBlur()\"\n @focus=\"onFocus()\"\n @update:modelValue=\"valueChanged\"\n @keydown.up.prevent=\"increment()\"\n @keydown.down.prevent=\"decrement()\"\n />\n <neon-button\n v-if=\"spinButtons\"\n :aria-label=\"incrementLabel\"\n :color=\"color\"\n :disabled=\"disabled || (max !== undefined && max === modelValue)\"\n :size=\"size\"\n button-style=\"outline\"\n class=\"neon-number__increment\"\n icon=\"plus\"\n @click=\"increment()\"\n />\n </neon-field-group>\n</template>\n\n<script lang=\"ts\" src=\"./NeonNumber.ts\" />\n"],"names":["_createBlock","_component_neon_field_group","_normalizeClass","_ctx","_component_neon_button","_createVNode","_component_neon_input","_mergeProps"],"mappings":"wSACEA,EAAAA,
|
|
1
|
+
{"version":3,"file":"NeonNumber.vue.cjs.js","sources":["../../../../src/components/user-input/number/NeonNumber.vue"],"sourcesContent":["<template>\n <neon-field-group\n :class=\"[\n `neon-number--${size}`,\n `neon-number--${color}`,\n {\n 'neon-number--disabled': disabled,\n 'neon-number--editable': editable,\n 'neon-number--with-buttons': spinButtons,\n },\n ]\"\n class=\"neon-number\"\n indicator-style=\"external\"\n >\n <neon-button\n v-if=\"spinButtons\"\n :aria-label=\"decrementLabel\"\n :color=\"color\"\n :disabled=\"disabled || (min !== undefined && min === modelValue)\"\n :size=\"size\"\n button-style=\"outline\"\n class=\"neon-number__decrement\"\n icon=\"minus\"\n @click=\"decrement()\"\n />\n <neon-input\n :id=\"id\"\n :aria-valuemax=\"max\"\n :aria-valuemin=\"min\"\n :aria-valuenow=\"modelValue\"\n :color=\"color\"\n :disabled=\"disabled || !editable\"\n :inputmode=\"inputmode\"\n :max=\"max\"\n :min=\"min\"\n :model-value=\"displayValue\"\n :placeholder=\"placeholder\"\n :size=\"size\"\n :step=\"computedStep\"\n class=\"neon-number__input\"\n role=\"spinbutton\"\n type=\"text\"\n v-bind=\"sanitizedAttributes\"\n @blur=\"onBlur()\"\n @focus=\"onFocus()\"\n @update:modelValue=\"valueChanged\"\n @keydown.up.prevent=\"increment()\"\n @keydown.down.prevent=\"decrement()\"\n />\n <neon-button\n v-if=\"spinButtons\"\n :aria-label=\"incrementLabel\"\n :color=\"color\"\n :disabled=\"disabled || (max !== undefined && max === modelValue)\"\n :size=\"size\"\n button-style=\"outline\"\n class=\"neon-number__increment\"\n icon=\"plus\"\n @click=\"increment()\"\n />\n </neon-field-group>\n</template>\n\n<script lang=\"ts\" src=\"./NeonNumber.ts\" />\n"],"names":["_createBlock","_component_neon_field_group","_normalizeClass","_ctx","_component_neon_button","_createVNode","_component_neon_input","_mergeProps"],"mappings":"wSACEA,EAAAA,YA2DmBC,EAAA,CA1DhB,MAAKC,EAAAA,eAAA,CAAA,iBAA0BC,EAAA,IAAI,mBAA0BA,EAAA,KAAK,4BAA6CA,EAAA,iCAA2CA,EAAA,qCAA+CA,EAAA,cASpM,aAAa,CAAA,EACnB,kBAAgB,+BAEhB,IAUE,CATMA,EAAA,2BADRH,EAAAA,YAUEI,EAAA,OARC,aAAYD,EAAA,eACZ,MAAOA,EAAA,MACP,SAAUA,YAAaA,EAAA,MAAQ,QAAaA,EAAA,MAAQA,EAAA,WACpD,KAAMA,EAAA,KACP,eAAa,UACb,MAAM,yBACN,KAAK,QACJ,uBAAOA,EAAA,4FAEVE,EAAAA,YAuBEC,EAvBFC,aAuBE,CAtBC,GAAIJ,EAAA,GACJ,gBAAeA,EAAA,IACf,gBAAeA,EAAA,IACf,gBAAeA,EAAA,WACf,MAAOA,EAAA,MACP,SAAUA,EAAA,UAAQ,CAAKA,EAAA,SACvB,UAAWA,EAAA,UACX,IAAKA,EAAA,IACL,IAAKA,EAAA,IACL,cAAaA,EAAA,aACb,YAAaA,EAAA,YACb,KAAMA,EAAA,KACN,KAAMA,EAAA,aACP,MAAM,qBACN,KAAK,aACL,KAAK,QACGA,EAAA,oBAAmB,CAC1B,sBAAMA,EAAA,OAAM,GACZ,uBAAOA,EAAA,QAAO,GACd,sBAAmBA,EAAA,aACnB,UAAO,2CAAaA,EAAA,UAAS,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,IAAA,CAAA,6CACPA,EAAA,UAAS,EAAA,CAAA,SAAA,CAAA,EAAA,CAAA,MAAA,CAAA,iLAG1BA,EAAA,2BADRH,EAAAA,YAUEI,EAAA,OARC,aAAYD,EAAA,eACZ,MAAOA,EAAA,MACP,SAAUA,YAAaA,EAAA,MAAQ,QAAaA,EAAA,MAAQA,EAAA,WACpD,KAAMA,EAAA,KACP,eAAa,UACb,MAAM,yBACN,KAAK,OACJ,uBAAOA,EAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import p from "./NeonNumber.es.js";
|
|
2
|
-
import { resolveComponent as l, openBlock as i, createBlock as a, normalizeClass as b, withCtx as v, createCommentVNode as
|
|
2
|
+
import { resolveComponent as l, openBlock as i, createBlock as a, normalizeClass as b, withCtx as v, createCommentVNode as d, createVNode as f, mergeProps as z, withKeys as s, withModifiers as u } from "vue";
|
|
3
3
|
import $ from "../../../_virtual/_plugin-vue_export-helper.es.js";
|
|
4
4
|
function y(e, n, w, V, B, C) {
|
|
5
5
|
const r = l("neon-button"), m = l("neon-input"), t = l("neon-field-group");
|
|
@@ -26,8 +26,9 @@ function y(e, n, w, V, B, C) {
|
|
|
26
26
|
class: "neon-number__decrement",
|
|
27
27
|
icon: "minus",
|
|
28
28
|
onClick: n[0] || (n[0] = (o) => e.decrement())
|
|
29
|
-
}, null, 8, ["aria-label", "color", "disabled", "size"])) :
|
|
29
|
+
}, null, 8, ["aria-label", "color", "disabled", "size"])) : d("", !0),
|
|
30
30
|
f(m, z({
|
|
31
|
+
id: e.id,
|
|
31
32
|
"aria-valuemax": e.max,
|
|
32
33
|
"aria-valuemin": e.min,
|
|
33
34
|
"aria-valuenow": e.modelValue,
|
|
@@ -48,10 +49,10 @@ function y(e, n, w, V, B, C) {
|
|
|
48
49
|
onFocus: n[2] || (n[2] = (o) => e.onFocus()),
|
|
49
50
|
"onUpdate:modelValue": e.valueChanged,
|
|
50
51
|
onKeydown: [
|
|
51
|
-
n[3] || (n[3] =
|
|
52
|
-
n[4] || (n[4] =
|
|
52
|
+
n[3] || (n[3] = s(u((o) => e.increment(), ["prevent"]), ["up"])),
|
|
53
|
+
n[4] || (n[4] = s(u((o) => e.decrement(), ["prevent"]), ["down"]))
|
|
53
54
|
]
|
|
54
|
-
}), null, 16, ["aria-valuemax", "aria-valuemin", "aria-valuenow", "color", "disabled", "inputmode", "max", "min", "model-value", "placeholder", "size", "step", "onUpdate:modelValue"]),
|
|
55
|
+
}), null, 16, ["id", "aria-valuemax", "aria-valuemin", "aria-valuenow", "color", "disabled", "inputmode", "max", "min", "model-value", "placeholder", "size", "step", "onUpdate:modelValue"]),
|
|
55
56
|
e.spinButtons ? (i(), a(r, {
|
|
56
57
|
key: 1,
|
|
57
58
|
"aria-label": e.incrementLabel,
|
|
@@ -62,7 +63,7 @@ function y(e, n, w, V, B, C) {
|
|
|
62
63
|
class: "neon-number__increment",
|
|
63
64
|
icon: "plus",
|
|
64
65
|
onClick: n[5] || (n[5] = (o) => e.increment())
|
|
65
|
-
}, null, 8, ["aria-label", "color", "disabled", "size"])) :
|
|
66
|
+
}, null, 8, ["aria-label", "color", "disabled", "size"])) : d("", !0)
|
|
66
67
|
]),
|
|
67
68
|
_: 1
|
|
68
69
|
}, 8, ["class"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NeonNumber.vue.es.js","sources":["../../../../src/components/user-input/number/NeonNumber.vue"],"sourcesContent":["<template>\n <neon-field-group\n :class=\"[\n `neon-number--${size}`,\n `neon-number--${color}`,\n {\n 'neon-number--disabled': disabled,\n 'neon-number--editable': editable,\n 'neon-number--with-buttons': spinButtons,\n },\n ]\"\n class=\"neon-number\"\n indicator-style=\"external\"\n >\n <neon-button\n v-if=\"spinButtons\"\n :aria-label=\"decrementLabel\"\n :color=\"color\"\n :disabled=\"disabled || (min !== undefined && min === modelValue)\"\n :size=\"size\"\n button-style=\"outline\"\n class=\"neon-number__decrement\"\n icon=\"minus\"\n @click=\"decrement()\"\n />\n <neon-input\n :aria-valuemax=\"max\"\n :aria-valuemin=\"min\"\n :aria-valuenow=\"modelValue\"\n :color=\"color\"\n :disabled=\"disabled || !editable\"\n :inputmode=\"inputmode\"\n :max=\"max\"\n :min=\"min\"\n :model-value=\"displayValue\"\n :placeholder=\"placeholder\"\n :size=\"size\"\n :step=\"computedStep\"\n class=\"neon-number__input\"\n role=\"spinbutton\"\n type=\"text\"\n v-bind=\"sanitizedAttributes\"\n @blur=\"onBlur()\"\n @focus=\"onFocus()\"\n @update:modelValue=\"valueChanged\"\n @keydown.up.prevent=\"increment()\"\n @keydown.down.prevent=\"decrement()\"\n />\n <neon-button\n v-if=\"spinButtons\"\n :aria-label=\"incrementLabel\"\n :color=\"color\"\n :disabled=\"disabled || (max !== undefined && max === modelValue)\"\n :size=\"size\"\n button-style=\"outline\"\n class=\"neon-number__increment\"\n icon=\"plus\"\n @click=\"increment()\"\n />\n </neon-field-group>\n</template>\n\n<script lang=\"ts\" src=\"./NeonNumber.ts\" />\n"],"names":["_createBlock","_component_neon_field_group","_normalizeClass","_ctx","_component_neon_button","_createVNode","_component_neon_input","_mergeProps"],"mappings":";;;;;cACEA,
|
|
1
|
+
{"version":3,"file":"NeonNumber.vue.es.js","sources":["../../../../src/components/user-input/number/NeonNumber.vue"],"sourcesContent":["<template>\n <neon-field-group\n :class=\"[\n `neon-number--${size}`,\n `neon-number--${color}`,\n {\n 'neon-number--disabled': disabled,\n 'neon-number--editable': editable,\n 'neon-number--with-buttons': spinButtons,\n },\n ]\"\n class=\"neon-number\"\n indicator-style=\"external\"\n >\n <neon-button\n v-if=\"spinButtons\"\n :aria-label=\"decrementLabel\"\n :color=\"color\"\n :disabled=\"disabled || (min !== undefined && min === modelValue)\"\n :size=\"size\"\n button-style=\"outline\"\n class=\"neon-number__decrement\"\n icon=\"minus\"\n @click=\"decrement()\"\n />\n <neon-input\n :id=\"id\"\n :aria-valuemax=\"max\"\n :aria-valuemin=\"min\"\n :aria-valuenow=\"modelValue\"\n :color=\"color\"\n :disabled=\"disabled || !editable\"\n :inputmode=\"inputmode\"\n :max=\"max\"\n :min=\"min\"\n :model-value=\"displayValue\"\n :placeholder=\"placeholder\"\n :size=\"size\"\n :step=\"computedStep\"\n class=\"neon-number__input\"\n role=\"spinbutton\"\n type=\"text\"\n v-bind=\"sanitizedAttributes\"\n @blur=\"onBlur()\"\n @focus=\"onFocus()\"\n @update:modelValue=\"valueChanged\"\n @keydown.up.prevent=\"increment()\"\n @keydown.down.prevent=\"decrement()\"\n />\n <neon-button\n v-if=\"spinButtons\"\n :aria-label=\"incrementLabel\"\n :color=\"color\"\n :disabled=\"disabled || (max !== undefined && max === modelValue)\"\n :size=\"size\"\n button-style=\"outline\"\n class=\"neon-number__increment\"\n icon=\"plus\"\n @click=\"increment()\"\n />\n </neon-field-group>\n</template>\n\n<script lang=\"ts\" src=\"./NeonNumber.ts\" />\n"],"names":["_createBlock","_component_neon_field_group","_normalizeClass","_ctx","_component_neon_button","_createVNode","_component_neon_input","_mergeProps"],"mappings":";;;;;cACEA,EA2DmBC,GAAA;AAAA,IA1DhB,OAAKC,EAAA,CAAA;AAAA,sBAA0BC,EAAA,IAAI;AAAA,sBAA0BA,EAAA,KAAK;AAAA;iCAA6CA,EAAA;AAAA,iCAA2CA,EAAA;AAAA,qCAA+CA,EAAA;AAAA;OASpM,aAAa,CAAA;AAAA,IACnB,mBAAgB;AAAA;eAEhB,MAUE;AAAA,MATMA,EAAA,oBADRH,EAUEI,GAAA;AAAA;QARC,cAAYD,EAAA;AAAA,QACZ,OAAOA,EAAA;AAAA,QACP,UAAUA,cAAaA,EAAA,QAAQ,UAAaA,EAAA,QAAQA,EAAA;AAAA,QACpD,MAAMA,EAAA;AAAA,QACP,gBAAa;AAAA,QACb,OAAM;AAAA,QACN,MAAK;AAAA,QACJ,gCAAOA,EAAA;;MAEVE,EAuBEC,GAvBFC,EAuBE;AAAA,QAtBC,IAAIJ,EAAA;AAAA,QACJ,iBAAeA,EAAA;AAAA,QACf,iBAAeA,EAAA;AAAA,QACf,iBAAeA,EAAA;AAAA,QACf,OAAOA,EAAA;AAAA,QACP,UAAUA,EAAA,YAAQ,CAAKA,EAAA;AAAA,QACvB,WAAWA,EAAA;AAAA,QACX,KAAKA,EAAA;AAAA,QACL,KAAKA,EAAA;AAAA,QACL,eAAaA,EAAA;AAAA,QACb,aAAaA,EAAA;AAAA,QACb,MAAMA,EAAA;AAAA,QACN,MAAMA,EAAA;AAAA,QACP,OAAM;AAAA,QACN,MAAK;AAAA,QACL,MAAK;AAAA,SACGA,EAAA,qBAAmB;AAAA,QAC1B,+BAAMA,EAAA,OAAM;AAAA,QACZ,gCAAOA,EAAA,QAAO;AAAA,QACd,uBAAmBA,EAAA;AAAA,QACnB,WAAO;AAAA,qCAAaA,EAAA,UAAS,GAAA,CAAA,SAAA,CAAA,GAAA,CAAA,IAAA,CAAA;AAAA,qCACPA,EAAA,UAAS,GAAA,CAAA,SAAA,CAAA,GAAA,CAAA,MAAA,CAAA;AAAA;;MAG1BA,EAAA,oBADRH,EAUEI,GAAA;AAAA;QARC,cAAYD,EAAA;AAAA,QACZ,OAAOA,EAAA;AAAA,QACP,UAAUA,cAAaA,EAAA,QAAQ,UAAaA,EAAA,QAAQA,EAAA;AAAA,QACpD,MAAMA,EAAA;AAAA,QACP,gBAAa;AAAA,QACb,OAAM;AAAA,QACN,MAAK;AAAA,QACJ,gCAAOA,EAAA;;;;;;;"}
|
|
@@ -14,6 +14,8 @@ export declare enum NeonFunctionalColor {
|
|
|
14
14
|
HighContrast = "high-contrast",
|
|
15
15
|
/** Brand is the main brand color palette, this is useful for branded CTAs, text & controls. */
|
|
16
16
|
Brand = "brand",
|
|
17
|
+
/** Accent is an alternative brand accent palette used when multiple brand colors are required */
|
|
18
|
+
Accent = "accent",
|
|
17
19
|
/** Primary is the main application color palette. For most applications this will be used by default. */
|
|
18
20
|
Primary = "primary",
|
|
19
21
|
/** Info can be used to convey informational context, e.g. notes & alerts */
|
|
@@ -618,9 +618,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
618
618
|
required: true;
|
|
619
619
|
};
|
|
620
620
|
dismissible: {
|
|
621
|
-
type: BooleanConstructor;
|
|
622
|
-
* The color of the button for the confirm (positive) action.
|
|
623
|
-
*/
|
|
621
|
+
type: BooleanConstructor;
|
|
624
622
|
default: boolean;
|
|
625
623
|
};
|
|
626
624
|
opaque: {
|
|
@@ -631,6 +629,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
631
629
|
type: BooleanConstructor;
|
|
632
630
|
default: boolean;
|
|
633
631
|
};
|
|
632
|
+
breakpoint: {
|
|
633
|
+
type: () => import("../../../neon").NeonResponsive;
|
|
634
|
+
default: import("../../../neon").NeonResponsive;
|
|
635
|
+
};
|
|
634
636
|
}>, {
|
|
635
637
|
modal: import("vue").Ref<null, null>;
|
|
636
638
|
close: () => void;
|
|
@@ -640,9 +642,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
640
642
|
required: true;
|
|
641
643
|
};
|
|
642
644
|
dismissible: {
|
|
643
|
-
type: BooleanConstructor;
|
|
644
|
-
* The color of the button for the confirm (positive) action.
|
|
645
|
-
*/
|
|
645
|
+
type: BooleanConstructor;
|
|
646
646
|
default: boolean;
|
|
647
647
|
};
|
|
648
648
|
opaque: {
|
|
@@ -653,10 +653,15 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
653
653
|
type: BooleanConstructor;
|
|
654
654
|
default: boolean;
|
|
655
655
|
};
|
|
656
|
+
breakpoint: {
|
|
657
|
+
type: () => import("../../../neon").NeonResponsive;
|
|
658
|
+
default: import("../../../neon").NeonResponsive;
|
|
659
|
+
};
|
|
656
660
|
}>> & Readonly<{
|
|
657
661
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
658
662
|
}>, {
|
|
659
663
|
dismissible: boolean;
|
|
664
|
+
breakpoint: import("../../../neon").NeonResponsive;
|
|
660
665
|
opaque: boolean;
|
|
661
666
|
showTopNav: boolean;
|
|
662
667
|
}, {}, {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NeonResponsive } from '@/common/enums/NeonResponsive';
|
|
1
2
|
/**
|
|
2
3
|
* A modal dialog component. This will be rendered above the content of the main window and can either be dismissed by the user or configured to require user interaction before dismissal.
|
|
3
4
|
*/
|
|
@@ -30,6 +31,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
30
31
|
type: BooleanConstructor;
|
|
31
32
|
default: boolean;
|
|
32
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* Responsive breakpoint below which point the modal becomes fullscreen.
|
|
36
|
+
* Supports NeonResponsive.Mobile & NeonResponsive.MobileLarge.
|
|
37
|
+
*/
|
|
38
|
+
breakpoint: {
|
|
39
|
+
type: () => NeonResponsive;
|
|
40
|
+
default: NeonResponsive;
|
|
41
|
+
};
|
|
33
42
|
}>, {
|
|
34
43
|
modal: import("vue").Ref<null, null>;
|
|
35
44
|
close: () => void;
|
|
@@ -62,10 +71,19 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
62
71
|
type: BooleanConstructor;
|
|
63
72
|
default: boolean;
|
|
64
73
|
};
|
|
74
|
+
/**
|
|
75
|
+
* Responsive breakpoint below which point the modal becomes fullscreen.
|
|
76
|
+
* Supports NeonResponsive.Mobile & NeonResponsive.MobileLarge.
|
|
77
|
+
*/
|
|
78
|
+
breakpoint: {
|
|
79
|
+
type: () => NeonResponsive;
|
|
80
|
+
default: NeonResponsive;
|
|
81
|
+
};
|
|
65
82
|
}>> & Readonly<{
|
|
66
83
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
67
84
|
}>, {
|
|
68
85
|
dismissible: boolean;
|
|
86
|
+
breakpoint: NeonResponsive;
|
|
69
87
|
opaque: boolean;
|
|
70
88
|
showTopNav: boolean;
|
|
71
89
|
}, {}, {
|
|
@@ -80,8 +98,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
80
98
|
};
|
|
81
99
|
size: {
|
|
82
100
|
type: () => import("../../../neon").NeonButtonSize;
|
|
83
|
-
default: import("../../../neon").NeonButtonSize;
|
|
84
|
-
|
|
101
|
+
default: import("../../../neon").NeonButtonSize; /**
|
|
102
|
+
* Emitted when the modal is closed.
|
|
103
|
+
* @type {void}
|
|
104
|
+
*/
|
|
105
|
+
}; /**
|
|
106
|
+
* Emitted when the modal is closed.
|
|
107
|
+
* @type {void}
|
|
108
|
+
*/
|
|
85
109
|
color: {
|
|
86
110
|
type: () => import("../../../neon").NeonFunctionalColor;
|
|
87
111
|
default: import("../../../neon").NeonFunctionalColor;
|
|
@@ -179,8 +203,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
179
203
|
};
|
|
180
204
|
size: {
|
|
181
205
|
type: () => import("../../../neon").NeonButtonSize;
|
|
182
|
-
default: import("../../../neon").NeonButtonSize;
|
|
183
|
-
|
|
206
|
+
default: import("../../../neon").NeonButtonSize; /**
|
|
207
|
+
* Emitted when the modal is closed.
|
|
208
|
+
* @type {void}
|
|
209
|
+
*/
|
|
210
|
+
}; /**
|
|
211
|
+
* Emitted when the modal is closed.
|
|
212
|
+
* @type {void}
|
|
213
|
+
*/
|
|
184
214
|
color: {
|
|
185
215
|
type: () => import("../../../neon").NeonFunctionalColor;
|
|
186
216
|
default: import("../../../neon").NeonFunctionalColor;
|
|
@@ -273,12 +303,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
273
303
|
};
|
|
274
304
|
inverse: {
|
|
275
305
|
type: BooleanConstructor;
|
|
276
|
-
default: boolean;
|
|
277
|
-
|
|
278
|
-
*/
|
|
279
|
-
}; /**
|
|
280
|
-
* Whether the user is allowed to dismiss the modal by clicking outside the modal or pressing escape.
|
|
281
|
-
*/
|
|
306
|
+
default: boolean;
|
|
307
|
+
};
|
|
282
308
|
disabled: {
|
|
283
309
|
type: BooleanConstructor;
|
|
284
310
|
default: boolean;
|
|
@@ -294,12 +320,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
294
320
|
};
|
|
295
321
|
inverse: {
|
|
296
322
|
type: BooleanConstructor;
|
|
297
|
-
default: boolean;
|
|
298
|
-
|
|
299
|
-
*/
|
|
300
|
-
}; /**
|
|
301
|
-
* Whether the user is allowed to dismiss the modal by clicking outside the modal or pressing escape.
|
|
302
|
-
*/
|
|
323
|
+
default: boolean;
|
|
324
|
+
};
|
|
303
325
|
disabled: {
|
|
304
326
|
type: BooleanConstructor;
|
|
305
327
|
default: boolean;
|