@youngonesworks/ui 0.1.18 → 0.1.20
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/icons/IconLoading.d.ts +1 -1
- package/dist/index.cjs +117 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +116 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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,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
|
@@ -103322,76 +103322,15 @@ 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
|
-
const IconLoading = (props) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
103327
|
+
const IconLoading = ({ className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
103392
103328
|
"data-component": "button",
|
|
103393
103329
|
"data-testid": "loading-svg-button",
|
|
103394
103330
|
viewBox: "0 0 256 256",
|
|
103331
|
+
width: "1em",
|
|
103332
|
+
height: "1em",
|
|
103333
|
+
className,
|
|
103395
103334
|
...props,
|
|
103396
103335
|
children: [
|
|
103397
103336
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
@@ -103485,22 +103424,22 @@ const buttonVariants = {
|
|
|
103485
103424
|
|
|
103486
103425
|
//#endregion
|
|
103487
103426
|
//#region src/components/button/index.tsx
|
|
103488
|
-
|
|
103489
|
-
const
|
|
103490
|
-
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({
|
|
103491
103431
|
"-mr-2": iconRight,
|
|
103492
103432
|
"-ml-2": !iconRight
|
|
103493
|
-
}) });
|
|
103433
|
+
}, icon === loadingIcon ? "text-current" : "size-[1.125rem]") }) : null;
|
|
103494
103434
|
const handleOnClick = (event) => {
|
|
103495
|
-
onClick
|
|
103435
|
+
onClick?.(event);
|
|
103496
103436
|
};
|
|
103497
103437
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
103498
103438
|
type,
|
|
103499
103439
|
"aria-label": ariaLabel,
|
|
103500
103440
|
"data-testid": dataTestId,
|
|
103501
103441
|
className: cn(buttonVariants[variant], className, block && "w-full"),
|
|
103502
|
-
onClick:
|
|
103503
|
-
ref,
|
|
103442
|
+
onClick: handleOnClick,
|
|
103504
103443
|
...props,
|
|
103505
103444
|
children: [
|
|
103506
103445
|
!iconRight && formattedIcon,
|
|
@@ -103508,9 +103447,73 @@ const Button = (0, react.forwardRef)(({ type = "button", variant = "primary", ar
|
|
|
103508
103447
|
iconRight && formattedIcon
|
|
103509
103448
|
]
|
|
103510
103449
|
});
|
|
103511
|
-
}
|
|
103450
|
+
}
|
|
103512
103451
|
Button.displayName = "Button";
|
|
103513
103452
|
|
|
103453
|
+
//#endregion
|
|
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", {
|
|
103456
|
+
className: cn("relative grid gap-2", className),
|
|
103457
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
103458
|
+
className: cn("flex cursor-pointer items-center gap-3"),
|
|
103459
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
103460
|
+
className: cn("relative grid shrink-0 place-content-center", size$3 === "sm" ? "size-4" : "size-5"),
|
|
103461
|
+
children: [
|
|
103462
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
103463
|
+
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",
|
|
103464
|
+
type: "checkbox",
|
|
103465
|
+
"data-testid": "checkbox",
|
|
103466
|
+
disabled,
|
|
103467
|
+
ref,
|
|
103468
|
+
...props
|
|
103469
|
+
}),
|
|
103470
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
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"),
|
|
103472
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
103473
|
+
viewBox: "0 0 24 24",
|
|
103474
|
+
fill: "none",
|
|
103475
|
+
stroke: "currentColor",
|
|
103476
|
+
strokeWidth: "4",
|
|
103477
|
+
strokeLinecap: "round",
|
|
103478
|
+
strokeLinejoin: "round",
|
|
103479
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("polyline", { points: "20 6 9 17 4 12" })
|
|
103480
|
+
}),
|
|
103481
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
103482
|
+
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 }),
|
|
103483
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
103484
|
+
viewBox: "0 0 24 24",
|
|
103485
|
+
fill: "none",
|
|
103486
|
+
stroke: "currentColor",
|
|
103487
|
+
strokeWidth: "4",
|
|
103488
|
+
strokeLinecap: "round",
|
|
103489
|
+
strokeLinejoin: "round",
|
|
103490
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
|
|
103491
|
+
x1: "4",
|
|
103492
|
+
y1: "12",
|
|
103493
|
+
x2: "20",
|
|
103494
|
+
y2: "12"
|
|
103495
|
+
})
|
|
103496
|
+
})
|
|
103497
|
+
]
|
|
103498
|
+
}), label && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
103499
|
+
className: cn("grow text-sm font-normal", { "font-medium": mediumBoldText }),
|
|
103500
|
+
children: label
|
|
103501
|
+
})]
|
|
103502
|
+
}), error$1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("small", {
|
|
103503
|
+
className: "text-xs font-normal text-red-500",
|
|
103504
|
+
children: error$1
|
|
103505
|
+
})]
|
|
103506
|
+
}));
|
|
103507
|
+
Checkbox.displayName = "Checkbox";
|
|
103508
|
+
|
|
103509
|
+
//#endregion
|
|
103510
|
+
//#region src/components/divider/index.tsx
|
|
103511
|
+
const Divider = ({ className,...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
103512
|
+
"data-component": "divider",
|
|
103513
|
+
className: clsx_default("block h-px w-full bg-[#CCCCCC]", className),
|
|
103514
|
+
...props
|
|
103515
|
+
});
|
|
103516
|
+
|
|
103514
103517
|
//#endregion
|
|
103515
103518
|
//#region src/components/filters/FilterButton.tsx
|
|
103516
103519
|
const FilterButton = ({ onClick, hasFilters, reset, filtersText, resetText }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -137797,8 +137800,37 @@ function isClassComponent(Component$1) {
|
|
|
137797
137800
|
* @returns {boolean}
|
|
137798
137801
|
*/
|
|
137799
137802
|
function isForwardRefComponent(Component$1) {
|
|
137800
|
-
|
|
137801
|
-
|
|
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;
|
|
137802
137834
|
}
|
|
137803
137835
|
/**
|
|
137804
137836
|
* Check if we're running React 19+ by detecting if function components support ref props
|
|
@@ -137856,19 +137888,15 @@ var ReactRenderer = class {
|
|
|
137856
137888
|
const props = this.props;
|
|
137857
137889
|
const editor = this.editor;
|
|
137858
137890
|
const isReact19 = isReact19Plus();
|
|
137859
|
-
const
|
|
137860
|
-
const isForwardRefComp = isForwardRefComponent(Component$1);
|
|
137891
|
+
const componentCanReceiveRef = canReceiveRef(Component$1);
|
|
137861
137892
|
const elementProps = { ...props };
|
|
137862
|
-
if (
|
|
137863
|
-
|
|
137864
|
-
|
|
137865
|
-
|
|
137866
|
-
|
|
137867
|
-
|
|
137868
|
-
|
|
137869
|
-
this.ref = ref;
|
|
137870
|
-
};
|
|
137871
|
-
}
|
|
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
|
+
};
|
|
137872
137900
|
}
|
|
137873
137901
|
this.reactElement = react.default.createElement(Component$1, { ...elementProps });
|
|
137874
137902
|
(_a = editor === null || editor === void 0 ? void 0 : editor.contentComponent) === null || _a === void 0 ? void 0 : _a.setRenderer(this.id, this);
|
|
@@ -140298,6 +140326,7 @@ exports.AvatarIndicator = AvatarIndicator;
|
|
|
140298
140326
|
exports.Badge = Badge;
|
|
140299
140327
|
exports.BigBadge = BigBadge;
|
|
140300
140328
|
exports.BreadCrumb = BreadCrumb;
|
|
140329
|
+
exports.Button = Button;
|
|
140301
140330
|
exports.Checkbox = Checkbox;
|
|
140302
140331
|
exports.Divider = Divider;
|
|
140303
140332
|
exports.Filters = Filters;
|
|
@@ -140345,4 +140374,5 @@ exports.UnorderedList = UnorderedList;
|
|
|
140345
140374
|
exports.UnorderedListItem = UnorderedListItem;
|
|
140346
140375
|
exports.UnstyledButton = UnstyledButton;
|
|
140347
140376
|
exports.WysiwygEditor = WysiwygEditor;
|
|
140377
|
+
exports.buttonVariants = buttonVariants;
|
|
140348
140378
|
//# sourceMappingURL=index.cjs.map
|