1 |
- {"version":3,"file":"VToolbar.mjs","names":["VToolbarTitle","VExpandTransition","VDefaultsProvider","VImg","makeBorderProps","useBorder","useBackgroundColor","makeComponentProps","provideDefaults","makeElevationProps","useElevation","useRtl","makeRoundedProps","useRounded","makeTagProps","makeThemeProps","provideTheme","computed","shallowRef","toRef","convertToUnit","genericComponent","propsFactory","useRender","allowedDensities","makeVToolbarProps","absolute","Boolean","collapse","color","String","density","type","default","validator","v","includes","extended","extensionHeight","Number","flat","floating","height","image","title","tag","VToolbar","name","props","setup","_ref","slots","backgroundColorClasses","backgroundColorStyles","borderClasses","elevationClasses","roundedClasses","themeClasses","rtlClasses","isExtended","extension","contentHeight","parseInt","value","VBtn","variant","hasTitle","hasImage","_createVNode","class","style","cover","src","VTabs","prepend","text","append"],"sources":["../../../src/components/VToolbar/VToolbar.tsx"],"sourcesContent":["// Styles\nimport './VToolbar.sass'\n\n// Components\nimport { VToolbarTitle } from './VToolbarTitle'\nimport { VExpandTransition } from '@/components/transitions'\nimport { VDefaultsProvider } from '@/components/VDefaultsProvider'\nimport { VImg } from '@/components/VImg'\n\n// Composables\nimport { makeBorderProps, useBorder } from '@/composables/border'\nimport { useBackgroundColor } from '@/composables/color'\nimport { makeComponentProps } from '@/composables/component'\nimport { provideDefaults } from '@/composables/defaults'\nimport { makeElevationProps, useElevation } from '@/composables/elevation'\nimport { useRtl } from '@/composables/locale'\nimport { makeRoundedProps, useRounded } from '@/composables/rounded'\nimport { makeTagProps } from '@/composables/tag'\nimport { makeThemeProps, provideTheme } from '@/composables/theme'\n\n// Utilities\nimport { computed, shallowRef, toRef } from 'vue'\nimport { convertToUnit, genericComponent, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\n\nconst allowedDensities = [null, 'prominent', 'default', 'comfortable', 'compact'] as const\n\nexport type Density = null | 'prominent' | 'default' | 'comfortable' | 'compact'\n\nexport const makeVToolbarProps = propsFactory({\n absolute: Boolean,\n collapse: Boolean,\n color: String,\n density: {\n type: String as PropType<Density>,\n default: 'default',\n validator: (v: any) => allowedDensities.includes(v),\n },\n extended: Boolean,\n extensionHeight: {\n type: [Number, String],\n default: 48,\n },\n flat: Boolean,\n floating: Boolean,\n height: {\n type: [Number, String],\n default: 64,\n },\n image: String,\n title: String,\n\n ...makeBorderProps(),\n ...makeComponentProps(),\n ...makeElevationProps(),\n ...makeRoundedProps(),\n ...makeTagProps({ tag: 'header' }),\n ...makeThemeProps(),\n}, 'VToolbar')\n\nexport type VToolbarSlots = {\n default: never\n image: never\n prepend: never\n append: never\n title: never\n extension: never\n}\n\nexport const VToolbar = genericComponent<VToolbarSlots>()({\n name: 'VToolbar',\n\n props: makeVToolbarProps(),\n\n setup (props, { slots }) {\n const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor(toRef(props, 'color'))\n const { borderClasses } = useBorder(props)\n const { elevationClasses } = useElevation(props)\n const { roundedClasses } = useRounded(props)\n const { themeClasses } = provideTheme(props)\n const { rtlClasses } = useRtl()\n\n const isExtended = shallowRef(!!(props.extended || slots.extension?.()))\n const contentHeight = computed(() => parseInt((\n Number(props.height) +\n (props.density === 'prominent' ? Number(props.height) : 0) -\n (props.density === 'comfortable' ? 8 : 0) -\n (props.density === 'compact' ? 16 : 0)\n ), 10))\n const extensionHeight = computed(() => isExtended.value\n ? parseInt((\n Number(props.extensionHeight) +\n (props.density === 'prominent' ? Number(props.extensionHeight) : 0) -\n (props.density === 'comfortable' ? 4 : 0) -\n (props.density === 'compact' ? 8 : 0)\n ), 10)\n : 0\n )\n\n provideDefaults({\n VBtn: {\n variant: 'text',\n },\n })\n\n useRender(() => {\n const hasTitle = !!(props.title || slots.title)\n const hasImage = !!(slots.image || props.image)\n\n const extension = slots.extension?.()\n isExtended.value = !!(props.extended || extension)\n\n return (\n <props.tag\n class={[\n 'v-toolbar',\n {\n 'v-toolbar--absolute': props.absolute,\n 'v-toolbar--collapse': props.collapse,\n 'v-toolbar--flat': props.flat,\n 'v-toolbar--floating': props.floating,\n [`v-toolbar--density-${props.density}`]: true,\n },\n backgroundColorClasses.value,\n borderClasses.value,\n elevationClasses.value,\n roundedClasses.value,\n themeClasses.value,\n rtlClasses.value,\n props.class,\n ]}\n style={[\n backgroundColorStyles.value,\n props.style,\n ]}\n >\n { hasImage && (\n <div key=\"image\" class=\"v-toolbar__image\">\n { !slots.image ? (\n <VImg\n key=\"image-img\"\n cover\n src={ props.image }\n />\n ) : (\n <VDefaultsProvider\n key=\"image-defaults\"\n disabled={ !props.image }\n defaults={{\n VImg: {\n cover: true,\n src: props.image,\n },\n }}\n v-slots:default={ slots.image }\n />\n )}\n </div>\n )}\n\n <VDefaultsProvider\n defaults={{\n VTabs: {\n height: convertToUnit(contentHeight.value),\n },\n }}\n >\n <div\n class=\"v-toolbar__content\"\n style={{ height: convertToUnit(contentHeight.value) }}\n >\n { slots.prepend && (\n <div class=\"v-toolbar__prepend\">\n { slots.prepend?.() }\n </div>\n )}\n\n { hasTitle && (\n <VToolbarTitle key=\"title\" text={ props.title }>\n {{ text: slots.title }}\n </VToolbarTitle>\n )}\n\n { slots.default?.() }\n\n { slots.append && (\n <div class=\"v-toolbar__append\">\n { slots.append?.() }\n </div>\n )}\n </div>\n </VDefaultsProvider>\n\n <VDefaultsProvider\n defaults={{\n VTabs: {\n height: convertToUnit(extensionHeight.value),\n },\n }}\n >\n <VExpandTransition>\n { isExtended.value && (\n <div\n class=\"v-toolbar__extension\"\n style={{ height: convertToUnit(extensionHeight.value) }}\n >\n { extension }\n </div>\n )}\n </VExpandTransition>\n </VDefaultsProvider>\n </props.tag>\n )\n })\n\n return {\n contentHeight,\n extensionHeight,\n }\n },\n})\n\nexport type VToolbar = InstanceType<typeof VToolbar>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,aAAa;AAAA,SACbC,iBAAiB;AAAA,SACjBC,iBAAiB;AAAA,SACjBC,IAAI,6BAEb;AAAA,SACSC,eAAe,EAAEC,SAAS;AAAA,SAC1BC,kBAAkB;AAAA,SAClBC,k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