@fea-ui/react 0.1.0-alpha.2 → 0.1.0-alpha.4

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/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { cn, cn as cn$1, tv } from "tailwind-variants";
2
- import { Accordion, Avatar, Button, Checkbox, CheckboxGroup, Dialog, Field, Input, Menu, Meter, Separator, Switch, Tabs, Toggle } from "@base-ui/react";
3
- import { LucideCheck, LucideMenu, LucidePlus, LucideX } from "lucide-react";
2
+ import { Accordion, AlertDialog, Avatar, Button, Checkbox, CheckboxGroup, Dialog, Field, Fieldset, Input, Menu, Meter, Progress, Separator, Slider, Switch, Tabs, Toggle } from "@base-ui/react";
3
+ import { LucideCheck, LucideChevronDown, LucideMenu, LucideX } from "lucide-react";
4
4
  import React, { createContext, useCallback, useContext, useMemo, useState } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
 
@@ -62,7 +62,7 @@ const AccordionTrigger = ({ className, ...props }) => {
62
62
  };
63
63
  const AccordionTriggerIcon = ({ className, ...props }) => {
64
64
  const { slots } = useAccordion();
65
- return /* @__PURE__ */ jsx(LucidePlus, {
65
+ return /* @__PURE__ */ jsx(LucideChevronDown, {
66
66
  className: cn$1(className, slots.triggerIcon()),
67
67
  ...props
68
68
  });
@@ -90,6 +90,108 @@ Accordion$1.Trigger = AccordionTrigger;
90
90
  Accordion$1.TriggerIcon = AccordionTriggerIcon;
91
91
  var accordion_default = Accordion$1;
92
92
 
93
+ //#endregion
94
+ //#region src/components/alert-dialog/alert-dialog.context.ts
95
+ const AlertDialogContext = createContext(null);
96
+
97
+ //#endregion
98
+ //#region src/components/alert-dialog/alert-dialog.variants.ts
99
+ const alertDialogVariants = tv({ slots: {
100
+ backdrop: "alert-dialog__backdrop",
101
+ close: "alert-dialog__close",
102
+ description: "alert-dialog__description",
103
+ popup: "alert-dialog__popup",
104
+ portal: "alert-dialog__portal",
105
+ root: "alert-dialog",
106
+ title: "alert-dialog__title",
107
+ trigger: "alert-dialog__trigger",
108
+ viewport: "alert-dialog__viewport"
109
+ } });
110
+
111
+ //#endregion
112
+ //#region src/components/alert-dialog/use-alert-dialog.ts
113
+ const useAlertDialog = () => {
114
+ const context = useContext(AlertDialogContext);
115
+ if (!context) throw new Error("useAlertDialog must be used within a AlertDialogProvider");
116
+ return context;
117
+ };
118
+
119
+ //#endregion
120
+ //#region src/components/alert-dialog/alert-dialog.tsx
121
+ const AlertDialog$1 = ({ ...props }) => {
122
+ return /* @__PURE__ */ jsx(AlertDialogContext, {
123
+ value: { slots: useMemo(() => alertDialogVariants(), []) },
124
+ children: /* @__PURE__ */ jsx(AlertDialog.Root, { ...props })
125
+ });
126
+ };
127
+ const AlertDialogTrigger = ({ className, ...props }) => {
128
+ const { slots } = useAlertDialog();
129
+ return /* @__PURE__ */ jsx(AlertDialog.Trigger, {
130
+ className: cn$1(slots.trigger(), className),
131
+ ...props
132
+ });
133
+ };
134
+ const AlertDialogPortal = ({ className, ...props }) => {
135
+ const { slots } = useAlertDialog();
136
+ return /* @__PURE__ */ jsx(AlertDialog.Portal, {
137
+ className: cn$1(slots.portal(), className),
138
+ ...props
139
+ });
140
+ };
141
+ const AlertDialogBackdrop = ({ className, ...props }) => {
142
+ const { slots } = useAlertDialog();
143
+ return /* @__PURE__ */ jsx(AlertDialog.Backdrop, {
144
+ className: cn$1(slots.backdrop(), className),
145
+ ...props
146
+ });
147
+ };
148
+ const AlertDialogViewport = ({ className, ...props }) => {
149
+ const { slots } = useAlertDialog();
150
+ return /* @__PURE__ */ jsx(AlertDialog.Viewport, {
151
+ className: cn$1(slots.viewport(), className),
152
+ ...props
153
+ });
154
+ };
155
+ const AlertDialogPopup = ({ className, ...props }) => {
156
+ const { slots } = useAlertDialog();
157
+ return /* @__PURE__ */ jsx(AlertDialog.Popup, {
158
+ className: cn$1(slots.popup(), className),
159
+ ...props
160
+ });
161
+ };
162
+ const AlertDialogTitle = ({ className, ...props }) => {
163
+ const { slots } = useAlertDialog();
164
+ return /* @__PURE__ */ jsx(AlertDialog.Title, {
165
+ className: cn$1(slots.title(), className),
166
+ ...props
167
+ });
168
+ };
169
+ const AlertDialogDescription = ({ className, ...props }) => {
170
+ const { slots } = useAlertDialog();
171
+ return /* @__PURE__ */ jsx(AlertDialog.Description, {
172
+ className: cn$1(slots.description(), className),
173
+ ...props
174
+ });
175
+ };
176
+ const AlertDialogClose = ({ className, children, ...props }) => {
177
+ const { slots } = useAlertDialog();
178
+ return /* @__PURE__ */ jsx(AlertDialog.Close, {
179
+ className: cn$1(slots.close(), className),
180
+ ...props,
181
+ children: children ?? /* @__PURE__ */ jsx(LucideX, {})
182
+ });
183
+ };
184
+ AlertDialog$1.Root = AlertDialog$1;
185
+ AlertDialog$1.Trigger = AlertDialogTrigger;
186
+ AlertDialog$1.Portal = AlertDialogPortal;
187
+ AlertDialog$1.Backdrop = AlertDialogBackdrop;
188
+ AlertDialog$1.Viewport = AlertDialogViewport;
189
+ AlertDialog$1.Popup = AlertDialogPopup;
190
+ AlertDialog$1.Title = AlertDialogTitle;
191
+ AlertDialog$1.Description = AlertDialogDescription;
192
+ AlertDialog$1.Close = AlertDialogClose;
193
+ var alert_dialog_default = AlertDialog$1;
194
+
93
195
  //#endregion
94
196
  //#region src/components/avatar/avatar.context.ts
95
197
  const AvatarContext = createContext(null);
@@ -580,6 +682,48 @@ Field$1.Label = FieldLabel;
580
682
  Field$1.Root = Field$1;
581
683
  var field_default = Field$1;
582
684
 
685
+ //#endregion
686
+ //#region src/components/fieldset/fieldset.context.ts
687
+ const FieldsetContext = createContext(null);
688
+
689
+ //#endregion
690
+ //#region src/components/fieldset/fieldset.variants.ts
691
+ const fieldsetVariants = tv({ slots: {
692
+ legend: "fieldset__legend",
693
+ root: "fieldset"
694
+ } });
695
+
696
+ //#endregion
697
+ //#region src/components/fieldset/use-fieldset.ts
698
+ const useFieldset = () => {
699
+ const context = useContext(FieldsetContext);
700
+ if (!context) throw new Error("useFieldset must be used within a FieldsetProvider");
701
+ return context;
702
+ };
703
+
704
+ //#endregion
705
+ //#region src/components/fieldset/fieldset.tsx
706
+ const Fieldset$1 = ({ className, ...props }) => {
707
+ const slots = useMemo(() => fieldsetVariants(), []);
708
+ return /* @__PURE__ */ jsx(FieldsetContext, {
709
+ value: { slots },
710
+ children: /* @__PURE__ */ jsx(Fieldset.Root, {
711
+ className: cn$1(className, slots.root()),
712
+ ...props
713
+ })
714
+ });
715
+ };
716
+ const FieldsetLegend = ({ className, ...props }) => {
717
+ const { slots } = useFieldset();
718
+ return /* @__PURE__ */ jsx(Fieldset.Legend, {
719
+ className: cn$1(slots.legend(), className),
720
+ ...props
721
+ });
722
+ };
723
+ Fieldset$1.Root = Fieldset$1;
724
+ Fieldset$1.Legend = FieldsetLegend;
725
+ var fieldset_default = Fieldset$1;
726
+
583
727
  //#endregion
584
728
  //#region src/components/form/form.variants.ts
585
729
  const formVariants = tv({ base: "form" });
@@ -1050,6 +1194,75 @@ Navbar.Menu = NavbarMenu;
1050
1194
  Navbar.MenuItem = NavbarMenuItem;
1051
1195
  var navbar_default = Navbar;
1052
1196
 
1197
+ //#endregion
1198
+ //#region src/components/progress/progress.context.ts
1199
+ const ProgressContext = createContext(null);
1200
+
1201
+ //#endregion
1202
+ //#region src/components/progress/progress.variants.ts
1203
+ const progressVariants = tv({ slots: {
1204
+ indicator: "progress__indicator",
1205
+ label: "progress__label",
1206
+ root: "progress",
1207
+ track: "progress__track",
1208
+ value: "progress__value"
1209
+ } });
1210
+
1211
+ //#endregion
1212
+ //#region src/components/progress/use-progress.ts
1213
+ const useProgress = () => {
1214
+ const context = useContext(ProgressContext);
1215
+ if (!context) throw new Error("useProgress must be used within a ProgressProvider");
1216
+ return context;
1217
+ };
1218
+
1219
+ //#endregion
1220
+ //#region src/components/progress/progress.tsx
1221
+ const Progress$1 = ({ className, ...props }) => {
1222
+ const slots = useMemo(() => progressVariants(), []);
1223
+ return /* @__PURE__ */ jsx(ProgressContext, {
1224
+ value: { slots },
1225
+ children: /* @__PURE__ */ jsx(Progress.Root, {
1226
+ className: cn$1(className, slots.root()),
1227
+ ...props
1228
+ })
1229
+ });
1230
+ };
1231
+ const ProgressLabel = ({ className, ...props }) => {
1232
+ const { slots } = useProgress();
1233
+ return /* @__PURE__ */ jsx(Progress.Label, {
1234
+ className: cn$1(className, slots.label()),
1235
+ ...props
1236
+ });
1237
+ };
1238
+ const ProgressValue = ({ className, ...props }) => {
1239
+ const { slots } = useProgress();
1240
+ return /* @__PURE__ */ jsx(Progress.Value, {
1241
+ className: cn$1(className, slots.value()),
1242
+ ...props
1243
+ });
1244
+ };
1245
+ const ProgressTrack = ({ className, ...props }) => {
1246
+ const { slots } = useProgress();
1247
+ return /* @__PURE__ */ jsx(Progress.Track, {
1248
+ className: cn$1(className, slots.track()),
1249
+ ...props
1250
+ });
1251
+ };
1252
+ const ProgressIndicator = ({ className, ...props }) => {
1253
+ const { slots } = useProgress();
1254
+ return /* @__PURE__ */ jsx(Progress.Indicator, {
1255
+ className: cn$1(className, slots.indicator()),
1256
+ ...props
1257
+ });
1258
+ };
1259
+ Progress$1.Label = ProgressLabel;
1260
+ Progress$1.Value = ProgressValue;
1261
+ Progress$1.Track = ProgressTrack;
1262
+ Progress$1.Indicator = ProgressIndicator;
1263
+ Progress$1.Root = Progress$1;
1264
+ var progress_default = Progress$1;
1265
+
1053
1266
  //#endregion
1054
1267
  //#region src/components/separator/separator.variants.ts
1055
1268
  const separatorVariants = tv({
@@ -1071,6 +1284,84 @@ const Separator$1 = ({ className, orientation, ...props }) => {
1071
1284
  };
1072
1285
  var separator_default = Separator$1;
1073
1286
 
1287
+ //#endregion
1288
+ //#region src/components/slider/slider.context.ts
1289
+ const SliderContext = createContext(null);
1290
+
1291
+ //#endregion
1292
+ //#region src/components/slider/slider.variants.ts
1293
+ const sliderVariants = tv({ slots: {
1294
+ control: "slider__control",
1295
+ indicator: "slider__indicator",
1296
+ root: "slider",
1297
+ thumb: "slider__thumb",
1298
+ track: "slider__track",
1299
+ value: "slider__value"
1300
+ } });
1301
+
1302
+ //#endregion
1303
+ //#region src/components/slider/use-slider.tsx
1304
+ const useSlider = () => {
1305
+ const context = useContext(SliderContext);
1306
+ if (!context) throw new Error("useSlider must be used within a SliderProvider");
1307
+ return context;
1308
+ };
1309
+
1310
+ //#endregion
1311
+ //#region src/components/slider/slider.tsx
1312
+ const Slider$1 = ({ className, ...props }) => {
1313
+ const slots = useMemo(() => sliderVariants(), []);
1314
+ return /* @__PURE__ */ jsx(SliderContext, {
1315
+ value: { slots },
1316
+ children: /* @__PURE__ */ jsx(Slider.Root, {
1317
+ className: cn$1(className, slots.root()),
1318
+ ...props
1319
+ })
1320
+ });
1321
+ };
1322
+ const SliderValue = ({ className, ...props }) => {
1323
+ const { slots } = useSlider();
1324
+ return /* @__PURE__ */ jsx(Slider.Value, {
1325
+ className: cn$1(className, slots.value()),
1326
+ ...props
1327
+ });
1328
+ };
1329
+ const SliderControl = ({ className, ...props }) => {
1330
+ const { slots } = useSlider();
1331
+ return /* @__PURE__ */ jsx(Slider.Control, {
1332
+ className: cn$1(className, slots.control()),
1333
+ ...props
1334
+ });
1335
+ };
1336
+ const SliderTrack = ({ className, ...props }) => {
1337
+ const { slots } = useSlider();
1338
+ return /* @__PURE__ */ jsx(Slider.Track, {
1339
+ className: cn$1(className, slots.track()),
1340
+ ...props
1341
+ });
1342
+ };
1343
+ const SliderIndicator = ({ className, ...props }) => {
1344
+ const { slots } = useSlider();
1345
+ return /* @__PURE__ */ jsx(Slider.Indicator, {
1346
+ className: cn$1(className, slots.indicator()),
1347
+ ...props
1348
+ });
1349
+ };
1350
+ const SliderThumb = ({ className, ...props }) => {
1351
+ const { slots } = useSlider();
1352
+ return /* @__PURE__ */ jsx(Slider.Thumb, {
1353
+ className: cn$1(className, slots.thumb()),
1354
+ ...props
1355
+ });
1356
+ };
1357
+ Slider$1.Value = SliderValue;
1358
+ Slider$1.Control = SliderControl;
1359
+ Slider$1.Track = SliderTrack;
1360
+ Slider$1.Indicator = SliderIndicator;
1361
+ Slider$1.Thumb = SliderThumb;
1362
+ Slider$1.Root = Slider$1;
1363
+ var slider_default = Slider$1;
1364
+
1074
1365
  //#endregion
1075
1366
  //#region src/components/switch/switch.context.ts
1076
1367
  const SwitchContext = createContext(null);
@@ -1121,6 +1412,93 @@ Switch$1.Thumb = SwitchThumb;
1121
1412
  Switch$1.Root = Switch$1;
1122
1413
  var switch_default = Switch$1;
1123
1414
 
1415
+ //#endregion
1416
+ //#region src/components/table/table.context.ts
1417
+ const TableContext = createContext(null);
1418
+
1419
+ //#endregion
1420
+ //#region src/components/table/table.variants.ts
1421
+ const tableVariants = tv({ slots: {
1422
+ root: "table",
1423
+ tbody: "table__tbody",
1424
+ td: "table__td",
1425
+ tfoot: "table__tfoot",
1426
+ th: "table__th",
1427
+ thead: "table__thead",
1428
+ tr: "table__tr"
1429
+ } });
1430
+
1431
+ //#endregion
1432
+ //#region src/components/table/use-table.ts
1433
+ const useTable = () => {
1434
+ const context = useContext(TableContext);
1435
+ if (!context) throw new Error("useTable must be used within a TableProvider");
1436
+ return context;
1437
+ };
1438
+
1439
+ //#endregion
1440
+ //#region src/components/table/table.tsx
1441
+ const Table = ({ className, ...props }) => {
1442
+ const slots = useMemo(() => tableVariants(), []);
1443
+ return /* @__PURE__ */ jsx(TableContext, {
1444
+ value: { slots },
1445
+ children: /* @__PURE__ */ jsx("table", {
1446
+ className: cn$1(className, slots.root()),
1447
+ ...props
1448
+ })
1449
+ });
1450
+ };
1451
+ const TableHead = ({ className, ...props }) => {
1452
+ const { slots } = useTable();
1453
+ return /* @__PURE__ */ jsx("thead", {
1454
+ className: cn$1(className, slots.thead()),
1455
+ ...props
1456
+ });
1457
+ };
1458
+ const TableRow = ({ className, ...props }) => {
1459
+ const { slots } = useTable();
1460
+ return /* @__PURE__ */ jsx("tr", {
1461
+ className: cn$1(className, slots.tr()),
1462
+ ...props
1463
+ });
1464
+ };
1465
+ const TableHeaderCell = ({ className, ...props }) => {
1466
+ const { slots } = useTable();
1467
+ return /* @__PURE__ */ jsx("th", {
1468
+ className: cn$1(className, slots.th()),
1469
+ ...props
1470
+ });
1471
+ };
1472
+ const TableBody = ({ className, ...props }) => {
1473
+ const { slots } = useTable();
1474
+ return /* @__PURE__ */ jsx("tbody", {
1475
+ className: cn$1(className, slots.tbody()),
1476
+ ...props
1477
+ });
1478
+ };
1479
+ const TableDataCell = ({ className, ...props }) => {
1480
+ const { slots } = useTable();
1481
+ return /* @__PURE__ */ jsx("td", {
1482
+ className: cn$1(className, slots.td()),
1483
+ ...props
1484
+ });
1485
+ };
1486
+ const TableFooter = ({ className, ...props }) => {
1487
+ const { slots } = useTable();
1488
+ return /* @__PURE__ */ jsx("tfoot", {
1489
+ className: cn$1(className, slots.tfoot()),
1490
+ ...props
1491
+ });
1492
+ };
1493
+ Table.Root = Table;
1494
+ Table.Head = TableHead;
1495
+ Table.Row = TableRow;
1496
+ Table.HeaderCell = TableHeaderCell;
1497
+ Table.Body = TableBody;
1498
+ Table.DataCell = TableDataCell;
1499
+ Table.Footer = TableFooter;
1500
+ var table_default = Table;
1501
+
1124
1502
  //#endregion
1125
1503
  //#region src/components/tabs/tabs.context.ts
1126
1504
  const TabsContext = createContext(null);
@@ -1243,5 +1621,5 @@ const ToggleButton = ({ className, variant, size, ...props }) => {
1243
1621
  var toggle_button_default = ToggleButton;
1244
1622
 
1245
1623
  //#endregion
1246
- export { accordion_default as Accordion, avatar_default as Avatar, button_default as Button, button_group_default as ButtonGroup, card_default as Card, checkbox_default as Checkbox, checkbox_group_default as CheckboxGroup, chip_default as Chip, container_default as Container, dialog_default as Dialog, field_default as Field, form_default as Form, input_default as Input, label_default as Label, link_default as Link, list_default as List, menu_default as Menu, meter_default as Meter, navbar_default as Navbar, separator_default as Separator, switch_default as Switch, tabs_default as Tabs, text_default as Text, textarea_default as Textarea, toggle_button_default as ToggleButton, accordionVariants, avatarVariants, buttonGroupVariants, buttonVariants, cardVariants, checkboxGroupVariants, checkboxVariants, chipVariants, cn, containerVariants, dialogVariants, fieldVariants, formVariants, inputVariants, labelVariants, linkVariants, listVariants, menuVariants, meterVariants, navbarVariants, separatorVariants, switchVariants, tabsVariants, textVariants, textareaVariants, toggleButtonVariants };
1624
+ export { accordion_default as Accordion, alert_dialog_default as AlertDialog, avatar_default as Avatar, button_default as Button, button_group_default as ButtonGroup, card_default as Card, checkbox_default as Checkbox, checkbox_group_default as CheckboxGroup, chip_default as Chip, container_default as Container, dialog_default as Dialog, field_default as Field, fieldset_default as Fieldset, form_default as Form, input_default as Input, label_default as Label, link_default as Link, list_default as List, menu_default as Menu, meter_default as Meter, navbar_default as Navbar, progress_default as Progress, separator_default as Separator, slider_default as Slider, switch_default as Switch, table_default as Table, tabs_default as Tabs, text_default as Text, textarea_default as Textarea, toggle_button_default as ToggleButton, accordionVariants, alertDialogVariants, avatarVariants, buttonGroupVariants, buttonVariants, cardVariants, checkboxGroupVariants, checkboxVariants, chipVariants, cn, containerVariants, dialogVariants, fieldVariants, fieldsetVariants, formVariants, inputVariants, labelVariants, linkVariants, listVariants, menuVariants, meterVariants, navbarVariants, progressVariants, separatorVariants, sliderVariants, switchVariants, tableVariants, tabsVariants, textVariants, textareaVariants, toggleButtonVariants };
1247
1625
  //# sourceMappingURL=index.mjs.map