@cryptlex/web-components 5.1.1 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/components/data-table/data-table-filter.d.ts +27 -0
  2. package/dist/components/data-table/data-table-filter.js +112 -0
  3. package/dist/components/data-table/data-table.d.ts +73 -0
  4. package/dist/components/data-table/data-table.js +265 -0
  5. package/dist/components/data-table/table-commons.d.ts +56 -0
  6. package/dist/components/data-table/table-commons.js +137 -0
  7. package/dist/components/inputs/checkbox.d.ts +8 -0
  8. package/dist/components/inputs/checkbox.js +25 -0
  9. package/dist/components/inputs/date-picker.d.ts +11 -0
  10. package/dist/components/inputs/date-picker.js +22 -0
  11. package/dist/components/inputs/datefield.d.ts +14 -0
  12. package/dist/components/inputs/datefield.js +25 -0
  13. package/dist/components/inputs/field.d.ts +21 -0
  14. package/dist/components/inputs/field.js +48 -0
  15. package/dist/components/inputs/id-search.d.ts +20 -0
  16. package/dist/components/inputs/id-search.js +40 -0
  17. package/dist/components/inputs/input-otp.d.ts +8 -0
  18. package/dist/components/inputs/input-otp.js +19 -0
  19. package/dist/components/inputs/multi-select.d.ts +17 -0
  20. package/dist/components/inputs/multi-select.js +18 -0
  21. package/dist/components/inputs/numberfield.d.ts +7 -0
  22. package/dist/components/inputs/numberfield.js +25 -0
  23. package/dist/components/inputs/searchfield.d.ts +5 -0
  24. package/dist/components/inputs/searchfield.js +24 -0
  25. package/dist/components/inputs/select-options.d.ts +8 -0
  26. package/dist/components/inputs/select-options.js +286 -0
  27. package/dist/components/inputs/select.d.ts +17 -0
  28. package/dist/components/inputs/select.js +34 -0
  29. package/dist/components/inputs/textfield.d.ts +7 -0
  30. package/dist/components/inputs/textfield.js +28 -0
  31. package/dist/components/key-value-card/key-value-card.d.ts +17 -0
  32. package/dist/components/key-value-card/key-value-card.js +40 -0
  33. package/dist/components/ui/alert.d.ts +8 -0
  34. package/dist/components/ui/alert.js +18 -0
  35. package/dist/components/ui/avatar.d.ts +8 -0
  36. package/dist/components/ui/avatar.js +5 -0
  37. package/dist/components/ui/badge.d.ts +2 -0
  38. package/dist/components/ui/badge.js +5 -0
  39. package/dist/components/ui/breadcrumbs.d.ts +10 -0
  40. package/dist/components/ui/breadcrumbs.js +28 -0
  41. package/dist/components/ui/button.d.ts +11 -0
  42. package/dist/components/ui/button.js +34 -0
  43. package/dist/components/ui/calendar.d.ts +17 -0
  44. package/dist/components/ui/calendar.js +63 -0
  45. package/dist/components/ui/card.d.ts +7 -0
  46. package/dist/components/ui/card.js +20 -0
  47. package/dist/components/ui/dialog.d.ts +19 -0
  48. package/dist/components/ui/dialog.js +42 -0
  49. package/dist/components/ui/disclosure.d.ts +19 -0
  50. package/dist/components/ui/disclosure.js +20 -0
  51. package/dist/components/ui/list-box.d.ts +5 -0
  52. package/dist/components/ui/list-box.js +24 -0
  53. package/dist/components/ui/loader.d.ts +5 -0
  54. package/dist/components/ui/loader.js +6 -0
  55. package/dist/components/ui/menu.d.ts +25 -0
  56. package/dist/components/ui/menu.js +38 -0
  57. package/dist/components/ui/popover.d.ts +4 -0
  58. package/dist/components/ui/popover.js +14 -0
  59. package/dist/components/ui/sidebar.d.ts +53 -0
  60. package/dist/components/ui/sidebar.js +177 -0
  61. package/dist/components/ui/skeleton.d.ts +1 -0
  62. package/dist/components/ui/skeleton.js +5 -0
  63. package/dist/components/ui/sonner.d.ts +4 -0
  64. package/dist/components/ui/sonner.js +14 -0
  65. package/dist/components/ui/table.d.ts +9 -0
  66. package/dist/components/ui/table.js +26 -0
  67. package/dist/components/ui/tabs.d.ts +5 -0
  68. package/dist/components/ui/tabs.js +25 -0
  69. package/dist/components/ui/timeline.d.ts +15 -0
  70. package/dist/components/ui/timeline.js +31 -0
  71. package/dist/components/ui/tooltip.d.ts +4 -0
  72. package/dist/components/ui/tooltip.js +12 -0
  73. package/dist/utils/form-context.d.ts +4 -0
  74. package/dist/utils/form-context.js +5 -0
  75. package/dist/utils/form-hook.d.ts +25 -0
  76. package/dist/utils/form-hook.js +30 -0
  77. package/dist/utils/primitives.d.ts +30 -0
  78. package/dist/utils/primitives.js +39 -0
  79. package/dist/utils/resource-names.d.ts +23 -0
  80. package/dist/utils/resource-names.js +212 -0
  81. package/dist/utils/use-mobile.d.ts +1 -0
  82. package/dist/utils/use-mobile.js +15 -0
  83. package/package.json +32 -37
  84. package/dist/components/data-table/data-table-filter.es.js +0 -132
  85. package/dist/components/data-table/data-table-filter.es.js.map +0 -1
  86. package/dist/components/data-table/data-table.es.js +0 -412
  87. package/dist/components/data-table/data-table.es.js.map +0 -1
  88. package/dist/components/data-table/table-commons.es.js +0 -136
  89. package/dist/components/data-table/table-commons.es.js.map +0 -1
  90. package/dist/components/inputs/checkbox.es.js +0 -61
  91. package/dist/components/inputs/checkbox.es.js.map +0 -1
  92. package/dist/components/inputs/date-picker.es.js +0 -124
  93. package/dist/components/inputs/date-picker.es.js.map +0 -1
  94. package/dist/components/inputs/datefield.es.js +0 -90
  95. package/dist/components/inputs/datefield.es.js.map +0 -1
  96. package/dist/components/inputs/field.es.js +0 -91
  97. package/dist/components/inputs/field.es.js.map +0 -1
  98. package/dist/components/inputs/id-search.es.js +0 -61
  99. package/dist/components/inputs/id-search.es.js.map +0 -1
  100. package/dist/components/inputs/input-otp.es.js +0 -60
  101. package/dist/components/inputs/input-otp.es.js.map +0 -1
  102. package/dist/components/inputs/multi-select.es.js +0 -47
  103. package/dist/components/inputs/multi-select.es.js.map +0 -1
  104. package/dist/components/inputs/numberfield.es.js +0 -101
  105. package/dist/components/inputs/numberfield.es.js.map +0 -1
  106. package/dist/components/inputs/searchfield.es.js +0 -80
  107. package/dist/components/inputs/searchfield.es.js.map +0 -1
  108. package/dist/components/inputs/select-options.es.js +0 -286
  109. package/dist/components/inputs/select-options.es.js.map +0 -1
  110. package/dist/components/inputs/select.es.js +0 -113
  111. package/dist/components/inputs/select.es.js.map +0 -1
  112. package/dist/components/inputs/textfield.es.js +0 -86
  113. package/dist/components/inputs/textfield.es.js.map +0 -1
  114. package/dist/components/key-value-card/key-value-card.es.js +0 -53
  115. package/dist/components/key-value-card/key-value-card.es.js.map +0 -1
  116. package/dist/components/ui/alert.es.js +0 -29
  117. package/dist/components/ui/alert.es.js.map +0 -1
  118. package/dist/components/ui/avatar.es.js +0 -19
  119. package/dist/components/ui/avatar.es.js.map +0 -1
  120. package/dist/components/ui/badge.es.js +0 -19
  121. package/dist/components/ui/badge.es.js.map +0 -1
  122. package/dist/components/ui/breadcrumbs.es.js +0 -104
  123. package/dist/components/ui/breadcrumbs.es.js.map +0 -1
  124. package/dist/components/ui/button.es.js +0 -58
  125. package/dist/components/ui/button.es.js.map +0 -1
  126. package/dist/components/ui/calendar.es.js +0 -163
  127. package/dist/components/ui/calendar.es.js.map +0 -1
  128. package/dist/components/ui/card.es.js +0 -53
  129. package/dist/components/ui/card.es.js.map +0 -1
  130. package/dist/components/ui/dialog.es.js +0 -156
  131. package/dist/components/ui/dialog.es.js.map +0 -1
  132. package/dist/components/ui/disclosure.es.js +0 -90
  133. package/dist/components/ui/disclosure.es.js.map +0 -1
  134. package/dist/components/ui/list-box.es.js +0 -76
  135. package/dist/components/ui/list-box.es.js.map +0 -1
  136. package/dist/components/ui/loader.es.js +0 -10
  137. package/dist/components/ui/loader.es.js.map +0 -1
  138. package/dist/components/ui/menu.es.js +0 -129
  139. package/dist/components/ui/menu.es.js.map +0 -1
  140. package/dist/components/ui/popover.es.js +0 -32
  141. package/dist/components/ui/popover.es.js.map +0 -1
  142. package/dist/components/ui/sidebar.es.js +0 -456
  143. package/dist/components/ui/sidebar.es.js.map +0 -1
  144. package/dist/components/ui/skeleton.es.js +0 -9
  145. package/dist/components/ui/skeleton.es.js.map +0 -1
  146. package/dist/components/ui/sonner.es.js +0 -24
  147. package/dist/components/ui/sonner.es.js.map +0 -1
  148. package/dist/components/ui/table.es.js +0 -88
  149. package/dist/components/ui/table.es.js.map +0 -1
  150. package/dist/components/ui/tabs.es.js +0 -83
  151. package/dist/components/ui/tabs.es.js.map +0 -1
  152. package/dist/components/ui/timeline.es.js +0 -46
  153. package/dist/components/ui/timeline.es.js.map +0 -1
  154. package/dist/components/ui/tooltip.es.js +0 -28
  155. package/dist/components/ui/tooltip.es.js.map +0 -1
  156. package/dist/index.es.d.ts +0 -861
  157. package/dist/index.es.js +0 -218
  158. package/dist/index.es.js.map +0 -1
  159. package/dist/utils/form-context.es.js +0 -8
  160. package/dist/utils/form-context.es.js.map +0 -1
  161. package/dist/utils/form-hook.es.js +0 -30
  162. package/dist/utils/form-hook.es.js.map +0 -1
  163. package/dist/utils/primitives.es.js +0 -31
  164. package/dist/utils/primitives.es.js.map +0 -1
  165. package/dist/utils/resource-names.es.js +0 -182
  166. package/dist/utils/resource-names.es.js.map +0 -1
  167. package/dist/utils/use-mobile.es.js +0 -17
  168. package/dist/utils/use-mobile.es.js.map +0 -1
@@ -0,0 +1,286 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ export const LICENSE_TYPE_OPTIONS = [
3
+ {
4
+ label: _jsx(_Fragment, { children: "Node-locked" }),
5
+ id: "node-locked",
6
+ },
7
+ {
8
+ label: _jsx(_Fragment, { children: "Hosted floating" }),
9
+ id: "hosted-floating",
10
+ },
11
+ {
12
+ label: _jsx(_Fragment, { children: "LexFloatServer" }),
13
+ id: "on-premise-floating",
14
+ },
15
+ ];
16
+ /**
17
+ * Creates Unicode flag from a two-letter ISO country code.
18
+ * https://stackoverflow.com/questions/24050671/how-to-put-japan-flag-character-in-a-string
19
+ * @param {string} country — A two-letter ISO country code (case-insensitive).
20
+ * @return {string}
21
+ */
22
+ function getCountryFlag(country) {
23
+ function getRegionalIndicatorSymbol(letter) {
24
+ return String.fromCodePoint(0x1f1e6 - 65 + letter.toUpperCase().charCodeAt(0));
25
+ }
26
+ return (getRegionalIndicatorSymbol(country[0]) +
27
+ getRegionalIndicatorSymbol(country[1]));
28
+ }
29
+ const ALL_COUNTRIES = {
30
+ AF: "Afghanistan",
31
+ AX: "Åland Islands",
32
+ AL: "Albania",
33
+ DZ: "Algeria",
34
+ AS: "American Samoa",
35
+ AD: "Andorra",
36
+ AO: "Angola",
37
+ AI: "Anguilla",
38
+ AQ: "Antarctica",
39
+ AG: "Antigua and Barbuda",
40
+ AR: "Argentina",
41
+ AM: "Armenia",
42
+ AW: "Aruba",
43
+ AU: "Australia",
44
+ AT: "Austria",
45
+ AZ: "Azerbaijan",
46
+ BS: "Bahamas",
47
+ BH: "Bahrain",
48
+ BD: "Bangladesh",
49
+ BB: "Barbados",
50
+ BY: "Belarus",
51
+ BE: "Belgium",
52
+ BZ: "Belize",
53
+ BJ: "Benin",
54
+ BM: "Bermuda",
55
+ BT: "Bhutan",
56
+ BO: "Bolivia (Plurinational State of)",
57
+ BQ: "Bonaire, Sint Eustatius and Saba",
58
+ BA: "Bosnia and Herzegovina",
59
+ BW: "Botswana",
60
+ BV: "Bouvet Island",
61
+ BR: "Brazil",
62
+ IO: "British Indian Ocean Territory",
63
+ BN: "Brunei Darussalam",
64
+ BG: "Bulgaria",
65
+ BF: "Burkina Faso",
66
+ BI: "Burundi",
67
+ CV: "Caboe Verde",
68
+ KH: "Cambodia",
69
+ CM: "Cameroon",
70
+ CA: "Canada",
71
+ KY: "Cayman Islands",
72
+ CF: "Central African Republic",
73
+ TD: "Chad",
74
+ CL: "Chile",
75
+ CN: "China",
76
+ CX: "Christmas Island",
77
+ CC: "Cocos (Keeling) Islands",
78
+ CO: "Colombia",
79
+ KM: "Comoros",
80
+ CG: "Congo",
81
+ CD: "Congo, Democratic Republic of the",
82
+ CK: "Cook Islands",
83
+ CR: "Costa Rica",
84
+ CI: "Côte d'voire",
85
+ HR: "Croatia",
86
+ CU: "Cuba",
87
+ CW: "Curaçao",
88
+ CY: "Cyprus",
89
+ CZ: "Czechia",
90
+ DK: "Denmark",
91
+ DJ: "Djibouti",
92
+ DM: "Dominica",
93
+ DO: "Dominican Republic",
94
+ EC: "Ecuador",
95
+ EG: "Egypt",
96
+ SV: "El Salvador",
97
+ GQ: "Equatorial Guinea",
98
+ ER: "Eritrea",
99
+ EE: "Estonia",
100
+ SZ: "Eswatini",
101
+ ET: "Ethiopia",
102
+ FK: "Falkland Islands (Malvinas)",
103
+ FO: "Faroe Islands",
104
+ FJ: "Fiji",
105
+ FI: "Finland",
106
+ FR: "France",
107
+ GF: "French Guiana",
108
+ PF: "French Polynesia",
109
+ TF: "French Southern Territories",
110
+ GA: "Gabon",
111
+ GM: "Gambia",
112
+ GE: "Georgia",
113
+ DE: "Germany",
114
+ GH: "Ghana",
115
+ GI: "Gibraltar",
116
+ GR: "Greece",
117
+ GL: "Greenland",
118
+ GD: "Grenada",
119
+ GP: "Guadeloupe",
120
+ GU: "Guam",
121
+ GT: "Guatemala",
122
+ GG: "Guernsey",
123
+ GN: "Guinea",
124
+ GW: "Guinea-Bissau",
125
+ GY: "Guyana",
126
+ HT: "Haiti",
127
+ HM: "Heard Island and Mcdonald Islands",
128
+ VA: "Holy See",
129
+ HN: "Honduras",
130
+ HK: "Hong Kong",
131
+ HU: "Hungary",
132
+ IS: "Iceland",
133
+ IN: "India",
134
+ ID: "Indonesia",
135
+ IR: "Iran (Islamic Republic of)",
136
+ IQ: "Iraq",
137
+ IE: "Ireland",
138
+ IM: "Isle of Man",
139
+ IL: "Israel",
140
+ IT: "Italy",
141
+ JM: "Jamaica",
142
+ JP: "Japan",
143
+ JE: "Jersey",
144
+ JO: "Jordan",
145
+ KZ: "Kazakhstan",
146
+ KE: "Kenya",
147
+ KI: "Kiribati",
148
+ KP: "Korea (Democratic People's Republic of)",
149
+ KR: "Korea (Republic of)",
150
+ KW: "Kuwait",
151
+ KG: "Kyrgyzstan",
152
+ LA: "Lao People's Democratic Republic",
153
+ LV: "Latvia",
154
+ LB: "Lebanon",
155
+ LS: "Lesotho",
156
+ LR: "Liberia",
157
+ LY: "Libya",
158
+ LI: "Liechtenstein",
159
+ LT: "Lithuania",
160
+ LU: "Luxembourg",
161
+ MO: "Macao",
162
+ MG: "Madagascar",
163
+ MW: "Malawi",
164
+ MY: "Malaysia",
165
+ MV: "Maldives",
166
+ ML: "Mali",
167
+ MT: "Malta",
168
+ MH: "Marshall Islands",
169
+ MQ: "Martinique",
170
+ MR: "Mauritania",
171
+ MU: "Mauritius",
172
+ YT: "Mayotte",
173
+ MX: "Mexico",
174
+ FM: "Micronesia (Federated States of)",
175
+ MD: "Moldova, Republic of",
176
+ MC: "Monaco",
177
+ MN: "Mongolia",
178
+ ME: "Montenegro",
179
+ MS: "Montserrat",
180
+ MA: "Morocco",
181
+ MZ: "Mozambique",
182
+ MM: "Myanmar",
183
+ NA: "Namibia",
184
+ NR: "Nauru",
185
+ NP: "Nepal",
186
+ NL: "Netherlands, Kingdom of the",
187
+ NC: "New Caledonia",
188
+ NZ: "New Zealand",
189
+ NI: "Nicaragua",
190
+ NE: "Niger",
191
+ NG: "Nigeria",
192
+ NU: "Niue",
193
+ NF: "Norfolk Island",
194
+ MK: "North Macedonia",
195
+ MP: "Northern Mariana Islands",
196
+ NO: "Norway",
197
+ OM: "Oman",
198
+ PK: "Pakistan",
199
+ PW: "Palau",
200
+ PS: "Palestine, State of",
201
+ PA: "Panama",
202
+ PG: "Papua New Guinea",
203
+ PY: "Paraguay",
204
+ PE: "Peru",
205
+ PH: "Philippines",
206
+ PN: "Pitcairn",
207
+ PL: "Poland",
208
+ PT: "Portugal",
209
+ PR: "Puerto Rico",
210
+ QA: "Qatar",
211
+ RE: "Réunion",
212
+ RO: "Romania",
213
+ RU: "Russian Federation",
214
+ RW: "Rwanda",
215
+ BL: "Saint Barthélemy",
216
+ SH: "Saint Helena, Ascension Island, Tristan da Cunha",
217
+ KN: "Saint Kitts and Nevis",
218
+ LC: "Saint Lucia",
219
+ MF: "Saint Martin (French part)",
220
+ PM: "Saint Pierre and Miquelon",
221
+ VC: "Saint Vincent and the Grenadines",
222
+ WS: "Samoa",
223
+ SM: "San Marino",
224
+ ST: "Sao Tome and Principe",
225
+ SA: "Saudi Arabia",
226
+ SN: "Senegal",
227
+ RS: "Serbia",
228
+ SC: "Seychelles",
229
+ SL: "Sierra Leone",
230
+ SG: "Singapore",
231
+ SX: "Sint Maarten (Dutch part)",
232
+ SK: "Slovakia",
233
+ SI: "Slovenia",
234
+ SB: "Solomon Islands",
235
+ SO: "Somalia",
236
+ ZA: "South Africa",
237
+ GS: "South Georgia and the South Sandwich Islands",
238
+ SS: "South Sudan",
239
+ ES: "Spain",
240
+ LK: "Sri Lanka",
241
+ SD: "Sudan",
242
+ SR: "Suriname",
243
+ SJ: "Svalbard and Jan Mayen",
244
+ SE: "Sweden",
245
+ CH: "Switzerland",
246
+ SY: "Syrian Arab Republic",
247
+ TW: "Taiwan, Province of China",
248
+ TJ: "Tajikistan",
249
+ TZ: "Tanzania, United Republic of",
250
+ TH: "Thailand",
251
+ TL: "Timor-Leste",
252
+ TG: "Togo",
253
+ TK: "Tokelau",
254
+ TO: "Tonga",
255
+ TT: "Trinidad and Tobago",
256
+ TN: "Tunisia",
257
+ TR: "Türkiye",
258
+ TM: "Turkmenistan",
259
+ TC: "Turks and Caicos Islands",
260
+ TV: "Tuvalu",
261
+ UG: "Uganda",
262
+ UA: "Ukraine",
263
+ AE: "United Arab Emirates",
264
+ GB: "United Kingdom of Great Britain and Northern Ireland",
265
+ UM: "United States Minor Outlying Islands",
266
+ US: "United States of America",
267
+ UY: "Uruguay",
268
+ UZ: "Uzbekistan",
269
+ VU: "Vanuatu",
270
+ VE: "Venezuela (Bolivarian Republic of)",
271
+ VN: "Viet Nam",
272
+ VG: "Virgin Islands (British)",
273
+ VI: "Virgin Islands (U.S)",
274
+ WF: "Wallis and Futuna",
275
+ EH: "Western Sahara",
276
+ YE: "Yemen",
277
+ ZM: "Zambia",
278
+ ZW: "Zimbabwe",
279
+ };
280
+ /** Options for MultiSelect component */
281
+ export const COUNTRY_OPTIONS = Object.entries(ALL_COUNTRIES).map((v) => {
282
+ return {
283
+ label: (_jsxs(_Fragment, { children: [getCountryFlag(v[0]), " ", v[1]] })),
284
+ id: v[0],
285
+ };
286
+ });
@@ -0,0 +1,17 @@
1
+ import { PopoverProps as AriaPopoverProps, SelectProps as AriaSelectProps, SelectValueProps as AriaSelectValueProps } from "react-aria-components";
2
+ import { type FormFieldProps } from "lib/components/inputs/field";
3
+ import type { SelectOption } from "lib/components/inputs/select-options";
4
+ import { ListBoxHeader, ListBoxItem } from "../ui/list-box";
5
+ export declare const SelectItem: typeof ListBoxItem;
6
+ export declare const SelectHeader: typeof ListBoxHeader;
7
+ export declare const SelectCollection: typeof import("react-aria-components").Collection;
8
+ export declare const SelectValue: <T extends object>({ className, ...props }: AriaSelectValueProps<T>) => import("react/jsx-runtime").JSX.Element;
9
+ export declare function SelectPopover({ className, ...props }: AriaPopoverProps): import("react/jsx-runtime").JSX.Element;
10
+ export interface SingleSelectProps<T extends SelectOption> extends Omit<AriaSelectProps<T>, "children">, FormFieldProps {
11
+ items: Iterable<T>;
12
+ children: React.ReactNode | ((item: T) => React.ReactNode);
13
+ }
14
+ export declare function SingleSelect<T extends SelectOption>({ label, description, errorMessage, children, className, items, ...props }: SingleSelectProps<T>): import("react/jsx-runtime").JSX.Element;
15
+ type TfSingleSelectProps<T extends SelectOption> = Omit<SingleSelectProps<T>, "value" | "setValue" | 'children'>;
16
+ export declare function TfSingleSelect<T extends SelectOption>({ ...props }: TfSingleSelectProps<T>): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ListBox as AriaListBox, Select as AriaSelect, SelectValue as AriaSelectValue, composeRenderProps } from "react-aria-components";
4
+ import { FormField } from "lib/components/inputs/field";
5
+ import { Button } from "lib/components/ui/button";
6
+ import { useFieldContext } from "lib/utils/form-context";
7
+ import { getFieldErrorMessage } from "lib/utils/form-hook";
8
+ import { cn } from "lib/utils/primitives";
9
+ import { ChevronDown } from "lucide-react";
10
+ import { ListBoxCollection, ListBoxHeader, ListBoxItem, } from "../ui/list-box";
11
+ import { Popover } from "../ui/popover";
12
+ const ASelect = AriaSelect;
13
+ export const SelectItem = ListBoxItem;
14
+ export const SelectHeader = ListBoxHeader;
15
+ export const SelectCollection = ListBoxCollection;
16
+ export const SelectValue = ({ className, ...props }) => (_jsx(AriaSelectValue, { className: composeRenderProps(className, (className) => cn("line-clamp-1 data-[placeholder]:text-muted-foreground",
17
+ /* Description */
18
+ "[&>[slot=description]]:hidden", className)), ...props }));
19
+ function SelectTrigger({ className, children, ...props }) {
20
+ return (_jsx(Button, { ...props, children: composeRenderProps(children, (children) => (_jsxs(_Fragment, { children: [children, _jsx(ChevronDown, { "aria-hidden": "true", className: "size-icon opacity-50" })] }))) }));
21
+ }
22
+ export function SelectPopover({ className, ...props }) {
23
+ return (_jsx(Popover, { className: composeRenderProps(className, (className) => cn("w-auto min-w-[--trigger-width]", className)), ...props }));
24
+ }
25
+ function SelectListBox({ className, ...props }) {
26
+ return (_jsx(AriaListBox, { className: composeRenderProps(className, (className) => cn("overflow-auto p-1 outline-none [clip-path:inset(0_0_0_0_round_calc(var(--radius)-2px))]", className)), ...props }));
27
+ }
28
+ export function SingleSelect({ label, description, errorMessage, children, className, items, ...props }) {
29
+ return (_jsx(ASelect, { className: composeRenderProps(className, (className) => cn("group form-field", className)), ...props, children: _jsxs(FormField, { label: label, description: description, errorMessage: errorMessage, children: [_jsx(SelectTrigger, { children: _jsx(SelectValue, {}) }), _jsx(SelectPopover, { children: _jsx(SelectListBox, { items: items, children: children }) })] }) }));
30
+ }
31
+ export function TfSingleSelect({ ...props }) {
32
+ const field = useFieldContext();
33
+ return (_jsx(SingleSelect, { selectedKey: field.state.value, onSelectionChange: (e) => field.handleChange(e.toString()), onBlur: field.handleBlur, errorMessage: getFieldErrorMessage(field), ...props, children: (item) => _jsx(SelectItem, { id: item.id, children: item.label }, item.id) }));
34
+ }
@@ -0,0 +1,7 @@
1
+ import { TextFieldProps as AriaTextFieldProps } from "react-aria-components";
2
+ import { type FormFieldProps } from "./field";
3
+ export interface TextFieldProps extends AriaTextFieldProps, FormFieldProps {
4
+ textArea?: boolean;
5
+ }
6
+ export declare function TextField({ label, description, errorMessage, textArea, className, ...props }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function TfTextField({ isDisabled, ...props }: React.ComponentProps<typeof TextField>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Input as AriaInput, TextArea as AriaTextArea, TextField as AriaTextField, composeRenderProps } from "react-aria-components";
3
+ import { useFieldContext } from "lib/utils/form-context";
4
+ import { getFieldErrorMessage } from "lib/utils/form-hook";
5
+ import { cn } from "lib/utils/primitives";
6
+ import { FormField } from "./field";
7
+ const ATextField = AriaTextField;
8
+ function Input({ className, ...props }) {
9
+ return (_jsx(AriaInput, { className: composeRenderProps(className, (className) => cn("flex input-dim w-full border border-input bg-card ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground",
10
+ /* Disabled */
11
+ "disabled-muted",
12
+ /* Focused */
13
+ "focus-ring", className)), ...props }));
14
+ }
15
+ function TextArea({ className, ...props }) {
16
+ return (_jsx(AriaTextArea, { className: composeRenderProps(className, (className) => cn("flex min-h-32 w-full border border-input bg-card px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground",
17
+ /* Focused */
18
+ "focus-ring",
19
+ /* Disabled */
20
+ "disabled-muted", className)), ...props }));
21
+ }
22
+ export function TextField({ label, description, errorMessage, textArea, className, ...props }) {
23
+ return (_jsx(ATextField, { className: composeRenderProps(className, (className) => cn("group form-field", className)), ...props, children: _jsx(FormField, { label: label, errorMessage: errorMessage, description: description, children: textArea ? _jsx(TextArea, {}) : _jsx(Input, {}) }) }));
24
+ }
25
+ export function TfTextField({ isDisabled, ...props }) {
26
+ const field = useFieldContext();
27
+ return (_jsx(TextField, { isDisabled: isDisabled || field.form.state.isSubmitting, value: field.state.value, id: field.name, name: field.name, onBlur: field.handleBlur, onChange: field.handleChange, errorMessage: getFieldErrorMessage(field), ...props }));
28
+ }
@@ -0,0 +1,17 @@
1
+ type NestedKeyOf<T> = T extends object ? {
2
+ [K in keyof T]: K extends string | number ? `${K & string}` | `${K & string}.${NestedKeyOf<T[K]>}` : never;
3
+ }[keyof T] : never;
4
+ export type DisplayField<T> = {
5
+ display: string;
6
+ accessor: NestedKeyOf<T>;
7
+ type?: "text" | "badge" | "boolean" | "date" | "yesno" | "copyButton" | "link";
8
+ transform?: (value: any) => React.ReactNode;
9
+ };
10
+ export interface KeyValueCardProps<T> {
11
+ data: T;
12
+ label: string;
13
+ fields: DisplayField<T>[];
14
+ className?: string;
15
+ }
16
+ export declare const KeyValueCard: <T extends {}>({ data, label, fields, }: KeyValueCardProps<T>) => import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { formatDate } from "lib/components/data-table/table-commons";
3
+ import { Badge } from "lib/components/ui/badge";
4
+ import { Card, CardContent, CardHeader, CardTitle } from "lib/components/ui/card";
5
+ import { Skeleton } from "lib/components/ui/skeleton";
6
+ export const KeyValueCard = ({ data, label, fields, }) => {
7
+ const renderValue = (field, value) => {
8
+ if (field.transform) {
9
+ return field.transform(value);
10
+ }
11
+ if (value === undefined || value === null) {
12
+ return "-";
13
+ }
14
+ switch (field.type) {
15
+ case "date":
16
+ return _jsx("span", { children: formatDate(value) });
17
+ case "yesno":
18
+ return _jsx("span", { children: value ? "Yes" : "No" });
19
+ case "badge":
20
+ return (_jsx("div", { className: "flex flex-wrap gap-1", children: Array.isArray(value)
21
+ ? value.map((item, index) => (_jsx(Badge, { children: typeof item === "object" ? item?.name || item?.id : item }, index)))
22
+ : value }));
23
+ case "boolean":
24
+ return _jsx("span", { children: value.toString() });
25
+ default:
26
+ return _jsx("span", { children: value });
27
+ }
28
+ };
29
+ return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: label }) }), _jsx(CardContent, { children: _jsx("div", { className: "flex flex-col gap-2", children: data
30
+ ? fields.map((field) => {
31
+ // TODO: improve this
32
+ const value = field.accessor
33
+ ? field.accessor
34
+ .split(".")
35
+ .reduce((obj, key) => obj && key in obj ? obj[key] : undefined, data)
36
+ : null;
37
+ return (_jsxs("div", { className: "flex w-full flex-col md:flex-row justify-between first:pt-0 last:pb-0", children: [_jsx("p", { className: "text-sm flex w-full justify-start col-span-1", children: field.display }), _jsx("div", { className: "text-sm flex w-full justify-start text-wrap break-all", children: renderValue(field, value) })] }, field.display));
38
+ })
39
+ : fields.map((_, index) => (_jsx(Skeleton, { className: "h-12 w-full" }, index))) }) })] }));
40
+ };
@@ -0,0 +1,8 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import { type LucideIcon } from "lucide-react";
3
+ export declare const alertVariants: (props?: ({
4
+ variant?: "destructive" | "success" | "muted" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export declare function Alert({ children, className, variant, icon: Icon, ...props }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants> & {
7
+ icon?: LucideIcon;
8
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { cn } from "lib/utils/primitives";
4
+ export const alertVariants = cva(`transition-colors border border-dotted p-2 text-foreground text-sm inline-flex items-start gap-2`, {
5
+ variants: {
6
+ variant: {
7
+ destructive: "bg-destructive-foreground/20 text-destructive border-destructive",
8
+ success: "bg-success-foreground/20 text-success border-success",
9
+ muted: "bg-muted-foreground/20 text-muted border-muted",
10
+ },
11
+ },
12
+ defaultVariants: {
13
+ variant: "muted",
14
+ },
15
+ });
16
+ export function Alert({ children, className, variant, icon: Icon, ...props }) {
17
+ return (_jsxs("div", { role: "alert", className: cn(alertVariants({ variant }), className), ...props, children: [Icon && _jsx(Icon, { className: "size-icon mt-1" }), _jsx("span", { className: "w-full", children: children })] }));
18
+ }
@@ -0,0 +1,8 @@
1
+ import type * as React from "react";
2
+ interface InitialString {
3
+ initials: string[2];
4
+ }
5
+ export interface AvatarProps extends Omit<React.ComponentProps<"div">, "children">, InitialString {
6
+ }
7
+ export declare function Avatar({ className, initials, ...props }: AvatarProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "lib/utils/primitives";
3
+ export function Avatar({ className, initials, ...props }) {
4
+ return (_jsx("div", { className: cn("relative text-xs font-mono font-bold flex items-center leading-none justify-center bg-accent text-accent-foreground select-none size-input shrink-0 overflow-hidden rounded-full", className), ...props, children: initials }));
5
+ }
@@ -0,0 +1,2 @@
1
+ import type * as React from "react";
2
+ export declare function Badge({ className, children, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "lib/utils/primitives";
3
+ export function Badge({ className, children, ...props }) {
4
+ return (_jsx("span", { className: cn("text-muted leading-none text-sm px-1 inline-flex items-center justify-center select-none bg-card border h-input focus:outline-hidden focus:ring-1 focus:ring-ring", className), ...props, children: _jsx("span", { children: children }) }));
5
+ }
@@ -0,0 +1,10 @@
1
+ import { BreadcrumbProps as AriaBreadcrumbProps, BreadcrumbsProps as AriaBreadcrumbsProps, LinkProps as AriaLinkProps } from "react-aria-components";
2
+ export declare function Breadcrumbs<T extends object>({ className, ...props }: AriaBreadcrumbsProps<T>): import("react/jsx-runtime").JSX.Element;
3
+ export declare function BreadcrumbItem({ className, ...props }: AriaBreadcrumbProps): import("react/jsx-runtime").JSX.Element;
4
+ export declare function BreadcrumbLink({ className, ...props }: AriaLinkProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
6
+ export declare function BreadcrumbEllipsis({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
7
+ interface BreadcrumbPageProps extends Omit<AriaLinkProps, "href"> {
8
+ }
9
+ export declare function BreadcrumbPage({ className, ...props }: BreadcrumbPageProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Breadcrumb as AriaBreadcrumb, Breadcrumbs as AriaBreadcrumbs, Link as AriaLink, composeRenderProps, } from "react-aria-components";
3
+ import { cn } from "lib/utils/primitives";
4
+ import { ChevronRight, DotSquare } from "lucide-react";
5
+ export function Breadcrumbs({ className, ...props }) {
6
+ return (_jsx(AriaBreadcrumbs, { className: cn("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5", className), ...props }));
7
+ }
8
+ export function BreadcrumbItem({ className, ...props }) {
9
+ return (_jsx(AriaBreadcrumb, { className: cn("inline-flex items-center gap-1.5 sm:gap-2.5", className), ...props }));
10
+ }
11
+ export function BreadcrumbLink({ className, ...props }) {
12
+ return (_jsx(AriaLink, { className: composeRenderProps(className, (className) => cn("transition-colors",
13
+ /* Hover */
14
+ "data-[hovered]:text-foreground",
15
+ /* Disabled */
16
+ "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
17
+ /* Current */
18
+ "data-[current]:pointer-events-auto data-[current]:opacity-100", className)), ...props }));
19
+ }
20
+ export function BreadcrumbSeparator({ children, className, ...props }) {
21
+ return (_jsx("span", { role: "presentation", "aria-hidden": "true", className: cn("[&>svg]:size-3.5", className), ...props, children: children || _jsx(ChevronRight, {}) }));
22
+ }
23
+ export function BreadcrumbEllipsis({ className, ...props }) {
24
+ return (_jsxs("span", { role: "presentation", "aria-hidden": "true", className: cn("flex size-9 items-center justify-center", className), ...props, children: [_jsx(DotSquare, { className: "size-4" }), _jsx("span", { className: "sr-only", children: "More" })] }));
25
+ }
26
+ export function BreadcrumbPage({ className, ...props }) {
27
+ return (_jsx(AriaLink, { className: composeRenderProps(className, (className) => cn("font-normal text-foreground", className)), ...props }));
28
+ }
@@ -0,0 +1,11 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import { type ButtonProps as AriaButtonProps } from "react-aria-components";
3
+ export declare const buttonVariants: (props?: ({
4
+ variant?: "link" | "ghost" | "primary" | "secondary" | "destructive" | "neutral" | null | undefined;
5
+ size?: "default" | "none" | "icon" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export type ButtonProps = AriaButtonProps & VariantProps<typeof buttonVariants> & {
8
+ ref?: React.Ref<HTMLButtonElement>;
9
+ active?: boolean;
10
+ };
11
+ export declare function Button({ className: additionalClasses, variant, size, children, isPending, active, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { cva } from "class-variance-authority";
4
+ import { cn } from "lib/utils/primitives";
5
+ import { Button as AriaButton, composeRenderProps, } from "react-aria-components";
6
+ import { Loader } from "./loader";
7
+ export const buttonVariants = cva("btn inline-flex gap-1 text-ellipsis overflow-hidden items-center justify-center font-medium transition-colors", {
8
+ variants: {
9
+ variant: {
10
+ primary: "btn-primary",
11
+ secondary: "btn-secondary",
12
+ destructive: "btn-destructive",
13
+ neutral: "btn-neutral",
14
+ ghost: "btn-ghost",
15
+ link: "text-primary underline-offset-4 hover:underline",
16
+ },
17
+ size: {
18
+ default: "input-dim",
19
+ icon: "size-input",
20
+ none: ""
21
+ },
22
+ },
23
+ defaultVariants: {
24
+ variant: "neutral",
25
+ size: "default",
26
+ },
27
+ });
28
+ export function Button({ className: additionalClasses, variant, size, children, isPending, active, ...props }) {
29
+ return (_jsx(AriaButton, { ...props, className: composeRenderProps(additionalClasses, (className) => cn(buttonVariants({
30
+ variant,
31
+ size,
32
+ className,
33
+ }), additionalClasses)), children: composeRenderProps(children, (children) => (_jsxs(_Fragment, { children: [isPending && _jsx(Loader, {}), !isPending && _jsx(_Fragment, { children: children })] }))) }));
34
+ }
@@ -0,0 +1,17 @@
1
+ import * as React from "react";
2
+ import { CalendarCellProps as AriaCalendarCellProps, CalendarGridBodyProps as AriaCalendarGridBodyProps, CalendarGridProps as AriaCalendarGridProps, CalendarHeaderCellProps as AriaCalendarHeaderCellProps, CalendarProps as AriaCalendarProps, DateValue as AriaDateValue, RangeCalendarProps as AriaRangeCalendarProps } from "react-aria-components";
3
+ export declare function CalendarHeading(props: React.HTMLAttributes<HTMLElement>): import("react/jsx-runtime").JSX.Element;
4
+ export declare function CalendarGrid({ className, ...props }: AriaCalendarGridProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare const CalendarGridHeader: (props: import("react-aria-components").CalendarGridHeaderProps & React.RefAttributes<HTMLTableSectionElement>) => React.ReactElement | null;
6
+ export declare function CalendarHeaderCell({ className, ...props }: AriaCalendarHeaderCellProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function CalendarGridBody({ className, ...props }: AriaCalendarGridBodyProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function CalendarCell({ className, ...props }: AriaCalendarCellProps): import("react/jsx-runtime").JSX.Element;
9
+ interface CalendarProps<T extends AriaDateValue> extends AriaCalendarProps<T> {
10
+ errorMessage?: string;
11
+ }
12
+ export declare function Calendar<T extends AriaDateValue>({ errorMessage, className, ...props }: CalendarProps<T>): import("react/jsx-runtime").JSX.Element;
13
+ interface RangeCalendarProps<T extends AriaDateValue> extends AriaRangeCalendarProps<T> {
14
+ errorMessage?: string;
15
+ }
16
+ export declare function RangeCalendar<T extends AriaDateValue>({ errorMessage, className, ...props }: RangeCalendarProps<T>): import("react/jsx-runtime").JSX.Element;
17
+ export {};