liquidcn 0.0.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/LICENSE.md +201 -0
- package/README.md +209 -0
- package/dist/cjs/client/components/index.js +18 -0
- package/dist/cjs/client/components/index.js.map +1 -0
- package/dist/cjs/client/components/ui/dialog.js +48 -0
- package/dist/cjs/client/components/ui/dialog.js.map +1 -0
- package/dist/cjs/client/components/ui/index.js +24 -0
- package/dist/cjs/client/components/ui/index.js.map +1 -0
- package/dist/cjs/client/components/ui/pretty-date.js +91 -0
- package/dist/cjs/client/components/ui/pretty-date.js.map +1 -0
- package/dist/cjs/client/components/ui/resizable-navbar.js +126 -0
- package/dist/cjs/client/components/ui/resizable-navbar.js.map +1 -0
- package/dist/cjs/client/components/ui/select.js +50 -0
- package/dist/cjs/client/components/ui/select.js.map +1 -0
- package/dist/cjs/client/components/ui/sonner.js +12 -0
- package/dist/cjs/client/components/ui/sonner.js.map +1 -0
- package/dist/cjs/client/components/ui/switch.js +11 -0
- package/dist/cjs/client/components/ui/switch.js.map +1 -0
- package/dist/cjs/client/components/ui/tabs.js +53 -0
- package/dist/cjs/client/components/ui/tabs.js.map +1 -0
- package/dist/cjs/client/hooks/index.js +18 -0
- package/dist/cjs/client/hooks/index.js.map +1 -0
- package/dist/cjs/client/hooks/use-cookie-with-fallback.js +107 -0
- package/dist/cjs/client/hooks/use-cookie-with-fallback.js.map +1 -0
- package/dist/cjs/client/index.js +19 -0
- package/dist/cjs/client/index.js.map +1 -0
- package/dist/cjs/components/index.js +18 -0
- package/dist/cjs/components/index.js.map +1 -0
- package/dist/cjs/components/ui/alert.js +33 -0
- package/dist/cjs/components/ui/alert.js.map +1 -0
- package/dist/cjs/components/ui/badge.js +28 -0
- package/dist/cjs/components/ui/badge.js.map +1 -0
- package/dist/cjs/components/ui/button.js +39 -0
- package/dist/cjs/components/ui/button.js.map +1 -0
- package/dist/cjs/components/ui/card.js +48 -0
- package/dist/cjs/components/ui/card.js.map +1 -0
- package/dist/cjs/components/ui/footer.js +9 -0
- package/dist/cjs/components/ui/footer.js.map +1 -0
- package/dist/cjs/components/ui/index.js +25 -0
- package/dist/cjs/components/ui/index.js.map +1 -0
- package/dist/cjs/components/ui/input.js +12 -0
- package/dist/cjs/components/ui/input.js.map +1 -0
- package/dist/cjs/components/ui/pretty-amount.js +167 -0
- package/dist/cjs/components/ui/pretty-amount.js.map +1 -0
- package/dist/cjs/components/ui/textarea.js +12 -0
- package/dist/cjs/components/ui/textarea.js.map +1 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/utils.js +9 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/client/components/index.js +2 -0
- package/dist/esm/client/components/index.js.map +1 -0
- package/dist/esm/client/components/ui/dialog.js +37 -0
- package/dist/esm/client/components/ui/dialog.js.map +1 -0
- package/dist/esm/client/components/ui/index.js +8 -0
- package/dist/esm/client/components/ui/index.js.map +1 -0
- package/dist/esm/client/components/ui/pretty-date.js +88 -0
- package/dist/esm/client/components/ui/pretty-date.js.map +1 -0
- package/dist/esm/client/components/ui/resizable-navbar.js +113 -0
- package/dist/esm/client/components/ui/resizable-navbar.js.map +1 -0
- package/dist/esm/client/components/ui/select.js +39 -0
- package/dist/esm/client/components/ui/select.js.map +1 -0
- package/dist/esm/client/components/ui/sonner.js +9 -0
- package/dist/esm/client/components/ui/sonner.js.map +1 -0
- package/dist/esm/client/components/ui/switch.js +9 -0
- package/dist/esm/client/components/ui/switch.js.map +1 -0
- package/dist/esm/client/components/ui/tabs.js +47 -0
- package/dist/esm/client/components/ui/tabs.js.map +1 -0
- package/dist/esm/client/hooks/index.js +2 -0
- package/dist/esm/client/hooks/index.js.map +1 -0
- package/dist/esm/client/hooks/use-cookie-with-fallback.js +104 -0
- package/dist/esm/client/hooks/use-cookie-with-fallback.js.map +1 -0
- package/dist/esm/client/index.js +3 -0
- package/dist/esm/client/index.js.map +1 -0
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/components/ui/alert.js +30 -0
- package/dist/esm/components/ui/alert.js.map +1 -0
- package/dist/esm/components/ui/badge.js +25 -0
- package/dist/esm/components/ui/badge.js.map +1 -0
- package/dist/esm/components/ui/button.js +36 -0
- package/dist/esm/components/ui/button.js.map +1 -0
- package/dist/esm/components/ui/card.js +41 -0
- package/dist/esm/components/ui/card.js.map +1 -0
- package/dist/esm/components/ui/footer.js +6 -0
- package/dist/esm/components/ui/footer.js.map +1 -0
- package/dist/esm/components/ui/index.js +9 -0
- package/dist/esm/components/ui/index.js.map +1 -0
- package/dist/esm/components/ui/input.js +11 -0
- package/dist/esm/components/ui/input.js.map +1 -0
- package/dist/esm/components/ui/pretty-amount.js +164 -0
- package/dist/esm/components/ui/pretty-amount.js.map +1 -0
- package/dist/esm/components/ui/textarea.js +11 -0
- package/dist/esm/components/ui/textarea.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/utils.js +6 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/styles.css +563 -0
- package/dist/types/client/components/index.d.ts +2 -0
- package/dist/types/client/components/index.d.ts.map +1 -0
- package/dist/types/client/components/ui/dialog.d.ts +16 -0
- package/dist/types/client/components/ui/dialog.d.ts.map +1 -0
- package/dist/types/client/components/ui/index.d.ts +8 -0
- package/dist/types/client/components/ui/index.d.ts.map +1 -0
- package/dist/types/client/components/ui/pretty-date.d.ts +30 -0
- package/dist/types/client/components/ui/pretty-date.d.ts.map +1 -0
- package/dist/types/client/components/ui/resizable-navbar.d.ts +84 -0
- package/dist/types/client/components/ui/resizable-navbar.d.ts.map +1 -0
- package/dist/types/client/components/ui/select.d.ts +16 -0
- package/dist/types/client/components/ui/select.d.ts.map +1 -0
- package/dist/types/client/components/ui/sonner.d.ts +6 -0
- package/dist/types/client/components/ui/sonner.d.ts.map +1 -0
- package/dist/types/client/components/ui/switch.d.ts +5 -0
- package/dist/types/client/components/ui/switch.d.ts.map +1 -0
- package/dist/types/client/components/ui/tabs.d.ts +11 -0
- package/dist/types/client/components/ui/tabs.d.ts.map +1 -0
- package/dist/types/client/hooks/index.d.ts +2 -0
- package/dist/types/client/hooks/index.d.ts.map +1 -0
- package/dist/types/client/hooks/use-cookie-with-fallback.d.ts +20 -0
- package/dist/types/client/hooks/use-cookie-with-fallback.d.ts.map +1 -0
- package/dist/types/client/index.d.ts +3 -0
- package/dist/types/client/index.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/components/ui/alert.d.ts +21 -0
- package/dist/types/components/ui/alert.d.ts.map +1 -0
- package/dist/types/components/ui/badge.d.ts +10 -0
- package/dist/types/components/ui/badge.d.ts.map +1 -0
- package/dist/types/components/ui/button.d.ts +16 -0
- package/dist/types/components/ui/button.d.ts.map +1 -0
- package/dist/types/components/ui/card.d.ts +26 -0
- package/dist/types/components/ui/card.d.ts.map +1 -0
- package/dist/types/components/ui/footer.d.ts +25 -0
- package/dist/types/components/ui/footer.d.ts.map +1 -0
- package/dist/types/components/ui/index.d.ts +9 -0
- package/dist/types/components/ui/index.d.ts.map +1 -0
- package/dist/types/components/ui/input.d.ts +10 -0
- package/dist/types/components/ui/input.d.ts.map +1 -0
- package/dist/types/components/ui/pretty-amount.d.ts +24 -0
- package/dist/types/components/ui/pretty-amount.d.ts.map +1 -0
- package/dist/types/components/ui/textarea.d.ts +10 -0
- package/dist/types/components/ui/textarea.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/utils.d.ts +3 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/package.json +102 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2025] [Mehmet Guleryuz]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
[![npm latest package][npm-latest-image]][npm-url]
|
|
4
|
+
[![Build Status][ci-image]][ci-url]
|
|
5
|
+
[![License][license-image]][license-url]
|
|
6
|
+
[![npm downloads][npm-downloads-image]][npm-url]
|
|
7
|
+
[![Follow on Twitter][twitter-image]][twitter-url]
|
|
8
|
+
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
## liquidcn - Reusable UI Components
|
|
12
|
+
|
|
13
|
+
A collection of reusable, accessible React UI components built with TypeScript, Tailwind CSS, and modern development tools.
|
|
14
|
+
|
|
15
|
+
## Summary
|
|
16
|
+
|
|
17
|
+
**liquidcn** is a comprehensive component library featuring:
|
|
18
|
+
|
|
19
|
+
- **UI Components**: Button, Card, Alert, Badge, Input, Textarea, Footer, PrettyAmount
|
|
20
|
+
- **Client Components**: Dialog, Select, Switch, Tabs, Sonner (Toast), PrettyDate, ResizableNavbar
|
|
21
|
+
- **Hooks**: Custom React hooks including `useCookieWithFallback`
|
|
22
|
+
- **Utilities**: `cn()` utility for className merging using clsx and tailwind-merge
|
|
23
|
+
|
|
24
|
+
Bun + Npm + Typescript + Standard Version + Flat Config Linting + Husky + Commit / Release Pipeline
|
|
25
|
+
|
|
26
|
+
Check out the [Changelog](./CHANGELOG.md) to see what changed in the last releases.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
bun add liquidcn
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Install Bun ( bun is the default package manager for this project ( its optional ) ):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Supported on macOS, Linux, and WSL
|
|
38
|
+
curl -fsSL https://bun.sh/install | bash
|
|
39
|
+
# Upgrade Bun every once in a while
|
|
40
|
+
bun upgrage
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
### Import Styles
|
|
46
|
+
|
|
47
|
+
Add the liquidcn styles to your project root or layout file:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import 'liquidcn/styles.css'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Navbar Component
|
|
54
|
+
|
|
55
|
+
The `ResizableNavbar` component provides a responsive navigation bar with desktop and mobile support:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
'use client'
|
|
59
|
+
import {
|
|
60
|
+
Navbar as ResizableNavbar,
|
|
61
|
+
NavBody,
|
|
62
|
+
NavItems,
|
|
63
|
+
MobileNav,
|
|
64
|
+
NavbarLogo,
|
|
65
|
+
NavbarButton,
|
|
66
|
+
MobileNavHeader,
|
|
67
|
+
MobileNavToggle,
|
|
68
|
+
MobileNavMenu,
|
|
69
|
+
} from 'liquidcn/client'
|
|
70
|
+
import { useState } from 'react'
|
|
71
|
+
import Link from 'next/link'
|
|
72
|
+
import { usePathname } from 'next/navigation'
|
|
73
|
+
|
|
74
|
+
const navItems = [
|
|
75
|
+
{ name: 'Projects', link: '/' },
|
|
76
|
+
{ name: 'Deploy', link: '/deploy' },
|
|
77
|
+
{ name: 'Docs', link: '/docs' },
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
export function Navbar({ className }: { className?: string }) {
|
|
81
|
+
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false)
|
|
82
|
+
const pathname = usePathname()
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<ResizableNavbar className={className} menuOpen={isMobileMenuOpen}>
|
|
86
|
+
{/* Desktop Navigation */}
|
|
87
|
+
<NavBody>
|
|
88
|
+
<NavbarLogo imageSrc="/logo.png" />
|
|
89
|
+
<NavItems items={navItems} currentPath={pathname} />
|
|
90
|
+
<div className="flex items-center gap-4">
|
|
91
|
+
<NavbarButton>Your Content Here</NavbarButton>
|
|
92
|
+
</div>
|
|
93
|
+
</NavBody>
|
|
94
|
+
|
|
95
|
+
{/* Mobile Navigation */}
|
|
96
|
+
<MobileNav>
|
|
97
|
+
<MobileNavHeader>
|
|
98
|
+
<NavbarLogo imageSrc="/logo.png" />
|
|
99
|
+
<MobileNavToggle
|
|
100
|
+
isOpen={isMobileMenuOpen}
|
|
101
|
+
onClick={() => setIsMobileMenuOpen(!isMobileMenuOpen)}
|
|
102
|
+
/>
|
|
103
|
+
</MobileNavHeader>
|
|
104
|
+
|
|
105
|
+
<MobileNavMenu isOpen={isMobileMenuOpen}>
|
|
106
|
+
{navItems.map((item, idx) => (
|
|
107
|
+
<Link key={idx} href={item.link}>
|
|
108
|
+
{item.name}
|
|
109
|
+
</Link>
|
|
110
|
+
))}
|
|
111
|
+
</MobileNavMenu>
|
|
112
|
+
</MobileNav>
|
|
113
|
+
</ResizableNavbar>
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Footer Component
|
|
119
|
+
|
|
120
|
+
The `Footer` component displays links with icons and social media integration:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
'use client'
|
|
124
|
+
import Link from 'next/link'
|
|
125
|
+
import { FileText } from 'lucide-react'
|
|
126
|
+
import { SiFarcaster } from 'react-icons/si'
|
|
127
|
+
import { FaSquareXTwitter } from 'react-icons/fa6'
|
|
128
|
+
import { Footer, type FooterLink } from 'liquidcn'
|
|
129
|
+
|
|
130
|
+
const footerLinks: FooterLink[] = [
|
|
131
|
+
{
|
|
132
|
+
name: 'Twitter / X',
|
|
133
|
+
href: 'https://x.com/yourhandle',
|
|
134
|
+
icon: FaSquareXTwitter,
|
|
135
|
+
showLabel: false,
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'Farcaster',
|
|
139
|
+
href: 'https://farcaster.xyz/yourhandle',
|
|
140
|
+
icon: SiFarcaster,
|
|
141
|
+
showLabel: false,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'Documentation',
|
|
145
|
+
href: 'https://docs.example.com',
|
|
146
|
+
icon: FileText,
|
|
147
|
+
showLabel: true,
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
export function MyFooter() {
|
|
152
|
+
return (
|
|
153
|
+
<Footer
|
|
154
|
+
links={footerLinks}
|
|
155
|
+
builtByBrand="Your Brand"
|
|
156
|
+
linkComponent={Link}
|
|
157
|
+
/>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Developing
|
|
163
|
+
|
|
164
|
+
Install Dependencies:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
bun i
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Watching TS Problems:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
bun watch
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Format / Lint / Type Check:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
bun format
|
|
180
|
+
bun lint
|
|
181
|
+
bun type-check
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## How to make a release
|
|
185
|
+
|
|
186
|
+
**For the Maintainer**: Add `NPM_TOKEN` to the GitHub Secrets.
|
|
187
|
+
|
|
188
|
+
1. PR with changes
|
|
189
|
+
2. Merge PR into main
|
|
190
|
+
3. Checkout main
|
|
191
|
+
4. `git pull`
|
|
192
|
+
5. `bun release: '' | alpha | beta` optionally add `-- --release-as minor | major | 0.0.1`
|
|
193
|
+
6. Make sure everything looks good (e.g. in CHANGELOG.md)
|
|
194
|
+
7. Lastly run `bun release:pub`
|
|
195
|
+
8. Done
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
This package is licensed - see the [LICENSE](./LICENSE.md) file for details.
|
|
200
|
+
|
|
201
|
+
[ci-image]: https://badgen.net/github/checks/mguleryuz/liquidcn/main?label=ci
|
|
202
|
+
[ci-url]: https://github.com/mguleryuz/liquidcn/actions/workflows/ci.yaml
|
|
203
|
+
[npm-url]: https://npmjs.org/package/liquidcn
|
|
204
|
+
[twitter-url]: https://twitter.com/0xxmemo
|
|
205
|
+
[twitter-image]: https://img.shields.io/twitter/follow/0xxmemo.svg?label=follow+liquidcn
|
|
206
|
+
[license-image]: https://img.shields.io/badge/License-Apache%20v2-blue
|
|
207
|
+
[license-url]: ./LICENSE.md
|
|
208
|
+
[npm-latest-image]: https://img.shields.io/npm/v/liquidcn/latest.svg
|
|
209
|
+
[npm-downloads-image]: https://img.shields.io/npm/dm/liquidcn.svg
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ui"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/client/components/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAoB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Dialog = Dialog;
|
|
5
|
+
exports.DialogClose = DialogClose;
|
|
6
|
+
exports.DialogContent = DialogContent;
|
|
7
|
+
exports.DialogDescription = DialogDescription;
|
|
8
|
+
exports.DialogFooter = DialogFooter;
|
|
9
|
+
exports.DialogHeader = DialogHeader;
|
|
10
|
+
exports.DialogOverlay = DialogOverlay;
|
|
11
|
+
exports.DialogPortal = DialogPortal;
|
|
12
|
+
exports.DialogTitle = DialogTitle;
|
|
13
|
+
exports.DialogTrigger = DialogTrigger;
|
|
14
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
const DialogPrimitive = require("@radix-ui/react-dialog");
|
|
16
|
+
const lucide_react_1 = require("lucide-react");
|
|
17
|
+
const utils_1 = require("../../../utils");
|
|
18
|
+
function Dialog({ ...props }) {
|
|
19
|
+
return (0, jsx_runtime_1.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
20
|
+
}
|
|
21
|
+
function DialogTrigger({ ...props }) {
|
|
22
|
+
return (0, jsx_runtime_1.jsx)(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
23
|
+
}
|
|
24
|
+
function DialogPortal({ ...props }) {
|
|
25
|
+
return (0, jsx_runtime_1.jsx)(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
26
|
+
}
|
|
27
|
+
function DialogClose({ ...props }) {
|
|
28
|
+
return (0, jsx_runtime_1.jsx)(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
29
|
+
}
|
|
30
|
+
function DialogOverlay({ className, ...props }) {
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: (0, utils_1.cn)('data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/60 backdrop-blur-sm', className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [(0, jsx_runtime_1.jsx)(DialogOverlay, {}), (0, jsx_runtime_1.jsxs)(DialogPrimitive.Content, { "data-slot": "dialog-content", className: (0, utils_1.cn)('glass glass-lg relative data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 w-full max-w-[calc(100%-2rem)] max-h-[80vh] translate-x-[-50%] translate-y-[-50%] rounded-xl border border-white/30 shadow-2xl duration-200 sm:max-w-lg', className), ...props, children: [(0, jsx_runtime_1.jsx)("span", { className: "glass-layers glass-refraction glass-texture glass-tint-none", "aria-hidden": "true" }), (0, jsx_runtime_1.jsx)("div", { className: "relative z-10 grid gap-4 p-6 max-h-[80vh] overflow-y-auto", children: children }), showCloseButton && ((0, jsx_runtime_1.jsxs)(DialogPrimitive.Close, { "data-slot": "dialog-close", className: "absolute top-4 right-4 z-20 rounded-full p-1.5 text-white/70 transition-all hover:text-white hover:bg-white/10 focus:ring-2 focus:ring-white/50 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.XIcon, {}), (0, jsx_runtime_1.jsx)("span", { className: "sr-only", children: "Close" })] }))] })] }));
|
|
35
|
+
}
|
|
36
|
+
function DialogHeader({ className, ...props }) {
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "dialog-header", className: (0, utils_1.cn)('flex flex-col gap-2 text-center sm:text-left', className), ...props }));
|
|
38
|
+
}
|
|
39
|
+
function DialogFooter({ className, ...props }) {
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)("div", { "data-slot": "dialog-footer", className: (0, utils_1.cn)('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className), ...props }));
|
|
41
|
+
}
|
|
42
|
+
function DialogTitle({ className, ...props }) {
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(DialogPrimitive.Title, { "data-slot": "dialog-title", className: (0, utils_1.cn)('text-lg leading-none font-semibold text-white', className), ...props }));
|
|
44
|
+
}
|
|
45
|
+
function DialogDescription({ className, ...props }) {
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(DialogPrimitive.Description, { "data-slot": "dialog-description", className: (0, utils_1.cn)('text-white/70 text-sm', className), ...props }));
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../../../src/client/components/ui/dialog.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;AA0HV,wBAAM;AACN,kCAAW;AACX,sCAAa;AACb,8CAAiB;AACjB,oCAAY;AACZ,oCAAY;AACZ,sCAAa;AACb,oCAAY;AACZ,kCAAW;AACX,sCAAa;;AAjIf,0DAAyD;AACzD,+CAAoC;AAGpC,0CAAmC;AAEnC,SAAS,MAAM,CAAC,EAAE,GAAG,KAAK,EAAqD;IAC7E,OAAO,uBAAC,eAAe,CAAC,IAAI,iBAAW,QAAQ,KAAK,KAAK,GAAI,CAAA;AAC/D,CAAC;AAED,SAAS,aAAa,CAAC,EAAE,GAAG,KAAK,EAAwD;IACvF,OAAO,uBAAC,eAAe,CAAC,OAAO,iBAAW,gBAAgB,KAAK,KAAK,GAAI,CAAA;AAC1E,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,GAAG,KAAK,EAAuD;IACrF,OAAO,uBAAC,eAAe,CAAC,MAAM,iBA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xE,OAAO,CACL,6CACY,eAAe,EACzB,SAAS,EAAE,IAAA,UAAE,EAAC,wDAAwD,EAAE,SAAS,CAAC,KAC9E,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAsD;IAC9F,OAAO,CACL,uBAAC,eAAe,CAAC,KAAK,iBACV,cAAc,EACxB,SAAS,EAAE,IAAA,UAAE,EAAC,+CAA+C,EAAE,SAAS,CAAC,KACrE,KAAK,GACT,CACH,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACiD;IACzD,OAAO,CACL,uBAAC,eAAe,CAAC,WAAW,iBAChB,oBAAoB,EAC9B,SAAS,EAAE,IAAA,UAAE,EAAC,uBAAuB,EAAE,SAAS,CAAC,KAC7C,KAAK,GACT,CACH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./dialog"), exports);
|
|
18
|
+
__exportStar(require("./pretty-date"), exports);
|
|
19
|
+
__exportStar(require("./resizable-navbar"), exports);
|
|
20
|
+
__exportStar(require("./select"), exports);
|
|
21
|
+
__exportStar(require("./sonner"), exports);
|
|
22
|
+
__exportStar(require("./switch"), exports);
|
|
23
|
+
__exportStar(require("./tabs"), exports);
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/client/components/ui/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAwB;AACxB,gDAA6B;AAC7B,qDAAkC;AAClC,2CAAwB;AACxB,2CAAwB;AACxB,2CAAwB;AACxB,yCAAsB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrettyDate = PrettyDate;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
const sizeClasses = {
|
|
8
|
+
xs: 'text-xs',
|
|
9
|
+
sm: 'text-sm',
|
|
10
|
+
base: 'text-base',
|
|
11
|
+
lg: 'text-lg',
|
|
12
|
+
xl: 'text-xl',
|
|
13
|
+
'2xl': 'text-2xl',
|
|
14
|
+
};
|
|
15
|
+
function parseDate(date) {
|
|
16
|
+
if (date instanceof Date)
|
|
17
|
+
return date;
|
|
18
|
+
if (typeof date === 'string')
|
|
19
|
+
return new Date(date);
|
|
20
|
+
if (typeof date === 'number')
|
|
21
|
+
return new Date(date);
|
|
22
|
+
throw new Error('Invalid date format');
|
|
23
|
+
}
|
|
24
|
+
function formatDuration(milliseconds, showSeconds = false) {
|
|
25
|
+
const seconds = Math.floor(Math.abs(milliseconds) / 1000);
|
|
26
|
+
const minutes = Math.floor(seconds / 60);
|
|
27
|
+
const hours = Math.floor(minutes / 60);
|
|
28
|
+
const days = Math.floor(hours / 24);
|
|
29
|
+
const remainingHours = hours % 24;
|
|
30
|
+
const remainingMinutes = minutes % 60;
|
|
31
|
+
const remainingSeconds = seconds % 60;
|
|
32
|
+
const parts = [];
|
|
33
|
+
if (days > 0) {
|
|
34
|
+
parts.push(`${days}d`);
|
|
35
|
+
}
|
|
36
|
+
if (remainingHours > 0 || days > 0) {
|
|
37
|
+
parts.push(`${remainingHours}h`);
|
|
38
|
+
}
|
|
39
|
+
if (remainingMinutes > 0 || hours > 0 || days > 0) {
|
|
40
|
+
parts.push(`${remainingMinutes}m`);
|
|
41
|
+
}
|
|
42
|
+
if (showSeconds && (remainingSeconds > 0 || (days === 0 && hours === 0 && minutes === 0))) {
|
|
43
|
+
parts.push(`${remainingSeconds}s`);
|
|
44
|
+
}
|
|
45
|
+
return parts.length > 0 ? parts.join(' ') : '0s';
|
|
46
|
+
}
|
|
47
|
+
function getTimeUntil(targetDate, referenceDate) {
|
|
48
|
+
const now = referenceDate || new Date();
|
|
49
|
+
const diff = targetDate.getTime() - now.getTime();
|
|
50
|
+
return {
|
|
51
|
+
milliseconds: diff,
|
|
52
|
+
isPast: diff < 0,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function PrettyDate({ date, format = 'datetime', className, size = 'base', showSeconds = false, referenceDate, labels = {}, }) {
|
|
56
|
+
const [, setUpdateTrigger] = (0, react_1.useState)(0);
|
|
57
|
+
const parsedDate = parseDate(date);
|
|
58
|
+
const parsedReferenceDate = referenceDate ? parseDate(referenceDate) : undefined;
|
|
59
|
+
const timeInfo = getTimeUntil(parsedDate, parsedReferenceDate);
|
|
60
|
+
(0, react_1.useEffect)(() => {
|
|
61
|
+
if (format === 'countdown') {
|
|
62
|
+
const interval = setInterval(() => {
|
|
63
|
+
setUpdateTrigger((prev) => prev + 1);
|
|
64
|
+
}, 1000);
|
|
65
|
+
return () => clearInterval(interval);
|
|
66
|
+
}
|
|
67
|
+
return;
|
|
68
|
+
}, [format]);
|
|
69
|
+
const sizeClass = sizeClasses[size];
|
|
70
|
+
const { ago: agoLabel = 'ago', fromNow: fromNowLabel = 'from now' } = labels;
|
|
71
|
+
if (format === 'countdown') {
|
|
72
|
+
const duration = formatDuration(timeInfo.milliseconds, showSeconds);
|
|
73
|
+
const suffix = timeInfo.isPast ? agoLabel : fromNowLabel;
|
|
74
|
+
const colorClass = timeInfo.isPast ? 'text-red-500' : 'text-green-500';
|
|
75
|
+
return ((0, jsx_runtime_1.jsxs)("span", { className: (0, utils_1.cn)('inline-flex items-baseline gap-1', className), children: [(0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)(sizeClass, colorClass), children: duration }), (0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)('text-muted-foreground', sizeClass), children: suffix })] }));
|
|
76
|
+
}
|
|
77
|
+
if (format === 'relative') {
|
|
78
|
+
const duration = formatDuration(Math.abs(timeInfo.milliseconds), showSeconds);
|
|
79
|
+
const suffix = timeInfo.isPast ? agoLabel : fromNowLabel;
|
|
80
|
+
const colorClass = timeInfo.isPast ? 'text-muted-foreground' : 'text-green-500';
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)("span", { className: (0, utils_1.cn)('inline-flex items-baseline gap-1', className), children: [(0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)(sizeClass, colorClass), children: duration }), (0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)('text-muted-foreground', sizeClass), children: suffix })] }));
|
|
82
|
+
}
|
|
83
|
+
if (format === 'date') {
|
|
84
|
+
return (0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)(sizeClass, className), children: parsedDate.toLocaleDateString() });
|
|
85
|
+
}
|
|
86
|
+
if (format === 'time') {
|
|
87
|
+
return (0, jsx_runtime_1.jsx)("span", { className: (0, utils_1.cn)(sizeClass, className), children: parsedDate.toLocaleTimeString() });
|
|
88
|
+
}
|
|
89
|
+
return ((0, jsx_runtime_1.jsxs)("span", { className: (0, utils_1.cn)(sizeClass, className), children: [parsedDate.toLocaleDateString(), " at ", parsedDate.toLocaleTimeString()] }));
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=pretty-date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pretty-date.js","sourceRoot":"","sources":["../../../../../src/client/components/ui/pretty-date.tsx"],"names":[],"mappings":";;AAyFA,gCAqEC;;AA9JD,iCAA2C;AAG3C,0CAAmC;AA8BnC,MAAM,WAAW,GAAqC;IACpD,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,IAAI,EAAE,WAAW;IACjB,EAAE,EAAE,SAAS;IACb,EAAE,EAAE,SAAS;IACb,KAAK,EAAE,UAAU;CAClB,CAAA;AAED,SAAS,SAAS,CAAC,IAA4B;IAC7C,IAAI,IAAI,YAAY,IAAI;QAAE,OAAO,IAAI,CAAA;IACrC,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;IACnD,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAA;IACnD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAA;AACxC,CAAC;AAED,SAAS,cAAc,CAAC,YAAoB,EAAE,WAAW,GAAG,KAAK;IAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAA;IACzD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAA;IACxC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAA;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,CAAA;IAEnC,MAAM,cAAc,GAAG,KAAK,GAAG,EAAE,CAAA;IACjC,MAAM,gB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