@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/components/button/index.d.ts +6 -3
- package/dist/components/checkbox/index.d.ts +10 -8
- package/dist/components/favouriteButton/index.d.ts +6 -11
- package/dist/icons/IconLoading.d.ts +1 -1
- package/dist/index.cjs +54 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +52 -56
- package/dist/index.js.map +1 -1
- package/package.json +18 -10
- package/dist/components/calendar/index.d.ts +0 -0
- package/dist/components/checkbox/Checkbox.stories.d.ts +0 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
import { buttonVariants } from './buttonVariants';
|
|
3
|
-
interface
|
|
3
|
+
export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
|
|
4
4
|
variant?: keyof typeof buttonVariants;
|
|
5
5
|
ariaLabel?: string;
|
|
6
6
|
isLoading?: boolean;
|
|
@@ -8,6 +8,9 @@ interface IButton extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
8
8
|
dataTestId?: string;
|
|
9
9
|
icon?: ReactNode;
|
|
10
10
|
iconRight?: boolean;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare function Button({ type, variant, ariaLabel, block, isLoading, icon: iconFromProps, iconRight, onClick, className, children, dataTestId, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare namespace Button {
|
|
15
|
+
var displayName: string;
|
|
11
16
|
}
|
|
12
|
-
export declare const Button: import("react").ForwardRefExoticComponent<IButton & import("react").RefAttributes<HTMLButtonElement>>;
|
|
13
|
-
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
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
|
-
|
|
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:
|
|
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:
|
|
16
|
+
export declare const FavouriteButton: (props: IFavouriteButtonProps & {
|
|
17
|
+
ref?: React.Ref<HTMLButtonElement>;
|
|
18
|
+
}) => JSX.Element;
|
|
24
19
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type SVGProps } from 'react';
|
|
2
|
-
export declare const IconLoading: (props: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const IconLoading: ({ className, ...props }: SVGProps<SVGSVGElement>) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.cjs
CHANGED
|
@@ -103324,10 +103324,13 @@ BreadCrumb.displayName = "BreadCrumb";
|
|
|
103324
103324
|
|
|
103325
103325
|
//#endregion
|
|
103326
103326
|
//#region src/icons/IconLoading.tsx
|
|
103327
|
-
const IconLoading = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
103327
|
+
const IconLoading = ({ className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
103328
103328
|
"data-component": "button",
|
|
103329
103329
|
"data-testid": "loading-svg-button",
|
|
103330
103330
|
viewBox: "0 0 256 256",
|
|
103331
|
+
width: "1em",
|
|
103332
|
+
height: "1em",
|
|
103333
|
+
className,
|
|
103331
103334
|
...props,
|
|
103332
103335
|
children: [
|
|
103333
103336
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
@@ -103421,22 +103424,22 @@ const buttonVariants = {
|
|
|
103421
103424
|
|
|
103422
103425
|
//#endregion
|
|
103423
103426
|
//#region src/components/button/index.tsx
|
|
103424
|
-
|
|
103425
|
-
const
|
|
103426
|
-
const
|
|
103427
|
+
function Button({ type = "button", variant = "primary", ariaLabel, block = false, isLoading = false, icon: iconFromProps = null, iconRight = false, onClick, className, children, dataTestId,...props }) {
|
|
103428
|
+
const loadingIcon = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconLoading, { className: "animate-spin-slow mr-2 stroke-current" });
|
|
103429
|
+
const icon = isLoading ? loadingIcon : iconFromProps;
|
|
103430
|
+
const formattedIcon = icon ? formatIcon(icon, { className: clsx_default({
|
|
103427
103431
|
"-mr-2": iconRight,
|
|
103428
103432
|
"-ml-2": !iconRight
|
|
103429
|
-
}) });
|
|
103433
|
+
}, icon === loadingIcon ? "text-current" : "size-[1.125rem]") }) : null;
|
|
103430
103434
|
const handleOnClick = (event) => {
|
|
103431
|
-
onClick
|
|
103435
|
+
onClick?.(event);
|
|
103432
103436
|
};
|
|
103433
103437
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
103434
103438
|
type,
|
|
103435
103439
|
"aria-label": ariaLabel,
|
|
103436
103440
|
"data-testid": dataTestId,
|
|
103437
|
-
className: cn(buttonVariants[variant], className, block && "w-full"),
|
|
103438
|
-
onClick:
|
|
103439
|
-
ref,
|
|
103441
|
+
className: cn(buttonVariants[variant], className, block && "w-full text-sm"),
|
|
103442
|
+
onClick: handleOnClick,
|
|
103440
103443
|
...props,
|
|
103441
103444
|
children: [
|
|
103442
103445
|
!iconRight && formattedIcon,
|
|
@@ -103444,12 +103447,12 @@ const Button = (0, react.forwardRef)(({ type = "button", variant = "primary", ar
|
|
|
103444
103447
|
iconRight && formattedIcon
|
|
103445
103448
|
]
|
|
103446
103449
|
});
|
|
103447
|
-
}
|
|
103450
|
+
}
|
|
103448
103451
|
Button.displayName = "Button";
|
|
103449
103452
|
|
|
103450
103453
|
//#endregion
|
|
103451
103454
|
//#region src/components/checkbox/index.tsx
|
|
103452
|
-
const
|
|
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", {
|
|
103453
103456
|
className: cn("relative grid gap-2", className),
|
|
103454
103457
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
103455
103458
|
className: cn("flex cursor-pointer items-center gap-3"),
|
|
@@ -103461,8 +103464,8 @@ const Checkbox = (0, react.forwardRef)(({ size: size$3 = "md", className, error:
|
|
|
103461
103464
|
type: "checkbox",
|
|
103462
103465
|
"data-testid": "checkbox",
|
|
103463
103466
|
disabled,
|
|
103464
|
-
|
|
103465
|
-
|
|
103467
|
+
...props,
|
|
103468
|
+
ref
|
|
103466
103469
|
}),
|
|
103467
103470
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
103468
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"),
|
|
@@ -103500,17 +103503,35 @@ const Checkbox = (0, react.forwardRef)(({ size: size$3 = "md", className, error:
|
|
|
103500
103503
|
className: "text-xs font-normal text-red-500",
|
|
103501
103504
|
children: error$1
|
|
103502
103505
|
})]
|
|
103503
|
-
})
|
|
103504
|
-
Checkbox
|
|
103506
|
+
});
|
|
103507
|
+
const Checkbox = (0, react.forwardRef)(CheckboxComponent);
|
|
103505
103508
|
|
|
103506
103509
|
//#endregion
|
|
103507
103510
|
//#region src/components/divider/index.tsx
|
|
103508
103511
|
const Divider = ({ className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
103509
103512
|
"data-component": "divider",
|
|
103510
|
-
className: clsx_default("block h-px w-full bg-
|
|
103513
|
+
className: clsx_default("block h-px w-full bg-gray-200", className),
|
|
103511
103514
|
...props
|
|
103512
103515
|
});
|
|
103513
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
|
+
|
|
103514
103535
|
//#endregion
|
|
103515
103536
|
//#region src/components/filters/FilterButton.tsx
|
|
103516
103537
|
const FilterButton = ({ onClick, hasFilters, reset, filtersText, resetText }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -111924,9 +111945,9 @@ var jsx = function jsx$3(type, props) {
|
|
|
111924
111945
|
}
|
|
111925
111946
|
return react.createElement.apply(null, createElementArgArray);
|
|
111926
111947
|
};
|
|
111927
|
-
(function(_jsx$
|
|
111948
|
+
(function(_jsx$66) {
|
|
111928
111949
|
var JSX;
|
|
111929
|
-
(function(_JSX) {})(JSX || (JSX = _jsx$
|
|
111950
|
+
(function(_JSX) {})(JSX || (JSX = _jsx$66.JSX || (_jsx$66.JSX = {})));
|
|
111930
111951
|
})(jsx || (jsx = {}));
|
|
111931
111952
|
var Global = /* @__PURE__ */ withEmotionCache(function(props, cache) {
|
|
111932
111953
|
var styles = props.styles;
|
|
@@ -137797,37 +137818,8 @@ function isClassComponent(Component$1) {
|
|
|
137797
137818
|
* @returns {boolean}
|
|
137798
137819
|
*/
|
|
137799
137820
|
function isForwardRefComponent(Component$1) {
|
|
137800
|
-
|
|
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;
|
|
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)");
|
|
137831
137823
|
}
|
|
137832
137824
|
/**
|
|
137833
137825
|
* Check if we're running React 19+ by detecting if function components support ref props
|
|
@@ -137885,15 +137877,19 @@ var ReactRenderer = class {
|
|
|
137885
137877
|
const props = this.props;
|
|
137886
137878
|
const editor = this.editor;
|
|
137887
137879
|
const isReact19 = isReact19Plus();
|
|
137888
|
-
const
|
|
137880
|
+
const isClassComp = isClassComponent(Component$1);
|
|
137881
|
+
const isForwardRefComp = isForwardRefComponent(Component$1);
|
|
137889
137882
|
const elementProps = { ...props };
|
|
137890
|
-
if (elementProps.ref
|
|
137891
|
-
|
|
137892
|
-
|
|
137893
|
-
|
|
137894
|
-
|
|
137895
|
-
|
|
137896
|
-
|
|
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
|
+
}
|
|
137897
137893
|
}
|
|
137898
137894
|
this.reactElement = react.default.createElement(Component$1, { ...elementProps });
|
|
137899
137895
|
(_a = editor === null || editor === void 0 ? void 0 : editor.contentComponent) === null || _a === void 0 ? void 0 : _a.setRenderer(this.id, this);
|
|
@@ -140326,6 +140322,7 @@ exports.BreadCrumb = BreadCrumb;
|
|
|
140326
140322
|
exports.Button = Button;
|
|
140327
140323
|
exports.Checkbox = Checkbox;
|
|
140328
140324
|
exports.Divider = Divider;
|
|
140325
|
+
exports.FavouriteButton = FavouriteButton;
|
|
140329
140326
|
exports.Filters = Filters;
|
|
140330
140327
|
exports.GoogleAppButtonIcon = GoogleAppButtonIcon;
|
|
140331
140328
|
exports.HR = HR;
|