@orioncactuscorp/ui
v1.27.0
Published
orioncactus UI foundations and core primitives
Maintainers
Readme
@orioncactuscorp/ui
orioncactus 디자인 시스템의 React 19+ UI package입니다.
Resources
- Storybook — 최신 컴포넌트와 사용 예시
- Changelog — 이 패키지 버전까지의 전체 변경 내역
- Documentation — 이 패키지 버전에 고정된 상세 가이드
요구사항
- React 19+, React DOM 19+
- Node 22+
- 브라우저:
color-mix()를 지원하는 evergreen 브라우저 — Chrome/Edge 111+, Safari 16.2+, Firefox 113+ - CSS Modules와 CSS
@layer를 처리하는 bundler - package manager: npm-compatible package manager
버전 라인, 공개 계약의 범위, breaking change 기준, 프리릴리즈 채널은 Stability Policy를 참조하세요.
설치
bun
bun add @orioncactuscorp/ui @orioncactuscorp/iconsnpm
npm install @orioncactuscorp/ui @orioncactuscorp/iconsyarn
yarn add @orioncactuscorp/ui @orioncactuscorp/iconspnpm
pnpm add @orioncactuscorp/ui @orioncactuscorp/icons앱 코드에서 아이콘을 직접 import한다면 @orioncactuscorp/icons를 consumer repository의 direct dependency로 함께 설치하세요. @orioncactuscorp/ui 컴포넌트 내부 indicator만 사용한다면 별도 작업은 필요 없습니다.
사용
앱 root에서 foundations.css(토큰 + reset)를 한 번 import합니다. 컴포넌트 스타일은 컴포넌트를 import하면 사용한 컴포넌트만 자동으로 함께 로드됩니다.
import '@orioncactuscorp/ui/foundations.css';
import { IconDefault } from '@orioncactuscorp/icons';
import { Button, IconButton } from '@orioncactuscorp/ui';
export default function Example() {
return (
<>
<Button>확인</Button>
<IconButton aria-label='기본 아이콘'>
<IconDefault />
</IconButton>
</>
);
}foundations.css는 항상 필요합니다. 컴포넌트 CSS에는 토큰 정의가 없어, 이 import를 빠뜨리면 모든 컴포넌트의 색·여백·타이포가 깨집니다.foundations.css는 첫 페인트 전에 적용되는 앱 root stylesheet로 불러오세요.rootScrollArea의 문서 scrollbar 숨김 규칙도 여기에 있습니다. Safari는 scrollbar를 만들 때의 스타일을 유지하므로, 이 파일이 늦게 로드되면 다음ScrollArea상태 변화 전까지 네이티브 scrollbar가 남을 수 있습니다.- 컴포넌트 CSS 자동 로드는 CSS Modules를 처리하는 번들러(Next.js, Vite 등)를 전제로 합니다. 번들러가 없거나 CSS Modules를 처리하지 못하는 환경에서는 아래 CSS-only 환경 절의
styles.css를 사용합니다.
Documentation
이 패키지는 상세 가이드를 docs/로 함께 배포합니다. 설치 후 node_modules/@orioncactuscorp/ui/docs/에서 설치 버전과 일치하는 문서를 바로 읽을 수 있고, 웹에서는 https://cdn.jsdelivr.net/npm/@orioncactuscorp/[email protected]/docs/<파일명>으로 볼 수 있습니다.
| 문서 | 내용 |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| API Naming Conventions | variant, appearance, size prop의 역할과 명명 규칙 |
| Selector Contract | data-oc-* 기반 커스터마이즈 계약 — 컴포넌트별 selector/slot/state 표 |
| CSS Variables | 컴포넌트별 contract 변수의 override·읽기 전용·internal 구분 |
| Semantic Colors | 59개 semantic color의 역할, light/dark 기본값, pairing 규칙 |
| Typography | 19개 variant의 용도, responsive stop, line-height, weight |
| SCSS Helpers | oc-border, oc-radius, oc-inner-radius, oc-outer-radius, oc-corner-inset, oc-focus-ring, oc-alpha, oc-easing-gradient, oc-gradient-mask, oc-fluid, typo, respond-to |
| Semantic Motion | intent/phase/pace 기반 motion 계약과 reduced-motion 정책 |
| Spring Motion | 단일 spring과 기준 경로를 추종하는 gentle 모델의 CSS·runtime 지원 |
| Responsive Foundation Profile | typo/space responsive 출력 mode 컴파일 설정 |
| Overlay Stacking | z-index 의미 단계와 중첩 portal boundary 규칙 |
| Token Reference | --oc-* foundation 토큰 전체 목록 |
| Stability Policy | 버전 라인, 공개 계약 범위, SemVer 기준, deprecation, 프리릴리즈 채널 |
| Editor Setup | VS Code CSS 변수 자동완성 설정 |
입력 추적·자유 플링·모션 설정·ref를 함께 사용하는 방법은 제스처 표면 조합 가이드를 참고하세요.
Components
HistoryNavigationButton,useNavigationHistory— 버튼 종류와 독립적인 방문 기록 이동 (가이드)SectionHeaderButton,TextButton,IconButton,BackgroundIconButtonPositionSnap,PositionSnapRoot,PositionSnapPositioner,PositionSnapHandleActionArea,ActionAreaButton,ActionAreaLayoutBadge,Background,Divider,Loading,ProgressIndicator,Skeleton,Thumbnail,Cell,CellItemReveal/RevealProvider/RevealGroup— 준비된 콘텐츠의 한 번 등장·visible 제어 등장/퇴장,fade·slide·blur, 마운트·viewport 조건, 영역별 기본값과 본문→항목의 공통 등장 순서RevealText— 문장을 단어(어절)·글자 단위로 차례대로 등장. Reveal과 같은 등장 정책, 재생 중에만 분리AnimatedNumber— 값이 바뀔 때 바뀐 자리만 움직이는 숫자.Intl.NumberFormat서식,slide·blur·roll변화AnimatedText— 문장 안의 텍스트가 값 변경에 따라 전환.blur·slide·fade, 단어·글자 단위 시차, 너비 보간으로 주변 문장이 밀림.AnimatedTextScope로 문장을 감싸면 뒤 문장이 모든 엔진에서 부드럽게 이동PageIndicator— 캐러셀 페이지 위치를 점으로 표시.onIndexChange로 클릭, 작은 끝 점·탭 펼치기, 드래그·길게 눌러 넘기기 지원.useScrollSnapIndex와 조합 (가이드)CheckMarkField,FieldLabel,FieldControl,FieldMessage,FieldErrorMessage(vertical/horizontalorientation)InputGroup,InputGroupInput,InputGroupSeparator— 분할 입력과 공통 라벨 (포커스 가이드)Fieldset,FieldLegend,FieldsetContent,FieldGroupCheckbox,Radio,Switch- 단순 상태 관리에는
onCheckedChange(checked), form 통합에는 nativeonChange를 사용하세요 (발화 순서:onChange→onCheckedChange).CheckMark동일.
- 단순 상태 관리에는
FramedCard,FramedCardAction— 주 대상 하나(Radio·Checkbox또는 버튼·링크FramedCardAction)를 감싸 카드 전체를 그 대상의 영역으로 만드는 framed 표면. 상태는 주 대상에서 읽고, 보조 액션은trailing에 두며, 주 대상이 없으면 정적 프레임입니다TextInput,TextInputContentTextInput variant='underlined'로 밑줄형을 선택하고, 세로Field labelPlacement='floating'안에서 기존FieldLabel을 입력값에 따라 이동·축소할 수 있습니다.
TextArea,TextAreaContentSelect,SelectContentMenuRoot,MenuTrigger,MenuContent,MenuItem,MenuSeparatorAlert,AlertRoot,AlertContent,AlertHeading,AlertDescription,AlertActionArea,AlertActionActionSheet,ActionSheetRoot,ActionSheetTrigger,ActionSheetContent,ActionSheetAction,ActionSheetCancel— 사용자가 시작한 행동에 선택지를 되묻는 표면. 누른 컨트롤을 덮으며 열리고 바깥을 누르면 취소. trigger가 없으면 화면 가운데에 뜸Accordion,AccordionItem,AccordionSummary,AccordionDetails,AccordionDescription,AccordionContentTabsRoot,TabsList,TabsTab,TabsPanelCarouselRoot,CarouselSlide— scroll-snap slide·드래그 크로스페이드 fade 캐러셀과 스토리형 자동 넘김 표시SegmentedControlRoot,SegmentedControlItem— 하나의 값을 고르는 radio group. panel 전환은 Tabs 사용SegmentedProgressRoot,SegmentedProgressItem— 구간별 진행률 막대와 구간 이동. 탭 버튼이나 섹션 링크로 조합하고, 현재 구간 전환 모션과 시간으로 채우기(current·duration)를 제공Slider— 범위 안에서 값 하나 또는 구간을 고르는 슬라이더.step단계와 눈금(marks) 지원Modal,ModalRoot,ModalTrigger,ModalContent,ModalHeader,ModalNavigationSection,ModalBody,ModalFooter,ModalCloseFloatingWindow,FloatingWindowManager,FloatingWindowRoot,ModalWindowRoot,FloatingWindowTrigger,FloatingWindowContent,FloatingWindowDragHandle,FloatingWindowHeader,FloatingWindowNavigationSection,FloatingWindowBody,FloatingWindowFooter,FloatingWindowTitle,FloatingWindowDescription,FloatingWindowCloseTooltipProvider,TooltipRoot,TooltipTrigger,TooltipContentPopoverRoot,PopoverTrigger,PopoverContent,PopoverBody,PopoverHeader,PopoverTitle,PopoverDescription,PopoverMedia,PopoverPages,PopoverPage,PopoverClose— 트리거에 붙는 비차단 표면. 누르면 열리는 패널, 머무르거나 길게 눌러 보는 미리보기, 처음부터 열려 있는 안내ScrollArea,ScrollAreaContainer,ScrollAreaEdgeEdgeMask— 스크롤 축 양 끝을 투명하게 만드는 장식용 마스크(fade, 배경과 무관하게 투명한progressive-blur). 정적인 장식 콘텐츠 전용SvgIcon,InteractionInteractionScope— 나란히 놓인 컨트롤 사이에서 hover 표시 하나가 이동하는 공유 hover
ScrollArea는 네이티브 스크롤과 브라우저의 키보드·포커스 동작을 유지하면서 scrollbar의 시각과 포인터 조작을 제공합니다. 커스텀 scrollbar는 보조기술에서 숨기며, 스크롤 영역에 별도 Tab 정지점이나 landmark를 자동으로 만들지 않습니다. 자세한 내용은 selector contract를 참고하세요.
텍스트만 있는 내부 영역을 Safari 등에서도 키보드로 직접 스크롤해야 한다면 ScrollAreaContainer에 tabIndex={0}, role="region", 접근 가능한 이름을 소비자가 명시할 수 있습니다. 이는 의도적으로 Tab 정지점을 추가하는 선택입니다.
ScrollArea 루트는 각 가장자리 너머에 콘텐츠가 남았는지를 data-oc-overflow-y-start 같은 attribute로 노출합니다. ScrollAreaEdge는 이 상태로 header·footer 아래를 지나는 콘텐츠를 fade 또는 progressive-blur로 처리하는 장식 요소이며, ScrollArea의 직계 자식으로 둡니다. bar 높이는 --oc-scroll-area-edge-inset-block-start/-end로 알려주면 scrollbar track이 bar 바로 아래에서 시작합니다. ModalHeader는 backgroundVariant, scrollEdgeVariant, divider로 같은 처리를 제공합니다.
<ScrollArea style={{ '--oc-scroll-area-edge-inset-block-start': '56px' }}>
<ScrollAreaContainer>{content}</ScrollAreaContainer>
<ScrollAreaEdge side='block-start' variant='progressive-blur' />
<header className='bar'>…</header>
</ScrollArea>InteractionScope
앱 루트를 한 번 감싸면 참여 컴포넌트에 공유 hover가 적용됩니다. client component지만 server component children을 그대로 받으므로 layout을 client로 바꾸지 않아도 됩니다.
// app/layout.tsx
<body>
<InteractionScope>{children}</InteractionScope>
</body>참여 대상, 이동 조건, 영역 제외(hover="individual"), 커스텀 host 참여는 selector contract의 공유 hover 항목을 참고하세요.
PositionSnap
PositionSnap은 Button 같은 독립 control을 viewport 또는 지정한 element의 named position 사이에서 드래그해 안착시키는 compound component입니다. Positioner가 위치 transform을 소유하므로 내부 Button의 transform과 interaction 표현은 유지됩니다. drag="content"는 Positioner 전체에서, drag="handle"은 명시한 PositionSnapHandle에서만 drag를 시작합니다.
import { Button, PositionSnap } from '@orioncactuscorp/ui';
<PositionSnap.Root
positions={['block-end-inline-start', 'block-end-inline-end']}
defaultPosition='block-end-inline-end'
>
<PositionSnap.Positioner>
<Button>도움말</Button>
</PositionSnap.Positioner>
</PositionSnap.Root>;position,defaultPosition,onPositionChange로 controlled/uncontrolled 상태를 구성합니다.- 기본 boundary는 visual viewport이며
boundary에 element를 전달하면 해당 영역 안에서 안착합니다. boundaryPadding은 boundary와 control 사이의 최소 여백입니다.- Modal의 popup
snapPositions는 같은 position geometry와 release 정책을 사용하지만 backdrop, dismissal, scroll arbitration은 Modal이 계속 소유합니다.
Modal bottom sheet
Bottom 모달의 snapPoints는 관성에 따라 여러 스냅을 건너 이동합니다. 상위 스냅에서 아래로 내리면 최하단 스냅까지 이동하고, 최하단에서 다시 내릴 때 닫힘을 평가합니다. 낮은 스냅·peek의 그림자는 유지하고 실제 닫힘에서 backdrop과 함께 사라집니다. 자세한 동작은 제스처 가이드를 참고하세요.
다중 스냅 핸들은 클릭·탭 및 Enter·Space로 높이를 순환하는 버튼입니다. snapPoint와 onSnapPointChange로 선택을 제어하며, drag={false}에서도 핸들 조작을 사용할 수 있습니다.
non-modal 표시(modal={false})에서 소프트 키보드가 열린 채 배경 문서를 드래그하면 키보드를 닫고, 페이지 스크롤은 키보드가 완전히 닫힌 뒤 다음 제스처부터 동작합니다. keyboardDismiss="none"으로 키보드를 유지할 수 있으며, 그 경우 소비자 앱 viewport meta에 interactive-widget=resizes-content를 추가하는 것을 권장합니다.
키보드가 열린 동안 ModalBody가 스크롤 경계에 도달하고 시트가 더 이동할 수 없으면 해당 방향의 overscroll은 Modal 안에서 멈추며 document pan으로 전파되지 않습니다. 스크롤 범위가 있는 방향의 네이티브 스크롤과 관성은 유지됩니다.
Modal popup 위치
ModalContent position은 드래그 없이 Popup을 배치합니다. 기본값은 center이며 block-start, block-end, inline-start, inline-end와 block-start-inline-end 같은 모서리 조합을 지원합니다. inline 쪽은 글이 흐르는 방향을 따라 RTL에서 좌우가 바뀌고, snapPositions도 같은 값을 씁니다. top, left, top-right 같은 물리 이름은 deprecated 별칭입니다.
<ModalRoot open={open} onOpenChange={setOpen}>
<ModalContent variant='popup' position='block-end' drag={false}>
<ModalHeader title='옵션 선택' />
<ModalBody>선택할 옵션</ModalBody>
</ModalContent>
</ModalRoot>variant="popup"은 모바일에서도 Popup 형태로 viewport 여백 안에 배치됩니다.position="block-end"는 화면 끝에 밀착하는variant="bottom"과 다릅니다.variant="adaptive"에서는 실제 Popup 배치일 때만 적용됩니다. 모바일의 bottom 배치와variant="full"에는 영향을 주지 않습니다.position변경과 viewport·콘텐츠 크기 변경에 맞춰 정렬됩니다. 위치 변경 자체에 별도 이동 애니메이션은 적용하지 않습니다.drag가 활성화되고snapPositions가 비어 있지 않으면 스냅 모드가 우선합니다. 이때position은 무시되며 초기 위치는 기존defaultSnapPosition규칙을 따릅니다.drag={false}로 전환하면position이 적용됩니다.position은 backdrop, focus trap, 닫기 정책을 변경하지 않습니다. 기존 반응형 여백과 곡률도 유지합니다.
Modal initial focus
Modal은 DOM 순서의 첫 control을 기계적으로 선택하지 않습니다. 기본 initialFocus="auto"는 ModalHeader의 title을 tabIndex={-1}인 정적 문맥 시작점으로 포커스하고, title이 없을 때만 첫 tabbable 요소로 fallback합니다. modeless surface는 현재 작업 포커스를 유지합니다.
- 일반 Modal과
ModalWindowRoot는 같은 초기 포커스 정책을 공유합니다. - form은 ref/function으로 첫 입력을, 단순 진행 dialog는 주요 action을 명시할 수 있습니다.
- 되돌리기 어려운 확인 dialog는 취소처럼 가장 덜 파괴적인 action을 ref로 지정하세요.
initialFocus="first-interactive"는 첫 tabbable 요소,initialFocus="title"은 등록된 title을 명시합니다.initialFocus="content"는 dialog container를 포커스하는 호환용 escape hatch입니다. 신규 사용은 title 또는 구체적인 ref/function을 우선하세요.
Modal depth navigation with history
같은 Modal 안에서 view를 교체하는 depth navigation은 ModalRoot의 navigationDepth로 현재 깊이를 알립니다. 이 값은 두 가지 계약을 동시에 가집니다.
0보다 크면 drag, backdrop pointer 같은 암묵적 닫기가 기본 차단됩니다.dismissBehavior로 reason별 정책을 조정할 수 있습니다.contentTransition="auto"인 popup은navigationDepth변경을 명시적 교체 신호로 사용합니다. view와 depth가 같은 커밋에서 바뀌면 surface가 이전 높이를 고정한 채 새 높이로 전환하므로 목적지 레이아웃이 먼저 보이는 플래시가 없습니다.
const history = useNavigationHistory({
initialEntry: { screen: 'settings', title: '프로젝트 설정', depth: 0 },
});
const view = history.current.value;
const targets = history.backEntries.map(entry => ({
key: entry.key,
label: entry.value.title,
}));
<ModalRoot
open={open}
onOpenChange={setOpen}
navigationDepth={view.depth}
onOpenChangeComplete={nextOpen => {
if (!nextOpen) history.reset();
}}
>
<ModalContent variant='popup' resize='content'>
<ModalHeader
title={view.title}
titleOverflow='wrap'
backButton={{ targets, onNavigate: history.goTo }}
/>
<ModalBody>{renderScreen(view.screen)}</ModalBody>
<ModalFooter>
<ActionArea variant='neutral'>{actions}</ActionArea>
</ModalFooter>
</ModalContent>
</ModalRoot>;navigationDepth는 계층 깊이이며 방문 기록의 현재 index가 아닙니다. 같은 depth의 다른 화면도 별도 방문 기록으로 남길 수 있습니다. 이동은push·back·forward·goTo로 요청하고 라우터, 폼 검증과 입력값 보존은 소비자가 관리합니다.ModalHeader backButton은HistoryNavigationButton(direction="back")을 header 맨 앞에 렌더링합니다.targets가 비어 있으면 렌더링하지 않으므로 루트에서 조건부로 감출 필요가 없습니다. 표시 여부는navigationDepth가 아니라 돌아갈 기록으로 정합니다.leadingContent를 함께 지정하면 뒤로 버튼 다음에 놓입니다. 나머지 props(label,historyMenu,render등)는HistoryNavigationButton과 같습니다.Header의 leading·title·trailing 영역 사이 간격은
--oc-modal-header-gap으로 조절합니다. 기본값은--oc-space-item-gap-small이며ModalContent또는ModalHeader에 지정할 수 있습니다.Modal의 단계 이동에는 뒤로 버튼과 footer의 다음 액션을 조합하세요.
forward는 공통 history API로 제공하지만 Modal 예시에는 앞으로 버튼을 추가하지 않습니다.화면마다 의미 있는
title을 두고 Modal 제목과 기록 메뉴 label에 재사용하세요. 복잡한 제목 JSX에는 별도의 문자열 label을 제공하세요.ModalHeader titleOverflow="wrap"은 긴 제목과 공백 없는 문자열을 줄바꿈합니다. 기본ellipsis는 기존 한 줄 표시를 유지하며 원문을 DOM에 보존하지만 Tooltip을 자동 생성하지 않습니다. 말줄임을 선택하면 터치·키보드에서도 사용할 수 있는 원문 펼치기 또는 다른 명시적 확인 경로를 제공하세요. Tooltip은 보조 수단이며 history hold 동작 위에 중첩하지 않습니다.화면 이동 후 새 제목이나 적절한 요소로 포커스를 반드시 이동하세요. 마지막 기록에서 뒤로 버튼이 사라지거나 disabled가 되면 해당 버튼으로 포커스를 복원할 수 없습니다. 이 처리는 화면 owner가 맡고, 메뉴의 닫힘 포커스 복원 이후에도 유지되는지 확인하세요. 뒤로가기와 Modal 닫기는 별도 의도이며 루트에서 자동 닫기나 Escape 뒤로가기를 추가하지 않습니다.
닫을 때는
navigationDepth와 view 상태를 그대로 두세요. surface는 exit transition 동안 계속 렌더링되므로onOpenChange(false)에서 depth를0으로 되돌리면 사라지는 surface 아래에서 root view로 교체되어 높이가 튑니다. 초기화는 다시 열 때(onOpenChange(true)) 하거나, exit가 끝난 뒤 호출되는onOpenChangeComplete(false)에서 하세요.depth 하나당 한 번의 이산 교체를 전제로 합니다. depth를 바꾸는 커밋에서 자체 애니메이션 콘텐츠를 함께 시작하면 surface가 그 애니메이션을 뒤따라가므로, 펼침 같은 in-place 모션은 depth 전환이 끝난 뒤 시작하세요.
전환 중 header나 footer 측정값이 늦게 반영되어 목표 높이가 바뀌면 진행 중인 전환이 새 목표로 재타겟됩니다. footer의 스크롤 배경과 여백은 목적지 scrollport 기준으로 판정되어 전환 중 깜빡이지 않습니다.
ModalFooter와 headerbottomContent는 depth 0부터 유지하는 구성을 권장합니다. 조건부로 마운트해도 높이 전환은 동작하지만 chrome 자체는 즉시 나타나고,ActionArea버튼 등장에는 별도 모션 계약이 없습니다. 버튼이 없는ActionArea는data-oc-empty="true"로 접혀 footer 예약 없이 body의 기본 하단 여백만 남습니다.ModalBody안의TabsPanel교체는navigationDepth없이도 화면에 그려지기 전에 감지합니다.keepMounted유무와 제어형value변경 모두 이전 높이에서 새 높이로 전환하며, 탭 선택을 depth 값으로 변환할 필요는 없습니다.ModalBody안에서 노드 추가·제거, 텍스트 변경,style외 속성 변경으로 즉시 바뀌는 콘텐츠도 화면에 그려지기 전에 감지해 이전 높이에서 새 높이로 전환합니다. 자체 애니메이션 중인 콘텐츠는 surface가 자연스럽게 따라갑니다.inline
style만 바뀌는 변경, 이미지 로드, header/footer 콘텐츠 변경은 안착한 이산 변화만 best-effort로 전환하므로 목적지 레이아웃이 한 프레임 먼저 보일 수 있습니다. depth view 교체에는navigationDepth를 사용하세요.bottom sheet는 콘텐츠 높이 변화를 sheet motion 계약(canvas settle)으로 처리합니다.
navigationDepth변경 커밋에서는 콘텐츠를 즉시 다시 재어 같은 프레임에 settle을 시작하고, 전환 중 header/footer 측정값이 늦게 반영되면 진행 중인 속도를 이어받아 새 목표로 재타겟합니다.높이 전환이 필요 없거나 자체 animation을 사용하는 경우
contentTransition="none"을 지정하세요.
FloatingWindow
FloatingWindowRoot는 trigger 또는 명시적 anchor를 기준으로 collision-aware 배치되는 modeless dialog가 기본입니다. ModalWindowRoot는 같은 geometry에 focus trap, 배경 입력을 차단하는 backdrop, Modal popup scale/fade motion을 적용합니다. 필요한 경우에만 FloatingWindowContent backdrop="hidden"으로 dimmer를 숨길 수 있으며 modal focus와 배경 inert 정책은 유지됩니다. Header, Body, Footer, NavigationSection은 Modal 기본 presentation을 공유합니다.
import {
FloatingWindowBody,
FloatingWindowContent,
FloatingWindowFooter,
FloatingWindowHeader,
FloatingWindowManager,
FloatingWindowRoot,
FloatingWindowTrigger,
ActionArea,
ActionAreaButton,
} from '@orioncactuscorp/ui';
<FloatingWindowManager>
<FloatingWindowRoot windowId='notes'>
<FloatingWindowTrigger>메모 열기</FloatingWindowTrigger>
<FloatingWindowContent placement='right-start' resize='fixed'>
<FloatingWindowHeader title='프로젝트 메모' />
<FloatingWindowBody>임의 콘텐츠</FloatingWindowBody>
<FloatingWindowFooter>
<ActionArea variant='neutral'>
<ActionAreaButton priority='alternative'>취소</ActionAreaButton>
<ActionAreaButton priority='main'>저장</ActionAreaButton>
</ActionArea>
</FloatingWindowFooter>
</FloatingWindowContent>
</FloatingWindowRoot>
</FloatingWindowManager>;- modeless 창은 외부 pointer 작업으로 닫히지 않으며 Escape와 명시적 close로 닫습니다.
placement또는side+alignment는 trigger 기준 배치를 정합니다.placement는side또는side-alignment(bottom-start,right-end등)이며side와alignment보다 우선합니다.bottomLeft같은 camelCase 이름은 deprecated 별칭입니다.- 기본 collision 정책은 주축
flip, 정렬축shift입니다. 따라서 오른쪽 공간이 부족한right창은 왼쪽으로 전환되고, 아래 공간이 부족한bottom창은 위쪽으로 전환됩니다. anchor로 trigger 대신 element, ref, resolver 함수를 기준점으로 사용할 수 있습니다. 열려 있는 anchored window는 anchor가 크기 변화 없이 layout에서 이동해도 좌표를 다시 맞춥니다.- 창을 drag하면 anchor에서 분리되어 free window가 됩니다.
position은 controlled 자유 좌표,defaultPosition은 처음부터 분리된 초기 좌표입니다. onPositionChange는 anchor 재배치, drag, viewport 보정 중 좌표 변경을 알리고,onPositionCommit은 drag 종료 좌표를 저장할 때 사용합니다.collisionBoundary는 기본 viewport이며 특정 element를 전달하면 해당 element의 화면상 rect를 배치·이동 경계로 사용합니다.- 기본
dragHandleVisibility={48}은 viewport 높이가 줄어도 drag handle의 48px을 남겨 창을 복구할 수 있게 합니다. resize="fixed"는 Modal popup과 같은 고정 높이 surface를 사용합니다. Body가 넘치면 내부만 스크롤되고 Header와 Footer의 경계 상태가 자동 갱신됩니다.- Footer의 기본 action 조합은 Modal과 동일하게
ActionArea와ActionAreaButton을 사용합니다. ModalWindowRoot는 배경을 inert 처리하고 focus를 가두는 application modal입니다. 배경 pointer 작업만 허용하고 focus는 창에 유지해야 하면FloatingWindowRoot modal='trap-focus'를 사용합니다.- modeless
FloatingWindowRoot는 기본적으로 현재 focus를 유지하며,ModalWindowRoot는 Modal과 동일하게 등록된 title을 초기 focus로 사용합니다.initialFocus를 명시하면 두 root 모두 해당 정책을 우선합니다. FloatingWindowClose의 접근성 이름은 명시한aria-label을 우선하고, 없으면label(기본값닫기)을 사용합니다.FloatingWindowHeader와FloatingWindowNavigationSection은 surface 최상단을 소유하는 대체형 chrome입니다. Navigation을 사용할 때는 title이 기본적으로 dialog 접근성 이름을 제공합니다.- Header와 명시적인
FloatingWindowDragHandle에서 drag를 시작할 수 있습니다. 내부 interactive element는 자동 제외되며 custom interactive target은data-oc-window-no-drag를 선언할 수 있습니다. FloatingWindowManager는 열린 창을 등록하고 open, pointer, focus 활성화 순서에 따라 Modal과 공유하는 global stack level을 정규화합니다. Manager 안의 각 root에는 고유한windowId가 필요합니다.- Escape와 outside dismissal은 활성 창 하나에만 적용됩니다. 활성 창의 종료 모션이 끝나면 바로 아래 창이 활성화되며, 개별 창의 geometry나 position 저장은 Manager가 소유하지 않습니다.
- 비활성 modeless 창의 명시적 Close는 창을 활성화하거나 최상단으로 올리지 않고 현재 stack 위치에서 종료합니다.
- modeless 창의 활성화는 stacking만 변경하며 포커스를 강제로 이동하지 않습니다. 닫힐 때의 포커스 복원은 각 Dialog trigger 계약을 따릅니다.
- modal과
trap-focus창은 focus isolation을 보호하기 위해 modeless 창보다 위에 유지됩니다. 같은 modality tier 안에서는 최근 활성화한 창이 위로 이동합니다. - focus-owning 창이 여러 개 열리면 활성 창 하나만 실제 modal/inert owner가 됩니다. 아래 modal은 요청한 modality와 stack tier를 유지한 채 대기하고, 위 창 종료 후 focus isolation을 승계합니다.
- Manager 밖의 창도 Modal과 같은 global stack에 자동 등록됩니다.
onActivate는 외부 coordinator를 위한 unmanaged escape hatch이며,stackLevel은 자동 depth에 더해지는 수동 offset입니다. Manager 안에서는 manager가 계산한 자동 stack level이 우선합니다.
Tooltip 접근성
Tooltip 내용은 트리거의 이름이나 설명으로 연결되지 않는 시각 보조 정보입니다. 팝업에 role="tooltip"을 두지 않고 트리거에 aria-describedby를 연결하지 않으므로 보조기술은 Tooltip 내용을 읽지 않습니다.
TooltipTrigger는 Tooltip과 같은 의미의 접근 가능한 이름을 직접 가져야 합니다. 텍스트가 없는 트리거에는aria-label이나aria-labelledby를 지정하세요. 이미지 트리거는 대체 텍스트로 이름을 제공할 수 있습니다.TooltipTrigger는aria-*,id, 이벤트 핸들러,ref같은 native 속성을 트리거 요소나render요소에 전달합니다. 이벤트 핸들러는tapToOpen·long-press 동작과 함께 실행됩니다.disabled는 받지 않습니다.- 개발 빌드에서 이름을 찾지 못한 트리거에는 콘솔 경고를 한 번 출력합니다.
- 터치나 보조기술 사용자에게 필요한 정보는 Tooltip에 두지 말고 화면에 직접 표시하세요.
<TooltipTrigger aria-label='다운로드'>
<IconDownload />
</TooltipTrigger>
<TooltipContent>다운로드</TooltipContent>Popover
Popover는 트리거에 붙는 비차단 표면입니다. 트리거 이름을 되풀이하는 짧은 문구는 Tooltip, 액션 목록은 Menu, 배경을 막아야 하는 작업은 Modal을 쓰고, 그 밖의 고유한 정보와 임의 콘텐츠에 Popover를 씁니다.
openOn="click"(기본)은 누르면 열리고 포커스가 안으로 들어갑니다. 버튼·입력 같은 컨트롤을 담을 수 있습니다.openOn="hover"는 미리보기입니다. 마우스는 머무르면, 키보드는 포커스하면, 터치는 길게 누르고 있는 동안 열립니다. 누르기는 트리거 자체의 동작으로 남고 포커스가 들어가지 않으므로 컨트롤을 담지 않습니다. 미리보기로만 닿을 수 있는 필수 정보는 두지 마세요.- 처음부터 열려 있는 안내는
open으로 제어하고, 어떤 사유로 닫을지는onOpenChange의reason으로 정합니다. - 열려 있는 동안 내용이 바뀌면 표면 높이가 부드럽게 이어집니다(
PopoverContent의contentTransition, 기본auto). 쪽을 넘기는 안내는 글을PopoverPages/PopoverPage로 나눕니다. 모든 쪽을 겹쳐 두므로 표면 너비가 가장 넓은 쪽(최대 너비까지)으로 고정되고 높이만 이어집니다. 이미지는PopoverMedia의 내용을 바꿉니다.
<PopoverRoot
open={open}
onOpenChange={(nextOpen, { reason }) => {
// 닫기 버튼으로만 닫습니다.
if (!nextOpen && reason !== 'close-press') return;
setOpen(nextOpen);
}}
>
<PopoverTrigger render={<Button />}>기준</PopoverTrigger>
<PopoverContent>
<PopoverClose />
<PopoverMedia>
<img src='/guide.png' alt='' />
</PopoverMedia>
<PopoverBody>
<PopoverHeader>
<PopoverTitle>안내 제목</PopoverTitle>
<PopoverDescription>
안내 내용을 설명하는 문구입니다.
</PopoverDescription>
</PopoverHeader>
</PopoverBody>
</PopoverContent>
</PopoverRoot>역할별 동작과 selector는 Selector Contract의 Popover 계약을 참조하세요.
Customization
컴포넌트 커스터마이즈는 CSS Module 해시가 아니라 안정 data attribute와 component contract 변수를 사용합니다.
[data-oc-component='<name>']— 컴포넌트 루트[data-oc-part='<slot>']— 안정 내부 slot[data-oc-variant],[data-oc-size],[data-oc-state]등 — 시각/상태 selector--oc-{component}-*— component contract 변수 override (CSS Variables에 override로 표시된 변수)
[data-oc-component='cell-item'][data-oc-interactive='true']
[data-oc-part='label'] {
font-weight: 600;
}이 selector들은 버전 관리되는 계약입니다. 컴포넌트별 전체 표는 Selector Contract를 참조하세요.
어떤 변수를 override해도 되나요?
component contract 변수는 세 가지로 나뉩니다. 컴포넌트별 전체 목록은 CSS Variables에 있습니다.
- override: 색, 간격, radius, 크기처럼 브랜드·레이아웃에 맞춰 바꾸는 변수입니다. 컴포넌트 루트(
className이 붙는 요소)에 지정하세요. - 읽기 전용: 컴포넌트가 측정·계산해 노출하는 값입니다.
var()로 읽기만 합니다. - internal: 구현 세부입니다.
--oc-prefix를 쓰더라도 목록에서 internal로 표시된 변수와--_-*변수는 값을 지정하지 마세요. 예고 없이 바뀔 수 있습니다.
.brandButton {
--oc-button-radius: var(--oc-atomic-radius-max);
--oc-button-padding-x: var(--oc-space-item-padding-large);
}목록에 없는 --oc-{component}-* 이름은 계약이 아닙니다.
ScrollArea의 세로 커스텀 스크롤바는 host의 --oc-scroll-area-scrollbar-vertical-inset-inline-start/-end로 위치를 조절합니다. 좌우 분할 화면에서 root 스크롤바를 열 경계로 옮기는 반응형 예시는 CSS Variables의 ScrollArea 항목을 참조하세요.
Exports
| Subpath | 내용 |
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| @orioncactuscorp/ui | 컴포넌트 root barrel |
| @orioncactuscorp/ui/foundations.css | foundation 토큰 + reset 번들 |
| @orioncactuscorp/ui/foundations/*.css | foundation별 부분 CSS. @layer 래핑과 reset이 없으므로 일반 사용은 foundations.css 권장 |
| @orioncactuscorp/ui/reset.css | reset 단독 (foundation module 개별 compile 시 사용) |
| @orioncactuscorp/ui/styles.css | 전 컴포넌트 스타일 단일 파일 (파운데이션 내장). CSS Modules 번들러가 없는 환경용 대안 |
| @orioncactuscorp/ui/scss/* | SCSS source (foundations, mixins) |
| @orioncactuscorp/ui/scss/index.scss | SCSS source compile용 통합 entry (foundation CSS를 방출하므로 foundations.css와 함께 쓰지 않음) |
| @orioncactuscorp/ui/scss/foundations/responsive.config | responsive 출력 mode 설정 |
| @orioncactuscorp/ui/utils/breakpoints | getBreakpoint/getBreakpoints — runtime breakpoint 값 조회 |
| @orioncactuscorp/ui/utils/focus | ocFocus: 명시적 대상 및 첫 이동 가능한 대상에 포커스 (가이드) |
| @orioncactuscorp/ui/react/focus | useAutoAdvance, useInputNavigation: 선택적 자동 이동 및 입력 경계 화살표 이동 |
| @orioncactuscorp/ui/react/scroll | useDragScroll: 단일 축 드래그·관성·CSS 스냅·경계 복귀 (가이드), useScrollSnapIndex: 스냅 페이지 번호·이동 (가이드) |
| @orioncactuscorp/ui/utils/scroll | animateScrollTo: 좌표 이동·가감속·드래그 자동 인계, suspendScrollSnap: 공유 snap 해제 (가이드) |
| @orioncactuscorp/ui/utils/gesture | ocGesture: 경계 저항·복귀·마찰 감속·스냅 감속·투사·속도 추적 (가이드) |
| @orioncactuscorp/ui/utils/spring | ocSpring (gentle({ duration, extraBounce }) 포함), createSpringAnimator |
| @orioncactuscorp/ui/utils/motion | motion intent/phase/pace vocabulary, resolve·Web Animations 시간 유틸 |
| @orioncactuscorp/ui/react/spring | useSpringTarget, useSpringValue |
| @orioncactuscorp/ui/react/motion | MotionExpand, MotionResize, usePrefersReducedMotion, useAutoplayIndex: 재생·정지 선택과 화면 밖·탭 숨김 대기를 갖춘 인덱스 자동 순환 |
| @orioncactuscorp/ui/react/refs | mergeRefs: React 19 ref 결합 (가이드) |
| @orioncactuscorp/ui/utils/fling | createFlingAnimator: 자유 감속과 경계 복귀 (가이드) |
React Server Components
@orioncactuscorp/ui는 root barrel 전체를 client boundary로 승격하지 않고, 실제 client-only component/module entry에만 'use client' directive를 보존합니다. Next App Router Server Component에서 root barrel로 Button 같은 interactive component를 import해도 leaf boundary가 유지되도록 package build에서 검증합니다.
Client Component에 전달하는 prop은 React Server Components의 serializable prop 제약을 따릅니다. Server Component에서 onClick 같은 function prop을 직접 넘겨야 하는 경우에는 해당 사용 지점을 Client Component로 분리하세요.
아이콘 컴포넌트를 받는 prop(leadingIcon, trailingIcon, icon)도 함수 값이므로 같은 제약을 받습니다. 아이콘 element를 받는 자리(CellItem·MenuItem의 leading·trailing, IconButton의 children)는 Server Component에서 그대로 넘길 수 있습니다.
// Server Component에서는 오류: 함수 값은 Client Component에 넘길 수 없음
<Button leadingIcon={IconPlus}>추가</Button>;
// Client Component로 분리한 사용 지점에서는 정상 동작
('use client');
export function AddButton() {
return <Button leadingIcon={IconPlus}>추가</Button>;
}
// element를 받는 slot은 Server Component에서도 사용 가능
<CellItem leading={<IconPlus />} content='추가' />;Foundation
일반적인 사용은 prebuilt foundations.css(토큰 + reset)를 앱 root에서 한 번 import합니다. 컴포넌트 스타일은 컴포넌트를 import할 때 자동으로 로드되므로 별도 import가 필요 없습니다.
import '@orioncactuscorp/ui/foundations.css';문서 기본 스타일과 폰트
reset은 문서 기본값을 지정합니다. 컴포넌트는 이 값을 상속하므로 별도 지정 없이도 같은 글꼴과 색으로 그려집니다.
:root:font-family: var(--oc-typo-font-family),--oc-color-theme-label-normal글자색,--oc-color-theme-background-normal-normal배경body:typo(body1). root에 글자 크기를 두면 모든 rem 값이 함께 바뀌므로 body에 둡니다.- 모두
:where()로 선언해 specificity가 0이고@layer oc-reset안에 있으므로 앱이<html>이나<body>에 지정한 규칙이 항상 우선하고 하위 요소로 상속됩니다. 예를 들어next/font의className을<html>에 붙이면 그 폰트가 페이지 전체에 적용됩니다. data-theme하위 scope는 글자색만 다시 지정합니다. 상속된 색은 선언한 요소에서 계산되기 때문입니다. 하위 scope의 배경은 그 영역의 surface에서 지정하세요.- 배경과 글자색은 theme token을 따르므로, 라이트 화면만 만든 앱도 OS가 다크 모드면 배경이 어두워집니다. 라이트로 고정하려면 아래 Theming처럼
<html>에data-theme='light'를 지정하세요. - 앱의 전역 요소 스타일(
a { color: inherit }등)을 layer 밖에 두면 컴포넌트 스타일까지 덮습니다. 전역 요소 스타일은 oc-ui보다 낮은 layer에 두세요. 규칙과 예시는 selector contract의 Cascade layer 절에 있습니다. - body의 line-height는
body1기준 길이 값입니다. 하위 요소의 글자 크기를 바꿀 때는 줄 간격도 함께 바뀌도록typo()mixin을 사용하세요. lang이ko인 영역은word-break: keep-all로 어절 단위로 줄을 바꾸고, 공백 없는 긴 문자열은overflow-wrap: break-word로 넘치지 않게 합니다. 그 안의 다른 언어 영역은 그 언어의 기본 줄바꿈으로 돌아갑니다. 중국어·일본어는 글자 단위로 바꾸고, WebKit에서도 영어 하이픈 뒤 줄바꿈이 유지됩니다. 규칙은 언어가 바뀌는 지점에만 있어서lang="ko"를 반복해도 앱이 상위 요소에 지정한 줄바꿈 규칙이 그대로 상속됩니다.
폰트 파일은 포함하지 않습니다. 기본값 --oc-typo-font-family-system은 플랫폼 UI 폰트와 이모지 폰트로 이루어진 시스템 스택입니다. 앱 폰트는 앞에 붙이고 시스템 스택을 fallback으로 남깁니다.
:root {
--oc-typo-font-family:
'Pretendard Variable', var(--oc-typo-font-family-system);
}- 한자·가나·한글은 브라우저가
<html lang>에 맞는 시스템 폰트로 대체합니다. 문서 언어를 지정하세요. - weight는 530~550 같은 중간 값을 씁니다. 시스템 한글 폰트는 Windows에서 굵기가 400·700뿐이라 단계가 합쳐지므로, Windows에서 타이포가 아쉽거나 플랫폼마다 같은 타이포가 필요하면 타입 스케일의 기준 폰트인 Pretendard Variable을 권장합니다.
- 스택 구성 이유,
system-ui우선 설정,next/font연결은 Typography를 참조하세요. - reset 없이 token만 쓰려면 아래 Exports의
foundations/*.css를 사용합니다.
CSS-only 환경 (styles.css)
CSS Modules를 처리하는 번들러가 없는 환경(플레인 <script type="module">, CSS만 다루는 파이프라인 등)에서는 전 컴포넌트 스타일을 담은 단일 파일 styles.css를 사용합니다.
import '@orioncactuscorp/ui/styles.css';styles.css는 파운데이션(토큰 + reset)을 이미 내장합니다. 이 파일을 쓸 때는foundations.css를 함께 import하지 않습니다 — 함께 쓰면 파운데이션이 이중 로드됩니다.- 모든 컴포넌트 CSS를 포함하므로 사용하지 않는 컴포넌트 스타일도 로드됩니다(tree-shaking 없음). 번들러 환경에서는 위 컴포넌트 자동 로드 방식을 권장합니다.
Token Override
브랜드 색처럼 CSS token 값만 바꾸는 경우에는 import 이후 로드되는 CSS에서 필요한 theme selector의 --oc-* 값을 override합니다.
:root,
[data-theme='light'],
[data-theme='dark'] {
--oc-color-theme-primary-normal: #ff5800;
}Theming
prebuilt foundations.css의 theme 동작은 다음과 같습니다.
- 기본은 light theme이고, OS가 dark를 선호하면
prefers-color-scheme: dark로 자동 전환됩니다. data-theme='light'또는data-theme='dark'attribute를 지정하면 system preference와 무관하게 해당 theme으로 고정됩니다.<html>에 지정하면 전체, 하위 요소에 지정하면 해당 서브트리만 적용됩니다.- 각 theme selector는 같은 scope에
color-scheme: light또는color-scheme: dark를 선언해 네이티브 form control, scrollbar 등 브라우저 UI도 theme과 일치시킵니다. 이 동작을 원하지 않으면 package CSS import 이후 원하는 scope에서color-scheme을 override하세요. 문서 전체의<meta name='color-scheme'>와theme-color설정은 소비자 앱이 담당합니다. next-themes처럼color-scheme을 inline style로 관리하는 도구를 함께 사용하면 inline 선언이 foundation CSS보다 우선합니다. foundation에 제어를 위임하려면 해당 도구의 중복 제어를 끄고, 직접 관리한다면data-theme과 같은 값으로 유지하세요.- 위 brand override 예시가
:root와 두[data-theme]selector를 모두 덮는 이유는 이 세 가지 적용 경로를 전부 커버하기 위해서입니다. theme별로 다른 값이 필요하면 selector를 나눠 지정하세요.
theme 출력 자체를 바꾸려면(예: light 전용 출력, system preference 자동 전환 제거) SCSS foundation source를 compile하면서 color.config를 설정합니다.
@use '@orioncactuscorp/ui/scss/foundations/color.config' with (
$oc-color-themes: (
light,
),
$oc-color-system-preference: false
);$oc-color-themes: 출력할 theme 목록 (light,dark). 하나만 두면 그 theme이:root기본값이 됩니다.$oc-color-system-preference:prefers-color-scheme자동 전환 media 출력 여부입니다.
Foundation별 커스텀 방식은 아래 기준으로 나눕니다.
| 대상 | 기본 방식 | SCSS source compile 필요 여부 |
| ------ | --------------------------------------------------------- | --------------------------------------------------------------------------- |
| color | --oc-color-theme-* override | theme 출력 범위나 system preference 설정 변경 시 |
| typo | $oc-typo-size-overrides, $oc-typo-height-overrides | 필요 |
| space | $oc-space-overrides | 필요 |
| atomic | radius, width, blur, shadow 같은 --oc-atomic-* override | 보통 불필요 (radius stop 값을 $oc-atomic-radius-overrides로 바꿀 때 필요) |
--oc-typo-size-factor은 특정 요소나 section 안의 typography를 함께 키우거나 줄일 때 쓰는 runtime multiplier입니다. 예를 들어 article 영역의 읽기 크기를 전반적으로 키워야 할 때 해당 scope에 --oc-typo-size-factor: 1.1처럼 지정할 수 있습니다. html { font-size } 조정과는 영향 범위가 다릅니다 — root font-size는 rem 기반 typography·spacing·radius 전체를 움직이고, --oc-typo-size-factor는 typo mixin이 출력한 font-size/line-height에만 적용됩니다.
--oc-atomic-radius-factor는 atomic radius와 radius helper를 거친 component-local radius를 함께 키우거나 줄이는 runtime multiplier입니다. 0으로 지정하면 --oc-atomic-radius-max를 포함한 radius token이 모두 각진 형태가 되며, 기존 --oc-atomic-radius-* token 이름은 그대로 유지됩니다.
Focus Ring
키보드 포커스(:focus-visible) ring은 reset 레이어의 전역 기본값으로 제공됩니다. 키보드 포커스를 받는 모든 요소에 자동 적용되며, ring은 요소의 border-radius를 그대로 따라갑니다. <Interaction focusRing />을 둔 컨트롤은 hover 때 보이는 영역(Interaction 박스)에 ring을 그리고, 내용을 담는 영역(tabpanel, 스크롤 영역 등)은 자기 가장자리 안쪽에 그립니다. ScrollArea는 --oc-scroll-area-edge-inset-block-*로 덮인 구간을 뺀, 보이는 구간에 ring을 그립니다. text-entry 컨트롤(input/textarea/select)은 제외되고 Field 계열의 :focus-within stroke가 포커스를 표현합니다.
--oc-focus-ring-width,--oc-focus-ring-offset— 두께/offset 토큰--oc-color-theme-focus-ring— ring 색 (기본:--oc-color-theme-primary-normalalias, theme별 override 가능)- 포커스를 받는 요소와 보이는 표면이 다른 커스텀 컨트롤에서만
@include oc-focus-ring믹스인을 사용합니다. - opt-out: 전역 규칙은
:where()라 specificity 0입니다. 해당 요소에outline: none을 선언하면 덮어집니다 (프로그램 포커스 표면 등).
SCSS Profile
글자와 간격 token이 viewport 폭에 따라 어떻게 바뀔지는 SCSS compile 시점에 정합니다. prebuilt foundations.css와 styles.css는 기본 구성으로 빌드되어 있습니다.
| 원하는 동작 | 구성 |
| ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
| 글자와 컴포넌트 크기는 고정, 화면 여백만 769px에서 한 번 전환 (기본값) | prebuilt foundations.css 그대로 |
| 글자와 간격이 viewport 폭에 따라 연속으로 변함 | 아래 Fluid 설정 |
| 그 밖의 조합 (전부 고정, 폭 구간마다 전환, 일부 그룹만 fluid 등) | scss/index.scss를 with()로 설정 (Responsive Foundation Profile) |
기본 구성에서는 body1이 16px, --oc-space-item-padding-small이 16px로 모든 폭에서 같고, 화면 여백(--oc-space-section-padding-viewport-x/-y)만 769px부터 16px에서 32px/24px로 바뀝니다. radius(--oc-atomic-radius-*)도 모든 폭에서 md 값으로 고정되어 --oc-atomic-radius-large는 12px입니다.
Fluid
Fluid 설정은 typography와 spacing token을 breakpoint 사이에서 clamp()로 연속 보간합니다. 예를 들어 1440px에서 body1은 18px, 화면 여백 가로는 48px입니다. Sass compile이 필요합니다.
SCSS 파일을 하나 만듭니다.
// styles/foundations.scss @use '@orioncactuscorp/ui/scss/index.scss' with ( $oc-responsive-mode: fluid );앱 root에서
foundations.css대신 이 파일을 import합니다.import './styles/foundations.scss';
scss/index.scss는 foundation token과 reset을 함께 방출합니다. token은 prebuilt foundations.css와 같은 @layer oc-tokens에, reset은 @layer oc-reset에 들어가므로 token override 작성 기준도 같습니다. foundations.css와 reset.css를 함께 import하지 않습니다. 컴포넌트 스타일은 이 경우에도 컴포넌트를 import할 때 자동으로 로드됩니다. color 설정이나 token override도 같은 with()에 넣습니다.
styles.css(CSS-only 환경)는 기본 구성 foundation을 내장하므로 이 설정을 적용할 수 없습니다. Fluid가 필요하면 번들러의 컴포넌트 CSS 자동 로드와 위 SCSS 파일로 전환합니다.
그 밖의 설정
글자만 fluid, 화면 여백만 fluid, 폭 구간마다 전환, 전부 고정, stop 범위 지정은 Responsive Foundation Profile을 참조하세요. 문서 맨 위 표에 원하는 동작별 설정 한 줄과 폭별 결과 값이 있습니다.
SCSS Helpers
SCSS mixin/function 전체 시그니처와 예시는 SCSS Helpers 가이드를 참조하세요. 아래는 대표 helper 요약입니다.
| Helper | 모듈 | 용도 |
| ----------------------------------------- | ------------------------ | ----------------------------------------------------------------------- |
| oc-border(...) | scss/mixins/element | layout에 영향 없는 box-shadow surface stroke (side/placement 지정 가능) |
| oc-radius($radius) | scss/mixins/radius | 컴포넌트 로컬 radius를 전역 radius factor에 연결 |
| oc-inner-radius($outer-radius, $inset) | scss/mixins/radius | 안쪽으로 들어간 surface의 같은 중심 radius |
| oc-outer-radius($inner-radius, $outset) | scss/mixins/radius | 바깥으로 커진 surface의 같은 중심 radius |
| oc-corner-inset($outer-radius, $radius) | scss/mixins/radius | 둥근 모서리 곡선을 피하는 요소 위치 |
| @include oc-focus-ring | scss/mixins/focus | foundation 토큰 기반 :focus-visible ring |
| @include oc-focus-ring-inward | scss/mixins/focus | 여유를 낼 수 없는 자리에서 ring을 표면 안쪽에 그림 |
| oc-alpha($color, $opacity) | scss/mixins/color | CSS 변수 색상에도 동작하는 color-mix 기반 알파 |
| oc-easing-gradient(...) | scss/mixins/gradient | smoothstep 색 변화율을 적용한 4방향 linear gradient |
| @include oc-gradient-mask(...) | scss/mixins/gradient | fade 길이와 content 길이를 조정하는 양끝 gradient mask |
| @include oc-gradient-mask-edges(...) | scss/mixins/gradient | 2D scroll content의 네 edge를 교차 합성하는 gradient mask |
| @include typo($variant, $weight) | scss/mixins/typo | typo 토큰 조합 출력 (--oc-typo-size-factor 반영) |
| @include respond-to(...) | scss/mixins/breakpoint | breakpoint media query (named/직접 값/구간) |
| oc-fluid(...) | scss/mixins/fluid | 커스텀 fluid 값 생성 |
| toRem($px) | scss/mixins/utils | px→rem 변환 |
@orioncactuscorp/ui/scss/mixins/element는 요소 표면을 구성할 때 쓰는 SCSS helper를 제공합니다.
oc-border는 실제 CSS border 대신 inset box-shadow로 안쪽 border를 그립니다. 요소의 content, padding, layout 크기를 바꾸지 않는 surface stroke가 필요할 때 사용합니다.
@use '@orioncactuscorp/ui/scss/mixins/element' as *;
.surface {
@include oc-border;
}
.surfaceAccent {
@include oc-border(var(--oc-color-theme-primary-normal));
}
.surfaceInvalid {
@include oc-border(1.5px, var(--oc-color-theme-status-negative));
}@include oc-border는1px currentColorinset border를 출력합니다.@include oc-border(black)처럼 색상만 넘기면1px blackinset border를 출력합니다.@include oc-border(1.5px, var(--color))처럼 width와 color를 함께 넘길 수 있습니다.1.5px,2.5px,3.5px같은 half-pixel px width는 WebKit/DPR 보정을 함께 출력합니다.
oc-radius($radius, $factor-token: var(--oc-atomic-radius-factor))는 rem, em, px, clamp(...) 기반 radius 값을 전역 radius factor에 연결합니다. 컴포넌트 로컬 radius contract가 typography-relative em 값을 유지하면서도 전역 radius 정책을 따라야 할 때 사용합니다.
@use '@orioncactuscorp/ui/scss/mixins/radius' as *;
.badge {
--oc-badge-radius: #{oc-radius(0.4em)};
}Icons
@orioncactuscorp/ui는 @orioncactuscorp/icons를 dependency로 사용합니다. Checkbox, Radio, Select, Accordion, ModalClose 같은 컴포넌트 내부 indicator를 별도 설정 없이 렌더링합니다.
앱 코드에서 아이콘을 직접 사용할 때는 @orioncactuscorp/icons에서 import합니다.
import { IconClose, IconDefault } from '@orioncactuscorp/icons';@orioncactuscorp/ui는 앱 코드용 icon export를 제공하지 않습니다. 컴포넌트 내부 indicator는 @orioncactuscorp/icons 아이콘으로 고정입니다.
앱 아이콘은 @orioncactuscorp/icons → @orioncactuscorp/montage-icons 순서로 찾고, 둘 다 없으면 @orioncactuscorp/material-symbols-rounded를 쓸지 사용자에게 묻습니다. 앱 코드는 앱 레지스트리 app/icons/index.ts를 거쳐 import합니다. 전체 규칙은 @orioncactuscorp/icons README의 "아이콘 세트 선택" 단락에 있습니다.
Motion
intent별 정책과 reduced-motion 동작 전체는 Semantic Motion 가이드를 참조하세요. Motion은 duration/easing 숫자를 직접 고르는 대신 feedback, fade, disclosure, surface, sheet, expand 같은 intent 기준으로 작성합니다. oc-motion은 intent, phase, pace를 기반으로 duration token, spring profile, reduced-motion 정책을 함께 적용합니다.
@include oc-motion(
$properties,
$intent,
$phase: change,
$pace: normal,
$duration-factor: 1,
$reduced: auto,
$duration-token: null,
$extra-bounce: null
);@use '@orioncactuscorp/ui/scss/mixins/motion' as *;
.button {
@include oc-motion((background-color, color), feedback);
}
.notice {
@include oc-motion(opacity, fade);
}
.popover {
@include oc-motion((opacity, transform), disclosure);
}
.accordionPanel {
@include oc-motion(block-size, expand, $phase: enter);
}일반 컴포넌트와 consumer SCSS에서는 oc-motion을 우선 사용하고, 직접 spring parameter를 설계해야 하는 고급 케이스에서만 oc-spring을 사용합니다.
spring-backed motion의 반동만 국소 조정해야 할 때는 $extra-bounce를 사용할 수 있습니다. non-spring motion에서는 사용할 수 없고, transform entrance처럼 overshoot가 의미 있는 property에 제한적으로 사용합니다.
Motion Factor
Motion factor는 transform scale, 이동 거리, duration의 전역 강도를 조정하는 runtime token입니다. 기본값보다 작으면 효과가 약해지거나 짧아지고, 크면 효과가 강해지거나 길어집니다. 전체 tone은 parent token으로 먼저 맞추고, 특정 intent만 달라야 할 때 child token을 override합니다.
spatial factor는 intent가 아니라 scale/translate amplitude group입니다. disclosure, surface, sheet, expand, move처럼 UI의 공간 관계를 설명하는 motion에 적용됩니다.
| Token | 기본값 | 비고 |
| -------------------------------------- | ---------------------------------- | ---------------------------------------- |
| --oc-motion-scale-factor | 1 | 전체 transform scale amplitude |
| --oc-motion-scale-factor-feedback | var(--oc-motion-scale-factor) | press, hover, selected |
| --oc-motion-scale-factor-spatial | var(--oc-motion-scale-factor) | disclosure, surface, sheet, expand, move |
| --oc-motion-distance-factor | 1 | 전체 translate/reject 거리 |
| --oc-motion-distance-factor-reject | var(--oc-motion-distance-factor) | reject shake |
| --oc-motion-distance-factor-spatial | var(--oc-motion-distance-factor) | disclosure, surface, sheet, expand, move |
| --oc-motion-duration-factor | 1 | 전체 duration. 작으면 빠르고 크면 느림 |
| --oc-motion-duration-factor-reduced | 0.75 | reduced-motion fade/feedback |
| --oc-motion-duration-factor-preserve | 1 | reduced-motion preserve |
| --oc-motion-pace-quick | 0.75 | quick pace duration multiplier |
| --oc-motion-pace-normal | 1 | normal pace duration multiplier |
| --oc-motion-pace-slow | 1.35 | slow pace duration multiplier |
Runtime Motion
React에서 height expand처럼 CSS transition만으로 안정적으로 다루기 어려운 motion은 @orioncactuscorp/ui/react/motion subpath를 사용합니다. MotionExpand는 같은 intent, phase, pace, extraBounce, reduced vocabulary로 열고 닫는 높이를 Web Animations로 움직이고, MotionResize는 열림 상태 없이 내용의 크기가 바뀔 때 상자가 따라가게 합니다.
import { MotionExpand } from '@orioncactuscorp/ui/react/motion';
export function Panel({ open, children }) {
return (
<MotionExpand open={open} forceMount intent='expand' pace='normal'>
{children}
</MotionExpand>
);
}Spring
preset·physical spring·고급 옵션 전체는 Spring Motion 가이드를 참조하세요. SCSS에서는 iOS spring의 perceptual duration 기준으로 low-level transition을 작성할 수 있습니다. helper는 실제 CSS duration을 감쇠 settling duration으로 출력합니다.
transition: oc-spring($property, $duration, $preset: smooth, $extra-bounce: 0);.box {
transition: oc-spring(transform, 0.5s, snappy);
}
.custom {
transition: oc-spring(transform, 0.5s, snappy, 0.1);
}
.menu {
transition: oc-spring(
(
opacity: (
0.3s,
snappy,
),
transform: (
0.3s,
snappy,
0.1,
),
)
);
}property별 tuple은 (duration, preset, extra-bounce, delay, samples) 순서입니다. physical spring과 고급 옵션은 named map을 사용합니다.
TS 런타임에서는 subpath util을 사용합니다.
import {
createSpringAnimator,
ocSpring,
} from '@orioncactuscorp/ui/utils/spring';
const spring = ocSpring.snappy({ duration: 0.5, extraBounce: 0.1 });
spring.settlingDuration; // 실제 CSS transition duration
spring.timingFunction; // linear(...) easing
const animator = createSpringAnimator({
value: { x: 0, y: 0 },
target: { x: 120, y: 80 },
spring,
onUpdate: value => {
element.style.transform = `translate(${value.x}px, ${value.y}px)`;
},
});
animator.setTarget({ x: 240, y: 120 }); // 현재 velocity를 이어받아 retargetReact component에서 spring 값을 렌더링해야 하면 hook subpath를 사용합니다. 일반적인 controlled target UI는 useSpringTarget으로 시작하고, 직접 retarget setter가 필요하면 useSpringValue를 사용합니다.
import { useState } from 'react';
import { useSpringTarget } from '@orioncactuscorp/ui/react/spring';
import { ocSpring } from '@orioncactuscorp/ui/utils/spring';
export function Follower() {
const [target, setTarget] = useState({ x: 120, y: 80 });
const position = useSpringTarget(target, {
value: { x: 0, y: 0 },
spring: ocSpring.snappy({ duration: 0.5 }),
});
return (
<button
type='button'
style={{
transform: `translate3d(${position.value.x}px, ${position.value.y}px, 0)`,
}}
onClick={() => setTarget({ x: 240, y: 120 })}
>
이동
</button>
);
}VS Code CSS Variable Autocomplete
package는 VS Code CSS variable autocomplete 확장(phoenisx.cssvar)이 읽을 수 있는 foundation token index(dist/vscode/oc-ui-vars.css)를 함께 배포합니다. 설정 방법과 트러블슈팅은 Editor Setup을 참조하세요.
참고
- wanteddev/montage-web: foundation, component state, slot, accessibility, interaction 설계 참고
라이선스
MIT
의견 나누기
GitHub 리포지터리 공개를 준비하고 있습니다. 그동안 의견이나 해결이 필요한 경우 [email protected]으로 편히 알려주세요.
