@aivex/ui 1.2.0-dev.60 → 1.2.0-dev.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/DESIGN.md +1 -1
- package/dist/components/Autocomplete/Autocomplete.cjs +2 -0
- package/dist/components/Autocomplete/Autocomplete.cjs.map +1 -0
- package/dist/components/Autocomplete/Autocomplete.d.cts +157 -0
- package/dist/components/Autocomplete/Autocomplete.d.ts +157 -0
- package/dist/components/Autocomplete/Autocomplete.js +192 -0
- package/dist/components/Autocomplete/Autocomplete.js.map +1 -0
- package/dist/components/Autocomplete/index.d.cts +2 -0
- package/dist/components/Autocomplete/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.cjs +1 -1
- package/dist/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.js +8 -8
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.js +6 -6
- package/dist/components/Coachmark/Coachmark.cjs +1 -1
- package/dist/components/Coachmark/Coachmark.js +14 -14
- package/dist/components/Comment/CommentInput.cjs +1 -1
- package/dist/components/Comment/CommentInput.js +6 -6
- package/dist/components/IconButton/IconButton.cjs +1 -1
- package/dist/components/IconButton/IconButton.cjs.map +1 -1
- package/dist/components/IconButton/IconButton.js +6 -6
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +21 -21
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.js +17 -17
- package/dist/components/NumberField/NumberField.cjs +1 -1
- package/dist/components/NumberField/NumberField.js +7 -7
- package/dist/components/Popover/Popover.cjs.map +1 -1
- package/dist/components/Popover/Popover.d.cts +5 -0
- package/dist/components/Popover/Popover.d.ts +5 -0
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/SelectBox/SelectBox.cjs +1 -1
- package/dist/components/SelectBox/SelectBox.js +4 -4
- package/dist/components/SelectButton/SelectButton.cjs +1 -1
- package/dist/components/SelectButton/SelectButton.js +5 -5
- package/dist/components/Tagbox/Tagbox.cjs +1 -1
- package/dist/components/Tagbox/Tagbox.js +8 -8
- package/dist/components/Textarea/Textarea.cjs +1 -1
- package/dist/components/Textarea/Textarea.js +6 -6
- package/dist/components/Textbox/Textbox.cjs +1 -1
- package/dist/components/Textbox/Textbox.js +10 -10
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +61 -60
- package/dist/llms-full.txt +69 -2
- package/dist/llms.txt +3 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Autocomplete.js","names":[],"sources":["../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["\"use client\";\n\nimport { Autocomplete as AutocompletePrimitive } from \"@base-ui/react/autocomplete\";\nimport {\n createContext,\n type InputHTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useContext,\n useMemo,\n useRef,\n} from \"react\";\nimport { useFieldState } from \"@/components/Field/FieldStateContext\";\nimport { CloseIcon } from \"@/components/Icon\";\nimport { IconButton } from \"@/components/IconButton\";\nimport { InputBase } from \"@/components/InputBase\";\nimport { resolveInputError, useInputFocus } from \"@/components/InputBase/useInputState\";\nimport { cn } from \"@/utils/cn\";\nimport { PortalEventBoundary } from \"@/utils/PortalEventBoundary\";\nimport { type PopupPositioningProps, splitPositioningProps } from \"@/utils/popupPositioning\";\nimport { useControllableState } from \"@/utils/useControllableState\";\n\n// ─── Context ──────────────────────────────────────────────────────────────────\n\ninterface AutocompleteContextValue {\n value: string;\n /** 루트에서 비활성화했는지 — 입력 박스 외형에 반영한다. */\n disabled: boolean;\n /** 목록에서 하이라이트된 항목이 있는지 — Enter가 항목 선택인지 제출인지 가른다. */\n hasHighlightRef: { current: boolean };\n submit: (value: string) => void;\n}\n\nconst AutocompleteContext = createContext<AutocompleteContextValue | null>(null);\n\nfunction useAutocompleteContext(part: string) {\n const context = useContext(AutocompleteContext);\n if (!context) throw new Error(`${part}는 <Autocomplete> 안에서만 쓸 수 있습니다.`);\n return context;\n}\n\n// ─── Root ─────────────────────────────────────────────────────────────────────\n\ntype PrimitiveRootProps<Item> = AutocompletePrimitive.Root.Props<Item>;\n\nexport type AutocompleteRootProps<Item = string> = Omit<\n PrimitiveRootProps<Item>,\n \"value\" | \"defaultValue\" | \"onValueChange\" | \"items\" | \"actionsRef\"\n> & {\n /** 제안 목록. 문자열이거나 `{ value, label }` 꼴이면 그대로 쓰고, 다른 객체는 `itemToStringValue`를 함께 준다. */\n items?: readonly Item[];\n /** 입력값(제어) */\n value?: string;\n /** 초기 입력값(비제어) */\n defaultValue?: string;\n /** 입력값이 바뀔 때(타이핑·항목 선택·지우기) 호출된다. 원인은 `details.reason`으로 구분한다. */\n onValueChange?: (value: string, details: AutocompletePrimitive.Root.ChangeEventDetails) => void;\n /**\n * 하이라이트된 항목 없이 입력창에서 Enter를 누르면 현재 입력값으로 호출되고 목록이 닫힌다.\n * 목록에 없는 자유 입력을 확정(검색 실행 등)할 때 쓴다. 항목을 고른 경우는 Item의 `onClick`으로 받는다.\n */\n onSubmit?: (value: string) => void;\n};\n\n/**\n * 입력창 아래에 제안 목록이 뜨는 텍스트 입력. 목록은 제안일 뿐이라 목록에 없는 값도 그대로 입력할 수 있다.\n *\n * 최근 검색어·추천어가 붙는 검색창처럼 \"자유 입력 + 제안\"일 때 쓴다. 목록 중 하나만 골라야 하면\n * SelectBox, 제안 없이 입력만 받으면 Textbox를 쓴다. Popover에 Textbox를 anchor로 붙여 직접\n * 만들지 않는다 — 방향키 이동·Enter 선택·Esc·포커스 이탈 처리를 이 컴포넌트가 맡는다.\n *\n * Esc는 열린 목록을 닫을 뿐 입력값을 지우지 않는다. 목록이 닫혀 있으면 Esc는 바깥(모달 등)으로 넘어간다.\n *\n * 기본은 입력값으로 `items`를 걸러 보여 준다(`mode=\"list\"`). 최근 검색어처럼 입력과 무관하게\n * 목록을 그대로 보여 주려면 `mode=\"none\"`, 입력창을 누르자마자 목록을 열려면 `openOnInputClick`.\n *\n * @example\n * ```tsx\n * import { Autocomplete, SearchIcon } from \"@aivex/ui\";\n *\n * const [keyword, setKeyword] = useState(\"\");\n *\n * <Autocomplete\n * items={recentKeywords}\n * value={keyword}\n * onValueChange={setKeyword}\n * onSubmit={search}\n * mode=\"none\"\n * openOnInputClick\n * >\n * <Autocomplete.Input clearable startContent={<SearchIcon />} placeholder=\"검색\" />\n * <Autocomplete.Content>\n * <Autocomplete.Empty>최근 검색어가 없습니다</Autocomplete.Empty>\n * <Autocomplete.List>\n * {(item: string) => (\n * <Autocomplete.Item key={item} value={item} onClick={() => search(item)}>\n * {item}\n * </Autocomplete.Item>\n * )}\n * </Autocomplete.List>\n * </Autocomplete.Content>\n * </Autocomplete>\n * ```\n */\nfunction AutocompleteRoot<Item = string>({\n value,\n defaultValue,\n onValueChange,\n onSubmit,\n onItemHighlighted,\n disabled,\n children,\n ...props\n}: AutocompleteRootProps<Item>) {\n const actionsRef = useRef<AutocompletePrimitive.Root.Actions | null>(null);\n const hasHighlightRef = useRef(false);\n const detailsRef = useRef<AutocompletePrimitive.Root.ChangeEventDetails | null>(null);\n const [currentValue, setCurrentValue] = useControllableState<string>({\n value,\n defaultValue: defaultValue ?? \"\",\n onChange: (next) => {\n if (detailsRef.current) onValueChange?.(next, detailsRef.current);\n },\n });\n\n const onSubmitRef = useRef(onSubmit);\n onSubmitRef.current = onSubmit;\n\n const context = useMemo<AutocompleteContextValue>(\n () => ({\n value: currentValue,\n disabled: Boolean(disabled),\n hasHighlightRef,\n submit: (submitted) => {\n if (!onSubmitRef.current) return;\n onSubmitRef.current(submitted);\n actionsRef.current?.close();\n },\n }),\n [currentValue, disabled],\n );\n\n const rootProps = {\n ...props,\n disabled,\n actionsRef,\n value: currentValue,\n onValueChange: (next: string, details: AutocompletePrimitive.Root.ChangeEventDetails) => {\n // 목록이 닫힌 상태의 Esc를 Base UI는 \"입력 비우기\"로 쓴다. 검색창·폼 입력에서는 확정한 값이\n // Esc 한 번에 사라지고, 모달 안에서는 그 Esc가 모달에 닿지 않기도 한다 — 값은 그대로 두고\n // Esc를 바깥(모달 등)으로 흘려보낸다.\n if (details.reason === \"escape-key\") {\n details.cancel();\n details.allowPropagation();\n return;\n }\n detailsRef.current = details;\n setCurrentValue(next);\n },\n onItemHighlighted: ((highlighted, details) => {\n hasHighlightRef.current = highlighted !== undefined;\n onItemHighlighted?.(highlighted, details);\n }) satisfies PrimitiveRootProps<Item>[\"onItemHighlighted\"],\n } as Omit<PrimitiveRootProps<Item>, \"items\"> & { items?: readonly Item[] };\n\n return (\n <AutocompleteContext.Provider value={context}>\n <AutocompletePrimitive.Root {...rootProps}>{children}</AutocompletePrimitive.Root>\n </AutocompleteContext.Provider>\n );\n}\n\n// ─── Input ────────────────────────────────────────────────────────────────────\n\nexport interface AutocompleteInputProps\n extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"size\" | \"value\" | \"defaultValue\" | \"onChange\"\n > {\n /**\n * 높이 sm 32px·md 40px\n * @default \"md\"\n */\n size?: \"sm\" | \"md\";\n /** 에러 상태. Field 안에서는 Field의 invalid로도 켜진다 */\n error?: boolean;\n /** 입력값 전체 삭제 버튼 표시 여부 */\n clearable?: boolean;\n /**\n * clearable 삭제 버튼의 aria-label\n * @default \"입력값 삭제\"\n */\n clearAriaLabel?: string;\n /** 인풋 좌측 슬롯 */\n startContent?: ReactNode;\n /** 인풋 우측 슬롯 (clearable=true 이고 값이 있으면 삭제 버튼이 추가됨) */\n endContent?: ReactNode;\n /** 입력 박스(테두리)에 추가할 className. 폭은 여기서 정한다. */\n className?: string;\n ref?: Ref<HTMLInputElement>;\n}\n\n/**\n * 제안 목록이 붙는 입력창. 외형은 Textbox와 같고, 목록은 이 박스 폭에 맞춰 바로 아래에 뜬다.\n * 값은 루트(`value`/`onValueChange`)가 갖는다. 라벨이 없으면 aria-label을 지정한다.\n */\nfunction AutocompleteInput({\n size = \"md\",\n error,\n clearable,\n clearAriaLabel = \"입력값 삭제\",\n startContent,\n endContent,\n className,\n disabled,\n onFocus,\n onBlur,\n onKeyDown,\n ref,\n ...props\n}: AutocompleteInputProps) {\n const {\n value,\n disabled: rootDisabled,\n hasHighlightRef,\n submit,\n } = useAutocompleteContext(\"Autocomplete.Input\");\n const focus = useInputFocus({ onFocus, onBlur });\n const field = useFieldState();\n const isError = resolveInputError(error, props[\"aria-invalid\"]) || field.invalid;\n const isDisabled = Boolean(disabled) || rootDisabled || field.disabled;\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n // 한글 조합 중의 Enter는 글자 확정이다 — 제출로 보지 않는다.\n if (event.key !== \"Enter\" || event.nativeEvent.isComposing) return;\n if (!hasHighlightRef.current) submit(value);\n };\n\n const clearButton = clearable ? (\n <AutocompletePrimitive.Clear\n aria-label={clearAriaLabel}\n render={\n <IconButton size={size === \"sm\" ? \"xs\" : \"sm\"} tabIndex={-1} className=\"aivex:shrink-0\" />\n }\n >\n <CloseIcon size={size === \"sm\" ? 14 : 16} />\n </AutocompletePrimitive.Clear>\n ) : null;\n\n const showsClear = clearable && value.length > 0;\n\n return (\n <AutocompletePrimitive.InputGroup className={cn(\"aivex:w-full\", className)}>\n <InputBase\n error={isError}\n disabled={isDisabled}\n focused={focus.focused}\n filled={value.length > 0}\n size={size}\n layout=\"inline\"\n startContent={startContent}\n endContent={\n endContent || showsClear ? (\n <>\n {endContent}\n {clearButton}\n </>\n ) : undefined\n }\n >\n <AutocompletePrimitive.Input\n ref={ref}\n disabled={disabled}\n className={cn(\n \"aivex:m-0 aivex:w-full aivex:min-w-0 aivex:appearance-none aivex:border-0 aivex:bg-transparent aivex:p-0 aivex:text-text-primary aivex:placeholder:text-text-tertiary aivex:outline-none\",\n size === \"sm\" ? \"aivex:text-body-md-regular\" : \"aivex:text-body-lg-regular\",\n )}\n onFocus={focus.onFocus}\n onBlur={focus.onBlur}\n onKeyDown={handleKeyDown}\n {...props}\n />\n </InputBase>\n </AutocompletePrimitive.InputGroup>\n );\n}\n\n// ─── Content ──────────────────────────────────────────────────────────────────\n\n/** 글자를 입력받는 요소(input·textarea·select·contenteditable)인지. */\nfunction isTextEntry(target: EventTarget): boolean {\n return (\n target instanceof HTMLElement &&\n (target.isContentEditable || target.matches(\"input, textarea, select\"))\n );\n}\n\nconst contentClassName = cn(\n \"aivex:flex aivex:flex-col aivex:gap-xs aivex:rounded-md aivex:bg-bg-primary aivex:p-md aivex:overflow-clip\",\n \"aivex:shadow-md aivex:border aivex:border-border-subtle aivex:outline-none\",\n \"aivex:w-(--anchor-width) aivex:max-w-(--available-width)\",\n \"aivex:data-[open]:animate-in aivex:data-[closed]:animate-out\",\n \"aivex:data-[closed]:fade-out-0 aivex:data-[open]:fade-in-0\",\n);\n\nexport type AutocompleteContentProps = Omit<AutocompletePrimitive.Popup.Props, \"className\"> &\n PopupPositioningProps & {\n className?: string;\n /** 포털 대상. 생략하면 document.body — Shadow DOM 안에서는 그 루트 안의 요소를 넘긴다. */\n container?: AutocompletePrimitive.Portal.Props[\"container\"];\n ref?: Ref<HTMLDivElement>;\n };\n\n/**\n * 제안 목록이 담기는 팝업. Portal로 렌더되고 기본 폭은 입력 박스와 같으며 `sideOffset`은 4px.\n * 목록(`Autocomplete.List`) 위아래에 제목·전체 삭제 버튼 같은 요소를 자유롭게 둘 수 있다.\n * 팝업 안을 마우스로 눌러도 포커스는 입력창에 남는다(방향키·Esc가 계속 목록에 닿게).\n * 팝업 안에 둔 입력 요소만 예외로 포커스를 받는다.\n */\nfunction AutocompleteContent({\n className,\n container,\n onMouseDown,\n ref,\n ...props\n}: AutocompleteContentProps) {\n const [{ sideOffset = 4, align = \"start\", ...positioning }, popupProps] =\n splitPositioningProps(props);\n\n return (\n <PortalEventBoundary>\n <AutocompletePrimitive.Portal container={container}>\n <AutocompletePrimitive.Positioner\n sideOffset={sideOffset}\n align={align}\n className=\"aivex:z-(--aivex-z-dropdown) aivex:outline-none\"\n {...positioning}\n >\n <AutocompletePrimitive.Popup\n ref={ref}\n className={cn(contentClassName, className)}\n // 포커스는 항상 입력창에 둔다 — 팝업 안 버튼(전체 삭제 등)이 포커스를 가져간 뒤 사라지면\n // 포커스가 유실되어 Esc·방향키가 목록에 닿지 않는다.\n onMouseDown={(event) => {\n onMouseDown?.(event);\n // 팝업 안에 둔 입력 요소는 예외 — 눌러서 포커스할 수 있어야 한다.\n if (!isTextEntry(event.target)) event.preventDefault();\n }}\n {...popupProps}\n />\n </AutocompletePrimitive.Positioner>\n </AutocompletePrimitive.Portal>\n </PortalEventBoundary>\n );\n}\n\n// ─── List ─────────────────────────────────────────────────────────────────────\n\ntype AutocompleteListProps = Omit<AutocompletePrimitive.List.Props, \"className\"> & {\n className?: string;\n ref?: Ref<HTMLDivElement>;\n};\n\n/**\n * 항목 목록. 자식으로 `(item, index) => <Autocomplete.Item />` 함수를 주면 루트의 `items`(걸러진 결과)를 그린다.\n * 길어지면 안에서 스크롤된다.\n */\nfunction AutocompleteList({ className, ref, ...props }: AutocompleteListProps) {\n return (\n <AutocompletePrimitive.List\n ref={ref}\n className={cn(\n \"aivex:flex aivex:max-h-[min(320px,var(--available-height))] aivex:flex-col aivex:overflow-y-auto aivex:overscroll-contain aivex:outline-none aivex:data-[empty]:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Item ─────────────────────────────────────────────────────────────────────\n\ntype AutocompleteItemProps = Omit<AutocompletePrimitive.Item.Props, \"className\"> & {\n className?: string;\n /** 항목 왼쪽 아이콘 */\n icon?: ReactNode;\n /**\n * 항목 오른쪽 슬롯(개별 삭제 버튼 등). 이 안을 눌러도 항목이 선택되지 않는다.\n */\n endContent?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n};\n\n/**\n * 제안 항목 하나. `value`가 선택 시 입력창에 채워지고, 선택(클릭 또는 하이라이트 후 Enter)은 `onClick`으로 받는다.\n */\nfunction AutocompleteItem({\n className,\n icon,\n endContent,\n children,\n ref,\n ...props\n}: AutocompleteItemProps) {\n return (\n <AutocompletePrimitive.Item\n ref={ref}\n className={cn(\n \"aivex:group aivex:relative aivex:flex aivex:min-h-8 aivex:w-full aivex:shrink-0 aivex:cursor-pointer aivex:select-none aivex:items-center aivex:gap-xs aivex:overflow-hidden aivex:rounded-md aivex:px-md aivex:py-xs aivex:text-label-lg aivex:text-text-primary aivex:outline-none\",\n \"aivex:data-[disabled]:pointer-events-none aivex:data-[disabled]:opacity-disable\",\n className,\n )}\n {...props}\n >\n {/* InteractionLayer와 같은 오버레이 — data-highlighted 기준이라 키보드 이동에도 표시된다 */}\n <span\n aria-hidden\n className=\"aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:bg-bg-inverse-strong aivex:opacity-0 aivex:transition-opacity aivex:group-data-[highlighted]:opacity-4 aivex:group-active:opacity-8\"\n />\n {icon ? (\n <span className=\"aivex:flex aivex:size-4 aivex:shrink-0 aivex:items-center aivex:justify-center aivex:text-icon-secondary aivex:[&_svg]:size-4\">\n {icon}\n </span>\n ) : null}\n <span className=\"aivex:min-w-0 aivex:flex-1 aivex:truncate\">{children}</span>\n {endContent ? (\n // biome-ignore lint/a11y/noStaticElementInteractions: 슬롯 안 버튼의 클릭이 항목 선택으로 번지지 않게 막는 래퍼\n <span\n className=\"aivex:relative aivex:flex aivex:shrink-0 aivex:items-center\"\n onClick={(event) => event.stopPropagation()}\n onKeyDown={(event) => event.stopPropagation()}\n >\n {endContent}\n </span>\n ) : null}\n </AutocompletePrimitive.Item>\n );\n}\n\n// ─── Empty ────────────────────────────────────────────────────────────────────\n\ntype AutocompleteEmptyProps = Omit<AutocompletePrimitive.Empty.Props, \"className\"> & {\n className?: string;\n ref?: Ref<HTMLDivElement>;\n};\n\n/** 보여 줄 항목이 없을 때만 내용이 나타나는 안내 문구. */\nfunction AutocompleteEmpty({ className, ref, ...props }: AutocompleteEmptyProps) {\n return (\n <AutocompletePrimitive.Empty\n ref={ref}\n className={cn(\n \"aivex:flex aivex:min-h-8 aivex:items-center aivex:gap-xs aivex:px-md aivex:text-label-lg aivex:text-text-tertiary aivex:empty:hidden\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Group ────────────────────────────────────────────────────────────────────\n\ntype AutocompleteGroupProps = Omit<AutocompletePrimitive.Group.Props, \"className\"> & {\n className?: string;\n ref?: Ref<HTMLDivElement>;\n};\n\n/**\n * 항목 묶음. 루트 `items`에 `{ value, items }` 그룹 배열을 주고, 그룹마다 `items`를 넘긴 뒤\n * 안에서 `Autocomplete.Collection`으로 그 그룹의 (걸러진) 항목을 그린다. 제목은 `Autocomplete.GroupLabel`.\n */\nfunction AutocompleteGroup({ className, ref, ...props }: AutocompleteGroupProps) {\n return (\n <AutocompletePrimitive.Group\n ref={ref}\n className={cn(\"aivex:flex aivex:flex-col\", className)}\n {...props}\n />\n );\n}\n\ntype AutocompleteGroupLabelProps = Omit<AutocompletePrimitive.GroupLabel.Props, \"className\"> & {\n className?: string;\n ref?: Ref<HTMLDivElement>;\n};\n\n/** 그룹 제목. 그룹의 접근성 이름으로 연결된다. */\nfunction AutocompleteGroupLabel({ className, ref, ...props }: AutocompleteGroupLabelProps) {\n return (\n <AutocompletePrimitive.GroupLabel\n ref={ref}\n className={cn(\n \"aivex:select-none aivex:px-md aivex:py-2xs aivex:text-label-md aivex:text-text-tertiary\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Compound export ──────────────────────────────────────────────────────────\n\nconst Autocomplete = Object.assign(AutocompleteRoot, {\n Input: AutocompleteInput,\n Content: AutocompleteContent,\n List: AutocompleteList,\n Item: AutocompleteItem,\n Empty: AutocompleteEmpty,\n Group: AutocompleteGroup,\n GroupLabel: AutocompleteGroupLabel,\n /** 그룹 안에서 그 그룹의 항목을 그리는 자식 함수 컨테이너: `{(item) => <Autocomplete.Item />}` */\n Collection: AutocompletePrimitive.Collection,\n});\n\nexport { Autocomplete };\n"],"mappings":";;;;;;;;;;;;;;;AAkCA,IAAM,IAAsB,EAA+C,KAAK;AAEhF,SAAS,EAAuB,GAAc;CAC5C,IAAM,IAAU,EAAW,EAAoB;AAC/C,KAAI,CAAC,EAAS,OAAU,MAAM,GAAG,EAAK,iCAAiC;AACvE,QAAO;;AAkET,SAAS,EAAgC,EACvC,UACA,iBACA,kBACA,aACA,sBACA,aACA,aACA,GAAG,KAC2B;CAC9B,IAAM,IAAa,EAAkD,KAAK,EACpE,IAAkB,EAAO,GAAM,EAC/B,IAAa,EAA6D,KAAK,EAC/E,CAAC,GAAc,KAAmB,EAA6B;EACnE;EACA,cAAc,KAAgB;EAC9B,WAAW,MAAS;AAClB,GAAI,EAAW,WAAS,IAAgB,GAAM,EAAW,QAAQ;;EAEpE,CAAC,EAEI,IAAc,EAAO,EAAS;AACpC,GAAY,UAAU;CAEtB,IAAM,IAAU,SACP;EACL,OAAO;EACP,UAAU,EAAQ;EAClB;EACA,SAAS,MAAc;AAChB,KAAY,YACjB,EAAY,QAAQ,EAAU,EAC9B,EAAW,SAAS,OAAO;;EAE9B,GACD,CAAC,GAAc,EAAS,CACzB,EAEK,IAAY;EAChB,GAAG;EACH;EACA;EACA,OAAO;EACP,gBAAgB,GAAc,MAA2D;AAIvF,OAAI,EAAQ,WAAW,cAAc;AAEnC,IADA,EAAQ,QAAQ,EAChB,EAAQ,kBAAkB;AAC1B;;AAGF,GADA,EAAW,UAAU,GACrB,EAAgB,EAAK;;EAEvB,qBAAqB,GAAa,MAAY;AAE5C,GADA,EAAgB,UAAU,MAAgB,KAAA,GAC1C,IAAoB,GAAa,EAAQ;;EAE5C;AAED,QACE,kBAAC,EAAoB,UAArB;EAA8B,OAAO;YACnC,kBAAC,EAAsB,MAAvB;GAA4B,GAAI;GAAY;GAAsC,CAAA;EACrD,CAAA;;AAsCnC,SAAS,EAAkB,EACzB,UAAO,MACP,UACA,cACA,oBAAiB,UACjB,iBACA,eACA,cACA,aACA,YACA,WACA,cACA,QACA,GAAG,KACsB;CACzB,IAAM,EACJ,UACA,UAAU,GACV,oBACA,cACE,EAAuB,qBAAqB,EAC1C,IAAQ,EAAc;EAAE;EAAS;EAAQ,CAAC,EAC1C,IAAQ,GAAe,EACvB,IAAU,EAAkB,GAAO,EAAM,gBAAgB,IAAI,EAAM,SACnE,IAAa,EAAQ,KAAa,KAAgB,EAAM,UAExD,KAAiB,MAA2C;AAChE,MAAY,EAAM,EAEd,IAAM,QAAQ,WAAW,EAAM,YAAY,iBAC1C,EAAgB,WAAS,EAAO,EAAM;IAGvC,IAAc,IAClB,kBAAC,EAAsB,OAAvB;EACE,cAAY;EACZ,QACE,kBAAC,GAAD;GAAY,MAAM,MAAS,OAAO,OAAO;GAAM,UAAU;GAAI,WAAU;GAAmB,CAAA;YAG5F,kBAAC,GAAD,EAAW,MAAM,MAAS,OAAO,KAAK,IAAM,CAAA;EAChB,CAAA,GAC5B,MAEE,IAAa,KAAa,EAAM,SAAS;AAE/C,QACE,kBAAC,EAAsB,YAAvB;EAAkC,WAAW,EAAG,gBAAgB,EAAU;YACxE,kBAAC,GAAD;GACE,OAAO;GACP,UAAU;GACV,SAAS,EAAM;GACf,QAAQ,EAAM,SAAS;GACjB;GACN,QAAO;GACO;GACd,YACE,KAAc,IACZ,kBAAA,GAAA,EAAA,UAAA,CACG,GACA,EACA,EAAA,CAAA,GACD,KAAA;aAGN,kBAAC,EAAsB,OAAvB;IACO;IACK;IACV,WAAW,EACT,4LACA,MAAS,OAAO,+BAA+B,6BAChD;IACD,SAAS,EAAM;IACf,QAAQ,EAAM;IACd,WAAW;IACX,GAAI;IACJ,CAAA;GACQ,CAAA;EACqB,CAAA;;AAOvC,SAAS,EAAY,GAA8B;AACjD,QACE,aAAkB,gBACjB,EAAO,qBAAqB,EAAO,QAAQ,0BAA0B;;AAI1E,IAAM,IAAmB,EACvB,8GACA,8EACA,4DACA,gEACA,6DACD;AAgBD,SAAS,EAAoB,EAC3B,cACA,cACA,gBACA,QACA,GAAG,KACwB;CAC3B,IAAM,CAAC,EAAE,gBAAa,GAAG,WAAQ,SAAS,GAAG,KAAe,KAC1D,EAAsB,EAAM;AAE9B,QACE,kBAAC,GAAD,EAAA,UACE,kBAAC,EAAsB,QAAvB;EAAyC;YACvC,kBAAC,EAAsB,YAAvB;GACc;GACL;GACP,WAAU;GACV,GAAI;aAEJ,kBAAC,EAAsB,OAAvB;IACO;IACL,WAAW,EAAG,GAAkB,EAAU;IAG1C,cAAc,MAAU;AAGtB,KAFA,IAAc,EAAM,EAEf,EAAY,EAAM,OAAO,IAAE,EAAM,gBAAgB;;IAExD,GAAI;IACJ,CAAA;GAC+B,CAAA;EACN,CAAA,EACX,CAAA;;AAe1B,SAAS,EAAiB,EAAE,cAAW,QAAK,GAAG,KAAgC;AAC7E,QACE,kBAAC,EAAsB,MAAvB;EACO;EACL,WAAW,EACT,0KACA,EACD;EACD,GAAI;EACJ,CAAA;;AAoBN,SAAS,EAAiB,EACxB,cACA,SACA,eACA,aACA,QACA,GAAG,KACqB;AACxB,QACE,kBAAC,EAAsB,MAAvB;EACO;EACL,WAAW,EACT,wRACA,mFACA,EACD;EACD,GAAI;YAPN;GAUE,kBAAC,QAAD;IACE,eAAA;IACA,WAAU;IACV,CAAA;GACD,IACC,kBAAC,QAAD;IAAM,WAAU;cACb;IACI,CAAA,GACL;GACJ,kBAAC,QAAD;IAAM,WAAU;IAA6C;IAAgB,CAAA;GAC5E,IAEC,kBAAC,QAAD;IACE,WAAU;IACV,UAAU,MAAU,EAAM,iBAAiB;IAC3C,YAAY,MAAU,EAAM,iBAAiB;cAE5C;IACI,CAAA,GACL;GACuB;;;AAYjC,SAAS,EAAkB,EAAE,cAAW,QAAK,GAAG,KAAiC;AAC/E,QACE,kBAAC,EAAsB,OAAvB;EACO;EACL,WAAW,EACT,wIACA,EACD;EACD,GAAI;EACJ,CAAA;;AAeN,SAAS,EAAkB,EAAE,cAAW,QAAK,GAAG,KAAiC;AAC/E,QACE,kBAAC,EAAsB,OAAvB;EACO;EACL,WAAW,EAAG,6BAA6B,EAAU;EACrD,GAAI;EACJ,CAAA;;AAUN,SAAS,EAAuB,EAAE,cAAW,QAAK,GAAG,KAAsC;AACzF,QACE,kBAAC,EAAsB,YAAvB;EACO;EACL,WAAW,EACT,2FACA,EACD;EACD,GAAI;EACJ,CAAA;;AAMN,IAAM,IAAe,OAAO,OAAO,GAAkB;CACnD,OAAO;CACP,SAAS;CACT,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACP,YAAY;CAEZ,YAAY,EAAsB;CACnC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../Tooltip/Tooltip.cjs`);let n=require(`react`),r=require(`react/jsx-runtime`),i=require(`@base-ui/react/avatar`);var
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../Tooltip/Tooltip.cjs`);let n=require(`react`),r=require(`react/jsx-runtime`),i=require(`class-variance-authority`),a=require(`@base-ui/react/avatar`);var o=(0,i.cva)(`aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:overflow-hidden aivex:select-none aivex:leading-none aivex:text-text-primary`,{variants:{size:{xxs:`aivex:w-4 aivex:h-4 aivex:text-label-sm`,xs:`aivex:w-5 aivex:h-5 aivex:text-label-md`,sm:`aivex:w-6 aivex:h-6 aivex:text-label-md`,md:`aivex:w-8 aivex:h-8 aivex:text-label-lg`,lg:`aivex:w-9 aivex:h-9 aivex:text-label-xl`,xl:`aivex:w-12 aivex:h-12 aivex:text-label-xl`,"2xl":`aivex:w-14 aivex:h-14 aivex:text-label-xl`},type:{round:`aivex:rounded-full aivex:bg-category-indigo-bg`,square:`aivex:bg-category-indigo-bg`,image:`aivex:rounded-full aivex:border aivex:border-border-subtle aivex:bg-bg-secondary`}},compoundVariants:[{type:`square`,size:[`xxs`,`xs`,`sm`],className:`aivex:rounded-xs`},{type:`square`,size:[`md`,`lg`],className:`aivex:rounded-sm`},{type:`square`,size:[`xl`,`2xl`],className:`aivex:rounded-md`}],defaultVariants:{size:`md`,type:`round`}}),s=[`aivex:bg-category-blue-bg aivex:text-category-blue-text`,`aivex:bg-category-green-bg aivex:text-category-green-text`,`aivex:bg-category-orange-bg aivex:text-category-orange-text`,`aivex:bg-category-violet-bg aivex:text-category-violet-text`,`aivex:bg-category-teal-bg aivex:text-category-teal-text`,`aivex:bg-category-pink-bg aivex:text-category-pink-text`,`aivex:bg-category-cyan-bg aivex:text-category-cyan-text`,`aivex:bg-category-red-bg aivex:text-category-red-text`,`aivex:bg-category-lime-bg aivex:text-category-lime-text`,`aivex:bg-category-yellow-bg aivex:text-category-yellow-text`,`aivex:bg-category-indigo-bg aivex:text-category-indigo-text`];function c(e){let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return s[t%s.length]}function l({initials:e,name:t,icon:n}){return(e??t?.trim().slice(0,1).toUpperCase())||(n??null)}function u({className:i,size:s,type:u,src:d,alt:f,initials:p,icon:m,name:h,bgColor:g,showTooltip:_,style:v,ref:y,...b}){let x=l({initials:p,name:h,icon:m}),S=h??p,C=!d&&!g&&S?c(S):void 0,[w,T]=(0,n.useState)(`idle`),E=!!d&&w!==`loaded`&&w!==`error`,D=(0,r.jsxs)(a.Avatar.Root,{ref:y,"aria-busy":E||void 0,className:e.cn(o({size:s,type:u}),C,E&&`aivex-skeleton aivex:bg-bg-tertiary`,i),style:g&&!E?{backgroundColor:g,...v}:v,...b,children:[d&&(0,r.jsx)(a.Avatar.Image,{src:d,alt:f??`avatar`,className:`aivex:w-full aivex:h-full aivex:object-cover`,onLoadingStatusChange:T}),!E&&(0,r.jsx)(a.Avatar.Fallback,{className:`aivex:inline-flex aivex:h-full aivex:w-full aivex:items-center aivex:justify-center aivex:leading-none`,children:x})]});return _&&h?(0,r.jsx)(t.Tooltip,{content:h,children:D}):D}exports.Avatar=u,exports.avatarVariants=o;
|
|
2
2
|
//# sourceMappingURL=Avatar.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.cjs","names":[],"sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import { Avatar as AvatarPrimitive } from \"@base-ui/react/avatar\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { type HTMLAttributes, type ReactNode, type Ref, useState } from \"react\";\nimport { Tooltip } from \"@/components/Tooltip\";\nimport { cn } from \"@/utils/cn\";\n\n/** Avatar의 크기(`size`)·모양(`type`) 클래스를 만드는 cva 변형 함수. */\nconst avatarVariants = cva(\n \"aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:overflow-hidden aivex:select-none aivex:leading-none aivex:text-text-primary\",\n {\n variants: {\n size: {\n xxs: \"aivex:w-4 aivex:h-4 aivex:text-label-sm\",\n xs: \"aivex:w-5 aivex:h-5 aivex:text-label-md\",\n sm: \"aivex:w-6 aivex:h-6 aivex:text-label-md\",\n md: \"aivex:w-8 aivex:h-8 aivex:text-label-lg\",\n lg: \"aivex:w-9 aivex:h-9 aivex:text-label-xl\",\n xl: \"aivex:w-12 aivex:h-12 aivex:text-label-xl\",\n \"2xl\": \"aivex:w-14 aivex:h-14 aivex:text-label-xl\",\n },\n type: {\n round: \"aivex:rounded-full aivex:bg-category-indigo-bg\",\n square: \"aivex:bg-category-indigo-bg\",\n image: \"aivex:rounded-full aivex:border aivex:border-border-subtle aivex:bg-bg-secondary\",\n },\n },\n // Square shape: size-scaled radius per Figma\n compoundVariants: [\n { type: \"square\", size: [\"xxs\", \"xs\", \"sm\"], className: \"aivex:rounded-xs\" },\n { type: \"square\", size: [\"md\", \"lg\"], className: \"aivex:rounded-sm\" },\n { type: \"square\", size: [\"xl\", \"2xl\"], className: \"aivex:rounded-md\" },\n ],\n defaultVariants: { size: \"md\", type: \"round\" },\n },\n);\n\ntype ImageLoadingStatus = AvatarPrimitive.Root.State[\"imageLoadingStatus\"];\n\nexport interface AvatarProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"children\">,\n VariantProps<typeof avatarVariants> {\n /** 프로필 이미지 URL. 로딩 중엔 스켈레톤을, 실패하면 이니셜·아이콘 폴백을 보인다. */\n src?: string;\n /** 이미지 대체 텍스트 (생략하면 \"avatar\") */\n alt?: string;\n /** 폴백으로 표시할 이니셜. 지정하면 `name`에서 뽑은 첫 글자보다 우선한다. */\n initials?: string;\n /** 이니셜도 `name`도 없을 때 표시할 폴백 아이콘 */\n icon?: ReactNode;\n /** 사용자·조직 이름. 이니셜(첫 글자)과 자동 배경색 결정, 툴팁 내용에 쓰인다. */\n name?: string;\n /** 배경색(CSS 색상값). 지정하면 이름 기반 자동 색 대신 사용한다. */\n bgColor?: string;\n /** hover 시 `name`을 툴팁으로 표시 (`name`이 있을 때만 동작) */\n showTooltip?: boolean;\n ref?: Ref<HTMLSpanElement>;\n}\n\n/** name(또는 initials) 기반으로 결정적 색을 고르기 위한 카테고리 팔레트 */\nconst avatarColorClasses = [\n \"aivex:bg-category-blue-bg aivex:text-category-blue-text\",\n \"aivex:bg-category-green-bg aivex:text-category-green-text\",\n \"aivex:bg-category-orange-bg aivex:text-category-orange-text\",\n \"aivex:bg-category-violet-bg aivex:text-category-violet-text\",\n \"aivex:bg-category-teal-bg aivex:text-category-teal-text\",\n \"aivex:bg-category-pink-bg aivex:text-category-pink-text\",\n \"aivex:bg-category-cyan-bg aivex:text-category-cyan-text\",\n \"aivex:bg-category-red-bg aivex:text-category-red-text\",\n \"aivex:bg-category-lime-bg aivex:text-category-lime-text\",\n \"aivex:bg-category-yellow-bg aivex:text-category-yellow-text\",\n \"aivex:bg-category-indigo-bg aivex:text-category-indigo-text\",\n] as const;\n\nfunction pickColorClass(key: string): string {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash * 31 + key.charCodeAt(i)) >>> 0;\n }\n return avatarColorClasses[hash % avatarColorClasses.length];\n}\n\nfunction resolveFallback({\n initials,\n name,\n icon,\n}: Pick<AvatarProps, \"initials\" | \"name\" | \"icon\">): ReactNode {\n const text = initials ?? name?.trim().slice(0, 1).toUpperCase();\n if (text) return text;\n return icon ?? null;\n}\n\n/**\n * 사용자·조직을 이미지, 이니셜 또는 아이콘으로 나타내는 아바타.\n *\n * 폴백 우선순위는 `src` 이미지 → `initials` → `name` 첫 글자 → `icon`이다.\n * `src`·`bgColor`가 없으면 `name`(없으면 `initials`)으로 카테고리 배경색을 결정적으로 고른다.\n * `size`: xxs(16px)·xs(20)·sm(24)·md(32, 기본)·lg(36)·xl(48)·2xl(56).\n * `type`: round(원형, 기본)·square(모서리 둥근 사각)·image(원형+테두리, 사진용).\n *\n * @example\n * ```tsx\n * import { Avatar } from \"@aivex/ui\";\n *\n * <Avatar size=\"lg\" name=\"Alice Park\" showTooltip />\n * <Avatar type=\"image\" src=\"/profile.png\" alt=\"Alice Park\" name=\"Alice Park\" />\n * ```\n */\nfunction Avatar({\n className,\n size,\n type,\n src,\n alt,\n initials,\n icon,\n name,\n bgColor,\n showTooltip,\n style,\n ref,\n ...props\n}: AvatarProps) {\n const fallback = resolveFallback({ initials, name, icon });\n // src/bgColor가 없으면 name(없으면 initials) 기준으로 카테고리 색을 자동 배정한다.\n const colorSeed = name ?? initials;\n const autoColorClass = !src && !bgColor && colorSeed ? pickColorClass(colorSeed) : undefined;\n // 사진을 받는 동안엔 색·이니셜 대신 스켈레톤을 보이고, 실패했을 때만 이니셜로 대체한다.\n const [status, setStatus] = useState<ImageLoadingStatus>(\"idle\");\n const loading = !!src && status !== \"loaded\" && status !== \"error\";\n\n const avatar = (\n <AvatarPrimitive.Root\n ref={ref}\n aria-busy={loading || undefined}\n className={cn(\n avatarVariants({ size, type }),\n autoColorClass,\n loading && \"aivex-skeleton aivex:bg-bg-tertiary\",\n className,\n )}\n style={bgColor && !loading ? { backgroundColor: bgColor, ...style } : style}\n {...props}\n >\n {src && (\n <AvatarPrimitive.Image\n src={src}\n alt={alt ?? \"avatar\"}\n className=\"aivex:w-full aivex:h-full aivex:object-cover\"\n onLoadingStatusChange={setStatus}\n />\n )}\n {!loading && (\n <AvatarPrimitive.Fallback className=\"aivex:inline-flex aivex:h-full aivex:w-full aivex:items-center aivex:justify-center aivex:leading-none\">\n {fallback}\n </AvatarPrimitive.Fallback>\n )}\n </AvatarPrimitive.Root>\n );\n\n return showTooltip && name ? <Tooltip content={name}>{avatar}</Tooltip> : avatar;\n}\n\nexport { Avatar, avatarVariants };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Avatar.cjs","names":[],"sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import { Avatar as AvatarPrimitive } from \"@base-ui/react/avatar\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { type HTMLAttributes, type ReactNode, type Ref, useState } from \"react\";\nimport { Tooltip } from \"@/components/Tooltip\";\nimport { cn } from \"@/utils/cn\";\n\n/** Avatar의 크기(`size`)·모양(`type`) 클래스를 만드는 cva 변형 함수. */\nconst avatarVariants = cva(\n \"aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:overflow-hidden aivex:select-none aivex:leading-none aivex:text-text-primary\",\n {\n variants: {\n size: {\n xxs: \"aivex:w-4 aivex:h-4 aivex:text-label-sm\",\n xs: \"aivex:w-5 aivex:h-5 aivex:text-label-md\",\n sm: \"aivex:w-6 aivex:h-6 aivex:text-label-md\",\n md: \"aivex:w-8 aivex:h-8 aivex:text-label-lg\",\n lg: \"aivex:w-9 aivex:h-9 aivex:text-label-xl\",\n xl: \"aivex:w-12 aivex:h-12 aivex:text-label-xl\",\n \"2xl\": \"aivex:w-14 aivex:h-14 aivex:text-label-xl\",\n },\n type: {\n round: \"aivex:rounded-full aivex:bg-category-indigo-bg\",\n square: \"aivex:bg-category-indigo-bg\",\n image: \"aivex:rounded-full aivex:border aivex:border-border-subtle aivex:bg-bg-secondary\",\n },\n },\n // Square shape: size-scaled radius per Figma\n compoundVariants: [\n { type: \"square\", size: [\"xxs\", \"xs\", \"sm\"], className: \"aivex:rounded-xs\" },\n { type: \"square\", size: [\"md\", \"lg\"], className: \"aivex:rounded-sm\" },\n { type: \"square\", size: [\"xl\", \"2xl\"], className: \"aivex:rounded-md\" },\n ],\n defaultVariants: { size: \"md\", type: \"round\" },\n },\n);\n\ntype ImageLoadingStatus = AvatarPrimitive.Root.State[\"imageLoadingStatus\"];\n\nexport interface AvatarProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"children\">,\n VariantProps<typeof avatarVariants> {\n /** 프로필 이미지 URL. 로딩 중엔 스켈레톤을, 실패하면 이니셜·아이콘 폴백을 보인다. */\n src?: string;\n /** 이미지 대체 텍스트 (생략하면 \"avatar\") */\n alt?: string;\n /** 폴백으로 표시할 이니셜. 지정하면 `name`에서 뽑은 첫 글자보다 우선한다. */\n initials?: string;\n /** 이니셜도 `name`도 없을 때 표시할 폴백 아이콘 */\n icon?: ReactNode;\n /** 사용자·조직 이름. 이니셜(첫 글자)과 자동 배경색 결정, 툴팁 내용에 쓰인다. */\n name?: string;\n /** 배경색(CSS 색상값). 지정하면 이름 기반 자동 색 대신 사용한다. */\n bgColor?: string;\n /** hover 시 `name`을 툴팁으로 표시 (`name`이 있을 때만 동작) */\n showTooltip?: boolean;\n ref?: Ref<HTMLSpanElement>;\n}\n\n/** name(또는 initials) 기반으로 결정적 색을 고르기 위한 카테고리 팔레트 */\nconst avatarColorClasses = [\n \"aivex:bg-category-blue-bg aivex:text-category-blue-text\",\n \"aivex:bg-category-green-bg aivex:text-category-green-text\",\n \"aivex:bg-category-orange-bg aivex:text-category-orange-text\",\n \"aivex:bg-category-violet-bg aivex:text-category-violet-text\",\n \"aivex:bg-category-teal-bg aivex:text-category-teal-text\",\n \"aivex:bg-category-pink-bg aivex:text-category-pink-text\",\n \"aivex:bg-category-cyan-bg aivex:text-category-cyan-text\",\n \"aivex:bg-category-red-bg aivex:text-category-red-text\",\n \"aivex:bg-category-lime-bg aivex:text-category-lime-text\",\n \"aivex:bg-category-yellow-bg aivex:text-category-yellow-text\",\n \"aivex:bg-category-indigo-bg aivex:text-category-indigo-text\",\n] as const;\n\nfunction pickColorClass(key: string): string {\n let hash = 0;\n for (let i = 0; i < key.length; i++) {\n hash = (hash * 31 + key.charCodeAt(i)) >>> 0;\n }\n return avatarColorClasses[hash % avatarColorClasses.length];\n}\n\nfunction resolveFallback({\n initials,\n name,\n icon,\n}: Pick<AvatarProps, \"initials\" | \"name\" | \"icon\">): ReactNode {\n const text = initials ?? name?.trim().slice(0, 1).toUpperCase();\n if (text) return text;\n return icon ?? null;\n}\n\n/**\n * 사용자·조직을 이미지, 이니셜 또는 아이콘으로 나타내는 아바타.\n *\n * 폴백 우선순위는 `src` 이미지 → `initials` → `name` 첫 글자 → `icon`이다.\n * `src`·`bgColor`가 없으면 `name`(없으면 `initials`)으로 카테고리 배경색을 결정적으로 고른다.\n * `size`: xxs(16px)·xs(20)·sm(24)·md(32, 기본)·lg(36)·xl(48)·2xl(56).\n * `type`: round(원형, 기본)·square(모서리 둥근 사각)·image(원형+테두리, 사진용).\n *\n * @example\n * ```tsx\n * import { Avatar } from \"@aivex/ui\";\n *\n * <Avatar size=\"lg\" name=\"Alice Park\" showTooltip />\n * <Avatar type=\"image\" src=\"/profile.png\" alt=\"Alice Park\" name=\"Alice Park\" />\n * ```\n */\nfunction Avatar({\n className,\n size,\n type,\n src,\n alt,\n initials,\n icon,\n name,\n bgColor,\n showTooltip,\n style,\n ref,\n ...props\n}: AvatarProps) {\n const fallback = resolveFallback({ initials, name, icon });\n // src/bgColor가 없으면 name(없으면 initials) 기준으로 카테고리 색을 자동 배정한다.\n const colorSeed = name ?? initials;\n const autoColorClass = !src && !bgColor && colorSeed ? pickColorClass(colorSeed) : undefined;\n // 사진을 받는 동안엔 색·이니셜 대신 스켈레톤을 보이고, 실패했을 때만 이니셜로 대체한다.\n const [status, setStatus] = useState<ImageLoadingStatus>(\"idle\");\n const loading = !!src && status !== \"loaded\" && status !== \"error\";\n\n const avatar = (\n <AvatarPrimitive.Root\n ref={ref}\n aria-busy={loading || undefined}\n className={cn(\n avatarVariants({ size, type }),\n autoColorClass,\n loading && \"aivex-skeleton aivex:bg-bg-tertiary\",\n className,\n )}\n style={bgColor && !loading ? { backgroundColor: bgColor, ...style } : style}\n {...props}\n >\n {src && (\n <AvatarPrimitive.Image\n src={src}\n alt={alt ?? \"avatar\"}\n className=\"aivex:w-full aivex:h-full aivex:object-cover\"\n onLoadingStatusChange={setStatus}\n />\n )}\n {!loading && (\n <AvatarPrimitive.Fallback className=\"aivex:inline-flex aivex:h-full aivex:w-full aivex:items-center aivex:justify-center aivex:leading-none\">\n {fallback}\n </AvatarPrimitive.Fallback>\n )}\n </AvatarPrimitive.Root>\n );\n\n return showTooltip && name ? <Tooltip content={name}>{avatar}</Tooltip> : avatar;\n}\n\nexport { Avatar, avatarVariants };\n"],"mappings":"mQAOA,IAAM,GAAA,EAAA,EAAA,KACJ,8JACA,CACE,SAAU,CACR,KAAM,CACJ,IAAK,0CACL,GAAI,0CACJ,GAAI,0CACJ,GAAI,0CACJ,GAAI,0CACJ,GAAI,4CACJ,MAAO,4CACR,CACD,KAAM,CACJ,MAAO,iDACP,OAAQ,8BACR,MAAO,mFACR,CACF,CAED,iBAAkB,CAChB,CAAE,KAAM,SAAU,KAAM,CAAC,MAAO,KAAM,KAAK,CAAE,UAAW,mBAAoB,CAC5E,CAAE,KAAM,SAAU,KAAM,CAAC,KAAM,KAAK,CAAE,UAAW,mBAAoB,CACrE,CAAE,KAAM,SAAU,KAAM,CAAC,KAAM,MAAM,CAAE,UAAW,mBAAoB,CACvE,CACD,gBAAiB,CAAE,KAAM,KAAM,KAAM,QAAS,CAC/C,CACF,CAyBK,EAAqB,CACzB,0DACA,4DACA,8DACA,8DACA,0DACA,0DACA,0DACA,wDACA,0DACA,8DACA,8DACD,CAED,SAAS,EAAe,EAAqB,CAC3C,IAAI,EAAO,EACX,IAAK,IAAI,EAAI,EAAG,EAAI,EAAI,OAAQ,IAC9B,EAAQ,EAAO,GAAK,EAAI,WAAW,EAAE,GAAM,EAE7C,OAAO,EAAmB,EAAO,EAAmB,QAGtD,SAAS,EAAgB,CACvB,WACA,OACA,QAC6D,CAG7D,OAFa,GAAY,GAAM,MAAM,CAAC,MAAM,EAAG,EAAE,CAAC,aAAa,IAExD,GAAQ,MAmBjB,SAAS,EAAO,CACd,YACA,OACA,OACA,MACA,MACA,WACA,OACA,OACA,UACA,cACA,QACA,MACA,GAAG,GACW,CACd,IAAM,EAAW,EAAgB,CAAE,WAAU,OAAM,OAAM,CAAC,CAEpD,EAAY,GAAQ,EACpB,EAAiB,CAAC,GAAO,CAAC,GAAW,EAAY,EAAe,EAAU,CAAG,IAAA,GAE7E,CAAC,EAAQ,IAAA,EAAA,EAAA,UAA0C,OAAO,CAC1D,EAAU,CAAC,CAAC,GAAO,IAAW,UAAY,IAAW,QAErD,GACJ,EAAA,EAAA,MAAC,EAAA,OAAgB,KAAjB,CACO,MACL,YAAW,GAAW,IAAA,GACtB,UAAW,EAAA,GACT,EAAe,CAAE,OAAM,OAAM,CAAC,CAC9B,EACA,GAAW,sCACX,EACD,CACD,MAAO,GAAW,CAAC,EAAU,CAAE,gBAAiB,EAAS,GAAG,EAAO,CAAG,EACtE,GAAI,WAVN,CAYG,IACC,EAAA,EAAA,KAAC,EAAA,OAAgB,MAAjB,CACO,MACL,IAAK,GAAO,SACZ,UAAU,+CACV,sBAAuB,EACvB,CAAA,CAEH,CAAC,IACA,EAAA,EAAA,KAAC,EAAA,OAAgB,SAAjB,CAA0B,UAAU,kHACjC,EACwB,CAAA,CAER,GAGzB,OAAO,GAAe,GAAO,EAAA,EAAA,KAAC,EAAA,QAAD,CAAS,QAAS,WAAO,EAAiB,CAAA,CAAG"}
|
|
@@ -3,10 +3,10 @@ import { cn as e } from "../../utils.js";
|
|
|
3
3
|
import { Tooltip as t } from "../Tooltip/Tooltip.js";
|
|
4
4
|
import { useState as n } from "react";
|
|
5
5
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { cva as a } from "class-variance-authority";
|
|
7
|
+
import { Avatar as o } from "@base-ui/react/avatar";
|
|
8
8
|
//#region src/components/Avatar/Avatar.tsx
|
|
9
|
-
var s =
|
|
9
|
+
var s = a("aivex:inline-flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:overflow-hidden aivex:select-none aivex:leading-none aivex:text-text-primary", {
|
|
10
10
|
variants: {
|
|
11
11
|
size: {
|
|
12
12
|
xxs: "aivex:w-4 aivex:h-4 aivex:text-label-sm",
|
|
@@ -69,29 +69,29 @@ function l(e) {
|
|
|
69
69
|
function u({ initials: e, name: t, icon: n }) {
|
|
70
70
|
return (e ?? t?.trim().slice(0, 1).toUpperCase()) || (n ?? null);
|
|
71
71
|
}
|
|
72
|
-
function d({ className:
|
|
72
|
+
function d({ className: a, size: c, type: d, src: f, alt: p, initials: m, icon: h, name: g, bgColor: _, showTooltip: v, style: y, ref: b, ...x }) {
|
|
73
73
|
let S = u({
|
|
74
74
|
initials: m,
|
|
75
75
|
name: g,
|
|
76
76
|
icon: h
|
|
77
|
-
}), C = g ?? m, w = !f && !_ && C ? l(C) : void 0, [T, E] = n("idle"), D = !!f && T !== "loaded" && T !== "error", O = /* @__PURE__ */ i(
|
|
77
|
+
}), C = g ?? m, w = !f && !_ && C ? l(C) : void 0, [T, E] = n("idle"), D = !!f && T !== "loaded" && T !== "error", O = /* @__PURE__ */ i(o.Root, {
|
|
78
78
|
ref: b,
|
|
79
79
|
"aria-busy": D || void 0,
|
|
80
80
|
className: e(s({
|
|
81
81
|
size: c,
|
|
82
82
|
type: d
|
|
83
|
-
}), w, D && "aivex-skeleton aivex:bg-bg-tertiary",
|
|
83
|
+
}), w, D && "aivex-skeleton aivex:bg-bg-tertiary", a),
|
|
84
84
|
style: _ && !D ? {
|
|
85
85
|
backgroundColor: _,
|
|
86
86
|
...y
|
|
87
87
|
} : y,
|
|
88
88
|
...x,
|
|
89
|
-
children: [f && /* @__PURE__ */ r(
|
|
89
|
+
children: [f && /* @__PURE__ */ r(o.Image, {
|
|
90
90
|
src: f,
|
|
91
91
|
alt: p ?? "avatar",
|
|
92
92
|
className: "aivex:w-full aivex:h-full aivex:object-cover",
|
|
93
93
|
onLoadingStatusChange: E
|
|
94
|
-
}), !D && /* @__PURE__ */ r(
|
|
94
|
+
}), !D && /* @__PURE__ */ r(o.Fallback, {
|
|
95
95
|
className: "aivex:inline-flex aivex:h-full aivex:w-full aivex:items-center aivex:justify-center aivex:leading-none",
|
|
96
96
|
children: S
|
|
97
97
|
})]
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../InteractionLayer/InteractionLayer.cjs`);let n=require(`react/jsx-runtime`),r=require(
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../InteractionLayer/InteractionLayer.cjs`);let n=require(`react/jsx-runtime`),r=require(`@base-ui/react/use-render`);var i=(0,require(`class-variance-authority`).cva)(`aivex:relative aivex:overflow-hidden aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:whitespace-nowrap aivex:border aivex:border-transparent aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand`,{variants:{variant:{solid:``,outline:``,ghost:``},color:{primary:``,secondary:``,danger:``},size:{sm:`aivex:h-6 aivex:gap-none aivex:px-sm aivex:rounded-sm aivex:text-label-md`,md:`aivex:h-8 aivex:gap-2xs aivex:px-md aivex:rounded-md aivex:text-label-lg`,lg:`aivex:h-10 aivex:gap-xs aivex:px-lg aivex:rounded-md aivex:text-label-xl`,"icon-sm":`aivex:h-6 aivex:w-6 aivex:px-0 aivex:rounded-sm`,"icon-md":`aivex:h-8 aivex:w-8 aivex:px-0 aivex:rounded-md`,"icon-lg":`aivex:h-10 aivex:w-10 aivex:px-0 aivex:rounded-md`}},compoundVariants:[{variant:`solid`,color:`primary`,className:`aivex:bg-bg-brand aivex:text-text-on-color`},{variant:`solid`,color:`secondary`,className:`aivex:bg-bg-tertiary aivex:text-text-primary`},{variant:`solid`,color:`danger`,className:`aivex:bg-bg-danger aivex:text-text-on-color`},{variant:`outline`,color:`primary`,className:`aivex:border-border-brand aivex:text-text-brand`},{variant:`outline`,color:`secondary`,className:`aivex:border-border-default aivex:text-text-primary`},{variant:`outline`,color:`danger`,className:`aivex:border-border-danger aivex:text-text-danger`},{variant:`ghost`,color:`primary`,className:`aivex:text-text-brand`},{variant:`ghost`,color:`secondary`,className:`aivex:text-text-primary`},{variant:`ghost`,color:`danger`,className:`aivex:text-text-danger`}],defaultVariants:{variant:`solid`,size:`md`}});function a(e=`solid`,t){return t??(e===`solid`?`primary`:`secondary`)}function o(e,t){return e===`solid`?t===`secondary`?`default`:`strong`:t===`danger`?`danger`:`default`}function s({variant:e=`solid`,color:t,size:n=`md`,className:r}={}){let o=e??`solid`;return i({variant:o,color:a(o,t),size:n,className:r})}function c({className:i,variant:c=`solid`,color:l,size:u=`md`,render:d,startContent:f,endContent:p,ref:m,children:h,...g}){let _=c??`solid`,v=a(_,l),y=u??`md`,b=y.startsWith(`icon-`),x=!b&&f,S=!b&&p;return(0,r.useRender)({defaultTagName:`button`,render:d,ref:m,props:{...g,className:e.cn(s({variant:_,color:v,size:y}),i),children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.InteractionLayer,{variant:o(_,v)}),x&&(0,n.jsx)(`span`,{className:`aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-center`,children:f}),h,S&&(0,n.jsx)(`span`,{className:`aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-center`,children:p})]})}})}exports.Button=c,exports.buttonVariants=s;
|
|
2
2
|
//# sourceMappingURL=Button.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.cjs","names":[],"sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { InteractionLayer, type InteractionLayerVariant } from \"@/components/InteractionLayer\";\nimport { cn } from \"@/utils/cn\";\n\nconst buttonVariantStyles = cva(\n \"aivex:relative aivex:overflow-hidden aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:whitespace-nowrap aivex:border aivex:border-transparent aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand\",\n {\n variants: {\n variant: {\n solid: \"\",\n outline: \"\",\n ghost: \"\",\n },\n color: {\n primary: \"\",\n secondary: \"\",\n danger: \"\",\n },\n size: {\n sm: \"aivex:h-6 aivex:gap-none aivex:px-sm aivex:rounded-sm aivex:text-label-md\",\n md: \"aivex:h-8 aivex:gap-2xs aivex:px-md aivex:rounded-md aivex:text-label-lg\",\n lg: \"aivex:h-10 aivex:gap-xs aivex:px-lg aivex:rounded-md aivex:text-label-xl\",\n \"icon-sm\": \"aivex:h-6 aivex:w-6 aivex:px-0 aivex:rounded-sm\",\n \"icon-md\": \"aivex:h-8 aivex:w-8 aivex:px-0 aivex:rounded-md\",\n \"icon-lg\": \"aivex:h-10 aivex:w-10 aivex:px-0 aivex:rounded-md\",\n },\n },\n compoundVariants: [\n {\n variant: \"solid\",\n color: \"primary\",\n className: \"aivex:bg-bg-brand aivex:text-text-on-color\",\n },\n {\n variant: \"solid\",\n color: \"secondary\",\n className: \"aivex:bg-bg-tertiary aivex:text-text-primary\",\n },\n {\n variant: \"solid\",\n color: \"danger\",\n className: \"aivex:bg-bg-danger aivex:text-text-on-color\",\n },\n {\n variant: \"outline\",\n color: \"primary\",\n className: \"aivex:border-border-brand aivex:text-text-brand\",\n },\n {\n variant: \"outline\",\n color: \"secondary\",\n className: \"aivex:border-border-default aivex:text-text-primary\",\n },\n {\n variant: \"outline\",\n color: \"danger\",\n className: \"aivex:border-border-danger aivex:text-text-danger\",\n },\n {\n variant: \"ghost\",\n color: \"primary\",\n className: \"aivex:text-text-brand\",\n },\n {\n variant: \"ghost\",\n color: \"secondary\",\n className: \"aivex:text-text-primary\",\n },\n {\n variant: \"ghost\",\n color: \"danger\",\n className: \"aivex:text-text-danger\",\n },\n ],\n defaultVariants: {\n variant: \"solid\",\n size: \"md\",\n },\n },\n);\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariantStyles>;\ntype ButtonVariant = NonNullable<ButtonVariantProps[\"variant\"]>;\ntype ButtonColor = NonNullable<ButtonVariantProps[\"color\"]>;\n\nfunction getButtonColor(variant: ButtonVariant = \"solid\", color?: ButtonColor | null) {\n return color ?? (variant === \"solid\" ? \"primary\" : \"secondary\");\n}\n\nfunction getInteractionVariant(\n variant: ButtonVariant,\n color: ButtonColor,\n): InteractionLayerVariant {\n if (variant === \"solid\") {\n return color === \"secondary\" ? \"default\" : \"strong\";\n }\n\n return color === \"danger\" ? \"danger\" : \"default\";\n}\n\n/**\n * Button과 같은 모양의 클래스 문자열을 만든다. `color`를 생략하면 solid는 primary, 그 외는 secondary가 된다.\n * 링크 등 Button이 아닌 요소를 버튼처럼 꾸밀 때 쓴다.\n */\nfunction buttonVariants({\n variant = \"solid\",\n color,\n size = \"md\",\n className,\n}: ButtonVariantProps & { className?: string } = {}) {\n const effectiveVariant = variant ?? \"solid\";\n const effectiveColor = getButtonColor(effectiveVariant, color);\n\n return buttonVariantStyles({ variant: effectiveVariant, color: effectiveColor, size, className });\n}\n\nexport interface ButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"color\">,\n ButtonVariantProps {\n /**\n * `<button>` 대신 그릴 요소(예: `<a href=\"…\" />`) 또는 `(props) => 요소` 함수.\n * 버튼의 props·스타일이 그 요소에 합쳐지고, 라벨과 슬롯은 `children`으로 그대로 넘긴다.\n */\n render?: useRender.RenderProp;\n /** 라벨 앞 슬롯(주로 아이콘). `icon-*` 크기에서는 렌더링되지 않는다. */\n startContent?: ReactNode;\n /** 라벨 뒤 슬롯(주로 아이콘). `icon-*` 크기에서는 렌더링되지 않는다. */\n endContent?: ReactNode;\n /** 버튼 라벨. `icon-*` 크기에서는 아이콘 하나를 넣는다. */\n children?: ReactNode;\n ref?: Ref<HTMLButtonElement>;\n}\n\n/**\n * 텍스트 라벨이 있는 기본 액션 버튼.\n *\n * `variant`: solid(채움, 기본)·outline(테두리)·ghost(배경 없음). `color`: primary·secondary·danger이며\n * 생략하면 solid는 primary, outline·ghost는 secondary가 된다. `size`: sm(24px)·md(32px, 기본)·lg(40px),\n * 아이콘 전용 정사각형은 icon-sm·icon-md·icon-lg(이때 `aria-label` 필수).\n * 툴바·닫기 같은 배경 없는 작은 아이콘 버튼은 `IconButton`을 쓴다.\n * `type`을 기본값으로 지정하지 않으므로 폼 안에서 제출 용도가 아니면 `type=\"button\"`을 준다.\n *\n * @example\n * ```tsx\n * import { Button, PlusIcon } from \"@aivex/ui\";\n *\n * <Button type=\"button\" variant=\"outline\" color=\"primary\" startContent={<PlusIcon size={20} />}>\n * 추가\n * </Button>\n * <Button type=\"submit\" color=\"danger\">삭제</Button>\n * ```\n */\nfunction Button({\n className,\n variant = \"solid\",\n color,\n size = \"md\",\n render,\n startContent,\n endContent,\n ref,\n children,\n ...props\n}: ButtonProps) {\n const effectiveVariant = variant ?? \"solid\";\n const effectiveColor = getButtonColor(effectiveVariant, color);\n const effectiveSize = size ?? \"md\";\n const isIconSize = effectiveSize.startsWith(\"icon-\");\n const shouldRenderStartContent = !isIconSize && startContent;\n const shouldRenderEndContent = !isIconSize && endContent;\n\n return useRender({\n defaultTagName: \"button\",\n render,\n ref,\n props: {\n ...props,\n className: cn(\n buttonVariants({ variant: effectiveVariant, color: effectiveColor, size: effectiveSize }),\n className,\n ),\n children: (\n <>\n <InteractionLayer variant={getInteractionVariant(effectiveVariant, effectiveColor)} />\n {shouldRenderStartContent && (\n <span className=\"aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-center\">\n {startContent}\n </span>\n )}\n {children}\n {shouldRenderEndContent && (\n <span className=\"aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-center\">\n {endContent}\n </span>\n )}\n </>\n ),\n },\n });\n}\n\nexport { Button, buttonVariants };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.cjs","names":[],"sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { InteractionLayer, type InteractionLayerVariant } from \"@/components/InteractionLayer\";\nimport { cn } from \"@/utils/cn\";\n\nconst buttonVariantStyles = cva(\n \"aivex:relative aivex:overflow-hidden aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:whitespace-nowrap aivex:border aivex:border-transparent aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand\",\n {\n variants: {\n variant: {\n solid: \"\",\n outline: \"\",\n ghost: \"\",\n },\n color: {\n primary: \"\",\n secondary: \"\",\n danger: \"\",\n },\n size: {\n sm: \"aivex:h-6 aivex:gap-none aivex:px-sm aivex:rounded-sm aivex:text-label-md\",\n md: \"aivex:h-8 aivex:gap-2xs aivex:px-md aivex:rounded-md aivex:text-label-lg\",\n lg: \"aivex:h-10 aivex:gap-xs aivex:px-lg aivex:rounded-md aivex:text-label-xl\",\n \"icon-sm\": \"aivex:h-6 aivex:w-6 aivex:px-0 aivex:rounded-sm\",\n \"icon-md\": \"aivex:h-8 aivex:w-8 aivex:px-0 aivex:rounded-md\",\n \"icon-lg\": \"aivex:h-10 aivex:w-10 aivex:px-0 aivex:rounded-md\",\n },\n },\n compoundVariants: [\n {\n variant: \"solid\",\n color: \"primary\",\n className: \"aivex:bg-bg-brand aivex:text-text-on-color\",\n },\n {\n variant: \"solid\",\n color: \"secondary\",\n className: \"aivex:bg-bg-tertiary aivex:text-text-primary\",\n },\n {\n variant: \"solid\",\n color: \"danger\",\n className: \"aivex:bg-bg-danger aivex:text-text-on-color\",\n },\n {\n variant: \"outline\",\n color: \"primary\",\n className: \"aivex:border-border-brand aivex:text-text-brand\",\n },\n {\n variant: \"outline\",\n color: \"secondary\",\n className: \"aivex:border-border-default aivex:text-text-primary\",\n },\n {\n variant: \"outline\",\n color: \"danger\",\n className: \"aivex:border-border-danger aivex:text-text-danger\",\n },\n {\n variant: \"ghost\",\n color: \"primary\",\n className: \"aivex:text-text-brand\",\n },\n {\n variant: \"ghost\",\n color: \"secondary\",\n className: \"aivex:text-text-primary\",\n },\n {\n variant: \"ghost\",\n color: \"danger\",\n className: \"aivex:text-text-danger\",\n },\n ],\n defaultVariants: {\n variant: \"solid\",\n size: \"md\",\n },\n },\n);\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariantStyles>;\ntype ButtonVariant = NonNullable<ButtonVariantProps[\"variant\"]>;\ntype ButtonColor = NonNullable<ButtonVariantProps[\"color\"]>;\n\nfunction getButtonColor(variant: ButtonVariant = \"solid\", color?: ButtonColor | null) {\n return color ?? (variant === \"solid\" ? \"primary\" : \"secondary\");\n}\n\nfunction getInteractionVariant(\n variant: ButtonVariant,\n color: ButtonColor,\n): InteractionLayerVariant {\n if (variant === \"solid\") {\n return color === \"secondary\" ? \"default\" : \"strong\";\n }\n\n return color === \"danger\" ? \"danger\" : \"default\";\n}\n\n/**\n * Button과 같은 모양의 클래스 문자열을 만든다. `color`를 생략하면 solid는 primary, 그 외는 secondary가 된다.\n * 링크 등 Button이 아닌 요소를 버튼처럼 꾸밀 때 쓴다.\n */\nfunction buttonVariants({\n variant = \"solid\",\n color,\n size = \"md\",\n className,\n}: ButtonVariantProps & { className?: string } = {}) {\n const effectiveVariant = variant ?? \"solid\";\n const effectiveColor = getButtonColor(effectiveVariant, color);\n\n return buttonVariantStyles({ variant: effectiveVariant, color: effectiveColor, size, className });\n}\n\nexport interface ButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"color\">,\n ButtonVariantProps {\n /**\n * `<button>` 대신 그릴 요소(예: `<a href=\"…\" />`) 또는 `(props) => 요소` 함수.\n * 버튼의 props·스타일이 그 요소에 합쳐지고, 라벨과 슬롯은 `children`으로 그대로 넘긴다.\n */\n render?: useRender.RenderProp;\n /** 라벨 앞 슬롯(주로 아이콘). `icon-*` 크기에서는 렌더링되지 않는다. */\n startContent?: ReactNode;\n /** 라벨 뒤 슬롯(주로 아이콘). `icon-*` 크기에서는 렌더링되지 않는다. */\n endContent?: ReactNode;\n /** 버튼 라벨. `icon-*` 크기에서는 아이콘 하나를 넣는다. */\n children?: ReactNode;\n ref?: Ref<HTMLButtonElement>;\n}\n\n/**\n * 텍스트 라벨이 있는 기본 액션 버튼.\n *\n * `variant`: solid(채움, 기본)·outline(테두리)·ghost(배경 없음). `color`: primary·secondary·danger이며\n * 생략하면 solid는 primary, outline·ghost는 secondary가 된다. `size`: sm(24px)·md(32px, 기본)·lg(40px),\n * 아이콘 전용 정사각형은 icon-sm·icon-md·icon-lg(이때 `aria-label` 필수).\n * 툴바·닫기 같은 배경 없는 작은 아이콘 버튼은 `IconButton`을 쓴다.\n * `type`을 기본값으로 지정하지 않으므로 폼 안에서 제출 용도가 아니면 `type=\"button\"`을 준다.\n *\n * @example\n * ```tsx\n * import { Button, PlusIcon } from \"@aivex/ui\";\n *\n * <Button type=\"button\" variant=\"outline\" color=\"primary\" startContent={<PlusIcon size={20} />}>\n * 추가\n * </Button>\n * <Button type=\"submit\" color=\"danger\">삭제</Button>\n * ```\n */\nfunction Button({\n className,\n variant = \"solid\",\n color,\n size = \"md\",\n render,\n startContent,\n endContent,\n ref,\n children,\n ...props\n}: ButtonProps) {\n const effectiveVariant = variant ?? \"solid\";\n const effectiveColor = getButtonColor(effectiveVariant, color);\n const effectiveSize = size ?? \"md\";\n const isIconSize = effectiveSize.startsWith(\"icon-\");\n const shouldRenderStartContent = !isIconSize && startContent;\n const shouldRenderEndContent = !isIconSize && endContent;\n\n return useRender({\n defaultTagName: \"button\",\n render,\n ref,\n props: {\n ...props,\n className: cn(\n buttonVariants({ variant: effectiveVariant, color: effectiveColor, size: effectiveSize }),\n className,\n ),\n children: (\n <>\n <InteractionLayer variant={getInteractionVariant(effectiveVariant, effectiveColor)} />\n {shouldRenderStartContent && (\n <span className=\"aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-center\">\n {startContent}\n </span>\n )}\n {children}\n {shouldRenderEndContent && (\n <span className=\"aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-center\">\n {endContent}\n </span>\n )}\n </>\n ),\n },\n });\n}\n\nexport { Button, buttonVariants };\n"],"mappings":"gOAMA,IAAM,GAAA,sCAAA,KACJ,4XACA,CACE,SAAU,CACR,QAAS,CACP,MAAO,GACP,QAAS,GACT,MAAO,GACR,CACD,MAAO,CACL,QAAS,GACT,UAAW,GACX,OAAQ,GACT,CACD,KAAM,CACJ,GAAI,4EACJ,GAAI,2EACJ,GAAI,2EACJ,UAAW,kDACX,UAAW,kDACX,UAAW,oDACZ,CACF,CACD,iBAAkB,CAChB,CACE,QAAS,QACT,MAAO,UACP,UAAW,6CACZ,CACD,CACE,QAAS,QACT,MAAO,YACP,UAAW,+CACZ,CACD,CACE,QAAS,QACT,MAAO,SACP,UAAW,8CACZ,CACD,CACE,QAAS,UACT,MAAO,UACP,UAAW,kDACZ,CACD,CACE,QAAS,UACT,MAAO,YACP,UAAW,sDACZ,CACD,CACE,QAAS,UACT,MAAO,SACP,UAAW,oDACZ,CACD,CACE,QAAS,QACT,MAAO,UACP,UAAW,wBACZ,CACD,CACE,QAAS,QACT,MAAO,YACP,UAAW,0BACZ,CACD,CACE,QAAS,QACT,MAAO,SACP,UAAW,yBACZ,CACF,CACD,gBAAiB,CACf,QAAS,QACT,KAAM,KACP,CACF,CACF,CAMD,SAAS,EAAe,EAAyB,QAAS,EAA4B,CACpF,OAAO,IAAU,IAAY,QAAU,UAAY,aAGrD,SAAS,EACP,EACA,EACyB,CAKzB,OAJI,IAAY,QACP,IAAU,YAAc,UAAY,SAGtC,IAAU,SAAW,SAAW,UAOzC,SAAS,EAAe,CACtB,UAAU,QACV,QACA,OAAO,KACP,aAC+C,EAAE,CAAE,CACnD,IAAM,EAAmB,GAAW,QAGpC,OAAO,EAAoB,CAAE,QAAS,EAAkB,MAFjC,EAAe,EAAkB,EAAM,CAEiB,OAAM,YAAW,CAAC,CAuCnG,SAAS,EAAO,CACd,YACA,UAAU,QACV,QACA,OAAO,KACP,SACA,eACA,aACA,MACA,WACA,GAAG,GACW,CACd,IAAM,EAAmB,GAAW,QAC9B,EAAiB,EAAe,EAAkB,EAAM,CACxD,EAAgB,GAAQ,KACxB,EAAa,EAAc,WAAW,QAAQ,CAC9C,EAA2B,CAAC,GAAc,EAC1C,EAAyB,CAAC,GAAc,EAE9C,OAAA,EAAA,EAAA,WAAiB,CACf,eAAgB,SAChB,SACA,MACA,MAAO,CACL,GAAG,EACH,UAAW,EAAA,GACT,EAAe,CAAE,QAAS,EAAkB,MAAO,EAAgB,KAAM,EAAe,CAAC,CACzF,EACD,CACD,UACE,EAAA,EAAA,MAAA,EAAA,SAAA,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,EAAA,iBAAD,CAAkB,QAAS,EAAsB,EAAkB,EAAe,CAAI,CAAA,CACrF,IACC,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,6EACb,EACI,CAAA,CAER,EACA,IACC,EAAA,EAAA,KAAC,OAAD,CAAM,UAAU,6EACb,EACI,CAAA,CAER,CAAA,CAAA,CAEN,CACF,CAAC"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { cn as e } from "../../utils.js";
|
|
3
3
|
import { InteractionLayer as t } from "../InteractionLayer/InteractionLayer.js";
|
|
4
4
|
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useRender as a } from "@base-ui/react/use-render";
|
|
6
|
+
import { cva as o } from "class-variance-authority";
|
|
7
7
|
//#region src/components/Button/Button.tsx
|
|
8
|
-
var s =
|
|
8
|
+
var s = o("aivex:relative aivex:overflow-hidden aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:whitespace-nowrap aivex:border aivex:border-transparent aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand", {
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
11
|
solid: "",
|
|
@@ -93,9 +93,9 @@ function u({ variant: e = "solid", color: t, size: n = "md", className: r } = {}
|
|
|
93
93
|
className: r
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
|
-
function d({ className:
|
|
96
|
+
function d({ className: o, variant: s = "solid", color: d, size: f = "md", render: p, startContent: m, endContent: h, ref: g, children: _, ...v }) {
|
|
97
97
|
let y = s ?? "solid", b = c(y, d), x = f ?? "md", S = x.startsWith("icon-"), C = !S && m, w = !S && h;
|
|
98
|
-
return
|
|
98
|
+
return a({
|
|
99
99
|
defaultTagName: "button",
|
|
100
100
|
render: p,
|
|
101
101
|
ref: g,
|
|
@@ -105,7 +105,7 @@ function d({ className: a, variant: s = "solid", color: d, size: f = "md", rende
|
|
|
105
105
|
variant: y,
|
|
106
106
|
color: b,
|
|
107
107
|
size: x
|
|
108
|
-
}),
|
|
108
|
+
}), o),
|
|
109
109
|
children: /* @__PURE__ */ i(n, { children: [
|
|
110
110
|
/* @__PURE__ */ r(t, { variant: l(y, b) }),
|
|
111
111
|
C && /* @__PURE__ */ r("span", {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Icon/index.cjs`),t=require(`../../utils.cjs`),n=require(
|
|
1
|
+
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Icon/index.cjs`),t=require(`../../utils.cjs`),n=require(`../IconButton/IconButton.cjs`),r=require(`../../utils/PortalEventBoundary.cjs`),i=require(`../../utils/popupPositioning.cjs`),a=require(`../../utils/popupArrow.cjs`),o=require(`../Button/Button.cjs`),s=require(`../Popover/Popover.cjs`);let c=require(`react/jsx-runtime`),l=require(`@base-ui/react/popover`);var u=20,d=10,f=t.cn(s.popoverContentBaseClassName,`aivex:w-[280px] aivex:bg-static-gray aivex:text-text-on-color`);function p({button:e,variant:n,className:r}){let{children:i,...a}=e;return(0,c.jsx)(o.Button,{variant:n,color:`primary`,size:`md`,className:t.cn(`aivex:text-text-on-color`,r),...a,children:i})}function m(e){return(0,c.jsx)(l.Popover.Root,{...e})}function h({ref:e,...t}){return(0,c.jsx)(l.Popover.Trigger,{ref:e,...t})}function g({className:o,title:m,children:h,tertiaryButton:g,secondaryButton:_,primaryButton:v,onClose:y,closeAriaLabel:b=`닫기`,container:x,keepMounted:S,ref:C,...w}){let[{sideOffset:T=8,...E},D]=i.splitPositioningProps(w),O=!!(g||_||v);return(0,c.jsx)(r.PortalEventBoundary,{children:(0,c.jsx)(l.Popover.Portal,{container:x,keepMounted:S,children:(0,c.jsx)(l.Popover.Positioner,{sideOffset:typeof T==`number`?T+d:e=>T(e)+d,className:s.popoverPositionerClassName,...E,children:(0,c.jsxs)(l.Popover.Popup,{ref:C,initialFocus:!1,className:t.cn(f,o),...D,children:[(m!=null||y!=null)&&(0,c.jsxs)(`div`,{className:`aivex:flex aivex:w-full aivex:items-center aivex:gap-2.5 aivex:px-xs`,children:[(0,c.jsx)(`div`,{className:`aivex:min-w-0 aivex:flex-1 aivex:truncate aivex:text-label-lg`,children:m}),y!=null&&(0,c.jsx)(n.IconButton,{"aria-label":b,color:`white`,size:`xs`,onClick:y,children:(0,c.jsx)(e.CloseIcon,{size:20})})]}),(0,c.jsx)(`div`,{className:`aivex:flex aivex:max-h-[200px] aivex:min-h-[40px] aivex:w-full aivex:flex-col aivex:gap-md aivex:overflow-y-auto aivex:text-body-md-regular`,children:h}),O&&(0,c.jsxs)(`div`,{className:`aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-md`,children:[(0,c.jsx)(`div`,{className:`aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-start`,children:g&&(0,c.jsx)(p,{button:g,variant:`ghost`,className:`aivex:min-w-9`})}),(0,c.jsxs)(`div`,{className:`aivex:flex aivex:items-start aivex:gap-md`,children:[_&&(0,c.jsx)(p,{button:_,variant:`ghost`,className:`aivex:min-w-[60px]`}),v&&(0,c.jsx)(p,{button:v,variant:`solid`,className:`aivex:min-w-[60px]`})]})]}),(0,c.jsx)(l.Popover.Arrow,{className:a.popupArrowClassName,style:a.popupArrowStyle(u,d),children:(0,c.jsx)(a.PopupArrowShape,{width:u,height:d,className:`aivex:fill-static-gray`})})]})})})})}var _=Object.assign(m,{Trigger:h,Content:g});exports.Coachmark=_;
|
|
2
2
|
//# sourceMappingURL=Coachmark.cjs.map
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { CloseIcon as e } from "../Icon/index.js";
|
|
4
4
|
import { cn as t } from "../../utils.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { splitPositioningProps as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { IconButton as n } from "../IconButton/IconButton.js";
|
|
6
|
+
import { PortalEventBoundary as r } from "../../utils/PortalEventBoundary.js";
|
|
7
|
+
import { splitPositioningProps as i } from "../../utils/popupPositioning.js";
|
|
8
|
+
import { PopupArrowShape as a, popupArrowClassName as o, popupArrowStyle as s } from "../../utils/popupArrow.js";
|
|
9
|
+
import { Button as c } from "../Button/Button.js";
|
|
10
10
|
import { popoverContentBaseClassName as l, popoverPositionerClassName as u } from "../Popover/Popover.js";
|
|
11
11
|
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
12
12
|
import { Popover as p } from "@base-ui/react/popover";
|
|
@@ -14,7 +14,7 @@ import { Popover as p } from "@base-ui/react/popover";
|
|
|
14
14
|
var m = 20, h = 10, g = t(l, "aivex:w-[280px] aivex:bg-static-gray aivex:text-text-on-color");
|
|
15
15
|
function _({ button: e, variant: n, className: r }) {
|
|
16
16
|
let { children: i, ...a } = e;
|
|
17
|
-
return /* @__PURE__ */ d(
|
|
17
|
+
return /* @__PURE__ */ d(c, {
|
|
18
18
|
variant: n,
|
|
19
19
|
color: "primary",
|
|
20
20
|
size: "md",
|
|
@@ -32,9 +32,9 @@ function y({ ref: e, ...t }) {
|
|
|
32
32
|
...t
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
function b({ className:
|
|
36
|
-
let [{ sideOffset: O = 8, ...k }, A] =
|
|
37
|
-
return /* @__PURE__ */ d(
|
|
35
|
+
function b({ className: c, title: l, children: v, tertiaryButton: y, secondaryButton: b, primaryButton: x, onClose: S, closeAriaLabel: C = "닫기", container: w, keepMounted: T, ref: E, ...D }) {
|
|
36
|
+
let [{ sideOffset: O = 8, ...k }, A] = i(D), j = !!(y || b || x);
|
|
37
|
+
return /* @__PURE__ */ d(r, { children: /* @__PURE__ */ d(p.Portal, {
|
|
38
38
|
container: w,
|
|
39
39
|
keepMounted: T,
|
|
40
40
|
children: /* @__PURE__ */ d(p.Positioner, {
|
|
@@ -44,7 +44,7 @@ function b({ className: s, title: l, children: v, tertiaryButton: y, secondaryBu
|
|
|
44
44
|
children: /* @__PURE__ */ f(p.Popup, {
|
|
45
45
|
ref: E,
|
|
46
46
|
initialFocus: !1,
|
|
47
|
-
className: t(g,
|
|
47
|
+
className: t(g, c),
|
|
48
48
|
...A,
|
|
49
49
|
children: [
|
|
50
50
|
(l != null || S != null) && /* @__PURE__ */ f("div", {
|
|
@@ -52,7 +52,7 @@ function b({ className: s, title: l, children: v, tertiaryButton: y, secondaryBu
|
|
|
52
52
|
children: [/* @__PURE__ */ d("div", {
|
|
53
53
|
className: "aivex:min-w-0 aivex:flex-1 aivex:truncate aivex:text-label-lg",
|
|
54
54
|
children: l
|
|
55
|
-
}), S != null && /* @__PURE__ */ d(
|
|
55
|
+
}), S != null && /* @__PURE__ */ d(n, {
|
|
56
56
|
"aria-label": C,
|
|
57
57
|
color: "white",
|
|
58
58
|
size: "xs",
|
|
@@ -87,9 +87,9 @@ function b({ className: s, title: l, children: v, tertiaryButton: y, secondaryBu
|
|
|
87
87
|
})]
|
|
88
88
|
}),
|
|
89
89
|
/* @__PURE__ */ d(p.Arrow, {
|
|
90
|
-
className:
|
|
91
|
-
style:
|
|
92
|
-
children: /* @__PURE__ */ d(
|
|
90
|
+
className: o,
|
|
91
|
+
style: s(m, h),
|
|
92
|
+
children: /* @__PURE__ */ d(a, {
|
|
93
93
|
width: m,
|
|
94
94
|
height: h,
|
|
95
95
|
className: "aivex:fill-static-gray"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Icon/index.cjs`),t=require(`../../utils.cjs`),n=require(`../
|
|
1
|
+
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Icon/index.cjs`),t=require(`../../utils.cjs`),n=require(`../IconButton/IconButton.cjs`),r=require(`../Avatar/Avatar.cjs`),i=require(`../Button/Button.cjs`),a=require(`./MentionInput.cjs`);let o=require(`react/jsx-runtime`);function s({user:s,value:c,onChange:l,onSubmit:u,onClose:d,title:f=`Comment`,closeLabel:p=`Close`,placeholder:m,submitLabel:h=`Send`,showSubmit:g=!0,pending:_=!1,userList:v,mentionEmptyText:y,initialContent:b,className:x}){let S=()=>{!c.trim()||_||u()};return(0,o.jsx)(`div`,{className:t.cn(`aivex:rounded-2xl aivex:bg-bg-primary aivex:shadow-xl`,x),children:(0,o.jsxs)(`div`,{className:`aivex:flex aivex:w-[360px] aivex:flex-col`,children:[(0,o.jsxs)(`div`,{className:`aivex:flex aivex:h-12 aivex:items-center aivex:justify-between aivex:border-border-subtle aivex:border-b aivex:px-5 aivex:py-2`,children:[(0,o.jsx)(`span`,{className:`aivex:text-body-lg-medium aivex:text-text-primary`,children:f}),(0,o.jsx)(n.IconButton,{size:`sm`,className:`aivex:text-text-secondary`,onClick:d,"aria-label":p,children:(0,o.jsx)(e.CloseIcon,{size:20})})]}),(0,o.jsxs)(`div`,{className:`aivex:flex aivex:flex-col aivex:px-4 aivex:py-3`,children:[(0,o.jsxs)(`div`,{className:`aivex:flex aivex:gap-1.5`,children:[(0,o.jsx)(`div`,{className:`aivex:h-6 aivex:w-6 aivex:py-1`,children:s?(0,o.jsx)(r.Avatar,{size:`sm`,src:s.avatarUrl,bgColor:s.color,name:s.name}):null}),(0,o.jsx)(`div`,{className:`aivex:min-w-0 aivex:flex-1`,children:(0,o.jsx)(a.MentionInput,{value:c,onChange:l,placeholder:m,onSubmit:S,onEscape:d,userList:v,mentionEmptyText:y,initialContent:b})})]}),g?(0,o.jsx)(`div`,{className:t.cn(`aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out`,c.trim()?`aivex:grid-rows-[1fr] aivex:opacity-100`:`aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0`),children:(0,o.jsx)(`div`,{className:`aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5`,children:(0,o.jsx)(i.Button,{size:`md`,disabled:!c.trim()||_,onClick:S,tabIndex:c.trim()?void 0:-1,children:h})})}):null]})]})})}exports.CommentInput=s;
|
|
2
2
|
//# sourceMappingURL=CommentInput.cjs.map
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { CloseIcon as e } from "../Icon/index.js";
|
|
4
4
|
import { cn as t } from "../../utils.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { IconButton as n } from "../IconButton/IconButton.js";
|
|
6
|
+
import { Avatar as r } from "../Avatar/Avatar.js";
|
|
7
|
+
import { Button as i } from "../Button/Button.js";
|
|
8
8
|
import { MentionInput as a } from "./MentionInput.js";
|
|
9
9
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
10
10
|
//#region src/components/Comment/CommentInput.tsx
|
|
@@ -21,7 +21,7 @@ function c({ user: c, value: l, onChange: u, onSubmit: d, onClose: f, title: p =
|
|
|
21
21
|
children: [/* @__PURE__ */ o("span", {
|
|
22
22
|
className: "aivex:text-body-lg-medium aivex:text-text-primary",
|
|
23
23
|
children: p
|
|
24
|
-
}), /* @__PURE__ */ o(
|
|
24
|
+
}), /* @__PURE__ */ o(n, {
|
|
25
25
|
size: "sm",
|
|
26
26
|
className: "aivex:text-text-secondary",
|
|
27
27
|
onClick: f,
|
|
@@ -34,7 +34,7 @@ function c({ user: c, value: l, onChange: u, onSubmit: d, onClose: f, title: p =
|
|
|
34
34
|
className: "aivex:flex aivex:gap-1.5",
|
|
35
35
|
children: [/* @__PURE__ */ o("div", {
|
|
36
36
|
className: "aivex:h-6 aivex:w-6 aivex:py-1",
|
|
37
|
-
children: c ? /* @__PURE__ */ o(
|
|
37
|
+
children: c ? /* @__PURE__ */ o(r, {
|
|
38
38
|
size: "sm",
|
|
39
39
|
src: c.avatarUrl,
|
|
40
40
|
bgColor: c.color,
|
|
@@ -57,7 +57,7 @@ function c({ user: c, value: l, onChange: u, onSubmit: d, onClose: f, title: p =
|
|
|
57
57
|
className: t("aivex:grid aivex:transition-[grid-template-rows,opacity] aivex:duration-200 aivex:ease-out", l.trim() ? "aivex:grid-rows-[1fr] aivex:opacity-100" : "aivex:pointer-events-none aivex:grid-rows-[0fr] aivex:opacity-0"),
|
|
58
58
|
children: /* @__PURE__ */ o("div", {
|
|
59
59
|
className: "aivex:flex aivex:justify-end aivex:overflow-hidden aivex:pt-1.5",
|
|
60
|
-
children: /* @__PURE__ */ o(
|
|
60
|
+
children: /* @__PURE__ */ o(i, {
|
|
61
61
|
size: "md",
|
|
62
62
|
disabled: !l.trim() || v,
|
|
63
63
|
onClick: C,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../InteractionLayer/InteractionLayer.cjs`);let n=require(`react/jsx-runtime`),r=require(
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../InteractionLayer/InteractionLayer.cjs`);let n=require(`react/jsx-runtime`),r=require(`@base-ui/react/use-render`);var i=(0,require(`class-variance-authority`).cva)(`aivex:relative aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand`,{variants:{size:{xs:`aivex:size-xl aivex:rounded-xs`,sm:`aivex:size-2xl aivex:rounded-xs`,md:`aivex:size-3xl aivex:rounded-sm`},shape:{rectangle:``,rounded:`aivex:rounded-full`}},defaultVariants:{size:`sm`,shape:`rectangle`}}),a={xs:`aivex:size-xl`,sm:`aivex:size-2xl`,md:`aivex:size-3xl`},o={xs:`aivex:-inset-2xs`,sm:`aivex:-inset-xs`,md:`aivex:-inset-xs`},s={xs:{rectangle:`aivex:rounded-xs`,rounded:`aivex:rounded-full`},sm:{rectangle:`aivex:rounded-sm`,rounded:`aivex:rounded-full`},md:{rectangle:`aivex:rounded-md`,rounded:`aivex:rounded-full`}};function c({className:c,size:l=`sm`,shape:u=`rectangle`,color:d=`primary`,error:f=!1,render:p,children:m,ref:h,...g}){let _=f?`aivex:text-icon-danger`:d===`white`?`aivex:text-static-white`:`aivex:text-icon-primary`,v=f?`danger`:d===`white`?`white`:`default`,y=l??`sm`,b=u??`rectangle`;return(0,r.useRender)({defaultTagName:`button`,render:p,ref:h,props:{type:p?void 0:`button`,...g,className:e.cn(i({size:l,shape:u}),_,c),children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.InteractionLayer,{variant:v,fill:!1,interactive:!0,className:e.cn(o[y],s[y][b])}),(0,n.jsx)(`span`,{className:e.cn(`aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0`,a[y]),children:m})]})}})}exports.IconButton=c,exports.iconButtonVariants=i;
|
|
2
2
|
//# sourceMappingURL=IconButton.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.cjs","names":[],"sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { InteractionLayer } from \"@/components/InteractionLayer\";\nimport { cn } from \"@/utils/cn\";\n\n/** IconButton의 크기(`size`)·모양(`shape`) 클래스를 만드는 cva 변형 함수. */\nconst iconButtonVariants = cva(\n \"aivex:relative aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand\",\n {\n variants: {\n size: {\n xs: \"aivex:size-xl aivex:rounded-xs\",\n sm: \"aivex:size-2xl aivex:rounded-xs\",\n md: \"aivex:size-3xl aivex:rounded-sm\",\n },\n shape: {\n rectangle: \"\",\n rounded: \"aivex:rounded-full\",\n },\n },\n defaultVariants: {\n size: \"sm\",\n shape: \"rectangle\",\n },\n },\n);\n\ntype IconButtonSize = \"xs\" | \"sm\" | \"md\";\ntype IconButtonShape = \"rectangle\" | \"rounded\";\n\nconst iconSizeClass: Record<IconButtonSize, string> = {\n xs: \"aivex:size-xl\",\n sm: \"aivex:size-2xl\",\n md: \"aivex:size-3xl\",\n};\n\nconst interactionInsetClass: Record<IconButtonSize, string> = {\n xs: \"aivex:-inset-2xs\",\n sm: \"aivex:-inset-xs\",\n md: \"aivex:-inset-xs\",\n};\n\nconst interactionRadiusClass: Record<IconButtonSize, Record<IconButtonShape, string>> = {\n xs: {\n rectangle: \"aivex:rounded-xs\",\n rounded: \"aivex:rounded-full\",\n },\n sm: {\n rectangle: \"aivex:rounded-sm\",\n rounded: \"aivex:rounded-full\",\n },\n md: {\n rectangle: \"aivex:rounded-md\",\n rounded: \"aivex:rounded-full\",\n },\n};\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"type\">,\n VariantProps<typeof iconButtonVariants> {\n /**\n * 아이콘 색상 — primary: 밝은 배경 위 기본(어두운) 아이콘, white: 어두운 배경 위 흰 아이콘\n * @default \"primary\"\n */\n color?: \"primary\" | \"white\";\n /**\n * true 이면 danger 색상 적용 (color 보다 우선)\n * @default false\n */\n error?: boolean;\n /**\n * `<button>` 대신 그릴 요소(예: `<a href=\"…\" />`) 또는 `(props) => 요소` 함수.\n * 버튼의 props·스타일이 그 요소에 합쳐지고, 아이콘은 `children`으로 그대로 넘긴다.\n */\n render?: useRender.RenderProp;\n /** 표시할 아이콘 하나 */\n children?: ReactNode;\n ref?: Ref<HTMLButtonElement>;\n}\n\n/**\n * 배경 없이 아이콘만 보이는 작은 버튼(닫기·더보기·툴바 액션 등).\n *\n * 텍스트가 없으므로 `aria-label`을 반드시 지정한다. `type=\"button\"`으로 고정되어 폼을 제출하지 않는다.\n * `size`: xs(16px)·sm(20px, 기본)·md(24px)이며 hover 영역은 박스보다 조금 넓게 그려진다.\n * `shape`: rectangle(기본)·rounded(원형). 배경·테두리가 있는 아이콘 버튼은 `Button`의 `icon-*` 크기를 쓴다.\n *\n * @example\n * ```tsx\n * import { CloseIcon, IconButton } from \"@aivex/ui\";\n *\n * <IconButton size=\"sm\" aria-label=\"닫기\" onClick={onClose}>\n * <CloseIcon />\n * </IconButton>\n * ```\n */\nfunction IconButton({\n className,\n size = \"sm\",\n shape = \"rectangle\",\n color = \"primary\",\n error = false,\n render,\n children,\n ref,\n ...props\n}: IconButtonProps) {\n const iconColor = error\n ? \"aivex:text-icon-danger\"\n : color === \"white\"\n ? \"aivex:text-static-white\"\n : \"aivex:text-icon-primary\";\n\n const interactionVariant = error ? \"danger\" : color === \"white\" ? \"white\" : \"default\";\n const iconButtonSize = size ?? \"sm\";\n const iconButtonShape = shape ?? \"rectangle\";\n\n return useRender({\n defaultTagName: \"button\",\n render,\n ref,\n props: {\n // 링크 등 다른 요소로 그릴 때는 button 전용 속성을 붙이지 않는다.\n type: render ? undefined : \"button\",\n ...props,\n className: cn(iconButtonVariants({ size, shape }), iconColor, className),\n children: (\n <>\n <InteractionLayer\n variant={interactionVariant}\n fill={false}\n interactive\n className={cn(\n interactionInsetClass[iconButtonSize],\n interactionRadiusClass[iconButtonSize][iconButtonShape],\n )}\n />\n <span\n className={cn(\n \"aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0\",\n iconSizeClass[iconButtonSize],\n )}\n >\n {children}\n </span>\n </>\n ),\n },\n });\n}\n\nexport { IconButton, iconButtonVariants };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IconButton.cjs","names":[],"sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import { useRender } from \"@base-ui/react/use-render\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { InteractionLayer } from \"@/components/InteractionLayer\";\nimport { cn } from \"@/utils/cn\";\n\n/** IconButton의 크기(`size`)·모양(`shape`) 클래스를 만드는 cva 변형 함수. */\nconst iconButtonVariants = cva(\n \"aivex:relative aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand\",\n {\n variants: {\n size: {\n xs: \"aivex:size-xl aivex:rounded-xs\",\n sm: \"aivex:size-2xl aivex:rounded-xs\",\n md: \"aivex:size-3xl aivex:rounded-sm\",\n },\n shape: {\n rectangle: \"\",\n rounded: \"aivex:rounded-full\",\n },\n },\n defaultVariants: {\n size: \"sm\",\n shape: \"rectangle\",\n },\n },\n);\n\ntype IconButtonSize = \"xs\" | \"sm\" | \"md\";\ntype IconButtonShape = \"rectangle\" | \"rounded\";\n\nconst iconSizeClass: Record<IconButtonSize, string> = {\n xs: \"aivex:size-xl\",\n sm: \"aivex:size-2xl\",\n md: \"aivex:size-3xl\",\n};\n\nconst interactionInsetClass: Record<IconButtonSize, string> = {\n xs: \"aivex:-inset-2xs\",\n sm: \"aivex:-inset-xs\",\n md: \"aivex:-inset-xs\",\n};\n\nconst interactionRadiusClass: Record<IconButtonSize, Record<IconButtonShape, string>> = {\n xs: {\n rectangle: \"aivex:rounded-xs\",\n rounded: \"aivex:rounded-full\",\n },\n sm: {\n rectangle: \"aivex:rounded-sm\",\n rounded: \"aivex:rounded-full\",\n },\n md: {\n rectangle: \"aivex:rounded-md\",\n rounded: \"aivex:rounded-full\",\n },\n};\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"type\">,\n VariantProps<typeof iconButtonVariants> {\n /**\n * 아이콘 색상 — primary: 밝은 배경 위 기본(어두운) 아이콘, white: 어두운 배경 위 흰 아이콘\n * @default \"primary\"\n */\n color?: \"primary\" | \"white\";\n /**\n * true 이면 danger 색상 적용 (color 보다 우선)\n * @default false\n */\n error?: boolean;\n /**\n * `<button>` 대신 그릴 요소(예: `<a href=\"…\" />`) 또는 `(props) => 요소` 함수.\n * 버튼의 props·스타일이 그 요소에 합쳐지고, 아이콘은 `children`으로 그대로 넘긴다.\n */\n render?: useRender.RenderProp;\n /** 표시할 아이콘 하나 */\n children?: ReactNode;\n ref?: Ref<HTMLButtonElement>;\n}\n\n/**\n * 배경 없이 아이콘만 보이는 작은 버튼(닫기·더보기·툴바 액션 등).\n *\n * 텍스트가 없으므로 `aria-label`을 반드시 지정한다. `type=\"button\"`으로 고정되어 폼을 제출하지 않는다.\n * `size`: xs(16px)·sm(20px, 기본)·md(24px)이며 hover 영역은 박스보다 조금 넓게 그려진다.\n * `shape`: rectangle(기본)·rounded(원형). 배경·테두리가 있는 아이콘 버튼은 `Button`의 `icon-*` 크기를 쓴다.\n *\n * @example\n * ```tsx\n * import { CloseIcon, IconButton } from \"@aivex/ui\";\n *\n * <IconButton size=\"sm\" aria-label=\"닫기\" onClick={onClose}>\n * <CloseIcon />\n * </IconButton>\n * ```\n */\nfunction IconButton({\n className,\n size = \"sm\",\n shape = \"rectangle\",\n color = \"primary\",\n error = false,\n render,\n children,\n ref,\n ...props\n}: IconButtonProps) {\n const iconColor = error\n ? \"aivex:text-icon-danger\"\n : color === \"white\"\n ? \"aivex:text-static-white\"\n : \"aivex:text-icon-primary\";\n\n const interactionVariant = error ? \"danger\" : color === \"white\" ? \"white\" : \"default\";\n const iconButtonSize = size ?? \"sm\";\n const iconButtonShape = shape ?? \"rectangle\";\n\n return useRender({\n defaultTagName: \"button\",\n render,\n ref,\n props: {\n // 링크 등 다른 요소로 그릴 때는 button 전용 속성을 붙이지 않는다.\n type: render ? undefined : \"button\",\n ...props,\n className: cn(iconButtonVariants({ size, shape }), iconColor, className),\n children: (\n <>\n <InteractionLayer\n variant={interactionVariant}\n fill={false}\n interactive\n className={cn(\n interactionInsetClass[iconButtonSize],\n interactionRadiusClass[iconButtonSize][iconButtonShape],\n )}\n />\n <span\n className={cn(\n \"aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0\",\n iconSizeClass[iconButtonSize],\n )}\n >\n {children}\n </span>\n </>\n ),\n },\n });\n}\n\nexport { IconButton, iconButtonVariants };\n"],"mappings":"gOAOA,IAAM,GAAA,sCAAA,KACJ,wSACA,CACE,SAAU,CACR,KAAM,CACJ,GAAI,iCACJ,GAAI,kCACJ,GAAI,kCACL,CACD,MAAO,CACL,UAAW,GACX,QAAS,qBACV,CACF,CACD,gBAAiB,CACf,KAAM,KACN,MAAO,YACR,CACF,CACF,CAKK,EAAgD,CACpD,GAAI,gBACJ,GAAI,iBACJ,GAAI,iBACL,CAEK,EAAwD,CAC5D,GAAI,mBACJ,GAAI,kBACJ,GAAI,kBACL,CAEK,EAAkF,CACtF,GAAI,CACF,UAAW,mBACX,QAAS,qBACV,CACD,GAAI,CACF,UAAW,mBACX,QAAS,qBACV,CACD,GAAI,CACF,UAAW,mBACX,QAAS,qBACV,CACF,CAyCD,SAAS,EAAW,CAClB,YACA,OAAO,KACP,QAAQ,YACR,QAAQ,UACR,QAAQ,GACR,SACA,WACA,MACA,GAAG,GACe,CAClB,IAAM,EAAY,EACd,yBACA,IAAU,QACR,0BACA,0BAEA,EAAqB,EAAQ,SAAW,IAAU,QAAU,QAAU,UACtE,EAAiB,GAAQ,KACzB,EAAkB,GAAS,YAEjC,OAAA,EAAA,EAAA,WAAiB,CACf,eAAgB,SAChB,SACA,MACA,MAAO,CAEL,KAAM,EAAS,IAAA,GAAY,SAC3B,GAAG,EACH,UAAW,EAAA,GAAG,EAAmB,CAAE,OAAM,QAAO,CAAC,CAAE,EAAW,EAAU,CACxE,UACE,EAAA,EAAA,MAAA,EAAA,SAAA,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,EAAA,iBAAD,CACE,QAAS,EACT,KAAM,GACN,YAAA,GACA,UAAW,EAAA,GACT,EAAsB,GACtB,EAAuB,GAAgB,GACxC,CACD,CAAA,EACF,EAAA,EAAA,KAAC,OAAD,CACE,UAAW,EAAA,GACT,oEACA,EAAc,GACf,CAEA,WACI,CAAA,CACN,CAAA,CAAA,CAEN,CACF,CAAC"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { cn as e } from "../../utils.js";
|
|
3
3
|
import { InteractionLayer as t } from "../InteractionLayer/InteractionLayer.js";
|
|
4
4
|
import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useRender as a } from "@base-ui/react/use-render";
|
|
6
|
+
import { cva as o } from "class-variance-authority";
|
|
7
7
|
//#region src/components/IconButton/IconButton.tsx
|
|
8
|
-
var s =
|
|
8
|
+
var s = o("aivex:relative aivex:group aivex:inline-flex aivex:cursor-pointer aivex:items-center aivex:justify-center aivex:transition-colors aivex:disabled:pointer-events-none aivex:disabled:opacity-disable aivex:focus-visible:outline-none aivex:focus-visible:ring-2 aivex:focus-visible:ring-border-brand", {
|
|
9
9
|
variants: {
|
|
10
10
|
size: {
|
|
11
11
|
xs: "aivex:size-xl aivex:rounded-xs",
|
|
@@ -43,9 +43,9 @@ var s = a("aivex:relative aivex:group aivex:inline-flex aivex:cursor-pointer aiv
|
|
|
43
43
|
rounded: "aivex:rounded-full"
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
-
function d({ className:
|
|
46
|
+
function d({ className: o, size: d = "sm", shape: f = "rectangle", color: p = "primary", error: m = !1, render: h, children: g, ref: _, ...v }) {
|
|
47
47
|
let y = m ? "aivex:text-icon-danger" : p === "white" ? "aivex:text-static-white" : "aivex:text-icon-primary", b = m ? "danger" : p === "white" ? "white" : "default", x = d ?? "sm", S = f ?? "rectangle";
|
|
48
|
-
return
|
|
48
|
+
return a({
|
|
49
49
|
defaultTagName: "button",
|
|
50
50
|
render: h,
|
|
51
51
|
ref: _,
|
|
@@ -55,7 +55,7 @@ function d({ className: a, size: d = "sm", shape: f = "rectangle", color: p = "p
|
|
|
55
55
|
className: e(s({
|
|
56
56
|
size: d,
|
|
57
57
|
shape: f
|
|
58
|
-
}), y,
|
|
58
|
+
}), y, o),
|
|
59
59
|
children: /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r(t, {
|
|
60
60
|
variant: b,
|
|
61
61
|
fill: !1,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Icon/index.cjs`),t=require(`../../utils.cjs`),n=require(
|
|
1
|
+
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Icon/index.cjs`),t=require(`../../utils.cjs`),n=require(`../InteractionLayer/InteractionLayer.cjs`),r=require(`../../utils/PortalEventBoundary.cjs`),i=require(`../../utils/popupPositioning.cjs`);let a=require(`react`),o=require(`react/jsx-runtime`),s=require(`class-variance-authority`),c=require(`@base-ui/react/menu`);var l=(0,s.cva)(`aivex:relative aivex:overflow-hidden aivex:group aivex:flex aivex:w-full aivex:items-center aivex:gap-md aivex:px-md aivex:py-sm aivex:text-label-lg aivex:rounded-md aivex:transition-colors aivex:cursor-pointer aivex:select-none aivex:outline-none aivex:data-[disabled]:opacity-disable aivex:data-[disabled]:pointer-events-none`,{variants:{danger:{true:`aivex:text-text-danger`,false:`aivex:text-text-primary`}},defaultVariants:{danger:!1}}),u=t.cn(`aivex:flex aivex:flex-col aivex:rounded-md aivex:bg-bg-primary aivex:p-md aivex:overflow-clip`,`aivex:shadow-md aivex:border aivex:border-border-subtle aivex:min-w-[160px]`,`aivex:outline-none`,`aivex:data-[open]:animate-in aivex:data-[closed]:animate-out`,`aivex:data-[closed]:fade-out-0 aivex:data-[open]:fade-in-0`,`aivex:data-[closed]:zoom-out-95 aivex:data-[open]:zoom-in-95`),d=`aivex:z-(--aivex-z-dropdown) aivex:outline-none`,f=(0,a.createContext)(!1);function p(e){return(0,o.jsx)(c.Menu.Root,{...e})}function m({ref:e,onClick:t,...n}){return(0,o.jsx)(c.Menu.Trigger,{ref:e,onClick:e=>{t?.(e),e.stopPropagation(),e.preventDefault()},...n})}function h({className:e,container:n,keepMounted:a,ref:s,...l}){let[{sideOffset:f=4,...p},m]=i.splitPositioningProps(l);return(0,o.jsx)(r.PortalEventBoundary,{children:(0,o.jsx)(c.Menu.Portal,{container:n,keepMounted:a,children:(0,o.jsx)(c.Menu.Positioner,{sideOffset:f,className:d,...p,children:(0,o.jsx)(c.Menu.Popup,{ref:s,className:t.cn(u,e),...m})})})})}function g({className:e,ref:n,...r}){return(0,o.jsx)(f,{value:!0,children:(0,o.jsx)(c.Menu.Group,{ref:n,className:t.cn(`aivex:flex aivex:flex-col`,e),...r})})}function _({className:e,ref:n,...r}){return(0,o.jsx)(c.Menu.Separator,{ref:n,className:t.cn(`aivex:h-px aivex:bg-border-subtle aivex:w-full aivex:my-xs`,e),...r})}function v({className:e,ref:n,...r}){let i=(0,a.use)(f),s=t.cn(`aivex:px-md aivex:py-2xs aivex:text-label-md aivex:text-text-tertiary aivex:select-none`,e);return i?(0,o.jsx)(c.Menu.GroupLabel,{ref:n,className:s,...r}):(0,o.jsx)(`div`,{ref:n,className:s,...r})}function y({className:e,label:r,icon:i,danger:a=!1,children:s,ref:u,...d}){let f=r??s;return(0,o.jsxs)(c.Menu.Item,{ref:u,className:t.cn(l({danger:a}),e),label:typeof r==`string`?r:void 0,...d,children:[(0,o.jsx)(n.InteractionLayer,{variant:a?`danger`:`default`}),i&&(0,o.jsx)(`span`,{className:t.cn(`aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0`,a?`aivex:text-icon-danger`:`aivex:text-icon-secondary`),children:i}),(0,o.jsx)(`span`,{className:`aivex:flex-1 aivex:min-w-0 aivex:truncate aivex:text-left`,children:f})]})}function b({className:r,label:i,icon:a,closeOnClick:s=!0,children:u,ref:d,...f}){let p=i??u;return(0,o.jsxs)(c.Menu.CheckboxItem,{ref:d,className:t.cn(l(),r),label:typeof i==`string`?i:void 0,closeOnClick:s,...f,children:[(0,o.jsx)(n.InteractionLayer,{variant:`default`}),(0,o.jsx)(D,{children:(0,o.jsx)(c.Menu.CheckboxItemIndicator,{className:`aivex:flex`,children:(0,o.jsx)(e.CheckIcon,{size:20})})}),a&&(0,o.jsx)(`span`,{className:`aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:text-icon-secondary`,children:a}),(0,o.jsx)(`span`,{className:`aivex:flex-1 aivex:min-w-0 aivex:truncate aivex:text-left`,children:p})]})}function x({className:e,ref:n,...r}){return(0,o.jsx)(f,{value:!0,children:(0,o.jsx)(c.Menu.RadioGroup,{ref:n,className:t.cn(`aivex:flex aivex:flex-col`,e),...r})})}function S({className:r,label:i,icon:a,closeOnClick:s=!0,children:u,ref:d,...f}){let p=i??u;return(0,o.jsxs)(c.Menu.RadioItem,{ref:d,className:t.cn(l(),r),label:typeof i==`string`?i:void 0,closeOnClick:s,...f,children:[(0,o.jsx)(n.InteractionLayer,{variant:`default`}),(0,o.jsx)(D,{children:(0,o.jsx)(c.Menu.RadioItemIndicator,{className:`aivex:flex`,children:(0,o.jsx)(e.CheckIcon,{size:20})})}),a&&(0,o.jsx)(`span`,{className:`aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:text-icon-secondary`,children:a}),(0,o.jsx)(`span`,{className:`aivex:flex-1 aivex:min-w-0 aivex:truncate aivex:text-left`,children:p})]})}function C({className:e,ref:n,...r}){return(0,o.jsx)(`span`,{ref:n,className:t.cn(`aivex:inline-flex aivex:items-center aivex:justify-center aivex:min-h-5 aivex:min-w-5 aivex:px-2xs aivex:rounded-xs aivex:border aivex:border-border-subtle aivex:text-label-md aivex:text-text-tertiary aivex:ml-auto`,e),...r})}function w(e){return(0,o.jsx)(c.Menu.SubmenuRoot,{...e})}function T({className:r,label:i,icon:a,children:s,ref:u,...d}){let f=i??s;return(0,o.jsxs)(c.Menu.SubmenuTrigger,{ref:u,className:t.cn(l(),r),label:typeof i==`string`?i:void 0,...d,children:[(0,o.jsx)(n.InteractionLayer,{variant:`default`}),a&&(0,o.jsx)(`span`,{className:`aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:text-icon-secondary`,children:a}),(0,o.jsx)(`span`,{className:`aivex:flex-1 aivex:min-w-0 aivex:truncate aivex:text-left`,children:f}),(0,o.jsx)(`span`,{className:`aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:text-icon-secondary`,children:(0,o.jsx)(e.DirectionRightIcon,{size:16})})]})}function E(e){return(0,o.jsx)(h,{...e})}function D({children:e}){return(0,o.jsx)(`span`,{"aria-hidden":!0,className:`aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:w-5 aivex:h-5 aivex:text-icon-primary`,children:e})}var O=Object.assign(p,{Trigger:m,Content:h,Item:y,Group:g,Separator:_,Label:v,CheckboxItem:b,RadioGroup:x,RadioItem:S,Sub:w,SubTrigger:T,SubContent:E,Shortcut:C});exports.Menu=O,exports.contentClassName=u,exports.positionerClassName=d;
|
|
2
2
|
//# sourceMappingURL=Menu.cjs.map
|