@codefast/ui 0.3.1-canary.8 → 0.3.1
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/CHANGELOG.md +218 -0
- package/dist/cjs/components/calendar.cjs.map +1 -1
- package/dist/cjs/components/chart.cjs.map +1 -1
- package/dist/cjs/components/form.cjs.map +1 -1
- package/dist/cjs/components/pagination.cjs.map +1 -1
- package/dist/cjs/components/progress-circle.cjs.map +1 -1
- package/dist/cjs/components/spinner.cjs.map +1 -1
- package/dist/esm/components/calendar.js.map +1 -1
- package/dist/esm/components/chart.js.map +1 -1
- package/dist/esm/components/form.js.map +1 -1
- package/dist/esm/components/pagination.js.map +1 -1
- package/dist/esm/components/progress-circle.js.map +1 -1
- package/dist/esm/components/spinner.js.map +1 -1
- package/package.json +325 -325
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,223 @@
|
|
|
1
1
|
# @codefast/ui
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`9a962dd`](https://github.com/codefastlabs/codefast/commit/9a962ddc9c1bcae30ec79ebde64b321db53d4da9) Thanks [@thevuong](https://github.com/thevuong)! - fix(cli): correct binary path and version retrieval logic
|
|
8
|
+
|
|
9
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`2335615`](https://github.com/codefastlabs/codefast/commit/233561592edad614f5083fbf552fb2ca0c7f3342) Thanks [@thevuong](https://github.com/thevuong)! - fix(dependencies): update multiple dependencies to latest versions
|
|
10
|
+
|
|
11
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`8509d93`](https://github.com/codefastlabs/codefast/commit/8509d93373d7bd33c763f0a0697fc615cfadd207) Thanks [@thevuong](https://github.com/thevuong)! - feat: add eslint-import-resolver-typescript dependency and format import rules
|
|
12
|
+
|
|
13
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`8cfbef1`](https://github.com/codefastlabs/codefast/commit/8cfbef1dcb74e5d790c65327fd0bba6746986e54) Thanks [@thevuong](https://github.com/thevuong)! - feat: add environment-aware build configurations
|
|
14
|
+
|
|
15
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`11f69ea`](https://github.com/codefastlabs/codefast/commit/11f69ea2b300959572853b4d8554f7a8db59184f) Thanks [@thevuong](https://github.com/thevuong)! - feat(ui): enhance scrollbar styles and optimize dev scripts
|
|
16
|
+
|
|
17
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`64f8f15`](https://github.com/codefastlabs/codefast/commit/64f8f15fd036ec87ed54022e15c7bae635ee4337) Thanks [@thevuong](https://github.com/thevuong)! - chore(deps): update package dependencies
|
|
18
|
+
|
|
19
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`ac7b430`](https://github.com/codefastlabs/codefast/commit/ac7b4304a8ce1c5e00bda01f8a9acbd0c37827aa) Thanks [@thevuong](https://github.com/thevuong)! - chore(dependencies): update package versions
|
|
20
|
+
|
|
21
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`2f7758d`](https://github.com/codefastlabs/codefast/commit/2f7758d0bc8e0a989644843c0f7d57227ab98d98) Thanks [@thevuong](https://github.com/thevuong)! - chore: update package dependencies across multiple packages to ensure compatibility and access new features
|
|
22
|
+
|
|
23
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`ea44123`](https://github.com/codefastlabs/codefast/commit/ea44123de09904b7b70b57dc5453171a53136423) Thanks [@thevuong](https://github.com/thevuong)! - feat: update peer dependencies and add unrs-resolver
|
|
24
|
+
|
|
25
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`1f7120b`](https://github.com/codefastlabs/codefast/commit/1f7120bc15fed4d6355a66490489e6c279c4de29) Thanks [@thevuong](https://github.com/thevuong)! - fix(package.json): update repository URL format and bin path
|
|
26
|
+
|
|
27
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`06bc9ba`](https://github.com/codefastlabs/codefast/commit/06bc9ba72a65f0f49c287985147963fe0a0de18b) Thanks [@thevuong](https://github.com/thevuong)! - fix: correct types and default exports in package.json for various components
|
|
28
|
+
|
|
29
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`0f29ef5`](https://github.com/codefastlabs/codefast/commit/0f29ef56e23a0b6540f9f7f98c10d5ed6ca96561) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): add support for optimizePackageImports in Next.js config
|
|
30
|
+
|
|
31
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`3c2a6c9`](https://github.com/codefastlabs/codefast/commit/3c2a6c9cc913d97179508d94b781701178203051) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): add cleanup step to remove unnecessary packages
|
|
32
|
+
|
|
33
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`72d204b`](https://github.com/codefastlabs/codefast/commit/72d204be70cbee040c00a2a4792fe2aac50933c0) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): enhance project setup with new dependencies and improved formatting scripts
|
|
34
|
+
|
|
35
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`fab3c11`](https://github.com/codefastlabs/codefast/commit/fab3c117f06224d03c16f40b24f4a983aa03dae7) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): enhance project setup with Prettier ignore support
|
|
36
|
+
|
|
37
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`84a3726`](https://github.com/codefastlabs/codefast/commit/84a3726573c81a324489a88fa06bc6c26605e735) Thanks [@thevuong](https://github.com/thevuong)! - fix(cli): update lint script to use autofix option
|
|
38
|
+
|
|
39
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`22e3c61`](https://github.com/codefastlabs/codefast/commit/22e3c61008eb90c15bac1c384b8e1e8fd189a6d7) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): skip Next.js project creation if package.json exists
|
|
40
|
+
|
|
41
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`999a691`](https://github.com/codefastlabs/codefast/commit/999a691ff212b6bcb5356bbf6cc7698a4924b1db) Thanks [@thevuong](https://github.com/thevuong)! - feat: update jsx-a11y rule overrides for accessibility needs
|
|
42
|
+
|
|
43
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`528451f`](https://github.com/codefastlabs/codefast/commit/528451f31c26502bda448c4e9570be26aee90b59) Thanks [@thevuong](https://github.com/thevuong)! - refactor: simplify command parameters and improve configuration handling in project and export commands
|
|
44
|
+
|
|
45
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`b3071f0`](https://github.com/codefastlabs/codefast/commit/b3071f07df0687526475d87fe1904698e3e25cbd) Thanks [@thevuong](https://github.com/thevuong)! - fix(cli): correct dark mode CSS selector in constants
|
|
46
|
+
|
|
47
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`cce2a38`](https://github.com/codefastlabs/codefast/commit/cce2a380cddd2cb92803fc2bb56e4107ee4b53c5) Thanks [@thevuong](https://github.com/thevuong)! - fix(styles): correct CSS variable names for outline and scrollbar
|
|
48
|
+
|
|
49
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`9db142c`](https://github.com/codefastlabs/codefast/commit/9db142c2548c36a020aba26dc48532fa7f7a680e) Thanks [@thevuong](https://github.com/thevuong)! - feat: support optional values in change handlers
|
|
50
|
+
|
|
51
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`f5d4f8c`](https://github.com/codefastlabs/codefast/commit/f5d4f8c5db6bccc92794450092cc39d038797df3) Thanks [@thevuong](https://github.com/thevuong)! - refactor(cli): adjust comment formatting in config-files.ts
|
|
52
|
+
|
|
53
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`69202e9`](https://github.com/codefastlabs/codefast/commit/69202e9ee023764669f53de3497fbd3b121ca668) Thanks [@thevuong](https://github.com/thevuong)! - refactor(cli): simplify command registration and improve import statements
|
|
54
|
+
|
|
55
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`3eed1b7`](https://github.com/codefastlabs/codefast/commit/3eed1b74e7e8252d13a842592bc3476b1eefeaf4) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): add `codefast` CLI package with initial features
|
|
56
|
+
|
|
57
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`b4f8ceb`](https://github.com/codefastlabs/codefast/commit/b4f8ceb1df8d9ddc17b9b73e97051a7bdcbe1f8f) Thanks [@thevuong](https://github.com/thevuong)! - chore(dependencies): update eslint and related dependencies to latest versions across packages
|
|
58
|
+
|
|
59
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`235182c`](https://github.com/codefastlabs/codefast/commit/235182c0e05d3dc4027c9280c21386ae12e8a22e) Thanks [@thevuong](https://github.com/thevuong)! - fix(cli): remove redundant default action from CLI
|
|
60
|
+
|
|
61
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`0e13b93`](https://github.com/codefastlabs/codefast/commit/0e13b9327c563b408826554fada5e6ad219dcea6) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): update layout.tsx with fontVariables support
|
|
62
|
+
|
|
63
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`f4651b1`](https://github.com/codefastlabs/codefast/commit/f4651b1f372664e0d08a0afe72e2ec2251fdeb6b) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): add type-checking script to generated projects
|
|
64
|
+
|
|
65
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`45ff1a9`](https://github.com/codefastlabs/codefast/commit/45ff1a937ca27c502c745a49dd32c26d54967bc1) Thanks [@thevuong](https://github.com/thevuong)! - changeset
|
|
66
|
+
|
|
67
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`26c326c`](https://github.com/codefastlabs/codefast/commit/26c326c9fa59fb710eebc383a109d53a7a66a54d) Thanks [@thevuong](https://github.com/thevuong)! - refactor(cli): update styles and constants for project creation
|
|
68
|
+
|
|
69
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`1cc10af`](https://github.com/codefastlabs/codefast/commit/1cc10af0c971a5bfb2db67fef041ef82a167479c) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): modularize project creation functionalities
|
|
70
|
+
|
|
71
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`1d7e0b4`](https://github.com/codefastlabs/codefast/commit/1d7e0b4f3073cd17e582a5f8cac57364444cd9b0) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): update packages to remove in project creation
|
|
72
|
+
|
|
73
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`5861995`](https://github.com/codefastlabs/codefast/commit/5861995d71d5254d4050b353a835f96b192c4c31) Thanks [@thevuong](https://github.com/thevuong)! - refactor(cli): improve config file handling in project setup
|
|
74
|
+
|
|
75
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`b4b5bd8`](https://github.com/codefastlabs/codefast/commit/b4b5bd8303d35996d3a44be89e39f3ac8bb36a66) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): add lucide-react to default project dependencies
|
|
76
|
+
|
|
77
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`2b06496`](https://github.com/codefastlabs/codefast/commit/2b064962d114400d14a4067e1603c45fb1593c17) Thanks [@thevuong](https://github.com/thevuong)! - refactor(cli): remove logger utility and update logging usage
|
|
78
|
+
|
|
79
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`d260167`](https://github.com/codefastlabs/codefast/commit/d2601677455c76ed66b24c840b92e6a1ddc62a60) Thanks [@thevuong](https://github.com/thevuong)! - feat: enhance ESLint rules with detailed configurations
|
|
80
|
+
|
|
81
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`3d98dde`](https://github.com/codefastlabs/codefast/commit/3d98ddecece720d95c50c43f603f539c8595cefb) Thanks [@thevuong](https://github.com/thevuong)! - chore(dependencies): update dependencies to latest versions
|
|
82
|
+
|
|
83
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`abd1ee9`](https://github.com/codefastlabs/codefast/commit/abd1ee91da009bd1aac98cd9b7896547431fbdcb) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): improve ReactNode handling and RootLayout typings
|
|
84
|
+
|
|
85
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`7b7b459`](https://github.com/codefastlabs/codefast/commit/7b7b4596bd30b6e53a7cf5d165ccede98c60d7d2) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): add files field to package.json for better packaging
|
|
86
|
+
|
|
87
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`d6dbb0b`](https://github.com/codefastlabs/codefast/commit/d6dbb0b3d1358e5ce0bcde9f0ad9a2b6958ba8b8) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): add enhanced project creation command
|
|
88
|
+
|
|
89
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`a943b3d`](https://github.com/codefastlabs/codefast/commit/a943b3dadef73a2100dbf7394815e9b858040d94) Thanks [@thevuong](https://github.com/thevuong)! - feat(style-guide): update sorting rules for interfaces and object types
|
|
90
|
+
|
|
91
|
+
- [#150](https://github.com/codefastlabs/codefast/pull/150) [`9f45422`](https://github.com/codefastlabs/codefast/commit/9f454223b2b47e3562f808288ae7091e371550f1) Thanks [@thevuong](https://github.com/thevuong)! - refactor(cli): centralize file operations and error handling
|
|
92
|
+
|
|
93
|
+
- Updated dependencies [[`9a962dd`](https://github.com/codefastlabs/codefast/commit/9a962ddc9c1bcae30ec79ebde64b321db53d4da9), [`2335615`](https://github.com/codefastlabs/codefast/commit/233561592edad614f5083fbf552fb2ca0c7f3342), [`8509d93`](https://github.com/codefastlabs/codefast/commit/8509d93373d7bd33c763f0a0697fc615cfadd207), [`8cfbef1`](https://github.com/codefastlabs/codefast/commit/8cfbef1dcb74e5d790c65327fd0bba6746986e54), [`11f69ea`](https://github.com/codefastlabs/codefast/commit/11f69ea2b300959572853b4d8554f7a8db59184f), [`64f8f15`](https://github.com/codefastlabs/codefast/commit/64f8f15fd036ec87ed54022e15c7bae635ee4337), [`ac7b430`](https://github.com/codefastlabs/codefast/commit/ac7b4304a8ce1c5e00bda01f8a9acbd0c37827aa), [`2f7758d`](https://github.com/codefastlabs/codefast/commit/2f7758d0bc8e0a989644843c0f7d57227ab98d98), [`ea44123`](https://github.com/codefastlabs/codefast/commit/ea44123de09904b7b70b57dc5453171a53136423), [`1f7120b`](https://github.com/codefastlabs/codefast/commit/1f7120bc15fed4d6355a66490489e6c279c4de29), [`06bc9ba`](https://github.com/codefastlabs/codefast/commit/06bc9ba72a65f0f49c287985147963fe0a0de18b), [`0f29ef5`](https://github.com/codefastlabs/codefast/commit/0f29ef56e23a0b6540f9f7f98c10d5ed6ca96561), [`3c2a6c9`](https://github.com/codefastlabs/codefast/commit/3c2a6c9cc913d97179508d94b781701178203051), [`72d204b`](https://github.com/codefastlabs/codefast/commit/72d204be70cbee040c00a2a4792fe2aac50933c0), [`fab3c11`](https://github.com/codefastlabs/codefast/commit/fab3c117f06224d03c16f40b24f4a983aa03dae7), [`84a3726`](https://github.com/codefastlabs/codefast/commit/84a3726573c81a324489a88fa06bc6c26605e735), [`22e3c61`](https://github.com/codefastlabs/codefast/commit/22e3c61008eb90c15bac1c384b8e1e8fd189a6d7), [`999a691`](https://github.com/codefastlabs/codefast/commit/999a691ff212b6bcb5356bbf6cc7698a4924b1db), [`528451f`](https://github.com/codefastlabs/codefast/commit/528451f31c26502bda448c4e9570be26aee90b59), [`b3071f0`](https://github.com/codefastlabs/codefast/commit/b3071f07df0687526475d87fe1904698e3e25cbd), [`cce2a38`](https://github.com/codefastlabs/codefast/commit/cce2a380cddd2cb92803fc2bb56e4107ee4b53c5), [`9db142c`](https://github.com/codefastlabs/codefast/commit/9db142c2548c36a020aba26dc48532fa7f7a680e), [`f5d4f8c`](https://github.com/codefastlabs/codefast/commit/f5d4f8c5db6bccc92794450092cc39d038797df3), [`69202e9`](https://github.com/codefastlabs/codefast/commit/69202e9ee023764669f53de3497fbd3b121ca668), [`3eed1b7`](https://github.com/codefastlabs/codefast/commit/3eed1b74e7e8252d13a842592bc3476b1eefeaf4), [`b4f8ceb`](https://github.com/codefastlabs/codefast/commit/b4f8ceb1df8d9ddc17b9b73e97051a7bdcbe1f8f), [`235182c`](https://github.com/codefastlabs/codefast/commit/235182c0e05d3dc4027c9280c21386ae12e8a22e), [`0e13b93`](https://github.com/codefastlabs/codefast/commit/0e13b9327c563b408826554fada5e6ad219dcea6), [`f4651b1`](https://github.com/codefastlabs/codefast/commit/f4651b1f372664e0d08a0afe72e2ec2251fdeb6b), [`45ff1a9`](https://github.com/codefastlabs/codefast/commit/45ff1a937ca27c502c745a49dd32c26d54967bc1), [`26c326c`](https://github.com/codefastlabs/codefast/commit/26c326c9fa59fb710eebc383a109d53a7a66a54d), [`1cc10af`](https://github.com/codefastlabs/codefast/commit/1cc10af0c971a5bfb2db67fef041ef82a167479c), [`1d7e0b4`](https://github.com/codefastlabs/codefast/commit/1d7e0b4f3073cd17e582a5f8cac57364444cd9b0), [`5861995`](https://github.com/codefastlabs/codefast/commit/5861995d71d5254d4050b353a835f96b192c4c31), [`b4b5bd8`](https://github.com/codefastlabs/codefast/commit/b4b5bd8303d35996d3a44be89e39f3ac8bb36a66), [`2b06496`](https://github.com/codefastlabs/codefast/commit/2b064962d114400d14a4067e1603c45fb1593c17), [`d260167`](https://github.com/codefastlabs/codefast/commit/d2601677455c76ed66b24c840b92e6a1ddc62a60), [`3d98dde`](https://github.com/codefastlabs/codefast/commit/3d98ddecece720d95c50c43f603f539c8595cefb), [`abd1ee9`](https://github.com/codefastlabs/codefast/commit/abd1ee91da009bd1aac98cd9b7896547431fbdcb), [`7b7b459`](https://github.com/codefastlabs/codefast/commit/7b7b4596bd30b6e53a7cf5d165ccede98c60d7d2), [`d6dbb0b`](https://github.com/codefastlabs/codefast/commit/d6dbb0b3d1358e5ce0bcde9f0ad9a2b6958ba8b8), [`a943b3d`](https://github.com/codefastlabs/codefast/commit/a943b3dadef73a2100dbf7394815e9b858040d94), [`9f45422`](https://github.com/codefastlabs/codefast/commit/9f454223b2b47e3562f808288ae7091e371550f1)]:
|
|
94
|
+
- @codefast-ui/progress-circle@0.3.1
|
|
95
|
+
- @codefast-ui/checkbox-group@0.3.1
|
|
96
|
+
- @codefast-ui/input-number@0.3.1
|
|
97
|
+
- @codefast-ui/input@0.3.1
|
|
98
|
+
- @codefast/hooks@0.3.1
|
|
99
|
+
|
|
100
|
+
## 0.3.1-canary.15
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- [`3567101`](https://github.com/codefastlabs/codefast/commit/35671017419adc327528a7fe3fdf3cfa06328fac) Thanks [@thevuong](https://github.com/thevuong)! - chore(dependencies): update eslint and related dependencies to latest versions across packages
|
|
105
|
+
|
|
106
|
+
- Updated dependencies [[`3567101`](https://github.com/codefastlabs/codefast/commit/35671017419adc327528a7fe3fdf3cfa06328fac)]:
|
|
107
|
+
- @codefast-ui/progress-circle@0.3.1-canary.15
|
|
108
|
+
- @codefast-ui/checkbox-group@0.3.1-canary.15
|
|
109
|
+
- @codefast-ui/input-number@0.3.1-canary.15
|
|
110
|
+
- @codefast-ui/input@0.3.1-canary.15
|
|
111
|
+
- @codefast/hooks@0.3.1-canary.15
|
|
112
|
+
|
|
113
|
+
## 0.3.1-canary.14
|
|
114
|
+
|
|
115
|
+
### Patch Changes
|
|
116
|
+
|
|
117
|
+
- [`df6ae17`](https://github.com/codefastlabs/codefast/commit/df6ae17f547a820614fb456c9556e61cbc8abd5e) Thanks [@thevuong](https://github.com/thevuong)! - chore: update package dependencies across multiple packages to ensure compatibility and access new features
|
|
118
|
+
|
|
119
|
+
- [`5ea0cf3`](https://github.com/codefastlabs/codefast/commit/5ea0cf3347bff9cfc58b66b65cc039d410d3729e) Thanks [@thevuong](https://github.com/thevuong)! - fix: correct types and default exports in package.json for various components
|
|
120
|
+
|
|
121
|
+
- [`bc6d38e`](https://github.com/codefastlabs/codefast/commit/bc6d38eb8f300426fdfd8a51ea394e25bce4583a) Thanks [@thevuong](https://github.com/thevuong)! - refactor: simplify command parameters and improve configuration handling in project and export commands
|
|
122
|
+
|
|
123
|
+
- Updated dependencies [[`df6ae17`](https://github.com/codefastlabs/codefast/commit/df6ae17f547a820614fb456c9556e61cbc8abd5e), [`5ea0cf3`](https://github.com/codefastlabs/codefast/commit/5ea0cf3347bff9cfc58b66b65cc039d410d3729e), [`bc6d38e`](https://github.com/codefastlabs/codefast/commit/bc6d38eb8f300426fdfd8a51ea394e25bce4583a)]:
|
|
124
|
+
- @codefast-ui/progress-circle@0.3.1-canary.14
|
|
125
|
+
- @codefast-ui/checkbox-group@0.3.1-canary.14
|
|
126
|
+
- @codefast-ui/input-number@0.3.1-canary.14
|
|
127
|
+
- @codefast-ui/input@0.3.1-canary.14
|
|
128
|
+
- @codefast/hooks@0.3.1-canary.14
|
|
129
|
+
|
|
130
|
+
## 0.3.1-canary.13
|
|
131
|
+
|
|
132
|
+
### Patch Changes
|
|
133
|
+
|
|
134
|
+
- [`cd28e81`](https://github.com/codefastlabs/codefast/commit/cd28e81b34be31b1c73abbdaabe47e27952bd5df) Thanks [@thevuong](https://github.com/thevuong)! - feat: add eslint-import-resolver-typescript dependency and format import rules
|
|
135
|
+
|
|
136
|
+
- [`1990579`](https://github.com/codefastlabs/codefast/commit/19905793ee89b2223402592c753e35e81ed46182) Thanks [@thevuong](https://github.com/thevuong)! - chore(deps): update package dependencies
|
|
137
|
+
|
|
138
|
+
- [`40d05e8`](https://github.com/codefastlabs/codefast/commit/40d05e8b33a0189ce4f7d942e18b6f43daa18756) Thanks [@thevuong](https://github.com/thevuong)! - refactor(cli): simplify command registration and improve import statements
|
|
139
|
+
|
|
140
|
+
- [`952e0a3`](https://github.com/codefastlabs/codefast/commit/952e0a349defcda5c62409c39b751ebd30e78c52) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): add type-checking script to generated projects
|
|
141
|
+
|
|
142
|
+
- Updated dependencies [[`cd28e81`](https://github.com/codefastlabs/codefast/commit/cd28e81b34be31b1c73abbdaabe47e27952bd5df), [`1990579`](https://github.com/codefastlabs/codefast/commit/19905793ee89b2223402592c753e35e81ed46182), [`40d05e8`](https://github.com/codefastlabs/codefast/commit/40d05e8b33a0189ce4f7d942e18b6f43daa18756), [`952e0a3`](https://github.com/codefastlabs/codefast/commit/952e0a349defcda5c62409c39b751ebd30e78c52)]:
|
|
143
|
+
- @codefast-ui/progress-circle@0.3.1-canary.13
|
|
144
|
+
- @codefast-ui/checkbox-group@0.3.1-canary.13
|
|
145
|
+
- @codefast-ui/input-number@0.3.1-canary.13
|
|
146
|
+
- @codefast-ui/input@0.3.1-canary.13
|
|
147
|
+
- @codefast/hooks@0.3.1-canary.13
|
|
148
|
+
|
|
149
|
+
## 0.3.1-canary.12
|
|
150
|
+
|
|
151
|
+
### Patch Changes
|
|
152
|
+
|
|
153
|
+
- [`0841266`](https://github.com/codefastlabs/codefast/commit/0841266536570b017099fd32b6f0b732cc562932) Thanks [@thevuong](https://github.com/thevuong)! - fix(cli): remove redundant default action from CLI
|
|
154
|
+
|
|
155
|
+
- [`5d33972`](https://github.com/codefastlabs/codefast/commit/5d339720048479b37ce3ded253d5182364df6762) Thanks [@thevuong](https://github.com/thevuong)! - refactor(cli): update styles and constants for project creation
|
|
156
|
+
|
|
157
|
+
- [`109a2a5`](https://github.com/codefastlabs/codefast/commit/109a2a5cf4a205d4c5ceb5c3ac7afa95ca69a51d) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): improve ReactNode handling and RootLayout typings
|
|
158
|
+
|
|
159
|
+
- [`e873ddc`](https://github.com/codefastlabs/codefast/commit/e873ddcdabb110655e39aa7a69a0850c9050186e) Thanks [@thevuong](https://github.com/thevuong)! - refactor(cli): centralize file operations and error handling
|
|
160
|
+
|
|
161
|
+
- Updated dependencies [[`0841266`](https://github.com/codefastlabs/codefast/commit/0841266536570b017099fd32b6f0b732cc562932), [`5d33972`](https://github.com/codefastlabs/codefast/commit/5d339720048479b37ce3ded253d5182364df6762), [`109a2a5`](https://github.com/codefastlabs/codefast/commit/109a2a5cf4a205d4c5ceb5c3ac7afa95ca69a51d), [`e873ddc`](https://github.com/codefastlabs/codefast/commit/e873ddcdabb110655e39aa7a69a0850c9050186e)]:
|
|
162
|
+
- @codefast-ui/progress-circle@0.3.1-canary.12
|
|
163
|
+
- @codefast-ui/checkbox-group@0.3.1-canary.12
|
|
164
|
+
- @codefast-ui/input-number@0.3.1-canary.12
|
|
165
|
+
- @codefast-ui/input@0.3.1-canary.12
|
|
166
|
+
- @codefast/hooks@0.3.1-canary.12
|
|
167
|
+
|
|
168
|
+
## 0.3.1-canary.11
|
|
169
|
+
|
|
170
|
+
### Patch Changes
|
|
171
|
+
|
|
172
|
+
- [`6b32857`](https://github.com/codefastlabs/codefast/commit/6b32857abb5960c780a46a642b114a2f459cbb4c) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): add support for optimizePackageImports in Next.js config
|
|
173
|
+
|
|
174
|
+
- [`b33cd3c`](https://github.com/codefastlabs/codefast/commit/b33cd3c893c16861d70e25476973a2b6973a3736) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): enhance project setup with Prettier ignore support
|
|
175
|
+
|
|
176
|
+
- [`6acb04b`](https://github.com/codefastlabs/codefast/commit/6acb04b3d8efaeb17a0a4944652f76b21b59ffcb) Thanks [@thevuong](https://github.com/thevuong)! - refactor(cli): adjust comment formatting in config-files.ts
|
|
177
|
+
|
|
178
|
+
- Updated dependencies [[`6b32857`](https://github.com/codefastlabs/codefast/commit/6b32857abb5960c780a46a642b114a2f459cbb4c), [`b33cd3c`](https://github.com/codefastlabs/codefast/commit/b33cd3c893c16861d70e25476973a2b6973a3736), [`6acb04b`](https://github.com/codefastlabs/codefast/commit/6acb04b3d8efaeb17a0a4944652f76b21b59ffcb)]:
|
|
179
|
+
- @codefast-ui/progress-circle@0.3.1-canary.11
|
|
180
|
+
- @codefast-ui/checkbox-group@0.3.1-canary.11
|
|
181
|
+
- @codefast-ui/input-number@0.3.1-canary.11
|
|
182
|
+
- @codefast-ui/input@0.3.1-canary.11
|
|
183
|
+
- @codefast/hooks@0.3.1-canary.11
|
|
184
|
+
|
|
185
|
+
## 0.3.1-canary.10
|
|
186
|
+
|
|
187
|
+
### Patch Changes
|
|
188
|
+
|
|
189
|
+
- [`377ffb7`](https://github.com/codefastlabs/codefast/commit/377ffb7395bee448703d490ecf461c218df90d97) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): enhance project setup with new dependencies and improved formatting scripts
|
|
190
|
+
|
|
191
|
+
- [`d3f7fd0`](https://github.com/codefastlabs/codefast/commit/d3f7fd09976bbda34903ea376c58c590900aeef0) Thanks [@thevuong](https://github.com/thevuong)! - fix(cli): correct dark mode CSS selector in constants
|
|
192
|
+
|
|
193
|
+
- [`c57b54a`](https://github.com/codefastlabs/codefast/commit/c57b54a234a9a07dfbe800664126b8eb405f44c4) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): add lucide-react to default project dependencies
|
|
194
|
+
|
|
195
|
+
- Updated dependencies [[`377ffb7`](https://github.com/codefastlabs/codefast/commit/377ffb7395bee448703d490ecf461c218df90d97), [`d3f7fd0`](https://github.com/codefastlabs/codefast/commit/d3f7fd09976bbda34903ea376c58c590900aeef0), [`c57b54a`](https://github.com/codefastlabs/codefast/commit/c57b54a234a9a07dfbe800664126b8eb405f44c4)]:
|
|
196
|
+
- @codefast-ui/progress-circle@0.3.1-canary.10
|
|
197
|
+
- @codefast-ui/checkbox-group@0.3.1-canary.10
|
|
198
|
+
- @codefast-ui/input-number@0.3.1-canary.10
|
|
199
|
+
- @codefast-ui/input@0.3.1-canary.10
|
|
200
|
+
- @codefast/hooks@0.3.1-canary.10
|
|
201
|
+
|
|
202
|
+
## 0.3.1-canary.9
|
|
203
|
+
|
|
204
|
+
### Patch Changes
|
|
205
|
+
|
|
206
|
+
- [`77d43d1`](https://github.com/codefastlabs/codefast/commit/77d43d1dfa36b856125956f9edaf141262914831) Thanks [@thevuong](https://github.com/thevuong)! - chore(dependencies): update package versions
|
|
207
|
+
|
|
208
|
+
- [`b5558d7`](https://github.com/codefastlabs/codefast/commit/b5558d7fc117c3e5314d88fe9aff48f84c7ffc18) Thanks [@thevuong](https://github.com/thevuong)! - feat: update peer dependencies and add unrs-resolver
|
|
209
|
+
|
|
210
|
+
- [`04a8165`](https://github.com/codefastlabs/codefast/commit/04a8165e6ad8e7c17e715b286d3c9aed0f7dbb02) Thanks [@thevuong](https://github.com/thevuong)! - feat(cli): update packages to remove in project creation
|
|
211
|
+
|
|
212
|
+
- [`9c32c5d`](https://github.com/codefastlabs/codefast/commit/9c32c5d97724d09436de51ed17a9af7af3ed55bd) Thanks [@thevuong](https://github.com/thevuong)! - feat(style-guide): update sorting rules for interfaces and object types
|
|
213
|
+
|
|
214
|
+
- Updated dependencies [[`77d43d1`](https://github.com/codefastlabs/codefast/commit/77d43d1dfa36b856125956f9edaf141262914831), [`b5558d7`](https://github.com/codefastlabs/codefast/commit/b5558d7fc117c3e5314d88fe9aff48f84c7ffc18), [`04a8165`](https://github.com/codefastlabs/codefast/commit/04a8165e6ad8e7c17e715b286d3c9aed0f7dbb02), [`9c32c5d`](https://github.com/codefastlabs/codefast/commit/9c32c5d97724d09436de51ed17a9af7af3ed55bd)]:
|
|
215
|
+
- @codefast-ui/progress-circle@0.3.1-canary.9
|
|
216
|
+
- @codefast-ui/checkbox-group@0.3.1-canary.9
|
|
217
|
+
- @codefast-ui/input-number@0.3.1-canary.9
|
|
218
|
+
- @codefast-ui/input@0.3.1-canary.9
|
|
219
|
+
- @codefast/hooks@0.3.1-canary.9
|
|
220
|
+
|
|
3
221
|
## 0.3.1-canary.8
|
|
4
222
|
|
|
5
223
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/calendar.cjs","sources":["webpack://@codefast/ui/./src/components/calendar.tsx"],"sourcesContent":["\n\nimport type { ComponentProps, JSX, ReactNode } from \"react\";\nimport type { CustomComponents, DateRange } from \"react-day-picker\";\n\nimport { format } from \"date-fns\";\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, DotIcon } from \"lucide-react\";\nimport { DayFlag, DayPicker, SelectionState, UI } from \"react-day-picker\";\n\nimport { buttonVariants } from \"@/components/button\";\nimport { cn } from \"@/lib/utils\";\n\n/* -----------------------------------------------------------------------------\n * Component: Chevron\n * -------------------------------------------------------------------------- */\n\nfunction Chevron({ orientation, className, ...props }: ComponentProps<CustomComponents[\"Chevron\"]>): JSX.Element {\n switch (orientation) {\n case \"up\": {\n return <ChevronUpIcon className={cn(\"size-4\", className)} {...props} />;\n }\n\n case \"down\": {\n return <ChevronDownIcon className={cn(\"size-4\", className)} {...props} />;\n }\n\n case \"left\": {\n return <ChevronLeftIcon className={cn(\"size-4\", className)} {...props} />;\n }\n\n case \"right\": {\n return <ChevronRightIcon className={cn(\"size-4\", className)} {...props} />;\n }\n\n default: {\n return <DotIcon className={cn(\"size-4\", className)} {...props} />;\n }\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Component: Calendar\n * -------------------------------------------------------------------------- */\n\nfunction Calendar({ showOutsideDays = true, classNames, ...props }: ComponentProps<typeof DayPicker>): JSX.Element {\n const isInteractive = props.mode !== undefined || props.onDayClick !== undefined;\n\n return (\n <DayPicker\n classNames={{\n [UI.Root]: cn(\"p-3\", classNames?.[UI.Root]),\n [UI.Chevron]: cn(classNames?.[UI.Chevron]),\n [UI.Day]: cn(\n \"grid place-items-center text-center text-sm\",\n isInteractive ? \"min-w-8.5 has-focus-visible:z-20 group\" : \"min-w-8.5 h-8\",\n classNames?.[UI.Day],\n ),\n [UI.DayButton]: cn(\n \"group-[.is-outside]:text-muted-foreground hover:not-disabled:not-group-aria-selected:bg-secondary hover:not-disabled:not-group-aria-selected:text-secondary-foreground group-data-today:not-group-aria-selected:bg-secondary group-data-today:not-group-aria-selected:text-secondary-foreground group-aria-selected:not-group-[.is-range-middle]:bg-primary group-aria-selected:not-group-[.is-range-middle]:text-primary-foreground outline-hidden focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 group-[.is-selected]:not-group-[.is-range-middle]:focus-visible:ring-primary/20 dark:group-[.is-selected]:not-group-[.is-range-middle]:focus-visible:ring-primary/40 group-[.is-selected]:not-group-[.is-range-middle]:focus-visible:border-primary size-8 rounded-lg border border-transparent disabled:opacity-50\",\n classNames?.[UI.DayButton],\n ),\n [UI.CaptionLabel]: cn(\"flex items-center gap-2 [&>svg]:opacity-50\", classNames?.[UI.CaptionLabel]),\n [UI.Dropdowns]: cn(\"flex gap-4\", classNames?.[UI.Dropdowns]),\n [UI.Dropdown]: cn(\"absolute opacity-0\", classNames?.[UI.Dropdown]),\n [UI.DropdownRoot]: cn(\"relative\", classNames?.[UI.DropdownRoot]),\n [UI.Footer]: cn(classNames?.[UI.Footer]),\n [UI.MonthGrid]: cn(classNames?.[UI.MonthGrid]),\n [UI.MonthCaption]: cn(\"py-1 text-sm font-medium\", classNames?.[UI.MonthCaption]),\n [UI.MonthsDropdown]: cn(classNames?.[UI.MonthsDropdown]),\n [UI.Month]: cn(\"flex flex-col gap-4\", classNames?.[UI.Month]),\n [UI.Months]: cn(\"relative flex gap-4\", classNames?.[UI.Months]),\n [UI.Nav]: cn(\"absolute end-0 flex gap-2\", classNames?.[UI.Nav]),\n [UI.NextMonthButton]: buttonVariants({\n variant: \"ghost\",\n size: \"icon\",\n className: [\"size-7\", classNames?.[UI.NextMonthButton]],\n }),\n [UI.PreviousMonthButton]: buttonVariants({\n variant: \"ghost\",\n size: \"icon\",\n className: [\"size-7\", classNames?.[UI.PreviousMonthButton]],\n }),\n [UI.Week]: cn(\"mt-2 flex justify-between\", classNames?.[UI.Week]),\n [UI.Weeks]: cn(classNames?.[UI.Weeks]),\n [UI.Weekday]: cn(\"text-muted-foreground min-w-8.5 text-xs font-medium\", classNames?.[UI.Weekday]),\n [UI.Weekdays]: cn(\"flex w-full justify-between\", classNames?.[UI.Weekdays]),\n [UI.WeekNumber]: cn(\n \"text-muted-foreground min-w-8.5 grid h-8 place-items-center text-xs font-normal [&+*]:rounded-l-lg\",\n classNames?.[UI.WeekNumber],\n ),\n [UI.WeekNumberHeader]: cn(\"min-w-8.5\", classNames?.[UI.WeekNumberHeader]),\n [UI.YearsDropdown]: cn(classNames?.[UI.YearsDropdown]),\n\n [SelectionState.range_end]: cn(\n \"to-secondary is-range-end rounded-r-lg bg-gradient-to-l first:rounded-l-lg\",\n classNames?.[SelectionState.range_end],\n ),\n [SelectionState.range_middle]: cn(\n \"is-range-middle bg-secondary text-secondary-foreground first:rounded-l-lg last:rounded-r-lg\",\n classNames?.[SelectionState.range_middle],\n ),\n [SelectionState.range_start]: cn(\n \"to-secondary is-range-start rounded-l-lg bg-gradient-to-r last:rounded-r-lg\",\n classNames?.[SelectionState.range_start],\n ),\n [SelectionState.selected]: cn(\"is-selected\", classNames?.[SelectionState.selected]),\n\n [DayFlag.disabled]: cn(\"is-disabled\", classNames?.[DayFlag.disabled]),\n [DayFlag.focused]: cn(\"is-focused\", classNames?.[DayFlag.focused]),\n [DayFlag.hidden]: cn(\"is-hidden size-8\", classNames?.[DayFlag.hidden]),\n [DayFlag.outside]: cn(\"is-outside\", classNames?.[DayFlag.outside]),\n [DayFlag.today]: cn(\"is-today\", classNames?.[DayFlag.today]),\n }}\n components={{\n Chevron,\n }}\n showOutsideDays={showOutsideDays}\n {...props}\n />\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: CalendarRangeLabel\n * -------------------------------------------------------------------------- */\n\nfunction CalendarRangeLabel({\n date,\n formatStr = \"LLL dd, y\",\n placeholder = \"Pick a date\",\n}: {\n date: DateRange | undefined;\n formatStr?: string;\n placeholder?: string;\n}): ReactNode {\n if (!date?.from) {\n return <span className=\"truncate\">{placeholder}</span>;\n }\n\n const formattedFromDate = format(date.from, formatStr);\n\n if (!date.to) {\n return <span className=\"truncate\">{formattedFromDate}</span>;\n }\n\n const formattedToDate = format(date.to, formatStr);\n\n return (\n <span className=\"truncate\">\n {formattedFromDate} - {formattedToDate}\n </span>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: CalendarLabel\n * -------------------------------------------------------------------------- */\n\nfunction CalendarLabel({\n date,\n formatStr = \"PPP\",\n placeholder = \"Pick a date\",\n}: {\n date: Date | undefined;\n formatStr?: string;\n placeholder?: string;\n}): ReactNode {\n if (!date) {\n return <span className=\"truncate\">{placeholder}</span>;\n }\n\n return <span className=\"truncate\">{format(date, formatStr)}</span>;\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport type { DateRange, Matcher } from \"react-day-picker\";\nexport { Calendar, CalendarLabel, CalendarRangeLabel };\n"],"names":["Chevron","orientation","className","props","ChevronUpIcon","cn","ChevronDownIcon","ChevronLeftIcon","ChevronRightIcon","DotIcon","Calendar","showOutsideDays","classNames","isInteractive","undefined","DayPicker","UI","buttonVariants","SelectionState","DayFlag","CalendarRangeLabel","date","formatStr","placeholder","formattedFromDate","format","formattedToDate","CalendarLabel"],"mappings":";utCAgBA,SAASA,QAAQ,CAAEC,YAAAA,CAAW,CAAEC,UAAAA,CAAS,CAAE,GAAGC,EAAoD,EAChG,OAAQF,GACN,IAAK,KACH,MAAO,oCAACG,sCAAAA,aAAaA,CAAAA,CAAC,UAAWC,GAAAA,0BAAAA,EAAAA,EAAG,SAAUH,GAAa,GAAGC,CAAK,EAGrE,KAAK,OACH,MAAO,oCAACG,sCAAAA,eAAeA,CAAAA,CAAC,UAAWD,GAAAA,0BAAAA,EAAAA,EAAG,SAAUH,GAAa,GAAGC,CAAK,EAGvE,KAAK,OACH,MAAO,oCAACI,sCAAAA,eAAeA,CAAAA,CAAC,UAAWF,GAAAA,0BAAAA,EAAAA,EAAG,SAAUH,GAAa,GAAGC,CAAK,EAGvE,KAAK,QACH,MAAO,oCAACK,sCAAAA,gBAAgBA,CAAAA,CAAC,UAAWH,GAAAA,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,CAAAA,OAAe,CAAC,EACjE,CAACA,0CAAAA,OAAAA,CAAAA,KAAa,CAAC,CAAEd,GAAAA,0BAAAA,EAAAA,EAAG,WAAYO,GAAY,CAACO,0CAAAA,OAAAA,CAAAA,KAAa,CAAC,CAC7D,EACA,WAAY,CACVnB,OACF,EACA,gBAAiBW,EAChB,GAAGR,CAAK,EAGf,CAMA,SAASiB,mBAAmB,CAC1BC,KAAAA,CAAI,CACJC,UAAAA,EAAY,WAAW,CACvBC,YAAAA,EAAc,aAAa,CAK5B,EACC,GAAI,CAACF,GAAM,KACT,MAAO,oCAAC,QAAK,UAAU,W,SAAYE,C,GAGrC,IAAMC,EAAoBC,GAAAA,kCAAAA,MAAAA,EAAOJ,EAAK,IAAI,CAAEC,GAE5C,GAAI,CAACD,EAAK,EAAE,CACV,MAAO,oCAAC,QAAK,UAAU,W,SAAYG,C,GAGrC,IAAME,EAAkBD,GAAAA,kCAAAA,MAAAA,EAAOJ,EAAK,EAAE,CAAEC,GAExC,MACE,qCAAC,QAAK,UAAU,W,UACbE,EAAkB,MAAIE,E,EAG7B,CAMA,SAASC,cAAc,CACrBN,KAAAA,CAAI,CACJC,UAAAA,EAAY,KAAK,CACjBC,YAAAA,EAAc,aAAa,CAK5B,SACC,EAIO,oCAAC,QAAK,UAAU,W,SAAYE,GAAAA,kCAAAA,MAAAA,EAAOJ,EAAMC,E,GAHvC,oCAAC,QAAK,UAAU,W,SAAYC,C,EAIvC,C"}
|
|
1
|
+
{"version":3,"file":"components/calendar.cjs","sources":["webpack://@codefast/ui/./src/components/calendar.tsx"],"sourcesContent":["\n\nimport type { ComponentProps, JSX, ReactNode } from \"react\";\nimport type { CustomComponents, DateRange } from \"react-day-picker\";\n\nimport { format } from \"date-fns\";\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronUpIcon, DotIcon } from \"lucide-react\";\nimport { DayFlag, DayPicker, SelectionState, UI } from \"react-day-picker\";\n\nimport { buttonVariants } from \"@/components/button\";\nimport { cn } from \"@/lib/utils\";\n\n/* -----------------------------------------------------------------------------\n * Component: Chevron\n * -------------------------------------------------------------------------- */\n\nfunction Chevron({ orientation, className, ...props }: ComponentProps<CustomComponents[\"Chevron\"]>): JSX.Element {\n switch (orientation) {\n case \"up\": {\n return <ChevronUpIcon className={cn(\"size-4\", className)} {...props} />;\n }\n\n case \"down\": {\n return <ChevronDownIcon className={cn(\"size-4\", className)} {...props} />;\n }\n\n case \"left\": {\n return <ChevronLeftIcon className={cn(\"size-4\", className)} {...props} />;\n }\n\n case \"right\": {\n return <ChevronRightIcon className={cn(\"size-4\", className)} {...props} />;\n }\n\n default: {\n return <DotIcon className={cn(\"size-4\", className)} {...props} />;\n }\n }\n}\n\n/* -----------------------------------------------------------------------------\n * Component: Calendar\n * -------------------------------------------------------------------------- */\n\nfunction Calendar({ showOutsideDays = true, classNames, ...props }: ComponentProps<typeof DayPicker>): JSX.Element {\n const isInteractive = props.mode !== undefined || props.onDayClick !== undefined;\n\n return (\n <DayPicker\n classNames={{\n [UI.Root]: cn(\"p-3\", classNames?.[UI.Root]),\n [UI.Chevron]: cn(classNames?.[UI.Chevron]),\n [UI.Day]: cn(\n \"grid place-items-center text-center text-sm\",\n isInteractive ? \"min-w-8.5 has-focus-visible:z-20 group\" : \"min-w-8.5 h-8\",\n classNames?.[UI.Day],\n ),\n [UI.DayButton]: cn(\n \"group-[.is-outside]:text-muted-foreground hover:not-disabled:not-group-aria-selected:bg-secondary hover:not-disabled:not-group-aria-selected:text-secondary-foreground group-data-today:not-group-aria-selected:bg-secondary group-data-today:not-group-aria-selected:text-secondary-foreground group-aria-selected:not-group-[.is-range-middle]:bg-primary group-aria-selected:not-group-[.is-range-middle]:text-primary-foreground outline-hidden focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-3 group-[.is-selected]:not-group-[.is-range-middle]:focus-visible:ring-primary/20 dark:group-[.is-selected]:not-group-[.is-range-middle]:focus-visible:ring-primary/40 group-[.is-selected]:not-group-[.is-range-middle]:focus-visible:border-primary size-8 rounded-lg border border-transparent disabled:opacity-50\",\n classNames?.[UI.DayButton],\n ),\n [UI.CaptionLabel]: cn(\"flex items-center gap-2 [&>svg]:opacity-50\", classNames?.[UI.CaptionLabel]),\n [UI.Dropdowns]: cn(\"flex gap-4\", classNames?.[UI.Dropdowns]),\n [UI.Dropdown]: cn(\"absolute opacity-0\", classNames?.[UI.Dropdown]),\n [UI.DropdownRoot]: cn(\"relative\", classNames?.[UI.DropdownRoot]),\n [UI.Footer]: cn(classNames?.[UI.Footer]),\n [UI.MonthGrid]: cn(classNames?.[UI.MonthGrid]),\n [UI.MonthCaption]: cn(\"py-1 text-sm font-medium\", classNames?.[UI.MonthCaption]),\n [UI.MonthsDropdown]: cn(classNames?.[UI.MonthsDropdown]),\n [UI.Month]: cn(\"flex flex-col gap-4\", classNames?.[UI.Month]),\n [UI.Months]: cn(\"relative flex gap-4\", classNames?.[UI.Months]),\n [UI.Nav]: cn(\"absolute end-0 flex gap-2\", classNames?.[UI.Nav]),\n [UI.NextMonthButton]: buttonVariants({\n variant: \"ghost\",\n size: \"icon\",\n className: [\"size-7\", classNames?.[UI.NextMonthButton]],\n }),\n [UI.PreviousMonthButton]: buttonVariants({\n variant: \"ghost\",\n size: \"icon\",\n className: [\"size-7\", classNames?.[UI.PreviousMonthButton]],\n }),\n [UI.Week]: cn(\"mt-2 flex justify-between\", classNames?.[UI.Week]),\n [UI.Weeks]: cn(classNames?.[UI.Weeks]),\n [UI.Weekday]: cn(\"text-muted-foreground min-w-8.5 text-xs font-medium\", classNames?.[UI.Weekday]),\n [UI.Weekdays]: cn(\"flex w-full justify-between\", classNames?.[UI.Weekdays]),\n [UI.WeekNumber]: cn(\n \"text-muted-foreground min-w-8.5 grid h-8 place-items-center text-xs font-normal [&+*]:rounded-l-lg\",\n classNames?.[UI.WeekNumber],\n ),\n [UI.WeekNumberHeader]: cn(\"min-w-8.5\", classNames?.[UI.WeekNumberHeader]),\n [UI.YearsDropdown]: cn(classNames?.[UI.YearsDropdown]),\n\n [SelectionState.range_end]: cn(\n \"to-secondary is-range-end rounded-r-lg bg-gradient-to-l first:rounded-l-lg\",\n classNames?.[SelectionState.range_end],\n ),\n [SelectionState.range_middle]: cn(\n \"is-range-middle bg-secondary text-secondary-foreground first:rounded-l-lg last:rounded-r-lg\",\n classNames?.[SelectionState.range_middle],\n ),\n [SelectionState.range_start]: cn(\n \"to-secondary is-range-start rounded-l-lg bg-gradient-to-r last:rounded-r-lg\",\n classNames?.[SelectionState.range_start],\n ),\n [SelectionState.selected]: cn(\"is-selected\", classNames?.[SelectionState.selected]),\n\n [DayFlag.disabled]: cn(\"is-disabled\", classNames?.[DayFlag.disabled]),\n [DayFlag.focused]: cn(\"is-focused\", classNames?.[DayFlag.focused]),\n [DayFlag.hidden]: cn(\"is-hidden size-8\", classNames?.[DayFlag.hidden]),\n [DayFlag.outside]: cn(\"is-outside\", classNames?.[DayFlag.outside]),\n [DayFlag.today]: cn(\"is-today\", classNames?.[DayFlag.today]),\n }}\n components={{\n Chevron,\n }}\n showOutsideDays={showOutsideDays}\n {...props}\n />\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: CalendarRangeLabel\n * -------------------------------------------------------------------------- */\n\nfunction CalendarRangeLabel({\n date,\n formatStr = \"LLL dd, y\",\n placeholder = \"Pick a date\",\n}: {\n date: DateRange | undefined;\n formatStr?: string;\n placeholder?: string;\n}): ReactNode {\n if (!date?.from) {\n return <span className=\"truncate\">{placeholder}</span>;\n }\n\n const formattedFromDate = format(date.from, formatStr);\n\n if (!date.to) {\n return <span className=\"truncate\">{formattedFromDate}</span>;\n }\n\n const formattedToDate = format(date.to, formatStr);\n\n return (\n <span className=\"truncate\">\n {formattedFromDate} - {formattedToDate}\n </span>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: CalendarLabel\n * -------------------------------------------------------------------------- */\n\nfunction CalendarLabel({\n date,\n formatStr = \"PPP\",\n placeholder = \"Pick a date\",\n}: {\n date: Date | undefined;\n formatStr?: string;\n placeholder?: string;\n}): ReactNode {\n if (!date) {\n return <span className=\"truncate\">{placeholder}</span>;\n }\n\n return <span className=\"truncate\">{format(date, formatStr)}</span>;\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport type { DateRange, Matcher } from \"react-day-picker\";\nexport { Calendar, CalendarLabel, CalendarRangeLabel };\n"],"names":["Chevron","orientation","className","props","ChevronUpIcon","cn","ChevronDownIcon","ChevronLeftIcon","ChevronRightIcon","DotIcon","Calendar","showOutsideDays","classNames","isInteractive","undefined","DayPicker","UI","buttonVariants","SelectionState","DayFlag","CalendarRangeLabel","date","formatStr","placeholder","formattedFromDate","format","formattedToDate","CalendarLabel"],"mappings":";utCAgBA,SAASA,QAAQ,CAAEC,YAAAA,CAAW,CAAEC,UAAAA,CAAS,CAAE,GAAGC,EAAoD,EAChG,OAAQF,GACN,IAAK,KACH,MAAO,oCAACG,sCAAAA,aAAaA,CAAAA,CAAC,UAAWC,GAAAA,0BAAAA,EAAAA,EAAG,SAAUH,GAAa,GAAGC,CAAK,EAGrE,KAAK,OACH,MAAO,oCAACG,sCAAAA,eAAeA,CAAAA,CAAC,UAAWD,GAAAA,0BAAAA,EAAAA,EAAG,SAAUH,GAAa,GAAGC,CAAK,EAGvE,KAAK,OACH,MAAO,oCAACI,sCAAAA,eAAeA,CAAAA,CAAC,UAAWF,GAAAA,0BAAAA,EAAAA,EAAG,SAAUH,GAAa,GAAGC,CAAK,EAGvE,KAAK,QACH,MAAO,oCAACK,sCAAAA,gBAAgBA,CAAAA,CAAC,UAAWH,GAAAA,0BAAAA,EAAAA,EAAG,SAAUH,GAAa,GAAGC,CAAK,EAGxE,SACE,MAAO,oCAACM,sCAAAA,OAAOA,CAAAA,CAAC,UAAWJ,GAAAA,0BAAAA,EAAAA,EAAG,SAAUH,GAAa,GAAGC,CAAK,EAEjE,CACF,CAMA,SAASO,SAAS,CAAEC,gBAAAA,EAAkB,EAAI,CAAEC,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,CAC1BC,KAAAA,CAAI,CACJC,UAAAA,EAAY,WAAW,CACvBC,YAAAA,EAAc,aAAa,CAK5B,EACC,GAAI,CAACF,GAAM,KACT,MAAO,oCAAC,QAAK,UAAU,W,SAAYE,C,GAGrC,IAAMC,EAAoBC,GAAAA,kCAAAA,MAAAA,EAAOJ,EAAK,IAAI,CAAEC,GAE5C,GAAI,CAACD,EAAK,EAAE,CACV,MAAO,oCAAC,QAAK,UAAU,W,SAAYG,C,GAGrC,IAAME,EAAkBD,GAAAA,kCAAAA,MAAAA,EAAOJ,EAAK,EAAE,CAAEC,GAExC,MACE,qCAAC,QAAK,UAAU,W,UACbE,EAAkB,MAAIE,E,EAG7B,CAMA,SAASC,cAAc,CACrBN,KAAAA,CAAI,CACJC,UAAAA,EAAY,KAAK,CACjBC,YAAAA,EAAc,aAAa,CAK5B,SACC,EAIO,oCAAC,QAAK,UAAU,W,SAAYE,GAAAA,kCAAAA,MAAAA,EAAOJ,EAAMC,E,GAHvC,oCAAC,QAAK,UAAU,W,SAAYC,C,EAIvC,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/chart.cjs","sources":["webpack://@codefast/ui/./src/components/chart.tsx"],"sourcesContent":["\n\nimport type { Scope } from \"@radix-ui/react-context\";\nimport type { ComponentProps, ComponentType, CSSProperties, JSX, ReactNode } from \"react\";\nimport type { NameType, Payload, ValueType } from \"recharts/types/component/DefaultTooltipContent\";\n\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useId, useMemo } from \"react\";\nimport * as RechartsPrimitive from \"recharts\";\n\nimport { cn } from \"@/lib/utils\";\n\n/* -----------------------------------------------------------------------------\n * Context: ChartProvider\n * ---------------------------------------------------------------------------*/\n\nconst CHART_PROVIDER_NAME = \"ChartProvider\";\n\ntype ScopedProps<P> = P & { __scopeChart?: Scope };\n\n/**\n * Supported themes in the application\n */\ntype Theme = \"dark\" | \"light\";\n\n/**\n * Mapping between themes and their corresponding CSS classes\n */\nconst THEMES: Record<Theme, string> = {\n dark: \".dark\",\n light: \"\",\n};\n\n/**\n * Configuration for icon and label display in charts\n */\ninterface IconLabelConfig {\n /** Icon to display with data */\n icon?: ComponentType;\n /** Label to display with data */\n label?: ReactNode;\n}\n\n/**\n * Single color configuration for chart elements\n */\ntype ColorConfig = {\n /** Valid CSS color (hex, rgba, etc.) */\n color?: string;\n} & { theme?: never };\n\n/**\n * Theme-based color configuration for chart elements\n */\ntype ThemeConfig = {\n /** Map of colors for each theme mode */\n theme: Record<Theme, string>;\n} & { color?: never };\n\n/**\n * Complete configuration for a chart element\n */\ntype ChartConfigItem = (ColorConfig | ThemeConfig) & IconLabelConfig;\n\n/**\n * Configuration for the entire chart organized by series/data keys\n * Where keys are the names of data in the chart\n */\ntype ChartConfig = Record<string, ChartConfigItem | undefined>;\n\n/**\n * Value provided by Chart Context\n */\ninterface ChartContextValue {\n /** Display configuration for the chart */\n config: ChartConfig;\n}\n\nconst [createChartContext, createChartScope] = createContextScope(CHART_PROVIDER_NAME);\n\nconst [ChartContextProvider, useChartContext] = createChartContext<ChartContextValue>(CHART_PROVIDER_NAME);\n\n/* -----------------------------------------------------------------------------\n * Component: Chart\n * -------------------------------------------------------------------------- */\n\nfunction ChartContainer({\n __scopeChart,\n id,\n children,\n className,\n config,\n ...props\n}: ScopedProps<\n ComponentProps<\"div\"> & {\n children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>[\"children\"];\n config: ChartConfig;\n }\n>): JSX.Element {\n const uniqueId = useId();\n const chartId = `chart-${id || uniqueId}`;\n\n return (\n <ChartContextProvider config={config} scope={__scopeChart}>\n <div\n className={cn(\n \"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-surface]:outline-hidden flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-sector[stroke='#fff']]:stroke-transparent\",\n className,\n )}\n data-chart={chartId}\n data-slot=\"chart\"\n {...props}\n >\n <ChartStyle config={config} id={chartId} />\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContextProvider>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: ChartStyle\n * -------------------------------------------------------------------------- */\n\nfunction ChartStyle({ id, config }: { config: ChartConfig; id: string }): ReactNode {\n const cssString = useMemo(() => generateCSS(id, config), [id, config]);\n\n return <style dangerouslySetInnerHTML={{ __html: cssString }} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: ChartTooltip\n * -------------------------------------------------------------------------- */\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\n/* -----------------------------------------------------------------------------\n * Component: ChartTooltipContent\n * -------------------------------------------------------------------------- */\n\nconst CHART_TOOLTIP_CONTENT_NAME = \"ChartTooltipContent\";\n\nfunction ChartTooltipContent({\n __scopeChart,\n active,\n className,\n color,\n formatter,\n hideIndicator = false,\n hideLabel = false,\n indicator = \"dot\",\n label,\n labelClassName,\n labelFormatter,\n labelKey,\n nameKey,\n payload,\n}: ScopedProps<\n ComponentProps<typeof RechartsPrimitive.Tooltip> &\n Omit<ComponentProps<\"div\">, \"content\"> & {\n hideIndicator?: boolean;\n hideLabel?: boolean;\n indicator?: \"dashed\" | \"dot\" | \"line\";\n labelKey?: string;\n nameKey?: string;\n }\n>): ReactNode {\n const { config } = useChartContext(CHART_TOOLTIP_CONTENT_NAME, __scopeChart);\n\n const tooltipLabel = useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n\n const key = `${labelKey || item.dataKey || item.name || \"value\"}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value = !labelKey && typeof label === \"string\" ? config[label]?.label || label : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cn(\"font-medium\", labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cn(\"font-medium\", labelClassName)}>{value}</div>;\n }, [config, hideLabel, label, labelClassName, labelFormatter, labelKey, payload]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== \"dot\";\n\n return (\n <div\n className={cn(\n \"bg-background grid min-w-32 items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl\",\n className,\n )}\n >\n {nestLabel ? null : tooltipLabel}\n <div className=\"grid gap-1.5\">\n {payload.map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || \"value\"}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color || (item.payload as { fill?: string }).fill || item.color;\n\n return (\n <div\n key={item.dataKey}\n className={cn(\n \"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5\",\n indicator === \"dot\" && \"items-center\",\n )}\n >\n {formatter && item.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload as Payload<ValueType, NameType>[])\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn(\"border-(--color-border) bg-(--color-bg) rounded-xs shrink-0\", {\n \"h-2.5 w-2.5\": indicator === \"dot\",\n \"my-0.5\": nestLabel && indicator === \"dashed\",\n \"w-0 border border-dashed bg-transparent\": indicator === \"dashed\",\n \"w-1\": indicator === \"line\",\n })}\n style={\n {\n \"--color-bg\": indicatorColor,\n \"--color-border\": indicatorColor,\n } as CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\"flex flex-1 justify-between leading-none\", nestLabel ? \"items-end\" : \"items-center\")}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">{itemConfig?.label || item.name}</span>\n </div>\n {item.value ? (\n <span className=\"text-foreground font-mono font-medium tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n ) : null}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: ChartLegend\n * -------------------------------------------------------------------------- */\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\n/* -----------------------------------------------------------------------------\n * Component: ChartLegendContent\n * -------------------------------------------------------------------------- */\n\nconst CHART_LEGEND_CONTENT_NAME = \"ChartLegendContent\";\n\nfunction ChartLegendContent({\n __scopeChart,\n className,\n hideIcon = false,\n nameKey,\n payload,\n verticalAlign = \"bottom\",\n}: ScopedProps<\n ComponentProps<\"div\"> &\n Pick<RechartsPrimitive.LegendProps, \"payload\" | \"verticalAlign\"> & {\n hideIcon?: boolean;\n nameKey?: string;\n }\n>): ReactNode {\n const { config } = useChartContext(CHART_LEGEND_CONTENT_NAME, __scopeChart);\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div className={cn(\"flex items-center justify-center gap-4\", verticalAlign === \"top\" ? \"pb-3\" : \"pt-3\", className)}>\n {payload.map((item) => {\n let key = \"value\";\n\n if (nameKey) {\n key = nameKey;\n } else if (item.dataKey) {\n key = String(item.dataKey);\n }\n\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div\n key={String(item.value)}\n className={cn(\"[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:size-3\")}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"size-2 shrink-0 rounded-md\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Helpers\n * -------------------------------------------------------------------------- */\n\n/**\n * Extracts and returns the appropriate configuration object from\n * the payload based on the specified key.\n *\n * @param config - The chart configuration object that contains various\n * settings.\n * @param payload - The payload object that might contain nested payload data.\n * @param key - The key used to retrieve the specific configuration from the\n * chart config.\n * @returns Returns a configuration object with optional properties `icon`,\n * `label`, `color` or `theme`, or `undefined` if the payload is invalid or\n * no configuration is found for the provided key.\n */\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string): ChartConfigItem | undefined {\n if (!isValidObject(payload)) {\n return undefined;\n }\n\n const nestedPayload = \"payload\" in payload && isValidObject(payload.payload) ? payload.payload : undefined;\n\n const configLabelKey = getConfigLabelKey(payload, nestedPayload, key);\n\n return configLabelKey in config ? config[configLabelKey] : config[key];\n}\n\n/**\n * Checks if the provided value is a valid object.\n *\n * @param obj - The value to check.\n * @returns - Returns true if the value is an object and not null, false\n * otherwise.\n */\nfunction isValidObject(obj: unknown): obj is Record<string, unknown> {\n return typeof obj === \"object\" && obj !== null;\n}\n\n/**\n * Retrieves the configuration label key from either the payload or\n * nestedPayload. If the key exists in the payload and is a string, the\n * corresponding value is returned. Otherwise, if the key exists in the\n * nestedPayload and is a string, its value is returned. If the key is not\n * found as a string in either object, the key itself is returned.\n *\n * @param payload - The primary payload containing key-value pairs.\n * @param nestedPayload - An optional nested payload containing additional\n * key-value pairs.\n * @param key - The key to search for within the payload and nestedPayload.\n *\n * @returns The string value associated with the key if found; otherwise, the\n * key itself.\n */\nfunction getConfigLabelKey(\n payload: Record<string, unknown>,\n nestedPayload: Record<string, unknown> | undefined,\n key: string,\n): string {\n if (key in payload && typeof payload[key] === \"string\") {\n return payload[key];\n }\n\n if (nestedPayload && key in nestedPayload && typeof nestedPayload[key] === \"string\") {\n return nestedPayload[key];\n }\n\n return key;\n}\n\n/**\n * Generates CSS for a specified theme and chart configuration.\n *\n * @param theme - The theme to be used (for example, 'light', 'dark').\n * @param id - The unique identifier of the chart.\n * @param configEntries - A list of configuration entries, each containing a\n * key and a chart configuration.\n * @returns The generated CSS as a string.\n */\nfunction generateThemeCSS(theme: Theme, id: string, configEntries: [string, ChartConfig[string]][]): string {\n const rules: string[] = [];\n\n rules.push(`${THEMES[theme]} [data-chart=${id}] {`);\n\n for (const [key, itemConfig] of configEntries) {\n const color = itemConfig?.theme?.[theme] || itemConfig?.color;\n\n if (color) {\n rules.push(` --color-${key}: ${color};`);\n }\n }\n\n rules.push(\"}\");\n\n return rules.join(\"\\n\");\n}\n\n/**\n * Generates CSS styles for a chart based on the provided configuration and\n * themes.\n *\n * @param id - The unique identifier for the chart element.\n * @param config - Configuration object for the chart. This includes theme and\n * color settings.\n * @returns A string containing the generated CSS rules.\n */\nfunction generateCSS(id: string, config: ChartConfig): string {\n const themeOrColorConfig = Object.entries(config).filter(([_, itemConfig]) => itemConfig?.theme || itemConfig?.color);\n\n const allRules: string[] = [];\n\n for (const theme of Object.keys(THEMES)) {\n const themeCSS = generateThemeCSS(theme as Theme, id, themeOrColorConfig);\n\n allRules.push(themeCSS);\n }\n\n return allRules.join(\"\\n\");\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport type { ChartConfig };\nexport {\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n ChartTooltip,\n ChartTooltipContent,\n createChartScope,\n};\n"],"names":["CHART_PROVIDER_NAME","THEMES","createChartContext","createChartScope","createContextScope","ChartContextProvider","useChartContext","ChartContainer","__scopeChart","id","children","className","config","props","uniqueId","useId","chartId","cn","ChartStyle","RechartsPrimitive","cssString","useMemo","generateCSS","ChartTooltip","CHART_TOOLTIP_CONTENT_NAME","ChartTooltipContent","active","color","formatter","hideIndicator","hideLabel","indicator","label","labelClassName","labelFormatter","labelKey","nameKey","payload","tooltipLabel","item","key","itemConfig","getPayloadConfigFromPayload","value","nestLabel","index","indicatorColor","undefined","ChartLegend","CHART_LEGEND_CONTENT_NAME","ChartLegendContent","hideIcon","verticalAlign","String","isValidObject","nestedPayload","configLabelKey","getConfigLabelKey","obj","generateThemeCSS","theme","configEntries","rules","them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e,CAC7C,IAAMlC,EAAQc,GAAY,OAAO,CAACmB,EAAM,EAAInB,GAAY,KAEpDd,CAAAA,GACFmC,EAAM,IAAI,CAAC,CAAC,UAAU,EAAEtB,EAAI,EAAE,EAAEb,EAAM,CAAC,CAAC,CAE5C,CAIA,OAFAmC,EAAM,IAAI,CAAC,KAEJA,EAAM,IAAI,CAAC,KACpB,CAWA,SAASxC,YAAYb,CAAU,CAAEG,CAAmB,EAClD,IAAMmD,EAAqBC,OAAO,OAAO,CAACpD,GAAQ,MAAM,CAAC,CAAC,CAACqD,EAAGxB,EAAW,GAAKA,GAAY,OAASA,GAAY,OAEzGyB,EAAqB,EAAE,CAE7B,IAAK,IAAMN,KAASI,OAAO,IAAI,CAAC/D,QAAS,CACvC,IAAMkE,EAAWR,iBAAiBC,EAAgBnD,EAAIsD,GAEtDG,EAAS,IAAI,CAACC,EAChB,CAEA,OAAOD,EAAS,IAAI,CAAC,KACvB,C"}
|
|
1
|
+
{"version":3,"file":"components/chart.cjs","sources":["webpack://@codefast/ui/./src/components/chart.tsx"],"sourcesContent":["\n\nimport type { Scope } from \"@radix-ui/react-context\";\nimport type { ComponentProps, ComponentType, CSSProperties, JSX, ReactNode } from \"react\";\nimport type { NameType, Payload, ValueType } from \"recharts/types/component/DefaultTooltipContent\";\n\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useId, useMemo } from \"react\";\nimport * as RechartsPrimitive from \"recharts\";\n\nimport { cn } from \"@/lib/utils\";\n\n/* -----------------------------------------------------------------------------\n * Context: ChartProvider\n * ---------------------------------------------------------------------------*/\n\nconst CHART_PROVIDER_NAME = \"ChartProvider\";\n\ntype ScopedProps<P> = P & { __scopeChart?: Scope };\n\n/**\n * Supported themes in the application\n */\ntype Theme = \"dark\" | \"light\";\n\n/**\n * Mapping between themes and their corresponding CSS classes\n */\nconst THEMES: Record<Theme, string> = {\n dark: \".dark\",\n light: \"\",\n};\n\n/**\n * Configuration for icon and label display in charts\n */\ninterface IconLabelConfig {\n /** Icon to display with data */\n icon?: ComponentType;\n /** Label to display with data */\n label?: ReactNode;\n}\n\n/**\n * Single color configuration for chart elements\n */\ntype ColorConfig = {\n /** Valid CSS color (hex, rgba, etc.) */\n color?: string;\n} & { theme?: never };\n\n/**\n * Theme-based color configuration for chart elements\n */\ntype ThemeConfig = {\n /** Map of colors for each theme mode */\n theme: Record<Theme, string>;\n} & { color?: never };\n\n/**\n * Complete configuration for a chart element\n */\ntype ChartConfigItem = (ColorConfig | ThemeConfig) & IconLabelConfig;\n\n/**\n * Configuration for the entire chart organized by series/data keys\n * Where keys are the names of data in the chart\n */\ntype ChartConfig = Record<string, ChartConfigItem | undefined>;\n\n/**\n * Value provided by Chart Context\n */\ninterface ChartContextValue {\n /** Display configuration for the chart */\n config: ChartConfig;\n}\n\nconst [createChartContext, createChartScope] = createContextScope(CHART_PROVIDER_NAME);\n\nconst [ChartContextProvider, useChartContext] = createChartContext<ChartContextValue>(CHART_PROVIDER_NAME);\n\n/* -----------------------------------------------------------------------------\n * Component: Chart\n * -------------------------------------------------------------------------- */\n\nfunction ChartContainer({\n __scopeChart,\n id,\n children,\n className,\n config,\n ...props\n}: ScopedProps<\n ComponentProps<\"div\"> & {\n children: ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>[\"children\"];\n config: ChartConfig;\n }\n>): JSX.Element {\n const uniqueId = useId();\n const chartId = `chart-${id || uniqueId}`;\n\n return (\n <ChartContextProvider config={config} scope={__scopeChart}>\n <div\n className={cn(\n \"[&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-layer]:outline-hidden [&_.recharts-sector]:outline-hidden [&_.recharts-surface]:outline-hidden flex aspect-video justify-center text-xs [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-sector[stroke='#fff']]:stroke-transparent\",\n className,\n )}\n data-chart={chartId}\n data-slot=\"chart\"\n {...props}\n >\n <ChartStyle config={config} id={chartId} />\n <RechartsPrimitive.ResponsiveContainer>{children}</RechartsPrimitive.ResponsiveContainer>\n </div>\n </ChartContextProvider>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: ChartStyle\n * -------------------------------------------------------------------------- */\n\nfunction ChartStyle({ id, config }: { config: ChartConfig; id: string }): ReactNode {\n const cssString = useMemo(() => generateCSS(id, config), [id, config]);\n\n return <style dangerouslySetInnerHTML={{ __html: cssString }} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: ChartTooltip\n * -------------------------------------------------------------------------- */\n\nconst ChartTooltip = RechartsPrimitive.Tooltip;\n\n/* -----------------------------------------------------------------------------\n * Component: ChartTooltipContent\n * -------------------------------------------------------------------------- */\n\nconst CHART_TOOLTIP_CONTENT_NAME = \"ChartTooltipContent\";\n\nfunction ChartTooltipContent({\n __scopeChart,\n active,\n className,\n color,\n formatter,\n hideIndicator = false,\n hideLabel = false,\n indicator = \"dot\",\n label,\n labelClassName,\n labelFormatter,\n labelKey,\n nameKey,\n payload,\n}: ScopedProps<\n ComponentProps<typeof RechartsPrimitive.Tooltip> &\n Omit<ComponentProps<\"div\">, \"content\"> & {\n hideIndicator?: boolean;\n hideLabel?: boolean;\n indicator?: \"dashed\" | \"dot\" | \"line\";\n labelKey?: string;\n nameKey?: string;\n }\n>): ReactNode {\n const { config } = useChartContext(CHART_TOOLTIP_CONTENT_NAME, __scopeChart);\n\n const tooltipLabel = useMemo(() => {\n if (hideLabel || !payload?.length) {\n return null;\n }\n\n const [item] = payload;\n\n const key = `${labelKey || item.dataKey || item.name || \"value\"}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const value = !labelKey && typeof label === \"string\" ? config[label]?.label || label : itemConfig?.label;\n\n if (labelFormatter) {\n return <div className={cn(\"font-medium\", labelClassName)}>{labelFormatter(value, payload)}</div>;\n }\n\n if (!value) {\n return null;\n }\n\n return <div className={cn(\"font-medium\", labelClassName)}>{value}</div>;\n }, [config, hideLabel, label, labelClassName, labelFormatter, labelKey, payload]);\n\n if (!active || !payload?.length) {\n return null;\n }\n\n const nestLabel = payload.length === 1 && indicator !== \"dot\";\n\n return (\n <div\n className={cn(\n \"bg-background grid min-w-32 items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl\",\n className,\n )}\n >\n {nestLabel ? null : tooltipLabel}\n <div className=\"grid gap-1.5\">\n {payload.map((item, index) => {\n const key = `${nameKey || item.name || item.dataKey || \"value\"}`;\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n const indicatorColor = color || (item.payload as { fill?: string }).fill || item.color;\n\n return (\n <div\n key={item.dataKey}\n className={cn(\n \"[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5\",\n indicator === \"dot\" && \"items-center\",\n )}\n >\n {formatter && item.value !== undefined && item.name ? (\n formatter(item.value, item.name, item, index, item.payload as Payload<ValueType, NameType>[])\n ) : (\n <>\n {itemConfig?.icon ? (\n <itemConfig.icon />\n ) : (\n !hideIndicator && (\n <div\n className={cn(\"border-(--color-border) bg-(--color-bg) rounded-xs shrink-0\", {\n \"h-2.5 w-2.5\": indicator === \"dot\",\n \"my-0.5\": nestLabel && indicator === \"dashed\",\n \"w-0 border border-dashed bg-transparent\": indicator === \"dashed\",\n \"w-1\": indicator === \"line\",\n })}\n style={\n {\n \"--color-bg\": indicatorColor,\n \"--color-border\": indicatorColor,\n } as CSSProperties\n }\n />\n )\n )}\n <div\n className={cn(\"flex flex-1 justify-between leading-none\", nestLabel ? \"items-end\" : \"items-center\")}\n >\n <div className=\"grid gap-1.5\">\n {nestLabel ? tooltipLabel : null}\n <span className=\"text-muted-foreground\">{itemConfig?.label || item.name}</span>\n </div>\n {item.value ? (\n <span className=\"text-foreground font-mono font-medium tabular-nums\">\n {item.value.toLocaleString()}\n </span>\n ) : null}\n </div>\n </>\n )}\n </div>\n );\n })}\n </div>\n </div>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: ChartLegend\n * -------------------------------------------------------------------------- */\n\nconst ChartLegend = RechartsPrimitive.Legend;\n\n/* -----------------------------------------------------------------------------\n * Component: ChartLegendContent\n * -------------------------------------------------------------------------- */\n\nconst CHART_LEGEND_CONTENT_NAME = \"ChartLegendContent\";\n\nfunction ChartLegendContent({\n __scopeChart,\n className,\n hideIcon = false,\n nameKey,\n payload,\n verticalAlign = \"bottom\",\n}: ScopedProps<\n ComponentProps<\"div\"> &\n Pick<RechartsPrimitive.LegendProps, \"payload\" | \"verticalAlign\"> & {\n hideIcon?: boolean;\n nameKey?: string;\n }\n>): ReactNode {\n const { config } = useChartContext(CHART_LEGEND_CONTENT_NAME, __scopeChart);\n\n if (!payload?.length) {\n return null;\n }\n\n return (\n <div className={cn(\"flex items-center justify-center gap-4\", verticalAlign === \"top\" ? \"pb-3\" : \"pt-3\", className)}>\n {payload.map((item) => {\n let key = \"value\";\n\n if (nameKey) {\n key = nameKey;\n } else if (item.dataKey) {\n key = String(item.dataKey);\n }\n\n const itemConfig = getPayloadConfigFromPayload(config, item, key);\n\n return (\n <div\n key={String(item.value)}\n className={cn(\"[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:size-3\")}\n >\n {itemConfig?.icon && !hideIcon ? (\n <itemConfig.icon />\n ) : (\n <div\n className=\"size-2 shrink-0 rounded-md\"\n style={{\n backgroundColor: item.color,\n }}\n />\n )}\n {itemConfig?.label}\n </div>\n );\n })}\n </div>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Helpers\n * -------------------------------------------------------------------------- */\n\n/**\n * Extracts and returns the appropriate configuration object from\n * the payload based on the specified key.\n *\n * @param config - The chart configuration object that contains various\n * settings.\n * @param payload - The payload object that might contain nested payload data.\n * @param key - The key used to retrieve the specific configuration from the\n * chart config.\n * @returns Returns a configuration object with optional properties `icon`,\n * `label`, `color` or `theme`, or `undefined` if the payload is invalid or\n * no configuration is found for the provided key.\n */\nfunction getPayloadConfigFromPayload(config: ChartConfig, payload: unknown, key: string): ChartConfigItem | undefined {\n if (!isValidObject(payload)) {\n return undefined;\n }\n\n const nestedPayload = \"payload\" in payload && isValidObject(payload.payload) ? payload.payload : undefined;\n\n const configLabelKey = getConfigLabelKey(payload, nestedPayload, key);\n\n return configLabelKey in config ? config[configLabelKey] : config[key];\n}\n\n/**\n * Checks if the provided value is a valid object.\n *\n * @param obj - The value to check.\n * @returns - Returns true if the value is an object and not null, false\n * otherwise.\n */\nfunction isValidObject(obj: unknown): obj is Record<string, unknown> {\n return typeof obj === \"object\" && obj !== null;\n}\n\n/**\n * Retrieves the configuration label key from either the payload or\n * nestedPayload. If the key exists in the payload and is a string, the\n * corresponding value is returned. Otherwise, if the key exists in the\n * nestedPayload and is a string, its value is returned. If the key is not\n * found as a string in either object, the key itself is returned.\n *\n * @param payload - The primary payload containing key-value pairs.\n * @param nestedPayload - An optional nested payload containing additional\n * key-value pairs.\n * @param key - The key to search for within the payload and nestedPayload.\n *\n * @returns The string value associated with the key if found; otherwise, the\n * key itself.\n */\nfunction getConfigLabelKey(\n payload: Record<string, unknown>,\n nestedPayload: Record<string, unknown> | undefined,\n key: string,\n): string {\n if (key in payload && typeof payload[key] === \"string\") {\n return payload[key];\n }\n\n if (nestedPayload && key in nestedPayload && typeof nestedPayload[key] === \"string\") {\n return nestedPayload[key];\n }\n\n return key;\n}\n\n/**\n * Generates CSS for a specified theme and chart configuration.\n *\n * @param theme - The theme to be used (for example, 'light', 'dark').\n * @param id - The unique identifier of the chart.\n * @param configEntries - A list of configuration entries, each containing a\n * key and a chart configuration.\n * @returns The generated CSS as a string.\n */\nfunction generateThemeCSS(theme: Theme, id: string, configEntries: [string, ChartConfig[string]][]): string {\n const rules: string[] = [];\n\n rules.push(`${THEMES[theme]} [data-chart=${id}] {`);\n\n for (const [key, itemConfig] of configEntries) {\n const color = itemConfig?.theme?.[theme] || itemConfig?.color;\n\n if (color) {\n rules.push(` --color-${key}: ${color};`);\n }\n }\n\n rules.push(\"}\");\n\n return rules.join(\"\\n\");\n}\n\n/**\n * Generates CSS styles for a chart based on the provided configuration and\n * themes.\n *\n * @param id - The unique identifier for the chart element.\n * @param config - Configuration object for the chart. This includes theme and\n * color settings.\n * @returns A string containing the generated CSS rules.\n */\nfunction generateCSS(id: string, config: ChartConfig): string {\n const themeOrColorConfig = Object.entries(config).filter(([_, itemConfig]) => itemConfig?.theme || itemConfig?.color);\n\n const allRules: string[] = [];\n\n for (const theme of Object.keys(THEMES)) {\n const themeCSS = generateThemeCSS(theme as Theme, id, themeOrColorConfig);\n\n allRules.push(themeCSS);\n }\n\n return allRules.join(\"\\n\");\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport type { ChartConfig };\nexport {\n ChartContainer,\n ChartLegend,\n ChartLegendContent,\n ChartStyle,\n ChartTooltip,\n ChartTooltipContent,\n createChartScope,\n};\n"],"names":["CHART_PROVIDER_NAME","THEMES","createChartContext","createChartScope","createContextScope","ChartContextProvider","useChartContext","ChartContainer","__scopeChart","id","children","className","config","props","uniqueId","useId","chartId","cn","ChartStyle","RechartsPrimitive","cssString","useMemo","generateCSS","ChartTooltip","CHART_TOOLTIP_CONTENT_NAME","ChartTooltipContent","active","color","formatter","hideIndicator","hideLabel","indicator","label","labelClassName","labelFormatter","labelKey","nameKey","payload","tooltipLabel","item","key","itemConfig","getPayloadConfigFromPayload","value","nestLabel","index","indicatorColor","undefined","ChartLegend","CHART_LEGEND_CONTENT_NAME","ChartLegendContent","hideIcon","verticalAlign","String","isValidObject","nestedPayload","configLabelKey","getConfigLabelKey","obj","generateThemeCSS","theme","configEntries","rules","themeOrColorConfig","Object","_","allRules","themeCSS"],"mappings":";0xCAgBMA,oBAAsB,gBAYtBC,OAAgC,CACpC,KAAM,QACN,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AAC,UAAU,EAAEtB,EAAI,EAAE,EAAEb,EAAM,CAAC,CAAC,CAE5C,CAIA,OAFAmC,EAAM,IAAI,CAAC,KAEJA,EAAM,IAAI,CAAC,KACpB,CAWA,SAASxC,YAAYb,CAAU,CAAEG,CAAmB,EAClD,IAAMmD,EAAqBC,OAAO,OAAO,CAACpD,GAAQ,MAAM,CAAC,CAAC,CAACqD,EAAGxB,EAAW,GAAKA,GAAY,OAASA,GAAY,OAEzGyB,EAAqB,EAAE,CAE7B,IAAK,IAAMN,KAASI,OAAO,IAAI,CAAC/D,QAAS,CACvC,IAAMkE,EAAWR,iBAAiBC,EAAgBnD,EAAIsD,GAEtDG,EAAS,IAAI,CAACC,EAChB,CAEA,OAAOD,EAAS,IAAI,CAAC,KACvB,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/form.cjs","sources":["webpack://@codefast/ui/./src/components/form.tsx"],"sourcesContent":["\n\nimport type { Scope } from \"@radix-ui/react-context\";\nimport type * as LabelPrimitive from \"@radix-ui/react-label\";\nimport type { ComponentProps, JSX, ReactNode } from \"react\";\nimport type { ControllerProps, FieldError, FieldPath, FieldValues } from \"react-hook-form\";\n\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { useId } from \"react\";\nimport { Controller, FormProvider, useFormContext, useFormState } from \"react-hook-form\";\n\nimport { Label } from \"@/components/label\";\nimport { cn } from \"@/lib/utils\";\n\n/* -----------------------------------------------------------------------------\n * Component: Form\n * -------------------------------------------------------------------------- */\n\nconst Form = FormProvider;\n\n/* -----------------------------------------------------------------------------\n * Context: FormField\n * -------------------------------------------------------------------------- */\n\nconst FORM_FIELD_NAME = \"FormField\";\n\ntype ScopedProps<P> = P & { __scopeFormField?: Scope };\n\nconst [createFormFieldContext, createFormFieldScope] = createContextScope(FORM_FIELD_NAME);\n\ninterface FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n name: TName;\n}\n\nconst [FormFieldContextProvider, useFormFieldContext] = createFormFieldContext<FormFieldContextValue>(FORM_FIELD_NAME);\n\nfunction useFormItem(\n consumerName: string,\n scope: Scope,\n): {\n formDescriptionId: string;\n formItemId: string;\n formMessageId: string;\n id: string;\n invalid: boolean;\n isDirty: boolean;\n isTouched: boolean;\n isValidating: boolean;\n name: string;\n error?: FieldError;\n} {\n const { id } = useFormItemContext(consumerName, scope);\n const { name } = useFormFieldContext(consumerName, scope);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name });\n const fieldState = getFieldState(name, formState);\n\n return {\n id,\n name,\n formDescriptionId: `form-item-description-${id}`,\n formItemId: `form-item-${id}`,\n formMessageId: `form-item-message-${id}`,\n ...fieldState,\n };\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormField\n * -------------------------------------------------------------------------- */\n\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(formFieldProps: ScopedProps<ControllerProps<TFieldValues, TName>>): JSX.Element {\n const { __scopeFormField, ...props } = formFieldProps;\n\n return (\n <FormFieldContextProvider name={props.name} scope={__scopeFormField}>\n <Controller {...props} />\n </FormFieldContextProvider>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Context: FormItem\n * -------------------------------------------------------------------------- */\n\nconst FORM_ITEM_NAME = \"FormItem\";\n\ninterface FormItemContextValue {\n id: string;\n}\n\nconst [FormItemContextProvider, useFormItemContext] = createFormFieldContext<FormItemContextValue>(FORM_ITEM_NAME);\n\n/* -----------------------------------------------------------------------------\n * Component: FormItem\n * -------------------------------------------------------------------------- */\n\nfunction FormItem({ __scopeFormField, className, ...props }: ScopedProps<ComponentProps<\"div\">>): JSX.Element {\n const id = useId();\n\n return (\n <FormItemContextProvider id={id} scope={__scopeFormField}>\n <div className={cn(\"grid gap-2\", className)} data-slot=\"form-item\" {...props} />\n </FormItemContextProvider>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormLabel\n * -------------------------------------------------------------------------- */\n\nconst FORM_LABEL_NAME = \"FormLabel\";\n\nfunction FormLabel({\n __scopeFormField,\n ...props\n}: ScopedProps<ComponentProps<typeof LabelPrimitive.Root>>): JSX.Element {\n const { formItemId, error } = useFormItem(FORM_LABEL_NAME, __scopeFormField);\n\n return <Label data-invalid={error ? true : undefined} data-slot=\"form-label\" htmlFor={formItemId} {...props} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormControl\n * -------------------------------------------------------------------------- */\n\nconst FORM_CONTROL_NAME = \"FormControl\";\n\nfunction FormControl({ __scopeFormField, ...props }: ScopedProps<ComponentProps<typeof Slot>>): JSX.Element {\n const { formDescriptionId, formItemId, formMessageId, error } = useFormItem(FORM_CONTROL_NAME, __scopeFormField);\n\n return (\n <Slot\n aria-describedby={error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId}\n aria-invalid={Boolean(error)}\n data-slot=\"form-control\"\n id={formItemId}\n {...props}\n />\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormDescription\n * -------------------------------------------------------------------------- */\n\nfunction FormDescription({ __scopeFormField, className, ...props }: ScopedProps<ComponentProps<\"p\">>): JSX.Element {\n const { formDescriptionId } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField);\n\n return (\n <p\n className={cn(\"text-muted-foreground text-xs\", className)}\n data-slot=\"form-description\"\n id={formDescriptionId}\n {...props}\n />\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormMessage\n * -------------------------------------------------------------------------- */\n\nconst FORM_MESSAGE_NAME = \"FormMessage\";\n\nfunction FormMessage({ __scopeFormField, children, className, ...props }: ScopedProps<ComponentProps<\"p\">>): ReactNode {\n const { formMessageId, error } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField);\n const body = error?.message ? String(error.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n className={cn(\"text-xs\", error?.message ? \"text-destructive font-medium\" : \"text-muted-foreground\", className)}\n data-slot=\"form-message\"\n id={formMessageId}\n {...props}\n >\n {body}\n </p>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport { createFormFieldScope, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage };\n"],"names":["Form","FormProvider","FORM_FIELD_NAME","createFormFieldContext","createFormFieldScope","createContextScope","FormFieldContextProvider","useFormFieldContext","useFormItem","consumerName","scope","id","useFormItemContext","name","getFieldState","useFormContext","formState","useFormState","fieldState","FormField","formFieldProps","__scopeFormField","props","Controller","FORM_ITEM_NAME","FormItemContextProvider","FormItem","className","useId","cn","FORM_LABEL_NAME","FormLabel","formItemId","error","Label","undefined","FORM_CONTROL_NAME","FormControl","formDescriptionId","formMessageId","Slot","Boolean","FormDescription","FORM_MESSAGE_NAME","FormMessage","children","body","String"],"mappings":";y4CAmBMA,KAAOC,yCAAAA,YAAYA,CAMnBC,gBAAkB,YAIlB,CAACC,uBAAwBC,qBAAqB,CAAGC,GAAAA,8BAAAA,kBAAAA,EAAmBH,iBASpE,CAACI,yBAA0BC,oBAAoB,CAAGJ,uBAA8CD,iBAEtG,SAASM,YACPC,CAAoB,CACpBC,CAAY,EAaZ,GAAM,CAAEC,GAAAA,CAAE,CAAE,CAAGC,mBAAmBH,EAAcC,GAC1C,CAAEG,KAAAA,CAAI,CAAE,CAAGN,oBAAoBE,EAAcC,GAC7C,CAAEI,cAAAA,CAAa,CAAE,CAAGC,GAAAA,yCAAAA,cAAAA,IACpBC,EAAYC,GAAAA,yCAAAA,YAAAA,EAAa,CAAEJ,KAAAA,CAAK,GAChCK,EAAaJ,EAAcD,EAAMG,GAEvC,MAAO,CACLL,GAAAA,EACAE,KAAAA,EACA,kBAAmB,CAAC,sBAAsB,EAAEF,EAAG,CAAC,CAChD,WAAY,CAAC,UAAU,EAAEA,EAAG,CAAC,CAC7B,cAAe,CAAC,kBAAkB,EAAEA,EAAG,CAAC,CACxC,GAAGO,CAAU,CAEjB,CAMA,SAASC,UAGPC,CAAiE,EACjE,GAAM,CAAEC,iBAAAA,CAAgB,CAAE,GAAGC,EAAO,CAAGF,EAEvC,MACE,oCAACd,yBAAAA,CAAyB,KAAMgB,EAAM,IAAI,CAAE,MAAOD,E,SACjD,oCAACE,yCAAAA,UAAUA,CAAAA,CAAE,GAAGD,CAAK,IAG3B,CAMA,IAAME,eAAiB,WAMjB,CAACC,wBAAyBb,mBAAmB,CAAGT,uBAN/B,YAYvB,SAASuB,SAAS,CAAEL,iBAAAA,CAAgB,CAAEM,UAAAA,CAAS,CAAE,GAAGL,EAA2C,EAC7F,IAAMX,EAAKiB,GAAAA,+BAAAA,KAAAA,IAEX,MACE,oCAACH,wBAAAA,CAAwB,GAAId,EAAI,MAAOU,E,SACtC,oCAAC,OAAI,UAAWQ,GAAAA,0BAAAA,EAAAA,EAAG,aAAcF,GAAY,YAAU,YAAa,GAAGL,CAAK,IAGlF,CAMA,IAAMQ,gBAAkB,YAExB,SAASC,UAAU,CACjBV,iBAAAA,CAAgB,CAChB,GAAGC,EACqD,EACxD,GAAM,CAAEU,WAAAA,CAAU,CAAEC,MAAAA,CAAK,CAAE,CAAGzB,YANR,YAMqCa,GAE3D,MAAO,oCAACa,mCAAAA,KAAKA,CAAAA,CAAC,eAAcD,EAAAA,GAAeE,
|
|
1
|
+
{"version":3,"file":"components/form.cjs","sources":["webpack://@codefast/ui/./src/components/form.tsx"],"sourcesContent":["\n\nimport type { Scope } from \"@radix-ui/react-context\";\nimport type * as LabelPrimitive from \"@radix-ui/react-label\";\nimport type { ComponentProps, JSX, ReactNode } from \"react\";\nimport type { ControllerProps, FieldError, FieldPath, FieldValues } from \"react-hook-form\";\n\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { useId } from \"react\";\nimport { Controller, FormProvider, useFormContext, useFormState } from \"react-hook-form\";\n\nimport { Label } from \"@/components/label\";\nimport { cn } from \"@/lib/utils\";\n\n/* -----------------------------------------------------------------------------\n * Component: Form\n * -------------------------------------------------------------------------- */\n\nconst Form = FormProvider;\n\n/* -----------------------------------------------------------------------------\n * Context: FormField\n * -------------------------------------------------------------------------- */\n\nconst FORM_FIELD_NAME = \"FormField\";\n\ntype ScopedProps<P> = P & { __scopeFormField?: Scope };\n\nconst [createFormFieldContext, createFormFieldScope] = createContextScope(FORM_FIELD_NAME);\n\ninterface FormFieldContextValue<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n name: TName;\n}\n\nconst [FormFieldContextProvider, useFormFieldContext] = createFormFieldContext<FormFieldContextValue>(FORM_FIELD_NAME);\n\nfunction useFormItem(\n consumerName: string,\n scope: Scope,\n): {\n formDescriptionId: string;\n formItemId: string;\n formMessageId: string;\n id: string;\n invalid: boolean;\n isDirty: boolean;\n isTouched: boolean;\n isValidating: boolean;\n name: string;\n error?: FieldError;\n} {\n const { id } = useFormItemContext(consumerName, scope);\n const { name } = useFormFieldContext(consumerName, scope);\n const { getFieldState } = useFormContext();\n const formState = useFormState({ name });\n const fieldState = getFieldState(name, formState);\n\n return {\n id,\n name,\n formDescriptionId: `form-item-description-${id}`,\n formItemId: `form-item-${id}`,\n formMessageId: `form-item-message-${id}`,\n ...fieldState,\n };\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormField\n * -------------------------------------------------------------------------- */\n\nfunction FormField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>(formFieldProps: ScopedProps<ControllerProps<TFieldValues, TName>>): JSX.Element {\n const { __scopeFormField, ...props } = formFieldProps;\n\n return (\n <FormFieldContextProvider name={props.name} scope={__scopeFormField}>\n <Controller {...props} />\n </FormFieldContextProvider>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Context: FormItem\n * -------------------------------------------------------------------------- */\n\nconst FORM_ITEM_NAME = \"FormItem\";\n\ninterface FormItemContextValue {\n id: string;\n}\n\nconst [FormItemContextProvider, useFormItemContext] = createFormFieldContext<FormItemContextValue>(FORM_ITEM_NAME);\n\n/* -----------------------------------------------------------------------------\n * Component: FormItem\n * -------------------------------------------------------------------------- */\n\nfunction FormItem({ __scopeFormField, className, ...props }: ScopedProps<ComponentProps<\"div\">>): JSX.Element {\n const id = useId();\n\n return (\n <FormItemContextProvider id={id} scope={__scopeFormField}>\n <div className={cn(\"grid gap-2\", className)} data-slot=\"form-item\" {...props} />\n </FormItemContextProvider>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormLabel\n * -------------------------------------------------------------------------- */\n\nconst FORM_LABEL_NAME = \"FormLabel\";\n\nfunction FormLabel({\n __scopeFormField,\n ...props\n}: ScopedProps<ComponentProps<typeof LabelPrimitive.Root>>): JSX.Element {\n const { formItemId, error } = useFormItem(FORM_LABEL_NAME, __scopeFormField);\n\n return <Label data-invalid={error ? true : undefined} data-slot=\"form-label\" htmlFor={formItemId} {...props} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormControl\n * -------------------------------------------------------------------------- */\n\nconst FORM_CONTROL_NAME = \"FormControl\";\n\nfunction FormControl({ __scopeFormField, ...props }: ScopedProps<ComponentProps<typeof Slot>>): JSX.Element {\n const { formDescriptionId, formItemId, formMessageId, error } = useFormItem(FORM_CONTROL_NAME, __scopeFormField);\n\n return (\n <Slot\n aria-describedby={error ? `${formDescriptionId} ${formMessageId}` : formDescriptionId}\n aria-invalid={Boolean(error)}\n data-slot=\"form-control\"\n id={formItemId}\n {...props}\n />\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormDescription\n * -------------------------------------------------------------------------- */\n\nfunction FormDescription({ __scopeFormField, className, ...props }: ScopedProps<ComponentProps<\"p\">>): JSX.Element {\n const { formDescriptionId } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField);\n\n return (\n <p\n className={cn(\"text-muted-foreground text-xs\", className)}\n data-slot=\"form-description\"\n id={formDescriptionId}\n {...props}\n />\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: FormMessage\n * -------------------------------------------------------------------------- */\n\nconst FORM_MESSAGE_NAME = \"FormMessage\";\n\nfunction FormMessage({ __scopeFormField, children, className, ...props }: ScopedProps<ComponentProps<\"p\">>): ReactNode {\n const { formMessageId, error } = useFormItem(FORM_MESSAGE_NAME, __scopeFormField);\n const body = error?.message ? String(error.message) : children;\n\n if (!body) {\n return null;\n }\n\n return (\n <p\n className={cn(\"text-xs\", error?.message ? \"text-destructive font-medium\" : \"text-muted-foreground\", className)}\n data-slot=\"form-message\"\n id={formMessageId}\n {...props}\n >\n {body}\n </p>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport { createFormFieldScope, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage };\n"],"names":["Form","FormProvider","FORM_FIELD_NAME","createFormFieldContext","createFormFieldScope","createContextScope","FormFieldContextProvider","useFormFieldContext","useFormItem","consumerName","scope","id","useFormItemContext","name","getFieldState","useFormContext","formState","useFormState","fieldState","FormField","formFieldProps","__scopeFormField","props","Controller","FORM_ITEM_NAME","FormItemContextProvider","FormItem","className","useId","cn","FORM_LABEL_NAME","FormLabel","formItemId","error","Label","undefined","FORM_CONTROL_NAME","FormControl","formDescriptionId","formMessageId","Slot","Boolean","FormDescription","FORM_MESSAGE_NAME","FormMessage","children","body","String"],"mappings":";y4CAmBMA,KAAOC,yCAAAA,YAAYA,CAMnBC,gBAAkB,YAIlB,CAACC,uBAAwBC,qBAAqB,CAAGC,GAAAA,8BAAAA,kBAAAA,EAAmBH,iBASpE,CAACI,yBAA0BC,oBAAoB,CAAGJ,uBAA8CD,iBAEtG,SAASM,YACPC,CAAoB,CACpBC,CAAY,EAaZ,GAAM,CAAEC,GAAAA,CAAE,CAAE,CAAGC,mBAAmBH,EAAcC,GAC1C,CAAEG,KAAAA,CAAI,CAAE,CAAGN,oBAAoBE,EAAcC,GAC7C,CAAEI,cAAAA,CAAa,CAAE,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AEhB,iBAAAA,CAAgB,CAAE,GAAGC,EAAiD,EAC3F,GAAM,CAAEgB,kBAAAA,CAAiB,CAAEN,WAAAA,CAAU,CAAEO,cAAAA,CAAa,CAAEN,MAAAA,CAAK,CAAE,CAAGzB,YAHxC,cAGuEa,GAE/F,MACE,oCAACmB,2BAAAA,IAAIA,CAAAA,CACH,mBAAkBP,EAAQ,CAAC,EAAEK,EAAkB,CAAC,EAAEC,EAAc,CAAC,CAAGD,EACpE,eAAcG,EAAQR,EACtB,YAAU,eACV,GAAID,EACH,GAAGV,CAAK,EAGf,CAMA,SAASoB,gBAAgB,CAAErB,iBAAAA,CAAgB,CAAEM,UAAAA,CAAS,CAAE,GAAGL,EAAyC,EAClG,GAAM,CAAEgB,kBAAAA,CAAiB,CAAE,CAAG9B,YAAYmC,kBAAmBtB,GAE7D,MACE,oCAAC,KACC,UAAWQ,GAAAA,0BAAAA,EAAAA,EAAG,gCAAiCF,GAC/C,YAAU,mBACV,GAAIW,EACH,GAAGhB,CAAK,EAGf,CAMA,IAAMqB,kBAAoB,cAE1B,SAASC,YAAY,CAAEvB,iBAAAA,CAAgB,CAAEwB,SAAAA,CAAQ,CAAElB,UAAAA,CAAS,CAAE,GAAGL,EAAyC,EACxG,GAAM,CAAEiB,cAAAA,CAAa,CAAEN,MAAAA,CAAK,CAAE,CAAGzB,YAAYmC,kBAAmBtB,GAC1DyB,EAAOb,GAAO,QAAUc,OAAOd,EAAM,OAAO,EAAIY,SAEtD,EAKE,oCAAC,KACC,UAAWhB,GAAAA,0BAAAA,EAAAA,EAAG,UAAWI,GAAO,QAAU,+BAAiC,wBAAyBN,GACpG,YAAU,eACV,GAAIY,EACH,GAAGjB,CAAK,C,SAERwB,C,GAVI,IAaX,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/pagination.cjs","sources":["webpack://@codefast/ui/./src/components/pagination.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from \"react\";\n\nimport { ChevronLeftIcon, ChevronRightIcon, EllipsisIcon } from \"lucide-react\";\n\nimport type { VariantProps } from \"@/lib/utils\";\n\nimport { buttonVariants } from \"@/components/button\";\nimport { cn } from \"@/lib/utils\";\n\n/* -----------------------------------------------------------------------------\n * Component: Pagination\n * -------------------------------------------------------------------------- */\n\nfunction Pagination({ className, ...props }: ComponentProps<\"nav\">): JSX.Element {\n return (\n <nav\n aria-label=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n data-slot=\"pagination\"\n role=\"navigation\"\n {...props}\n />\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationContent\n * -------------------------------------------------------------------------- */\n\nfunction PaginationContent({ className, ...props }: ComponentProps<\"ul\">): JSX.Element {\n return <ul className={cn(\"flex flex-row items-center gap-1\", className)} data-slot=\"pagination-content\" {...props} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationItem\n * -------------------------------------------------------------------------- */\n\nfunction PaginationItem(props: ComponentProps<\"li\">): JSX.Element {\n return <li data-slot=\"pagination-item\" {...props} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationLink\n * -------------------------------------------------------------------------- */\n\nfunction PaginationLink({\n children,\n className,\n isActive,\n size = \"icon\",\n ...props\n}: ComponentProps<\"a\"> &\n Pick<VariantProps<typeof buttonVariants>, \"size\"> & {\n isActive?: boolean;\n }): JSX.Element {\n return (\n <a\n aria-current={isActive ? \"page\" : undefined}\n className={buttonVariants({ className, size, variant: isActive ? \"outline\" : \"ghost\" })}\n data-slot=\"pagination-link\"\n {...props}\n >\n {children}\n </a>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationPrevious\n * -------------------------------------------------------------------------- */\n\nfunction PaginationPrevious({\n ...props\n}: ComponentProps<\"a\"> &\n Pick<VariantProps<typeof buttonVariants>, \"size\"> & {\n isActive?: boolean;\n }): JSX.Element {\n return (\n <PaginationLink aria-label=\"Go to previous page\" data-slot=\"pagination-previous\" size=\"md\" {...props}>\n <ChevronLeftIcon className=\"size-4\" />\n <span>Previous</span>\n </PaginationLink>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationNext\n * -------------------------------------------------------------------------- */\n\nfunction PaginationNext({\n ...props\n}: ComponentProps<\"a\"> &\n Pick<VariantProps<typeof buttonVariants>, \"size\"> & {\n isActive?: boolean;\n }): JSX.Element {\n return (\n <PaginationLink aria-label=\"Go to next page\" data-slot=\"pagination-next\" size=\"md\" {...props}>\n <span>Next</span>\n <ChevronRightIcon />\n </PaginationLink>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationEllipsis\n * -------------------------------------------------------------------------- */\n\nfunction PaginationEllipsis({ className, ...props }: ComponentProps<\"span\">): JSX.Element {\n return (\n <span\n aria-hidden\n className={cn(\"flex size-10 items-center justify-center\", className)}\n data-slot=\"pagination-ellipsis\"\n {...props}\n >\n <EllipsisIcon className=\"size-4\" />\n <span className=\"sr-only\">More pages</span>\n </span>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious,\n};\n"],"names":["Pagination","className","props","cn","PaginationContent","PaginationItem","PaginationLink","children","isActive","size","undefined","buttonVariants","PaginationPrevious","ChevronLeftIcon","PaginationNext","ChevronRightIcon","PaginationEllipsis","EllipsisIcon"],"mappings":"uvCAaA,SAASA,WAAW,CAAEC,UAAAA,CAAS,CAAE,GAAGC,EAA8B,EAChE,MACE,oCAAC,OACC,aAAW,aACX,UAAWC,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EAAG,qCAAsCF,GACpD,YAAU,aACV,KAAK,aACJ,GAAGC,CAAK,A,EAGf,CAMA,SAASE,kBAAkB,CAAEH,UAAAA,CAAS,CAAE,GAAGC,EAA6B,EACtE,MAAO,oCAAC,MAAG,UAAWC,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EAAG,mCAAoCF,GAAY,YAAU,qBAAsB,GAAGC,CAAK,A,EACnH,CAMA,SAASG,eAAeH,CAA2B,EACjD,MAAO,oCAAC,MAAG,YAAU,kBAAmB,GAAGA,CAAK,A,EAClD,CAMA,SAASI,eAAe,CACtBC,SAAAA,CAAQ,CACRN,UAAAA,CAAS,CACTO,SAAAA,CAAQ,CACRC,KAAAA,EAAO,MAAM,CACb,GAAGP,EAIF,EACD,MACE,oCAAC,KACC,eAAcM,EAAW,OAASE,
|
|
1
|
+
{"version":3,"file":"components/pagination.cjs","sources":["webpack://@codefast/ui/./src/components/pagination.tsx"],"sourcesContent":["import type { ComponentProps, JSX } from \"react\";\n\nimport { ChevronLeftIcon, ChevronRightIcon, EllipsisIcon } from \"lucide-react\";\n\nimport type { VariantProps } from \"@/lib/utils\";\n\nimport { buttonVariants } from \"@/components/button\";\nimport { cn } from \"@/lib/utils\";\n\n/* -----------------------------------------------------------------------------\n * Component: Pagination\n * -------------------------------------------------------------------------- */\n\nfunction Pagination({ className, ...props }: ComponentProps<\"nav\">): JSX.Element {\n return (\n <nav\n aria-label=\"pagination\"\n className={cn(\"mx-auto flex w-full justify-center\", className)}\n data-slot=\"pagination\"\n role=\"navigation\"\n {...props}\n />\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationContent\n * -------------------------------------------------------------------------- */\n\nfunction PaginationContent({ className, ...props }: ComponentProps<\"ul\">): JSX.Element {\n return <ul className={cn(\"flex flex-row items-center gap-1\", className)} data-slot=\"pagination-content\" {...props} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationItem\n * -------------------------------------------------------------------------- */\n\nfunction PaginationItem(props: ComponentProps<\"li\">): JSX.Element {\n return <li data-slot=\"pagination-item\" {...props} />;\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationLink\n * -------------------------------------------------------------------------- */\n\nfunction PaginationLink({\n children,\n className,\n isActive,\n size = \"icon\",\n ...props\n}: ComponentProps<\"a\"> &\n Pick<VariantProps<typeof buttonVariants>, \"size\"> & {\n isActive?: boolean;\n }): JSX.Element {\n return (\n <a\n aria-current={isActive ? \"page\" : undefined}\n className={buttonVariants({ className, size, variant: isActive ? \"outline\" : \"ghost\" })}\n data-slot=\"pagination-link\"\n {...props}\n >\n {children}\n </a>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationPrevious\n * -------------------------------------------------------------------------- */\n\nfunction PaginationPrevious({\n ...props\n}: ComponentProps<\"a\"> &\n Pick<VariantProps<typeof buttonVariants>, \"size\"> & {\n isActive?: boolean;\n }): JSX.Element {\n return (\n <PaginationLink aria-label=\"Go to previous page\" data-slot=\"pagination-previous\" size=\"md\" {...props}>\n <ChevronLeftIcon className=\"size-4\" />\n <span>Previous</span>\n </PaginationLink>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationNext\n * -------------------------------------------------------------------------- */\n\nfunction PaginationNext({\n ...props\n}: ComponentProps<\"a\"> &\n Pick<VariantProps<typeof buttonVariants>, \"size\"> & {\n isActive?: boolean;\n }): JSX.Element {\n return (\n <PaginationLink aria-label=\"Go to next page\" data-slot=\"pagination-next\" size=\"md\" {...props}>\n <span>Next</span>\n <ChevronRightIcon />\n </PaginationLink>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Component: PaginationEllipsis\n * -------------------------------------------------------------------------- */\n\nfunction PaginationEllipsis({ className, ...props }: ComponentProps<\"span\">): JSX.Element {\n return (\n <span\n aria-hidden\n className={cn(\"flex size-10 items-center justify-center\", className)}\n data-slot=\"pagination-ellipsis\"\n {...props}\n >\n <EllipsisIcon className=\"size-4\" />\n <span className=\"sr-only\">More pages</span>\n </span>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport {\n Pagination,\n PaginationContent,\n PaginationEllipsis,\n PaginationItem,\n PaginationLink,\n PaginationNext,\n PaginationPrevious,\n};\n"],"names":["Pagination","className","props","cn","PaginationContent","PaginationItem","PaginationLink","children","isActive","size","undefined","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K,C,UAC1F,oCAAC,Q,SAAK,M,GACN,oCAACa,sCAAAA,gBAAgBA,CAAAA,CAAAA,G,EAGvB,CAMA,SAASC,mBAAmB,CAAEf,UAAAA,CAAS,CAAE,GAAGC,EAA+B,EACzE,MACE,qCAAC,QACC,cAAW,GACX,UAAWC,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EAAG,2CAA4CF,GAC1D,YAAU,sBACT,GAAGC,CAAK,C,UAET,oCAACe,sCAAAA,YAAYA,CAAAA,CAAC,UAAU,Q,GACxB,oCAAC,QAAK,UAAU,U,SAAU,Y,KAGhC,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/progress-circle.cjs","sources":["webpack://@codefast/ui/./src/components/progress-circle.tsx"],"sourcesContent":["\n\nimport type { ComponentProps, CSSProperties, JSX } from \"react\";\n\nimport * as ProgressCirclePrimitive from \"@codefast-ui/progress-circle\";\nimport { useAnimatedValue } from \"@codefast/hooks\";\nimport { useCallback, useMemo } from \"react\";\n\nimport type { VariantProps } from \"@/lib/utils\";\n\nimport { tv } from \"@/lib/utils\";\n\n/* -------------------------------------------------------------------------------------------------\n * Variant: ProgressCircle\n * -----------------------------------------------------------------------------------------------*/\n\nconst progressCircleVariants = tv({\n slots: {\n root: \"relative inline-flex items-center justify-center\",\n svg: \"size-full\",\n track: \"origin-center\",\n indicator: \"origin-center\",\n label: \"absolute inset-0 flex items-center justify-center text-xs font-medium\",\n },\n variants: {\n variant: {\n default: { indicator: \"text-primary\", track: \"text-primary/20\" },\n destructive: { indicator: \"text-destructive\", track: \"text-destructive/20\" },\n },\n size: {\n sm: { label: \"text-[10px]\" },\n md: { label: \"text-xs\" },\n lg: { label: \"text-sm\" },\n xl: { label: \"text-base\" },\n \"2xl\": { label: \"text-lg\" },\n },\n thickness: { thin: {}, regular: {}, thick: {} },\n },\n defaultVariants: { variant: \"default\", size: \"md\", thickness: \"regular\" },\n});\n\n/* -------------------------------------------------------------------------------------------------\n * Component: ProgressCircle\n * -----------------------------------------------------------------------------------------------*/\n\nfunction ProgressCircle({\n value = 0,\n classNames,\n customLabel,\n showValue = false,\n variant = \"default\",\n size,\n sizeInPixels,\n thickness = \"regular\",\n animate = true,\n animationDuration = 1000,\n className,\n strokeWidth,\n ...props\n}: Omit<ComponentProps<typeof ProgressCirclePrimitive.Provider>, \"children\" | \"size\"> &\n VariantProps<typeof progressCircleVariants> & {\n /**\n * Enables animation effect when value changes\n */\n animate?: boolean;\n\n /**\n * Duration of the animation in milliseconds\n */\n animationDuration?: number;\n\n /**\n * CSS class to customize the entire component\n */\n className?: string;\n\n /**\n * CSS classes to customize specific parts of the component\n */\n classNames?: {\n /**\n * Class for the progress indicator\n */\n indicator?: string;\n\n /**\n * Class for the label in the center of the circle\n */\n label?: string;\n\n /**\n * Class for the root element of the component\n */\n root?: string;\n\n /**\n * Class for the SVG element\n */\n svg?: string;\n\n /**\n * Class for the circle track\n */\n track?: string;\n };\n\n /**\n * Custom function to render content in the center of the circle\n * @param value - Current value of the component\n * @returns React element to display in the center of the circle\n */\n customLabel?: ({ value }: { value: number }) => JSX.Element;\n\n /**\n * Display the numeric value in the center of the circle\n */\n showValue?: boolean;\n\n /**\n * Custom size in pixels\n * When provided, this value overrides the size variant option\n */\n sizeInPixels?: number;\n }): JSX.Element {\n const displayValue = useAnimatedValue(value, animationDuration, animate);\n\n const actualSize = useMemo(() => sizeInPixels || getActualSize(size), [sizeInPixels, size]);\n\n const actualThickness = useMemo(\n () => strokeWidth || getStrokeWidth(thickness, actualSize),\n [strokeWidth, thickness, actualSize],\n );\n\n const slots = useMemo(() => progressCircleVariants({ variant, size, thickness }), [variant, size, thickness]);\n\n const shouldShowLabel = showValue || Boolean(customLabel);\n\n const renderLabel = useCallback(() => {\n if (customLabel) {\n return customLabel({ value: displayValue });\n }\n\n return `${displayValue}%`;\n }, [customLabel, displayValue]);\n\n return (\n <ProgressCirclePrimitive.Provider size={actualSize} strokeWidth={actualThickness} value={value} {...props}>\n <ProgressCirclePrimitive.Root className={slots.root({ className: [className, classNames?.root] })}>\n <ProgressCirclePrimitive.SVG className={slots.svg({ className: classNames?.svg })}>\n <ProgressCirclePrimitive.Track className={slots.track({ className: classNames?.track })} />\n <ProgressCirclePrimitive.Indicator\n className={slots.indicator({ className: classNames?.indicator })}\n style={\n {\n transitionDuration: `${animationDuration}ms`,\n transitionProperty: \"stroke-dashoffset\",\n } as CSSProperties\n }\n />\n </ProgressCirclePrimitive.SVG>\n {shouldShowLabel ? (\n <ProgressCirclePrimitive.Value className={slots.label({ className: classNames?.label })}>\n {renderLabel()}\n </ProgressCirclePrimitive.Value>\n ) : null}\n </ProgressCirclePrimitive.Root>\n </ProgressCirclePrimitive.Provider>\n );\n}\n\nProgressCircle.displayName = \"ProgressCircle\";\n\n/* -----------------------------------------------------------------------------\n * Helpers\n * -------------------------------------------------------------------------- */\n\n/**\n * Maps size variants to actual pixel sizes\n */\nconst getActualSize = (size?: VariantProps<typeof progressCircleVariants>[\"size\"]): number => {\n const sizeMap: Record<NonNullable<typeof size>, number> = {\n sm: 32,\n md: 48,\n lg: 64,\n xl: 96,\n \"2xl\": 128,\n };\n\n return size ? sizeMap[size] : 48;\n};\n\n/**\n * Calculates stroke width based on thickness variant and circle size\n */\nconst getStrokeWidth = (thickness: VariantProps<typeof progressCircleVariants>[\"thickness\"], size: number): number => {\n const thicknessMap: Record<NonNullable<typeof thickness>, number> = {\n thin: Math.max(2, size * 0.025),\n regular: Math.max(3, size * 0.05),\n thick: Math.max(4, size * 0.075),\n };\n\n return thickness ? thicknessMap[thickness] : Math.max(3, size * 0.05);\n};\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport { ProgressCircle };\n"],"names":["progressCircleVariants","tv","ProgressCircle","value","classNames","customLabel","showValue","variant","size","sizeInPixels","thickness","animate","animationDuration","className","strokeWidth","props","displayValue","useAnimatedValue","actualSize","useMemo","getActualSize","actualThickness","getStrokeWidth","slots","shouldShowLabel","Boolean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AAA,OAAAA,EAAQ,IAAMnB,uBAAuB,CAAEO,QAAAA,EAASC,KAAAA,EAAME,UAAAA,CAAU,GAAI,CAACH,EAASC,EAAME,EAAU,EAEtGc,EAAkBlB,GAAamB,
|
|
1
|
+
{"version":3,"file":"components/progress-circle.cjs","sources":["webpack://@codefast/ui/./src/components/progress-circle.tsx"],"sourcesContent":["\n\nimport type { ComponentProps, CSSProperties, JSX } from \"react\";\n\nimport * as ProgressCirclePrimitive from \"@codefast-ui/progress-circle\";\nimport { useAnimatedValue } from \"@codefast/hooks\";\nimport { useCallback, useMemo } from \"react\";\n\nimport type { VariantProps } from \"@/lib/utils\";\n\nimport { tv } from \"@/lib/utils\";\n\n/* -------------------------------------------------------------------------------------------------\n * Variant: ProgressCircle\n * -----------------------------------------------------------------------------------------------*/\n\nconst progressCircleVariants = tv({\n slots: {\n root: \"relative inline-flex items-center justify-center\",\n svg: \"size-full\",\n track: \"origin-center\",\n indicator: \"origin-center\",\n label: \"absolute inset-0 flex items-center justify-center text-xs font-medium\",\n },\n variants: {\n variant: {\n default: { indicator: \"text-primary\", track: \"text-primary/20\" },\n destructive: { indicator: \"text-destructive\", track: \"text-destructive/20\" },\n },\n size: {\n sm: { label: \"text-[10px]\" },\n md: { label: \"text-xs\" },\n lg: { label: \"text-sm\" },\n xl: { label: \"text-base\" },\n \"2xl\": { label: \"text-lg\" },\n },\n thickness: { thin: {}, regular: {}, thick: {} },\n },\n defaultVariants: { variant: \"default\", size: \"md\", thickness: \"regular\" },\n});\n\n/* -------------------------------------------------------------------------------------------------\n * Component: ProgressCircle\n * -----------------------------------------------------------------------------------------------*/\n\nfunction ProgressCircle({\n value = 0,\n classNames,\n customLabel,\n showValue = false,\n variant = \"default\",\n size,\n sizeInPixels,\n thickness = \"regular\",\n animate = true,\n animationDuration = 1000,\n className,\n strokeWidth,\n ...props\n}: Omit<ComponentProps<typeof ProgressCirclePrimitive.Provider>, \"children\" | \"size\"> &\n VariantProps<typeof progressCircleVariants> & {\n /**\n * Enables animation effect when value changes\n */\n animate?: boolean;\n\n /**\n * Duration of the animation in milliseconds\n */\n animationDuration?: number;\n\n /**\n * CSS class to customize the entire component\n */\n className?: string;\n\n /**\n * CSS classes to customize specific parts of the component\n */\n classNames?: {\n /**\n * Class for the progress indicator\n */\n indicator?: string;\n\n /**\n * Class for the label in the center of the circle\n */\n label?: string;\n\n /**\n * Class for the root element of the component\n */\n root?: string;\n\n /**\n * Class for the SVG element\n */\n svg?: string;\n\n /**\n * Class for the circle track\n */\n track?: string;\n };\n\n /**\n * Custom function to render content in the center of the circle\n * @param value - Current value of the component\n * @returns React element to display in the center of the circle\n */\n customLabel?: ({ value }: { value: number }) => JSX.Element;\n\n /**\n * Display the numeric value in the center of the circle\n */\n showValue?: boolean;\n\n /**\n * Custom size in pixels\n * When provided, this value overrides the size variant option\n */\n sizeInPixels?: number;\n }): JSX.Element {\n const displayValue = useAnimatedValue(value, animationDuration, animate);\n\n const actualSize = useMemo(() => sizeInPixels || getActualSize(size), [sizeInPixels, size]);\n\n const actualThickness = useMemo(\n () => strokeWidth || getStrokeWidth(thickness, actualSize),\n [strokeWidth, thickness, actualSize],\n );\n\n const slots = useMemo(() => progressCircleVariants({ variant, size, thickness }), [variant, size, thickness]);\n\n const shouldShowLabel = showValue || Boolean(customLabel);\n\n const renderLabel = useCallback(() => {\n if (customLabel) {\n return customLabel({ value: displayValue });\n }\n\n return `${displayValue}%`;\n }, [customLabel, displayValue]);\n\n return (\n <ProgressCirclePrimitive.Provider size={actualSize} strokeWidth={actualThickness} value={value} {...props}>\n <ProgressCirclePrimitive.Root className={slots.root({ className: [className, classNames?.root] })}>\n <ProgressCirclePrimitive.SVG className={slots.svg({ className: classNames?.svg })}>\n <ProgressCirclePrimitive.Track className={slots.track({ className: classNames?.track })} />\n <ProgressCirclePrimitive.Indicator\n className={slots.indicator({ className: classNames?.indicator })}\n style={\n {\n transitionDuration: `${animationDuration}ms`,\n transitionProperty: \"stroke-dashoffset\",\n } as CSSProperties\n }\n />\n </ProgressCirclePrimitive.SVG>\n {shouldShowLabel ? (\n <ProgressCirclePrimitive.Value className={slots.label({ className: classNames?.label })}>\n {renderLabel()}\n </ProgressCirclePrimitive.Value>\n ) : null}\n </ProgressCirclePrimitive.Root>\n </ProgressCirclePrimitive.Provider>\n );\n}\n\nProgressCircle.displayName = \"ProgressCircle\";\n\n/* -----------------------------------------------------------------------------\n * Helpers\n * -------------------------------------------------------------------------- */\n\n/**\n * Maps size variants to actual pixel sizes\n */\nconst getActualSize = (size?: VariantProps<typeof progressCircleVariants>[\"size\"]): number => {\n const sizeMap: Record<NonNullable<typeof size>, number> = {\n sm: 32,\n md: 48,\n lg: 64,\n xl: 96,\n \"2xl\": 128,\n };\n\n return size ? sizeMap[size] : 48;\n};\n\n/**\n * Calculates stroke width based on thickness variant and circle size\n */\nconst getStrokeWidth = (thickness: VariantProps<typeof progressCircleVariants>[\"thickness\"], size: number): number => {\n const thicknessMap: Record<NonNullable<typeof thickness>, number> = {\n thin: Math.max(2, size * 0.025),\n regular: Math.max(3, size * 0.05),\n thick: Math.max(4, size * 0.075),\n };\n\n return thickness ? thicknessMap[thickness] : Math.max(3, size * 0.05);\n};\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport { ProgressCircle };\n"],"names":["progressCircleVariants","tv","ProgressCircle","value","classNames","customLabel","showValue","variant","size","sizeInPixels","thickness","animate","animationDuration","className","strokeWidth","props","displayValue","useAnimatedValue","actualSize","useMemo","getActualSize","actualThickness","getStrokeWidth","slots","shouldShowLabel","Boolean","renderLabel","useCallback","ProgressCirclePrimitive","sizeMap","thicknessMap","Math"],"mappings":";4kCAgBMA,uBAAyBC,GAAAA,0BAAAA,EAAAA,EAAG,CAChC,MAAO,CACL,KAAM,mDACN,IAAK,YACL,MAAO,gBACP,UAAW,gBACX,MAAO,uEACT,EACA,SAAU,CACR,QAAS,CACP,QAAS,CAAE,UAAW,eAAgB,MAAO,iBAAkB,EAC/D,Y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esContent":["import type { ComponentProps, CSSProperties, ReactNode } from \"react\";\n\nimport { VisuallyHidden } from \"@radix-ui/react-visually-hidden\";\n\nimport { cn } from \"@/lib/utils\";\n\n/* -----------------------------------------------------------------------------\n * Component: Spinner\n * -------------------------------------------------------------------------- */\n\nconst SPINNER_COUNT = 8;\n\nfunction Spinner({\n children,\n className,\n loading = true,\n ...props\n}: ComponentProps<\"span\"> & {\n loading?: boolean;\n}): ReactNode {\n if (!loading) {\n return children;\n }\n\n const spinner = (\n <span className={cn(\"relative flex size-4 items-center justify-center opacity-60\", className)} {...props}>\n {Array.from({ length: SPINNER_COUNT }, (_, i) => (\n <span\n key={i}\n className={cn(\n \"rotate-(--spinner-rotate) before:animate-out before:fade-out-25 before:animation-repeat-infinite before:animation-delay-(--spinner-delay) before:animation-duration-(--spinner-duration) absolute h-full before:block before:h-1/3 before:w-full before:rounded-full before:bg-current\",\n )}\n style={\n {\n \"--spinner-delay\": `-${((SPINNER_COUNT - i) * 100).toString()}ms`,\n \"--spinner-duration\": `${(SPINNER_COUNT * 100).toString()}ms`,\n \"--spinner-rotate\": `${((360 / SPINNER_COUNT) * i).toString()}deg`,\n width: `${(100 / SPINNER_COUNT).toString()}%`,\n } as CSSProperties\n }\n />\n ))}\n </span>\n );\n\n if (children === undefined) {\n return spinner;\n }\n\n return (\n <span className=\"relative\">\n <span aria-hidden className=\"invisible contents\">\n {children}\n </span>\n <VisuallyHidden>{children}</VisuallyHidden>\n <span className=\"absolute inset-0 flex items-center justify-center\">{spinner}</span>\n </span>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport { Spinner };\n"],"names":["SPINNER_COUNT","Spinner","children","className","loading","props","spinner","cn","Array","_","i","undefined","VisuallyHidden"],"mappings":"s+BAUMA,cAAgB,EAEtB,SAASC,QAAQ,CACfC,SAAAA,CAAQ,CACRC,UAAAA,CAAS,CACTC,QAAAA,EAAU,EAAI,CACd,GAAGC,EAGJ,EACC,GAAI,CAACD,EACH,OAAOF,EAGT,IAAMI,EACJ,oCAAC,QAAK,UAAWC,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EAAG,8DAA+DJ,GAAa,GAAGE,CAAK,C,SACrGG,MAAM,IAAI,CAAC,CAAE,OAhBE,CAgBoB,EAAG,CAACC,EAAGC,IACzC,oCAAC,QAEC,UAAWH,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EACT,0RAEF,MACE,CACE,kBAAmB,CAAC,CAAC,EAAG,AAACP,CAAAA,
|
|
1
|
+
{"version":3,"file":"components/spinner.cjs","sources":["webpack://@codefast/ui/./src/components/spinner.tsx"],"sourcesContent":["import type { ComponentProps, CSSProperties, ReactNode } from \"react\";\n\nimport { VisuallyHidden } from \"@radix-ui/react-visually-hidden\";\n\nimport { cn } from \"@/lib/utils\";\n\n/* -----------------------------------------------------------------------------\n * Component: Spinner\n * -------------------------------------------------------------------------- */\n\nconst SPINNER_COUNT = 8;\n\nfunction Spinner({\n children,\n className,\n loading = true,\n ...props\n}: ComponentProps<\"span\"> & {\n loading?: boolean;\n}): ReactNode {\n if (!loading) {\n return children;\n }\n\n const spinner = (\n <span className={cn(\"relative flex size-4 items-center justify-center opacity-60\", className)} {...props}>\n {Array.from({ length: SPINNER_COUNT }, (_, i) => (\n <span\n key={i}\n className={cn(\n \"rotate-(--spinner-rotate) before:animate-out before:fade-out-25 before:animation-repeat-infinite before:animation-delay-(--spinner-delay) before:animation-duration-(--spinner-duration) absolute h-full before:block before:h-1/3 before:w-full before:rounded-full before:bg-current\",\n )}\n style={\n {\n \"--spinner-delay\": `-${((SPINNER_COUNT - i) * 100).toString()}ms`,\n \"--spinner-duration\": `${(SPINNER_COUNT * 100).toString()}ms`,\n \"--spinner-rotate\": `${((360 / SPINNER_COUNT) * i).toString()}deg`,\n width: `${(100 / SPINNER_COUNT).toString()}%`,\n } as CSSProperties\n }\n />\n ))}\n </span>\n );\n\n if (children === undefined) {\n return spinner;\n }\n\n return (\n <span className=\"relative\">\n <span aria-hidden className=\"invisible contents\">\n {children}\n </span>\n <VisuallyHidden>{children}</VisuallyHidden>\n <span className=\"absolute inset-0 flex items-center justify-center\">{spinner}</span>\n </span>\n );\n}\n\n/* -----------------------------------------------------------------------------\n * Exports\n * -------------------------------------------------------------------------- */\n\nexport { Spinner };\n"],"names":["SPINNER_COUNT","Spinner","children","className","loading","props","spinner","cn","Array","_","i","undefined","VisuallyHidden"],"mappings":"s+BAUMA,cAAgB,EAEtB,SAASC,QAAQ,CACfC,SAAAA,CAAQ,CACRC,UAAAA,CAAS,CACTC,QAAAA,EAAU,EAAI,CACd,GAAGC,EAGJ,EACC,GAAI,CAACD,EACH,OAAOF,EAGT,IAAMI,EACJ,oCAAC,QAAK,UAAWC,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EAAG,8DAA+DJ,GAAa,GAAGE,CAAK,C,SACrGG,MAAM,IAAI,CAAC,CAAE,OAhBE,CAgBoB,EAAG,CAACC,EAAGC,IACzC,oCAAC,QAEC,UAAWH,AAAAA,GAAAA,0BAAAA,EAAAA,AAAAA,EACT,0RAEF,MACE,CACE,kBAAmB,CAAC,CAAC,EAAG,AAACP,CAAAA,CAxBjB,EAwBiCU,CAAAA,EAAK,GAAE,EAAG,QAAQ,GAAG,EAAE,CAAC,CACjE,qBAAsB,QACtB,mBAAoB,CAAC,EAAG,AAAC,IAAuBA,CAAAA,EAAG,QAAQ,GAAG,GAAG,CAAC,CAClE,MAAO,OACT,C,EAVGA,G,UAiBb,AAAIR,AAAaS,SAAbT,EACKI,EAIP,qCAAC,QAAK,UAAU,W,UACd,oCAAC,QAAK,cAAW,GAAC,UAAU,qB,SACzBJ,C,GAEH,oCAACU,sCAAAA,cAAcA,CAAAA,C,SAAEV,C,GACjB,oCAAC,QAAK,UAAU,oD,SAAqDI,C,KAG3E,C"}
|