{"version":3,"file":"JAvatar.vue.cjs","sources":["../../../../src/components/atoms/JAvatar.vue"],"sourcesContent":["<script setup lang=\"ts\">\r\nimport { computed } from 'vue'\r\nimport Avatar from '@/components/shadcn/Avatar.vue'\r\nimport AvatarFallback from '@/components/shadcn/AvatarFallback.vue'\r\nimport AvatarImage from '@/components/shadcn/AvatarImage.vue'\r\n\r\ntype StyleType =\r\n  | 'default'   // 기본 스타일\r\n  | 'primary'   // 강조 스타일 (파랑)\r\n  | 'success'   // 성공 스타일 (초록)\r\n  | 'warning'   // 경고 스타일 (주황)\r\n  | 'danger'    // 위험 스타일 (빨강)\r\n\r\ntype Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\r\ntype Shape = 'circle' | 'square' | 'rounded'\r\n\r\ntype Status = 'online' | 'offline' | 'away' | 'busy'\r\n\r\nconst props = withDefaults(\r\n  defineProps<{\r\n    src?: string\r\n    alt?: string\r\n    fallback?: string\r\n    class?: string\r\n    /** 스타일 프리셋 */\r\n    styletype?: StyleType\r\n    /** 아바타 크기 */\r\n    size?: Size\r\n    /** 아바타 모양 */\r\n    shape?: Shape\r\n    /** 상태 표시 */\r\n    status?: Status\r\n  }>(),\r\n  {\n    alt: '',\n    fallback: '?',\n    styletype: 'default',\n    size: 'sm',\n    shape: 'circle',\n  },\n)\r\n\r\n/**\r\n * styletype -> class 매핑\r\n */\r\nconst STYLE_PRESETS: Record<StyleType, { class: string }> = {\r\n  default: { class: '' },\r\n  primary: { \r\n    class: 'bg-blue-500 text-white',\r\n  },\r\n  success: { \r\n    class: 'bg-green-500 text-white',\r\n  },\r\n  warning: { \r\n    class: 'bg-amber-500 text-white',\r\n  },\r\n  danger: { \r\n    class: 'bg-red-500 text-white',\r\n  },\r\n}\r\n\r\n/**\r\n * size -> class 매핑\r\n */\r\nconst SIZE_PRESETS: Record<Size, { class: string }> = {\n  xs: { \n    class: 'h-6 w-6 text-[10px]',\n  },\n  sm: { \n    class: 'h-8 w-8 text-xs',\n  },\n  md: { \n    class: 'h-10 w-10 text-sm',\n  },\n  lg: { \n    class: 'h-12 w-12 text-base',\n  },\n  xl: { \n    class: 'h-16 w-16 text-lg',\n  },\n}\n\r\n/**\r\n * shape -> class 매핑\r\n */\r\nconst SHAPE_PRESETS: Record<Shape, { class: string }> = {\r\n  circle: { \r\n    class: 'rounded-full',\r\n  },\r\n  square: { \r\n    class: 'rounded-none',\r\n  },\r\n  rounded: { \r\n    class: 'rounded-lg',\r\n  },\r\n}\r\n\r\n/**\r\n * status -> class 매핑\r\n */\r\nconst STATUS_PRESETS: Record<Status, { class: string }> = {\r\n  online: { \r\n    class: 'ring-2 ring-green-500 ring-offset-2',\r\n  },\r\n  offline: { \r\n    class: 'ring-2 ring-gray-400 ring-offset-2',\r\n  },\r\n  away: { \r\n    class: 'ring-2 ring-yellow-500 ring-offset-2',\r\n  },\r\n  busy: { \r\n    class: 'ring-2 ring-red-500 ring-offset-2',\r\n  },\r\n}\r\n\r\n/** 최종 바인딩: 직접 넘긴 class가 있으면 styletype, size, shape, status 기본값과 병합 */\r\nconst mapped = computed(() => {\r\n  const stylePreset = STYLE_PRESETS[props.styletype!]\r\n  const sizePreset = SIZE_PRESETS[props.size!]\r\n  const shapePreset = SHAPE_PRESETS[props.shape!]\r\n  const statusPreset = props.status ? STATUS_PRESETS[props.status] : { class: '' }\r\n  const finalClass = [stylePreset.class, sizePreset.class, shapePreset.class, statusPreset.class, props.class].filter(Boolean).join(' ')\r\n  \r\n  return {\r\n    class: finalClass,\r\n  }\r\n})\r\n</script>\r\n\r\n<template>\r\n  <Avatar v-bind=\"mapped\">\r\n    <AvatarImage v-if=\"props.src\" :src=\"props.src\" :alt=\"props.alt\" />\r\n    <AvatarFallback v-else>{{ props.fallback }}</AvatarFallback>\r\n  </Avatar>\r\n</template>\r\n"],"names":["props","__props","STYLE_PRESETS","SIZE_PRESETS","SHAPE_PRESETS","STATUS_PRESETS","mapped","computed","stylePreset","sizePreset","shapePreset","statusPreset","_openBlock","_createBlock","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