@youngonesworks/ui 0.1.18 → 0.1.19

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
@@ -103322,70 +103322,6 @@ const BreadCrumb = ({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
103322
103322
  });
103323
103323
  BreadCrumb.displayName = "BreadCrumb";
103324
103324
 
103325
- //#endregion
103326
- //#region src/components/checkbox/index.tsx
103327
- const Checkbox = (0, react.forwardRef)(({ size: size$3 = "md", className, error: error$1, mediumBoldText, label, indeterminate = false, disabled = false,...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
103328
- className: cn("relative grid gap-2", className),
103329
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
103330
- className: cn("flex cursor-pointer items-center gap-3"),
103331
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
103332
- className: cn("relative grid shrink-0 place-content-center", size$3 === "sm" ? "size-4" : "size-5"),
103333
- children: [
103334
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
103335
- className: "checked:border-light-blue checked:bg-light-blue [&:not([disabled])]:checked:border-light-blue [&:not([disabled])]:checked:bg-light-blue peer absolute inset-0 shrink-0 appearance-none rounded-xs border border-gray-800 bg-white focus:outline-hidden disabled:border-gray-300 disabled:bg-gray-100 disabled:[&[checked]]:border-gray-100",
103336
- type: "checkbox",
103337
- "data-testid": "checkbox",
103338
- disabled,
103339
- ref,
103340
- ...props
103341
- }),
103342
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
103343
- className: cn("pointer-events-none absolute top-1/2 left-1/2 hidden -translate-x-1/2 -translate-y-1/2 stroke-white outline-hidden peer-checked:block", { "stroke-gray-300": disabled }, size$3 === "sm" ? "size-3" : "size-4"),
103344
- xmlns: "http://www.w3.org/2000/svg",
103345
- viewBox: "0 0 24 24",
103346
- fill: "none",
103347
- stroke: "currentColor",
103348
- strokeWidth: "4",
103349
- strokeLinecap: "round",
103350
- strokeLinejoin: "round",
103351
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", { points: "20 6 9 17 4 12" })
103352
- }),
103353
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
103354
- className: cn("pointer-events-none absolute left-1/2 hidden -translate-x-1/2 -translate-y-1/2 stroke-black outline-hidden", { "stroke-gray-300": disabled }, size$3 === "sm" ? "top-[60%] size-3" : "top-1/2 size-4", { block: indeterminate }),
103355
- xmlns: "http://www.w3.org/2000/svg",
103356
- viewBox: "0 0 24 24",
103357
- fill: "none",
103358
- stroke: "currentColor",
103359
- strokeWidth: "4",
103360
- strokeLinecap: "round",
103361
- strokeLinejoin: "round",
103362
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103363
- x1: "4",
103364
- y1: "12",
103365
- x2: "20",
103366
- y2: "12"
103367
- })
103368
- })
103369
- ]
103370
- }), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
103371
- className: cn("grow text-sm font-normal", { "font-medium": mediumBoldText }),
103372
- children: label
103373
- })]
103374
- }), error$1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
103375
- className: "text-xs font-normal text-red-500",
103376
- children: error$1
103377
- })]
103378
- }));
103379
- Checkbox.displayName = "Checkbox";
103380
-
103381
- //#endregion
103382
- //#region src/components/divider/index.tsx
103383
- const Divider = ({ className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
103384
- "data-component": "divider",
103385
- className: clsx_default("block h-px w-full bg-[#CCCCCC]", className),
103386
- ...props
103387
- });
103388
-
103389
103325
  //#endregion
103390
103326
  //#region src/icons/IconLoading.tsx
103391
103327
  const IconLoading = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
@@ -103511,6 +103447,70 @@ const Button = (0, react.forwardRef)(({ type = "button", variant = "primary", ar
103511
103447
  });
103512
103448
  Button.displayName = "Button";
103513
103449
 
103450
+ //#endregion
103451
+ //#region src/components/checkbox/index.tsx
103452
+ const Checkbox = (0, react.forwardRef)(({ size: size$3 = "md", className, error: error$1, mediumBoldText, label, indeterminate = false, disabled = false,...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
103453
+ className: cn("relative grid gap-2", className),
103454
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
103455
+ className: cn("flex cursor-pointer items-center gap-3"),
103456
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
103457
+ className: cn("relative grid shrink-0 place-content-center", size$3 === "sm" ? "size-4" : "size-5"),
103458
+ children: [
103459
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
103460
+ className: "checked:border-light-blue checked:bg-light-blue [&:not([disabled])]:checked:border-light-blue [&:not([disabled])]:checked:bg-light-blue peer absolute inset-0 shrink-0 appearance-none rounded-xs border border-gray-800 bg-white focus:outline-hidden disabled:border-gray-300 disabled:bg-gray-100 disabled:[&[checked]]:border-gray-100",
103461
+ type: "checkbox",
103462
+ "data-testid": "checkbox",
103463
+ disabled,
103464
+ ref,
103465
+ ...props
103466
+ }),
103467
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
103468
+ className: cn("pointer-events-none absolute top-1/2 left-1/2 hidden -translate-x-1/2 -translate-y-1/2 stroke-white outline-hidden peer-checked:block", { "stroke-gray-300": disabled }, size$3 === "sm" ? "size-3" : "size-4"),
103469
+ xmlns: "http://www.w3.org/2000/svg",
103470
+ viewBox: "0 0 24 24",
103471
+ fill: "none",
103472
+ stroke: "currentColor",
103473
+ strokeWidth: "4",
103474
+ strokeLinecap: "round",
103475
+ strokeLinejoin: "round",
103476
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", { points: "20 6 9 17 4 12" })
103477
+ }),
103478
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
103479
+ className: cn("pointer-events-none absolute left-1/2 hidden -translate-x-1/2 -translate-y-1/2 stroke-black outline-hidden", { "stroke-gray-300": disabled }, size$3 === "sm" ? "top-[60%] size-3" : "top-1/2 size-4", { block: indeterminate }),
103480
+ xmlns: "http://www.w3.org/2000/svg",
103481
+ viewBox: "0 0 24 24",
103482
+ fill: "none",
103483
+ stroke: "currentColor",
103484
+ strokeWidth: "4",
103485
+ strokeLinecap: "round",
103486
+ strokeLinejoin: "round",
103487
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
103488
+ x1: "4",
103489
+ y1: "12",
103490
+ x2: "20",
103491
+ y2: "12"
103492
+ })
103493
+ })
103494
+ ]
103495
+ }), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
103496
+ className: cn("grow text-sm font-normal", { "font-medium": mediumBoldText }),
103497
+ children: label
103498
+ })]
103499
+ }), error$1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
103500
+ className: "text-xs font-normal text-red-500",
103501
+ children: error$1
103502
+ })]
103503
+ }));
103504
+ Checkbox.displayName = "Checkbox";
103505
+
103506
+ //#endregion
103507
+ //#region src/components/divider/index.tsx
103508
+ const Divider = ({ className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
103509
+ "data-component": "divider",
103510
+ className: clsx_default("block h-px w-full bg-[#CCCCCC]", className),
103511
+ ...props
103512
+ });
103513
+
103514
103514
  //#endregion
103515
103515
  //#region src/components/filters/FilterButton.tsx
103516
103516
  const FilterButton = ({ onClick, hasFilters, reset, filtersText, resetText }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -137797,8 +137797,37 @@ function isClassComponent(Component$1) {
137797
137797
  * @returns {boolean}
137798
137798
  */
137799
137799
  function isForwardRefComponent(Component$1) {
137800
- var _a;
137801
- return !!(typeof Component$1 === "object" && ((_a = Component$1.$$typeof) === null || _a === void 0 ? void 0 : _a.toString()) === "Symbol(react.forward_ref)");
137800
+ return !!(typeof Component$1 === "object" && Component$1.$$typeof && (Component$1.$$typeof.toString() === "Symbol(react.forward_ref)" || Component$1.$$typeof.description === "react.forward_ref"));
137801
+ }
137802
+ /**
137803
+ * Check if a component is a memoized component.
137804
+ * @param Component
137805
+ * @returns {boolean}
137806
+ */
137807
+ function isMemoComponent(Component$1) {
137808
+ return !!(typeof Component$1 === "object" && Component$1.$$typeof && (Component$1.$$typeof.toString() === "Symbol(react.memo)" || Component$1.$$typeof.description === "react.memo"));
137809
+ }
137810
+ /**
137811
+ * Check if a component can safely receive a ref prop.
137812
+ * This includes class components, forwardRef components, and memoized components
137813
+ * that wrap forwardRef or class components.
137814
+ * @param Component
137815
+ * @returns {boolean}
137816
+ */
137817
+ function canReceiveRef(Component$1) {
137818
+ if (isClassComponent(Component$1)) {
137819
+ return true;
137820
+ }
137821
+ if (isForwardRefComponent(Component$1)) {
137822
+ return true;
137823
+ }
137824
+ if (isMemoComponent(Component$1)) {
137825
+ const wrappedComponent = Component$1.type;
137826
+ if (wrappedComponent) {
137827
+ return isClassComponent(wrappedComponent) || isForwardRefComponent(wrappedComponent);
137828
+ }
137829
+ }
137830
+ return false;
137802
137831
  }
137803
137832
  /**
137804
137833
  * Check if we're running React 19+ by detecting if function components support ref props
@@ -137856,19 +137885,15 @@ var ReactRenderer = class {
137856
137885
  const props = this.props;
137857
137886
  const editor = this.editor;
137858
137887
  const isReact19 = isReact19Plus();
137859
- const isClassComp = isClassComponent(Component$1);
137860
- const isForwardRefComp = isForwardRefComponent(Component$1);
137888
+ const componentCanReceiveRef = canReceiveRef(Component$1);
137861
137889
  const elementProps = { ...props };
137862
- if (!elementProps.ref) {
137863
- if (isReact19) {
137864
- elementProps.ref = (ref) => {
137865
- this.ref = ref;
137866
- };
137867
- } else if (isClassComp || isForwardRefComp) {
137868
- elementProps.ref = (ref) => {
137869
- this.ref = ref;
137870
- };
137871
- }
137890
+ if (elementProps.ref && !(isReact19 || componentCanReceiveRef)) {
137891
+ delete elementProps.ref;
137892
+ }
137893
+ if (!elementProps.ref && (isReact19 || componentCanReceiveRef)) {
137894
+ elementProps.ref = (ref) => {
137895
+ this.ref = ref;
137896
+ };
137872
137897
  }
137873
137898
  this.reactElement = react.default.createElement(Component$1, { ...elementProps });
137874
137899
  (_a = editor === null || editor === void 0 ? void 0 : editor.contentComponent) === null || _a === void 0 ? void 0 : _a.setRenderer(this.id, this);
@@ -140298,6 +140323,7 @@ exports.AvatarIndicator = AvatarIndicator;
140298
140323
  exports.Badge = Badge;
140299
140324
  exports.BigBadge = BigBadge;
140300
140325
  exports.BreadCrumb = BreadCrumb;
140326
+ exports.Button = Button;
140301
140327
  exports.Checkbox = Checkbox;
140302
140328
  exports.Divider = Divider;
140303
140329
  exports.Filters = Filters;
@@ -140345,4 +140371,5 @@ exports.UnorderedList = UnorderedList;
140345
140371
  exports.UnorderedListItem = UnorderedListItem;
140346
140372
  exports.UnstyledButton = UnstyledButton;
140347
140373
  exports.WysiwygEditor = WysiwygEditor;
140374
+ exports.buttonVariants = buttonVariants;
140348
140375
  //# sourceMappingURL=index.cjs.map