mcr-design-systems 1.0.0 → 1.0.2

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 (180) hide show
  1. package/README.md +238 -1
  2. package/dist/components/Badge/index.d.ts +3 -0
  3. package/dist/components/Badge/index.js +186 -0
  4. package/dist/components/Breadcrumb/index.d.ts +45 -0
  5. package/dist/components/Breadcrumb/index.js +136 -0
  6. package/dist/components/Breadcrumb/variants.d.ts +37 -0
  7. package/dist/components/Breadcrumb/variants.js +67 -0
  8. package/dist/components/Button/helper/index.d.ts +0 -21
  9. package/dist/components/Button/helper/index.js +11 -27
  10. package/dist/components/Button/index.d.ts +1 -1
  11. package/dist/components/Button/index.js +36 -39
  12. package/dist/components/ButtonFilter/helper/index.d.ts +83 -0
  13. package/dist/components/ButtonFilter/helper/index.js +69 -0
  14. package/dist/components/ButtonFilter/index.d.ts +94 -0
  15. package/dist/components/ButtonFilter/index.js +288 -0
  16. package/dist/components/Chip/helper/variants.d.ts +101 -0
  17. package/dist/components/Chip/helper/variants.js +188 -0
  18. package/dist/components/Chip/index.d.ts +26 -0
  19. package/dist/components/Chip/index.js +129 -0
  20. package/dist/components/DatePicker/CalendarGrid.d.ts +52 -0
  21. package/dist/components/DatePicker/CalendarGrid.js +181 -0
  22. package/dist/components/DatePicker/DateRangePicker.d.ts +40 -0
  23. package/dist/components/DatePicker/DateRangePicker.js +232 -0
  24. package/dist/components/DatePicker/MonthGrid.d.ts +34 -0
  25. package/dist/components/DatePicker/MonthGrid.js +86 -0
  26. package/dist/components/DatePicker/YearGrid.d.ts +44 -0
  27. package/dist/components/DatePicker/YearGrid.js +78 -0
  28. package/dist/components/DatePicker/helper/variants.d.ts +527 -0
  29. package/dist/components/DatePicker/helper/variants.js +412 -0
  30. package/dist/components/DatePicker/index.d.ts +107 -0
  31. package/dist/components/DatePicker/index.js +327 -0
  32. package/dist/components/Divider/helper/components.d.ts +29 -0
  33. package/dist/components/Divider/helper/index.d.ts +3 -0
  34. package/dist/components/Divider/helper/utils.d.ts +17 -0
  35. package/dist/components/Divider/helper/utils.js +11 -0
  36. package/dist/components/Divider/helper/variants.d.ts +133 -0
  37. package/dist/components/Divider/helper/variants.js +62 -0
  38. package/dist/components/Divider/index.d.ts +44 -0
  39. package/dist/components/Divider/index.js +76 -0
  40. package/dist/components/Dropdown/helper/variants.d.ts +9 -0
  41. package/dist/components/Dropdown/helper/variants.js +5 -0
  42. package/dist/components/Dropdown/index.d.ts +9 -0
  43. package/dist/components/Dropdown/index.js +137 -111
  44. package/dist/components/Icon/Icon.js +1 -1
  45. package/dist/components/Image/helper/variants.d.ts +127 -0
  46. package/dist/components/Image/helper/variants.js +53 -0
  47. package/dist/components/Image/index.d.ts +16 -0
  48. package/dist/components/Image/index.js +24 -0
  49. package/dist/components/Input/DateInput.d.ts +24 -0
  50. package/dist/components/Input/DateInput.js +146 -0
  51. package/dist/components/Input/Input.d.ts +51 -0
  52. package/dist/components/Input/Input.js +218 -0
  53. package/dist/components/Input/MultiSelectInput.d.ts +43 -0
  54. package/dist/components/Input/MultiSelectInput.js +279 -0
  55. package/dist/components/Input/PasswordInput.d.ts +7 -0
  56. package/dist/components/Input/PasswordInput.js +59 -0
  57. package/dist/components/Input/QuantityInput.d.ts +31 -0
  58. package/dist/components/Input/QuantityInput.js +167 -0
  59. package/dist/components/Input/SearchInput.d.ts +11 -0
  60. package/dist/components/Input/SearchInput.js +73 -0
  61. package/dist/components/Input/SelectInput.d.ts +25 -0
  62. package/dist/components/Input/SelectInput.js +155 -0
  63. package/dist/components/Input/index.d.ts +7 -1
  64. package/dist/components/Input/variants.d.ts +309 -0
  65. package/dist/components/Input/variants.js +152 -0
  66. package/dist/components/InputBase/variants.d.ts +16 -25
  67. package/dist/components/InputNumber/index.d.ts +12 -0
  68. package/dist/components/MenuItem/helper/variants.d.ts +24 -0
  69. package/dist/components/MenuItem/helper/variants.js +179 -168
  70. package/dist/components/MenuItem/index.d.ts +2 -0
  71. package/dist/components/MenuItem/index.js +78 -54
  72. package/dist/components/Modal/helper/variants.d.ts +110 -0
  73. package/dist/components/Modal/index.d.ts +110 -0
  74. package/dist/components/PIN/index.d.ts +48 -0
  75. package/dist/components/PIN/index.js +122 -0
  76. package/dist/components/PIN/variants.d.ts +38 -0
  77. package/dist/components/PIN/variants.js +94 -0
  78. package/dist/components/Pagination/Pagination.d.ts +66 -0
  79. package/dist/components/Pagination/helper/PaginationButton.d.ts +27 -0
  80. package/dist/components/Pagination/helper/PaginationEllipsis.d.ts +15 -0
  81. package/dist/components/Pagination/helper/PaginationGoTo.d.ts +39 -0
  82. package/dist/components/Pagination/helper/PaginationInfo.d.ts +31 -0
  83. package/dist/components/Pagination/helper/PaginationNavigation.d.ts +39 -0
  84. package/dist/components/Pagination/helper/PaginationRowsSelector.d.ts +43 -0
  85. package/dist/components/Pagination/helper/index.d.ts +15 -0
  86. package/dist/components/Pagination/helper/utils.d.ts +21 -0
  87. package/dist/components/Pagination/helper/variants.d.ts +156 -0
  88. package/dist/components/Pagination/index.d.ts +67 -0
  89. package/dist/components/PaginationTest/ListPagination.d.ts +1 -0
  90. package/dist/components/PaginationTest/PaginationDropdown.d.ts +1 -0
  91. package/dist/components/PaginationTest/index.d.ts +1 -0
  92. package/dist/components/PhoneInput/FagDefault.d.ts +2 -0
  93. package/dist/components/PhoneInput/FagDefault.js +24 -0
  94. package/dist/components/PhoneInput/helper/variants.d.ts +105 -0
  95. package/dist/components/PhoneInput/helper/variants.js +47 -0
  96. package/dist/components/PhoneInput/index.d.ts +58 -0
  97. package/dist/components/PhoneInput/index.js +195 -0
  98. package/dist/components/Popover/index.js +61 -61
  99. package/dist/components/ProgressBar/index.d.ts +32 -0
  100. package/dist/components/ProgressBar/index.js +81 -0
  101. package/dist/components/ProgressBar/variants.d.ts +35 -0
  102. package/dist/components/ProgressBar/variants.js +29 -0
  103. package/dist/components/Sidebar/helper/variants.js +5 -5
  104. package/dist/components/Sidebar/index.js +12 -6
  105. package/dist/components/Tab/helper/variants.d.ts +24 -0
  106. package/dist/components/Tab/helper/variants.js +71 -17
  107. package/dist/components/Tab/index.d.ts +4 -3
  108. package/dist/components/Tab/index.js +111 -85
  109. package/dist/components/Tooltip/index.js +31 -31
  110. package/dist/components/TopNavigationBar/helper/index.d.ts +2 -0
  111. package/dist/components/TopNavigationBar/helper/tabNavigation.d.ts +1 -0
  112. package/dist/components/TopNavigationBar/helper/variants.d.ts +54 -0
  113. package/dist/components/TopNavigationBar/index.d.ts +87 -0
  114. package/dist/components/Typography/variants.js +390 -385
  115. package/dist/index.d.ts +24 -1
  116. package/dist/index.js +104 -64
  117. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +63 -65
  118. package/dist/node_modules/@radix-ui/react-id/dist/index.js +8 -8
  119. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +3 -3
  120. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +113 -106
  121. package/dist/node_modules/libphonenumber-js/es6/AsYouType.js +350 -0
  122. package/dist/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternMatcher.js +153 -0
  123. package/dist/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.PatternParser.js +136 -0
  124. package/dist/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js +49 -0
  125. package/dist/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js +247 -0
  126. package/dist/node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js +65 -0
  127. package/dist/node_modules/libphonenumber-js/es6/AsYouTypeParser.js +246 -0
  128. package/dist/node_modules/libphonenumber-js/es6/AsYouTypeState.js +89 -0
  129. package/dist/node_modules/libphonenumber-js/es6/PhoneNumber.js +167 -0
  130. package/dist/node_modules/libphonenumber-js/es6/constants.js +8 -0
  131. package/dist/node_modules/libphonenumber-js/es6/format.js +133 -0
  132. package/dist/node_modules/libphonenumber-js/es6/getExampleNumber.js +8 -0
  133. package/dist/node_modules/libphonenumber-js/es6/helpers/RFC3966.js +11 -0
  134. package/dist/node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js +7 -0
  135. package/dist/node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js +14 -0
  136. package/dist/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js +47 -0
  137. package/dist/node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js +22 -0
  138. package/dist/node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js +35 -0
  139. package/dist/node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js +31 -0
  140. package/dist/node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js +27 -0
  141. package/dist/node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js +13 -0
  142. package/dist/node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js +49 -0
  143. package/dist/node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js +12 -0
  144. package/dist/node_modules/libphonenumber-js/es6/helpers/getNumberType.js +52 -0
  145. package/dist/node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js +14 -0
  146. package/dist/node_modules/libphonenumber-js/es6/helpers/isObject.js +7 -0
  147. package/dist/node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js +6 -0
  148. package/dist/node_modules/libphonenumber-js/es6/helpers/parseDigits.js +114 -0
  149. package/dist/node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js +19 -0
  150. package/dist/node_modules/libphonenumber-js/es6/isPossible.js +42 -0
  151. package/dist/node_modules/libphonenumber-js/es6/isValid.js +12 -0
  152. package/dist/node_modules/libphonenumber-js/es6/metadata.js +456 -0
  153. package/dist/node_modules/libphonenumber-js/es6/tools/semver-compare.js +14 -0
  154. package/dist/node_modules/libphonenumber-js/examples.mobile.json.js +4 -0
  155. package/dist/node_modules/libphonenumber-js/metadata.min.json.js +4 -0
  156. package/dist/node_modules/libphonenumber-js/min/exports/AsYouType.js +10 -0
  157. package/dist/node_modules/libphonenumber-js/min/exports/getExampleNumber.js +8 -0
  158. package/dist/node_modules/libphonenumber-js/min/exports/withMetadataArgument.js +8 -0
  159. package/dist/shared/flags/base64.d.ts +1 -0
  160. package/dist/shared/flags/base64.js +4 -0
  161. package/dist/shared/flags/countries-data.d.ts +5 -0
  162. package/dist/shared/flags/countries-data.js +1220 -0
  163. package/dist/shared/flags/flag-positions.d.ts +993 -0
  164. package/dist/shared/flags/flag-positions.js +246 -0
  165. package/dist/shared/flags/index.d.ts +3 -0
  166. package/dist/shared/hooks/index.d.ts +1 -0
  167. package/dist/shared/hooks/useTruncateTooltip.d.ts +8 -0
  168. package/dist/shared/hooks/useTruncateTooltip.js +19 -0
  169. package/dist/shared/utils/constant.d.ts +1 -0
  170. package/dist/shared/utils/constant.js +18 -0
  171. package/dist/tokens/index.js +11 -6
  172. package/dist/tokens/primitives/colors.d.ts +3 -0
  173. package/dist/tokens/primitives/colors.js +7 -4
  174. package/dist/tokens/primitives/layout.js +1 -0
  175. package/dist/tokens/tailwind-config.d.ts +6 -0
  176. package/dist/tokens/tailwind-config.js +24 -21
  177. package/dist/tokens/theme-types.d.ts +2 -3
  178. package/dist/tokens/utils.js +59 -56
  179. package/package.json +3 -1
  180. package/dist/components/Input/index.js +0 -7
package/README.md CHANGED
@@ -93,6 +93,189 @@ To check for code quality issues:
93
93
  yarn lint
94
94
  ```
95
95
 
96
+ ## Library Usage
97
+
98
+ ### Installation
99
+
100
+ Install the library in your project:
101
+
102
+ ```bash
103
+ npm install mcr-design-system
104
+ # or
105
+ yarn add mcr-design-system
106
+ ```
107
+
108
+ ### Setup with Tailwind CSS v4
109
+
110
+ For projects using **Tailwind CSS v4** (recommended):
111
+
112
+ 1. Install Tailwind CSS v4:
113
+
114
+ ```bash
115
+ npm install tailwindcss@next @tailwindcss/vite
116
+ # or
117
+ yarn add tailwindcss@next @tailwindcss/vite
118
+ ```
119
+
120
+ 2. Configure Vite to use the Tailwind plugin (`vite.config.ts`):
121
+
122
+ ```typescript
123
+ import { defineConfig } from 'vite';
124
+ import react from '@vitejs/plugin-react';
125
+ import tailwindcss from '@tailwindcss/vite';
126
+
127
+ export default defineConfig({
128
+ plugins: [react(), tailwindcss()],
129
+ resolve: {
130
+ alias: {
131
+ '@': resolve(__dirname, './src'),
132
+ },
133
+ },
134
+ });
135
+ ```
136
+
137
+ 3. Create your `tailwind.config.js` using the design system generator:
138
+
139
+ ```javascript
140
+ import { generateTailwindConfig } from 'mcr-design-system';
141
+
142
+ /** @type {import('tailwindcss').Config} */
143
+ export default generateTailwindConfig();
144
+ ```
145
+
146
+ 4. Import Tailwind and configure in your main CSS file:
147
+
148
+ ```css
149
+ @import 'tailwindcss';
150
+ @config '../tailwind.config.js';
151
+
152
+ /* Optional: Add any custom styles */
153
+ ```
154
+
155
+ 5. Wrap your app with the ThemeProvider:
156
+
157
+ ```tsx
158
+ import { ThemeProvider } from 'mcr-design-system';
159
+
160
+ function App() {
161
+ return <ThemeProvider>{/* Your app content */}</ThemeProvider>;
162
+ }
163
+ ```
164
+
165
+ ### Setup with Tailwind CSS v3
166
+
167
+ For projects using **Tailwind CSS v3**:
168
+
169
+ 1. Install Tailwind CSS v3:
170
+
171
+ ```bash
172
+ npm install -D tailwindcss postcss autoprefixer
173
+ # or
174
+ yarn add -D tailwindcss postcss autoprefixer
175
+ ```
176
+
177
+ 2. Create/update your `tailwind.config.js`:
178
+
179
+ ```javascript
180
+ import { generateTailwindConfig } from 'mcr-design-system';
181
+
182
+ /** @type {import('tailwindcss').Config} */
183
+ export default {
184
+ content: [
185
+ './index.html',
186
+ './src/**/*.{js,ts,jsx,tsx}',
187
+ './node_modules/mcr-design-system/dist/**/*.{js,ts,jsx,tsx}',
188
+ ],
189
+ ...generateTailwindConfig(), // Spreads design system tokens and configuration
190
+ };
191
+ ```
192
+
193
+ 3. Configure PostCSS (`postcss.config.js`):
194
+
195
+ ```javascript
196
+ export default {
197
+ plugins: {
198
+ tailwindcss: {},
199
+ autoprefixer: {},
200
+ },
201
+ };
202
+ ```
203
+
204
+ 4. Import Tailwind in your main CSS file:
205
+
206
+ ```css
207
+ @tailwind base;
208
+ @tailwind components;
209
+ @tailwind utilities;
210
+ ```
211
+
212
+ 5. Wrap your app with the ThemeProvider:
213
+
214
+ ```tsx
215
+ import { ThemeProvider } from 'mcr-design-system';
216
+
217
+ function App() {
218
+ return <ThemeProvider>{/* Your app content */}</ThemeProvider>;
219
+ }
220
+ ```
221
+
222
+ ### Using Components
223
+
224
+ Import and use components in your React application:
225
+
226
+ ```tsx
227
+ import { Button, Alert, Typography, Badge } from 'mcr-design-system';
228
+
229
+ function MyComponent() {
230
+ return (
231
+ <div>
232
+ <Typography variant="h1">Welcome</Typography>
233
+ <Button variant="primary" size="lg">
234
+ Click me
235
+ </Button>
236
+ <Alert variant="success">Operation completed successfully!</Alert>
237
+ <Badge variant="info">New</Badge>
238
+ </div>
239
+ );
240
+ }
241
+ ```
242
+
243
+ ### TypeScript Support
244
+
245
+ The library includes full TypeScript support. Import types as needed:
246
+
247
+ ```tsx
248
+ import type { ButtonProps, AlertVariant } from 'mcr-design-system';
249
+
250
+ interface MyComponentProps {
251
+ buttonProps: ButtonProps;
252
+ alertType: AlertVariant;
253
+ }
254
+ ```
255
+
256
+ ### Design Token Access
257
+
258
+ Access design tokens programmatically:
259
+
260
+ ```tsx
261
+ import { useTheme } from 'mcr-design-system';
262
+
263
+ function MyComponent() {
264
+ const theme = useTheme();
265
+
266
+ return (
267
+ <div
268
+ style={{
269
+ backgroundColor: theme.colors.bg.surface.level1,
270
+ color: theme.colors.fg.neutral.main,
271
+ }}
272
+ >
273
+ Custom styled content
274
+ </div>
275
+ );
276
+ }
277
+ ```
278
+
96
279
  ## Project Structure
97
280
 
98
281
  ```
@@ -170,15 +353,31 @@ Note: This will automatically run the build process before publishing.
170
353
 
171
354
  - React 19.x
172
355
  - React DOM 19.x
173
- - Tailwind CSS 4.x
356
+ - Tailwind CSS 4.x (for development)
174
357
  - TypeScript 5.x
175
358
  - Vite 7.x
176
359
 
360
+ ### Peer Dependencies (Required in consuming projects)
361
+
362
+ - **React**: ^18.0.0 || ^19.0.0
363
+ - **React DOM**: ^18.0.0 || ^19.0.0
364
+ - **Tailwind CSS**: ^3.0.0 || ^4.0.0-next
365
+
177
366
  ### Development Tools
178
367
 
179
368
  - ESLint for code linting
180
369
  - Husky for git hooks
181
370
  - Vite Plugin DTS for TypeScript declarations
371
+ - Tailwind Variants for component styling
372
+ - Class Variance Authority for type-safe variants
373
+
374
+ ### Tailwind CSS Compatibility
375
+
376
+ | Tailwind Version | Support Status | Setup Method |
377
+ | ---------------- | ---------------- | ------------------------- |
378
+ | v4.x (Next) | ✅ Recommended | Vite plugin + CSS imports |
379
+ | v3.x | ✅ Supported | PostCSS + config merge |
380
+ | v2.x | ❌ Not supported | - |
182
381
 
183
382
  ## Browser Support
184
383
 
@@ -200,6 +399,43 @@ This project supports modern browsers that are compatible with React 18+ and ES2
200
399
  2. **Node version**: Ensure you're using Node.js version 16 or higher
201
400
  3. **Dependencies**: Delete `node_modules` and `package-lock.json`, then run `yarn install` if you encounter dependency issues
202
401
 
402
+ ### Tailwind CSS Issues
403
+
404
+ #### Styles not applying in consuming project
405
+
406
+ **For Tailwind v4:**
407
+
408
+ - Ensure your `tailwind.config.js` uses `generateTailwindConfig()` from the design system
409
+ - Verify Vite configuration includes `@tailwindcss/vite` plugin
410
+ - Check that your CSS imports `@import 'tailwindcss';` and `@config '../tailwind.config.js';`
411
+ - Verify ThemeProvider wraps your app
412
+
413
+ **For Tailwind v3:**
414
+
415
+ - Verify `tailwind.config.js` includes the design system path in content array
416
+ - Ensure `generateTailwindConfig()` is spread in your config: `...generateTailwindConfig()`
417
+ - Check PostCSS configuration is correct
418
+ - Verify standard Tailwind imports: `@tailwind base;`, `@tailwind components;`, `@tailwind utilities;`
419
+
420
+ #### Design tokens not working
421
+
422
+ 1. Verify ThemeProvider is wrapping your application
423
+ 2. Check console for token loading errors
424
+ 3. Ensure proper CSS imports are in place
425
+
426
+ #### Version conflicts
427
+
428
+ If you encounter version conflicts between Tailwind v3 and v4:
429
+
430
+ ```bash
431
+ # Clear node_modules and lock files
432
+ rm -rf node_modules package-lock.json yarn.lock
433
+ # Reinstall with specific Tailwind version
434
+ npm install tailwindcss@^3.4.0 # for v3
435
+ # or
436
+ npm install tailwindcss@next # for v4
437
+ ```
438
+
203
439
  ### Getting Help
204
440
 
205
441
  If you encounter issues:
@@ -208,3 +444,4 @@ If you encounter issues:
208
444
  2. Ensure all dependencies are properly installed
209
445
  3. Verify Node.js version compatibility
210
446
  4. Check the Vite documentation for additional configuration options
447
+ 5. Review Tailwind CSS documentation for version-specific setup
@@ -11,6 +11,7 @@ declare const badge: import('tailwind-variants').TVReturnType<{
11
11
  yellow: string;
12
12
  violet: string;
13
13
  outline: string;
14
+ boldest: string;
14
15
  };
15
16
  size: {
16
17
  sm: string;
@@ -42,6 +43,7 @@ declare const badge: import('tailwind-variants').TVReturnType<{
42
43
  yellow: string;
43
44
  violet: string;
44
45
  outline: string;
46
+ boldest: string;
45
47
  };
46
48
  size: {
47
49
  sm: string;
@@ -73,6 +75,7 @@ declare const badge: import('tailwind-variants').TVReturnType<{
73
75
  yellow: string;
74
76
  violet: string;
75
77
  outline: string;
78
+ boldest: string;
76
79
  };
77
80
  size: {
78
81
  sm: string;
@@ -0,0 +1,186 @@
1
+ import { jsx as r, jsxs as N } from "react/jsx-runtime";
2
+ import l, { useMemo as f } from "react";
3
+ import { tv as B } from "../../node_modules/tailwind-variants/dist/index.js";
4
+ import { Typography as I } from "../Typography/index.js";
5
+ import "clsx";
6
+ import "tailwind-merge";
7
+ import { dataTestId as _ } from "../../shared/utils/dataTestId.js";
8
+ const j = {
9
+ info: "bg-fg-accent-info-strong",
10
+ success: "bg-fg-accent-success-strong",
11
+ warning: "bg-fg-accent-warning-strong",
12
+ error: "bg-fg-accent-error-strong",
13
+ yellow: "bg-fg-accent-yellow-strong",
14
+ violet: "bg-fg-accent-violet-strong",
15
+ neutral: "bg-fg-neutral-subtle",
16
+ outline: "bg-fg-neutral-subtle",
17
+ boldest: "bg-bg-selected-boldest-rest"
18
+ }, D = B({
19
+ base: "font-medium inline-flex w-fit select-none items-center",
20
+ variants: {
21
+ variant: {
22
+ neutral: "border border-neutral-strong bg-bg-neutral-bold-rest",
23
+ info: "border border-info-light bg-bg-accent-info-subtle text-fg-accent-info-strong",
24
+ success: "border border-success-light bg-bg-accent-success-subtle text-fg-accent-success-strong",
25
+ warning: "border border-warning-light bg-bg-accent-warning-subtle text-fg-accent-warning-strong",
26
+ error: "border border-error-light bg-bg-accent-error-subtle text-fg-accent-error-strong",
27
+ yellow: "border border-yellow-light bg-bg-accent-yellow-subtle text-fg-accent-yellow-strong",
28
+ violet: "border border-violet-light bg-bg-accent-violet-subtle text-fg-accent-violet-strong",
29
+ outline: "bg-bg-surface-level-3 border border-neutral-strong text-fg-neutral-subtle",
30
+ boldest: "border border-warning-light bg-bg-selected-boldest-rest text-fg-selected-bold"
31
+ },
32
+ size: {
33
+ sm: "h-[16px] gap-xs-3 rounded-sm px-xs-3 py-none",
34
+ md: "h-[24px] gap-xs-4 rounded-md px-xs-2 py-xs-4"
35
+ },
36
+ pill: {
37
+ true: "rounded-full px-2",
38
+ false: ""
39
+ },
40
+ emphasize: {
41
+ true: "border-none text-fg-neutral-inverse-static",
42
+ false: ""
43
+ },
44
+ disabled: {
45
+ true: "pointer-events-none opacity-50",
46
+ false: ""
47
+ },
48
+ withIcon: {
49
+ true: "gap-1",
50
+ false: ""
51
+ }
52
+ },
53
+ defaultVariants: {
54
+ variant: "neutral",
55
+ size: "md",
56
+ pill: !1,
57
+ emphasize: !1,
58
+ disabled: !1,
59
+ withIcon: !1
60
+ },
61
+ compoundVariants: [
62
+ {
63
+ variant: "neutral",
64
+ emphasize: !1,
65
+ className: "text-fg-neutral-subtle"
66
+ },
67
+ {
68
+ variant: "neutral",
69
+ emphasize: !0,
70
+ className: " bg-bg-neutral-boldest-rest"
71
+ // className: 'border-none bg-red-500',
72
+ },
73
+ {
74
+ variant: "info",
75
+ emphasize: !0,
76
+ className: "bg-bg-accent-info-rest"
77
+ },
78
+ {
79
+ variant: "success",
80
+ emphasize: !0,
81
+ className: "bg-bg-accent-success-rest"
82
+ },
83
+ {
84
+ variant: "warning",
85
+ emphasize: !0,
86
+ className: "bg-bg-accent-warning-rest"
87
+ },
88
+ {
89
+ variant: "error",
90
+ emphasize: !0,
91
+ className: "bg-bg-accent-error-rest"
92
+ },
93
+ {
94
+ variant: "yellow",
95
+ emphasize: !0,
96
+ className: "bg-bg-accent-yellow-rest"
97
+ },
98
+ {
99
+ variant: "violet",
100
+ emphasize: !0,
101
+ className: "bg-bg-accent-violet-rest"
102
+ },
103
+ {
104
+ variant: "boldest",
105
+ emphasize: !0,
106
+ className: "bg-bg-selected-boldest-rest"
107
+ }
108
+ ]
109
+ }), m = l.memo(({ icon: t, iconAriaLabel: e }) => /* @__PURE__ */ r(
110
+ "span",
111
+ {
112
+ "aria-label": e,
113
+ role: e ? "img" : void 0,
114
+ className: "flex items-center justify-center",
115
+ children: typeof t == "function" ? t({ size: 16, name: "user-03" }) : t
116
+ }
117
+ ));
118
+ m.displayName = "BadgeIcon";
119
+ const p = l.memo(({ variant: t, emphasize: e }) => /* @__PURE__ */ r(
120
+ "span",
121
+ {
122
+ className: `h-1.5 w-1.5 rounded-full ${e ? "bg-fg-neutral-inverse" : j[t]}`,
123
+ "aria-hidden": "true"
124
+ }
125
+ ));
126
+ p.displayName = "BadgeDot";
127
+ const O = l.forwardRef(
128
+ ({
129
+ children: t,
130
+ icon: e,
131
+ iconAriaLabel: h,
132
+ variant: a = "neutral",
133
+ size: n = "md",
134
+ pill: g = !1,
135
+ emphasize: v = !1,
136
+ disabled: s = !1,
137
+ className: c,
138
+ withIcon: i,
139
+ dataTestIdName: b = "Badge",
140
+ dot: u = !1,
141
+ ...x
142
+ }, w) => {
143
+ const o = a === "outline" ? !1 : v, { id: y } = f(() => _(b), [b]), d = !!e, z = f(
144
+ () => D({
145
+ variant: a,
146
+ size: n,
147
+ pill: g,
148
+ emphasize: o,
149
+ disabled: s,
150
+ withIcon: d || i,
151
+ className: c
152
+ }),
153
+ [
154
+ a,
155
+ n,
156
+ g,
157
+ o,
158
+ s,
159
+ d,
160
+ i,
161
+ c
162
+ ]
163
+ );
164
+ return !t && !e && !u ? null : /* @__PURE__ */ N(
165
+ "div",
166
+ {
167
+ ref: w,
168
+ className: z,
169
+ "aria-disabled": s || void 0,
170
+ role: "status",
171
+ tabIndex: s ? -1 : 0,
172
+ "data-testid": y,
173
+ ...x,
174
+ children: [
175
+ e && /* @__PURE__ */ r(m, { icon: e, iconAriaLabel: h }),
176
+ u && !e && /* @__PURE__ */ r(p, { variant: a, emphasize: o }),
177
+ t && /* @__PURE__ */ r(I, { variants: "action-emphasize", size: n, children: t })
178
+ ]
179
+ }
180
+ );
181
+ }
182
+ );
183
+ O.displayName = "Badge";
184
+ export {
185
+ O as default
186
+ };
@@ -0,0 +1,45 @@
1
+ import { default as React } from 'react';
2
+ export type BreadcrumbSeparator = 'slash' | 'dot' | 'arrow';
3
+ export interface BreadcrumbItem {
4
+ /** Display text for the breadcrumb item */
5
+ label: string;
6
+ /** URL to navigate to (if not provided, item is not clickable) */
7
+ href?: string;
8
+ /** Optional icon to display before the label */
9
+ icon?: React.ReactNode;
10
+ /** Whether this is the current/active item */
11
+ current?: boolean;
12
+ /** Click handler for the breadcrumb item */
13
+ onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
14
+ }
15
+ export interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
16
+ /** Array of breadcrumb items */
17
+ items: BreadcrumbItem[];
18
+ /** Type of separator to use between items */
19
+ separator?: BreadcrumbSeparator;
20
+ /** Whether to show icons */
21
+ showIcons?: boolean;
22
+ /** Maximum number of items to show before truncating */
23
+ maxItems?: number;
24
+ /** Custom className */
25
+ className?: string;
26
+ /** Optional data-test-id attribute */
27
+ 'data-test-id'?: string;
28
+ }
29
+ /**
30
+ * Breadcrumb component for navigation hierarchy display
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * <Breadcrumb
35
+ * items={[
36
+ * { label: 'Home', href: '/' },
37
+ * { label: 'Products', href: '/products' },
38
+ * { label: 'Shoes', current: true }
39
+ * ]}
40
+ * separator="slash"
41
+ * />
42
+ * ```
43
+ */
44
+ export declare const Breadcrumb: React.ForwardRefExoticComponent<BreadcrumbProps & React.RefAttributes<HTMLElement>>;
45
+ export default Breadcrumb;
@@ -0,0 +1,136 @@
1
+ import { jsx as n, jsxs as o, Fragment as B } from "react/jsx-runtime";
2
+ import h, { forwardRef as F } from "react";
3
+ import { cn as c } from "../../shared/utils/cn.js";
4
+ import { dataTestId as S } from "../../shared/utils/dataTestId.js";
5
+ import { Dropdown as j } from "../Dropdown/index.js";
6
+ import { breadcrumbVariants as D, breadcrumbLinkVariants as g, breadcrumbItemVariants as w, breadcrumbSeparatorVariants as I } from "./variants.js";
7
+ const L = F(
8
+ ({
9
+ items: l,
10
+ separator: i = "slash",
11
+ showIcons: u = !0,
12
+ maxItems: s,
13
+ className: N,
14
+ "data-test-id": v,
15
+ ...C
16
+ }, k) => {
17
+ const y = S("breadcrumb", v), { displayItems: m, hiddenItems: d } = h.useMemo(() => {
18
+ if (!s || l.length <= s)
19
+ return { displayItems: l, hiddenItems: [] };
20
+ const r = l[0], e = l.slice(-(s - 2)), a = l.slice(1, l.length - (s - 2));
21
+ return {
22
+ displayItems: [r, ...e],
23
+ hiddenItems: a
24
+ };
25
+ }, [l, s]), f = (r) => {
26
+ switch (r) {
27
+ case "slash":
28
+ return "/";
29
+ case "dot":
30
+ return "•";
31
+ case "arrow":
32
+ return ">";
33
+ default:
34
+ return "/";
35
+ }
36
+ }, p = (r, e) => {
37
+ const a = e === m.length - 1, t = r.current || a, b = /* @__PURE__ */ o(B, { children: [
38
+ u && r.icon && /* @__PURE__ */ n("span", { className: "w-4 h-4 flex-shrink-0", children: r.icon }),
39
+ /* @__PURE__ */ n("span", { children: r.label })
40
+ ] });
41
+ return /* @__PURE__ */ o(h.Fragment, { children: [
42
+ /* @__PURE__ */ n(
43
+ "li",
44
+ {
45
+ className: c(
46
+ w({ current: t })
47
+ ),
48
+ children: r.href && !t ? /* @__PURE__ */ n(
49
+ "a",
50
+ {
51
+ href: r.href,
52
+ onClick: r.onClick,
53
+ className: c(g()),
54
+ "aria-current": t ? "page" : void 0,
55
+ children: b
56
+ }
57
+ ) : /* @__PURE__ */ n("span", { "aria-current": t ? "page" : void 0, children: b })
58
+ }
59
+ ),
60
+ !a && /* @__PURE__ */ n(
61
+ "li",
62
+ {
63
+ className: c(I({ variant: i })),
64
+ "aria-hidden": "true",
65
+ children: f(i)
66
+ }
67
+ )
68
+ ] }, e);
69
+ }, V = () => {
70
+ if (d.length === 0) return null;
71
+ const r = d.map((e) => ({
72
+ value: e.href || e.label,
73
+ label: e.label,
74
+ icon: u && e.icon ? e.icon : void 0
75
+ }));
76
+ return /* @__PURE__ */ o(h.Fragment, { children: [
77
+ /* @__PURE__ */ n("li", { className: c(w({ current: !1 })), children: /* @__PURE__ */ n(
78
+ j,
79
+ {
80
+ items: r,
81
+ placeholder: "...",
82
+ onValueChange: (e) => {
83
+ const a = d.find(
84
+ (t) => (t.href || t.label) === e
85
+ );
86
+ if (a?.onClick && a.href) {
87
+ const t = new MouseEvent("click");
88
+ a.onClick(t);
89
+ } else a?.href && (window.location.href = a.href);
90
+ },
91
+ trigger: /* @__PURE__ */ n(
92
+ "button",
93
+ {
94
+ className: c(
95
+ g(),
96
+ "inline-flex items-center gap-1 px-2 py-1 text-sm"
97
+ ),
98
+ "aria-label": "Show hidden breadcrumb items",
99
+ children: /* @__PURE__ */ n("span", { children: "..." })
100
+ }
101
+ ),
102
+ side: "bottom",
103
+ align: "start"
104
+ }
105
+ ) }),
106
+ /* @__PURE__ */ n(
107
+ "li",
108
+ {
109
+ className: c(I({ variant: i })),
110
+ "aria-hidden": "true",
111
+ children: f(i)
112
+ }
113
+ )
114
+ ] }, "dropdown");
115
+ };
116
+ return /* @__PURE__ */ n(
117
+ "nav",
118
+ {
119
+ ref: k,
120
+ className: c(D({ className: N })),
121
+ "aria-label": "Breadcrumb",
122
+ "data-test-id": y,
123
+ ...C,
124
+ children: /* @__PURE__ */ n("ol", { className: "flex items-center flex-wrap gap-1", children: m.map((r, e) => e === 1 && d.length > 0 ? /* @__PURE__ */ o(h.Fragment, { children: [
125
+ V(),
126
+ p(r, e)
127
+ ] }, `item-${e}`) : p(r, e)) })
128
+ }
129
+ );
130
+ }
131
+ );
132
+ L.displayName = "Breadcrumb";
133
+ export {
134
+ L as Breadcrumb,
135
+ L as default
136
+ };
@@ -0,0 +1,37 @@
1
+ export declare const breadcrumbVariants: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, "flex items-center flex-wrap gap-1", {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, "flex items-center flex-wrap gap-1", unknown, unknown, undefined>>;
2
+ export declare const breadcrumbItemVariants: import('tailwind-variants').TVReturnType<{
3
+ current: {
4
+ true: string;
5
+ false: string;
6
+ };
7
+ }, undefined, string[], {
8
+ current: {
9
+ true: string;
10
+ false: string;
11
+ };
12
+ }, undefined, import('tailwind-variants').TVReturnType<{
13
+ current: {
14
+ true: string;
15
+ false: string;
16
+ };
17
+ }, undefined, string[], unknown, unknown, undefined>>;
18
+ export declare const breadcrumbSeparatorVariants: import('tailwind-variants').TVReturnType<{
19
+ variant: {
20
+ slash: string;
21
+ dot: string;
22
+ arrow: string;
23
+ };
24
+ }, undefined, string[], {
25
+ variant: {
26
+ slash: string;
27
+ dot: string;
28
+ arrow: string;
29
+ };
30
+ }, undefined, import('tailwind-variants').TVReturnType<{
31
+ variant: {
32
+ slash: string;
33
+ dot: string;
34
+ arrow: string;
35
+ };
36
+ }, undefined, string[], unknown, unknown, undefined>>;
37
+ export declare const breadcrumbLinkVariants: import('tailwind-variants').TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import('tailwind-variants').TVReturnType<unknown, undefined, string[], unknown, unknown, undefined>>;