@youngonesworks/ui 0.1.19 → 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.
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export { Button } from './components/button';
13
13
  export { buttonVariants } from './components/button/buttonVariants';
14
14
  export { Checkbox } from './components/checkbox';
15
15
  export { Divider } from './components/divider';
16
+ export { FavouriteButton } from './components/favouriteButton';
16
17
  export { Filters } from './components/filters';
17
18
  export { GoogleAppButtonIcon } from './components/googleAppButtonIcon';
18
19
  export { HamburgerMenuButton } from './components/hamburgerMenuButton';
package/dist/index.js CHANGED
@@ -103326,10 +103326,13 @@ BreadCrumb.displayName = "BreadCrumb";
103326
103326
 
103327
103327
  //#endregion
103328
103328
  //#region src/icons/IconLoading.tsx
103329
- const IconLoading = (props) => /* @__PURE__ */ jsxs("svg", {
103329
+ const IconLoading = ({ className,...props }) => /* @__PURE__ */ jsxs("svg", {
103330
103330
  "data-component": "button",
103331
103331
  "data-testid": "loading-svg-button",
103332
103332
  viewBox: "0 0 256 256",
103333
+ width: "1em",
103334
+ height: "1em",
103335
+ className,
103333
103336
  ...props,
103334
103337
  children: [
103335
103338
  /* @__PURE__ */ jsx("line", {
@@ -103423,22 +103426,22 @@ const buttonVariants = {
103423
103426
 
103424
103427
  //#endregion
103425
103428
  //#region src/components/button/index.tsx
103426
- const Button = forwardRef(({ type = "button", variant = "primary", ariaLabel, block = false, isLoading = false, icon: iconFromProps = null, iconRight = false, onClick, className, children, dataTestId,...props }, ref) => {
103427
- const icon = isLoading ? /* @__PURE__ */ jsx(IconLoading, { className: "animate-spin-slow mr-2 stroke-current" }) : iconFromProps;
103428
- const formattedIcon = formatIcon(icon, { className: clsx_default("size-[1.125rem]", {
103429
+ function Button({ type = "button", variant = "primary", ariaLabel, block = false, isLoading = false, icon: iconFromProps = null, iconRight = false, onClick, className, children, dataTestId,...props }) {
103430
+ const loadingIcon = /* @__PURE__ */ jsx(IconLoading, { className: "animate-spin-slow mr-2 stroke-current" });
103431
+ const icon = isLoading ? loadingIcon : iconFromProps;
103432
+ const formattedIcon = icon ? formatIcon(icon, { className: clsx_default({
103429
103433
  "-mr-2": iconRight,
103430
103434
  "-ml-2": !iconRight
103431
- }) });
103435
+ }, icon === loadingIcon ? "text-current" : "size-[1.125rem]") }) : null;
103432
103436
  const handleOnClick = (event) => {
103433
- onClick && onClick(event);
103437
+ onClick?.(event);
103434
103438
  };
103435
103439
  return /* @__PURE__ */ jsxs("button", {
103436
103440
  type,
103437
103441
  "aria-label": ariaLabel,
103438
103442
  "data-testid": dataTestId,
103439
- className: cn(buttonVariants[variant], className, block && "w-full"),
103440
- onClick: (event) => handleOnClick(event),
103441
- ref,
103443
+ className: cn(buttonVariants[variant], className, block && "w-full text-sm"),
103444
+ onClick: handleOnClick,
103442
103445
  ...props,
103443
103446
  children: [
103444
103447
  !iconRight && formattedIcon,
@@ -103446,12 +103449,12 @@ const Button = forwardRef(({ type = "button", variant = "primary", ariaLabel, bl
103446
103449
  iconRight && formattedIcon
103447
103450
  ]
103448
103451
  });
103449
- });
103452
+ }
103450
103453
  Button.displayName = "Button";
103451
103454
 
103452
103455
  //#endregion
103453
103456
  //#region src/components/checkbox/index.tsx
103454
- const Checkbox = forwardRef(({ size: size$3 = "md", className, error: error$1, mediumBoldText, label, indeterminate = false, disabled = false,...props }, ref) => /* @__PURE__ */ jsxs("div", {
103457
+ const CheckboxComponent = ({ size: size$3 = "md", className, error: error$1, mediumBoldText, label, indeterminate = false, disabled = false,...props }, ref) => /* @__PURE__ */ jsxs("div", {
103455
103458
  className: cn("relative grid gap-2", className),
103456
103459
  children: [/* @__PURE__ */ jsxs("label", {
103457
103460
  className: cn("flex cursor-pointer items-center gap-3"),
@@ -103463,8 +103466,8 @@ const Checkbox = forwardRef(({ size: size$3 = "md", className, error: error$1, m
103463
103466
  type: "checkbox",
103464
103467
  "data-testid": "checkbox",
103465
103468
  disabled,
103466
- ref,
103467
- ...props
103469
+ ...props,
103470
+ ref
103468
103471
  }),
103469
103472
  /* @__PURE__ */ jsx("svg", {
103470
103473
  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"),
@@ -103502,17 +103505,35 @@ const Checkbox = forwardRef(({ size: size$3 = "md", className, error: error$1, m
103502
103505
  className: "text-xs font-normal text-red-500",
103503
103506
  children: error$1
103504
103507
  })]
103505
- }));
103506
- Checkbox.displayName = "Checkbox";
103508
+ });
103509
+ const Checkbox = forwardRef(CheckboxComponent);
103507
103510
 
103508
103511
  //#endregion
103509
103512
  //#region src/components/divider/index.tsx
103510
103513
  const Divider = ({ className,...props }) => /* @__PURE__ */ jsx("div", {
103511
103514
  "data-component": "divider",
103512
- className: clsx_default("block h-px w-full bg-[#CCCCCC]", className),
103515
+ className: clsx_default("block h-px w-full bg-gray-200", className),
103513
103516
  ...props
103514
103517
  });
103515
103518
 
103519
+ //#endregion
103520
+ //#region src/components/favouriteButton/index.tsx
103521
+ const FavouriteButton = forwardRef((props, ref) => {
103522
+ const { onClick, favourite, iconFilled, iconOutline, favouriteTitle, iconColorSelected = "text-pink", iconColor = "text-gray-800", iconSize, className = "", styleVariant = "transparent", children,...rest } = props;
103523
+ return /* @__PURE__ */ jsx(ActionIcon, {
103524
+ onClick,
103525
+ "data-component": "favouriteButton",
103526
+ title: favouriteTitle || "Favorite",
103527
+ styleVariant,
103528
+ className: `${favourite ? iconColorSelected : iconColor} ${className}`.trim(),
103529
+ iconSize,
103530
+ ref,
103531
+ icon: favourite ? iconFilled ?? /* @__PURE__ */ jsx(IconHeartFilled, {}) : iconOutline ?? /* @__PURE__ */ jsx(IconHeart, {}),
103532
+ ...rest,
103533
+ children
103534
+ });
103535
+ });
103536
+
103516
103537
  //#endregion
103517
103538
  //#region src/components/filters/FilterButton.tsx
103518
103539
  const FilterButton = ({ onClick, hasFilters, reset, filtersText, resetText }) => /* @__PURE__ */ jsxs("div", {
@@ -137799,37 +137820,8 @@ function isClassComponent(Component$1) {
137799
137820
  * @returns {boolean}
137800
137821
  */
137801
137822
  function isForwardRefComponent(Component$1) {
137802
- return !!(typeof Component$1 === "object" && Component$1.$$typeof && (Component$1.$$typeof.toString() === "Symbol(react.forward_ref)" || Component$1.$$typeof.description === "react.forward_ref"));
137803
- }
137804
- /**
137805
- * Check if a component is a memoized component.
137806
- * @param Component
137807
- * @returns {boolean}
137808
- */
137809
- function isMemoComponent(Component$1) {
137810
- return !!(typeof Component$1 === "object" && Component$1.$$typeof && (Component$1.$$typeof.toString() === "Symbol(react.memo)" || Component$1.$$typeof.description === "react.memo"));
137811
- }
137812
- /**
137813
- * Check if a component can safely receive a ref prop.
137814
- * This includes class components, forwardRef components, and memoized components
137815
- * that wrap forwardRef or class components.
137816
- * @param Component
137817
- * @returns {boolean}
137818
- */
137819
- function canReceiveRef(Component$1) {
137820
- if (isClassComponent(Component$1)) {
137821
- return true;
137822
- }
137823
- if (isForwardRefComponent(Component$1)) {
137824
- return true;
137825
- }
137826
- if (isMemoComponent(Component$1)) {
137827
- const wrappedComponent = Component$1.type;
137828
- if (wrappedComponent) {
137829
- return isClassComponent(wrappedComponent) || isForwardRefComponent(wrappedComponent);
137830
- }
137831
- }
137832
- return false;
137823
+ var _a;
137824
+ return !!(typeof Component$1 === "object" && ((_a = Component$1.$$typeof) === null || _a === void 0 ? void 0 : _a.toString()) === "Symbol(react.forward_ref)");
137833
137825
  }
137834
137826
  /**
137835
137827
  * Check if we're running React 19+ by detecting if function components support ref props
@@ -137887,15 +137879,19 @@ var ReactRenderer = class {
137887
137879
  const props = this.props;
137888
137880
  const editor = this.editor;
137889
137881
  const isReact19 = isReact19Plus();
137890
- const componentCanReceiveRef = canReceiveRef(Component$1);
137882
+ const isClassComp = isClassComponent(Component$1);
137883
+ const isForwardRefComp = isForwardRefComponent(Component$1);
137891
137884
  const elementProps = { ...props };
137892
- if (elementProps.ref && !(isReact19 || componentCanReceiveRef)) {
137893
- delete elementProps.ref;
137894
- }
137895
- if (!elementProps.ref && (isReact19 || componentCanReceiveRef)) {
137896
- elementProps.ref = (ref) => {
137897
- this.ref = ref;
137898
- };
137885
+ if (!elementProps.ref) {
137886
+ if (isReact19) {
137887
+ elementProps.ref = (ref) => {
137888
+ this.ref = ref;
137889
+ };
137890
+ } else if (isClassComp || isForwardRefComp) {
137891
+ elementProps.ref = (ref) => {
137892
+ this.ref = ref;
137893
+ };
137894
+ }
137899
137895
  }
137900
137896
  this.reactElement = React.createElement(Component$1, { ...elementProps });
137901
137897
  (_a = editor === null || editor === void 0 ? void 0 : editor.contentComponent) === null || _a === void 0 ? void 0 : _a.setRenderer(this.id, this);
@@ -140314,5 +140310,5 @@ const WysiwygEditor = forwardRef(({ id, content, className, placeholder, onChang
140314
140310
  });
140315
140311
 
140316
140312
  //#endregion
140317
- export { AccordionItem, AccordionWrapper, ActionIcon, Alert, AppleAppButtonIcon, AutoCompleteInput, Avatar, AvatarIndicator, Badge, BigBadge, BreadCrumb, Button, Checkbox, Divider, Filters, GoogleAppButtonIcon, HR, HamburgerMenuButton, Island, Label, LinkText, Loader, LogoBlack, Modal, NavButtons, NumberField, NumberedStepper, PageUnavailable, PasswordInput, Popover, ProgressBar, RadioButton, Rating, RegionSelector, Reviews, ScrollToTop, SearchInput, Select, SettingsCard, Skeleton, SkillPill, Stepper, StickyMobileButtonWrapper, Table, TableCell, TableHeader, TableHeaderItem, TableHeaderRow, TableRow, TextInput, Textarea, ThemeIcon, Toggle, Tooltip, TruncatedText, UnorderedList, UnorderedListItem, UnstyledButton, WysiwygEditor, buttonVariants };
140313
+ export { AccordionItem, AccordionWrapper, ActionIcon, Alert, AppleAppButtonIcon, AutoCompleteInput, Avatar, AvatarIndicator, Badge, BigBadge, BreadCrumb, Button, Checkbox, Divider, FavouriteButton, Filters, GoogleAppButtonIcon, HR, HamburgerMenuButton, Island, Label, LinkText, Loader, LogoBlack, Modal, NavButtons, NumberField, NumberedStepper, PageUnavailable, PasswordInput, Popover, ProgressBar, RadioButton, Rating, RegionSelector, Reviews, ScrollToTop, SearchInput, Select, SettingsCard, Skeleton, SkillPill, Stepper, StickyMobileButtonWrapper, Table, TableCell, TableHeader, TableHeaderItem, TableHeaderRow, TableRow, TextInput, Textarea, ThemeIcon, Toggle, Tooltip, TruncatedText, UnorderedList, UnorderedListItem, UnstyledButton, WysiwygEditor, buttonVariants };
140318
140314
  //# sourceMappingURL=index.js.map