@jbpark/ui-kit 10.0.1 → 10.1.0

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.
Files changed (120) hide show
  1. package/README.ko.md +40 -25
  2. package/README.md +40 -25
  3. package/dist/Breadcrumb.d.mts +39 -0
  4. package/dist/Breadcrumb.d.mts.map +1 -0
  5. package/dist/Breadcrumb.mjs +103 -0
  6. package/dist/Breadcrumb.mjs.map +1 -0
  7. package/dist/Pagination.d.mts +53 -0
  8. package/dist/Pagination.d.mts.map +1 -0
  9. package/dist/Pagination.mjs +208 -0
  10. package/dist/Pagination.mjs.map +1 -0
  11. package/dist/Table.d.mts +48 -0
  12. package/dist/Table.d.mts.map +1 -0
  13. package/dist/Table.mjs +119 -0
  14. package/dist/Table.mjs.map +1 -0
  15. package/dist/components/atoms/checkbox/checkbox.mjs +2 -1
  16. package/dist/components/atoms/checkbox/checkbox.mjs.map +1 -1
  17. package/dist/components/atoms/checkbox/group.mjs +2 -1
  18. package/dist/components/atoms/checkbox/group.mjs.map +1 -1
  19. package/dist/components/atoms/color-picker.mjs +1 -1
  20. package/dist/components/atoms/date-picker.mjs +1 -1
  21. package/dist/components/atoms/float-button/back-top.mjs +1 -1
  22. package/dist/components/atoms/index.d.mts +2 -1
  23. package/dist/components/atoms/input/search.mjs +3 -1
  24. package/dist/components/atoms/input/search.mjs.map +1 -1
  25. package/dist/components/atoms/popover.mjs +1 -1
  26. package/dist/components/atoms/radio/group.mjs +1 -1
  27. package/dist/components/atoms/radio/radio.mjs +2 -1
  28. package/dist/components/atoms/radio/radio.mjs.map +1 -1
  29. package/dist/components/atoms/select-multiple.d.mts +29 -0
  30. package/dist/components/atoms/select-multiple.d.mts.map +1 -0
  31. package/dist/components/atoms/select-multiple.mjs +97 -0
  32. package/dist/components/atoms/select-multiple.mjs.map +1 -0
  33. package/dist/components/atoms/select-searchable-options.d.mts +21 -0
  34. package/dist/components/atoms/select-searchable-options.d.mts.map +1 -0
  35. package/dist/components/atoms/select-searchable-options.mjs +62 -0
  36. package/dist/components/atoms/select-searchable-options.mjs.map +1 -0
  37. package/dist/components/atoms/select-searchable.d.mts +22 -0
  38. package/dist/components/atoms/select-searchable.d.mts.map +1 -0
  39. package/dist/components/atoms/select-searchable.mjs +65 -0
  40. package/dist/components/atoms/select-searchable.mjs.map +1 -0
  41. package/dist/components/atoms/select.d.mts +8 -2
  42. package/dist/components/atoms/select.d.mts.map +1 -1
  43. package/dist/components/atoms/select.mjs +11 -1
  44. package/dist/components/atoms/select.mjs.map +1 -1
  45. package/dist/components/atoms/slider/slider.mjs +1 -1
  46. package/dist/components/atoms/switch.mjs +1 -1
  47. package/dist/components/atoms/tooltip.d.mts +21 -0
  48. package/dist/components/atoms/tooltip.d.mts.map +1 -0
  49. package/dist/components/atoms/tooltip.mjs +78 -0
  50. package/dist/components/atoms/tooltip.mjs.map +1 -0
  51. package/dist/components/atoms/typography/paragraph.mjs +1 -0
  52. package/dist/components/atoms/typography/paragraph.mjs.map +1 -1
  53. package/dist/components/atoms/typography/title.mjs +1 -0
  54. package/dist/components/atoms/typography/title.mjs.map +1 -1
  55. package/dist/components/molecules/dropdown.mjs +1 -1
  56. package/dist/components/molecules/index.d.mts +13 -10
  57. package/dist/components/molecules/marquees/marquees.mjs +1 -1
  58. package/dist/components/molecules/menu/menu.mjs +2 -1
  59. package/dist/components/molecules/menu/menu.mjs.map +1 -1
  60. package/dist/components/molecules/tabs.d.mts +37 -0
  61. package/dist/components/molecules/tabs.d.mts.map +1 -0
  62. package/dist/components/molecules/tabs.mjs +51 -0
  63. package/dist/components/molecules/tabs.mjs.map +1 -0
  64. package/dist/components/molecules/upload.mjs +2 -1
  65. package/dist/components/molecules/upload.mjs.map +1 -1
  66. package/dist/components/organisms/drawer.d.mts.map +1 -1
  67. package/dist/components/organisms/drawer.mjs +7 -2
  68. package/dist/components/organisms/drawer.mjs.map +1 -1
  69. package/dist/components/organisms/index.d.mts +6 -5
  70. package/dist/components/organisms/list/list.mjs +1 -1
  71. package/dist/components/organisms/modal.d.mts.map +1 -1
  72. package/dist/components/organisms/modal.mjs +7 -4
  73. package/dist/components/organisms/modal.mjs.map +1 -1
  74. package/dist/components/organisms/toast.d.mts.map +1 -1
  75. package/dist/components/organisms/toast.mjs +2 -1
  76. package/dist/components/organisms/toast.mjs.map +1 -1
  77. package/dist/components/templates/empty.mjs +1 -0
  78. package/dist/components/templates/empty.mjs.map +1 -1
  79. package/dist/components/templates/layout/content.mjs +1 -0
  80. package/dist/components/templates/layout/content.mjs.map +1 -1
  81. package/dist/components/templates/layout/footer.mjs +1 -0
  82. package/dist/components/templates/layout/footer.mjs.map +1 -1
  83. package/dist/components/templates/layout/header.mjs +1 -0
  84. package/dist/components/templates/layout/header.mjs.map +1 -1
  85. package/dist/components/templates/layout/layout.mjs +1 -0
  86. package/dist/components/templates/layout/layout.mjs.map +1 -1
  87. package/dist/components/templates/layout/sider.mjs +3 -1
  88. package/dist/components/templates/layout/sider.mjs.map +1 -1
  89. package/dist/components/templates/page-header.mjs +1 -0
  90. package/dist/components/templates/page-header.mjs.map +1 -1
  91. package/dist/components/templates/result.mjs +1 -0
  92. package/dist/components/templates/result.mjs.map +1 -1
  93. package/dist/core/badge.d.mts +1 -1
  94. package/dist/core/button.d.mts +1 -1
  95. package/dist/core/combobox.d.mts +7 -0
  96. package/dist/core/combobox.d.mts.map +1 -0
  97. package/dist/core/combobox.mjs +99 -0
  98. package/dist/core/combobox.mjs.map +1 -0
  99. package/dist/core/dialog.mjs.map +1 -1
  100. package/dist/core/drawer.mjs.map +1 -1
  101. package/dist/core/field.mjs +2 -4
  102. package/dist/core/field.mjs.map +1 -1
  103. package/dist/core/index.d.mts +4 -1
  104. package/dist/core/select.mjs +27 -22
  105. package/dist/core/select.mjs.map +1 -1
  106. package/dist/core/tabs.d.mts +9 -0
  107. package/dist/core/tabs.d.mts.map +1 -0
  108. package/dist/core/tabs.mjs +59 -0
  109. package/dist/core/tabs.mjs.map +1 -0
  110. package/dist/core/tooltip.d.mts +2 -0
  111. package/dist/core/tooltip.mjs +41 -0
  112. package/dist/core/tooltip.mjs.map +1 -0
  113. package/dist/index.d.mts +31 -26
  114. package/dist/index.mjs +7 -2
  115. package/dist/lib/z-layers.mjs +21 -0
  116. package/dist/lib/z-layers.mjs.map +1 -1
  117. package/dist/providers/config/dark-mode.mjs +2 -10
  118. package/dist/providers/config/dark-mode.mjs.map +1 -1
  119. package/dist/style.css +195 -16
  120. package/package.json +17 -2
package/README.ko.md CHANGED
@@ -9,8 +9,8 @@ TypeScript와 Tailwind CSS를 기반으로 구축된 현대적이고 재사용
9
9
  - **패키지명**: `@jbpark/ui-kit`
10
10
  - **라이선스**: MIT
11
11
  - **패키지 매니저**: pnpm
12
- - **Node.js 요구사항**: >= 18
13
- - **React 요구사항**: ^18.0.0 || ^19.0.0
12
+ - **Node.js 요구사항**: >= 20
13
+ - **React 요구사항**: ^19.0.0
14
14
 
15
15
  ## 🏗 아키텍처
16
16
 
@@ -27,8 +27,10 @@ src/
27
27
  │ └── templates/ # 📄 템플릿 - 페이지 레이아웃
28
28
  ├── core/ # ⚙️ 핵심 UI 로직 (Base UI 기반)
29
29
  ├── lib/
30
- │ ├── enums/ # 📋 열거형 타입
31
- │ └── utils/ # 🛠 유틸리티 함수
30
+ │ ├── utils/ # 🛠 유틸리티 함수
31
+ │ ├── colors.ts # 🎨 색상 토큰 해석
32
+ │ └── z-layers.ts # 🪟 포털 공용 z-index 스케일
33
+ ├── providers/ # 🧩 Config 프로바이더 및 테마
32
34
  ├── globals.css # 🎨 전역 스타일
33
35
  └── index.ts # 📥 패키지 진입점
34
36
  ```
@@ -103,7 +105,7 @@ Base UI 기반의 접근성 우선 핵심 컴포넌트들:
103
105
  ### 유틸리티
104
106
 
105
107
  - **`cn()`** - 클래스명 병합 유틸리티 (clsx + tailwind-merge)
106
- - **`TEXT_LEVELS`** - 타이포그래피 레벨 상수
108
+ - **`renderConditional()`** - 조건부 렌더 헬퍼
107
109
 
108
110
  ## 🚀 설치 및 사용법
109
111
 
@@ -143,6 +145,13 @@ function App() {
143
145
  해당 요소에 `isolation: isolate`를 적용해 Base UI 포털이 앱 내부의 z-index와
144
146
  경쟁하지 않고 페이지 콘텐츠 위에 표시되도록 합니다.
145
147
 
148
+ 반대 방향으로도 효과가 있습니다. 오버레이(Modal, Drawer, Select, Popover)와
149
+ 페이지 흐름 안에 고정되는 요소(sticky/fixed `Layout.Header`, `FloatButton`,
150
+ Dropdown 메뉴)는 모두 `z-index: 1000`을 씁니다. 루트를 격리하지 않으면 이
151
+ 요소들이 z-index가 더 낮은 앱 자체의 다이얼로그(예: shadcn의 `z-50`)를 덮습니다.
152
+ `data-ui-root`를 지정하면 `body`로 포털되는 앱의 오버레이가 이 요소들을 포함한
153
+ 앱 전체를 덮습니다.
154
+
146
155
  ### 개별 컴포넌트 import
147
156
 
148
157
  ```tsx
@@ -171,13 +180,12 @@ import Typography from '@jbpark/ui-kit/Typography';
171
180
  > 이펙트로 불러오기 때문에 Node/SSR 빌드(예: Astro static build)에서 순수
172
181
  > `.css` import를 처리 못 해 빌드가 깨질 수 있습니다.
173
182
 
174
- ### 유틸리티 및 열거형 import
183
+ ### 유틸리티 및 프로바이더 import
175
184
 
176
185
  ```tsx
177
186
  // 유틸리티 함수
178
- // 열거형 상수
179
- import { TEXT_LEVELS } from '@jbpark/ui-kit/enums';
180
- import { cn } from '@jbpark/ui-kit/utils';
187
+ import { Config } from '@jbpark/ui-kit/providers';
188
+ import { cn, renderConditional } from '@jbpark/ui-kit/utils';
181
189
  ```
182
190
 
183
191
  ### 스타일 import
@@ -210,28 +218,29 @@ import '@jbpark/ui-kit/style.css';
210
218
 
211
219
  ### 핵심 라이브러리
212
220
 
213
- - **React 19.1.0** - UI 라이브러리
214
- - **TypeScript 5.9.2** - 정적 타입 체크
215
- - **Tailwind CSS 4.1.12** - 유틸리티 CSS 프레임워크
221
+ - **React 19.2** - UI 라이브러리
222
+ - **TypeScript 6.0** - 정적 타입 체크
223
+ - **Tailwind CSS 4.3** - 유틸리티 CSS 프레임워크
216
224
 
217
225
  ### UI 라이브러리
218
226
 
219
- - **Base UI** - 접근성 우선 헤드리스 UI 컴포넌트
220
- - **Lucide React 0.542.0** - 아이콘 라이브러리
221
- - **Motion 12.23.12** - 애니메이션 라이브러리
222
- - **Swiper 11.2.10** - 터치 슬라이더
223
- - **Vaul 1.1.2** - 드로어 컴포넌트
227
+ - **Base UI 1.8** - 접근성 우선 헤드리스 UI 프리미티브
228
+ - **Lucide React 1.45** - 아이콘 라이브러리
229
+ - **Motion 13.1** - 애니메이션 라이브러리
230
+ - **Swiper 14.1** - 터치 슬라이더
231
+ - **TipTap 3.30** - RichTextEditor 엔진
232
+ - **react-day-picker 10.0** - DatePicker 캘린더
233
+ - **react-resizable-panels 4.12** - Splitter 패널
224
234
 
225
235
  ### 유틸리티
226
236
 
227
237
  - **class-variance-authority 0.7.1** - 컴포넌트 variants 관리
228
238
  - **clsx 2.1.1** - 조건부 클래스명
229
- - **tailwind-merge 3.3.1** - Tailwind 클래스 병합
230
- - **react-use 17.6.0** - React 훅 모음
231
- - **@uidotdev/usehooks 2.4.1** - 추가 React 훅
232
- - **uuid 11.1.0** - 고유 ID 생성
233
- - **@gsap/react 2.1.2** - GSAP 애니메이션
234
- - **tw-animate-css 1.3.7** - Tailwind 애니메이션
239
+ - **tailwind-merge 3.6** - Tailwind 클래스 병합
240
+ - **@jbpark/use-hooks 4.0** - React 훅 모음
241
+ - **date-fns 4.4** - 날짜 포매팅/파싱
242
+ - **react-colorful 5.8** - ColorPicker 입력
243
+ - **GSAP 3.15 / @gsap/react 2.1** - GSAP 애니메이션
235
244
 
236
245
  ## 🔧 개발
237
246
 
@@ -267,10 +276,16 @@ pnpm run generate:component
267
276
 
268
277
  - `@jbpark/ui-kit` - 메인 패키지 (모든 컴포넌트)
269
278
  - `@jbpark/ui-kit/Typography` - Typography 컴포넌트
279
+ - `@jbpark/ui-kit/Button` - Button 컴포넌트
280
+ - `@jbpark/ui-kit/Tag` - Tag 컴포넌트
281
+ - `@jbpark/ui-kit/Card` - Card 컴포넌트
282
+ - `@jbpark/ui-kit/Space` - Space 컴포넌트
270
283
  - `@jbpark/ui-kit/Menu` - Menu 컴포넌트
271
284
  - `@jbpark/ui-kit/Reveals` - Reveals 컴포넌트
272
- - `@jbpark/ui-kit/utils` - 유틸리티 함수 (`cn` 등)
273
- - `@jbpark/ui-kit/enums` - 열거형 상수 (`TEXT_LEVELS` 등)
285
+ - `@jbpark/ui-kit/CodeEditor` - CodeEditor 컴포넌트
286
+ - `@jbpark/ui-kit/Layout` - Layout 템플릿
287
+ - `@jbpark/ui-kit/utils` - 유틸리티 함수 (`cn`, `renderConditional`)
288
+ - `@jbpark/ui-kit/providers` - Config 프로바이더 및 테마
274
289
  - `@jbpark/ui-kit/style.css` - 전역 스타일 (필수)
275
290
 
276
291
  ## 🤝 기여하기
package/README.md CHANGED
@@ -9,8 +9,8 @@ A modern and reusable React UI component library built with TypeScript and Tailw
9
9
  - **Package Name**: `@jbpark/ui-kit`
10
10
  - **License**: MIT
11
11
  - **Package Manager**: pnpm
12
- - **Node.js Requirement**: >= 18
13
- - **React Requirement**: ^18.0.0 || ^19.0.0
12
+ - **Node.js Requirement**: >= 20
13
+ - **React Requirement**: ^19.0.0
14
14
 
15
15
  ## 🏗 Architecture
16
16
 
@@ -27,8 +27,10 @@ src/
27
27
  │ └── templates/ # 📄 Templates - Page layouts
28
28
  ├── core/ # ⚙️ Core UI logic (Base UI based)
29
29
  ├── lib/
30
- │ ├── enums/ # 📋 Enumeration types
31
- │ └── utils/ # 🛠 Utility functions
30
+ │ ├── utils/ # 🛠 Utility functions
31
+ │ ├── colors.ts # 🎨 Colour token resolution
32
+ │ └── z-layers.ts # 🪟 Shared portal z-index scale
33
+ ├── providers/ # 🧩 Config provider and theming
32
34
  ├── globals.css # 🎨 Global styles
33
35
  └── index.ts # 📥 Package entry point
34
36
  ```
@@ -103,7 +105,7 @@ Accessibility-first core components based on Base UI:
103
105
  ### Utilities
104
106
 
105
107
  - **`cn()`** - Class name merging utility (clsx + tailwind-merge)
106
- - **`TEXT_LEVELS`** - Typography level constants
108
+ - **`renderConditional()`** - Conditional render helper
107
109
 
108
110
  ## 🚀 Installation & Usage
109
111
 
@@ -143,6 +145,13 @@ Put `data-ui-root` on your application layout root. The included stylesheet
143
145
  applies `isolation: isolate` there so Base UI portals render above page content
144
146
  without competing with z-index values inside the app.
145
147
 
148
+ It also works in the other direction. Overlays (Modal, Drawer, Select,
149
+ Popover) and in-flow chrome (sticky/fixed `Layout.Header`, `FloatButton`,
150
+ Dropdown menus) share `z-index: 1000`. Without an isolated root, that
151
+ chrome paints over your own dialogs if they use a lower z-index (for example
152
+ shadcn's `z-50`). With `data-ui-root`, any overlay you portal to `body`
153
+ covers the whole app, including this chrome.
154
+
146
155
  ### Import Individual Components
147
156
 
148
157
  ```tsx
@@ -171,13 +180,12 @@ import Typography from '@jbpark/ui-kit/Typography';
171
180
  > `swiper`'s CSS as a side effect and can break Node/SSR builds (e.g. an
172
181
  > Astro static build) that don't expect a bare `.css` import.
173
182
 
174
- ### Import Utilities and Enums
183
+ ### Import Utilities and Providers
175
184
 
176
185
  ```tsx
177
186
  // Utility functions
178
- // Enumeration constants
179
- import { TEXT_LEVELS } from '@jbpark/ui-kit/enums';
180
- import { cn } from '@jbpark/ui-kit/utils';
187
+ import { Config } from '@jbpark/ui-kit/providers';
188
+ import { cn, renderConditional } from '@jbpark/ui-kit/utils';
181
189
  ```
182
190
 
183
191
  ### Import Styles
@@ -210,28 +218,29 @@ import '@jbpark/ui-kit/style.css';
210
218
 
211
219
  ### Core Libraries
212
220
 
213
- - **React 19.1.0** - UI library
214
- - **TypeScript 5.9.2** - Static type checking
215
- - **Tailwind CSS 4.1.12** - Utility-first CSS framework
221
+ - **React 19.2** - UI library
222
+ - **TypeScript 6.0** - Static type checking
223
+ - **Tailwind CSS 4.3** - Utility-first CSS framework
216
224
 
217
225
  ### UI Libraries
218
226
 
219
- - **Base UI** - Accessible headless UI components
220
- - **Lucide React 0.542.0** - Icon library
221
- - **Motion 12.23.12** - Animation library
222
- - **Swiper 11.2.10** - Touch slider
223
- - **Vaul 1.1.2** - Drawer component
227
+ - **Base UI 1.8** - Accessible headless UI primitives
228
+ - **Lucide React 1.45** - Icon library
229
+ - **Motion 13.1** - Animation library
230
+ - **Swiper 14.1** - Touch slider
231
+ - **TipTap 3.30** - RichTextEditor engine
232
+ - **react-day-picker 10.0** - DatePicker calendar
233
+ - **react-resizable-panels 4.12** - Splitter panels
224
234
 
225
235
  ### Utilities
226
236
 
227
237
  - **class-variance-authority 0.7.1** - Component variants management
228
238
  - **clsx 2.1.1** - Conditional class names
229
- - **tailwind-merge 3.3.1** - Tailwind class merging
230
- - **react-use 17.6.0** - React hooks collection
231
- - **@uidotdev/usehooks 2.4.1** - Additional React hooks
232
- - **uuid 11.1.0** - Unique ID generation
233
- - **@gsap/react 2.1.2** - GSAP animation
234
- - **tw-animate-css 1.3.7** - Tailwind animations
239
+ - **tailwind-merge 3.6** - Tailwind class merging
240
+ - **@jbpark/use-hooks 4.0** - React hooks collection
241
+ - **date-fns 4.4** - Date formatting and parsing
242
+ - **react-colorful 5.8** - ColorPicker input
243
+ - **GSAP 3.15 / @gsap/react 2.1** - GSAP animation
235
244
 
236
245
  ## 🔧 Development
237
246
 
@@ -267,10 +276,16 @@ This package exports the following modules:
267
276
 
268
277
  - `@jbpark/ui-kit` - Main package (all components)
269
278
  - `@jbpark/ui-kit/Typography` - Typography component
279
+ - `@jbpark/ui-kit/Button` - Button component
280
+ - `@jbpark/ui-kit/Tag` - Tag component
281
+ - `@jbpark/ui-kit/Card` - Card component
282
+ - `@jbpark/ui-kit/Space` - Space component
270
283
  - `@jbpark/ui-kit/Menu` - Menu component
271
284
  - `@jbpark/ui-kit/Reveals` - Reveals component
272
- - `@jbpark/ui-kit/utils` - Utility functions (`cn` etc)
273
- - `@jbpark/ui-kit/enums` - Enumeration constants (`TEXT_LEVELS` etc)
285
+ - `@jbpark/ui-kit/CodeEditor` - CodeEditor component
286
+ - `@jbpark/ui-kit/Layout` - Layout template
287
+ - `@jbpark/ui-kit/utils` - Utility functions (`cn`, `renderConditional`)
288
+ - `@jbpark/ui-kit/providers` - Config provider and theming
274
289
  - `@jbpark/ui-kit/style.css` - Global styles (required)
275
290
 
276
291
  ## 🤝 Contributing
@@ -0,0 +1,39 @@
1
+ //#region src/components/molecules/breadcrumb.d.ts
2
+ interface Item {
3
+ key?: React.Key;
4
+ title: React.ReactNode;
5
+ href?: string;
6
+ target?: React.HTMLAttributeAnchorTarget;
7
+ rel?: string;
8
+ onClick?: React.MouseEventHandler<HTMLElement>;
9
+ className?: string;
10
+ 'aria-label'?: string;
11
+ /** Decorative icon placed before the title. */
12
+ icon?: React.ReactNode;
13
+ /** Overrides the separator after this item. */
14
+ separator?: React.ReactNode;
15
+ }
16
+ interface Props extends Omit<React.ComponentPropsWithoutRef<'nav'>, 'children'> {
17
+ items: Item[];
18
+ separator?: React.ReactNode;
19
+ /** Collapse middle items when the trail has more than this many entries. */
20
+ maxItems?: number;
21
+ itemsBeforeCollapse?: number;
22
+ itemsAfterCollapse?: number;
23
+ expandText?: string;
24
+ /** Render custom router links. The renderer owns aria-current for the last item. */
25
+ itemRender?: (item: Item, index: number, isCurrent: boolean) => React.ReactNode;
26
+ classNames?: {
27
+ list?: string;
28
+ item?: string;
29
+ link?: string;
30
+ current?: string;
31
+ separator?: string;
32
+ collapsed?: string;
33
+ popup?: string;
34
+ };
35
+ }
36
+ declare const Breadcrumb: ({ items, separator, maxItems, itemsBeforeCollapse, itemsAfterCollapse, expandText, itemRender, className, classNames, dir, "aria-label": ariaLabel, ...props }: Props) => import("react").JSX.Element;
37
+ //#endregion
38
+ export { Item, Props, Breadcrumb as default };
39
+ //# sourceMappingURL=Breadcrumb.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumb.d.mts","names":[],"sources":["../src/components/molecules/breadcrumb.tsx"],"mappings":";UAUiB;EACf,MAAM,MAAM;EACZ,OAAO,MAAM;EACb;EACA,SAAS,MAAM;EACf;EACA,UAAU,MAAM,kBAAkB;EAClC;EACA;;EAEA,OAAO,MAAM;;EAEb,YAAY,MAAM;;UAGH,cAAc,KAC7B,MAAM;EAGN,OAAO;EACP,YAAY,MAAM;;EAElB;EACA;EACA;EACA;;EAEA,cACE,MAAM,MACN,eACA,uBACG,MAAM;EACX;IACE;IACA;IACA;IACA;IACA;IACA;IACA;;;cAOE,eAAc,OAAA,WAAA,UAAA,qBAAA,oBAAA,YAAA,YAAA,WAAA,YAAA,mBAAA,cAAA,SAajB,0BAAK,IAAA"}
@@ -0,0 +1,103 @@
1
+ "use client";
2
+ import { cn } from "./utils.mjs";
3
+ import { useConfig } from "./providers/config/context.mjs";
4
+ import Button from "./Button.mjs";
5
+ import Popover from "./components/atoms/popover.mjs";
6
+ import { Fragment } from "react";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/molecules/breadcrumb.tsx
9
+ const safeCount = (value, minimum) => Number.isFinite(value) ? Math.max(minimum, Math.floor(value)) : minimum;
10
+ const Breadcrumb = ({ items, separator = "/", maxItems = 8, itemsBeforeCollapse = 1, itemsAfterCollapse = 1, expandText = "Show path", itemRender, className, classNames, dir, "aria-label": ariaLabel, ...props }) => {
11
+ const { direction } = useConfig();
12
+ const limit = safeCount(maxItems, 3);
13
+ const before = Math.min(safeCount(itemsBeforeCollapse, 1), limit - 2);
14
+ const after = Math.min(safeCount(itemsAfterCollapse, 1), limit - before - 1);
15
+ const collapsed = items.length > limit && items.length - before - after > 0;
16
+ const visibleIndices = collapsed ? [...Array.from({ length: before }, (_, index) => index), ...Array.from({ length: after }, (_, index) => items.length - after + index)] : items.map((_, index) => index);
17
+ const hiddenIndices = collapsed ? Array.from({ length: items.length - before - after }, (_, index) => before + index) : [];
18
+ const renderItem = (index) => {
19
+ const item = items[index];
20
+ const isCurrent = index === items.length - 1;
21
+ if (itemRender) return itemRender(item, index, isCurrent);
22
+ const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [item.icon != null && /* @__PURE__ */ jsx("span", {
23
+ "data-slot": "breadcrumb-icon",
24
+ "aria-hidden": "true",
25
+ className: "inline-flex shrink-0",
26
+ children: item.icon
27
+ }), item.title] });
28
+ const itemClassName = cn("inline-flex items-center gap-1.5 rounded-sm", (item.href !== void 0 || item.onClick) && "hover:text-foreground focus-visible:outline-ring focus-visible:outline-2", isCurrent ? "text-foreground font-medium" : "text-muted-foreground", (item.href !== void 0 || item.onClick) && classNames?.link, isCurrent && classNames?.current, item.className);
29
+ if (item.href !== void 0) return /* @__PURE__ */ jsx("a", {
30
+ href: item.href,
31
+ target: item.target,
32
+ rel: item.rel,
33
+ onClick: item.onClick,
34
+ "aria-label": item["aria-label"],
35
+ "aria-current": isCurrent ? "page" : void 0,
36
+ className: itemClassName,
37
+ children: content
38
+ });
39
+ if (item.onClick) return /* @__PURE__ */ jsx(Button, {
40
+ variant: "text",
41
+ size: "small",
42
+ onClick: item.onClick,
43
+ "aria-label": item["aria-label"],
44
+ "aria-current": isCurrent ? "page" : void 0,
45
+ className: cn("h-auto px-0 py-0 font-normal", itemClassName),
46
+ children: content
47
+ });
48
+ return /* @__PURE__ */ jsx("span", {
49
+ "aria-label": item["aria-label"],
50
+ "aria-current": isCurrent ? "page" : void 0,
51
+ className: itemClassName,
52
+ children: content
53
+ });
54
+ };
55
+ const renderSeparator = (index) => /* @__PURE__ */ jsx("li", {
56
+ "data-slot": "breadcrumb-separator",
57
+ "aria-hidden": "true",
58
+ className: cn("text-muted-foreground mx-2 shrink-0", classNames?.separator),
59
+ children: items[index]?.separator ?? separator
60
+ });
61
+ return /* @__PURE__ */ jsx("nav", {
62
+ ...props,
63
+ "data-slot": "breadcrumb",
64
+ dir: dir ?? direction,
65
+ "aria-label": ariaLabel ?? "Breadcrumb",
66
+ className: cn("text-sm", className),
67
+ children: /* @__PURE__ */ jsx("ol", {
68
+ "data-slot": "breadcrumb-list",
69
+ className: cn("m-0 flex min-w-0 flex-wrap items-center p-0", classNames?.list),
70
+ children: visibleIndices.map((index, position) => /* @__PURE__ */ jsxs(Fragment, { children: [
71
+ position > 0 && renderSeparator(collapsed && position === before ? index - 1 : visibleIndices[position - 1]),
72
+ /* @__PURE__ */ jsx("li", {
73
+ "data-slot": "breadcrumb-item",
74
+ className: cn("inline-flex min-w-0 items-center", classNames?.item),
75
+ children: renderItem(index)
76
+ }),
77
+ collapsed && position === before - 1 && /* @__PURE__ */ jsxs(Fragment$1, { children: [renderSeparator(index), /* @__PURE__ */ jsx("li", {
78
+ "data-slot": "breadcrumb-collapsed",
79
+ className: classNames?.collapsed,
80
+ children: /* @__PURE__ */ jsx(Popover, {
81
+ placement: "bottom",
82
+ className: classNames?.popup,
83
+ content: /* @__PURE__ */ jsx("ol", {
84
+ className: "m-0 grid list-none gap-1 p-0",
85
+ children: hiddenIndices.map((hiddenIndex) => /* @__PURE__ */ jsx("li", { children: renderItem(hiddenIndex) }, items[hiddenIndex]?.key ?? hiddenIndex))
86
+ }),
87
+ children: /* @__PURE__ */ jsx(Button, {
88
+ variant: "text",
89
+ size: "small",
90
+ "aria-label": expandText,
91
+ className: "h-auto px-1",
92
+ children: "…"
93
+ })
94
+ })
95
+ })] })
96
+ ] }, items[index]?.key ?? index))
97
+ })
98
+ });
99
+ };
100
+ //#endregion
101
+ export { Breadcrumb as default };
102
+
103
+ //# sourceMappingURL=Breadcrumb.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumb.mjs","names":[],"sources":["../src/components/molecules/breadcrumb.tsx"],"sourcesContent":["'use client';\n\nimport { Fragment } from 'react';\n\nimport { useConfig } from '@repo/ui/providers';\nimport { cn } from '@repo/ui/utils';\n\nimport Button from '../atoms/button';\nimport Popover from '../atoms/popover';\n\nexport interface Item {\n key?: React.Key;\n title: React.ReactNode;\n href?: string;\n target?: React.HTMLAttributeAnchorTarget;\n rel?: string;\n onClick?: React.MouseEventHandler<HTMLElement>;\n className?: string;\n 'aria-label'?: string;\n /** Decorative icon placed before the title. */\n icon?: React.ReactNode;\n /** Overrides the separator after this item. */\n separator?: React.ReactNode;\n}\n\nexport interface Props extends Omit<\n React.ComponentPropsWithoutRef<'nav'>,\n 'children'\n> {\n items: Item[];\n separator?: React.ReactNode;\n /** Collapse middle items when the trail has more than this many entries. */\n maxItems?: number;\n itemsBeforeCollapse?: number;\n itemsAfterCollapse?: number;\n expandText?: string;\n /** Render custom router links. The renderer owns aria-current for the last item. */\n itemRender?: (\n item: Item,\n index: number,\n isCurrent: boolean,\n ) => React.ReactNode;\n classNames?: {\n list?: string;\n item?: string;\n link?: string;\n current?: string;\n separator?: string;\n collapsed?: string;\n popup?: string;\n };\n}\n\nconst safeCount = (value: number, minimum: number) =>\n Number.isFinite(value) ? Math.max(minimum, Math.floor(value)) : minimum;\n\nconst Breadcrumb = ({\n items,\n separator = '/',\n maxItems = 8,\n itemsBeforeCollapse = 1,\n itemsAfterCollapse = 1,\n expandText = 'Show path',\n itemRender,\n className,\n classNames,\n dir,\n 'aria-label': ariaLabel,\n ...props\n}: Props) => {\n const { direction } = useConfig();\n const limit = safeCount(maxItems, 3);\n const before = Math.min(safeCount(itemsBeforeCollapse, 1), limit - 2);\n const after = Math.min(safeCount(itemsAfterCollapse, 1), limit - before - 1);\n const collapsed = items.length > limit && items.length - before - after > 0;\n const visibleIndices = collapsed\n ? [\n ...Array.from({ length: before }, (_, index) => index),\n ...Array.from(\n { length: after },\n (_, index) => items.length - after + index,\n ),\n ]\n : items.map((_, index) => index);\n const hiddenIndices = collapsed\n ? Array.from(\n { length: items.length - before - after },\n (_, index) => before + index,\n )\n : [];\n\n const renderItem = (index: number) => {\n const item = items[index]!;\n const isCurrent = index === items.length - 1;\n\n if (itemRender) {\n return itemRender(item, index, isCurrent);\n }\n\n const content = (\n <>\n {item.icon != null && (\n <span\n data-slot=\"breadcrumb-icon\"\n aria-hidden=\"true\"\n className=\"inline-flex shrink-0\"\n >\n {item.icon}\n </span>\n )}\n {item.title}\n </>\n );\n const itemClassName = cn(\n 'inline-flex items-center gap-1.5 rounded-sm',\n (item.href !== undefined || item.onClick) &&\n 'hover:text-foreground focus-visible:outline-ring focus-visible:outline-2',\n isCurrent ? 'text-foreground font-medium' : 'text-muted-foreground',\n (item.href !== undefined || item.onClick) && classNames?.link,\n isCurrent && classNames?.current,\n item.className,\n //\n );\n\n if (item.href !== undefined) {\n return (\n <a\n href={item.href}\n target={item.target}\n rel={item.rel}\n onClick={item.onClick}\n aria-label={item['aria-label']}\n aria-current={isCurrent ? 'page' : undefined}\n className={itemClassName}\n >\n {content}\n </a>\n );\n }\n\n if (item.onClick) {\n return (\n <Button\n variant=\"text\"\n size=\"small\"\n onClick={item.onClick}\n aria-label={item['aria-label']}\n aria-current={isCurrent ? 'page' : undefined}\n className={cn('h-auto px-0 py-0 font-normal', itemClassName)}\n >\n {content}\n </Button>\n );\n }\n\n return (\n <span\n aria-label={item['aria-label']}\n aria-current={isCurrent ? 'page' : undefined}\n className={itemClassName}\n >\n {content}\n </span>\n );\n };\n\n const renderSeparator = (index: number) => (\n <li\n data-slot=\"breadcrumb-separator\"\n aria-hidden=\"true\"\n className={cn(\n 'text-muted-foreground mx-2 shrink-0',\n classNames?.separator,\n //\n )}\n >\n {items[index]?.separator ?? separator}\n </li>\n );\n\n return (\n <nav\n {...props}\n data-slot=\"breadcrumb\"\n dir={dir ?? direction}\n aria-label={ariaLabel ?? 'Breadcrumb'}\n className={cn(\n 'text-sm',\n className, //\n )}\n >\n <ol\n data-slot=\"breadcrumb-list\"\n className={cn(\n 'm-0 flex min-w-0 flex-wrap items-center p-0',\n classNames?.list,\n //\n )}\n >\n {visibleIndices.map((index, position) => (\n <Fragment key={items[index]?.key ?? index}>\n {position > 0 &&\n renderSeparator(\n collapsed && position === before\n ? index - 1\n : visibleIndices[position - 1]!,\n )}\n <li\n data-slot=\"breadcrumb-item\"\n className={cn(\n 'inline-flex min-w-0 items-center',\n classNames?.item, //\n )}\n >\n {renderItem(index)}\n </li>\n {collapsed && position === before - 1 && (\n <>\n {renderSeparator(index)}\n <li\n data-slot=\"breadcrumb-collapsed\"\n className={classNames?.collapsed}\n >\n <Popover\n placement=\"bottom\"\n className={classNames?.popup}\n content={\n <ol className=\"m-0 grid list-none gap-1 p-0\">\n {hiddenIndices.map(hiddenIndex => (\n <li key={items[hiddenIndex]?.key ?? hiddenIndex}>\n {renderItem(hiddenIndex)}\n </li>\n ))}\n </ol>\n }\n >\n <Button\n variant=\"text\"\n size=\"small\"\n aria-label={expandText}\n className=\"h-auto px-1\"\n >\n …\n </Button>\n </Popover>\n </li>\n </>\n )}\n </Fragment>\n ))}\n </ol>\n </nav>\n );\n};\n\nexport default Breadcrumb;\n"],"mappings":"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"}
@@ -0,0 +1,53 @@
1
+ //#region src/components/molecules/pagination.d.ts
2
+ interface Props extends Omit<React.ComponentPropsWithoutRef<'nav'>, 'children' | 'onChange'> {
3
+ /** Total number of items, not pages. */
4
+ total: number;
5
+ /** Controlled number of items per page. */
6
+ pageSize?: number;
7
+ defaultPageSize?: number;
8
+ onPageSizeChange?: (pageSize: number) => void;
9
+ pageSizeOptions?: number[];
10
+ showSizeChanger?: boolean;
11
+ /** Render the total and the 1-based inclusive range of visible items. */
12
+ showTotal?: (total: number, range: [number, number]) => React.ReactNode;
13
+ showQuickJumper?: boolean;
14
+ /** 1-based controlled page. */
15
+ page?: number;
16
+ defaultPage?: number;
17
+ onChange?: (page: number) => void;
18
+ siblingCount?: number;
19
+ boundaryCount?: number;
20
+ showFirstLast?: boolean;
21
+ hideOnSinglePage?: boolean;
22
+ /** Render available page controls as links to these URLs. */
23
+ getPageHref?: (page: number) => string;
24
+ disabled?: boolean;
25
+ size?: 'small' | 'middle' | 'large';
26
+ labels?: {
27
+ navigation?: string;
28
+ page?: (page: number) => string;
29
+ previous?: string;
30
+ next?: string;
31
+ first?: string;
32
+ last?: string;
33
+ pageSize?: string;
34
+ jump?: string;
35
+ go?: string;
36
+ };
37
+ classNames?: {
38
+ item?: string;
39
+ active?: string;
40
+ previous?: string;
41
+ next?: string;
42
+ first?: string;
43
+ last?: string;
44
+ ellipsis?: string;
45
+ total?: string;
46
+ sizeChanger?: string;
47
+ jumper?: string;
48
+ };
49
+ }
50
+ declare const Pagination: ({ total, pageSize, defaultPageSize, onPageSizeChange, pageSizeOptions, showSizeChanger, showTotal, showQuickJumper, page, defaultPage, onChange, siblingCount, boundaryCount, showFirstLast, hideOnSinglePage, getPageHref, disabled, size, labels, className, classNames, "aria-label": ariaLabel, ...props }: Props) => import("react").JSX.Element | null;
51
+ //#endregion
52
+ export { Props, Pagination as default };
53
+ //# sourceMappingURL=Pagination.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pagination.d.mts","names":[],"sources":["../src/components/molecules/pagination.tsx"],"mappings":";UAoBiB,cAAc,KAC7B,MAAM;;EAIN;;EAEA;EACA;EACA,oBAAoB;EACpB;EACA;;EAEA,aAAa,eAAe,4BAA4B,MAAM;EAC9D;;EAEA;EACA;EACA,YAAY;EACZ;EACA;EACA;EACA;;EAEA,eAAe;EACf;EACA;EACA;IACE;IACA,QAAQ;IACR;IACA;IACA;IACA;IACA;IACA;IACA;;EAEF;IACE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;;cAkEE,eAAc,OAAA,UAAA,iBAAA,kBAAA,iBAAA,iBAAA,WAAA,iBAAA,MAAA,aAAA,UAAA,cAAA,eAAA,eAAA,kBAAA,aAAA,UAAA,MAAA,QAAA,WAAA,0BAAA,cAAA,SAwBjB,0BAAK,IAAA"}