@youngonesworks/ui 0.1.20 → 0.1.23

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.
@@ -1,11 +1,13 @@
1
- import { type InputHTMLAttributes, type ReactNode } from 'react';
2
- export interface ICheckbox extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'size' | 'disabled'> {
3
- size?: 'sm' | 'md';
4
- mediumBoldText?: boolean;
5
- label?: ReactNode;
6
- disabled?: boolean;
1
+ import { type JSX } from 'react';
2
+ interface ICheckbox extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
7
3
  className?: string;
8
- indeterminate?: boolean;
4
+ mediumBoldText?: boolean;
9
5
  error?: string;
6
+ label?: React.ReactNode;
7
+ indeterminate?: boolean;
8
+ size?: 'sm' | 'md';
10
9
  }
11
- export declare const Checkbox: import("react").ForwardRefExoticComponent<ICheckbox & import("react").RefAttributes<HTMLInputElement>>;
10
+ export declare const Checkbox: (props: ICheckbox & {
11
+ ref?: React.Ref<HTMLInputElement>;
12
+ }) => JSX.Element;
13
+ export {};
@@ -1,17 +1,9 @@
1
- import { type ReactNode } from 'react';
2
- interface IFavouriteButtonProps {
1
+ import { type JSX, type ReactNode } from 'react';
2
+ interface IFavouriteButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'size'> {
3
3
  onClick: () => void;
4
4
  favourite: boolean;
5
5
  iconOutline?: ReactNode;
6
6
  iconFilled?: ReactNode;
7
- /**
8
- * @deprecated Can be removed and replaced by iconSize
9
- */
10
- width?: string;
11
- /**
12
- * @deprecated Can be removed and replaced by iconSize
13
- */
14
- height?: string;
15
7
  iconSize?: number;
16
8
  className?: string;
17
9
  favouriteTitle?: string;
@@ -19,6 +11,9 @@ interface IFavouriteButtonProps {
19
11
  iconColor?: string;
20
12
  iconColorSelected?: string;
21
13
  styleVariant?: 'transparent' | 'small' | 'default' | 'round' | undefined;
14
+ children?: React.ReactNode;
22
15
  }
23
- export declare const FavouriteButton: import("react").ForwardRefExoticComponent<IFavouriteButtonProps & import("react").RefAttributes<HTMLButtonElement & HTMLAnchorElement>>;
16
+ export declare const FavouriteButton: (props: IFavouriteButtonProps & {
17
+ ref?: React.Ref<HTMLButtonElement>;
18
+ }) => JSX.Element;
24
19
  export {};
package/dist/index.cjs CHANGED
@@ -103438,7 +103438,7 @@ function Button({ type = "button", variant = "primary", ariaLabel, block = false
103438
103438
  type,
103439
103439
  "aria-label": ariaLabel,
103440
103440
  "data-testid": dataTestId,
103441
- className: cn(buttonVariants[variant], className, block && "w-full"),
103441
+ className: cn(buttonVariants[variant], className, block && "w-full text-sm"),
103442
103442
  onClick: handleOnClick,
103443
103443
  ...props,
103444
103444
  children: [
@@ -103452,7 +103452,7 @@ Button.displayName = "Button";
103452
103452
 
103453
103453
  //#endregion
103454
103454
  //#region src/components/checkbox/index.tsx
103455
- 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", {
103455
+ const CheckboxComponent = ({ size: size$3 = "md", className, error: error$1, mediumBoldText, label, indeterminate = false, disabled = false,...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
103456
103456
  className: cn("relative grid gap-2", className),
103457
103457
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
103458
103458
  className: cn("flex cursor-pointer items-center gap-3"),
@@ -103464,8 +103464,8 @@ const Checkbox = (0, react.forwardRef)(({ size: size$3 = "md", className, error:
103464
103464
  type: "checkbox",
103465
103465
  "data-testid": "checkbox",
103466
103466
  disabled,
103467
- ref,
103468
- ...props
103467
+ ...props,
103468
+ ref
103469
103469
  }),
103470
103470
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
103471
103471
  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"),
@@ -103503,17 +103503,35 @@ const Checkbox = (0, react.forwardRef)(({ size: size$3 = "md", className, error:
103503
103503
  className: "text-xs font-normal text-red-500",
103504
103504
  children: error$1
103505
103505
  })]
103506
- }));
103507
- Checkbox.displayName = "Checkbox";
103506
+ });
103507
+ const Checkbox = (0, react.forwardRef)(CheckboxComponent);
103508
103508
 
103509
103509
  //#endregion
103510
103510
  //#region src/components/divider/index.tsx
103511
103511
  const Divider = ({ className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
103512
103512
  "data-component": "divider",
103513
- className: clsx_default("block h-px w-full bg-[#CCCCCC]", className),
103513
+ className: clsx_default("block h-px w-full bg-gray-200", className),
103514
103514
  ...props
103515
103515
  });
103516
103516
 
103517
+ //#endregion
103518
+ //#region src/components/favouriteButton/index.tsx
103519
+ const FavouriteButton = (0, react.forwardRef)((props, ref) => {
103520
+ const { onClick, favourite, iconFilled, iconOutline, favouriteTitle, iconColorSelected = "text-pink", iconColor = "text-gray-800", iconSize, className = "", styleVariant = "transparent", children,...rest } = props;
103521
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActionIcon, {
103522
+ onClick,
103523
+ "data-component": "favouriteButton",
103524
+ title: favouriteTitle || "Favorite",
103525
+ styleVariant,
103526
+ className: `${favourite ? iconColorSelected : iconColor} ${className}`.trim(),
103527
+ iconSize,
103528
+ ref,
103529
+ icon: favourite ? iconFilled ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconHeartFilled, {}) : iconOutline ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconHeart, {}),
103530
+ ...rest,
103531
+ children
103532
+ });
103533
+ });
103534
+
103517
103535
  //#endregion
103518
103536
  //#region src/components/filters/FilterButton.tsx
103519
103537
  const FilterButton = ({ onClick, hasFilters, reset, filtersText, resetText }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -111927,9 +111945,9 @@ var jsx = function jsx$3(type, props) {
111927
111945
  }
111928
111946
  return react.createElement.apply(null, createElementArgArray);
111929
111947
  };
111930
- (function(_jsx$65) {
111948
+ (function(_jsx$66) {
111931
111949
  var JSX;
111932
- (function(_JSX) {})(JSX || (JSX = _jsx$65.JSX || (_jsx$65.JSX = {})));
111950
+ (function(_JSX) {})(JSX || (JSX = _jsx$66.JSX || (_jsx$66.JSX = {})));
111933
111951
  })(jsx || (jsx = {}));
111934
111952
  var Global = /* @__PURE__ */ withEmotionCache(function(props, cache) {
111935
111953
  var styles = props.styles;
@@ -137800,37 +137818,8 @@ function isClassComponent(Component$1) {
137800
137818
  * @returns {boolean}
137801
137819
  */
137802
137820
  function isForwardRefComponent(Component$1) {
137803
- return !!(typeof Component$1 === "object" && Component$1.$$typeof && (Component$1.$$typeof.toString() === "Symbol(react.forward_ref)" || Component$1.$$typeof.description === "react.forward_ref"));
137804
- }
137805
- /**
137806
- * Check if a component is a memoized component.
137807
- * @param Component
137808
- * @returns {boolean}
137809
- */
137810
- function isMemoComponent(Component$1) {
137811
- return !!(typeof Component$1 === "object" && Component$1.$$typeof && (Component$1.$$typeof.toString() === "Symbol(react.memo)" || Component$1.$$typeof.description === "react.memo"));
137812
- }
137813
- /**
137814
- * Check if a component can safely receive a ref prop.
137815
- * This includes class components, forwardRef components, and memoized components
137816
- * that wrap forwardRef or class components.
137817
- * @param Component
137818
- * @returns {boolean}
137819
- */
137820
- function canReceiveRef(Component$1) {
137821
- if (isClassComponent(Component$1)) {
137822
- return true;
137823
- }
137824
- if (isForwardRefComponent(Component$1)) {
137825
- return true;
137826
- }
137827
- if (isMemoComponent(Component$1)) {
137828
- const wrappedComponent = Component$1.type;
137829
- if (wrappedComponent) {
137830
- return isClassComponent(wrappedComponent) || isForwardRefComponent(wrappedComponent);
137831
- }
137832
- }
137833
- return false;
137821
+ var _a;
137822
+ return !!(typeof Component$1 === "object" && ((_a = Component$1.$$typeof) === null || _a === void 0 ? void 0 : _a.toString()) === "Symbol(react.forward_ref)");
137834
137823
  }
137835
137824
  /**
137836
137825
  * Check if we're running React 19+ by detecting if function components support ref props
@@ -137888,15 +137877,19 @@ var ReactRenderer = class {
137888
137877
  const props = this.props;
137889
137878
  const editor = this.editor;
137890
137879
  const isReact19 = isReact19Plus();
137891
- const componentCanReceiveRef = canReceiveRef(Component$1);
137880
+ const isClassComp = isClassComponent(Component$1);
137881
+ const isForwardRefComp = isForwardRefComponent(Component$1);
137892
137882
  const elementProps = { ...props };
137893
- if (elementProps.ref && !(isReact19 || componentCanReceiveRef)) {
137894
- delete elementProps.ref;
137895
- }
137896
- if (!elementProps.ref && (isReact19 || componentCanReceiveRef)) {
137897
- elementProps.ref = (ref) => {
137898
- this.ref = ref;
137899
- };
137883
+ if (!elementProps.ref) {
137884
+ if (isReact19) {
137885
+ elementProps.ref = (ref) => {
137886
+ this.ref = ref;
137887
+ };
137888
+ } else if (isClassComp || isForwardRefComp) {
137889
+ elementProps.ref = (ref) => {
137890
+ this.ref = ref;
137891
+ };
137892
+ }
137900
137893
  }
137901
137894
  this.reactElement = react.default.createElement(Component$1, { ...elementProps });
137902
137895
  (_a = editor === null || editor === void 0 ? void 0 : editor.contentComponent) === null || _a === void 0 ? void 0 : _a.setRenderer(this.id, this);
@@ -140329,6 +140322,7 @@ exports.BreadCrumb = BreadCrumb;
140329
140322
  exports.Button = Button;
140330
140323
  exports.Checkbox = Checkbox;
140331
140324
  exports.Divider = Divider;
140325
+ exports.FavouriteButton = FavouriteButton;
140332
140326
  exports.Filters = Filters;
140333
140327
  exports.GoogleAppButtonIcon = GoogleAppButtonIcon;
140334
140328
  exports.HR = HR;