@fea-ui/react 0.1.0-alpha.6 → 0.1.0-alpha.8

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,5 +1,5 @@
1
1
  import { cn, cn as cn$1, tv } from "tailwind-variants";
2
- import { Accordion, AlertDialog, Avatar, Button, Checkbox, CheckboxGroup, Dialog, Field, Fieldset, Input, Menu, Meter, Progress, Separator, Slider, Switch, Tabs, Toggle } from "@base-ui/react";
2
+ import { Accordion, AlertDialog, Avatar, Button, Checkbox, CheckboxGroup, Dialog, Field, Fieldset, Input, Menu, Meter, Popover, Progress, Radio, RadioGroup, Separator, Slider, Switch, Tabs, Toggle } from "@base-ui/react";
3
3
  import { LucideCheck, LucideChevronDown, LucideMenu, LucideX } from "lucide-react";
4
4
  import React, { createContext, useCallback, useContext, useMemo, useState } from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -849,6 +849,28 @@ const Form = ({ className, ...props }) => {
849
849
  };
850
850
  var form_default = Form;
851
851
 
852
+ //#endregion
853
+ //#region src/components/icon-button/icon-button.variants.ts
854
+ const iconButtonVariants = tv({
855
+ base: "icon-button",
856
+ defaultVariants: { isIconOnly: true },
857
+ extend: buttonVariants
858
+ });
859
+
860
+ //#endregion
861
+ //#region src/components/icon-button/icon-button.tsx
862
+ const IconButton = ({ className, variant, size, isIconOnly, ...props }) => {
863
+ return /* @__PURE__ */ jsx(button_default, {
864
+ className: cn$1(className, iconButtonVariants({
865
+ isIconOnly,
866
+ size,
867
+ variant
868
+ })),
869
+ ...props
870
+ });
871
+ };
872
+ var icon_button_default = IconButton;
873
+
852
874
  //#endregion
853
875
  //#region src/components/input/input.variants.ts
854
876
  const inputVariants = tv({
@@ -1334,19 +1356,157 @@ Navbar.Menu = NavbarMenu;
1334
1356
  Navbar.MenuItem = NavbarMenuItem;
1335
1357
  var navbar_default = Navbar;
1336
1358
 
1359
+ //#endregion
1360
+ //#region src/components/popover/popover.context.ts
1361
+ const PopoverContext = createContext(null);
1362
+
1363
+ //#endregion
1364
+ //#region src/components/popover/popover.variants.ts
1365
+ const popoverVariants = tv({ slots: {
1366
+ arrow: "popover__arrow",
1367
+ backdrop: "popover__backdrop",
1368
+ close: "popover__close",
1369
+ description: "popover__description",
1370
+ popup: "popover__popup",
1371
+ portal: "popover__portal",
1372
+ positioner: "popover__positioner",
1373
+ root: "popover",
1374
+ title: "popover__title",
1375
+ trigger: "popover__trigger",
1376
+ viewport: "popover__viewport"
1377
+ } });
1378
+
1379
+ //#endregion
1380
+ //#region src/components/popover/use-popover.ts
1381
+ const usePopover = () => {
1382
+ const context = useContext(PopoverContext);
1383
+ if (!context) throw new Error("usePopover must be used within a PopoverProvider");
1384
+ return context;
1385
+ };
1386
+
1387
+ //#endregion
1388
+ //#region src/components/popover/popover.tsx
1389
+ const Popover$1 = ({ ...props }) => {
1390
+ return /* @__PURE__ */ jsx(PopoverContext, {
1391
+ value: { slots: useMemo(() => popoverVariants(), []) },
1392
+ children: /* @__PURE__ */ jsx(Popover.Root, { ...props })
1393
+ });
1394
+ };
1395
+ const PopoverTrigger = ({ className, ...props }) => {
1396
+ const { slots } = usePopover();
1397
+ return /* @__PURE__ */ jsx(Popover.Trigger, {
1398
+ className: cn$1(slots.trigger(), className),
1399
+ ...props
1400
+ });
1401
+ };
1402
+ const PopoverPortal = ({ className, ...props }) => {
1403
+ const { slots } = usePopover();
1404
+ return /* @__PURE__ */ jsx(Popover.Portal, {
1405
+ className: cn$1(slots.portal(), className),
1406
+ ...props
1407
+ });
1408
+ };
1409
+ const PopoverBackdrop = ({ className, ...props }) => {
1410
+ const { slots } = usePopover();
1411
+ return /* @__PURE__ */ jsx(Popover.Backdrop, {
1412
+ className: cn$1(slots.backdrop(), className),
1413
+ ...props
1414
+ });
1415
+ };
1416
+ const PopoverPositioner = ({ className, ...props }) => {
1417
+ const { slots } = usePopover();
1418
+ return /* @__PURE__ */ jsx(Popover.Positioner, {
1419
+ className: cn$1(slots.positioner(), className),
1420
+ ...props
1421
+ });
1422
+ };
1423
+ const PopoverPopup = ({ className, ...props }) => {
1424
+ const { slots } = usePopover();
1425
+ return /* @__PURE__ */ jsx(Popover.Popup, {
1426
+ className: cn$1(slots.popup(), className),
1427
+ ...props
1428
+ });
1429
+ };
1430
+ const PopoverArrow = ({ className, ...props }) => {
1431
+ const { slots } = usePopover();
1432
+ return /* @__PURE__ */ jsx(Popover.Arrow, {
1433
+ className: cn$1(slots.arrow(), className),
1434
+ ...props
1435
+ });
1436
+ };
1437
+ const PopoverViewport = ({ className, ...props }) => {
1438
+ const { slots } = usePopover();
1439
+ return /* @__PURE__ */ jsx(Popover.Viewport, {
1440
+ className: cn$1(slots.viewport(), className),
1441
+ ...props
1442
+ });
1443
+ };
1444
+ const PopoverTitle = ({ className, ...props }) => {
1445
+ const { slots } = usePopover();
1446
+ return /* @__PURE__ */ jsx(Popover.Title, {
1447
+ className: cn$1(slots.title(), className),
1448
+ ...props
1449
+ });
1450
+ };
1451
+ const PopoverDescription = ({ className, ...props }) => {
1452
+ const { slots } = usePopover();
1453
+ return /* @__PURE__ */ jsx(Popover.Description, {
1454
+ className: cn$1(slots.description(), className),
1455
+ ...props
1456
+ });
1457
+ };
1458
+ const PopoverClose = ({ className, ...props }) => {
1459
+ const { slots } = usePopover();
1460
+ return /* @__PURE__ */ jsx(Popover.Close, {
1461
+ className: cn$1(slots.close(), className),
1462
+ ...props
1463
+ });
1464
+ };
1465
+ Popover$1.Root = Popover$1;
1466
+ Popover$1.Trigger = PopoverTrigger;
1467
+ Popover$1.Portal = PopoverPortal;
1468
+ Popover$1.Backdrop = PopoverBackdrop;
1469
+ Popover$1.Positioner = PopoverPositioner;
1470
+ Popover$1.Popup = PopoverPopup;
1471
+ Popover$1.Arrow = PopoverArrow;
1472
+ Popover$1.Viewport = PopoverViewport;
1473
+ Popover$1.Title = PopoverTitle;
1474
+ Popover$1.Description = PopoverDescription;
1475
+ Popover$1.Close = PopoverClose;
1476
+ var popover_default = Popover$1;
1477
+
1337
1478
  //#endregion
1338
1479
  //#region src/components/progress/progress.context.ts
1339
1480
  const ProgressContext = createContext(null);
1340
1481
 
1341
1482
  //#endregion
1342
1483
  //#region src/components/progress/progress.variants.ts
1343
- const progressVariants = tv({ slots: {
1344
- indicator: "progress__indicator",
1345
- label: "progress__label",
1346
- root: "progress",
1347
- track: "progress__track",
1348
- value: "progress__value"
1349
- } });
1484
+ const progressVariants = tv({
1485
+ defaultVariants: {
1486
+ size: "md",
1487
+ variant: "primary"
1488
+ },
1489
+ slots: {
1490
+ indicator: "progress__indicator",
1491
+ label: "progress__label",
1492
+ root: "progress",
1493
+ track: "progress__track",
1494
+ value: "progress__value"
1495
+ },
1496
+ variants: {
1497
+ size: {
1498
+ lg: { root: "progress--lg" },
1499
+ md: { root: "progress--md" },
1500
+ sm: { root: "progress--sm" }
1501
+ },
1502
+ variant: {
1503
+ danger: { root: "progress--danger" },
1504
+ primary: { root: "progress--primary" },
1505
+ secondary: { root: "progress--secondary" },
1506
+ success: { root: "progress--success" }
1507
+ }
1508
+ }
1509
+ });
1350
1510
 
1351
1511
  //#endregion
1352
1512
  //#region src/components/progress/use-progress.ts
@@ -1358,8 +1518,11 @@ const useProgress = () => {
1358
1518
 
1359
1519
  //#endregion
1360
1520
  //#region src/components/progress/progress.tsx
1361
- const Progress$1 = ({ className, ...props }) => {
1362
- const slots = useMemo(() => progressVariants(), []);
1521
+ const Progress$1 = ({ className, variant, size, ...props }) => {
1522
+ const slots = useMemo(() => progressVariants({
1523
+ size,
1524
+ variant
1525
+ }), [variant, size]);
1363
1526
  return /* @__PURE__ */ jsx(ProgressContext, {
1364
1527
  value: { slots },
1365
1528
  children: /* @__PURE__ */ jsx(Progress.Root, {
@@ -1403,6 +1566,62 @@ Progress$1.Indicator = ProgressIndicator;
1403
1566
  Progress$1.Root = Progress$1;
1404
1567
  var progress_default = Progress$1;
1405
1568
 
1569
+ //#endregion
1570
+ //#region src/components/radio/radio.context.ts
1571
+ const RadioContext = createContext(null);
1572
+
1573
+ //#endregion
1574
+ //#region src/components/radio/radio.variants.ts
1575
+ const radioVariants = tv({ slots: {
1576
+ indicator: "radio__indicator",
1577
+ root: "radio"
1578
+ } });
1579
+
1580
+ //#endregion
1581
+ //#region src/components/radio/use-radio.ts
1582
+ const useRadio = () => {
1583
+ const context = useContext(RadioContext);
1584
+ if (!context) throw new Error("useRadio must be used within a RadioProvider");
1585
+ return context;
1586
+ };
1587
+
1588
+ //#endregion
1589
+ //#region src/components/radio/radio.tsx
1590
+ const Radio$1 = ({ className, ...props }) => {
1591
+ const slots = useMemo(() => radioVariants({}), []);
1592
+ return /* @__PURE__ */ jsx(RadioContext, {
1593
+ value: { slots },
1594
+ children: /* @__PURE__ */ jsx(Radio.Root, {
1595
+ className: cn$1(slots.root(), className),
1596
+ ...props
1597
+ })
1598
+ });
1599
+ };
1600
+ const RadioIndicator = ({ className, ...props }) => {
1601
+ const { slots } = useRadio();
1602
+ return /* @__PURE__ */ jsx(Radio.Indicator, {
1603
+ className: cn$1(slots.indicator(), className),
1604
+ ...props
1605
+ });
1606
+ };
1607
+ Radio$1.Root = Radio$1;
1608
+ Radio$1.Indicator = RadioIndicator;
1609
+ var radio_default = Radio$1;
1610
+
1611
+ //#endregion
1612
+ //#region src/components/radio-group/radio-group.variants.ts
1613
+ const radioGroupVariants = tv({ base: "radio-group" });
1614
+
1615
+ //#endregion
1616
+ //#region src/components/radio-group/radio-group.tsx
1617
+ const RadioGroup$1 = ({ className, ...props }) => {
1618
+ return /* @__PURE__ */ jsx(RadioGroup, {
1619
+ className: cn$1(className, useMemo(() => radioGroupVariants(), [])),
1620
+ ...props
1621
+ });
1622
+ };
1623
+ var radio_group_default = RadioGroup$1;
1624
+
1406
1625
  //#endregion
1407
1626
  //#region src/components/slider/slider.context.ts
1408
1627
  const SliderContext = createContext(null);
@@ -1740,5 +1959,5 @@ const ToggleButton = ({ className, variant, size, ...props }) => {
1740
1959
  var toggle_button_default = ToggleButton;
1741
1960
 
1742
1961
  //#endregion
1743
- 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, drawer_default as Drawer, 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, drawerVariants, fieldVariants, fieldsetVariants, formVariants, inputVariants, labelVariants, linkVariants, listVariants, menuVariants, meterVariants, navbarVariants, progressVariants, separatorVariants, sliderVariants, switchVariants, tableVariants, tabsVariants, textVariants, textareaVariants, toggleButtonVariants };
1962
+ 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, drawer_default as Drawer, field_default as Field, fieldset_default as Fieldset, form_default as Form, icon_button_default as IconButton, 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, popover_default as Popover, progress_default as Progress, radio_default as Radio, radio_group_default as RadioGroup, 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, drawerVariants, fieldVariants, fieldsetVariants, formVariants, iconButtonVariants, inputVariants, labelVariants, linkVariants, listVariants, menuVariants, meterVariants, navbarVariants, popoverVariants, progressVariants, radioGroupVariants, radioVariants, separatorVariants, sliderVariants, switchVariants, tableVariants, tabsVariants, textVariants, textareaVariants, toggleButtonVariants };
1744
1963
  //# sourceMappingURL=index.mjs.map