Skip to content

Commit bff50a7

Browse files
committed
Display: Add styles for input number #6862
1 parent 5cc53df commit bff50a7

File tree

3 files changed

+130
-4
lines changed

3 files changed

+130
-4
lines changed
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
.p-inputnumber {
2+
@apply inline-flex relative;
3+
4+
&-button {
5+
@apply flex items-center justify-center grow-0 shrink-0 basis-0 cursor-pointer transition bg-transparent text-gray-90 w-8
6+
disabled:cursor-auto;
7+
8+
&:not(:disabled) {
9+
@apply hover:bg-support-1 hover:text-primary hover:border-primary
10+
active:bg-support-1 active:text-primary active:border-primary;
11+
}
12+
}
13+
14+
&-stacked &-button {
15+
@apply relative flex-auto border-none;
16+
}
17+
18+
&-stacked &-button-group {
19+
@apply flex flex-col absolute top-[1px] right-[1px] z-10;
20+
21+
height: calc(100% - 2px);
22+
}
23+
24+
&-stacked &-increment-button {
25+
@apply p-0 rounded-tr-lg;
26+
}
27+
28+
&-stacked &-decrement-button {
29+
@apply p-0 rounded-br-lg;
30+
}
31+
32+
&-stacked &-input {
33+
@apply pr-8;
34+
}
35+
36+
&-horizontal &-button{
37+
@apply border border-solid border-gray-50 basis-8
38+
hover:border-solid
39+
active:border-solid;
40+
}
41+
42+
&-horizontal &-increment-button {
43+
@apply order-3 rounded-r-lg right-0 border-l-0;
44+
}
45+
46+
&-horizontal &-input {
47+
@apply order-2 rounded-none;
48+
}
49+
50+
&-horizontal &-decrement-button {
51+
@apply order-1 rounded-l-lg left-0 border-r-0;
52+
}
53+
54+
.p-floatlabel:has(&-horizontal) label {
55+
@apply ml-8;
56+
}
57+
58+
&-vertical {
59+
@apply flex-col;
60+
}
61+
62+
&-vertical &-button {
63+
@apply border border-solid border-gray-50 p-0 basis-8
64+
hover:border-primary
65+
active:border-gray-50;
66+
}
67+
68+
&-vertical &-increment-button {
69+
@apply order-1 rounded-t-lg w-full border-b-0;
70+
}
71+
72+
&-vertical &-input {
73+
@apply order-2 rounded-none text-center;
74+
}
75+
76+
&-vertical &-decrement-button {
77+
@apply order-3 rounded-b-lg w-full border-t-0;
78+
}
79+
80+
&-input {
81+
@apply flex-auto;
82+
}
83+
84+
&-fluid {
85+
@apply w-full;
86+
}
87+
88+
&-fluid &-input {
89+
@apply w-[1%];
90+
}
91+
92+
&-fluid.p-inputnumber-vertical &-input {
93+
@apply w-full
94+
}
95+
96+
&-clear-icon {
97+
@apply absolute top-1/2 -mt-2 cursor-pointer pr-1 text-gray-90;
98+
}
99+
100+
&:has(&-clear-icon) &-input {
101+
@apply pr-8;
102+
}
103+
104+
&-stacked &-clear-icon {
105+
@apply right-8;
106+
}
107+
}
108+
109+
/*
110+
111+
.p-inputnumber:has(.p-inputtext-sm) .p-inputnumber-button .p-icon {
112+
font-size: dt('form.field.sm.font.size');
113+
width: dt('form.field.sm.font.size');
114+
height: dt('form.field.sm.font.size');
115+
}
116+
117+
.p-inputnumber:has(.p-inputtext-lg) .p-inputnumber-button .p-icon {
118+
font-size: dt('form.field.lg.font.size');
119+
width: dt('form.field.lg.font.size');
120+
height: dt('form.field.lg.font.size');
121+
}
122+
*/

assets/css/scss/index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
@include meta.load-css("atoms/inputgroup");
4242
@include meta.load-css("atoms/input_switch");
4343
@include meta.load-css("atoms/input_text");
44+
@include meta.load-css("atoms/input_number");
4445
@include meta.load-css("atoms/messages");
4546
@include meta.load-css("atoms/multiselect");
4647
@include meta.load-css("atoms/overlay");

assets/vue/components/basecomponents/BaseInputNumber.vue

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
<template>
22
<div class="field">
3-
<div class="p-float-label">
3+
<FloatLabel variant="on">
44
<InputNumber
5-
:input-id="id"
6-
:class="{ 'p-invalid': isInvalid }"
75
:disabled="disabled"
6+
:input-id="id"
7+
:invalid="isInvalid"
88
:max="max"
99
:min="min"
1010
:model-value="modelValue"
1111
:step="step"
12+
fluid
13+
showButtons
1214
@update:model-value="$emit('update:modelValue', $event)"
1315
/>
1416
<label
1517
:for="id"
1618
v-text="label"
1719
/>
18-
</div>
20+
</FloatLabel>
1921
<small
2022
v-if="smallText"
2123
:class="{ 'p-error': isInvalid }"
@@ -25,6 +27,7 @@
2527
</template>
2628

2729
<script setup>
30+
import FloatLabel from "primevue/floatlabel"
2831
import InputNumber from "primevue/inputnumber"
2932
import { computed } from "vue"
3033

0 commit comments

Comments
 (0)