-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: slots config and child components config (#4176)
* feat(child-props): init child props feature * feat(modal): use child props * feat(components-config): slot prop * docs(components-config): add child and slots. improve examples * docs: minor fix
- Loading branch information
Showing
34 changed files
with
659 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"> | ||
<path d="M12 0a12 12 0 0 0-3.8 23.4c.6.1.8-.3.8-.6v-2.2c-3.3.7-4-1.4-4-1.4-.6-1.4-1.4-1.8-1.4-1.8-1-.7.1-.7.1-.7 1.2 0 1.9 1.2 1.9 1.2 1 1.8 2.8 1.3 3.4 1 .2-.8.5-1.3.8-1.6-2.7-.3-5.5-1.3-5.5-6 0-1.2.5-2.3 1.3-3.1-.1-.4-.6-1.6.1-3.2 0 0 1-.3 3.3 1.2a11.5 11.5 0 0 1 6 0C17.3 4.7 18.3 5 18.3 5c.7 1.6.2 2.9.1 3.2.8.8 1.3 1.9 1.3 3.2 0 4.6-2.9 5.6-5.5 5.9.4.4.8 1.1.8 2.2v3.3c0 .3.2.7.8.6A12 12 0 0 0 12 0z" /> | ||
</svg> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
packages/docs/page-config/services/components-config/code/components-all.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
components: { | ||
all: { | ||
color: '#d91698', | ||
disabled: 'true', | ||
createVuestic({ | ||
components: { | ||
all: { | ||
color: '#d91698', | ||
disabled: true, | ||
}, | ||
}, | ||
}, | ||
}) |
3 changes: 3 additions & 0 deletions
3
packages/docs/page-config/services/components-config/code/components-attributes-style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.my-custom-alert { | ||
background: linear-gradient(90deg, #ff8a00 0%, #e52e71 100%); | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/docs/page-config/services/components-config/code/components-attributes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
createVuestic({ | ||
components: { | ||
VaAlert: { | ||
style: 'outline: 2px solid var(--va-primary)', | ||
class: 'my-custom-alert', | ||
icon: 'info', | ||
dense: true, | ||
} | ||
} | ||
}) |
24 changes: 13 additions & 11 deletions
24
packages/docs/page-config/services/components-config/code/components-config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
components: { | ||
VaAvatar: { | ||
square: true, | ||
icon: 'spinner', | ||
createVuestic({ | ||
components: { | ||
VaAvatar: { | ||
square: true, | ||
icon: 'spinner', | ||
}, | ||
VaCard: { | ||
color: 'secondary', | ||
}, | ||
VaTabs: { | ||
grow: true, | ||
}, | ||
}, | ||
VaCard: { | ||
color: 'secondary', | ||
}, | ||
VaTabs: { | ||
grow: true, | ||
}, | ||
}, | ||
}) |
14 changes: 8 additions & 6 deletions
14
packages/docs/page-config/services/components-config/code/components-default-sizes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
components: { | ||
VaIcon: { | ||
sizesConfig: { | ||
defaultSize: 24, | ||
sizes: { | ||
createVuestic({ | ||
components: { | ||
VaIcon: { | ||
sizesConfig: { | ||
defaultSize: 24, | ||
sizes: { | ||
small: 16, | ||
medium: 24, | ||
large: 32, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}) |
13 changes: 7 additions & 6 deletions
13
packages/docs/page-config/services/components-config/code/components-presets.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
components: { | ||
presets: { | ||
VaButton: { | ||
addToCart: { size: 'large', round: true }, | ||
deleteFromCart: { size: 'small', plain: true }, | ||
createVuestic({ | ||
components: { | ||
presets: { | ||
VaButton: { | ||
addToCart: { round: true, color: 'success', icon: 'shopping_cart', 'slot:default': 'Add to card' }, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}) |
5 changes: 5 additions & 0 deletions
5
packages/docs/page-config/services/components-config/code/components-slots-style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.va-button--github { | ||
svg { | ||
margin-right: 8px; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/docs/page-config/services/components-config/code/components-slots.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import GithubSvgIcon from './GithubSvgIcon.vue' | ||
|
||
createVuestic({ | ||
components: { | ||
presets: { | ||
VaButton: { | ||
github: { | ||
'slot:prepend': markRaw(GithubSvgIcon), | ||
'slot:default': 'View on GitHub', | ||
color: '#000000', | ||
style: 'fill: currentColor', | ||
class: 'va-button--github', | ||
} | ||
} | ||
} | ||
} | ||
}) |
24 changes: 24 additions & 0 deletions
24
packages/docs/page-config/services/components-config/components/Priority.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<div class="flex flex-col"> | ||
<p class="my-2 mx-auto">Less important</p> | ||
<div | ||
v-for="priority, index in [ | ||
'Component `default` prop value', | ||
'Global `all` props value', | ||
'Component props from Global Config', | ||
'Component props form VaConfig', | ||
'Props value from component preset', | ||
'Props bound directly to component', | ||
]" | ||
:key="priority" | ||
> | ||
<div | ||
class="border-2 border-solid border-[var(--va-background-border)] p-4" | ||
> | ||
{{ priority }} | ||
</div> | ||
<div v-if="index !== 5" class="w-0 mx-auto justify-self-center border-r-2 border-solid border-[var(--va-background-border)] h-4" /> | ||
</div> | ||
<p class="my-2 mx-auto">More important</p> | ||
</div> | ||
</template> |
27 changes: 27 additions & 0 deletions
27
packages/docs/page-config/services/components-config/examples/attributes.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<VaConfig | ||
:components="{ | ||
VaAlert: { | ||
style: 'outline: 2px solid var(--va-primary)', | ||
class: 'my-custom-alert', | ||
icon: 'info', | ||
dense: true, | ||
} | ||
} | ||
" | ||
> | ||
<VaAlert> | ||
Test alert! | ||
</VaAlert> | ||
</VaConfig> | ||
</template> | ||
|
||
<script setup> | ||
import { VaConfig, VaAlert } from 'vuestic-ui' | ||
</script> | ||
|
||
<style> | ||
.my-custom-alert { | ||
background: linear-gradient(90deg, #ff8a00 0%, #e52e71 100%); | ||
} | ||
</style> |
49 changes: 0 additions & 49 deletions
49
packages/docs/page-config/services/components-config/examples/button.vue
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
packages/docs/page-config/services/components-config/examples/child-components.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<VaDatePicker | ||
:child:prev-button="{ textColor: 'danger' }" | ||
:child:middle-button="{ textColor: 'info' }" | ||
:child:next-button="{ textColor: 'success' }" | ||
/> | ||
</template> | ||
|
||
<script setup> | ||
import { VaDatePicker } from 'vuestic-ui' | ||
</script> |
8 changes: 1 addition & 7 deletions
8
packages/docs/page-config/services/components-config/examples/presets.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
<template> | ||
<VaButton | ||
preset="addToCart" | ||
class="mr-6" | ||
> | ||
'addToCart' preset | ||
</VaButton> | ||
<VaButton preset="deleteFromCart"> | ||
'deleteFromCart' preset | ||
</VaButton> | ||
/> | ||
</template> |
10 changes: 0 additions & 10 deletions
10
packages/docs/page-config/services/components-config/examples/priority.vue
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
packages/docs/page-config/services/components-config/examples/slots.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<template> | ||
<VaButton preset="github" /> | ||
</template> | ||
|
||
<style> | ||
.va-button--github { | ||
svg { | ||
margin-right: 8px; | ||
} | ||
} | ||
</style> |
48 changes: 18 additions & 30 deletions
48
packages/docs/page-config/services/components-config/examples/va-config.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
<template> | ||
<VaAlert color="#1B2D2A"> | ||
<VaConfig | ||
:components="{ | ||
VaButton: { color: '#414066', round: true }, | ||
VaIcon: { color: '#605E97' }, | ||
}" | ||
> | ||
<div class="alert-content"> | ||
<p>Read this important demo message!</p> | ||
<VaButton icon="hearing"> | ||
Ok | ||
</VaButton> | ||
<VaButton icon="visibility"> | ||
I already read it before | ||
</VaButton> | ||
<VaButton | ||
color="danger" | ||
icon="close" | ||
icon-color="warning" | ||
> | ||
Close | ||
</VaButton> | ||
</div> | ||
</VaConfig> | ||
</VaAlert> | ||
<VaConfig | ||
:components="{ | ||
VaAlert: { color: 'danger', icon: 'warning' }, | ||
}" | ||
> | ||
<div> | ||
<VaAlert> | ||
This is error alert | ||
</VaAlert> | ||
<VaAlert> | ||
This is error alert | ||
</VaAlert> | ||
|
||
<VaAlert color="warning"> | ||
This alert can have it's own color | ||
</VaAlert> | ||
</div> | ||
</VaConfig> | ||
</template> | ||
|
||
<style> | ||
.alert-content .va-button { | ||
margin-right: 0.5rem; | ||
} | ||
</style> |
Oops, something went wrong.