@jackbernnie/hiyf 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +191 -0
- package/NOTICE +12 -0
- package/README.md +47 -0
- package/dist/components/Accordion.d.ts +38 -0
- package/dist/components/Accordion.js +38 -0
- package/dist/components/Alert.d.ts +29 -0
- package/dist/components/Alert.js +39 -0
- package/dist/components/AlertDialog.d.ts +37 -0
- package/dist/components/AlertDialog.js +38 -0
- package/dist/components/AspectRatio.d.ts +15 -0
- package/dist/components/AspectRatio.js +15 -0
- package/dist/components/Avatar.d.ts +26 -0
- package/dist/components/Avatar.js +13 -0
- package/dist/components/Badge.d.ts +18 -0
- package/dist/components/Badge.js +17 -0
- package/dist/components/Box.d.ts +13 -0
- package/dist/components/Box.js +52 -0
- package/dist/components/Breadcrumb.d.ts +33 -0
- package/dist/components/Breadcrumb.js +16 -0
- package/dist/components/Button.d.ts +40 -0
- package/dist/components/Button.js +33 -0
- package/dist/components/ButtonGroup.d.ts +18 -0
- package/dist/components/ButtonGroup.js +8 -0
- package/dist/components/Card.d.ts +46 -0
- package/dist/components/Card.js +24 -0
- package/dist/components/Carousel.d.ts +27 -0
- package/dist/components/Carousel.js +13 -0
- package/dist/components/Chart.d.ts +17 -0
- package/dist/components/Chart.js +94 -0
- package/dist/components/Checkbox.d.ts +26 -0
- package/dist/components/Checkbox.js +9 -0
- package/dist/components/Collapsible.d.ts +27 -0
- package/dist/components/Collapsible.js +26 -0
- package/dist/components/Combobox.d.ts +36 -0
- package/dist/components/Combobox.js +41 -0
- package/dist/components/Command.d.ts +37 -0
- package/dist/components/Command.js +32 -0
- package/dist/components/ContextMenu.d.ts +34 -0
- package/dist/components/ContextMenu.js +23 -0
- package/dist/components/Dialog.d.ts +20 -0
- package/dist/components/Dialog.js +34 -0
- package/dist/components/Drawer.d.ts +28 -0
- package/dist/components/Drawer.js +25 -0
- package/dist/components/DropdownMenu.d.ts +42 -0
- package/dist/components/DropdownMenu.js +32 -0
- package/dist/components/Empty.d.ts +28 -0
- package/dist/components/Empty.js +15 -0
- package/dist/components/Field.d.ts +30 -0
- package/dist/components/Field.js +13 -0
- package/dist/components/Grid.d.ts +32 -0
- package/dist/components/Grid.js +37 -0
- package/dist/components/GridItem.d.ts +30 -0
- package/dist/components/GridItem.js +40 -0
- package/dist/components/HoverCard.d.ts +22 -0
- package/dist/components/HoverCard.js +12 -0
- package/dist/components/Input.d.ts +34 -0
- package/dist/components/Input.js +8 -0
- package/dist/components/InputGroup.d.ts +28 -0
- package/dist/components/InputGroup.js +13 -0
- package/dist/components/InputOTP.d.ts +26 -0
- package/dist/components/InputOTP.js +25 -0
- package/dist/components/Kbd.d.ts +26 -0
- package/dist/components/Kbd.js +11 -0
- package/dist/components/Label.d.ts +20 -0
- package/dist/components/Label.js +17 -0
- package/dist/components/Menubar.d.ts +35 -0
- package/dist/components/Menubar.js +19 -0
- package/dist/components/NativeSelect.d.ts +33 -0
- package/dist/components/NativeSelect.js +37 -0
- package/dist/components/NavigationMenu.d.ts +32 -0
- package/dist/components/NavigationMenu.js +14 -0
- package/dist/components/Pagination.d.ts +28 -0
- package/dist/components/Pagination.js +62 -0
- package/dist/components/Popover.d.ts +28 -0
- package/dist/components/Popover.js +19 -0
- package/dist/components/Progress.d.ts +25 -0
- package/dist/components/Progress.js +37 -0
- package/dist/components/RadioGroup.d.ts +35 -0
- package/dist/components/RadioGroup.js +44 -0
- package/dist/components/Resizable.d.ts +31 -0
- package/dist/components/Resizable.js +17 -0
- package/dist/components/ScrollArea.d.ts +8 -0
- package/dist/components/ScrollArea.js +14 -0
- package/dist/components/Select.d.ts +35 -0
- package/dist/components/Select.js +33 -0
- package/dist/components/Separator.d.ts +10 -0
- package/dist/components/Separator.js +30 -0
- package/dist/components/Sheet.d.ts +31 -0
- package/dist/components/Sheet.js +26 -0
- package/dist/components/Sidebar.d.ts +52 -0
- package/dist/components/Sidebar.js +96 -0
- package/dist/components/Skeleton.d.ts +40 -0
- package/dist/components/Skeleton.js +42 -0
- package/dist/components/Slider.d.ts +26 -0
- package/dist/components/Slider.js +9 -0
- package/dist/components/Spinner.d.ts +7 -0
- package/dist/components/Spinner.js +13 -0
- package/dist/components/Status.d.ts +30 -0
- package/dist/components/Status.js +27 -0
- package/dist/components/Switch.d.ts +27 -0
- package/dist/components/Switch.js +9 -0
- package/dist/components/Table.d.ts +39 -0
- package/dist/components/Table.js +22 -0
- package/dist/components/Tabs.d.ts +32 -0
- package/dist/components/Tabs.js +21 -0
- package/dist/components/Text.d.ts +2 -0
- package/dist/components/Text.js +5 -0
- package/dist/components/Textarea.d.ts +32 -0
- package/dist/components/Textarea.js +15 -0
- package/dist/components/Toaster.d.ts +30 -0
- package/dist/components/Toaster.js +9 -0
- package/dist/components/Toggle.d.ts +34 -0
- package/dist/components/Toggle.js +31 -0
- package/dist/components/ToggleGroup.d.ts +46 -0
- package/dist/components/ToggleGroup.js +26 -0
- package/dist/components/Tooltip.d.ts +25 -0
- package/dist/components/Tooltip.js +12 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +81 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/alert-dialog.js +154 -0
- package/dist/components/ui/alert.d.ts +10 -0
- package/dist/components/ui/alert.js +64 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/aspect-ratio.js +11 -0
- package/dist/components/ui/avatar.d.ts +11 -0
- package/dist/components/ui/avatar.js +57 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +42 -0
- package/dist/components/ui/breadcrumb.d.ts +11 -0
- package/dist/components/ui/breadcrumb.js +87 -0
- package/dist/components/ui/button-group.d.ts +11 -0
- package/dist/components/ui/button-group.js +37 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +55 -0
- package/dist/components/ui/card.d.ts +11 -0
- package/dist/components/ui/card.js +82 -0
- package/dist/components/ui/carousel.d.ts +28 -0
- package/dist/components/ui/carousel.js +196 -0
- package/dist/components/ui/chart.d.ts +44 -0
- package/dist/components/ui/chart.js +198 -0
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +33 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +33 -0
- package/dist/components/ui/combobox.d.ts +24 -0
- package/dist/components/ui/combobox.js +160 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/command.js +142 -0
- package/dist/components/ui/context-menu.d.ts +31 -0
- package/dist/components/ui/context-menu.js +73 -0
- package/dist/components/ui/dialog.d.ts +17 -0
- package/dist/components/ui/dialog.js +138 -0
- package/dist/components/ui/direction.d.ts +7 -0
- package/dist/components/ui/direction.js +14 -0
- package/dist/components/ui/drawer.d.ts +13 -0
- package/dist/components/ui/drawer.js +101 -0
- package/dist/components/ui/dropdown-menu.d.ts +29 -0
- package/dist/components/ui/dropdown-menu.js +98 -0
- package/dist/components/ui/empty.d.ts +11 -0
- package/dist/components/ui/empty.js +97 -0
- package/dist/components/ui/field.d.ts +24 -0
- package/dist/components/ui/field.js +110 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.js +37 -0
- package/dist/components/ui/input-group.d.ts +16 -0
- package/dist/components/ui/input-group.js +111 -0
- package/dist/components/ui/input-otp.d.ts +11 -0
- package/dist/components/ui/input-otp.js +66 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/input.js +19 -0
- package/dist/components/ui/item.d.ts +23 -0
- package/dist/components/ui/item.js +181 -0
- package/dist/components/ui/kbd.d.ts +3 -0
- package/dist/components/ui/kbd.js +28 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/label.js +23 -0
- package/dist/components/ui/menubar.d.ts +30 -0
- package/dist/components/ui/menubar.js +119 -0
- package/dist/components/ui/native-select.d.ts +8 -0
- package/dist/components/ui/native-select.js +49 -0
- package/dist/components/ui/navigation-menu.d.ts +14 -0
- package/dist/components/ui/navigation-menu.js +139 -0
- package/dist/components/ui/pagination.d.ts +17 -0
- package/dist/components/ui/pagination.js +120 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/popover.js +37 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +44 -0
- package/dist/components/ui/resizable.d.ts +7 -0
- package/dist/components/ui/resizable.js +44 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +59 -0
- package/dist/components/ui/select.d.ts +15 -0
- package/dist/components/ui/select.js +131 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +27 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.js +113 -0
- package/dist/components/ui/sidebar.d.ts +69 -0
- package/dist/components/ui/sidebar.js +459 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/slider.js +60 -0
- package/dist/components/ui/sonner.d.ts +3 -0
- package/dist/components/ui/sonner.js +38 -0
- package/dist/components/ui/spinner.d.ts +2 -0
- package/dist/components/ui/spinner.js +13 -0
- package/dist/components/ui/switch.d.ts +6 -0
- package/dist/components/ui/switch.js +32 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +95 -0
- package/dist/components/ui/tabs.d.ts +11 -0
- package/dist/components/ui/tabs.js +87 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/textarea.js +18 -0
- package/dist/components/ui/toggle-group.d.ts +10 -0
- package/dist/components/ui/toggle-group.js +76 -0
- package/dist/components/ui/toggle.d.ts +9 -0
- package/dist/components/ui/toggle.js +43 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +53 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/index.d.ts +122 -0
- package/dist/index.js +61 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +8 -0
- package/dist/primitives/createText.d.ts +103 -0
- package/dist/primitives/createText.js +183 -0
- package/dist/primitives/resolveProperties.d.ts +17 -0
- package/dist/stylex.css +1450 -0
- package/dist/tokens/animations.d.ts +126 -0
- package/dist/tokens/animations.js +61 -0
- package/dist/tokens/tokens.stylex.d.ts +85 -0
- package/dist/tokens/tokens.stylex.js +81 -0
- package/dist/utils/box-styles.d.ts +1117 -0
- package/dist/utils/box-styles.js +1455 -0
- package/dist/utils/grid.d.ts +4 -0
- package/dist/utils/resolvers.d.ts +10 -0
- package/dist/utils/resolvers.js +356 -0
- package/dist/utils/types.d.ts +133 -0
- package/package.json +80 -0
- package/src/theme.css +206 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
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
|
+
|
|
179
|
+
Copyright 2023 Polar Software Inc
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
This project includes code forked from Polar's "Orbit" design system.
|
|
2
|
+
|
|
3
|
+
Original source: https://github.com/polarsource/polar
|
|
4
|
+
(clients/packages/orbit)
|
|
5
|
+
Original author: Polar Software Inc.
|
|
6
|
+
License: Apache License 2.0 (see LICENSE)
|
|
7
|
+
|
|
8
|
+
Background on the original design system:
|
|
9
|
+
https://polar.sh/blog/orbit-llm-safe-design-system
|
|
10
|
+
|
|
11
|
+
Modifications have been made for use as a standalone, personal design system.
|
|
12
|
+
The original Apache-2.0 license and this attribution are retained as required.
|
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# @jackbernnie/hiyf
|
|
2
|
+
|
|
3
|
+
**human-in-your-face** — a personal, LLM-safe design system: the full shadcn/ui
|
|
4
|
+
component set as a robust base, themed neutral, and closed down so the only
|
|
5
|
+
expressible choices are correct ones.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @jackbernnie/hiyf
|
|
9
|
+
npm install -D hiyf-eslint-config # the "lockdown" rules (recommended)
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```css
|
|
13
|
+
/* global CSS — no StyleX/bundler plugin needed; styles ship precompiled */
|
|
14
|
+
@import "tailwindcss";
|
|
15
|
+
@import "@jackbernnie/hiyf/theme.css"; /* design tokens (light/dark) */
|
|
16
|
+
@import "@jackbernnie/hiyf/styles.css"; /* precompiled primitive styles */
|
|
17
|
+
@source "../node_modules/@jackbernnie/hiyf/dist"; /* let Tailwind see the component classes */
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { Box, Text, Button, Card } from '@jackbernnie/hiyf'
|
|
22
|
+
|
|
23
|
+
<Box flexDirection="column" gap="m" padding="l" backgroundColor="background-card" borderRadius="m">
|
|
24
|
+
<Text variant="heading-s">Invoices</Text>
|
|
25
|
+
<Button intent="primary">New invoice</Button>
|
|
26
|
+
</Box>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- **Components** — closed wrappers over shadcn/ui with intent-named, enumerated
|
|
30
|
+
props and no `className`/`style` escape hatch.
|
|
31
|
+
- **`Box` / `Text` primitives** — token-only props (`padding="l"`,
|
|
32
|
+
`variant="heading-s"`). Their styles are **precompiled** (StyleX → static CSS
|
|
33
|
+
at publish time), so consumers need **no StyleX bundler plugin** — just import
|
|
34
|
+
`@jackbernnie/hiyf/styles.css`.
|
|
35
|
+
- **Theme** — `@jackbernnie/hiyf/theme.css` (neutral radix-vega tokens, light + dark).
|
|
36
|
+
|
|
37
|
+
Pair with [`hiyf-eslint-config`](https://www.npmjs.com/package/hiyf-eslint-config)
|
|
38
|
+
to make off-system code (raw elements, arbitrary Tailwind, inline styles) **fail
|
|
39
|
+
the build** — which is what makes it safe to generate UI with an LLM.
|
|
40
|
+
|
|
41
|
+
Ships compiled JS + types + CSS; works in Vite, Next.js (App Router — `'use client'`
|
|
42
|
+
directives are preserved), and any bundler. Full setup: see the repository's
|
|
43
|
+
`USAGE.md`.
|
|
44
|
+
|
|
45
|
+
## Attribution
|
|
46
|
+
|
|
47
|
+
Forked from Polar's "Orbit" design system (Apache-2.0). See `LICENSE`/`NOTICE`.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Accordion — closed wrapper over shadcn's composable Accordion parts.
|
|
4
|
+
*
|
|
5
|
+
* The raw parts accept arbitrary className, free-form children, and any
|
|
6
|
+
* nesting pattern. This wrapper closes that down by driving the accordion
|
|
7
|
+
* from a typed `items` data model:
|
|
8
|
+
* - `items` is the only way to populate panels; no ad-hoc AccordionItem
|
|
9
|
+
* imports needed (or possible) from consumer code.
|
|
10
|
+
* - `type` and `collapsible` are the only expressible behaviour knobs,
|
|
11
|
+
* matching the Radix root's intent-level props.
|
|
12
|
+
* - No `className` or `style` escape hatch on the public API.
|
|
13
|
+
*/
|
|
14
|
+
export interface AccordionItem {
|
|
15
|
+
/** Unique identifier for the panel; used as the Radix `value`. */
|
|
16
|
+
value: string;
|
|
17
|
+
/** Content rendered in the trigger button (text or JSX). */
|
|
18
|
+
trigger: React.ReactNode;
|
|
19
|
+
/** Content rendered inside the collapsible panel. */
|
|
20
|
+
content: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export interface AccordionProps {
|
|
23
|
+
/** Ordered list of accordion panels. */
|
|
24
|
+
items: AccordionItem[];
|
|
25
|
+
/**
|
|
26
|
+
* Whether one or multiple panels can be open at a time.
|
|
27
|
+
* Defaults to 'single'.
|
|
28
|
+
*/
|
|
29
|
+
type?: "single" | "multiple";
|
|
30
|
+
/**
|
|
31
|
+
* When `type='single'`, whether the open panel can be collapsed by
|
|
32
|
+
* clicking its trigger again. Ignored for `type='multiple'`.
|
|
33
|
+
*/
|
|
34
|
+
collapsible?: boolean;
|
|
35
|
+
/** Panel value(s) open on first render (uncontrolled). */
|
|
36
|
+
defaultValue?: string | string[];
|
|
37
|
+
}
|
|
38
|
+
export declare function Accordion({ items, type, collapsible, defaultValue, }: AccordionProps): React.JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { Accordion as Accordion$1, AccordionItem, AccordionTrigger, AccordionContent } from './ui/accordion.js';
|
|
4
|
+
|
|
5
|
+
function Accordion({
|
|
6
|
+
items,
|
|
7
|
+
type = "single",
|
|
8
|
+
collapsible = false,
|
|
9
|
+
defaultValue
|
|
10
|
+
}) {
|
|
11
|
+
if (type === "multiple") {
|
|
12
|
+
return /* @__PURE__ */ jsx(
|
|
13
|
+
Accordion$1,
|
|
14
|
+
{
|
|
15
|
+
type: "multiple",
|
|
16
|
+
defaultValue: defaultValue === void 0 ? void 0 : Array.isArray(defaultValue) ? defaultValue : [defaultValue],
|
|
17
|
+
children: items.map((item) => /* @__PURE__ */ jsxs(AccordionItem, { value: item.value, children: [
|
|
18
|
+
/* @__PURE__ */ jsx(AccordionTrigger, { children: item.trigger }),
|
|
19
|
+
/* @__PURE__ */ jsx(AccordionContent, { children: item.content })
|
|
20
|
+
] }, item.value))
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
Accordion$1,
|
|
26
|
+
{
|
|
27
|
+
type: "single",
|
|
28
|
+
collapsible,
|
|
29
|
+
defaultValue: defaultValue === void 0 ? void 0 : Array.isArray(defaultValue) ? defaultValue[0] : defaultValue,
|
|
30
|
+
children: items.map((item) => /* @__PURE__ */ jsxs(AccordionItem, { value: item.value, children: [
|
|
31
|
+
/* @__PURE__ */ jsx(AccordionTrigger, { children: item.trigger }),
|
|
32
|
+
/* @__PURE__ */ jsx(AccordionContent, { children: item.content })
|
|
33
|
+
] }, item.value))
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { Accordion };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
/**
|
|
4
|
+
* Alert — a closed wrapper over shadcn's Alert primitive.
|
|
5
|
+
*
|
|
6
|
+
* shadcn's <Alert> accepts an arbitrary `variant` and `className`, letting any
|
|
7
|
+
* tone bleed in unchecked. This wrapper closes it:
|
|
8
|
+
* - `tone` is named by INTENT (neutral/info/success/warning/danger), not by
|
|
9
|
+
* appearance — the same strategy as HIYF's Status chip.
|
|
10
|
+
* - A colored left border communicates the tone without arbitrary overrides.
|
|
11
|
+
* - NO `className`/`style` escape hatch. Every alert on screen is one of a
|
|
12
|
+
* finite, on-brand set of treatments.
|
|
13
|
+
* - Need another treatment? Add a `tone` here — a deliberate, reviewable
|
|
14
|
+
* change to the design system.
|
|
15
|
+
*/
|
|
16
|
+
declare const alertWrapperVariants: (props?: ({
|
|
17
|
+
tone?: "danger" | "warning" | "success" | "neutral" | "info" | null | undefined;
|
|
18
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
19
|
+
export type AlertTone = NonNullable<VariantProps<typeof alertWrapperVariants>['tone']>;
|
|
20
|
+
export interface AlertProps {
|
|
21
|
+
/** Named by intent, not appearance. */
|
|
22
|
+
tone?: AlertTone;
|
|
23
|
+
/** Optional heading displayed above the description. */
|
|
24
|
+
title?: string;
|
|
25
|
+
/** Alert body / description content. */
|
|
26
|
+
children: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export declare function Alert({ tone, title, children }: AlertProps): React.JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { Alert as Alert$1, AlertTitle, AlertDescription } from './ui/alert.js';
|
|
4
|
+
|
|
5
|
+
const alertWrapperVariants = cva(
|
|
6
|
+
"relative w-full border-l-4 [&>div[data-slot=alert]]:border-0 [&>div[data-slot=alert]]:rounded-none",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
tone: {
|
|
10
|
+
neutral: "border-l-muted-foreground/40",
|
|
11
|
+
info: "border-l-blue-500",
|
|
12
|
+
success: "border-l-emerald-500",
|
|
13
|
+
warning: "border-l-amber-500",
|
|
14
|
+
danger: "border-l-destructive"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: { tone: "neutral" }
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
const alertInnerVariants = cva("rounded-none border-0 border-l-0", {
|
|
21
|
+
variants: {
|
|
22
|
+
tone: {
|
|
23
|
+
neutral: "bg-muted/50 text-foreground",
|
|
24
|
+
info: "bg-blue-500/10 text-blue-700 dark:text-blue-300",
|
|
25
|
+
success: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
|
|
26
|
+
warning: "bg-amber-500/10 text-amber-700 dark:text-amber-300",
|
|
27
|
+
danger: "bg-destructive/10 text-destructive"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: { tone: "neutral" }
|
|
31
|
+
});
|
|
32
|
+
function Alert({ tone = "neutral", title, children }) {
|
|
33
|
+
return /* @__PURE__ */ jsx("div", { className: alertWrapperVariants({ tone }), children: /* @__PURE__ */ jsxs(Alert$1, { className: alertInnerVariants({ tone }), children: [
|
|
34
|
+
title && /* @__PURE__ */ jsx(AlertTitle, { children: title }),
|
|
35
|
+
/* @__PURE__ */ jsx(AlertDescription, { children })
|
|
36
|
+
] }) });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { Alert };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* AlertDialog — a closed convenience wrapper over the shadcn AlertDialog primitives.
|
|
4
|
+
*
|
|
5
|
+
* The raw primitives let callers pass arbitrary className, choose any button
|
|
6
|
+
* variant, and compose the footer however they like. This wrapper closes that:
|
|
7
|
+
* - `tone` maps to intent ('default' or 'danger') instead of exposing raw
|
|
8
|
+
* button variants — callers express what the action means, not how it looks.
|
|
9
|
+
* - `confirmLabel` / `cancelLabel` drive the two-button footer; no freestyle
|
|
10
|
+
* footer slot is offered because alert dialogs have a fixed structural shape.
|
|
11
|
+
* - No `className` or `style` escape hatch on any public prop.
|
|
12
|
+
*/
|
|
13
|
+
export interface AlertDialogProps {
|
|
14
|
+
/** Element that opens the dialog (e.g. a Button). */
|
|
15
|
+
trigger: React.ReactNode;
|
|
16
|
+
/** Accessible dialog title. */
|
|
17
|
+
title: string;
|
|
18
|
+
/** Explanatory text below the title. */
|
|
19
|
+
description: string;
|
|
20
|
+
/** Label for the confirm button; defaults to 'Confirm'. */
|
|
21
|
+
confirmLabel?: string;
|
|
22
|
+
/** Label for the cancel button; defaults to 'Cancel'. */
|
|
23
|
+
cancelLabel?: string;
|
|
24
|
+
/** Called when the confirm button is clicked. */
|
|
25
|
+
onConfirm?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Intent of the confirm action.
|
|
28
|
+
* 'danger' renders the confirm button in the destructive style to signal
|
|
29
|
+
* an irreversible or high-risk operation.
|
|
30
|
+
*/
|
|
31
|
+
tone?: "default" | "danger";
|
|
32
|
+
/** Controlled open state. */
|
|
33
|
+
open?: boolean;
|
|
34
|
+
/** Called when the open state should change. */
|
|
35
|
+
onOpenChange?: (open: boolean) => void;
|
|
36
|
+
}
|
|
37
|
+
export declare function AlertDialog({ trigger, title, description, confirmLabel, cancelLabel, onConfirm, tone, open, onOpenChange, }: AlertDialogProps): React.JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { AlertDialog as AlertDialog$1, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction } from './ui/alert-dialog.js';
|
|
4
|
+
|
|
5
|
+
function AlertDialog({
|
|
6
|
+
trigger,
|
|
7
|
+
title,
|
|
8
|
+
description,
|
|
9
|
+
confirmLabel = "Confirm",
|
|
10
|
+
cancelLabel = "Cancel",
|
|
11
|
+
onConfirm,
|
|
12
|
+
tone = "default",
|
|
13
|
+
open,
|
|
14
|
+
onOpenChange
|
|
15
|
+
}) {
|
|
16
|
+
return /* @__PURE__ */ jsxs(AlertDialog$1, { open, onOpenChange, children: [
|
|
17
|
+
/* @__PURE__ */ jsx(AlertDialogTrigger, { asChild: true, children: trigger }),
|
|
18
|
+
/* @__PURE__ */ jsxs(AlertDialogContent, { children: [
|
|
19
|
+
/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
|
|
20
|
+
/* @__PURE__ */ jsx(AlertDialogTitle, { children: title }),
|
|
21
|
+
/* @__PURE__ */ jsx(AlertDialogDescription, { children: description })
|
|
22
|
+
] }),
|
|
23
|
+
/* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
|
|
24
|
+
/* @__PURE__ */ jsx(AlertDialogCancel, { children: cancelLabel }),
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
AlertDialogAction,
|
|
27
|
+
{
|
|
28
|
+
variant: tone === "danger" ? "destructive" : "default",
|
|
29
|
+
onClick: onConfirm,
|
|
30
|
+
children: confirmLabel
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
] })
|
|
34
|
+
] })
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { AlertDialog };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface AspectRatioProps {
|
|
3
|
+
/**
|
|
4
|
+
* Named aspect ratio.
|
|
5
|
+
* - 'square' → 1:1
|
|
6
|
+
* - 'video' → 16:9
|
|
7
|
+
* - 'wide' → 21:9
|
|
8
|
+
* - 'portrait' → 3:4
|
|
9
|
+
* Defaults to 'video'.
|
|
10
|
+
*/
|
|
11
|
+
ratio?: 'square' | 'video' | 'wide' | 'portrait';
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/** Closed aspect ratio container — no className/style. */
|
|
15
|
+
export declare function AspectRatio({ ratio, children }: AspectRatioProps): React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { AspectRatio as AspectRatio$1 } from './ui/aspect-ratio.js';
|
|
4
|
+
|
|
5
|
+
const RATIO_MAP = {
|
|
6
|
+
square: 1,
|
|
7
|
+
video: 16 / 9,
|
|
8
|
+
wide: 21 / 9,
|
|
9
|
+
portrait: 3 / 4
|
|
10
|
+
};
|
|
11
|
+
function AspectRatio({ ratio = "video", children }) {
|
|
12
|
+
return /* @__PURE__ */ jsx(AspectRatio$1, { ratio: RATIO_MAP[ratio], children });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { AspectRatio };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Avatar — a closed wrapper over shadcn's Avatar primitive family.
|
|
4
|
+
*
|
|
5
|
+
* shadcn's Avatar passes `className` to the root, image, and fallback,
|
|
6
|
+
* letting consumers override size, shape, and color freely. This wrapper
|
|
7
|
+
* closes it:
|
|
8
|
+
* - `size` is enumerated ('sm'|'md'|'lg') and maps to the ui primitive's
|
|
9
|
+
* own `size` data attribute — the only expressible sizes are correct ones.
|
|
10
|
+
* - `src`, `alt`, and `fallback` (initials/text) are declared explicitly;
|
|
11
|
+
* AvatarImage and AvatarFallback are composed internally.
|
|
12
|
+
* - NO `className`/`style` escape hatch. Every avatar on screen is
|
|
13
|
+
* one of a finite, on-brand set of treatments.
|
|
14
|
+
* - Need another size? Add it to the ui primitive and mirror it here.
|
|
15
|
+
*/
|
|
16
|
+
export interface AvatarProps {
|
|
17
|
+
/** Image URL. When absent (or on load failure), `fallback` is shown. */
|
|
18
|
+
src?: string;
|
|
19
|
+
/** Accessible alt text for the image. */
|
|
20
|
+
alt?: string;
|
|
21
|
+
/** Short text (e.g. initials) shown when the image is unavailable. */
|
|
22
|
+
fallback: string;
|
|
23
|
+
/** Enumerated size. Defaults to 'md'. */
|
|
24
|
+
size?: 'sm' | 'md' | 'lg';
|
|
25
|
+
}
|
|
26
|
+
export declare function Avatar({ src, alt, fallback, size }: AvatarProps): React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Avatar as Avatar$1, AvatarImage, AvatarFallback } from './ui/avatar.js';
|
|
4
|
+
|
|
5
|
+
function Avatar({ src, alt, fallback, size = "md" }) {
|
|
6
|
+
const primitiveSize = size === "md" ? "default" : size;
|
|
7
|
+
return /* @__PURE__ */ jsxs(Avatar$1, { size: primitiveSize, children: [
|
|
8
|
+
src && /* @__PURE__ */ jsx(AvatarImage, { src, alt: alt ?? fallback }),
|
|
9
|
+
/* @__PURE__ */ jsx(AvatarFallback, { children: fallback })
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { Avatar };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export type BadgeTone = 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info';
|
|
3
|
+
export interface BadgeProps {
|
|
4
|
+
/**
|
|
5
|
+
* Intent of the badge.
|
|
6
|
+
* - 'neutral' → muted/secondary style
|
|
7
|
+
* - 'primary' → brand/primary style
|
|
8
|
+
* - 'success' → green semantic style
|
|
9
|
+
* - 'warning' → amber semantic style
|
|
10
|
+
* - 'danger' → destructive/red style
|
|
11
|
+
* - 'info' → blue semantic style
|
|
12
|
+
* Defaults to 'neutral'.
|
|
13
|
+
*/
|
|
14
|
+
tone?: BadgeTone;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/** Closed intent-named badge — no className/style. */
|
|
18
|
+
export declare function Badge({ tone, children }: BadgeProps): React.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Badge as Badge$1 } from './ui/badge.js';
|
|
3
|
+
|
|
4
|
+
const TONE_MAP = {
|
|
5
|
+
neutral: { variant: "secondary" },
|
|
6
|
+
primary: { variant: "default" },
|
|
7
|
+
success: { variant: "outline", className: "border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400" },
|
|
8
|
+
warning: { variant: "outline", className: "border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400" },
|
|
9
|
+
danger: { variant: "destructive" },
|
|
10
|
+
info: { variant: "outline", className: "border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400" }
|
|
11
|
+
};
|
|
12
|
+
function Badge({ tone = "neutral", children }) {
|
|
13
|
+
const config = TONE_MAP[tone];
|
|
14
|
+
return /* @__PURE__ */ jsx(Badge$1, { variant: config.variant, className: config.className, children });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Badge };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { BoxStyleProps } from '../utils/types';
|
|
3
|
+
type BoxElement = 'div' | 'span' | 'section' | 'article' | 'aside' | 'main' | 'nav' | 'header' | 'footer' | 'form' | 'fieldset' | 'label' | 'ul' | 'ol' | 'li';
|
|
4
|
+
type BoxOwnProps<E extends BoxElement = 'div'> = BoxStyleProps & {
|
|
5
|
+
as?: E;
|
|
6
|
+
className?: string;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export type BoxProps<E extends BoxElement = 'div'> = BoxOwnProps<E> & Omit<React.ComponentPropsWithoutRef<E>, keyof BoxOwnProps<E>>;
|
|
10
|
+
export declare const Box: <E extends BoxElement = "div">(props: BoxProps<E> & {
|
|
11
|
+
ref?: React.ForwardedRef<HTMLElement>;
|
|
12
|
+
}) => React.ReactElement | null;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as stylex from '@stylexjs/stylex';
|
|
4
|
+
import React__default, { useId } from 'react';
|
|
5
|
+
import { BOX_STYLE_PROP_KEYS, resolveBoxStyles } from '../utils/resolvers.js';
|
|
6
|
+
|
|
7
|
+
const NON_FLEX_DEFAULT_ELEMENTS = /* @__PURE__ */ new Set(["span", "label", "li"]);
|
|
8
|
+
function BoxInner({
|
|
9
|
+
as,
|
|
10
|
+
className,
|
|
11
|
+
children,
|
|
12
|
+
style: styleProp,
|
|
13
|
+
...rest
|
|
14
|
+
}, ref) {
|
|
15
|
+
const id = useId();
|
|
16
|
+
const scopeClass = `ds${id.replace(/:/g, "")}`;
|
|
17
|
+
const Component = as || "div";
|
|
18
|
+
const styleProps = {};
|
|
19
|
+
const domProps = {};
|
|
20
|
+
for (const [key, value] of Object.entries(rest)) {
|
|
21
|
+
if (BOX_STYLE_PROP_KEYS.has(key)) {
|
|
22
|
+
styleProps[key] = value;
|
|
23
|
+
} else {
|
|
24
|
+
domProps[key] = value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
if (styleProps.display === void 0 && !NON_FLEX_DEFAULT_ELEMENTS.has(as ?? "div")) {
|
|
28
|
+
styleProps.display = "flex";
|
|
29
|
+
}
|
|
30
|
+
const {
|
|
31
|
+
stylexStyles,
|
|
32
|
+
inlineStyle,
|
|
33
|
+
responsiveCSS
|
|
34
|
+
} = resolveBoxStyles(styleProps, scopeClass);
|
|
35
|
+
const sx = stylexStyles.length > 0 ? stylex.props(...stylexStyles) : null;
|
|
36
|
+
const mergedStyle = {
|
|
37
|
+
...sx?.style ?? {},
|
|
38
|
+
...inlineStyle,
|
|
39
|
+
...styleProp
|
|
40
|
+
};
|
|
41
|
+
const hasStyle = Object.keys(mergedStyle).length > 0;
|
|
42
|
+
const classes = [sx?.className ?? null, responsiveCSS ? scopeClass : null, className].filter(Boolean).join(" ") || void 0;
|
|
43
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
|
+
responsiveCSS && /* @__PURE__ */ jsx("style", { dangerouslySetInnerHTML: {
|
|
45
|
+
__html: responsiveCSS
|
|
46
|
+
} }),
|
|
47
|
+
/* @__PURE__ */ jsx(Component, { ref, className: classes, style: hasStyle ? mergedStyle : void 0, ...domProps, children })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
const Box = React__default.forwardRef(BoxInner);
|
|
51
|
+
|
|
52
|
+
export { Box };
|