@krds.ui/vue 0.0.12 → 0.0.14

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 CHANGED
@@ -1,160 +1,188 @@
1
1
  # KRDS Vue
2
2
 
3
- > 한국 정부 디자인 시스템(Korea Government Design System)을 기반으로 한 Vue 3 컴포넌트 라이브러리
3
+ > KRDS(Korea Digital Service Design System) 가이드를 Vue 3 + TypeScript 환경에서 사용할 수 있도록 구현한 컴포넌트 라이브러리
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@krds.ui/vue.svg)](https://www.npmjs.com/package/@krds.ui/vue)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- KRDS Vue는 대한민국 정부 표준 디자인 시스템을 Vue 3 + TypeScript로 구현한 공식 컴포넌트 라이브러리입니다. 접근성(WCAG 2.1 AA)과 정부 표준 준수를 핵심 목표로 하며, 정부 및 공공기관 웹사이트 개발에 최적화되어 있습니다.
8
+ KRDS Vue는 공공 웹서비스에서 반복되는 폼, 내비게이션, 레이아웃, 피드백 UI를 일관된 Vue 컴포넌트로 제공하는 라이브러리입니다. KRDS 디자인 토큰과 컴포넌트 스타일을 기반으로 하며, Vue 3 애플리케이션에서 전역 플러그인 또는 개별 컴포넌트 import 방식으로 사용할 수 있습니다.
9
+
10
+ 이 패키지는 **ESM 전용**입니다. CommonJS `require()`는 지원하지 않습니다.
9
11
 
10
12
  ## 링크
11
13
 
12
- - [Storybook 문서](https://krds.initializer.org/) - 컴포넌트 데모 및 API 문서
13
- - [KRDS 공식 홈페이지](https://www.krds.go.kr/html/site/index.html) - 디자인 가이드라인 및 표준
14
+ - [Storybook 문서](https://krds.initializer.org/) - 컴포넌트 예제, Controls, API 문서
15
+ - [npm 패키지](https://www.npmjs.com/package/@krds.ui/vue)
16
+ - [GitHub 저장소](https://github.com/Initializer-org/krds-vue)
17
+ - [KRDS 공식 홈페이지](https://www.krds.go.kr/html/site/index.html)
14
18
 
15
- ## 주요 특징
19
+ ## 특징
16
20
 
17
- - **Vue 3 완전 호환**: Composition API 기반 최신 Vue 3 지원
18
- - **TypeScript 완전 지원**: 완벽한 타입 정의와 IntelliSense 지원
19
- - **정부 표준 준수**: 대한민국 정부 디자인 시스템 공식 가이드라인 준수
20
- - **접근성 우선**: WCAG 2.1 AA 준수, 스크린 리더 및 키보드 내비게이션 완벽 지원
21
- - **40+ 컴포넌트**: 정부 웹사이트 개발에 필요한 다양한 UI 컴포넌트 제공
22
- - **Tree-shaking 지원**: ES 모듈 번들로 최적화된 빌드 사이즈
23
- - **Storybook 문서**: 인터랙티브한 컴포넌트 문서 및 데모
21
+ - **Vue 3 + TypeScript**: Vue 3.5 이상과 타입 정의를 지원합니다.
22
+ - **ESM-only 배포**: modern bundler 환경에 맞춘 ESM 산출물만 제공합니다.
23
+ - **컴포넌트 40+개**: Button, Form, Navigation, Layout, Feedback, Data Display 계열 컴포넌트를 포함합니다.
24
+ - **플러그인/개별 import 지원**: 전체 전역 등록 또는 필요한 컴포넌트만 import할 수 있습니다.
25
+ - **KRDS 스타일/토큰 포함**: 패키지 스타일 엔트리에서 토큰, 폰트, 컴포넌트 CSS를 함께 제공합니다.
26
+ - **접근성 고려**: 키보드 조작, ARIA 속성, 포커스 스타일, 고대비 모드를 고려해 구현합니다.
27
+ - **SSR 친화적 ID 생성**: 내부 ID가 필요한 컴포넌트는 Vue의 ID 생성 흐름을 따릅니다.
24
28
 
25
29
  ## 설치
26
30
 
27
31
  ```bash
32
+ # pnpm
33
+ pnpm add @krds.ui/vue
34
+
28
35
  # npm
29
36
  npm install @krds.ui/vue
30
37
 
31
- # pnpm (권장)
32
- pnpm add @krds.ui/vue
33
-
34
38
  # yarn
35
39
  yarn add @krds.ui/vue
36
40
  ```
37
41
 
38
42
  ## 빠른 시작
39
43
 
40
- ### 1. 스타일 가져오기
44
+ ### 1. 스타일 import
41
45
 
42
- 메인 엔트리 파일(예: `main.ts` 또는 `main.js`)에서 KRDS 스타일을 가져옵니다:
46
+ 애플리케이션 엔트리에서 스타일을 한 번 import합니다. CSS 안의 아이콘 URL은 패키지의 `dist/img` 자산을 기준으로 상대 경로를 사용합니다.
43
47
 
44
- ```typescript
45
- import '@krds.ui/vue/dist/style.css'
48
+ ```ts
49
+ import '@krds.ui/vue/style'
46
50
  ```
47
51
 
48
- ### 2. 컴포넌트 사용
52
+ ### 2. 전역 플러그인 등록
49
53
 
50
- ```vue
51
- <template>
52
- <div>
53
- <KrdsButton variant="primary" size="medium" @click="handleClick">
54
- 확인
55
- </KrdsButton>
56
-
57
- <KrdsInput
58
- v-model="text"
59
- label="이름"
60
- placeholder="이름을 입력하세요"
61
- required
62
- />
63
- </div>
64
- </template>
54
+ ```ts
55
+ import { createApp } from 'vue'
56
+ import KrdsVue from '@krds.ui/vue'
57
+ import '@krds.ui/vue/style'
58
+ import App from './App.vue'
59
+
60
+ createApp(App).use(KrdsVue).mount('#app')
61
+ ```
62
+
63
+ 특정 컴포넌트만 전역 등록할 수도 있습니다.
64
+
65
+ ```ts
66
+ app.use(KrdsVue, {
67
+ components: ['KrdsButton', 'KrdsInput', 'KrdsModal']
68
+ })
69
+ ```
70
+
71
+ ### 3. 개별 컴포넌트 import
65
72
 
73
+ 전역 등록이 필요 없다면 필요한 컴포넌트만 가져옵니다.
74
+
75
+ ```vue
66
76
  <script setup lang="ts">
67
77
  import { ref } from 'vue'
68
78
  import { KrdsButton, KrdsInput } from '@krds.ui/vue'
69
79
 
70
- const text = ref('')
71
-
72
- const handleClick = () => {
73
- console.log('버튼 클릭됨')
74
- }
80
+ const name = ref('')
75
81
  </script>
76
- ```
77
82
 
78
- ## 주요 컴포넌트
83
+ <template>
84
+ <KrdsInput
85
+ v-model="name"
86
+ label="이름"
87
+ placeholder="이름을 입력하세요"
88
+ required
89
+ />
90
+
91
+ <KrdsButton variant="primary" size="medium">
92
+ 확인
93
+ </KrdsButton>
94
+ </template>
95
+ ```
79
96
 
80
- 전체 컴포넌트 목록과 상세 API는 [Storybook 문서](https://krds.initializer.org/)를 참조하세요.
97
+ ## TypeScript
81
98
 
82
- ## TypeScript 지원
99
+ 컴포넌트 props와 공통 타입을 패키지 루트에서 가져올 수 있습니다.
83
100
 
84
- KRDS Vue는 완전한 TypeScript 지원을 제공합니다:
101
+ ```ts
102
+ import type { KrdsButtonProps, KrdsInputProps, Size } from '@krds.ui/vue'
85
103
 
86
- ```typescript
87
- import type { KrdsButtonProps, KrdsInputProps } from '@krds.ui/vue'
104
+ const size: Size = 'medium'
88
105
 
89
- // Props 타입 활용
90
106
  const buttonProps: KrdsButtonProps = {
91
107
  variant: 'primary',
92
- size: 'medium',
108
+ size,
93
109
  disabled: false
94
110
  }
95
111
 
96
- // 이벤트 타입 활용
97
- import type { KrdsInputEmits } from '@krds.ui/vue'
112
+ const inputProps: KrdsInputProps = {
113
+ label: '이름',
114
+ modelValue: '',
115
+ size
116
+ }
117
+ ```
118
+
119
+ ## 스타일과 테마
120
+
121
+ KRDS Vue 스타일은 CSS custom properties를 기반으로 합니다. 프로젝트에서 토큰 값을 조정해야 한다면 원본 CSS를 수정하지 말고 애플리케이션 CSS에서 필요한 변수만 재선언합니다.
98
122
 
99
- const handleInput: KrdsInputEmits['input'] = (value: string) => {
100
- console.log('입력값:', value)
123
+ ```css
124
+ :root {
125
+ --krds-color-light-primary-50: #256ef4;
101
126
  }
102
127
  ```
103
128
 
104
- ## 개발 환경 요구사항
129
+ 컬러 모드는 루트 요소의 `data-krds-mode` 속성으로 전환합니다.
105
130
 
106
- - **Node.js**: >= 20.0.0
107
- - **pnpm**: >= 9.0.0 (권장 패키지 매니저)
108
- - **Vue**: >= 3.5.0 (peer dependency)
131
+ ```ts
132
+ document.documentElement.setAttribute('data-krds-mode', 'high-contrast')
133
+ ```
109
134
 
110
- ## 접근성
135
+ 지원 모드:
111
136
 
112
- KRDS Vue는 WCAG 2.1 AA 수준의 접근성을 준수합니다:
137
+ - `light`: 기본 라이트 모드
138
+ - `high-contrast`: 고대비 모드
139
+ - `theme`: 사용자 시스템 설정에 따라 라이트/고대비 스타일 적용
113
140
 
114
- - 키보드 내비게이션 완전 지원
115
- - 스크린 리더 호환성
116
- - 적절한 ARIA 속성 및 역할
117
- - 색상 대비 및 포커스 표시
118
- - Storybook의 `@storybook/addon-a11y`를 통한 자동 검증
141
+ ## 컴포넌트 범위
119
142
 
120
- ## 기여
143
+ 대표 컴포넌트는 다음과 같습니다. 전체 목록과 props/events는 [Storybook 문서](https://krds.initializer.org/)에서 확인하세요.
121
144
 
122
- KRDS Vue는 오픈소스 프로젝트입니다. 기여를 환영합니다!
145
+ - **Actions**: `KrdsButton`, `KrdsButtonGroup`, `KrdsLink`, `KrdsTag`, `KrdsBadge`
146
+ - **Forms**: `KrdsInput`, `KrdsTextarea`, `KrdsSelect`, `KrdsDateInput`, `KrdsCheckbox`, `KrdsRadio`, `KrdsToggleSwitch`, `KrdsFileUpload`
147
+ - **Navigation**: `KrdsBreadcrumb`, `KrdsPagination`, `KrdsSideNavigation`, `KrdsInPageNavigation`, `KrdsStepIndicator`
148
+ - **Layout**: `KrdsLayout`, `KrdsHeader`, `KrdsFooter`, `KrdsMasthead`, `KrdsIdentifier`
149
+ - **Feedback/Overlay**: `KrdsModal`, `KrdsTooltip`, `KrdsCoachMark`, `KrdsContextualHelp`, `KrdsCriticalAlerts`, `KrdsSpinner`
150
+ - **Data/Content**: `KrdsTable`, `KrdsStructuredList`, `KrdsTextList`, `KrdsPanel`, `KrdsDisclosure`
123
151
 
124
- 1. 버그 리포트나 기능 요청: [GitHub Issues](https://github.com/Initializer-org/krds-vue/issues)
125
- 2. Pull Request: [GitHub Repository](https://github.com/Initializer-org/krds-vue)
152
+ ## 요구사항
126
153
 
127
- ### 개발 환경 설정
154
+ - **Runtime**: Vue `^3.5.0`
155
+ - **Module system**: ESM
156
+ - **Development**: Node.js `>=20.0.0`, pnpm `>=9.0.0`
157
+
158
+ ## 개발
128
159
 
129
160
  ```bash
130
- # 저장소 클론
131
161
  git clone https://github.com/Initializer-org/krds-vue.git
132
162
  cd krds-vue
133
163
 
134
- # 의존성 설치
135
164
  pnpm install
136
-
137
- # 개발 서버 실행
138
- pnpm dev
139
-
140
- # Storybook 실행
141
165
  pnpm storybook
142
-
143
- # 테스트 실행
144
166
  pnpm test
145
-
146
- # 빌드
147
167
  pnpm build
148
168
  ```
149
169
 
150
- ## 라이센스
170
+ 주요 스크립트:
151
171
 
152
- MIT © [Initializer Team](https://github.com/Initializer-org)
172
+ - `pnpm storybook`: Storybook 개발 서버 실행
173
+ - `pnpm test`: Vitest 실행
174
+ - `pnpm build`: 타입 검사와 라이브러리 빌드
175
+ - `pnpm build-storybook`: 정적 Storybook 빌드
153
176
 
154
- ## 관련 링크
177
+ ## 배포 산출물
155
178
 
156
- - [GitHub Repository](https://github.com/Initializer-org/krds-vue)
157
- - [npm Package](https://www.npmjs.com/package/@krds.ui/vue)
158
- - [Storybook 문서](https://krds.initializer.org/)
159
- - [KRDS 공식 홈페이지](https://www.krds.go.kr/html/site/index.html)
160
- - [Issue Tracker](https://github.com/Initializer-org/krds-vue/issues)
179
+ `npm pack --dry-run` 기준으로 패키지에는 다음 산출물이 포함됩니다.
180
+
181
+ - `dist/krds-vue.es.js`
182
+ - `dist/style.css`
183
+ - `dist/types/index.d.ts`
184
+ - `dist/img/component/icon/*.svg`
185
+
186
+ ## 라이선스
187
+
188
+ MIT © [Initializer Team](https://github.com/Initializer-org)
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.64955 4.08082C7.92463 3.94681 8.25205 3.98143 8.49301 4.17001L17.693 11.3702C17.8868 11.5218 18 11.7542 18 12.0002C17.9999 12.2462 17.8867 12.4786 17.693 12.6302L8.493 19.8302C8.25204 20.0188 7.92462 20.0534 7.64955 19.9194C7.37448 19.7854 7.19995 19.5062 7.19995 19.2002V4.80001C7.19995 4.49402 7.37448 4.21484 7.64955 4.08082Z" fill="#256EF4"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.79922 4.8C7.79922 4.35817 7.44105 4 6.99922 4C6.55739 4 6.19922 4.35817 6.19922 4.8V19.2002C6.19922 19.642 6.55739 20.0002 6.99922 20.0002C7.44105 20.0002 7.79922 19.642 7.79922 19.2002V4.8ZM17.7992 4.8C17.7992 4.35817 17.441 4 16.9992 4C16.5574 4 16.1992 4.35817 16.1992 4.8V19.2002C16.1992 19.642 16.5574 20.0002 16.9992 20.0002C17.441 20.0002 17.7992 19.642 17.7992 19.2002V4.8Z" fill="white"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M13.9805 3.12958C14.5004 2.79015 15.1904 3.16017 15.1904 3.77997V20.2995C15.1904 20.9194 14.5004 21.2896 13.9805 20.9499L7.44043 16.6804C7.03045 16.4104 6.56005 16.2702 6.08008 16.2702H2.75977C2.34003 16.2701 2.00025 15.9301 2 15.5104V8.57001C2 8.15009 2.33987 7.81037 2.75977 7.81024H6.08008C6.56005 7.81023 7.04045 7.67007 7.44043 7.40009L13.9805 3.12958ZM19.0703 7.08954C19.3503 6.80999 19.7897 6.8203 20.0596 7.11005C21.1996 8.34004 21.9102 10.0699 21.9102 11.9899C21.9102 13.9099 21.1996 15.6298 20.0596 16.8698C19.7897 17.1596 19.3503 17.1699 19.0703 16.8903C18.7903 16.6103 18.7698 16.1395 19.0498 15.8395C19.9397 14.8795 20.5 13.5098 20.5 11.9899C20.5 10.47 19.9397 9.11031 19.0498 8.14032C18.7798 7.85032 18.7903 7.36954 19.0703 7.08954ZM16.8242 8.82587C17.1543 8.52039 17.6705 8.56159 17.9395 8.91962C18.6095 9.81962 19 10.8602 19 11.9802C19 13.1 18.62 14.1399 17.9502 15.0397C17.6802 15.3997 17.1501 15.4496 16.8301 15.1296C16.5502 14.8596 16.52 14.43 16.75 14.11C17.2199 13.4702 17.4901 12.7502 17.4902 11.9704C17.4902 11.1904 17.22 10.4698 16.75 9.82977C16.5217 9.522 16.5498 9.08653 16.8242 8.82587ZM16.8301 8.82001L16.8203 8.82977V8.82001H16.8301Z" fill="#256EF4"/>
3
+ </svg>