@bbki.ng/components 2.5.11 → 2.6.1

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";
@@ -969,6 +983,7 @@ var Img = (props) => {
969
983
  }
970
984
  handleImgLoad(input);
971
985
  },
986
+ crossOrigin: "anonymous",
972
987
  width,
973
988
  height,
974
989
  src: addOssWebpProcessStyle(src, processType || "webp" /* WEBP */),
@@ -999,6 +1014,7 @@ var Img = (props) => {
999
1014
  "opacity-0": decoded
1000
1015
  }
1001
1016
  ),
1017
+ crossOrigin: "anonymous",
1002
1018
  style: { top: 0, left: 0 }
1003
1019
  }));
1004
1020
  };
@@ -1341,7 +1357,7 @@ var ContextMenuSubTrigger = React22.forwardRef(({ className, inset, children, ..
1341
1357
  ),
1342
1358
  ...props
1343
1359
  }, children, /* @__PURE__ */ React22.createElement(import_react_icons.ChevronRightIcon, {
1344
- className: "ml-auto h-4 w-4"
1360
+ className: "ml-auto"
1345
1361
  })));
1346
1362
  ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName;
1347
1363
  var ContextMenuSubContent = React22.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React22.createElement(ContextMenuPrimitive.SubContent, {
@@ -1429,12 +1445,147 @@ var ContextMenuShortcut = ({
1429
1445
  };
1430
1446
  ContextMenuShortcut.displayName = "ContextMenuShortcut";
1431
1447
 
1448
+ // lib/form/index.tsx
1449
+ var React24 = __toESM(require("react"), 1);
1450
+ var import_zod = require("zod");
1451
+ var import_react_slot = require("@radix-ui/react-slot");
1452
+ var import_zod2 = require("@hookform/resolvers/zod");
1453
+ var import_react_hook_form = require("react-hook-form");
1454
+ var import_classnames17 = __toESM(require("classnames"), 1);
1455
+
1456
+ // lib/label/index.tsx
1457
+ var React23 = __toESM(require("react"), 1);
1458
+ var LabelPrimitive = __toESM(require("@radix-ui/react-label"), 1);
1459
+ var import_class_variance_authority = require("class-variance-authority");
1460
+ var import_classnames16 = __toESM(require("classnames"), 1);
1461
+ "use client";
1462
+ var labelVariants = (0, import_class_variance_authority.cva)(
1463
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
1464
+ );
1465
+ var Label2 = React23.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ React23.createElement(LabelPrimitive.Root, {
1466
+ ref,
1467
+ className: (0, import_classnames16.default)(labelVariants(), className),
1468
+ ...props
1469
+ }));
1470
+ Label2.displayName = LabelPrimitive.Root.displayName;
1471
+
1472
+ // lib/form/index.tsx
1473
+ "use client";
1474
+ var Form = import_react_hook_form.FormProvider;
1475
+ var FormFieldContext = React24.createContext(
1476
+ {}
1477
+ );
1478
+ var FormField = ({
1479
+ ...props
1480
+ }) => {
1481
+ return /* @__PURE__ */ React24.createElement(FormFieldContext.Provider, {
1482
+ value: { name: props.name }
1483
+ }, /* @__PURE__ */ React24.createElement(import_react_hook_form.Controller, {
1484
+ ...props
1485
+ }));
1486
+ };
1487
+ var useFormField = () => {
1488
+ const fieldContext = React24.useContext(FormFieldContext);
1489
+ const itemContext = React24.useContext(FormItemContext);
1490
+ const { getFieldState, formState } = (0, import_react_hook_form.useFormContext)();
1491
+ const fieldState = getFieldState(fieldContext.name, formState);
1492
+ if (!fieldContext) {
1493
+ throw new Error("useFormField should be used within <FormField>");
1494
+ }
1495
+ const { id } = itemContext;
1496
+ return {
1497
+ id,
1498
+ name: fieldContext.name,
1499
+ formItemId: `${id}-form-item`,
1500
+ formDescriptionId: `${id}-form-item-description`,
1501
+ formMessageId: `${id}-form-item-message`,
1502
+ ...fieldState
1503
+ };
1504
+ };
1505
+ var FormItemContext = React24.createContext(
1506
+ {}
1507
+ );
1508
+ var FormItem = React24.forwardRef(({ className, ...props }, ref) => {
1509
+ const id = React24.useId();
1510
+ return /* @__PURE__ */ React24.createElement(FormItemContext.Provider, {
1511
+ value: { id }
1512
+ }, /* @__PURE__ */ React24.createElement("div", {
1513
+ ref,
1514
+ className: (0, import_classnames17.default)("space-y-2", className),
1515
+ ...props
1516
+ }));
1517
+ });
1518
+ FormItem.displayName = "FormItem";
1519
+ var FormLabel = React24.forwardRef(({ className, ...props }, ref) => {
1520
+ const { error, formItemId } = useFormField();
1521
+ return /* @__PURE__ */ React24.createElement(Label2, {
1522
+ ref,
1523
+ className: (0, import_classnames17.default)(error && "text-destructive", className),
1524
+ htmlFor: formItemId,
1525
+ ...props
1526
+ });
1527
+ });
1528
+ FormLabel.displayName = "FormLabel";
1529
+ var FormControl = React24.forwardRef(({ ...props }, ref) => {
1530
+ const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
1531
+ return /* @__PURE__ */ React24.createElement(import_react_slot.Slot, {
1532
+ ref,
1533
+ id: formItemId,
1534
+ "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
1535
+ "aria-invalid": !!error,
1536
+ ...props
1537
+ });
1538
+ });
1539
+ FormControl.displayName = "FormControl";
1540
+ var FormDescription = React24.forwardRef(({ className, ...props }, ref) => {
1541
+ const { formDescriptionId } = useFormField();
1542
+ return /* @__PURE__ */ React24.createElement("p", {
1543
+ ref,
1544
+ id: formDescriptionId,
1545
+ className: (0, import_classnames17.default)("text-sm text-muted-foreground", className),
1546
+ ...props
1547
+ });
1548
+ });
1549
+ FormDescription.displayName = "FormDescription";
1550
+ var FormMessage = React24.forwardRef(({ className, children, ...props }, ref) => {
1551
+ const { error, formMessageId } = useFormField();
1552
+ const body = error ? String(error == null ? void 0 : error.message) : children;
1553
+ if (!body) {
1554
+ return null;
1555
+ }
1556
+ return /* @__PURE__ */ React24.createElement("p", {
1557
+ ref,
1558
+ id: formMessageId,
1559
+ className: (0, import_classnames17.default)("text-sm font-medium text-destructive", className),
1560
+ ...props
1561
+ }, body);
1562
+ });
1563
+ FormMessage.displayName = "FormMessage";
1564
+
1565
+ // lib/input/index.tsx
1566
+ var React25 = __toESM(require("react"), 1);
1567
+ var import_classnames18 = __toESM(require("classnames"), 1);
1568
+ var Input = React25.forwardRef(
1569
+ ({ className, type, ...props }, ref) => {
1570
+ return /* @__PURE__ */ React25.createElement("input", {
1571
+ type,
1572
+ className: (0, import_classnames18.default)(
1573
+ "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",
1574
+ className
1575
+ ),
1576
+ ref,
1577
+ ...props
1578
+ });
1579
+ }
1580
+ );
1581
+ Input.displayName = "Input";
1582
+
1432
1583
  // lib/blur-cover/BlurCover.tsx
1433
1584
  var import_react23 = __toESM(require("react"), 1);
1434
- var import_classnames16 = __toESM(require("classnames"), 1);
1585
+ var import_classnames19 = __toESM(require("classnames"), 1);
1435
1586
  var BlurCover = (props) => {
1436
1587
  const { status } = props;
1437
- const coverCls = (0, import_classnames16.default)(
1588
+ const coverCls = (0, import_classnames19.default)(
1438
1589
  "fixed",
1439
1590
  "block",
1440
1591
  "text-blur",
@@ -1594,8 +1745,17 @@ var Canvas = (props) => {
1594
1745
  DropZone,
1595
1746
  Error,
1596
1747
  ErrorBoundary,
1748
+ Form,
1749
+ FormControl,
1750
+ FormDescription,
1751
+ FormField,
1752
+ FormItem,
1753
+ FormLabel,
1754
+ FormMessage,
1597
1755
  Gallery,
1598
1756
  Img,
1757
+ Input,
1758
+ Label,
1599
1759
  Link,
1600
1760
  LinkColor,
1601
1761
  LinkList,
@@ -1615,6 +1775,10 @@ var Canvas = (props) => {
1615
1775
  Tags,
1616
1776
  ThreeColLayout,
1617
1777
  TitledList,
1618
- ossProcessType
1778
+ ossProcessType,
1779
+ useForm,
1780
+ useFormField,
1781
+ z,
1782
+ zodResolver
1619
1783
  });
1620
1784
  //# sourceMappingURL=index.cjs.map