@bbki.ng/components 2.5.10 → 2.6.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/dist/index.cjs CHANGED
@@ -53,8 +53,17 @@ __export(lib_exports, {
53
53
  DropZone: () => DropZone,
54
54
  Error: () => Error2,
55
55
  ErrorBoundary: () => ErrorBoundary,
56
+ Form: () => Form,
57
+ FormControl: () => FormControl,
58
+ FormDescription: () => FormDescription,
59
+ FormField: () => FormField,
60
+ FormItem: () => FormItem,
61
+ FormLabel: () => FormLabel,
62
+ FormMessage: () => FormMessage,
56
63
  Gallery: () => Gallery,
57
64
  Img: () => Img,
65
+ Input: () => Input,
66
+ Label: () => Label2,
58
67
  Link: () => Link,
59
68
  LinkColor: () => LinkColor,
60
69
  LinkList: () => LinkList,
@@ -74,7 +83,11 @@ __export(lib_exports, {
74
83
  Tags: () => Tags,
75
84
  ThreeColLayout: () => ThreeColLayout,
76
85
  TitledList: () => TitledList,
77
- ossProcessType: () => ossProcessType
86
+ ossProcessType: () => ossProcessType,
87
+ useForm: () => import_react_hook_form.useForm,
88
+ useFormField: () => useFormField,
89
+ z: () => import_zod.z,
90
+ zodResolver: () => import_zod2.zodResolver
78
91
  });
79
92
  module.exports = __toCommonJS(lib_exports);
80
93
 
@@ -110,11 +123,12 @@ function Button(props) {
110
123
  ["disabled" /* DISABLED */]: "text-gray-400 cursor-not-allowed",
111
124
  ["normal" /* NORMAL */]: "text-black"
112
125
  };
113
- const { type = "normal" /* NORMAL */, className = "", onClick } = props;
126
+ const { type = "normal" /* NORMAL */, className = "", onClick, btnType } = props;
114
127
  const shadowTransCls = type === "disabled" /* DISABLED */ ? "" : "transition-all duration-200 ease-in-out shadow-button hover:shadow-button-hover active:shadow-empty";
115
128
  return /* @__PURE__ */ import_react2.default.createElement("button", {
116
129
  className: `${typeClsMap[type]} ${className} ${shadowTransCls} py-8 px-16 transition-all duration-200 ease-in-out`,
117
- onClick
130
+ onClick,
131
+ type: btnType
118
132
  }, props.children);
119
133
  }
120
134
  Button.displayName = "Button";
@@ -1341,7 +1355,7 @@ var ContextMenuSubTrigger = React22.forwardRef(({ className, inset, children, ..
1341
1355
  ),
1342
1356
  ...props
1343
1357
  }, children, /* @__PURE__ */ React22.createElement(import_react_icons.ChevronRightIcon, {
1344
- className: "ml-auto h-4 w-4"
1358
+ className: "ml-auto"
1345
1359
  })));
1346
1360
  ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
1347
1361
  var ContextMenuSubContent = React22.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React22.createElement(ContextMenuPrimitive.SubContent, {
@@ -1429,12 +1443,147 @@ var ContextMenuShortcut = ({
1429
1443
  };
1430
1444
  ContextMenuShortcut.displayName = "ContextMenuShortcut";
1431
1445
 
1446
+ // lib/form/index.tsx
1447
+ var React24 = __toESM(require("react"), 1);
1448
+ var import_zod = require("zod");
1449
+ var import_react_slot = require("@radix-ui/react-slot");
1450
+ var import_zod2 = require("@hookform/resolvers/zod");
1451
+ var import_react_hook_form = require("react-hook-form");
1452
+ var import_classnames17 = __toESM(require("classnames"), 1);
1453
+
1454
+ // lib/label/index.tsx
1455
+ var React23 = __toESM(require("react"), 1);
1456
+ var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
1457
+ var import_class_variance_authority = require("class-variance-authority");
1458
+ var import_classnames16 = __toESM(require("classnames"), 1);
1459
+ "use client";
1460
+ var labelVariants = (0, import_class_variance_authority.cva)(
1461
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1462
+ );
1463
+ var Label2 = React23.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React23.createElement(LabelPrimitive.Root, {
1464
+ ref,
1465
+ className: (0, import_classnames16.default)(labelVariants(), className),
1466
+ ...props
1467
+ }));
1468
+ Label2.displayName = LabelPrimitive.Root.displayName;
1469
+
1470
+ // lib/form/index.tsx
1471
+ "use client";
1472
+ var Form = import_react_hook_form.FormProvider;
1473
+ var FormFieldContext = React24.createContext(
1474
+ {}
1475
+ );
1476
+ var FormField = ({
1477
+ ...props
1478
+ }) => {
1479
+ return /* @__PURE__ */ React24.createElement(FormFieldContext.Provider, {
1480
+ value: { name: props.name }
1481
+ }, /* @__PURE__ */ React24.createElement(import_react_hook_form.Controller, {
1482
+ ...props
1483
+ }));
1484
+ };
1485
+ var useFormField = () => {
1486
+ const fieldContext = React24.useContext(FormFieldContext);
1487
+ const itemContext = React24.useContext(FormItemContext);
1488
+ const { getFieldState, formState } = (0, import_react_hook_form.useFormContext)();
1489
+ const fieldState = getFieldState(fieldContext.name, formState);
1490
+ if (!fieldContext) {
1491
+ throw new Error("useFormField should be used within <FormField>");
1492
+ }
1493
+ const { id } = itemContext;
1494
+ return {
1495
+ id,
1496
+ name: fieldContext.name,
1497
+ formItemId: `${id}-form-item`,
1498
+ formDescriptionId: `${id}-form-item-description`,
1499
+ formMessageId: `${id}-form-item-message`,
1500
+ ...fieldState
1501
+ };
1502
+ };
1503
+ var FormItemContext = React24.createContext(
1504
+ {}
1505
+ );
1506
+ var FormItem = React24.forwardRef(({ className, ...props }, ref) => {
1507
+ const id = React24.useId();
1508
+ return /* @__PURE__ */ React24.createElement(FormItemContext.Provider, {
1509
+ value: { id }
1510
+ }, /* @__PURE__ */ React24.createElement("div", {
1511
+ ref,
1512
+ className: (0, import_classnames17.default)("space-y-2", className),
1513
+ ...props
1514
+ }));
1515
+ });
1516
+ FormItem.displayName = "FormItem";
1517
+ var FormLabel = React24.forwardRef(({ className, ...props }, ref) => {
1518
+ const { error, formItemId } = useFormField();
1519
+ return /* @__PURE__ */ React24.createElement(Label2, {
1520
+ ref,
1521
+ className: (0, import_classnames17.default)(error && "text-destructive", className),
1522
+ htmlFor: formItemId,
1523
+ ...props
1524
+ });
1525
+ });
1526
+ FormLabel.displayName = "FormLabel";
1527
+ var FormControl = React24.forwardRef(({ ...props }, ref) => {
1528
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
1529
+ return /* @__PURE__ */ React24.createElement(import_react_slot.Slot, {
1530
+ ref,
1531
+ id: formItemId,
1532
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
1533
+ "aria-invalid": !!error,
1534
+ ...props
1535
+ });
1536
+ });
1537
+ FormControl.displayName = "FormControl";
1538
+ var FormDescription = React24.forwardRef(({ className, ...props }, ref) => {
1539
+ const { formDescriptionId } = useFormField();
1540
+ return /* @__PURE__ */ React24.createElement("p", {
1541
+ ref,
1542
+ id: formDescriptionId,
1543
+ className: (0, import_classnames17.default)("text-sm text-muted-foreground", className),
1544
+ ...props
1545
+ });
1546
+ });
1547
+ FormDescription.displayName = "FormDescription";
1548
+ var FormMessage = React24.forwardRef(({ className, children, ...props }, ref) => {
1549
+ const { error, formMessageId } = useFormField();
1550
+ const body = error ? String(error == null ? void 0 : error.message) : children;
1551
+ if (!body) {
1552
+ return null;
1553
+ }
1554
+ return /* @__PURE__ */ React24.createElement("p", {
1555
+ ref,
1556
+ id: formMessageId,
1557
+ className: (0, import_classnames17.default)("text-sm font-medium text-destructive", className),
1558
+ ...props
1559
+ }, body);
1560
+ });
1561
+ FormMessage.displayName = "FormMessage";
1562
+
1563
+ // lib/input/index.tsx
1564
+ var React25 = __toESM(require("react"), 1);
1565
+ var import_classnames18 = __toESM(require("classnames"), 1);
1566
+ var Input = React25.forwardRef(
1567
+ ({ className, type, ...props }, ref) => {
1568
+ return /* @__PURE__ */ React25.createElement("input", {
1569
+ type,
1570
+ className: (0, import_classnames18.default)(
1571
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
1572
+ className
1573
+ ),
1574
+ ref,
1575
+ ...props
1576
+ });
1577
+ }
1578
+ );
1579
+ Input.displayName = "Input";
1580
+
1432
1581
  // lib/blur-cover/BlurCover.tsx
1433
1582
  var import_react23 = __toESM(require("react"), 1);
1434
- var import_classnames16 = __toESM(require("classnames"), 1);
1583
+ var import_classnames19 = __toESM(require("classnames"), 1);
1435
1584
  var BlurCover = (props) => {
1436
1585
  const { status } = props;
1437
- const coverCls = (0, import_classnames16.default)(
1586
+ const coverCls = (0, import_classnames19.default)(
1438
1587
  "fixed",
1439
1588
  "block",
1440
1589
  "text-blur",
@@ -1594,8 +1743,17 @@ var Canvas = (props) => {
1594
1743
  DropZone,
1595
1744
  Error,
1596
1745
  ErrorBoundary,
1746
+ Form,
1747
+ FormControl,
1748
+ FormDescription,
1749
+ FormField,
1750
+ FormItem,
1751
+ FormLabel,
1752
+ FormMessage,
1597
1753
  Gallery,
1598
1754
  Img,
1755
+ Input,
1756
+ Label,
1599
1757
  Link,
1600
1758
  LinkColor,
1601
1759
  LinkList,
@@ -1615,6 +1773,10 @@ var Canvas = (props) => {
1615
1773
  Tags,
1616
1774
  ThreeColLayout,
1617
1775
  TitledList,
1618
- ossProcessType
1776
+ ossProcessType,
1777
+ useForm,
1778
+ useFormField,
1779
+ z,
1780
+ zodResolver
1619
1781
  });
1620
1782
  //# sourceMappingURL=index.cjs.map