@dumiflex/wp-kit 0.3.0 → 0.5.0
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/CHANGELOG.md +92 -51
- package/LICENSE +674 -674
- package/README.md +73 -76
- package/package.json +78 -77
- package/src/Avatar.vue +83 -83
- package/src/Badge.vue +97 -97
- package/src/Banner.vue +118 -118
- package/src/BookmarkButton.vue +27 -27
- package/src/BundleMeta.vue +51 -51
- package/src/Button.vue +103 -103
- package/src/Card.vue +68 -68
- package/src/Checkbox.vue +109 -107
- package/src/Chip.vue +163 -97
- package/src/ChoiceCards.vue +133 -133
- package/src/CloseButton.vue +69 -69
- package/src/CodeBlock.vue +146 -119
- package/src/ColorField.vue +188 -206
- package/src/ColorPicker.vue +201 -201
- package/src/Combobox.vue +331 -334
- package/src/ConfirmDialog.vue +165 -163
- package/src/ConfirmModal.vue +147 -147
- package/src/ConstraintMatrixPreview.vue +708 -708
- package/src/ContextMenu.vue +386 -379
- package/src/CopyButton.vue +156 -156
- package/src/DataTable.vue +293 -292
- package/src/DatePicker.vue +234 -234
- package/src/DescriptionList.vue +73 -73
- package/src/DiffView.vue +68 -68
- package/src/Disclosure.vue +166 -166
- package/src/DragHandle.vue +49 -49
- package/src/Drawer.vue +131 -131
- package/src/DropZone.vue +196 -196
- package/src/DropdownMenu.vue +72 -72
- package/src/EmptyState.vue +111 -111
- package/src/Field.vue +28 -28
- package/src/HsvPicker.vue +208 -208
- package/src/Icon.vue +39 -39
- package/src/IconPicker.vue +209 -209
- package/src/ImageGrid.vue +127 -125
- package/src/InlineEdit.vue +183 -183
- package/src/Input.vue +99 -99
- package/src/Kbd.vue +56 -56
- package/src/Lightbox.vue +176 -173
- package/src/ListFilter.vue +85 -85
- package/src/ListRow.vue +204 -204
- package/src/LoadingMark.vue +217 -161
- package/src/Logo.vue +60 -60
- package/src/Modal.vue +78 -76
- package/src/ModalShell.vue +109 -107
- package/src/Pagination.vue +106 -106
- package/src/Popover.vue +180 -171
- package/src/PostCard.vue +210 -211
- package/src/ProgressBar.vue +90 -90
- package/src/RadioGroup.vue +177 -177
- package/src/RangeSlider.vue +183 -183
- package/src/RelativeDate.vue +35 -35
- package/src/ResizeHandle.vue +143 -143
- package/src/SearchInput.vue +192 -199
- package/src/Select.vue +644 -641
- package/src/Separator.vue +54 -54
- package/src/Skeleton.vue +98 -82
- package/src/Slider.vue +198 -198
- package/src/SortableList.vue +260 -260
- package/src/SplitPane.vue +68 -68
- package/src/StarButton.vue +40 -40
- package/src/Stepper.vue +141 -141
- package/src/SupportLinks.vue +93 -93
- package/src/TagInput.vue +297 -300
- package/src/Textarea.vue +57 -57
- package/src/Timeline.vue +92 -92
- package/src/ToastCard.vue +119 -119
- package/src/ToastHost.vue +40 -40
- package/src/Toggle.vue +36 -36
- package/src/TokenizedValue.vue +310 -310
- package/src/Toolbar.vue +110 -110
- package/src/VirtualList.vue +87 -87
- package/src/VisuallyHidden.vue +29 -29
- package/src/WpButton.vue +75 -75
- package/src/WpCheck.vue +104 -102
- package/src/WpIconButton.vue +107 -107
- package/src/WpImageZoom.vue +544 -544
- package/src/WpNumber.vue +178 -183
- package/src/WpSegmented.vue +175 -175
- package/src/WpSelect.vue +93 -89
- package/src/WpSwitch.vue +163 -163
- package/src/WpTabs.vue +188 -188
- package/src/_modal-motion.css +33 -33
- package/src/_skeleton.css +50 -50
- package/src/axis-color.ts +42 -42
- package/src/button.css +169 -169
- package/src/calendar.ts +59 -59
- package/src/clipboard.ts +50 -50
- package/src/colour-presets.ts +12 -12
- package/src/diff.ts +51 -51
- package/src/drop-zone.ts +41 -41
- package/src/field.css +50 -0
- package/src/flip.ts +237 -237
- package/src/floating-layer.ts +48 -0
- package/src/floating.ts +99 -99
- package/src/highlight.ts +199 -0
- package/src/hsv.ts +100 -100
- package/src/icon-catalog.ts +52 -52
- package/src/image-zoom.ts +93 -93
- package/src/kind-colour.ts +28 -0
- package/src/loading-mark-motion.ts +249 -0
- package/src/logo-paths.ts +21 -21
- package/src/matrix-axis.ts +91 -91
- package/src/pagination.ts +27 -27
- package/src/platform-keys.ts +29 -29
- package/src/rich-tokenize.ts +357 -357
- package/src/select-types.ts +32 -32
- package/src/slider-math.ts +45 -45
- package/src/sortable.ts +22 -22
- package/src/theme/fonts/OFL-Fraunces.txt +93 -93
- package/src/theme/fonts/OFL-JetBrainsMono.txt +93 -93
- package/src/theme/fonts/OFL-Manrope.txt +93 -93
- package/src/theme/looks.css +428 -428
- package/src/theme/palettes.css +254 -254
- package/src/theme/tokens.css +2896 -2894
- package/src/tokens.ts +56 -56
- package/src/tooltip.css +43 -43
- package/src/tooltip.ts +146 -146
- package/src/useDialogFocus.ts +73 -73
- package/src/useGrowableField.ts +357 -357
- package/src/useModalKeyShield.ts +116 -116
- package/src/useToast.ts +48 -48
- package/src/wp-logo.svg +14 -14
- package/src/ChipToggle.vue +0 -92
- package/src/KindChip.vue +0 -53
- package/src/RatingBadge.vue +0 -42
package/src/WpNumber.vue
CHANGED
|
@@ -1,183 +1,178 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* The one number field, on the canvas and in the manager: a number input
|
|
4
|
-
* with our stacked ▲/▼ arrows instead of the browser's spinner (hidden).
|
|
5
|
-
* It replaced the canvas steppers every widget used to hand-roll (seed rows,
|
|
6
|
-
* sweep limit, Image Filter timeout) and Input's `type="number"` mode.
|
|
7
|
-
*
|
|
8
|
-
* Emits a finite number only: typing commits on `change` (or every
|
|
9
|
-
* keystroke with `commit="input"`); the arrows, ArrowUp/ArrowDown and the
|
|
10
|
-
* wheel step by `step` and clamp to `min` / `max`. Typed values snap to 3
|
|
11
|
-
* decimals and stepped values to the step's own precision, so float fuzz
|
|
12
|
-
* (1.2999999999999998) never reaches a store. With `nullable`, clearing the
|
|
13
|
-
* box emits `null` (a "use the default" field with a placeholder).
|
|
14
|
-
*
|
|
15
|
-
* `size` follows the control scale (sm 24 / md 32 / lg 40); the canvas uses
|
|
16
|
-
* `sm`, manager forms `md`. `class` and `style` land on the box (set a width
|
|
17
|
-
* there); other attributes and listeners (`@blur`, `@keydown.enter`, `id`)
|
|
18
|
-
* land on the input. `dataTest` lands on the input, with `-up` / `-down` on
|
|
19
|
-
* the arrows. `suffix` shows a unit after the number ("px", "s"). Reads
|
|
20
|
-
* only SHARED_TOKENS, so it wears whichever side it is on.
|
|
21
|
-
*/
|
|
22
|
-
import { computed, ref, useAttrs } from "vue";
|
|
23
|
-
|
|
24
|
-
defineOptions({ inheritAttrs: false });
|
|
25
|
-
|
|
26
|
-
const props = withDefaults(
|
|
27
|
-
defineProps<{
|
|
28
|
-
modelValue: number | null;
|
|
29
|
-
min?: number | undefined;
|
|
30
|
-
max?: number | undefined;
|
|
31
|
-
step?: number | undefined;
|
|
32
|
-
size?: "sm" | "md" | "lg" | undefined;
|
|
33
|
-
placeholder?: string | undefined;
|
|
34
|
-
ariaLabel?: string | undefined;
|
|
35
|
-
upLabel?: string | undefined;
|
|
36
|
-
downLabel?: string | undefined;
|
|
37
|
-
dataTest?: string | undefined;
|
|
38
|
-
commit?: "change" | "input" | undefined;
|
|
39
|
-
/** Clearing the box emits null instead of being ignored. */
|
|
40
|
-
nullable?: boolean | undefined;
|
|
41
|
-
disabled?: boolean | undefined;
|
|
42
|
-
invalid?: boolean | undefined;
|
|
43
|
-
/** Unit shown after the number ("px", "s"). */
|
|
44
|
-
suffix?: string | undefined;
|
|
45
|
-
}>(),
|
|
46
|
-
{ step: 1, size: "sm", commit: "change", upLabel: "Increase", downLabel: "Decrease" },
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
const emit = defineEmits<{ "update:modelValue": [value: number | null] }>();
|
|
50
|
-
|
|
51
|
-
const attrs = useAttrs();
|
|
52
|
-
const rootAttrs = computed(() => ({ class: attrs.class, style: attrs.style }));
|
|
53
|
-
const inputAttrs = computed(() => {
|
|
54
|
-
const { class: _c, style: _s, ...rest } = attrs;
|
|
55
|
-
return rest;
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
function clamp(n: number): number {
|
|
59
|
-
let v = n;
|
|
60
|
-
if (props.min !== undefined) v = Math.max(props.min, v);
|
|
61
|
-
if (props.max !== undefined) v = Math.min(props.max, v);
|
|
62
|
-
return v;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function onType(ev: Event, kind: "change" | "input"): void {
|
|
66
|
-
if (kind !== props.commit) return;
|
|
67
|
-
const raw = (ev.target as HTMLInputElement).value;
|
|
68
|
-
if (raw === "") {
|
|
69
|
-
if (props.nullable) emit("update:modelValue", null);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
const n = Number(raw);
|
|
73
|
-
if (!Number.isFinite(n)) return;
|
|
74
|
-
emit("update:modelValue", Math.round(n * 1000) / 1000);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** ArrowUp / ArrowDown and the wheel (while focused) step like the arrows.
|
|
78
|
-
* Every key stops here so the canvas doesn't read it as a shortcut. */
|
|
79
|
-
function onKey(ev: KeyboardEvent): void {
|
|
80
|
-
ev.stopPropagation();
|
|
81
|
-
if (ev.key !== "ArrowUp" && ev.key !== "ArrowDown") return;
|
|
82
|
-
ev.preventDefault();
|
|
83
|
-
bump(ev.key === "ArrowUp" ? 1 : -1);
|
|
84
|
-
}
|
|
85
|
-
function onWheel(ev: WheelEvent): void {
|
|
86
|
-
if (document.activeElement !== ev.target) return;
|
|
87
|
-
ev.preventDefault();
|
|
88
|
-
bump(ev.deltaY < 0 ? 1 : -1);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const field = ref<HTMLInputElement | null>(null);
|
|
92
|
-
defineExpose({ focus: () => field.value?.focus(), select: () => field.value?.select(), el: field });
|
|
93
|
-
|
|
94
|
-
/** Step with the step's decimal precision, so 1 + 0.1 shows 1.1. */
|
|
95
|
-
function bump(dir: 1 | -1): void {
|
|
96
|
-
if (props.disabled) return;
|
|
97
|
-
const dot = String(props.step).indexOf(".");
|
|
98
|
-
const f = dot < 0 ? 1 : 10 ** (String(props.step).length - dot - 1);
|
|
99
|
-
emit("update:modelValue", clamp(Math.round(((props.modelValue ?? 0) + dir * props.step) * f) / f));
|
|
100
|
-
}
|
|
101
|
-
</script>
|
|
102
|
-
|
|
103
|
-
<template>
|
|
104
|
-
<span
|
|
105
|
-
class="wp-cnum"
|
|
106
|
-
:class="[`wp-cnum--${size}`, { 'is-disabled': disabled, 'is-invalid': invalid }]"
|
|
107
|
-
v-bind="rootAttrs"
|
|
108
|
-
>
|
|
109
|
-
<input
|
|
110
|
-
ref="field"
|
|
111
|
-
class="wp-cnum__field"
|
|
112
|
-
type="number"
|
|
113
|
-
:value="modelValue ?? ''"
|
|
114
|
-
:min="min"
|
|
115
|
-
:max="max"
|
|
116
|
-
step="any"
|
|
117
|
-
:placeholder="placeholder"
|
|
118
|
-
:disabled="disabled"
|
|
119
|
-
:aria-label="ariaLabel"
|
|
120
|
-
:aria-invalid="invalid || undefined"
|
|
121
|
-
:data-test="dataTest"
|
|
122
|
-
v-bind="inputAttrs"
|
|
123
|
-
@input="onType($event, 'input')"
|
|
124
|
-
@change="onType($event, 'change')"
|
|
125
|
-
@keydown="onKey"
|
|
126
|
-
@wheel="onWheel"
|
|
127
|
-
/>
|
|
128
|
-
<span v-if="suffix" class="wp-cnum__suffix" aria-hidden="true">{{ suffix }}</span>
|
|
129
|
-
<span class="wp-cnum__spin">
|
|
130
|
-
<button
|
|
131
|
-
type="button" class="wp-cnum__btn" tabindex="-1" :disabled="disabled"
|
|
132
|
-
:aria-label="upLabel" :data-test="dataTest && `${dataTest}-up`" @click="bump(1)"
|
|
133
|
-
><i class="pi pi-chevron-up" aria-hidden="true" /></button>
|
|
134
|
-
<button
|
|
135
|
-
type="button" class="wp-cnum__btn" tabindex="-1" :disabled="disabled"
|
|
136
|
-
:aria-label="downLabel" :data-test="dataTest && `${dataTest}-down`" @click="bump(-1)"
|
|
137
|
-
><i class="pi pi-chevron-down" aria-hidden="true" /></button>
|
|
138
|
-
</span>
|
|
139
|
-
</span>
|
|
140
|
-
</template>
|
|
141
|
-
|
|
142
|
-
<style scoped>
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
font:
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
.wp-cnum--
|
|
152
|
-
.wp-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
.wp-cnum__field {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
.wp-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
.wp-cnum__btn {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.wp-cnum--md .wp-cnum__btn .pi, .wp-cnum--lg .wp-cnum__btn .pi { font-size: 8px; }
|
|
180
|
-
.wp-cnum__btn + .wp-cnum__btn { border-top: 1px solid var(--wp-border); }
|
|
181
|
-
.wp-cnum__btn:hover:not(:disabled) { color: var(--wp-accent-text); background: color-mix(in oklab, var(--wp-accent) 12%, transparent); }
|
|
182
|
-
.wp-cnum__btn:disabled { cursor: not-allowed; }
|
|
183
|
-
</style>
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* The one number field, on the canvas and in the manager: a number input
|
|
4
|
+
* with our stacked ▲/▼ arrows instead of the browser's spinner (hidden).
|
|
5
|
+
* It replaced the canvas steppers every widget used to hand-roll (seed rows,
|
|
6
|
+
* sweep limit, Image Filter timeout) and Input's `type="number"` mode.
|
|
7
|
+
*
|
|
8
|
+
* Emits a finite number only: typing commits on `change` (or every
|
|
9
|
+
* keystroke with `commit="input"`); the arrows, ArrowUp/ArrowDown and the
|
|
10
|
+
* wheel step by `step` and clamp to `min` / `max`. Typed values snap to 3
|
|
11
|
+
* decimals and stepped values to the step's own precision, so float fuzz
|
|
12
|
+
* (1.2999999999999998) never reaches a store. With `nullable`, clearing the
|
|
13
|
+
* box emits `null` (a "use the default" field with a placeholder).
|
|
14
|
+
*
|
|
15
|
+
* `size` follows the control scale (sm 24 / md 32 / lg 40); the canvas uses
|
|
16
|
+
* `sm`, manager forms `md`. `class` and `style` land on the box (set a width
|
|
17
|
+
* there); other attributes and listeners (`@blur`, `@keydown.enter`, `id`)
|
|
18
|
+
* land on the input. `dataTest` lands on the input, with `-up` / `-down` on
|
|
19
|
+
* the arrows. `suffix` shows a unit after the number ("px", "s"). Reads
|
|
20
|
+
* only SHARED_TOKENS, so it wears whichever side it is on.
|
|
21
|
+
*/
|
|
22
|
+
import { computed, ref, useAttrs } from "vue";
|
|
23
|
+
|
|
24
|
+
defineOptions({ inheritAttrs: false });
|
|
25
|
+
|
|
26
|
+
const props = withDefaults(
|
|
27
|
+
defineProps<{
|
|
28
|
+
modelValue: number | null;
|
|
29
|
+
min?: number | undefined;
|
|
30
|
+
max?: number | undefined;
|
|
31
|
+
step?: number | undefined;
|
|
32
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
33
|
+
placeholder?: string | undefined;
|
|
34
|
+
ariaLabel?: string | undefined;
|
|
35
|
+
upLabel?: string | undefined;
|
|
36
|
+
downLabel?: string | undefined;
|
|
37
|
+
dataTest?: string | undefined;
|
|
38
|
+
commit?: "change" | "input" | undefined;
|
|
39
|
+
/** Clearing the box emits null instead of being ignored. */
|
|
40
|
+
nullable?: boolean | undefined;
|
|
41
|
+
disabled?: boolean | undefined;
|
|
42
|
+
invalid?: boolean | undefined;
|
|
43
|
+
/** Unit shown after the number ("px", "s"). */
|
|
44
|
+
suffix?: string | undefined;
|
|
45
|
+
}>(),
|
|
46
|
+
{ step: 1, size: "sm", commit: "change", upLabel: "Increase", downLabel: "Decrease" },
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const emit = defineEmits<{ "update:modelValue": [value: number | null] }>();
|
|
50
|
+
|
|
51
|
+
const attrs = useAttrs();
|
|
52
|
+
const rootAttrs = computed(() => ({ class: attrs.class, style: attrs.style }));
|
|
53
|
+
const inputAttrs = computed(() => {
|
|
54
|
+
const { class: _c, style: _s, ...rest } = attrs;
|
|
55
|
+
return rest;
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function clamp(n: number): number {
|
|
59
|
+
let v = n;
|
|
60
|
+
if (props.min !== undefined) v = Math.max(props.min, v);
|
|
61
|
+
if (props.max !== undefined) v = Math.min(props.max, v);
|
|
62
|
+
return v;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function onType(ev: Event, kind: "change" | "input"): void {
|
|
66
|
+
if (kind !== props.commit) return;
|
|
67
|
+
const raw = (ev.target as HTMLInputElement).value;
|
|
68
|
+
if (raw === "") {
|
|
69
|
+
if (props.nullable) emit("update:modelValue", null);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const n = Number(raw);
|
|
73
|
+
if (!Number.isFinite(n)) return;
|
|
74
|
+
emit("update:modelValue", Math.round(n * 1000) / 1000);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** ArrowUp / ArrowDown and the wheel (while focused) step like the arrows.
|
|
78
|
+
* Every key stops here so the canvas doesn't read it as a shortcut. */
|
|
79
|
+
function onKey(ev: KeyboardEvent): void {
|
|
80
|
+
ev.stopPropagation();
|
|
81
|
+
if (ev.key !== "ArrowUp" && ev.key !== "ArrowDown") return;
|
|
82
|
+
ev.preventDefault();
|
|
83
|
+
bump(ev.key === "ArrowUp" ? 1 : -1);
|
|
84
|
+
}
|
|
85
|
+
function onWheel(ev: WheelEvent): void {
|
|
86
|
+
if (document.activeElement !== ev.target) return;
|
|
87
|
+
ev.preventDefault();
|
|
88
|
+
bump(ev.deltaY < 0 ? 1 : -1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const field = ref<HTMLInputElement | null>(null);
|
|
92
|
+
defineExpose({ focus: () => field.value?.focus(), select: () => field.value?.select(), el: field });
|
|
93
|
+
|
|
94
|
+
/** Step with the step's decimal precision, so 1 + 0.1 shows 1.1. */
|
|
95
|
+
function bump(dir: 1 | -1): void {
|
|
96
|
+
if (props.disabled) return;
|
|
97
|
+
const dot = String(props.step).indexOf(".");
|
|
98
|
+
const f = dot < 0 ? 1 : 10 ** (String(props.step).length - dot - 1);
|
|
99
|
+
emit("update:modelValue", clamp(Math.round(((props.modelValue ?? 0) + dir * props.step) * f) / f));
|
|
100
|
+
}
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<template>
|
|
104
|
+
<span
|
|
105
|
+
class="wp-cnum wp-field-box"
|
|
106
|
+
:class="[`wp-cnum--${size}`, `wp-field-box--${size}`, { 'is-disabled': disabled, 'is-invalid': invalid }]"
|
|
107
|
+
v-bind="rootAttrs"
|
|
108
|
+
>
|
|
109
|
+
<input
|
|
110
|
+
ref="field"
|
|
111
|
+
class="wp-cnum__field"
|
|
112
|
+
type="number"
|
|
113
|
+
:value="modelValue ?? ''"
|
|
114
|
+
:min="min"
|
|
115
|
+
:max="max"
|
|
116
|
+
step="any"
|
|
117
|
+
:placeholder="placeholder"
|
|
118
|
+
:disabled="disabled"
|
|
119
|
+
:aria-label="ariaLabel"
|
|
120
|
+
:aria-invalid="invalid || undefined"
|
|
121
|
+
:data-test="dataTest"
|
|
122
|
+
v-bind="inputAttrs"
|
|
123
|
+
@input="onType($event, 'input')"
|
|
124
|
+
@change="onType($event, 'change')"
|
|
125
|
+
@keydown="onKey"
|
|
126
|
+
@wheel="onWheel"
|
|
127
|
+
/>
|
|
128
|
+
<span v-if="suffix" class="wp-cnum__suffix" aria-hidden="true">{{ suffix }}</span>
|
|
129
|
+
<span class="wp-cnum__spin">
|
|
130
|
+
<button
|
|
131
|
+
type="button" class="wp-cnum__btn" tabindex="-1" :disabled="disabled"
|
|
132
|
+
:aria-label="upLabel" :data-test="dataTest && `${dataTest}-up`" @click="bump(1)"
|
|
133
|
+
><i class="pi pi-chevron-up" aria-hidden="true" /></button>
|
|
134
|
+
<button
|
|
135
|
+
type="button" class="wp-cnum__btn" tabindex="-1" :disabled="disabled"
|
|
136
|
+
:aria-label="downLabel" :data-test="dataTest && `${dataTest}-down`" @click="bump(-1)"
|
|
137
|
+
><i class="pi pi-chevron-down" aria-hidden="true" /></button>
|
|
138
|
+
</span>
|
|
139
|
+
</span>
|
|
140
|
+
</template>
|
|
141
|
+
|
|
142
|
+
<style scoped src="./field.css"></style>
|
|
143
|
+
|
|
144
|
+
<style scoped>
|
|
145
|
+
.wp-cnum {
|
|
146
|
+
--cnum-spin: 16px;
|
|
147
|
+
display: inline-flex; align-items: stretch; height: var(--wp-field-h); min-width: 0; overflow: hidden;
|
|
148
|
+
font-family: var(--wp-font-mono);
|
|
149
|
+
}
|
|
150
|
+
.wp-cnum--md { --cnum-spin: 20px; }
|
|
151
|
+
.wp-cnum--lg { --cnum-spin: 22px; }
|
|
152
|
+
.wp-cnum__field {
|
|
153
|
+
flex: 1; min-width: 0; padding: 0 6px 0 8px; background: transparent; border: 0;
|
|
154
|
+
color: var(--wp-text); font: inherit; text-align: right;
|
|
155
|
+
-moz-appearance: textfield; appearance: textfield;
|
|
156
|
+
}
|
|
157
|
+
.wp-cnum__field::-webkit-outer-spin-button, .wp-cnum__field::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
|
|
158
|
+
.wp-cnum__field::placeholder { color: var(--wp-text-dim); }
|
|
159
|
+
.wp-cnum__field:focus { outline: none; }
|
|
160
|
+
.wp-cnum__field:disabled { cursor: not-allowed; }
|
|
161
|
+
.wp-cnum__suffix {
|
|
162
|
+
display: inline-flex; align-items: center; flex-shrink: 0; padding-right: 6px;
|
|
163
|
+
color: var(--wp-text-dim); user-select: none;
|
|
164
|
+
}
|
|
165
|
+
.wp-cnum__spin {
|
|
166
|
+
display: flex; flex-direction: column; width: var(--cnum-spin); flex-shrink: 0;
|
|
167
|
+
border-left: 1px solid var(--wp-border); background: color-mix(in oklab, var(--wp-accent) 4%, transparent);
|
|
168
|
+
}
|
|
169
|
+
.wp-cnum__btn {
|
|
170
|
+
flex: 1; display: flex; align-items: center; justify-content: center; padding: 0; border: 0;
|
|
171
|
+
background: transparent; color: var(--wp-text-dim); cursor: pointer; line-height: 0;
|
|
172
|
+
}
|
|
173
|
+
.wp-cnum__btn .pi { font-size: 7px; }
|
|
174
|
+
.wp-cnum--md .wp-cnum__btn .pi, .wp-cnum--lg .wp-cnum__btn .pi { font-size: 8px; }
|
|
175
|
+
.wp-cnum__btn + .wp-cnum__btn { border-top: 1px solid var(--wp-border); }
|
|
176
|
+
.wp-cnum__btn:hover:not(:disabled) { color: var(--wp-accent-text); background: color-mix(in oklab, var(--wp-accent) 12%, transparent); }
|
|
177
|
+
.wp-cnum__btn:disabled { cursor: not-allowed; }
|
|
178
|
+
</style>
|