-
Notifications
You must be signed in to change notification settings - Fork 0
Showcase form #2
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
base: main
Are you sure you want to change the base?
Changes from all commits
da9161e
e8e07f0
e8c4dff
3d64541
abdee3a
b005825
4f7a4fe
020ae91
ddbf06d
b9a2082
5b0d656
10c6096
bfe66c5
2c7ad78
d9f1c49
28fa372
bc8da27
fc71d91
77d433a
8debb52
adf966b
047c18a
5d0a469
d4931b8
db44705
3957ea7
e3c4e82
77a1e47
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,6 @@ logs | |
.DS_Store | ||
.fleet | ||
.idea | ||
|
||
# ignore images from uploads folder | ||
public/img/uploads/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
<template> | ||
<div class="form__group__input"> | ||
<label v-if="label" :for="id" :class="labelClasses"> | ||
{{ label }}<span v-if="required" class="form__group__required" /> | ||
</label> | ||
<input | ||
:id="id" | ||
:type="type" | ||
:class="classes" | ||
:name="id" | ||
:placeholder="placeholder" | ||
:value="value" | ||
:min="min" | ||
:max="max" | ||
:step="step" | ||
:pattern="pattern" | ||
:autocomplete="autocomplete" | ||
:readonly="readonly" | ||
:required="required" | ||
:accept="accept" | ||
@input.stop="onInput" | ||
/> | ||
<div | ||
v-if="message" | ||
class="badge badge--sm" | ||
:class="`badge--${messageType}`" | ||
> | ||
{{ message }} | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed, type PropType } from 'vue' | ||
|
||
const props = defineProps({ | ||
type: { | ||
type: String, | ||
validator: (prop) => | ||
[ | ||
'color', | ||
'date', | ||
'datetime-local', | ||
'email', | ||
'file', | ||
'month', | ||
'number', | ||
'password', | ||
'range', | ||
'search', | ||
'tel', | ||
'text', | ||
'time', | ||
'url', | ||
'week', | ||
'submit', | ||
].includes(prop as string), | ||
default: () => 'text', | ||
}, | ||
variant: { | ||
type: String, | ||
validator: (prop) => ['outline', 'negative'].includes(prop as string), | ||
default: () => 'outline', | ||
}, | ||
message: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
onInput: { | ||
type: Function as PropType<(event: Event) => void>, | ||
default: () => ({}), | ||
}, | ||
messageType: { | ||
type: String, | ||
validator: (prop) => | ||
['error', 'warning', 'success', 'info'].includes(prop as string), | ||
default: () => 'error', | ||
}, | ||
size: { | ||
type: String, | ||
validator: (prop) => ['sm', 'base', 'lg'].includes(prop as string), | ||
default: () => undefined, | ||
}, | ||
label: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
hideLabel: { | ||
type: Boolean, | ||
default: () => false, | ||
}, | ||
placeholder: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
value: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
id: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
min: { | ||
type: Number, | ||
default: () => undefined, | ||
}, | ||
max: { | ||
type: Number, | ||
default: () => undefined, | ||
}, | ||
step: { | ||
type: Number, | ||
default: () => undefined, | ||
}, | ||
pattern: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
autocomplete: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
readonly: { | ||
type: Boolean, | ||
default: () => false, | ||
}, | ||
required: { | ||
type: Boolean, | ||
default: () => false, | ||
}, | ||
accept: { | ||
type: String, | ||
default: () => undefined, | ||
} | ||
}) | ||
|
||
const classes = computed(() => { | ||
let base = '' | ||
if (props.variant) base += `input--${props.variant} ` | ||
if (props.size) base += `input--${props.size} ` | ||
if (props.message) base += `input--${props.messageType} ` | ||
if (props.type === 'submit') base += 'input--submit' | ||
return base | ||
}) | ||
|
||
const labelClasses = computed(() => { | ||
let base = '' | ||
if (props.variant === 'negative') base += `text--negative ` | ||
if (props.size) base += `text--${props.size} ` | ||
if (props.hideLabel) base += `sr-only ` | ||
if (props.required) base += `text--asterisk ` | ||
return base | ||
}) | ||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<template> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a copy from swiss design example plus... |
||
<div | ||
:open="open || undefined" | ||
:class="['notification-banner', 'notification', `notification--${type}`]" | ||
:style="{ | ||
transitionDuration: `${closeDuration}`, | ||
}" | ||
> | ||
<div | ||
class="notification-banner__wrapper" | ||
:style="{ | ||
transitionDelay: `${closeDuration}`, | ||
}" | ||
> | ||
<p class="notification-banner__infos"> | ||
<slot /> | ||
</p> | ||
<slot name="buttons" /> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const { open = true, closeDuration = '0.3s' } = defineProps<{ | ||
type: 'info' | 'success' | 'warning' | 'error' | ||
open?: boolean | ||
closeDuration?: string | ||
}>() | ||
</script> | ||
|
||
<style scoped> | ||
.notification-banner { | ||
display: block; | ||
transition-property: padding, opacity; | ||
transition-timing-function: ease-in-out, ease-in-out; | ||
} | ||
.notification-banner:not([open]) { | ||
padding: 0; | ||
opacity: 0; | ||
overflow: hidden; | ||
} | ||
.notification-banner__wrapper { | ||
transition-property: height; | ||
transition-duration: 0s; | ||
} | ||
.notification-banner:not([open]) .notification-banner__wrapper { | ||
height: 0; | ||
} | ||
Comment on lines
+32
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...a transition which smoothly collapses the notification when |
||
</style> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<template> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also a copy from swiss design |
||
<div class="form__group__input"> | ||
<label v-if="label" :for="id" :class="labelClasses"> | ||
{{ label }} | ||
</label> | ||
<textarea | ||
:id="id" | ||
:class="classes" | ||
:name="id" | ||
:rows="rows" | ||
:cols="cols" | ||
:maxlength="maxlength" | ||
:minlength="minlength" | ||
:placeholder="placeholder" | ||
:required="required" | ||
/> | ||
<div | ||
v-if="message" | ||
class="badge badge--sm" | ||
:class="`badge--${messageType}`" | ||
> | ||
{{ message }} | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { computed } from 'vue' | ||
const props = defineProps({ | ||
variant: { | ||
type: String, | ||
validator: (prop) => ['outline', 'negative'].includes(prop as string), | ||
default: () => undefined, | ||
}, | ||
size: { | ||
type: String, | ||
validator: (prop) => ['sm', 'base', 'lg'].includes(prop as string), | ||
default: () => undefined, | ||
}, | ||
id: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
name: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
label: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
placeholder: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
rows: { | ||
type: Number, | ||
default: () => 4, | ||
}, | ||
cols: { | ||
type: Number, | ||
default: () => 50, | ||
}, | ||
message: { | ||
type: String, | ||
default: () => undefined, | ||
}, | ||
messageType: { | ||
type: String, | ||
validator: (prop) => | ||
['error', 'warning', 'success', 'info'].includes(prop as string), | ||
default: () => undefined, | ||
}, | ||
required: { | ||
type: Boolean, | ||
default: () => false, | ||
}, | ||
resizable: { | ||
type: Boolean, | ||
default: () => true, | ||
}, | ||
maxlength: { | ||
type: Number, | ||
default: () => undefined, | ||
}, | ||
minlength: { | ||
type: Number, | ||
default: () => undefined, | ||
}, | ||
}) | ||
const classes = computed(() => { | ||
let base = '' | ||
if (props.variant) base += `input--${props.variant} ` | ||
if (props.size) base += `input--${props.size} ` | ||
if (props.messageType) base += `input--${props.messageType} ` | ||
if (!props.resizable) base += 'textarea--public' | ||
return base | ||
}) | ||
const labelClasses = computed(() => { | ||
let base = '' | ||
if (props.variant === 'negative') base += `text--negative ` | ||
if (props.size) base += `text--${props.size} ` | ||
if (props.required) base += `text--asterisk ` | ||
return base | ||
}) | ||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,9 +44,15 @@ | |
<template #option="option"> | ||
<span> | ||
{{ option.title }} | ||
<span style="float: right; color: #888;">({{ option.count }})</span> | ||
<span v-if="option.count" style="float: right; color: #888;">({{ option.count }})</span> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hiding the |
||
</span> | ||
</template> | ||
<template | ||
#selected-option="option" | ||
> | ||
{{ option.title }} | ||
<input type="hidden" :name="name" :value="option.id"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hidden input makes it possible to use the component in native |
||
</template> | ||
</VSelect> | ||
<div class="select__icon"> | ||
<svg role="presentation" aria-hidden="true" viewBox="0 0 24 24"> | ||
|
@@ -226,3 +232,9 @@ watch( | |
} | ||
) | ||
</script> | ||
|
||
<style scoped> | ||
input.vs__selected { | ||
cursor: default; | ||
} | ||
</style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is direct copy from swiss design
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input css is currently broken. There is a conflict with vuetify (which is not removed here but in main)