Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(VNumberInput): add new component #18162

Merged
merged 44 commits into from
Mar 19, 2024
Merged

feat(VNumberInput): add new component #18162

merged 44 commits into from
Mar 19, 2024

Conversation

yuwu9145
Copy link
Member

@yuwu9145 yuwu9145 commented Aug 28, 2023

Description

image

Markup:

<template>
  <v-app>
    <v-select
      v-model="fieldVariant"
      label="Variants"
      :items="['underlined', 'outlined', 'filled', 'solo', 'solo-inverted', 'solo-filled', 'plain']"
    />
    <h1>{{ numberInputValue }}</h1>
    <div class="ma-4 pa-4">
      <v-number-input
        v-model="numberInputValue"
        :variant="fieldVariant"
      />
      <v-number-input
        v-model="numberInputValue"
        control-variant="stacked"
        :variant="fieldVariant"
      />
      <v-number-input
        v-model="numberInputValue"
        control-variant="split"
        :variant="fieldVariant"
      />
    </div>
    <div class="ma-4 pa-4">
      <h1>Reverse</h1>
      <v-number-input
        v-model="numberInputValue"
        reverse
        :variant="fieldVariant"
      />
      <v-number-input
        v-model="numberInputValue"
        control-variant="stacked"
        reverse
        :variant="fieldVariant"
      />
      <v-number-input
        v-model="numberInputValue"
        control-variant="split"
        reverse
        :variant="fieldVariant"
      />
    </div>
    <div class="ma-4 pa-4">
      <h1>inset</h1>
      <v-number-input
        v-model="numberInputValue"
        inset
        :variant="fieldVariant"
      />
      <v-number-input
        v-model="numberInputValue"
        control-variant="stacked"
        inset
        :variant="fieldVariant"
      />
      <v-number-input
        v-model="numberInputValue"
        control-variant="split"
        inset
        :variant="fieldVariant"
      />
    </div>
    <div class="ma-4 pa-4">
      <h1>Reverse Inset</h1>
      <v-number-input
        v-model="numberInputValue"
        reverse
        inset
        :variant="fieldVariant"
      />
      <v-number-input
        v-model="numberInputValue"
        control-variant="stacked"
        reverse
        inset
        :variant="fieldVariant"
      />
      <v-number-input
        v-model="numberInputValue"
        control-variant="split"
        reverse
        inset
        :variant="fieldVariant"
      />
    </div>
    <div class="ma-4 pa-4">
      <h1>Hide Input</h1>
      <v-number-input
        v-model="numberInputValue"
        hide-input
        :variant="fieldVariant"
      />
      <v-number-input
        v-model="numberInputValue"
        inset
        hide-input
        :variant="fieldVariant"
      />
    </div>
    <div class="ma-4 pa-4">
      <h1>Control slots</h1>
      <v-number-input
        v-model="numberInputValue"
        :variant="fieldVariant"
        reverse
      >
        <template v-slot:increment="{ click }">
          <v-btn
            color="red"
            @click="click"
          />
        </template>
        <template v-slot:decrement="{ click }">
          <v-btn
            color="green"
            @click="click"
          />
        </template>
      </v-number-input>
    </div>
    <div class="ma-4 pa-4">
      <h1>Native html attributes support</h1>
      <h4>max (100)</h4>
      <v-number-input
        :max="100"
        :min="10"
        :model-value="120"
        :variant="fieldVariant"
      />
      <h4>min (10)</h4>
      <v-number-input
        :max="100"
        :min="10"
        :model-value="6"
        :variant="fieldVariant"
      />
      <h4>step (5)</h4>
      <v-number-input
        :max="100"
        :min="10"
        :step="5"
        :model-value="70"
        :variant="fieldVariant"
      />
    </div>
    <div class="ma-4 pa-4">
      <h1>VInput/VField props</h1>
      <h4>disabled</h4>
      <v-number-input
        :max="100"
        :min="10"
        disabled
        :variant="fieldVariant"
      />
      <h4>hint</h4>
      <v-number-input
        hint="Enter your password to access this website"
        :variant="fieldVariant"
      />
      <h4>label</h4>
      <v-number-input
        label="test label"
        :variant="fieldVariant"
      />
      <h4>Density</h4>
      <v-number-input
        :variant="fieldVariant"
        density="default"
      />
      <v-number-input
        :variant="fieldVariant"
        density="comfortable"
      />
      <v-number-input
        :variant="fieldVariant"
        density="compact"
      />
      <h4>Loading</h4>
      <v-number-input
        :variant="fieldVariant"
        loading
        color="blue"
      >
      </v-number-input>
    </div>
  </v-app>
</template>

<script setup lang="ts">
  import { computed, ref } from 'vue'
  const fieldVariant = ref('outlined')
  const numberInputValue = ref(120)
  const progress = computed(() => Math.min(100, 5 * 10))
</script>



@yuwu9145 yuwu9145 changed the base branch from master to dev August 28, 2023 13:32
@github-actions
Copy link
Contributor

🚀 Nightly release published to @vuetify/nightly@3.4.0-alpha.1-pr-18162.6892936.

@MajesticPotatoe MajesticPotatoe added T: feature A new feature C: New Component This issue would need a new component to be developed. labels Sep 11, 2023
@yuwu9145 yuwu9145 self-assigned this Jan 6, 2024
@yuwu9145 yuwu9145 marked this pull request as ready for review January 6, 2024 10:55
@yuwu9145
Copy link
Member Author

yuwu9145 commented Jan 6, 2024

Q1: How should labels be aligned in the context of "reverse stepper buttons"? Especially for outlined variant?

Screenshot 2024-01-06 at 9 57 05 pm Screenshot 2024-01-06 at 9 57 47 pm

Q2: Should we support plain & underlined variants?

Screenshot 2024-01-06 at 9 58 39 pm

@KaelWD
Copy link
Member

KaelWD commented Jan 23, 2024

How should labels be aligned?

It could also be shifted over the width of the buttons like prepend-inner does.

Should we support plain & underlined variants?

Plain definitely, underlined kinda comes free with that and still looks better than native.

@johnleider johnleider added this to the v3.x.x milestone Jan 23, 2024
@KaelWD KaelWD modified the milestones: v3.x.x, v3.6.0 (Nebula) Jan 25, 2024
@yuwu9145
Copy link
Member Author

Label alignment should be resolved in #19214

@yuwu9145
Copy link
Member Author

yuwu9145 commented Feb 26, 2024

Leave the plain and underlined variants of the UI as out-of-the-box for now, feel free to comment if they really need special UX care.

Other parts are ready for further review

@yuwu9145 yuwu9145 changed the base branch from dev to master March 16, 2024 04:33
@johnleider johnleider merged commit 319b9c6 into master Mar 19, 2024
17 of 18 checks passed
@johnleider johnleider deleted the feat/v3-number-input branch March 19, 2024 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: New Component This issue would need a new component to be developed. C: VNumberInput labs T: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants