@leavepulse/ui 0.28.0 → 0.28.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createBlock, unref, withCtx, createVNode } from "vue";
|
|
1
|
+
import { defineComponent, useId, openBlock, createBlock, unref, withCtx, createVNode, createElementBlock, toDisplayString, createCommentVNode } from "vue";
|
|
2
2
|
import { NumberFieldRoot, NumberFieldDecrement, NumberFieldInput, NumberFieldIncrement } from "reka-ui";
|
|
3
3
|
import { _ as _sfc_main$1 } from "./LpIcon-CCnX5_2j.js";
|
|
4
|
+
const _hoisted_1 = ["id"];
|
|
4
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
6
|
__name: "LpNumberField",
|
|
6
7
|
props: {
|
|
@@ -8,10 +9,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
8
9
|
min: {},
|
|
9
10
|
max: {},
|
|
10
11
|
step: {},
|
|
11
|
-
disabled: { type: Boolean }
|
|
12
|
+
disabled: { type: Boolean },
|
|
13
|
+
unit: {}
|
|
12
14
|
},
|
|
13
15
|
emits: ["update:modelValue"],
|
|
14
16
|
setup(__props) {
|
|
17
|
+
const unitId = useId();
|
|
15
18
|
return (_ctx, _cache) => {
|
|
16
19
|
return openBlock(), createBlock(unref(NumberFieldRoot), {
|
|
17
20
|
"model-value": __props.modelValue ?? void 0,
|
|
@@ -34,7 +37,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
34
37
|
]),
|
|
35
38
|
_: 1
|
|
36
39
|
}),
|
|
37
|
-
createVNode(unref(NumberFieldInput), {
|
|
40
|
+
createVNode(unref(NumberFieldInput), {
|
|
41
|
+
"aria-describedby": __props.unit ? unref(unitId) : void 0,
|
|
42
|
+
class: "min-w-0 flex-1 bg-transparent text-center text-sm text-ink outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none"
|
|
43
|
+
}, null, 8, ["aria-describedby"]),
|
|
44
|
+
__props.unit ? (openBlock(), createElementBlock("span", {
|
|
45
|
+
key: 0,
|
|
46
|
+
id: unref(unitId),
|
|
47
|
+
class: "shrink-0 pr-1 text-xs text-muted"
|
|
48
|
+
}, toDisplayString(__props.unit), 9, _hoisted_1)) : createCommentVNode("", true),
|
|
38
49
|
createVNode(unref(NumberFieldIncrement), { class: "group grid h-full w-8 place-items-center text-muted transition-colors duration-[var(--duration-fast)] hover:text-ink disabled:opacity-40" }, {
|
|
39
50
|
default: withCtx(() => [
|
|
40
51
|
createVNode(_sfc_main$1, {
|
|
@@ -4,6 +4,7 @@ type __VLS_Props = {
|
|
|
4
4
|
max?: number;
|
|
5
5
|
step?: number;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
+
unit?: string;
|
|
7
8
|
};
|
|
8
9
|
declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
|
|
9
10
|
"update:modelValue": (value: number | null) => any;
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ import { _ as _30 } from "./chunks/LpLink-BHZ1CLlF.js";
|
|
|
36
36
|
import { _ as _31 } from "./chunks/LpLogViewer-CcQ3s3Fp.js";
|
|
37
37
|
import { _ as _32 } from "./chunks/LpModal-D_o-56To.js";
|
|
38
38
|
import { _ as _33 } from "./chunks/LpNotificationBell-Dvu-b6Vn.js";
|
|
39
|
-
import { _ as _34 } from "./chunks/LpNumberField-
|
|
39
|
+
import { _ as _34 } from "./chunks/LpNumberField-NPE8Bumx.js";
|
|
40
40
|
import { _ as _35 } from "./chunks/LpNumberFlow-amWYaeuA.js";
|
|
41
41
|
import { _ as _36 } from "./chunks/LpOtpInput-DqaT0Z75.js";
|
|
42
42
|
import { _ as _37 } from "./chunks/LpPagination-CeGuNe_q.js";
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
NumberFieldInput,
|
|
7
7
|
NumberFieldRoot,
|
|
8
8
|
} from "reka-ui"
|
|
9
|
+
import { useId } from "vue"
|
|
9
10
|
import LpIcon from "./LpIcon.vue"
|
|
10
11
|
|
|
11
12
|
defineProps<{
|
|
@@ -16,9 +17,19 @@ defineProps<{
|
|
|
16
17
|
max?: number
|
|
17
18
|
step?: number
|
|
18
19
|
disabled?: boolean
|
|
20
|
+
// The unit the number is in ("mm", "W", "mA"). It sits inside the field
|
|
21
|
+
// rather than in the label, because a grid of bare boxes labelled "Width",
|
|
22
|
+
// "Depth", "Weight" tells the reader nothing about which one wants grams.
|
|
23
|
+
// Not part of the value: it is never typed, selected, or submitted.
|
|
24
|
+
unit?: string
|
|
19
25
|
}>()
|
|
20
26
|
|
|
21
27
|
defineEmits<{ (e: "update:modelValue", value: number | null): void }>()
|
|
28
|
+
|
|
29
|
+
// The unit is described to the input rather than merely placed beside it: on
|
|
30
|
+
// screen the two read as one field, and without this a reader announces "380"
|
|
31
|
+
// and leaves out the milliamps that make it mean anything.
|
|
32
|
+
const unitId = useId()
|
|
22
33
|
</script>
|
|
23
34
|
|
|
24
35
|
<template>
|
|
@@ -42,8 +53,13 @@ defineEmits<{ (e: "update:modelValue", value: number | null): void }>()
|
|
|
42
53
|
/>
|
|
43
54
|
</NumberFieldDecrement>
|
|
44
55
|
<NumberFieldInput
|
|
56
|
+
:aria-describedby="unit ? unitId : undefined"
|
|
45
57
|
class="min-w-0 flex-1 bg-transparent text-center text-sm text-ink outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none"
|
|
46
58
|
/>
|
|
59
|
+
<!-- The unit sits between the value and the increment button, so a long one
|
|
60
|
+
narrows the field rather than covering the digits. Not focusable and
|
|
61
|
+
not part of the value: it is read, never typed. -->
|
|
62
|
+
<span v-if="unit" :id="unitId" class="shrink-0 pr-1 text-xs text-muted">{{ unit }}</span>
|
|
47
63
|
<NumberFieldIncrement
|
|
48
64
|
class="group grid h-full w-8 place-items-center text-muted transition-colors duration-[var(--duration-fast)] hover:text-ink disabled:opacity-40"
|
|
49
65
|
>
|